comparison hgaction.h @ 109:1721c580c10e

* Add a queueing mechanism for Hg actions, instead of refusing to start an action if something else is already happening. This is essential now that actions can be prompted by asynchronous events (e.g. filesystem watcher). * Make Revert behave sensibly
author Chris Cannam
date Fri, 26 Nov 2010 12:48:29 +0000
parents
children 0f039d3cc38e
comparison
equal deleted inserted replaced
108:8ae3b44c0073 109:1721c580c10e
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 EasyMercurial
5
6 Based on HgExplorer by Jari Korhonen
7 Copyright (c) 2010 Jari Korhonen
8 Copyright (c) 2010 Chris Cannam
9 Copyright (c) 2010 Queen Mary, University of London
10
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2 of the
14 License, or (at your option) any later version. See the file
15 COPYING included with this distribution for more information.
16 */
17
18 #ifndef HGACTION_H
19 #define HGACTION_H
20
21 #include <QString>
22 #include <QStringList>
23
24 enum HGACTIONS
25 {
26 ACT_NONE,
27 ACT_QUERY_PATHS,
28 ACT_QUERY_BRANCH,
29 ACT_STAT,
30 ACT_QUERY_HEADS,
31 ACT_QUERY_PARENTS,
32 ACT_LOG,
33 ACT_REMOVE,
34 ACT_ADD,
35 ACT_INCOMING,
36 ACT_PUSH,
37 ACT_PULL,
38 ACT_CLONEFROMREMOTE,
39 ACT_INIT,
40 ACT_COMMIT,
41 ACT_ANNOTATE,
42 ACT_FILEDIFF,
43 ACT_FOLDERDIFF,
44 ACT_CHGSETDIFF,
45 ACT_UPDATE,
46 ACT_REVERT,
47 ACT_MERGE,
48 ACT_RESOLVE_LIST,
49 ACT_SERVE,
50 ACT_RESOLVE_MARK,
51 ACT_RETRY_MERGE,
52 ACT_TAG,
53 ACT_HG_IGNORE,
54 };
55
56 struct HgAction
57 {
58 HGACTIONS action;
59 QString workingDir;
60 QStringList params;
61
62 QString executable; // empty for normal Hg
63
64 HgAction() : action(ACT_NONE) { }
65
66 HgAction(HGACTIONS _action, QString _wd, QStringList _params) :
67 action(_action), workingDir(_wd), params(_params) { }
68 /*
69 HgAction(const HgAction &a) :
70 action(a.action), workingDir(a.workingDir),
71 params(a.params), executable(a.executable) { }
72
73 HgAction &operator=(const HgAction &a) {
74 if (&a != this) {
75 action = a.action;
76 workingDir = a.workingDir;
77 params = a.params;
78 executable = a.executable;
79 }
80 return *this;
81 }
82 */
83 bool operator==(const HgAction &a) {
84 return (a.action == action && a.workingDir == workingDir &&
85 a.params == params && a.executable == executable);
86 }
87
88 bool mayBeInteractive() const {
89 switch (action) {
90 case ACT_INCOMING:
91 case ACT_PUSH:
92 case ACT_PULL:
93 case ACT_CLONEFROMREMOTE:
94 return true;
95 default:
96 return false;
97 }
98 }
99 };
100
101 #endif