Show More
@@ -1,135 +1,135 b'' | |||||
1 | # rewriteutil.py - utility functions for rewriting changesets |
|
1 | # rewriteutil.py - utility functions for rewriting changesets | |
2 | # |
|
2 | # | |
3 | # Copyright 2017 Octobus <contact@octobus.net> |
|
3 | # Copyright 2017 Octobus <contact@octobus.net> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from __future__ import absolute_import |
|
8 | from __future__ import absolute_import | |
9 |
|
9 | |||
10 | import re |
|
10 | import re | |
11 |
|
11 | |||
12 | from .i18n import _ |
|
12 | from .i18n import _ | |
13 |
|
13 | |||
14 | from . import ( |
|
14 | from . import ( | |
15 | error, |
|
15 | error, | |
16 | node, |
|
16 | node, | |
17 | obsolete, |
|
17 | obsolete, | |
18 | obsutil, |
|
18 | obsutil, | |
19 | revset, |
|
19 | revset, | |
20 | scmutil, |
|
20 | scmutil, | |
21 | ) |
|
21 | ) | |
22 |
|
22 | |||
23 |
|
23 | |||
24 | NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b') |
|
24 | NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b') | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | def precheck(repo, revs, action=b'rewrite'): |
|
27 | def precheck(repo, revs, action=b'rewrite'): | |
28 | """check if revs can be rewritten |
|
28 | """check if revs can be rewritten | |
29 | action is used to control the error message. |
|
29 | action is used to control the error message. | |
30 |
|
30 | |||
31 | Make sure this function is called after taking the lock. |
|
31 | Make sure this function is called after taking the lock. | |
32 | """ |
|
32 | """ | |
33 | if node.nullrev in revs: |
|
33 | if node.nullrev in revs: | |
34 | msg = _(b"cannot %s null changeset") % action |
|
34 | msg = _(b"cannot %s null changeset") % action | |
35 | hint = _(b"no changeset checked out") |
|
35 | hint = _(b"no changeset checked out") | |
36 |
raise error. |
|
36 | raise error.InputError(msg, hint=hint) | |
37 |
|
37 | |||
38 | if len(repo[None].parents()) > 1: |
|
38 | if len(repo[None].parents()) > 1: | |
39 |
raise error. |
|
39 | raise error.StateError(_(b"cannot %s while merging") % action) | |
40 |
|
40 | |||
41 | publicrevs = repo.revs(b'%ld and public()', revs) |
|
41 | publicrevs = repo.revs(b'%ld and public()', revs) | |
42 | if publicrevs: |
|
42 | if publicrevs: | |
43 | msg = _(b"cannot %s public changesets") % action |
|
43 | msg = _(b"cannot %s public changesets") % action | |
44 | hint = _(b"see 'hg help phases' for details") |
|
44 | hint = _(b"see 'hg help phases' for details") | |
45 |
raise error. |
|
45 | raise error.InputError(msg, hint=hint) | |
46 |
|
46 | |||
47 | newunstable = disallowednewunstable(repo, revs) |
|
47 | newunstable = disallowednewunstable(repo, revs) | |
48 | if newunstable: |
|
48 | if newunstable: | |
49 |
raise error. |
|
49 | raise error.InputError(_(b"cannot %s changeset with children") % action) | |
50 |
|
50 | |||
51 |
|
51 | |||
52 | def disallowednewunstable(repo, revs): |
|
52 | def disallowednewunstable(repo, revs): | |
53 | """Checks whether editing the revs will create new unstable changesets and |
|
53 | """Checks whether editing the revs will create new unstable changesets and | |
54 | are we allowed to create them. |
|
54 | are we allowed to create them. | |
55 |
|
55 | |||
56 | To allow new unstable changesets, set the config: |
|
56 | To allow new unstable changesets, set the config: | |
57 | `experimental.evolution.allowunstable=True` |
|
57 | `experimental.evolution.allowunstable=True` | |
58 | """ |
|
58 | """ | |
59 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) |
|
59 | allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt) | |
60 | if allowunstable: |
|
60 | if allowunstable: | |
61 | return revset.baseset() |
|
61 | return revset.baseset() | |
62 | return repo.revs(b"(%ld::) - %ld", revs, revs) |
|
62 | return repo.revs(b"(%ld::) - %ld", revs, revs) | |
63 |
|
63 | |||
64 |
|
64 | |||
65 | def skip_empty_successor(ui, command): |
|
65 | def skip_empty_successor(ui, command): | |
66 | empty_successor = ui.config(b'rewrite', b'empty-successor') |
|
66 | empty_successor = ui.config(b'rewrite', b'empty-successor') | |
67 | if empty_successor == b'skip': |
|
67 | if empty_successor == b'skip': | |
68 | return True |
|
68 | return True | |
69 | elif empty_successor == b'keep': |
|
69 | elif empty_successor == b'keep': | |
70 | return False |
|
70 | return False | |
71 | else: |
|
71 | else: | |
72 | raise error.ConfigError( |
|
72 | raise error.ConfigError( | |
73 | _( |
|
73 | _( | |
74 | b"%s doesn't know how to handle config " |
|
74 | b"%s doesn't know how to handle config " | |
75 | b"rewrite.empty-successor=%s (only 'skip' and 'keep' are " |
|
75 | b"rewrite.empty-successor=%s (only 'skip' and 'keep' are " | |
76 | b"supported)" |
|
76 | b"supported)" | |
77 | ) |
|
77 | ) | |
78 | % (command, empty_successor) |
|
78 | % (command, empty_successor) | |
79 | ) |
|
79 | ) | |
80 |
|
80 | |||
81 |
|
81 | |||
82 | def update_hash_refs(repo, commitmsg, pending=None): |
|
82 | def update_hash_refs(repo, commitmsg, pending=None): | |
83 | """Replace all obsolete commit hashes in the message with the current hash. |
|
83 | """Replace all obsolete commit hashes in the message with the current hash. | |
84 |
|
84 | |||
85 | If the obsolete commit was split or is divergent, the hash is not replaced |
|
85 | If the obsolete commit was split or is divergent, the hash is not replaced | |
86 | as there's no way to know which successor to choose. |
|
86 | as there's no way to know which successor to choose. | |
87 |
|
87 | |||
88 | For commands that update a series of commits in the current transaction, the |
|
88 | For commands that update a series of commits in the current transaction, the | |
89 | new obsolete markers can be considered by setting ``pending`` to a mapping |
|
89 | new obsolete markers can be considered by setting ``pending`` to a mapping | |
90 | of ``pending[oldnode] = [successor_node1, successor_node2,..]``. |
|
90 | of ``pending[oldnode] = [successor_node1, successor_node2,..]``. | |
91 | """ |
|
91 | """ | |
92 | if not pending: |
|
92 | if not pending: | |
93 | pending = {} |
|
93 | pending = {} | |
94 | cache = {} |
|
94 | cache = {} | |
95 | hashes = re.findall(NODE_RE, commitmsg) |
|
95 | hashes = re.findall(NODE_RE, commitmsg) | |
96 | unfi = repo.unfiltered() |
|
96 | unfi = repo.unfiltered() | |
97 | for h in hashes: |
|
97 | for h in hashes: | |
98 | fullnode = scmutil.resolvehexnodeidprefix(unfi, h) |
|
98 | fullnode = scmutil.resolvehexnodeidprefix(unfi, h) | |
99 | if fullnode is None: |
|
99 | if fullnode is None: | |
100 | continue |
|
100 | continue | |
101 | ctx = unfi[fullnode] |
|
101 | ctx = unfi[fullnode] | |
102 | if not ctx.obsolete(): |
|
102 | if not ctx.obsolete(): | |
103 | successors = pending.get(fullnode) |
|
103 | successors = pending.get(fullnode) | |
104 | if successors is None: |
|
104 | if successors is None: | |
105 | continue |
|
105 | continue | |
106 | # obsutil.successorssets() returns a list of list of nodes |
|
106 | # obsutil.successorssets() returns a list of list of nodes | |
107 | successors = [successors] |
|
107 | successors = [successors] | |
108 | else: |
|
108 | else: | |
109 | successors = obsutil.successorssets(repo, ctx.node(), cache=cache) |
|
109 | successors = obsutil.successorssets(repo, ctx.node(), cache=cache) | |
110 |
|
110 | |||
111 | # We can't make any assumptions about how to update the hash if the |
|
111 | # We can't make any assumptions about how to update the hash if the | |
112 | # cset in question was split or diverged. |
|
112 | # cset in question was split or diverged. | |
113 | if len(successors) == 1 and len(successors[0]) == 1: |
|
113 | if len(successors) == 1 and len(successors[0]) == 1: | |
114 | successor = successors[0][0] |
|
114 | successor = successors[0][0] | |
115 | if successor is not None: |
|
115 | if successor is not None: | |
116 | newhash = node.hex(successor) |
|
116 | newhash = node.hex(successor) | |
117 | commitmsg = commitmsg.replace(h, newhash[: len(h)]) |
|
117 | commitmsg = commitmsg.replace(h, newhash[: len(h)]) | |
118 | else: |
|
118 | else: | |
119 | repo.ui.note( |
|
119 | repo.ui.note( | |
120 | _( |
|
120 | _( | |
121 | b'The stale commit message reference to %s could ' |
|
121 | b'The stale commit message reference to %s could ' | |
122 | b'not be updated\n(The referenced commit was dropped)\n' |
|
122 | b'not be updated\n(The referenced commit was dropped)\n' | |
123 | ) |
|
123 | ) | |
124 | % h |
|
124 | % h | |
125 | ) |
|
125 | ) | |
126 | else: |
|
126 | else: | |
127 | repo.ui.note( |
|
127 | repo.ui.note( | |
128 | _( |
|
128 | _( | |
129 | b'The stale commit message reference to %s could ' |
|
129 | b'The stale commit message reference to %s could ' | |
130 | b'not be updated\n' |
|
130 | b'not be updated\n' | |
131 | ) |
|
131 | ) | |
132 | % h |
|
132 | % h | |
133 | ) |
|
133 | ) | |
134 |
|
134 | |||
135 | return commitmsg |
|
135 | return commitmsg |
@@ -1,531 +1,531 b'' | |||||
1 | #testcases obsstore-off obsstore-on |
|
1 | #testcases obsstore-off obsstore-on | |
2 |
|
2 | |||
3 | $ cat << EOF >> $HGRCPATH |
|
3 | $ cat << EOF >> $HGRCPATH | |
4 | > [extensions] |
|
4 | > [extensions] | |
5 | > amend= |
|
5 | > amend= | |
6 | > debugdrawdag=$TESTDIR/drawdag.py |
|
6 | > debugdrawdag=$TESTDIR/drawdag.py | |
7 | > [diff] |
|
7 | > [diff] | |
8 | > git=1 |
|
8 | > git=1 | |
9 | > EOF |
|
9 | > EOF | |
10 |
|
10 | |||
11 | #if obsstore-on |
|
11 | #if obsstore-on | |
12 | $ cat << EOF >> $HGRCPATH |
|
12 | $ cat << EOF >> $HGRCPATH | |
13 | > [experimental] |
|
13 | > [experimental] | |
14 | > evolution.createmarkers=True |
|
14 | > evolution.createmarkers=True | |
15 | > EOF |
|
15 | > EOF | |
16 | #endif |
|
16 | #endif | |
17 |
|
17 | |||
18 | Basic amend |
|
18 | Basic amend | |
19 |
|
19 | |||
20 | $ hg init repo1 |
|
20 | $ hg init repo1 | |
21 | $ cd repo1 |
|
21 | $ cd repo1 | |
22 | $ hg debugdrawdag <<'EOS' |
|
22 | $ hg debugdrawdag <<'EOS' | |
23 | > B |
|
23 | > B | |
24 | > | |
|
24 | > | | |
25 | > A |
|
25 | > A | |
26 | > EOS |
|
26 | > EOS | |
27 |
|
27 | |||
28 | $ hg update B -q |
|
28 | $ hg update B -q | |
29 | $ echo 2 >> B |
|
29 | $ echo 2 >> B | |
30 |
|
30 | |||
31 | $ hg amend |
|
31 | $ hg amend | |
32 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (obsstore-off !) |
|
32 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/112478962961-7e959a55-amend.hg (obsstore-off !) | |
33 | #if obsstore-off |
|
33 | #if obsstore-off | |
34 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
34 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' | |
35 | @ 1 be169c7e8dbe B |
|
35 | @ 1 be169c7e8dbe B | |
36 | | diff --git a/B b/B |
|
36 | | diff --git a/B b/B | |
37 | | new file mode 100644 |
|
37 | | new file mode 100644 | |
38 | | --- /dev/null |
|
38 | | --- /dev/null | |
39 | | +++ b/B |
|
39 | | +++ b/B | |
40 | | @@ -0,0 +1,1 @@ |
|
40 | | @@ -0,0 +1,1 @@ | |
41 | | +B2 |
|
41 | | +B2 | |
42 | | |
|
42 | | | |
43 | o 0 426bada5c675 A |
|
43 | o 0 426bada5c675 A | |
44 | diff --git a/A b/A |
|
44 | diff --git a/A b/A | |
45 | new file mode 100644 |
|
45 | new file mode 100644 | |
46 | --- /dev/null |
|
46 | --- /dev/null | |
47 | +++ b/A |
|
47 | +++ b/A | |
48 | @@ -0,0 +1,1 @@ |
|
48 | @@ -0,0 +1,1 @@ | |
49 | +A |
|
49 | +A | |
50 | \ No newline at end of file |
|
50 | \ No newline at end of file | |
51 |
|
51 | |||
52 | #else |
|
52 | #else | |
53 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' |
|
53 | $ hg log -p -G --hidden -T '{rev} {node|short} {desc}\n' | |
54 | @ 2 be169c7e8dbe B |
|
54 | @ 2 be169c7e8dbe B | |
55 | | diff --git a/B b/B |
|
55 | | diff --git a/B b/B | |
56 | | new file mode 100644 |
|
56 | | new file mode 100644 | |
57 | | --- /dev/null |
|
57 | | --- /dev/null | |
58 | | +++ b/B |
|
58 | | +++ b/B | |
59 | | @@ -0,0 +1,1 @@ |
|
59 | | @@ -0,0 +1,1 @@ | |
60 | | +B2 |
|
60 | | +B2 | |
61 | | |
|
61 | | | |
62 | | x 1 112478962961 B |
|
62 | | x 1 112478962961 B | |
63 | |/ diff --git a/B b/B |
|
63 | |/ diff --git a/B b/B | |
64 | | new file mode 100644 |
|
64 | | new file mode 100644 | |
65 | | --- /dev/null |
|
65 | | --- /dev/null | |
66 | | +++ b/B |
|
66 | | +++ b/B | |
67 | | @@ -0,0 +1,1 @@ |
|
67 | | @@ -0,0 +1,1 @@ | |
68 | | +B |
|
68 | | +B | |
69 | | \ No newline at end of file |
|
69 | | \ No newline at end of file | |
70 | | |
|
70 | | | |
71 | o 0 426bada5c675 A |
|
71 | o 0 426bada5c675 A | |
72 | diff --git a/A b/A |
|
72 | diff --git a/A b/A | |
73 | new file mode 100644 |
|
73 | new file mode 100644 | |
74 | --- /dev/null |
|
74 | --- /dev/null | |
75 | +++ b/A |
|
75 | +++ b/A | |
76 | @@ -0,0 +1,1 @@ |
|
76 | @@ -0,0 +1,1 @@ | |
77 | +A |
|
77 | +A | |
78 | \ No newline at end of file |
|
78 | \ No newline at end of file | |
79 |
|
79 | |||
80 | #endif |
|
80 | #endif | |
81 |
|
81 | |||
82 | Nothing changed |
|
82 | Nothing changed | |
83 |
|
83 | |||
84 | $ hg amend |
|
84 | $ hg amend | |
85 | nothing changed |
|
85 | nothing changed | |
86 | [1] |
|
86 | [1] | |
87 |
|
87 | |||
88 | $ hg amend -d "0 0" |
|
88 | $ hg amend -d "0 0" | |
89 | nothing changed |
|
89 | nothing changed | |
90 | [1] |
|
90 | [1] | |
91 |
|
91 | |||
92 | $ hg amend -d "Thu Jan 01 00:00:00 1970 UTC" |
|
92 | $ hg amend -d "Thu Jan 01 00:00:00 1970 UTC" | |
93 | nothing changed |
|
93 | nothing changed | |
94 | [1] |
|
94 | [1] | |
95 |
|
95 | |||
96 | #if obsstore-on |
|
96 | #if obsstore-on | |
97 | $ hg init repo-merge-state |
|
97 | $ hg init repo-merge-state | |
98 | $ cd repo-merge-state |
|
98 | $ cd repo-merge-state | |
99 | $ echo a > f |
|
99 | $ echo a > f | |
100 | $ hg ci -Aqm a |
|
100 | $ hg ci -Aqm a | |
101 | $ echo b > f |
|
101 | $ echo b > f | |
102 | $ hg ci -Aqm b |
|
102 | $ hg ci -Aqm b | |
103 | $ echo c > f |
|
103 | $ echo c > f | |
104 | $ hg co -m '.^' |
|
104 | $ hg co -m '.^' | |
105 | merging f |
|
105 | merging f | |
106 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') |
|
106 | warning: conflicts while merging f! (edit, then use 'hg resolve --mark') | |
107 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
107 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
108 | use 'hg resolve' to retry unresolved file merges |
|
108 | use 'hg resolve' to retry unresolved file merges | |
109 | [1] |
|
109 | [1] | |
110 | $ echo d > f |
|
110 | $ echo d > f | |
111 | $ hg resolve -m f |
|
111 | $ hg resolve -m f | |
112 | (no more unresolved files) |
|
112 | (no more unresolved files) | |
113 | $ hg ci --amend --config experimental.evolution.allowunstable=True |
|
113 | $ hg ci --amend --config experimental.evolution.allowunstable=True | |
114 | 1 new orphan changesets |
|
114 | 1 new orphan changesets | |
115 | $ hg resolve -l |
|
115 | $ hg resolve -l | |
116 | $ cd .. |
|
116 | $ cd .. | |
117 | #endif |
|
117 | #endif | |
118 |
|
118 | |||
119 | Matcher and metadata options |
|
119 | Matcher and metadata options | |
120 |
|
120 | |||
121 | $ echo 3 > C |
|
121 | $ echo 3 > C | |
122 | $ echo 4 > D |
|
122 | $ echo 4 > D | |
123 | $ hg add C D |
|
123 | $ hg add C D | |
124 | $ hg amend -m NEWMESSAGE -I C |
|
124 | $ hg amend -m NEWMESSAGE -I C | |
125 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (obsstore-off !) |
|
125 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/be169c7e8dbe-7684ddc5-amend.hg (obsstore-off !) | |
126 | $ hg log -r . -T '{node|short} {desc} {files}\n' |
|
126 | $ hg log -r . -T '{node|short} {desc} {files}\n' | |
127 | c7ba14d9075b NEWMESSAGE B C |
|
127 | c7ba14d9075b NEWMESSAGE B C | |
128 | $ echo 5 > E |
|
128 | $ echo 5 > E | |
129 | $ rm C |
|
129 | $ rm C | |
130 | $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D |
|
130 | $ hg amend -d '2000 1000' -u 'Foo <foo@example.com>' -A C D | |
131 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (obsstore-off !) |
|
131 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (obsstore-off !) | |
132 | $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n' |
|
132 | $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n' | |
133 | 14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000 |
|
133 | 14f6c4bcc865 NEWMESSAGE B D Foo <foo@example.com> 2000.01000 | |
134 |
|
134 | |||
135 | Amend with editor |
|
135 | Amend with editor | |
136 |
|
136 | |||
137 | $ cat > $TESTTMP/prefix.sh <<'EOF' |
|
137 | $ cat > $TESTTMP/prefix.sh <<'EOF' | |
138 | > printf 'EDITED: ' > $TESTTMP/msg |
|
138 | > printf 'EDITED: ' > $TESTTMP/msg | |
139 | > cat "$1" >> $TESTTMP/msg |
|
139 | > cat "$1" >> $TESTTMP/msg | |
140 | > mv $TESTTMP/msg "$1" |
|
140 | > mv $TESTTMP/msg "$1" | |
141 | > EOF |
|
141 | > EOF | |
142 | $ chmod +x $TESTTMP/prefix.sh |
|
142 | $ chmod +x $TESTTMP/prefix.sh | |
143 |
|
143 | |||
144 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit |
|
144 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend --edit | |
145 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (obsstore-off !) |
|
145 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/14f6c4bcc865-6591f15d-amend.hg (obsstore-off !) | |
146 | $ hg log -r . -T '{node|short} {desc}\n' |
|
146 | $ hg log -r . -T '{node|short} {desc}\n' | |
147 | 298f085230c3 EDITED: NEWMESSAGE |
|
147 | 298f085230c3 EDITED: NEWMESSAGE | |
148 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG |
|
148 | $ HGEDITOR="sh $TESTTMP/prefix.sh" hg amend -e -m MSG | |
149 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (obsstore-off !) |
|
149 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/298f085230c3-d81a6ad3-amend.hg (obsstore-off !) | |
150 | $ hg log -r . -T '{node|short} {desc}\n' |
|
150 | $ hg log -r . -T '{node|short} {desc}\n' | |
151 | 974f07f28537 EDITED: MSG |
|
151 | 974f07f28537 EDITED: MSG | |
152 |
|
152 | |||
153 | $ echo FOO > $TESTTMP/msg |
|
153 | $ echo FOO > $TESTTMP/msg | |
154 | $ hg amend -l $TESTTMP/msg -m BAR |
|
154 | $ hg amend -l $TESTTMP/msg -m BAR | |
155 | abort: cannot specify both --message and --logfile |
|
155 | abort: cannot specify both --message and --logfile | |
156 | [10] |
|
156 | [10] | |
157 | $ hg amend -l $TESTTMP/msg |
|
157 | $ hg amend -l $TESTTMP/msg | |
158 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !) |
|
158 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/974f07f28537-edb6470a-amend.hg (obsstore-off !) | |
159 | $ hg log -r . -T '{node|short} {desc}\n' |
|
159 | $ hg log -r . -T '{node|short} {desc}\n' | |
160 | 507be9bdac71 FOO |
|
160 | 507be9bdac71 FOO | |
161 |
|
161 | |||
162 | Interactive mode |
|
162 | Interactive mode | |
163 |
|
163 | |||
164 | $ touch F G |
|
164 | $ touch F G | |
165 | $ hg add F G |
|
165 | $ hg add F G | |
166 | $ cat <<EOS | hg amend -i --config ui.interactive=1 |
|
166 | $ cat <<EOS | hg amend -i --config ui.interactive=1 | |
167 | > y |
|
167 | > y | |
168 | > n |
|
168 | > n | |
169 | > EOS |
|
169 | > EOS | |
170 | diff --git a/F b/F |
|
170 | diff --git a/F b/F | |
171 | new file mode 100644 |
|
171 | new file mode 100644 | |
172 | examine changes to 'F'? |
|
172 | examine changes to 'F'? | |
173 | (enter ? for help) [Ynesfdaq?] y |
|
173 | (enter ? for help) [Ynesfdaq?] y | |
174 |
|
174 | |||
175 | diff --git a/G b/G |
|
175 | diff --git a/G b/G | |
176 | new file mode 100644 |
|
176 | new file mode 100644 | |
177 | examine changes to 'G'? |
|
177 | examine changes to 'G'? | |
178 | (enter ? for help) [Ynesfdaq?] n |
|
178 | (enter ? for help) [Ynesfdaq?] n | |
179 |
|
179 | |||
180 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !) |
|
180 | saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/507be9bdac71-c8077452-amend.hg (obsstore-off !) | |
181 | $ hg log -r . -T '{files}\n' |
|
181 | $ hg log -r . -T '{files}\n' | |
182 | B D F |
|
182 | B D F | |
183 |
|
183 | |||
184 | Amend in the middle of a stack |
|
184 | Amend in the middle of a stack | |
185 |
|
185 | |||
186 | $ hg init $TESTTMP/repo2 |
|
186 | $ hg init $TESTTMP/repo2 | |
187 | $ cd $TESTTMP/repo2 |
|
187 | $ cd $TESTTMP/repo2 | |
188 | $ hg debugdrawdag <<'EOS' |
|
188 | $ hg debugdrawdag <<'EOS' | |
189 | > C |
|
189 | > C | |
190 | > | |
|
190 | > | | |
191 | > B |
|
191 | > B | |
192 | > | |
|
192 | > | | |
193 | > A |
|
193 | > A | |
194 | > EOS |
|
194 | > EOS | |
195 |
|
195 | |||
196 | $ hg update -q B |
|
196 | $ hg update -q B | |
197 | $ echo 2 >> B |
|
197 | $ echo 2 >> B | |
198 | $ hg amend |
|
198 | $ hg amend | |
199 | abort: cannot amend changeset with children |
|
199 | abort: cannot amend changeset with children | |
200 |
[ |
|
200 | [10] | |
201 |
|
201 | |||
202 | #if obsstore-on |
|
202 | #if obsstore-on | |
203 |
|
203 | |||
204 | With allowunstable, amend could work in the middle of a stack |
|
204 | With allowunstable, amend could work in the middle of a stack | |
205 |
|
205 | |||
206 | $ cat >> $HGRCPATH <<EOF |
|
206 | $ cat >> $HGRCPATH <<EOF | |
207 | > [experimental] |
|
207 | > [experimental] | |
208 | > evolution.createmarkers=True |
|
208 | > evolution.createmarkers=True | |
209 | > evolution.allowunstable=True |
|
209 | > evolution.allowunstable=True | |
210 | > EOF |
|
210 | > EOF | |
211 |
|
211 | |||
212 | $ hg amend |
|
212 | $ hg amend | |
213 | 1 new orphan changesets |
|
213 | 1 new orphan changesets | |
214 | $ hg log -T '{rev} {node|short} {desc}\n' -G |
|
214 | $ hg log -T '{rev} {node|short} {desc}\n' -G | |
215 | @ 3 be169c7e8dbe B |
|
215 | @ 3 be169c7e8dbe B | |
216 | | |
|
216 | | | |
217 | | * 2 26805aba1e60 C |
|
217 | | * 2 26805aba1e60 C | |
218 | | | |
|
218 | | | | |
219 | | x 1 112478962961 B |
|
219 | | x 1 112478962961 B | |
220 | |/ |
|
220 | |/ | |
221 | o 0 426bada5c675 A |
|
221 | o 0 426bada5c675 A | |
222 |
|
222 | |||
223 | Checking the note stored in the obsmarker |
|
223 | Checking the note stored in the obsmarker | |
224 |
|
224 | |||
225 | $ echo foo > bar |
|
225 | $ echo foo > bar | |
226 | $ hg add bar |
|
226 | $ hg add bar | |
227 | $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy' |
|
227 | $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy' | |
228 | abort: cannot store a note of more than 255 bytes |
|
228 | abort: cannot store a note of more than 255 bytes | |
229 | [10] |
|
229 | [10] | |
230 | $ hg amend --note "adding bar" |
|
230 | $ hg amend --note "adding bar" | |
231 | $ hg debugobsolete -r . |
|
231 | $ hg debugobsolete -r . | |
232 | 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'} |
|
232 | 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'} | |
233 | be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'} |
|
233 | be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'} | |
234 | #endif |
|
234 | #endif | |
235 |
|
235 | |||
236 | Cannot amend public changeset |
|
236 | Cannot amend public changeset | |
237 |
|
237 | |||
238 | $ hg phase -r A --public |
|
238 | $ hg phase -r A --public | |
239 | $ hg update -C -q A |
|
239 | $ hg update -C -q A | |
240 | $ hg amend -m AMEND |
|
240 | $ hg amend -m AMEND | |
241 | abort: cannot amend public changesets |
|
241 | abort: cannot amend public changesets | |
242 | (see 'hg help phases' for details) |
|
242 | (see 'hg help phases' for details) | |
243 |
[ |
|
243 | [10] | |
244 |
|
244 | |||
245 | Amend a merge changeset |
|
245 | Amend a merge changeset | |
246 |
|
246 | |||
247 | $ hg init $TESTTMP/repo3 |
|
247 | $ hg init $TESTTMP/repo3 | |
248 | $ cd $TESTTMP/repo3 |
|
248 | $ cd $TESTTMP/repo3 | |
249 | $ hg debugdrawdag <<'EOS' |
|
249 | $ hg debugdrawdag <<'EOS' | |
250 | > C |
|
250 | > C | |
251 | > /| |
|
251 | > /| | |
252 | > A B |
|
252 | > A B | |
253 | > EOS |
|
253 | > EOS | |
254 | $ hg update -q C |
|
254 | $ hg update -q C | |
255 | $ hg amend -m FOO |
|
255 | $ hg amend -m FOO | |
256 | saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !) |
|
256 | saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !) | |
257 | $ rm .hg/localtags |
|
257 | $ rm .hg/localtags | |
258 | $ hg log -G -T '{desc}\n' |
|
258 | $ hg log -G -T '{desc}\n' | |
259 | @ FOO |
|
259 | @ FOO | |
260 | |\ |
|
260 | |\ | |
261 | | o B |
|
261 | | o B | |
262 | | |
|
262 | | | |
263 | o A |
|
263 | o A | |
264 |
|
264 | |||
265 |
|
265 | |||
266 | More complete test for status changes (issue5732) |
|
266 | More complete test for status changes (issue5732) | |
267 | ------------------------------------------------- |
|
267 | ------------------------------------------------- | |
268 |
|
268 | |||
269 | Generates history of files having 3 states, r0_r1_wc: |
|
269 | Generates history of files having 3 states, r0_r1_wc: | |
270 |
|
270 | |||
271 | r0: ground (content/missing) |
|
271 | r0: ground (content/missing) | |
272 | r1: old state to be amended (content/missing, where missing means removed) |
|
272 | r1: old state to be amended (content/missing, where missing means removed) | |
273 | wc: changes to be included in r1 (content/missing-tracked/untracked) |
|
273 | wc: changes to be included in r1 (content/missing-tracked/untracked) | |
274 |
|
274 | |||
275 | $ hg init $TESTTMP/wcstates |
|
275 | $ hg init $TESTTMP/wcstates | |
276 | $ cd $TESTTMP/wcstates |
|
276 | $ cd $TESTTMP/wcstates | |
277 |
|
277 | |||
278 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1 |
|
278 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1 | |
279 | $ hg addremove -q --similarity 0 |
|
279 | $ hg addremove -q --similarity 0 | |
280 | $ hg commit -m0 |
|
280 | $ hg commit -m0 | |
281 |
|
281 | |||
282 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2 |
|
282 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2 | |
283 | $ hg addremove -q --similarity 0 |
|
283 | $ hg addremove -q --similarity 0 | |
284 | $ hg commit -m1 |
|
284 | $ hg commit -m1 | |
285 |
|
285 | |||
286 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc |
|
286 | $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc | |
287 | $ hg addremove -q --similarity 0 |
|
287 | $ hg addremove -q --similarity 0 | |
288 | $ hg forget *_*_*-untracked |
|
288 | $ hg forget *_*_*-untracked | |
289 | $ rm *_*_missing-* |
|
289 | $ rm *_*_missing-* | |
290 |
|
290 | |||
291 | amend r1 to include wc changes |
|
291 | amend r1 to include wc changes | |
292 |
|
292 | |||
293 | $ hg amend |
|
293 | $ hg amend | |
294 | saved backup bundle to * (glob) (obsstore-off !) |
|
294 | saved backup bundle to * (glob) (obsstore-off !) | |
295 |
|
295 | |||
296 | clean/modified/removed/added states of the amended revision |
|
296 | clean/modified/removed/added states of the amended revision | |
297 |
|
297 | |||
298 | $ hg status --all --change . 'glob:content1_*_content1-tracked' |
|
298 | $ hg status --all --change . 'glob:content1_*_content1-tracked' | |
299 | C content1_content1_content1-tracked |
|
299 | C content1_content1_content1-tracked | |
300 | C content1_content2_content1-tracked |
|
300 | C content1_content2_content1-tracked | |
301 | C content1_missing_content1-tracked |
|
301 | C content1_missing_content1-tracked | |
302 | $ hg status --all --change . 'glob:content1_*_content[23]-tracked' |
|
302 | $ hg status --all --change . 'glob:content1_*_content[23]-tracked' | |
303 | M content1_content1_content3-tracked |
|
303 | M content1_content1_content3-tracked | |
304 | M content1_content2_content2-tracked |
|
304 | M content1_content2_content2-tracked | |
305 | M content1_content2_content3-tracked |
|
305 | M content1_content2_content3-tracked | |
306 | M content1_missing_content3-tracked |
|
306 | M content1_missing_content3-tracked | |
307 | $ hg status --all --change . 'glob:content1_*_missing-tracked' |
|
307 | $ hg status --all --change . 'glob:content1_*_missing-tracked' | |
308 | M content1_content2_missing-tracked |
|
308 | M content1_content2_missing-tracked | |
309 | R content1_missing_missing-tracked |
|
309 | R content1_missing_missing-tracked | |
310 | C content1_content1_missing-tracked |
|
310 | C content1_content1_missing-tracked | |
311 | $ hg status --all --change . 'glob:content1_*_*-untracked' |
|
311 | $ hg status --all --change . 'glob:content1_*_*-untracked' | |
312 | R content1_content1_content1-untracked |
|
312 | R content1_content1_content1-untracked | |
313 | R content1_content1_content3-untracked |
|
313 | R content1_content1_content3-untracked | |
314 | R content1_content1_missing-untracked |
|
314 | R content1_content1_missing-untracked | |
315 | R content1_content2_content1-untracked |
|
315 | R content1_content2_content1-untracked | |
316 | R content1_content2_content2-untracked |
|
316 | R content1_content2_content2-untracked | |
317 | R content1_content2_content3-untracked |
|
317 | R content1_content2_content3-untracked | |
318 | R content1_content2_missing-untracked |
|
318 | R content1_content2_missing-untracked | |
319 | R content1_missing_content1-untracked |
|
319 | R content1_missing_content1-untracked | |
320 | R content1_missing_content3-untracked |
|
320 | R content1_missing_content3-untracked | |
321 | R content1_missing_missing-untracked |
|
321 | R content1_missing_missing-untracked | |
322 | $ hg status --all --change . 'glob:missing_content2_*' |
|
322 | $ hg status --all --change . 'glob:missing_content2_*' | |
323 | A missing_content2_content2-tracked |
|
323 | A missing_content2_content2-tracked | |
324 | A missing_content2_content3-tracked |
|
324 | A missing_content2_content3-tracked | |
325 | A missing_content2_missing-tracked |
|
325 | A missing_content2_missing-tracked | |
326 | $ hg status --all --change . 'glob:missing_missing_*' |
|
326 | $ hg status --all --change . 'glob:missing_missing_*' | |
327 | A missing_missing_content3-tracked |
|
327 | A missing_missing_content3-tracked | |
328 |
|
328 | |||
329 | working directory should be all clean (with some missing/untracked files) |
|
329 | working directory should be all clean (with some missing/untracked files) | |
330 |
|
330 | |||
331 | $ hg status --all 'glob:*_content?-tracked' |
|
331 | $ hg status --all 'glob:*_content?-tracked' | |
332 | C content1_content1_content1-tracked |
|
332 | C content1_content1_content1-tracked | |
333 | C content1_content1_content3-tracked |
|
333 | C content1_content1_content3-tracked | |
334 | C content1_content2_content1-tracked |
|
334 | C content1_content2_content1-tracked | |
335 | C content1_content2_content2-tracked |
|
335 | C content1_content2_content2-tracked | |
336 | C content1_content2_content3-tracked |
|
336 | C content1_content2_content3-tracked | |
337 | C content1_missing_content1-tracked |
|
337 | C content1_missing_content1-tracked | |
338 | C content1_missing_content3-tracked |
|
338 | C content1_missing_content3-tracked | |
339 | C missing_content2_content2-tracked |
|
339 | C missing_content2_content2-tracked | |
340 | C missing_content2_content3-tracked |
|
340 | C missing_content2_content3-tracked | |
341 | C missing_missing_content3-tracked |
|
341 | C missing_missing_content3-tracked | |
342 | $ hg status --all 'glob:*_missing-tracked' |
|
342 | $ hg status --all 'glob:*_missing-tracked' | |
343 | ! content1_content1_missing-tracked |
|
343 | ! content1_content1_missing-tracked | |
344 | ! content1_content2_missing-tracked |
|
344 | ! content1_content2_missing-tracked | |
345 | ! content1_missing_missing-tracked |
|
345 | ! content1_missing_missing-tracked | |
346 | ! missing_content2_missing-tracked |
|
346 | ! missing_content2_missing-tracked | |
347 | ! missing_missing_missing-tracked |
|
347 | ! missing_missing_missing-tracked | |
348 | $ hg status --all 'glob:*-untracked' |
|
348 | $ hg status --all 'glob:*-untracked' | |
349 | ? content1_content1_content1-untracked |
|
349 | ? content1_content1_content1-untracked | |
350 | ? content1_content1_content3-untracked |
|
350 | ? content1_content1_content3-untracked | |
351 | ? content1_content2_content1-untracked |
|
351 | ? content1_content2_content1-untracked | |
352 | ? content1_content2_content2-untracked |
|
352 | ? content1_content2_content2-untracked | |
353 | ? content1_content2_content3-untracked |
|
353 | ? content1_content2_content3-untracked | |
354 | ? content1_missing_content1-untracked |
|
354 | ? content1_missing_content1-untracked | |
355 | ? content1_missing_content3-untracked |
|
355 | ? content1_missing_content3-untracked | |
356 | ? missing_content2_content2-untracked |
|
356 | ? missing_content2_content2-untracked | |
357 | ? missing_content2_content3-untracked |
|
357 | ? missing_content2_content3-untracked | |
358 | ? missing_missing_content3-untracked |
|
358 | ? missing_missing_content3-untracked | |
359 |
|
359 | |||
360 | ================================= |
|
360 | ================================= | |
361 | Test backup-bundle config option| |
|
361 | Test backup-bundle config option| | |
362 | ================================= |
|
362 | ================================= | |
363 | $ hg init $TESTTMP/repo4 |
|
363 | $ hg init $TESTTMP/repo4 | |
364 | $ cd $TESTTMP/repo4 |
|
364 | $ cd $TESTTMP/repo4 | |
365 | $ echo a>a |
|
365 | $ echo a>a | |
366 | $ hg ci -Aqma |
|
366 | $ hg ci -Aqma | |
367 | $ echo oops>b |
|
367 | $ echo oops>b | |
368 | $ hg ci -Aqm "b" |
|
368 | $ hg ci -Aqm "b" | |
369 | $ echo partiallyfixed > b |
|
369 | $ echo partiallyfixed > b | |
370 |
|
370 | |||
371 | #if obsstore-off |
|
371 | #if obsstore-off | |
372 | $ hg amend |
|
372 | $ hg amend | |
373 | saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg |
|
373 | saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg | |
374 | When backup-bundle config option is set: |
|
374 | When backup-bundle config option is set: | |
375 | $ cat << EOF >> $HGRCPATH |
|
375 | $ cat << EOF >> $HGRCPATH | |
376 | > [rewrite] |
|
376 | > [rewrite] | |
377 | > backup-bundle = False |
|
377 | > backup-bundle = False | |
378 | > EOF |
|
378 | > EOF | |
379 | $ echo fixed > b |
|
379 | $ echo fixed > b | |
380 | $ hg amend |
|
380 | $ hg amend | |
381 |
|
381 | |||
382 | #else |
|
382 | #else | |
383 | $ hg amend |
|
383 | $ hg amend | |
384 | When backup-bundle config option is set: |
|
384 | When backup-bundle config option is set: | |
385 | $ cat << EOF >> $HGRCPATH |
|
385 | $ cat << EOF >> $HGRCPATH | |
386 | > [rewrite] |
|
386 | > [rewrite] | |
387 | > backup-bundle = False |
|
387 | > backup-bundle = False | |
388 | > EOF |
|
388 | > EOF | |
389 | $ echo fixed > b |
|
389 | $ echo fixed > b | |
390 | $ hg amend |
|
390 | $ hg amend | |
391 |
|
391 | |||
392 | #endif |
|
392 | #endif | |
393 | ========================================== |
|
393 | ========================================== | |
394 | Test update-timestamp config option| |
|
394 | Test update-timestamp config option| | |
395 | ========================================== |
|
395 | ========================================== | |
396 |
|
396 | |||
397 | $ cat >> $HGRCPATH << EOF |
|
397 | $ cat >> $HGRCPATH << EOF | |
398 | > [extensions] |
|
398 | > [extensions] | |
399 | > amend= |
|
399 | > amend= | |
400 | > mockmakedate = $TESTDIR/mockmakedate.py |
|
400 | > mockmakedate = $TESTDIR/mockmakedate.py | |
401 | > EOF |
|
401 | > EOF | |
402 |
|
402 | |||
403 | $ hg init $TESTTMP/repo5 |
|
403 | $ hg init $TESTTMP/repo5 | |
404 | $ cd $TESTTMP/repo5 |
|
404 | $ cd $TESTTMP/repo5 | |
405 | $ cat <<'EOF' >> .hg/hgrc |
|
405 | $ cat <<'EOF' >> .hg/hgrc | |
406 | > [command-templates] |
|
406 | > [command-templates] | |
407 | > log = 'user: {user} |
|
407 | > log = 'user: {user} | |
408 | > date: {date|date} |
|
408 | > date: {date|date} | |
409 | > summary: {desc|firstline}\n' |
|
409 | > summary: {desc|firstline}\n' | |
410 | > EOF |
|
410 | > EOF | |
411 |
|
411 | |||
412 | $ echo a>a |
|
412 | $ echo a>a | |
413 | $ hg ci -Am 'commit 1' |
|
413 | $ hg ci -Am 'commit 1' | |
414 | adding a |
|
414 | adding a | |
415 |
|
415 | |||
416 | When updatetimestamp is False |
|
416 | When updatetimestamp is False | |
417 |
|
417 | |||
418 | $ hg amend --date '1997-1-1 0:1' |
|
418 | $ hg amend --date '1997-1-1 0:1' | |
419 | $ hg log --limit 1 |
|
419 | $ hg log --limit 1 | |
420 | user: test |
|
420 | user: test | |
421 | date: Wed Jan 01 00:01:00 1997 +0000 |
|
421 | date: Wed Jan 01 00:01:00 1997 +0000 | |
422 | summary: commit 1 |
|
422 | summary: commit 1 | |
423 |
|
423 | |||
424 | When update-timestamp is True and no other change than the date |
|
424 | When update-timestamp is True and no other change than the date | |
425 |
|
425 | |||
426 | $ hg amend --config rewrite.update-timestamp=True |
|
426 | $ hg amend --config rewrite.update-timestamp=True | |
427 | nothing changed |
|
427 | nothing changed | |
428 | [1] |
|
428 | [1] | |
429 | $ hg log --limit 1 |
|
429 | $ hg log --limit 1 | |
430 | user: test |
|
430 | user: test | |
431 | date: Wed Jan 01 00:01:00 1997 +0000 |
|
431 | date: Wed Jan 01 00:01:00 1997 +0000 | |
432 | summary: commit 1 |
|
432 | summary: commit 1 | |
433 |
|
433 | |||
434 | When update-timestamp is True and there is other change than the date |
|
434 | When update-timestamp is True and there is other change than the date | |
435 | $ hg amend --user foobar --config rewrite.update-timestamp=True |
|
435 | $ hg amend --user foobar --config rewrite.update-timestamp=True | |
436 | $ hg log --limit 1 |
|
436 | $ hg log --limit 1 | |
437 | user: foobar |
|
437 | user: foobar | |
438 | date: Thu Jan 01 00:00:02 1970 +0000 |
|
438 | date: Thu Jan 01 00:00:02 1970 +0000 | |
439 | summary: commit 1 |
|
439 | summary: commit 1 | |
440 |
|
440 | |||
441 | When date option is applicable and update-timestamp is True |
|
441 | When date option is applicable and update-timestamp is True | |
442 | $ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True |
|
442 | $ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True | |
443 | $ hg log --limit 1 |
|
443 | $ hg log --limit 1 | |
444 | user: foobar |
|
444 | user: foobar | |
445 | date: Thu Jan 01 00:01:00 1998 +0000 |
|
445 | date: Thu Jan 01 00:01:00 1998 +0000 | |
446 | summary: commit 1 |
|
446 | summary: commit 1 | |
447 |
|
447 | |||
448 | Unlike rewrite.update-timestamp, -D/--currentdate always updates the timestamp |
|
448 | Unlike rewrite.update-timestamp, -D/--currentdate always updates the timestamp | |
449 |
|
449 | |||
450 | $ hg amend -D |
|
450 | $ hg amend -D | |
451 | $ hg log --limit 1 |
|
451 | $ hg log --limit 1 | |
452 | user: foobar |
|
452 | user: foobar | |
453 | date: Thu Jan 01 00:00:04 1970 +0000 |
|
453 | date: Thu Jan 01 00:00:04 1970 +0000 | |
454 | summary: commit 1 |
|
454 | summary: commit 1 | |
455 |
|
455 | |||
456 | $ hg amend -D --config rewrite.update-timestamp=True |
|
456 | $ hg amend -D --config rewrite.update-timestamp=True | |
457 | $ hg log --limit 1 |
|
457 | $ hg log --limit 1 | |
458 | user: foobar |
|
458 | user: foobar | |
459 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
459 | date: Thu Jan 01 00:00:05 1970 +0000 | |
460 | summary: commit 1 |
|
460 | summary: commit 1 | |
461 |
|
461 | |||
462 | rewrite.update-timestamp can be negated by --no-currentdate |
|
462 | rewrite.update-timestamp can be negated by --no-currentdate | |
463 |
|
463 | |||
464 | $ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz |
|
464 | $ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz | |
465 | $ hg log --limit 1 |
|
465 | $ hg log --limit 1 | |
466 | user: baz |
|
466 | user: baz | |
467 | date: Thu Jan 01 00:00:05 1970 +0000 |
|
467 | date: Thu Jan 01 00:00:05 1970 +0000 | |
468 | summary: commit 1 |
|
468 | summary: commit 1 | |
469 |
|
469 | |||
470 | Bad combination of date options: |
|
470 | Bad combination of date options: | |
471 |
|
471 | |||
472 | $ hg amend -D --date '0 0' |
|
472 | $ hg amend -D --date '0 0' | |
473 | abort: cannot specify both --date and --currentdate |
|
473 | abort: cannot specify both --date and --currentdate | |
474 | [10] |
|
474 | [10] | |
475 |
|
475 | |||
476 | Close branch |
|
476 | Close branch | |
477 |
|
477 | |||
478 | $ hg amend --secret --close-branch |
|
478 | $ hg amend --secret --close-branch | |
479 | $ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n' |
|
479 | $ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n' | |
480 | close=1 |
|
480 | close=1 | |
481 | phase=secret |
|
481 | phase=secret | |
482 |
|
482 | |||
483 | $ cd .. |
|
483 | $ cd .. | |
484 |
|
484 | |||
485 | Corner case of amend from issue6157: |
|
485 | Corner case of amend from issue6157: | |
486 | - working copy parent has a change to file `a` |
|
486 | - working copy parent has a change to file `a` | |
487 | - working copy has the inverse change |
|
487 | - working copy has the inverse change | |
488 | - we amend the working copy parent for files other than `a` |
|
488 | - we amend the working copy parent for files other than `a` | |
489 | hg used to include the changes to `a` anyway. |
|
489 | hg used to include the changes to `a` anyway. | |
490 |
|
490 | |||
491 | $ hg init 6157; cd 6157 |
|
491 | $ hg init 6157; cd 6157 | |
492 | $ echo a > a; echo b > b; hg commit -qAm_ |
|
492 | $ echo a > a; echo b > b; hg commit -qAm_ | |
493 | $ echo a2 > a; hg commit -qm_ |
|
493 | $ echo a2 > a; hg commit -qm_ | |
494 | $ hg diff --stat -c . |
|
494 | $ hg diff --stat -c . | |
495 | a | 2 +- |
|
495 | a | 2 +- | |
496 | 1 files changed, 1 insertions(+), 1 deletions(-) |
|
496 | 1 files changed, 1 insertions(+), 1 deletions(-) | |
497 | $ echo a > a; echo b2 > b; hg amend -q b |
|
497 | $ echo a > a; echo b2 > b; hg amend -q b | |
498 | $ hg diff --stat -c . |
|
498 | $ hg diff --stat -c . | |
499 | a | 2 +- |
|
499 | a | 2 +- | |
500 | b | 2 +- |
|
500 | b | 2 +- | |
501 | 2 files changed, 2 insertions(+), 2 deletions(-) |
|
501 | 2 files changed, 2 insertions(+), 2 deletions(-) | |
502 |
|
502 | |||
503 | Modifying a file while the editor is open can cause dirstate corruption |
|
503 | Modifying a file while the editor is open can cause dirstate corruption | |
504 | (issue6233) |
|
504 | (issue6233) | |
505 |
|
505 | |||
506 | $ cd $TESTTMP |
|
506 | $ cd $TESTTMP | |
507 | $ hg init modify-during-amend; cd modify-during-amend |
|
507 | $ hg init modify-during-amend; cd modify-during-amend | |
508 | $ echo r0 > foo; hg commit -qAm "r0" |
|
508 | $ echo r0 > foo; hg commit -qAm "r0" | |
509 | $ echo alpha > foo; hg commit -qm "alpha" |
|
509 | $ echo alpha > foo; hg commit -qm "alpha" | |
510 | $ echo beta >> foo |
|
510 | $ echo beta >> foo | |
511 | $ cat > $TESTTMP/touchy_editor.sh <<EOF |
|
511 | $ cat > $TESTTMP/touchy_editor.sh <<EOF | |
512 | > sleep 1 |
|
512 | > sleep 1 | |
513 | > echo delta >> "$TESTTMP/modify-during-amend/foo" |
|
513 | > echo delta >> "$TESTTMP/modify-during-amend/foo" | |
514 | > sleep 1 |
|
514 | > sleep 1 | |
515 | > echo hi > "\$1" |
|
515 | > echo hi > "\$1" | |
516 | > sleep 1 |
|
516 | > sleep 1 | |
517 | > EOF |
|
517 | > EOF | |
518 | $ HGEDITOR="sh $TESTTMP/touchy_editor.sh" hg commit --amend |
|
518 | $ HGEDITOR="sh $TESTTMP/touchy_editor.sh" hg commit --amend | |
519 | $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then |
|
519 | $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then | |
520 | > echo "OK." |
|
520 | > echo "OK." | |
521 | > else |
|
521 | > else | |
522 | > echo "Bug detected. 'delta' is not part of the commit OR the wdir" |
|
522 | > echo "Bug detected. 'delta' is not part of the commit OR the wdir" | |
523 | > echo "Diff and status before rebuild:" |
|
523 | > echo "Diff and status before rebuild:" | |
524 | > hg diff |
|
524 | > hg diff | |
525 | > hg status |
|
525 | > hg status | |
526 | > hg debugrebuilddirstate |
|
526 | > hg debugrebuilddirstate | |
527 | > echo "Diff and status after rebuild:" |
|
527 | > echo "Diff and status after rebuild:" | |
528 | > hg diff |
|
528 | > hg diff | |
529 | > hg status |
|
529 | > hg status | |
530 | > fi |
|
530 | > fi | |
531 | OK. |
|
531 | OK. |
@@ -1,430 +1,430 b'' | |||||
1 | Testing changing branch on commits |
|
1 | Testing changing branch on commits | |
2 | ================================== |
|
2 | ================================== | |
3 |
|
3 | |||
4 | Setup |
|
4 | Setup | |
5 |
|
5 | |||
6 | $ cat >> $HGRCPATH << EOF |
|
6 | $ cat >> $HGRCPATH << EOF | |
7 | > [alias] |
|
7 | > [alias] | |
8 | > glog = log -G -T "{rev}:{node|short} {desc}\n{branch} ({bookmarks})" |
|
8 | > glog = log -G -T "{rev}:{node|short} {desc}\n{branch} ({bookmarks})" | |
9 | > [experimental] |
|
9 | > [experimental] | |
10 | > evolution = createmarkers |
|
10 | > evolution = createmarkers | |
11 | > [extensions] |
|
11 | > [extensions] | |
12 | > rebase= |
|
12 | > rebase= | |
13 | > EOF |
|
13 | > EOF | |
14 |
|
14 | |||
15 | $ hg init repo |
|
15 | $ hg init repo | |
16 | $ cd repo |
|
16 | $ cd repo | |
17 | $ for ch in a b c d e; do echo foo >> $ch; hg ci -Aqm "Added "$ch; done |
|
17 | $ for ch in a b c d e; do echo foo >> $ch; hg ci -Aqm "Added "$ch; done | |
18 | $ hg glog |
|
18 | $ hg glog | |
19 | @ 4:aa98ab95a928 Added e |
|
19 | @ 4:aa98ab95a928 Added e | |
20 | | default () |
|
20 | | default () | |
21 | o 3:62615734edd5 Added d |
|
21 | o 3:62615734edd5 Added d | |
22 | | default () |
|
22 | | default () | |
23 | o 2:28ad74487de9 Added c |
|
23 | o 2:28ad74487de9 Added c | |
24 | | default () |
|
24 | | default () | |
25 | o 1:29becc82797a Added b |
|
25 | o 1:29becc82797a Added b | |
26 | | default () |
|
26 | | default () | |
27 | o 0:18d04c59bb5d Added a |
|
27 | o 0:18d04c59bb5d Added a | |
28 | default () |
|
28 | default () | |
29 |
|
29 | |||
30 | $ hg branches |
|
30 | $ hg branches | |
31 | default 4:aa98ab95a928 |
|
31 | default 4:aa98ab95a928 | |
32 |
|
32 | |||
33 | Try without passing a new branch name |
|
33 | Try without passing a new branch name | |
34 |
|
34 | |||
35 | $ hg branch -r . |
|
35 | $ hg branch -r . | |
36 | abort: no branch name specified for the revisions |
|
36 | abort: no branch name specified for the revisions | |
37 | [10] |
|
37 | [10] | |
38 |
|
38 | |||
39 | Setting an invalid branch name |
|
39 | Setting an invalid branch name | |
40 |
|
40 | |||
41 | $ hg branch -r . a:b |
|
41 | $ hg branch -r . a:b | |
42 | abort: ':' cannot be used in a name |
|
42 | abort: ':' cannot be used in a name | |
43 | [10] |
|
43 | [10] | |
44 | $ hg branch -r . tip |
|
44 | $ hg branch -r . tip | |
45 | abort: the name 'tip' is reserved |
|
45 | abort: the name 'tip' is reserved | |
46 | [10] |
|
46 | [10] | |
47 | $ hg branch -r . 1234 |
|
47 | $ hg branch -r . 1234 | |
48 | abort: cannot use an integer as a name |
|
48 | abort: cannot use an integer as a name | |
49 | [10] |
|
49 | [10] | |
50 |
|
50 | |||
51 | Change on non-linear set of commits |
|
51 | Change on non-linear set of commits | |
52 |
|
52 | |||
53 | $ hg branch -r 2 -r 4 foo |
|
53 | $ hg branch -r 2 -r 4 foo | |
54 | abort: cannot change branch of non-linear revisions |
|
54 | abort: cannot change branch of non-linear revisions | |
55 | [10] |
|
55 | [10] | |
56 |
|
56 | |||
57 | Change in middle of the stack (linear commits) |
|
57 | Change in middle of the stack (linear commits) | |
58 |
|
58 | |||
59 | $ hg branch -r 1::3 foo |
|
59 | $ hg branch -r 1::3 foo | |
60 | abort: cannot change branch of changeset with children |
|
60 | abort: cannot change branch of changeset with children | |
61 |
[ |
|
61 | [10] | |
62 |
|
62 | |||
63 | Change with dirty working directory |
|
63 | Change with dirty working directory | |
64 |
|
64 | |||
65 | $ echo bar > a |
|
65 | $ echo bar > a | |
66 | $ hg branch -r . foo |
|
66 | $ hg branch -r . foo | |
67 | abort: uncommitted changes |
|
67 | abort: uncommitted changes | |
68 | [20] |
|
68 | [20] | |
69 |
|
69 | |||
70 | $ hg revert --all |
|
70 | $ hg revert --all | |
71 | reverting a |
|
71 | reverting a | |
72 |
|
72 | |||
73 | Change on empty revision set |
|
73 | Change on empty revision set | |
74 |
|
74 | |||
75 | $ hg branch -r 'draft() - all()' foo |
|
75 | $ hg branch -r 'draft() - all()' foo | |
76 | abort: empty revision set |
|
76 | abort: empty revision set | |
77 | [10] |
|
77 | [10] | |
78 |
|
78 | |||
79 | Changing branch on linear set of commits from head |
|
79 | Changing branch on linear set of commits from head | |
80 |
|
80 | |||
81 | Without obsmarkers |
|
81 | Without obsmarkers | |
82 |
|
82 | |||
83 | $ hg branch -r 3:4 foo --config experimental.evolution=! |
|
83 | $ hg branch -r 3:4 foo --config experimental.evolution=! | |
84 | changed branch on 2 changesets |
|
84 | changed branch on 2 changesets | |
85 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/62615734edd5-e86bd13a-branch-change.hg |
|
85 | saved backup bundle to $TESTTMP/repo/.hg/strip-backup/62615734edd5-e86bd13a-branch-change.hg | |
86 | $ hg glog |
|
86 | $ hg glog | |
87 | @ 4:3938acfb5c0f Added e |
|
87 | @ 4:3938acfb5c0f Added e | |
88 | | foo () |
|
88 | | foo () | |
89 | o 3:9435da006bdc Added d |
|
89 | o 3:9435da006bdc Added d | |
90 | | foo () |
|
90 | | foo () | |
91 | o 2:28ad74487de9 Added c |
|
91 | o 2:28ad74487de9 Added c | |
92 | | default () |
|
92 | | default () | |
93 | o 1:29becc82797a Added b |
|
93 | o 1:29becc82797a Added b | |
94 | | default () |
|
94 | | default () | |
95 | o 0:18d04c59bb5d Added a |
|
95 | o 0:18d04c59bb5d Added a | |
96 | default () |
|
96 | default () | |
97 |
|
97 | |||
98 | $ hg branches |
|
98 | $ hg branches | |
99 | foo 4:3938acfb5c0f |
|
99 | foo 4:3938acfb5c0f | |
100 | default 2:28ad74487de9 (inactive) |
|
100 | default 2:28ad74487de9 (inactive) | |
101 |
|
101 | |||
102 | With obsmarkers |
|
102 | With obsmarkers | |
103 |
|
103 | |||
104 | $ hg branch -r 3::4 bar |
|
104 | $ hg branch -r 3::4 bar | |
105 | changed branch on 2 changesets |
|
105 | changed branch on 2 changesets | |
106 | $ hg glog |
|
106 | $ hg glog | |
107 | @ 6:7c1991464886 Added e |
|
107 | @ 6:7c1991464886 Added e | |
108 | | bar () |
|
108 | | bar () | |
109 | o 5:1ea05e93925f Added d |
|
109 | o 5:1ea05e93925f Added d | |
110 | | bar () |
|
110 | | bar () | |
111 | o 2:28ad74487de9 Added c |
|
111 | o 2:28ad74487de9 Added c | |
112 | | default () |
|
112 | | default () | |
113 | o 1:29becc82797a Added b |
|
113 | o 1:29becc82797a Added b | |
114 | | default () |
|
114 | | default () | |
115 | o 0:18d04c59bb5d Added a |
|
115 | o 0:18d04c59bb5d Added a | |
116 | default () |
|
116 | default () | |
117 |
|
117 | |||
118 | $ hg branches |
|
118 | $ hg branches | |
119 | bar 6:7c1991464886 |
|
119 | bar 6:7c1991464886 | |
120 | default 2:28ad74487de9 (inactive) |
|
120 | default 2:28ad74487de9 (inactive) | |
121 |
|
121 | |||
122 | Change branch name to an existing branch |
|
122 | Change branch name to an existing branch | |
123 |
|
123 | |||
124 | $ hg branch -r . default |
|
124 | $ hg branch -r . default | |
125 | abort: a branch of the same name already exists |
|
125 | abort: a branch of the same name already exists | |
126 | [10] |
|
126 | [10] | |
127 |
|
127 | |||
128 | Changing on a branch head which is not topological head |
|
128 | Changing on a branch head which is not topological head | |
129 |
|
129 | |||
130 | $ hg branch -r 2 stable |
|
130 | $ hg branch -r 2 stable | |
131 | abort: cannot change branch of changeset with children |
|
131 | abort: cannot change branch of changeset with children | |
132 |
[ |
|
132 | [10] | |
133 |
|
133 | |||
134 | Enabling the allowunstable config and trying to change branch on a branch head |
|
134 | Enabling the allowunstable config and trying to change branch on a branch head | |
135 | which is not a topological head |
|
135 | which is not a topological head | |
136 |
|
136 | |||
137 | $ echo "[experimental]" >> .hg/hgrc |
|
137 | $ echo "[experimental]" >> .hg/hgrc | |
138 | $ echo "evolution.allowunstable=yes" >> .hg/hgrc |
|
138 | $ echo "evolution.allowunstable=yes" >> .hg/hgrc | |
139 | $ hg branch -r 2 foo |
|
139 | $ hg branch -r 2 foo | |
140 | changed branch on 1 changesets |
|
140 | changed branch on 1 changesets | |
141 | 2 new orphan changesets |
|
141 | 2 new orphan changesets | |
142 |
|
142 | |||
143 | Changing branch of an obsoleted changeset |
|
143 | Changing branch of an obsoleted changeset | |
144 |
|
144 | |||
145 | $ hg branch -r 4 foobar |
|
145 | $ hg branch -r 4 foobar | |
146 | abort: hidden revision '4' was rewritten as: 7c1991464886! |
|
146 | abort: hidden revision '4' was rewritten as: 7c1991464886! | |
147 | (use --hidden to access hidden revisions) |
|
147 | (use --hidden to access hidden revisions) | |
148 | [255] |
|
148 | [255] | |
149 |
|
149 | |||
150 | $ hg branch -r 4 --hidden foobar |
|
150 | $ hg branch -r 4 --hidden foobar | |
151 | abort: cannot change branch of a obsolete changeset |
|
151 | abort: cannot change branch of a obsolete changeset | |
152 | [10] |
|
152 | [10] | |
153 |
|
153 | |||
154 | Make sure bookmark movement is correct |
|
154 | Make sure bookmark movement is correct | |
155 |
|
155 | |||
156 | $ hg bookmark b1 |
|
156 | $ hg bookmark b1 | |
157 | $ hg glog -r '.^::' |
|
157 | $ hg glog -r '.^::' | |
158 | @ 6:7c1991464886 Added e |
|
158 | @ 6:7c1991464886 Added e | |
159 | | bar (b1) |
|
159 | | bar (b1) | |
160 | * 5:1ea05e93925f Added d |
|
160 | * 5:1ea05e93925f Added d | |
161 | | bar () |
|
161 | | bar () | |
162 | ~ |
|
162 | ~ | |
163 |
|
163 | |||
164 | $ hg branch -r '(.^)::' wat --debug |
|
164 | $ hg branch -r '(.^)::' wat --debug | |
165 | changing branch of '1ea05e93925f806d875a2163f9b76764be644636' from 'bar' to 'wat' |
|
165 | changing branch of '1ea05e93925f806d875a2163f9b76764be644636' from 'bar' to 'wat' | |
166 | committing files: |
|
166 | committing files: | |
167 | d |
|
167 | d | |
168 | committing manifest |
|
168 | committing manifest | |
169 | committing changelog |
|
169 | committing changelog | |
170 | new node id is 343660ccab7400da637bd6a211d07f413536d718 |
|
170 | new node id is 343660ccab7400da637bd6a211d07f413536d718 | |
171 | changing branch of '7c19914648869f5b02fc7fed31ddee9783fdd680' from 'bar' to 'wat' |
|
171 | changing branch of '7c19914648869f5b02fc7fed31ddee9783fdd680' from 'bar' to 'wat' | |
172 | committing files: |
|
172 | committing files: | |
173 | e |
|
173 | e | |
174 | committing manifest |
|
174 | committing manifest | |
175 | committing changelog |
|
175 | committing changelog | |
176 | new node id is de1404b45a69f8cc6437d7679033ee33e9efb4ba |
|
176 | new node id is de1404b45a69f8cc6437d7679033ee33e9efb4ba | |
177 | moving bookmarks ['b1'] from 7c19914648869f5b02fc7fed31ddee9783fdd680 to de1404b45a69f8cc6437d7679033ee33e9efb4ba |
|
177 | moving bookmarks ['b1'] from 7c19914648869f5b02fc7fed31ddee9783fdd680 to de1404b45a69f8cc6437d7679033ee33e9efb4ba | |
178 | resolving manifests |
|
178 | resolving manifests | |
179 | branchmerge: False, force: False, partial: False |
|
179 | branchmerge: False, force: False, partial: False | |
180 | ancestor: 7c1991464886, local: 7c1991464886+, remote: de1404b45a69 |
|
180 | ancestor: 7c1991464886, local: 7c1991464886+, remote: de1404b45a69 | |
181 | starting 4 threads for background file closing (?) |
|
181 | starting 4 threads for background file closing (?) | |
182 | changed branch on 2 changesets |
|
182 | changed branch on 2 changesets | |
183 | updating the branch cache |
|
183 | updating the branch cache | |
184 | invalid branch cache (served): tip differs |
|
184 | invalid branch cache (served): tip differs | |
185 |
|
185 | |||
186 | $ hg glog -r '(.^)::' |
|
186 | $ hg glog -r '(.^)::' | |
187 | @ 9:de1404b45a69 Added e |
|
187 | @ 9:de1404b45a69 Added e | |
188 | | wat (b1) |
|
188 | | wat (b1) | |
189 | * 8:343660ccab74 Added d |
|
189 | * 8:343660ccab74 Added d | |
190 | | wat () |
|
190 | | wat () | |
191 | ~ |
|
191 | ~ | |
192 |
|
192 | |||
193 | Make sure phase handling is correct |
|
193 | Make sure phase handling is correct | |
194 |
|
194 | |||
195 | $ echo foo >> bar |
|
195 | $ echo foo >> bar | |
196 | $ hg ci -Aqm "added bar" --secret |
|
196 | $ hg ci -Aqm "added bar" --secret | |
197 | 1 new orphan changesets |
|
197 | 1 new orphan changesets | |
198 | $ hg glog -r . |
|
198 | $ hg glog -r . | |
199 | @ 10:8ad1294c1660 added bar |
|
199 | @ 10:8ad1294c1660 added bar | |
200 | | wat (b1) |
|
200 | | wat (b1) | |
201 | ~ |
|
201 | ~ | |
202 | $ hg branch -r . secret |
|
202 | $ hg branch -r . secret | |
203 | changed branch on 1 changesets |
|
203 | changed branch on 1 changesets | |
204 | $ hg phase -r . |
|
204 | $ hg phase -r . | |
205 | 11: secret |
|
205 | 11: secret | |
206 |
|
206 | |||
207 | $ hg branches |
|
207 | $ hg branches | |
208 | secret 11:38a9b2d53f98 |
|
208 | secret 11:38a9b2d53f98 | |
209 | foo 7:8a4729a5e2b8 |
|
209 | foo 7:8a4729a5e2b8 | |
210 | wat 9:de1404b45a69 (inactive) |
|
210 | wat 9:de1404b45a69 (inactive) | |
211 | default 2:28ad74487de9 (inactive) |
|
211 | default 2:28ad74487de9 (inactive) | |
212 | $ hg branch |
|
212 | $ hg branch | |
213 | secret |
|
213 | secret | |
214 |
|
214 | |||
215 | Changing branch of another head, different from one on which we are |
|
215 | Changing branch of another head, different from one on which we are | |
216 |
|
216 | |||
217 | $ hg glog |
|
217 | $ hg glog | |
218 | @ 11:38a9b2d53f98 added bar |
|
218 | @ 11:38a9b2d53f98 added bar | |
219 | | secret (b1) |
|
219 | | secret (b1) | |
220 | * 9:de1404b45a69 Added e |
|
220 | * 9:de1404b45a69 Added e | |
221 | | wat () |
|
221 | | wat () | |
222 | * 8:343660ccab74 Added d |
|
222 | * 8:343660ccab74 Added d | |
223 | | wat () |
|
223 | | wat () | |
224 | | o 7:8a4729a5e2b8 Added c |
|
224 | | o 7:8a4729a5e2b8 Added c | |
225 | | | foo () |
|
225 | | | foo () | |
226 | x | 2:28ad74487de9 Added c |
|
226 | x | 2:28ad74487de9 Added c | |
227 | |/ default () |
|
227 | |/ default () | |
228 | o 1:29becc82797a Added b |
|
228 | o 1:29becc82797a Added b | |
229 | | default () |
|
229 | | default () | |
230 | o 0:18d04c59bb5d Added a |
|
230 | o 0:18d04c59bb5d Added a | |
231 | default () |
|
231 | default () | |
232 |
|
232 | |||
233 | $ hg branch |
|
233 | $ hg branch | |
234 | secret |
|
234 | secret | |
235 |
|
235 | |||
236 | $ hg branch -r 7 foobar |
|
236 | $ hg branch -r 7 foobar | |
237 | changed branch on 1 changesets |
|
237 | changed branch on 1 changesets | |
238 |
|
238 | |||
239 | The current branch must be preserved |
|
239 | The current branch must be preserved | |
240 | $ hg branch |
|
240 | $ hg branch | |
241 | secret |
|
241 | secret | |
242 |
|
242 | |||
243 | Changing branch on multiple heads at once |
|
243 | Changing branch on multiple heads at once | |
244 |
|
244 | |||
245 | $ hg rebase -s 8 -d 12 --keepbranches -q |
|
245 | $ hg rebase -s 8 -d 12 --keepbranches -q | |
246 |
|
246 | |||
247 | $ hg rebase -s 14 -d 1 --keepbranches -q |
|
247 | $ hg rebase -s 14 -d 1 --keepbranches -q | |
248 |
|
248 | |||
249 | $ hg branch -r 0: stable |
|
249 | $ hg branch -r 0: stable | |
250 | changed branch on 6 changesets |
|
250 | changed branch on 6 changesets | |
251 | $ hg glog |
|
251 | $ hg glog | |
252 | @ 23:6a5ddbcfb870 added bar |
|
252 | @ 23:6a5ddbcfb870 added bar | |
253 | | stable (b1) |
|
253 | | stable (b1) | |
254 | o 22:baedc6e98a67 Added e |
|
254 | o 22:baedc6e98a67 Added e | |
255 | | stable () |
|
255 | | stable () | |
256 | | o 21:99ac7bf8aad1 Added d |
|
256 | | o 21:99ac7bf8aad1 Added d | |
257 | | | stable () |
|
257 | | | stable () | |
258 | | o 20:0ecb4d39c4bd Added c |
|
258 | | o 20:0ecb4d39c4bd Added c | |
259 | |/ stable () |
|
259 | |/ stable () | |
260 | o 19:fd45b986b109 Added b |
|
260 | o 19:fd45b986b109 Added b | |
261 | | stable () |
|
261 | | stable () | |
262 | o 18:204d2769eca2 Added a |
|
262 | o 18:204d2769eca2 Added a | |
263 | stable () |
|
263 | stable () | |
264 |
|
264 | |||
265 | $ hg branches |
|
265 | $ hg branches | |
266 | stable 23:6a5ddbcfb870 |
|
266 | stable 23:6a5ddbcfb870 | |
267 |
|
267 | |||
268 | $ hg branch |
|
268 | $ hg branch | |
269 | stable |
|
269 | stable | |
270 |
|
270 | |||
271 | Changing to same branch is no-op |
|
271 | Changing to same branch is no-op | |
272 |
|
272 | |||
273 | $ hg branch -r 19::21 stable |
|
273 | $ hg branch -r 19::21 stable | |
274 | changed branch on 0 changesets |
|
274 | changed branch on 0 changesets | |
275 |
|
275 | |||
276 | Changing branch name to existing branch name if the branch of parent of root of |
|
276 | Changing branch name to existing branch name if the branch of parent of root of | |
277 | revs is same as the new branch name |
|
277 | revs is same as the new branch name | |
278 |
|
278 | |||
279 | $ hg branch -r 20::21 bugfix |
|
279 | $ hg branch -r 20::21 bugfix | |
280 | changed branch on 2 changesets |
|
280 | changed branch on 2 changesets | |
281 | $ hg glog |
|
281 | $ hg glog | |
282 | o 25:714defe1cf34 Added d |
|
282 | o 25:714defe1cf34 Added d | |
283 | | bugfix () |
|
283 | | bugfix () | |
284 | o 24:98394def28fc Added c |
|
284 | o 24:98394def28fc Added c | |
285 | | bugfix () |
|
285 | | bugfix () | |
286 | | @ 23:6a5ddbcfb870 added bar |
|
286 | | @ 23:6a5ddbcfb870 added bar | |
287 | | | stable (b1) |
|
287 | | | stable (b1) | |
288 | | o 22:baedc6e98a67 Added e |
|
288 | | o 22:baedc6e98a67 Added e | |
289 | |/ stable () |
|
289 | |/ stable () | |
290 | o 19:fd45b986b109 Added b |
|
290 | o 19:fd45b986b109 Added b | |
291 | | stable () |
|
291 | | stable () | |
292 | o 18:204d2769eca2 Added a |
|
292 | o 18:204d2769eca2 Added a | |
293 | stable () |
|
293 | stable () | |
294 |
|
294 | |||
295 | $ hg branch -r 24:25 stable |
|
295 | $ hg branch -r 24:25 stable | |
296 | changed branch on 2 changesets |
|
296 | changed branch on 2 changesets | |
297 | $ hg glog |
|
297 | $ hg glog | |
298 | o 27:4ec342341562 Added d |
|
298 | o 27:4ec342341562 Added d | |
299 | | stable () |
|
299 | | stable () | |
300 | o 26:83f48859c2de Added c |
|
300 | o 26:83f48859c2de Added c | |
301 | | stable () |
|
301 | | stable () | |
302 | | @ 23:6a5ddbcfb870 added bar |
|
302 | | @ 23:6a5ddbcfb870 added bar | |
303 | | | stable (b1) |
|
303 | | | stable (b1) | |
304 | | o 22:baedc6e98a67 Added e |
|
304 | | o 22:baedc6e98a67 Added e | |
305 | |/ stable () |
|
305 | |/ stable () | |
306 | o 19:fd45b986b109 Added b |
|
306 | o 19:fd45b986b109 Added b | |
307 | | stable () |
|
307 | | stable () | |
308 | o 18:204d2769eca2 Added a |
|
308 | o 18:204d2769eca2 Added a | |
309 | stable () |
|
309 | stable () | |
310 |
|
310 | |||
311 | Changing branch of a merge commit |
|
311 | Changing branch of a merge commit | |
312 |
|
312 | |||
313 | $ hg branch -q ghi |
|
313 | $ hg branch -q ghi | |
314 | $ echo f > f |
|
314 | $ echo f > f | |
315 | $ hg ci -qAm 'Added f' |
|
315 | $ hg ci -qAm 'Added f' | |
316 | $ hg up -q 27 |
|
316 | $ hg up -q 27 | |
317 | $ hg branch -q jkl |
|
317 | $ hg branch -q jkl | |
318 | $ echo g > g |
|
318 | $ echo g > g | |
319 | $ hg ci -qAm 'Added g' |
|
319 | $ hg ci -qAm 'Added g' | |
320 | $ hg glog -r 'heads(:)' |
|
320 | $ hg glog -r 'heads(:)' | |
321 | @ 29:6bc1c6c2c9da Added g |
|
321 | @ 29:6bc1c6c2c9da Added g | |
322 | | jkl () |
|
322 | | jkl () | |
323 | ~ |
|
323 | ~ | |
324 | o 28:2f1019bd29d2 Added f |
|
324 | o 28:2f1019bd29d2 Added f | |
325 | | ghi (b1) |
|
325 | | ghi (b1) | |
326 | ~ |
|
326 | ~ | |
327 |
|
327 | |||
328 | $ hg branch -q default |
|
328 | $ hg branch -q default | |
329 | $ hg merge -r 28 |
|
329 | $ hg merge -r 28 | |
330 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
330 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
331 | (branch merge, don't forget to commit) |
|
331 | (branch merge, don't forget to commit) | |
332 | $ hg branch -r . abcd |
|
332 | $ hg branch -r . abcd | |
333 | abort: outstanding uncommitted merge |
|
333 | abort: outstanding uncommitted merge | |
334 | [20] |
|
334 | [20] | |
335 |
|
335 | |||
336 | $ hg ci -m "Merge commit" |
|
336 | $ hg ci -m "Merge commit" | |
337 | $ hg glog -r 'parents(.)::' |
|
337 | $ hg glog -r 'parents(.)::' | |
338 | @ 30:4d56e6b1eb6b Merge commit |
|
338 | @ 30:4d56e6b1eb6b Merge commit | |
339 | |\ default () |
|
339 | |\ default () | |
340 | | o 29:6bc1c6c2c9da Added g |
|
340 | | o 29:6bc1c6c2c9da Added g | |
341 | | | jkl () |
|
341 | | | jkl () | |
342 | | ~ |
|
342 | | ~ | |
343 | o 28:2f1019bd29d2 Added f |
|
343 | o 28:2f1019bd29d2 Added f | |
344 | | ghi (b1) |
|
344 | | ghi (b1) | |
345 | ~ |
|
345 | ~ | |
346 |
|
346 | |||
347 | $ hg branch -r . ghi |
|
347 | $ hg branch -r . ghi | |
348 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
348 | 0 files updated, 0 files merged, 4 files removed, 0 files unresolved | |
349 | changed branch on 1 changesets |
|
349 | changed branch on 1 changesets | |
350 | $ hg branch -r . jkl |
|
350 | $ hg branch -r . jkl | |
351 | changed branch on 1 changesets |
|
351 | changed branch on 1 changesets | |
352 | $ hg branch -r . default |
|
352 | $ hg branch -r . default | |
353 | changed branch on 1 changesets |
|
353 | changed branch on 1 changesets | |
354 | $ hg branch -r . stable |
|
354 | $ hg branch -r . stable | |
355 | abort: a branch of the same name already exists |
|
355 | abort: a branch of the same name already exists | |
356 | [10] |
|
356 | [10] | |
357 |
|
357 | |||
358 | $ hg branch -r . stable --force |
|
358 | $ hg branch -r . stable --force | |
359 | changed branch on 1 changesets |
|
359 | changed branch on 1 changesets | |
360 | $ hg branches |
|
360 | $ hg branches | |
361 | stable 34:d1c2addda4a2 |
|
361 | stable 34:d1c2addda4a2 | |
362 | jkl 29:6bc1c6c2c9da (inactive) |
|
362 | jkl 29:6bc1c6c2c9da (inactive) | |
363 | ghi 28:2f1019bd29d2 (inactive) |
|
363 | ghi 28:2f1019bd29d2 (inactive) | |
364 |
|
364 | |||
365 | Changing branch on public changeset |
|
365 | Changing branch on public changeset | |
366 |
|
366 | |||
367 | $ hg phase -r . -p |
|
367 | $ hg phase -r . -p | |
368 | $ hg branch -r . def |
|
368 | $ hg branch -r . def | |
369 | abort: cannot change branch of public changesets |
|
369 | abort: cannot change branch of public changesets | |
370 | (see 'hg help phases' for details) |
|
370 | (see 'hg help phases' for details) | |
371 |
[ |
|
371 | [10] | |
372 |
|
372 | |||
373 | Merge commit with conflicts, with evolution and without |
|
373 | Merge commit with conflicts, with evolution and without | |
374 |
|
374 | |||
375 | $ mklozenge() { |
|
375 | $ mklozenge() { | |
376 | > echo foo > a |
|
376 | > echo foo > a | |
377 | > hg ci -qAm foo |
|
377 | > hg ci -qAm foo | |
378 | > echo bar > a |
|
378 | > echo bar > a | |
379 | > hg ci -qm bar |
|
379 | > hg ci -qm bar | |
380 | > hg up -q '.^' |
|
380 | > hg up -q '.^' | |
381 | > echo baz > a |
|
381 | > echo baz > a | |
382 | > hg ci -qm baz |
|
382 | > hg ci -qm baz | |
383 | > hg merge -q -t :local |
|
383 | > hg merge -q -t :local | |
384 | > echo neither > a |
|
384 | > echo neither > a | |
385 | > hg ci -qm neither |
|
385 | > hg ci -qm neither | |
386 | > } |
|
386 | > } | |
387 |
|
387 | |||
388 | $ cd .. |
|
388 | $ cd .. | |
389 | $ hg init merge-with-evolution |
|
389 | $ hg init merge-with-evolution | |
390 | $ cd merge-with-evolution |
|
390 | $ cd merge-with-evolution | |
391 | $ mklozenge |
|
391 | $ mklozenge | |
392 |
|
392 | |||
393 | $ hg branch -r '(.^)::' abc |
|
393 | $ hg branch -r '(.^)::' abc | |
394 | changed branch on 2 changesets |
|
394 | changed branch on 2 changesets | |
395 | $ hg glog |
|
395 | $ hg glog | |
396 | @ 5:c07fa8b34d54 neither |
|
396 | @ 5:c07fa8b34d54 neither | |
397 | |\ abc () |
|
397 | |\ abc () | |
398 | | o 4:f2aa51777cc9 baz |
|
398 | | o 4:f2aa51777cc9 baz | |
399 | | | abc () |
|
399 | | | abc () | |
400 | o | 1:2e33c4f0856b bar |
|
400 | o | 1:2e33c4f0856b bar | |
401 | |/ default () |
|
401 | |/ default () | |
402 | o 0:91cfb6004abf foo |
|
402 | o 0:91cfb6004abf foo | |
403 | default () |
|
403 | default () | |
404 | $ hg cat a |
|
404 | $ hg cat a | |
405 | neither |
|
405 | neither | |
406 |
|
406 | |||
407 | $ cd .. |
|
407 | $ cd .. | |
408 | $ hg init merge-without-evolution |
|
408 | $ hg init merge-without-evolution | |
409 | $ cd merge-without-evolution |
|
409 | $ cd merge-without-evolution | |
410 | $ mklozenge |
|
410 | $ mklozenge | |
411 | $ cat > .hg/hgrc << EOF |
|
411 | $ cat > .hg/hgrc << EOF | |
412 | > [experimental] |
|
412 | > [experimental] | |
413 | > evolution = no |
|
413 | > evolution = no | |
414 | > evolution.allowunstable = no |
|
414 | > evolution.allowunstable = no | |
415 | > EOF |
|
415 | > EOF | |
416 |
|
416 | |||
417 | $ hg branch -r '(.^)::' abc |
|
417 | $ hg branch -r '(.^)::' abc | |
418 | changed branch on 2 changesets |
|
418 | changed branch on 2 changesets | |
419 | saved backup bundle to $TESTTMP/merge-without-evolution/.hg/strip-backup/9a3a2af368f4-8db1a361-branch-change.hg |
|
419 | saved backup bundle to $TESTTMP/merge-without-evolution/.hg/strip-backup/9a3a2af368f4-8db1a361-branch-change.hg | |
420 | $ hg glog |
|
420 | $ hg glog | |
421 | @ 3:c07fa8b34d54 neither |
|
421 | @ 3:c07fa8b34d54 neither | |
422 | |\ abc () |
|
422 | |\ abc () | |
423 | | o 2:f2aa51777cc9 baz |
|
423 | | o 2:f2aa51777cc9 baz | |
424 | | | abc () |
|
424 | | | abc () | |
425 | o | 1:2e33c4f0856b bar |
|
425 | o | 1:2e33c4f0856b bar | |
426 | |/ default () |
|
426 | |/ default () | |
427 | o 0:91cfb6004abf foo |
|
427 | o 0:91cfb6004abf foo | |
428 | default () |
|
428 | default () | |
429 | $ hg cat a |
|
429 | $ hg cat a | |
430 | neither |
|
430 | neither |
@@ -1,1319 +1,1319 b'' | |||||
1 | $ hg init |
|
1 | $ hg init | |
2 |
|
2 | |||
3 | Setup: |
|
3 | Setup: | |
4 |
|
4 | |||
5 | $ echo a >> a |
|
5 | $ echo a >> a | |
6 | $ hg ci -Am 'base' |
|
6 | $ hg ci -Am 'base' | |
7 | adding a |
|
7 | adding a | |
8 |
|
8 | |||
9 | Refuse to amend public csets: |
|
9 | Refuse to amend public csets: | |
10 |
|
10 | |||
11 | $ hg phase -r . -p |
|
11 | $ hg phase -r . -p | |
12 | $ hg ci --amend |
|
12 | $ hg ci --amend | |
13 | abort: cannot amend public changesets |
|
13 | abort: cannot amend public changesets | |
14 | (see 'hg help phases' for details) |
|
14 | (see 'hg help phases' for details) | |
15 |
[ |
|
15 | [10] | |
16 | $ hg phase -r . -f -d |
|
16 | $ hg phase -r . -f -d | |
17 |
|
17 | |||
18 | $ echo a >> a |
|
18 | $ echo a >> a | |
19 | $ hg ci -Am 'base1' |
|
19 | $ hg ci -Am 'base1' | |
20 |
|
20 | |||
21 | Nothing to amend: |
|
21 | Nothing to amend: | |
22 |
|
22 | |||
23 | $ hg ci --amend -m 'base1' |
|
23 | $ hg ci --amend -m 'base1' | |
24 | nothing changed |
|
24 | nothing changed | |
25 | [1] |
|
25 | [1] | |
26 |
|
26 | |||
27 | $ cat >> $HGRCPATH <<EOF |
|
27 | $ cat >> $HGRCPATH <<EOF | |
28 | > [hooks] |
|
28 | > [hooks] | |
29 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" |
|
29 | > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE" | |
30 | > EOF |
|
30 | > EOF | |
31 |
|
31 | |||
32 | Amending changeset with changes in working dir: |
|
32 | Amending changeset with changes in working dir: | |
33 | (and check that --message does not trigger an editor) |
|
33 | (and check that --message does not trigger an editor) | |
34 |
|
34 | |||
35 | $ echo a >> a |
|
35 | $ echo a >> a | |
36 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' |
|
36 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1' | |
37 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 |
|
37 | pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149 | |
38 | 43f1ba15f28a tip |
|
38 | 43f1ba15f28a tip | |
39 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg |
|
39 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg | |
40 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH |
|
40 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH | |
41 | $ hg diff -c . |
|
41 | $ hg diff -c . | |
42 | diff -r ad120869acf0 -r 43f1ba15f28a a |
|
42 | diff -r ad120869acf0 -r 43f1ba15f28a a | |
43 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
43 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
44 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
44 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
45 | @@ -1,1 +1,3 @@ |
|
45 | @@ -1,1 +1,3 @@ | |
46 | a |
|
46 | a | |
47 | +a |
|
47 | +a | |
48 | +a |
|
48 | +a | |
49 | $ hg log |
|
49 | $ hg log | |
50 | changeset: 1:43f1ba15f28a |
|
50 | changeset: 1:43f1ba15f28a | |
51 | tag: tip |
|
51 | tag: tip | |
52 | user: test |
|
52 | user: test | |
53 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
53 | date: Thu Jan 01 00:00:00 1970 +0000 | |
54 | summary: amend base1 |
|
54 | summary: amend base1 | |
55 |
|
55 | |||
56 | changeset: 0:ad120869acf0 |
|
56 | changeset: 0:ad120869acf0 | |
57 | user: test |
|
57 | user: test | |
58 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
58 | date: Thu Jan 01 00:00:00 1970 +0000 | |
59 | summary: base |
|
59 | summary: base | |
60 |
|
60 | |||
61 |
|
61 | |||
62 | Check proper abort for empty message |
|
62 | Check proper abort for empty message | |
63 |
|
63 | |||
64 | $ cat > editor.sh << '__EOF__' |
|
64 | $ cat > editor.sh << '__EOF__' | |
65 | > #!/bin/sh |
|
65 | > #!/bin/sh | |
66 | > echo "" > "$1" |
|
66 | > echo "" > "$1" | |
67 | > __EOF__ |
|
67 | > __EOF__ | |
68 |
|
68 | |||
69 | Update the existing file to ensure that the dirstate is not in pending state |
|
69 | Update the existing file to ensure that the dirstate is not in pending state | |
70 | (where the status of some files in the working copy is not known yet). This in |
|
70 | (where the status of some files in the working copy is not known yet). This in | |
71 | turn ensures that when the transaction is aborted due to an empty message during |
|
71 | turn ensures that when the transaction is aborted due to an empty message during | |
72 | the amend, there should be no rollback. |
|
72 | the amend, there should be no rollback. | |
73 | $ echo a >> a |
|
73 | $ echo a >> a | |
74 |
|
74 | |||
75 | $ echo b > b |
|
75 | $ echo b > b | |
76 | $ hg add b |
|
76 | $ hg add b | |
77 | $ hg summary |
|
77 | $ hg summary | |
78 | parent: 1:43f1ba15f28a tip |
|
78 | parent: 1:43f1ba15f28a tip | |
79 | amend base1 |
|
79 | amend base1 | |
80 | branch: default |
|
80 | branch: default | |
81 | commit: 1 modified, 1 added, 1 unknown |
|
81 | commit: 1 modified, 1 added, 1 unknown | |
82 | update: (current) |
|
82 | update: (current) | |
83 | phases: 2 draft |
|
83 | phases: 2 draft | |
84 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
84 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend | |
85 | abort: empty commit message |
|
85 | abort: empty commit message | |
86 | [10] |
|
86 | [10] | |
87 | $ hg summary |
|
87 | $ hg summary | |
88 | parent: 1:43f1ba15f28a tip |
|
88 | parent: 1:43f1ba15f28a tip | |
89 | amend base1 |
|
89 | amend base1 | |
90 | branch: default |
|
90 | branch: default | |
91 | commit: 1 modified, 1 added, 1 unknown |
|
91 | commit: 1 modified, 1 added, 1 unknown | |
92 | update: (current) |
|
92 | update: (current) | |
93 | phases: 2 draft |
|
93 | phases: 2 draft | |
94 |
|
94 | |||
95 | Add new file along with modified existing file: |
|
95 | Add new file along with modified existing file: | |
96 | $ hg ci --amend -m 'amend base1 new file' |
|
96 | $ hg ci --amend -m 'amend base1 new file' | |
97 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg |
|
97 | saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg | |
98 |
|
98 | |||
99 | Remove file that was added in amended commit: |
|
99 | Remove file that was added in amended commit: | |
100 | (and test logfile option) |
|
100 | (and test logfile option) | |
101 | (and test that logfile option do not trigger an editor) |
|
101 | (and test that logfile option do not trigger an editor) | |
102 |
|
102 | |||
103 | $ hg rm b |
|
103 | $ hg rm b | |
104 | $ echo 'amend base1 remove new file' > ../logfile |
|
104 | $ echo 'amend base1 remove new file' > ../logfile | |
105 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile |
|
105 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile | |
106 | saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg |
|
106 | saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg | |
107 |
|
107 | |||
108 | $ hg cat b |
|
108 | $ hg cat b | |
109 | b: no such file in rev 47343646fa3d |
|
109 | b: no such file in rev 47343646fa3d | |
110 | [1] |
|
110 | [1] | |
111 |
|
111 | |||
112 | No changes, just a different message: |
|
112 | No changes, just a different message: | |
113 |
|
113 | |||
114 | $ hg ci -v --amend -m 'no changes, new message' |
|
114 | $ hg ci -v --amend -m 'no changes, new message' | |
115 | amending changeset 47343646fa3d |
|
115 | amending changeset 47343646fa3d | |
116 | copying changeset 47343646fa3d to ad120869acf0 |
|
116 | copying changeset 47343646fa3d to ad120869acf0 | |
117 | committing files: |
|
117 | committing files: | |
118 | a |
|
118 | a | |
119 | committing manifest |
|
119 | committing manifest | |
120 | committing changelog |
|
120 | committing changelog | |
121 | 1 changesets found |
|
121 | 1 changesets found | |
122 | uncompressed size of bundle content: |
|
122 | uncompressed size of bundle content: | |
123 | 254 (changelog) |
|
123 | 254 (changelog) | |
124 | 163 (manifests) |
|
124 | 163 (manifests) | |
125 | 131 a |
|
125 | 131 a | |
126 | saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg |
|
126 | saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg | |
127 | 1 changesets found |
|
127 | 1 changesets found | |
128 | uncompressed size of bundle content: |
|
128 | uncompressed size of bundle content: | |
129 | 250 (changelog) |
|
129 | 250 (changelog) | |
130 | 163 (manifests) |
|
130 | 163 (manifests) | |
131 | 131 a |
|
131 | 131 a | |
132 | adding branch |
|
132 | adding branch | |
133 | adding changesets |
|
133 | adding changesets | |
134 | adding manifests |
|
134 | adding manifests | |
135 | adding file changes |
|
135 | adding file changes | |
136 | added 1 changesets with 1 changes to 1 files |
|
136 | added 1 changesets with 1 changes to 1 files | |
137 | committed changeset 1:401431e913a1 |
|
137 | committed changeset 1:401431e913a1 | |
138 | $ hg diff -c . |
|
138 | $ hg diff -c . | |
139 | diff -r ad120869acf0 -r 401431e913a1 a |
|
139 | diff -r ad120869acf0 -r 401431e913a1 a | |
140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
140 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
141 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
142 | @@ -1,1 +1,4 @@ |
|
142 | @@ -1,1 +1,4 @@ | |
143 | a |
|
143 | a | |
144 | +a |
|
144 | +a | |
145 | +a |
|
145 | +a | |
146 | +a |
|
146 | +a | |
147 | $ hg log |
|
147 | $ hg log | |
148 | changeset: 1:401431e913a1 |
|
148 | changeset: 1:401431e913a1 | |
149 | tag: tip |
|
149 | tag: tip | |
150 | user: test |
|
150 | user: test | |
151 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
151 | date: Thu Jan 01 00:00:00 1970 +0000 | |
152 | summary: no changes, new message |
|
152 | summary: no changes, new message | |
153 |
|
153 | |||
154 | changeset: 0:ad120869acf0 |
|
154 | changeset: 0:ad120869acf0 | |
155 | user: test |
|
155 | user: test | |
156 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
156 | date: Thu Jan 01 00:00:00 1970 +0000 | |
157 | summary: base |
|
157 | summary: base | |
158 |
|
158 | |||
159 |
|
159 | |||
160 | Disable default date on commit so when -d isn't given, the old date is preserved: |
|
160 | Disable default date on commit so when -d isn't given, the old date is preserved: | |
161 |
|
161 | |||
162 | $ echo '[defaults]' >> $HGRCPATH |
|
162 | $ echo '[defaults]' >> $HGRCPATH | |
163 | $ echo 'commit=' >> $HGRCPATH |
|
163 | $ echo 'commit=' >> $HGRCPATH | |
164 |
|
164 | |||
165 | Test -u/-d: |
|
165 | Test -u/-d: | |
166 |
|
166 | |||
167 | $ cat > .hg/checkeditform.sh <<EOF |
|
167 | $ cat > .hg/checkeditform.sh <<EOF | |
168 | > env | grep HGEDITFORM |
|
168 | > env | grep HGEDITFORM | |
169 | > true |
|
169 | > true | |
170 | > EOF |
|
170 | > EOF | |
171 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' |
|
171 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0' | |
172 | HGEDITFORM=commit.amend.normal |
|
172 | HGEDITFORM=commit.amend.normal | |
173 | saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg |
|
173 | saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg | |
174 | $ echo a >> a |
|
174 | $ echo a >> a | |
175 | $ hg ci --amend -u foo -d '1 0' |
|
175 | $ hg ci --amend -u foo -d '1 0' | |
176 | saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg |
|
176 | saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg | |
177 | $ hg log -r . |
|
177 | $ hg log -r . | |
178 | changeset: 1:a9a13940fc03 |
|
178 | changeset: 1:a9a13940fc03 | |
179 | tag: tip |
|
179 | tag: tip | |
180 | user: foo |
|
180 | user: foo | |
181 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
181 | date: Thu Jan 01 00:00:01 1970 +0000 | |
182 | summary: no changes, new message |
|
182 | summary: no changes, new message | |
183 |
|
183 | |||
184 |
|
184 | |||
185 | Open editor with old commit message if a message isn't given otherwise: |
|
185 | Open editor with old commit message if a message isn't given otherwise: | |
186 |
|
186 | |||
187 | $ cat > editor.sh << '__EOF__' |
|
187 | $ cat > editor.sh << '__EOF__' | |
188 | > #!/bin/sh |
|
188 | > #!/bin/sh | |
189 | > cat $1 |
|
189 | > cat $1 | |
190 | > echo "another precious commit message" > "$1" |
|
190 | > echo "another precious commit message" > "$1" | |
191 | > __EOF__ |
|
191 | > __EOF__ | |
192 |
|
192 | |||
193 | at first, test saving last-message.txt |
|
193 | at first, test saving last-message.txt | |
194 |
|
194 | |||
195 | $ cat > .hg/hgrc << '__EOF__' |
|
195 | $ cat > .hg/hgrc << '__EOF__' | |
196 | > [hooks] |
|
196 | > [hooks] | |
197 | > pretxncommit.test-saving-last-message = false |
|
197 | > pretxncommit.test-saving-last-message = false | |
198 | > __EOF__ |
|
198 | > __EOF__ | |
199 |
|
199 | |||
200 | $ rm -f .hg/last-message.txt |
|
200 | $ rm -f .hg/last-message.txt | |
201 | $ hg commit --amend -v -m "message given from command line" |
|
201 | $ hg commit --amend -v -m "message given from command line" | |
202 | amending changeset a9a13940fc03 |
|
202 | amending changeset a9a13940fc03 | |
203 | copying changeset a9a13940fc03 to ad120869acf0 |
|
203 | copying changeset a9a13940fc03 to ad120869acf0 | |
204 | committing files: |
|
204 | committing files: | |
205 | a |
|
205 | a | |
206 | committing manifest |
|
206 | committing manifest | |
207 | committing changelog |
|
207 | committing changelog | |
208 | running hook pretxncommit.test-saving-last-message: false |
|
208 | running hook pretxncommit.test-saving-last-message: false | |
209 | transaction abort! |
|
209 | transaction abort! | |
210 | rollback completed |
|
210 | rollback completed | |
211 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
211 | abort: pretxncommit.test-saving-last-message hook exited with status 1 | |
212 | [255] |
|
212 | [255] | |
213 | $ cat .hg/last-message.txt |
|
213 | $ cat .hg/last-message.txt | |
214 | message given from command line (no-eol) |
|
214 | message given from command line (no-eol) | |
215 |
|
215 | |||
216 | $ rm -f .hg/last-message.txt |
|
216 | $ rm -f .hg/last-message.txt | |
217 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
217 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
218 | amending changeset a9a13940fc03 |
|
218 | amending changeset a9a13940fc03 | |
219 | copying changeset a9a13940fc03 to ad120869acf0 |
|
219 | copying changeset a9a13940fc03 to ad120869acf0 | |
220 | no changes, new message |
|
220 | no changes, new message | |
221 |
|
221 | |||
222 |
|
222 | |||
223 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
223 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
224 | HG: Leave message empty to abort commit. |
|
224 | HG: Leave message empty to abort commit. | |
225 | HG: -- |
|
225 | HG: -- | |
226 | HG: user: foo |
|
226 | HG: user: foo | |
227 | HG: branch 'default' |
|
227 | HG: branch 'default' | |
228 | HG: changed a |
|
228 | HG: changed a | |
229 | committing files: |
|
229 | committing files: | |
230 | a |
|
230 | a | |
231 | committing manifest |
|
231 | committing manifest | |
232 | committing changelog |
|
232 | committing changelog | |
233 | running hook pretxncommit.test-saving-last-message: false |
|
233 | running hook pretxncommit.test-saving-last-message: false | |
234 | transaction abort! |
|
234 | transaction abort! | |
235 | rollback completed |
|
235 | rollback completed | |
236 | abort: pretxncommit.test-saving-last-message hook exited with status 1 |
|
236 | abort: pretxncommit.test-saving-last-message hook exited with status 1 | |
237 | [255] |
|
237 | [255] | |
238 |
|
238 | |||
239 | $ cat .hg/last-message.txt |
|
239 | $ cat .hg/last-message.txt | |
240 | another precious commit message |
|
240 | another precious commit message | |
241 |
|
241 | |||
242 | $ cat > .hg/hgrc << '__EOF__' |
|
242 | $ cat > .hg/hgrc << '__EOF__' | |
243 | > [hooks] |
|
243 | > [hooks] | |
244 | > pretxncommit.test-saving-last-message = |
|
244 | > pretxncommit.test-saving-last-message = | |
245 | > __EOF__ |
|
245 | > __EOF__ | |
246 |
|
246 | |||
247 | then, test editing custom commit message |
|
247 | then, test editing custom commit message | |
248 |
|
248 | |||
249 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
249 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
250 | amending changeset a9a13940fc03 |
|
250 | amending changeset a9a13940fc03 | |
251 | copying changeset a9a13940fc03 to ad120869acf0 |
|
251 | copying changeset a9a13940fc03 to ad120869acf0 | |
252 | no changes, new message |
|
252 | no changes, new message | |
253 |
|
253 | |||
254 |
|
254 | |||
255 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
255 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
256 | HG: Leave message empty to abort commit. |
|
256 | HG: Leave message empty to abort commit. | |
257 | HG: -- |
|
257 | HG: -- | |
258 | HG: user: foo |
|
258 | HG: user: foo | |
259 | HG: branch 'default' |
|
259 | HG: branch 'default' | |
260 | HG: changed a |
|
260 | HG: changed a | |
261 | committing files: |
|
261 | committing files: | |
262 | a |
|
262 | a | |
263 | committing manifest |
|
263 | committing manifest | |
264 | committing changelog |
|
264 | committing changelog | |
265 | 1 changesets found |
|
265 | 1 changesets found | |
266 | uncompressed size of bundle content: |
|
266 | uncompressed size of bundle content: | |
267 | 249 (changelog) |
|
267 | 249 (changelog) | |
268 | 163 (manifests) |
|
268 | 163 (manifests) | |
269 | 133 a |
|
269 | 133 a | |
270 | saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg |
|
270 | saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg | |
271 | 1 changesets found |
|
271 | 1 changesets found | |
272 | uncompressed size of bundle content: |
|
272 | uncompressed size of bundle content: | |
273 | 257 (changelog) |
|
273 | 257 (changelog) | |
274 | 163 (manifests) |
|
274 | 163 (manifests) | |
275 | 133 a |
|
275 | 133 a | |
276 | adding branch |
|
276 | adding branch | |
277 | adding changesets |
|
277 | adding changesets | |
278 | adding manifests |
|
278 | adding manifests | |
279 | adding file changes |
|
279 | adding file changes | |
280 | added 1 changesets with 1 changes to 1 files |
|
280 | added 1 changesets with 1 changes to 1 files | |
281 | committed changeset 1:64a124ba1b44 |
|
281 | committed changeset 1:64a124ba1b44 | |
282 |
|
282 | |||
283 | Same, but with changes in working dir (different code path): |
|
283 | Same, but with changes in working dir (different code path): | |
284 |
|
284 | |||
285 | $ echo a >> a |
|
285 | $ echo a >> a | |
286 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v |
|
286 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v | |
287 | amending changeset 64a124ba1b44 |
|
287 | amending changeset 64a124ba1b44 | |
288 | another precious commit message |
|
288 | another precious commit message | |
289 |
|
289 | |||
290 |
|
290 | |||
291 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
291 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
292 | HG: Leave message empty to abort commit. |
|
292 | HG: Leave message empty to abort commit. | |
293 | HG: -- |
|
293 | HG: -- | |
294 | HG: user: foo |
|
294 | HG: user: foo | |
295 | HG: branch 'default' |
|
295 | HG: branch 'default' | |
296 | HG: changed a |
|
296 | HG: changed a | |
297 | committing files: |
|
297 | committing files: | |
298 | a |
|
298 | a | |
299 | committing manifest |
|
299 | committing manifest | |
300 | committing changelog |
|
300 | committing changelog | |
301 | 1 changesets found |
|
301 | 1 changesets found | |
302 | uncompressed size of bundle content: |
|
302 | uncompressed size of bundle content: | |
303 | 257 (changelog) |
|
303 | 257 (changelog) | |
304 | 163 (manifests) |
|
304 | 163 (manifests) | |
305 | 133 a |
|
305 | 133 a | |
306 | saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg |
|
306 | saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg | |
307 | 1 changesets found |
|
307 | 1 changesets found | |
308 | uncompressed size of bundle content: |
|
308 | uncompressed size of bundle content: | |
309 | 257 (changelog) |
|
309 | 257 (changelog) | |
310 | 163 (manifests) |
|
310 | 163 (manifests) | |
311 | 135 a |
|
311 | 135 a | |
312 | adding branch |
|
312 | adding branch | |
313 | adding changesets |
|
313 | adding changesets | |
314 | adding manifests |
|
314 | adding manifests | |
315 | adding file changes |
|
315 | adding file changes | |
316 | added 1 changesets with 1 changes to 1 files |
|
316 | added 1 changesets with 1 changes to 1 files | |
317 | committed changeset 1:7892795b8e38 |
|
317 | committed changeset 1:7892795b8e38 | |
318 |
|
318 | |||
319 | $ rm editor.sh |
|
319 | $ rm editor.sh | |
320 | $ hg log -r . |
|
320 | $ hg log -r . | |
321 | changeset: 1:7892795b8e38 |
|
321 | changeset: 1:7892795b8e38 | |
322 | tag: tip |
|
322 | tag: tip | |
323 | user: foo |
|
323 | user: foo | |
324 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
324 | date: Thu Jan 01 00:00:01 1970 +0000 | |
325 | summary: another precious commit message |
|
325 | summary: another precious commit message | |
326 |
|
326 | |||
327 |
|
327 | |||
328 | Moving bookmarks, preserve active bookmark: |
|
328 | Moving bookmarks, preserve active bookmark: | |
329 |
|
329 | |||
330 | $ hg book book1 |
|
330 | $ hg book book1 | |
331 | $ hg book book2 |
|
331 | $ hg book book2 | |
332 | $ hg ci --amend -m 'move bookmarks' |
|
332 | $ hg ci --amend -m 'move bookmarks' | |
333 | saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg |
|
333 | saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg | |
334 | $ hg book |
|
334 | $ hg book | |
335 | book1 1:8311f17e2616 |
|
335 | book1 1:8311f17e2616 | |
336 | * book2 1:8311f17e2616 |
|
336 | * book2 1:8311f17e2616 | |
337 | $ echo a >> a |
|
337 | $ echo a >> a | |
338 | $ hg ci --amend -m 'move bookmarks' |
|
338 | $ hg ci --amend -m 'move bookmarks' | |
339 | saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg |
|
339 | saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg | |
340 | $ hg book |
|
340 | $ hg book | |
341 | book1 1:a3b65065808c |
|
341 | book1 1:a3b65065808c | |
342 | * book2 1:a3b65065808c |
|
342 | * book2 1:a3b65065808c | |
343 |
|
343 | |||
344 | abort does not loose bookmarks |
|
344 | abort does not loose bookmarks | |
345 |
|
345 | |||
346 | $ cat > editor.sh << '__EOF__' |
|
346 | $ cat > editor.sh << '__EOF__' | |
347 | > #!/bin/sh |
|
347 | > #!/bin/sh | |
348 | > echo "" > "$1" |
|
348 | > echo "" > "$1" | |
349 | > __EOF__ |
|
349 | > __EOF__ | |
350 | $ echo a >> a |
|
350 | $ echo a >> a | |
351 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend |
|
351 | $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend | |
352 | abort: empty commit message |
|
352 | abort: empty commit message | |
353 | [10] |
|
353 | [10] | |
354 | $ hg book |
|
354 | $ hg book | |
355 | book1 1:a3b65065808c |
|
355 | book1 1:a3b65065808c | |
356 | * book2 1:a3b65065808c |
|
356 | * book2 1:a3b65065808c | |
357 | $ hg revert -Caq |
|
357 | $ hg revert -Caq | |
358 | $ rm editor.sh |
|
358 | $ rm editor.sh | |
359 |
|
359 | |||
360 | $ echo '[defaults]' >> $HGRCPATH |
|
360 | $ echo '[defaults]' >> $HGRCPATH | |
361 | $ echo "commit=-d '0 0'" >> $HGRCPATH |
|
361 | $ echo "commit=-d '0 0'" >> $HGRCPATH | |
362 |
|
362 | |||
363 | Moving branches: |
|
363 | Moving branches: | |
364 |
|
364 | |||
365 | $ hg branch foo |
|
365 | $ hg branch foo | |
366 | marked working directory as branch foo |
|
366 | marked working directory as branch foo | |
367 | (branches are permanent and global, did you want a bookmark?) |
|
367 | (branches are permanent and global, did you want a bookmark?) | |
368 | $ echo a >> a |
|
368 | $ echo a >> a | |
369 | $ hg ci -m 'branch foo' |
|
369 | $ hg ci -m 'branch foo' | |
370 | $ hg branch default -f |
|
370 | $ hg branch default -f | |
371 | marked working directory as branch default |
|
371 | marked working directory as branch default | |
372 | $ hg ci --amend -m 'back to default' |
|
372 | $ hg ci --amend -m 'back to default' | |
373 | saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg |
|
373 | saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg | |
374 | $ hg branches |
|
374 | $ hg branches | |
375 | default 2:9c07515f2650 |
|
375 | default 2:9c07515f2650 | |
376 |
|
376 | |||
377 | Close branch: |
|
377 | Close branch: | |
378 |
|
378 | |||
379 | $ hg up -q 0 |
|
379 | $ hg up -q 0 | |
380 | $ echo b >> b |
|
380 | $ echo b >> b | |
381 | $ hg branch foo |
|
381 | $ hg branch foo | |
382 | marked working directory as branch foo |
|
382 | marked working directory as branch foo | |
383 | (branches are permanent and global, did you want a bookmark?) |
|
383 | (branches are permanent and global, did you want a bookmark?) | |
384 | $ hg ci -Am 'fork' |
|
384 | $ hg ci -Am 'fork' | |
385 | adding b |
|
385 | adding b | |
386 | $ echo b >> b |
|
386 | $ echo b >> b | |
387 | $ hg ci -mb |
|
387 | $ hg ci -mb | |
388 | $ hg ci --amend --close-branch -m 'closing branch foo' |
|
388 | $ hg ci --amend --close-branch -m 'closing branch foo' | |
389 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg |
|
389 | saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg | |
390 |
|
390 | |||
391 | Same thing, different code path: |
|
391 | Same thing, different code path: | |
392 |
|
392 | |||
393 | $ echo b >> b |
|
393 | $ echo b >> b | |
394 | $ hg ci -m 'reopen branch' |
|
394 | $ hg ci -m 'reopen branch' | |
395 | reopening closed branch head 4 |
|
395 | reopening closed branch head 4 | |
396 | $ echo b >> b |
|
396 | $ echo b >> b | |
397 | $ hg ci --amend --close-branch |
|
397 | $ hg ci --amend --close-branch | |
398 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg |
|
398 | saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg | |
399 | $ hg branches |
|
399 | $ hg branches | |
400 | default 2:9c07515f2650 |
|
400 | default 2:9c07515f2650 | |
401 |
|
401 | |||
402 | Refuse to amend during a merge: |
|
402 | Refuse to amend during a merge: | |
403 |
|
403 | |||
404 | $ hg up -q default |
|
404 | $ hg up -q default | |
405 | $ hg merge foo |
|
405 | $ hg merge foo | |
406 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
406 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
407 | (branch merge, don't forget to commit) |
|
407 | (branch merge, don't forget to commit) | |
408 | $ hg ci --amend |
|
408 | $ hg ci --amend | |
409 | abort: cannot amend while merging |
|
409 | abort: cannot amend while merging | |
410 |
[2 |
|
410 | [20] | |
411 | $ hg ci -m 'merge' |
|
411 | $ hg ci -m 'merge' | |
412 |
|
412 | |||
413 | Refuse to amend if there is a merge conflict (issue5805): |
|
413 | Refuse to amend if there is a merge conflict (issue5805): | |
414 |
|
414 | |||
415 | $ hg up -q foo |
|
415 | $ hg up -q foo | |
416 | $ echo c > a |
|
416 | $ echo c > a | |
417 | $ hg up default -t :fail |
|
417 | $ hg up default -t :fail | |
418 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
418 | 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | |
419 | use 'hg resolve' to retry unresolved file merges |
|
419 | use 'hg resolve' to retry unresolved file merges | |
420 | [1] |
|
420 | [1] | |
421 | $ hg resolve -l |
|
421 | $ hg resolve -l | |
422 | U a |
|
422 | U a | |
423 |
|
423 | |||
424 | $ hg ci --amend |
|
424 | $ hg ci --amend | |
425 | abort: unresolved merge conflicts (see 'hg help resolve') |
|
425 | abort: unresolved merge conflicts (see 'hg help resolve') | |
426 | [255] |
|
426 | [255] | |
427 |
|
427 | |||
428 | $ hg up -qC . |
|
428 | $ hg up -qC . | |
429 |
|
429 | |||
430 | Follow copies/renames: |
|
430 | Follow copies/renames: | |
431 |
|
431 | |||
432 | $ hg mv b c |
|
432 | $ hg mv b c | |
433 | $ hg ci -m 'b -> c' |
|
433 | $ hg ci -m 'b -> c' | |
434 | $ hg mv c d |
|
434 | $ hg mv c d | |
435 | $ hg ci --amend -m 'b -> d' |
|
435 | $ hg ci --amend -m 'b -> d' | |
436 | saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg |
|
436 | saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg | |
437 | $ hg st --rev '.^' --copies d |
|
437 | $ hg st --rev '.^' --copies d | |
438 | A d |
|
438 | A d | |
439 | b |
|
439 | b | |
440 | $ hg cp d e |
|
440 | $ hg cp d e | |
441 | $ hg ci -m 'e = d' |
|
441 | $ hg ci -m 'e = d' | |
442 | $ hg cp e f |
|
442 | $ hg cp e f | |
443 | $ hg ci --amend -m 'f = d' |
|
443 | $ hg ci --amend -m 'f = d' | |
444 | saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg |
|
444 | saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg | |
445 | $ hg st --rev '.^' --copies f |
|
445 | $ hg st --rev '.^' --copies f | |
446 | A f |
|
446 | A f | |
447 | d |
|
447 | d | |
448 |
|
448 | |||
449 | $ mv f f.orig |
|
449 | $ mv f f.orig | |
450 | $ hg rm -A f |
|
450 | $ hg rm -A f | |
451 | $ hg ci -m removef |
|
451 | $ hg ci -m removef | |
452 | $ hg cp a f |
|
452 | $ hg cp a f | |
453 | $ mv f.orig f |
|
453 | $ mv f.orig f | |
454 | $ hg ci --amend -m replacef |
|
454 | $ hg ci --amend -m replacef | |
455 | saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg |
|
455 | saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg | |
456 | $ hg st --change . --copies |
|
456 | $ hg st --change . --copies | |
457 | $ hg log -r . --template "{file_copies}\n" |
|
457 | $ hg log -r . --template "{file_copies}\n" | |
458 |
|
458 | |||
459 |
|
459 | |||
460 | Move added file (issue3410): |
|
460 | Move added file (issue3410): | |
461 |
|
461 | |||
462 | $ echo g >> g |
|
462 | $ echo g >> g | |
463 | $ hg ci -Am g |
|
463 | $ hg ci -Am g | |
464 | adding g |
|
464 | adding g | |
465 | $ hg mv g h |
|
465 | $ hg mv g h | |
466 | $ hg ci --amend |
|
466 | $ hg ci --amend | |
467 | saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg |
|
467 | saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg | |
468 | $ hg st --change . --copies h |
|
468 | $ hg st --change . --copies h | |
469 | A h |
|
469 | A h | |
470 | $ hg log -r . --template "{file_copies}\n" |
|
470 | $ hg log -r . --template "{file_copies}\n" | |
471 |
|
471 | |||
472 |
|
472 | |||
473 | Can't rollback an amend: |
|
473 | Can't rollback an amend: | |
474 |
|
474 | |||
475 | $ hg rollback |
|
475 | $ hg rollback | |
476 | no rollback information available |
|
476 | no rollback information available | |
477 | [1] |
|
477 | [1] | |
478 |
|
478 | |||
479 | Preserve extra dict (issue3430): |
|
479 | Preserve extra dict (issue3430): | |
480 |
|
480 | |||
481 | $ hg branch a |
|
481 | $ hg branch a | |
482 | marked working directory as branch a |
|
482 | marked working directory as branch a | |
483 | (branches are permanent and global, did you want a bookmark?) |
|
483 | (branches are permanent and global, did you want a bookmark?) | |
484 | $ echo a >> a |
|
484 | $ echo a >> a | |
485 | $ hg ci -ma |
|
485 | $ hg ci -ma | |
486 | $ hg ci --amend -m "a'" |
|
486 | $ hg ci --amend -m "a'" | |
487 | saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg |
|
487 | saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg | |
488 | $ hg log -r . --template "{branch}\n" |
|
488 | $ hg log -r . --template "{branch}\n" | |
489 | a |
|
489 | a | |
490 | $ hg ci --amend -m "a''" |
|
490 | $ hg ci --amend -m "a''" | |
491 | saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg |
|
491 | saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg | |
492 | $ hg log -r . --template "{branch}\n" |
|
492 | $ hg log -r . --template "{branch}\n" | |
493 | a |
|
493 | a | |
494 |
|
494 | |||
495 | Also preserve other entries in the dict that are in the old commit, |
|
495 | Also preserve other entries in the dict that are in the old commit, | |
496 | first graft something so there's an additional entry: |
|
496 | first graft something so there's an additional entry: | |
497 |
|
497 | |||
498 | $ hg up 0 -q |
|
498 | $ hg up 0 -q | |
499 | $ echo z > z |
|
499 | $ echo z > z | |
500 | $ hg ci -Am 'fork' |
|
500 | $ hg ci -Am 'fork' | |
501 | adding z |
|
501 | adding z | |
502 | created new head |
|
502 | created new head | |
503 | $ hg up 11 |
|
503 | $ hg up 11 | |
504 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
504 | 5 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
505 | $ hg graft 12 |
|
505 | $ hg graft 12 | |
506 | grafting 12:2647734878ef "fork" (tip) |
|
506 | grafting 12:2647734878ef "fork" (tip) | |
507 | $ hg ci --amend -m 'graft amend' |
|
507 | $ hg ci --amend -m 'graft amend' | |
508 | saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg |
|
508 | saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg | |
509 | $ hg log -r . --debug | grep extra |
|
509 | $ hg log -r . --debug | grep extra | |
510 | extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 |
|
510 | extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60 | |
511 | extra: branch=a |
|
511 | extra: branch=a | |
512 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a |
|
512 | extra: source=2647734878ef0236dda712fae9c1651cf694ea8a | |
513 |
|
513 | |||
514 | Preserve phase |
|
514 | Preserve phase | |
515 |
|
515 | |||
516 | $ hg phase '.^::.' |
|
516 | $ hg phase '.^::.' | |
517 | 11: draft |
|
517 | 11: draft | |
518 | 13: draft |
|
518 | 13: draft | |
519 | $ hg phase --secret --force . |
|
519 | $ hg phase --secret --force . | |
520 | $ hg phase '.^::.' |
|
520 | $ hg phase '.^::.' | |
521 | 11: draft |
|
521 | 11: draft | |
522 | 13: secret |
|
522 | 13: secret | |
523 | $ hg commit --amend -m 'amend for phase' -q |
|
523 | $ hg commit --amend -m 'amend for phase' -q | |
524 | $ hg phase '.^::.' |
|
524 | $ hg phase '.^::.' | |
525 | 11: draft |
|
525 | 11: draft | |
526 | 13: secret |
|
526 | 13: secret | |
527 |
|
527 | |||
528 | Test amend with obsolete |
|
528 | Test amend with obsolete | |
529 | --------------------------- |
|
529 | --------------------------- | |
530 |
|
530 | |||
531 | Enable obsolete |
|
531 | Enable obsolete | |
532 |
|
532 | |||
533 | $ cat >> $HGRCPATH << EOF |
|
533 | $ cat >> $HGRCPATH << EOF | |
534 | > [experimental] |
|
534 | > [experimental] | |
535 | > evolution.createmarkers=True |
|
535 | > evolution.createmarkers=True | |
536 | > evolution.allowunstable=True |
|
536 | > evolution.allowunstable=True | |
537 | > EOF |
|
537 | > EOF | |
538 |
|
538 | |||
539 | Amend with no files changes |
|
539 | Amend with no files changes | |
540 |
|
540 | |||
541 | $ hg id -n |
|
541 | $ hg id -n | |
542 | 13 |
|
542 | 13 | |
543 | $ hg ci --amend -m 'babar' |
|
543 | $ hg ci --amend -m 'babar' | |
544 | $ hg id -n |
|
544 | $ hg id -n | |
545 | 14 |
|
545 | 14 | |
546 | $ hg log -Gl 3 --style=compact |
|
546 | $ hg log -Gl 3 --style=compact | |
547 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
547 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test | |
548 | | babar |
|
548 | | babar | |
549 | | |
|
549 | | | |
550 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
550 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
551 | | | fork |
|
551 | | | fork | |
552 | | ~ |
|
552 | | ~ | |
553 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
553 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
554 | | a'' |
|
554 | | a'' | |
555 | ~ |
|
555 | ~ | |
556 | $ hg log -Gl 4 --hidden --style=compact |
|
556 | $ hg log -Gl 4 --hidden --style=compact | |
557 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test |
|
557 | @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test | |
558 | | babar |
|
558 | | babar | |
559 | | |
|
559 | | | |
560 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
560 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test | |
561 | |/ amend for phase |
|
561 | |/ amend for phase | |
562 | | |
|
562 | | | |
563 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
563 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
564 | | | fork |
|
564 | | | fork | |
565 | | ~ |
|
565 | | ~ | |
566 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
566 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
567 | | a'' |
|
567 | | a'' | |
568 | ~ |
|
568 | ~ | |
569 |
|
569 | |||
570 | Amend with files changes |
|
570 | Amend with files changes | |
571 |
|
571 | |||
572 | (note: the extra commit over 15 is a temporary junk I would be happy to get |
|
572 | (note: the extra commit over 15 is a temporary junk I would be happy to get | |
573 | ride of) |
|
573 | ride of) | |
574 |
|
574 | |||
575 | $ echo 'babar' >> a |
|
575 | $ echo 'babar' >> a | |
576 | $ hg commit --amend |
|
576 | $ hg commit --amend | |
577 | $ hg log -Gl 6 --hidden --style=compact |
|
577 | $ hg log -Gl 6 --hidden --style=compact | |
578 | @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test |
|
578 | @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test | |
579 | | babar |
|
579 | | babar | |
580 | | |
|
580 | | | |
581 | | x 14:11 682950e85999 1970-01-01 00:00 +0000 test |
|
581 | | x 14:11 682950e85999 1970-01-01 00:00 +0000 test | |
582 | |/ babar |
|
582 | |/ babar | |
583 | | |
|
583 | | | |
584 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test |
|
584 | | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test | |
585 | |/ amend for phase |
|
585 | |/ amend for phase | |
586 | | |
|
586 | | | |
587 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test |
|
587 | | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test | |
588 | | | fork |
|
588 | | | fork | |
589 | | ~ |
|
589 | | ~ | |
590 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test |
|
590 | o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test | |
591 | | a'' |
|
591 | | a'' | |
592 | | |
|
592 | | | |
593 | o 10 5fa75032e226 1970-01-01 00:00 +0000 test |
|
593 | o 10 5fa75032e226 1970-01-01 00:00 +0000 test | |
594 | | g |
|
594 | | g | |
595 | ~ |
|
595 | ~ | |
596 |
|
596 | |||
597 |
|
597 | |||
598 | Test that amend does not make it easy to create obsolescence cycle |
|
598 | Test that amend does not make it easy to create obsolescence cycle | |
599 | --------------------------------------------------------------------- |
|
599 | --------------------------------------------------------------------- | |
600 |
|
600 | |||
601 | $ hg id -r 14 --hidden |
|
601 | $ hg id -r 14 --hidden | |
602 | 682950e85999 (a) |
|
602 | 682950e85999 (a) | |
603 | $ hg revert -ar 14 --hidden |
|
603 | $ hg revert -ar 14 --hidden | |
604 | reverting a |
|
604 | reverting a | |
605 | $ hg commit --amend |
|
605 | $ hg commit --amend | |
606 | $ hg id |
|
606 | $ hg id | |
607 | 37973c7e0b61 (a) tip |
|
607 | 37973c7e0b61 (a) tip | |
608 |
|
608 | |||
609 | Test that rewriting leaving instability behind is allowed |
|
609 | Test that rewriting leaving instability behind is allowed | |
610 | --------------------------------------------------------------------- |
|
610 | --------------------------------------------------------------------- | |
611 |
|
611 | |||
612 | $ hg up '.^' |
|
612 | $ hg up '.^' | |
613 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
613 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
614 | $ echo 'b' >> a |
|
614 | $ echo 'b' >> a | |
615 | $ hg log --style compact -r 'children(.)' |
|
615 | $ hg log --style compact -r 'children(.)' | |
616 | 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test |
|
616 | 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test | |
617 | babar |
|
617 | babar | |
618 |
|
618 | |||
619 | $ hg commit --amend |
|
619 | $ hg commit --amend | |
620 | 1 new orphan changesets |
|
620 | 1 new orphan changesets | |
621 | $ hg log -r 'orphan()' |
|
621 | $ hg log -r 'orphan()' | |
622 | changeset: 16:37973c7e0b61 |
|
622 | changeset: 16:37973c7e0b61 | |
623 | branch: a |
|
623 | branch: a | |
624 | parent: 11:0ddb275cfad1 |
|
624 | parent: 11:0ddb275cfad1 | |
625 | user: test |
|
625 | user: test | |
626 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
626 | date: Thu Jan 01 00:00:00 1970 +0000 | |
627 | instability: orphan |
|
627 | instability: orphan | |
628 | summary: babar |
|
628 | summary: babar | |
629 |
|
629 | |||
630 |
|
630 | |||
631 | Amend a merge changeset (with renames and conflicts from the second parent): |
|
631 | Amend a merge changeset (with renames and conflicts from the second parent): | |
632 |
|
632 | |||
633 | $ hg up -q default |
|
633 | $ hg up -q default | |
634 | $ hg branch -q bar |
|
634 | $ hg branch -q bar | |
635 | $ hg cp a aa |
|
635 | $ hg cp a aa | |
636 | $ hg mv z zz |
|
636 | $ hg mv z zz | |
637 | $ echo cc > cc |
|
637 | $ echo cc > cc | |
638 | $ hg add cc |
|
638 | $ hg add cc | |
639 | $ hg ci -m aazzcc |
|
639 | $ hg ci -m aazzcc | |
640 | $ hg up -q default |
|
640 | $ hg up -q default | |
641 | $ echo a >> a |
|
641 | $ echo a >> a | |
642 | $ echo dd > cc |
|
642 | $ echo dd > cc | |
643 | $ hg add cc |
|
643 | $ hg add cc | |
644 | $ hg ci -m aa |
|
644 | $ hg ci -m aa | |
645 | $ hg merge -q bar |
|
645 | $ hg merge -q bar | |
646 | warning: conflicts while merging cc! (edit, then use 'hg resolve --mark') |
|
646 | warning: conflicts while merging cc! (edit, then use 'hg resolve --mark') | |
647 | [1] |
|
647 | [1] | |
648 | $ hg resolve -m cc |
|
648 | $ hg resolve -m cc | |
649 | (no more unresolved files) |
|
649 | (no more unresolved files) | |
650 | $ hg ci -m 'merge bar' |
|
650 | $ hg ci -m 'merge bar' | |
651 | $ hg log --config diff.git=1 -pr . |
|
651 | $ hg log --config diff.git=1 -pr . | |
652 | changeset: 20:5aba7f3726e6 |
|
652 | changeset: 20:5aba7f3726e6 | |
653 | tag: tip |
|
653 | tag: tip | |
654 | parent: 19:30d96aeaf27b |
|
654 | parent: 19:30d96aeaf27b | |
655 | parent: 18:1aa437659d19 |
|
655 | parent: 18:1aa437659d19 | |
656 | user: test |
|
656 | user: test | |
657 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
657 | date: Thu Jan 01 00:00:00 1970 +0000 | |
658 | summary: merge bar |
|
658 | summary: merge bar | |
659 |
|
659 | |||
660 | diff --git a/a b/aa |
|
660 | diff --git a/a b/aa | |
661 | copy from a |
|
661 | copy from a | |
662 | copy to aa |
|
662 | copy to aa | |
663 | diff --git a/cc b/cc |
|
663 | diff --git a/cc b/cc | |
664 | --- a/cc |
|
664 | --- a/cc | |
665 | +++ b/cc |
|
665 | +++ b/cc | |
666 | @@ -1,1 +1,5 @@ |
|
666 | @@ -1,1 +1,5 @@ | |
667 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
667 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
668 | dd |
|
668 | dd | |
669 | +======= |
|
669 | +======= | |
670 | +cc |
|
670 | +cc | |
671 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
671 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
672 | diff --git a/z b/zz |
|
672 | diff --git a/z b/zz | |
673 | rename from z |
|
673 | rename from z | |
674 | rename to zz |
|
674 | rename to zz | |
675 |
|
675 | |||
676 | $ hg debugrename aa |
|
676 | $ hg debugrename aa | |
677 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
677 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
678 | $ hg debugrename zz |
|
678 | $ hg debugrename zz | |
679 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
679 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a | |
680 | $ hg debugrename cc |
|
680 | $ hg debugrename cc | |
681 | cc not renamed |
|
681 | cc not renamed | |
682 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit |
|
682 | $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit | |
683 | HGEDITFORM=commit.amend.merge |
|
683 | HGEDITFORM=commit.amend.merge | |
684 | $ hg log --config diff.git=1 -pr . |
|
684 | $ hg log --config diff.git=1 -pr . | |
685 | changeset: 21:4b0631ef043e |
|
685 | changeset: 21:4b0631ef043e | |
686 | tag: tip |
|
686 | tag: tip | |
687 | parent: 19:30d96aeaf27b |
|
687 | parent: 19:30d96aeaf27b | |
688 | parent: 18:1aa437659d19 |
|
688 | parent: 18:1aa437659d19 | |
689 | user: test |
|
689 | user: test | |
690 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
690 | date: Thu Jan 01 00:00:00 1970 +0000 | |
691 | summary: merge bar (amend message) |
|
691 | summary: merge bar (amend message) | |
692 |
|
692 | |||
693 | diff --git a/a b/aa |
|
693 | diff --git a/a b/aa | |
694 | copy from a |
|
694 | copy from a | |
695 | copy to aa |
|
695 | copy to aa | |
696 | diff --git a/cc b/cc |
|
696 | diff --git a/cc b/cc | |
697 | --- a/cc |
|
697 | --- a/cc | |
698 | +++ b/cc |
|
698 | +++ b/cc | |
699 | @@ -1,1 +1,5 @@ |
|
699 | @@ -1,1 +1,5 @@ | |
700 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
700 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
701 | dd |
|
701 | dd | |
702 | +======= |
|
702 | +======= | |
703 | +cc |
|
703 | +cc | |
704 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
704 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
705 | diff --git a/z b/zz |
|
705 | diff --git a/z b/zz | |
706 | rename from z |
|
706 | rename from z | |
707 | rename to zz |
|
707 | rename to zz | |
708 |
|
708 | |||
709 | $ hg debugrename aa |
|
709 | $ hg debugrename aa | |
710 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
710 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
711 | $ hg debugrename zz |
|
711 | $ hg debugrename zz | |
712 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a |
|
712 | zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a | |
713 | $ hg debugrename cc |
|
713 | $ hg debugrename cc | |
714 | cc not renamed |
|
714 | cc not renamed | |
715 | $ hg mv zz z |
|
715 | $ hg mv zz z | |
716 | $ hg ci --amend -m 'merge bar (undo rename)' |
|
716 | $ hg ci --amend -m 'merge bar (undo rename)' | |
717 | $ hg log --config diff.git=1 -pr . |
|
717 | $ hg log --config diff.git=1 -pr . | |
718 | changeset: 22:06423be42d60 |
|
718 | changeset: 22:06423be42d60 | |
719 | tag: tip |
|
719 | tag: tip | |
720 | parent: 19:30d96aeaf27b |
|
720 | parent: 19:30d96aeaf27b | |
721 | parent: 18:1aa437659d19 |
|
721 | parent: 18:1aa437659d19 | |
722 | user: test |
|
722 | user: test | |
723 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
723 | date: Thu Jan 01 00:00:00 1970 +0000 | |
724 | summary: merge bar (undo rename) |
|
724 | summary: merge bar (undo rename) | |
725 |
|
725 | |||
726 | diff --git a/a b/aa |
|
726 | diff --git a/a b/aa | |
727 | copy from a |
|
727 | copy from a | |
728 | copy to aa |
|
728 | copy to aa | |
729 | diff --git a/cc b/cc |
|
729 | diff --git a/cc b/cc | |
730 | --- a/cc |
|
730 | --- a/cc | |
731 | +++ b/cc |
|
731 | +++ b/cc | |
732 | @@ -1,1 +1,5 @@ |
|
732 | @@ -1,1 +1,5 @@ | |
733 | +<<<<<<< working copy: 30d96aeaf27b - test: aa |
|
733 | +<<<<<<< working copy: 30d96aeaf27b - test: aa | |
734 | dd |
|
734 | dd | |
735 | +======= |
|
735 | +======= | |
736 | +cc |
|
736 | +cc | |
737 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc |
|
737 | +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc | |
738 |
|
738 | |||
739 | $ hg debugrename z |
|
739 | $ hg debugrename z | |
740 | z not renamed |
|
740 | z not renamed | |
741 |
|
741 | |||
742 | Amend a merge changeset (with renames during the merge): |
|
742 | Amend a merge changeset (with renames during the merge): | |
743 |
|
743 | |||
744 | $ hg up -q bar |
|
744 | $ hg up -q bar | |
745 | $ echo x > x |
|
745 | $ echo x > x | |
746 | $ hg add x |
|
746 | $ hg add x | |
747 | $ hg ci -m x |
|
747 | $ hg ci -m x | |
748 | $ hg up -q default |
|
748 | $ hg up -q default | |
749 | $ hg merge -q bar |
|
749 | $ hg merge -q bar | |
750 | $ hg mv aa aaa |
|
750 | $ hg mv aa aaa | |
751 | $ echo aa >> aaa |
|
751 | $ echo aa >> aaa | |
752 | $ hg ci -m 'merge bar again' |
|
752 | $ hg ci -m 'merge bar again' | |
753 | $ hg log --config diff.git=1 -pr . |
|
753 | $ hg log --config diff.git=1 -pr . | |
754 | changeset: 24:a89974a20457 |
|
754 | changeset: 24:a89974a20457 | |
755 | tag: tip |
|
755 | tag: tip | |
756 | parent: 22:06423be42d60 |
|
756 | parent: 22:06423be42d60 | |
757 | parent: 23:4c94d5bc65f5 |
|
757 | parent: 23:4c94d5bc65f5 | |
758 | user: test |
|
758 | user: test | |
759 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
759 | date: Thu Jan 01 00:00:00 1970 +0000 | |
760 | summary: merge bar again |
|
760 | summary: merge bar again | |
761 |
|
761 | |||
762 | diff --git a/aa b/aa |
|
762 | diff --git a/aa b/aa | |
763 | deleted file mode 100644 |
|
763 | deleted file mode 100644 | |
764 | --- a/aa |
|
764 | --- a/aa | |
765 | +++ /dev/null |
|
765 | +++ /dev/null | |
766 | @@ -1,2 +0,0 @@ |
|
766 | @@ -1,2 +0,0 @@ | |
767 | -a |
|
767 | -a | |
768 | -a |
|
768 | -a | |
769 | diff --git a/aaa b/aaa |
|
769 | diff --git a/aaa b/aaa | |
770 | new file mode 100644 |
|
770 | new file mode 100644 | |
771 | --- /dev/null |
|
771 | --- /dev/null | |
772 | +++ b/aaa |
|
772 | +++ b/aaa | |
773 | @@ -0,0 +1,3 @@ |
|
773 | @@ -0,0 +1,3 @@ | |
774 | +a |
|
774 | +a | |
775 | +a |
|
775 | +a | |
776 | +aa |
|
776 | +aa | |
777 | diff --git a/x b/x |
|
777 | diff --git a/x b/x | |
778 | new file mode 100644 |
|
778 | new file mode 100644 | |
779 | --- /dev/null |
|
779 | --- /dev/null | |
780 | +++ b/x |
|
780 | +++ b/x | |
781 | @@ -0,0 +1,1 @@ |
|
781 | @@ -0,0 +1,1 @@ | |
782 | +x |
|
782 | +x | |
783 |
|
783 | |||
784 | $ hg debugrename aaa |
|
784 | $ hg debugrename aaa | |
785 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 |
|
785 | aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980 | |
786 |
|
786 | |||
787 | Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists |
|
787 | Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists | |
788 | in p1 too, but it was recorded as copied from p2. |
|
788 | in p1 too, but it was recorded as copied from p2. | |
789 | $ echo modified >> aaa |
|
789 | $ echo modified >> aaa | |
790 | $ hg co -m '.^' -t :merge3 |
|
790 | $ hg co -m '.^' -t :merge3 | |
791 | file 'aaa' was deleted in other [destination] but was modified in local [working copy]. |
|
791 | file 'aaa' was deleted in other [destination] but was modified in local [working copy]. | |
792 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. |
|
792 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. | |
793 | What do you want to do? u |
|
793 | What do you want to do? u | |
794 | 1 files updated, 0 files merged, 1 files removed, 1 files unresolved |
|
794 | 1 files updated, 0 files merged, 1 files removed, 1 files unresolved | |
795 | use 'hg resolve' to retry unresolved file merges |
|
795 | use 'hg resolve' to retry unresolved file merges | |
796 | [1] |
|
796 | [1] | |
797 | $ hg co -C tip |
|
797 | $ hg co -C tip | |
798 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
798 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
799 |
|
799 | |||
800 | $ hg mv aaa aa |
|
800 | $ hg mv aaa aa | |
801 | $ hg ci --amend -m 'merge bar again (undo rename)' |
|
801 | $ hg ci --amend -m 'merge bar again (undo rename)' | |
802 | $ hg log --config diff.git=1 -pr . |
|
802 | $ hg log --config diff.git=1 -pr . | |
803 | changeset: 25:282080768800 |
|
803 | changeset: 25:282080768800 | |
804 | tag: tip |
|
804 | tag: tip | |
805 | parent: 22:06423be42d60 |
|
805 | parent: 22:06423be42d60 | |
806 | parent: 23:4c94d5bc65f5 |
|
806 | parent: 23:4c94d5bc65f5 | |
807 | user: test |
|
807 | user: test | |
808 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
808 | date: Thu Jan 01 00:00:00 1970 +0000 | |
809 | summary: merge bar again (undo rename) |
|
809 | summary: merge bar again (undo rename) | |
810 |
|
810 | |||
811 | diff --git a/aa b/aa |
|
811 | diff --git a/aa b/aa | |
812 | --- a/aa |
|
812 | --- a/aa | |
813 | +++ b/aa |
|
813 | +++ b/aa | |
814 | @@ -1,2 +1,3 @@ |
|
814 | @@ -1,2 +1,3 @@ | |
815 | a |
|
815 | a | |
816 | a |
|
816 | a | |
817 | +aa |
|
817 | +aa | |
818 | diff --git a/x b/x |
|
818 | diff --git a/x b/x | |
819 | new file mode 100644 |
|
819 | new file mode 100644 | |
820 | --- /dev/null |
|
820 | --- /dev/null | |
821 | +++ b/x |
|
821 | +++ b/x | |
822 | @@ -0,0 +1,1 @@ |
|
822 | @@ -0,0 +1,1 @@ | |
823 | +x |
|
823 | +x | |
824 |
|
824 | |||
825 | $ hg debugrename aa |
|
825 | $ hg debugrename aa | |
826 | aa not renamed |
|
826 | aa not renamed | |
827 | $ hg debugrename -r '.^' aa |
|
827 | $ hg debugrename -r '.^' aa | |
828 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e |
|
828 | aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e | |
829 |
|
829 | |||
830 | Amend a merge changeset (with manifest-level conflicts): |
|
830 | Amend a merge changeset (with manifest-level conflicts): | |
831 |
|
831 | |||
832 | $ hg up -q bar |
|
832 | $ hg up -q bar | |
833 | $ hg rm aa |
|
833 | $ hg rm aa | |
834 | $ hg ci -m 'rm aa' |
|
834 | $ hg ci -m 'rm aa' | |
835 | $ hg up -q default |
|
835 | $ hg up -q default | |
836 | $ echo aa >> aa |
|
836 | $ echo aa >> aa | |
837 | $ hg ci -m aa |
|
837 | $ hg ci -m aa | |
838 | $ hg merge -q bar --config ui.interactive=True << EOF |
|
838 | $ hg merge -q bar --config ui.interactive=True << EOF | |
839 | > c |
|
839 | > c | |
840 | > EOF |
|
840 | > EOF | |
841 | file 'aa' was deleted in other [merge rev] but was modified in local [working copy]. |
|
841 | file 'aa' was deleted in other [merge rev] but was modified in local [working copy]. | |
842 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. |
|
842 | You can use (c)hanged version, (d)elete, or leave (u)nresolved. | |
843 | What do you want to do? c |
|
843 | What do you want to do? c | |
844 | $ hg ci -m 'merge bar (with conflicts)' |
|
844 | $ hg ci -m 'merge bar (with conflicts)' | |
845 | $ hg log --config diff.git=1 -pr . |
|
845 | $ hg log --config diff.git=1 -pr . | |
846 | changeset: 28:ed15db12298d |
|
846 | changeset: 28:ed15db12298d | |
847 | tag: tip |
|
847 | tag: tip | |
848 | parent: 27:eb5adec0b43b |
|
848 | parent: 27:eb5adec0b43b | |
849 | parent: 26:67db8847a540 |
|
849 | parent: 26:67db8847a540 | |
850 | user: test |
|
850 | user: test | |
851 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
851 | date: Thu Jan 01 00:00:00 1970 +0000 | |
852 | summary: merge bar (with conflicts) |
|
852 | summary: merge bar (with conflicts) | |
853 |
|
853 | |||
854 |
|
854 | |||
855 | $ hg rm aa |
|
855 | $ hg rm aa | |
856 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' |
|
856 | $ hg ci --amend -m 'merge bar (with conflicts, amended)' | |
857 | $ hg log --config diff.git=1 -pr . |
|
857 | $ hg log --config diff.git=1 -pr . | |
858 | changeset: 29:0eeafd043f63 |
|
858 | changeset: 29:0eeafd043f63 | |
859 | tag: tip |
|
859 | tag: tip | |
860 | parent: 27:eb5adec0b43b |
|
860 | parent: 27:eb5adec0b43b | |
861 | parent: 26:67db8847a540 |
|
861 | parent: 26:67db8847a540 | |
862 | user: test |
|
862 | user: test | |
863 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
863 | date: Thu Jan 01 00:00:00 1970 +0000 | |
864 | summary: merge bar (with conflicts, amended) |
|
864 | summary: merge bar (with conflicts, amended) | |
865 |
|
865 | |||
866 | diff --git a/aa b/aa |
|
866 | diff --git a/aa b/aa | |
867 | deleted file mode 100644 |
|
867 | deleted file mode 100644 | |
868 | --- a/aa |
|
868 | --- a/aa | |
869 | +++ /dev/null |
|
869 | +++ /dev/null | |
870 | @@ -1,4 +0,0 @@ |
|
870 | @@ -1,4 +0,0 @@ | |
871 | -a |
|
871 | -a | |
872 | -a |
|
872 | -a | |
873 | -aa |
|
873 | -aa | |
874 | -aa |
|
874 | -aa | |
875 |
|
875 | |||
876 | Issue 3445: amending with --close-branch a commit that created a new head should fail |
|
876 | Issue 3445: amending with --close-branch a commit that created a new head should fail | |
877 | This shouldn't be possible: |
|
877 | This shouldn't be possible: | |
878 |
|
878 | |||
879 | $ hg up -q default |
|
879 | $ hg up -q default | |
880 | $ hg branch closewithamend |
|
880 | $ hg branch closewithamend | |
881 | marked working directory as branch closewithamend |
|
881 | marked working directory as branch closewithamend | |
882 | $ echo foo > foo |
|
882 | $ echo foo > foo | |
883 | $ hg add foo |
|
883 | $ hg add foo | |
884 | $ hg ci -m.. |
|
884 | $ hg ci -m.. | |
885 | $ hg ci --amend --close-branch -m 'closing' |
|
885 | $ hg ci --amend --close-branch -m 'closing' | |
886 | abort: can only close branch heads |
|
886 | abort: can only close branch heads | |
887 | [10] |
|
887 | [10] | |
888 |
|
888 | |||
889 | This silliness fails: |
|
889 | This silliness fails: | |
890 |
|
890 | |||
891 | $ hg branch silliness |
|
891 | $ hg branch silliness | |
892 | marked working directory as branch silliness |
|
892 | marked working directory as branch silliness | |
893 | $ echo b >> b |
|
893 | $ echo b >> b | |
894 | $ hg ci --close-branch -m'open and close' |
|
894 | $ hg ci --close-branch -m'open and close' | |
895 | abort: branch "silliness" has no heads to close |
|
895 | abort: branch "silliness" has no heads to close | |
896 | [10] |
|
896 | [10] | |
897 |
|
897 | |||
898 | Test that amend with --secret creates new secret changeset forcibly |
|
898 | Test that amend with --secret creates new secret changeset forcibly | |
899 | --------------------------------------------------------------------- |
|
899 | --------------------------------------------------------------------- | |
900 |
|
900 | |||
901 | $ hg phase '.^::.' |
|
901 | $ hg phase '.^::.' | |
902 | 29: draft |
|
902 | 29: draft | |
903 | 30: draft |
|
903 | 30: draft | |
904 | $ hg commit --amend --secret -m 'amend as secret' -q |
|
904 | $ hg commit --amend --secret -m 'amend as secret' -q | |
905 | $ hg phase '.^::.' |
|
905 | $ hg phase '.^::.' | |
906 | 29: draft |
|
906 | 29: draft | |
907 | 31: secret |
|
907 | 31: secret | |
908 |
|
908 | |||
909 | Test that amend with --edit invokes editor forcibly |
|
909 | Test that amend with --edit invokes editor forcibly | |
910 | --------------------------------------------------- |
|
910 | --------------------------------------------------- | |
911 |
|
911 | |||
912 | $ hg parents --template "{desc}\n" |
|
912 | $ hg parents --template "{desc}\n" | |
913 | amend as secret |
|
913 | amend as secret | |
914 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" |
|
914 | $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed" | |
915 | $ hg parents --template "{desc}\n" |
|
915 | $ hg parents --template "{desc}\n" | |
916 | editor should be suppressed |
|
916 | editor should be suppressed | |
917 |
|
917 | |||
918 | $ hg status --rev '.^1::.' |
|
918 | $ hg status --rev '.^1::.' | |
919 | A foo |
|
919 | A foo | |
920 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit |
|
920 | $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit | |
921 | editor should be invoked |
|
921 | editor should be invoked | |
922 |
|
922 | |||
923 |
|
923 | |||
924 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
924 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
925 | HG: Leave message empty to abort commit. |
|
925 | HG: Leave message empty to abort commit. | |
926 | HG: -- |
|
926 | HG: -- | |
927 | HG: user: test |
|
927 | HG: user: test | |
928 | HG: branch 'silliness' |
|
928 | HG: branch 'silliness' | |
929 | HG: added foo |
|
929 | HG: added foo | |
930 | $ hg parents --template "{desc}\n" |
|
930 | $ hg parents --template "{desc}\n" | |
931 | editor should be invoked |
|
931 | editor should be invoked | |
932 |
|
932 | |||
933 | Test that amend with --no-edit avoids the editor |
|
933 | Test that amend with --no-edit avoids the editor | |
934 | ------------------------------------------------ |
|
934 | ------------------------------------------------ | |
935 |
|
935 | |||
936 | $ hg commit --amend -m "before anything happens" |
|
936 | $ hg commit --amend -m "before anything happens" | |
937 | $ hg parents --template "{desc}\n" |
|
937 | $ hg parents --template "{desc}\n" | |
938 | before anything happens |
|
938 | before anything happens | |
939 | $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed" |
|
939 | $ HGEDITOR=cat hg commit --amend --no-edit -m "editor should be suppressed" | |
940 | $ hg parents --template "{desc}\n" |
|
940 | $ hg parents --template "{desc}\n" | |
941 | editor should be suppressed |
|
941 | editor should be suppressed | |
942 |
|
942 | |||
943 | (We need a file change here since we won't have a message change) |
|
943 | (We need a file change here since we won't have a message change) | |
944 | $ cp foo foo.orig |
|
944 | $ cp foo foo.orig | |
945 | $ echo hi >> foo |
|
945 | $ echo hi >> foo | |
946 | $ HGEDITOR=cat hg commit --amend --no-edit |
|
946 | $ HGEDITOR=cat hg commit --amend --no-edit | |
947 | $ hg parents --template "{desc}\n" |
|
947 | $ hg parents --template "{desc}\n" | |
948 | editor should be suppressed |
|
948 | editor should be suppressed | |
949 | $ hg status -mar |
|
949 | $ hg status -mar | |
950 | (Let's undo adding that "hi" so later tests don't need to be adjusted) |
|
950 | (Let's undo adding that "hi" so later tests don't need to be adjusted) | |
951 | $ mv foo.orig foo |
|
951 | $ mv foo.orig foo | |
952 | $ hg commit --amend --no-edit |
|
952 | $ hg commit --amend --no-edit | |
953 |
|
953 | |||
954 | Test that "diff()" in committemplate works correctly for amending |
|
954 | Test that "diff()" in committemplate works correctly for amending | |
955 | ----------------------------------------------------------------- |
|
955 | ----------------------------------------------------------------- | |
956 |
|
956 | |||
957 | $ cat >> .hg/hgrc <<EOF |
|
957 | $ cat >> .hg/hgrc <<EOF | |
958 | > [committemplate] |
|
958 | > [committemplate] | |
959 | > changeset.commit.amend = {desc}\n |
|
959 | > changeset.commit.amend = {desc}\n | |
960 | > HG: M: {file_mods} |
|
960 | > HG: M: {file_mods} | |
961 | > HG: A: {file_adds} |
|
961 | > HG: A: {file_adds} | |
962 | > HG: R: {file_dels} |
|
962 | > HG: R: {file_dels} | |
963 | > {splitlines(diff()) % 'HG: {line}\n'} |
|
963 | > {splitlines(diff()) % 'HG: {line}\n'} | |
964 | > EOF |
|
964 | > EOF | |
965 |
|
965 | |||
966 | $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n" |
|
966 | $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n" | |
967 | M: |
|
967 | M: | |
968 | A: foo |
|
968 | A: foo | |
969 | R: |
|
969 | R: | |
970 | $ hg status -amr |
|
970 | $ hg status -amr | |
971 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo" |
|
971 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo" | |
972 | expecting diff of foo |
|
972 | expecting diff of foo | |
973 |
|
973 | |||
974 | HG: M: |
|
974 | HG: M: | |
975 | HG: A: foo |
|
975 | HG: A: foo | |
976 | HG: R: |
|
976 | HG: R: | |
977 | HG: diff -r 0eeafd043f63 foo |
|
977 | HG: diff -r 0eeafd043f63 foo | |
978 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
978 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
979 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
979 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
980 | HG: @@ -0,0 +1,1 @@ |
|
980 | HG: @@ -0,0 +1,1 @@ | |
981 | HG: +foo |
|
981 | HG: +foo | |
982 |
|
982 | |||
983 | $ echo y > y |
|
983 | $ echo y > y | |
984 | $ hg add y |
|
984 | $ hg add y | |
985 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y" |
|
985 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y" | |
986 | expecting diff of foo and y |
|
986 | expecting diff of foo and y | |
987 |
|
987 | |||
988 | HG: M: |
|
988 | HG: M: | |
989 | HG: A: foo y |
|
989 | HG: A: foo y | |
990 | HG: R: |
|
990 | HG: R: | |
991 | HG: diff -r 0eeafd043f63 foo |
|
991 | HG: diff -r 0eeafd043f63 foo | |
992 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
992 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
993 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
993 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
994 | HG: @@ -0,0 +1,1 @@ |
|
994 | HG: @@ -0,0 +1,1 @@ | |
995 | HG: +foo |
|
995 | HG: +foo | |
996 | HG: diff -r 0eeafd043f63 y |
|
996 | HG: diff -r 0eeafd043f63 y | |
997 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
997 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
998 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
998 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
999 | HG: @@ -0,0 +1,1 @@ |
|
999 | HG: @@ -0,0 +1,1 @@ | |
1000 | HG: +y |
|
1000 | HG: +y | |
1001 |
|
1001 | |||
1002 | $ hg rm a |
|
1002 | $ hg rm a | |
1003 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" |
|
1003 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y" | |
1004 | expecting diff of a, foo and y |
|
1004 | expecting diff of a, foo and y | |
1005 |
|
1005 | |||
1006 | HG: M: |
|
1006 | HG: M: | |
1007 | HG: A: foo y |
|
1007 | HG: A: foo y | |
1008 | HG: R: a |
|
1008 | HG: R: a | |
1009 | HG: diff -r 0eeafd043f63 a |
|
1009 | HG: diff -r 0eeafd043f63 a | |
1010 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1010 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1011 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1011 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1012 | HG: @@ -1,2 +0,0 @@ |
|
1012 | HG: @@ -1,2 +0,0 @@ | |
1013 | HG: -a |
|
1013 | HG: -a | |
1014 | HG: -a |
|
1014 | HG: -a | |
1015 | HG: diff -r 0eeafd043f63 foo |
|
1015 | HG: diff -r 0eeafd043f63 foo | |
1016 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1016 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1017 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1017 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
1018 | HG: @@ -0,0 +1,1 @@ |
|
1018 | HG: @@ -0,0 +1,1 @@ | |
1019 | HG: +foo |
|
1019 | HG: +foo | |
1020 | HG: diff -r 0eeafd043f63 y |
|
1020 | HG: diff -r 0eeafd043f63 y | |
1021 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1021 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1022 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1022 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1023 | HG: @@ -0,0 +1,1 @@ |
|
1023 | HG: @@ -0,0 +1,1 @@ | |
1024 | HG: +y |
|
1024 | HG: +y | |
1025 |
|
1025 | |||
1026 | $ hg rm x |
|
1026 | $ hg rm x | |
1027 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" |
|
1027 | $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y" | |
1028 | expecting diff of a, foo, x and y |
|
1028 | expecting diff of a, foo, x and y | |
1029 |
|
1029 | |||
1030 | HG: M: |
|
1030 | HG: M: | |
1031 | HG: A: foo y |
|
1031 | HG: A: foo y | |
1032 | HG: R: a x |
|
1032 | HG: R: a x | |
1033 | HG: diff -r 0eeafd043f63 a |
|
1033 | HG: diff -r 0eeafd043f63 a | |
1034 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1034 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1035 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1035 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1036 | HG: @@ -1,2 +0,0 @@ |
|
1036 | HG: @@ -1,2 +0,0 @@ | |
1037 | HG: -a |
|
1037 | HG: -a | |
1038 | HG: -a |
|
1038 | HG: -a | |
1039 | HG: diff -r 0eeafd043f63 foo |
|
1039 | HG: diff -r 0eeafd043f63 foo | |
1040 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1040 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1041 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1041 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
1042 | HG: @@ -0,0 +1,1 @@ |
|
1042 | HG: @@ -0,0 +1,1 @@ | |
1043 | HG: +foo |
|
1043 | HG: +foo | |
1044 | HG: diff -r 0eeafd043f63 x |
|
1044 | HG: diff -r 0eeafd043f63 x | |
1045 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1045 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 | |
1046 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1046 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1047 | HG: @@ -1,1 +0,0 @@ |
|
1047 | HG: @@ -1,1 +0,0 @@ | |
1048 | HG: -x |
|
1048 | HG: -x | |
1049 | HG: diff -r 0eeafd043f63 y |
|
1049 | HG: diff -r 0eeafd043f63 y | |
1050 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1050 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1051 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1051 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1052 | HG: @@ -0,0 +1,1 @@ |
|
1052 | HG: @@ -0,0 +1,1 @@ | |
1053 | HG: +y |
|
1053 | HG: +y | |
1054 |
|
1054 | |||
1055 | $ echo cccc >> cc |
|
1055 | $ echo cccc >> cc | |
1056 | $ hg status -amr |
|
1056 | $ hg status -amr | |
1057 | M cc |
|
1057 | M cc | |
1058 | $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc |
|
1058 | $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc | |
1059 | cc should be excluded |
|
1059 | cc should be excluded | |
1060 |
|
1060 | |||
1061 | HG: M: |
|
1061 | HG: M: | |
1062 | HG: A: foo y |
|
1062 | HG: A: foo y | |
1063 | HG: R: a x |
|
1063 | HG: R: a x | |
1064 | HG: diff -r 0eeafd043f63 a |
|
1064 | HG: diff -r 0eeafd043f63 a | |
1065 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
1065 | HG: --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
1066 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1066 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1067 | HG: @@ -1,2 +0,0 @@ |
|
1067 | HG: @@ -1,2 +0,0 @@ | |
1068 | HG: -a |
|
1068 | HG: -a | |
1069 | HG: -a |
|
1069 | HG: -a | |
1070 | HG: diff -r 0eeafd043f63 foo |
|
1070 | HG: diff -r 0eeafd043f63 foo | |
1071 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1071 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1072 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 |
|
1072 | HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000 | |
1073 | HG: @@ -0,0 +1,1 @@ |
|
1073 | HG: @@ -0,0 +1,1 @@ | |
1074 | HG: +foo |
|
1074 | HG: +foo | |
1075 | HG: diff -r 0eeafd043f63 x |
|
1075 | HG: diff -r 0eeafd043f63 x | |
1076 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 |
|
1076 | HG: --- a/x Thu Jan 01 00:00:00 1970 +0000 | |
1077 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1077 | HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1078 | HG: @@ -1,1 +0,0 @@ |
|
1078 | HG: @@ -1,1 +0,0 @@ | |
1079 | HG: -x |
|
1079 | HG: -x | |
1080 | HG: diff -r 0eeafd043f63 y |
|
1080 | HG: diff -r 0eeafd043f63 y | |
1081 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
1081 | HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
1082 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
1082 | HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000 | |
1083 | HG: @@ -0,0 +1,1 @@ |
|
1083 | HG: @@ -0,0 +1,1 @@ | |
1084 | HG: +y |
|
1084 | HG: +y | |
1085 |
|
1085 | |||
1086 | Check for issue4405 |
|
1086 | Check for issue4405 | |
1087 | ------------------- |
|
1087 | ------------------- | |
1088 |
|
1088 | |||
1089 | Setup the repo with a file that gets moved in a second commit. |
|
1089 | Setup the repo with a file that gets moved in a second commit. | |
1090 | $ hg init repo |
|
1090 | $ hg init repo | |
1091 | $ cd repo |
|
1091 | $ cd repo | |
1092 | $ touch a0 |
|
1092 | $ touch a0 | |
1093 | $ hg add a0 |
|
1093 | $ hg add a0 | |
1094 | $ hg commit -m a0 |
|
1094 | $ hg commit -m a0 | |
1095 | $ hg mv a0 a1 |
|
1095 | $ hg mv a0 a1 | |
1096 | $ hg commit -m a1 |
|
1096 | $ hg commit -m a1 | |
1097 | $ hg up -q 0 |
|
1097 | $ hg up -q 0 | |
1098 | $ hg log -G --template '{rev} {desc}' |
|
1098 | $ hg log -G --template '{rev} {desc}' | |
1099 | o 1 a1 |
|
1099 | o 1 a1 | |
1100 | | |
|
1100 | | | |
1101 | @ 0 a0 |
|
1101 | @ 0 a0 | |
1102 |
|
1102 | |||
1103 |
|
1103 | |||
1104 | Now we branch the repro, but re-use the file contents, so we have a divergence |
|
1104 | Now we branch the repro, but re-use the file contents, so we have a divergence | |
1105 | in the file revlog topology and the changelog topology. |
|
1105 | in the file revlog topology and the changelog topology. | |
1106 | $ hg revert --rev 1 --all |
|
1106 | $ hg revert --rev 1 --all | |
1107 | removing a0 |
|
1107 | removing a0 | |
1108 | adding a1 |
|
1108 | adding a1 | |
1109 | $ hg ci -qm 'a1-amend' |
|
1109 | $ hg ci -qm 'a1-amend' | |
1110 | $ hg log -G --template '{rev} {desc}' |
|
1110 | $ hg log -G --template '{rev} {desc}' | |
1111 | @ 2 a1-amend |
|
1111 | @ 2 a1-amend | |
1112 | | |
|
1112 | | | |
1113 | | o 1 a1 |
|
1113 | | o 1 a1 | |
1114 | |/ |
|
1114 | |/ | |
1115 | o 0 a0 |
|
1115 | o 0 a0 | |
1116 |
|
1116 | |||
1117 |
|
1117 | |||
1118 | The way mercurial does amends is by folding the working copy and old commit |
|
1118 | The way mercurial does amends is by folding the working copy and old commit | |
1119 | together into another commit (rev 3). During this process, _findlimit is called |
|
1119 | together into another commit (rev 3). During this process, _findlimit is called | |
1120 | to check how far back to look for the transitive closure of file copy |
|
1120 | to check how far back to look for the transitive closure of file copy | |
1121 | information, but due to the divergence of the filelog and changelog graph |
|
1121 | information, but due to the divergence of the filelog and changelog graph | |
1122 | topologies, before _findlimit was fixed, it returned a rev which was not far |
|
1122 | topologies, before _findlimit was fixed, it returned a rev which was not far | |
1123 | enough back in this case. |
|
1123 | enough back in this case. | |
1124 | $ hg mv a1 a2 |
|
1124 | $ hg mv a1 a2 | |
1125 | $ hg status --copies --rev 0 |
|
1125 | $ hg status --copies --rev 0 | |
1126 | A a2 |
|
1126 | A a2 | |
1127 | a0 |
|
1127 | a0 | |
1128 | R a0 |
|
1128 | R a0 | |
1129 | $ hg ci --amend -q |
|
1129 | $ hg ci --amend -q | |
1130 | $ hg log -G --template '{rev} {desc}' |
|
1130 | $ hg log -G --template '{rev} {desc}' | |
1131 | @ 3 a1-amend |
|
1131 | @ 3 a1-amend | |
1132 | | |
|
1132 | | | |
1133 | | o 1 a1 |
|
1133 | | o 1 a1 | |
1134 | |/ |
|
1134 | |/ | |
1135 | o 0 a0 |
|
1135 | o 0 a0 | |
1136 |
|
1136 | |||
1137 |
|
1137 | |||
1138 | Before the fix, the copy information was lost. |
|
1138 | Before the fix, the copy information was lost. | |
1139 | $ hg status --copies --rev 0 |
|
1139 | $ hg status --copies --rev 0 | |
1140 | A a2 |
|
1140 | A a2 | |
1141 | a0 |
|
1141 | a0 | |
1142 | R a0 |
|
1142 | R a0 | |
1143 | $ cd .. |
|
1143 | $ cd .. | |
1144 |
|
1144 | |||
1145 | Check that amend properly preserve rename from directory rename (issue-4516) |
|
1145 | Check that amend properly preserve rename from directory rename (issue-4516) | |
1146 |
|
1146 | |||
1147 | If a parent of the merge renames a full directory, any files added to the old |
|
1147 | If a parent of the merge renames a full directory, any files added to the old | |
1148 | directory in the other parent will be renamed to the new directory. For some |
|
1148 | directory in the other parent will be renamed to the new directory. For some | |
1149 | reason, the rename metadata was when amending such merge. This test ensure we |
|
1149 | reason, the rename metadata was when amending such merge. This test ensure we | |
1150 | do not regress. We have a dedicated repo because it needs a setup with renamed |
|
1150 | do not regress. We have a dedicated repo because it needs a setup with renamed | |
1151 | directory) |
|
1151 | directory) | |
1152 |
|
1152 | |||
1153 | $ hg init issue4516 |
|
1153 | $ hg init issue4516 | |
1154 | $ cd issue4516 |
|
1154 | $ cd issue4516 | |
1155 | $ mkdir olddirname |
|
1155 | $ mkdir olddirname | |
1156 | $ echo line1 > olddirname/commonfile.py |
|
1156 | $ echo line1 > olddirname/commonfile.py | |
1157 | $ hg add olddirname/commonfile.py |
|
1157 | $ hg add olddirname/commonfile.py | |
1158 | $ hg ci -m first |
|
1158 | $ hg ci -m first | |
1159 |
|
1159 | |||
1160 | $ hg branch newdirname |
|
1160 | $ hg branch newdirname | |
1161 | marked working directory as branch newdirname |
|
1161 | marked working directory as branch newdirname | |
1162 | (branches are permanent and global, did you want a bookmark?) |
|
1162 | (branches are permanent and global, did you want a bookmark?) | |
1163 | $ hg mv olddirname newdirname |
|
1163 | $ hg mv olddirname newdirname | |
1164 | moving olddirname/commonfile.py to newdirname/commonfile.py |
|
1164 | moving olddirname/commonfile.py to newdirname/commonfile.py | |
1165 | $ hg ci -m rename |
|
1165 | $ hg ci -m rename | |
1166 |
|
1166 | |||
1167 | $ hg update default |
|
1167 | $ hg update default | |
1168 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
1168 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
1169 | $ echo line1 > olddirname/newfile.py |
|
1169 | $ echo line1 > olddirname/newfile.py | |
1170 | $ hg add olddirname/newfile.py |
|
1170 | $ hg add olddirname/newfile.py | |
1171 | $ hg ci -m log |
|
1171 | $ hg ci -m log | |
1172 |
|
1172 | |||
1173 | $ hg up newdirname |
|
1173 | $ hg up newdirname | |
1174 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
1174 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
1175 | $ # create newdirname/newfile.py |
|
1175 | $ # create newdirname/newfile.py | |
1176 | $ hg merge default |
|
1176 | $ hg merge default | |
1177 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
1177 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
1178 | (branch merge, don't forget to commit) |
|
1178 | (branch merge, don't forget to commit) | |
1179 | $ hg ci -m add |
|
1179 | $ hg ci -m add | |
1180 | $ |
|
1180 | $ | |
1181 | $ hg debugrename newdirname/newfile.py |
|
1181 | $ hg debugrename newdirname/newfile.py | |
1182 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def |
|
1182 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def | |
1183 | $ hg status -C --change . |
|
1183 | $ hg status -C --change . | |
1184 | A newdirname/newfile.py |
|
1184 | A newdirname/newfile.py | |
1185 | $ hg status -C --rev 1 |
|
1185 | $ hg status -C --rev 1 | |
1186 | A newdirname/newfile.py |
|
1186 | A newdirname/newfile.py | |
1187 | $ hg status -C --rev 2 |
|
1187 | $ hg status -C --rev 2 | |
1188 | A newdirname/commonfile.py |
|
1188 | A newdirname/commonfile.py | |
1189 | olddirname/commonfile.py |
|
1189 | olddirname/commonfile.py | |
1190 | A newdirname/newfile.py |
|
1190 | A newdirname/newfile.py | |
1191 | olddirname/newfile.py |
|
1191 | olddirname/newfile.py | |
1192 | R olddirname/commonfile.py |
|
1192 | R olddirname/commonfile.py | |
1193 | R olddirname/newfile.py |
|
1193 | R olddirname/newfile.py | |
1194 | $ hg debugindex newdirname/newfile.py |
|
1194 | $ hg debugindex newdirname/newfile.py | |
1195 | rev linkrev nodeid p1 p2 |
|
1195 | rev linkrev nodeid p1 p2 | |
1196 | 0 3 34a4d536c0c0 000000000000 000000000000 |
|
1196 | 0 3 34a4d536c0c0 000000000000 000000000000 | |
1197 |
|
1197 | |||
1198 | $ echo a >> newdirname/commonfile.py |
|
1198 | $ echo a >> newdirname/commonfile.py | |
1199 | $ hg ci --amend -m bug |
|
1199 | $ hg ci --amend -m bug | |
1200 | $ hg debugrename newdirname/newfile.py |
|
1200 | $ hg debugrename newdirname/newfile.py | |
1201 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def |
|
1201 | newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def | |
1202 | $ hg debugindex newdirname/newfile.py |
|
1202 | $ hg debugindex newdirname/newfile.py | |
1203 | rev linkrev nodeid p1 p2 |
|
1203 | rev linkrev nodeid p1 p2 | |
1204 | 0 3 34a4d536c0c0 000000000000 000000000000 |
|
1204 | 0 3 34a4d536c0c0 000000000000 000000000000 | |
1205 |
|
1205 | |||
1206 | #if execbit |
|
1206 | #if execbit | |
1207 |
|
1207 | |||
1208 | Test if amend preserves executable bit changes |
|
1208 | Test if amend preserves executable bit changes | |
1209 | $ chmod +x newdirname/commonfile.py |
|
1209 | $ chmod +x newdirname/commonfile.py | |
1210 | $ hg ci -m chmod |
|
1210 | $ hg ci -m chmod | |
1211 | $ hg ci --amend -m "chmod amended" |
|
1211 | $ hg ci --amend -m "chmod amended" | |
1212 | $ hg ci --amend -m "chmod amended second time" |
|
1212 | $ hg ci --amend -m "chmod amended second time" | |
1213 | $ hg log -p --git -r . |
|
1213 | $ hg log -p --git -r . | |
1214 | changeset: 7:b1326f52dddf |
|
1214 | changeset: 7:b1326f52dddf | |
1215 | branch: newdirname |
|
1215 | branch: newdirname | |
1216 | tag: tip |
|
1216 | tag: tip | |
1217 | parent: 4:7fd235f7cb2f |
|
1217 | parent: 4:7fd235f7cb2f | |
1218 | user: test |
|
1218 | user: test | |
1219 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
1219 | date: Thu Jan 01 00:00:00 1970 +0000 | |
1220 | summary: chmod amended second time |
|
1220 | summary: chmod amended second time | |
1221 |
|
1221 | |||
1222 | diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py |
|
1222 | diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py | |
1223 | old mode 100644 |
|
1223 | old mode 100644 | |
1224 | new mode 100755 |
|
1224 | new mode 100755 | |
1225 |
|
1225 | |||
1226 | #endif |
|
1226 | #endif | |
1227 |
|
1227 | |||
1228 | Test amend with file inclusion options |
|
1228 | Test amend with file inclusion options | |
1229 | -------------------------------------- |
|
1229 | -------------------------------------- | |
1230 |
|
1230 | |||
1231 | These tests ensure that we are always amending some files that were part of the |
|
1231 | These tests ensure that we are always amending some files that were part of the | |
1232 | pre-amend commit. We want to test that the remaining files in the pre-amend |
|
1232 | pre-amend commit. We want to test that the remaining files in the pre-amend | |
1233 | commit were not changed in the amended commit. We do so by performing a diff of |
|
1233 | commit were not changed in the amended commit. We do so by performing a diff of | |
1234 | the amended commit against its parent commit. |
|
1234 | the amended commit against its parent commit. | |
1235 | $ cd .. |
|
1235 | $ cd .. | |
1236 | $ hg init testfileinclusions |
|
1236 | $ hg init testfileinclusions | |
1237 | $ cd testfileinclusions |
|
1237 | $ cd testfileinclusions | |
1238 | $ echo a > a |
|
1238 | $ echo a > a | |
1239 | $ echo b > b |
|
1239 | $ echo b > b | |
1240 | $ hg commit -Aqm "Adding a and b" |
|
1240 | $ hg commit -Aqm "Adding a and b" | |
1241 |
|
1241 | |||
1242 | Only add changes to a particular file |
|
1242 | Only add changes to a particular file | |
1243 | $ echo a >> a |
|
1243 | $ echo a >> a | |
1244 | $ echo b >> b |
|
1244 | $ echo b >> b | |
1245 | $ hg commit --amend -I a |
|
1245 | $ hg commit --amend -I a | |
1246 | $ hg diff --git -r null -r . |
|
1246 | $ hg diff --git -r null -r . | |
1247 | diff --git a/a b/a |
|
1247 | diff --git a/a b/a | |
1248 | new file mode 100644 |
|
1248 | new file mode 100644 | |
1249 | --- /dev/null |
|
1249 | --- /dev/null | |
1250 | +++ b/a |
|
1250 | +++ b/a | |
1251 | @@ -0,0 +1,2 @@ |
|
1251 | @@ -0,0 +1,2 @@ | |
1252 | +a |
|
1252 | +a | |
1253 | +a |
|
1253 | +a | |
1254 | diff --git a/b b/b |
|
1254 | diff --git a/b b/b | |
1255 | new file mode 100644 |
|
1255 | new file mode 100644 | |
1256 | --- /dev/null |
|
1256 | --- /dev/null | |
1257 | +++ b/b |
|
1257 | +++ b/b | |
1258 | @@ -0,0 +1,1 @@ |
|
1258 | @@ -0,0 +1,1 @@ | |
1259 | +b |
|
1259 | +b | |
1260 |
|
1260 | |||
1261 | $ echo a >> a |
|
1261 | $ echo a >> a | |
1262 | $ hg commit --amend b |
|
1262 | $ hg commit --amend b | |
1263 | $ hg diff --git -r null -r . |
|
1263 | $ hg diff --git -r null -r . | |
1264 | diff --git a/a b/a |
|
1264 | diff --git a/a b/a | |
1265 | new file mode 100644 |
|
1265 | new file mode 100644 | |
1266 | --- /dev/null |
|
1266 | --- /dev/null | |
1267 | +++ b/a |
|
1267 | +++ b/a | |
1268 | @@ -0,0 +1,2 @@ |
|
1268 | @@ -0,0 +1,2 @@ | |
1269 | +a |
|
1269 | +a | |
1270 | +a |
|
1270 | +a | |
1271 | diff --git a/b b/b |
|
1271 | diff --git a/b b/b | |
1272 | new file mode 100644 |
|
1272 | new file mode 100644 | |
1273 | --- /dev/null |
|
1273 | --- /dev/null | |
1274 | +++ b/b |
|
1274 | +++ b/b | |
1275 | @@ -0,0 +1,2 @@ |
|
1275 | @@ -0,0 +1,2 @@ | |
1276 | +b |
|
1276 | +b | |
1277 | +b |
|
1277 | +b | |
1278 |
|
1278 | |||
1279 | Exclude changes to a particular file |
|
1279 | Exclude changes to a particular file | |
1280 | $ echo b >> b |
|
1280 | $ echo b >> b | |
1281 | $ hg commit --amend -X a |
|
1281 | $ hg commit --amend -X a | |
1282 | $ hg diff --git -r null -r . |
|
1282 | $ hg diff --git -r null -r . | |
1283 | diff --git a/a b/a |
|
1283 | diff --git a/a b/a | |
1284 | new file mode 100644 |
|
1284 | new file mode 100644 | |
1285 | --- /dev/null |
|
1285 | --- /dev/null | |
1286 | +++ b/a |
|
1286 | +++ b/a | |
1287 | @@ -0,0 +1,2 @@ |
|
1287 | @@ -0,0 +1,2 @@ | |
1288 | +a |
|
1288 | +a | |
1289 | +a |
|
1289 | +a | |
1290 | diff --git a/b b/b |
|
1290 | diff --git a/b b/b | |
1291 | new file mode 100644 |
|
1291 | new file mode 100644 | |
1292 | --- /dev/null |
|
1292 | --- /dev/null | |
1293 | +++ b/b |
|
1293 | +++ b/b | |
1294 | @@ -0,0 +1,3 @@ |
|
1294 | @@ -0,0 +1,3 @@ | |
1295 | +b |
|
1295 | +b | |
1296 | +b |
|
1296 | +b | |
1297 | +b |
|
1297 | +b | |
1298 |
|
1298 | |||
1299 | Check the addremove flag |
|
1299 | Check the addremove flag | |
1300 | $ echo c > c |
|
1300 | $ echo c > c | |
1301 | $ rm a |
|
1301 | $ rm a | |
1302 | $ hg commit --amend -A |
|
1302 | $ hg commit --amend -A | |
1303 | removing a |
|
1303 | removing a | |
1304 | adding c |
|
1304 | adding c | |
1305 | $ hg diff --git -r null -r . |
|
1305 | $ hg diff --git -r null -r . | |
1306 | diff --git a/b b/b |
|
1306 | diff --git a/b b/b | |
1307 | new file mode 100644 |
|
1307 | new file mode 100644 | |
1308 | --- /dev/null |
|
1308 | --- /dev/null | |
1309 | +++ b/b |
|
1309 | +++ b/b | |
1310 | @@ -0,0 +1,3 @@ |
|
1310 | @@ -0,0 +1,3 @@ | |
1311 | +b |
|
1311 | +b | |
1312 | +b |
|
1312 | +b | |
1313 | +b |
|
1313 | +b | |
1314 | diff --git a/c b/c |
|
1314 | diff --git a/c b/c | |
1315 | new file mode 100644 |
|
1315 | new file mode 100644 | |
1316 | --- /dev/null |
|
1316 | --- /dev/null | |
1317 | +++ b/c |
|
1317 | +++ b/c | |
1318 | @@ -0,0 +1,1 @@ |
|
1318 | @@ -0,0 +1,1 @@ | |
1319 | +c |
|
1319 | +c |
@@ -1,1693 +1,1693 b'' | |||||
1 | A script that implements uppercasing of specific lines in a file. This |
|
1 | A script that implements uppercasing of specific lines in a file. This | |
2 | approximates the behavior of code formatters well enough for our tests. |
|
2 | approximates the behavior of code formatters well enough for our tests. | |
3 |
|
3 | |||
4 | $ UPPERCASEPY="$TESTTMP/uppercase.py" |
|
4 | $ UPPERCASEPY="$TESTTMP/uppercase.py" | |
5 | $ cat > $UPPERCASEPY <<EOF |
|
5 | $ cat > $UPPERCASEPY <<EOF | |
6 | > import sys |
|
6 | > import sys | |
7 | > from mercurial.utils.procutil import setbinary |
|
7 | > from mercurial.utils.procutil import setbinary | |
8 | > setbinary(sys.stdin) |
|
8 | > setbinary(sys.stdin) | |
9 | > setbinary(sys.stdout) |
|
9 | > setbinary(sys.stdout) | |
10 | > lines = set() |
|
10 | > lines = set() | |
11 | > for arg in sys.argv[1:]: |
|
11 | > for arg in sys.argv[1:]: | |
12 | > if arg == 'all': |
|
12 | > if arg == 'all': | |
13 | > sys.stdout.write(sys.stdin.read().upper()) |
|
13 | > sys.stdout.write(sys.stdin.read().upper()) | |
14 | > sys.exit(0) |
|
14 | > sys.exit(0) | |
15 | > else: |
|
15 | > else: | |
16 | > first, last = arg.split('-') |
|
16 | > first, last = arg.split('-') | |
17 | > lines.update(range(int(first), int(last) + 1)) |
|
17 | > lines.update(range(int(first), int(last) + 1)) | |
18 | > for i, line in enumerate(sys.stdin.readlines()): |
|
18 | > for i, line in enumerate(sys.stdin.readlines()): | |
19 | > if i + 1 in lines: |
|
19 | > if i + 1 in lines: | |
20 | > sys.stdout.write(line.upper()) |
|
20 | > sys.stdout.write(line.upper()) | |
21 | > else: |
|
21 | > else: | |
22 | > sys.stdout.write(line) |
|
22 | > sys.stdout.write(line) | |
23 | > EOF |
|
23 | > EOF | |
24 | $ TESTLINES="foo\nbar\nbaz\nqux\n" |
|
24 | $ TESTLINES="foo\nbar\nbaz\nqux\n" | |
25 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY |
|
25 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY | |
26 | foo |
|
26 | foo | |
27 | bar |
|
27 | bar | |
28 | baz |
|
28 | baz | |
29 | qux |
|
29 | qux | |
30 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY all |
|
30 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY all | |
31 | FOO |
|
31 | FOO | |
32 | BAR |
|
32 | BAR | |
33 | BAZ |
|
33 | BAZ | |
34 | QUX |
|
34 | QUX | |
35 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-1 |
|
35 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-1 | |
36 | FOO |
|
36 | FOO | |
37 | bar |
|
37 | bar | |
38 | baz |
|
38 | baz | |
39 | qux |
|
39 | qux | |
40 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-2 |
|
40 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 1-2 | |
41 | FOO |
|
41 | FOO | |
42 | BAR |
|
42 | BAR | |
43 | baz |
|
43 | baz | |
44 | qux |
|
44 | qux | |
45 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-3 |
|
45 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-3 | |
46 | foo |
|
46 | foo | |
47 | BAR |
|
47 | BAR | |
48 | BAZ |
|
48 | BAZ | |
49 | qux |
|
49 | qux | |
50 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-2 4-4 |
|
50 | $ printf $TESTLINES | "$PYTHON" $UPPERCASEPY 2-2 4-4 | |
51 | foo |
|
51 | foo | |
52 | BAR |
|
52 | BAR | |
53 | baz |
|
53 | baz | |
54 | QUX |
|
54 | QUX | |
55 |
|
55 | |||
56 | Set up the config with two simple fixers: one that fixes specific line ranges, |
|
56 | Set up the config with two simple fixers: one that fixes specific line ranges, | |
57 | and one that always fixes the whole file. They both "fix" files by converting |
|
57 | and one that always fixes the whole file. They both "fix" files by converting | |
58 | letters to uppercase. They use different file extensions, so each test case can |
|
58 | letters to uppercase. They use different file extensions, so each test case can | |
59 | choose which behavior to use by naming files. |
|
59 | choose which behavior to use by naming files. | |
60 |
|
60 | |||
61 | $ cat >> $HGRCPATH <<EOF |
|
61 | $ cat >> $HGRCPATH <<EOF | |
62 | > [extensions] |
|
62 | > [extensions] | |
63 | > fix = |
|
63 | > fix = | |
64 | > [experimental] |
|
64 | > [experimental] | |
65 | > evolution.createmarkers=True |
|
65 | > evolution.createmarkers=True | |
66 | > evolution.allowunstable=True |
|
66 | > evolution.allowunstable=True | |
67 | > [fix] |
|
67 | > [fix] | |
68 | > uppercase-whole-file:command="$PYTHON" $UPPERCASEPY all |
|
68 | > uppercase-whole-file:command="$PYTHON" $UPPERCASEPY all | |
69 | > uppercase-whole-file:pattern=set:**.whole |
|
69 | > uppercase-whole-file:pattern=set:**.whole | |
70 | > uppercase-changed-lines:command="$PYTHON" $UPPERCASEPY |
|
70 | > uppercase-changed-lines:command="$PYTHON" $UPPERCASEPY | |
71 | > uppercase-changed-lines:linerange={first}-{last} |
|
71 | > uppercase-changed-lines:linerange={first}-{last} | |
72 | > uppercase-changed-lines:pattern=set:**.changed |
|
72 | > uppercase-changed-lines:pattern=set:**.changed | |
73 | > EOF |
|
73 | > EOF | |
74 |
|
74 | |||
75 | Help text for fix. |
|
75 | Help text for fix. | |
76 |
|
76 | |||
77 | $ hg help fix |
|
77 | $ hg help fix | |
78 | hg fix [OPTION]... [FILE]... |
|
78 | hg fix [OPTION]... [FILE]... | |
79 |
|
79 | |||
80 | rewrite file content in changesets or working directory |
|
80 | rewrite file content in changesets or working directory | |
81 |
|
81 | |||
82 | Runs any configured tools to fix the content of files. Only affects files |
|
82 | Runs any configured tools to fix the content of files. Only affects files | |
83 | with changes, unless file arguments are provided. Only affects changed |
|
83 | with changes, unless file arguments are provided. Only affects changed | |
84 | lines of files, unless the --whole flag is used. Some tools may always |
|
84 | lines of files, unless the --whole flag is used. Some tools may always | |
85 | affect the whole file regardless of --whole. |
|
85 | affect the whole file regardless of --whole. | |
86 |
|
86 | |||
87 | If --working-dir is used, files with uncommitted changes in the working |
|
87 | If --working-dir is used, files with uncommitted changes in the working | |
88 | copy will be fixed. Note that no backup are made. |
|
88 | copy will be fixed. Note that no backup are made. | |
89 |
|
89 | |||
90 | If revisions are specified with --source, those revisions and their |
|
90 | If revisions are specified with --source, those revisions and their | |
91 | descendants will be checked, and they may be replaced with new revisions |
|
91 | descendants will be checked, and they may be replaced with new revisions | |
92 | that have fixed file content. By automatically including the descendants, |
|
92 | that have fixed file content. By automatically including the descendants, | |
93 | no merging, rebasing, or evolution will be required. If an ancestor of the |
|
93 | no merging, rebasing, or evolution will be required. If an ancestor of the | |
94 | working copy is included, then the working copy itself will also be fixed, |
|
94 | working copy is included, then the working copy itself will also be fixed, | |
95 | and the working copy will be updated to the fixed parent. |
|
95 | and the working copy will be updated to the fixed parent. | |
96 |
|
96 | |||
97 | When determining what lines of each file to fix at each revision, the |
|
97 | When determining what lines of each file to fix at each revision, the | |
98 | whole set of revisions being fixed is considered, so that fixes to earlier |
|
98 | whole set of revisions being fixed is considered, so that fixes to earlier | |
99 | revisions are not forgotten in later ones. The --base flag can be used to |
|
99 | revisions are not forgotten in later ones. The --base flag can be used to | |
100 | override this default behavior, though it is not usually desirable to do |
|
100 | override this default behavior, though it is not usually desirable to do | |
101 | so. |
|
101 | so. | |
102 |
|
102 | |||
103 | (use 'hg help -e fix' to show help for the fix extension) |
|
103 | (use 'hg help -e fix' to show help for the fix extension) | |
104 |
|
104 | |||
105 | options ([+] can be repeated): |
|
105 | options ([+] can be repeated): | |
106 |
|
106 | |||
107 | --all fix all non-public non-obsolete revisions |
|
107 | --all fix all non-public non-obsolete revisions | |
108 | --base REV [+] revisions to diff against (overrides automatic selection, |
|
108 | --base REV [+] revisions to diff against (overrides automatic selection, | |
109 | and applies to every revision being fixed) |
|
109 | and applies to every revision being fixed) | |
110 | -s --source REV [+] fix the specified revisions and their descendants |
|
110 | -s --source REV [+] fix the specified revisions and their descendants | |
111 | -w --working-dir fix the working directory |
|
111 | -w --working-dir fix the working directory | |
112 | --whole always fix every line of a file |
|
112 | --whole always fix every line of a file | |
113 |
|
113 | |||
114 | (some details hidden, use --verbose to show complete help) |
|
114 | (some details hidden, use --verbose to show complete help) | |
115 |
|
115 | |||
116 | $ hg help -e fix |
|
116 | $ hg help -e fix | |
117 | fix extension - rewrite file content in changesets or working copy |
|
117 | fix extension - rewrite file content in changesets or working copy | |
118 | (EXPERIMENTAL) |
|
118 | (EXPERIMENTAL) | |
119 |
|
119 | |||
120 | Provides a command that runs configured tools on the contents of modified |
|
120 | Provides a command that runs configured tools on the contents of modified | |
121 | files, writing back any fixes to the working copy or replacing changesets. |
|
121 | files, writing back any fixes to the working copy or replacing changesets. | |
122 |
|
122 | |||
123 | Here is an example configuration that causes 'hg fix' to apply automatic |
|
123 | Here is an example configuration that causes 'hg fix' to apply automatic | |
124 | formatting fixes to modified lines in C++ code: |
|
124 | formatting fixes to modified lines in C++ code: | |
125 |
|
125 | |||
126 | [fix] |
|
126 | [fix] | |
127 | clang-format:command=clang-format --assume-filename={rootpath} |
|
127 | clang-format:command=clang-format --assume-filename={rootpath} | |
128 | clang-format:linerange=--lines={first}:{last} |
|
128 | clang-format:linerange=--lines={first}:{last} | |
129 | clang-format:pattern=set:**.cpp or **.hpp |
|
129 | clang-format:pattern=set:**.cpp or **.hpp | |
130 |
|
130 | |||
131 | The :command suboption forms the first part of the shell command that will be |
|
131 | The :command suboption forms the first part of the shell command that will be | |
132 | used to fix a file. The content of the file is passed on standard input, and |
|
132 | used to fix a file. The content of the file is passed on standard input, and | |
133 | the fixed file content is expected on standard output. Any output on standard |
|
133 | the fixed file content is expected on standard output. Any output on standard | |
134 | error will be displayed as a warning. If the exit status is not zero, the file |
|
134 | error will be displayed as a warning. If the exit status is not zero, the file | |
135 | will not be affected. A placeholder warning is displayed if there is a non- |
|
135 | will not be affected. A placeholder warning is displayed if there is a non- | |
136 | zero exit status but no standard error output. Some values may be substituted |
|
136 | zero exit status but no standard error output. Some values may be substituted | |
137 | into the command: |
|
137 | into the command: | |
138 |
|
138 | |||
139 | {rootpath} The path of the file being fixed, relative to the repo root |
|
139 | {rootpath} The path of the file being fixed, relative to the repo root | |
140 | {basename} The name of the file being fixed, without the directory path |
|
140 | {basename} The name of the file being fixed, without the directory path | |
141 |
|
141 | |||
142 | If the :linerange suboption is set, the tool will only be run if there are |
|
142 | If the :linerange suboption is set, the tool will only be run if there are | |
143 | changed lines in a file. The value of this suboption is appended to the shell |
|
143 | changed lines in a file. The value of this suboption is appended to the shell | |
144 | command once for every range of changed lines in the file. Some values may be |
|
144 | command once for every range of changed lines in the file. Some values may be | |
145 | substituted into the command: |
|
145 | substituted into the command: | |
146 |
|
146 | |||
147 | {first} The 1-based line number of the first line in the modified range |
|
147 | {first} The 1-based line number of the first line in the modified range | |
148 | {last} The 1-based line number of the last line in the modified range |
|
148 | {last} The 1-based line number of the last line in the modified range | |
149 |
|
149 | |||
150 | Deleted sections of a file will be ignored by :linerange, because there is no |
|
150 | Deleted sections of a file will be ignored by :linerange, because there is no | |
151 | corresponding line range in the version being fixed. |
|
151 | corresponding line range in the version being fixed. | |
152 |
|
152 | |||
153 | By default, tools that set :linerange will only be executed if there is at |
|
153 | By default, tools that set :linerange will only be executed if there is at | |
154 | least one changed line range. This is meant to prevent accidents like running |
|
154 | least one changed line range. This is meant to prevent accidents like running | |
155 | a code formatter in such a way that it unexpectedly reformats the whole file. |
|
155 | a code formatter in such a way that it unexpectedly reformats the whole file. | |
156 | If such a tool needs to operate on unchanged files, it should set the |
|
156 | If such a tool needs to operate on unchanged files, it should set the | |
157 | :skipclean suboption to false. |
|
157 | :skipclean suboption to false. | |
158 |
|
158 | |||
159 | The :pattern suboption determines which files will be passed through each |
|
159 | The :pattern suboption determines which files will be passed through each | |
160 | configured tool. See 'hg help patterns' for possible values. However, all |
|
160 | configured tool. See 'hg help patterns' for possible values. However, all | |
161 | patterns are relative to the repo root, even if that text says they are |
|
161 | patterns are relative to the repo root, even if that text says they are | |
162 | relative to the current working directory. If there are file arguments to 'hg |
|
162 | relative to the current working directory. If there are file arguments to 'hg | |
163 | fix', the intersection of these patterns is used. |
|
163 | fix', the intersection of these patterns is used. | |
164 |
|
164 | |||
165 | There is also a configurable limit for the maximum size of file that will be |
|
165 | There is also a configurable limit for the maximum size of file that will be | |
166 | processed by 'hg fix': |
|
166 | processed by 'hg fix': | |
167 |
|
167 | |||
168 | [fix] |
|
168 | [fix] | |
169 | maxfilesize = 2MB |
|
169 | maxfilesize = 2MB | |
170 |
|
170 | |||
171 | Normally, execution of configured tools will continue after a failure |
|
171 | Normally, execution of configured tools will continue after a failure | |
172 | (indicated by a non-zero exit status). It can also be configured to abort |
|
172 | (indicated by a non-zero exit status). It can also be configured to abort | |
173 | after the first such failure, so that no files will be affected if any tool |
|
173 | after the first such failure, so that no files will be affected if any tool | |
174 | fails. This abort will also cause 'hg fix' to exit with a non-zero status: |
|
174 | fails. This abort will also cause 'hg fix' to exit with a non-zero status: | |
175 |
|
175 | |||
176 | [fix] |
|
176 | [fix] | |
177 | failure = abort |
|
177 | failure = abort | |
178 |
|
178 | |||
179 | When multiple tools are configured to affect a file, they execute in an order |
|
179 | When multiple tools are configured to affect a file, they execute in an order | |
180 | defined by the :priority suboption. The priority suboption has a default value |
|
180 | defined by the :priority suboption. The priority suboption has a default value | |
181 | of zero for each tool. Tools are executed in order of descending priority. The |
|
181 | of zero for each tool. Tools are executed in order of descending priority. The | |
182 | execution order of tools with equal priority is unspecified. For example, you |
|
182 | execution order of tools with equal priority is unspecified. For example, you | |
183 | could use the 'sort' and 'head' utilities to keep only the 10 smallest numbers |
|
183 | could use the 'sort' and 'head' utilities to keep only the 10 smallest numbers | |
184 | in a text file by ensuring that 'sort' runs before 'head': |
|
184 | in a text file by ensuring that 'sort' runs before 'head': | |
185 |
|
185 | |||
186 | [fix] |
|
186 | [fix] | |
187 | sort:command = sort -n |
|
187 | sort:command = sort -n | |
188 | head:command = head -n 10 |
|
188 | head:command = head -n 10 | |
189 | sort:pattern = numbers.txt |
|
189 | sort:pattern = numbers.txt | |
190 | head:pattern = numbers.txt |
|
190 | head:pattern = numbers.txt | |
191 | sort:priority = 2 |
|
191 | sort:priority = 2 | |
192 | head:priority = 1 |
|
192 | head:priority = 1 | |
193 |
|
193 | |||
194 | To account for changes made by each tool, the line numbers used for |
|
194 | To account for changes made by each tool, the line numbers used for | |
195 | incremental formatting are recomputed before executing the next tool. So, each |
|
195 | incremental formatting are recomputed before executing the next tool. So, each | |
196 | tool may see different values for the arguments added by the :linerange |
|
196 | tool may see different values for the arguments added by the :linerange | |
197 | suboption. |
|
197 | suboption. | |
198 |
|
198 | |||
199 | Each fixer tool is allowed to return some metadata in addition to the fixed |
|
199 | Each fixer tool is allowed to return some metadata in addition to the fixed | |
200 | file content. The metadata must be placed before the file content on stdout, |
|
200 | file content. The metadata must be placed before the file content on stdout, | |
201 | separated from the file content by a zero byte. The metadata is parsed as a |
|
201 | separated from the file content by a zero byte. The metadata is parsed as a | |
202 | JSON value (so, it should be UTF-8 encoded and contain no zero bytes). A fixer |
|
202 | JSON value (so, it should be UTF-8 encoded and contain no zero bytes). A fixer | |
203 | tool is expected to produce this metadata encoding if and only if the |
|
203 | tool is expected to produce this metadata encoding if and only if the | |
204 | :metadata suboption is true: |
|
204 | :metadata suboption is true: | |
205 |
|
205 | |||
206 | [fix] |
|
206 | [fix] | |
207 | tool:command = tool --prepend-json-metadata |
|
207 | tool:command = tool --prepend-json-metadata | |
208 | tool:metadata = true |
|
208 | tool:metadata = true | |
209 |
|
209 | |||
210 | The metadata values are passed to hooks, which can be used to print summaries |
|
210 | The metadata values are passed to hooks, which can be used to print summaries | |
211 | or perform other post-fixing work. The supported hooks are: |
|
211 | or perform other post-fixing work. The supported hooks are: | |
212 |
|
212 | |||
213 | "postfixfile" |
|
213 | "postfixfile" | |
214 | Run once for each file in each revision where any fixer tools made changes |
|
214 | Run once for each file in each revision where any fixer tools made changes | |
215 | to the file content. Provides "$HG_REV" and "$HG_PATH" to identify the file, |
|
215 | to the file content. Provides "$HG_REV" and "$HG_PATH" to identify the file, | |
216 | and "$HG_METADATA" with a map of fixer names to metadata values from fixer |
|
216 | and "$HG_METADATA" with a map of fixer names to metadata values from fixer | |
217 | tools that affected the file. Fixer tools that didn't affect the file have a |
|
217 | tools that affected the file. Fixer tools that didn't affect the file have a | |
218 | value of None. Only fixer tools that executed are present in the metadata. |
|
218 | value of None. Only fixer tools that executed are present in the metadata. | |
219 |
|
219 | |||
220 | "postfix" |
|
220 | "postfix" | |
221 | Run once after all files and revisions have been handled. Provides |
|
221 | Run once after all files and revisions have been handled. Provides | |
222 | "$HG_REPLACEMENTS" with information about what revisions were created and |
|
222 | "$HG_REPLACEMENTS" with information about what revisions were created and | |
223 | made obsolete. Provides a boolean "$HG_WDIRWRITTEN" to indicate whether any |
|
223 | made obsolete. Provides a boolean "$HG_WDIRWRITTEN" to indicate whether any | |
224 | files in the working copy were updated. Provides a list "$HG_METADATA" |
|
224 | files in the working copy were updated. Provides a list "$HG_METADATA" | |
225 | mapping fixer tool names to lists of metadata values returned from |
|
225 | mapping fixer tool names to lists of metadata values returned from | |
226 | executions that modified a file. This aggregates the same metadata |
|
226 | executions that modified a file. This aggregates the same metadata | |
227 | previously passed to the "postfixfile" hook. |
|
227 | previously passed to the "postfixfile" hook. | |
228 |
|
228 | |||
229 | Fixer tools are run in the repository's root directory. This allows them to |
|
229 | Fixer tools are run in the repository's root directory. This allows them to | |
230 | read configuration files from the working copy, or even write to the working |
|
230 | read configuration files from the working copy, or even write to the working | |
231 | copy. The working copy is not updated to match the revision being fixed. In |
|
231 | copy. The working copy is not updated to match the revision being fixed. In | |
232 | fact, several revisions may be fixed in parallel. Writes to the working copy |
|
232 | fact, several revisions may be fixed in parallel. Writes to the working copy | |
233 | are not amended into the revision being fixed; fixer tools should always write |
|
233 | are not amended into the revision being fixed; fixer tools should always write | |
234 | fixed file content back to stdout as documented above. |
|
234 | fixed file content back to stdout as documented above. | |
235 |
|
235 | |||
236 | list of commands: |
|
236 | list of commands: | |
237 |
|
237 | |||
238 | fix rewrite file content in changesets or working directory |
|
238 | fix rewrite file content in changesets or working directory | |
239 |
|
239 | |||
240 | (use 'hg help -v -e fix' to show built-in aliases and global options) |
|
240 | (use 'hg help -v -e fix' to show built-in aliases and global options) | |
241 |
|
241 | |||
242 | There is no default behavior in the absence of --rev and --working-dir. |
|
242 | There is no default behavior in the absence of --rev and --working-dir. | |
243 |
|
243 | |||
244 | $ hg init badusage |
|
244 | $ hg init badusage | |
245 | $ cd badusage |
|
245 | $ cd badusage | |
246 |
|
246 | |||
247 | $ hg fix |
|
247 | $ hg fix | |
248 | abort: no changesets specified |
|
248 | abort: no changesets specified | |
249 | (use --source or --working-dir) |
|
249 | (use --source or --working-dir) | |
250 | [255] |
|
250 | [255] | |
251 | $ hg fix --whole |
|
251 | $ hg fix --whole | |
252 | abort: no changesets specified |
|
252 | abort: no changesets specified | |
253 | (use --source or --working-dir) |
|
253 | (use --source or --working-dir) | |
254 | [255] |
|
254 | [255] | |
255 | $ hg fix --base 0 |
|
255 | $ hg fix --base 0 | |
256 | abort: no changesets specified |
|
256 | abort: no changesets specified | |
257 | (use --source or --working-dir) |
|
257 | (use --source or --working-dir) | |
258 | [255] |
|
258 | [255] | |
259 |
|
259 | |||
260 | Fixing a public revision isn't allowed. It should abort early enough that |
|
260 | Fixing a public revision isn't allowed. It should abort early enough that | |
261 | nothing happens, even to the working directory. |
|
261 | nothing happens, even to the working directory. | |
262 |
|
262 | |||
263 | $ printf "hello\n" > hello.whole |
|
263 | $ printf "hello\n" > hello.whole | |
264 | $ hg commit -Aqm "hello" |
|
264 | $ hg commit -Aqm "hello" | |
265 | $ hg phase -r 0 --public |
|
265 | $ hg phase -r 0 --public | |
266 | $ hg fix -r 0 |
|
266 | $ hg fix -r 0 | |
267 | abort: cannot fix public changesets |
|
267 | abort: cannot fix public changesets | |
268 | (see 'hg help phases' for details) |
|
268 | (see 'hg help phases' for details) | |
269 |
[ |
|
269 | [10] | |
270 | $ hg fix -r 0 --working-dir |
|
270 | $ hg fix -r 0 --working-dir | |
271 | abort: cannot fix public changesets |
|
271 | abort: cannot fix public changesets | |
272 | (see 'hg help phases' for details) |
|
272 | (see 'hg help phases' for details) | |
273 |
[ |
|
273 | [10] | |
274 | $ hg cat -r tip hello.whole |
|
274 | $ hg cat -r tip hello.whole | |
275 | hello |
|
275 | hello | |
276 | $ cat hello.whole |
|
276 | $ cat hello.whole | |
277 | hello |
|
277 | hello | |
278 |
|
278 | |||
279 | $ cd .. |
|
279 | $ cd .. | |
280 |
|
280 | |||
281 | Fixing a clean working directory should do nothing. Even the --whole flag |
|
281 | Fixing a clean working directory should do nothing. Even the --whole flag | |
282 | shouldn't cause any clean files to be fixed. Specifying a clean file explicitly |
|
282 | shouldn't cause any clean files to be fixed. Specifying a clean file explicitly | |
283 | should only fix it if the fixer always fixes the whole file. The combination of |
|
283 | should only fix it if the fixer always fixes the whole file. The combination of | |
284 | an explicit filename and --whole should format the entire file regardless. |
|
284 | an explicit filename and --whole should format the entire file regardless. | |
285 |
|
285 | |||
286 | $ hg init fixcleanwdir |
|
286 | $ hg init fixcleanwdir | |
287 | $ cd fixcleanwdir |
|
287 | $ cd fixcleanwdir | |
288 |
|
288 | |||
289 | $ printf "hello\n" > hello.changed |
|
289 | $ printf "hello\n" > hello.changed | |
290 | $ printf "world\n" > hello.whole |
|
290 | $ printf "world\n" > hello.whole | |
291 | $ hg commit -Aqm "foo" |
|
291 | $ hg commit -Aqm "foo" | |
292 | $ hg fix --working-dir |
|
292 | $ hg fix --working-dir | |
293 | $ hg diff |
|
293 | $ hg diff | |
294 | $ hg fix --working-dir --whole |
|
294 | $ hg fix --working-dir --whole | |
295 | $ hg diff |
|
295 | $ hg diff | |
296 | $ hg fix --working-dir * |
|
296 | $ hg fix --working-dir * | |
297 | $ cat * |
|
297 | $ cat * | |
298 | hello |
|
298 | hello | |
299 | WORLD |
|
299 | WORLD | |
300 | $ hg revert --all --no-backup |
|
300 | $ hg revert --all --no-backup | |
301 | reverting hello.whole |
|
301 | reverting hello.whole | |
302 | $ hg fix --working-dir * --whole |
|
302 | $ hg fix --working-dir * --whole | |
303 | $ cat * |
|
303 | $ cat * | |
304 | HELLO |
|
304 | HELLO | |
305 | WORLD |
|
305 | WORLD | |
306 |
|
306 | |||
307 | The same ideas apply to fixing a revision, so we create a revision that doesn't |
|
307 | The same ideas apply to fixing a revision, so we create a revision that doesn't | |
308 | modify either of the files in question and try fixing it. This also tests that |
|
308 | modify either of the files in question and try fixing it. This also tests that | |
309 | we ignore a file that doesn't match any configured fixer. |
|
309 | we ignore a file that doesn't match any configured fixer. | |
310 |
|
310 | |||
311 | $ hg revert --all --no-backup |
|
311 | $ hg revert --all --no-backup | |
312 | reverting hello.changed |
|
312 | reverting hello.changed | |
313 | reverting hello.whole |
|
313 | reverting hello.whole | |
314 | $ printf "unimportant\n" > some.file |
|
314 | $ printf "unimportant\n" > some.file | |
315 | $ hg commit -Aqm "some other file" |
|
315 | $ hg commit -Aqm "some other file" | |
316 |
|
316 | |||
317 | $ hg fix -r . |
|
317 | $ hg fix -r . | |
318 | $ hg cat -r tip * |
|
318 | $ hg cat -r tip * | |
319 | hello |
|
319 | hello | |
320 | world |
|
320 | world | |
321 | unimportant |
|
321 | unimportant | |
322 | $ hg fix -r . --whole |
|
322 | $ hg fix -r . --whole | |
323 | $ hg cat -r tip * |
|
323 | $ hg cat -r tip * | |
324 | hello |
|
324 | hello | |
325 | world |
|
325 | world | |
326 | unimportant |
|
326 | unimportant | |
327 | $ hg fix -r . * |
|
327 | $ hg fix -r . * | |
328 | $ hg cat -r tip * |
|
328 | $ hg cat -r tip * | |
329 | hello |
|
329 | hello | |
330 | WORLD |
|
330 | WORLD | |
331 | unimportant |
|
331 | unimportant | |
332 | $ hg fix -r . * --whole --config experimental.evolution.allowdivergence=true |
|
332 | $ hg fix -r . * --whole --config experimental.evolution.allowdivergence=true | |
333 | 2 new content-divergent changesets |
|
333 | 2 new content-divergent changesets | |
334 | $ hg cat -r tip * |
|
334 | $ hg cat -r tip * | |
335 | HELLO |
|
335 | HELLO | |
336 | WORLD |
|
336 | WORLD | |
337 | unimportant |
|
337 | unimportant | |
338 |
|
338 | |||
339 | $ cd .. |
|
339 | $ cd .. | |
340 |
|
340 | |||
341 | Fixing the working directory should still work if there are no revisions. |
|
341 | Fixing the working directory should still work if there are no revisions. | |
342 |
|
342 | |||
343 | $ hg init norevisions |
|
343 | $ hg init norevisions | |
344 | $ cd norevisions |
|
344 | $ cd norevisions | |
345 |
|
345 | |||
346 | $ printf "something\n" > something.whole |
|
346 | $ printf "something\n" > something.whole | |
347 | $ hg add |
|
347 | $ hg add | |
348 | adding something.whole |
|
348 | adding something.whole | |
349 | $ hg fix --working-dir |
|
349 | $ hg fix --working-dir | |
350 | $ cat something.whole |
|
350 | $ cat something.whole | |
351 | SOMETHING |
|
351 | SOMETHING | |
352 |
|
352 | |||
353 | $ cd .. |
|
353 | $ cd .. | |
354 |
|
354 | |||
355 | Test the effect of fixing the working directory for each possible status, with |
|
355 | Test the effect of fixing the working directory for each possible status, with | |
356 | and without providing explicit file arguments. |
|
356 | and without providing explicit file arguments. | |
357 |
|
357 | |||
358 | $ hg init implicitlyfixstatus |
|
358 | $ hg init implicitlyfixstatus | |
359 | $ cd implicitlyfixstatus |
|
359 | $ cd implicitlyfixstatus | |
360 |
|
360 | |||
361 | $ printf "modified\n" > modified.whole |
|
361 | $ printf "modified\n" > modified.whole | |
362 | $ printf "removed\n" > removed.whole |
|
362 | $ printf "removed\n" > removed.whole | |
363 | $ printf "deleted\n" > deleted.whole |
|
363 | $ printf "deleted\n" > deleted.whole | |
364 | $ printf "clean\n" > clean.whole |
|
364 | $ printf "clean\n" > clean.whole | |
365 | $ printf "ignored.whole" > .hgignore |
|
365 | $ printf "ignored.whole" > .hgignore | |
366 | $ hg commit -Aqm "stuff" |
|
366 | $ hg commit -Aqm "stuff" | |
367 |
|
367 | |||
368 | $ printf "modified!!!\n" > modified.whole |
|
368 | $ printf "modified!!!\n" > modified.whole | |
369 | $ printf "unknown\n" > unknown.whole |
|
369 | $ printf "unknown\n" > unknown.whole | |
370 | $ printf "ignored\n" > ignored.whole |
|
370 | $ printf "ignored\n" > ignored.whole | |
371 | $ printf "added\n" > added.whole |
|
371 | $ printf "added\n" > added.whole | |
372 | $ hg add added.whole |
|
372 | $ hg add added.whole | |
373 | $ hg remove removed.whole |
|
373 | $ hg remove removed.whole | |
374 | $ rm deleted.whole |
|
374 | $ rm deleted.whole | |
375 |
|
375 | |||
376 | $ hg status --all |
|
376 | $ hg status --all | |
377 | M modified.whole |
|
377 | M modified.whole | |
378 | A added.whole |
|
378 | A added.whole | |
379 | R removed.whole |
|
379 | R removed.whole | |
380 | ! deleted.whole |
|
380 | ! deleted.whole | |
381 | ? unknown.whole |
|
381 | ? unknown.whole | |
382 | I ignored.whole |
|
382 | I ignored.whole | |
383 | C .hgignore |
|
383 | C .hgignore | |
384 | C clean.whole |
|
384 | C clean.whole | |
385 |
|
385 | |||
386 | $ hg fix --working-dir |
|
386 | $ hg fix --working-dir | |
387 |
|
387 | |||
388 | $ hg status --all |
|
388 | $ hg status --all | |
389 | M modified.whole |
|
389 | M modified.whole | |
390 | A added.whole |
|
390 | A added.whole | |
391 | R removed.whole |
|
391 | R removed.whole | |
392 | ! deleted.whole |
|
392 | ! deleted.whole | |
393 | ? unknown.whole |
|
393 | ? unknown.whole | |
394 | I ignored.whole |
|
394 | I ignored.whole | |
395 | C .hgignore |
|
395 | C .hgignore | |
396 | C clean.whole |
|
396 | C clean.whole | |
397 |
|
397 | |||
398 | $ cat *.whole |
|
398 | $ cat *.whole | |
399 | ADDED |
|
399 | ADDED | |
400 | clean |
|
400 | clean | |
401 | ignored |
|
401 | ignored | |
402 | MODIFIED!!! |
|
402 | MODIFIED!!! | |
403 | unknown |
|
403 | unknown | |
404 |
|
404 | |||
405 | $ printf "modified!!!\n" > modified.whole |
|
405 | $ printf "modified!!!\n" > modified.whole | |
406 | $ printf "added\n" > added.whole |
|
406 | $ printf "added\n" > added.whole | |
407 |
|
407 | |||
408 | Listing the files explicitly causes untracked files to also be fixed, but |
|
408 | Listing the files explicitly causes untracked files to also be fixed, but | |
409 | ignored files are still unaffected. |
|
409 | ignored files are still unaffected. | |
410 |
|
410 | |||
411 | $ hg fix --working-dir *.whole |
|
411 | $ hg fix --working-dir *.whole | |
412 |
|
412 | |||
413 | $ hg status --all |
|
413 | $ hg status --all | |
414 | M clean.whole |
|
414 | M clean.whole | |
415 | M modified.whole |
|
415 | M modified.whole | |
416 | A added.whole |
|
416 | A added.whole | |
417 | R removed.whole |
|
417 | R removed.whole | |
418 | ! deleted.whole |
|
418 | ! deleted.whole | |
419 | ? unknown.whole |
|
419 | ? unknown.whole | |
420 | I ignored.whole |
|
420 | I ignored.whole | |
421 | C .hgignore |
|
421 | C .hgignore | |
422 |
|
422 | |||
423 | $ cat *.whole |
|
423 | $ cat *.whole | |
424 | ADDED |
|
424 | ADDED | |
425 | CLEAN |
|
425 | CLEAN | |
426 | ignored |
|
426 | ignored | |
427 | MODIFIED!!! |
|
427 | MODIFIED!!! | |
428 | UNKNOWN |
|
428 | UNKNOWN | |
429 |
|
429 | |||
430 | $ cd .. |
|
430 | $ cd .. | |
431 |
|
431 | |||
432 | Test that incremental fixing works on files with additions, deletions, and |
|
432 | Test that incremental fixing works on files with additions, deletions, and | |
433 | changes in multiple line ranges. Note that deletions do not generally cause |
|
433 | changes in multiple line ranges. Note that deletions do not generally cause | |
434 | neighboring lines to be fixed, so we don't return a line range for purely |
|
434 | neighboring lines to be fixed, so we don't return a line range for purely | |
435 | deleted sections. In the future we should support a :deletion config that |
|
435 | deleted sections. In the future we should support a :deletion config that | |
436 | allows fixers to know where deletions are located. |
|
436 | allows fixers to know where deletions are located. | |
437 |
|
437 | |||
438 | $ hg init incrementalfixedlines |
|
438 | $ hg init incrementalfixedlines | |
439 | $ cd incrementalfixedlines |
|
439 | $ cd incrementalfixedlines | |
440 |
|
440 | |||
441 | $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.txt |
|
441 | $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.txt | |
442 | $ hg commit -Aqm "foo" |
|
442 | $ hg commit -Aqm "foo" | |
443 | $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.txt |
|
443 | $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.txt | |
444 |
|
444 | |||
445 | $ hg --config "fix.fail:command=echo" \ |
|
445 | $ hg --config "fix.fail:command=echo" \ | |
446 | > --config "fix.fail:linerange={first}:{last}" \ |
|
446 | > --config "fix.fail:linerange={first}:{last}" \ | |
447 | > --config "fix.fail:pattern=foo.txt" \ |
|
447 | > --config "fix.fail:pattern=foo.txt" \ | |
448 | > fix --working-dir |
|
448 | > fix --working-dir | |
449 | $ cat foo.txt |
|
449 | $ cat foo.txt | |
450 | 1:1 4:6 8:8 |
|
450 | 1:1 4:6 8:8 | |
451 |
|
451 | |||
452 | $ cd .. |
|
452 | $ cd .. | |
453 |
|
453 | |||
454 | Test that --whole fixes all lines regardless of the diffs present. |
|
454 | Test that --whole fixes all lines regardless of the diffs present. | |
455 |
|
455 | |||
456 | $ hg init wholeignoresdiffs |
|
456 | $ hg init wholeignoresdiffs | |
457 | $ cd wholeignoresdiffs |
|
457 | $ cd wholeignoresdiffs | |
458 |
|
458 | |||
459 | $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.changed |
|
459 | $ printf "a\nb\nc\nd\ne\nf\ng\n" > foo.changed | |
460 | $ hg commit -Aqm "foo" |
|
460 | $ hg commit -Aqm "foo" | |
461 | $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.changed |
|
461 | $ printf "zz\na\nc\ndd\nee\nff\nf\ngg\n" > foo.changed | |
462 |
|
462 | |||
463 | $ hg fix --working-dir |
|
463 | $ hg fix --working-dir | |
464 | $ cat foo.changed |
|
464 | $ cat foo.changed | |
465 | ZZ |
|
465 | ZZ | |
466 | a |
|
466 | a | |
467 | c |
|
467 | c | |
468 | DD |
|
468 | DD | |
469 | EE |
|
469 | EE | |
470 | FF |
|
470 | FF | |
471 | f |
|
471 | f | |
472 | GG |
|
472 | GG | |
473 |
|
473 | |||
474 | $ hg fix --working-dir --whole |
|
474 | $ hg fix --working-dir --whole | |
475 | $ cat foo.changed |
|
475 | $ cat foo.changed | |
476 | ZZ |
|
476 | ZZ | |
477 | A |
|
477 | A | |
478 | C |
|
478 | C | |
479 | DD |
|
479 | DD | |
480 | EE |
|
480 | EE | |
481 | FF |
|
481 | FF | |
482 | F |
|
482 | F | |
483 | GG |
|
483 | GG | |
484 |
|
484 | |||
485 | $ cd .. |
|
485 | $ cd .. | |
486 |
|
486 | |||
487 | We should do nothing with symlinks, and their targets should be unaffected. Any |
|
487 | We should do nothing with symlinks, and their targets should be unaffected. Any | |
488 | other behavior would be more complicated to implement and harder to document. |
|
488 | other behavior would be more complicated to implement and harder to document. | |
489 |
|
489 | |||
490 | #if symlink |
|
490 | #if symlink | |
491 | $ hg init dontmesswithsymlinks |
|
491 | $ hg init dontmesswithsymlinks | |
492 | $ cd dontmesswithsymlinks |
|
492 | $ cd dontmesswithsymlinks | |
493 |
|
493 | |||
494 | $ printf "hello\n" > hello.whole |
|
494 | $ printf "hello\n" > hello.whole | |
495 | $ ln -s hello.whole hellolink |
|
495 | $ ln -s hello.whole hellolink | |
496 | $ hg add |
|
496 | $ hg add | |
497 | adding hello.whole |
|
497 | adding hello.whole | |
498 | adding hellolink |
|
498 | adding hellolink | |
499 | $ hg fix --working-dir hellolink |
|
499 | $ hg fix --working-dir hellolink | |
500 | $ hg status |
|
500 | $ hg status | |
501 | A hello.whole |
|
501 | A hello.whole | |
502 | A hellolink |
|
502 | A hellolink | |
503 |
|
503 | |||
504 | $ cd .. |
|
504 | $ cd .. | |
505 | #endif |
|
505 | #endif | |
506 |
|
506 | |||
507 | We should allow fixers to run on binary files, even though this doesn't sound |
|
507 | We should allow fixers to run on binary files, even though this doesn't sound | |
508 | like a common use case. There's not much benefit to disallowing it, and users |
|
508 | like a common use case. There's not much benefit to disallowing it, and users | |
509 | can add "and not binary()" to their filesets if needed. The Mercurial |
|
509 | can add "and not binary()" to their filesets if needed. The Mercurial | |
510 | philosophy is generally to not handle binary files specially anyway. |
|
510 | philosophy is generally to not handle binary files specially anyway. | |
511 |
|
511 | |||
512 | $ hg init cantouchbinaryfiles |
|
512 | $ hg init cantouchbinaryfiles | |
513 | $ cd cantouchbinaryfiles |
|
513 | $ cd cantouchbinaryfiles | |
514 |
|
514 | |||
515 | $ printf "hello\0\n" > hello.whole |
|
515 | $ printf "hello\0\n" > hello.whole | |
516 | $ hg add |
|
516 | $ hg add | |
517 | adding hello.whole |
|
517 | adding hello.whole | |
518 | $ hg fix --working-dir 'set:binary()' |
|
518 | $ hg fix --working-dir 'set:binary()' | |
519 | $ cat hello.whole |
|
519 | $ cat hello.whole | |
520 | HELLO\x00 (esc) |
|
520 | HELLO\x00 (esc) | |
521 |
|
521 | |||
522 | $ cd .. |
|
522 | $ cd .. | |
523 |
|
523 | |||
524 | We have a config for the maximum size of file we will attempt to fix. This can |
|
524 | We have a config for the maximum size of file we will attempt to fix. This can | |
525 | be helpful to avoid running unsuspecting fixer tools on huge inputs, which |
|
525 | be helpful to avoid running unsuspecting fixer tools on huge inputs, which | |
526 | could happen by accident without a well considered configuration. A more |
|
526 | could happen by accident without a well considered configuration. A more | |
527 | precise configuration could use the size() fileset function if one global limit |
|
527 | precise configuration could use the size() fileset function if one global limit | |
528 | is undesired. |
|
528 | is undesired. | |
529 |
|
529 | |||
530 | $ hg init maxfilesize |
|
530 | $ hg init maxfilesize | |
531 | $ cd maxfilesize |
|
531 | $ cd maxfilesize | |
532 |
|
532 | |||
533 | $ printf "this file is huge\n" > hello.whole |
|
533 | $ printf "this file is huge\n" > hello.whole | |
534 | $ hg add |
|
534 | $ hg add | |
535 | adding hello.whole |
|
535 | adding hello.whole | |
536 | $ hg --config fix.maxfilesize=10 fix --working-dir |
|
536 | $ hg --config fix.maxfilesize=10 fix --working-dir | |
537 | ignoring file larger than 10 bytes: hello.whole |
|
537 | ignoring file larger than 10 bytes: hello.whole | |
538 | $ cat hello.whole |
|
538 | $ cat hello.whole | |
539 | this file is huge |
|
539 | this file is huge | |
540 |
|
540 | |||
541 | $ cd .. |
|
541 | $ cd .. | |
542 |
|
542 | |||
543 | If we specify a file to fix, other files should be left alone, even if they |
|
543 | If we specify a file to fix, other files should be left alone, even if they | |
544 | have changes. |
|
544 | have changes. | |
545 |
|
545 | |||
546 | $ hg init fixonlywhatitellyouto |
|
546 | $ hg init fixonlywhatitellyouto | |
547 | $ cd fixonlywhatitellyouto |
|
547 | $ cd fixonlywhatitellyouto | |
548 |
|
548 | |||
549 | $ printf "fix me!\n" > fixme.whole |
|
549 | $ printf "fix me!\n" > fixme.whole | |
550 | $ printf "not me.\n" > notme.whole |
|
550 | $ printf "not me.\n" > notme.whole | |
551 | $ hg add |
|
551 | $ hg add | |
552 | adding fixme.whole |
|
552 | adding fixme.whole | |
553 | adding notme.whole |
|
553 | adding notme.whole | |
554 | $ hg fix --working-dir fixme.whole |
|
554 | $ hg fix --working-dir fixme.whole | |
555 | $ cat *.whole |
|
555 | $ cat *.whole | |
556 | FIX ME! |
|
556 | FIX ME! | |
557 | not me. |
|
557 | not me. | |
558 |
|
558 | |||
559 | $ cd .. |
|
559 | $ cd .. | |
560 |
|
560 | |||
561 | If we try to fix a missing file, we still fix other files. |
|
561 | If we try to fix a missing file, we still fix other files. | |
562 |
|
562 | |||
563 | $ hg init fixmissingfile |
|
563 | $ hg init fixmissingfile | |
564 | $ cd fixmissingfile |
|
564 | $ cd fixmissingfile | |
565 |
|
565 | |||
566 | $ printf "fix me!\n" > foo.whole |
|
566 | $ printf "fix me!\n" > foo.whole | |
567 | $ hg add |
|
567 | $ hg add | |
568 | adding foo.whole |
|
568 | adding foo.whole | |
569 | $ hg fix --working-dir foo.whole bar.whole |
|
569 | $ hg fix --working-dir foo.whole bar.whole | |
570 | bar.whole: $ENOENT$ |
|
570 | bar.whole: $ENOENT$ | |
571 | $ cat *.whole |
|
571 | $ cat *.whole | |
572 | FIX ME! |
|
572 | FIX ME! | |
573 |
|
573 | |||
574 | $ cd .. |
|
574 | $ cd .. | |
575 |
|
575 | |||
576 | Specifying a directory name should fix all its files and subdirectories. |
|
576 | Specifying a directory name should fix all its files and subdirectories. | |
577 |
|
577 | |||
578 | $ hg init fixdirectory |
|
578 | $ hg init fixdirectory | |
579 | $ cd fixdirectory |
|
579 | $ cd fixdirectory | |
580 |
|
580 | |||
581 | $ mkdir -p dir1/dir2 |
|
581 | $ mkdir -p dir1/dir2 | |
582 | $ printf "foo\n" > foo.whole |
|
582 | $ printf "foo\n" > foo.whole | |
583 | $ printf "bar\n" > dir1/bar.whole |
|
583 | $ printf "bar\n" > dir1/bar.whole | |
584 | $ printf "baz\n" > dir1/dir2/baz.whole |
|
584 | $ printf "baz\n" > dir1/dir2/baz.whole | |
585 | $ hg add |
|
585 | $ hg add | |
586 | adding dir1/bar.whole |
|
586 | adding dir1/bar.whole | |
587 | adding dir1/dir2/baz.whole |
|
587 | adding dir1/dir2/baz.whole | |
588 | adding foo.whole |
|
588 | adding foo.whole | |
589 | $ hg fix --working-dir dir1 |
|
589 | $ hg fix --working-dir dir1 | |
590 | $ cat foo.whole dir1/bar.whole dir1/dir2/baz.whole |
|
590 | $ cat foo.whole dir1/bar.whole dir1/dir2/baz.whole | |
591 | foo |
|
591 | foo | |
592 | BAR |
|
592 | BAR | |
593 | BAZ |
|
593 | BAZ | |
594 |
|
594 | |||
595 | $ cd .. |
|
595 | $ cd .. | |
596 |
|
596 | |||
597 | Fixing a file in the working directory that needs no fixes should not actually |
|
597 | Fixing a file in the working directory that needs no fixes should not actually | |
598 | write back to the file, so for example the mtime shouldn't change. |
|
598 | write back to the file, so for example the mtime shouldn't change. | |
599 |
|
599 | |||
600 | $ hg init donttouchunfixedfiles |
|
600 | $ hg init donttouchunfixedfiles | |
601 | $ cd donttouchunfixedfiles |
|
601 | $ cd donttouchunfixedfiles | |
602 |
|
602 | |||
603 | $ printf "NO FIX NEEDED\n" > foo.whole |
|
603 | $ printf "NO FIX NEEDED\n" > foo.whole | |
604 | $ hg add |
|
604 | $ hg add | |
605 | adding foo.whole |
|
605 | adding foo.whole | |
606 | $ cp -p foo.whole foo.whole.orig |
|
606 | $ cp -p foo.whole foo.whole.orig | |
607 | $ cp -p foo.whole.orig foo.whole |
|
607 | $ cp -p foo.whole.orig foo.whole | |
608 | $ sleep 2 # mtime has a resolution of one or two seconds. |
|
608 | $ sleep 2 # mtime has a resolution of one or two seconds. | |
609 | $ hg fix --working-dir |
|
609 | $ hg fix --working-dir | |
610 | $ f foo.whole.orig --newer foo.whole |
|
610 | $ f foo.whole.orig --newer foo.whole | |
611 | foo.whole.orig: newer than foo.whole |
|
611 | foo.whole.orig: newer than foo.whole | |
612 |
|
612 | |||
613 | $ cd .. |
|
613 | $ cd .. | |
614 |
|
614 | |||
615 | When a fixer prints to stderr, we don't assume that it has failed. We show the |
|
615 | When a fixer prints to stderr, we don't assume that it has failed. We show the | |
616 | error messages to the user, and we still let the fixer affect the file it was |
|
616 | error messages to the user, and we still let the fixer affect the file it was | |
617 | fixing if its exit code is zero. Some code formatters might emit error messages |
|
617 | fixing if its exit code is zero. Some code formatters might emit error messages | |
618 | on stderr and nothing on stdout, which would cause us the clear the file, |
|
618 | on stderr and nothing on stdout, which would cause us the clear the file, | |
619 | except that they also exit with a non-zero code. We show the user which fixer |
|
619 | except that they also exit with a non-zero code. We show the user which fixer | |
620 | emitted the stderr, and which revision, but we assume that the fixer will print |
|
620 | emitted the stderr, and which revision, but we assume that the fixer will print | |
621 | the filename if it is relevant (since the issue may be non-specific). There is |
|
621 | the filename if it is relevant (since the issue may be non-specific). There is | |
622 | also a config to abort (without affecting any files whatsoever) if we see any |
|
622 | also a config to abort (without affecting any files whatsoever) if we see any | |
623 | tool with a non-zero exit status. |
|
623 | tool with a non-zero exit status. | |
624 |
|
624 | |||
625 | $ hg init showstderr |
|
625 | $ hg init showstderr | |
626 | $ cd showstderr |
|
626 | $ cd showstderr | |
627 |
|
627 | |||
628 | $ printf "hello\n" > hello.txt |
|
628 | $ printf "hello\n" > hello.txt | |
629 | $ hg add |
|
629 | $ hg add | |
630 | adding hello.txt |
|
630 | adding hello.txt | |
631 | $ cat > $TESTTMP/work.sh <<'EOF' |
|
631 | $ cat > $TESTTMP/work.sh <<'EOF' | |
632 | > printf 'HELLO\n' |
|
632 | > printf 'HELLO\n' | |
633 | > printf "$@: some\nerror that didn't stop the tool" >&2 |
|
633 | > printf "$@: some\nerror that didn't stop the tool" >&2 | |
634 | > exit 0 # success despite the stderr output |
|
634 | > exit 0 # success despite the stderr output | |
635 | > EOF |
|
635 | > EOF | |
636 | $ hg --config "fix.work:command=sh $TESTTMP/work.sh {rootpath}" \ |
|
636 | $ hg --config "fix.work:command=sh $TESTTMP/work.sh {rootpath}" \ | |
637 | > --config "fix.work:pattern=hello.txt" \ |
|
637 | > --config "fix.work:pattern=hello.txt" \ | |
638 | > fix --working-dir |
|
638 | > fix --working-dir | |
639 | [wdir] work: hello.txt: some |
|
639 | [wdir] work: hello.txt: some | |
640 | [wdir] work: error that didn't stop the tool |
|
640 | [wdir] work: error that didn't stop the tool | |
641 | $ cat hello.txt |
|
641 | $ cat hello.txt | |
642 | HELLO |
|
642 | HELLO | |
643 |
|
643 | |||
644 | $ printf "goodbye\n" > hello.txt |
|
644 | $ printf "goodbye\n" > hello.txt | |
645 | $ printf "foo\n" > foo.whole |
|
645 | $ printf "foo\n" > foo.whole | |
646 | $ hg add |
|
646 | $ hg add | |
647 | adding foo.whole |
|
647 | adding foo.whole | |
648 | $ cat > $TESTTMP/fail.sh <<'EOF' |
|
648 | $ cat > $TESTTMP/fail.sh <<'EOF' | |
649 | > printf 'GOODBYE\n' |
|
649 | > printf 'GOODBYE\n' | |
650 | > printf "$@: some\nerror that did stop the tool\n" >&2 |
|
650 | > printf "$@: some\nerror that did stop the tool\n" >&2 | |
651 | > exit 42 # success despite the stdout output |
|
651 | > exit 42 # success despite the stdout output | |
652 | > EOF |
|
652 | > EOF | |
653 | $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \ |
|
653 | $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \ | |
654 | > --config "fix.fail:pattern=hello.txt" \ |
|
654 | > --config "fix.fail:pattern=hello.txt" \ | |
655 | > --config "fix.failure=abort" \ |
|
655 | > --config "fix.failure=abort" \ | |
656 | > fix --working-dir |
|
656 | > fix --working-dir | |
657 | [wdir] fail: hello.txt: some |
|
657 | [wdir] fail: hello.txt: some | |
658 | [wdir] fail: error that did stop the tool |
|
658 | [wdir] fail: error that did stop the tool | |
659 | abort: no fixes will be applied |
|
659 | abort: no fixes will be applied | |
660 | (use --config fix.failure=continue to apply any successful fixes anyway) |
|
660 | (use --config fix.failure=continue to apply any successful fixes anyway) | |
661 | [255] |
|
661 | [255] | |
662 | $ cat hello.txt |
|
662 | $ cat hello.txt | |
663 | goodbye |
|
663 | goodbye | |
664 | $ cat foo.whole |
|
664 | $ cat foo.whole | |
665 | foo |
|
665 | foo | |
666 |
|
666 | |||
667 | $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \ |
|
667 | $ hg --config "fix.fail:command=sh $TESTTMP/fail.sh {rootpath}" \ | |
668 | > --config "fix.fail:pattern=hello.txt" \ |
|
668 | > --config "fix.fail:pattern=hello.txt" \ | |
669 | > fix --working-dir |
|
669 | > fix --working-dir | |
670 | [wdir] fail: hello.txt: some |
|
670 | [wdir] fail: hello.txt: some | |
671 | [wdir] fail: error that did stop the tool |
|
671 | [wdir] fail: error that did stop the tool | |
672 | $ cat hello.txt |
|
672 | $ cat hello.txt | |
673 | goodbye |
|
673 | goodbye | |
674 | $ cat foo.whole |
|
674 | $ cat foo.whole | |
675 | FOO |
|
675 | FOO | |
676 |
|
676 | |||
677 | $ hg --config "fix.fail:command=exit 42" \ |
|
677 | $ hg --config "fix.fail:command=exit 42" \ | |
678 | > --config "fix.fail:pattern=hello.txt" \ |
|
678 | > --config "fix.fail:pattern=hello.txt" \ | |
679 | > fix --working-dir |
|
679 | > fix --working-dir | |
680 | [wdir] fail: exited with status 42 |
|
680 | [wdir] fail: exited with status 42 | |
681 |
|
681 | |||
682 | $ cd .. |
|
682 | $ cd .. | |
683 |
|
683 | |||
684 | Fixing the working directory and its parent revision at the same time should |
|
684 | Fixing the working directory and its parent revision at the same time should | |
685 | check out the replacement revision for the parent. This prevents any new |
|
685 | check out the replacement revision for the parent. This prevents any new | |
686 | uncommitted changes from appearing. We test this for a clean working directory |
|
686 | uncommitted changes from appearing. We test this for a clean working directory | |
687 | and a dirty one. In both cases, all lines/files changed since the grandparent |
|
687 | and a dirty one. In both cases, all lines/files changed since the grandparent | |
688 | will be fixed. The grandparent is the "baserev" for both the parent and the |
|
688 | will be fixed. The grandparent is the "baserev" for both the parent and the | |
689 | working copy. |
|
689 | working copy. | |
690 |
|
690 | |||
691 | $ hg init fixdotandcleanwdir |
|
691 | $ hg init fixdotandcleanwdir | |
692 | $ cd fixdotandcleanwdir |
|
692 | $ cd fixdotandcleanwdir | |
693 |
|
693 | |||
694 | $ printf "hello\n" > hello.whole |
|
694 | $ printf "hello\n" > hello.whole | |
695 | $ printf "world\n" > world.whole |
|
695 | $ printf "world\n" > world.whole | |
696 | $ hg commit -Aqm "the parent commit" |
|
696 | $ hg commit -Aqm "the parent commit" | |
697 |
|
697 | |||
698 | $ hg parents --template '{rev} {desc}\n' |
|
698 | $ hg parents --template '{rev} {desc}\n' | |
699 | 0 the parent commit |
|
699 | 0 the parent commit | |
700 | $ hg fix --working-dir -r . |
|
700 | $ hg fix --working-dir -r . | |
701 | $ hg parents --template '{rev} {desc}\n' |
|
701 | $ hg parents --template '{rev} {desc}\n' | |
702 | 1 the parent commit |
|
702 | 1 the parent commit | |
703 | $ hg cat -r . *.whole |
|
703 | $ hg cat -r . *.whole | |
704 | HELLO |
|
704 | HELLO | |
705 | WORLD |
|
705 | WORLD | |
706 | $ cat *.whole |
|
706 | $ cat *.whole | |
707 | HELLO |
|
707 | HELLO | |
708 | WORLD |
|
708 | WORLD | |
709 | $ hg status |
|
709 | $ hg status | |
710 |
|
710 | |||
711 | $ cd .. |
|
711 | $ cd .. | |
712 |
|
712 | |||
713 | Same test with a dirty working copy. |
|
713 | Same test with a dirty working copy. | |
714 |
|
714 | |||
715 | $ hg init fixdotanddirtywdir |
|
715 | $ hg init fixdotanddirtywdir | |
716 | $ cd fixdotanddirtywdir |
|
716 | $ cd fixdotanddirtywdir | |
717 |
|
717 | |||
718 | $ printf "hello\n" > hello.whole |
|
718 | $ printf "hello\n" > hello.whole | |
719 | $ printf "world\n" > world.whole |
|
719 | $ printf "world\n" > world.whole | |
720 | $ hg commit -Aqm "the parent commit" |
|
720 | $ hg commit -Aqm "the parent commit" | |
721 |
|
721 | |||
722 | $ printf "hello,\n" > hello.whole |
|
722 | $ printf "hello,\n" > hello.whole | |
723 | $ printf "world!\n" > world.whole |
|
723 | $ printf "world!\n" > world.whole | |
724 |
|
724 | |||
725 | $ hg parents --template '{rev} {desc}\n' |
|
725 | $ hg parents --template '{rev} {desc}\n' | |
726 | 0 the parent commit |
|
726 | 0 the parent commit | |
727 | $ hg fix --working-dir -r . |
|
727 | $ hg fix --working-dir -r . | |
728 | $ hg parents --template '{rev} {desc}\n' |
|
728 | $ hg parents --template '{rev} {desc}\n' | |
729 | 1 the parent commit |
|
729 | 1 the parent commit | |
730 | $ hg cat -r . *.whole |
|
730 | $ hg cat -r . *.whole | |
731 | HELLO |
|
731 | HELLO | |
732 | WORLD |
|
732 | WORLD | |
733 | $ cat *.whole |
|
733 | $ cat *.whole | |
734 | HELLO, |
|
734 | HELLO, | |
735 | WORLD! |
|
735 | WORLD! | |
736 | $ hg status |
|
736 | $ hg status | |
737 | M hello.whole |
|
737 | M hello.whole | |
738 | M world.whole |
|
738 | M world.whole | |
739 |
|
739 | |||
740 | $ cd .. |
|
740 | $ cd .. | |
741 |
|
741 | |||
742 | When we have a chain of commits that change mutually exclusive lines of code, |
|
742 | When we have a chain of commits that change mutually exclusive lines of code, | |
743 | we should be able to do incremental fixing that causes each commit in the chain |
|
743 | we should be able to do incremental fixing that causes each commit in the chain | |
744 | to include fixes made to the previous commits. This prevents children from |
|
744 | to include fixes made to the previous commits. This prevents children from | |
745 | backing out the fixes made in their parents. A dirty working directory is |
|
745 | backing out the fixes made in their parents. A dirty working directory is | |
746 | conceptually similar to another commit in the chain. |
|
746 | conceptually similar to another commit in the chain. | |
747 |
|
747 | |||
748 | $ hg init incrementallyfixchain |
|
748 | $ hg init incrementallyfixchain | |
749 | $ cd incrementallyfixchain |
|
749 | $ cd incrementallyfixchain | |
750 |
|
750 | |||
751 | $ cat > file.changed <<EOF |
|
751 | $ cat > file.changed <<EOF | |
752 | > first |
|
752 | > first | |
753 | > second |
|
753 | > second | |
754 | > third |
|
754 | > third | |
755 | > fourth |
|
755 | > fourth | |
756 | > fifth |
|
756 | > fifth | |
757 | > EOF |
|
757 | > EOF | |
758 | $ hg commit -Aqm "the common ancestor (the baserev)" |
|
758 | $ hg commit -Aqm "the common ancestor (the baserev)" | |
759 | $ cat > file.changed <<EOF |
|
759 | $ cat > file.changed <<EOF | |
760 | > first (changed) |
|
760 | > first (changed) | |
761 | > second |
|
761 | > second | |
762 | > third |
|
762 | > third | |
763 | > fourth |
|
763 | > fourth | |
764 | > fifth |
|
764 | > fifth | |
765 | > EOF |
|
765 | > EOF | |
766 | $ hg commit -Aqm "the first commit to fix" |
|
766 | $ hg commit -Aqm "the first commit to fix" | |
767 | $ cat > file.changed <<EOF |
|
767 | $ cat > file.changed <<EOF | |
768 | > first (changed) |
|
768 | > first (changed) | |
769 | > second |
|
769 | > second | |
770 | > third (changed) |
|
770 | > third (changed) | |
771 | > fourth |
|
771 | > fourth | |
772 | > fifth |
|
772 | > fifth | |
773 | > EOF |
|
773 | > EOF | |
774 | $ hg commit -Aqm "the second commit to fix" |
|
774 | $ hg commit -Aqm "the second commit to fix" | |
775 | $ cat > file.changed <<EOF |
|
775 | $ cat > file.changed <<EOF | |
776 | > first (changed) |
|
776 | > first (changed) | |
777 | > second |
|
777 | > second | |
778 | > third (changed) |
|
778 | > third (changed) | |
779 | > fourth |
|
779 | > fourth | |
780 | > fifth (changed) |
|
780 | > fifth (changed) | |
781 | > EOF |
|
781 | > EOF | |
782 |
|
782 | |||
783 | $ hg fix -r . -r '.^' --working-dir |
|
783 | $ hg fix -r . -r '.^' --working-dir | |
784 |
|
784 | |||
785 | $ hg parents --template '{rev}\n' |
|
785 | $ hg parents --template '{rev}\n' | |
786 | 4 |
|
786 | 4 | |
787 | $ hg cat -r '.^^' file.changed |
|
787 | $ hg cat -r '.^^' file.changed | |
788 | first |
|
788 | first | |
789 | second |
|
789 | second | |
790 | third |
|
790 | third | |
791 | fourth |
|
791 | fourth | |
792 | fifth |
|
792 | fifth | |
793 | $ hg cat -r '.^' file.changed |
|
793 | $ hg cat -r '.^' file.changed | |
794 | FIRST (CHANGED) |
|
794 | FIRST (CHANGED) | |
795 | second |
|
795 | second | |
796 | third |
|
796 | third | |
797 | fourth |
|
797 | fourth | |
798 | fifth |
|
798 | fifth | |
799 | $ hg cat -r . file.changed |
|
799 | $ hg cat -r . file.changed | |
800 | FIRST (CHANGED) |
|
800 | FIRST (CHANGED) | |
801 | second |
|
801 | second | |
802 | THIRD (CHANGED) |
|
802 | THIRD (CHANGED) | |
803 | fourth |
|
803 | fourth | |
804 | fifth |
|
804 | fifth | |
805 | $ cat file.changed |
|
805 | $ cat file.changed | |
806 | FIRST (CHANGED) |
|
806 | FIRST (CHANGED) | |
807 | second |
|
807 | second | |
808 | THIRD (CHANGED) |
|
808 | THIRD (CHANGED) | |
809 | fourth |
|
809 | fourth | |
810 | FIFTH (CHANGED) |
|
810 | FIFTH (CHANGED) | |
811 |
|
811 | |||
812 | $ cd .. |
|
812 | $ cd .. | |
813 |
|
813 | |||
814 | If we incrementally fix a merge commit, we should fix any lines that changed |
|
814 | If we incrementally fix a merge commit, we should fix any lines that changed | |
815 | versus either parent. You could imagine only fixing the intersection or some |
|
815 | versus either parent. You could imagine only fixing the intersection or some | |
816 | other subset, but this is necessary if either parent is being fixed. It |
|
816 | other subset, but this is necessary if either parent is being fixed. It | |
817 | prevents us from forgetting fixes made in either parent. |
|
817 | prevents us from forgetting fixes made in either parent. | |
818 |
|
818 | |||
819 | $ hg init incrementallyfixmergecommit |
|
819 | $ hg init incrementallyfixmergecommit | |
820 | $ cd incrementallyfixmergecommit |
|
820 | $ cd incrementallyfixmergecommit | |
821 |
|
821 | |||
822 | $ printf "a\nb\nc\n" > file.changed |
|
822 | $ printf "a\nb\nc\n" > file.changed | |
823 | $ hg commit -Aqm "ancestor" |
|
823 | $ hg commit -Aqm "ancestor" | |
824 |
|
824 | |||
825 | $ printf "aa\nb\nc\n" > file.changed |
|
825 | $ printf "aa\nb\nc\n" > file.changed | |
826 | $ hg commit -m "change a" |
|
826 | $ hg commit -m "change a" | |
827 |
|
827 | |||
828 | $ hg checkout '.^' |
|
828 | $ hg checkout '.^' | |
829 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
829 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
830 | $ printf "a\nb\ncc\n" > file.changed |
|
830 | $ printf "a\nb\ncc\n" > file.changed | |
831 | $ hg commit -m "change c" |
|
831 | $ hg commit -m "change c" | |
832 | created new head |
|
832 | created new head | |
833 |
|
833 | |||
834 | $ hg merge |
|
834 | $ hg merge | |
835 | merging file.changed |
|
835 | merging file.changed | |
836 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
|
836 | 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | |
837 | (branch merge, don't forget to commit) |
|
837 | (branch merge, don't forget to commit) | |
838 | $ hg commit -m "merge" |
|
838 | $ hg commit -m "merge" | |
839 | $ hg cat -r . file.changed |
|
839 | $ hg cat -r . file.changed | |
840 | aa |
|
840 | aa | |
841 | b |
|
841 | b | |
842 | cc |
|
842 | cc | |
843 |
|
843 | |||
844 | $ hg fix -r . --working-dir |
|
844 | $ hg fix -r . --working-dir | |
845 | $ hg cat -r . file.changed |
|
845 | $ hg cat -r . file.changed | |
846 | AA |
|
846 | AA | |
847 | b |
|
847 | b | |
848 | CC |
|
848 | CC | |
849 |
|
849 | |||
850 | $ cd .. |
|
850 | $ cd .. | |
851 |
|
851 | |||
852 | Abort fixing revisions if there is an unfinished operation. We don't want to |
|
852 | Abort fixing revisions if there is an unfinished operation. We don't want to | |
853 | make things worse by editing files or stripping/obsoleting things. Also abort |
|
853 | make things worse by editing files or stripping/obsoleting things. Also abort | |
854 | fixing the working directory if there are unresolved merge conflicts. |
|
854 | fixing the working directory if there are unresolved merge conflicts. | |
855 |
|
855 | |||
856 | $ hg init abortunresolved |
|
856 | $ hg init abortunresolved | |
857 | $ cd abortunresolved |
|
857 | $ cd abortunresolved | |
858 |
|
858 | |||
859 | $ echo "foo1" > foo.whole |
|
859 | $ echo "foo1" > foo.whole | |
860 | $ hg commit -Aqm "foo 1" |
|
860 | $ hg commit -Aqm "foo 1" | |
861 |
|
861 | |||
862 | $ hg update null |
|
862 | $ hg update null | |
863 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
863 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
864 | $ echo "foo2" > foo.whole |
|
864 | $ echo "foo2" > foo.whole | |
865 | $ hg commit -Aqm "foo 2" |
|
865 | $ hg commit -Aqm "foo 2" | |
866 |
|
866 | |||
867 | $ hg --config extensions.rebase= rebase -r 1 -d 0 |
|
867 | $ hg --config extensions.rebase= rebase -r 1 -d 0 | |
868 | rebasing 1:c3b6dc0e177a tip "foo 2" |
|
868 | rebasing 1:c3b6dc0e177a tip "foo 2" | |
869 | merging foo.whole |
|
869 | merging foo.whole | |
870 | warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark') |
|
870 | warning: conflicts while merging foo.whole! (edit, then use 'hg resolve --mark') | |
871 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
871 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
872 | [240] |
|
872 | [240] | |
873 |
|
873 | |||
874 | $ hg --config extensions.rebase= fix --working-dir |
|
874 | $ hg --config extensions.rebase= fix --working-dir | |
875 | abort: unresolved conflicts |
|
875 | abort: unresolved conflicts | |
876 | (use 'hg resolve') |
|
876 | (use 'hg resolve') | |
877 | [255] |
|
877 | [255] | |
878 |
|
878 | |||
879 | $ hg --config extensions.rebase= fix -r . |
|
879 | $ hg --config extensions.rebase= fix -r . | |
880 | abort: rebase in progress |
|
880 | abort: rebase in progress | |
881 | (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop') |
|
881 | (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop') | |
882 | [20] |
|
882 | [20] | |
883 |
|
883 | |||
884 | $ cd .. |
|
884 | $ cd .. | |
885 |
|
885 | |||
886 | When fixing a file that was renamed, we should diff against the source of the |
|
886 | When fixing a file that was renamed, we should diff against the source of the | |
887 | rename for incremental fixing and we should correctly reproduce the rename in |
|
887 | rename for incremental fixing and we should correctly reproduce the rename in | |
888 | the replacement revision. |
|
888 | the replacement revision. | |
889 |
|
889 | |||
890 | $ hg init fixrenamecommit |
|
890 | $ hg init fixrenamecommit | |
891 | $ cd fixrenamecommit |
|
891 | $ cd fixrenamecommit | |
892 |
|
892 | |||
893 | $ printf "a\nb\nc\n" > source.changed |
|
893 | $ printf "a\nb\nc\n" > source.changed | |
894 | $ hg commit -Aqm "source revision" |
|
894 | $ hg commit -Aqm "source revision" | |
895 | $ hg move source.changed dest.changed |
|
895 | $ hg move source.changed dest.changed | |
896 | $ printf "a\nb\ncc\n" > dest.changed |
|
896 | $ printf "a\nb\ncc\n" > dest.changed | |
897 | $ hg commit -m "dest revision" |
|
897 | $ hg commit -m "dest revision" | |
898 |
|
898 | |||
899 | $ hg fix -r . |
|
899 | $ hg fix -r . | |
900 | $ hg log -r tip --copies --template "{file_copies}\n" |
|
900 | $ hg log -r tip --copies --template "{file_copies}\n" | |
901 | dest.changed (source.changed) |
|
901 | dest.changed (source.changed) | |
902 | $ hg cat -r tip dest.changed |
|
902 | $ hg cat -r tip dest.changed | |
903 | a |
|
903 | a | |
904 | b |
|
904 | b | |
905 | CC |
|
905 | CC | |
906 |
|
906 | |||
907 | $ cd .. |
|
907 | $ cd .. | |
908 |
|
908 | |||
909 | When fixing revisions that remove files we must ensure that the replacement |
|
909 | When fixing revisions that remove files we must ensure that the replacement | |
910 | actually removes the file, whereas it could accidentally leave it unchanged or |
|
910 | actually removes the file, whereas it could accidentally leave it unchanged or | |
911 | write an empty string to it. |
|
911 | write an empty string to it. | |
912 |
|
912 | |||
913 | $ hg init fixremovedfile |
|
913 | $ hg init fixremovedfile | |
914 | $ cd fixremovedfile |
|
914 | $ cd fixremovedfile | |
915 |
|
915 | |||
916 | $ printf "foo\n" > foo.whole |
|
916 | $ printf "foo\n" > foo.whole | |
917 | $ printf "bar\n" > bar.whole |
|
917 | $ printf "bar\n" > bar.whole | |
918 | $ hg commit -Aqm "add files" |
|
918 | $ hg commit -Aqm "add files" | |
919 | $ hg remove bar.whole |
|
919 | $ hg remove bar.whole | |
920 | $ hg commit -m "remove file" |
|
920 | $ hg commit -m "remove file" | |
921 | $ hg status --change . |
|
921 | $ hg status --change . | |
922 | R bar.whole |
|
922 | R bar.whole | |
923 | $ hg fix -r . foo.whole |
|
923 | $ hg fix -r . foo.whole | |
924 | $ hg status --change tip |
|
924 | $ hg status --change tip | |
925 | M foo.whole |
|
925 | M foo.whole | |
926 | R bar.whole |
|
926 | R bar.whole | |
927 |
|
927 | |||
928 | $ cd .. |
|
928 | $ cd .. | |
929 |
|
929 | |||
930 | If fixing a revision finds no fixes to make, no replacement revision should be |
|
930 | If fixing a revision finds no fixes to make, no replacement revision should be | |
931 | created. |
|
931 | created. | |
932 |
|
932 | |||
933 | $ hg init nofixesneeded |
|
933 | $ hg init nofixesneeded | |
934 | $ cd nofixesneeded |
|
934 | $ cd nofixesneeded | |
935 |
|
935 | |||
936 | $ printf "FOO\n" > foo.whole |
|
936 | $ printf "FOO\n" > foo.whole | |
937 | $ hg commit -Aqm "add file" |
|
937 | $ hg commit -Aqm "add file" | |
938 | $ hg log --template '{rev}\n' |
|
938 | $ hg log --template '{rev}\n' | |
939 | 0 |
|
939 | 0 | |
940 | $ hg fix -r . |
|
940 | $ hg fix -r . | |
941 | $ hg log --template '{rev}\n' |
|
941 | $ hg log --template '{rev}\n' | |
942 | 0 |
|
942 | 0 | |
943 |
|
943 | |||
944 | $ cd .. |
|
944 | $ cd .. | |
945 |
|
945 | |||
946 | If fixing a commit reverts all the changes in the commit, we replace it with a |
|
946 | If fixing a commit reverts all the changes in the commit, we replace it with a | |
947 | commit that changes no files. |
|
947 | commit that changes no files. | |
948 |
|
948 | |||
949 | $ hg init nochangesleft |
|
949 | $ hg init nochangesleft | |
950 | $ cd nochangesleft |
|
950 | $ cd nochangesleft | |
951 |
|
951 | |||
952 | $ printf "FOO\n" > foo.whole |
|
952 | $ printf "FOO\n" > foo.whole | |
953 | $ hg commit -Aqm "add file" |
|
953 | $ hg commit -Aqm "add file" | |
954 | $ printf "foo\n" > foo.whole |
|
954 | $ printf "foo\n" > foo.whole | |
955 | $ hg commit -m "edit file" |
|
955 | $ hg commit -m "edit file" | |
956 | $ hg status --change . |
|
956 | $ hg status --change . | |
957 | M foo.whole |
|
957 | M foo.whole | |
958 | $ hg fix -r . |
|
958 | $ hg fix -r . | |
959 | $ hg status --change tip |
|
959 | $ hg status --change tip | |
960 |
|
960 | |||
961 | $ cd .. |
|
961 | $ cd .. | |
962 |
|
962 | |||
963 | If we fix a parent and child revision together, the child revision must be |
|
963 | If we fix a parent and child revision together, the child revision must be | |
964 | replaced if the parent is replaced, even if the diffs of the child needed no |
|
964 | replaced if the parent is replaced, even if the diffs of the child needed no | |
965 | fixes. However, we're free to not replace revisions that need no fixes and have |
|
965 | fixes. However, we're free to not replace revisions that need no fixes and have | |
966 | no ancestors that are replaced. |
|
966 | no ancestors that are replaced. | |
967 |
|
967 | |||
968 | $ hg init mustreplacechild |
|
968 | $ hg init mustreplacechild | |
969 | $ cd mustreplacechild |
|
969 | $ cd mustreplacechild | |
970 |
|
970 | |||
971 | $ printf "FOO\n" > foo.whole |
|
971 | $ printf "FOO\n" > foo.whole | |
972 | $ hg commit -Aqm "add foo" |
|
972 | $ hg commit -Aqm "add foo" | |
973 | $ printf "foo\n" > foo.whole |
|
973 | $ printf "foo\n" > foo.whole | |
974 | $ hg commit -m "edit foo" |
|
974 | $ hg commit -m "edit foo" | |
975 | $ printf "BAR\n" > bar.whole |
|
975 | $ printf "BAR\n" > bar.whole | |
976 | $ hg commit -Aqm "add bar" |
|
976 | $ hg commit -Aqm "add bar" | |
977 |
|
977 | |||
978 | $ hg log --graph --template '{rev} {files}' |
|
978 | $ hg log --graph --template '{rev} {files}' | |
979 | @ 2 bar.whole |
|
979 | @ 2 bar.whole | |
980 | | |
|
980 | | | |
981 | o 1 foo.whole |
|
981 | o 1 foo.whole | |
982 | | |
|
982 | | | |
983 | o 0 foo.whole |
|
983 | o 0 foo.whole | |
984 |
|
984 | |||
985 | $ hg fix -r 0:2 |
|
985 | $ hg fix -r 0:2 | |
986 | $ hg log --graph --template '{rev} {files}' |
|
986 | $ hg log --graph --template '{rev} {files}' | |
987 | o 4 bar.whole |
|
987 | o 4 bar.whole | |
988 | | |
|
988 | | | |
989 | o 3 |
|
989 | o 3 | |
990 | | |
|
990 | | | |
991 | | @ 2 bar.whole |
|
991 | | @ 2 bar.whole | |
992 | | | |
|
992 | | | | |
993 | | x 1 foo.whole |
|
993 | | x 1 foo.whole | |
994 | |/ |
|
994 | |/ | |
995 | o 0 foo.whole |
|
995 | o 0 foo.whole | |
996 |
|
996 | |||
997 |
|
997 | |||
998 | $ cd .. |
|
998 | $ cd .. | |
999 |
|
999 | |||
1000 | It's also possible that the child needs absolutely no changes, but we still |
|
1000 | It's also possible that the child needs absolutely no changes, but we still | |
1001 | need to replace it to update its parent. If we skipped replacing the child |
|
1001 | need to replace it to update its parent. If we skipped replacing the child | |
1002 | because it had no file content changes, it would become an orphan for no good |
|
1002 | because it had no file content changes, it would become an orphan for no good | |
1003 | reason. |
|
1003 | reason. | |
1004 |
|
1004 | |||
1005 | $ hg init mustreplacechildevenifnop |
|
1005 | $ hg init mustreplacechildevenifnop | |
1006 | $ cd mustreplacechildevenifnop |
|
1006 | $ cd mustreplacechildevenifnop | |
1007 |
|
1007 | |||
1008 | $ printf "Foo\n" > foo.whole |
|
1008 | $ printf "Foo\n" > foo.whole | |
1009 | $ hg commit -Aqm "add a bad foo" |
|
1009 | $ hg commit -Aqm "add a bad foo" | |
1010 | $ printf "FOO\n" > foo.whole |
|
1010 | $ printf "FOO\n" > foo.whole | |
1011 | $ hg commit -m "add a good foo" |
|
1011 | $ hg commit -m "add a good foo" | |
1012 | $ hg fix -r . -r '.^' |
|
1012 | $ hg fix -r . -r '.^' | |
1013 | $ hg log --graph --template '{rev} {desc}' |
|
1013 | $ hg log --graph --template '{rev} {desc}' | |
1014 | o 3 add a good foo |
|
1014 | o 3 add a good foo | |
1015 | | |
|
1015 | | | |
1016 | o 2 add a bad foo |
|
1016 | o 2 add a bad foo | |
1017 |
|
1017 | |||
1018 | @ 1 add a good foo |
|
1018 | @ 1 add a good foo | |
1019 | | |
|
1019 | | | |
1020 | x 0 add a bad foo |
|
1020 | x 0 add a bad foo | |
1021 |
|
1021 | |||
1022 |
|
1022 | |||
1023 | $ cd .. |
|
1023 | $ cd .. | |
1024 |
|
1024 | |||
1025 | Similar to the case above, the child revision may become empty as a result of |
|
1025 | Similar to the case above, the child revision may become empty as a result of | |
1026 | fixing its parent. We should still create an empty replacement child. |
|
1026 | fixing its parent. We should still create an empty replacement child. | |
1027 | TODO: determine how this should interact with ui.allowemptycommit given that |
|
1027 | TODO: determine how this should interact with ui.allowemptycommit given that | |
1028 | the empty replacement could have children. |
|
1028 | the empty replacement could have children. | |
1029 |
|
1029 | |||
1030 | $ hg init mustreplacechildevenifempty |
|
1030 | $ hg init mustreplacechildevenifempty | |
1031 | $ cd mustreplacechildevenifempty |
|
1031 | $ cd mustreplacechildevenifempty | |
1032 |
|
1032 | |||
1033 | $ printf "foo\n" > foo.whole |
|
1033 | $ printf "foo\n" > foo.whole | |
1034 | $ hg commit -Aqm "add foo" |
|
1034 | $ hg commit -Aqm "add foo" | |
1035 | $ printf "Foo\n" > foo.whole |
|
1035 | $ printf "Foo\n" > foo.whole | |
1036 | $ hg commit -m "edit foo" |
|
1036 | $ hg commit -m "edit foo" | |
1037 | $ hg fix -r . -r '.^' |
|
1037 | $ hg fix -r . -r '.^' | |
1038 | $ hg log --graph --template '{rev} {desc}\n' --stat |
|
1038 | $ hg log --graph --template '{rev} {desc}\n' --stat | |
1039 | o 3 edit foo |
|
1039 | o 3 edit foo | |
1040 | | |
|
1040 | | | |
1041 | o 2 add foo |
|
1041 | o 2 add foo | |
1042 | foo.whole | 1 + |
|
1042 | foo.whole | 1 + | |
1043 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
1043 | 1 files changed, 1 insertions(+), 0 deletions(-) | |
1044 |
|
1044 | |||
1045 | @ 1 edit foo |
|
1045 | @ 1 edit foo | |
1046 | | foo.whole | 2 +- |
|
1046 | | foo.whole | 2 +- | |
1047 | | 1 files changed, 1 insertions(+), 1 deletions(-) |
|
1047 | | 1 files changed, 1 insertions(+), 1 deletions(-) | |
1048 | | |
|
1048 | | | |
1049 | x 0 add foo |
|
1049 | x 0 add foo | |
1050 | foo.whole | 1 + |
|
1050 | foo.whole | 1 + | |
1051 | 1 files changed, 1 insertions(+), 0 deletions(-) |
|
1051 | 1 files changed, 1 insertions(+), 0 deletions(-) | |
1052 |
|
1052 | |||
1053 |
|
1053 | |||
1054 | $ cd .. |
|
1054 | $ cd .. | |
1055 |
|
1055 | |||
1056 | Fixing a secret commit should replace it with another secret commit. |
|
1056 | Fixing a secret commit should replace it with another secret commit. | |
1057 |
|
1057 | |||
1058 | $ hg init fixsecretcommit |
|
1058 | $ hg init fixsecretcommit | |
1059 | $ cd fixsecretcommit |
|
1059 | $ cd fixsecretcommit | |
1060 |
|
1060 | |||
1061 | $ printf "foo\n" > foo.whole |
|
1061 | $ printf "foo\n" > foo.whole | |
1062 | $ hg commit -Aqm "add foo" --secret |
|
1062 | $ hg commit -Aqm "add foo" --secret | |
1063 | $ hg fix -r . |
|
1063 | $ hg fix -r . | |
1064 | $ hg log --template '{rev} {phase}\n' |
|
1064 | $ hg log --template '{rev} {phase}\n' | |
1065 | 1 secret |
|
1065 | 1 secret | |
1066 | 0 secret |
|
1066 | 0 secret | |
1067 |
|
1067 | |||
1068 | $ cd .. |
|
1068 | $ cd .. | |
1069 |
|
1069 | |||
1070 | We should also preserve phase when fixing a draft commit while the user has |
|
1070 | We should also preserve phase when fixing a draft commit while the user has | |
1071 | their default set to secret. |
|
1071 | their default set to secret. | |
1072 |
|
1072 | |||
1073 | $ hg init respectphasesnewcommit |
|
1073 | $ hg init respectphasesnewcommit | |
1074 | $ cd respectphasesnewcommit |
|
1074 | $ cd respectphasesnewcommit | |
1075 |
|
1075 | |||
1076 | $ printf "foo\n" > foo.whole |
|
1076 | $ printf "foo\n" > foo.whole | |
1077 | $ hg commit -Aqm "add foo" |
|
1077 | $ hg commit -Aqm "add foo" | |
1078 | $ hg --config phases.newcommit=secret fix -r . |
|
1078 | $ hg --config phases.newcommit=secret fix -r . | |
1079 | $ hg log --template '{rev} {phase}\n' |
|
1079 | $ hg log --template '{rev} {phase}\n' | |
1080 | 1 draft |
|
1080 | 1 draft | |
1081 | 0 draft |
|
1081 | 0 draft | |
1082 |
|
1082 | |||
1083 | $ cd .. |
|
1083 | $ cd .. | |
1084 |
|
1084 | |||
1085 | Debug output should show what fixer commands are being subprocessed, which is |
|
1085 | Debug output should show what fixer commands are being subprocessed, which is | |
1086 | useful for anyone trying to set up a new config. |
|
1086 | useful for anyone trying to set up a new config. | |
1087 |
|
1087 | |||
1088 | $ hg init debugoutput |
|
1088 | $ hg init debugoutput | |
1089 | $ cd debugoutput |
|
1089 | $ cd debugoutput | |
1090 |
|
1090 | |||
1091 | $ printf "foo\nbar\nbaz\n" > foo.changed |
|
1091 | $ printf "foo\nbar\nbaz\n" > foo.changed | |
1092 | $ hg commit -Aqm "foo" |
|
1092 | $ hg commit -Aqm "foo" | |
1093 | $ printf "Foo\nbar\nBaz\n" > foo.changed |
|
1093 | $ printf "Foo\nbar\nBaz\n" > foo.changed | |
1094 | $ hg --debug fix --working-dir |
|
1094 | $ hg --debug fix --working-dir | |
1095 | subprocess: * $TESTTMP/uppercase.py 1-1 3-3 (glob) |
|
1095 | subprocess: * $TESTTMP/uppercase.py 1-1 3-3 (glob) | |
1096 |
|
1096 | |||
1097 | $ cd .. |
|
1097 | $ cd .. | |
1098 |
|
1098 | |||
1099 | Fixing an obsolete revision can cause divergence, so we abort unless the user |
|
1099 | Fixing an obsolete revision can cause divergence, so we abort unless the user | |
1100 | configures to allow it. This is not yet smart enough to know whether there is a |
|
1100 | configures to allow it. This is not yet smart enough to know whether there is a | |
1101 | successor, but even then it is not likely intentional or idiomatic to fix an |
|
1101 | successor, but even then it is not likely intentional or idiomatic to fix an | |
1102 | obsolete revision. |
|
1102 | obsolete revision. | |
1103 |
|
1103 | |||
1104 | $ hg init abortobsoleterev |
|
1104 | $ hg init abortobsoleterev | |
1105 | $ cd abortobsoleterev |
|
1105 | $ cd abortobsoleterev | |
1106 |
|
1106 | |||
1107 | $ printf "foo\n" > foo.changed |
|
1107 | $ printf "foo\n" > foo.changed | |
1108 | $ hg commit -Aqm "foo" |
|
1108 | $ hg commit -Aqm "foo" | |
1109 | $ hg debugobsolete `hg parents --template '{node}'` |
|
1109 | $ hg debugobsolete `hg parents --template '{node}'` | |
1110 | 1 new obsolescence markers |
|
1110 | 1 new obsolescence markers | |
1111 | obsoleted 1 changesets |
|
1111 | obsoleted 1 changesets | |
1112 | $ hg --hidden fix -r 0 |
|
1112 | $ hg --hidden fix -r 0 | |
1113 | abort: fixing obsolete revision could cause divergence |
|
1113 | abort: fixing obsolete revision could cause divergence | |
1114 | [255] |
|
1114 | [255] | |
1115 |
|
1115 | |||
1116 | $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true |
|
1116 | $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true | |
1117 | $ hg cat -r tip foo.changed |
|
1117 | $ hg cat -r tip foo.changed | |
1118 | FOO |
|
1118 | FOO | |
1119 |
|
1119 | |||
1120 | $ cd .. |
|
1120 | $ cd .. | |
1121 |
|
1121 | |||
1122 | Test all of the available substitution values for fixer commands. |
|
1122 | Test all of the available substitution values for fixer commands. | |
1123 |
|
1123 | |||
1124 | $ hg init substitution |
|
1124 | $ hg init substitution | |
1125 | $ cd substitution |
|
1125 | $ cd substitution | |
1126 |
|
1126 | |||
1127 | $ mkdir foo |
|
1127 | $ mkdir foo | |
1128 | $ printf "hello\ngoodbye\n" > foo/bar |
|
1128 | $ printf "hello\ngoodbye\n" > foo/bar | |
1129 | $ hg add |
|
1129 | $ hg add | |
1130 | adding foo/bar |
|
1130 | adding foo/bar | |
1131 | $ hg --config "fix.fail:command=printf '%s\n' '{rootpath}' '{basename}'" \ |
|
1131 | $ hg --config "fix.fail:command=printf '%s\n' '{rootpath}' '{basename}'" \ | |
1132 | > --config "fix.fail:linerange='{first}' '{last}'" \ |
|
1132 | > --config "fix.fail:linerange='{first}' '{last}'" \ | |
1133 | > --config "fix.fail:pattern=foo/bar" \ |
|
1133 | > --config "fix.fail:pattern=foo/bar" \ | |
1134 | > fix --working-dir |
|
1134 | > fix --working-dir | |
1135 | $ cat foo/bar |
|
1135 | $ cat foo/bar | |
1136 | foo/bar |
|
1136 | foo/bar | |
1137 | bar |
|
1137 | bar | |
1138 | 1 |
|
1138 | 1 | |
1139 | 2 |
|
1139 | 2 | |
1140 |
|
1140 | |||
1141 | $ cd .. |
|
1141 | $ cd .. | |
1142 |
|
1142 | |||
1143 | The --base flag should allow picking the revisions to diff against for changed |
|
1143 | The --base flag should allow picking the revisions to diff against for changed | |
1144 | files and incremental line formatting. |
|
1144 | files and incremental line formatting. | |
1145 |
|
1145 | |||
1146 | $ hg init baseflag |
|
1146 | $ hg init baseflag | |
1147 | $ cd baseflag |
|
1147 | $ cd baseflag | |
1148 |
|
1148 | |||
1149 | $ printf "one\ntwo\n" > foo.changed |
|
1149 | $ printf "one\ntwo\n" > foo.changed | |
1150 | $ printf "bar\n" > bar.changed |
|
1150 | $ printf "bar\n" > bar.changed | |
1151 | $ hg commit -Aqm "first" |
|
1151 | $ hg commit -Aqm "first" | |
1152 | $ printf "one\nTwo\n" > foo.changed |
|
1152 | $ printf "one\nTwo\n" > foo.changed | |
1153 | $ hg commit -m "second" |
|
1153 | $ hg commit -m "second" | |
1154 | $ hg fix -w --base . |
|
1154 | $ hg fix -w --base . | |
1155 | $ hg status |
|
1155 | $ hg status | |
1156 | $ hg fix -w --base null |
|
1156 | $ hg fix -w --base null | |
1157 | $ cat foo.changed |
|
1157 | $ cat foo.changed | |
1158 | ONE |
|
1158 | ONE | |
1159 | TWO |
|
1159 | TWO | |
1160 | $ cat bar.changed |
|
1160 | $ cat bar.changed | |
1161 | BAR |
|
1161 | BAR | |
1162 |
|
1162 | |||
1163 | $ cd .. |
|
1163 | $ cd .. | |
1164 |
|
1164 | |||
1165 | If the user asks to fix the parent of another commit, they are asking to create |
|
1165 | If the user asks to fix the parent of another commit, they are asking to create | |
1166 | an orphan. We must respect experimental.evolution.allowunstable. |
|
1166 | an orphan. We must respect experimental.evolution.allowunstable. | |
1167 |
|
1167 | |||
1168 | $ hg init allowunstable |
|
1168 | $ hg init allowunstable | |
1169 | $ cd allowunstable |
|
1169 | $ cd allowunstable | |
1170 |
|
1170 | |||
1171 | $ printf "one\n" > foo.whole |
|
1171 | $ printf "one\n" > foo.whole | |
1172 | $ hg commit -Aqm "first" |
|
1172 | $ hg commit -Aqm "first" | |
1173 | $ printf "two\n" > foo.whole |
|
1173 | $ printf "two\n" > foo.whole | |
1174 | $ hg commit -m "second" |
|
1174 | $ hg commit -m "second" | |
1175 | $ hg --config experimental.evolution.allowunstable=False fix -r '.^' |
|
1175 | $ hg --config experimental.evolution.allowunstable=False fix -r '.^' | |
1176 | abort: cannot fix changeset with children |
|
1176 | abort: cannot fix changeset with children | |
1177 |
[ |
|
1177 | [10] | |
1178 | $ hg fix -r '.^' |
|
1178 | $ hg fix -r '.^' | |
1179 | 1 new orphan changesets |
|
1179 | 1 new orphan changesets | |
1180 | $ hg cat -r 2 foo.whole |
|
1180 | $ hg cat -r 2 foo.whole | |
1181 | ONE |
|
1181 | ONE | |
1182 |
|
1182 | |||
1183 | $ cd .. |
|
1183 | $ cd .. | |
1184 |
|
1184 | |||
1185 | The --base flag affects the set of files being fixed. So while the --whole flag |
|
1185 | The --base flag affects the set of files being fixed. So while the --whole flag | |
1186 | makes the base irrelevant for changed line ranges, it still changes the |
|
1186 | makes the base irrelevant for changed line ranges, it still changes the | |
1187 | meaning and effect of the command. In this example, no files or lines are fixed |
|
1187 | meaning and effect of the command. In this example, no files or lines are fixed | |
1188 | until we specify the base, but then we do fix unchanged lines. |
|
1188 | until we specify the base, but then we do fix unchanged lines. | |
1189 |
|
1189 | |||
1190 | $ hg init basewhole |
|
1190 | $ hg init basewhole | |
1191 | $ cd basewhole |
|
1191 | $ cd basewhole | |
1192 | $ printf "foo1\n" > foo.changed |
|
1192 | $ printf "foo1\n" > foo.changed | |
1193 | $ hg commit -Aqm "first" |
|
1193 | $ hg commit -Aqm "first" | |
1194 | $ printf "foo2\n" >> foo.changed |
|
1194 | $ printf "foo2\n" >> foo.changed | |
1195 | $ printf "bar\n" > bar.changed |
|
1195 | $ printf "bar\n" > bar.changed | |
1196 | $ hg commit -Aqm "second" |
|
1196 | $ hg commit -Aqm "second" | |
1197 |
|
1197 | |||
1198 | $ hg fix --working-dir --whole |
|
1198 | $ hg fix --working-dir --whole | |
1199 | $ cat *.changed |
|
1199 | $ cat *.changed | |
1200 | bar |
|
1200 | bar | |
1201 | foo1 |
|
1201 | foo1 | |
1202 | foo2 |
|
1202 | foo2 | |
1203 |
|
1203 | |||
1204 | $ hg fix --working-dir --base 0 --whole |
|
1204 | $ hg fix --working-dir --base 0 --whole | |
1205 | $ cat *.changed |
|
1205 | $ cat *.changed | |
1206 | BAR |
|
1206 | BAR | |
1207 | FOO1 |
|
1207 | FOO1 | |
1208 | FOO2 |
|
1208 | FOO2 | |
1209 |
|
1209 | |||
1210 | $ cd .. |
|
1210 | $ cd .. | |
1211 |
|
1211 | |||
1212 | The execution order of tools can be controlled. This example doesn't work if |
|
1212 | The execution order of tools can be controlled. This example doesn't work if | |
1213 | you sort after truncating, but the config defines the correct order while the |
|
1213 | you sort after truncating, but the config defines the correct order while the | |
1214 | definitions are out of order (which might imply the incorrect order given the |
|
1214 | definitions are out of order (which might imply the incorrect order given the | |
1215 | implementation of fix). The goal is to use multiple tools to select the lowest |
|
1215 | implementation of fix). The goal is to use multiple tools to select the lowest | |
1216 | 5 numbers in the file. |
|
1216 | 5 numbers in the file. | |
1217 |
|
1217 | |||
1218 | $ hg init priorityexample |
|
1218 | $ hg init priorityexample | |
1219 | $ cd priorityexample |
|
1219 | $ cd priorityexample | |
1220 |
|
1220 | |||
1221 | $ cat >> .hg/hgrc <<EOF |
|
1221 | $ cat >> .hg/hgrc <<EOF | |
1222 | > [fix] |
|
1222 | > [fix] | |
1223 | > head:command = head -n 5 |
|
1223 | > head:command = head -n 5 | |
1224 | > head:pattern = numbers.txt |
|
1224 | > head:pattern = numbers.txt | |
1225 | > head:priority = 1 |
|
1225 | > head:priority = 1 | |
1226 | > sort:command = sort -n |
|
1226 | > sort:command = sort -n | |
1227 | > sort:pattern = numbers.txt |
|
1227 | > sort:pattern = numbers.txt | |
1228 | > sort:priority = 2 |
|
1228 | > sort:priority = 2 | |
1229 | > EOF |
|
1229 | > EOF | |
1230 |
|
1230 | |||
1231 | $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt |
|
1231 | $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt | |
1232 | $ hg add -q |
|
1232 | $ hg add -q | |
1233 | $ hg fix -w |
|
1233 | $ hg fix -w | |
1234 | $ cat numbers.txt |
|
1234 | $ cat numbers.txt | |
1235 | 0 |
|
1235 | 0 | |
1236 | 1 |
|
1236 | 1 | |
1237 | 2 |
|
1237 | 2 | |
1238 | 3 |
|
1238 | 3 | |
1239 | 4 |
|
1239 | 4 | |
1240 |
|
1240 | |||
1241 | And of course we should be able to break this by reversing the execution order. |
|
1241 | And of course we should be able to break this by reversing the execution order. | |
1242 | Test negative priorities while we're at it. |
|
1242 | Test negative priorities while we're at it. | |
1243 |
|
1243 | |||
1244 | $ cat >> .hg/hgrc <<EOF |
|
1244 | $ cat >> .hg/hgrc <<EOF | |
1245 | > [fix] |
|
1245 | > [fix] | |
1246 | > head:priority = -1 |
|
1246 | > head:priority = -1 | |
1247 | > sort:priority = -2 |
|
1247 | > sort:priority = -2 | |
1248 | > EOF |
|
1248 | > EOF | |
1249 | $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt |
|
1249 | $ printf "8\n2\n3\n6\n7\n4\n9\n5\n1\n0\n" > numbers.txt | |
1250 | $ hg fix -w |
|
1250 | $ hg fix -w | |
1251 | $ cat numbers.txt |
|
1251 | $ cat numbers.txt | |
1252 | 2 |
|
1252 | 2 | |
1253 | 3 |
|
1253 | 3 | |
1254 | 6 |
|
1254 | 6 | |
1255 | 7 |
|
1255 | 7 | |
1256 | 8 |
|
1256 | 8 | |
1257 |
|
1257 | |||
1258 | $ cd .. |
|
1258 | $ cd .. | |
1259 |
|
1259 | |||
1260 | It's possible for repeated applications of a fixer tool to create cycles in the |
|
1260 | It's possible for repeated applications of a fixer tool to create cycles in the | |
1261 | generated content of a file. For example, two users with different versions of |
|
1261 | generated content of a file. For example, two users with different versions of | |
1262 | a code formatter might fight over the formatting when they run hg fix. In the |
|
1262 | a code formatter might fight over the formatting when they run hg fix. In the | |
1263 | absence of other changes, this means we could produce commits with the same |
|
1263 | absence of other changes, this means we could produce commits with the same | |
1264 | hash in subsequent runs of hg fix. This is a problem unless we support |
|
1264 | hash in subsequent runs of hg fix. This is a problem unless we support | |
1265 | obsolescence cycles well. We avoid this by adding an extra field to the |
|
1265 | obsolescence cycles well. We avoid this by adding an extra field to the | |
1266 | successor which forces it to have a new hash. That's why this test creates |
|
1266 | successor which forces it to have a new hash. That's why this test creates | |
1267 | three revisions instead of two. |
|
1267 | three revisions instead of two. | |
1268 |
|
1268 | |||
1269 | $ hg init cyclictool |
|
1269 | $ hg init cyclictool | |
1270 | $ cd cyclictool |
|
1270 | $ cd cyclictool | |
1271 |
|
1271 | |||
1272 | $ cat >> .hg/hgrc <<EOF |
|
1272 | $ cat >> .hg/hgrc <<EOF | |
1273 | > [fix] |
|
1273 | > [fix] | |
1274 | > swapletters:command = tr ab ba |
|
1274 | > swapletters:command = tr ab ba | |
1275 | > swapletters:pattern = foo |
|
1275 | > swapletters:pattern = foo | |
1276 | > EOF |
|
1276 | > EOF | |
1277 |
|
1277 | |||
1278 | $ echo ab > foo |
|
1278 | $ echo ab > foo | |
1279 | $ hg commit -Aqm foo |
|
1279 | $ hg commit -Aqm foo | |
1280 |
|
1280 | |||
1281 | $ hg fix -r 0 |
|
1281 | $ hg fix -r 0 | |
1282 | $ hg fix -r 1 |
|
1282 | $ hg fix -r 1 | |
1283 |
|
1283 | |||
1284 | $ hg cat -r 0 foo --hidden |
|
1284 | $ hg cat -r 0 foo --hidden | |
1285 | ab |
|
1285 | ab | |
1286 | $ hg cat -r 1 foo --hidden |
|
1286 | $ hg cat -r 1 foo --hidden | |
1287 | ba |
|
1287 | ba | |
1288 | $ hg cat -r 2 foo |
|
1288 | $ hg cat -r 2 foo | |
1289 | ab |
|
1289 | ab | |
1290 |
|
1290 | |||
1291 | $ cd .. |
|
1291 | $ cd .. | |
1292 |
|
1292 | |||
1293 | We run fixer tools in the repo root so they can look for config files or other |
|
1293 | We run fixer tools in the repo root so they can look for config files or other | |
1294 | important things in the working directory. This does NOT mean we are |
|
1294 | important things in the working directory. This does NOT mean we are | |
1295 | reconstructing a working copy of every revision being fixed; we're just giving |
|
1295 | reconstructing a working copy of every revision being fixed; we're just giving | |
1296 | the tool knowledge of the repo's location in case it can do something |
|
1296 | the tool knowledge of the repo's location in case it can do something | |
1297 | reasonable with that. |
|
1297 | reasonable with that. | |
1298 |
|
1298 | |||
1299 | $ hg init subprocesscwd |
|
1299 | $ hg init subprocesscwd | |
1300 | $ cd subprocesscwd |
|
1300 | $ cd subprocesscwd | |
1301 |
|
1301 | |||
1302 | $ cat >> .hg/hgrc <<EOF |
|
1302 | $ cat >> .hg/hgrc <<EOF | |
1303 | > [fix] |
|
1303 | > [fix] | |
1304 | > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())" |
|
1304 | > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())" | |
1305 | > printcwd:pattern = relpath:foo/bar |
|
1305 | > printcwd:pattern = relpath:foo/bar | |
1306 | > filesetpwd:command = "$PYTHON" -c "import os; print('fs: ' + os.getcwd())" |
|
1306 | > filesetpwd:command = "$PYTHON" -c "import os; print('fs: ' + os.getcwd())" | |
1307 | > filesetpwd:pattern = set:**quux |
|
1307 | > filesetpwd:pattern = set:**quux | |
1308 | > EOF |
|
1308 | > EOF | |
1309 |
|
1309 | |||
1310 | $ mkdir foo |
|
1310 | $ mkdir foo | |
1311 | $ printf "bar\n" > foo/bar |
|
1311 | $ printf "bar\n" > foo/bar | |
1312 | $ printf "quux\n" > quux |
|
1312 | $ printf "quux\n" > quux | |
1313 | $ hg commit -Aqm blah |
|
1313 | $ hg commit -Aqm blah | |
1314 |
|
1314 | |||
1315 | $ hg fix -w -r . foo/bar |
|
1315 | $ hg fix -w -r . foo/bar | |
1316 | $ hg cat -r tip foo/bar |
|
1316 | $ hg cat -r tip foo/bar | |
1317 | $TESTTMP/subprocesscwd |
|
1317 | $TESTTMP/subprocesscwd | |
1318 | $ cat foo/bar |
|
1318 | $ cat foo/bar | |
1319 | $TESTTMP/subprocesscwd |
|
1319 | $TESTTMP/subprocesscwd | |
1320 |
|
1320 | |||
1321 | $ cd foo |
|
1321 | $ cd foo | |
1322 |
|
1322 | |||
1323 | $ hg fix -w -r . bar |
|
1323 | $ hg fix -w -r . bar | |
1324 | $ hg cat -r tip bar ../quux |
|
1324 | $ hg cat -r tip bar ../quux | |
1325 | $TESTTMP/subprocesscwd |
|
1325 | $TESTTMP/subprocesscwd | |
1326 | quux |
|
1326 | quux | |
1327 | $ cat bar ../quux |
|
1327 | $ cat bar ../quux | |
1328 | $TESTTMP/subprocesscwd |
|
1328 | $TESTTMP/subprocesscwd | |
1329 | quux |
|
1329 | quux | |
1330 | $ echo modified > bar |
|
1330 | $ echo modified > bar | |
1331 | $ hg fix -w bar |
|
1331 | $ hg fix -w bar | |
1332 | $ cat bar |
|
1332 | $ cat bar | |
1333 | $TESTTMP/subprocesscwd |
|
1333 | $TESTTMP/subprocesscwd | |
1334 |
|
1334 | |||
1335 | Apparently fixing p1() and its descendants doesn't include wdir() unless |
|
1335 | Apparently fixing p1() and its descendants doesn't include wdir() unless | |
1336 | explicitly stated. |
|
1336 | explicitly stated. | |
1337 |
|
1337 | |||
1338 | $ hg fix -r '.::' |
|
1338 | $ hg fix -r '.::' | |
1339 | $ hg cat -r . ../quux |
|
1339 | $ hg cat -r . ../quux | |
1340 | quux |
|
1340 | quux | |
1341 | $ hg cat -r tip ../quux |
|
1341 | $ hg cat -r tip ../quux | |
1342 | fs: $TESTTMP/subprocesscwd |
|
1342 | fs: $TESTTMP/subprocesscwd | |
1343 | $ cat ../quux |
|
1343 | $ cat ../quux | |
1344 | quux |
|
1344 | quux | |
1345 |
|
1345 | |||
1346 | Clean files are not fixed unless explicitly named |
|
1346 | Clean files are not fixed unless explicitly named | |
1347 | $ echo 'dirty' > ../quux |
|
1347 | $ echo 'dirty' > ../quux | |
1348 |
|
1348 | |||
1349 | $ hg fix --working-dir |
|
1349 | $ hg fix --working-dir | |
1350 | $ cat ../quux |
|
1350 | $ cat ../quux | |
1351 | fs: $TESTTMP/subprocesscwd |
|
1351 | fs: $TESTTMP/subprocesscwd | |
1352 |
|
1352 | |||
1353 | $ cd ../.. |
|
1353 | $ cd ../.. | |
1354 |
|
1354 | |||
1355 | Tools configured without a pattern are ignored. It would be too dangerous to |
|
1355 | Tools configured without a pattern are ignored. It would be too dangerous to | |
1356 | run them on all files, because this might happen while testing a configuration |
|
1356 | run them on all files, because this might happen while testing a configuration | |
1357 | that also deletes all of the file content. There is no reasonable subset of the |
|
1357 | that also deletes all of the file content. There is no reasonable subset of the | |
1358 | files to use as a default. Users should be explicit about what files are |
|
1358 | files to use as a default. Users should be explicit about what files are | |
1359 | affected by a tool. This test also confirms that we don't crash when the |
|
1359 | affected by a tool. This test also confirms that we don't crash when the | |
1360 | pattern config is missing, and that we only warn about it once. |
|
1360 | pattern config is missing, and that we only warn about it once. | |
1361 |
|
1361 | |||
1362 | $ hg init nopatternconfigured |
|
1362 | $ hg init nopatternconfigured | |
1363 | $ cd nopatternconfigured |
|
1363 | $ cd nopatternconfigured | |
1364 |
|
1364 | |||
1365 | $ printf "foo" > foo |
|
1365 | $ printf "foo" > foo | |
1366 | $ printf "bar" > bar |
|
1366 | $ printf "bar" > bar | |
1367 | $ hg add -q |
|
1367 | $ hg add -q | |
1368 | $ hg fix --debug --working-dir --config "fix.nopattern:command=echo fixed" |
|
1368 | $ hg fix --debug --working-dir --config "fix.nopattern:command=echo fixed" | |
1369 | fixer tool has no pattern configuration: nopattern |
|
1369 | fixer tool has no pattern configuration: nopattern | |
1370 | $ cat foo bar |
|
1370 | $ cat foo bar | |
1371 | foobar (no-eol) |
|
1371 | foobar (no-eol) | |
1372 | $ hg fix --debug --working-dir --config "fix.nocommand:pattern=foo.bar" |
|
1372 | $ hg fix --debug --working-dir --config "fix.nocommand:pattern=foo.bar" | |
1373 | fixer tool has no command configuration: nocommand |
|
1373 | fixer tool has no command configuration: nocommand | |
1374 |
|
1374 | |||
1375 | $ cd .. |
|
1375 | $ cd .. | |
1376 |
|
1376 | |||
1377 | Tools can be disabled. Disabled tools do nothing but print a debug message. |
|
1377 | Tools can be disabled. Disabled tools do nothing but print a debug message. | |
1378 |
|
1378 | |||
1379 | $ hg init disabled |
|
1379 | $ hg init disabled | |
1380 | $ cd disabled |
|
1380 | $ cd disabled | |
1381 |
|
1381 | |||
1382 | $ printf "foo\n" > foo |
|
1382 | $ printf "foo\n" > foo | |
1383 | $ hg add -q |
|
1383 | $ hg add -q | |
1384 | $ hg fix --debug --working-dir --config "fix.disabled:command=echo fixed" \ |
|
1384 | $ hg fix --debug --working-dir --config "fix.disabled:command=echo fixed" \ | |
1385 | > --config "fix.disabled:pattern=foo" \ |
|
1385 | > --config "fix.disabled:pattern=foo" \ | |
1386 | > --config "fix.disabled:enabled=false" |
|
1386 | > --config "fix.disabled:enabled=false" | |
1387 | ignoring disabled fixer tool: disabled |
|
1387 | ignoring disabled fixer tool: disabled | |
1388 | $ cat foo |
|
1388 | $ cat foo | |
1389 | foo |
|
1389 | foo | |
1390 |
|
1390 | |||
1391 | $ cd .. |
|
1391 | $ cd .. | |
1392 |
|
1392 | |||
1393 | Test that we can configure a fixer to affect all files regardless of the cwd. |
|
1393 | Test that we can configure a fixer to affect all files regardless of the cwd. | |
1394 | The way we invoke matching must not prohibit this. |
|
1394 | The way we invoke matching must not prohibit this. | |
1395 |
|
1395 | |||
1396 | $ hg init affectallfiles |
|
1396 | $ hg init affectallfiles | |
1397 | $ cd affectallfiles |
|
1397 | $ cd affectallfiles | |
1398 |
|
1398 | |||
1399 | $ mkdir foo bar |
|
1399 | $ mkdir foo bar | |
1400 | $ printf "foo" > foo/file |
|
1400 | $ printf "foo" > foo/file | |
1401 | $ printf "bar" > bar/file |
|
1401 | $ printf "bar" > bar/file | |
1402 | $ printf "baz" > baz_file |
|
1402 | $ printf "baz" > baz_file | |
1403 | $ hg add -q |
|
1403 | $ hg add -q | |
1404 |
|
1404 | |||
1405 | $ cd bar |
|
1405 | $ cd bar | |
1406 | $ hg fix --working-dir --config "fix.cooltool:command=echo fixed" \ |
|
1406 | $ hg fix --working-dir --config "fix.cooltool:command=echo fixed" \ | |
1407 | > --config "fix.cooltool:pattern=glob:**" |
|
1407 | > --config "fix.cooltool:pattern=glob:**" | |
1408 | $ cd .. |
|
1408 | $ cd .. | |
1409 |
|
1409 | |||
1410 | $ cat foo/file |
|
1410 | $ cat foo/file | |
1411 | fixed |
|
1411 | fixed | |
1412 | $ cat bar/file |
|
1412 | $ cat bar/file | |
1413 | fixed |
|
1413 | fixed | |
1414 | $ cat baz_file |
|
1414 | $ cat baz_file | |
1415 | fixed |
|
1415 | fixed | |
1416 |
|
1416 | |||
1417 | $ cd .. |
|
1417 | $ cd .. | |
1418 |
|
1418 | |||
1419 | Tools should be able to run on unchanged files, even if they set :linerange. |
|
1419 | Tools should be able to run on unchanged files, even if they set :linerange. | |
1420 | This includes a corner case where deleted chunks of a file are not considered |
|
1420 | This includes a corner case where deleted chunks of a file are not considered | |
1421 | changes. |
|
1421 | changes. | |
1422 |
|
1422 | |||
1423 | $ hg init skipclean |
|
1423 | $ hg init skipclean | |
1424 | $ cd skipclean |
|
1424 | $ cd skipclean | |
1425 |
|
1425 | |||
1426 | $ printf "a\nb\nc\n" > foo |
|
1426 | $ printf "a\nb\nc\n" > foo | |
1427 | $ printf "a\nb\nc\n" > bar |
|
1427 | $ printf "a\nb\nc\n" > bar | |
1428 | $ printf "a\nb\nc\n" > baz |
|
1428 | $ printf "a\nb\nc\n" > baz | |
1429 | $ hg commit -Aqm "base" |
|
1429 | $ hg commit -Aqm "base" | |
1430 |
|
1430 | |||
1431 | $ printf "a\nc\n" > foo |
|
1431 | $ printf "a\nc\n" > foo | |
1432 | $ printf "a\nx\nc\n" > baz |
|
1432 | $ printf "a\nx\nc\n" > baz | |
1433 |
|
1433 | |||
1434 | $ cat >> print.py <<EOF |
|
1434 | $ cat >> print.py <<EOF | |
1435 | > import sys |
|
1435 | > import sys | |
1436 | > for a in sys.argv[1:]: |
|
1436 | > for a in sys.argv[1:]: | |
1437 | > print(a) |
|
1437 | > print(a) | |
1438 | > EOF |
|
1438 | > EOF | |
1439 |
|
1439 | |||
1440 | $ hg fix --working-dir foo bar baz \ |
|
1440 | $ hg fix --working-dir foo bar baz \ | |
1441 | > --config "fix.changedlines:command=\"$PYTHON\" print.py \"Line ranges:\"" \ |
|
1441 | > --config "fix.changedlines:command=\"$PYTHON\" print.py \"Line ranges:\"" \ | |
1442 | > --config 'fix.changedlines:linerange="{first} through {last}"' \ |
|
1442 | > --config 'fix.changedlines:linerange="{first} through {last}"' \ | |
1443 | > --config 'fix.changedlines:pattern=glob:**' \ |
|
1443 | > --config 'fix.changedlines:pattern=glob:**' \ | |
1444 | > --config 'fix.changedlines:skipclean=false' |
|
1444 | > --config 'fix.changedlines:skipclean=false' | |
1445 |
|
1445 | |||
1446 | $ cat foo |
|
1446 | $ cat foo | |
1447 | Line ranges: |
|
1447 | Line ranges: | |
1448 | $ cat bar |
|
1448 | $ cat bar | |
1449 | Line ranges: |
|
1449 | Line ranges: | |
1450 | $ cat baz |
|
1450 | $ cat baz | |
1451 | Line ranges: |
|
1451 | Line ranges: | |
1452 | 2 through 2 |
|
1452 | 2 through 2 | |
1453 |
|
1453 | |||
1454 | $ cd .. |
|
1454 | $ cd .. | |
1455 |
|
1455 | |||
1456 | Test various cases around merges. We were previously dropping files if they were |
|
1456 | Test various cases around merges. We were previously dropping files if they were | |
1457 | created on only the p2 side of the merge, so let's test permutations of: |
|
1457 | created on only the p2 side of the merge, so let's test permutations of: | |
1458 | * added, was fixed |
|
1458 | * added, was fixed | |
1459 | * added, considered for fixing but was already good |
|
1459 | * added, considered for fixing but was already good | |
1460 | * added, not considered for fixing |
|
1460 | * added, not considered for fixing | |
1461 | * modified, was fixed |
|
1461 | * modified, was fixed | |
1462 | * modified, considered for fixing but was already good |
|
1462 | * modified, considered for fixing but was already good | |
1463 | * modified, not considered for fixing |
|
1463 | * modified, not considered for fixing | |
1464 |
|
1464 | |||
1465 | Before the bug was fixed where we would drop files, this test demonstrated the |
|
1465 | Before the bug was fixed where we would drop files, this test demonstrated the | |
1466 | following issues: |
|
1466 | following issues: | |
1467 | * new_in_r1.ignored, new_in_r1_already_good.changed, and |
|
1467 | * new_in_r1.ignored, new_in_r1_already_good.changed, and | |
1468 | > mod_in_r1_already_good.changed were NOT in the manifest for the merge commit |
|
1468 | > mod_in_r1_already_good.changed were NOT in the manifest for the merge commit | |
1469 | * mod_in_r1.ignored had its contents from r0, NOT r1. |
|
1469 | * mod_in_r1.ignored had its contents from r0, NOT r1. | |
1470 |
|
1470 | |||
1471 | We're also setting a named branch for every commit to demonstrate that the |
|
1471 | We're also setting a named branch for every commit to demonstrate that the | |
1472 | branch is kept intact and there aren't issues updating to another branch in the |
|
1472 | branch is kept intact and there aren't issues updating to another branch in the | |
1473 | middle of fix. |
|
1473 | middle of fix. | |
1474 |
|
1474 | |||
1475 | $ hg init merge_keeps_files |
|
1475 | $ hg init merge_keeps_files | |
1476 | $ cd merge_keeps_files |
|
1476 | $ cd merge_keeps_files | |
1477 | $ for f in r0 mod_in_r1 mod_in_r2 mod_in_merge mod_in_child; do |
|
1477 | $ for f in r0 mod_in_r1 mod_in_r2 mod_in_merge mod_in_child; do | |
1478 | > for c in changed whole ignored; do |
|
1478 | > for c in changed whole ignored; do | |
1479 | > printf "hello\n" > $f.$c |
|
1479 | > printf "hello\n" > $f.$c | |
1480 | > done |
|
1480 | > done | |
1481 | > printf "HELLO\n" > "mod_in_${f}_already_good.changed" |
|
1481 | > printf "HELLO\n" > "mod_in_${f}_already_good.changed" | |
1482 | > done |
|
1482 | > done | |
1483 | $ hg branch -q r0 |
|
1483 | $ hg branch -q r0 | |
1484 | $ hg ci -Aqm 'r0' |
|
1484 | $ hg ci -Aqm 'r0' | |
1485 | $ hg phase -p |
|
1485 | $ hg phase -p | |
1486 | $ make_test_files() { |
|
1486 | $ make_test_files() { | |
1487 | > printf "world\n" >> "mod_in_$1.changed" |
|
1487 | > printf "world\n" >> "mod_in_$1.changed" | |
1488 | > printf "world\n" >> "mod_in_$1.whole" |
|
1488 | > printf "world\n" >> "mod_in_$1.whole" | |
1489 | > printf "world\n" >> "mod_in_$1.ignored" |
|
1489 | > printf "world\n" >> "mod_in_$1.ignored" | |
1490 | > printf "WORLD\n" >> "mod_in_$1_already_good.changed" |
|
1490 | > printf "WORLD\n" >> "mod_in_$1_already_good.changed" | |
1491 | > printf "new in $1\n" > "new_in_$1.changed" |
|
1491 | > printf "new in $1\n" > "new_in_$1.changed" | |
1492 | > printf "new in $1\n" > "new_in_$1.whole" |
|
1492 | > printf "new in $1\n" > "new_in_$1.whole" | |
1493 | > printf "new in $1\n" > "new_in_$1.ignored" |
|
1493 | > printf "new in $1\n" > "new_in_$1.ignored" | |
1494 | > printf "ALREADY GOOD, NEW IN THIS REV\n" > "new_in_$1_already_good.changed" |
|
1494 | > printf "ALREADY GOOD, NEW IN THIS REV\n" > "new_in_$1_already_good.changed" | |
1495 | > } |
|
1495 | > } | |
1496 | $ make_test_commit() { |
|
1496 | $ make_test_commit() { | |
1497 | > make_test_files "$1" |
|
1497 | > make_test_files "$1" | |
1498 | > hg branch -q "$1" |
|
1498 | > hg branch -q "$1" | |
1499 | > hg ci -Aqm "$2" |
|
1499 | > hg ci -Aqm "$2" | |
1500 | > } |
|
1500 | > } | |
1501 | $ make_test_commit r1 "merge me, pt1" |
|
1501 | $ make_test_commit r1 "merge me, pt1" | |
1502 | $ hg co -q ".^" |
|
1502 | $ hg co -q ".^" | |
1503 | $ make_test_commit r2 "merge me, pt2" |
|
1503 | $ make_test_commit r2 "merge me, pt2" | |
1504 | $ hg merge -qr 1 |
|
1504 | $ hg merge -qr 1 | |
1505 | $ make_test_commit merge "evil merge" |
|
1505 | $ make_test_commit merge "evil merge" | |
1506 | $ make_test_commit child "child of merge" |
|
1506 | $ make_test_commit child "child of merge" | |
1507 | $ make_test_files wdir |
|
1507 | $ make_test_files wdir | |
1508 | $ hg fix -r 'not public()' -w |
|
1508 | $ hg fix -r 'not public()' -w | |
1509 | $ hg log -G -T'{rev}:{shortest(node,8)}: branch:{branch} desc:{desc}' |
|
1509 | $ hg log -G -T'{rev}:{shortest(node,8)}: branch:{branch} desc:{desc}' | |
1510 | @ 8:c22ce900: branch:child desc:child of merge |
|
1510 | @ 8:c22ce900: branch:child desc:child of merge | |
1511 | | |
|
1511 | | | |
1512 | o 7:5a30615a: branch:merge desc:evil merge |
|
1512 | o 7:5a30615a: branch:merge desc:evil merge | |
1513 | |\ |
|
1513 | |\ | |
1514 | | o 6:4e5acdc4: branch:r2 desc:merge me, pt2 |
|
1514 | | o 6:4e5acdc4: branch:r2 desc:merge me, pt2 | |
1515 | | | |
|
1515 | | | | |
1516 | o | 5:eea01878: branch:r1 desc:merge me, pt1 |
|
1516 | o | 5:eea01878: branch:r1 desc:merge me, pt1 | |
1517 | |/ |
|
1517 | |/ | |
1518 | o 0:0c548d87: branch:r0 desc:r0 |
|
1518 | o 0:0c548d87: branch:r0 desc:r0 | |
1519 |
|
1519 | |||
1520 | $ hg files -r tip |
|
1520 | $ hg files -r tip | |
1521 | mod_in_child.changed |
|
1521 | mod_in_child.changed | |
1522 | mod_in_child.ignored |
|
1522 | mod_in_child.ignored | |
1523 | mod_in_child.whole |
|
1523 | mod_in_child.whole | |
1524 | mod_in_child_already_good.changed |
|
1524 | mod_in_child_already_good.changed | |
1525 | mod_in_merge.changed |
|
1525 | mod_in_merge.changed | |
1526 | mod_in_merge.ignored |
|
1526 | mod_in_merge.ignored | |
1527 | mod_in_merge.whole |
|
1527 | mod_in_merge.whole | |
1528 | mod_in_merge_already_good.changed |
|
1528 | mod_in_merge_already_good.changed | |
1529 | mod_in_mod_in_child_already_good.changed |
|
1529 | mod_in_mod_in_child_already_good.changed | |
1530 | mod_in_mod_in_merge_already_good.changed |
|
1530 | mod_in_mod_in_merge_already_good.changed | |
1531 | mod_in_mod_in_r1_already_good.changed |
|
1531 | mod_in_mod_in_r1_already_good.changed | |
1532 | mod_in_mod_in_r2_already_good.changed |
|
1532 | mod_in_mod_in_r2_already_good.changed | |
1533 | mod_in_r0_already_good.changed |
|
1533 | mod_in_r0_already_good.changed | |
1534 | mod_in_r1.changed |
|
1534 | mod_in_r1.changed | |
1535 | mod_in_r1.ignored |
|
1535 | mod_in_r1.ignored | |
1536 | mod_in_r1.whole |
|
1536 | mod_in_r1.whole | |
1537 | mod_in_r1_already_good.changed |
|
1537 | mod_in_r1_already_good.changed | |
1538 | mod_in_r2.changed |
|
1538 | mod_in_r2.changed | |
1539 | mod_in_r2.ignored |
|
1539 | mod_in_r2.ignored | |
1540 | mod_in_r2.whole |
|
1540 | mod_in_r2.whole | |
1541 | mod_in_r2_already_good.changed |
|
1541 | mod_in_r2_already_good.changed | |
1542 | new_in_child.changed |
|
1542 | new_in_child.changed | |
1543 | new_in_child.ignored |
|
1543 | new_in_child.ignored | |
1544 | new_in_child.whole |
|
1544 | new_in_child.whole | |
1545 | new_in_child_already_good.changed |
|
1545 | new_in_child_already_good.changed | |
1546 | new_in_merge.changed |
|
1546 | new_in_merge.changed | |
1547 | new_in_merge.ignored |
|
1547 | new_in_merge.ignored | |
1548 | new_in_merge.whole |
|
1548 | new_in_merge.whole | |
1549 | new_in_merge_already_good.changed |
|
1549 | new_in_merge_already_good.changed | |
1550 | new_in_r1.changed |
|
1550 | new_in_r1.changed | |
1551 | new_in_r1.ignored |
|
1551 | new_in_r1.ignored | |
1552 | new_in_r1.whole |
|
1552 | new_in_r1.whole | |
1553 | new_in_r1_already_good.changed |
|
1553 | new_in_r1_already_good.changed | |
1554 | new_in_r2.changed |
|
1554 | new_in_r2.changed | |
1555 | new_in_r2.ignored |
|
1555 | new_in_r2.ignored | |
1556 | new_in_r2.whole |
|
1556 | new_in_r2.whole | |
1557 | new_in_r2_already_good.changed |
|
1557 | new_in_r2_already_good.changed | |
1558 | r0.changed |
|
1558 | r0.changed | |
1559 | r0.ignored |
|
1559 | r0.ignored | |
1560 | r0.whole |
|
1560 | r0.whole | |
1561 | $ for f in "$(hg files -r tip)"; do hg cat -r tip $f -T'{path}:\n{data}\n'; done |
|
1561 | $ for f in "$(hg files -r tip)"; do hg cat -r tip $f -T'{path}:\n{data}\n'; done | |
1562 | mod_in_child.changed: |
|
1562 | mod_in_child.changed: | |
1563 | hello |
|
1563 | hello | |
1564 | WORLD |
|
1564 | WORLD | |
1565 |
|
1565 | |||
1566 | mod_in_child.ignored: |
|
1566 | mod_in_child.ignored: | |
1567 | hello |
|
1567 | hello | |
1568 | world |
|
1568 | world | |
1569 |
|
1569 | |||
1570 | mod_in_child.whole: |
|
1570 | mod_in_child.whole: | |
1571 | HELLO |
|
1571 | HELLO | |
1572 | WORLD |
|
1572 | WORLD | |
1573 |
|
1573 | |||
1574 | mod_in_child_already_good.changed: |
|
1574 | mod_in_child_already_good.changed: | |
1575 | WORLD |
|
1575 | WORLD | |
1576 |
|
1576 | |||
1577 | mod_in_merge.changed: |
|
1577 | mod_in_merge.changed: | |
1578 | hello |
|
1578 | hello | |
1579 | WORLD |
|
1579 | WORLD | |
1580 |
|
1580 | |||
1581 | mod_in_merge.ignored: |
|
1581 | mod_in_merge.ignored: | |
1582 | hello |
|
1582 | hello | |
1583 | world |
|
1583 | world | |
1584 |
|
1584 | |||
1585 | mod_in_merge.whole: |
|
1585 | mod_in_merge.whole: | |
1586 | HELLO |
|
1586 | HELLO | |
1587 | WORLD |
|
1587 | WORLD | |
1588 |
|
1588 | |||
1589 | mod_in_merge_already_good.changed: |
|
1589 | mod_in_merge_already_good.changed: | |
1590 | WORLD |
|
1590 | WORLD | |
1591 |
|
1591 | |||
1592 | mod_in_mod_in_child_already_good.changed: |
|
1592 | mod_in_mod_in_child_already_good.changed: | |
1593 | HELLO |
|
1593 | HELLO | |
1594 |
|
1594 | |||
1595 | mod_in_mod_in_merge_already_good.changed: |
|
1595 | mod_in_mod_in_merge_already_good.changed: | |
1596 | HELLO |
|
1596 | HELLO | |
1597 |
|
1597 | |||
1598 | mod_in_mod_in_r1_already_good.changed: |
|
1598 | mod_in_mod_in_r1_already_good.changed: | |
1599 | HELLO |
|
1599 | HELLO | |
1600 |
|
1600 | |||
1601 | mod_in_mod_in_r2_already_good.changed: |
|
1601 | mod_in_mod_in_r2_already_good.changed: | |
1602 | HELLO |
|
1602 | HELLO | |
1603 |
|
1603 | |||
1604 | mod_in_r0_already_good.changed: |
|
1604 | mod_in_r0_already_good.changed: | |
1605 | HELLO |
|
1605 | HELLO | |
1606 |
|
1606 | |||
1607 | mod_in_r1.changed: |
|
1607 | mod_in_r1.changed: | |
1608 | hello |
|
1608 | hello | |
1609 | WORLD |
|
1609 | WORLD | |
1610 |
|
1610 | |||
1611 | mod_in_r1.ignored: |
|
1611 | mod_in_r1.ignored: | |
1612 | hello |
|
1612 | hello | |
1613 | world |
|
1613 | world | |
1614 |
|
1614 | |||
1615 | mod_in_r1.whole: |
|
1615 | mod_in_r1.whole: | |
1616 | HELLO |
|
1616 | HELLO | |
1617 | WORLD |
|
1617 | WORLD | |
1618 |
|
1618 | |||
1619 | mod_in_r1_already_good.changed: |
|
1619 | mod_in_r1_already_good.changed: | |
1620 | WORLD |
|
1620 | WORLD | |
1621 |
|
1621 | |||
1622 | mod_in_r2.changed: |
|
1622 | mod_in_r2.changed: | |
1623 | hello |
|
1623 | hello | |
1624 | WORLD |
|
1624 | WORLD | |
1625 |
|
1625 | |||
1626 | mod_in_r2.ignored: |
|
1626 | mod_in_r2.ignored: | |
1627 | hello |
|
1627 | hello | |
1628 | world |
|
1628 | world | |
1629 |
|
1629 | |||
1630 | mod_in_r2.whole: |
|
1630 | mod_in_r2.whole: | |
1631 | HELLO |
|
1631 | HELLO | |
1632 | WORLD |
|
1632 | WORLD | |
1633 |
|
1633 | |||
1634 | mod_in_r2_already_good.changed: |
|
1634 | mod_in_r2_already_good.changed: | |
1635 | WORLD |
|
1635 | WORLD | |
1636 |
|
1636 | |||
1637 | new_in_child.changed: |
|
1637 | new_in_child.changed: | |
1638 | NEW IN CHILD |
|
1638 | NEW IN CHILD | |
1639 |
|
1639 | |||
1640 | new_in_child.ignored: |
|
1640 | new_in_child.ignored: | |
1641 | new in child |
|
1641 | new in child | |
1642 |
|
1642 | |||
1643 | new_in_child.whole: |
|
1643 | new_in_child.whole: | |
1644 | NEW IN CHILD |
|
1644 | NEW IN CHILD | |
1645 |
|
1645 | |||
1646 | new_in_child_already_good.changed: |
|
1646 | new_in_child_already_good.changed: | |
1647 | ALREADY GOOD, NEW IN THIS REV |
|
1647 | ALREADY GOOD, NEW IN THIS REV | |
1648 |
|
1648 | |||
1649 | new_in_merge.changed: |
|
1649 | new_in_merge.changed: | |
1650 | NEW IN MERGE |
|
1650 | NEW IN MERGE | |
1651 |
|
1651 | |||
1652 | new_in_merge.ignored: |
|
1652 | new_in_merge.ignored: | |
1653 | new in merge |
|
1653 | new in merge | |
1654 |
|
1654 | |||
1655 | new_in_merge.whole: |
|
1655 | new_in_merge.whole: | |
1656 | NEW IN MERGE |
|
1656 | NEW IN MERGE | |
1657 |
|
1657 | |||
1658 | new_in_merge_already_good.changed: |
|
1658 | new_in_merge_already_good.changed: | |
1659 | ALREADY GOOD, NEW IN THIS REV |
|
1659 | ALREADY GOOD, NEW IN THIS REV | |
1660 |
|
1660 | |||
1661 | new_in_r1.changed: |
|
1661 | new_in_r1.changed: | |
1662 | NEW IN R1 |
|
1662 | NEW IN R1 | |
1663 |
|
1663 | |||
1664 | new_in_r1.ignored: |
|
1664 | new_in_r1.ignored: | |
1665 | new in r1 |
|
1665 | new in r1 | |
1666 |
|
1666 | |||
1667 | new_in_r1.whole: |
|
1667 | new_in_r1.whole: | |
1668 | NEW IN R1 |
|
1668 | NEW IN R1 | |
1669 |
|
1669 | |||
1670 | new_in_r1_already_good.changed: |
|
1670 | new_in_r1_already_good.changed: | |
1671 | ALREADY GOOD, NEW IN THIS REV |
|
1671 | ALREADY GOOD, NEW IN THIS REV | |
1672 |
|
1672 | |||
1673 | new_in_r2.changed: |
|
1673 | new_in_r2.changed: | |
1674 | NEW IN R2 |
|
1674 | NEW IN R2 | |
1675 |
|
1675 | |||
1676 | new_in_r2.ignored: |
|
1676 | new_in_r2.ignored: | |
1677 | new in r2 |
|
1677 | new in r2 | |
1678 |
|
1678 | |||
1679 | new_in_r2.whole: |
|
1679 | new_in_r2.whole: | |
1680 | NEW IN R2 |
|
1680 | NEW IN R2 | |
1681 |
|
1681 | |||
1682 | new_in_r2_already_good.changed: |
|
1682 | new_in_r2_already_good.changed: | |
1683 | ALREADY GOOD, NEW IN THIS REV |
|
1683 | ALREADY GOOD, NEW IN THIS REV | |
1684 |
|
1684 | |||
1685 | r0.changed: |
|
1685 | r0.changed: | |
1686 | hello |
|
1686 | hello | |
1687 |
|
1687 | |||
1688 | r0.ignored: |
|
1688 | r0.ignored: | |
1689 | hello |
|
1689 | hello | |
1690 |
|
1690 | |||
1691 | r0.whole: |
|
1691 | r0.whole: | |
1692 | hello |
|
1692 | hello | |
1693 |
|
1693 |
@@ -1,591 +1,591 b'' | |||||
1 | #testcases abortcommand abortflag |
|
1 | #testcases abortcommand abortflag | |
2 |
|
2 | |||
3 | #if abortflag |
|
3 | #if abortflag | |
4 | $ cat >> $HGRCPATH <<EOF |
|
4 | $ cat >> $HGRCPATH <<EOF | |
5 | > [alias] |
|
5 | > [alias] | |
6 | > abort = histedit --abort |
|
6 | > abort = histedit --abort | |
7 | > EOF |
|
7 | > EOF | |
8 | #endif |
|
8 | #endif | |
9 |
|
9 | |||
10 | $ . "$TESTDIR/histedit-helpers.sh" |
|
10 | $ . "$TESTDIR/histedit-helpers.sh" | |
11 |
|
11 | |||
12 | Enable obsolete |
|
12 | Enable obsolete | |
13 |
|
13 | |||
14 | $ cat >> $HGRCPATH << EOF |
|
14 | $ cat >> $HGRCPATH << EOF | |
15 | > [ui] |
|
15 | > [ui] | |
16 | > logtemplate= {rev}:{node|short} {desc|firstline} |
|
16 | > logtemplate= {rev}:{node|short} {desc|firstline} | |
17 | > [phases] |
|
17 | > [phases] | |
18 | > publish=False |
|
18 | > publish=False | |
19 | > [experimental] |
|
19 | > [experimental] | |
20 | > evolution.createmarkers=True |
|
20 | > evolution.createmarkers=True | |
21 | > evolution.allowunstable=True |
|
21 | > evolution.allowunstable=True | |
22 | > [extensions] |
|
22 | > [extensions] | |
23 | > histedit= |
|
23 | > histedit= | |
24 | > rebase= |
|
24 | > rebase= | |
25 | > EOF |
|
25 | > EOF | |
26 |
|
26 | |||
27 | Test that histedit learns about obsolescence not stored in histedit state |
|
27 | Test that histedit learns about obsolescence not stored in histedit state | |
28 | $ hg init boo |
|
28 | $ hg init boo | |
29 | $ cd boo |
|
29 | $ cd boo | |
30 | $ echo a > a |
|
30 | $ echo a > a | |
31 | $ hg ci -Am a |
|
31 | $ hg ci -Am a | |
32 | adding a |
|
32 | adding a | |
33 | $ echo a > b |
|
33 | $ echo a > b | |
34 | $ echo a > c |
|
34 | $ echo a > c | |
35 | $ echo a > c |
|
35 | $ echo a > c | |
36 | $ hg ci -Am b |
|
36 | $ hg ci -Am b | |
37 | adding b |
|
37 | adding b | |
38 | adding c |
|
38 | adding c | |
39 | $ echo a > d |
|
39 | $ echo a > d | |
40 | $ hg ci -Am c |
|
40 | $ hg ci -Am c | |
41 | adding d |
|
41 | adding d | |
42 | $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan |
|
42 | $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan | |
43 | $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan |
|
43 | $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan | |
44 | $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan |
|
44 | $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan | |
45 | $ hg histedit -r 'all()' --commands plan |
|
45 | $ hg histedit -r 'all()' --commands plan | |
46 | Editing (1b2d564fad96), you may commit or record as needed now. |
|
46 | Editing (1b2d564fad96), you may commit or record as needed now. | |
47 | (hg histedit --continue to resume) |
|
47 | (hg histedit --continue to resume) | |
48 | [240] |
|
48 | [240] | |
49 | $ hg st |
|
49 | $ hg st | |
50 | A b |
|
50 | A b | |
51 | A c |
|
51 | A c | |
52 | ? plan |
|
52 | ? plan | |
53 | $ hg commit --amend b |
|
53 | $ hg commit --amend b | |
54 | $ hg histedit --continue |
|
54 | $ hg histedit --continue | |
55 | $ hg log -G |
|
55 | $ hg log -G | |
56 | @ 5:46abc7c4d873 b |
|
56 | @ 5:46abc7c4d873 b | |
57 | | |
|
57 | | | |
58 | o 4:49d44ab2be1b c |
|
58 | o 4:49d44ab2be1b c | |
59 | | |
|
59 | | | |
60 | o 0:cb9a9f314b8b a |
|
60 | o 0:cb9a9f314b8b a | |
61 |
|
61 | |||
62 | $ hg debugobsolete |
|
62 | $ hg debugobsolete | |
63 | e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'} |
|
63 | e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'} | |
64 | 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'} |
|
64 | 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'} | |
65 | 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'} |
|
65 | 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'} | |
66 |
|
66 | |||
67 | With some node gone missing during the edit. |
|
67 | With some node gone missing during the edit. | |
68 |
|
68 | |||
69 | $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan |
|
69 | $ echo "pick `hg log -r 0 -T '{node|short}'`" > plan | |
70 | $ echo "pick `hg log -r 5 -T '{node|short}'`" >> plan |
|
70 | $ echo "pick `hg log -r 5 -T '{node|short}'`" >> plan | |
71 | $ echo "edit `hg log -r 4 -T '{node|short}'`" >> plan |
|
71 | $ echo "edit `hg log -r 4 -T '{node|short}'`" >> plan | |
72 | $ hg histedit -r 'all()' --commands plan |
|
72 | $ hg histedit -r 'all()' --commands plan | |
73 | Editing (49d44ab2be1b), you may commit or record as needed now. |
|
73 | Editing (49d44ab2be1b), you may commit or record as needed now. | |
74 | (hg histedit --continue to resume) |
|
74 | (hg histedit --continue to resume) | |
75 | [240] |
|
75 | [240] | |
76 | $ hg st |
|
76 | $ hg st | |
77 | A b |
|
77 | A b | |
78 | A d |
|
78 | A d | |
79 | ? plan |
|
79 | ? plan | |
80 | $ hg commit --amend -X . -m XXXXXX |
|
80 | $ hg commit --amend -X . -m XXXXXX | |
81 | $ hg commit --amend -X . -m b2 |
|
81 | $ hg commit --amend -X . -m b2 | |
82 | $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup |
|
82 | $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup | |
83 | $ hg histedit --continue |
|
83 | $ hg histedit --continue | |
84 | $ hg log -G |
|
84 | $ hg log -G | |
85 | @ 8:273c1f3b8626 c |
|
85 | @ 8:273c1f3b8626 c | |
86 | | |
|
86 | | | |
87 | o 7:aba7da937030 b2 |
|
87 | o 7:aba7da937030 b2 | |
88 | | |
|
88 | | | |
89 | o 0:cb9a9f314b8b a |
|
89 | o 0:cb9a9f314b8b a | |
90 |
|
90 | |||
91 | $ hg debugobsolete |
|
91 | $ hg debugobsolete | |
92 | e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'} |
|
92 | e72d22b19f8ecf4150ab4f91d0973fd9955d3ddf 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'} | |
93 | 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'} |
|
93 | 1b2d564fad96311b45362f17c2aa855150efb35f 46abc7c4d8738e8563e577f7889e1b6db3da4199 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'} | |
94 | 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'} |
|
94 | 114f4176969ef342759a8a57e6bccefc4234829b 49d44ab2be1b67a79127568a67c9c99430633b48 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '12', 'operation': 'histedit', 'user': 'test'} | |
95 | 76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'} |
|
95 | 76f72745eac0643d16530e56e2f86e36e40631f1 2ca853e48edbd6453a0674dc0fe28a0974c51b9c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'} | |
96 | 2ca853e48edbd6453a0674dc0fe28a0974c51b9c aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'} |
|
96 | 2ca853e48edbd6453a0674dc0fe28a0974c51b9c aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '1', 'operation': 'amend', 'user': 'test'} | |
97 | 49d44ab2be1b67a79127568a67c9c99430633b48 273c1f3b86267ed3ec684bb13af1fa4d6ba56e02 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'} |
|
97 | 49d44ab2be1b67a79127568a67c9c99430633b48 273c1f3b86267ed3ec684bb13af1fa4d6ba56e02 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'} | |
98 | 46abc7c4d8738e8563e577f7889e1b6db3da4199 aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '5', 'operation': 'histedit', 'user': 'test'} |
|
98 | 46abc7c4d8738e8563e577f7889e1b6db3da4199 aba7da93703075eec9fb1dbaf143ff2bc1c49d46 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '5', 'operation': 'histedit', 'user': 'test'} | |
99 | $ cd .. |
|
99 | $ cd .. | |
100 |
|
100 | |||
101 | Base setup for the rest of the testing |
|
101 | Base setup for the rest of the testing | |
102 | ====================================== |
|
102 | ====================================== | |
103 |
|
103 | |||
104 | $ hg init base |
|
104 | $ hg init base | |
105 | $ cd base |
|
105 | $ cd base | |
106 |
|
106 | |||
107 | $ for x in a b c d e f ; do |
|
107 | $ for x in a b c d e f ; do | |
108 | > echo $x > $x |
|
108 | > echo $x > $x | |
109 | > hg add $x |
|
109 | > hg add $x | |
110 | > hg ci -m $x |
|
110 | > hg ci -m $x | |
111 | > done |
|
111 | > done | |
112 |
|
112 | |||
113 | $ hg log --graph |
|
113 | $ hg log --graph | |
114 | @ 5:652413bf663e f |
|
114 | @ 5:652413bf663e f | |
115 | | |
|
115 | | | |
116 | o 4:e860deea161a e |
|
116 | o 4:e860deea161a e | |
117 | | |
|
117 | | | |
118 | o 3:055a42cdd887 d |
|
118 | o 3:055a42cdd887 d | |
119 | | |
|
119 | | | |
120 | o 2:177f92b77385 c |
|
120 | o 2:177f92b77385 c | |
121 | | |
|
121 | | | |
122 | o 1:d2ae7f538514 b |
|
122 | o 1:d2ae7f538514 b | |
123 | | |
|
123 | | | |
124 | o 0:cb9a9f314b8b a |
|
124 | o 0:cb9a9f314b8b a | |
125 |
|
125 | |||
126 |
|
126 | |||
127 | $ HGEDITOR=cat hg histedit 1 |
|
127 | $ HGEDITOR=cat hg histedit 1 | |
128 | pick d2ae7f538514 1 b |
|
128 | pick d2ae7f538514 1 b | |
129 | pick 177f92b77385 2 c |
|
129 | pick 177f92b77385 2 c | |
130 | pick 055a42cdd887 3 d |
|
130 | pick 055a42cdd887 3 d | |
131 | pick e860deea161a 4 e |
|
131 | pick e860deea161a 4 e | |
132 | pick 652413bf663e 5 f |
|
132 | pick 652413bf663e 5 f | |
133 |
|
133 | |||
134 | # Edit history between d2ae7f538514 and 652413bf663e |
|
134 | # Edit history between d2ae7f538514 and 652413bf663e | |
135 | # |
|
135 | # | |
136 | # Commits are listed from least to most recent |
|
136 | # Commits are listed from least to most recent | |
137 | # |
|
137 | # | |
138 | # You can reorder changesets by reordering the lines |
|
138 | # You can reorder changesets by reordering the lines | |
139 | # |
|
139 | # | |
140 | # Commands: |
|
140 | # Commands: | |
141 | # |
|
141 | # | |
142 | # e, edit = use commit, but stop for amending |
|
142 | # e, edit = use commit, but stop for amending | |
143 | # m, mess = edit commit message without changing commit content |
|
143 | # m, mess = edit commit message without changing commit content | |
144 | # p, pick = use commit |
|
144 | # p, pick = use commit | |
145 | # b, base = checkout changeset and apply further changesets from there |
|
145 | # b, base = checkout changeset and apply further changesets from there | |
146 | # d, drop = remove commit from history |
|
146 | # d, drop = remove commit from history | |
147 | # f, fold = use commit, but combine it with the one above |
|
147 | # f, fold = use commit, but combine it with the one above | |
148 | # r, roll = like fold, but discard this commit's description and date |
|
148 | # r, roll = like fold, but discard this commit's description and date | |
149 | # |
|
149 | # | |
150 | $ hg histedit 1 --commands - --verbose <<EOF | grep histedit |
|
150 | $ hg histedit 1 --commands - --verbose <<EOF | grep histedit | |
151 | > pick 177f92b77385 2 c |
|
151 | > pick 177f92b77385 2 c | |
152 | > drop d2ae7f538514 1 b |
|
152 | > drop d2ae7f538514 1 b | |
153 | > pick 055a42cdd887 3 d |
|
153 | > pick 055a42cdd887 3 d | |
154 | > fold e860deea161a 4 e |
|
154 | > fold e860deea161a 4 e | |
155 | > pick 652413bf663e 5 f |
|
155 | > pick 652413bf663e 5 f | |
156 | > EOF |
|
156 | > EOF | |
157 | [1] |
|
157 | [1] | |
158 | $ hg log --graph --hidden |
|
158 | $ hg log --graph --hidden | |
159 | @ 10:cacdfd884a93 f |
|
159 | @ 10:cacdfd884a93 f | |
160 | | |
|
160 | | | |
161 | o 9:59d9f330561f d |
|
161 | o 9:59d9f330561f d | |
162 | | |
|
162 | | | |
163 | | x 8:b558abc46d09 fold-temp-revision e860deea161a |
|
163 | | x 8:b558abc46d09 fold-temp-revision e860deea161a | |
164 | | | |
|
164 | | | | |
165 | | x 7:96e494a2d553 d |
|
165 | | x 7:96e494a2d553 d | |
166 | |/ |
|
166 | |/ | |
167 | o 6:b346ab9a313d c |
|
167 | o 6:b346ab9a313d c | |
168 | | |
|
168 | | | |
169 | | x 5:652413bf663e f |
|
169 | | x 5:652413bf663e f | |
170 | | | |
|
170 | | | | |
171 | | x 4:e860deea161a e |
|
171 | | x 4:e860deea161a e | |
172 | | | |
|
172 | | | | |
173 | | x 3:055a42cdd887 d |
|
173 | | x 3:055a42cdd887 d | |
174 | | | |
|
174 | | | | |
175 | | x 2:177f92b77385 c |
|
175 | | x 2:177f92b77385 c | |
176 | | | |
|
176 | | | | |
177 | | x 1:d2ae7f538514 b |
|
177 | | x 1:d2ae7f538514 b | |
178 | |/ |
|
178 | |/ | |
179 | o 0:cb9a9f314b8b a |
|
179 | o 0:cb9a9f314b8b a | |
180 |
|
180 | |||
181 | $ hg debugobsolete |
|
181 | $ hg debugobsolete | |
182 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'} |
|
182 | d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 {cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'} | |
183 | 177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'} |
|
183 | 177f92b773850b59254aa5e923436f921b55483b b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'} | |
184 | 055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'histedit', 'user': 'test'} |
|
184 | 055a42cdd88768532f9cf79daa407fc8d138de9b 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'histedit', 'user': 'test'} | |
185 | e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'histedit', 'user': 'test'} |
|
185 | e860deea161a2f77de56603b340ebbb4536308ae 59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'histedit', 'user': 'test'} | |
186 | 652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'} |
|
186 | 652413bf663ef2a641cab26574e46d5f5a64a55a cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'} | |
187 | 96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'} |
|
187 | 96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 {b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'} | |
188 | b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'} |
|
188 | b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 {96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'histedit', 'user': 'test'} | |
189 |
|
189 | |||
190 |
|
190 | |||
191 | Ensure hidden revision does not prevent histedit |
|
191 | Ensure hidden revision does not prevent histedit | |
192 | ------------------------------------------------- |
|
192 | ------------------------------------------------- | |
193 |
|
193 | |||
194 | create an hidden revision |
|
194 | create an hidden revision | |
195 |
|
195 | |||
196 | $ hg histedit 6 --commands - << EOF |
|
196 | $ hg histedit 6 --commands - << EOF | |
197 | > pick b346ab9a313d 6 c |
|
197 | > pick b346ab9a313d 6 c | |
198 | > drop 59d9f330561f 7 d |
|
198 | > drop 59d9f330561f 7 d | |
199 | > pick cacdfd884a93 8 f |
|
199 | > pick cacdfd884a93 8 f | |
200 | > EOF |
|
200 | > EOF | |
201 | $ hg log --graph |
|
201 | $ hg log --graph | |
202 | @ 11:c13eb81022ca f |
|
202 | @ 11:c13eb81022ca f | |
203 | | |
|
203 | | | |
204 | o 6:b346ab9a313d c |
|
204 | o 6:b346ab9a313d c | |
205 | | |
|
205 | | | |
206 | o 0:cb9a9f314b8b a |
|
206 | o 0:cb9a9f314b8b a | |
207 |
|
207 | |||
208 | check hidden revision are ignored (6 have hidden children 7 and 8) |
|
208 | check hidden revision are ignored (6 have hidden children 7 and 8) | |
209 |
|
209 | |||
210 | $ hg histedit 6 --commands - << EOF |
|
210 | $ hg histedit 6 --commands - << EOF | |
211 | > pick b346ab9a313d 6 c |
|
211 | > pick b346ab9a313d 6 c | |
212 | > pick c13eb81022ca 8 f |
|
212 | > pick c13eb81022ca 8 f | |
213 | > EOF |
|
213 | > EOF | |
214 |
|
214 | |||
215 |
|
215 | |||
216 |
|
216 | |||
217 | Test that rewriting leaving instability behind is allowed |
|
217 | Test that rewriting leaving instability behind is allowed | |
218 | --------------------------------------------------------------------- |
|
218 | --------------------------------------------------------------------- | |
219 |
|
219 | |||
220 | $ hg up '.^' |
|
220 | $ hg up '.^' | |
221 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
221 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
222 | $ hg log -r 'children(.)' |
|
222 | $ hg log -r 'children(.)' | |
223 | 11:c13eb81022ca f (no-eol) |
|
223 | 11:c13eb81022ca f (no-eol) | |
224 | $ hg histedit -r '.' --commands - <<EOF |
|
224 | $ hg histedit -r '.' --commands - <<EOF | |
225 | > edit b346ab9a313d 6 c |
|
225 | > edit b346ab9a313d 6 c | |
226 | > EOF |
|
226 | > EOF | |
227 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
227 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
228 | Editing (b346ab9a313d), you may commit or record as needed now. |
|
228 | Editing (b346ab9a313d), you may commit or record as needed now. | |
229 | (hg histedit --continue to resume) |
|
229 | (hg histedit --continue to resume) | |
230 | [240] |
|
230 | [240] | |
231 | $ echo c >> c |
|
231 | $ echo c >> c | |
232 | $ hg histedit --continue |
|
232 | $ hg histedit --continue | |
233 | 1 new orphan changesets |
|
233 | 1 new orphan changesets | |
234 |
|
234 | |||
235 | $ hg log -r 'orphan()' |
|
235 | $ hg log -r 'orphan()' | |
236 | 11:c13eb81022ca f (no-eol) |
|
236 | 11:c13eb81022ca f (no-eol) | |
237 |
|
237 | |||
238 | stabilise |
|
238 | stabilise | |
239 |
|
239 | |||
240 | $ hg rebase -r 'orphan()' -d . |
|
240 | $ hg rebase -r 'orphan()' -d . | |
241 | rebasing 11:c13eb81022ca "f" |
|
241 | rebasing 11:c13eb81022ca "f" | |
242 | $ hg up tip -q |
|
242 | $ hg up tip -q | |
243 |
|
243 | |||
244 | Test dropping of changeset on the top of the stack |
|
244 | Test dropping of changeset on the top of the stack | |
245 | ------------------------------------------------------- |
|
245 | ------------------------------------------------------- | |
246 |
|
246 | |||
247 | Nothing is rewritten below, the working directory parent must be change for the |
|
247 | Nothing is rewritten below, the working directory parent must be change for the | |
248 | dropped changeset to be hidden. |
|
248 | dropped changeset to be hidden. | |
249 |
|
249 | |||
250 | $ cd .. |
|
250 | $ cd .. | |
251 | $ hg clone base droplast |
|
251 | $ hg clone base droplast | |
252 | updating to branch default |
|
252 | updating to branch default | |
253 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
253 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
254 | $ cd droplast |
|
254 | $ cd droplast | |
255 | $ hg histedit -r '40db8afa467b' --commands - << EOF |
|
255 | $ hg histedit -r '40db8afa467b' --commands - << EOF | |
256 | > pick 40db8afa467b 10 c |
|
256 | > pick 40db8afa467b 10 c | |
257 | > drop b449568bf7fc 11 f |
|
257 | > drop b449568bf7fc 11 f | |
258 | > EOF |
|
258 | > EOF | |
259 | $ hg log -G |
|
259 | $ hg log -G | |
260 | @ 12:40db8afa467b c |
|
260 | @ 12:40db8afa467b c | |
261 | | |
|
261 | | | |
262 | o 0:cb9a9f314b8b a |
|
262 | o 0:cb9a9f314b8b a | |
263 |
|
263 | |||
264 |
|
264 | |||
265 | With rewritten ancestors |
|
265 | With rewritten ancestors | |
266 |
|
266 | |||
267 | $ echo e > e |
|
267 | $ echo e > e | |
268 | $ hg add e |
|
268 | $ hg add e | |
269 | $ hg commit -m g |
|
269 | $ hg commit -m g | |
270 | $ echo f > f |
|
270 | $ echo f > f | |
271 | $ hg add f |
|
271 | $ hg add f | |
272 | $ hg commit -m h |
|
272 | $ hg commit -m h | |
273 | $ hg histedit -r '40db8afa467b' --commands - << EOF |
|
273 | $ hg histedit -r '40db8afa467b' --commands - << EOF | |
274 | > pick 47a8561c0449 12 g |
|
274 | > pick 47a8561c0449 12 g | |
275 | > pick 40db8afa467b 10 c |
|
275 | > pick 40db8afa467b 10 c | |
276 | > drop 1b3b05f35ff0 13 h |
|
276 | > drop 1b3b05f35ff0 13 h | |
277 | > EOF |
|
277 | > EOF | |
278 | $ hg log -G |
|
278 | $ hg log -G | |
279 | @ 17:ee6544123ab8 c |
|
279 | @ 17:ee6544123ab8 c | |
280 | | |
|
280 | | | |
281 | o 16:269e713e9eae g |
|
281 | o 16:269e713e9eae g | |
282 | | |
|
282 | | | |
283 | o 0:cb9a9f314b8b a |
|
283 | o 0:cb9a9f314b8b a | |
284 |
|
284 | |||
285 | $ cd ../base |
|
285 | $ cd ../base | |
286 |
|
286 | |||
287 |
|
287 | |||
288 |
|
288 | |||
289 | Test phases support |
|
289 | Test phases support | |
290 | =========================================== |
|
290 | =========================================== | |
291 |
|
291 | |||
292 | Check that histedit respect immutability |
|
292 | Check that histedit respect immutability | |
293 | ------------------------------------------- |
|
293 | ------------------------------------------- | |
294 |
|
294 | |||
295 | $ cat >> $HGRCPATH << EOF |
|
295 | $ cat >> $HGRCPATH << EOF | |
296 | > [command-templates] |
|
296 | > [command-templates] | |
297 | > log = {rev}:{node|short} ({phase}) {desc|firstline}\n |
|
297 | > log = {rev}:{node|short} ({phase}) {desc|firstline}\n | |
298 | > EOF |
|
298 | > EOF | |
299 |
|
299 | |||
300 | $ hg ph -pv '.^' |
|
300 | $ hg ph -pv '.^' | |
301 | phase changed for 2 changesets |
|
301 | phase changed for 2 changesets | |
302 | $ hg log -G |
|
302 | $ hg log -G | |
303 | @ 13:b449568bf7fc (draft) f |
|
303 | @ 13:b449568bf7fc (draft) f | |
304 | | |
|
304 | | | |
305 | o 12:40db8afa467b (public) c |
|
305 | o 12:40db8afa467b (public) c | |
306 | | |
|
306 | | | |
307 | o 0:cb9a9f314b8b (public) a |
|
307 | o 0:cb9a9f314b8b (public) a | |
308 |
|
308 | |||
309 | $ hg histedit -r '.~2' |
|
309 | $ hg histedit -r '.~2' | |
310 | abort: cannot edit public changesets |
|
310 | abort: cannot edit public changesets | |
311 | (see 'hg help phases' for details) |
|
311 | (see 'hg help phases' for details) | |
312 |
[ |
|
312 | [10] | |
313 |
|
313 | |||
314 |
|
314 | |||
315 | Prepare further testing |
|
315 | Prepare further testing | |
316 | ------------------------------------------- |
|
316 | ------------------------------------------- | |
317 |
|
317 | |||
318 | $ for x in g h i j k ; do |
|
318 | $ for x in g h i j k ; do | |
319 | > echo $x > $x |
|
319 | > echo $x > $x | |
320 | > hg add $x |
|
320 | > hg add $x | |
321 | > hg ci -m $x |
|
321 | > hg ci -m $x | |
322 | > done |
|
322 | > done | |
323 | $ hg phase --force --secret .~2 |
|
323 | $ hg phase --force --secret .~2 | |
324 | $ hg log -G |
|
324 | $ hg log -G | |
325 | @ 18:ee118ab9fa44 (secret) k |
|
325 | @ 18:ee118ab9fa44 (secret) k | |
326 | | |
|
326 | | | |
327 | o 17:3a6c53ee7f3d (secret) j |
|
327 | o 17:3a6c53ee7f3d (secret) j | |
328 | | |
|
328 | | | |
329 | o 16:b605fb7503f2 (secret) i |
|
329 | o 16:b605fb7503f2 (secret) i | |
330 | | |
|
330 | | | |
331 | o 15:7395e1ff83bd (draft) h |
|
331 | o 15:7395e1ff83bd (draft) h | |
332 | | |
|
332 | | | |
333 | o 14:6b70183d2492 (draft) g |
|
333 | o 14:6b70183d2492 (draft) g | |
334 | | |
|
334 | | | |
335 | o 13:b449568bf7fc (draft) f |
|
335 | o 13:b449568bf7fc (draft) f | |
336 | | |
|
336 | | | |
337 | o 12:40db8afa467b (public) c |
|
337 | o 12:40db8afa467b (public) c | |
338 | | |
|
338 | | | |
339 | o 0:cb9a9f314b8b (public) a |
|
339 | o 0:cb9a9f314b8b (public) a | |
340 |
|
340 | |||
341 | $ cd .. |
|
341 | $ cd .. | |
342 |
|
342 | |||
343 | simple phase conservation |
|
343 | simple phase conservation | |
344 | ------------------------------------------- |
|
344 | ------------------------------------------- | |
345 |
|
345 | |||
346 | Resulting changeset should conserve the phase of the original one whatever the |
|
346 | Resulting changeset should conserve the phase of the original one whatever the | |
347 | phases.new-commit option is. |
|
347 | phases.new-commit option is. | |
348 |
|
348 | |||
349 | New-commit as draft (default) |
|
349 | New-commit as draft (default) | |
350 |
|
350 | |||
351 | $ cp -R base simple-draft |
|
351 | $ cp -R base simple-draft | |
352 | $ cd simple-draft |
|
352 | $ cd simple-draft | |
353 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
353 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF | |
354 | > edit b449568bf7fc 11 f |
|
354 | > edit b449568bf7fc 11 f | |
355 | > pick 6b70183d2492 12 g |
|
355 | > pick 6b70183d2492 12 g | |
356 | > pick 7395e1ff83bd 13 h |
|
356 | > pick 7395e1ff83bd 13 h | |
357 | > pick b605fb7503f2 14 i |
|
357 | > pick b605fb7503f2 14 i | |
358 | > pick 3a6c53ee7f3d 15 j |
|
358 | > pick 3a6c53ee7f3d 15 j | |
359 | > pick ee118ab9fa44 16 k |
|
359 | > pick ee118ab9fa44 16 k | |
360 | > EOF |
|
360 | > EOF | |
361 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
361 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved | |
362 | Editing (b449568bf7fc), you may commit or record as needed now. |
|
362 | Editing (b449568bf7fc), you may commit or record as needed now. | |
363 | (hg histedit --continue to resume) |
|
363 | (hg histedit --continue to resume) | |
364 | [240] |
|
364 | [240] | |
365 | $ echo f >> f |
|
365 | $ echo f >> f | |
366 | $ hg histedit --continue |
|
366 | $ hg histedit --continue | |
367 | $ hg log -G |
|
367 | $ hg log -G | |
368 | @ 24:12e89af74238 (secret) k |
|
368 | @ 24:12e89af74238 (secret) k | |
369 | | |
|
369 | | | |
370 | o 23:636a8687b22e (secret) j |
|
370 | o 23:636a8687b22e (secret) j | |
371 | | |
|
371 | | | |
372 | o 22:ccaf0a38653f (secret) i |
|
372 | o 22:ccaf0a38653f (secret) i | |
373 | | |
|
373 | | | |
374 | o 21:11a89d1c2613 (draft) h |
|
374 | o 21:11a89d1c2613 (draft) h | |
375 | | |
|
375 | | | |
376 | o 20:c1dec7ca82ea (draft) g |
|
376 | o 20:c1dec7ca82ea (draft) g | |
377 | | |
|
377 | | | |
378 | o 19:087281e68428 (draft) f |
|
378 | o 19:087281e68428 (draft) f | |
379 | | |
|
379 | | | |
380 | o 12:40db8afa467b (public) c |
|
380 | o 12:40db8afa467b (public) c | |
381 | | |
|
381 | | | |
382 | o 0:cb9a9f314b8b (public) a |
|
382 | o 0:cb9a9f314b8b (public) a | |
383 |
|
383 | |||
384 | $ cd .. |
|
384 | $ cd .. | |
385 |
|
385 | |||
386 |
|
386 | |||
387 | New-commit as secret (config) |
|
387 | New-commit as secret (config) | |
388 |
|
388 | |||
389 | $ cp -R base simple-secret |
|
389 | $ cp -R base simple-secret | |
390 | $ cd simple-secret |
|
390 | $ cd simple-secret | |
391 | $ cat >> .hg/hgrc << EOF |
|
391 | $ cat >> .hg/hgrc << EOF | |
392 | > [phases] |
|
392 | > [phases] | |
393 | > new-commit=secret |
|
393 | > new-commit=secret | |
394 | > EOF |
|
394 | > EOF | |
395 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
395 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF | |
396 | > edit b449568bf7fc 11 f |
|
396 | > edit b449568bf7fc 11 f | |
397 | > pick 6b70183d2492 12 g |
|
397 | > pick 6b70183d2492 12 g | |
398 | > pick 7395e1ff83bd 13 h |
|
398 | > pick 7395e1ff83bd 13 h | |
399 | > pick b605fb7503f2 14 i |
|
399 | > pick b605fb7503f2 14 i | |
400 | > pick 3a6c53ee7f3d 15 j |
|
400 | > pick 3a6c53ee7f3d 15 j | |
401 | > pick ee118ab9fa44 16 k |
|
401 | > pick ee118ab9fa44 16 k | |
402 | > EOF |
|
402 | > EOF | |
403 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved |
|
403 | 0 files updated, 0 files merged, 6 files removed, 0 files unresolved | |
404 | Editing (b449568bf7fc), you may commit or record as needed now. |
|
404 | Editing (b449568bf7fc), you may commit or record as needed now. | |
405 | (hg histedit --continue to resume) |
|
405 | (hg histedit --continue to resume) | |
406 | [240] |
|
406 | [240] | |
407 | $ echo f >> f |
|
407 | $ echo f >> f | |
408 | $ hg histedit --continue |
|
408 | $ hg histedit --continue | |
409 | $ hg log -G |
|
409 | $ hg log -G | |
410 | @ 24:12e89af74238 (secret) k |
|
410 | @ 24:12e89af74238 (secret) k | |
411 | | |
|
411 | | | |
412 | o 23:636a8687b22e (secret) j |
|
412 | o 23:636a8687b22e (secret) j | |
413 | | |
|
413 | | | |
414 | o 22:ccaf0a38653f (secret) i |
|
414 | o 22:ccaf0a38653f (secret) i | |
415 | | |
|
415 | | | |
416 | o 21:11a89d1c2613 (draft) h |
|
416 | o 21:11a89d1c2613 (draft) h | |
417 | | |
|
417 | | | |
418 | o 20:c1dec7ca82ea (draft) g |
|
418 | o 20:c1dec7ca82ea (draft) g | |
419 | | |
|
419 | | | |
420 | o 19:087281e68428 (draft) f |
|
420 | o 19:087281e68428 (draft) f | |
421 | | |
|
421 | | | |
422 | o 12:40db8afa467b (public) c |
|
422 | o 12:40db8afa467b (public) c | |
423 | | |
|
423 | | | |
424 | o 0:cb9a9f314b8b (public) a |
|
424 | o 0:cb9a9f314b8b (public) a | |
425 |
|
425 | |||
426 | $ cd .. |
|
426 | $ cd .. | |
427 |
|
427 | |||
428 |
|
428 | |||
429 | Changeset reordering |
|
429 | Changeset reordering | |
430 | ------------------------------------------- |
|
430 | ------------------------------------------- | |
431 |
|
431 | |||
432 | If a secret changeset is put before a draft one, all descendant should be secret. |
|
432 | If a secret changeset is put before a draft one, all descendant should be secret. | |
433 | It seems more important to present the secret phase. |
|
433 | It seems more important to present the secret phase. | |
434 |
|
434 | |||
435 | $ cp -R base reorder |
|
435 | $ cp -R base reorder | |
436 | $ cd reorder |
|
436 | $ cd reorder | |
437 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
437 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF | |
438 | > pick b449568bf7fc 11 f |
|
438 | > pick b449568bf7fc 11 f | |
439 | > pick 3a6c53ee7f3d 15 j |
|
439 | > pick 3a6c53ee7f3d 15 j | |
440 | > pick 6b70183d2492 12 g |
|
440 | > pick 6b70183d2492 12 g | |
441 | > pick b605fb7503f2 14 i |
|
441 | > pick b605fb7503f2 14 i | |
442 | > pick 7395e1ff83bd 13 h |
|
442 | > pick 7395e1ff83bd 13 h | |
443 | > pick ee118ab9fa44 16 k |
|
443 | > pick ee118ab9fa44 16 k | |
444 | > EOF |
|
444 | > EOF | |
445 | $ hg log -G |
|
445 | $ hg log -G | |
446 | @ 23:558246857888 (secret) k |
|
446 | @ 23:558246857888 (secret) k | |
447 | | |
|
447 | | | |
448 | o 22:28bd44768535 (secret) h |
|
448 | o 22:28bd44768535 (secret) h | |
449 | | |
|
449 | | | |
450 | o 21:d5395202aeb9 (secret) i |
|
450 | o 21:d5395202aeb9 (secret) i | |
451 | | |
|
451 | | | |
452 | o 20:21edda8e341b (secret) g |
|
452 | o 20:21edda8e341b (secret) g | |
453 | | |
|
453 | | | |
454 | o 19:5ab64f3a4832 (secret) j |
|
454 | o 19:5ab64f3a4832 (secret) j | |
455 | | |
|
455 | | | |
456 | o 13:b449568bf7fc (draft) f |
|
456 | o 13:b449568bf7fc (draft) f | |
457 | | |
|
457 | | | |
458 | o 12:40db8afa467b (public) c |
|
458 | o 12:40db8afa467b (public) c | |
459 | | |
|
459 | | | |
460 | o 0:cb9a9f314b8b (public) a |
|
460 | o 0:cb9a9f314b8b (public) a | |
461 |
|
461 | |||
462 | $ cd .. |
|
462 | $ cd .. | |
463 |
|
463 | |||
464 | Changeset folding |
|
464 | Changeset folding | |
465 | ------------------------------------------- |
|
465 | ------------------------------------------- | |
466 |
|
466 | |||
467 | Folding a secret changeset with a draft one turn the result secret (again, |
|
467 | Folding a secret changeset with a draft one turn the result secret (again, | |
468 | better safe than sorry). Folding between same phase changeset still works |
|
468 | better safe than sorry). Folding between same phase changeset still works | |
469 |
|
469 | |||
470 | Note that there is a few reordering in this series for more extensive test |
|
470 | Note that there is a few reordering in this series for more extensive test | |
471 |
|
471 | |||
472 | $ cp -R base folding |
|
472 | $ cp -R base folding | |
473 | $ cd folding |
|
473 | $ cd folding | |
474 | $ cat >> .hg/hgrc << EOF |
|
474 | $ cat >> .hg/hgrc << EOF | |
475 | > [phases] |
|
475 | > [phases] | |
476 | > new-commit=secret |
|
476 | > new-commit=secret | |
477 | > EOF |
|
477 | > EOF | |
478 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
478 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF | |
479 | > pick 7395e1ff83bd 13 h |
|
479 | > pick 7395e1ff83bd 13 h | |
480 | > fold b449568bf7fc 11 f |
|
480 | > fold b449568bf7fc 11 f | |
481 | > pick 6b70183d2492 12 g |
|
481 | > pick 6b70183d2492 12 g | |
482 | > fold 3a6c53ee7f3d 15 j |
|
482 | > fold 3a6c53ee7f3d 15 j | |
483 | > pick b605fb7503f2 14 i |
|
483 | > pick b605fb7503f2 14 i | |
484 | > fold ee118ab9fa44 16 k |
|
484 | > fold ee118ab9fa44 16 k | |
485 | > EOF |
|
485 | > EOF | |
486 | $ hg log -G |
|
486 | $ hg log -G | |
487 | @ 27:f9daec13fb98 (secret) i |
|
487 | @ 27:f9daec13fb98 (secret) i | |
488 | | |
|
488 | | | |
489 | o 24:49807617f46a (secret) g |
|
489 | o 24:49807617f46a (secret) g | |
490 | | |
|
490 | | | |
491 | o 21:050280826e04 (draft) h |
|
491 | o 21:050280826e04 (draft) h | |
492 | | |
|
492 | | | |
493 | o 12:40db8afa467b (public) c |
|
493 | o 12:40db8afa467b (public) c | |
494 | | |
|
494 | | | |
495 | o 0:cb9a9f314b8b (public) a |
|
495 | o 0:cb9a9f314b8b (public) a | |
496 |
|
496 | |||
497 | $ hg co 49807617f46a |
|
497 | $ hg co 49807617f46a | |
498 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
498 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
499 | $ echo wat >> wat |
|
499 | $ echo wat >> wat | |
500 | $ hg add wat |
|
500 | $ hg add wat | |
501 | $ hg ci -m 'add wat' |
|
501 | $ hg ci -m 'add wat' | |
502 | created new head |
|
502 | created new head | |
503 | $ hg merge f9daec13fb98 |
|
503 | $ hg merge f9daec13fb98 | |
504 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
504 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
505 | (branch merge, don't forget to commit) |
|
505 | (branch merge, don't forget to commit) | |
506 | $ hg ci -m 'merge' |
|
506 | $ hg ci -m 'merge' | |
507 | $ echo not wat > wat |
|
507 | $ echo not wat > wat | |
508 | $ hg ci -m 'modify wat' |
|
508 | $ hg ci -m 'modify wat' | |
509 | $ hg histedit 050280826e04 |
|
509 | $ hg histedit 050280826e04 | |
510 | abort: cannot edit history that contains merges |
|
510 | abort: cannot edit history that contains merges | |
511 | [255] |
|
511 | [255] | |
512 | $ cd .. |
|
512 | $ cd .. | |
513 |
|
513 | |||
514 | Check abort behavior |
|
514 | Check abort behavior | |
515 | ------------------------------------------- |
|
515 | ------------------------------------------- | |
516 |
|
516 | |||
517 | We checks that abort properly clean the repository so the same histedit can be |
|
517 | We checks that abort properly clean the repository so the same histedit can be | |
518 | attempted later. |
|
518 | attempted later. | |
519 |
|
519 | |||
520 | $ cp -R base abort |
|
520 | $ cp -R base abort | |
521 | $ cd abort |
|
521 | $ cd abort | |
522 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF |
|
522 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF | |
523 | > pick b449568bf7fc 13 f |
|
523 | > pick b449568bf7fc 13 f | |
524 | > pick 7395e1ff83bd 15 h |
|
524 | > pick 7395e1ff83bd 15 h | |
525 | > pick 6b70183d2492 14 g |
|
525 | > pick 6b70183d2492 14 g | |
526 | > pick b605fb7503f2 16 i |
|
526 | > pick b605fb7503f2 16 i | |
527 | > roll 3a6c53ee7f3d 17 j |
|
527 | > roll 3a6c53ee7f3d 17 j | |
528 | > edit ee118ab9fa44 18 k |
|
528 | > edit ee118ab9fa44 18 k | |
529 | > EOF |
|
529 | > EOF | |
530 | Editing (ee118ab9fa44), you may commit or record as needed now. |
|
530 | Editing (ee118ab9fa44), you may commit or record as needed now. | |
531 | (hg histedit --continue to resume) |
|
531 | (hg histedit --continue to resume) | |
532 | [240] |
|
532 | [240] | |
533 |
|
533 | |||
534 | #if abortcommand |
|
534 | #if abortcommand | |
535 | when in dry-run mode |
|
535 | when in dry-run mode | |
536 | $ hg abort --dry-run |
|
536 | $ hg abort --dry-run | |
537 | histedit in progress, will be aborted |
|
537 | histedit in progress, will be aborted | |
538 | #endif |
|
538 | #endif | |
539 |
|
539 | |||
540 | $ hg abort |
|
540 | $ hg abort | |
541 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
541 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
542 | saved backup bundle to $TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg |
|
542 | saved backup bundle to $TESTTMP/abort/.hg/strip-backup/4dc06258baa6-dff4ef05-backup.hg | |
543 |
|
543 | |||
544 | $ hg log -G |
|
544 | $ hg log -G | |
545 | @ 18:ee118ab9fa44 (secret) k |
|
545 | @ 18:ee118ab9fa44 (secret) k | |
546 | | |
|
546 | | | |
547 | o 17:3a6c53ee7f3d (secret) j |
|
547 | o 17:3a6c53ee7f3d (secret) j | |
548 | | |
|
548 | | | |
549 | o 16:b605fb7503f2 (secret) i |
|
549 | o 16:b605fb7503f2 (secret) i | |
550 | | |
|
550 | | | |
551 | o 15:7395e1ff83bd (draft) h |
|
551 | o 15:7395e1ff83bd (draft) h | |
552 | | |
|
552 | | | |
553 | o 14:6b70183d2492 (draft) g |
|
553 | o 14:6b70183d2492 (draft) g | |
554 | | |
|
554 | | | |
555 | o 13:b449568bf7fc (draft) f |
|
555 | o 13:b449568bf7fc (draft) f | |
556 | | |
|
556 | | | |
557 | o 12:40db8afa467b (public) c |
|
557 | o 12:40db8afa467b (public) c | |
558 | | |
|
558 | | | |
559 | o 0:cb9a9f314b8b (public) a |
|
559 | o 0:cb9a9f314b8b (public) a | |
560 |
|
560 | |||
561 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF --config experimental.evolution.track-operation=1 |
|
561 | $ hg histedit -r 'b449568bf7fc' --commands - << EOF --config experimental.evolution.track-operation=1 | |
562 | > pick b449568bf7fc 13 f |
|
562 | > pick b449568bf7fc 13 f | |
563 | > pick 7395e1ff83bd 15 h |
|
563 | > pick 7395e1ff83bd 15 h | |
564 | > pick 6b70183d2492 14 g |
|
564 | > pick 6b70183d2492 14 g | |
565 | > pick b605fb7503f2 16 i |
|
565 | > pick b605fb7503f2 16 i | |
566 | > pick 3a6c53ee7f3d 17 j |
|
566 | > pick 3a6c53ee7f3d 17 j | |
567 | > edit ee118ab9fa44 18 k |
|
567 | > edit ee118ab9fa44 18 k | |
568 | > EOF |
|
568 | > EOF | |
569 | Editing (ee118ab9fa44), you may commit or record as needed now. |
|
569 | Editing (ee118ab9fa44), you may commit or record as needed now. | |
570 | (hg histedit --continue to resume) |
|
570 | (hg histedit --continue to resume) | |
571 | [240] |
|
571 | [240] | |
572 | $ hg histedit --continue --config experimental.evolution.track-operation=1 |
|
572 | $ hg histedit --continue --config experimental.evolution.track-operation=1 | |
573 | $ hg log -G |
|
573 | $ hg log -G | |
574 | @ 23:175d6b286a22 (secret) k |
|
574 | @ 23:175d6b286a22 (secret) k | |
575 | | |
|
575 | | | |
576 | o 22:44ca09d59ae4 (secret) j |
|
576 | o 22:44ca09d59ae4 (secret) j | |
577 | | |
|
577 | | | |
578 | o 21:31747692a644 (secret) i |
|
578 | o 21:31747692a644 (secret) i | |
579 | | |
|
579 | | | |
580 | o 20:9985cd4f21fa (draft) g |
|
580 | o 20:9985cd4f21fa (draft) g | |
581 | | |
|
581 | | | |
582 | o 19:4dc06258baa6 (draft) h |
|
582 | o 19:4dc06258baa6 (draft) h | |
583 | | |
|
583 | | | |
584 | o 13:b449568bf7fc (draft) f |
|
584 | o 13:b449568bf7fc (draft) f | |
585 | | |
|
585 | | | |
586 | o 12:40db8afa467b (public) c |
|
586 | o 12:40db8afa467b (public) c | |
587 | | |
|
587 | | | |
588 | o 0:cb9a9f314b8b (public) a |
|
588 | o 0:cb9a9f314b8b (public) a | |
589 |
|
589 | |||
590 | $ hg debugobsolete --rev . |
|
590 | $ hg debugobsolete --rev . | |
591 | ee118ab9fa44ebb86be85996548b5517a39e5093 175d6b286a224c23f192e79a581ce83131a53fa2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'} |
|
591 | ee118ab9fa44ebb86be85996548b5517a39e5093 175d6b286a224c23f192e79a581ce83131a53fa2 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '4', 'operation': 'histedit', 'user': 'test'} |
@@ -1,776 +1,776 b'' | |||||
1 | $ cat >> $HGRCPATH <<EOF |
|
1 | $ cat >> $HGRCPATH <<EOF | |
2 | > [extensions] |
|
2 | > [extensions] | |
3 | > rebase= |
|
3 | > rebase= | |
4 | > mq= |
|
4 | > mq= | |
5 | > drawdag=$TESTDIR/drawdag.py |
|
5 | > drawdag=$TESTDIR/drawdag.py | |
6 | > |
|
6 | > | |
7 | > [phases] |
|
7 | > [phases] | |
8 | > publish=False |
|
8 | > publish=False | |
9 | > |
|
9 | > | |
10 | > [alias] |
|
10 | > [alias] | |
11 | > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n" |
|
11 | > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n" | |
12 | > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n" |
|
12 | > tglogp = log -G --template "{rev}: {node|short} {phase} '{desc}' {branches}\n" | |
13 | > EOF |
|
13 | > EOF | |
14 |
|
14 | |||
15 | Highest phase of source commits is used: |
|
15 | Highest phase of source commits is used: | |
16 |
|
16 | |||
17 | $ hg init phase |
|
17 | $ hg init phase | |
18 | $ cd phase |
|
18 | $ cd phase | |
19 | $ hg debugdrawdag << 'EOF' |
|
19 | $ hg debugdrawdag << 'EOF' | |
20 | > D |
|
20 | > D | |
21 | > | |
|
21 | > | | |
22 | > F C |
|
22 | > F C | |
23 | > | | |
|
23 | > | | | |
24 | > E B |
|
24 | > E B | |
25 | > |/ |
|
25 | > |/ | |
26 | > A |
|
26 | > A | |
27 | > EOF |
|
27 | > EOF | |
28 |
|
28 | |||
29 | $ hg phase --force --secret D |
|
29 | $ hg phase --force --secret D | |
30 |
|
30 | |||
31 | $ cat > $TESTTMP/editor.sh <<EOF |
|
31 | $ cat > $TESTTMP/editor.sh <<EOF | |
32 | > echo "==== before editing" |
|
32 | > echo "==== before editing" | |
33 | > cat \$1 |
|
33 | > cat \$1 | |
34 | > echo "====" |
|
34 | > echo "====" | |
35 | > echo "edited manually" >> \$1 |
|
35 | > echo "edited manually" >> \$1 | |
36 | > EOF |
|
36 | > EOF | |
37 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e --source B --dest F |
|
37 | $ HGEDITOR="sh $TESTTMP/editor.sh" hg rebase --collapse --keepbranches -e --source B --dest F | |
38 | rebasing 1:112478962961 B "B" |
|
38 | rebasing 1:112478962961 B "B" | |
39 | rebasing 3:26805aba1e60 C "C" |
|
39 | rebasing 3:26805aba1e60 C "C" | |
40 | rebasing 5:f585351a92f8 D tip "D" |
|
40 | rebasing 5:f585351a92f8 D tip "D" | |
41 | ==== before editing |
|
41 | ==== before editing | |
42 | Collapsed revision |
|
42 | Collapsed revision | |
43 | * B |
|
43 | * B | |
44 | * C |
|
44 | * C | |
45 | * D |
|
45 | * D | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
48 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
49 | HG: Leave message empty to abort commit. |
|
49 | HG: Leave message empty to abort commit. | |
50 | HG: -- |
|
50 | HG: -- | |
51 | HG: user: test |
|
51 | HG: user: test | |
52 | HG: branch 'default' |
|
52 | HG: branch 'default' | |
53 | HG: added B |
|
53 | HG: added B | |
54 | HG: added C |
|
54 | HG: added C | |
55 | HG: added D |
|
55 | HG: added D | |
56 | ==== |
|
56 | ==== | |
57 | saved backup bundle to $TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg |
|
57 | saved backup bundle to $TESTTMP/phase/.hg/strip-backup/112478962961-cb2a9b47-rebase.hg | |
58 |
|
58 | |||
59 | $ hg tglogp |
|
59 | $ hg tglogp | |
60 | o 3: 92fa5f5fe108 secret 'Collapsed revision |
|
60 | o 3: 92fa5f5fe108 secret 'Collapsed revision | |
61 | | * B |
|
61 | | * B | |
62 | | * C |
|
62 | | * C | |
63 | | * D |
|
63 | | * D | |
64 | | |
|
64 | | | |
65 | | |
|
65 | | | |
66 | | edited manually' |
|
66 | | edited manually' | |
67 | o 2: 64a8289d2492 draft 'F' |
|
67 | o 2: 64a8289d2492 draft 'F' | |
68 | | |
|
68 | | | |
69 | o 1: 7fb047a69f22 draft 'E' |
|
69 | o 1: 7fb047a69f22 draft 'E' | |
70 | | |
|
70 | | | |
71 | o 0: 426bada5c675 draft 'A' |
|
71 | o 0: 426bada5c675 draft 'A' | |
72 |
|
72 | |||
73 | $ hg manifest --rev tip |
|
73 | $ hg manifest --rev tip | |
74 | A |
|
74 | A | |
75 | B |
|
75 | B | |
76 | C |
|
76 | C | |
77 | D |
|
77 | D | |
78 | E |
|
78 | E | |
79 | F |
|
79 | F | |
80 |
|
80 | |||
81 | $ cd .. |
|
81 | $ cd .. | |
82 |
|
82 | |||
83 |
|
83 | |||
84 | Merge gets linearized: |
|
84 | Merge gets linearized: | |
85 |
|
85 | |||
86 | $ hg init linearized-merge |
|
86 | $ hg init linearized-merge | |
87 | $ cd linearized-merge |
|
87 | $ cd linearized-merge | |
88 |
|
88 | |||
89 | $ hg debugdrawdag << 'EOF' |
|
89 | $ hg debugdrawdag << 'EOF' | |
90 | > F D |
|
90 | > F D | |
91 | > |/| |
|
91 | > |/| | |
92 | > C B |
|
92 | > C B | |
93 | > |/ |
|
93 | > |/ | |
94 | > A |
|
94 | > A | |
95 | > EOF |
|
95 | > EOF | |
96 |
|
96 | |||
97 | $ hg phase --force --secret D |
|
97 | $ hg phase --force --secret D | |
98 | $ hg rebase --source B --collapse --dest F |
|
98 | $ hg rebase --source B --collapse --dest F | |
99 | rebasing 1:112478962961 B "B" |
|
99 | rebasing 1:112478962961 B "B" | |
100 | rebasing 3:4e4f9194f9f1 D "D" |
|
100 | rebasing 3:4e4f9194f9f1 D "D" | |
101 | saved backup bundle to $TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg |
|
101 | saved backup bundle to $TESTTMP/linearized-merge/.hg/strip-backup/112478962961-e389075b-rebase.hg | |
102 |
|
102 | |||
103 | $ hg tglog |
|
103 | $ hg tglog | |
104 | o 3: 5bdc08b7da2b 'Collapsed revision |
|
104 | o 3: 5bdc08b7da2b 'Collapsed revision | |
105 | | * B |
|
105 | | * B | |
106 | | * D' |
|
106 | | * D' | |
107 | o 2: afc707c82df0 'F' |
|
107 | o 2: afc707c82df0 'F' | |
108 | | |
|
108 | | | |
109 | o 1: dc0947a82db8 'C' |
|
109 | o 1: dc0947a82db8 'C' | |
110 | | |
|
110 | | | |
111 | o 0: 426bada5c675 'A' |
|
111 | o 0: 426bada5c675 'A' | |
112 |
|
112 | |||
113 | $ hg manifest --rev tip |
|
113 | $ hg manifest --rev tip | |
114 | A |
|
114 | A | |
115 | B |
|
115 | B | |
116 | C |
|
116 | C | |
117 | F |
|
117 | F | |
118 |
|
118 | |||
119 | $ cd .. |
|
119 | $ cd .. | |
120 |
|
120 | |||
121 | Custom message: |
|
121 | Custom message: | |
122 |
|
122 | |||
123 | $ hg init message |
|
123 | $ hg init message | |
124 | $ cd message |
|
124 | $ cd message | |
125 |
|
125 | |||
126 | $ hg debugdrawdag << 'EOF' |
|
126 | $ hg debugdrawdag << 'EOF' | |
127 | > C |
|
127 | > C | |
128 | > | |
|
128 | > | | |
129 | > D B |
|
129 | > D B | |
130 | > |/ |
|
130 | > |/ | |
131 | > A |
|
131 | > A | |
132 | > EOF |
|
132 | > EOF | |
133 |
|
133 | |||
134 |
|
134 | |||
135 | $ hg rebase --base B -m 'custom message' |
|
135 | $ hg rebase --base B -m 'custom message' | |
136 | abort: message can only be specified with collapse |
|
136 | abort: message can only be specified with collapse | |
137 | [255] |
|
137 | [255] | |
138 |
|
138 | |||
139 | $ cat > $TESTTMP/checkeditform.sh <<EOF |
|
139 | $ cat > $TESTTMP/checkeditform.sh <<EOF | |
140 | > env | grep HGEDITFORM |
|
140 | > env | grep HGEDITFORM | |
141 | > true |
|
141 | > true | |
142 | > EOF |
|
142 | > EOF | |
143 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source B --collapse -m 'custom message' -e --dest D |
|
143 | $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg rebase --source B --collapse -m 'custom message' -e --dest D | |
144 | rebasing 1:112478962961 B "B" |
|
144 | rebasing 1:112478962961 B "B" | |
145 | rebasing 3:26805aba1e60 C tip "C" |
|
145 | rebasing 3:26805aba1e60 C tip "C" | |
146 | HGEDITFORM=rebase.collapse |
|
146 | HGEDITFORM=rebase.collapse | |
147 | saved backup bundle to $TESTTMP/message/.hg/strip-backup/112478962961-f4131707-rebase.hg |
|
147 | saved backup bundle to $TESTTMP/message/.hg/strip-backup/112478962961-f4131707-rebase.hg | |
148 |
|
148 | |||
149 | $ hg tglog |
|
149 | $ hg tglog | |
150 | o 2: 2f197b9a08f3 'custom message' |
|
150 | o 2: 2f197b9a08f3 'custom message' | |
151 | | |
|
151 | | | |
152 | o 1: b18e25de2cf5 'D' |
|
152 | o 1: b18e25de2cf5 'D' | |
153 | | |
|
153 | | | |
154 | o 0: 426bada5c675 'A' |
|
154 | o 0: 426bada5c675 'A' | |
155 |
|
155 | |||
156 | $ hg manifest --rev tip |
|
156 | $ hg manifest --rev tip | |
157 | A |
|
157 | A | |
158 | B |
|
158 | B | |
159 | C |
|
159 | C | |
160 | D |
|
160 | D | |
161 |
|
161 | |||
162 | $ cd .. |
|
162 | $ cd .. | |
163 |
|
163 | |||
164 | Rebase and collapse - more than one external (fail): |
|
164 | Rebase and collapse - more than one external (fail): | |
165 |
|
165 | |||
166 | $ hg init multiple-external-parents |
|
166 | $ hg init multiple-external-parents | |
167 | $ cd multiple-external-parents |
|
167 | $ cd multiple-external-parents | |
168 |
|
168 | |||
169 | $ hg debugdrawdag << 'EOF' |
|
169 | $ hg debugdrawdag << 'EOF' | |
170 | > G |
|
170 | > G | |
171 | > |\ |
|
171 | > |\ | |
172 | > | F |
|
172 | > | F | |
173 | > | | |
|
173 | > | | | |
174 | > D E |
|
174 | > D E | |
175 | > |\| |
|
175 | > |\| | |
176 | > H C B |
|
176 | > H C B | |
177 | > \|/ |
|
177 | > \|/ | |
178 | > A |
|
178 | > A | |
179 | > EOF |
|
179 | > EOF | |
180 |
|
180 | |||
181 | $ hg rebase -s C --dest H --collapse |
|
181 | $ hg rebase -s C --dest H --collapse | |
182 | abort: unable to collapse on top of 3, there is more than one external parent: 1, 6 |
|
182 | abort: unable to collapse on top of 3, there is more than one external parent: 1, 6 | |
183 | [255] |
|
183 | [255] | |
184 |
|
184 | |||
185 | Rebase and collapse - E onto H: |
|
185 | Rebase and collapse - E onto H: | |
186 |
|
186 | |||
187 | $ hg rebase -s E --dest H --collapse # root (E) is not a merge |
|
187 | $ hg rebase -s E --dest H --collapse # root (E) is not a merge | |
188 | rebasing 5:49cb92066bfd E "E" |
|
188 | rebasing 5:49cb92066bfd E "E" | |
189 | rebasing 6:11abe3fb10b8 F "F" |
|
189 | rebasing 6:11abe3fb10b8 F "F" | |
190 | rebasing 7:64e264db77f0 G tip "G" |
|
190 | rebasing 7:64e264db77f0 G tip "G" | |
191 | saved backup bundle to $TESTTMP/multiple-external-parents/.hg/strip-backup/49cb92066bfd-ee8a8a79-rebase.hg |
|
191 | saved backup bundle to $TESTTMP/multiple-external-parents/.hg/strip-backup/49cb92066bfd-ee8a8a79-rebase.hg | |
192 |
|
192 | |||
193 | $ hg tglog |
|
193 | $ hg tglog | |
194 | o 5: 8b2315790719 'Collapsed revision |
|
194 | o 5: 8b2315790719 'Collapsed revision | |
195 | |\ * E |
|
195 | |\ * E | |
196 | | | * F |
|
196 | | | * F | |
197 | | | * G' |
|
197 | | | * G' | |
198 | | o 4: 4e4f9194f9f1 'D' |
|
198 | | o 4: 4e4f9194f9f1 'D' | |
199 | | |\ |
|
199 | | |\ | |
200 | o | | 3: 575c4b5ec114 'H' |
|
200 | o | | 3: 575c4b5ec114 'H' | |
201 | | | | |
|
201 | | | | | |
202 | +---o 2: dc0947a82db8 'C' |
|
202 | +---o 2: dc0947a82db8 'C' | |
203 | | | |
|
203 | | | | |
204 | | o 1: 112478962961 'B' |
|
204 | | o 1: 112478962961 'B' | |
205 | |/ |
|
205 | |/ | |
206 | o 0: 426bada5c675 'A' |
|
206 | o 0: 426bada5c675 'A' | |
207 |
|
207 | |||
208 | $ hg manifest --rev tip |
|
208 | $ hg manifest --rev tip | |
209 | A |
|
209 | A | |
210 | C |
|
210 | C | |
211 | E |
|
211 | E | |
212 | F |
|
212 | F | |
213 | H |
|
213 | H | |
214 |
|
214 | |||
215 | $ cd .. |
|
215 | $ cd .. | |
216 |
|
216 | |||
217 |
|
217 | |||
218 |
|
218 | |||
219 |
|
219 | |||
220 | Test that branchheads cache is updated correctly when doing a strip in which |
|
220 | Test that branchheads cache is updated correctly when doing a strip in which | |
221 | the parent of the ancestor node to be stripped does not become a head and also, |
|
221 | the parent of the ancestor node to be stripped does not become a head and also, | |
222 | the parent of a node that is a child of the node stripped becomes a head (node |
|
222 | the parent of a node that is a child of the node stripped becomes a head (node | |
223 | 3). The code is now much simpler and we could just test a simpler scenario |
|
223 | 3). The code is now much simpler and we could just test a simpler scenario | |
224 | We keep it the test this way in case new complexity is injected. |
|
224 | We keep it the test this way in case new complexity is injected. | |
225 |
|
225 | |||
226 | Create repo b: |
|
226 | Create repo b: | |
227 |
|
227 | |||
228 | $ hg init branch-heads |
|
228 | $ hg init branch-heads | |
229 | $ cd branch-heads |
|
229 | $ cd branch-heads | |
230 |
|
230 | |||
231 | $ hg debugdrawdag << 'EOF' |
|
231 | $ hg debugdrawdag << 'EOF' | |
232 | > G |
|
232 | > G | |
233 | > |\ |
|
233 | > |\ | |
234 | > | F |
|
234 | > | F | |
235 | > | | |
|
235 | > | | | |
236 | > D E |
|
236 | > D E | |
237 | > |\| |
|
237 | > |\| | |
238 | > H C B |
|
238 | > H C B | |
239 | > \|/ |
|
239 | > \|/ | |
240 | > A |
|
240 | > A | |
241 | > EOF |
|
241 | > EOF | |
242 |
|
242 | |||
243 | $ hg heads --template="{rev}:{node} {branch}\n" |
|
243 | $ hg heads --template="{rev}:{node} {branch}\n" | |
244 | 7:64e264db77f061f16d9132b70c5a58e2461fb630 default |
|
244 | 7:64e264db77f061f16d9132b70c5a58e2461fb630 default | |
245 | 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default |
|
245 | 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default | |
246 |
|
246 | |||
247 | $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served |
|
247 | $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served | |
248 | 64e264db77f061f16d9132b70c5a58e2461fb630 7 |
|
248 | 64e264db77f061f16d9132b70c5a58e2461fb630 7 | |
249 | 575c4b5ec114d64b681d33f8792853568bfb2b2c o default |
|
249 | 575c4b5ec114d64b681d33f8792853568bfb2b2c o default | |
250 | 64e264db77f061f16d9132b70c5a58e2461fb630 o default |
|
250 | 64e264db77f061f16d9132b70c5a58e2461fb630 o default | |
251 |
|
251 | |||
252 | $ hg strip 4 |
|
252 | $ hg strip 4 | |
253 | saved backup bundle to $TESTTMP/branch-heads/.hg/strip-backup/4e4f9194f9f1-5ec4b5e6-backup.hg |
|
253 | saved backup bundle to $TESTTMP/branch-heads/.hg/strip-backup/4e4f9194f9f1-5ec4b5e6-backup.hg | |
254 |
|
254 | |||
255 | $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served |
|
255 | $ cat $TESTTMP/branch-heads/.hg/cache/branch2-served | |
256 | 11abe3fb10b8689b560681094b17fe161871d043 5 |
|
256 | 11abe3fb10b8689b560681094b17fe161871d043 5 | |
257 | dc0947a82db884575bb76ea10ac97b08536bfa03 o default |
|
257 | dc0947a82db884575bb76ea10ac97b08536bfa03 o default | |
258 | 575c4b5ec114d64b681d33f8792853568bfb2b2c o default |
|
258 | 575c4b5ec114d64b681d33f8792853568bfb2b2c o default | |
259 | 11abe3fb10b8689b560681094b17fe161871d043 o default |
|
259 | 11abe3fb10b8689b560681094b17fe161871d043 o default | |
260 |
|
260 | |||
261 | $ hg heads --template="{rev}:{node} {branch}\n" |
|
261 | $ hg heads --template="{rev}:{node} {branch}\n" | |
262 | 5:11abe3fb10b8689b560681094b17fe161871d043 default |
|
262 | 5:11abe3fb10b8689b560681094b17fe161871d043 default | |
263 | 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default |
|
263 | 3:575c4b5ec114d64b681d33f8792853568bfb2b2c default | |
264 | 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default |
|
264 | 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default | |
265 |
|
265 | |||
266 | $ cd .. |
|
266 | $ cd .. | |
267 |
|
267 | |||
268 |
|
268 | |||
269 |
|
269 | |||
270 | Preserves external parent |
|
270 | Preserves external parent | |
271 |
|
271 | |||
272 | $ hg init external-parent |
|
272 | $ hg init external-parent | |
273 | $ cd external-parent |
|
273 | $ cd external-parent | |
274 |
|
274 | |||
275 | $ hg debugdrawdag << 'EOF' |
|
275 | $ hg debugdrawdag << 'EOF' | |
276 | > H |
|
276 | > H | |
277 | > |\ |
|
277 | > |\ | |
278 | > | G |
|
278 | > | G | |
279 | > | | |
|
279 | > | | | |
280 | > | F # F/E = F\n |
|
280 | > | F # F/E = F\n | |
281 | > | | |
|
281 | > | | | |
282 | > D E # D/D = D\n |
|
282 | > D E # D/D = D\n | |
283 | > |\| |
|
283 | > |\| | |
284 | > I C B |
|
284 | > I C B | |
285 | > \|/ |
|
285 | > \|/ | |
286 | > A |
|
286 | > A | |
287 | > EOF |
|
287 | > EOF | |
288 |
|
288 | |||
289 | $ hg rebase -s F --dest I --collapse # root (F) is not a merge |
|
289 | $ hg rebase -s F --dest I --collapse # root (F) is not a merge | |
290 | rebasing 6:c82b08f646f1 F "F" |
|
290 | rebasing 6:c82b08f646f1 F "F" | |
291 | file 'E' was deleted in local [dest] but was modified in other [source]. |
|
291 | file 'E' was deleted in local [dest] but was modified in other [source]. | |
292 | You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved. |
|
292 | You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved. | |
293 | What do you want to do? u |
|
293 | What do you want to do? u | |
294 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
294 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
295 | [240] |
|
295 | [240] | |
296 |
|
296 | |||
297 | $ echo F > E |
|
297 | $ echo F > E | |
298 | $ hg resolve -m |
|
298 | $ hg resolve -m | |
299 | (no more unresolved files) |
|
299 | (no more unresolved files) | |
300 | continue: hg rebase --continue |
|
300 | continue: hg rebase --continue | |
301 | $ hg rebase -c |
|
301 | $ hg rebase -c | |
302 | rebasing 6:c82b08f646f1 F "F" |
|
302 | rebasing 6:c82b08f646f1 F "F" | |
303 | rebasing 7:a6db7fa104e1 G "G" |
|
303 | rebasing 7:a6db7fa104e1 G "G" | |
304 | rebasing 8:e1d201b72d91 H tip "H" |
|
304 | rebasing 8:e1d201b72d91 H tip "H" | |
305 | saved backup bundle to $TESTTMP/external-parent/.hg/strip-backup/c82b08f646f1-f2721fbf-rebase.hg |
|
305 | saved backup bundle to $TESTTMP/external-parent/.hg/strip-backup/c82b08f646f1-f2721fbf-rebase.hg | |
306 |
|
306 | |||
307 | $ hg tglog |
|
307 | $ hg tglog | |
308 | o 6: 681daa3e686d 'Collapsed revision |
|
308 | o 6: 681daa3e686d 'Collapsed revision | |
309 | |\ * F |
|
309 | |\ * F | |
310 | | | * G |
|
310 | | | * G | |
311 | | | * H' |
|
311 | | | * H' | |
312 | | | o 5: 49cb92066bfd 'E' |
|
312 | | | o 5: 49cb92066bfd 'E' | |
313 | | | | |
|
313 | | | | | |
314 | | o | 4: 09143c0bf13e 'D' |
|
314 | | o | 4: 09143c0bf13e 'D' | |
315 | | |\| |
|
315 | | |\| | |
316 | o | | 3: 08ebfeb61bac 'I' |
|
316 | o | | 3: 08ebfeb61bac 'I' | |
317 | | | | |
|
317 | | | | | |
318 | | o | 2: dc0947a82db8 'C' |
|
318 | | o | 2: dc0947a82db8 'C' | |
319 | |/ / |
|
319 | |/ / | |
320 | | o 1: 112478962961 'B' |
|
320 | | o 1: 112478962961 'B' | |
321 | |/ |
|
321 | |/ | |
322 | o 0: 426bada5c675 'A' |
|
322 | o 0: 426bada5c675 'A' | |
323 |
|
323 | |||
324 | $ hg manifest --rev tip |
|
324 | $ hg manifest --rev tip | |
325 | A |
|
325 | A | |
326 | C |
|
326 | C | |
327 | D |
|
327 | D | |
328 | E |
|
328 | E | |
329 | F |
|
329 | F | |
330 | G |
|
330 | G | |
331 | I |
|
331 | I | |
332 |
|
332 | |||
333 | $ hg up tip -q |
|
333 | $ hg up tip -q | |
334 | $ cat E |
|
334 | $ cat E | |
335 | F |
|
335 | F | |
336 |
|
336 | |||
337 | $ cd .. |
|
337 | $ cd .. | |
338 |
|
338 | |||
339 | Rebasing from multiple bases: |
|
339 | Rebasing from multiple bases: | |
340 |
|
340 | |||
341 | $ hg init multiple-bases |
|
341 | $ hg init multiple-bases | |
342 | $ cd multiple-bases |
|
342 | $ cd multiple-bases | |
343 | $ hg debugdrawdag << 'EOF' |
|
343 | $ hg debugdrawdag << 'EOF' | |
344 | > C B |
|
344 | > C B | |
345 | > D |/ |
|
345 | > D |/ | |
346 | > |/ |
|
346 | > |/ | |
347 | > A |
|
347 | > A | |
348 | > EOF |
|
348 | > EOF | |
349 | $ hg rebase --collapse -r 'B+C' -d D |
|
349 | $ hg rebase --collapse -r 'B+C' -d D | |
350 | rebasing 1:fc2b737bb2e5 B "B" |
|
350 | rebasing 1:fc2b737bb2e5 B "B" | |
351 | rebasing 2:dc0947a82db8 C "C" |
|
351 | rebasing 2:dc0947a82db8 C "C" | |
352 | saved backup bundle to $TESTTMP/multiple-bases/.hg/strip-backup/dc0947a82db8-b0c1a7ea-rebase.hg |
|
352 | saved backup bundle to $TESTTMP/multiple-bases/.hg/strip-backup/dc0947a82db8-b0c1a7ea-rebase.hg | |
353 | $ hg tglog |
|
353 | $ hg tglog | |
354 | o 2: 2127ae44d291 'Collapsed revision |
|
354 | o 2: 2127ae44d291 'Collapsed revision | |
355 | | * B |
|
355 | | * B | |
356 | | * C' |
|
356 | | * C' | |
357 | o 1: b18e25de2cf5 'D' |
|
357 | o 1: b18e25de2cf5 'D' | |
358 | | |
|
358 | | | |
359 | o 0: 426bada5c675 'A' |
|
359 | o 0: 426bada5c675 'A' | |
360 |
|
360 | |||
361 | $ cd .. |
|
361 | $ cd .. | |
362 |
|
362 | |||
363 | With non-contiguous commits: |
|
363 | With non-contiguous commits: | |
364 |
|
364 | |||
365 | $ hg init non-contiguous |
|
365 | $ hg init non-contiguous | |
366 | $ cd non-contiguous |
|
366 | $ cd non-contiguous | |
367 | $ cat >> .hg/hgrc <<EOF |
|
367 | $ cat >> .hg/hgrc <<EOF | |
368 | > [experimental] |
|
368 | > [experimental] | |
369 | > evolution=all |
|
369 | > evolution=all | |
370 | > EOF |
|
370 | > EOF | |
371 |
|
371 | |||
372 | $ hg debugdrawdag << 'EOF' |
|
372 | $ hg debugdrawdag << 'EOF' | |
373 | > F |
|
373 | > F | |
374 | > | |
|
374 | > | | |
375 | > E |
|
375 | > E | |
376 | > | |
|
376 | > | | |
377 | > D |
|
377 | > D | |
378 | > | |
|
378 | > | | |
379 | > C |
|
379 | > C | |
380 | > | |
|
380 | > | | |
381 | > B G |
|
381 | > B G | |
382 | > |/ |
|
382 | > |/ | |
383 | > A |
|
383 | > A | |
384 | > EOF |
|
384 | > EOF | |
385 |
|
385 | |||
386 | BROKEN: should be allowed |
|
386 | BROKEN: should be allowed | |
387 | $ hg rebase --collapse -r 'B+D+F' -d G |
|
387 | $ hg rebase --collapse -r 'B+D+F' -d G | |
388 | abort: unable to collapse on top of 2, there is more than one external parent: 3, 5 |
|
388 | abort: unable to collapse on top of 2, there is more than one external parent: 3, 5 | |
389 | [255] |
|
389 | [255] | |
390 | $ cd .. |
|
390 | $ cd .. | |
391 |
|
391 | |||
392 |
|
392 | |||
393 | $ hg init multiple-external-parents-2 |
|
393 | $ hg init multiple-external-parents-2 | |
394 | $ cd multiple-external-parents-2 |
|
394 | $ cd multiple-external-parents-2 | |
395 | $ hg debugdrawdag << 'EOF' |
|
395 | $ hg debugdrawdag << 'EOF' | |
396 | > D G |
|
396 | > D G | |
397 | > |\ /| |
|
397 | > |\ /| | |
398 | > B C E F |
|
398 | > B C E F | |
399 | > \| |/ |
|
399 | > \| |/ | |
400 | > \ H / |
|
400 | > \ H / | |
401 | > \|/ |
|
401 | > \|/ | |
402 | > A |
|
402 | > A | |
403 | > EOF |
|
403 | > EOF | |
404 |
|
404 | |||
405 | $ hg rebase --collapse -d H -s 'B+F' |
|
405 | $ hg rebase --collapse -d H -s 'B+F' | |
406 | abort: unable to collapse on top of 5, there is more than one external parent: 1, 3 |
|
406 | abort: unable to collapse on top of 5, there is more than one external parent: 1, 3 | |
407 | [255] |
|
407 | [255] | |
408 | $ cd .. |
|
408 | $ cd .. | |
409 |
|
409 | |||
410 | With internal merge: |
|
410 | With internal merge: | |
411 |
|
411 | |||
412 | $ hg init internal-merge |
|
412 | $ hg init internal-merge | |
413 | $ cd internal-merge |
|
413 | $ cd internal-merge | |
414 |
|
414 | |||
415 | $ hg debugdrawdag << 'EOF' |
|
415 | $ hg debugdrawdag << 'EOF' | |
416 | > E |
|
416 | > E | |
417 | > |\ |
|
417 | > |\ | |
418 | > C D |
|
418 | > C D | |
419 | > |/ |
|
419 | > |/ | |
420 | > F B |
|
420 | > F B | |
421 | > |/ |
|
421 | > |/ | |
422 | > A |
|
422 | > A | |
423 | > EOF |
|
423 | > EOF | |
424 |
|
424 | |||
425 |
|
425 | |||
426 | $ hg rebase -s B --collapse --dest F |
|
426 | $ hg rebase -s B --collapse --dest F | |
427 | rebasing 1:112478962961 B "B" |
|
427 | rebasing 1:112478962961 B "B" | |
428 | rebasing 3:26805aba1e60 C "C" |
|
428 | rebasing 3:26805aba1e60 C "C" | |
429 | rebasing 4:be0ef73c17ad D "D" |
|
429 | rebasing 4:be0ef73c17ad D "D" | |
430 | rebasing 5:02c4367d6973 E tip "E" |
|
430 | rebasing 5:02c4367d6973 E tip "E" | |
431 | saved backup bundle to $TESTTMP/internal-merge/.hg/strip-backup/112478962961-1dfb057b-rebase.hg |
|
431 | saved backup bundle to $TESTTMP/internal-merge/.hg/strip-backup/112478962961-1dfb057b-rebase.hg | |
432 |
|
432 | |||
433 | $ hg tglog |
|
433 | $ hg tglog | |
434 | o 2: c0512a1797b0 'Collapsed revision |
|
434 | o 2: c0512a1797b0 'Collapsed revision | |
435 | | * B |
|
435 | | * B | |
436 | | * C |
|
436 | | * C | |
437 | | * D |
|
437 | | * D | |
438 | | * E' |
|
438 | | * E' | |
439 | o 1: 8908a377a434 'F' |
|
439 | o 1: 8908a377a434 'F' | |
440 | | |
|
440 | | | |
441 | o 0: 426bada5c675 'A' |
|
441 | o 0: 426bada5c675 'A' | |
442 |
|
442 | |||
443 | $ hg manifest --rev tip |
|
443 | $ hg manifest --rev tip | |
444 | A |
|
444 | A | |
445 | B |
|
445 | B | |
446 | C |
|
446 | C | |
447 | D |
|
447 | D | |
448 | F |
|
448 | F | |
449 | $ cd .. |
|
449 | $ cd .. | |
450 |
|
450 | |||
451 | Interactions between collapse and keepbranches |
|
451 | Interactions between collapse and keepbranches | |
452 | $ hg init e |
|
452 | $ hg init e | |
453 | $ cd e |
|
453 | $ cd e | |
454 | $ echo 'a' > a |
|
454 | $ echo 'a' > a | |
455 | $ hg ci -Am 'A' |
|
455 | $ hg ci -Am 'A' | |
456 | adding a |
|
456 | adding a | |
457 |
|
457 | |||
458 | $ hg branch 'one' |
|
458 | $ hg branch 'one' | |
459 | marked working directory as branch one |
|
459 | marked working directory as branch one | |
460 | (branches are permanent and global, did you want a bookmark?) |
|
460 | (branches are permanent and global, did you want a bookmark?) | |
461 | $ echo 'b' > b |
|
461 | $ echo 'b' > b | |
462 | $ hg ci -Am 'B' |
|
462 | $ hg ci -Am 'B' | |
463 | adding b |
|
463 | adding b | |
464 |
|
464 | |||
465 | $ hg branch 'two' |
|
465 | $ hg branch 'two' | |
466 | marked working directory as branch two |
|
466 | marked working directory as branch two | |
467 | $ echo 'c' > c |
|
467 | $ echo 'c' > c | |
468 | $ hg ci -Am 'C' |
|
468 | $ hg ci -Am 'C' | |
469 | adding c |
|
469 | adding c | |
470 |
|
470 | |||
471 | $ hg up -q 0 |
|
471 | $ hg up -q 0 | |
472 | $ echo 'd' > d |
|
472 | $ echo 'd' > d | |
473 | $ hg ci -Am 'D' |
|
473 | $ hg ci -Am 'D' | |
474 | adding d |
|
474 | adding d | |
475 |
|
475 | |||
476 | $ hg tglog |
|
476 | $ hg tglog | |
477 | @ 3: 41acb9dca9eb 'D' |
|
477 | @ 3: 41acb9dca9eb 'D' | |
478 | | |
|
478 | | | |
479 | | o 2: 8ac4a08debf1 'C' two |
|
479 | | o 2: 8ac4a08debf1 'C' two | |
480 | | | |
|
480 | | | | |
481 | | o 1: 1ba175478953 'B' one |
|
481 | | o 1: 1ba175478953 'B' one | |
482 | |/ |
|
482 | |/ | |
483 | o 0: 1994f17a630e 'A' |
|
483 | o 0: 1994f17a630e 'A' | |
484 |
|
484 | |||
485 | $ hg rebase --keepbranches --collapse -s 1 -d 3 |
|
485 | $ hg rebase --keepbranches --collapse -s 1 -d 3 | |
486 | abort: cannot collapse multiple named branches |
|
486 | abort: cannot collapse multiple named branches | |
487 | [255] |
|
487 | [255] | |
488 |
|
488 | |||
489 | $ cd .. |
|
489 | $ cd .. | |
490 |
|
490 | |||
491 | Rebase, collapse and copies |
|
491 | Rebase, collapse and copies | |
492 |
|
492 | |||
493 | $ hg init copies |
|
493 | $ hg init copies | |
494 | $ cd copies |
|
494 | $ cd copies | |
495 | $ hg unbundle "$TESTDIR/bundles/renames.hg" |
|
495 | $ hg unbundle "$TESTDIR/bundles/renames.hg" | |
496 | adding changesets |
|
496 | adding changesets | |
497 | adding manifests |
|
497 | adding manifests | |
498 | adding file changes |
|
498 | adding file changes | |
499 | added 4 changesets with 11 changes to 7 files (+1 heads) |
|
499 | added 4 changesets with 11 changes to 7 files (+1 heads) | |
500 | new changesets f447d5abf5ea:338e84e2e558 (4 drafts) |
|
500 | new changesets f447d5abf5ea:338e84e2e558 (4 drafts) | |
501 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
501 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
502 | $ hg up -q tip |
|
502 | $ hg up -q tip | |
503 | $ hg tglog |
|
503 | $ hg tglog | |
504 | @ 3: 338e84e2e558 'move2' |
|
504 | @ 3: 338e84e2e558 'move2' | |
505 | | |
|
505 | | | |
506 | o 2: 6e7340ee38c0 'move1' |
|
506 | o 2: 6e7340ee38c0 'move1' | |
507 | | |
|
507 | | | |
508 | | o 1: 1352765a01d4 'change' |
|
508 | | o 1: 1352765a01d4 'change' | |
509 | |/ |
|
509 | |/ | |
510 | o 0: f447d5abf5ea 'add' |
|
510 | o 0: f447d5abf5ea 'add' | |
511 |
|
511 | |||
512 | $ hg rebase --collapse -d 1 |
|
512 | $ hg rebase --collapse -d 1 | |
513 | rebasing 2:6e7340ee38c0 "move1" |
|
513 | rebasing 2:6e7340ee38c0 "move1" | |
514 | merging a and d to d |
|
514 | merging a and d to d | |
515 | merging b and e to e |
|
515 | merging b and e to e | |
516 | merging c and f to f |
|
516 | merging c and f to f | |
517 | rebasing 3:338e84e2e558 tip "move2" |
|
517 | rebasing 3:338e84e2e558 tip "move2" | |
518 | merging f and c to c |
|
518 | merging f and c to c | |
519 | merging e and g to g |
|
519 | merging e and g to g | |
520 | saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg |
|
520 | saved backup bundle to $TESTTMP/copies/.hg/strip-backup/6e7340ee38c0-ef8ef003-rebase.hg | |
521 | $ hg st |
|
521 | $ hg st | |
522 | $ hg st --copies --change tip |
|
522 | $ hg st --copies --change tip | |
523 | A d |
|
523 | A d | |
524 | a |
|
524 | a | |
525 | A g |
|
525 | A g | |
526 | b |
|
526 | b | |
527 | R b |
|
527 | R b | |
528 | $ hg up tip -q |
|
528 | $ hg up tip -q | |
529 | $ cat c |
|
529 | $ cat c | |
530 | c |
|
530 | c | |
531 | c |
|
531 | c | |
532 | $ cat d |
|
532 | $ cat d | |
533 | a |
|
533 | a | |
534 | a |
|
534 | a | |
535 | $ cat g |
|
535 | $ cat g | |
536 | b |
|
536 | b | |
537 | b |
|
537 | b | |
538 | $ hg log -r . --template "{file_copies}\n" |
|
538 | $ hg log -r . --template "{file_copies}\n" | |
539 | d (a)g (b) |
|
539 | d (a)g (b) | |
540 |
|
540 | |||
541 | Test collapsing a middle revision in-place |
|
541 | Test collapsing a middle revision in-place | |
542 |
|
542 | |||
543 | $ hg tglog |
|
543 | $ hg tglog | |
544 | @ 2: 64b456429f67 'Collapsed revision |
|
544 | @ 2: 64b456429f67 'Collapsed revision | |
545 | | * move1 |
|
545 | | * move1 | |
546 | | * move2' |
|
546 | | * move2' | |
547 | o 1: 1352765a01d4 'change' |
|
547 | o 1: 1352765a01d4 'change' | |
548 | | |
|
548 | | | |
549 | o 0: f447d5abf5ea 'add' |
|
549 | o 0: f447d5abf5ea 'add' | |
550 |
|
550 | |||
551 | $ hg rebase --collapse -r 1 -d 0 |
|
551 | $ hg rebase --collapse -r 1 -d 0 | |
552 | abort: cannot rebase changeset with children |
|
552 | abort: cannot rebase changeset with children | |
553 | (use --keep to keep original changesets) |
|
553 | (use --keep to keep original changesets) | |
554 |
[ |
|
554 | [10] | |
555 |
|
555 | |||
556 | Test collapsing in place |
|
556 | Test collapsing in place | |
557 |
|
557 | |||
558 | $ hg rebase --collapse -b . -d 0 |
|
558 | $ hg rebase --collapse -b . -d 0 | |
559 | rebasing 1:1352765a01d4 "change" |
|
559 | rebasing 1:1352765a01d4 "change" | |
560 | rebasing 2:64b456429f67 tip "Collapsed revision" |
|
560 | rebasing 2:64b456429f67 tip "Collapsed revision" | |
561 | saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg |
|
561 | saved backup bundle to $TESTTMP/copies/.hg/strip-backup/1352765a01d4-45a352ea-rebase.hg | |
562 | $ hg st --change tip --copies |
|
562 | $ hg st --change tip --copies | |
563 | M a |
|
563 | M a | |
564 | M c |
|
564 | M c | |
565 | A d |
|
565 | A d | |
566 | a |
|
566 | a | |
567 | A g |
|
567 | A g | |
568 | b |
|
568 | b | |
569 | R b |
|
569 | R b | |
570 | $ hg up tip -q |
|
570 | $ hg up tip -q | |
571 | $ cat a |
|
571 | $ cat a | |
572 | a |
|
572 | a | |
573 | a |
|
573 | a | |
574 | $ cat c |
|
574 | $ cat c | |
575 | c |
|
575 | c | |
576 | c |
|
576 | c | |
577 | $ cat d |
|
577 | $ cat d | |
578 | a |
|
578 | a | |
579 | a |
|
579 | a | |
580 | $ cat g |
|
580 | $ cat g | |
581 | b |
|
581 | b | |
582 | b |
|
582 | b | |
583 | $ cd .. |
|
583 | $ cd .. | |
584 |
|
584 | |||
585 |
|
585 | |||
586 | Test stripping a revision with another child |
|
586 | Test stripping a revision with another child | |
587 |
|
587 | |||
588 | $ hg init f |
|
588 | $ hg init f | |
589 | $ cd f |
|
589 | $ cd f | |
590 |
|
590 | |||
591 | $ hg debugdrawdag << 'EOF' |
|
591 | $ hg debugdrawdag << 'EOF' | |
592 | > C B |
|
592 | > C B | |
593 | > |/ |
|
593 | > |/ | |
594 | > A |
|
594 | > A | |
595 | > EOF |
|
595 | > EOF | |
596 |
|
596 | |||
597 | $ hg heads --template="{rev}:{node} {branch}: {desc}\n" |
|
597 | $ hg heads --template="{rev}:{node} {branch}: {desc}\n" | |
598 | 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default: C |
|
598 | 2:dc0947a82db884575bb76ea10ac97b08536bfa03 default: C | |
599 | 1:112478962961147124edd43549aedd1a335e44bf default: B |
|
599 | 1:112478962961147124edd43549aedd1a335e44bf default: B | |
600 |
|
600 | |||
601 | $ hg strip C |
|
601 | $ hg strip C | |
602 | saved backup bundle to $TESTTMP/f/.hg/strip-backup/dc0947a82db8-d21b92a4-backup.hg |
|
602 | saved backup bundle to $TESTTMP/f/.hg/strip-backup/dc0947a82db8-d21b92a4-backup.hg | |
603 |
|
603 | |||
604 | $ hg tglog |
|
604 | $ hg tglog | |
605 | o 1: 112478962961 'B' |
|
605 | o 1: 112478962961 'B' | |
606 | | |
|
606 | | | |
607 | o 0: 426bada5c675 'A' |
|
607 | o 0: 426bada5c675 'A' | |
608 |
|
608 | |||
609 |
|
609 | |||
610 |
|
610 | |||
611 | $ hg heads --template="{rev}:{node} {branch}: {desc}\n" |
|
611 | $ hg heads --template="{rev}:{node} {branch}: {desc}\n" | |
612 | 1:112478962961147124edd43549aedd1a335e44bf default: B |
|
612 | 1:112478962961147124edd43549aedd1a335e44bf default: B | |
613 |
|
613 | |||
614 | $ cd .. |
|
614 | $ cd .. | |
615 |
|
615 | |||
616 | Test collapsing changes that add then remove a file |
|
616 | Test collapsing changes that add then remove a file | |
617 |
|
617 | |||
618 | $ hg init collapseaddremove |
|
618 | $ hg init collapseaddremove | |
619 | $ cd collapseaddremove |
|
619 | $ cd collapseaddremove | |
620 |
|
620 | |||
621 | $ touch base |
|
621 | $ touch base | |
622 | $ hg commit -Am base |
|
622 | $ hg commit -Am base | |
623 | adding base |
|
623 | adding base | |
624 | $ touch a |
|
624 | $ touch a | |
625 | $ hg commit -Am a |
|
625 | $ hg commit -Am a | |
626 | adding a |
|
626 | adding a | |
627 | $ hg rm a |
|
627 | $ hg rm a | |
628 | $ touch b |
|
628 | $ touch b | |
629 | $ hg commit -Am b |
|
629 | $ hg commit -Am b | |
630 | adding b |
|
630 | adding b | |
631 | $ hg book foo |
|
631 | $ hg book foo | |
632 | $ hg rebase -d 0 -r "1::2" --collapse -m collapsed |
|
632 | $ hg rebase -d 0 -r "1::2" --collapse -m collapsed | |
633 | rebasing 1:6d8d9f24eec3 "a" |
|
633 | rebasing 1:6d8d9f24eec3 "a" | |
634 | rebasing 2:1cc73eca5ecc foo tip "b" |
|
634 | rebasing 2:1cc73eca5ecc foo tip "b" | |
635 | saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg |
|
635 | saved backup bundle to $TESTTMP/collapseaddremove/.hg/strip-backup/6d8d9f24eec3-77d3b6e2-rebase.hg | |
636 | $ hg log -G --template "{rev}: '{desc}' {bookmarks}" |
|
636 | $ hg log -G --template "{rev}: '{desc}' {bookmarks}" | |
637 | @ 1: 'collapsed' foo |
|
637 | @ 1: 'collapsed' foo | |
638 | | |
|
638 | | | |
639 | o 0: 'base' |
|
639 | o 0: 'base' | |
640 |
|
640 | |||
641 | $ hg manifest --rev tip |
|
641 | $ hg manifest --rev tip | |
642 | b |
|
642 | b | |
643 | base |
|
643 | base | |
644 |
|
644 | |||
645 | $ cd .. |
|
645 | $ cd .. | |
646 |
|
646 | |||
647 | Test that rebase --collapse will remember message after |
|
647 | Test that rebase --collapse will remember message after | |
648 | running into merge conflict and invoking rebase --continue. |
|
648 | running into merge conflict and invoking rebase --continue. | |
649 |
|
649 | |||
650 | $ hg init collapse_remember_message |
|
650 | $ hg init collapse_remember_message | |
651 | $ cd collapse_remember_message |
|
651 | $ cd collapse_remember_message | |
652 | $ hg debugdrawdag << 'EOF' |
|
652 | $ hg debugdrawdag << 'EOF' | |
653 | > C B # B/A = B\n |
|
653 | > C B # B/A = B\n | |
654 | > |/ # C/A = C\n |
|
654 | > |/ # C/A = C\n | |
655 | > A |
|
655 | > A | |
656 | > EOF |
|
656 | > EOF | |
657 | $ hg rebase --collapse -m "new message" -b B -d C |
|
657 | $ hg rebase --collapse -m "new message" -b B -d C | |
658 | rebasing 1:81e5401e4d37 B "B" |
|
658 | rebasing 1:81e5401e4d37 B "B" | |
659 | merging A |
|
659 | merging A | |
660 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') |
|
660 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') | |
661 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
661 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
662 | [240] |
|
662 | [240] | |
663 | $ rm A.orig |
|
663 | $ rm A.orig | |
664 | $ hg resolve --mark A |
|
664 | $ hg resolve --mark A | |
665 | (no more unresolved files) |
|
665 | (no more unresolved files) | |
666 | continue: hg rebase --continue |
|
666 | continue: hg rebase --continue | |
667 | $ hg rebase --continue |
|
667 | $ hg rebase --continue | |
668 | rebasing 1:81e5401e4d37 B "B" |
|
668 | rebasing 1:81e5401e4d37 B "B" | |
669 | saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/81e5401e4d37-96c3dd30-rebase.hg |
|
669 | saved backup bundle to $TESTTMP/collapse_remember_message/.hg/strip-backup/81e5401e4d37-96c3dd30-rebase.hg | |
670 | $ hg log |
|
670 | $ hg log | |
671 | changeset: 2:17186933e123 |
|
671 | changeset: 2:17186933e123 | |
672 | tag: tip |
|
672 | tag: tip | |
673 | user: test |
|
673 | user: test | |
674 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
674 | date: Thu Jan 01 00:00:00 1970 +0000 | |
675 | summary: new message |
|
675 | summary: new message | |
676 |
|
676 | |||
677 | changeset: 1:043039e9df84 |
|
677 | changeset: 1:043039e9df84 | |
678 | tag: C |
|
678 | tag: C | |
679 | user: test |
|
679 | user: test | |
680 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
680 | date: Thu Jan 01 00:00:00 1970 +0000 | |
681 | summary: C |
|
681 | summary: C | |
682 |
|
682 | |||
683 | changeset: 0:426bada5c675 |
|
683 | changeset: 0:426bada5c675 | |
684 | tag: A |
|
684 | tag: A | |
685 | user: test |
|
685 | user: test | |
686 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
686 | date: Thu Jan 01 00:00:00 1970 +0000 | |
687 | summary: A |
|
687 | summary: A | |
688 |
|
688 | |||
689 | $ cd .. |
|
689 | $ cd .. | |
690 |
|
690 | |||
691 | Test aborted editor on final message |
|
691 | Test aborted editor on final message | |
692 |
|
692 | |||
693 | $ HGMERGE=:merge3 |
|
693 | $ HGMERGE=:merge3 | |
694 | $ export HGMERGE |
|
694 | $ export HGMERGE | |
695 | $ hg init aborted-editor |
|
695 | $ hg init aborted-editor | |
696 | $ cd aborted-editor |
|
696 | $ cd aborted-editor | |
697 | $ hg debugdrawdag << 'EOF' |
|
697 | $ hg debugdrawdag << 'EOF' | |
698 | > C # D/A = D\n |
|
698 | > C # D/A = D\n | |
699 | > | # C/A = C\n |
|
699 | > | # C/A = C\n | |
700 | > B D # B/A = B\n |
|
700 | > B D # B/A = B\n | |
701 | > |/ # A/A = A\n |
|
701 | > |/ # A/A = A\n | |
702 | > A |
|
702 | > A | |
703 | > EOF |
|
703 | > EOF | |
704 | $ hg rebase --collapse -t internal:merge3 -s B -d D |
|
704 | $ hg rebase --collapse -t internal:merge3 -s B -d D | |
705 | rebasing 1:f899f3910ce7 B "B" |
|
705 | rebasing 1:f899f3910ce7 B "B" | |
706 | merging A |
|
706 | merging A | |
707 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') |
|
707 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') | |
708 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
708 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
709 | [240] |
|
709 | [240] | |
710 | $ hg tglog |
|
710 | $ hg tglog | |
711 | o 3: 63668d570d21 'C' |
|
711 | o 3: 63668d570d21 'C' | |
712 | | |
|
712 | | | |
713 | | @ 2: 82b8abf9c185 'D' |
|
713 | | @ 2: 82b8abf9c185 'D' | |
714 | | | |
|
714 | | | | |
715 | % | 1: f899f3910ce7 'B' |
|
715 | % | 1: f899f3910ce7 'B' | |
716 | |/ |
|
716 | |/ | |
717 | o 0: 4a2df7238c3b 'A' |
|
717 | o 0: 4a2df7238c3b 'A' | |
718 |
|
718 | |||
719 | $ cat A |
|
719 | $ cat A | |
720 | <<<<<<< dest: 82b8abf9c185 D - test: D |
|
720 | <<<<<<< dest: 82b8abf9c185 D - test: D | |
721 | D |
|
721 | D | |
722 | ||||||| base |
|
722 | ||||||| base | |
723 | A |
|
723 | A | |
724 | ======= |
|
724 | ======= | |
725 | B |
|
725 | B | |
726 | >>>>>>> source: f899f3910ce7 B - test: B |
|
726 | >>>>>>> source: f899f3910ce7 B - test: B | |
727 | $ echo BC > A |
|
727 | $ echo BC > A | |
728 | $ hg resolve -m |
|
728 | $ hg resolve -m | |
729 | (no more unresolved files) |
|
729 | (no more unresolved files) | |
730 | continue: hg rebase --continue |
|
730 | continue: hg rebase --continue | |
731 | $ hg rebase --continue |
|
731 | $ hg rebase --continue | |
732 | rebasing 1:f899f3910ce7 B "B" |
|
732 | rebasing 1:f899f3910ce7 B "B" | |
733 | rebasing 3:63668d570d21 C tip "C" |
|
733 | rebasing 3:63668d570d21 C tip "C" | |
734 | merging A |
|
734 | merging A | |
735 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') |
|
735 | warning: conflicts while merging A! (edit, then use 'hg resolve --mark') | |
736 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') |
|
736 | unresolved conflicts (see 'hg resolve', then 'hg rebase --continue') | |
737 | [240] |
|
737 | [240] | |
738 | $ hg tglog |
|
738 | $ hg tglog | |
739 | % 3: 63668d570d21 'C' |
|
739 | % 3: 63668d570d21 'C' | |
740 | | |
|
740 | | | |
741 | | @ 2: 82b8abf9c185 'D' |
|
741 | | @ 2: 82b8abf9c185 'D' | |
742 | | | |
|
742 | | | | |
743 | o | 1: f899f3910ce7 'B' |
|
743 | o | 1: f899f3910ce7 'B' | |
744 | |/ |
|
744 | |/ | |
745 | o 0: 4a2df7238c3b 'A' |
|
745 | o 0: 4a2df7238c3b 'A' | |
746 |
|
746 | |||
747 | $ cat A |
|
747 | $ cat A | |
748 | <<<<<<< dest: 82b8abf9c185 D - test: D |
|
748 | <<<<<<< dest: 82b8abf9c185 D - test: D | |
749 | BC |
|
749 | BC | |
750 | ||||||| base |
|
750 | ||||||| base | |
751 | B |
|
751 | B | |
752 | ======= |
|
752 | ======= | |
753 | C |
|
753 | C | |
754 | >>>>>>> source: 63668d570d21 C tip - test: C |
|
754 | >>>>>>> source: 63668d570d21 C tip - test: C | |
755 | $ echo BD > A |
|
755 | $ echo BD > A | |
756 | $ hg resolve -m |
|
756 | $ hg resolve -m | |
757 | (no more unresolved files) |
|
757 | (no more unresolved files) | |
758 | continue: hg rebase --continue |
|
758 | continue: hg rebase --continue | |
759 | $ HGEDITOR=false hg rebase --continue --config ui.interactive=1 |
|
759 | $ HGEDITOR=false hg rebase --continue --config ui.interactive=1 | |
760 | already rebased 1:f899f3910ce7 B "B" as 82b8abf9c185 |
|
760 | already rebased 1:f899f3910ce7 B "B" as 82b8abf9c185 | |
761 | rebasing 3:63668d570d21 C tip "C" |
|
761 | rebasing 3:63668d570d21 C tip "C" | |
762 | abort: edit failed: false exited with status 1 |
|
762 | abort: edit failed: false exited with status 1 | |
763 | [255] |
|
763 | [255] | |
764 | $ hg tglog |
|
764 | $ hg tglog | |
765 | o 3: 63668d570d21 'C' |
|
765 | o 3: 63668d570d21 'C' | |
766 | | |
|
766 | | | |
767 | | @ 2: 82b8abf9c185 'D' |
|
767 | | @ 2: 82b8abf9c185 'D' | |
768 | | | |
|
768 | | | | |
769 | o | 1: f899f3910ce7 'B' |
|
769 | o | 1: f899f3910ce7 'B' | |
770 | |/ |
|
770 | |/ | |
771 | o 0: 4a2df7238c3b 'A' |
|
771 | o 0: 4a2df7238c3b 'A' | |
772 |
|
772 | |||
773 | $ hg rebase --continue |
|
773 | $ hg rebase --continue | |
774 | already rebased 1:f899f3910ce7 B "B" as 82b8abf9c185 |
|
774 | already rebased 1:f899f3910ce7 B "B" as 82b8abf9c185 | |
775 | already rebased 3:63668d570d21 C tip "C" as 82b8abf9c185 |
|
775 | already rebased 3:63668d570d21 C tip "C" as 82b8abf9c185 | |
776 | saved backup bundle to $TESTTMP/aborted-editor/.hg/strip-backup/f899f3910ce7-7cab5e15-rebase.hg |
|
776 | saved backup bundle to $TESTTMP/aborted-editor/.hg/strip-backup/f899f3910ce7-7cab5e15-rebase.hg |
@@ -1,985 +1,985 b'' | |||||
1 | $ cat >> $HGRCPATH <<EOF |
|
1 | $ cat >> $HGRCPATH <<EOF | |
2 | > [extensions] |
|
2 | > [extensions] | |
3 | > rebase= |
|
3 | > rebase= | |
4 | > drawdag=$TESTDIR/drawdag.py |
|
4 | > drawdag=$TESTDIR/drawdag.py | |
5 | > |
|
5 | > | |
6 | > [phases] |
|
6 | > [phases] | |
7 | > publish=False |
|
7 | > publish=False | |
8 | > |
|
8 | > | |
9 | > [alias] |
|
9 | > [alias] | |
10 | > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n" |
|
10 | > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n" | |
11 | > EOF |
|
11 | > EOF | |
12 |
|
12 | |||
13 |
|
13 | |||
14 | $ hg init a |
|
14 | $ hg init a | |
15 | $ cd a |
|
15 | $ cd a | |
16 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" |
|
16 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" | |
17 | adding changesets |
|
17 | adding changesets | |
18 | adding manifests |
|
18 | adding manifests | |
19 | adding file changes |
|
19 | adding file changes | |
20 | added 8 changesets with 7 changes to 7 files (+2 heads) |
|
20 | added 8 changesets with 7 changes to 7 files (+2 heads) | |
21 | new changesets cd010b8cd998:02de42196ebe (8 drafts) |
|
21 | new changesets cd010b8cd998:02de42196ebe (8 drafts) | |
22 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
22 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
23 | $ hg up tip |
|
23 | $ hg up tip | |
24 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
24 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
25 | $ cd .. |
|
25 | $ cd .. | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | Rebasing |
|
28 | Rebasing | |
29 | D onto H - simple rebase: |
|
29 | D onto H - simple rebase: | |
30 | (this also tests that editor is invoked if '--edit' is specified, and that we |
|
30 | (this also tests that editor is invoked if '--edit' is specified, and that we | |
31 | can abort or warn for colliding untracked files) |
|
31 | can abort or warn for colliding untracked files) | |
32 |
|
32 | |||
33 | $ hg clone -q -u . a a1 |
|
33 | $ hg clone -q -u . a a1 | |
34 | $ cd a1 |
|
34 | $ cd a1 | |
35 |
|
35 | |||
36 | $ hg tglog |
|
36 | $ hg tglog | |
37 | @ 7: 02de42196ebe 'H' |
|
37 | @ 7: 02de42196ebe 'H' | |
38 | | |
|
38 | | | |
39 | | o 6: eea13746799a 'G' |
|
39 | | o 6: eea13746799a 'G' | |
40 | |/| |
|
40 | |/| | |
41 | o | 5: 24b6387c8c8c 'F' |
|
41 | o | 5: 24b6387c8c8c 'F' | |
42 | | | |
|
42 | | | | |
43 | | o 4: 9520eea781bc 'E' |
|
43 | | o 4: 9520eea781bc 'E' | |
44 | |/ |
|
44 | |/ | |
45 | | o 3: 32af7686d403 'D' |
|
45 | | o 3: 32af7686d403 'D' | |
46 | | | |
|
46 | | | | |
47 | | o 2: 5fddd98957c8 'C' |
|
47 | | o 2: 5fddd98957c8 'C' | |
48 | | | |
|
48 | | | | |
49 | | o 1: 42ccdea3bb16 'B' |
|
49 | | o 1: 42ccdea3bb16 'B' | |
50 | |/ |
|
50 | |/ | |
51 | o 0: cd010b8cd998 'A' |
|
51 | o 0: cd010b8cd998 'A' | |
52 |
|
52 | |||
53 |
|
53 | |||
54 | $ hg status --rev "3^1" --rev 3 |
|
54 | $ hg status --rev "3^1" --rev 3 | |
55 | A D |
|
55 | A D | |
56 | $ echo collide > D |
|
56 | $ echo collide > D | |
57 | $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn |
|
57 | $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn | |
58 | rebasing 3:32af7686d403 "D" |
|
58 | rebasing 3:32af7686d403 "D" | |
59 | D: replacing untracked file |
|
59 | D: replacing untracked file | |
60 | D |
|
60 | D | |
61 |
|
61 | |||
62 |
|
62 | |||
63 | HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
63 | HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
64 | HG: Leave message empty to abort commit. |
|
64 | HG: Leave message empty to abort commit. | |
65 | HG: -- |
|
65 | HG: -- | |
66 | HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com> |
|
66 | HG: user: Nicolas Dumazet <nicdumz.commits@gmail.com> | |
67 | HG: branch 'default' |
|
67 | HG: branch 'default' | |
68 | HG: added D |
|
68 | HG: added D | |
69 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg |
|
69 | saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg | |
70 | $ cat D.orig |
|
70 | $ cat D.orig | |
71 | collide |
|
71 | collide | |
72 | $ rm D.orig |
|
72 | $ rm D.orig | |
73 |
|
73 | |||
74 | $ hg tglog |
|
74 | $ hg tglog | |
75 | o 7: 1619f02ff7dd 'D' |
|
75 | o 7: 1619f02ff7dd 'D' | |
76 | | |
|
76 | | | |
77 | @ 6: 02de42196ebe 'H' |
|
77 | @ 6: 02de42196ebe 'H' | |
78 | | |
|
78 | | | |
79 | | o 5: eea13746799a 'G' |
|
79 | | o 5: eea13746799a 'G' | |
80 | |/| |
|
80 | |/| | |
81 | o | 4: 24b6387c8c8c 'F' |
|
81 | o | 4: 24b6387c8c8c 'F' | |
82 | | | |
|
82 | | | | |
83 | | o 3: 9520eea781bc 'E' |
|
83 | | o 3: 9520eea781bc 'E' | |
84 | |/ |
|
84 | |/ | |
85 | | o 2: 5fddd98957c8 'C' |
|
85 | | o 2: 5fddd98957c8 'C' | |
86 | | | |
|
86 | | | | |
87 | | o 1: 42ccdea3bb16 'B' |
|
87 | | o 1: 42ccdea3bb16 'B' | |
88 | |/ |
|
88 | |/ | |
89 | o 0: cd010b8cd998 'A' |
|
89 | o 0: cd010b8cd998 'A' | |
90 |
|
90 | |||
91 | $ cd .. |
|
91 | $ cd .. | |
92 |
|
92 | |||
93 |
|
93 | |||
94 | D onto F - intermediate point: |
|
94 | D onto F - intermediate point: | |
95 | (this also tests that editor is not invoked if '--edit' is not specified, and |
|
95 | (this also tests that editor is not invoked if '--edit' is not specified, and | |
96 | that we can ignore for colliding untracked files) |
|
96 | that we can ignore for colliding untracked files) | |
97 |
|
97 | |||
98 | $ hg clone -q -u . a a2 |
|
98 | $ hg clone -q -u . a a2 | |
99 | $ cd a2 |
|
99 | $ cd a2 | |
100 | $ echo collide > D |
|
100 | $ echo collide > D | |
101 |
|
101 | |||
102 | $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore |
|
102 | $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore | |
103 | rebasing 3:32af7686d403 "D" |
|
103 | rebasing 3:32af7686d403 "D" | |
104 | saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg |
|
104 | saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-rebase.hg | |
105 | $ cat D.orig |
|
105 | $ cat D.orig | |
106 | collide |
|
106 | collide | |
107 | $ rm D.orig |
|
107 | $ rm D.orig | |
108 |
|
108 | |||
109 | $ hg tglog |
|
109 | $ hg tglog | |
110 | o 7: 2107530e74ab 'D' |
|
110 | o 7: 2107530e74ab 'D' | |
111 | | |
|
111 | | | |
112 | | @ 6: 02de42196ebe 'H' |
|
112 | | @ 6: 02de42196ebe 'H' | |
113 | |/ |
|
113 | |/ | |
114 | | o 5: eea13746799a 'G' |
|
114 | | o 5: eea13746799a 'G' | |
115 | |/| |
|
115 | |/| | |
116 | o | 4: 24b6387c8c8c 'F' |
|
116 | o | 4: 24b6387c8c8c 'F' | |
117 | | | |
|
117 | | | | |
118 | | o 3: 9520eea781bc 'E' |
|
118 | | o 3: 9520eea781bc 'E' | |
119 | |/ |
|
119 | |/ | |
120 | | o 2: 5fddd98957c8 'C' |
|
120 | | o 2: 5fddd98957c8 'C' | |
121 | | | |
|
121 | | | | |
122 | | o 1: 42ccdea3bb16 'B' |
|
122 | | o 1: 42ccdea3bb16 'B' | |
123 | |/ |
|
123 | |/ | |
124 | o 0: cd010b8cd998 'A' |
|
124 | o 0: cd010b8cd998 'A' | |
125 |
|
125 | |||
126 | $ cd .. |
|
126 | $ cd .. | |
127 |
|
127 | |||
128 |
|
128 | |||
129 | E onto H - skip of G: |
|
129 | E onto H - skip of G: | |
130 | (this also tests that we can overwrite untracked files and don't create backups |
|
130 | (this also tests that we can overwrite untracked files and don't create backups | |
131 | if they have the same contents) |
|
131 | if they have the same contents) | |
132 |
|
132 | |||
133 | $ hg clone -q -u . a a3 |
|
133 | $ hg clone -q -u . a a3 | |
134 | $ cd a3 |
|
134 | $ cd a3 | |
135 | $ hg cat -r 4 E | tee E |
|
135 | $ hg cat -r 4 E | tee E | |
136 | E |
|
136 | E | |
137 |
|
137 | |||
138 | $ hg rebase -s 4 -d 7 |
|
138 | $ hg rebase -s 4 -d 7 | |
139 | rebasing 4:9520eea781bc "E" |
|
139 | rebasing 4:9520eea781bc "E" | |
140 | rebasing 6:eea13746799a "G" |
|
140 | rebasing 6:eea13746799a "G" | |
141 | note: not rebasing 6:eea13746799a "G", its destination already has all its changes |
|
141 | note: not rebasing 6:eea13746799a "G", its destination already has all its changes | |
142 | saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg |
|
142 | saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-rebase.hg | |
143 | $ f E.orig |
|
143 | $ f E.orig | |
144 | E.orig: file not found |
|
144 | E.orig: file not found | |
145 |
|
145 | |||
146 | $ hg tglog |
|
146 | $ hg tglog | |
147 | o 6: 9f8b8ec77260 'E' |
|
147 | o 6: 9f8b8ec77260 'E' | |
148 | | |
|
148 | | | |
149 | @ 5: 02de42196ebe 'H' |
|
149 | @ 5: 02de42196ebe 'H' | |
150 | | |
|
150 | | | |
151 | o 4: 24b6387c8c8c 'F' |
|
151 | o 4: 24b6387c8c8c 'F' | |
152 | | |
|
152 | | | |
153 | | o 3: 32af7686d403 'D' |
|
153 | | o 3: 32af7686d403 'D' | |
154 | | | |
|
154 | | | | |
155 | | o 2: 5fddd98957c8 'C' |
|
155 | | o 2: 5fddd98957c8 'C' | |
156 | | | |
|
156 | | | | |
157 | | o 1: 42ccdea3bb16 'B' |
|
157 | | o 1: 42ccdea3bb16 'B' | |
158 | |/ |
|
158 | |/ | |
159 | o 0: cd010b8cd998 'A' |
|
159 | o 0: cd010b8cd998 'A' | |
160 |
|
160 | |||
161 | $ cd .. |
|
161 | $ cd .. | |
162 |
|
162 | |||
163 |
|
163 | |||
164 | F onto E - rebase of a branching point (skip G): |
|
164 | F onto E - rebase of a branching point (skip G): | |
165 |
|
165 | |||
166 | $ hg clone -q -u . a a4 |
|
166 | $ hg clone -q -u . a a4 | |
167 | $ cd a4 |
|
167 | $ cd a4 | |
168 |
|
168 | |||
169 | $ hg rebase -s 5 -d 4 |
|
169 | $ hg rebase -s 5 -d 4 | |
170 | rebasing 5:24b6387c8c8c "F" |
|
170 | rebasing 5:24b6387c8c8c "F" | |
171 | rebasing 6:eea13746799a "G" |
|
171 | rebasing 6:eea13746799a "G" | |
172 | note: not rebasing 6:eea13746799a "G", its destination already has all its changes |
|
172 | note: not rebasing 6:eea13746799a "G", its destination already has all its changes | |
173 | rebasing 7:02de42196ebe tip "H" |
|
173 | rebasing 7:02de42196ebe tip "H" | |
174 | saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg |
|
174 | saved backup bundle to $TESTTMP/a4/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg | |
175 |
|
175 | |||
176 | $ hg tglog |
|
176 | $ hg tglog | |
177 | @ 6: e9240aeaa6ad 'H' |
|
177 | @ 6: e9240aeaa6ad 'H' | |
178 | | |
|
178 | | | |
179 | o 5: 5d0ccadb6e3e 'F' |
|
179 | o 5: 5d0ccadb6e3e 'F' | |
180 | | |
|
180 | | | |
181 | o 4: 9520eea781bc 'E' |
|
181 | o 4: 9520eea781bc 'E' | |
182 | | |
|
182 | | | |
183 | | o 3: 32af7686d403 'D' |
|
183 | | o 3: 32af7686d403 'D' | |
184 | | | |
|
184 | | | | |
185 | | o 2: 5fddd98957c8 'C' |
|
185 | | o 2: 5fddd98957c8 'C' | |
186 | | | |
|
186 | | | | |
187 | | o 1: 42ccdea3bb16 'B' |
|
187 | | o 1: 42ccdea3bb16 'B' | |
188 | |/ |
|
188 | |/ | |
189 | o 0: cd010b8cd998 'A' |
|
189 | o 0: cd010b8cd998 'A' | |
190 |
|
190 | |||
191 | $ cd .. |
|
191 | $ cd .. | |
192 |
|
192 | |||
193 |
|
193 | |||
194 | G onto H - merged revision having a parent in ancestors of target: |
|
194 | G onto H - merged revision having a parent in ancestors of target: | |
195 |
|
195 | |||
196 | $ hg clone -q -u . a a5 |
|
196 | $ hg clone -q -u . a a5 | |
197 | $ cd a5 |
|
197 | $ cd a5 | |
198 |
|
198 | |||
199 | $ hg rebase -s 6 -d 7 |
|
199 | $ hg rebase -s 6 -d 7 | |
200 | rebasing 6:eea13746799a "G" |
|
200 | rebasing 6:eea13746799a "G" | |
201 | saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-rebase.hg |
|
201 | saved backup bundle to $TESTTMP/a5/.hg/strip-backup/eea13746799a-883828ed-rebase.hg | |
202 |
|
202 | |||
203 | $ hg tglog |
|
203 | $ hg tglog | |
204 | o 7: 397834907a90 'G' |
|
204 | o 7: 397834907a90 'G' | |
205 | |\ |
|
205 | |\ | |
206 | | @ 6: 02de42196ebe 'H' |
|
206 | | @ 6: 02de42196ebe 'H' | |
207 | | | |
|
207 | | | | |
208 | | o 5: 24b6387c8c8c 'F' |
|
208 | | o 5: 24b6387c8c8c 'F' | |
209 | | | |
|
209 | | | | |
210 | o | 4: 9520eea781bc 'E' |
|
210 | o | 4: 9520eea781bc 'E' | |
211 | |/ |
|
211 | |/ | |
212 | | o 3: 32af7686d403 'D' |
|
212 | | o 3: 32af7686d403 'D' | |
213 | | | |
|
213 | | | | |
214 | | o 2: 5fddd98957c8 'C' |
|
214 | | o 2: 5fddd98957c8 'C' | |
215 | | | |
|
215 | | | | |
216 | | o 1: 42ccdea3bb16 'B' |
|
216 | | o 1: 42ccdea3bb16 'B' | |
217 | |/ |
|
217 | |/ | |
218 | o 0: cd010b8cd998 'A' |
|
218 | o 0: cd010b8cd998 'A' | |
219 |
|
219 | |||
220 | $ cd .. |
|
220 | $ cd .. | |
221 |
|
221 | |||
222 |
|
222 | |||
223 | F onto B - G maintains E as parent: |
|
223 | F onto B - G maintains E as parent: | |
224 |
|
224 | |||
225 | $ hg clone -q -u . a a6 |
|
225 | $ hg clone -q -u . a a6 | |
226 | $ cd a6 |
|
226 | $ cd a6 | |
227 |
|
227 | |||
228 | $ hg rebase -s 5 -d 1 |
|
228 | $ hg rebase -s 5 -d 1 | |
229 | rebasing 5:24b6387c8c8c "F" |
|
229 | rebasing 5:24b6387c8c8c "F" | |
230 | rebasing 6:eea13746799a "G" |
|
230 | rebasing 6:eea13746799a "G" | |
231 | rebasing 7:02de42196ebe tip "H" |
|
231 | rebasing 7:02de42196ebe tip "H" | |
232 | saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg |
|
232 | saved backup bundle to $TESTTMP/a6/.hg/strip-backup/24b6387c8c8c-c3fe765d-rebase.hg | |
233 |
|
233 | |||
234 | $ hg tglog |
|
234 | $ hg tglog | |
235 | @ 7: c87be72f9641 'H' |
|
235 | @ 7: c87be72f9641 'H' | |
236 | | |
|
236 | | | |
237 | | o 6: 17badd73d4f1 'G' |
|
237 | | o 6: 17badd73d4f1 'G' | |
238 | |/| |
|
238 | |/| | |
239 | o | 5: 74fb9ed646c4 'F' |
|
239 | o | 5: 74fb9ed646c4 'F' | |
240 | | | |
|
240 | | | | |
241 | | o 4: 9520eea781bc 'E' |
|
241 | | o 4: 9520eea781bc 'E' | |
242 | | | |
|
242 | | | | |
243 | | | o 3: 32af7686d403 'D' |
|
243 | | | o 3: 32af7686d403 'D' | |
244 | | | | |
|
244 | | | | | |
245 | +---o 2: 5fddd98957c8 'C' |
|
245 | +---o 2: 5fddd98957c8 'C' | |
246 | | | |
|
246 | | | | |
247 | o | 1: 42ccdea3bb16 'B' |
|
247 | o | 1: 42ccdea3bb16 'B' | |
248 | |/ |
|
248 | |/ | |
249 | o 0: cd010b8cd998 'A' |
|
249 | o 0: cd010b8cd998 'A' | |
250 |
|
250 | |||
251 | $ cd .. |
|
251 | $ cd .. | |
252 |
|
252 | |||
253 |
|
253 | |||
254 | These will fail (using --source): |
|
254 | These will fail (using --source): | |
255 |
|
255 | |||
256 | G onto F - rebase onto an ancestor: |
|
256 | G onto F - rebase onto an ancestor: | |
257 |
|
257 | |||
258 | $ hg clone -q -u . a a7 |
|
258 | $ hg clone -q -u . a a7 | |
259 | $ cd a7 |
|
259 | $ cd a7 | |
260 |
|
260 | |||
261 | $ hg rebase -s 6 -d 5 |
|
261 | $ hg rebase -s 6 -d 5 | |
262 | nothing to rebase |
|
262 | nothing to rebase | |
263 | [1] |
|
263 | [1] | |
264 |
|
264 | |||
265 | F onto G - rebase onto a descendant: |
|
265 | F onto G - rebase onto a descendant: | |
266 |
|
266 | |||
267 | $ hg rebase -s 5 -d 6 |
|
267 | $ hg rebase -s 5 -d 6 | |
268 | abort: source and destination form a cycle |
|
268 | abort: source and destination form a cycle | |
269 | [255] |
|
269 | [255] | |
270 |
|
270 | |||
271 | G onto B - merge revision with both parents not in ancestors of target: |
|
271 | G onto B - merge revision with both parents not in ancestors of target: | |
272 |
|
272 | |||
273 | $ hg rebase -s 6 -d 1 |
|
273 | $ hg rebase -s 6 -d 1 | |
274 | rebasing 6:eea13746799a "G" |
|
274 | rebasing 6:eea13746799a "G" | |
275 | abort: cannot rebase 6:eea13746799a without moving at least one of its parents |
|
275 | abort: cannot rebase 6:eea13746799a without moving at least one of its parents | |
276 | [255] |
|
276 | [255] | |
277 | $ hg rebase --abort |
|
277 | $ hg rebase --abort | |
278 | rebase aborted |
|
278 | rebase aborted | |
279 |
|
279 | |||
280 | These will abort gracefully (using --base): |
|
280 | These will abort gracefully (using --base): | |
281 |
|
281 | |||
282 | G onto G - rebase onto same changeset: |
|
282 | G onto G - rebase onto same changeset: | |
283 |
|
283 | |||
284 | $ hg rebase -b 6 -d 6 |
|
284 | $ hg rebase -b 6 -d 6 | |
285 | nothing to rebase - eea13746799a is both "base" and destination |
|
285 | nothing to rebase - eea13746799a is both "base" and destination | |
286 | [1] |
|
286 | [1] | |
287 |
|
287 | |||
288 | G onto F - rebase onto an ancestor: |
|
288 | G onto F - rebase onto an ancestor: | |
289 |
|
289 | |||
290 | $ hg rebase -b 6 -d 5 |
|
290 | $ hg rebase -b 6 -d 5 | |
291 | nothing to rebase |
|
291 | nothing to rebase | |
292 | [1] |
|
292 | [1] | |
293 |
|
293 | |||
294 | F onto G - rebase onto a descendant: |
|
294 | F onto G - rebase onto a descendant: | |
295 |
|
295 | |||
296 | $ hg rebase -b 5 -d 6 |
|
296 | $ hg rebase -b 5 -d 6 | |
297 | nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a |
|
297 | nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a | |
298 | [1] |
|
298 | [1] | |
299 |
|
299 | |||
300 | C onto A - rebase onto an ancestor: |
|
300 | C onto A - rebase onto an ancestor: | |
301 |
|
301 | |||
302 | $ hg rebase -d 0 -s 2 |
|
302 | $ hg rebase -d 0 -s 2 | |
303 | rebasing 2:5fddd98957c8 "C" |
|
303 | rebasing 2:5fddd98957c8 "C" | |
304 | rebasing 3:32af7686d403 "D" |
|
304 | rebasing 3:32af7686d403 "D" | |
305 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg |
|
305 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/5fddd98957c8-f9244fa1-rebase.hg | |
306 | $ hg tglog |
|
306 | $ hg tglog | |
307 | o 7: c9659aac0000 'D' |
|
307 | o 7: c9659aac0000 'D' | |
308 | | |
|
308 | | | |
309 | o 6: e1c4361dd923 'C' |
|
309 | o 6: e1c4361dd923 'C' | |
310 | | |
|
310 | | | |
311 | | @ 5: 02de42196ebe 'H' |
|
311 | | @ 5: 02de42196ebe 'H' | |
312 | | | |
|
312 | | | | |
313 | | | o 4: eea13746799a 'G' |
|
313 | | | o 4: eea13746799a 'G' | |
314 | | |/| |
|
314 | | |/| | |
315 | | o | 3: 24b6387c8c8c 'F' |
|
315 | | o | 3: 24b6387c8c8c 'F' | |
316 | |/ / |
|
316 | |/ / | |
317 | | o 2: 9520eea781bc 'E' |
|
317 | | o 2: 9520eea781bc 'E' | |
318 | |/ |
|
318 | |/ | |
319 | | o 1: 42ccdea3bb16 'B' |
|
319 | | o 1: 42ccdea3bb16 'B' | |
320 | |/ |
|
320 | |/ | |
321 | o 0: cd010b8cd998 'A' |
|
321 | o 0: cd010b8cd998 'A' | |
322 |
|
322 | |||
323 |
|
323 | |||
324 | Check rebasing public changeset |
|
324 | Check rebasing public changeset | |
325 |
|
325 | |||
326 | $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6 |
|
326 | $ hg pull --config phases.publish=True -q -r 6 . # update phase of 6 | |
327 | $ hg rebase -d 0 -b 6 |
|
327 | $ hg rebase -d 0 -b 6 | |
328 | abort: cannot rebase public changesets |
|
328 | abort: cannot rebase public changesets | |
329 | (see 'hg help phases' for details) |
|
329 | (see 'hg help phases' for details) | |
330 |
[ |
|
330 | [10] | |
331 | $ hg rebase -d 5 -b 6 |
|
331 | $ hg rebase -d 5 -b 6 | |
332 | abort: cannot rebase public changesets |
|
332 | abort: cannot rebase public changesets | |
333 | (see 'hg help phases' for details) |
|
333 | (see 'hg help phases' for details) | |
334 |
[ |
|
334 | [10] | |
335 | $ hg rebase -d 5 -r '1 + (6::)' |
|
335 | $ hg rebase -d 5 -r '1 + (6::)' | |
336 | abort: cannot rebase public changesets |
|
336 | abort: cannot rebase public changesets | |
337 | (see 'hg help phases' for details) |
|
337 | (see 'hg help phases' for details) | |
338 |
[ |
|
338 | [10] | |
339 |
|
339 | |||
340 | $ hg rebase -d 5 -b 6 --keep |
|
340 | $ hg rebase -d 5 -b 6 --keep | |
341 | rebasing 6:e1c4361dd923 "C" |
|
341 | rebasing 6:e1c4361dd923 "C" | |
342 | rebasing 7:c9659aac0000 tip "D" |
|
342 | rebasing 7:c9659aac0000 tip "D" | |
343 |
|
343 | |||
344 | Check rebasing mutable changeset |
|
344 | Check rebasing mutable changeset | |
345 | Source phase greater or equal to destination phase: new changeset get the phase of source: |
|
345 | Source phase greater or equal to destination phase: new changeset get the phase of source: | |
346 | $ hg id -n |
|
346 | $ hg id -n | |
347 | 5 |
|
347 | 5 | |
348 | $ hg rebase -s9 -d0 |
|
348 | $ hg rebase -s9 -d0 | |
349 | rebasing 9:2b23e52411f4 tip "D" |
|
349 | rebasing 9:2b23e52411f4 tip "D" | |
350 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg |
|
350 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg | |
351 | $ hg id -n # check we updated back to parent |
|
351 | $ hg id -n # check we updated back to parent | |
352 | 5 |
|
352 | 5 | |
353 | $ hg log --template "{phase}\n" -r 9 |
|
353 | $ hg log --template "{phase}\n" -r 9 | |
354 | draft |
|
354 | draft | |
355 | $ hg rebase -s9 -d1 |
|
355 | $ hg rebase -s9 -d1 | |
356 | rebasing 9:2cb10d0cfc6c tip "D" |
|
356 | rebasing 9:2cb10d0cfc6c tip "D" | |
357 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg |
|
357 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg | |
358 | $ hg log --template "{phase}\n" -r 9 |
|
358 | $ hg log --template "{phase}\n" -r 9 | |
359 | draft |
|
359 | draft | |
360 | $ hg phase --force --secret 9 |
|
360 | $ hg phase --force --secret 9 | |
361 | $ hg rebase -s9 -d0 |
|
361 | $ hg rebase -s9 -d0 | |
362 | rebasing 9:c5b12b67163a tip "D" |
|
362 | rebasing 9:c5b12b67163a tip "D" | |
363 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg |
|
363 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg | |
364 | $ hg log --template "{phase}\n" -r 9 |
|
364 | $ hg log --template "{phase}\n" -r 9 | |
365 | secret |
|
365 | secret | |
366 | $ hg rebase -s9 -d1 |
|
366 | $ hg rebase -s9 -d1 | |
367 | rebasing 9:2a0524f868ac tip "D" |
|
367 | rebasing 9:2a0524f868ac tip "D" | |
368 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg |
|
368 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg | |
369 | $ hg log --template "{phase}\n" -r 9 |
|
369 | $ hg log --template "{phase}\n" -r 9 | |
370 | secret |
|
370 | secret | |
371 | Source phase lower than destination phase: new changeset get the phase of destination: |
|
371 | Source phase lower than destination phase: new changeset get the phase of destination: | |
372 | $ hg rebase -s8 -d9 |
|
372 | $ hg rebase -s8 -d9 | |
373 | rebasing 8:6d4f22462821 "C" |
|
373 | rebasing 8:6d4f22462821 "C" | |
374 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg |
|
374 | saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg | |
375 | $ hg log --template "{phase}\n" -r 'rev(9)' |
|
375 | $ hg log --template "{phase}\n" -r 'rev(9)' | |
376 | secret |
|
376 | secret | |
377 |
|
377 | |||
378 | $ cd .. |
|
378 | $ cd .. | |
379 |
|
379 | |||
380 | Check that temporary bundle doesn't lose phase when not using generaldelta |
|
380 | Check that temporary bundle doesn't lose phase when not using generaldelta | |
381 |
|
381 | |||
382 | $ hg --config format.usegeneraldelta=no init issue5678 |
|
382 | $ hg --config format.usegeneraldelta=no init issue5678 | |
383 | $ cd issue5678 |
|
383 | $ cd issue5678 | |
384 | $ grep generaldelta .hg/requires |
|
384 | $ grep generaldelta .hg/requires | |
385 | [1] |
|
385 | [1] | |
386 | $ echo a > a |
|
386 | $ echo a > a | |
387 | $ hg ci -Aqm a |
|
387 | $ hg ci -Aqm a | |
388 | $ echo b > b |
|
388 | $ echo b > b | |
389 | $ hg ci -Aqm b |
|
389 | $ hg ci -Aqm b | |
390 | $ hg co -q '.^' |
|
390 | $ hg co -q '.^' | |
391 | $ echo c > c |
|
391 | $ echo c > c | |
392 | $ hg ci -Aqm c |
|
392 | $ hg ci -Aqm c | |
393 | $ hg phase --public |
|
393 | $ hg phase --public | |
394 | $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n' |
|
394 | $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n' | |
395 | @ 2:d36c public c |
|
395 | @ 2:d36c public c | |
396 | | |
|
396 | | | |
397 | | o 1:d2ae draft b |
|
397 | | o 1:d2ae draft b | |
398 | |/ |
|
398 | |/ | |
399 | o 0:cb9a public a |
|
399 | o 0:cb9a public a | |
400 |
|
400 | |||
401 | $ hg rebase -s 1 -d 2 |
|
401 | $ hg rebase -s 1 -d 2 | |
402 | rebasing 1:d2ae7f538514 "b" |
|
402 | rebasing 1:d2ae7f538514 "b" | |
403 | saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg |
|
403 | saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg | |
404 | $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n' |
|
404 | $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n' | |
405 | o 2:c882 draft b |
|
405 | o 2:c882 draft b | |
406 | | |
|
406 | | | |
407 | @ 1:d36c public c |
|
407 | @ 1:d36c public c | |
408 | | |
|
408 | | | |
409 | o 0:cb9a public a |
|
409 | o 0:cb9a public a | |
410 |
|
410 | |||
411 | $ cd .. |
|
411 | $ cd .. | |
412 |
|
412 | |||
413 | Test for revset |
|
413 | Test for revset | |
414 |
|
414 | |||
415 | We need a bit different graph |
|
415 | We need a bit different graph | |
416 | All destination are B |
|
416 | All destination are B | |
417 |
|
417 | |||
418 | $ hg init ah |
|
418 | $ hg init ah | |
419 | $ cd ah |
|
419 | $ cd ah | |
420 | $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg" |
|
420 | $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg" | |
421 | adding changesets |
|
421 | adding changesets | |
422 | adding manifests |
|
422 | adding manifests | |
423 | adding file changes |
|
423 | adding file changes | |
424 | added 9 changesets with 9 changes to 9 files (+2 heads) |
|
424 | added 9 changesets with 9 changes to 9 files (+2 heads) | |
425 | new changesets 9ae2ed22e576:479ddb54a924 (9 drafts) |
|
425 | new changesets 9ae2ed22e576:479ddb54a924 (9 drafts) | |
426 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
426 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
427 | $ hg tglog |
|
427 | $ hg tglog | |
428 | o 8: 479ddb54a924 'I' |
|
428 | o 8: 479ddb54a924 'I' | |
429 | | |
|
429 | | | |
430 | o 7: 72434a4e60b0 'H' |
|
430 | o 7: 72434a4e60b0 'H' | |
431 | | |
|
431 | | | |
432 | o 6: 3d8a618087a7 'G' |
|
432 | o 6: 3d8a618087a7 'G' | |
433 | | |
|
433 | | | |
434 | | o 5: 41bfcc75ed73 'F' |
|
434 | | o 5: 41bfcc75ed73 'F' | |
435 | | | |
|
435 | | | | |
436 | | o 4: c01897464e7f 'E' |
|
436 | | o 4: c01897464e7f 'E' | |
437 | |/ |
|
437 | |/ | |
438 | o 3: ffd453c31098 'D' |
|
438 | o 3: ffd453c31098 'D' | |
439 | | |
|
439 | | | |
440 | o 2: c9e50f6cdc55 'C' |
|
440 | o 2: c9e50f6cdc55 'C' | |
441 | | |
|
441 | | | |
442 | | o 1: 8fd0f7e49f53 'B' |
|
442 | | o 1: 8fd0f7e49f53 'B' | |
443 | |/ |
|
443 | |/ | |
444 | o 0: 9ae2ed22e576 'A' |
|
444 | o 0: 9ae2ed22e576 'A' | |
445 |
|
445 | |||
446 | $ cd .. |
|
446 | $ cd .. | |
447 |
|
447 | |||
448 |
|
448 | |||
449 | Simple case with keep: |
|
449 | Simple case with keep: | |
450 |
|
450 | |||
451 | Source on have two descendant heads but ask for one |
|
451 | Source on have two descendant heads but ask for one | |
452 |
|
452 | |||
453 | $ hg clone -q -u . ah ah1 |
|
453 | $ hg clone -q -u . ah ah1 | |
454 | $ cd ah1 |
|
454 | $ cd ah1 | |
455 | $ hg rebase -r '2::8' -d 1 |
|
455 | $ hg rebase -r '2::8' -d 1 | |
456 | abort: cannot rebase changeset with children |
|
456 | abort: cannot rebase changeset with children | |
457 | (use --keep to keep original changesets) |
|
457 | (use --keep to keep original changesets) | |
458 |
[ |
|
458 | [10] | |
459 | $ hg rebase -r '2::8' -d 1 -k |
|
459 | $ hg rebase -r '2::8' -d 1 -k | |
460 | rebasing 2:c9e50f6cdc55 "C" |
|
460 | rebasing 2:c9e50f6cdc55 "C" | |
461 | rebasing 3:ffd453c31098 "D" |
|
461 | rebasing 3:ffd453c31098 "D" | |
462 | rebasing 6:3d8a618087a7 "G" |
|
462 | rebasing 6:3d8a618087a7 "G" | |
463 | rebasing 7:72434a4e60b0 "H" |
|
463 | rebasing 7:72434a4e60b0 "H" | |
464 | rebasing 8:479ddb54a924 tip "I" |
|
464 | rebasing 8:479ddb54a924 tip "I" | |
465 | $ hg tglog |
|
465 | $ hg tglog | |
466 | o 13: 9bf1d9358a90 'I' |
|
466 | o 13: 9bf1d9358a90 'I' | |
467 | | |
|
467 | | | |
468 | o 12: 274623a778d4 'H' |
|
468 | o 12: 274623a778d4 'H' | |
469 | | |
|
469 | | | |
470 | o 11: ab8c8617c8e8 'G' |
|
470 | o 11: ab8c8617c8e8 'G' | |
471 | | |
|
471 | | | |
472 | o 10: c8cbf59f70da 'D' |
|
472 | o 10: c8cbf59f70da 'D' | |
473 | | |
|
473 | | | |
474 | o 9: 563e4faab485 'C' |
|
474 | o 9: 563e4faab485 'C' | |
475 | | |
|
475 | | | |
476 | | o 8: 479ddb54a924 'I' |
|
476 | | o 8: 479ddb54a924 'I' | |
477 | | | |
|
477 | | | | |
478 | | o 7: 72434a4e60b0 'H' |
|
478 | | o 7: 72434a4e60b0 'H' | |
479 | | | |
|
479 | | | | |
480 | | o 6: 3d8a618087a7 'G' |
|
480 | | o 6: 3d8a618087a7 'G' | |
481 | | | |
|
481 | | | | |
482 | | | o 5: 41bfcc75ed73 'F' |
|
482 | | | o 5: 41bfcc75ed73 'F' | |
483 | | | | |
|
483 | | | | | |
484 | | | o 4: c01897464e7f 'E' |
|
484 | | | o 4: c01897464e7f 'E' | |
485 | | |/ |
|
485 | | |/ | |
486 | | o 3: ffd453c31098 'D' |
|
486 | | o 3: ffd453c31098 'D' | |
487 | | | |
|
487 | | | | |
488 | | o 2: c9e50f6cdc55 'C' |
|
488 | | o 2: c9e50f6cdc55 'C' | |
489 | | | |
|
489 | | | | |
490 | o | 1: 8fd0f7e49f53 'B' |
|
490 | o | 1: 8fd0f7e49f53 'B' | |
491 | |/ |
|
491 | |/ | |
492 | o 0: 9ae2ed22e576 'A' |
|
492 | o 0: 9ae2ed22e576 'A' | |
493 |
|
493 | |||
494 |
|
494 | |||
495 | $ cd .. |
|
495 | $ cd .. | |
496 |
|
496 | |||
497 | Base on have one descendant heads we ask for but common ancestor have two |
|
497 | Base on have one descendant heads we ask for but common ancestor have two | |
498 |
|
498 | |||
499 | $ hg clone -q -u . ah ah2 |
|
499 | $ hg clone -q -u . ah ah2 | |
500 | $ cd ah2 |
|
500 | $ cd ah2 | |
501 | $ hg rebase -r '3::8' -d 1 |
|
501 | $ hg rebase -r '3::8' -d 1 | |
502 | abort: cannot rebase changeset with children |
|
502 | abort: cannot rebase changeset with children | |
503 | (use --keep to keep original changesets) |
|
503 | (use --keep to keep original changesets) | |
504 |
[ |
|
504 | [10] | |
505 | $ hg rebase -r '3::8' -d 1 --keep |
|
505 | $ hg rebase -r '3::8' -d 1 --keep | |
506 | rebasing 3:ffd453c31098 "D" |
|
506 | rebasing 3:ffd453c31098 "D" | |
507 | rebasing 6:3d8a618087a7 "G" |
|
507 | rebasing 6:3d8a618087a7 "G" | |
508 | rebasing 7:72434a4e60b0 "H" |
|
508 | rebasing 7:72434a4e60b0 "H" | |
509 | rebasing 8:479ddb54a924 tip "I" |
|
509 | rebasing 8:479ddb54a924 tip "I" | |
510 | $ hg tglog |
|
510 | $ hg tglog | |
511 | o 12: 9d7da0053b1c 'I' |
|
511 | o 12: 9d7da0053b1c 'I' | |
512 | | |
|
512 | | | |
513 | o 11: 8fbd00952cbc 'H' |
|
513 | o 11: 8fbd00952cbc 'H' | |
514 | | |
|
514 | | | |
515 | o 10: 51d434a615ee 'G' |
|
515 | o 10: 51d434a615ee 'G' | |
516 | | |
|
516 | | | |
517 | o 9: a9c125634b0b 'D' |
|
517 | o 9: a9c125634b0b 'D' | |
518 | | |
|
518 | | | |
519 | | o 8: 479ddb54a924 'I' |
|
519 | | o 8: 479ddb54a924 'I' | |
520 | | | |
|
520 | | | | |
521 | | o 7: 72434a4e60b0 'H' |
|
521 | | o 7: 72434a4e60b0 'H' | |
522 | | | |
|
522 | | | | |
523 | | o 6: 3d8a618087a7 'G' |
|
523 | | o 6: 3d8a618087a7 'G' | |
524 | | | |
|
524 | | | | |
525 | | | o 5: 41bfcc75ed73 'F' |
|
525 | | | o 5: 41bfcc75ed73 'F' | |
526 | | | | |
|
526 | | | | | |
527 | | | o 4: c01897464e7f 'E' |
|
527 | | | o 4: c01897464e7f 'E' | |
528 | | |/ |
|
528 | | |/ | |
529 | | o 3: ffd453c31098 'D' |
|
529 | | o 3: ffd453c31098 'D' | |
530 | | | |
|
530 | | | | |
531 | | o 2: c9e50f6cdc55 'C' |
|
531 | | o 2: c9e50f6cdc55 'C' | |
532 | | | |
|
532 | | | | |
533 | o | 1: 8fd0f7e49f53 'B' |
|
533 | o | 1: 8fd0f7e49f53 'B' | |
534 | |/ |
|
534 | |/ | |
535 | o 0: 9ae2ed22e576 'A' |
|
535 | o 0: 9ae2ed22e576 'A' | |
536 |
|
536 | |||
537 |
|
537 | |||
538 | $ cd .. |
|
538 | $ cd .. | |
539 |
|
539 | |||
540 | rebase subset |
|
540 | rebase subset | |
541 |
|
541 | |||
542 | $ hg clone -q -u . ah ah3 |
|
542 | $ hg clone -q -u . ah ah3 | |
543 | $ cd ah3 |
|
543 | $ cd ah3 | |
544 | $ hg rebase -r '3::7' -d 1 |
|
544 | $ hg rebase -r '3::7' -d 1 | |
545 | abort: cannot rebase changeset with children |
|
545 | abort: cannot rebase changeset with children | |
546 | (use --keep to keep original changesets) |
|
546 | (use --keep to keep original changesets) | |
547 |
[ |
|
547 | [10] | |
548 | $ hg rebase -r '3::7' -d 1 --keep |
|
548 | $ hg rebase -r '3::7' -d 1 --keep | |
549 | rebasing 3:ffd453c31098 "D" |
|
549 | rebasing 3:ffd453c31098 "D" | |
550 | rebasing 6:3d8a618087a7 "G" |
|
550 | rebasing 6:3d8a618087a7 "G" | |
551 | rebasing 7:72434a4e60b0 "H" |
|
551 | rebasing 7:72434a4e60b0 "H" | |
552 | $ hg tglog |
|
552 | $ hg tglog | |
553 | o 11: 8fbd00952cbc 'H' |
|
553 | o 11: 8fbd00952cbc 'H' | |
554 | | |
|
554 | | | |
555 | o 10: 51d434a615ee 'G' |
|
555 | o 10: 51d434a615ee 'G' | |
556 | | |
|
556 | | | |
557 | o 9: a9c125634b0b 'D' |
|
557 | o 9: a9c125634b0b 'D' | |
558 | | |
|
558 | | | |
559 | | o 8: 479ddb54a924 'I' |
|
559 | | o 8: 479ddb54a924 'I' | |
560 | | | |
|
560 | | | | |
561 | | o 7: 72434a4e60b0 'H' |
|
561 | | o 7: 72434a4e60b0 'H' | |
562 | | | |
|
562 | | | | |
563 | | o 6: 3d8a618087a7 'G' |
|
563 | | o 6: 3d8a618087a7 'G' | |
564 | | | |
|
564 | | | | |
565 | | | o 5: 41bfcc75ed73 'F' |
|
565 | | | o 5: 41bfcc75ed73 'F' | |
566 | | | | |
|
566 | | | | | |
567 | | | o 4: c01897464e7f 'E' |
|
567 | | | o 4: c01897464e7f 'E' | |
568 | | |/ |
|
568 | | |/ | |
569 | | o 3: ffd453c31098 'D' |
|
569 | | o 3: ffd453c31098 'D' | |
570 | | | |
|
570 | | | | |
571 | | o 2: c9e50f6cdc55 'C' |
|
571 | | o 2: c9e50f6cdc55 'C' | |
572 | | | |
|
572 | | | | |
573 | o | 1: 8fd0f7e49f53 'B' |
|
573 | o | 1: 8fd0f7e49f53 'B' | |
574 | |/ |
|
574 | |/ | |
575 | o 0: 9ae2ed22e576 'A' |
|
575 | o 0: 9ae2ed22e576 'A' | |
576 |
|
576 | |||
577 |
|
577 | |||
578 | $ cd .. |
|
578 | $ cd .. | |
579 |
|
579 | |||
580 | rebase subset with multiple head |
|
580 | rebase subset with multiple head | |
581 |
|
581 | |||
582 | $ hg clone -q -u . ah ah4 |
|
582 | $ hg clone -q -u . ah ah4 | |
583 | $ cd ah4 |
|
583 | $ cd ah4 | |
584 | $ hg rebase -r '3::(7+5)' -d 1 |
|
584 | $ hg rebase -r '3::(7+5)' -d 1 | |
585 | abort: cannot rebase changeset with children |
|
585 | abort: cannot rebase changeset with children | |
586 | (use --keep to keep original changesets) |
|
586 | (use --keep to keep original changesets) | |
587 |
[ |
|
587 | [10] | |
588 | $ hg rebase -r '3::(7+5)' -d 1 --keep |
|
588 | $ hg rebase -r '3::(7+5)' -d 1 --keep | |
589 | rebasing 3:ffd453c31098 "D" |
|
589 | rebasing 3:ffd453c31098 "D" | |
590 | rebasing 4:c01897464e7f "E" |
|
590 | rebasing 4:c01897464e7f "E" | |
591 | rebasing 5:41bfcc75ed73 "F" |
|
591 | rebasing 5:41bfcc75ed73 "F" | |
592 | rebasing 6:3d8a618087a7 "G" |
|
592 | rebasing 6:3d8a618087a7 "G" | |
593 | rebasing 7:72434a4e60b0 "H" |
|
593 | rebasing 7:72434a4e60b0 "H" | |
594 | $ hg tglog |
|
594 | $ hg tglog | |
595 | o 13: 8fbd00952cbc 'H' |
|
595 | o 13: 8fbd00952cbc 'H' | |
596 | | |
|
596 | | | |
597 | o 12: 51d434a615ee 'G' |
|
597 | o 12: 51d434a615ee 'G' | |
598 | | |
|
598 | | | |
599 | | o 11: df23d8bda0b7 'F' |
|
599 | | o 11: df23d8bda0b7 'F' | |
600 | | | |
|
600 | | | | |
601 | | o 10: 47b7889448ff 'E' |
|
601 | | o 10: 47b7889448ff 'E' | |
602 | |/ |
|
602 | |/ | |
603 | o 9: a9c125634b0b 'D' |
|
603 | o 9: a9c125634b0b 'D' | |
604 | | |
|
604 | | | |
605 | | o 8: 479ddb54a924 'I' |
|
605 | | o 8: 479ddb54a924 'I' | |
606 | | | |
|
606 | | | | |
607 | | o 7: 72434a4e60b0 'H' |
|
607 | | o 7: 72434a4e60b0 'H' | |
608 | | | |
|
608 | | | | |
609 | | o 6: 3d8a618087a7 'G' |
|
609 | | o 6: 3d8a618087a7 'G' | |
610 | | | |
|
610 | | | | |
611 | | | o 5: 41bfcc75ed73 'F' |
|
611 | | | o 5: 41bfcc75ed73 'F' | |
612 | | | | |
|
612 | | | | | |
613 | | | o 4: c01897464e7f 'E' |
|
613 | | | o 4: c01897464e7f 'E' | |
614 | | |/ |
|
614 | | |/ | |
615 | | o 3: ffd453c31098 'D' |
|
615 | | o 3: ffd453c31098 'D' | |
616 | | | |
|
616 | | | | |
617 | | o 2: c9e50f6cdc55 'C' |
|
617 | | o 2: c9e50f6cdc55 'C' | |
618 | | | |
|
618 | | | | |
619 | o | 1: 8fd0f7e49f53 'B' |
|
619 | o | 1: 8fd0f7e49f53 'B' | |
620 | |/ |
|
620 | |/ | |
621 | o 0: 9ae2ed22e576 'A' |
|
621 | o 0: 9ae2ed22e576 'A' | |
622 |
|
622 | |||
623 |
|
623 | |||
624 | $ cd .. |
|
624 | $ cd .. | |
625 |
|
625 | |||
626 | More advanced tests |
|
626 | More advanced tests | |
627 |
|
627 | |||
628 | rebase on ancestor with revset |
|
628 | rebase on ancestor with revset | |
629 |
|
629 | |||
630 | $ hg clone -q -u . ah ah5 |
|
630 | $ hg clone -q -u . ah ah5 | |
631 | $ cd ah5 |
|
631 | $ cd ah5 | |
632 | $ hg rebase -r '6::' -d 2 |
|
632 | $ hg rebase -r '6::' -d 2 | |
633 | rebasing 6:3d8a618087a7 "G" |
|
633 | rebasing 6:3d8a618087a7 "G" | |
634 | rebasing 7:72434a4e60b0 "H" |
|
634 | rebasing 7:72434a4e60b0 "H" | |
635 | rebasing 8:479ddb54a924 tip "I" |
|
635 | rebasing 8:479ddb54a924 tip "I" | |
636 | saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg |
|
636 | saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg | |
637 | $ hg tglog |
|
637 | $ hg tglog | |
638 | o 8: fcb52e68a694 'I' |
|
638 | o 8: fcb52e68a694 'I' | |
639 | | |
|
639 | | | |
640 | o 7: 77bd65cd7600 'H' |
|
640 | o 7: 77bd65cd7600 'H' | |
641 | | |
|
641 | | | |
642 | o 6: 12d0e738fb18 'G' |
|
642 | o 6: 12d0e738fb18 'G' | |
643 | | |
|
643 | | | |
644 | | o 5: 41bfcc75ed73 'F' |
|
644 | | o 5: 41bfcc75ed73 'F' | |
645 | | | |
|
645 | | | | |
646 | | o 4: c01897464e7f 'E' |
|
646 | | o 4: c01897464e7f 'E' | |
647 | | | |
|
647 | | | | |
648 | | o 3: ffd453c31098 'D' |
|
648 | | o 3: ffd453c31098 'D' | |
649 | |/ |
|
649 | |/ | |
650 | o 2: c9e50f6cdc55 'C' |
|
650 | o 2: c9e50f6cdc55 'C' | |
651 | | |
|
651 | | | |
652 | | o 1: 8fd0f7e49f53 'B' |
|
652 | | o 1: 8fd0f7e49f53 'B' | |
653 | |/ |
|
653 | |/ | |
654 | o 0: 9ae2ed22e576 'A' |
|
654 | o 0: 9ae2ed22e576 'A' | |
655 |
|
655 | |||
656 | $ cd .. |
|
656 | $ cd .. | |
657 |
|
657 | |||
658 |
|
658 | |||
659 | rebase with multiple root. |
|
659 | rebase with multiple root. | |
660 | We rebase E and G on B |
|
660 | We rebase E and G on B | |
661 | We would expect heads are I, F if it was supported |
|
661 | We would expect heads are I, F if it was supported | |
662 |
|
662 | |||
663 | $ hg clone -q -u . ah ah6 |
|
663 | $ hg clone -q -u . ah ah6 | |
664 | $ cd ah6 |
|
664 | $ cd ah6 | |
665 | $ hg rebase -r '(4+6)::' -d 1 |
|
665 | $ hg rebase -r '(4+6)::' -d 1 | |
666 | rebasing 4:c01897464e7f "E" |
|
666 | rebasing 4:c01897464e7f "E" | |
667 | rebasing 5:41bfcc75ed73 "F" |
|
667 | rebasing 5:41bfcc75ed73 "F" | |
668 | rebasing 6:3d8a618087a7 "G" |
|
668 | rebasing 6:3d8a618087a7 "G" | |
669 | rebasing 7:72434a4e60b0 "H" |
|
669 | rebasing 7:72434a4e60b0 "H" | |
670 | rebasing 8:479ddb54a924 tip "I" |
|
670 | rebasing 8:479ddb54a924 tip "I" | |
671 | saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg |
|
671 | saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg | |
672 | $ hg tglog |
|
672 | $ hg tglog | |
673 | o 8: 9136df9a87cf 'I' |
|
673 | o 8: 9136df9a87cf 'I' | |
674 | | |
|
674 | | | |
675 | o 7: 23e8f30da832 'H' |
|
675 | o 7: 23e8f30da832 'H' | |
676 | | |
|
676 | | | |
677 | o 6: b0efe8534e8b 'G' |
|
677 | o 6: b0efe8534e8b 'G' | |
678 | | |
|
678 | | | |
679 | | o 5: 6eb5b496ab79 'F' |
|
679 | | o 5: 6eb5b496ab79 'F' | |
680 | | | |
|
680 | | | | |
681 | | o 4: d15eade9b0b1 'E' |
|
681 | | o 4: d15eade9b0b1 'E' | |
682 | |/ |
|
682 | |/ | |
683 | | o 3: ffd453c31098 'D' |
|
683 | | o 3: ffd453c31098 'D' | |
684 | | | |
|
684 | | | | |
685 | | o 2: c9e50f6cdc55 'C' |
|
685 | | o 2: c9e50f6cdc55 'C' | |
686 | | | |
|
686 | | | | |
687 | o | 1: 8fd0f7e49f53 'B' |
|
687 | o | 1: 8fd0f7e49f53 'B' | |
688 | |/ |
|
688 | |/ | |
689 | o 0: 9ae2ed22e576 'A' |
|
689 | o 0: 9ae2ed22e576 'A' | |
690 |
|
690 | |||
691 | $ cd .. |
|
691 | $ cd .. | |
692 |
|
692 | |||
693 | More complex rebase with multiple roots |
|
693 | More complex rebase with multiple roots | |
694 | each root have a different common ancestor with the destination and this is a detach |
|
694 | each root have a different common ancestor with the destination and this is a detach | |
695 |
|
695 | |||
696 | (setup) |
|
696 | (setup) | |
697 |
|
697 | |||
698 | $ hg clone -q -u . a a8 |
|
698 | $ hg clone -q -u . a a8 | |
699 | $ cd a8 |
|
699 | $ cd a8 | |
700 | $ echo I > I |
|
700 | $ echo I > I | |
701 | $ hg add I |
|
701 | $ hg add I | |
702 | $ hg commit -m I |
|
702 | $ hg commit -m I | |
703 | $ hg up 4 |
|
703 | $ hg up 4 | |
704 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
704 | 1 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
705 | $ echo I > J |
|
705 | $ echo I > J | |
706 | $ hg add J |
|
706 | $ hg add J | |
707 | $ hg commit -m J |
|
707 | $ hg commit -m J | |
708 | created new head |
|
708 | created new head | |
709 | $ echo I > K |
|
709 | $ echo I > K | |
710 | $ hg add K |
|
710 | $ hg add K | |
711 | $ hg commit -m K |
|
711 | $ hg commit -m K | |
712 | $ hg tglog |
|
712 | $ hg tglog | |
713 | @ 10: 23a4ace37988 'K' |
|
713 | @ 10: 23a4ace37988 'K' | |
714 | | |
|
714 | | | |
715 | o 9: 1301922eeb0c 'J' |
|
715 | o 9: 1301922eeb0c 'J' | |
716 | | |
|
716 | | | |
717 | | o 8: e7ec4e813ba6 'I' |
|
717 | | o 8: e7ec4e813ba6 'I' | |
718 | | | |
|
718 | | | | |
719 | | o 7: 02de42196ebe 'H' |
|
719 | | o 7: 02de42196ebe 'H' | |
720 | | | |
|
720 | | | | |
721 | +---o 6: eea13746799a 'G' |
|
721 | +---o 6: eea13746799a 'G' | |
722 | | |/ |
|
722 | | |/ | |
723 | | o 5: 24b6387c8c8c 'F' |
|
723 | | o 5: 24b6387c8c8c 'F' | |
724 | | | |
|
724 | | | | |
725 | o | 4: 9520eea781bc 'E' |
|
725 | o | 4: 9520eea781bc 'E' | |
726 | |/ |
|
726 | |/ | |
727 | | o 3: 32af7686d403 'D' |
|
727 | | o 3: 32af7686d403 'D' | |
728 | | | |
|
728 | | | | |
729 | | o 2: 5fddd98957c8 'C' |
|
729 | | o 2: 5fddd98957c8 'C' | |
730 | | | |
|
730 | | | | |
731 | | o 1: 42ccdea3bb16 'B' |
|
731 | | o 1: 42ccdea3bb16 'B' | |
732 | |/ |
|
732 | |/ | |
733 | o 0: cd010b8cd998 'A' |
|
733 | o 0: cd010b8cd998 'A' | |
734 |
|
734 | |||
735 | (actual test) |
|
735 | (actual test) | |
736 |
|
736 | |||
737 | $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)' |
|
737 | $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)' | |
738 | rebasing 8:e7ec4e813ba6 "I" |
|
738 | rebasing 8:e7ec4e813ba6 "I" | |
739 | rebasing 10:23a4ace37988 tip "K" |
|
739 | rebasing 10:23a4ace37988 tip "K" | |
740 | saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg |
|
740 | saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg | |
741 | $ hg log --rev 'children(desc(G))' |
|
741 | $ hg log --rev 'children(desc(G))' | |
742 | changeset: 9:adb617877056 |
|
742 | changeset: 9:adb617877056 | |
743 | parent: 6:eea13746799a |
|
743 | parent: 6:eea13746799a | |
744 | user: test |
|
744 | user: test | |
745 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
745 | date: Thu Jan 01 00:00:00 1970 +0000 | |
746 | summary: I |
|
746 | summary: I | |
747 |
|
747 | |||
748 | changeset: 10:882431a34a0e |
|
748 | changeset: 10:882431a34a0e | |
749 | tag: tip |
|
749 | tag: tip | |
750 | parent: 6:eea13746799a |
|
750 | parent: 6:eea13746799a | |
751 | user: test |
|
751 | user: test | |
752 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
752 | date: Thu Jan 01 00:00:00 1970 +0000 | |
753 | summary: K |
|
753 | summary: K | |
754 |
|
754 | |||
755 | $ hg tglog |
|
755 | $ hg tglog | |
756 | @ 10: 882431a34a0e 'K' |
|
756 | @ 10: 882431a34a0e 'K' | |
757 | | |
|
757 | | | |
758 | | o 9: adb617877056 'I' |
|
758 | | o 9: adb617877056 'I' | |
759 | |/ |
|
759 | |/ | |
760 | | o 8: 1301922eeb0c 'J' |
|
760 | | o 8: 1301922eeb0c 'J' | |
761 | | | |
|
761 | | | | |
762 | | | o 7: 02de42196ebe 'H' |
|
762 | | | o 7: 02de42196ebe 'H' | |
763 | | | | |
|
763 | | | | | |
764 | o---+ 6: eea13746799a 'G' |
|
764 | o---+ 6: eea13746799a 'G' | |
765 | |/ / |
|
765 | |/ / | |
766 | | o 5: 24b6387c8c8c 'F' |
|
766 | | o 5: 24b6387c8c8c 'F' | |
767 | | | |
|
767 | | | | |
768 | o | 4: 9520eea781bc 'E' |
|
768 | o | 4: 9520eea781bc 'E' | |
769 | |/ |
|
769 | |/ | |
770 | | o 3: 32af7686d403 'D' |
|
770 | | o 3: 32af7686d403 'D' | |
771 | | | |
|
771 | | | | |
772 | | o 2: 5fddd98957c8 'C' |
|
772 | | o 2: 5fddd98957c8 'C' | |
773 | | | |
|
773 | | | | |
774 | | o 1: 42ccdea3bb16 'B' |
|
774 | | o 1: 42ccdea3bb16 'B' | |
775 | |/ |
|
775 | |/ | |
776 | o 0: cd010b8cd998 'A' |
|
776 | o 0: cd010b8cd998 'A' | |
777 |
|
777 | |||
778 |
|
778 | |||
779 | Test that rebase is not confused by $CWD disappearing during rebase (issue4121) |
|
779 | Test that rebase is not confused by $CWD disappearing during rebase (issue4121) | |
780 |
|
780 | |||
781 | $ cd .. |
|
781 | $ cd .. | |
782 | $ hg init cwd-vanish |
|
782 | $ hg init cwd-vanish | |
783 | $ cd cwd-vanish |
|
783 | $ cd cwd-vanish | |
784 | $ touch initial-file |
|
784 | $ touch initial-file | |
785 | $ hg add initial-file |
|
785 | $ hg add initial-file | |
786 | $ hg commit -m 'initial commit' |
|
786 | $ hg commit -m 'initial commit' | |
787 | $ touch dest-file |
|
787 | $ touch dest-file | |
788 | $ hg add dest-file |
|
788 | $ hg add dest-file | |
789 | $ hg commit -m 'dest commit' |
|
789 | $ hg commit -m 'dest commit' | |
790 | $ hg up 0 |
|
790 | $ hg up 0 | |
791 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
791 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
792 | $ touch other-file |
|
792 | $ touch other-file | |
793 | $ hg add other-file |
|
793 | $ hg add other-file | |
794 | $ hg commit -m 'first source commit' |
|
794 | $ hg commit -m 'first source commit' | |
795 | created new head |
|
795 | created new head | |
796 | $ mkdir subdir |
|
796 | $ mkdir subdir | |
797 | $ cd subdir |
|
797 | $ cd subdir | |
798 | $ touch subfile |
|
798 | $ touch subfile | |
799 | $ hg add subfile |
|
799 | $ hg add subfile | |
800 | $ hg commit -m 'second source with subdir' |
|
800 | $ hg commit -m 'second source with subdir' | |
801 |
|
801 | |||
802 | $ hg rebase -b . -d 1 --traceback |
|
802 | $ hg rebase -b . -d 1 --traceback | |
803 | rebasing 2:779a07b1b7a0 "first source commit" |
|
803 | rebasing 2:779a07b1b7a0 "first source commit" | |
804 | current directory was removed (rmcwd !) |
|
804 | current directory was removed (rmcwd !) | |
805 | (consider changing to repo root: $TESTTMP/cwd-vanish) (rmcwd !) |
|
805 | (consider changing to repo root: $TESTTMP/cwd-vanish) (rmcwd !) | |
806 | rebasing 3:a7d6f3a00bf3 tip "second source with subdir" |
|
806 | rebasing 3:a7d6f3a00bf3 tip "second source with subdir" | |
807 | saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg |
|
807 | saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg | |
808 |
|
808 | |||
809 | Get back to the root of cwd-vanish. Note that even though `cd ..` |
|
809 | Get back to the root of cwd-vanish. Note that even though `cd ..` | |
810 | works on most systems, it does not work on FreeBSD 10, so we use an |
|
810 | works on most systems, it does not work on FreeBSD 10, so we use an | |
811 | absolute path to get back to the repository. |
|
811 | absolute path to get back to the repository. | |
812 | $ cd $TESTTMP |
|
812 | $ cd $TESTTMP | |
813 |
|
813 | |||
814 | Test that rebase is done in topo order (issue5370) |
|
814 | Test that rebase is done in topo order (issue5370) | |
815 |
|
815 | |||
816 | $ hg init order |
|
816 | $ hg init order | |
817 | $ cd order |
|
817 | $ cd order | |
818 | $ touch a && hg add a && hg ci -m A |
|
818 | $ touch a && hg add a && hg ci -m A | |
819 | $ touch b && hg add b && hg ci -m B |
|
819 | $ touch b && hg add b && hg ci -m B | |
820 | $ touch c && hg add c && hg ci -m C |
|
820 | $ touch c && hg add c && hg ci -m C | |
821 | $ hg up 1 |
|
821 | $ hg up 1 | |
822 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
822 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
823 | $ touch d && hg add d && hg ci -m D |
|
823 | $ touch d && hg add d && hg ci -m D | |
824 | created new head |
|
824 | created new head | |
825 | $ hg up 2 |
|
825 | $ hg up 2 | |
826 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
826 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
827 | $ touch e && hg add e && hg ci -m E |
|
827 | $ touch e && hg add e && hg ci -m E | |
828 | $ hg up 3 |
|
828 | $ hg up 3 | |
829 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
829 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
830 | $ touch f && hg add f && hg ci -m F |
|
830 | $ touch f && hg add f && hg ci -m F | |
831 | $ hg up 0 |
|
831 | $ hg up 0 | |
832 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
832 | 0 files updated, 0 files merged, 3 files removed, 0 files unresolved | |
833 | $ touch g && hg add g && hg ci -m G |
|
833 | $ touch g && hg add g && hg ci -m G | |
834 | created new head |
|
834 | created new head | |
835 |
|
835 | |||
836 | $ hg tglog |
|
836 | $ hg tglog | |
837 | @ 6: 124bb27b6f28 'G' |
|
837 | @ 6: 124bb27b6f28 'G' | |
838 | | |
|
838 | | | |
839 | | o 5: 412b391de760 'F' |
|
839 | | o 5: 412b391de760 'F' | |
840 | | | |
|
840 | | | | |
841 | | | o 4: 82ae8dc7a9b7 'E' |
|
841 | | | o 4: 82ae8dc7a9b7 'E' | |
842 | | | | |
|
842 | | | | | |
843 | | o | 3: ab709c9f7171 'D' |
|
843 | | o | 3: ab709c9f7171 'D' | |
844 | | | | |
|
844 | | | | | |
845 | | | o 2: d84f5cfaaf14 'C' |
|
845 | | | o 2: d84f5cfaaf14 'C' | |
846 | | |/ |
|
846 | | |/ | |
847 | | o 1: 76035bbd54bd 'B' |
|
847 | | o 1: 76035bbd54bd 'B' | |
848 | |/ |
|
848 | |/ | |
849 | o 0: 216878401574 'A' |
|
849 | o 0: 216878401574 'A' | |
850 |
|
850 | |||
851 |
|
851 | |||
852 | $ hg rebase -s 1 -d 6 |
|
852 | $ hg rebase -s 1 -d 6 | |
853 | rebasing 1:76035bbd54bd "B" |
|
853 | rebasing 1:76035bbd54bd "B" | |
854 | rebasing 2:d84f5cfaaf14 "C" |
|
854 | rebasing 2:d84f5cfaaf14 "C" | |
855 | rebasing 4:82ae8dc7a9b7 "E" |
|
855 | rebasing 4:82ae8dc7a9b7 "E" | |
856 | rebasing 3:ab709c9f7171 "D" |
|
856 | rebasing 3:ab709c9f7171 "D" | |
857 | rebasing 5:412b391de760 "F" |
|
857 | rebasing 5:412b391de760 "F" | |
858 | saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg |
|
858 | saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg | |
859 |
|
859 | |||
860 | $ hg tglog |
|
860 | $ hg tglog | |
861 | o 6: 31884cfb735e 'F' |
|
861 | o 6: 31884cfb735e 'F' | |
862 | | |
|
862 | | | |
863 | o 5: 6d89fa5b0909 'D' |
|
863 | o 5: 6d89fa5b0909 'D' | |
864 | | |
|
864 | | | |
865 | | o 4: de64d97c697b 'E' |
|
865 | | o 4: de64d97c697b 'E' | |
866 | | | |
|
866 | | | | |
867 | | o 3: b18e4d2d0aa1 'C' |
|
867 | | o 3: b18e4d2d0aa1 'C' | |
868 | |/ |
|
868 | |/ | |
869 | o 2: 0983daf9ff6a 'B' |
|
869 | o 2: 0983daf9ff6a 'B' | |
870 | | |
|
870 | | | |
871 | @ 1: 124bb27b6f28 'G' |
|
871 | @ 1: 124bb27b6f28 'G' | |
872 | | |
|
872 | | | |
873 | o 0: 216878401574 'A' |
|
873 | o 0: 216878401574 'A' | |
874 |
|
874 | |||
875 |
|
875 | |||
876 | Test experimental revset |
|
876 | Test experimental revset | |
877 | ======================== |
|
877 | ======================== | |
878 |
|
878 | |||
879 | $ cd ../cwd-vanish |
|
879 | $ cd ../cwd-vanish | |
880 |
|
880 | |||
881 | Make the repo a bit more interesting |
|
881 | Make the repo a bit more interesting | |
882 |
|
882 | |||
883 | $ hg up 1 |
|
883 | $ hg up 1 | |
884 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
884 | 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
885 | $ echo aaa > aaa |
|
885 | $ echo aaa > aaa | |
886 | $ hg add aaa |
|
886 | $ hg add aaa | |
887 | $ hg commit -m aaa |
|
887 | $ hg commit -m aaa | |
888 | created new head |
|
888 | created new head | |
889 | $ hg log -G |
|
889 | $ hg log -G | |
890 | @ changeset: 4:5f7bc9025ed2 |
|
890 | @ changeset: 4:5f7bc9025ed2 | |
891 | | tag: tip |
|
891 | | tag: tip | |
892 | | parent: 1:58d79cc1cf43 |
|
892 | | parent: 1:58d79cc1cf43 | |
893 | | user: test |
|
893 | | user: test | |
894 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
894 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
895 | | summary: aaa |
|
895 | | summary: aaa | |
896 | | |
|
896 | | | |
897 | | o changeset: 3:1910d5ff34ea |
|
897 | | o changeset: 3:1910d5ff34ea | |
898 | | | user: test |
|
898 | | | user: test | |
899 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
899 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
900 | | | summary: second source with subdir |
|
900 | | | summary: second source with subdir | |
901 | | | |
|
901 | | | | |
902 | | o changeset: 2:82901330b6ef |
|
902 | | o changeset: 2:82901330b6ef | |
903 | |/ user: test |
|
903 | |/ user: test | |
904 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
904 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
905 | | summary: first source commit |
|
905 | | summary: first source commit | |
906 | | |
|
906 | | | |
907 | o changeset: 1:58d79cc1cf43 |
|
907 | o changeset: 1:58d79cc1cf43 | |
908 | | user: test |
|
908 | | user: test | |
909 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
909 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
910 | | summary: dest commit |
|
910 | | summary: dest commit | |
911 | | |
|
911 | | | |
912 | o changeset: 0:e94b687f7da3 |
|
912 | o changeset: 0:e94b687f7da3 | |
913 | user: test |
|
913 | user: test | |
914 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
914 | date: Thu Jan 01 00:00:00 1970 +0000 | |
915 | summary: initial commit |
|
915 | summary: initial commit | |
916 |
|
916 | |||
917 |
|
917 | |||
918 | Testing from lower head |
|
918 | Testing from lower head | |
919 |
|
919 | |||
920 | $ hg up 3 |
|
920 | $ hg up 3 | |
921 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
921 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
922 | $ hg log -r '_destrebase()' |
|
922 | $ hg log -r '_destrebase()' | |
923 | changeset: 4:5f7bc9025ed2 |
|
923 | changeset: 4:5f7bc9025ed2 | |
924 | tag: tip |
|
924 | tag: tip | |
925 | parent: 1:58d79cc1cf43 |
|
925 | parent: 1:58d79cc1cf43 | |
926 | user: test |
|
926 | user: test | |
927 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
927 | date: Thu Jan 01 00:00:00 1970 +0000 | |
928 | summary: aaa |
|
928 | summary: aaa | |
929 |
|
929 | |||
930 |
|
930 | |||
931 | Testing from upper head |
|
931 | Testing from upper head | |
932 |
|
932 | |||
933 | $ hg log -r '_destrebase(4)' |
|
933 | $ hg log -r '_destrebase(4)' | |
934 | changeset: 3:1910d5ff34ea |
|
934 | changeset: 3:1910d5ff34ea | |
935 | user: test |
|
935 | user: test | |
936 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
936 | date: Thu Jan 01 00:00:00 1970 +0000 | |
937 | summary: second source with subdir |
|
937 | summary: second source with subdir | |
938 |
|
938 | |||
939 | $ hg up 4 |
|
939 | $ hg up 4 | |
940 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
940 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
941 | $ hg log -r '_destrebase()' |
|
941 | $ hg log -r '_destrebase()' | |
942 | changeset: 3:1910d5ff34ea |
|
942 | changeset: 3:1910d5ff34ea | |
943 | user: test |
|
943 | user: test | |
944 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
944 | date: Thu Jan 01 00:00:00 1970 +0000 | |
945 | summary: second source with subdir |
|
945 | summary: second source with subdir | |
946 |
|
946 | |||
947 | Testing rebase being called inside another transaction |
|
947 | Testing rebase being called inside another transaction | |
948 |
|
948 | |||
949 | $ cd $TESTTMP |
|
949 | $ cd $TESTTMP | |
950 | $ hg init tr-state |
|
950 | $ hg init tr-state | |
951 | $ cd tr-state |
|
951 | $ cd tr-state | |
952 | $ cat > $TESTTMP/wraprebase.py <<EOF |
|
952 | $ cat > $TESTTMP/wraprebase.py <<EOF | |
953 | > from __future__ import absolute_import |
|
953 | > from __future__ import absolute_import | |
954 | > from mercurial import extensions |
|
954 | > from mercurial import extensions | |
955 | > def _rebase(orig, ui, repo, *args, **kwargs): |
|
955 | > def _rebase(orig, ui, repo, *args, **kwargs): | |
956 | > with repo.wlock(): |
|
956 | > with repo.wlock(): | |
957 | > with repo.lock(): |
|
957 | > with repo.lock(): | |
958 | > with repo.transaction(b'wrappedrebase'): |
|
958 | > with repo.transaction(b'wrappedrebase'): | |
959 | > return orig(ui, repo, *args, **kwargs) |
|
959 | > return orig(ui, repo, *args, **kwargs) | |
960 | > def wraprebase(loaded): |
|
960 | > def wraprebase(loaded): | |
961 | > assert loaded |
|
961 | > assert loaded | |
962 | > rebasemod = extensions.find(b'rebase') |
|
962 | > rebasemod = extensions.find(b'rebase') | |
963 | > extensions.wrapcommand(rebasemod.cmdtable, b'rebase', _rebase) |
|
963 | > extensions.wrapcommand(rebasemod.cmdtable, b'rebase', _rebase) | |
964 | > def extsetup(ui): |
|
964 | > def extsetup(ui): | |
965 | > extensions.afterloaded(b'rebase', wraprebase) |
|
965 | > extensions.afterloaded(b'rebase', wraprebase) | |
966 | > EOF |
|
966 | > EOF | |
967 |
|
967 | |||
968 | $ cat >> .hg/hgrc <<EOF |
|
968 | $ cat >> .hg/hgrc <<EOF | |
969 | > [extensions] |
|
969 | > [extensions] | |
970 | > wraprebase=$TESTTMP/wraprebase.py |
|
970 | > wraprebase=$TESTTMP/wraprebase.py | |
971 | > [experimental] |
|
971 | > [experimental] | |
972 | > evolution=true |
|
972 | > evolution=true | |
973 | > EOF |
|
973 | > EOF | |
974 |
|
974 | |||
975 | $ hg debugdrawdag <<'EOS' |
|
975 | $ hg debugdrawdag <<'EOS' | |
976 | > B C |
|
976 | > B C | |
977 | > |/ |
|
977 | > |/ | |
978 | > A |
|
978 | > A | |
979 | > EOS |
|
979 | > EOS | |
980 |
|
980 | |||
981 | $ hg rebase -s C -d B |
|
981 | $ hg rebase -s C -d B | |
982 | rebasing 2:dc0947a82db8 C tip "C" |
|
982 | rebasing 2:dc0947a82db8 C tip "C" | |
983 |
|
983 | |||
984 | $ [ -f .hg/rebasestate ] && echo 'WRONG: rebasestate should not exist' |
|
984 | $ [ -f .hg/rebasestate ] && echo 'WRONG: rebasestate should not exist' | |
985 | [1] |
|
985 | [1] |
@@ -1,978 +1,978 b'' | |||||
1 | #testcases obsstore-on obsstore-off |
|
1 | #testcases obsstore-on obsstore-off | |
2 |
|
2 | |||
3 | $ cat > $TESTTMP/editor.py <<EOF |
|
3 | $ cat > $TESTTMP/editor.py <<EOF | |
4 | > #!"$PYTHON" |
|
4 | > #!"$PYTHON" | |
5 | > import os |
|
5 | > import os | |
6 | > import sys |
|
6 | > import sys | |
7 | > path = os.path.join(os.environ['TESTTMP'], 'messages') |
|
7 | > path = os.path.join(os.environ['TESTTMP'], 'messages') | |
8 | > messages = open(path).read().split('--\n') |
|
8 | > messages = open(path).read().split('--\n') | |
9 | > prompt = open(sys.argv[1]).read() |
|
9 | > prompt = open(sys.argv[1]).read() | |
10 | > sys.stdout.write(''.join('EDITOR: %s' % l for l in prompt.splitlines(True))) |
|
10 | > sys.stdout.write(''.join('EDITOR: %s' % l for l in prompt.splitlines(True))) | |
11 | > sys.stdout.flush() |
|
11 | > sys.stdout.flush() | |
12 | > with open(sys.argv[1], 'w') as f: |
|
12 | > with open(sys.argv[1], 'w') as f: | |
13 | > f.write(messages[0]) |
|
13 | > f.write(messages[0]) | |
14 | > with open(path, 'w') as f: |
|
14 | > with open(path, 'w') as f: | |
15 | > f.write('--\n'.join(messages[1:])) |
|
15 | > f.write('--\n'.join(messages[1:])) | |
16 | > EOF |
|
16 | > EOF | |
17 |
|
17 | |||
18 | $ cat >> $HGRCPATH <<EOF |
|
18 | $ cat >> $HGRCPATH <<EOF | |
19 | > [extensions] |
|
19 | > [extensions] | |
20 | > drawdag=$TESTDIR/drawdag.py |
|
20 | > drawdag=$TESTDIR/drawdag.py | |
21 | > split= |
|
21 | > split= | |
22 | > [ui] |
|
22 | > [ui] | |
23 | > interactive=1 |
|
23 | > interactive=1 | |
24 | > color=no |
|
24 | > color=no | |
25 | > paginate=never |
|
25 | > paginate=never | |
26 | > [diff] |
|
26 | > [diff] | |
27 | > git=1 |
|
27 | > git=1 | |
28 | > unified=0 |
|
28 | > unified=0 | |
29 | > [commands] |
|
29 | > [commands] | |
30 | > commit.interactive.unified=0 |
|
30 | > commit.interactive.unified=0 | |
31 | > [alias] |
|
31 | > [alias] | |
32 | > glog=log -G -T '{rev}:{node|short} {desc} {bookmarks}\n' |
|
32 | > glog=log -G -T '{rev}:{node|short} {desc} {bookmarks}\n' | |
33 | > EOF |
|
33 | > EOF | |
34 |
|
34 | |||
35 | #if obsstore-on |
|
35 | #if obsstore-on | |
36 | $ cat >> $HGRCPATH <<EOF |
|
36 | $ cat >> $HGRCPATH <<EOF | |
37 | > [experimental] |
|
37 | > [experimental] | |
38 | > evolution=all |
|
38 | > evolution=all | |
39 | > EOF |
|
39 | > EOF | |
40 | #endif |
|
40 | #endif | |
41 |
|
41 | |||
42 | $ hg init a |
|
42 | $ hg init a | |
43 | $ cd a |
|
43 | $ cd a | |
44 |
|
44 | |||
45 | Nothing to split |
|
45 | Nothing to split | |
46 |
|
46 | |||
47 | $ hg split |
|
47 | $ hg split | |
48 | nothing to split |
|
48 | nothing to split | |
49 | [1] |
|
49 | [1] | |
50 |
|
50 | |||
51 | $ hg commit -m empty --config ui.allowemptycommit=1 |
|
51 | $ hg commit -m empty --config ui.allowemptycommit=1 | |
52 | $ hg split |
|
52 | $ hg split | |
53 | abort: cannot split an empty revision |
|
53 | abort: cannot split an empty revision | |
54 | [255] |
|
54 | [255] | |
55 |
|
55 | |||
56 | $ rm -rf .hg |
|
56 | $ rm -rf .hg | |
57 | $ hg init |
|
57 | $ hg init | |
58 |
|
58 | |||
59 | Cannot split working directory |
|
59 | Cannot split working directory | |
60 |
|
60 | |||
61 | $ hg split -r 'wdir()' |
|
61 | $ hg split -r 'wdir()' | |
62 | abort: cannot split working directory |
|
62 | abort: cannot split working directory | |
63 | [255] |
|
63 | [255] | |
64 |
|
64 | |||
65 | Generate some content. The sed filter drop CR on Windows, which is dropped in |
|
65 | Generate some content. The sed filter drop CR on Windows, which is dropped in | |
66 | the a > b line. |
|
66 | the a > b line. | |
67 |
|
67 | |||
68 | $ $TESTDIR/seq.py 1 5 | sed 's/\r$//' >> a |
|
68 | $ $TESTDIR/seq.py 1 5 | sed 's/\r$//' >> a | |
69 | $ hg ci -m a1 -A a -q |
|
69 | $ hg ci -m a1 -A a -q | |
70 | $ hg bookmark -i r1 |
|
70 | $ hg bookmark -i r1 | |
71 | $ sed 's/1/11/;s/3/33/;s/5/55/' a > b |
|
71 | $ sed 's/1/11/;s/3/33/;s/5/55/' a > b | |
72 | $ mv b a |
|
72 | $ mv b a | |
73 | $ hg ci -m a2 -q |
|
73 | $ hg ci -m a2 -q | |
74 | $ hg bookmark -i r2 |
|
74 | $ hg bookmark -i r2 | |
75 |
|
75 | |||
76 | Cannot split a public changeset |
|
76 | Cannot split a public changeset | |
77 |
|
77 | |||
78 | $ hg phase --public -r 'all()' |
|
78 | $ hg phase --public -r 'all()' | |
79 | $ hg split . |
|
79 | $ hg split . | |
80 | abort: cannot split public changesets |
|
80 | abort: cannot split public changesets | |
81 | (see 'hg help phases' for details) |
|
81 | (see 'hg help phases' for details) | |
82 |
[ |
|
82 | [10] | |
83 |
|
83 | |||
84 | $ hg phase --draft -f -r 'all()' |
|
84 | $ hg phase --draft -f -r 'all()' | |
85 |
|
85 | |||
86 | Cannot split while working directory is dirty |
|
86 | Cannot split while working directory is dirty | |
87 |
|
87 | |||
88 | $ touch dirty |
|
88 | $ touch dirty | |
89 | $ hg add dirty |
|
89 | $ hg add dirty | |
90 | $ hg split . |
|
90 | $ hg split . | |
91 | abort: uncommitted changes |
|
91 | abort: uncommitted changes | |
92 | [20] |
|
92 | [20] | |
93 | $ hg forget dirty |
|
93 | $ hg forget dirty | |
94 | $ rm dirty |
|
94 | $ rm dirty | |
95 |
|
95 | |||
96 | Make a clean directory for future tests to build off of |
|
96 | Make a clean directory for future tests to build off of | |
97 |
|
97 | |||
98 | $ cp -R . ../clean |
|
98 | $ cp -R . ../clean | |
99 |
|
99 | |||
100 | Split a head |
|
100 | Split a head | |
101 |
|
101 | |||
102 | $ hg bookmark r3 |
|
102 | $ hg bookmark r3 | |
103 |
|
103 | |||
104 | $ hg split 'all()' |
|
104 | $ hg split 'all()' | |
105 | abort: cannot split multiple revisions |
|
105 | abort: cannot split multiple revisions | |
106 | [255] |
|
106 | [255] | |
107 |
|
107 | |||
108 | This function splits a bit strangely primarily to avoid changing the behavior of |
|
108 | This function splits a bit strangely primarily to avoid changing the behavior of | |
109 | the test after a bug was fixed with how split/commit --interactive handled |
|
109 | the test after a bug was fixed with how split/commit --interactive handled | |
110 | `commands.commit.interactive.unified=0`: when there were no context lines, |
|
110 | `commands.commit.interactive.unified=0`: when there were no context lines, | |
111 | it kept only the last diff hunk. When running split, this meant that runsplit |
|
111 | it kept only the last diff hunk. When running split, this meant that runsplit | |
112 | was always recording three commits, one for each diff hunk, in reverse order |
|
112 | was always recording three commits, one for each diff hunk, in reverse order | |
113 | (the base commit was the last diff hunk in the file). |
|
113 | (the base commit was the last diff hunk in the file). | |
114 | $ runsplit() { |
|
114 | $ runsplit() { | |
115 | > cat > $TESTTMP/messages <<EOF |
|
115 | > cat > $TESTTMP/messages <<EOF | |
116 | > split 1 |
|
116 | > split 1 | |
117 | > -- |
|
117 | > -- | |
118 | > split 2 |
|
118 | > split 2 | |
119 | > -- |
|
119 | > -- | |
120 | > split 3 |
|
120 | > split 3 | |
121 | > EOF |
|
121 | > EOF | |
122 | > cat <<EOF | hg split "$@" |
|
122 | > cat <<EOF | hg split "$@" | |
123 | > y |
|
123 | > y | |
124 | > n |
|
124 | > n | |
125 | > n |
|
125 | > n | |
126 | > y |
|
126 | > y | |
127 | > y |
|
127 | > y | |
128 | > n |
|
128 | > n | |
129 | > y |
|
129 | > y | |
130 | > y |
|
130 | > y | |
131 | > y |
|
131 | > y | |
132 | > EOF |
|
132 | > EOF | |
133 | > } |
|
133 | > } | |
134 |
|
134 | |||
135 | $ HGEDITOR=false runsplit |
|
135 | $ HGEDITOR=false runsplit | |
136 | diff --git a/a b/a |
|
136 | diff --git a/a b/a | |
137 | 3 hunks, 3 lines changed |
|
137 | 3 hunks, 3 lines changed | |
138 | examine changes to 'a'? |
|
138 | examine changes to 'a'? | |
139 | (enter ? for help) [Ynesfdaq?] y |
|
139 | (enter ? for help) [Ynesfdaq?] y | |
140 |
|
140 | |||
141 | @@ -1,1 +1,1 @@ |
|
141 | @@ -1,1 +1,1 @@ | |
142 | -1 |
|
142 | -1 | |
143 | +11 |
|
143 | +11 | |
144 | record change 1/3 to 'a'? |
|
144 | record change 1/3 to 'a'? | |
145 | (enter ? for help) [Ynesfdaq?] n |
|
145 | (enter ? for help) [Ynesfdaq?] n | |
146 |
|
146 | |||
147 | @@ -3,1 +3,1 @@ 2 |
|
147 | @@ -3,1 +3,1 @@ 2 | |
148 | -3 |
|
148 | -3 | |
149 | +33 |
|
149 | +33 | |
150 | record change 2/3 to 'a'? |
|
150 | record change 2/3 to 'a'? | |
151 | (enter ? for help) [Ynesfdaq?] n |
|
151 | (enter ? for help) [Ynesfdaq?] n | |
152 |
|
152 | |||
153 | @@ -5,1 +5,1 @@ 4 |
|
153 | @@ -5,1 +5,1 @@ 4 | |
154 | -5 |
|
154 | -5 | |
155 | +55 |
|
155 | +55 | |
156 | record change 3/3 to 'a'? |
|
156 | record change 3/3 to 'a'? | |
157 | (enter ? for help) [Ynesfdaq?] y |
|
157 | (enter ? for help) [Ynesfdaq?] y | |
158 |
|
158 | |||
159 | transaction abort! |
|
159 | transaction abort! | |
160 | rollback completed |
|
160 | rollback completed | |
161 | abort: edit failed: false exited with status 1 |
|
161 | abort: edit failed: false exited with status 1 | |
162 | [255] |
|
162 | [255] | |
163 | $ hg status |
|
163 | $ hg status | |
164 |
|
164 | |||
165 | $ HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py" |
|
165 | $ HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py" | |
166 | $ runsplit |
|
166 | $ runsplit | |
167 | diff --git a/a b/a |
|
167 | diff --git a/a b/a | |
168 | 3 hunks, 3 lines changed |
|
168 | 3 hunks, 3 lines changed | |
169 | examine changes to 'a'? |
|
169 | examine changes to 'a'? | |
170 | (enter ? for help) [Ynesfdaq?] y |
|
170 | (enter ? for help) [Ynesfdaq?] y | |
171 |
|
171 | |||
172 | @@ -1,1 +1,1 @@ |
|
172 | @@ -1,1 +1,1 @@ | |
173 | -1 |
|
173 | -1 | |
174 | +11 |
|
174 | +11 | |
175 | record change 1/3 to 'a'? |
|
175 | record change 1/3 to 'a'? | |
176 | (enter ? for help) [Ynesfdaq?] n |
|
176 | (enter ? for help) [Ynesfdaq?] n | |
177 |
|
177 | |||
178 | @@ -3,1 +3,1 @@ 2 |
|
178 | @@ -3,1 +3,1 @@ 2 | |
179 | -3 |
|
179 | -3 | |
180 | +33 |
|
180 | +33 | |
181 | record change 2/3 to 'a'? |
|
181 | record change 2/3 to 'a'? | |
182 | (enter ? for help) [Ynesfdaq?] n |
|
182 | (enter ? for help) [Ynesfdaq?] n | |
183 |
|
183 | |||
184 | @@ -5,1 +5,1 @@ 4 |
|
184 | @@ -5,1 +5,1 @@ 4 | |
185 | -5 |
|
185 | -5 | |
186 | +55 |
|
186 | +55 | |
187 | record change 3/3 to 'a'? |
|
187 | record change 3/3 to 'a'? | |
188 | (enter ? for help) [Ynesfdaq?] y |
|
188 | (enter ? for help) [Ynesfdaq?] y | |
189 |
|
189 | |||
190 | EDITOR: HG: Splitting 1df0d5c5a3ab. Write commit message for the first split changeset. |
|
190 | EDITOR: HG: Splitting 1df0d5c5a3ab. Write commit message for the first split changeset. | |
191 | EDITOR: a2 |
|
191 | EDITOR: a2 | |
192 | EDITOR: |
|
192 | EDITOR: | |
193 | EDITOR: |
|
193 | EDITOR: | |
194 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
194 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
195 | EDITOR: HG: Leave message empty to abort commit. |
|
195 | EDITOR: HG: Leave message empty to abort commit. | |
196 | EDITOR: HG: -- |
|
196 | EDITOR: HG: -- | |
197 | EDITOR: HG: user: test |
|
197 | EDITOR: HG: user: test | |
198 | EDITOR: HG: branch 'default' |
|
198 | EDITOR: HG: branch 'default' | |
199 | EDITOR: HG: changed a |
|
199 | EDITOR: HG: changed a | |
200 | created new head |
|
200 | created new head | |
201 | diff --git a/a b/a |
|
201 | diff --git a/a b/a | |
202 | 2 hunks, 2 lines changed |
|
202 | 2 hunks, 2 lines changed | |
203 | examine changes to 'a'? |
|
203 | examine changes to 'a'? | |
204 | (enter ? for help) [Ynesfdaq?] y |
|
204 | (enter ? for help) [Ynesfdaq?] y | |
205 |
|
205 | |||
206 | @@ -1,1 +1,1 @@ |
|
206 | @@ -1,1 +1,1 @@ | |
207 | -1 |
|
207 | -1 | |
208 | +11 |
|
208 | +11 | |
209 | record change 1/2 to 'a'? |
|
209 | record change 1/2 to 'a'? | |
210 | (enter ? for help) [Ynesfdaq?] n |
|
210 | (enter ? for help) [Ynesfdaq?] n | |
211 |
|
211 | |||
212 | @@ -3,1 +3,1 @@ 2 |
|
212 | @@ -3,1 +3,1 @@ 2 | |
213 | -3 |
|
213 | -3 | |
214 | +33 |
|
214 | +33 | |
215 | record change 2/2 to 'a'? |
|
215 | record change 2/2 to 'a'? | |
216 | (enter ? for help) [Ynesfdaq?] y |
|
216 | (enter ? for help) [Ynesfdaq?] y | |
217 |
|
217 | |||
218 | EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into: |
|
218 | EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into: | |
219 | EDITOR: HG: - 2:e704349bd21b tip "split 1" |
|
219 | EDITOR: HG: - 2:e704349bd21b tip "split 1" | |
220 | EDITOR: HG: Write commit message for the next split changeset. |
|
220 | EDITOR: HG: Write commit message for the next split changeset. | |
221 | EDITOR: a2 |
|
221 | EDITOR: a2 | |
222 | EDITOR: |
|
222 | EDITOR: | |
223 | EDITOR: |
|
223 | EDITOR: | |
224 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
224 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
225 | EDITOR: HG: Leave message empty to abort commit. |
|
225 | EDITOR: HG: Leave message empty to abort commit. | |
226 | EDITOR: HG: -- |
|
226 | EDITOR: HG: -- | |
227 | EDITOR: HG: user: test |
|
227 | EDITOR: HG: user: test | |
228 | EDITOR: HG: branch 'default' |
|
228 | EDITOR: HG: branch 'default' | |
229 | EDITOR: HG: changed a |
|
229 | EDITOR: HG: changed a | |
230 | diff --git a/a b/a |
|
230 | diff --git a/a b/a | |
231 | 1 hunks, 1 lines changed |
|
231 | 1 hunks, 1 lines changed | |
232 | examine changes to 'a'? |
|
232 | examine changes to 'a'? | |
233 | (enter ? for help) [Ynesfdaq?] y |
|
233 | (enter ? for help) [Ynesfdaq?] y | |
234 |
|
234 | |||
235 | @@ -1,1 +1,1 @@ |
|
235 | @@ -1,1 +1,1 @@ | |
236 | -1 |
|
236 | -1 | |
237 | +11 |
|
237 | +11 | |
238 | record this change to 'a'? |
|
238 | record this change to 'a'? | |
239 | (enter ? for help) [Ynesfdaq?] y |
|
239 | (enter ? for help) [Ynesfdaq?] y | |
240 |
|
240 | |||
241 | EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into: |
|
241 | EDITOR: HG: Splitting 1df0d5c5a3ab. So far it has been split into: | |
242 | EDITOR: HG: - 2:e704349bd21b tip "split 1" |
|
242 | EDITOR: HG: - 2:e704349bd21b tip "split 1" | |
243 | EDITOR: HG: - 3:a09ad58faae3 "split 2" |
|
243 | EDITOR: HG: - 3:a09ad58faae3 "split 2" | |
244 | EDITOR: HG: Write commit message for the next split changeset. |
|
244 | EDITOR: HG: Write commit message for the next split changeset. | |
245 | EDITOR: a2 |
|
245 | EDITOR: a2 | |
246 | EDITOR: |
|
246 | EDITOR: | |
247 | EDITOR: |
|
247 | EDITOR: | |
248 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
248 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
249 | EDITOR: HG: Leave message empty to abort commit. |
|
249 | EDITOR: HG: Leave message empty to abort commit. | |
250 | EDITOR: HG: -- |
|
250 | EDITOR: HG: -- | |
251 | EDITOR: HG: user: test |
|
251 | EDITOR: HG: user: test | |
252 | EDITOR: HG: branch 'default' |
|
252 | EDITOR: HG: branch 'default' | |
253 | EDITOR: HG: changed a |
|
253 | EDITOR: HG: changed a | |
254 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/1df0d5c5a3ab-8341b760-split.hg (obsstore-off !) |
|
254 | saved backup bundle to $TESTTMP/a/.hg/strip-backup/1df0d5c5a3ab-8341b760-split.hg (obsstore-off !) | |
255 |
|
255 | |||
256 | #if obsstore-off |
|
256 | #if obsstore-off | |
257 | $ hg bookmark |
|
257 | $ hg bookmark | |
258 | r1 0:a61bcde8c529 |
|
258 | r1 0:a61bcde8c529 | |
259 | r2 3:00eebaf8d2e2 |
|
259 | r2 3:00eebaf8d2e2 | |
260 | * r3 3:00eebaf8d2e2 |
|
260 | * r3 3:00eebaf8d2e2 | |
261 | $ hg glog -p |
|
261 | $ hg glog -p | |
262 | @ 3:00eebaf8d2e2 split 3 r2 r3 |
|
262 | @ 3:00eebaf8d2e2 split 3 r2 r3 | |
263 | | diff --git a/a b/a |
|
263 | | diff --git a/a b/a | |
264 | | --- a/a |
|
264 | | --- a/a | |
265 | | +++ b/a |
|
265 | | +++ b/a | |
266 | | @@ -1,1 +1,1 @@ |
|
266 | | @@ -1,1 +1,1 @@ | |
267 | | -1 |
|
267 | | -1 | |
268 | | +11 |
|
268 | | +11 | |
269 | | |
|
269 | | | |
270 | o 2:a09ad58faae3 split 2 |
|
270 | o 2:a09ad58faae3 split 2 | |
271 | | diff --git a/a b/a |
|
271 | | diff --git a/a b/a | |
272 | | --- a/a |
|
272 | | --- a/a | |
273 | | +++ b/a |
|
273 | | +++ b/a | |
274 | | @@ -3,1 +3,1 @@ |
|
274 | | @@ -3,1 +3,1 @@ | |
275 | | -3 |
|
275 | | -3 | |
276 | | +33 |
|
276 | | +33 | |
277 | | |
|
277 | | | |
278 | o 1:e704349bd21b split 1 |
|
278 | o 1:e704349bd21b split 1 | |
279 | | diff --git a/a b/a |
|
279 | | diff --git a/a b/a | |
280 | | --- a/a |
|
280 | | --- a/a | |
281 | | +++ b/a |
|
281 | | +++ b/a | |
282 | | @@ -5,1 +5,1 @@ |
|
282 | | @@ -5,1 +5,1 @@ | |
283 | | -5 |
|
283 | | -5 | |
284 | | +55 |
|
284 | | +55 | |
285 | | |
|
285 | | | |
286 | o 0:a61bcde8c529 a1 r1 |
|
286 | o 0:a61bcde8c529 a1 r1 | |
287 | diff --git a/a b/a |
|
287 | diff --git a/a b/a | |
288 | new file mode 100644 |
|
288 | new file mode 100644 | |
289 | --- /dev/null |
|
289 | --- /dev/null | |
290 | +++ b/a |
|
290 | +++ b/a | |
291 | @@ -0,0 +1,5 @@ |
|
291 | @@ -0,0 +1,5 @@ | |
292 | +1 |
|
292 | +1 | |
293 | +2 |
|
293 | +2 | |
294 | +3 |
|
294 | +3 | |
295 | +4 |
|
295 | +4 | |
296 | +5 |
|
296 | +5 | |
297 |
|
297 | |||
298 | #else |
|
298 | #else | |
299 | $ hg bookmark |
|
299 | $ hg bookmark | |
300 | r1 0:a61bcde8c529 |
|
300 | r1 0:a61bcde8c529 | |
301 | r2 4:00eebaf8d2e2 |
|
301 | r2 4:00eebaf8d2e2 | |
302 | * r3 4:00eebaf8d2e2 |
|
302 | * r3 4:00eebaf8d2e2 | |
303 | $ hg glog |
|
303 | $ hg glog | |
304 | @ 4:00eebaf8d2e2 split 3 r2 r3 |
|
304 | @ 4:00eebaf8d2e2 split 3 r2 r3 | |
305 | | |
|
305 | | | |
306 | o 3:a09ad58faae3 split 2 |
|
306 | o 3:a09ad58faae3 split 2 | |
307 | | |
|
307 | | | |
308 | o 2:e704349bd21b split 1 |
|
308 | o 2:e704349bd21b split 1 | |
309 | | |
|
309 | | | |
310 | o 0:a61bcde8c529 a1 r1 |
|
310 | o 0:a61bcde8c529 a1 r1 | |
311 |
|
311 | |||
312 | #endif |
|
312 | #endif | |
313 |
|
313 | |||
314 | Split a head while working parent is not that head |
|
314 | Split a head while working parent is not that head | |
315 |
|
315 | |||
316 | $ cp -R $TESTTMP/clean $TESTTMP/b |
|
316 | $ cp -R $TESTTMP/clean $TESTTMP/b | |
317 | $ cd $TESTTMP/b |
|
317 | $ cd $TESTTMP/b | |
318 |
|
318 | |||
319 | $ hg up 0 -q |
|
319 | $ hg up 0 -q | |
320 | $ hg bookmark r3 |
|
320 | $ hg bookmark r3 | |
321 |
|
321 | |||
322 | $ runsplit tip >/dev/null |
|
322 | $ runsplit tip >/dev/null | |
323 |
|
323 | |||
324 | #if obsstore-off |
|
324 | #if obsstore-off | |
325 | $ hg bookmark |
|
325 | $ hg bookmark | |
326 | r1 0:a61bcde8c529 |
|
326 | r1 0:a61bcde8c529 | |
327 | r2 3:00eebaf8d2e2 |
|
327 | r2 3:00eebaf8d2e2 | |
328 | * r3 0:a61bcde8c529 |
|
328 | * r3 0:a61bcde8c529 | |
329 | $ hg glog |
|
329 | $ hg glog | |
330 | o 3:00eebaf8d2e2 split 3 r2 |
|
330 | o 3:00eebaf8d2e2 split 3 r2 | |
331 | | |
|
331 | | | |
332 | o 2:a09ad58faae3 split 2 |
|
332 | o 2:a09ad58faae3 split 2 | |
333 | | |
|
333 | | | |
334 | o 1:e704349bd21b split 1 |
|
334 | o 1:e704349bd21b split 1 | |
335 | | |
|
335 | | | |
336 | @ 0:a61bcde8c529 a1 r1 r3 |
|
336 | @ 0:a61bcde8c529 a1 r1 r3 | |
337 |
|
337 | |||
338 | #else |
|
338 | #else | |
339 | $ hg bookmark |
|
339 | $ hg bookmark | |
340 | r1 0:a61bcde8c529 |
|
340 | r1 0:a61bcde8c529 | |
341 | r2 4:00eebaf8d2e2 |
|
341 | r2 4:00eebaf8d2e2 | |
342 | * r3 0:a61bcde8c529 |
|
342 | * r3 0:a61bcde8c529 | |
343 | $ hg glog |
|
343 | $ hg glog | |
344 | o 4:00eebaf8d2e2 split 3 r2 |
|
344 | o 4:00eebaf8d2e2 split 3 r2 | |
345 | | |
|
345 | | | |
346 | o 3:a09ad58faae3 split 2 |
|
346 | o 3:a09ad58faae3 split 2 | |
347 | | |
|
347 | | | |
348 | o 2:e704349bd21b split 1 |
|
348 | o 2:e704349bd21b split 1 | |
349 | | |
|
349 | | | |
350 | @ 0:a61bcde8c529 a1 r1 r3 |
|
350 | @ 0:a61bcde8c529 a1 r1 r3 | |
351 |
|
351 | |||
352 | #endif |
|
352 | #endif | |
353 |
|
353 | |||
354 | Split a non-head |
|
354 | Split a non-head | |
355 |
|
355 | |||
356 | $ cp -R $TESTTMP/clean $TESTTMP/c |
|
356 | $ cp -R $TESTTMP/clean $TESTTMP/c | |
357 | $ cd $TESTTMP/c |
|
357 | $ cd $TESTTMP/c | |
358 | $ echo d > d |
|
358 | $ echo d > d | |
359 | $ hg ci -m d1 -A d |
|
359 | $ hg ci -m d1 -A d | |
360 | $ hg bookmark -i d1 |
|
360 | $ hg bookmark -i d1 | |
361 | $ echo 2 >> d |
|
361 | $ echo 2 >> d | |
362 | $ hg ci -m d2 |
|
362 | $ hg ci -m d2 | |
363 | $ echo 3 >> d |
|
363 | $ echo 3 >> d | |
364 | $ hg ci -m d3 |
|
364 | $ hg ci -m d3 | |
365 | $ hg bookmark -i d3 |
|
365 | $ hg bookmark -i d3 | |
366 | $ hg up '.^' -q |
|
366 | $ hg up '.^' -q | |
367 | $ hg bookmark d2 |
|
367 | $ hg bookmark d2 | |
368 | $ cp -R . ../d |
|
368 | $ cp -R . ../d | |
369 |
|
369 | |||
370 | $ runsplit -r 1 | grep rebasing |
|
370 | $ runsplit -r 1 | grep rebasing | |
371 | rebasing 2:b5c5ea414030 d1 "d1" |
|
371 | rebasing 2:b5c5ea414030 d1 "d1" | |
372 | rebasing 3:f4a0a8d004cc d2 "d2" |
|
372 | rebasing 3:f4a0a8d004cc d2 "d2" | |
373 | rebasing 4:777940761eba d3 "d3" |
|
373 | rebasing 4:777940761eba d3 "d3" | |
374 | #if obsstore-off |
|
374 | #if obsstore-off | |
375 | $ hg bookmark |
|
375 | $ hg bookmark | |
376 | d1 4:c4b449ef030e |
|
376 | d1 4:c4b449ef030e | |
377 | * d2 5:c9dd00ab36a3 |
|
377 | * d2 5:c9dd00ab36a3 | |
378 | d3 6:19f476bc865c |
|
378 | d3 6:19f476bc865c | |
379 | r1 0:a61bcde8c529 |
|
379 | r1 0:a61bcde8c529 | |
380 | r2 3:00eebaf8d2e2 |
|
380 | r2 3:00eebaf8d2e2 | |
381 | $ hg glog -p |
|
381 | $ hg glog -p | |
382 | o 6:19f476bc865c d3 d3 |
|
382 | o 6:19f476bc865c d3 d3 | |
383 | | diff --git a/d b/d |
|
383 | | diff --git a/d b/d | |
384 | | --- a/d |
|
384 | | --- a/d | |
385 | | +++ b/d |
|
385 | | +++ b/d | |
386 | | @@ -2,0 +3,1 @@ |
|
386 | | @@ -2,0 +3,1 @@ | |
387 | | +3 |
|
387 | | +3 | |
388 | | |
|
388 | | | |
389 | @ 5:c9dd00ab36a3 d2 d2 |
|
389 | @ 5:c9dd00ab36a3 d2 d2 | |
390 | | diff --git a/d b/d |
|
390 | | diff --git a/d b/d | |
391 | | --- a/d |
|
391 | | --- a/d | |
392 | | +++ b/d |
|
392 | | +++ b/d | |
393 | | @@ -1,0 +2,1 @@ |
|
393 | | @@ -1,0 +2,1 @@ | |
394 | | +2 |
|
394 | | +2 | |
395 | | |
|
395 | | | |
396 | o 4:c4b449ef030e d1 d1 |
|
396 | o 4:c4b449ef030e d1 d1 | |
397 | | diff --git a/d b/d |
|
397 | | diff --git a/d b/d | |
398 | | new file mode 100644 |
|
398 | | new file mode 100644 | |
399 | | --- /dev/null |
|
399 | | --- /dev/null | |
400 | | +++ b/d |
|
400 | | +++ b/d | |
401 | | @@ -0,0 +1,1 @@ |
|
401 | | @@ -0,0 +1,1 @@ | |
402 | | +d |
|
402 | | +d | |
403 | | |
|
403 | | | |
404 | o 3:00eebaf8d2e2 split 3 r2 |
|
404 | o 3:00eebaf8d2e2 split 3 r2 | |
405 | | diff --git a/a b/a |
|
405 | | diff --git a/a b/a | |
406 | | --- a/a |
|
406 | | --- a/a | |
407 | | +++ b/a |
|
407 | | +++ b/a | |
408 | | @@ -1,1 +1,1 @@ |
|
408 | | @@ -1,1 +1,1 @@ | |
409 | | -1 |
|
409 | | -1 | |
410 | | +11 |
|
410 | | +11 | |
411 | | |
|
411 | | | |
412 | o 2:a09ad58faae3 split 2 |
|
412 | o 2:a09ad58faae3 split 2 | |
413 | | diff --git a/a b/a |
|
413 | | diff --git a/a b/a | |
414 | | --- a/a |
|
414 | | --- a/a | |
415 | | +++ b/a |
|
415 | | +++ b/a | |
416 | | @@ -3,1 +3,1 @@ |
|
416 | | @@ -3,1 +3,1 @@ | |
417 | | -3 |
|
417 | | -3 | |
418 | | +33 |
|
418 | | +33 | |
419 | | |
|
419 | | | |
420 | o 1:e704349bd21b split 1 |
|
420 | o 1:e704349bd21b split 1 | |
421 | | diff --git a/a b/a |
|
421 | | diff --git a/a b/a | |
422 | | --- a/a |
|
422 | | --- a/a | |
423 | | +++ b/a |
|
423 | | +++ b/a | |
424 | | @@ -5,1 +5,1 @@ |
|
424 | | @@ -5,1 +5,1 @@ | |
425 | | -5 |
|
425 | | -5 | |
426 | | +55 |
|
426 | | +55 | |
427 | | |
|
427 | | | |
428 | o 0:a61bcde8c529 a1 r1 |
|
428 | o 0:a61bcde8c529 a1 r1 | |
429 | diff --git a/a b/a |
|
429 | diff --git a/a b/a | |
430 | new file mode 100644 |
|
430 | new file mode 100644 | |
431 | --- /dev/null |
|
431 | --- /dev/null | |
432 | +++ b/a |
|
432 | +++ b/a | |
433 | @@ -0,0 +1,5 @@ |
|
433 | @@ -0,0 +1,5 @@ | |
434 | +1 |
|
434 | +1 | |
435 | +2 |
|
435 | +2 | |
436 | +3 |
|
436 | +3 | |
437 | +4 |
|
437 | +4 | |
438 | +5 |
|
438 | +5 | |
439 |
|
439 | |||
440 | #else |
|
440 | #else | |
441 | $ hg bookmark |
|
441 | $ hg bookmark | |
442 | d1 8:c4b449ef030e |
|
442 | d1 8:c4b449ef030e | |
443 | * d2 9:c9dd00ab36a3 |
|
443 | * d2 9:c9dd00ab36a3 | |
444 | d3 10:19f476bc865c |
|
444 | d3 10:19f476bc865c | |
445 | r1 0:a61bcde8c529 |
|
445 | r1 0:a61bcde8c529 | |
446 | r2 7:00eebaf8d2e2 |
|
446 | r2 7:00eebaf8d2e2 | |
447 | $ hg glog |
|
447 | $ hg glog | |
448 | o 10:19f476bc865c d3 d3 |
|
448 | o 10:19f476bc865c d3 d3 | |
449 | | |
|
449 | | | |
450 | @ 9:c9dd00ab36a3 d2 d2 |
|
450 | @ 9:c9dd00ab36a3 d2 d2 | |
451 | | |
|
451 | | | |
452 | o 8:c4b449ef030e d1 d1 |
|
452 | o 8:c4b449ef030e d1 d1 | |
453 | | |
|
453 | | | |
454 | o 7:00eebaf8d2e2 split 3 r2 |
|
454 | o 7:00eebaf8d2e2 split 3 r2 | |
455 | | |
|
455 | | | |
456 | o 6:a09ad58faae3 split 2 |
|
456 | o 6:a09ad58faae3 split 2 | |
457 | | |
|
457 | | | |
458 | o 5:e704349bd21b split 1 |
|
458 | o 5:e704349bd21b split 1 | |
459 | | |
|
459 | | | |
460 | o 0:a61bcde8c529 a1 r1 |
|
460 | o 0:a61bcde8c529 a1 r1 | |
461 |
|
461 | |||
462 | #endif |
|
462 | #endif | |
463 |
|
463 | |||
464 | Split a non-head without rebase |
|
464 | Split a non-head without rebase | |
465 |
|
465 | |||
466 | $ cd $TESTTMP/d |
|
466 | $ cd $TESTTMP/d | |
467 | #if obsstore-off |
|
467 | #if obsstore-off | |
468 | $ runsplit -r 1 --no-rebase |
|
468 | $ runsplit -r 1 --no-rebase | |
469 | abort: cannot split changeset with children |
|
469 | abort: cannot split changeset with children | |
470 |
[ |
|
470 | [10] | |
471 | #else |
|
471 | #else | |
472 | $ runsplit -r 1 --no-rebase >/dev/null |
|
472 | $ runsplit -r 1 --no-rebase >/dev/null | |
473 | 3 new orphan changesets |
|
473 | 3 new orphan changesets | |
474 | $ hg bookmark |
|
474 | $ hg bookmark | |
475 | d1 2:b5c5ea414030 |
|
475 | d1 2:b5c5ea414030 | |
476 | * d2 3:f4a0a8d004cc |
|
476 | * d2 3:f4a0a8d004cc | |
477 | d3 4:777940761eba |
|
477 | d3 4:777940761eba | |
478 | r1 0:a61bcde8c529 |
|
478 | r1 0:a61bcde8c529 | |
479 | r2 7:00eebaf8d2e2 |
|
479 | r2 7:00eebaf8d2e2 | |
480 |
|
480 | |||
481 | $ hg glog |
|
481 | $ hg glog | |
482 | o 7:00eebaf8d2e2 split 3 r2 |
|
482 | o 7:00eebaf8d2e2 split 3 r2 | |
483 | | |
|
483 | | | |
484 | o 6:a09ad58faae3 split 2 |
|
484 | o 6:a09ad58faae3 split 2 | |
485 | | |
|
485 | | | |
486 | o 5:e704349bd21b split 1 |
|
486 | o 5:e704349bd21b split 1 | |
487 | | |
|
487 | | | |
488 | | * 4:777940761eba d3 d3 |
|
488 | | * 4:777940761eba d3 d3 | |
489 | | | |
|
489 | | | | |
490 | | @ 3:f4a0a8d004cc d2 d2 |
|
490 | | @ 3:f4a0a8d004cc d2 d2 | |
491 | | | |
|
491 | | | | |
492 | | * 2:b5c5ea414030 d1 d1 |
|
492 | | * 2:b5c5ea414030 d1 d1 | |
493 | | | |
|
493 | | | | |
494 | | x 1:1df0d5c5a3ab a2 |
|
494 | | x 1:1df0d5c5a3ab a2 | |
495 | |/ |
|
495 | |/ | |
496 | o 0:a61bcde8c529 a1 r1 |
|
496 | o 0:a61bcde8c529 a1 r1 | |
497 |
|
497 | |||
498 | #endif |
|
498 | #endif | |
499 |
|
499 | |||
500 | Split a non-head with obsoleted descendants |
|
500 | Split a non-head with obsoleted descendants | |
501 |
|
501 | |||
502 | #if obsstore-on |
|
502 | #if obsstore-on | |
503 | $ hg init $TESTTMP/e |
|
503 | $ hg init $TESTTMP/e | |
504 | $ cd $TESTTMP/e |
|
504 | $ cd $TESTTMP/e | |
505 | $ hg debugdrawdag <<'EOS' |
|
505 | $ hg debugdrawdag <<'EOS' | |
506 | > H I J |
|
506 | > H I J | |
507 | > | | | |
|
507 | > | | | | |
508 | > F G1 G2 # amend: G1 -> G2 |
|
508 | > F G1 G2 # amend: G1 -> G2 | |
509 | > | | / # prune: F |
|
509 | > | | / # prune: F | |
510 | > C D E |
|
510 | > C D E | |
511 | > \|/ |
|
511 | > \|/ | |
512 | > B |
|
512 | > B | |
513 | > | |
|
513 | > | | |
514 | > A |
|
514 | > A | |
515 | > EOS |
|
515 | > EOS | |
516 | 2 new orphan changesets |
|
516 | 2 new orphan changesets | |
517 | $ eval `hg tags -T '{tag}={node}\n'` |
|
517 | $ eval `hg tags -T '{tag}={node}\n'` | |
518 | $ rm .hg/localtags |
|
518 | $ rm .hg/localtags | |
519 | $ hg split $B --config experimental.evolution=createmarkers |
|
519 | $ hg split $B --config experimental.evolution=createmarkers | |
520 | abort: cannot split changeset with children |
|
520 | abort: cannot split changeset with children | |
521 |
[ |
|
521 | [10] | |
522 | $ cat > $TESTTMP/messages <<EOF |
|
522 | $ cat > $TESTTMP/messages <<EOF | |
523 | > Split B |
|
523 | > Split B | |
524 | > EOF |
|
524 | > EOF | |
525 | $ cat <<EOF | hg split $B |
|
525 | $ cat <<EOF | hg split $B | |
526 | > y |
|
526 | > y | |
527 | > y |
|
527 | > y | |
528 | > EOF |
|
528 | > EOF | |
529 | diff --git a/B b/B |
|
529 | diff --git a/B b/B | |
530 | new file mode 100644 |
|
530 | new file mode 100644 | |
531 | examine changes to 'B'? |
|
531 | examine changes to 'B'? | |
532 | (enter ? for help) [Ynesfdaq?] y |
|
532 | (enter ? for help) [Ynesfdaq?] y | |
533 |
|
533 | |||
534 | @@ -0,0 +1,1 @@ |
|
534 | @@ -0,0 +1,1 @@ | |
535 | +B |
|
535 | +B | |
536 | \ No newline at end of file |
|
536 | \ No newline at end of file | |
537 | record this change to 'B'? |
|
537 | record this change to 'B'? | |
538 | (enter ? for help) [Ynesfdaq?] y |
|
538 | (enter ? for help) [Ynesfdaq?] y | |
539 |
|
539 | |||
540 | EDITOR: HG: Splitting 112478962961. Write commit message for the first split changeset. |
|
540 | EDITOR: HG: Splitting 112478962961. Write commit message for the first split changeset. | |
541 | EDITOR: B |
|
541 | EDITOR: B | |
542 | EDITOR: |
|
542 | EDITOR: | |
543 | EDITOR: |
|
543 | EDITOR: | |
544 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
544 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
545 | EDITOR: HG: Leave message empty to abort commit. |
|
545 | EDITOR: HG: Leave message empty to abort commit. | |
546 | EDITOR: HG: -- |
|
546 | EDITOR: HG: -- | |
547 | EDITOR: HG: user: test |
|
547 | EDITOR: HG: user: test | |
548 | EDITOR: HG: branch 'default' |
|
548 | EDITOR: HG: branch 'default' | |
549 | EDITOR: HG: added B |
|
549 | EDITOR: HG: added B | |
550 | created new head |
|
550 | created new head | |
551 | rebasing 2:26805aba1e60 "C" |
|
551 | rebasing 2:26805aba1e60 "C" | |
552 | rebasing 3:be0ef73c17ad "D" |
|
552 | rebasing 3:be0ef73c17ad "D" | |
553 | rebasing 4:49cb92066bfd "E" |
|
553 | rebasing 4:49cb92066bfd "E" | |
554 | rebasing 7:97a6268cc7ef "G2" |
|
554 | rebasing 7:97a6268cc7ef "G2" | |
555 | rebasing 10:e2f1e425c0db "J" |
|
555 | rebasing 10:e2f1e425c0db "J" | |
556 | $ hg glog -r 'sort(all(), topo)' |
|
556 | $ hg glog -r 'sort(all(), topo)' | |
557 | o 16:556c085f8b52 J |
|
557 | o 16:556c085f8b52 J | |
558 | | |
|
558 | | | |
559 | o 15:8761f6c9123f G2 |
|
559 | o 15:8761f6c9123f G2 | |
560 | | |
|
560 | | | |
561 | o 14:a7aeffe59b65 E |
|
561 | o 14:a7aeffe59b65 E | |
562 | | |
|
562 | | | |
563 | | o 13:e1e914ede9ab D |
|
563 | | o 13:e1e914ede9ab D | |
564 | |/ |
|
564 | |/ | |
565 | | o 12:01947e9b98aa C |
|
565 | | o 12:01947e9b98aa C | |
566 | |/ |
|
566 | |/ | |
567 | o 11:0947baa74d47 Split B |
|
567 | o 11:0947baa74d47 Split B | |
568 | | |
|
568 | | | |
569 | | * 9:88ede1d5ee13 I |
|
569 | | * 9:88ede1d5ee13 I | |
570 | | | |
|
570 | | | | |
571 | | x 6:af8cbf225b7b G1 |
|
571 | | x 6:af8cbf225b7b G1 | |
572 | | | |
|
572 | | | | |
573 | | x 3:be0ef73c17ad D |
|
573 | | x 3:be0ef73c17ad D | |
574 | | | |
|
574 | | | | |
575 | | | * 8:74863e5b5074 H |
|
575 | | | * 8:74863e5b5074 H | |
576 | | | | |
|
576 | | | | | |
577 | | | x 5:ee481a2a1e69 F |
|
577 | | | x 5:ee481a2a1e69 F | |
578 | | | | |
|
578 | | | | | |
579 | | | x 2:26805aba1e60 C |
|
579 | | | x 2:26805aba1e60 C | |
580 | | |/ |
|
580 | | |/ | |
581 | | x 1:112478962961 B |
|
581 | | x 1:112478962961 B | |
582 | |/ |
|
582 | |/ | |
583 | o 0:426bada5c675 A |
|
583 | o 0:426bada5c675 A | |
584 |
|
584 | |||
585 | #endif |
|
585 | #endif | |
586 |
|
586 | |||
587 | Preserve secret phase in split |
|
587 | Preserve secret phase in split | |
588 |
|
588 | |||
589 | $ cp -R $TESTTMP/clean $TESTTMP/phases1 |
|
589 | $ cp -R $TESTTMP/clean $TESTTMP/phases1 | |
590 | $ cd $TESTTMP/phases1 |
|
590 | $ cd $TESTTMP/phases1 | |
591 | $ hg phase --secret -fr tip |
|
591 | $ hg phase --secret -fr tip | |
592 | $ hg log -T '{short(node)} {phase}\n' |
|
592 | $ hg log -T '{short(node)} {phase}\n' | |
593 | 1df0d5c5a3ab secret |
|
593 | 1df0d5c5a3ab secret | |
594 | a61bcde8c529 draft |
|
594 | a61bcde8c529 draft | |
595 | $ runsplit tip >/dev/null |
|
595 | $ runsplit tip >/dev/null | |
596 | $ hg log -T '{short(node)} {phase}\n' |
|
596 | $ hg log -T '{short(node)} {phase}\n' | |
597 | 00eebaf8d2e2 secret |
|
597 | 00eebaf8d2e2 secret | |
598 | a09ad58faae3 secret |
|
598 | a09ad58faae3 secret | |
599 | e704349bd21b secret |
|
599 | e704349bd21b secret | |
600 | a61bcde8c529 draft |
|
600 | a61bcde8c529 draft | |
601 |
|
601 | |||
602 | Do not move things to secret even if phases.new-commit=secret |
|
602 | Do not move things to secret even if phases.new-commit=secret | |
603 |
|
603 | |||
604 | $ cp -R $TESTTMP/clean $TESTTMP/phases2 |
|
604 | $ cp -R $TESTTMP/clean $TESTTMP/phases2 | |
605 | $ cd $TESTTMP/phases2 |
|
605 | $ cd $TESTTMP/phases2 | |
606 | $ cat >> .hg/hgrc <<EOF |
|
606 | $ cat >> .hg/hgrc <<EOF | |
607 | > [phases] |
|
607 | > [phases] | |
608 | > new-commit=secret |
|
608 | > new-commit=secret | |
609 | > EOF |
|
609 | > EOF | |
610 | $ hg log -T '{short(node)} {phase}\n' |
|
610 | $ hg log -T '{short(node)} {phase}\n' | |
611 | 1df0d5c5a3ab draft |
|
611 | 1df0d5c5a3ab draft | |
612 | a61bcde8c529 draft |
|
612 | a61bcde8c529 draft | |
613 | $ runsplit tip >/dev/null |
|
613 | $ runsplit tip >/dev/null | |
614 | $ hg log -T '{short(node)} {phase}\n' |
|
614 | $ hg log -T '{short(node)} {phase}\n' | |
615 | 00eebaf8d2e2 draft |
|
615 | 00eebaf8d2e2 draft | |
616 | a09ad58faae3 draft |
|
616 | a09ad58faae3 draft | |
617 | e704349bd21b draft |
|
617 | e704349bd21b draft | |
618 | a61bcde8c529 draft |
|
618 | a61bcde8c529 draft | |
619 |
|
619 | |||
620 | `hg split` with ignoreblanklines=1 does not infinite loop |
|
620 | `hg split` with ignoreblanklines=1 does not infinite loop | |
621 |
|
621 | |||
622 | $ mkdir $TESTTMP/f |
|
622 | $ mkdir $TESTTMP/f | |
623 | $ hg init $TESTTMP/f/a |
|
623 | $ hg init $TESTTMP/f/a | |
624 | $ cd $TESTTMP/f/a |
|
624 | $ cd $TESTTMP/f/a | |
625 | $ printf '1\n2\n3\n4\n5\n' > foo |
|
625 | $ printf '1\n2\n3\n4\n5\n' > foo | |
626 | $ cp foo bar |
|
626 | $ cp foo bar | |
627 | $ hg ci -qAm initial |
|
627 | $ hg ci -qAm initial | |
628 | $ printf '1\n\n2\n3\ntest\n4\n5\n' > bar |
|
628 | $ printf '1\n\n2\n3\ntest\n4\n5\n' > bar | |
629 | $ printf '1\n2\n3\ntest\n4\n5\n' > foo |
|
629 | $ printf '1\n2\n3\ntest\n4\n5\n' > foo | |
630 | $ hg ci -qm splitme |
|
630 | $ hg ci -qm splitme | |
631 | $ cat > $TESTTMP/messages <<EOF |
|
631 | $ cat > $TESTTMP/messages <<EOF | |
632 | > split 1 |
|
632 | > split 1 | |
633 | > -- |
|
633 | > -- | |
634 | > split 2 |
|
634 | > split 2 | |
635 | > EOF |
|
635 | > EOF | |
636 | $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split |
|
636 | $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split | |
637 | diff --git a/bar b/bar |
|
637 | diff --git a/bar b/bar | |
638 | 2 hunks, 2 lines changed |
|
638 | 2 hunks, 2 lines changed | |
639 | examine changes to 'bar'? |
|
639 | examine changes to 'bar'? | |
640 | (enter ? for help) [Ynesfdaq?] f |
|
640 | (enter ? for help) [Ynesfdaq?] f | |
641 |
|
641 | |||
642 | diff --git a/foo b/foo |
|
642 | diff --git a/foo b/foo | |
643 | 1 hunks, 1 lines changed |
|
643 | 1 hunks, 1 lines changed | |
644 | examine changes to 'foo'? |
|
644 | examine changes to 'foo'? | |
645 | (enter ? for help) [Ynesfdaq?] n |
|
645 | (enter ? for help) [Ynesfdaq?] n | |
646 |
|
646 | |||
647 | EDITOR: HG: Splitting dd3c45017cbf. Write commit message for the first split changeset. |
|
647 | EDITOR: HG: Splitting dd3c45017cbf. Write commit message for the first split changeset. | |
648 | EDITOR: splitme |
|
648 | EDITOR: splitme | |
649 | EDITOR: |
|
649 | EDITOR: | |
650 | EDITOR: |
|
650 | EDITOR: | |
651 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
651 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
652 | EDITOR: HG: Leave message empty to abort commit. |
|
652 | EDITOR: HG: Leave message empty to abort commit. | |
653 | EDITOR: HG: -- |
|
653 | EDITOR: HG: -- | |
654 | EDITOR: HG: user: test |
|
654 | EDITOR: HG: user: test | |
655 | EDITOR: HG: branch 'default' |
|
655 | EDITOR: HG: branch 'default' | |
656 | EDITOR: HG: changed bar |
|
656 | EDITOR: HG: changed bar | |
657 | created new head |
|
657 | created new head | |
658 | diff --git a/foo b/foo |
|
658 | diff --git a/foo b/foo | |
659 | 1 hunks, 1 lines changed |
|
659 | 1 hunks, 1 lines changed | |
660 | examine changes to 'foo'? |
|
660 | examine changes to 'foo'? | |
661 | (enter ? for help) [Ynesfdaq?] f |
|
661 | (enter ? for help) [Ynesfdaq?] f | |
662 |
|
662 | |||
663 | EDITOR: HG: Splitting dd3c45017cbf. So far it has been split into: |
|
663 | EDITOR: HG: Splitting dd3c45017cbf. So far it has been split into: | |
664 | EDITOR: HG: - 2:f205aea1c624 tip "split 1" |
|
664 | EDITOR: HG: - 2:f205aea1c624 tip "split 1" | |
665 | EDITOR: HG: Write commit message for the next split changeset. |
|
665 | EDITOR: HG: Write commit message for the next split changeset. | |
666 | EDITOR: splitme |
|
666 | EDITOR: splitme | |
667 | EDITOR: |
|
667 | EDITOR: | |
668 | EDITOR: |
|
668 | EDITOR: | |
669 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
669 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
670 | EDITOR: HG: Leave message empty to abort commit. |
|
670 | EDITOR: HG: Leave message empty to abort commit. | |
671 | EDITOR: HG: -- |
|
671 | EDITOR: HG: -- | |
672 | EDITOR: HG: user: test |
|
672 | EDITOR: HG: user: test | |
673 | EDITOR: HG: branch 'default' |
|
673 | EDITOR: HG: branch 'default' | |
674 | EDITOR: HG: changed foo |
|
674 | EDITOR: HG: changed foo | |
675 | saved backup bundle to $TESTTMP/f/a/.hg/strip-backup/dd3c45017cbf-463441b5-split.hg (obsstore-off !) |
|
675 | saved backup bundle to $TESTTMP/f/a/.hg/strip-backup/dd3c45017cbf-463441b5-split.hg (obsstore-off !) | |
676 |
|
676 | |||
677 | Let's try that again, with a slightly different set of patches, to ensure that |
|
677 | Let's try that again, with a slightly different set of patches, to ensure that | |
678 | the ignoreblanklines thing isn't somehow position dependent. |
|
678 | the ignoreblanklines thing isn't somehow position dependent. | |
679 |
|
679 | |||
680 | $ hg init $TESTTMP/f/b |
|
680 | $ hg init $TESTTMP/f/b | |
681 | $ cd $TESTTMP/f/b |
|
681 | $ cd $TESTTMP/f/b | |
682 | $ printf '1\n2\n3\n4\n5\n' > foo |
|
682 | $ printf '1\n2\n3\n4\n5\n' > foo | |
683 | $ cp foo bar |
|
683 | $ cp foo bar | |
684 | $ hg ci -qAm initial |
|
684 | $ hg ci -qAm initial | |
685 | $ printf '1\n2\n3\ntest\n4\n5\n' > bar |
|
685 | $ printf '1\n2\n3\ntest\n4\n5\n' > bar | |
686 | $ printf '1\n2\n3\ntest\n4\n\n5\n' > foo |
|
686 | $ printf '1\n2\n3\ntest\n4\n\n5\n' > foo | |
687 | $ hg ci -qm splitme |
|
687 | $ hg ci -qm splitme | |
688 | $ cat > $TESTTMP/messages <<EOF |
|
688 | $ cat > $TESTTMP/messages <<EOF | |
689 | > split 1 |
|
689 | > split 1 | |
690 | > -- |
|
690 | > -- | |
691 | > split 2 |
|
691 | > split 2 | |
692 | > EOF |
|
692 | > EOF | |
693 | $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split |
|
693 | $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split | |
694 | diff --git a/bar b/bar |
|
694 | diff --git a/bar b/bar | |
695 | 1 hunks, 1 lines changed |
|
695 | 1 hunks, 1 lines changed | |
696 | examine changes to 'bar'? |
|
696 | examine changes to 'bar'? | |
697 | (enter ? for help) [Ynesfdaq?] f |
|
697 | (enter ? for help) [Ynesfdaq?] f | |
698 |
|
698 | |||
699 | diff --git a/foo b/foo |
|
699 | diff --git a/foo b/foo | |
700 | 2 hunks, 2 lines changed |
|
700 | 2 hunks, 2 lines changed | |
701 | examine changes to 'foo'? |
|
701 | examine changes to 'foo'? | |
702 | (enter ? for help) [Ynesfdaq?] n |
|
702 | (enter ? for help) [Ynesfdaq?] n | |
703 |
|
703 | |||
704 | EDITOR: HG: Splitting 904c80b40a4a. Write commit message for the first split changeset. |
|
704 | EDITOR: HG: Splitting 904c80b40a4a. Write commit message for the first split changeset. | |
705 | EDITOR: splitme |
|
705 | EDITOR: splitme | |
706 | EDITOR: |
|
706 | EDITOR: | |
707 | EDITOR: |
|
707 | EDITOR: | |
708 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
708 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
709 | EDITOR: HG: Leave message empty to abort commit. |
|
709 | EDITOR: HG: Leave message empty to abort commit. | |
710 | EDITOR: HG: -- |
|
710 | EDITOR: HG: -- | |
711 | EDITOR: HG: user: test |
|
711 | EDITOR: HG: user: test | |
712 | EDITOR: HG: branch 'default' |
|
712 | EDITOR: HG: branch 'default' | |
713 | EDITOR: HG: changed bar |
|
713 | EDITOR: HG: changed bar | |
714 | created new head |
|
714 | created new head | |
715 | diff --git a/foo b/foo |
|
715 | diff --git a/foo b/foo | |
716 | 2 hunks, 2 lines changed |
|
716 | 2 hunks, 2 lines changed | |
717 | examine changes to 'foo'? |
|
717 | examine changes to 'foo'? | |
718 | (enter ? for help) [Ynesfdaq?] f |
|
718 | (enter ? for help) [Ynesfdaq?] f | |
719 |
|
719 | |||
720 | EDITOR: HG: Splitting 904c80b40a4a. So far it has been split into: |
|
720 | EDITOR: HG: Splitting 904c80b40a4a. So far it has been split into: | |
721 | EDITOR: HG: - 2:ffecf40fa954 tip "split 1" |
|
721 | EDITOR: HG: - 2:ffecf40fa954 tip "split 1" | |
722 | EDITOR: HG: Write commit message for the next split changeset. |
|
722 | EDITOR: HG: Write commit message for the next split changeset. | |
723 | EDITOR: splitme |
|
723 | EDITOR: splitme | |
724 | EDITOR: |
|
724 | EDITOR: | |
725 | EDITOR: |
|
725 | EDITOR: | |
726 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
726 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
727 | EDITOR: HG: Leave message empty to abort commit. |
|
727 | EDITOR: HG: Leave message empty to abort commit. | |
728 | EDITOR: HG: -- |
|
728 | EDITOR: HG: -- | |
729 | EDITOR: HG: user: test |
|
729 | EDITOR: HG: user: test | |
730 | EDITOR: HG: branch 'default' |
|
730 | EDITOR: HG: branch 'default' | |
731 | EDITOR: HG: changed foo |
|
731 | EDITOR: HG: changed foo | |
732 | saved backup bundle to $TESTTMP/f/b/.hg/strip-backup/904c80b40a4a-47fb907f-split.hg (obsstore-off !) |
|
732 | saved backup bundle to $TESTTMP/f/b/.hg/strip-backup/904c80b40a4a-47fb907f-split.hg (obsstore-off !) | |
733 |
|
733 | |||
734 |
|
734 | |||
735 | Testing the case in split when commiting flag-only file changes (issue5864) |
|
735 | Testing the case in split when commiting flag-only file changes (issue5864) | |
736 | --------------------------------------------------------------------------- |
|
736 | --------------------------------------------------------------------------- | |
737 | $ hg init $TESTTMP/issue5864 |
|
737 | $ hg init $TESTTMP/issue5864 | |
738 | $ cd $TESTTMP/issue5864 |
|
738 | $ cd $TESTTMP/issue5864 | |
739 | $ echo foo > foo |
|
739 | $ echo foo > foo | |
740 | $ hg add foo |
|
740 | $ hg add foo | |
741 | $ hg ci -m "initial" |
|
741 | $ hg ci -m "initial" | |
742 | $ hg import -q --bypass -m "make executable" - <<EOF |
|
742 | $ hg import -q --bypass -m "make executable" - <<EOF | |
743 | > diff --git a/foo b/foo |
|
743 | > diff --git a/foo b/foo | |
744 | > old mode 100644 |
|
744 | > old mode 100644 | |
745 | > new mode 100755 |
|
745 | > new mode 100755 | |
746 | > EOF |
|
746 | > EOF | |
747 | $ hg up -q |
|
747 | $ hg up -q | |
748 |
|
748 | |||
749 | $ hg glog |
|
749 | $ hg glog | |
750 | @ 1:3a2125f0f4cb make executable |
|
750 | @ 1:3a2125f0f4cb make executable | |
751 | | |
|
751 | | | |
752 | o 0:51f273a58d82 initial |
|
752 | o 0:51f273a58d82 initial | |
753 |
|
753 | |||
754 |
|
754 | |||
755 | #if no-windows |
|
755 | #if no-windows | |
756 | $ cat > $TESTTMP/messages <<EOF |
|
756 | $ cat > $TESTTMP/messages <<EOF | |
757 | > split 1 |
|
757 | > split 1 | |
758 | > EOF |
|
758 | > EOF | |
759 | $ printf 'y\n' | hg split |
|
759 | $ printf 'y\n' | hg split | |
760 | diff --git a/foo b/foo |
|
760 | diff --git a/foo b/foo | |
761 | old mode 100644 |
|
761 | old mode 100644 | |
762 | new mode 100755 |
|
762 | new mode 100755 | |
763 | examine changes to 'foo'? |
|
763 | examine changes to 'foo'? | |
764 | (enter ? for help) [Ynesfdaq?] y |
|
764 | (enter ? for help) [Ynesfdaq?] y | |
765 |
|
765 | |||
766 | EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split changeset. |
|
766 | EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split changeset. | |
767 | EDITOR: make executable |
|
767 | EDITOR: make executable | |
768 | EDITOR: |
|
768 | EDITOR: | |
769 | EDITOR: |
|
769 | EDITOR: | |
770 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
770 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
771 | EDITOR: HG: Leave message empty to abort commit. |
|
771 | EDITOR: HG: Leave message empty to abort commit. | |
772 | EDITOR: HG: -- |
|
772 | EDITOR: HG: -- | |
773 | EDITOR: HG: user: test |
|
773 | EDITOR: HG: user: test | |
774 | EDITOR: HG: branch 'default' |
|
774 | EDITOR: HG: branch 'default' | |
775 | EDITOR: HG: changed foo |
|
775 | EDITOR: HG: changed foo | |
776 | created new head |
|
776 | created new head | |
777 | saved backup bundle to $TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg (obsstore-off !) |
|
777 | saved backup bundle to $TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg (obsstore-off !) | |
778 |
|
778 | |||
779 | $ hg log -G -T "{node|short} {desc}\n" |
|
779 | $ hg log -G -T "{node|short} {desc}\n" | |
780 | @ b154670c87da split 1 |
|
780 | @ b154670c87da split 1 | |
781 | | |
|
781 | | | |
782 | o 51f273a58d82 initial |
|
782 | o 51f273a58d82 initial | |
783 |
|
783 | |||
784 | #else |
|
784 | #else | |
785 |
|
785 | |||
786 | TODO: Fix this on Windows. See issue 2020 and 5883 |
|
786 | TODO: Fix this on Windows. See issue 2020 and 5883 | |
787 |
|
787 | |||
788 | $ printf 'y\ny\ny\n' | hg split |
|
788 | $ printf 'y\ny\ny\n' | hg split | |
789 | abort: cannot split an empty revision |
|
789 | abort: cannot split an empty revision | |
790 | [255] |
|
790 | [255] | |
791 | #endif |
|
791 | #endif | |
792 |
|
792 | |||
793 | Test that splitting moves works properly (issue5723) |
|
793 | Test that splitting moves works properly (issue5723) | |
794 | ---------------------------------------------------- |
|
794 | ---------------------------------------------------- | |
795 |
|
795 | |||
796 | $ hg init $TESTTMP/issue5723-mv |
|
796 | $ hg init $TESTTMP/issue5723-mv | |
797 | $ cd $TESTTMP/issue5723-mv |
|
797 | $ cd $TESTTMP/issue5723-mv | |
798 | $ printf '1\n2\n' > file |
|
798 | $ printf '1\n2\n' > file | |
799 | $ hg ci -qAm initial |
|
799 | $ hg ci -qAm initial | |
800 | $ hg mv file file2 |
|
800 | $ hg mv file file2 | |
801 | $ printf 'a\nb\n1\n2\n3\n4\n' > file2 |
|
801 | $ printf 'a\nb\n1\n2\n3\n4\n' > file2 | |
802 | $ cat > $TESTTMP/messages <<EOF |
|
802 | $ cat > $TESTTMP/messages <<EOF | |
803 | > split1, keeping only the numbered lines |
|
803 | > split1, keeping only the numbered lines | |
804 | > -- |
|
804 | > -- | |
805 | > split2, keeping the lettered lines |
|
805 | > split2, keeping the lettered lines | |
806 | > EOF |
|
806 | > EOF | |
807 | $ hg ci -m 'move and modify' |
|
807 | $ hg ci -m 'move and modify' | |
808 | $ printf 'y\nn\na\na\n' | hg split |
|
808 | $ printf 'y\nn\na\na\n' | hg split | |
809 | diff --git a/file b/file2 |
|
809 | diff --git a/file b/file2 | |
810 | rename from file |
|
810 | rename from file | |
811 | rename to file2 |
|
811 | rename to file2 | |
812 | 2 hunks, 4 lines changed |
|
812 | 2 hunks, 4 lines changed | |
813 | examine changes to 'file' and 'file2'? |
|
813 | examine changes to 'file' and 'file2'? | |
814 | (enter ? for help) [Ynesfdaq?] y |
|
814 | (enter ? for help) [Ynesfdaq?] y | |
815 |
|
815 | |||
816 | @@ -0,0 +1,2 @@ |
|
816 | @@ -0,0 +1,2 @@ | |
817 | +a |
|
817 | +a | |
818 | +b |
|
818 | +b | |
819 | record change 1/2 to 'file2'? |
|
819 | record change 1/2 to 'file2'? | |
820 | (enter ? for help) [Ynesfdaq?] n |
|
820 | (enter ? for help) [Ynesfdaq?] n | |
821 |
|
821 | |||
822 | @@ -2,0 +5,2 @@ 2 |
|
822 | @@ -2,0 +5,2 @@ 2 | |
823 | +3 |
|
823 | +3 | |
824 | +4 |
|
824 | +4 | |
825 | record change 2/2 to 'file2'? |
|
825 | record change 2/2 to 'file2'? | |
826 | (enter ? for help) [Ynesfdaq?] a |
|
826 | (enter ? for help) [Ynesfdaq?] a | |
827 |
|
827 | |||
828 | EDITOR: HG: Splitting 8c42fa635116. Write commit message for the first split changeset. |
|
828 | EDITOR: HG: Splitting 8c42fa635116. Write commit message for the first split changeset. | |
829 | EDITOR: move and modify |
|
829 | EDITOR: move and modify | |
830 | EDITOR: |
|
830 | EDITOR: | |
831 | EDITOR: |
|
831 | EDITOR: | |
832 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
832 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
833 | EDITOR: HG: Leave message empty to abort commit. |
|
833 | EDITOR: HG: Leave message empty to abort commit. | |
834 | EDITOR: HG: -- |
|
834 | EDITOR: HG: -- | |
835 | EDITOR: HG: user: test |
|
835 | EDITOR: HG: user: test | |
836 | EDITOR: HG: branch 'default' |
|
836 | EDITOR: HG: branch 'default' | |
837 | EDITOR: HG: added file2 |
|
837 | EDITOR: HG: added file2 | |
838 | EDITOR: HG: removed file |
|
838 | EDITOR: HG: removed file | |
839 | created new head |
|
839 | created new head | |
840 | diff --git a/file2 b/file2 |
|
840 | diff --git a/file2 b/file2 | |
841 | 1 hunks, 2 lines changed |
|
841 | 1 hunks, 2 lines changed | |
842 | examine changes to 'file2'? |
|
842 | examine changes to 'file2'? | |
843 | (enter ? for help) [Ynesfdaq?] a |
|
843 | (enter ? for help) [Ynesfdaq?] a | |
844 |
|
844 | |||
845 | EDITOR: HG: Splitting 8c42fa635116. So far it has been split into: |
|
845 | EDITOR: HG: Splitting 8c42fa635116. So far it has been split into: | |
846 | EDITOR: HG: - 2:478be2a70c27 tip "split1, keeping only the numbered lines" |
|
846 | EDITOR: HG: - 2:478be2a70c27 tip "split1, keeping only the numbered lines" | |
847 | EDITOR: HG: Write commit message for the next split changeset. |
|
847 | EDITOR: HG: Write commit message for the next split changeset. | |
848 | EDITOR: move and modify |
|
848 | EDITOR: move and modify | |
849 | EDITOR: |
|
849 | EDITOR: | |
850 | EDITOR: |
|
850 | EDITOR: | |
851 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
851 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
852 | EDITOR: HG: Leave message empty to abort commit. |
|
852 | EDITOR: HG: Leave message empty to abort commit. | |
853 | EDITOR: HG: -- |
|
853 | EDITOR: HG: -- | |
854 | EDITOR: HG: user: test |
|
854 | EDITOR: HG: user: test | |
855 | EDITOR: HG: branch 'default' |
|
855 | EDITOR: HG: branch 'default' | |
856 | EDITOR: HG: changed file2 |
|
856 | EDITOR: HG: changed file2 | |
857 | saved backup bundle to $TESTTMP/issue5723-mv/.hg/strip-backup/8c42fa635116-a38044d4-split.hg (obsstore-off !) |
|
857 | saved backup bundle to $TESTTMP/issue5723-mv/.hg/strip-backup/8c42fa635116-a38044d4-split.hg (obsstore-off !) | |
858 | $ hg log -T '{desc}: {files%"{file} "}\n' |
|
858 | $ hg log -T '{desc}: {files%"{file} "}\n' | |
859 | split2, keeping the lettered lines: file2 |
|
859 | split2, keeping the lettered lines: file2 | |
860 | split1, keeping only the numbered lines: file file2 |
|
860 | split1, keeping only the numbered lines: file file2 | |
861 | initial: file |
|
861 | initial: file | |
862 | $ cat file2 |
|
862 | $ cat file2 | |
863 | a |
|
863 | a | |
864 | b |
|
864 | b | |
865 | 1 |
|
865 | 1 | |
866 | 2 |
|
866 | 2 | |
867 | 3 |
|
867 | 3 | |
868 | 4 |
|
868 | 4 | |
869 | $ hg cat -r ".^" file2 |
|
869 | $ hg cat -r ".^" file2 | |
870 | 1 |
|
870 | 1 | |
871 | 2 |
|
871 | 2 | |
872 | 3 |
|
872 | 3 | |
873 | 4 |
|
873 | 4 | |
874 | $ hg cat -r . file2 |
|
874 | $ hg cat -r . file2 | |
875 | a |
|
875 | a | |
876 | b |
|
876 | b | |
877 | 1 |
|
877 | 1 | |
878 | 2 |
|
878 | 2 | |
879 | 3 |
|
879 | 3 | |
880 | 4 |
|
880 | 4 | |
881 |
|
881 | |||
882 |
|
882 | |||
883 | Test that splitting copies works properly (issue5723) |
|
883 | Test that splitting copies works properly (issue5723) | |
884 | ---------------------------------------------------- |
|
884 | ---------------------------------------------------- | |
885 |
|
885 | |||
886 | $ hg init $TESTTMP/issue5723-cp |
|
886 | $ hg init $TESTTMP/issue5723-cp | |
887 | $ cd $TESTTMP/issue5723-cp |
|
887 | $ cd $TESTTMP/issue5723-cp | |
888 | $ printf '1\n2\n' > file |
|
888 | $ printf '1\n2\n' > file | |
889 | $ hg ci -qAm initial |
|
889 | $ hg ci -qAm initial | |
890 | $ hg cp file file2 |
|
890 | $ hg cp file file2 | |
891 | $ printf 'a\nb\n1\n2\n3\n4\n' > file2 |
|
891 | $ printf 'a\nb\n1\n2\n3\n4\n' > file2 | |
892 | Also modify 'file' to prove that the changes aren't being pulled in |
|
892 | Also modify 'file' to prove that the changes aren't being pulled in | |
893 | accidentally. |
|
893 | accidentally. | |
894 | $ printf 'this is the new contents of "file"' > file |
|
894 | $ printf 'this is the new contents of "file"' > file | |
895 | $ cat > $TESTTMP/messages <<EOF |
|
895 | $ cat > $TESTTMP/messages <<EOF | |
896 | > split1, keeping "file" and only the numbered lines in file2 |
|
896 | > split1, keeping "file" and only the numbered lines in file2 | |
897 | > -- |
|
897 | > -- | |
898 | > split2, keeping the lettered lines in file2 |
|
898 | > split2, keeping the lettered lines in file2 | |
899 | > EOF |
|
899 | > EOF | |
900 | $ hg ci -m 'copy file->file2, modify both' |
|
900 | $ hg ci -m 'copy file->file2, modify both' | |
901 | $ printf 'f\ny\nn\na\na\n' | hg split |
|
901 | $ printf 'f\ny\nn\na\na\n' | hg split | |
902 | diff --git a/file b/file |
|
902 | diff --git a/file b/file | |
903 | 1 hunks, 2 lines changed |
|
903 | 1 hunks, 2 lines changed | |
904 | examine changes to 'file'? |
|
904 | examine changes to 'file'? | |
905 | (enter ? for help) [Ynesfdaq?] f |
|
905 | (enter ? for help) [Ynesfdaq?] f | |
906 |
|
906 | |||
907 | diff --git a/file b/file2 |
|
907 | diff --git a/file b/file2 | |
908 | copy from file |
|
908 | copy from file | |
909 | copy to file2 |
|
909 | copy to file2 | |
910 | 2 hunks, 4 lines changed |
|
910 | 2 hunks, 4 lines changed | |
911 | examine changes to 'file' and 'file2'? |
|
911 | examine changes to 'file' and 'file2'? | |
912 | (enter ? for help) [Ynesfdaq?] y |
|
912 | (enter ? for help) [Ynesfdaq?] y | |
913 |
|
913 | |||
914 | @@ -0,0 +1,2 @@ |
|
914 | @@ -0,0 +1,2 @@ | |
915 | +a |
|
915 | +a | |
916 | +b |
|
916 | +b | |
917 | record change 2/3 to 'file2'? |
|
917 | record change 2/3 to 'file2'? | |
918 | (enter ? for help) [Ynesfdaq?] n |
|
918 | (enter ? for help) [Ynesfdaq?] n | |
919 |
|
919 | |||
920 | @@ -2,0 +5,2 @@ 2 |
|
920 | @@ -2,0 +5,2 @@ 2 | |
921 | +3 |
|
921 | +3 | |
922 | +4 |
|
922 | +4 | |
923 | record change 3/3 to 'file2'? |
|
923 | record change 3/3 to 'file2'? | |
924 | (enter ? for help) [Ynesfdaq?] a |
|
924 | (enter ? for help) [Ynesfdaq?] a | |
925 |
|
925 | |||
926 | EDITOR: HG: Splitting 41c861dfa61e. Write commit message for the first split changeset. |
|
926 | EDITOR: HG: Splitting 41c861dfa61e. Write commit message for the first split changeset. | |
927 | EDITOR: copy file->file2, modify both |
|
927 | EDITOR: copy file->file2, modify both | |
928 | EDITOR: |
|
928 | EDITOR: | |
929 | EDITOR: |
|
929 | EDITOR: | |
930 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
930 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
931 | EDITOR: HG: Leave message empty to abort commit. |
|
931 | EDITOR: HG: Leave message empty to abort commit. | |
932 | EDITOR: HG: -- |
|
932 | EDITOR: HG: -- | |
933 | EDITOR: HG: user: test |
|
933 | EDITOR: HG: user: test | |
934 | EDITOR: HG: branch 'default' |
|
934 | EDITOR: HG: branch 'default' | |
935 | EDITOR: HG: added file2 |
|
935 | EDITOR: HG: added file2 | |
936 | EDITOR: HG: changed file |
|
936 | EDITOR: HG: changed file | |
937 | created new head |
|
937 | created new head | |
938 | diff --git a/file2 b/file2 |
|
938 | diff --git a/file2 b/file2 | |
939 | 1 hunks, 2 lines changed |
|
939 | 1 hunks, 2 lines changed | |
940 | examine changes to 'file2'? |
|
940 | examine changes to 'file2'? | |
941 | (enter ? for help) [Ynesfdaq?] a |
|
941 | (enter ? for help) [Ynesfdaq?] a | |
942 |
|
942 | |||
943 | EDITOR: HG: Splitting 41c861dfa61e. So far it has been split into: |
|
943 | EDITOR: HG: Splitting 41c861dfa61e. So far it has been split into: | |
944 | EDITOR: HG: - 2:4b19e06610eb tip "split1, keeping "file" and only the numbered lines in file2" |
|
944 | EDITOR: HG: - 2:4b19e06610eb tip "split1, keeping "file" and only the numbered lines in file2" | |
945 | EDITOR: HG: Write commit message for the next split changeset. |
|
945 | EDITOR: HG: Write commit message for the next split changeset. | |
946 | EDITOR: copy file->file2, modify both |
|
946 | EDITOR: copy file->file2, modify both | |
947 | EDITOR: |
|
947 | EDITOR: | |
948 | EDITOR: |
|
948 | EDITOR: | |
949 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. |
|
949 | EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed. | |
950 | EDITOR: HG: Leave message empty to abort commit. |
|
950 | EDITOR: HG: Leave message empty to abort commit. | |
951 | EDITOR: HG: -- |
|
951 | EDITOR: HG: -- | |
952 | EDITOR: HG: user: test |
|
952 | EDITOR: HG: user: test | |
953 | EDITOR: HG: branch 'default' |
|
953 | EDITOR: HG: branch 'default' | |
954 | EDITOR: HG: changed file2 |
|
954 | EDITOR: HG: changed file2 | |
955 | saved backup bundle to $TESTTMP/issue5723-cp/.hg/strip-backup/41c861dfa61e-467e8d3c-split.hg (obsstore-off !) |
|
955 | saved backup bundle to $TESTTMP/issue5723-cp/.hg/strip-backup/41c861dfa61e-467e8d3c-split.hg (obsstore-off !) | |
956 | $ hg log -T '{desc}: {files%"{file} "}\n' |
|
956 | $ hg log -T '{desc}: {files%"{file} "}\n' | |
957 | split2, keeping the lettered lines in file2: file2 |
|
957 | split2, keeping the lettered lines in file2: file2 | |
958 | split1, keeping "file" and only the numbered lines in file2: file file2 |
|
958 | split1, keeping "file" and only the numbered lines in file2: file file2 | |
959 | initial: file |
|
959 | initial: file | |
960 | $ cat file2 |
|
960 | $ cat file2 | |
961 | a |
|
961 | a | |
962 | b |
|
962 | b | |
963 | 1 |
|
963 | 1 | |
964 | 2 |
|
964 | 2 | |
965 | 3 |
|
965 | 3 | |
966 | 4 |
|
966 | 4 | |
967 | $ hg cat -r ".^" file2 |
|
967 | $ hg cat -r ".^" file2 | |
968 | 1 |
|
968 | 1 | |
969 | 2 |
|
969 | 2 | |
970 | 3 |
|
970 | 3 | |
971 | 4 |
|
971 | 4 | |
972 | $ hg cat -r . file2 |
|
972 | $ hg cat -r . file2 | |
973 | a |
|
973 | a | |
974 | b |
|
974 | b | |
975 | 1 |
|
975 | 1 | |
976 | 2 |
|
976 | 2 | |
977 | 3 |
|
977 | 3 | |
978 | 4 |
|
978 | 4 |
@@ -1,421 +1,421 b'' | |||||
1 | Test for command `hg unamend` which lives in uncommit extension |
|
1 | Test for command `hg unamend` which lives in uncommit extension | |
2 | =============================================================== |
|
2 | =============================================================== | |
3 |
|
3 | |||
4 | $ cat >> $HGRCPATH << EOF |
|
4 | $ cat >> $HGRCPATH << EOF | |
5 | > [alias] |
|
5 | > [alias] | |
6 | > glog = log -G -T '{rev}:{node|short} {desc}' |
|
6 | > glog = log -G -T '{rev}:{node|short} {desc}' | |
7 | > [experimental] |
|
7 | > [experimental] | |
8 | > evolution = createmarkers, allowunstable |
|
8 | > evolution = createmarkers, allowunstable | |
9 | > [extensions] |
|
9 | > [extensions] | |
10 | > rebase = |
|
10 | > rebase = | |
11 | > amend = |
|
11 | > amend = | |
12 | > uncommit = |
|
12 | > uncommit = | |
13 | > EOF |
|
13 | > EOF | |
14 |
|
14 | |||
15 | Repo Setup |
|
15 | Repo Setup | |
16 |
|
16 | |||
17 | $ hg init repo |
|
17 | $ hg init repo | |
18 | $ cd repo |
|
18 | $ cd repo | |
19 | $ for ch in a b c d e f g h; do touch $ch; echo "foo" >> $ch; hg ci -Aqm "Added "$ch; done |
|
19 | $ for ch in a b c d e f g h; do touch $ch; echo "foo" >> $ch; hg ci -Aqm "Added "$ch; done | |
20 |
|
20 | |||
21 | $ hg glog |
|
21 | $ hg glog | |
22 | @ 7:ec2426147f0e Added h |
|
22 | @ 7:ec2426147f0e Added h | |
23 | | |
|
23 | | | |
24 | o 6:87d6d6676308 Added g |
|
24 | o 6:87d6d6676308 Added g | |
25 | | |
|
25 | | | |
26 | o 5:825660c69f0c Added f |
|
26 | o 5:825660c69f0c Added f | |
27 | | |
|
27 | | | |
28 | o 4:aa98ab95a928 Added e |
|
28 | o 4:aa98ab95a928 Added e | |
29 | | |
|
29 | | | |
30 | o 3:62615734edd5 Added d |
|
30 | o 3:62615734edd5 Added d | |
31 | | |
|
31 | | | |
32 | o 2:28ad74487de9 Added c |
|
32 | o 2:28ad74487de9 Added c | |
33 | | |
|
33 | | | |
34 | o 1:29becc82797a Added b |
|
34 | o 1:29becc82797a Added b | |
35 | | |
|
35 | | | |
36 | o 0:18d04c59bb5d Added a |
|
36 | o 0:18d04c59bb5d Added a | |
37 |
|
37 | |||
38 | Trying to unamend when there was no amend done |
|
38 | Trying to unamend when there was no amend done | |
39 |
|
39 | |||
40 | $ hg unamend |
|
40 | $ hg unamend | |
41 | abort: changeset must have one predecessor, found 0 predecessors |
|
41 | abort: changeset must have one predecessor, found 0 predecessors | |
42 | [255] |
|
42 | [255] | |
43 |
|
43 | |||
44 | Unamend on clean wdir and tip |
|
44 | Unamend on clean wdir and tip | |
45 |
|
45 | |||
46 | $ echo "bar" >> h |
|
46 | $ echo "bar" >> h | |
47 | $ hg amend |
|
47 | $ hg amend | |
48 |
|
48 | |||
49 | $ hg exp |
|
49 | $ hg exp | |
50 | # HG changeset patch |
|
50 | # HG changeset patch | |
51 | # User test |
|
51 | # User test | |
52 | # Date 0 0 |
|
52 | # Date 0 0 | |
53 | # Thu Jan 01 00:00:00 1970 +0000 |
|
53 | # Thu Jan 01 00:00:00 1970 +0000 | |
54 | # Node ID c9fa1a715c1b7661c0fafb362a9f30bd75878d7d |
|
54 | # Node ID c9fa1a715c1b7661c0fafb362a9f30bd75878d7d | |
55 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 |
|
55 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 | |
56 | Added h |
|
56 | Added h | |
57 |
|
57 | |||
58 | diff -r 87d6d6676308 -r c9fa1a715c1b h |
|
58 | diff -r 87d6d6676308 -r c9fa1a715c1b h | |
59 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
59 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
60 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 |
|
60 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 | |
61 | @@ -0,0 +1,2 @@ |
|
61 | @@ -0,0 +1,2 @@ | |
62 | +foo |
|
62 | +foo | |
63 | +bar |
|
63 | +bar | |
64 |
|
64 | |||
65 | $ hg glog --hidden |
|
65 | $ hg glog --hidden | |
66 | @ 8:c9fa1a715c1b Added h |
|
66 | @ 8:c9fa1a715c1b Added h | |
67 | | |
|
67 | | | |
68 | | x 7:ec2426147f0e Added h |
|
68 | | x 7:ec2426147f0e Added h | |
69 | |/ |
|
69 | |/ | |
70 | o 6:87d6d6676308 Added g |
|
70 | o 6:87d6d6676308 Added g | |
71 | | |
|
71 | | | |
72 | o 5:825660c69f0c Added f |
|
72 | o 5:825660c69f0c Added f | |
73 | | |
|
73 | | | |
74 | o 4:aa98ab95a928 Added e |
|
74 | o 4:aa98ab95a928 Added e | |
75 | | |
|
75 | | | |
76 | o 3:62615734edd5 Added d |
|
76 | o 3:62615734edd5 Added d | |
77 | | |
|
77 | | | |
78 | o 2:28ad74487de9 Added c |
|
78 | o 2:28ad74487de9 Added c | |
79 | | |
|
79 | | | |
80 | o 1:29becc82797a Added b |
|
80 | o 1:29becc82797a Added b | |
81 | | |
|
81 | | | |
82 | o 0:18d04c59bb5d Added a |
|
82 | o 0:18d04c59bb5d Added a | |
83 |
|
83 | |||
84 | $ hg unamend |
|
84 | $ hg unamend | |
85 | $ hg glog --hidden |
|
85 | $ hg glog --hidden | |
86 | @ 9:46d02d47eec6 Added h |
|
86 | @ 9:46d02d47eec6 Added h | |
87 | | |
|
87 | | | |
88 | | x 8:c9fa1a715c1b Added h |
|
88 | | x 8:c9fa1a715c1b Added h | |
89 | |/ |
|
89 | |/ | |
90 | | x 7:ec2426147f0e Added h |
|
90 | | x 7:ec2426147f0e Added h | |
91 | |/ |
|
91 | |/ | |
92 | o 6:87d6d6676308 Added g |
|
92 | o 6:87d6d6676308 Added g | |
93 | | |
|
93 | | | |
94 | o 5:825660c69f0c Added f |
|
94 | o 5:825660c69f0c Added f | |
95 | | |
|
95 | | | |
96 | o 4:aa98ab95a928 Added e |
|
96 | o 4:aa98ab95a928 Added e | |
97 | | |
|
97 | | | |
98 | o 3:62615734edd5 Added d |
|
98 | o 3:62615734edd5 Added d | |
99 | | |
|
99 | | | |
100 | o 2:28ad74487de9 Added c |
|
100 | o 2:28ad74487de9 Added c | |
101 | | |
|
101 | | | |
102 | o 1:29becc82797a Added b |
|
102 | o 1:29becc82797a Added b | |
103 | | |
|
103 | | | |
104 | o 0:18d04c59bb5d Added a |
|
104 | o 0:18d04c59bb5d Added a | |
105 |
|
105 | |||
106 | $ hg diff |
|
106 | $ hg diff | |
107 | diff -r 46d02d47eec6 h |
|
107 | diff -r 46d02d47eec6 h | |
108 | --- a/h Thu Jan 01 00:00:00 1970 +0000 |
|
108 | --- a/h Thu Jan 01 00:00:00 1970 +0000 | |
109 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 |
|
109 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 | |
110 | @@ -1,1 +1,2 @@ |
|
110 | @@ -1,1 +1,2 @@ | |
111 | foo |
|
111 | foo | |
112 | +bar |
|
112 | +bar | |
113 |
|
113 | |||
114 | $ hg exp |
|
114 | $ hg exp | |
115 | # HG changeset patch |
|
115 | # HG changeset patch | |
116 | # User test |
|
116 | # User test | |
117 | # Date 0 0 |
|
117 | # Date 0 0 | |
118 | # Thu Jan 01 00:00:00 1970 +0000 |
|
118 | # Thu Jan 01 00:00:00 1970 +0000 | |
119 | # Node ID 46d02d47eec6ca096b8dcab3f8f5579c40c3dd9a |
|
119 | # Node ID 46d02d47eec6ca096b8dcab3f8f5579c40c3dd9a | |
120 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 |
|
120 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 | |
121 | Added h |
|
121 | Added h | |
122 |
|
122 | |||
123 | diff -r 87d6d6676308 -r 46d02d47eec6 h |
|
123 | diff -r 87d6d6676308 -r 46d02d47eec6 h | |
124 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
124 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
125 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 |
|
125 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 | |
126 | @@ -0,0 +1,1 @@ |
|
126 | @@ -0,0 +1,1 @@ | |
127 | +foo |
|
127 | +foo | |
128 |
|
128 | |||
129 | $ hg status |
|
129 | $ hg status | |
130 | M h |
|
130 | M h | |
131 |
|
131 | |||
132 | $ hg log -r . -T '{extras % "{extra}\n"}' --config alias.log=log |
|
132 | $ hg log -r . -T '{extras % "{extra}\n"}' --config alias.log=log | |
133 | branch=default |
|
133 | branch=default | |
134 | unamend_source=c9fa1a715c1b7661c0fafb362a9f30bd75878d7d |
|
134 | unamend_source=c9fa1a715c1b7661c0fafb362a9f30bd75878d7d | |
135 |
|
135 | |||
136 | Using unamend to undo an unamed (intentional) |
|
136 | Using unamend to undo an unamed (intentional) | |
137 |
|
137 | |||
138 | $ hg unamend |
|
138 | $ hg unamend | |
139 | $ hg exp |
|
139 | $ hg exp | |
140 | # HG changeset patch |
|
140 | # HG changeset patch | |
141 | # User test |
|
141 | # User test | |
142 | # Date 0 0 |
|
142 | # Date 0 0 | |
143 | # Thu Jan 01 00:00:00 1970 +0000 |
|
143 | # Thu Jan 01 00:00:00 1970 +0000 | |
144 | # Node ID 850ddfc1bc662997ec6094ada958f01f0cc8070a |
|
144 | # Node ID 850ddfc1bc662997ec6094ada958f01f0cc8070a | |
145 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 |
|
145 | # Parent 87d6d66763085b629e6d7ed56778c79827273022 | |
146 | Added h |
|
146 | Added h | |
147 |
|
147 | |||
148 | diff -r 87d6d6676308 -r 850ddfc1bc66 h |
|
148 | diff -r 87d6d6676308 -r 850ddfc1bc66 h | |
149 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
149 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
150 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 |
|
150 | +++ b/h Thu Jan 01 00:00:00 1970 +0000 | |
151 | @@ -0,0 +1,2 @@ |
|
151 | @@ -0,0 +1,2 @@ | |
152 | +foo |
|
152 | +foo | |
153 | +bar |
|
153 | +bar | |
154 | $ hg diff |
|
154 | $ hg diff | |
155 |
|
155 | |||
156 | Unamend on a dirty working directory |
|
156 | Unamend on a dirty working directory | |
157 |
|
157 | |||
158 | $ echo "bar" >> a |
|
158 | $ echo "bar" >> a | |
159 | $ hg amend |
|
159 | $ hg amend | |
160 | $ echo "foobar" >> a |
|
160 | $ echo "foobar" >> a | |
161 | $ echo "bar" >> b |
|
161 | $ echo "bar" >> b | |
162 | $ hg status |
|
162 | $ hg status | |
163 | M a |
|
163 | M a | |
164 | M b |
|
164 | M b | |
165 |
|
165 | |||
166 | $ hg unamend |
|
166 | $ hg unamend | |
167 |
|
167 | |||
168 | $ hg status |
|
168 | $ hg status | |
169 | M a |
|
169 | M a | |
170 | M b |
|
170 | M b | |
171 |
|
171 | |||
172 | $ hg diff |
|
172 | $ hg diff | |
173 | diff -r ec338db45d51 a |
|
173 | diff -r ec338db45d51 a | |
174 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
|
174 | --- a/a Thu Jan 01 00:00:00 1970 +0000 | |
175 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
|
175 | +++ b/a Thu Jan 01 00:00:00 1970 +0000 | |
176 | @@ -1,1 +1,3 @@ |
|
176 | @@ -1,1 +1,3 @@ | |
177 | foo |
|
177 | foo | |
178 | +bar |
|
178 | +bar | |
179 | +foobar |
|
179 | +foobar | |
180 | diff -r ec338db45d51 b |
|
180 | diff -r ec338db45d51 b | |
181 | --- a/b Thu Jan 01 00:00:00 1970 +0000 |
|
181 | --- a/b Thu Jan 01 00:00:00 1970 +0000 | |
182 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
182 | +++ b/b Thu Jan 01 00:00:00 1970 +0000 | |
183 | @@ -1,1 +1,2 @@ |
|
183 | @@ -1,1 +1,2 @@ | |
184 | foo |
|
184 | foo | |
185 | +bar |
|
185 | +bar | |
186 |
|
186 | |||
187 | Unamending an added file |
|
187 | Unamending an added file | |
188 |
|
188 | |||
189 | $ hg ci -m "Added things to a and b" |
|
189 | $ hg ci -m "Added things to a and b" | |
190 | $ echo foo > bar |
|
190 | $ echo foo > bar | |
191 | $ hg add bar |
|
191 | $ hg add bar | |
192 | $ hg amend |
|
192 | $ hg amend | |
193 |
|
193 | |||
194 | $ hg unamend |
|
194 | $ hg unamend | |
195 | $ hg status |
|
195 | $ hg status | |
196 | A bar |
|
196 | A bar | |
197 |
|
197 | |||
198 | $ hg revert --all |
|
198 | $ hg revert --all | |
199 | forgetting bar |
|
199 | forgetting bar | |
200 |
|
200 | |||
201 | Unamending a removed file |
|
201 | Unamending a removed file | |
202 |
|
202 | |||
203 | $ hg remove a |
|
203 | $ hg remove a | |
204 | $ hg amend |
|
204 | $ hg amend | |
205 |
|
205 | |||
206 | $ hg unamend |
|
206 | $ hg unamend | |
207 | $ hg status |
|
207 | $ hg status | |
208 | R a |
|
208 | R a | |
209 | ? bar |
|
209 | ? bar | |
210 |
|
210 | |||
211 | $ hg revert --all |
|
211 | $ hg revert --all | |
212 | undeleting a |
|
212 | undeleting a | |
213 |
|
213 | |||
214 | Unamending an added file with dirty wdir status |
|
214 | Unamending an added file with dirty wdir status | |
215 |
|
215 | |||
216 | $ hg add bar |
|
216 | $ hg add bar | |
217 | $ hg amend |
|
217 | $ hg amend | |
218 | $ echo bar >> bar |
|
218 | $ echo bar >> bar | |
219 | $ hg status |
|
219 | $ hg status | |
220 | M bar |
|
220 | M bar | |
221 |
|
221 | |||
222 | $ hg unamend |
|
222 | $ hg unamend | |
223 | $ hg status |
|
223 | $ hg status | |
224 | A bar |
|
224 | A bar | |
225 | $ hg diff |
|
225 | $ hg diff | |
226 | diff -r 7f79409af972 bar |
|
226 | diff -r 7f79409af972 bar | |
227 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
227 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
228 | +++ b/bar Thu Jan 01 00:00:00 1970 +0000 |
|
228 | +++ b/bar Thu Jan 01 00:00:00 1970 +0000 | |
229 | @@ -0,0 +1,2 @@ |
|
229 | @@ -0,0 +1,2 @@ | |
230 | +foo |
|
230 | +foo | |
231 | +bar |
|
231 | +bar | |
232 |
|
232 | |||
233 | $ hg revert --all |
|
233 | $ hg revert --all | |
234 | forgetting bar |
|
234 | forgetting bar | |
235 | $ rm bar |
|
235 | $ rm bar | |
236 |
|
236 | |||
237 | Unamending in middle of a stack |
|
237 | Unamending in middle of a stack | |
238 |
|
238 | |||
239 | $ hg glog |
|
239 | $ hg glog | |
240 | @ 19:7f79409af972 Added things to a and b |
|
240 | @ 19:7f79409af972 Added things to a and b | |
241 | | |
|
241 | | | |
242 | o 12:ec338db45d51 Added h |
|
242 | o 12:ec338db45d51 Added h | |
243 | | |
|
243 | | | |
244 | o 6:87d6d6676308 Added g |
|
244 | o 6:87d6d6676308 Added g | |
245 | | |
|
245 | | | |
246 | o 5:825660c69f0c Added f |
|
246 | o 5:825660c69f0c Added f | |
247 | | |
|
247 | | | |
248 | o 4:aa98ab95a928 Added e |
|
248 | o 4:aa98ab95a928 Added e | |
249 | | |
|
249 | | | |
250 | o 3:62615734edd5 Added d |
|
250 | o 3:62615734edd5 Added d | |
251 | | |
|
251 | | | |
252 | o 2:28ad74487de9 Added c |
|
252 | o 2:28ad74487de9 Added c | |
253 | | |
|
253 | | | |
254 | o 1:29becc82797a Added b |
|
254 | o 1:29becc82797a Added b | |
255 | | |
|
255 | | | |
256 | o 0:18d04c59bb5d Added a |
|
256 | o 0:18d04c59bb5d Added a | |
257 |
|
257 | |||
258 | $ hg up 5 |
|
258 | $ hg up 5 | |
259 | 2 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
259 | 2 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
260 | $ echo bar >> f |
|
260 | $ echo bar >> f | |
261 | $ hg amend |
|
261 | $ hg amend | |
262 | 3 new orphan changesets |
|
262 | 3 new orphan changesets | |
263 | $ hg rebase -s 6 -d . -q |
|
263 | $ hg rebase -s 6 -d . -q | |
264 |
|
264 | |||
265 | $ hg glog |
|
265 | $ hg glog | |
266 | o 23:03ddd6fc5af1 Added things to a and b |
|
266 | o 23:03ddd6fc5af1 Added things to a and b | |
267 | | |
|
267 | | | |
268 | o 22:3e7b64ee157b Added h |
|
268 | o 22:3e7b64ee157b Added h | |
269 | | |
|
269 | | | |
270 | o 21:49635b68477e Added g |
|
270 | o 21:49635b68477e Added g | |
271 | | |
|
271 | | | |
272 | @ 20:93f0e8ffab32 Added f |
|
272 | @ 20:93f0e8ffab32 Added f | |
273 | | |
|
273 | | | |
274 | o 4:aa98ab95a928 Added e |
|
274 | o 4:aa98ab95a928 Added e | |
275 | | |
|
275 | | | |
276 | o 3:62615734edd5 Added d |
|
276 | o 3:62615734edd5 Added d | |
277 | | |
|
277 | | | |
278 | o 2:28ad74487de9 Added c |
|
278 | o 2:28ad74487de9 Added c | |
279 | | |
|
279 | | | |
280 | o 1:29becc82797a Added b |
|
280 | o 1:29becc82797a Added b | |
281 | | |
|
281 | | | |
282 | o 0:18d04c59bb5d Added a |
|
282 | o 0:18d04c59bb5d Added a | |
283 |
|
283 | |||
284 |
|
284 | |||
285 | $ hg --config experimental.evolution=createmarkers unamend |
|
285 | $ hg --config experimental.evolution=createmarkers unamend | |
286 | abort: cannot unamend changeset with children |
|
286 | abort: cannot unamend changeset with children | |
287 |
[ |
|
287 | [10] | |
288 |
|
288 | |||
289 | $ hg unamend |
|
289 | $ hg unamend | |
290 | 3 new orphan changesets |
|
290 | 3 new orphan changesets | |
291 |
|
291 | |||
292 | Trying to unamend a public changeset |
|
292 | Trying to unamend a public changeset | |
293 |
|
293 | |||
294 | $ hg up -C 23 |
|
294 | $ hg up -C 23 | |
295 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
295 | 5 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
296 | $ hg phase -r . -p |
|
296 | $ hg phase -r . -p | |
297 | 1 new phase-divergent changesets |
|
297 | 1 new phase-divergent changesets | |
298 | $ hg unamend |
|
298 | $ hg unamend | |
299 | abort: cannot unamend public changesets |
|
299 | abort: cannot unamend public changesets | |
300 | (see 'hg help phases' for details) |
|
300 | (see 'hg help phases' for details) | |
301 |
[ |
|
301 | [10] | |
302 |
|
302 | |||
303 | Testing whether unamend retains copies or not |
|
303 | Testing whether unamend retains copies or not | |
304 |
|
304 | |||
305 | $ hg status |
|
305 | $ hg status | |
306 |
|
306 | |||
307 | $ hg mv a foo |
|
307 | $ hg mv a foo | |
308 |
|
308 | |||
309 | $ hg ci -m "Moved a to foo" |
|
309 | $ hg ci -m "Moved a to foo" | |
310 | $ hg exp --git |
|
310 | $ hg exp --git | |
311 | # HG changeset patch |
|
311 | # HG changeset patch | |
312 | # User test |
|
312 | # User test | |
313 | # Date 0 0 |
|
313 | # Date 0 0 | |
314 | # Thu Jan 01 00:00:00 1970 +0000 |
|
314 | # Thu Jan 01 00:00:00 1970 +0000 | |
315 | # Node ID cfef290346fbee5126313d7e1aab51d877679b09 |
|
315 | # Node ID cfef290346fbee5126313d7e1aab51d877679b09 | |
316 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 |
|
316 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 | |
317 | Moved a to foo |
|
317 | Moved a to foo | |
318 |
|
318 | |||
319 | diff --git a/a b/foo |
|
319 | diff --git a/a b/foo | |
320 | rename from a |
|
320 | rename from a | |
321 | rename to foo |
|
321 | rename to foo | |
322 |
|
322 | |||
323 | $ hg mv b foobar |
|
323 | $ hg mv b foobar | |
324 | $ hg diff --git |
|
324 | $ hg diff --git | |
325 | diff --git a/b b/foobar |
|
325 | diff --git a/b b/foobar | |
326 | rename from b |
|
326 | rename from b | |
327 | rename to foobar |
|
327 | rename to foobar | |
328 | $ hg amend |
|
328 | $ hg amend | |
329 |
|
329 | |||
330 | $ hg exp --git |
|
330 | $ hg exp --git | |
331 | # HG changeset patch |
|
331 | # HG changeset patch | |
332 | # User test |
|
332 | # User test | |
333 | # Date 0 0 |
|
333 | # Date 0 0 | |
334 | # Thu Jan 01 00:00:00 1970 +0000 |
|
334 | # Thu Jan 01 00:00:00 1970 +0000 | |
335 | # Node ID eca050985275bb271ce3092b54e56ea5c85d29a3 |
|
335 | # Node ID eca050985275bb271ce3092b54e56ea5c85d29a3 | |
336 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 |
|
336 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 | |
337 | Moved a to foo |
|
337 | Moved a to foo | |
338 |
|
338 | |||
339 | diff --git a/a b/foo |
|
339 | diff --git a/a b/foo | |
340 | rename from a |
|
340 | rename from a | |
341 | rename to foo |
|
341 | rename to foo | |
342 | diff --git a/b b/foobar |
|
342 | diff --git a/b b/foobar | |
343 | rename from b |
|
343 | rename from b | |
344 | rename to foobar |
|
344 | rename to foobar | |
345 |
|
345 | |||
346 | $ hg mv c wat |
|
346 | $ hg mv c wat | |
347 | $ hg unamend |
|
347 | $ hg unamend | |
348 |
|
348 | |||
349 | $ hg verify -v |
|
349 | $ hg verify -v | |
350 | repository uses revlog format 1 |
|
350 | repository uses revlog format 1 | |
351 | checking changesets |
|
351 | checking changesets | |
352 | checking manifests |
|
352 | checking manifests | |
353 | crosschecking files in changesets and manifests |
|
353 | crosschecking files in changesets and manifests | |
354 | checking files |
|
354 | checking files | |
355 | checked 28 changesets with 16 changes to 11 files |
|
355 | checked 28 changesets with 16 changes to 11 files | |
356 |
|
356 | |||
357 | Retained copies in new prdecessor commit |
|
357 | Retained copies in new prdecessor commit | |
358 |
|
358 | |||
359 | $ hg exp --git |
|
359 | $ hg exp --git | |
360 | # HG changeset patch |
|
360 | # HG changeset patch | |
361 | # User test |
|
361 | # User test | |
362 | # Date 0 0 |
|
362 | # Date 0 0 | |
363 | # Thu Jan 01 00:00:00 1970 +0000 |
|
363 | # Thu Jan 01 00:00:00 1970 +0000 | |
364 | # Node ID 552e3af4f01f620f88ca27be1f898316235b736a |
|
364 | # Node ID 552e3af4f01f620f88ca27be1f898316235b736a | |
365 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 |
|
365 | # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231 | |
366 | Moved a to foo |
|
366 | Moved a to foo | |
367 |
|
367 | |||
368 | diff --git a/a b/foo |
|
368 | diff --git a/a b/foo | |
369 | rename from a |
|
369 | rename from a | |
370 | rename to foo |
|
370 | rename to foo | |
371 |
|
371 | |||
372 | Retained copies in working directoy |
|
372 | Retained copies in working directoy | |
373 |
|
373 | |||
374 | $ hg diff --git |
|
374 | $ hg diff --git | |
375 | diff --git a/b b/foobar |
|
375 | diff --git a/b b/foobar | |
376 | rename from b |
|
376 | rename from b | |
377 | rename to foobar |
|
377 | rename to foobar | |
378 | diff --git a/c b/wat |
|
378 | diff --git a/c b/wat | |
379 | rename from c |
|
379 | rename from c | |
380 | rename to wat |
|
380 | rename to wat | |
381 | $ hg revert -qa |
|
381 | $ hg revert -qa | |
382 | $ rm foobar wat |
|
382 | $ rm foobar wat | |
383 |
|
383 | |||
384 | Rename a->b, then amend b->c. After unamend, should look like b->c. |
|
384 | Rename a->b, then amend b->c. After unamend, should look like b->c. | |
385 |
|
385 | |||
386 | $ hg co -q 0 |
|
386 | $ hg co -q 0 | |
387 | $ hg mv a b |
|
387 | $ hg mv a b | |
388 | $ hg ci -qm 'move to a b' |
|
388 | $ hg ci -qm 'move to a b' | |
389 | $ hg mv b c |
|
389 | $ hg mv b c | |
390 | $ hg amend |
|
390 | $ hg amend | |
391 | $ hg unamend |
|
391 | $ hg unamend | |
392 | $ hg st --copies --change . |
|
392 | $ hg st --copies --change . | |
393 | A b |
|
393 | A b | |
394 | a |
|
394 | a | |
395 | R a |
|
395 | R a | |
396 | $ hg st --copies |
|
396 | $ hg st --copies | |
397 | A c |
|
397 | A c | |
398 | b |
|
398 | b | |
399 | R b |
|
399 | R b | |
400 | $ hg revert -qa |
|
400 | $ hg revert -qa | |
401 | $ rm c |
|
401 | $ rm c | |
402 |
|
402 | |||
403 | Rename a->b, then amend b->c, and working copy change c->d. After unamend, should look like b->d |
|
403 | Rename a->b, then amend b->c, and working copy change c->d. After unamend, should look like b->d | |
404 |
|
404 | |||
405 | $ hg co -q 0 |
|
405 | $ hg co -q 0 | |
406 | $ hg mv a b |
|
406 | $ hg mv a b | |
407 | $ hg ci -qm 'move to a b' |
|
407 | $ hg ci -qm 'move to a b' | |
408 | warning: commit already existed in the repository! |
|
408 | warning: commit already existed in the repository! | |
409 | $ hg mv b c |
|
409 | $ hg mv b c | |
410 | $ hg amend |
|
410 | $ hg amend | |
411 | warning: commit already existed in the repository! |
|
411 | warning: commit already existed in the repository! | |
412 | $ hg mv c d |
|
412 | $ hg mv c d | |
413 | $ hg unamend |
|
413 | $ hg unamend | |
414 | $ hg st --copies --change . |
|
414 | $ hg st --copies --change . | |
415 | A b |
|
415 | A b | |
416 | a |
|
416 | a | |
417 | R a |
|
417 | R a | |
418 | $ hg st --copies |
|
418 | $ hg st --copies | |
419 | A d |
|
419 | A d | |
420 | b |
|
420 | b | |
421 | R b |
|
421 | R b |
@@ -1,596 +1,596 b'' | |||||
1 | Test uncommit - set up the config |
|
1 | Test uncommit - set up the config | |
2 |
|
2 | |||
3 | $ cat >> $HGRCPATH <<EOF |
|
3 | $ cat >> $HGRCPATH <<EOF | |
4 | > [experimental] |
|
4 | > [experimental] | |
5 | > evolution.createmarkers=True |
|
5 | > evolution.createmarkers=True | |
6 | > evolution.allowunstable=True |
|
6 | > evolution.allowunstable=True | |
7 | > [extensions] |
|
7 | > [extensions] | |
8 | > uncommit = |
|
8 | > uncommit = | |
9 | > drawdag=$TESTDIR/drawdag.py |
|
9 | > drawdag=$TESTDIR/drawdag.py | |
10 | > EOF |
|
10 | > EOF | |
11 |
|
11 | |||
12 | Build up a repo |
|
12 | Build up a repo | |
13 |
|
13 | |||
14 | $ hg init repo |
|
14 | $ hg init repo | |
15 | $ cd repo |
|
15 | $ cd repo | |
16 | $ hg bookmark foo |
|
16 | $ hg bookmark foo | |
17 |
|
17 | |||
18 | Help for uncommit |
|
18 | Help for uncommit | |
19 |
|
19 | |||
20 | $ hg help uncommit |
|
20 | $ hg help uncommit | |
21 | hg uncommit [OPTION]... [FILE]... |
|
21 | hg uncommit [OPTION]... [FILE]... | |
22 |
|
22 | |||
23 | uncommit part or all of a local changeset |
|
23 | uncommit part or all of a local changeset | |
24 |
|
24 | |||
25 | This command undoes the effect of a local commit, returning the affected |
|
25 | This command undoes the effect of a local commit, returning the affected | |
26 | files to their uncommitted state. This means that files modified or |
|
26 | files to their uncommitted state. This means that files modified or | |
27 | deleted in the changeset will be left unchanged, and so will remain |
|
27 | deleted in the changeset will be left unchanged, and so will remain | |
28 | modified in the working directory. |
|
28 | modified in the working directory. | |
29 |
|
29 | |||
30 | If no files are specified, the commit will be pruned, unless --keep is |
|
30 | If no files are specified, the commit will be pruned, unless --keep is | |
31 | given. |
|
31 | given. | |
32 |
|
32 | |||
33 | (use 'hg help -e uncommit' to show help for the uncommit extension) |
|
33 | (use 'hg help -e uncommit' to show help for the uncommit extension) | |
34 |
|
34 | |||
35 | options ([+] can be repeated): |
|
35 | options ([+] can be repeated): | |
36 |
|
36 | |||
37 | --keep allow an empty commit after uncommitting |
|
37 | --keep allow an empty commit after uncommitting | |
38 | --allow-dirty-working-copy allow uncommit with outstanding changes |
|
38 | --allow-dirty-working-copy allow uncommit with outstanding changes | |
39 | -n --note TEXT store a note on uncommit |
|
39 | -n --note TEXT store a note on uncommit | |
40 | -I --include PATTERN [+] include names matching the given patterns |
|
40 | -I --include PATTERN [+] include names matching the given patterns | |
41 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
41 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
42 | -m --message TEXT use text as commit message |
|
42 | -m --message TEXT use text as commit message | |
43 | -l --logfile FILE read commit message from file |
|
43 | -l --logfile FILE read commit message from file | |
44 | -d --date DATE record the specified date as commit date |
|
44 | -d --date DATE record the specified date as commit date | |
45 | -u --user USER record the specified user as committer |
|
45 | -u --user USER record the specified user as committer | |
46 | -D --currentdate record the current date as commit date |
|
46 | -D --currentdate record the current date as commit date | |
47 | -U --currentuser record the current user as committer |
|
47 | -U --currentuser record the current user as committer | |
48 |
|
48 | |||
49 | (some details hidden, use --verbose to show complete help) |
|
49 | (some details hidden, use --verbose to show complete help) | |
50 |
|
50 | |||
51 | Uncommit with no commits should fail |
|
51 | Uncommit with no commits should fail | |
52 |
|
52 | |||
53 | $ hg uncommit |
|
53 | $ hg uncommit | |
54 | abort: cannot uncommit null changeset |
|
54 | abort: cannot uncommit null changeset | |
55 | (no changeset checked out) |
|
55 | (no changeset checked out) | |
56 |
[ |
|
56 | [10] | |
57 |
|
57 | |||
58 | Create some commits |
|
58 | Create some commits | |
59 |
|
59 | |||
60 | $ touch files |
|
60 | $ touch files | |
61 | $ hg add files |
|
61 | $ hg add files | |
62 | $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done |
|
62 | $ for i in a ab abc abcd abcde; do echo $i > files; echo $i > file-$i; hg add file-$i; hg commit -m "added file-$i"; done | |
63 | $ ls -A |
|
63 | $ ls -A | |
64 | .hg |
|
64 | .hg | |
65 | file-a |
|
65 | file-a | |
66 | file-ab |
|
66 | file-ab | |
67 | file-abc |
|
67 | file-abc | |
68 | file-abcd |
|
68 | file-abcd | |
69 | file-abcde |
|
69 | file-abcde | |
70 | files |
|
70 | files | |
71 |
|
71 | |||
72 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
72 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
73 | @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
73 | @ 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde | |
74 | | |
|
74 | | | |
75 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
75 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd | |
76 | | |
|
76 | | | |
77 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
77 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc | |
78 | | |
|
78 | | | |
79 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
79 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab | |
80 | | |
|
80 | | | |
81 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
81 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a | |
82 |
|
82 | |||
83 | Simple uncommit off the top, also moves bookmark |
|
83 | Simple uncommit off the top, also moves bookmark | |
84 |
|
84 | |||
85 | $ hg bookmark |
|
85 | $ hg bookmark | |
86 | * foo 4:6c4fd43ed714 |
|
86 | * foo 4:6c4fd43ed714 | |
87 | $ hg uncommit |
|
87 | $ hg uncommit | |
88 | $ hg status |
|
88 | $ hg status | |
89 | M files |
|
89 | M files | |
90 | A file-abcde |
|
90 | A file-abcde | |
91 | $ hg bookmark |
|
91 | $ hg bookmark | |
92 | * foo 3:6db330d65db4 |
|
92 | * foo 3:6db330d65db4 | |
93 |
|
93 | |||
94 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
94 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
95 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
95 | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde | |
96 | | |
|
96 | | | |
97 | @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
97 | @ 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd | |
98 | | |
|
98 | | | |
99 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
99 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc | |
100 | | |
|
100 | | | |
101 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
101 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab | |
102 | | |
|
102 | | | |
103 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
103 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a | |
104 |
|
104 | |||
105 |
|
105 | |||
106 | Recommit |
|
106 | Recommit | |
107 |
|
107 | |||
108 | $ hg commit -m 'new change abcde' |
|
108 | $ hg commit -m 'new change abcde' | |
109 | $ hg status |
|
109 | $ hg status | |
110 | $ hg heads -T '{rev}:{node} {desc}' |
|
110 | $ hg heads -T '{rev}:{node} {desc}' | |
111 | 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol) |
|
111 | 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde (no-eol) | |
112 |
|
112 | |||
113 | Uncommit of non-existent and unchanged files aborts |
|
113 | Uncommit of non-existent and unchanged files aborts | |
114 | $ hg uncommit nothinghere |
|
114 | $ hg uncommit nothinghere | |
115 | abort: cannot uncommit "nothinghere" |
|
115 | abort: cannot uncommit "nothinghere" | |
116 | (file does not exist) |
|
116 | (file does not exist) | |
117 | [255] |
|
117 | [255] | |
118 | $ hg status |
|
118 | $ hg status | |
119 | $ hg uncommit file-abc |
|
119 | $ hg uncommit file-abc | |
120 | abort: cannot uncommit "file-abc" |
|
120 | abort: cannot uncommit "file-abc" | |
121 | (file was not changed in working directory parent) |
|
121 | (file was not changed in working directory parent) | |
122 | [255] |
|
122 | [255] | |
123 | $ hg status |
|
123 | $ hg status | |
124 |
|
124 | |||
125 | Try partial uncommit, also moves bookmark |
|
125 | Try partial uncommit, also moves bookmark | |
126 |
|
126 | |||
127 | $ hg bookmark |
|
127 | $ hg bookmark | |
128 | * foo 5:0c07a3ccda77 |
|
128 | * foo 5:0c07a3ccda77 | |
129 | $ hg uncommit files |
|
129 | $ hg uncommit files | |
130 | $ hg status |
|
130 | $ hg status | |
131 | M files |
|
131 | M files | |
132 | $ hg bookmark |
|
132 | $ hg bookmark | |
133 | * foo 6:3727deee06f7 |
|
133 | * foo 6:3727deee06f7 | |
134 | $ hg heads -T '{rev}:{node} {desc}' |
|
134 | $ hg heads -T '{rev}:{node} {desc}' | |
135 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol) |
|
135 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde (no-eol) | |
136 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
136 | $ hg log -r . -p -T '{rev}:{node} {desc}' | |
137 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde |
|
137 | 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcdediff -r 6db330d65db4 -r 3727deee06f7 file-abcde | |
138 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
138 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
139 | +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000 |
|
139 | +++ b/file-abcde Thu Jan 01 00:00:00 1970 +0000 | |
140 | @@ -0,0 +1,1 @@ |
|
140 | @@ -0,0 +1,1 @@ | |
141 | +abcde |
|
141 | +abcde | |
142 |
|
142 | |||
143 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
143 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
144 | @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde |
|
144 | @ 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde | |
145 | | |
|
145 | | | |
146 | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde |
|
146 | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde | |
147 | |/ |
|
147 | |/ | |
148 | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
148 | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde | |
149 | |/ |
|
149 | |/ | |
150 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
150 | o 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd | |
151 | | |
|
151 | | | |
152 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
152 | o 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc | |
153 | | |
|
153 | | | |
154 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
154 | o 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab | |
155 | | |
|
155 | | | |
156 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
156 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a | |
157 |
|
157 | |||
158 | $ hg commit -m 'update files for abcde' |
|
158 | $ hg commit -m 'update files for abcde' | |
159 |
|
159 | |||
160 | Uncommit with dirty state |
|
160 | Uncommit with dirty state | |
161 |
|
161 | |||
162 | $ echo "foo" >> files |
|
162 | $ echo "foo" >> files | |
163 | $ cat files |
|
163 | $ cat files | |
164 | abcde |
|
164 | abcde | |
165 | foo |
|
165 | foo | |
166 | $ hg status |
|
166 | $ hg status | |
167 | M files |
|
167 | M files | |
168 | $ hg uncommit |
|
168 | $ hg uncommit | |
169 | abort: uncommitted changes |
|
169 | abort: uncommitted changes | |
170 | (requires --allow-dirty-working-copy to uncommit) |
|
170 | (requires --allow-dirty-working-copy to uncommit) | |
171 | [20] |
|
171 | [20] | |
172 | $ hg uncommit files |
|
172 | $ hg uncommit files | |
173 | abort: uncommitted changes |
|
173 | abort: uncommitted changes | |
174 | (requires --allow-dirty-working-copy to uncommit) |
|
174 | (requires --allow-dirty-working-copy to uncommit) | |
175 | [20] |
|
175 | [20] | |
176 | $ cat files |
|
176 | $ cat files | |
177 | abcde |
|
177 | abcde | |
178 | foo |
|
178 | foo | |
179 | $ hg commit --amend -m "files abcde + foo" |
|
179 | $ hg commit --amend -m "files abcde + foo" | |
180 |
|
180 | |||
181 | Testing the 'experimental.uncommitondirtywdir' config |
|
181 | Testing the 'experimental.uncommitondirtywdir' config | |
182 |
|
182 | |||
183 | $ echo "bar" >> files |
|
183 | $ echo "bar" >> files | |
184 | $ hg uncommit |
|
184 | $ hg uncommit | |
185 | abort: uncommitted changes |
|
185 | abort: uncommitted changes | |
186 | (requires --allow-dirty-working-copy to uncommit) |
|
186 | (requires --allow-dirty-working-copy to uncommit) | |
187 | [20] |
|
187 | [20] | |
188 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
188 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
189 | $ hg commit -m "files abcde + foo" |
|
189 | $ hg commit -m "files abcde + foo" | |
190 |
|
190 | |||
191 | Uncommit in the middle of a stack, does not move bookmark |
|
191 | Uncommit in the middle of a stack, does not move bookmark | |
192 |
|
192 | |||
193 | $ hg checkout '.^^^' |
|
193 | $ hg checkout '.^^^' | |
194 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
194 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
195 | (leaving bookmark foo) |
|
195 | (leaving bookmark foo) | |
196 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
196 | $ hg log -r . -p -T '{rev}:{node} {desc}' | |
197 | 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc |
|
197 | 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abcdiff -r 69a232e754b0 -r abf2df566fc1 file-abc | |
198 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
198 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
199 | +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000 |
|
199 | +++ b/file-abc Thu Jan 01 00:00:00 1970 +0000 | |
200 | @@ -0,0 +1,1 @@ |
|
200 | @@ -0,0 +1,1 @@ | |
201 | +abc |
|
201 | +abc | |
202 | diff -r 69a232e754b0 -r abf2df566fc1 files |
|
202 | diff -r 69a232e754b0 -r abf2df566fc1 files | |
203 | --- a/files Thu Jan 01 00:00:00 1970 +0000 |
|
203 | --- a/files Thu Jan 01 00:00:00 1970 +0000 | |
204 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 |
|
204 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 | |
205 | @@ -1,1 +1,1 @@ |
|
205 | @@ -1,1 +1,1 @@ | |
206 | -ab |
|
206 | -ab | |
207 | +abc |
|
207 | +abc | |
208 |
|
208 | |||
209 | $ hg bookmark |
|
209 | $ hg bookmark | |
210 | foo 9:48e5bd7cd583 |
|
210 | foo 9:48e5bd7cd583 | |
211 | $ hg uncommit |
|
211 | $ hg uncommit | |
212 | 3 new orphan changesets |
|
212 | 3 new orphan changesets | |
213 | $ hg status |
|
213 | $ hg status | |
214 | M files |
|
214 | M files | |
215 | A file-abc |
|
215 | A file-abc | |
216 | $ hg heads -T '{rev}:{node} {desc}' |
|
216 | $ hg heads -T '{rev}:{node} {desc}' | |
217 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) |
|
217 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo (no-eol) | |
218 | $ hg bookmark |
|
218 | $ hg bookmark | |
219 | foo 9:48e5bd7cd583 |
|
219 | foo 9:48e5bd7cd583 | |
220 | $ hg commit -m 'new abc' |
|
220 | $ hg commit -m 'new abc' | |
221 | created new head |
|
221 | created new head | |
222 |
|
222 | |||
223 | Partial uncommit in the middle, does not move bookmark |
|
223 | Partial uncommit in the middle, does not move bookmark | |
224 |
|
224 | |||
225 | $ hg checkout '.^' |
|
225 | $ hg checkout '.^' | |
226 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
226 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
227 | $ hg log -r . -p -T '{rev}:{node} {desc}' |
|
227 | $ hg log -r . -p -T '{rev}:{node} {desc}' | |
228 | 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab |
|
228 | 1:69a232e754b08d568c4899475faf2eb44b857802 added file-abdiff -r 3004d2d9b508 -r 69a232e754b0 file-ab | |
229 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
229 | --- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
230 | +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000 |
|
230 | +++ b/file-ab Thu Jan 01 00:00:00 1970 +0000 | |
231 | @@ -0,0 +1,1 @@ |
|
231 | @@ -0,0 +1,1 @@ | |
232 | +ab |
|
232 | +ab | |
233 | diff -r 3004d2d9b508 -r 69a232e754b0 files |
|
233 | diff -r 3004d2d9b508 -r 69a232e754b0 files | |
234 | --- a/files Thu Jan 01 00:00:00 1970 +0000 |
|
234 | --- a/files Thu Jan 01 00:00:00 1970 +0000 | |
235 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 |
|
235 | +++ b/files Thu Jan 01 00:00:00 1970 +0000 | |
236 | @@ -1,1 +1,1 @@ |
|
236 | @@ -1,1 +1,1 @@ | |
237 | -a |
|
237 | -a | |
238 | +ab |
|
238 | +ab | |
239 |
|
239 | |||
240 | $ hg bookmark |
|
240 | $ hg bookmark | |
241 | foo 9:48e5bd7cd583 |
|
241 | foo 9:48e5bd7cd583 | |
242 | $ hg uncommit file-ab |
|
242 | $ hg uncommit file-ab | |
243 | 1 new orphan changesets |
|
243 | 1 new orphan changesets | |
244 | $ hg status |
|
244 | $ hg status | |
245 | A file-ab |
|
245 | A file-ab | |
246 |
|
246 | |||
247 | $ hg heads -T '{rev}:{node} {desc}\n' |
|
247 | $ hg heads -T '{rev}:{node} {desc}\n' | |
248 | 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab |
|
248 | 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | |
249 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
249 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | |
250 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
250 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | |
251 |
|
251 | |||
252 | $ hg bookmark |
|
252 | $ hg bookmark | |
253 | foo 9:48e5bd7cd583 |
|
253 | foo 9:48e5bd7cd583 | |
254 | $ hg commit -m 'update ab' |
|
254 | $ hg commit -m 'update ab' | |
255 | $ hg status |
|
255 | $ hg status | |
256 | $ hg heads -T '{rev}:{node} {desc}\n' |
|
256 | $ hg heads -T '{rev}:{node} {desc}\n' | |
257 | 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab |
|
257 | 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | |
258 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
258 | 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | |
259 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
259 | 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | |
260 |
|
260 | |||
261 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
261 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
262 | @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab |
|
262 | @ 12:f21039c59242b085491bb58f591afc4ed1c04c09 update ab | |
263 | | |
|
263 | | | |
264 | o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab |
|
264 | o 11:8eb87968f2edb7f27f27fe676316e179de65fff6 added file-ab | |
265 | | |
|
265 | | | |
266 | | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc |
|
266 | | * 10:5dc89ca4486f8a88716c5797fa9f498d13d7c2e1 new abc | |
267 | | | |
|
267 | | | | |
268 | | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo |
|
268 | | | * 9:48e5bd7cd583eb24164ef8b89185819c84c96ed7 files abcde + foo | |
269 | | | | |
|
269 | | | | | |
270 | | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo |
|
270 | | | | x 8:84beeba0ac30e19521c036e4d2dd3a5fa02586ff files abcde + foo | |
271 | | | |/ |
|
271 | | | |/ | |
272 | | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde |
|
272 | | | | x 7:0977fa602c2fd7d8427ed4e7ee15ea13b84c9173 update files for abcde | |
273 | | | |/ |
|
273 | | | |/ | |
274 | | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde |
|
274 | | | * 6:3727deee06f72f5ffa8db792ee299cf39e3e190b new change abcde | |
275 | | | | |
|
275 | | | | | |
276 | | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde |
|
276 | | | | x 5:0c07a3ccda771b25f1cb1edbd02e683723344ef1 new change abcde | |
277 | | | |/ |
|
277 | | | |/ | |
278 | | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde |
|
278 | | | | x 4:6c4fd43ed714e7fcd8adbaa7b16c953c2e985b60 added file-abcde | |
279 | | | |/ |
|
279 | | | |/ | |
280 | | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd |
|
280 | | | * 3:6db330d65db434145c0b59d291853e9a84719b24 added file-abcd | |
281 | | | | |
|
281 | | | | | |
282 | | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc |
|
282 | | | x 2:abf2df566fc193b3ac34d946e63c1583e4d4732b added file-abc | |
283 | | |/ |
|
283 | | |/ | |
284 | | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab |
|
284 | | x 1:69a232e754b08d568c4899475faf2eb44b857802 added file-ab | |
285 | |/ |
|
285 | |/ | |
286 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a |
|
286 | o 0:3004d2d9b50883c1538fc754a3aeb55f1b4084f6 added file-a | |
287 |
|
287 | |||
288 | Uncommit with draft parent |
|
288 | Uncommit with draft parent | |
289 |
|
289 | |||
290 | $ hg uncommit |
|
290 | $ hg uncommit | |
291 | $ hg phase -r . |
|
291 | $ hg phase -r . | |
292 | 11: draft |
|
292 | 11: draft | |
293 | $ hg commit -m 'update ab again' |
|
293 | $ hg commit -m 'update ab again' | |
294 |
|
294 | |||
295 | Phase is preserved |
|
295 | Phase is preserved | |
296 |
|
296 | |||
297 | $ hg uncommit --keep --config phases.new-commit=secret |
|
297 | $ hg uncommit --keep --config phases.new-commit=secret | |
298 | note: keeping empty commit |
|
298 | note: keeping empty commit | |
299 | $ hg phase -r . |
|
299 | $ hg phase -r . | |
300 | 14: draft |
|
300 | 14: draft | |
301 | $ hg commit --amend -m 'update ab again' |
|
301 | $ hg commit --amend -m 'update ab again' | |
302 |
|
302 | |||
303 | Uncommit with public parent |
|
303 | Uncommit with public parent | |
304 |
|
304 | |||
305 | $ hg phase -p "::.^" |
|
305 | $ hg phase -p "::.^" | |
306 | $ hg uncommit |
|
306 | $ hg uncommit | |
307 | $ hg phase -r . |
|
307 | $ hg phase -r . | |
308 | 11: public |
|
308 | 11: public | |
309 |
|
309 | |||
310 | Partial uncommit with public parent |
|
310 | Partial uncommit with public parent | |
311 |
|
311 | |||
312 | $ echo xyz > xyz |
|
312 | $ echo xyz > xyz | |
313 | $ hg add xyz |
|
313 | $ hg add xyz | |
314 | $ hg commit -m "update ab and add xyz" |
|
314 | $ hg commit -m "update ab and add xyz" | |
315 | $ hg uncommit xyz |
|
315 | $ hg uncommit xyz | |
316 | $ hg status |
|
316 | $ hg status | |
317 | A xyz |
|
317 | A xyz | |
318 | $ hg phase -r . |
|
318 | $ hg phase -r . | |
319 | 17: draft |
|
319 | 17: draft | |
320 | $ hg phase -r ".^" |
|
320 | $ hg phase -r ".^" | |
321 | 11: public |
|
321 | 11: public | |
322 |
|
322 | |||
323 | Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset |
|
323 | Uncommit with --keep or experimental.uncommit.keep leaves an empty changeset | |
324 |
|
324 | |||
325 | $ cd $TESTTMP |
|
325 | $ cd $TESTTMP | |
326 | $ hg init repo1 |
|
326 | $ hg init repo1 | |
327 | $ cd repo1 |
|
327 | $ cd repo1 | |
328 | $ hg debugdrawdag <<'EOS' |
|
328 | $ hg debugdrawdag <<'EOS' | |
329 | > Q |
|
329 | > Q | |
330 | > | |
|
330 | > | | |
331 | > P |
|
331 | > P | |
332 | > EOS |
|
332 | > EOS | |
333 | $ hg up Q -q |
|
333 | $ hg up Q -q | |
334 | $ hg uncommit --keep |
|
334 | $ hg uncommit --keep | |
335 | note: keeping empty commit |
|
335 | note: keeping empty commit | |
336 | $ hg log -G -T '{desc} FILES: {files}' |
|
336 | $ hg log -G -T '{desc} FILES: {files}' | |
337 | @ Q FILES: |
|
337 | @ Q FILES: | |
338 | | |
|
338 | | | |
339 | | x Q FILES: Q |
|
339 | | x Q FILES: Q | |
340 | |/ |
|
340 | |/ | |
341 | o P FILES: P |
|
341 | o P FILES: P | |
342 |
|
342 | |||
343 | $ cat >> .hg/hgrc <<EOF |
|
343 | $ cat >> .hg/hgrc <<EOF | |
344 | > [experimental] |
|
344 | > [experimental] | |
345 | > uncommit.keep=True |
|
345 | > uncommit.keep=True | |
346 | > EOF |
|
346 | > EOF | |
347 | $ hg ci --amend |
|
347 | $ hg ci --amend | |
348 | $ hg uncommit |
|
348 | $ hg uncommit | |
349 | note: keeping empty commit |
|
349 | note: keeping empty commit | |
350 | $ hg log -G -T '{desc} FILES: {files}' |
|
350 | $ hg log -G -T '{desc} FILES: {files}' | |
351 | @ Q FILES: |
|
351 | @ Q FILES: | |
352 | | |
|
352 | | | |
353 | | x Q FILES: Q |
|
353 | | x Q FILES: Q | |
354 | |/ |
|
354 | |/ | |
355 | o P FILES: P |
|
355 | o P FILES: P | |
356 |
|
356 | |||
357 | $ hg status |
|
357 | $ hg status | |
358 | A Q |
|
358 | A Q | |
359 | $ hg ci --amend |
|
359 | $ hg ci --amend | |
360 | $ hg uncommit --no-keep |
|
360 | $ hg uncommit --no-keep | |
361 | $ hg log -G -T '{desc} FILES: {files}' |
|
361 | $ hg log -G -T '{desc} FILES: {files}' | |
362 | x Q FILES: Q |
|
362 | x Q FILES: Q | |
363 | | |
|
363 | | | |
364 | @ P FILES: P |
|
364 | @ P FILES: P | |
365 |
|
365 | |||
366 | $ hg status |
|
366 | $ hg status | |
367 | A Q |
|
367 | A Q | |
368 | $ cd .. |
|
368 | $ cd .. | |
369 | $ rm -rf repo1 |
|
369 | $ rm -rf repo1 | |
370 |
|
370 | |||
371 | Testing uncommit while merge |
|
371 | Testing uncommit while merge | |
372 |
|
372 | |||
373 | $ hg init repo2 |
|
373 | $ hg init repo2 | |
374 | $ cd repo2 |
|
374 | $ cd repo2 | |
375 |
|
375 | |||
376 | Create some history |
|
376 | Create some history | |
377 |
|
377 | |||
378 | $ touch a |
|
378 | $ touch a | |
379 | $ hg add a |
|
379 | $ hg add a | |
380 | $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done |
|
380 | $ for i in 1 2 3; do echo $i > a; hg commit -m "a $i"; done | |
381 | $ hg checkout 0 |
|
381 | $ hg checkout 0 | |
382 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
382 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
383 | $ touch b |
|
383 | $ touch b | |
384 | $ hg add b |
|
384 | $ hg add b | |
385 | $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done |
|
385 | $ for i in 1 2 3; do echo $i > b; hg commit -m "b $i"; done | |
386 | created new head |
|
386 | created new head | |
387 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
387 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
388 | @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 |
|
388 | @ 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 | |
389 | | |
|
389 | | | |
390 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 |
|
390 | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 | |
391 | | |
|
391 | | | |
392 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 |
|
392 | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 | |
393 | | |
|
393 | | | |
394 | | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 |
|
394 | | o 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 | |
395 | | | |
|
395 | | | | |
396 | | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 |
|
396 | | o 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 | |
397 | |/ |
|
397 | |/ | |
398 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 |
|
398 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 | |
399 |
|
399 | |||
400 |
|
400 | |||
401 | Add and expect uncommit to fail on both merge working dir and merge changeset |
|
401 | Add and expect uncommit to fail on both merge working dir and merge changeset | |
402 |
|
402 | |||
403 | $ hg merge 2 |
|
403 | $ hg merge 2 | |
404 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
404 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
405 | (branch merge, don't forget to commit) |
|
405 | (branch merge, don't forget to commit) | |
406 |
|
406 | |||
407 | $ hg uncommit |
|
407 | $ hg uncommit | |
408 | abort: outstanding uncommitted merge |
|
408 | abort: outstanding uncommitted merge | |
409 | (requires --allow-dirty-working-copy to uncommit) |
|
409 | (requires --allow-dirty-working-copy to uncommit) | |
410 | [20] |
|
410 | [20] | |
411 |
|
411 | |||
412 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
412 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
413 | abort: cannot uncommit while merging |
|
413 | abort: cannot uncommit while merging | |
414 |
[2 |
|
414 | [20] | |
415 |
|
415 | |||
416 | $ hg status |
|
416 | $ hg status | |
417 | M a |
|
417 | M a | |
418 | $ hg commit -m 'merge a and b' |
|
418 | $ hg commit -m 'merge a and b' | |
419 |
|
419 | |||
420 | $ hg uncommit |
|
420 | $ hg uncommit | |
421 | abort: cannot uncommit merge changeset |
|
421 | abort: cannot uncommit merge changeset | |
422 | [255] |
|
422 | [255] | |
423 |
|
423 | |||
424 | $ hg status |
|
424 | $ hg status | |
425 | $ hg log -G -T '{rev}:{node} {desc}' --hidden |
|
425 | $ hg log -G -T '{rev}:{node} {desc}' --hidden | |
426 | @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b |
|
426 | @ 6:c03b9c37bc67bf504d4912061cfb527b47a63c6e merge a and b | |
427 | |\ |
|
427 | |\ | |
428 | | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 |
|
428 | | o 5:2cd56cdde163ded2fbb16ba2f918c96046ab0bf2 b 3 | |
429 | | | |
|
429 | | | | |
430 | | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 |
|
430 | | o 4:c3a0d5bb3b15834ffd2ef9ef603e93ec65cf2037 b 2 | |
431 | | | |
|
431 | | | | |
432 | | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 |
|
432 | | o 3:49bb009ca26078726b8870f1edb29fae8f7618f5 b 1 | |
433 | | | |
|
433 | | | | |
434 | o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 |
|
434 | o | 2:990982b7384266e691f1bc08ca36177adcd1c8a9 a 3 | |
435 | | | |
|
435 | | | | |
436 | o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 |
|
436 | o | 1:24d38e3cf160c7b6f5ffe82179332229886a6d34 a 2 | |
437 | |/ |
|
437 | |/ | |
438 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 |
|
438 | o 0:ea4e33293d4d274a2ba73150733c2612231f398c a 1 | |
439 |
|
439 | |||
440 |
|
440 | |||
441 | Rename a->b, then remove b in working copy. Result should remove a. |
|
441 | Rename a->b, then remove b in working copy. Result should remove a. | |
442 |
|
442 | |||
443 | $ hg co -q 0 |
|
443 | $ hg co -q 0 | |
444 | $ hg mv a b |
|
444 | $ hg mv a b | |
445 | $ hg ci -qm 'move a to b' |
|
445 | $ hg ci -qm 'move a to b' | |
446 | $ hg rm b |
|
446 | $ hg rm b | |
447 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
447 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
448 | $ hg st --copies |
|
448 | $ hg st --copies | |
449 | R a |
|
449 | R a | |
450 | $ hg revert a |
|
450 | $ hg revert a | |
451 |
|
451 | |||
452 | Rename a->b, then rename b->c in working copy. Result should rename a->c. |
|
452 | Rename a->b, then rename b->c in working copy. Result should rename a->c. | |
453 |
|
453 | |||
454 | $ hg co -q 0 |
|
454 | $ hg co -q 0 | |
455 | $ hg mv a b |
|
455 | $ hg mv a b | |
456 | $ hg ci -qm 'move a to b' |
|
456 | $ hg ci -qm 'move a to b' | |
457 | $ hg mv b c |
|
457 | $ hg mv b c | |
458 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
458 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
459 | $ hg st --copies |
|
459 | $ hg st --copies | |
460 | A c |
|
460 | A c | |
461 | a |
|
461 | a | |
462 | R a |
|
462 | R a | |
463 | $ hg revert a |
|
463 | $ hg revert a | |
464 | $ hg forget c |
|
464 | $ hg forget c | |
465 | $ rm c |
|
465 | $ rm c | |
466 |
|
466 | |||
467 | Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c. |
|
467 | Copy a->b1 and a->b2, then rename b1->c in working copy. Result should copy a->b2 and a->c. | |
468 |
|
468 | |||
469 | $ hg co -q 0 |
|
469 | $ hg co -q 0 | |
470 | $ hg cp a b1 |
|
470 | $ hg cp a b1 | |
471 | $ hg cp a b2 |
|
471 | $ hg cp a b2 | |
472 | $ hg ci -qm 'move a to b1 and b2' |
|
472 | $ hg ci -qm 'move a to b1 and b2' | |
473 | $ hg mv b1 c |
|
473 | $ hg mv b1 c | |
474 | $ hg uncommit --config experimental.uncommitondirtywdir=True |
|
474 | $ hg uncommit --config experimental.uncommitondirtywdir=True | |
475 | $ hg st --copies |
|
475 | $ hg st --copies | |
476 | A b2 |
|
476 | A b2 | |
477 | a |
|
477 | a | |
478 | A c |
|
478 | A c | |
479 | a |
|
479 | a | |
480 | $ cd .. |
|
480 | $ cd .. | |
481 |
|
481 | |||
482 | --allow-dirty-working-copy should also work on a dirty PATH |
|
482 | --allow-dirty-working-copy should also work on a dirty PATH | |
483 |
|
483 | |||
484 | $ hg init issue5977 |
|
484 | $ hg init issue5977 | |
485 | $ cd issue5977 |
|
485 | $ cd issue5977 | |
486 | $ echo 'super critical info!' > a |
|
486 | $ echo 'super critical info!' > a | |
487 | $ hg ci -Am 'add a' |
|
487 | $ hg ci -Am 'add a' | |
488 | adding a |
|
488 | adding a | |
489 | $ echo 'foo' > b |
|
489 | $ echo 'foo' > b | |
490 | $ hg add b |
|
490 | $ hg add b | |
491 | $ hg status |
|
491 | $ hg status | |
492 | A b |
|
492 | A b | |
493 | $ hg uncommit a |
|
493 | $ hg uncommit a | |
494 | note: keeping empty commit |
|
494 | note: keeping empty commit | |
495 | $ cat a |
|
495 | $ cat a | |
496 | super critical info! |
|
496 | super critical info! | |
497 | $ hg log |
|
497 | $ hg log | |
498 | changeset: 1:656ba143d384 |
|
498 | changeset: 1:656ba143d384 | |
499 | tag: tip |
|
499 | tag: tip | |
500 | parent: -1:000000000000 |
|
500 | parent: -1:000000000000 | |
501 | user: test |
|
501 | user: test | |
502 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
502 | date: Thu Jan 01 00:00:00 1970 +0000 | |
503 | summary: add a |
|
503 | summary: add a | |
504 |
|
504 | |||
505 | $ hg ci -Am 'add b' |
|
505 | $ hg ci -Am 'add b' | |
506 | $ echo 'foo bar' > b |
|
506 | $ echo 'foo bar' > b | |
507 | $ hg uncommit b |
|
507 | $ hg uncommit b | |
508 | abort: uncommitted changes |
|
508 | abort: uncommitted changes | |
509 | (requires --allow-dirty-working-copy to uncommit) |
|
509 | (requires --allow-dirty-working-copy to uncommit) | |
510 | [20] |
|
510 | [20] | |
511 | $ hg uncommit --allow-dirty-working-copy b |
|
511 | $ hg uncommit --allow-dirty-working-copy b | |
512 | $ hg log |
|
512 | $ hg log | |
513 | changeset: 3:30fa958635b2 |
|
513 | changeset: 3:30fa958635b2 | |
514 | tag: tip |
|
514 | tag: tip | |
515 | parent: 1:656ba143d384 |
|
515 | parent: 1:656ba143d384 | |
516 | user: test |
|
516 | user: test | |
517 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
517 | date: Thu Jan 01 00:00:00 1970 +0000 | |
518 | summary: add b |
|
518 | summary: add b | |
519 |
|
519 | |||
520 | changeset: 1:656ba143d384 |
|
520 | changeset: 1:656ba143d384 | |
521 | parent: -1:000000000000 |
|
521 | parent: -1:000000000000 | |
522 | user: test |
|
522 | user: test | |
523 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
523 | date: Thu Jan 01 00:00:00 1970 +0000 | |
524 | summary: add a |
|
524 | summary: add a | |
525 |
|
525 | |||
526 | Removes can be uncommitted |
|
526 | Removes can be uncommitted | |
527 |
|
527 | |||
528 | $ hg ci -m 'modified b' |
|
528 | $ hg ci -m 'modified b' | |
529 | $ hg rm b |
|
529 | $ hg rm b | |
530 | $ hg ci -m 'remove b' |
|
530 | $ hg ci -m 'remove b' | |
531 | $ hg uncommit b |
|
531 | $ hg uncommit b | |
532 | note: keeping empty commit |
|
532 | note: keeping empty commit | |
533 | $ hg status |
|
533 | $ hg status | |
534 | R b |
|
534 | R b | |
535 |
|
535 | |||
536 | Uncommitting a directory won't run afoul of the checks that an explicit file |
|
536 | Uncommitting a directory won't run afoul of the checks that an explicit file | |
537 | can be uncommitted. |
|
537 | can be uncommitted. | |
538 |
|
538 | |||
539 | $ mkdir dir |
|
539 | $ mkdir dir | |
540 | $ echo 1 > dir/file.txt |
|
540 | $ echo 1 > dir/file.txt | |
541 | $ hg ci -Aqm 'add file in directory' |
|
541 | $ hg ci -Aqm 'add file in directory' | |
542 | $ hg uncommit dir -m 'uncommit with message' -u 'different user' \ |
|
542 | $ hg uncommit dir -m 'uncommit with message' -u 'different user' \ | |
543 | > -d 'Jun 30 12:12:12 1980 +0000' |
|
543 | > -d 'Jun 30 12:12:12 1980 +0000' | |
544 | $ hg status |
|
544 | $ hg status | |
545 | A dir/file.txt |
|
545 | A dir/file.txt | |
546 | $ hg log -r . |
|
546 | $ hg log -r . | |
547 | changeset: 8:b4dd26dc42e0 |
|
547 | changeset: 8:b4dd26dc42e0 | |
548 | tag: tip |
|
548 | tag: tip | |
549 | parent: 6:2278a4c24330 |
|
549 | parent: 6:2278a4c24330 | |
550 | user: different user |
|
550 | user: different user | |
551 | date: Mon Jun 30 12:12:12 1980 +0000 |
|
551 | date: Mon Jun 30 12:12:12 1980 +0000 | |
552 | summary: uncommit with message |
|
552 | summary: uncommit with message | |
553 |
|
553 | |||
554 | Bad option combinations |
|
554 | Bad option combinations | |
555 |
|
555 | |||
556 | $ hg rollback -q --config ui.rollback=True |
|
556 | $ hg rollback -q --config ui.rollback=True | |
557 | $ hg uncommit -U --user 'user' |
|
557 | $ hg uncommit -U --user 'user' | |
558 | abort: cannot specify both --user and --currentuser |
|
558 | abort: cannot specify both --user and --currentuser | |
559 | [10] |
|
559 | [10] | |
560 | $ hg uncommit -D --date today |
|
560 | $ hg uncommit -D --date today | |
561 | abort: cannot specify both --date and --currentdate |
|
561 | abort: cannot specify both --date and --currentdate | |
562 | [10] |
|
562 | [10] | |
563 |
|
563 | |||
564 | `uncommit <dir>` and `cd <dir> && uncommit .` behave the same... |
|
564 | `uncommit <dir>` and `cd <dir> && uncommit .` behave the same... | |
565 |
|
565 | |||
566 | $ echo 2 > dir/file2.txt |
|
566 | $ echo 2 > dir/file2.txt | |
567 | $ hg ci -Aqm 'add file2 in directory' |
|
567 | $ hg ci -Aqm 'add file2 in directory' | |
568 | $ hg uncommit dir |
|
568 | $ hg uncommit dir | |
569 | note: keeping empty commit |
|
569 | note: keeping empty commit | |
570 | $ hg status |
|
570 | $ hg status | |
571 | A dir/file2.txt |
|
571 | A dir/file2.txt | |
572 |
|
572 | |||
573 | $ hg rollback -q --config ui.rollback=True |
|
573 | $ hg rollback -q --config ui.rollback=True | |
574 | $ cd dir |
|
574 | $ cd dir | |
575 | $ hg uncommit . -n 'this is a note' |
|
575 | $ hg uncommit . -n 'this is a note' | |
576 | note: keeping empty commit |
|
576 | note: keeping empty commit | |
577 | $ hg status |
|
577 | $ hg status | |
578 | A dir/file2.txt |
|
578 | A dir/file2.txt | |
579 | $ cd .. |
|
579 | $ cd .. | |
580 |
|
580 | |||
581 | ... and errors out the same way when nothing can be uncommitted |
|
581 | ... and errors out the same way when nothing can be uncommitted | |
582 |
|
582 | |||
583 | $ hg rollback -q --config ui.rollback=True |
|
583 | $ hg rollback -q --config ui.rollback=True | |
584 | $ mkdir emptydir |
|
584 | $ mkdir emptydir | |
585 | $ hg uncommit emptydir |
|
585 | $ hg uncommit emptydir | |
586 | abort: cannot uncommit "emptydir" |
|
586 | abort: cannot uncommit "emptydir" | |
587 | (file was untracked in working directory parent) |
|
587 | (file was untracked in working directory parent) | |
588 | [255] |
|
588 | [255] | |
589 |
|
589 | |||
590 | $ cd emptydir |
|
590 | $ cd emptydir | |
591 | $ hg uncommit . |
|
591 | $ hg uncommit . | |
592 | abort: cannot uncommit "emptydir" |
|
592 | abort: cannot uncommit "emptydir" | |
593 | (file was untracked in working directory parent) |
|
593 | (file was untracked in working directory parent) | |
594 | [255] |
|
594 | [255] | |
595 | $ hg status |
|
595 | $ hg status | |
596 | $ cd .. |
|
596 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now