ActionEnabling » History » Version 7

Chris Cannam, 2010-11-25 05:53 PM

1 1 Chris Cannam
h1. When actions should be enabled
2 1 Chris Cannam
3 1 Chris Cannam
h2. Simple cases
4 1 Chris Cannam
5 1 Chris Cannam
* *Open* - always
6 2 Chris Cannam
7 2 Chris Cannam
Apart from Open, everything depends in the first instance on having a valid local work path -- this will be assumed below.
8 2 Chris Cannam
9 1 Chris Cannam
* *Refresh* - always
10 1 Chris Cannam
* *Preview* - whenever a remote URL is set
11 1 Chris Cannam
* *Pull* - whenever a remote URL is set
12 1 Chris Cannam
* *Push* - whenever a remote URL is set
13 2 Chris Cannam
14 2 Chris Cannam
h2. More complicated things
15 2 Chris Cannam
16 2 Chris Cannam
* *Revert* - whenever a file has been modified, added, or removed since commit
17 2 Chris Cannam
* *Commit* - whenever a file has been modified, added, or removed since commit
18 2 Chris Cannam
19 4 Chris Cannam
Some of the remaining functions look like they should behave differently depending on whether the Work tab or History tab is active.  However, I think that's probably confusing -- they should behave the same regardless of which tab is selected; that behaviour should be the "most obvious" behaviour where possible; and they should notify you quite clearly of what you are about to do in a confirmation dialog (which should be the same dialog as asks for your commit message, if appropriate).
20 2 Chris Cannam
21 4 Chris Cannam
Generally speaking, when I've characterised in the past behaviour as varying by tab, that's because I've been imagining having a separate selection in both tabs.  But I think that's wrong -- there should be no selection in the History tab.  If you want to use a specific changeset in a function, there should be a right-button menu for that.  There are no "beginner" functions that need a specific changeset, only "expert" ones.
22 2 Chris Cannam
23 4 Chris Cannam
* *Add* - when at least one untracked file is selected, and no other files are
24 4 Chris Cannam
* *Remove* - when at least one tracked file is selected, and no untracked files are
25 1 Chris Cannam
26 4 Chris Cannam
N.B. the latter implies we need to be able to show unmodified, tracked files.
27 4 Chris Cannam
28 5 Chris Cannam
* *Update* - in principle, should be active only when current branch has something to update to.  In practice that may be too complicated, so probably just make it active always.
29 5 Chris Cannam
30 5 Chris Cannam
* *Merge* - only when the current branch has more than one head? otherwise, use context menu in History tab
31 5 Chris Cannam
32 5 Chris Cannam
Review this.
33 5 Chris Cannam
34 1 Chris Cannam
h3. Diff
35 2 Chris Cannam
36 4 Chris Cannam
* *No changes since commit* - inactive
37 2 Chris Cannam
* *No modified files selected* - show diff for folder against parent
38 2 Chris Cannam
* *Modified files selected* - show diff for files against parent
39 2 Chris Cannam
40 4 Chris Cannam
h2. Functions currently missing entirely
41 2 Chris Cannam
42 4 Chris Cannam
* *Create branch*
43 4 Chris Cannam
* *Tag*
44 4 Chris Cannam
* *Rename*
45 6 Chris Cannam
46 6 Chris Cannam
h2. How to determine some things
47 6 Chris Cannam
48 6 Chris Cannam
h3. Whether a default merge makes sense:
49 6 Chris Cannam
50 6 Chris Cannam
@hg heads `hg branch`@
51 6 Chris Cannam
52 6 Chris Cannam
and see whether (a) exactly two heads are returned and (b) the current revision is one of them.
53 6 Chris Cannam
54 6 Chris Cannam
h3. Whether a no-args update would do anything:
55 6 Chris Cannam
56 6 Chris Cannam
@hg heads `hg branch`@
57 6 Chris Cannam
58 7 Chris Cannam
and see whether the current parent is _not_ among the returned heads.  (what if more than one parent?)