comparison src/hgaction.h @ 370:b9c153e00e84

Move source files to src/
author Chris Cannam
date Thu, 24 Mar 2011 10:27:51 +0000
parents hgaction.h@4cd753e083cc
children 470829a21f98
comparison
equal deleted inserted replaced
369:19cce6d2c470 370:b9c153e00e84
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) 2011 Chris Cannam
9 Copyright (c) 2011 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_TEST_HG,
28 ACT_TEST_HG_EXT,
29 ACT_QUERY_PATHS,
30 ACT_QUERY_BRANCH,
31 ACT_STAT,
32 ACT_RESOLVE_LIST,
33 ACT_QUERY_HEADS,
34 ACT_QUERY_PARENTS,
35 ACT_LOG,
36 ACT_LOG_INCREMENTAL,
37 ACT_REMOVE,
38 ACT_ADD,
39 ACT_INCOMING,
40 ACT_PUSH,
41 ACT_PULL,
42 ACT_CLONEFROMREMOTE,
43 ACT_INIT,
44 ACT_COMMIT,
45 ACT_ANNOTATE,
46 ACT_UNCOMMITTED_SUMMARY,
47 ACT_DIFF_SUMMARY,
48 ACT_FOLDERDIFF,
49 ACT_CHGSETDIFF,
50 ACT_UPDATE,
51 ACT_REVERT,
52 ACT_MERGE,
53 ACT_SERVE,
54 ACT_RESOLVE_MARK,
55 ACT_RETRY_MERGE,
56 ACT_TAG,
57 ACT_NEW_BRANCH,
58 ACT_HG_IGNORE,
59 ACT_COPY_FILE,
60 ACT_RENAME_FILE
61 };
62
63 struct HgAction
64 {
65 HGACTIONS action;
66 QString workingDir;
67 QStringList params;
68 QString executable; // empty for normal Hg, but gets filled in by hgrunner
69 void *extraData;
70
71 HgAction() : action(ACT_NONE) { }
72
73 HgAction(HGACTIONS _action, QString _wd, QStringList _params) :
74 action(_action), workingDir(_wd), params(_params), extraData(0) { }
75
76 HgAction(HGACTIONS _action, QString _wd, QStringList _params, void *_d) :
77 action(_action), workingDir(_wd), params(_params), extraData(_d) { }
78
79 bool operator==(const HgAction &a) {
80 return (a.action == action && a.workingDir == workingDir &&
81 a.params == params && a.executable == executable &&
82 a.extraData == extraData);
83 }
84
85 bool shouldBeFast() const {
86 switch (action) {
87 case ACT_NONE:
88 case ACT_TEST_HG:
89 case ACT_TEST_HG_EXT:
90 case ACT_QUERY_PATHS:
91 case ACT_QUERY_BRANCH:
92 case ACT_STAT:
93 case ACT_RESOLVE_LIST:
94 case ACT_QUERY_HEADS:
95 case ACT_QUERY_PARENTS:
96 case ACT_LOG_INCREMENTAL:
97 return true;
98 default:
99 return false;
100 }
101 }
102
103 bool mayBeInteractive() const {
104 switch (action) {
105 case ACT_TEST_HG_EXT: // so we force the module load to be tested
106 case ACT_INCOMING:
107 case ACT_PUSH:
108 case ACT_PULL:
109 case ACT_CLONEFROMREMOTE:
110 case ACT_FOLDERDIFF:
111 case ACT_CHGSETDIFF:
112 case ACT_SERVE:
113 return true;
114 default:
115 return false;
116 }
117 }
118 };
119
120 #endif