##// END OF EJS Templates
rewriteutil: point to help about instability when rewriting creates orphan...
Martin von Zweigbergk -
r47782:7a90fddb default
parent child Browse files
Show More
@@ -1,143 +1,146 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 from .node import (
13 from .node import (
14 hex,
14 hex,
15 nullrev,
15 nullrev,
16 )
16 )
17
17
18 from . import (
18 from . import (
19 error,
19 error,
20 obsolete,
20 obsolete,
21 obsutil,
21 obsutil,
22 revset,
22 revset,
23 scmutil,
23 scmutil,
24 util,
24 util,
25 )
25 )
26
26
27
27
28 NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b')
28 NODE_RE = re.compile(br'\b[0-9a-f]{6,64}\b')
29
29
30
30
31 def precheck(repo, revs, action=b'rewrite'):
31 def precheck(repo, revs, action=b'rewrite'):
32 """check if revs can be rewritten
32 """check if revs can be rewritten
33 action is used to control the error message.
33 action is used to control the error message.
34
34
35 Make sure this function is called after taking the lock.
35 Make sure this function is called after taking the lock.
36 """
36 """
37 if nullrev in revs:
37 if nullrev in revs:
38 msg = _(b"cannot %s the null revision") % action
38 msg = _(b"cannot %s the null revision") % action
39 hint = _(b"no changeset checked out")
39 hint = _(b"no changeset checked out")
40 raise error.InputError(msg, hint=hint)
40 raise error.InputError(msg, hint=hint)
41
41
42 if any(util.safehasattr(r, 'rev') for r in revs):
42 if any(util.safehasattr(r, 'rev') for r in revs):
43 repo.ui.develwarn(b"rewriteutil.precheck called with ctx not revs")
43 repo.ui.develwarn(b"rewriteutil.precheck called with ctx not revs")
44 revs = (r.rev() for r in revs)
44 revs = (r.rev() for r in revs)
45
45
46 if len(repo[None].parents()) > 1:
46 if len(repo[None].parents()) > 1:
47 raise error.StateError(_(b"cannot %s while merging") % action)
47 raise error.StateError(_(b"cannot %s while merging") % action)
48
48
49 publicrevs = repo.revs(b'%ld and public()', revs)
49 publicrevs = repo.revs(b'%ld and public()', revs)
50 if publicrevs:
50 if publicrevs:
51 msg = _(b"cannot %s public changesets") % action
51 msg = _(b"cannot %s public changesets") % action
52 hint = _(b"see 'hg help phases' for details")
52 hint = _(b"see 'hg help phases' for details")
53 raise error.InputError(msg, hint=hint)
53 raise error.InputError(msg, hint=hint)
54
54
55 newunstable = disallowednewunstable(repo, revs)
55 newunstable = disallowednewunstable(repo, revs)
56 if newunstable:
56 if newunstable:
57 raise error.InputError(_(b"cannot %s changeset with children") % action)
57 hint = _(b"see 'hg help evolution.instability'")
58 raise error.InputError(
59 _(b"cannot %s changeset with children") % action, hint=hint
60 )
58
61
59
62
60 def disallowednewunstable(repo, revs):
63 def disallowednewunstable(repo, revs):
61 """Checks whether editing the revs will create new unstable changesets and
64 """Checks whether editing the revs will create new unstable changesets and
62 are we allowed to create them.
65 are we allowed to create them.
63
66
64 To allow new unstable changesets, set the config:
67 To allow new unstable changesets, set the config:
65 `experimental.evolution.allowunstable=True`
68 `experimental.evolution.allowunstable=True`
66 """
69 """
67 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
70 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
68 if allowunstable:
71 if allowunstable:
69 return revset.baseset()
72 return revset.baseset()
70 return repo.revs(b"(%ld::) - %ld", revs, revs)
73 return repo.revs(b"(%ld::) - %ld", revs, revs)
71
74
72
75
73 def skip_empty_successor(ui, command):
76 def skip_empty_successor(ui, command):
74 empty_successor = ui.config(b'rewrite', b'empty-successor')
77 empty_successor = ui.config(b'rewrite', b'empty-successor')
75 if empty_successor == b'skip':
78 if empty_successor == b'skip':
76 return True
79 return True
77 elif empty_successor == b'keep':
80 elif empty_successor == b'keep':
78 return False
81 return False
79 else:
82 else:
80 raise error.ConfigError(
83 raise error.ConfigError(
81 _(
84 _(
82 b"%s doesn't know how to handle config "
85 b"%s doesn't know how to handle config "
83 b"rewrite.empty-successor=%s (only 'skip' and 'keep' are "
86 b"rewrite.empty-successor=%s (only 'skip' and 'keep' are "
84 b"supported)"
87 b"supported)"
85 )
88 )
86 % (command, empty_successor)
89 % (command, empty_successor)
87 )
90 )
88
91
89
92
90 def update_hash_refs(repo, commitmsg, pending=None):
93 def update_hash_refs(repo, commitmsg, pending=None):
91 """Replace all obsolete commit hashes in the message with the current hash.
94 """Replace all obsolete commit hashes in the message with the current hash.
92
95
93 If the obsolete commit was split or is divergent, the hash is not replaced
96 If the obsolete commit was split or is divergent, the hash is not replaced
94 as there's no way to know which successor to choose.
97 as there's no way to know which successor to choose.
95
98
96 For commands that update a series of commits in the current transaction, the
99 For commands that update a series of commits in the current transaction, the
97 new obsolete markers can be considered by setting ``pending`` to a mapping
100 new obsolete markers can be considered by setting ``pending`` to a mapping
98 of ``pending[oldnode] = [successor_node1, successor_node2,..]``.
101 of ``pending[oldnode] = [successor_node1, successor_node2,..]``.
99 """
102 """
100 if not pending:
103 if not pending:
101 pending = {}
104 pending = {}
102 cache = {}
105 cache = {}
103 hashes = re.findall(NODE_RE, commitmsg)
106 hashes = re.findall(NODE_RE, commitmsg)
104 unfi = repo.unfiltered()
107 unfi = repo.unfiltered()
105 for h in hashes:
108 for h in hashes:
106 fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
109 fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
107 if fullnode is None:
110 if fullnode is None:
108 continue
111 continue
109 ctx = unfi[fullnode]
112 ctx = unfi[fullnode]
110 if not ctx.obsolete():
113 if not ctx.obsolete():
111 successors = pending.get(fullnode)
114 successors = pending.get(fullnode)
112 if successors is None:
115 if successors is None:
113 continue
116 continue
114 # obsutil.successorssets() returns a list of list of nodes
117 # obsutil.successorssets() returns a list of list of nodes
115 successors = [successors]
118 successors = [successors]
116 else:
119 else:
117 successors = obsutil.successorssets(repo, ctx.node(), cache=cache)
120 successors = obsutil.successorssets(repo, ctx.node(), cache=cache)
118
121
119 # We can't make any assumptions about how to update the hash if the
122 # We can't make any assumptions about how to update the hash if the
120 # cset in question was split or diverged.
123 # cset in question was split or diverged.
121 if len(successors) == 1 and len(successors[0]) == 1:
124 if len(successors) == 1 and len(successors[0]) == 1:
122 successor = successors[0][0]
125 successor = successors[0][0]
123 if successor is not None:
126 if successor is not None:
124 newhash = hex(successor)
127 newhash = hex(successor)
125 commitmsg = commitmsg.replace(h, newhash[: len(h)])
128 commitmsg = commitmsg.replace(h, newhash[: len(h)])
126 else:
129 else:
127 repo.ui.note(
130 repo.ui.note(
128 _(
131 _(
129 b'The stale commit message reference to %s could '
132 b'The stale commit message reference to %s could '
130 b'not be updated\n(The referenced commit was dropped)\n'
133 b'not be updated\n(The referenced commit was dropped)\n'
131 )
134 )
132 % h
135 % h
133 )
136 )
134 else:
137 else:
135 repo.ui.note(
138 repo.ui.note(
136 _(
139 _(
137 b'The stale commit message reference to %s could '
140 b'The stale commit message reference to %s could '
138 b'not be updated\n'
141 b'not be updated\n'
139 )
142 )
140 % h
143 % h
141 )
144 )
142
145
143 return commitmsg
146 return commitmsg
@@ -1,531 +1,532 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 (see 'hg help evolution.instability')
200 [10]
201 [10]
201
202
202 #if obsstore-on
203 #if obsstore-on
203
204
204 With allowunstable, amend could work in the middle of a stack
205 With allowunstable, amend could work in the middle of a stack
205
206
206 $ cat >> $HGRCPATH <<EOF
207 $ cat >> $HGRCPATH <<EOF
207 > [experimental]
208 > [experimental]
208 > evolution.createmarkers=True
209 > evolution.createmarkers=True
209 > evolution.allowunstable=True
210 > evolution.allowunstable=True
210 > EOF
211 > EOF
211
212
212 $ hg amend
213 $ hg amend
213 1 new orphan changesets
214 1 new orphan changesets
214 $ hg log -T '{rev} {node|short} {desc}\n' -G
215 $ hg log -T '{rev} {node|short} {desc}\n' -G
215 @ 3 be169c7e8dbe B
216 @ 3 be169c7e8dbe B
216 |
217 |
217 | * 2 26805aba1e60 C
218 | * 2 26805aba1e60 C
218 | |
219 | |
219 | x 1 112478962961 B
220 | x 1 112478962961 B
220 |/
221 |/
221 o 0 426bada5c675 A
222 o 0 426bada5c675 A
222
223
223 Checking the note stored in the obsmarker
224 Checking the note stored in the obsmarker
224
225
225 $ echo foo > bar
226 $ echo foo > bar
226 $ hg add bar
227 $ hg add bar
227 $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
228 $ hg amend --note 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy'
228 abort: cannot store a note of more than 255 bytes
229 abort: cannot store a note of more than 255 bytes
229 [10]
230 [10]
230 $ hg amend --note "adding bar"
231 $ hg amend --note "adding bar"
231 $ hg debugobsolete -r .
232 $ hg debugobsolete -r .
232 112478962961147124edd43549aedd1a335e44bf be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'operation': 'amend', 'user': 'test'}
233 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'}
234 be169c7e8dbe21cd10b3d79691cbe7f241e3c21c 16084da537dd8f84cfdb3055c633772269d62e1b 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '8', 'note': 'adding bar', 'operation': 'amend', 'user': 'test'}
234 #endif
235 #endif
235
236
236 Cannot amend public changeset
237 Cannot amend public changeset
237
238
238 $ hg phase -r A --public
239 $ hg phase -r A --public
239 $ hg update -C -q A
240 $ hg update -C -q A
240 $ hg amend -m AMEND
241 $ hg amend -m AMEND
241 abort: cannot amend public changesets
242 abort: cannot amend public changesets
242 (see 'hg help phases' for details)
243 (see 'hg help phases' for details)
243 [10]
244 [10]
244
245
245 Amend a merge changeset
246 Amend a merge changeset
246
247
247 $ hg init $TESTTMP/repo3
248 $ hg init $TESTTMP/repo3
248 $ cd $TESTTMP/repo3
249 $ cd $TESTTMP/repo3
249 $ hg debugdrawdag <<'EOS'
250 $ hg debugdrawdag <<'EOS'
250 > C
251 > C
251 > /|
252 > /|
252 > A B
253 > A B
253 > EOS
254 > EOS
254 $ hg update -q C
255 $ hg update -q C
255 $ hg amend -m FOO
256 $ hg amend -m FOO
256 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !)
257 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/a35c07e8a2a4-15ff4612-amend.hg (obsstore-off !)
257 $ rm .hg/localtags
258 $ rm .hg/localtags
258 $ hg log -G -T '{desc}\n'
259 $ hg log -G -T '{desc}\n'
259 @ FOO
260 @ FOO
260 |\
261 |\
261 | o B
262 | o B
262 |
263 |
263 o A
264 o A
264
265
265
266
266 More complete test for status changes (issue5732)
267 More complete test for status changes (issue5732)
267 -------------------------------------------------
268 -------------------------------------------------
268
269
269 Generates history of files having 3 states, r0_r1_wc:
270 Generates history of files having 3 states, r0_r1_wc:
270
271
271 r0: ground (content/missing)
272 r0: ground (content/missing)
272 r1: old state to be amended (content/missing, where missing means removed)
273 r1: old state to be amended (content/missing, where missing means removed)
273 wc: changes to be included in r1 (content/missing-tracked/untracked)
274 wc: changes to be included in r1 (content/missing-tracked/untracked)
274
275
275 $ hg init $TESTTMP/wcstates
276 $ hg init $TESTTMP/wcstates
276 $ cd $TESTTMP/wcstates
277 $ cd $TESTTMP/wcstates
277
278
278 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
279 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 1
279 $ hg addremove -q --similarity 0
280 $ hg addremove -q --similarity 0
280 $ hg commit -m0
281 $ hg commit -m0
281
282
282 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
283 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 2
283 $ hg addremove -q --similarity 0
284 $ hg addremove -q --similarity 0
284 $ hg commit -m1
285 $ hg commit -m1
285
286
286 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
287 $ "$PYTHON" $TESTDIR/generate-working-copy-states.py state 2 wc
287 $ hg addremove -q --similarity 0
288 $ hg addremove -q --similarity 0
288 $ hg forget *_*_*-untracked
289 $ hg forget *_*_*-untracked
289 $ rm *_*_missing-*
290 $ rm *_*_missing-*
290
291
291 amend r1 to include wc changes
292 amend r1 to include wc changes
292
293
293 $ hg amend
294 $ hg amend
294 saved backup bundle to * (glob) (obsstore-off !)
295 saved backup bundle to * (glob) (obsstore-off !)
295
296
296 clean/modified/removed/added states of the amended revision
297 clean/modified/removed/added states of the amended revision
297
298
298 $ hg status --all --change . 'glob:content1_*_content1-tracked'
299 $ hg status --all --change . 'glob:content1_*_content1-tracked'
299 C content1_content1_content1-tracked
300 C content1_content1_content1-tracked
300 C content1_content2_content1-tracked
301 C content1_content2_content1-tracked
301 C content1_missing_content1-tracked
302 C content1_missing_content1-tracked
302 $ hg status --all --change . 'glob:content1_*_content[23]-tracked'
303 $ hg status --all --change . 'glob:content1_*_content[23]-tracked'
303 M content1_content1_content3-tracked
304 M content1_content1_content3-tracked
304 M content1_content2_content2-tracked
305 M content1_content2_content2-tracked
305 M content1_content2_content3-tracked
306 M content1_content2_content3-tracked
306 M content1_missing_content3-tracked
307 M content1_missing_content3-tracked
307 $ hg status --all --change . 'glob:content1_*_missing-tracked'
308 $ hg status --all --change . 'glob:content1_*_missing-tracked'
308 M content1_content2_missing-tracked
309 M content1_content2_missing-tracked
309 R content1_missing_missing-tracked
310 R content1_missing_missing-tracked
310 C content1_content1_missing-tracked
311 C content1_content1_missing-tracked
311 $ hg status --all --change . 'glob:content1_*_*-untracked'
312 $ hg status --all --change . 'glob:content1_*_*-untracked'
312 R content1_content1_content1-untracked
313 R content1_content1_content1-untracked
313 R content1_content1_content3-untracked
314 R content1_content1_content3-untracked
314 R content1_content1_missing-untracked
315 R content1_content1_missing-untracked
315 R content1_content2_content1-untracked
316 R content1_content2_content1-untracked
316 R content1_content2_content2-untracked
317 R content1_content2_content2-untracked
317 R content1_content2_content3-untracked
318 R content1_content2_content3-untracked
318 R content1_content2_missing-untracked
319 R content1_content2_missing-untracked
319 R content1_missing_content1-untracked
320 R content1_missing_content1-untracked
320 R content1_missing_content3-untracked
321 R content1_missing_content3-untracked
321 R content1_missing_missing-untracked
322 R content1_missing_missing-untracked
322 $ hg status --all --change . 'glob:missing_content2_*'
323 $ hg status --all --change . 'glob:missing_content2_*'
323 A missing_content2_content2-tracked
324 A missing_content2_content2-tracked
324 A missing_content2_content3-tracked
325 A missing_content2_content3-tracked
325 A missing_content2_missing-tracked
326 A missing_content2_missing-tracked
326 $ hg status --all --change . 'glob:missing_missing_*'
327 $ hg status --all --change . 'glob:missing_missing_*'
327 A missing_missing_content3-tracked
328 A missing_missing_content3-tracked
328
329
329 working directory should be all clean (with some missing/untracked files)
330 working directory should be all clean (with some missing/untracked files)
330
331
331 $ hg status --all 'glob:*_content?-tracked'
332 $ hg status --all 'glob:*_content?-tracked'
332 C content1_content1_content1-tracked
333 C content1_content1_content1-tracked
333 C content1_content1_content3-tracked
334 C content1_content1_content3-tracked
334 C content1_content2_content1-tracked
335 C content1_content2_content1-tracked
335 C content1_content2_content2-tracked
336 C content1_content2_content2-tracked
336 C content1_content2_content3-tracked
337 C content1_content2_content3-tracked
337 C content1_missing_content1-tracked
338 C content1_missing_content1-tracked
338 C content1_missing_content3-tracked
339 C content1_missing_content3-tracked
339 C missing_content2_content2-tracked
340 C missing_content2_content2-tracked
340 C missing_content2_content3-tracked
341 C missing_content2_content3-tracked
341 C missing_missing_content3-tracked
342 C missing_missing_content3-tracked
342 $ hg status --all 'glob:*_missing-tracked'
343 $ hg status --all 'glob:*_missing-tracked'
343 ! content1_content1_missing-tracked
344 ! content1_content1_missing-tracked
344 ! content1_content2_missing-tracked
345 ! content1_content2_missing-tracked
345 ! content1_missing_missing-tracked
346 ! content1_missing_missing-tracked
346 ! missing_content2_missing-tracked
347 ! missing_content2_missing-tracked
347 ! missing_missing_missing-tracked
348 ! missing_missing_missing-tracked
348 $ hg status --all 'glob:*-untracked'
349 $ hg status --all 'glob:*-untracked'
349 ? content1_content1_content1-untracked
350 ? content1_content1_content1-untracked
350 ? content1_content1_content3-untracked
351 ? content1_content1_content3-untracked
351 ? content1_content2_content1-untracked
352 ? content1_content2_content1-untracked
352 ? content1_content2_content2-untracked
353 ? content1_content2_content2-untracked
353 ? content1_content2_content3-untracked
354 ? content1_content2_content3-untracked
354 ? content1_missing_content1-untracked
355 ? content1_missing_content1-untracked
355 ? content1_missing_content3-untracked
356 ? content1_missing_content3-untracked
356 ? missing_content2_content2-untracked
357 ? missing_content2_content2-untracked
357 ? missing_content2_content3-untracked
358 ? missing_content2_content3-untracked
358 ? missing_missing_content3-untracked
359 ? missing_missing_content3-untracked
359
360
360 =================================
361 =================================
361 Test backup-bundle config option|
362 Test backup-bundle config option|
362 =================================
363 =================================
363 $ hg init $TESTTMP/repo4
364 $ hg init $TESTTMP/repo4
364 $ cd $TESTTMP/repo4
365 $ cd $TESTTMP/repo4
365 $ echo a>a
366 $ echo a>a
366 $ hg ci -Aqma
367 $ hg ci -Aqma
367 $ echo oops>b
368 $ echo oops>b
368 $ hg ci -Aqm "b"
369 $ hg ci -Aqm "b"
369 $ echo partiallyfixed > b
370 $ echo partiallyfixed > b
370
371
371 #if obsstore-off
372 #if obsstore-off
372 $ hg amend
373 $ hg amend
373 saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
374 saved backup bundle to $TESTTMP/repo4/.hg/strip-backup/95e899acf2ce-f11cb050-amend.hg
374 When backup-bundle config option is set:
375 When backup-bundle config option is set:
375 $ cat << EOF >> $HGRCPATH
376 $ cat << EOF >> $HGRCPATH
376 > [rewrite]
377 > [rewrite]
377 > backup-bundle = False
378 > backup-bundle = False
378 > EOF
379 > EOF
379 $ echo fixed > b
380 $ echo fixed > b
380 $ hg amend
381 $ hg amend
381
382
382 #else
383 #else
383 $ hg amend
384 $ hg amend
384 When backup-bundle config option is set:
385 When backup-bundle config option is set:
385 $ cat << EOF >> $HGRCPATH
386 $ cat << EOF >> $HGRCPATH
386 > [rewrite]
387 > [rewrite]
387 > backup-bundle = False
388 > backup-bundle = False
388 > EOF
389 > EOF
389 $ echo fixed > b
390 $ echo fixed > b
390 $ hg amend
391 $ hg amend
391
392
392 #endif
393 #endif
393 ==========================================
394 ==========================================
394 Test update-timestamp config option|
395 Test update-timestamp config option|
395 ==========================================
396 ==========================================
396
397
397 $ cat >> $HGRCPATH << EOF
398 $ cat >> $HGRCPATH << EOF
398 > [extensions]
399 > [extensions]
399 > amend=
400 > amend=
400 > mockmakedate = $TESTDIR/mockmakedate.py
401 > mockmakedate = $TESTDIR/mockmakedate.py
401 > EOF
402 > EOF
402
403
403 $ hg init $TESTTMP/repo5
404 $ hg init $TESTTMP/repo5
404 $ cd $TESTTMP/repo5
405 $ cd $TESTTMP/repo5
405 $ cat <<'EOF' >> .hg/hgrc
406 $ cat <<'EOF' >> .hg/hgrc
406 > [command-templates]
407 > [command-templates]
407 > log = 'user: {user}
408 > log = 'user: {user}
408 > date: {date|date}
409 > date: {date|date}
409 > summary: {desc|firstline}\n'
410 > summary: {desc|firstline}\n'
410 > EOF
411 > EOF
411
412
412 $ echo a>a
413 $ echo a>a
413 $ hg ci -Am 'commit 1'
414 $ hg ci -Am 'commit 1'
414 adding a
415 adding a
415
416
416 When updatetimestamp is False
417 When updatetimestamp is False
417
418
418 $ hg amend --date '1997-1-1 0:1'
419 $ hg amend --date '1997-1-1 0:1'
419 $ hg log --limit 1
420 $ hg log --limit 1
420 user: test
421 user: test
421 date: Wed Jan 01 00:01:00 1997 +0000
422 date: Wed Jan 01 00:01:00 1997 +0000
422 summary: commit 1
423 summary: commit 1
423
424
424 When update-timestamp is True and no other change than the date
425 When update-timestamp is True and no other change than the date
425
426
426 $ hg amend --config rewrite.update-timestamp=True
427 $ hg amend --config rewrite.update-timestamp=True
427 nothing changed
428 nothing changed
428 [1]
429 [1]
429 $ hg log --limit 1
430 $ hg log --limit 1
430 user: test
431 user: test
431 date: Wed Jan 01 00:01:00 1997 +0000
432 date: Wed Jan 01 00:01:00 1997 +0000
432 summary: commit 1
433 summary: commit 1
433
434
434 When update-timestamp is True and there is other change than the date
435 When update-timestamp is True and there is other change than the date
435 $ hg amend --user foobar --config rewrite.update-timestamp=True
436 $ hg amend --user foobar --config rewrite.update-timestamp=True
436 $ hg log --limit 1
437 $ hg log --limit 1
437 user: foobar
438 user: foobar
438 date: Thu Jan 01 00:00:02 1970 +0000
439 date: Thu Jan 01 00:00:02 1970 +0000
439 summary: commit 1
440 summary: commit 1
440
441
441 When date option is applicable and update-timestamp is True
442 When date option is applicable and update-timestamp is True
442 $ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True
443 $ hg amend --date '1998-1-1 0:1' --config rewrite.update-timestamp=True
443 $ hg log --limit 1
444 $ hg log --limit 1
444 user: foobar
445 user: foobar
445 date: Thu Jan 01 00:01:00 1998 +0000
446 date: Thu Jan 01 00:01:00 1998 +0000
446 summary: commit 1
447 summary: commit 1
447
448
448 Unlike rewrite.update-timestamp, -D/--currentdate always updates the timestamp
449 Unlike rewrite.update-timestamp, -D/--currentdate always updates the timestamp
449
450
450 $ hg amend -D
451 $ hg amend -D
451 $ hg log --limit 1
452 $ hg log --limit 1
452 user: foobar
453 user: foobar
453 date: Thu Jan 01 00:00:04 1970 +0000
454 date: Thu Jan 01 00:00:04 1970 +0000
454 summary: commit 1
455 summary: commit 1
455
456
456 $ hg amend -D --config rewrite.update-timestamp=True
457 $ hg amend -D --config rewrite.update-timestamp=True
457 $ hg log --limit 1
458 $ hg log --limit 1
458 user: foobar
459 user: foobar
459 date: Thu Jan 01 00:00:05 1970 +0000
460 date: Thu Jan 01 00:00:05 1970 +0000
460 summary: commit 1
461 summary: commit 1
461
462
462 rewrite.update-timestamp can be negated by --no-currentdate
463 rewrite.update-timestamp can be negated by --no-currentdate
463
464
464 $ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz
465 $ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz
465 $ hg log --limit 1
466 $ hg log --limit 1
466 user: baz
467 user: baz
467 date: Thu Jan 01 00:00:05 1970 +0000
468 date: Thu Jan 01 00:00:05 1970 +0000
468 summary: commit 1
469 summary: commit 1
469
470
470 Bad combination of date options:
471 Bad combination of date options:
471
472
472 $ hg amend -D --date '0 0'
473 $ hg amend -D --date '0 0'
473 abort: cannot specify both --date and --currentdate
474 abort: cannot specify both --date and --currentdate
474 [10]
475 [10]
475
476
476 Close branch
477 Close branch
477
478
478 $ hg amend --secret --close-branch
479 $ hg amend --secret --close-branch
479 $ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n'
480 $ hg log --limit 1 -T 'close={get(extras, "close")}\nphase={phase}\n'
480 close=1
481 close=1
481 phase=secret
482 phase=secret
482
483
483 $ cd ..
484 $ cd ..
484
485
485 Corner case of amend from issue6157:
486 Corner case of amend from issue6157:
486 - working copy parent has a change to file `a`
487 - working copy parent has a change to file `a`
487 - working copy has the inverse change
488 - working copy has the inverse change
488 - we amend the working copy parent for files other than `a`
489 - we amend the working copy parent for files other than `a`
489 hg used to include the changes to `a` anyway.
490 hg used to include the changes to `a` anyway.
490
491
491 $ hg init 6157; cd 6157
492 $ hg init 6157; cd 6157
492 $ echo a > a; echo b > b; hg commit -qAm_
493 $ echo a > a; echo b > b; hg commit -qAm_
493 $ echo a2 > a; hg commit -qm_
494 $ echo a2 > a; hg commit -qm_
494 $ hg diff --stat -c .
495 $ hg diff --stat -c .
495 a | 2 +-
496 a | 2 +-
496 1 files changed, 1 insertions(+), 1 deletions(-)
497 1 files changed, 1 insertions(+), 1 deletions(-)
497 $ echo a > a; echo b2 > b; hg amend -q b
498 $ echo a > a; echo b2 > b; hg amend -q b
498 $ hg diff --stat -c .
499 $ hg diff --stat -c .
499 a | 2 +-
500 a | 2 +-
500 b | 2 +-
501 b | 2 +-
501 2 files changed, 2 insertions(+), 2 deletions(-)
502 2 files changed, 2 insertions(+), 2 deletions(-)
502
503
503 Modifying a file while the editor is open can cause dirstate corruption
504 Modifying a file while the editor is open can cause dirstate corruption
504 (issue6233)
505 (issue6233)
505
506
506 $ cd $TESTTMP
507 $ cd $TESTTMP
507 $ hg init modify-during-amend; cd modify-during-amend
508 $ hg init modify-during-amend; cd modify-during-amend
508 $ echo r0 > foo; hg commit -qAm "r0"
509 $ echo r0 > foo; hg commit -qAm "r0"
509 $ echo alpha > foo; hg commit -qm "alpha"
510 $ echo alpha > foo; hg commit -qm "alpha"
510 $ echo beta >> foo
511 $ echo beta >> foo
511 $ cat > $TESTTMP/touchy_editor.sh <<EOF
512 $ cat > $TESTTMP/touchy_editor.sh <<EOF
512 > sleep 1
513 > sleep 1
513 > echo delta >> "$TESTTMP/modify-during-amend/foo"
514 > echo delta >> "$TESTTMP/modify-during-amend/foo"
514 > sleep 1
515 > sleep 1
515 > echo hi > "\$1"
516 > echo hi > "\$1"
516 > sleep 1
517 > sleep 1
517 > EOF
518 > EOF
518 $ HGEDITOR="sh $TESTTMP/touchy_editor.sh" hg commit --amend
519 $ HGEDITOR="sh $TESTTMP/touchy_editor.sh" hg commit --amend
519 $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then
520 $ if (hg diff -c . | grep 'delta' >/dev/null) || [ -n "$(hg status)" ]; then
520 > echo "OK."
521 > echo "OK."
521 > else
522 > else
522 > echo "Bug detected. 'delta' is not part of the commit OR the wdir"
523 > echo "Bug detected. 'delta' is not part of the commit OR the wdir"
523 > echo "Diff and status before rebuild:"
524 > echo "Diff and status before rebuild:"
524 > hg diff
525 > hg diff
525 > hg status
526 > hg status
526 > hg debugrebuilddirstate
527 > hg debugrebuilddirstate
527 > echo "Diff and status after rebuild:"
528 > echo "Diff and status after rebuild:"
528 > hg diff
529 > hg diff
529 > hg status
530 > hg status
530 > fi
531 > fi
531 OK.
532 OK.
@@ -1,430 +1,432 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 (see 'hg help evolution.instability')
61 [10]
62 [10]
62
63
63 Change with dirty working directory
64 Change with dirty working directory
64
65
65 $ echo bar > a
66 $ echo bar > a
66 $ hg branch -r . foo
67 $ hg branch -r . foo
67 abort: uncommitted changes
68 abort: uncommitted changes
68 [20]
69 [20]
69
70
70 $ hg revert --all
71 $ hg revert --all
71 reverting a
72 reverting a
72
73
73 Change on empty revision set
74 Change on empty revision set
74
75
75 $ hg branch -r 'draft() - all()' foo
76 $ hg branch -r 'draft() - all()' foo
76 abort: empty revision set
77 abort: empty revision set
77 [10]
78 [10]
78
79
79 Changing branch on linear set of commits from head
80 Changing branch on linear set of commits from head
80
81
81 Without obsmarkers
82 Without obsmarkers
82
83
83 $ hg branch -r 3:4 foo --config experimental.evolution=!
84 $ hg branch -r 3:4 foo --config experimental.evolution=!
84 changed branch on 2 changesets
85 changed branch on 2 changesets
85 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/62615734edd5-e86bd13a-branch-change.hg
86 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/62615734edd5-e86bd13a-branch-change.hg
86 $ hg glog
87 $ hg glog
87 @ 4:3938acfb5c0f Added e
88 @ 4:3938acfb5c0f Added e
88 | foo ()
89 | foo ()
89 o 3:9435da006bdc Added d
90 o 3:9435da006bdc Added d
90 | foo ()
91 | foo ()
91 o 2:28ad74487de9 Added c
92 o 2:28ad74487de9 Added c
92 | default ()
93 | default ()
93 o 1:29becc82797a Added b
94 o 1:29becc82797a Added b
94 | default ()
95 | default ()
95 o 0:18d04c59bb5d Added a
96 o 0:18d04c59bb5d Added a
96 default ()
97 default ()
97
98
98 $ hg branches
99 $ hg branches
99 foo 4:3938acfb5c0f
100 foo 4:3938acfb5c0f
100 default 2:28ad74487de9 (inactive)
101 default 2:28ad74487de9 (inactive)
101
102
102 With obsmarkers
103 With obsmarkers
103
104
104 $ hg branch -r 3::4 bar
105 $ hg branch -r 3::4 bar
105 changed branch on 2 changesets
106 changed branch on 2 changesets
106 $ hg glog
107 $ hg glog
107 @ 6:7c1991464886 Added e
108 @ 6:7c1991464886 Added e
108 | bar ()
109 | bar ()
109 o 5:1ea05e93925f Added d
110 o 5:1ea05e93925f Added d
110 | bar ()
111 | bar ()
111 o 2:28ad74487de9 Added c
112 o 2:28ad74487de9 Added c
112 | default ()
113 | default ()
113 o 1:29becc82797a Added b
114 o 1:29becc82797a Added b
114 | default ()
115 | default ()
115 o 0:18d04c59bb5d Added a
116 o 0:18d04c59bb5d Added a
116 default ()
117 default ()
117
118
118 $ hg branches
119 $ hg branches
119 bar 6:7c1991464886
120 bar 6:7c1991464886
120 default 2:28ad74487de9 (inactive)
121 default 2:28ad74487de9 (inactive)
121
122
122 Change branch name to an existing branch
123 Change branch name to an existing branch
123
124
124 $ hg branch -r . default
125 $ hg branch -r . default
125 abort: a branch of the same name already exists
126 abort: a branch of the same name already exists
126 [10]
127 [10]
127
128
128 Changing on a branch head which is not topological head
129 Changing on a branch head which is not topological head
129
130
130 $ hg branch -r 2 stable
131 $ hg branch -r 2 stable
131 abort: cannot change branch of changeset with children
132 abort: cannot change branch of changeset with children
133 (see 'hg help evolution.instability')
132 [10]
134 [10]
133
135
134 Enabling the allowunstable config and trying to change branch on a branch head
136 Enabling the allowunstable config and trying to change branch on a branch head
135 which is not a topological head
137 which is not a topological head
136
138
137 $ echo "[experimental]" >> .hg/hgrc
139 $ echo "[experimental]" >> .hg/hgrc
138 $ echo "evolution.allowunstable=yes" >> .hg/hgrc
140 $ echo "evolution.allowunstable=yes" >> .hg/hgrc
139 $ hg branch -r 2 foo
141 $ hg branch -r 2 foo
140 changed branch on 1 changesets
142 changed branch on 1 changesets
141 2 new orphan changesets
143 2 new orphan changesets
142
144
143 Changing branch of an obsoleted changeset
145 Changing branch of an obsoleted changeset
144
146
145 $ hg branch -r 4 foobar
147 $ hg branch -r 4 foobar
146 abort: hidden revision '4' was rewritten as: 7c1991464886
148 abort: hidden revision '4' was rewritten as: 7c1991464886
147 (use --hidden to access hidden revisions)
149 (use --hidden to access hidden revisions)
148 [255]
150 [255]
149
151
150 $ hg branch -r 4 --hidden foobar
152 $ hg branch -r 4 --hidden foobar
151 abort: cannot change branch of a obsolete changeset
153 abort: cannot change branch of a obsolete changeset
152 [10]
154 [10]
153
155
154 Make sure bookmark movement is correct
156 Make sure bookmark movement is correct
155
157
156 $ hg bookmark b1
158 $ hg bookmark b1
157 $ hg glog -r '.^::'
159 $ hg glog -r '.^::'
158 @ 6:7c1991464886 Added e
160 @ 6:7c1991464886 Added e
159 | bar (b1)
161 | bar (b1)
160 * 5:1ea05e93925f Added d
162 * 5:1ea05e93925f Added d
161 | bar ()
163 | bar ()
162 ~
164 ~
163
165
164 $ hg branch -r '(.^)::' wat --debug
166 $ hg branch -r '(.^)::' wat --debug
165 changing branch of '1ea05e93925f806d875a2163f9b76764be644636' from 'bar' to 'wat'
167 changing branch of '1ea05e93925f806d875a2163f9b76764be644636' from 'bar' to 'wat'
166 committing files:
168 committing files:
167 d
169 d
168 committing manifest
170 committing manifest
169 committing changelog
171 committing changelog
170 new node id is 343660ccab7400da637bd6a211d07f413536d718
172 new node id is 343660ccab7400da637bd6a211d07f413536d718
171 changing branch of '7c19914648869f5b02fc7fed31ddee9783fdd680' from 'bar' to 'wat'
173 changing branch of '7c19914648869f5b02fc7fed31ddee9783fdd680' from 'bar' to 'wat'
172 committing files:
174 committing files:
173 e
175 e
174 committing manifest
176 committing manifest
175 committing changelog
177 committing changelog
176 new node id is de1404b45a69f8cc6437d7679033ee33e9efb4ba
178 new node id is de1404b45a69f8cc6437d7679033ee33e9efb4ba
177 moving bookmarks ['b1'] from 7c19914648869f5b02fc7fed31ddee9783fdd680 to de1404b45a69f8cc6437d7679033ee33e9efb4ba
179 moving bookmarks ['b1'] from 7c19914648869f5b02fc7fed31ddee9783fdd680 to de1404b45a69f8cc6437d7679033ee33e9efb4ba
178 resolving manifests
180 resolving manifests
179 branchmerge: False, force: False, partial: False
181 branchmerge: False, force: False, partial: False
180 ancestor: 7c1991464886, local: 7c1991464886+, remote: de1404b45a69
182 ancestor: 7c1991464886, local: 7c1991464886+, remote: de1404b45a69
181 starting 4 threads for background file closing (?)
183 starting 4 threads for background file closing (?)
182 changed branch on 2 changesets
184 changed branch on 2 changesets
183 updating the branch cache
185 updating the branch cache
184 invalid branch cache (served): tip differs
186 invalid branch cache (served): tip differs
185
187
186 $ hg glog -r '(.^)::'
188 $ hg glog -r '(.^)::'
187 @ 9:de1404b45a69 Added e
189 @ 9:de1404b45a69 Added e
188 | wat (b1)
190 | wat (b1)
189 * 8:343660ccab74 Added d
191 * 8:343660ccab74 Added d
190 | wat ()
192 | wat ()
191 ~
193 ~
192
194
193 Make sure phase handling is correct
195 Make sure phase handling is correct
194
196
195 $ echo foo >> bar
197 $ echo foo >> bar
196 $ hg ci -Aqm "added bar" --secret
198 $ hg ci -Aqm "added bar" --secret
197 1 new orphan changesets
199 1 new orphan changesets
198 $ hg glog -r .
200 $ hg glog -r .
199 @ 10:8ad1294c1660 added bar
201 @ 10:8ad1294c1660 added bar
200 | wat (b1)
202 | wat (b1)
201 ~
203 ~
202 $ hg branch -r . secret
204 $ hg branch -r . secret
203 changed branch on 1 changesets
205 changed branch on 1 changesets
204 $ hg phase -r .
206 $ hg phase -r .
205 11: secret
207 11: secret
206
208
207 $ hg branches
209 $ hg branches
208 secret 11:38a9b2d53f98
210 secret 11:38a9b2d53f98
209 foo 7:8a4729a5e2b8
211 foo 7:8a4729a5e2b8
210 wat 9:de1404b45a69 (inactive)
212 wat 9:de1404b45a69 (inactive)
211 default 2:28ad74487de9 (inactive)
213 default 2:28ad74487de9 (inactive)
212 $ hg branch
214 $ hg branch
213 secret
215 secret
214
216
215 Changing branch of another head, different from one on which we are
217 Changing branch of another head, different from one on which we are
216
218
217 $ hg glog
219 $ hg glog
218 @ 11:38a9b2d53f98 added bar
220 @ 11:38a9b2d53f98 added bar
219 | secret (b1)
221 | secret (b1)
220 * 9:de1404b45a69 Added e
222 * 9:de1404b45a69 Added e
221 | wat ()
223 | wat ()
222 * 8:343660ccab74 Added d
224 * 8:343660ccab74 Added d
223 | wat ()
225 | wat ()
224 | o 7:8a4729a5e2b8 Added c
226 | o 7:8a4729a5e2b8 Added c
225 | | foo ()
227 | | foo ()
226 x | 2:28ad74487de9 Added c
228 x | 2:28ad74487de9 Added c
227 |/ default ()
229 |/ default ()
228 o 1:29becc82797a Added b
230 o 1:29becc82797a Added b
229 | default ()
231 | default ()
230 o 0:18d04c59bb5d Added a
232 o 0:18d04c59bb5d Added a
231 default ()
233 default ()
232
234
233 $ hg branch
235 $ hg branch
234 secret
236 secret
235
237
236 $ hg branch -r 7 foobar
238 $ hg branch -r 7 foobar
237 changed branch on 1 changesets
239 changed branch on 1 changesets
238
240
239 The current branch must be preserved
241 The current branch must be preserved
240 $ hg branch
242 $ hg branch
241 secret
243 secret
242
244
243 Changing branch on multiple heads at once
245 Changing branch on multiple heads at once
244
246
245 $ hg rebase -s 8 -d 12 --keepbranches -q
247 $ hg rebase -s 8 -d 12 --keepbranches -q
246
248
247 $ hg rebase -s 14 -d 1 --keepbranches -q
249 $ hg rebase -s 14 -d 1 --keepbranches -q
248
250
249 $ hg branch -r 0: stable
251 $ hg branch -r 0: stable
250 changed branch on 6 changesets
252 changed branch on 6 changesets
251 $ hg glog
253 $ hg glog
252 @ 23:6a5ddbcfb870 added bar
254 @ 23:6a5ddbcfb870 added bar
253 | stable (b1)
255 | stable (b1)
254 o 22:baedc6e98a67 Added e
256 o 22:baedc6e98a67 Added e
255 | stable ()
257 | stable ()
256 | o 21:99ac7bf8aad1 Added d
258 | o 21:99ac7bf8aad1 Added d
257 | | stable ()
259 | | stable ()
258 | o 20:0ecb4d39c4bd Added c
260 | o 20:0ecb4d39c4bd Added c
259 |/ stable ()
261 |/ stable ()
260 o 19:fd45b986b109 Added b
262 o 19:fd45b986b109 Added b
261 | stable ()
263 | stable ()
262 o 18:204d2769eca2 Added a
264 o 18:204d2769eca2 Added a
263 stable ()
265 stable ()
264
266
265 $ hg branches
267 $ hg branches
266 stable 23:6a5ddbcfb870
268 stable 23:6a5ddbcfb870
267
269
268 $ hg branch
270 $ hg branch
269 stable
271 stable
270
272
271 Changing to same branch is no-op
273 Changing to same branch is no-op
272
274
273 $ hg branch -r 19::21 stable
275 $ hg branch -r 19::21 stable
274 changed branch on 0 changesets
276 changed branch on 0 changesets
275
277
276 Changing branch name to existing branch name if the branch of parent of root of
278 Changing branch name to existing branch name if the branch of parent of root of
277 revs is same as the new branch name
279 revs is same as the new branch name
278
280
279 $ hg branch -r 20::21 bugfix
281 $ hg branch -r 20::21 bugfix
280 changed branch on 2 changesets
282 changed branch on 2 changesets
281 $ hg glog
283 $ hg glog
282 o 25:714defe1cf34 Added d
284 o 25:714defe1cf34 Added d
283 | bugfix ()
285 | bugfix ()
284 o 24:98394def28fc Added c
286 o 24:98394def28fc Added c
285 | bugfix ()
287 | bugfix ()
286 | @ 23:6a5ddbcfb870 added bar
288 | @ 23:6a5ddbcfb870 added bar
287 | | stable (b1)
289 | | stable (b1)
288 | o 22:baedc6e98a67 Added e
290 | o 22:baedc6e98a67 Added e
289 |/ stable ()
291 |/ stable ()
290 o 19:fd45b986b109 Added b
292 o 19:fd45b986b109 Added b
291 | stable ()
293 | stable ()
292 o 18:204d2769eca2 Added a
294 o 18:204d2769eca2 Added a
293 stable ()
295 stable ()
294
296
295 $ hg branch -r 24:25 stable
297 $ hg branch -r 24:25 stable
296 changed branch on 2 changesets
298 changed branch on 2 changesets
297 $ hg glog
299 $ hg glog
298 o 27:4ec342341562 Added d
300 o 27:4ec342341562 Added d
299 | stable ()
301 | stable ()
300 o 26:83f48859c2de Added c
302 o 26:83f48859c2de Added c
301 | stable ()
303 | stable ()
302 | @ 23:6a5ddbcfb870 added bar
304 | @ 23:6a5ddbcfb870 added bar
303 | | stable (b1)
305 | | stable (b1)
304 | o 22:baedc6e98a67 Added e
306 | o 22:baedc6e98a67 Added e
305 |/ stable ()
307 |/ stable ()
306 o 19:fd45b986b109 Added b
308 o 19:fd45b986b109 Added b
307 | stable ()
309 | stable ()
308 o 18:204d2769eca2 Added a
310 o 18:204d2769eca2 Added a
309 stable ()
311 stable ()
310
312
311 Changing branch of a merge commit
313 Changing branch of a merge commit
312
314
313 $ hg branch -q ghi
315 $ hg branch -q ghi
314 $ echo f > f
316 $ echo f > f
315 $ hg ci -qAm 'Added f'
317 $ hg ci -qAm 'Added f'
316 $ hg up -q 27
318 $ hg up -q 27
317 $ hg branch -q jkl
319 $ hg branch -q jkl
318 $ echo g > g
320 $ echo g > g
319 $ hg ci -qAm 'Added g'
321 $ hg ci -qAm 'Added g'
320 $ hg glog -r 'heads(:)'
322 $ hg glog -r 'heads(:)'
321 @ 29:6bc1c6c2c9da Added g
323 @ 29:6bc1c6c2c9da Added g
322 | jkl ()
324 | jkl ()
323 ~
325 ~
324 o 28:2f1019bd29d2 Added f
326 o 28:2f1019bd29d2 Added f
325 | ghi (b1)
327 | ghi (b1)
326 ~
328 ~
327
329
328 $ hg branch -q default
330 $ hg branch -q default
329 $ hg merge -r 28
331 $ hg merge -r 28
330 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
332 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
331 (branch merge, don't forget to commit)
333 (branch merge, don't forget to commit)
332 $ hg branch -r . abcd
334 $ hg branch -r . abcd
333 abort: outstanding uncommitted merge
335 abort: outstanding uncommitted merge
334 [20]
336 [20]
335
337
336 $ hg ci -m "Merge commit"
338 $ hg ci -m "Merge commit"
337 $ hg glog -r 'parents(.)::'
339 $ hg glog -r 'parents(.)::'
338 @ 30:4d56e6b1eb6b Merge commit
340 @ 30:4d56e6b1eb6b Merge commit
339 |\ default ()
341 |\ default ()
340 | o 29:6bc1c6c2c9da Added g
342 | o 29:6bc1c6c2c9da Added g
341 | | jkl ()
343 | | jkl ()
342 | ~
344 | ~
343 o 28:2f1019bd29d2 Added f
345 o 28:2f1019bd29d2 Added f
344 | ghi (b1)
346 | ghi (b1)
345 ~
347 ~
346
348
347 $ hg branch -r . ghi
349 $ hg branch -r . ghi
348 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
350 0 files updated, 0 files merged, 4 files removed, 0 files unresolved
349 changed branch on 1 changesets
351 changed branch on 1 changesets
350 $ hg branch -r . jkl
352 $ hg branch -r . jkl
351 changed branch on 1 changesets
353 changed branch on 1 changesets
352 $ hg branch -r . default
354 $ hg branch -r . default
353 changed branch on 1 changesets
355 changed branch on 1 changesets
354 $ hg branch -r . stable
356 $ hg branch -r . stable
355 abort: a branch of the same name already exists
357 abort: a branch of the same name already exists
356 [10]
358 [10]
357
359
358 $ hg branch -r . stable --force
360 $ hg branch -r . stable --force
359 changed branch on 1 changesets
361 changed branch on 1 changesets
360 $ hg branches
362 $ hg branches
361 stable 34:d1c2addda4a2
363 stable 34:d1c2addda4a2
362 jkl 29:6bc1c6c2c9da (inactive)
364 jkl 29:6bc1c6c2c9da (inactive)
363 ghi 28:2f1019bd29d2 (inactive)
365 ghi 28:2f1019bd29d2 (inactive)
364
366
365 Changing branch on public changeset
367 Changing branch on public changeset
366
368
367 $ hg phase -r . -p
369 $ hg phase -r . -p
368 $ hg branch -r . def
370 $ hg branch -r . def
369 abort: cannot change branch of public changesets
371 abort: cannot change branch of public changesets
370 (see 'hg help phases' for details)
372 (see 'hg help phases' for details)
371 [10]
373 [10]
372
374
373 Merge commit with conflicts, with evolution and without
375 Merge commit with conflicts, with evolution and without
374
376
375 $ mklozenge() {
377 $ mklozenge() {
376 > echo foo > a
378 > echo foo > a
377 > hg ci -qAm foo
379 > hg ci -qAm foo
378 > echo bar > a
380 > echo bar > a
379 > hg ci -qm bar
381 > hg ci -qm bar
380 > hg up -q '.^'
382 > hg up -q '.^'
381 > echo baz > a
383 > echo baz > a
382 > hg ci -qm baz
384 > hg ci -qm baz
383 > hg merge -q -t :local
385 > hg merge -q -t :local
384 > echo neither > a
386 > echo neither > a
385 > hg ci -qm neither
387 > hg ci -qm neither
386 > }
388 > }
387
389
388 $ cd ..
390 $ cd ..
389 $ hg init merge-with-evolution
391 $ hg init merge-with-evolution
390 $ cd merge-with-evolution
392 $ cd merge-with-evolution
391 $ mklozenge
393 $ mklozenge
392
394
393 $ hg branch -r '(.^)::' abc
395 $ hg branch -r '(.^)::' abc
394 changed branch on 2 changesets
396 changed branch on 2 changesets
395 $ hg glog
397 $ hg glog
396 @ 5:c07fa8b34d54 neither
398 @ 5:c07fa8b34d54 neither
397 |\ abc ()
399 |\ abc ()
398 | o 4:f2aa51777cc9 baz
400 | o 4:f2aa51777cc9 baz
399 | | abc ()
401 | | abc ()
400 o | 1:2e33c4f0856b bar
402 o | 1:2e33c4f0856b bar
401 |/ default ()
403 |/ default ()
402 o 0:91cfb6004abf foo
404 o 0:91cfb6004abf foo
403 default ()
405 default ()
404 $ hg cat a
406 $ hg cat a
405 neither
407 neither
406
408
407 $ cd ..
409 $ cd ..
408 $ hg init merge-without-evolution
410 $ hg init merge-without-evolution
409 $ cd merge-without-evolution
411 $ cd merge-without-evolution
410 $ mklozenge
412 $ mklozenge
411 $ cat > .hg/hgrc << EOF
413 $ cat > .hg/hgrc << EOF
412 > [experimental]
414 > [experimental]
413 > evolution = no
415 > evolution = no
414 > evolution.allowunstable = no
416 > evolution.allowunstable = no
415 > EOF
417 > EOF
416
418
417 $ hg branch -r '(.^)::' abc
419 $ hg branch -r '(.^)::' abc
418 changed branch on 2 changesets
420 changed branch on 2 changesets
419 saved backup bundle to $TESTTMP/merge-without-evolution/.hg/strip-backup/9a3a2af368f4-8db1a361-branch-change.hg
421 saved backup bundle to $TESTTMP/merge-without-evolution/.hg/strip-backup/9a3a2af368f4-8db1a361-branch-change.hg
420 $ hg glog
422 $ hg glog
421 @ 3:c07fa8b34d54 neither
423 @ 3:c07fa8b34d54 neither
422 |\ abc ()
424 |\ abc ()
423 | o 2:f2aa51777cc9 baz
425 | o 2:f2aa51777cc9 baz
424 | | abc ()
426 | | abc ()
425 o | 1:2e33c4f0856b bar
427 o | 1:2e33c4f0856b bar
426 |/ default ()
428 |/ default ()
427 o 0:91cfb6004abf foo
429 o 0:91cfb6004abf foo
428 default ()
430 default ()
429 $ hg cat a
431 $ hg cat a
430 neither
432 neither
@@ -1,1692 +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 [10]
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 [10]
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 ci --amend -m rewritten
1109 $ hg ci --amend -m rewritten
1110 $ hg --hidden fix -r 0
1110 $ hg --hidden fix -r 0
1111 abort: fixing obsolete revision could cause divergence
1111 abort: fixing obsolete revision could cause divergence
1112 [255]
1112 [255]
1113
1113
1114 $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true
1114 $ hg --hidden fix -r 0 --config experimental.evolution.allowdivergence=true
1115 2 new content-divergent changesets
1115 2 new content-divergent changesets
1116 $ hg cat -r tip foo.changed
1116 $ hg cat -r tip foo.changed
1117 FOO
1117 FOO
1118
1118
1119 $ cd ..
1119 $ cd ..
1120
1120
1121 Test all of the available substitution values for fixer commands.
1121 Test all of the available substitution values for fixer commands.
1122
1122
1123 $ hg init substitution
1123 $ hg init substitution
1124 $ cd substitution
1124 $ cd substitution
1125
1125
1126 $ mkdir foo
1126 $ mkdir foo
1127 $ printf "hello\ngoodbye\n" > foo/bar
1127 $ printf "hello\ngoodbye\n" > foo/bar
1128 $ hg add
1128 $ hg add
1129 adding foo/bar
1129 adding foo/bar
1130 $ hg --config "fix.fail:command=printf '%s\n' '{rootpath}' '{basename}'" \
1130 $ hg --config "fix.fail:command=printf '%s\n' '{rootpath}' '{basename}'" \
1131 > --config "fix.fail:linerange='{first}' '{last}'" \
1131 > --config "fix.fail:linerange='{first}' '{last}'" \
1132 > --config "fix.fail:pattern=foo/bar" \
1132 > --config "fix.fail:pattern=foo/bar" \
1133 > fix --working-dir
1133 > fix --working-dir
1134 $ cat foo/bar
1134 $ cat foo/bar
1135 foo/bar
1135 foo/bar
1136 bar
1136 bar
1137 1
1137 1
1138 2
1138 2
1139
1139
1140 $ cd ..
1140 $ cd ..
1141
1141
1142 The --base flag should allow picking the revisions to diff against for changed
1142 The --base flag should allow picking the revisions to diff against for changed
1143 files and incremental line formatting.
1143 files and incremental line formatting.
1144
1144
1145 $ hg init baseflag
1145 $ hg init baseflag
1146 $ cd baseflag
1146 $ cd baseflag
1147
1147
1148 $ printf "one\ntwo\n" > foo.changed
1148 $ printf "one\ntwo\n" > foo.changed
1149 $ printf "bar\n" > bar.changed
1149 $ printf "bar\n" > bar.changed
1150 $ hg commit -Aqm "first"
1150 $ hg commit -Aqm "first"
1151 $ printf "one\nTwo\n" > foo.changed
1151 $ printf "one\nTwo\n" > foo.changed
1152 $ hg commit -m "second"
1152 $ hg commit -m "second"
1153 $ hg fix -w --base .
1153 $ hg fix -w --base .
1154 $ hg status
1154 $ hg status
1155 $ hg fix -w --base null
1155 $ hg fix -w --base null
1156 $ cat foo.changed
1156 $ cat foo.changed
1157 ONE
1157 ONE
1158 TWO
1158 TWO
1159 $ cat bar.changed
1159 $ cat bar.changed
1160 BAR
1160 BAR
1161
1161
1162 $ cd ..
1162 $ cd ..
1163
1163
1164 If the user asks to fix the parent of another commit, they are asking to create
1164 If the user asks to fix the parent of another commit, they are asking to create
1165 an orphan. We must respect experimental.evolution.allowunstable.
1165 an orphan. We must respect experimental.evolution.allowunstable.
1166
1166
1167 $ hg init allowunstable
1167 $ hg init allowunstable
1168 $ cd allowunstable
1168 $ cd allowunstable
1169
1169
1170 $ printf "one\n" > foo.whole
1170 $ printf "one\n" > foo.whole
1171 $ hg commit -Aqm "first"
1171 $ hg commit -Aqm "first"
1172 $ printf "two\n" > foo.whole
1172 $ printf "two\n" > foo.whole
1173 $ hg commit -m "second"
1173 $ hg commit -m "second"
1174 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1174 $ hg --config experimental.evolution.allowunstable=False fix -r '.^'
1175 abort: cannot fix changeset with children
1175 abort: cannot fix changeset with children
1176 (see 'hg help evolution.instability')
1176 [10]
1177 [10]
1177 $ hg fix -r '.^'
1178 $ hg fix -r '.^'
1178 1 new orphan changesets
1179 1 new orphan changesets
1179 $ hg cat -r 2 foo.whole
1180 $ hg cat -r 2 foo.whole
1180 ONE
1181 ONE
1181
1182
1182 $ cd ..
1183 $ cd ..
1183
1184
1184 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
1185 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
1186 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
1187 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.
1188
1189
1189 $ hg init basewhole
1190 $ hg init basewhole
1190 $ cd basewhole
1191 $ cd basewhole
1191 $ printf "foo1\n" > foo.changed
1192 $ printf "foo1\n" > foo.changed
1192 $ hg commit -Aqm "first"
1193 $ hg commit -Aqm "first"
1193 $ printf "foo2\n" >> foo.changed
1194 $ printf "foo2\n" >> foo.changed
1194 $ printf "bar\n" > bar.changed
1195 $ printf "bar\n" > bar.changed
1195 $ hg commit -Aqm "second"
1196 $ hg commit -Aqm "second"
1196
1197
1197 $ hg fix --working-dir --whole
1198 $ hg fix --working-dir --whole
1198 $ cat *.changed
1199 $ cat *.changed
1199 bar
1200 bar
1200 foo1
1201 foo1
1201 foo2
1202 foo2
1202
1203
1203 $ hg fix --working-dir --base 0 --whole
1204 $ hg fix --working-dir --base 0 --whole
1204 $ cat *.changed
1205 $ cat *.changed
1205 BAR
1206 BAR
1206 FOO1
1207 FOO1
1207 FOO2
1208 FOO2
1208
1209
1209 $ cd ..
1210 $ cd ..
1210
1211
1211 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
1212 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
1213 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
1214 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
1215 5 numbers in the file.
1216 5 numbers in the file.
1216
1217
1217 $ hg init priorityexample
1218 $ hg init priorityexample
1218 $ cd priorityexample
1219 $ cd priorityexample
1219
1220
1220 $ cat >> .hg/hgrc <<EOF
1221 $ cat >> .hg/hgrc <<EOF
1221 > [fix]
1222 > [fix]
1222 > head:command = head -n 5
1223 > head:command = head -n 5
1223 > head:pattern = numbers.txt
1224 > head:pattern = numbers.txt
1224 > head:priority = 1
1225 > head:priority = 1
1225 > sort:command = sort -n
1226 > sort:command = sort -n
1226 > sort:pattern = numbers.txt
1227 > sort:pattern = numbers.txt
1227 > sort:priority = 2
1228 > sort:priority = 2
1228 > EOF
1229 > EOF
1229
1230
1230 $ 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
1231 $ hg add -q
1232 $ hg add -q
1232 $ hg fix -w
1233 $ hg fix -w
1233 $ cat numbers.txt
1234 $ cat numbers.txt
1234 0
1235 0
1235 1
1236 1
1236 2
1237 2
1237 3
1238 3
1238 4
1239 4
1239
1240
1240 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.
1241 Test negative priorities while we're at it.
1242 Test negative priorities while we're at it.
1242
1243
1243 $ cat >> .hg/hgrc <<EOF
1244 $ cat >> .hg/hgrc <<EOF
1244 > [fix]
1245 > [fix]
1245 > head:priority = -1
1246 > head:priority = -1
1246 > sort:priority = -2
1247 > sort:priority = -2
1247 > EOF
1248 > EOF
1248 $ 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
1249 $ hg fix -w
1250 $ hg fix -w
1250 $ cat numbers.txt
1251 $ cat numbers.txt
1251 2
1252 2
1252 3
1253 3
1253 6
1254 6
1254 7
1255 7
1255 8
1256 8
1256
1257
1257 $ cd ..
1258 $ cd ..
1258
1259
1259 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
1260 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
1261 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
1262 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
1263 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
1264 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
1265 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
1266 three revisions instead of two.
1267 three revisions instead of two.
1267
1268
1268 $ hg init cyclictool
1269 $ hg init cyclictool
1269 $ cd cyclictool
1270 $ cd cyclictool
1270
1271
1271 $ cat >> .hg/hgrc <<EOF
1272 $ cat >> .hg/hgrc <<EOF
1272 > [fix]
1273 > [fix]
1273 > swapletters:command = tr ab ba
1274 > swapletters:command = tr ab ba
1274 > swapletters:pattern = foo
1275 > swapletters:pattern = foo
1275 > EOF
1276 > EOF
1276
1277
1277 $ echo ab > foo
1278 $ echo ab > foo
1278 $ hg commit -Aqm foo
1279 $ hg commit -Aqm foo
1279
1280
1280 $ hg fix -r 0
1281 $ hg fix -r 0
1281 $ hg fix -r 1
1282 $ hg fix -r 1
1282
1283
1283 $ hg cat -r 0 foo --hidden
1284 $ hg cat -r 0 foo --hidden
1284 ab
1285 ab
1285 $ hg cat -r 1 foo --hidden
1286 $ hg cat -r 1 foo --hidden
1286 ba
1287 ba
1287 $ hg cat -r 2 foo
1288 $ hg cat -r 2 foo
1288 ab
1289 ab
1289
1290
1290 $ cd ..
1291 $ cd ..
1291
1292
1292 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
1293 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
1294 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
1295 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
1296 reasonable with that.
1297 reasonable with that.
1297
1298
1298 $ hg init subprocesscwd
1299 $ hg init subprocesscwd
1299 $ cd subprocesscwd
1300 $ cd subprocesscwd
1300
1301
1301 $ cat >> .hg/hgrc <<EOF
1302 $ cat >> .hg/hgrc <<EOF
1302 > [fix]
1303 > [fix]
1303 > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())"
1304 > printcwd:command = "$PYTHON" -c "import os; print(os.getcwd())"
1304 > printcwd:pattern = relpath:foo/bar
1305 > printcwd:pattern = relpath:foo/bar
1305 > filesetpwd:command = "$PYTHON" -c "import os; print('fs: ' + os.getcwd())"
1306 > filesetpwd:command = "$PYTHON" -c "import os; print('fs: ' + os.getcwd())"
1306 > filesetpwd:pattern = set:**quux
1307 > filesetpwd:pattern = set:**quux
1307 > EOF
1308 > EOF
1308
1309
1309 $ mkdir foo
1310 $ mkdir foo
1310 $ printf "bar\n" > foo/bar
1311 $ printf "bar\n" > foo/bar
1311 $ printf "quux\n" > quux
1312 $ printf "quux\n" > quux
1312 $ hg commit -Aqm blah
1313 $ hg commit -Aqm blah
1313
1314
1314 $ hg fix -w -r . foo/bar
1315 $ hg fix -w -r . foo/bar
1315 $ hg cat -r tip foo/bar
1316 $ hg cat -r tip foo/bar
1316 $TESTTMP/subprocesscwd
1317 $TESTTMP/subprocesscwd
1317 $ cat foo/bar
1318 $ cat foo/bar
1318 $TESTTMP/subprocesscwd
1319 $TESTTMP/subprocesscwd
1319
1320
1320 $ cd foo
1321 $ cd foo
1321
1322
1322 $ hg fix -w -r . bar
1323 $ hg fix -w -r . bar
1323 $ hg cat -r tip bar ../quux
1324 $ hg cat -r tip bar ../quux
1324 $TESTTMP/subprocesscwd
1325 $TESTTMP/subprocesscwd
1325 quux
1326 quux
1326 $ cat bar ../quux
1327 $ cat bar ../quux
1327 $TESTTMP/subprocesscwd
1328 $TESTTMP/subprocesscwd
1328 quux
1329 quux
1329 $ echo modified > bar
1330 $ echo modified > bar
1330 $ hg fix -w bar
1331 $ hg fix -w bar
1331 $ cat bar
1332 $ cat bar
1332 $TESTTMP/subprocesscwd
1333 $TESTTMP/subprocesscwd
1333
1334
1334 Apparently fixing p1() and its descendants doesn't include wdir() unless
1335 Apparently fixing p1() and its descendants doesn't include wdir() unless
1335 explicitly stated.
1336 explicitly stated.
1336
1337
1337 $ hg fix -r '.::'
1338 $ hg fix -r '.::'
1338 $ hg cat -r . ../quux
1339 $ hg cat -r . ../quux
1339 quux
1340 quux
1340 $ hg cat -r tip ../quux
1341 $ hg cat -r tip ../quux
1341 fs: $TESTTMP/subprocesscwd
1342 fs: $TESTTMP/subprocesscwd
1342 $ cat ../quux
1343 $ cat ../quux
1343 quux
1344 quux
1344
1345
1345 Clean files are not fixed unless explicitly named
1346 Clean files are not fixed unless explicitly named
1346 $ echo 'dirty' > ../quux
1347 $ echo 'dirty' > ../quux
1347
1348
1348 $ hg fix --working-dir
1349 $ hg fix --working-dir
1349 $ cat ../quux
1350 $ cat ../quux
1350 fs: $TESTTMP/subprocesscwd
1351 fs: $TESTTMP/subprocesscwd
1351
1352
1352 $ cd ../..
1353 $ cd ../..
1353
1354
1354 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
1355 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
1356 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
1357 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
1358 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
1359 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.
1360
1361
1361 $ hg init nopatternconfigured
1362 $ hg init nopatternconfigured
1362 $ cd nopatternconfigured
1363 $ cd nopatternconfigured
1363
1364
1364 $ printf "foo" > foo
1365 $ printf "foo" > foo
1365 $ printf "bar" > bar
1366 $ printf "bar" > bar
1366 $ hg add -q
1367 $ hg add -q
1367 $ hg fix --debug --working-dir --config "fix.nopattern:command=echo fixed"
1368 $ hg fix --debug --working-dir --config "fix.nopattern:command=echo fixed"
1368 fixer tool has no pattern configuration: nopattern
1369 fixer tool has no pattern configuration: nopattern
1369 $ cat foo bar
1370 $ cat foo bar
1370 foobar (no-eol)
1371 foobar (no-eol)
1371 $ hg fix --debug --working-dir --config "fix.nocommand:pattern=foo.bar"
1372 $ hg fix --debug --working-dir --config "fix.nocommand:pattern=foo.bar"
1372 fixer tool has no command configuration: nocommand
1373 fixer tool has no command configuration: nocommand
1373
1374
1374 $ cd ..
1375 $ cd ..
1375
1376
1376 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.
1377
1378
1378 $ hg init disabled
1379 $ hg init disabled
1379 $ cd disabled
1380 $ cd disabled
1380
1381
1381 $ printf "foo\n" > foo
1382 $ printf "foo\n" > foo
1382 $ hg add -q
1383 $ hg add -q
1383 $ hg fix --debug --working-dir --config "fix.disabled:command=echo fixed" \
1384 $ hg fix --debug --working-dir --config "fix.disabled:command=echo fixed" \
1384 > --config "fix.disabled:pattern=foo" \
1385 > --config "fix.disabled:pattern=foo" \
1385 > --config "fix.disabled:enabled=false"
1386 > --config "fix.disabled:enabled=false"
1386 ignoring disabled fixer tool: disabled
1387 ignoring disabled fixer tool: disabled
1387 $ cat foo
1388 $ cat foo
1388 foo
1389 foo
1389
1390
1390 $ cd ..
1391 $ cd ..
1391
1392
1392 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.
1393 The way we invoke matching must not prohibit this.
1394 The way we invoke matching must not prohibit this.
1394
1395
1395 $ hg init affectallfiles
1396 $ hg init affectallfiles
1396 $ cd affectallfiles
1397 $ cd affectallfiles
1397
1398
1398 $ mkdir foo bar
1399 $ mkdir foo bar
1399 $ printf "foo" > foo/file
1400 $ printf "foo" > foo/file
1400 $ printf "bar" > bar/file
1401 $ printf "bar" > bar/file
1401 $ printf "baz" > baz_file
1402 $ printf "baz" > baz_file
1402 $ hg add -q
1403 $ hg add -q
1403
1404
1404 $ cd bar
1405 $ cd bar
1405 $ hg fix --working-dir --config "fix.cooltool:command=echo fixed" \
1406 $ hg fix --working-dir --config "fix.cooltool:command=echo fixed" \
1406 > --config "fix.cooltool:pattern=glob:**"
1407 > --config "fix.cooltool:pattern=glob:**"
1407 $ cd ..
1408 $ cd ..
1408
1409
1409 $ cat foo/file
1410 $ cat foo/file
1410 fixed
1411 fixed
1411 $ cat bar/file
1412 $ cat bar/file
1412 fixed
1413 fixed
1413 $ cat baz_file
1414 $ cat baz_file
1414 fixed
1415 fixed
1415
1416
1416 $ cd ..
1417 $ cd ..
1417
1418
1418 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.
1419 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
1420 changes.
1421 changes.
1421
1422
1422 $ hg init skipclean
1423 $ hg init skipclean
1423 $ cd skipclean
1424 $ cd skipclean
1424
1425
1425 $ printf "a\nb\nc\n" > foo
1426 $ printf "a\nb\nc\n" > foo
1426 $ printf "a\nb\nc\n" > bar
1427 $ printf "a\nb\nc\n" > bar
1427 $ printf "a\nb\nc\n" > baz
1428 $ printf "a\nb\nc\n" > baz
1428 $ hg commit -Aqm "base"
1429 $ hg commit -Aqm "base"
1429
1430
1430 $ printf "a\nc\n" > foo
1431 $ printf "a\nc\n" > foo
1431 $ printf "a\nx\nc\n" > baz
1432 $ printf "a\nx\nc\n" > baz
1432
1433
1433 $ cat >> print.py <<EOF
1434 $ cat >> print.py <<EOF
1434 > import sys
1435 > import sys
1435 > for a in sys.argv[1:]:
1436 > for a in sys.argv[1:]:
1436 > print(a)
1437 > print(a)
1437 > EOF
1438 > EOF
1438
1439
1439 $ hg fix --working-dir foo bar baz \
1440 $ hg fix --working-dir foo bar baz \
1440 > --config "fix.changedlines:command=\"$PYTHON\" print.py \"Line ranges:\"" \
1441 > --config "fix.changedlines:command=\"$PYTHON\" print.py \"Line ranges:\"" \
1441 > --config 'fix.changedlines:linerange="{first} through {last}"' \
1442 > --config 'fix.changedlines:linerange="{first} through {last}"' \
1442 > --config 'fix.changedlines:pattern=glob:**' \
1443 > --config 'fix.changedlines:pattern=glob:**' \
1443 > --config 'fix.changedlines:skipclean=false'
1444 > --config 'fix.changedlines:skipclean=false'
1444
1445
1445 $ cat foo
1446 $ cat foo
1446 Line ranges:
1447 Line ranges:
1447 $ cat bar
1448 $ cat bar
1448 Line ranges:
1449 Line ranges:
1449 $ cat baz
1450 $ cat baz
1450 Line ranges:
1451 Line ranges:
1451 2 through 2
1452 2 through 2
1452
1453
1453 $ cd ..
1454 $ cd ..
1454
1455
1455 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
1456 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:
1457 * added, was fixed
1458 * added, was fixed
1458 * added, considered for fixing but was already good
1459 * added, considered for fixing but was already good
1459 * added, not considered for fixing
1460 * added, not considered for fixing
1460 * modified, was fixed
1461 * modified, was fixed
1461 * modified, considered for fixing but was already good
1462 * modified, considered for fixing but was already good
1462 * modified, not considered for fixing
1463 * modified, not considered for fixing
1463
1464
1464 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
1465 following issues:
1466 following issues:
1466 * new_in_r1.ignored, new_in_r1_already_good.changed, and
1467 * new_in_r1.ignored, new_in_r1_already_good.changed, and
1467 > 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
1468 * mod_in_r1.ignored had its contents from r0, NOT r1.
1469 * mod_in_r1.ignored had its contents from r0, NOT r1.
1469
1470
1470 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
1471 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
1472 middle of fix.
1473 middle of fix.
1473
1474
1474 $ hg init merge_keeps_files
1475 $ hg init merge_keeps_files
1475 $ cd merge_keeps_files
1476 $ cd merge_keeps_files
1476 $ 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
1477 > for c in changed whole ignored; do
1478 > for c in changed whole ignored; do
1478 > printf "hello\n" > $f.$c
1479 > printf "hello\n" > $f.$c
1479 > done
1480 > done
1480 > printf "HELLO\n" > "mod_in_${f}_already_good.changed"
1481 > printf "HELLO\n" > "mod_in_${f}_already_good.changed"
1481 > done
1482 > done
1482 $ hg branch -q r0
1483 $ hg branch -q r0
1483 $ hg ci -Aqm 'r0'
1484 $ hg ci -Aqm 'r0'
1484 $ hg phase -p
1485 $ hg phase -p
1485 $ make_test_files() {
1486 $ make_test_files() {
1486 > printf "world\n" >> "mod_in_$1.changed"
1487 > printf "world\n" >> "mod_in_$1.changed"
1487 > printf "world\n" >> "mod_in_$1.whole"
1488 > printf "world\n" >> "mod_in_$1.whole"
1488 > printf "world\n" >> "mod_in_$1.ignored"
1489 > printf "world\n" >> "mod_in_$1.ignored"
1489 > printf "WORLD\n" >> "mod_in_$1_already_good.changed"
1490 > printf "WORLD\n" >> "mod_in_$1_already_good.changed"
1490 > printf "new in $1\n" > "new_in_$1.changed"
1491 > printf "new in $1\n" > "new_in_$1.changed"
1491 > printf "new in $1\n" > "new_in_$1.whole"
1492 > printf "new in $1\n" > "new_in_$1.whole"
1492 > printf "new in $1\n" > "new_in_$1.ignored"
1493 > printf "new in $1\n" > "new_in_$1.ignored"
1493 > 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"
1494 > }
1495 > }
1495 $ make_test_commit() {
1496 $ make_test_commit() {
1496 > make_test_files "$1"
1497 > make_test_files "$1"
1497 > hg branch -q "$1"
1498 > hg branch -q "$1"
1498 > hg ci -Aqm "$2"
1499 > hg ci -Aqm "$2"
1499 > }
1500 > }
1500 $ make_test_commit r1 "merge me, pt1"
1501 $ make_test_commit r1 "merge me, pt1"
1501 $ hg co -q ".^"
1502 $ hg co -q ".^"
1502 $ make_test_commit r2 "merge me, pt2"
1503 $ make_test_commit r2 "merge me, pt2"
1503 $ hg merge -qr 1
1504 $ hg merge -qr 1
1504 $ make_test_commit merge "evil merge"
1505 $ make_test_commit merge "evil merge"
1505 $ make_test_commit child "child of merge"
1506 $ make_test_commit child "child of merge"
1506 $ make_test_files wdir
1507 $ make_test_files wdir
1507 $ hg fix -r 'not public()' -w
1508 $ hg fix -r 'not public()' -w
1508 $ 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}'
1509 @ 8:c22ce900: branch:child desc:child of merge
1510 @ 8:c22ce900: branch:child desc:child of merge
1510 |
1511 |
1511 o 7:5a30615a: branch:merge desc:evil merge
1512 o 7:5a30615a: branch:merge desc:evil merge
1512 |\
1513 |\
1513 | o 6:4e5acdc4: branch:r2 desc:merge me, pt2
1514 | o 6:4e5acdc4: branch:r2 desc:merge me, pt2
1514 | |
1515 | |
1515 o | 5:eea01878: branch:r1 desc:merge me, pt1
1516 o | 5:eea01878: branch:r1 desc:merge me, pt1
1516 |/
1517 |/
1517 o 0:0c548d87: branch:r0 desc:r0
1518 o 0:0c548d87: branch:r0 desc:r0
1518
1519
1519 $ hg files -r tip
1520 $ hg files -r tip
1520 mod_in_child.changed
1521 mod_in_child.changed
1521 mod_in_child.ignored
1522 mod_in_child.ignored
1522 mod_in_child.whole
1523 mod_in_child.whole
1523 mod_in_child_already_good.changed
1524 mod_in_child_already_good.changed
1524 mod_in_merge.changed
1525 mod_in_merge.changed
1525 mod_in_merge.ignored
1526 mod_in_merge.ignored
1526 mod_in_merge.whole
1527 mod_in_merge.whole
1527 mod_in_merge_already_good.changed
1528 mod_in_merge_already_good.changed
1528 mod_in_mod_in_child_already_good.changed
1529 mod_in_mod_in_child_already_good.changed
1529 mod_in_mod_in_merge_already_good.changed
1530 mod_in_mod_in_merge_already_good.changed
1530 mod_in_mod_in_r1_already_good.changed
1531 mod_in_mod_in_r1_already_good.changed
1531 mod_in_mod_in_r2_already_good.changed
1532 mod_in_mod_in_r2_already_good.changed
1532 mod_in_r0_already_good.changed
1533 mod_in_r0_already_good.changed
1533 mod_in_r1.changed
1534 mod_in_r1.changed
1534 mod_in_r1.ignored
1535 mod_in_r1.ignored
1535 mod_in_r1.whole
1536 mod_in_r1.whole
1536 mod_in_r1_already_good.changed
1537 mod_in_r1_already_good.changed
1537 mod_in_r2.changed
1538 mod_in_r2.changed
1538 mod_in_r2.ignored
1539 mod_in_r2.ignored
1539 mod_in_r2.whole
1540 mod_in_r2.whole
1540 mod_in_r2_already_good.changed
1541 mod_in_r2_already_good.changed
1541 new_in_child.changed
1542 new_in_child.changed
1542 new_in_child.ignored
1543 new_in_child.ignored
1543 new_in_child.whole
1544 new_in_child.whole
1544 new_in_child_already_good.changed
1545 new_in_child_already_good.changed
1545 new_in_merge.changed
1546 new_in_merge.changed
1546 new_in_merge.ignored
1547 new_in_merge.ignored
1547 new_in_merge.whole
1548 new_in_merge.whole
1548 new_in_merge_already_good.changed
1549 new_in_merge_already_good.changed
1549 new_in_r1.changed
1550 new_in_r1.changed
1550 new_in_r1.ignored
1551 new_in_r1.ignored
1551 new_in_r1.whole
1552 new_in_r1.whole
1552 new_in_r1_already_good.changed
1553 new_in_r1_already_good.changed
1553 new_in_r2.changed
1554 new_in_r2.changed
1554 new_in_r2.ignored
1555 new_in_r2.ignored
1555 new_in_r2.whole
1556 new_in_r2.whole
1556 new_in_r2_already_good.changed
1557 new_in_r2_already_good.changed
1557 r0.changed
1558 r0.changed
1558 r0.ignored
1559 r0.ignored
1559 r0.whole
1560 r0.whole
1560 $ 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
1561 mod_in_child.changed:
1562 mod_in_child.changed:
1562 hello
1563 hello
1563 WORLD
1564 WORLD
1564
1565
1565 mod_in_child.ignored:
1566 mod_in_child.ignored:
1566 hello
1567 hello
1567 world
1568 world
1568
1569
1569 mod_in_child.whole:
1570 mod_in_child.whole:
1570 HELLO
1571 HELLO
1571 WORLD
1572 WORLD
1572
1573
1573 mod_in_child_already_good.changed:
1574 mod_in_child_already_good.changed:
1574 WORLD
1575 WORLD
1575
1576
1576 mod_in_merge.changed:
1577 mod_in_merge.changed:
1577 hello
1578 hello
1578 WORLD
1579 WORLD
1579
1580
1580 mod_in_merge.ignored:
1581 mod_in_merge.ignored:
1581 hello
1582 hello
1582 world
1583 world
1583
1584
1584 mod_in_merge.whole:
1585 mod_in_merge.whole:
1585 HELLO
1586 HELLO
1586 WORLD
1587 WORLD
1587
1588
1588 mod_in_merge_already_good.changed:
1589 mod_in_merge_already_good.changed:
1589 WORLD
1590 WORLD
1590
1591
1591 mod_in_mod_in_child_already_good.changed:
1592 mod_in_mod_in_child_already_good.changed:
1592 HELLO
1593 HELLO
1593
1594
1594 mod_in_mod_in_merge_already_good.changed:
1595 mod_in_mod_in_merge_already_good.changed:
1595 HELLO
1596 HELLO
1596
1597
1597 mod_in_mod_in_r1_already_good.changed:
1598 mod_in_mod_in_r1_already_good.changed:
1598 HELLO
1599 HELLO
1599
1600
1600 mod_in_mod_in_r2_already_good.changed:
1601 mod_in_mod_in_r2_already_good.changed:
1601 HELLO
1602 HELLO
1602
1603
1603 mod_in_r0_already_good.changed:
1604 mod_in_r0_already_good.changed:
1604 HELLO
1605 HELLO
1605
1606
1606 mod_in_r1.changed:
1607 mod_in_r1.changed:
1607 hello
1608 hello
1608 WORLD
1609 WORLD
1609
1610
1610 mod_in_r1.ignored:
1611 mod_in_r1.ignored:
1611 hello
1612 hello
1612 world
1613 world
1613
1614
1614 mod_in_r1.whole:
1615 mod_in_r1.whole:
1615 HELLO
1616 HELLO
1616 WORLD
1617 WORLD
1617
1618
1618 mod_in_r1_already_good.changed:
1619 mod_in_r1_already_good.changed:
1619 WORLD
1620 WORLD
1620
1621
1621 mod_in_r2.changed:
1622 mod_in_r2.changed:
1622 hello
1623 hello
1623 WORLD
1624 WORLD
1624
1625
1625 mod_in_r2.ignored:
1626 mod_in_r2.ignored:
1626 hello
1627 hello
1627 world
1628 world
1628
1629
1629 mod_in_r2.whole:
1630 mod_in_r2.whole:
1630 HELLO
1631 HELLO
1631 WORLD
1632 WORLD
1632
1633
1633 mod_in_r2_already_good.changed:
1634 mod_in_r2_already_good.changed:
1634 WORLD
1635 WORLD
1635
1636
1636 new_in_child.changed:
1637 new_in_child.changed:
1637 NEW IN CHILD
1638 NEW IN CHILD
1638
1639
1639 new_in_child.ignored:
1640 new_in_child.ignored:
1640 new in child
1641 new in child
1641
1642
1642 new_in_child.whole:
1643 new_in_child.whole:
1643 NEW IN CHILD
1644 NEW IN CHILD
1644
1645
1645 new_in_child_already_good.changed:
1646 new_in_child_already_good.changed:
1646 ALREADY GOOD, NEW IN THIS REV
1647 ALREADY GOOD, NEW IN THIS REV
1647
1648
1648 new_in_merge.changed:
1649 new_in_merge.changed:
1649 NEW IN MERGE
1650 NEW IN MERGE
1650
1651
1651 new_in_merge.ignored:
1652 new_in_merge.ignored:
1652 new in merge
1653 new in merge
1653
1654
1654 new_in_merge.whole:
1655 new_in_merge.whole:
1655 NEW IN MERGE
1656 NEW IN MERGE
1656
1657
1657 new_in_merge_already_good.changed:
1658 new_in_merge_already_good.changed:
1658 ALREADY GOOD, NEW IN THIS REV
1659 ALREADY GOOD, NEW IN THIS REV
1659
1660
1660 new_in_r1.changed:
1661 new_in_r1.changed:
1661 NEW IN R1
1662 NEW IN R1
1662
1663
1663 new_in_r1.ignored:
1664 new_in_r1.ignored:
1664 new in r1
1665 new in r1
1665
1666
1666 new_in_r1.whole:
1667 new_in_r1.whole:
1667 NEW IN R1
1668 NEW IN R1
1668
1669
1669 new_in_r1_already_good.changed:
1670 new_in_r1_already_good.changed:
1670 ALREADY GOOD, NEW IN THIS REV
1671 ALREADY GOOD, NEW IN THIS REV
1671
1672
1672 new_in_r2.changed:
1673 new_in_r2.changed:
1673 NEW IN R2
1674 NEW IN R2
1674
1675
1675 new_in_r2.ignored:
1676 new_in_r2.ignored:
1676 new in r2
1677 new in r2
1677
1678
1678 new_in_r2.whole:
1679 new_in_r2.whole:
1679 NEW IN R2
1680 NEW IN R2
1680
1681
1681 new_in_r2_already_good.changed:
1682 new_in_r2_already_good.changed:
1682 ALREADY GOOD, NEW IN THIS REV
1683 ALREADY GOOD, NEW IN THIS REV
1683
1684
1684 r0.changed:
1685 r0.changed:
1685 hello
1686 hello
1686
1687
1687 r0.ignored:
1688 r0.ignored:
1688 hello
1689 hello
1689
1690
1690 r0.whole:
1691 r0.whole:
1691 hello
1692 hello
1692
1693
@@ -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 [10]
137 [10]
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 [20]
183 [20]
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 [20]
389 [20]
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 [20]
407 [20]
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 [10]
487 [10]
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 (see 'hg help evolution.instability')
554 [10]
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 [250]
763 [250]
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,984 +1,984 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 [10]
269 [10]
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 [10]
276 [10]
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 nothing to rebase
328 nothing to rebase
329 [1]
329 [1]
330 $ hg rebase -d 5 -b 6
330 $ hg rebase -d 5 -b 6
331 abort: cannot rebase public changesets
331 abort: cannot rebase public changesets
332 (see 'hg help phases' for details)
332 (see 'hg help phases' for details)
333 [10]
333 [10]
334 $ hg rebase -d 5 -r '1 + (6::)'
334 $ hg rebase -d 5 -r '1 + (6::)'
335 abort: cannot rebase public changesets
335 abort: cannot rebase public changesets
336 (see 'hg help phases' for details)
336 (see 'hg help phases' for details)
337 [10]
337 [10]
338
338
339 $ hg rebase -d 5 -b 6 --keep
339 $ hg rebase -d 5 -b 6 --keep
340 rebasing 6:e1c4361dd923 "C"
340 rebasing 6:e1c4361dd923 "C"
341 rebasing 7:c9659aac0000 tip "D"
341 rebasing 7:c9659aac0000 tip "D"
342
342
343 Check rebasing mutable changeset
343 Check rebasing mutable changeset
344 Source phase greater or equal to destination phase: new changeset get the phase of source:
344 Source phase greater or equal to destination phase: new changeset get the phase of source:
345 $ hg id -n
345 $ hg id -n
346 5
346 5
347 $ hg rebase -s9 -d0
347 $ hg rebase -s9 -d0
348 rebasing 9:2b23e52411f4 tip "D"
348 rebasing 9:2b23e52411f4 tip "D"
349 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg
349 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2b23e52411f4-f942decf-rebase.hg
350 $ hg id -n # check we updated back to parent
350 $ hg id -n # check we updated back to parent
351 5
351 5
352 $ hg log --template "{phase}\n" -r 9
352 $ hg log --template "{phase}\n" -r 9
353 draft
353 draft
354 $ hg rebase -s9 -d1
354 $ hg rebase -s9 -d1
355 rebasing 9:2cb10d0cfc6c tip "D"
355 rebasing 9:2cb10d0cfc6c tip "D"
356 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg
356 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2cb10d0cfc6c-ddb0f256-rebase.hg
357 $ hg log --template "{phase}\n" -r 9
357 $ hg log --template "{phase}\n" -r 9
358 draft
358 draft
359 $ hg phase --force --secret 9
359 $ hg phase --force --secret 9
360 $ hg rebase -s9 -d0
360 $ hg rebase -s9 -d0
361 rebasing 9:c5b12b67163a tip "D"
361 rebasing 9:c5b12b67163a tip "D"
362 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg
362 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/c5b12b67163a-4e372053-rebase.hg
363 $ hg log --template "{phase}\n" -r 9
363 $ hg log --template "{phase}\n" -r 9
364 secret
364 secret
365 $ hg rebase -s9 -d1
365 $ hg rebase -s9 -d1
366 rebasing 9:2a0524f868ac tip "D"
366 rebasing 9:2a0524f868ac tip "D"
367 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg
367 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/2a0524f868ac-cefd8574-rebase.hg
368 $ hg log --template "{phase}\n" -r 9
368 $ hg log --template "{phase}\n" -r 9
369 secret
369 secret
370 Source phase lower than destination phase: new changeset get the phase of destination:
370 Source phase lower than destination phase: new changeset get the phase of destination:
371 $ hg rebase -s8 -d9
371 $ hg rebase -s8 -d9
372 rebasing 8:6d4f22462821 "C"
372 rebasing 8:6d4f22462821 "C"
373 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg
373 saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6d4f22462821-3441f70b-rebase.hg
374 $ hg log --template "{phase}\n" -r 'rev(9)'
374 $ hg log --template "{phase}\n" -r 'rev(9)'
375 secret
375 secret
376
376
377 $ cd ..
377 $ cd ..
378
378
379 Check that temporary bundle doesn't lose phase when not using generaldelta
379 Check that temporary bundle doesn't lose phase when not using generaldelta
380
380
381 $ hg --config format.usegeneraldelta=no init issue5678
381 $ hg --config format.usegeneraldelta=no init issue5678
382 $ cd issue5678
382 $ cd issue5678
383 $ grep generaldelta .hg/requires
383 $ grep generaldelta .hg/requires
384 [1]
384 [1]
385 $ echo a > a
385 $ echo a > a
386 $ hg ci -Aqm a
386 $ hg ci -Aqm a
387 $ echo b > b
387 $ echo b > b
388 $ hg ci -Aqm b
388 $ hg ci -Aqm b
389 $ hg co -q '.^'
389 $ hg co -q '.^'
390 $ echo c > c
390 $ echo c > c
391 $ hg ci -Aqm c
391 $ hg ci -Aqm c
392 $ hg phase --public
392 $ hg phase --public
393 $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
393 $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
394 @ 2:d36c public c
394 @ 2:d36c public c
395 |
395 |
396 | o 1:d2ae draft b
396 | o 1:d2ae draft b
397 |/
397 |/
398 o 0:cb9a public a
398 o 0:cb9a public a
399
399
400 $ hg rebase -s 1 -d 2
400 $ hg rebase -s 1 -d 2
401 rebasing 1:d2ae7f538514 "b"
401 rebasing 1:d2ae7f538514 "b"
402 saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg
402 saved backup bundle to $TESTTMP/issue5678/.hg/strip-backup/d2ae7f538514-2953539b-rebase.hg
403 $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
403 $ hg log -G -T '{rev}:{node|shortest} {phase} {desc}\n'
404 o 2:c882 draft b
404 o 2:c882 draft b
405 |
405 |
406 @ 1:d36c public c
406 @ 1:d36c public c
407 |
407 |
408 o 0:cb9a public a
408 o 0:cb9a public a
409
409
410 $ cd ..
410 $ cd ..
411
411
412 Test for revset
412 Test for revset
413
413
414 We need a bit different graph
414 We need a bit different graph
415 All destination are B
415 All destination are B
416
416
417 $ hg init ah
417 $ hg init ah
418 $ cd ah
418 $ cd ah
419 $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg"
419 $ hg unbundle "$TESTDIR/bundles/rebase-revset.hg"
420 adding changesets
420 adding changesets
421 adding manifests
421 adding manifests
422 adding file changes
422 adding file changes
423 added 9 changesets with 9 changes to 9 files (+2 heads)
423 added 9 changesets with 9 changes to 9 files (+2 heads)
424 new changesets 9ae2ed22e576:479ddb54a924 (9 drafts)
424 new changesets 9ae2ed22e576:479ddb54a924 (9 drafts)
425 (run 'hg heads' to see heads, 'hg merge' to merge)
425 (run 'hg heads' to see heads, 'hg merge' to merge)
426 $ hg tglog
426 $ hg tglog
427 o 8: 479ddb54a924 'I'
427 o 8: 479ddb54a924 'I'
428 |
428 |
429 o 7: 72434a4e60b0 'H'
429 o 7: 72434a4e60b0 'H'
430 |
430 |
431 o 6: 3d8a618087a7 'G'
431 o 6: 3d8a618087a7 'G'
432 |
432 |
433 | o 5: 41bfcc75ed73 'F'
433 | o 5: 41bfcc75ed73 'F'
434 | |
434 | |
435 | o 4: c01897464e7f 'E'
435 | o 4: c01897464e7f 'E'
436 |/
436 |/
437 o 3: ffd453c31098 'D'
437 o 3: ffd453c31098 'D'
438 |
438 |
439 o 2: c9e50f6cdc55 'C'
439 o 2: c9e50f6cdc55 'C'
440 |
440 |
441 | o 1: 8fd0f7e49f53 'B'
441 | o 1: 8fd0f7e49f53 'B'
442 |/
442 |/
443 o 0: 9ae2ed22e576 'A'
443 o 0: 9ae2ed22e576 'A'
444
444
445 $ cd ..
445 $ cd ..
446
446
447
447
448 Simple case with keep:
448 Simple case with keep:
449
449
450 Source on have two descendant heads but ask for one
450 Source on have two descendant heads but ask for one
451
451
452 $ hg clone -q -u . ah ah1
452 $ hg clone -q -u . ah ah1
453 $ cd ah1
453 $ cd ah1
454 $ hg rebase -r '2::8' -d 1
454 $ hg rebase -r '2::8' -d 1
455 abort: cannot rebase changeset with children
455 abort: cannot rebase changeset with children
456 (use --keep to keep original changesets)
456 (see 'hg help evolution.instability')
457 [10]
457 [10]
458 $ hg rebase -r '2::8' -d 1 -k
458 $ hg rebase -r '2::8' -d 1 -k
459 rebasing 2:c9e50f6cdc55 "C"
459 rebasing 2:c9e50f6cdc55 "C"
460 rebasing 3:ffd453c31098 "D"
460 rebasing 3:ffd453c31098 "D"
461 rebasing 6:3d8a618087a7 "G"
461 rebasing 6:3d8a618087a7 "G"
462 rebasing 7:72434a4e60b0 "H"
462 rebasing 7:72434a4e60b0 "H"
463 rebasing 8:479ddb54a924 tip "I"
463 rebasing 8:479ddb54a924 tip "I"
464 $ hg tglog
464 $ hg tglog
465 o 13: 9bf1d9358a90 'I'
465 o 13: 9bf1d9358a90 'I'
466 |
466 |
467 o 12: 274623a778d4 'H'
467 o 12: 274623a778d4 'H'
468 |
468 |
469 o 11: ab8c8617c8e8 'G'
469 o 11: ab8c8617c8e8 'G'
470 |
470 |
471 o 10: c8cbf59f70da 'D'
471 o 10: c8cbf59f70da 'D'
472 |
472 |
473 o 9: 563e4faab485 'C'
473 o 9: 563e4faab485 'C'
474 |
474 |
475 | o 8: 479ddb54a924 'I'
475 | o 8: 479ddb54a924 'I'
476 | |
476 | |
477 | o 7: 72434a4e60b0 'H'
477 | o 7: 72434a4e60b0 'H'
478 | |
478 | |
479 | o 6: 3d8a618087a7 'G'
479 | o 6: 3d8a618087a7 'G'
480 | |
480 | |
481 | | o 5: 41bfcc75ed73 'F'
481 | | o 5: 41bfcc75ed73 'F'
482 | | |
482 | | |
483 | | o 4: c01897464e7f 'E'
483 | | o 4: c01897464e7f 'E'
484 | |/
484 | |/
485 | o 3: ffd453c31098 'D'
485 | o 3: ffd453c31098 'D'
486 | |
486 | |
487 | o 2: c9e50f6cdc55 'C'
487 | o 2: c9e50f6cdc55 'C'
488 | |
488 | |
489 o | 1: 8fd0f7e49f53 'B'
489 o | 1: 8fd0f7e49f53 'B'
490 |/
490 |/
491 o 0: 9ae2ed22e576 'A'
491 o 0: 9ae2ed22e576 'A'
492
492
493
493
494 $ cd ..
494 $ cd ..
495
495
496 Base on have one descendant heads we ask for but common ancestor have two
496 Base on have one descendant heads we ask for but common ancestor have two
497
497
498 $ hg clone -q -u . ah ah2
498 $ hg clone -q -u . ah ah2
499 $ cd ah2
499 $ cd ah2
500 $ hg rebase -r '3::8' -d 1
500 $ hg rebase -r '3::8' -d 1
501 abort: cannot rebase changeset with children
501 abort: cannot rebase changeset with children
502 (use --keep to keep original changesets)
502 (see 'hg help evolution.instability')
503 [10]
503 [10]
504 $ hg rebase -r '3::8' -d 1 --keep
504 $ hg rebase -r '3::8' -d 1 --keep
505 rebasing 3:ffd453c31098 "D"
505 rebasing 3:ffd453c31098 "D"
506 rebasing 6:3d8a618087a7 "G"
506 rebasing 6:3d8a618087a7 "G"
507 rebasing 7:72434a4e60b0 "H"
507 rebasing 7:72434a4e60b0 "H"
508 rebasing 8:479ddb54a924 tip "I"
508 rebasing 8:479ddb54a924 tip "I"
509 $ hg tglog
509 $ hg tglog
510 o 12: 9d7da0053b1c 'I'
510 o 12: 9d7da0053b1c 'I'
511 |
511 |
512 o 11: 8fbd00952cbc 'H'
512 o 11: 8fbd00952cbc 'H'
513 |
513 |
514 o 10: 51d434a615ee 'G'
514 o 10: 51d434a615ee 'G'
515 |
515 |
516 o 9: a9c125634b0b 'D'
516 o 9: a9c125634b0b 'D'
517 |
517 |
518 | o 8: 479ddb54a924 'I'
518 | o 8: 479ddb54a924 'I'
519 | |
519 | |
520 | o 7: 72434a4e60b0 'H'
520 | o 7: 72434a4e60b0 'H'
521 | |
521 | |
522 | o 6: 3d8a618087a7 'G'
522 | o 6: 3d8a618087a7 'G'
523 | |
523 | |
524 | | o 5: 41bfcc75ed73 'F'
524 | | o 5: 41bfcc75ed73 'F'
525 | | |
525 | | |
526 | | o 4: c01897464e7f 'E'
526 | | o 4: c01897464e7f 'E'
527 | |/
527 | |/
528 | o 3: ffd453c31098 'D'
528 | o 3: ffd453c31098 'D'
529 | |
529 | |
530 | o 2: c9e50f6cdc55 'C'
530 | o 2: c9e50f6cdc55 'C'
531 | |
531 | |
532 o | 1: 8fd0f7e49f53 'B'
532 o | 1: 8fd0f7e49f53 'B'
533 |/
533 |/
534 o 0: 9ae2ed22e576 'A'
534 o 0: 9ae2ed22e576 'A'
535
535
536
536
537 $ cd ..
537 $ cd ..
538
538
539 rebase subset
539 rebase subset
540
540
541 $ hg clone -q -u . ah ah3
541 $ hg clone -q -u . ah ah3
542 $ cd ah3
542 $ cd ah3
543 $ hg rebase -r '3::7' -d 1
543 $ hg rebase -r '3::7' -d 1
544 abort: cannot rebase changeset with children
544 abort: cannot rebase changeset with children
545 (use --keep to keep original changesets)
545 (see 'hg help evolution.instability')
546 [10]
546 [10]
547 $ hg rebase -r '3::7' -d 1 --keep
547 $ hg rebase -r '3::7' -d 1 --keep
548 rebasing 3:ffd453c31098 "D"
548 rebasing 3:ffd453c31098 "D"
549 rebasing 6:3d8a618087a7 "G"
549 rebasing 6:3d8a618087a7 "G"
550 rebasing 7:72434a4e60b0 "H"
550 rebasing 7:72434a4e60b0 "H"
551 $ hg tglog
551 $ hg tglog
552 o 11: 8fbd00952cbc 'H'
552 o 11: 8fbd00952cbc 'H'
553 |
553 |
554 o 10: 51d434a615ee 'G'
554 o 10: 51d434a615ee 'G'
555 |
555 |
556 o 9: a9c125634b0b 'D'
556 o 9: a9c125634b0b 'D'
557 |
557 |
558 | o 8: 479ddb54a924 'I'
558 | o 8: 479ddb54a924 'I'
559 | |
559 | |
560 | o 7: 72434a4e60b0 'H'
560 | o 7: 72434a4e60b0 'H'
561 | |
561 | |
562 | o 6: 3d8a618087a7 'G'
562 | o 6: 3d8a618087a7 'G'
563 | |
563 | |
564 | | o 5: 41bfcc75ed73 'F'
564 | | o 5: 41bfcc75ed73 'F'
565 | | |
565 | | |
566 | | o 4: c01897464e7f 'E'
566 | | o 4: c01897464e7f 'E'
567 | |/
567 | |/
568 | o 3: ffd453c31098 'D'
568 | o 3: ffd453c31098 'D'
569 | |
569 | |
570 | o 2: c9e50f6cdc55 'C'
570 | o 2: c9e50f6cdc55 'C'
571 | |
571 | |
572 o | 1: 8fd0f7e49f53 'B'
572 o | 1: 8fd0f7e49f53 'B'
573 |/
573 |/
574 o 0: 9ae2ed22e576 'A'
574 o 0: 9ae2ed22e576 'A'
575
575
576
576
577 $ cd ..
577 $ cd ..
578
578
579 rebase subset with multiple head
579 rebase subset with multiple head
580
580
581 $ hg clone -q -u . ah ah4
581 $ hg clone -q -u . ah ah4
582 $ cd ah4
582 $ cd ah4
583 $ hg rebase -r '3::(7+5)' -d 1
583 $ hg rebase -r '3::(7+5)' -d 1
584 abort: cannot rebase changeset with children
584 abort: cannot rebase changeset with children
585 (use --keep to keep original changesets)
585 (see 'hg help evolution.instability')
586 [10]
586 [10]
587 $ hg rebase -r '3::(7+5)' -d 1 --keep
587 $ hg rebase -r '3::(7+5)' -d 1 --keep
588 rebasing 3:ffd453c31098 "D"
588 rebasing 3:ffd453c31098 "D"
589 rebasing 4:c01897464e7f "E"
589 rebasing 4:c01897464e7f "E"
590 rebasing 5:41bfcc75ed73 "F"
590 rebasing 5:41bfcc75ed73 "F"
591 rebasing 6:3d8a618087a7 "G"
591 rebasing 6:3d8a618087a7 "G"
592 rebasing 7:72434a4e60b0 "H"
592 rebasing 7:72434a4e60b0 "H"
593 $ hg tglog
593 $ hg tglog
594 o 13: 8fbd00952cbc 'H'
594 o 13: 8fbd00952cbc 'H'
595 |
595 |
596 o 12: 51d434a615ee 'G'
596 o 12: 51d434a615ee 'G'
597 |
597 |
598 | o 11: df23d8bda0b7 'F'
598 | o 11: df23d8bda0b7 'F'
599 | |
599 | |
600 | o 10: 47b7889448ff 'E'
600 | o 10: 47b7889448ff 'E'
601 |/
601 |/
602 o 9: a9c125634b0b 'D'
602 o 9: a9c125634b0b 'D'
603 |
603 |
604 | o 8: 479ddb54a924 'I'
604 | o 8: 479ddb54a924 'I'
605 | |
605 | |
606 | o 7: 72434a4e60b0 'H'
606 | o 7: 72434a4e60b0 'H'
607 | |
607 | |
608 | o 6: 3d8a618087a7 'G'
608 | o 6: 3d8a618087a7 'G'
609 | |
609 | |
610 | | o 5: 41bfcc75ed73 'F'
610 | | o 5: 41bfcc75ed73 'F'
611 | | |
611 | | |
612 | | o 4: c01897464e7f 'E'
612 | | o 4: c01897464e7f 'E'
613 | |/
613 | |/
614 | o 3: ffd453c31098 'D'
614 | o 3: ffd453c31098 'D'
615 | |
615 | |
616 | o 2: c9e50f6cdc55 'C'
616 | o 2: c9e50f6cdc55 'C'
617 | |
617 | |
618 o | 1: 8fd0f7e49f53 'B'
618 o | 1: 8fd0f7e49f53 'B'
619 |/
619 |/
620 o 0: 9ae2ed22e576 'A'
620 o 0: 9ae2ed22e576 'A'
621
621
622
622
623 $ cd ..
623 $ cd ..
624
624
625 More advanced tests
625 More advanced tests
626
626
627 rebase on ancestor with revset
627 rebase on ancestor with revset
628
628
629 $ hg clone -q -u . ah ah5
629 $ hg clone -q -u . ah ah5
630 $ cd ah5
630 $ cd ah5
631 $ hg rebase -r '6::' -d 2
631 $ hg rebase -r '6::' -d 2
632 rebasing 6:3d8a618087a7 "G"
632 rebasing 6:3d8a618087a7 "G"
633 rebasing 7:72434a4e60b0 "H"
633 rebasing 7:72434a4e60b0 "H"
634 rebasing 8:479ddb54a924 tip "I"
634 rebasing 8:479ddb54a924 tip "I"
635 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg
635 saved backup bundle to $TESTTMP/ah5/.hg/strip-backup/3d8a618087a7-b4f73f31-rebase.hg
636 $ hg tglog
636 $ hg tglog
637 o 8: fcb52e68a694 'I'
637 o 8: fcb52e68a694 'I'
638 |
638 |
639 o 7: 77bd65cd7600 'H'
639 o 7: 77bd65cd7600 'H'
640 |
640 |
641 o 6: 12d0e738fb18 'G'
641 o 6: 12d0e738fb18 'G'
642 |
642 |
643 | o 5: 41bfcc75ed73 'F'
643 | o 5: 41bfcc75ed73 'F'
644 | |
644 | |
645 | o 4: c01897464e7f 'E'
645 | o 4: c01897464e7f 'E'
646 | |
646 | |
647 | o 3: ffd453c31098 'D'
647 | o 3: ffd453c31098 'D'
648 |/
648 |/
649 o 2: c9e50f6cdc55 'C'
649 o 2: c9e50f6cdc55 'C'
650 |
650 |
651 | o 1: 8fd0f7e49f53 'B'
651 | o 1: 8fd0f7e49f53 'B'
652 |/
652 |/
653 o 0: 9ae2ed22e576 'A'
653 o 0: 9ae2ed22e576 'A'
654
654
655 $ cd ..
655 $ cd ..
656
656
657
657
658 rebase with multiple root.
658 rebase with multiple root.
659 We rebase E and G on B
659 We rebase E and G on B
660 We would expect heads are I, F if it was supported
660 We would expect heads are I, F if it was supported
661
661
662 $ hg clone -q -u . ah ah6
662 $ hg clone -q -u . ah ah6
663 $ cd ah6
663 $ cd ah6
664 $ hg rebase -r '(4+6)::' -d 1
664 $ hg rebase -r '(4+6)::' -d 1
665 rebasing 4:c01897464e7f "E"
665 rebasing 4:c01897464e7f "E"
666 rebasing 5:41bfcc75ed73 "F"
666 rebasing 5:41bfcc75ed73 "F"
667 rebasing 6:3d8a618087a7 "G"
667 rebasing 6:3d8a618087a7 "G"
668 rebasing 7:72434a4e60b0 "H"
668 rebasing 7:72434a4e60b0 "H"
669 rebasing 8:479ddb54a924 tip "I"
669 rebasing 8:479ddb54a924 tip "I"
670 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg
670 saved backup bundle to $TESTTMP/ah6/.hg/strip-backup/3d8a618087a7-aae93a24-rebase.hg
671 $ hg tglog
671 $ hg tglog
672 o 8: 9136df9a87cf 'I'
672 o 8: 9136df9a87cf 'I'
673 |
673 |
674 o 7: 23e8f30da832 'H'
674 o 7: 23e8f30da832 'H'
675 |
675 |
676 o 6: b0efe8534e8b 'G'
676 o 6: b0efe8534e8b 'G'
677 |
677 |
678 | o 5: 6eb5b496ab79 'F'
678 | o 5: 6eb5b496ab79 'F'
679 | |
679 | |
680 | o 4: d15eade9b0b1 'E'
680 | o 4: d15eade9b0b1 'E'
681 |/
681 |/
682 | o 3: ffd453c31098 'D'
682 | o 3: ffd453c31098 'D'
683 | |
683 | |
684 | o 2: c9e50f6cdc55 'C'
684 | o 2: c9e50f6cdc55 'C'
685 | |
685 | |
686 o | 1: 8fd0f7e49f53 'B'
686 o | 1: 8fd0f7e49f53 'B'
687 |/
687 |/
688 o 0: 9ae2ed22e576 'A'
688 o 0: 9ae2ed22e576 'A'
689
689
690 $ cd ..
690 $ cd ..
691
691
692 More complex rebase with multiple roots
692 More complex rebase with multiple roots
693 each root have a different common ancestor with the destination and this is a detach
693 each root have a different common ancestor with the destination and this is a detach
694
694
695 (setup)
695 (setup)
696
696
697 $ hg clone -q -u . a a8
697 $ hg clone -q -u . a a8
698 $ cd a8
698 $ cd a8
699 $ echo I > I
699 $ echo I > I
700 $ hg add I
700 $ hg add I
701 $ hg commit -m I
701 $ hg commit -m I
702 $ hg up 4
702 $ hg up 4
703 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
703 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
704 $ echo I > J
704 $ echo I > J
705 $ hg add J
705 $ hg add J
706 $ hg commit -m J
706 $ hg commit -m J
707 created new head
707 created new head
708 $ echo I > K
708 $ echo I > K
709 $ hg add K
709 $ hg add K
710 $ hg commit -m K
710 $ hg commit -m K
711 $ hg tglog
711 $ hg tglog
712 @ 10: 23a4ace37988 'K'
712 @ 10: 23a4ace37988 'K'
713 |
713 |
714 o 9: 1301922eeb0c 'J'
714 o 9: 1301922eeb0c 'J'
715 |
715 |
716 | o 8: e7ec4e813ba6 'I'
716 | o 8: e7ec4e813ba6 'I'
717 | |
717 | |
718 | o 7: 02de42196ebe 'H'
718 | o 7: 02de42196ebe 'H'
719 | |
719 | |
720 +---o 6: eea13746799a 'G'
720 +---o 6: eea13746799a 'G'
721 | |/
721 | |/
722 | o 5: 24b6387c8c8c 'F'
722 | o 5: 24b6387c8c8c 'F'
723 | |
723 | |
724 o | 4: 9520eea781bc 'E'
724 o | 4: 9520eea781bc 'E'
725 |/
725 |/
726 | o 3: 32af7686d403 'D'
726 | o 3: 32af7686d403 'D'
727 | |
727 | |
728 | o 2: 5fddd98957c8 'C'
728 | o 2: 5fddd98957c8 'C'
729 | |
729 | |
730 | o 1: 42ccdea3bb16 'B'
730 | o 1: 42ccdea3bb16 'B'
731 |/
731 |/
732 o 0: cd010b8cd998 'A'
732 o 0: cd010b8cd998 'A'
733
733
734 (actual test)
734 (actual test)
735
735
736 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
736 $ hg rebase --dest 'desc(G)' --rev 'desc(K) + desc(I)'
737 rebasing 8:e7ec4e813ba6 "I"
737 rebasing 8:e7ec4e813ba6 "I"
738 rebasing 10:23a4ace37988 tip "K"
738 rebasing 10:23a4ace37988 tip "K"
739 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg
739 saved backup bundle to $TESTTMP/a8/.hg/strip-backup/23a4ace37988-b06984b3-rebase.hg
740 $ hg log --rev 'children(desc(G))'
740 $ hg log --rev 'children(desc(G))'
741 changeset: 9:adb617877056
741 changeset: 9:adb617877056
742 parent: 6:eea13746799a
742 parent: 6:eea13746799a
743 user: test
743 user: test
744 date: Thu Jan 01 00:00:00 1970 +0000
744 date: Thu Jan 01 00:00:00 1970 +0000
745 summary: I
745 summary: I
746
746
747 changeset: 10:882431a34a0e
747 changeset: 10:882431a34a0e
748 tag: tip
748 tag: tip
749 parent: 6:eea13746799a
749 parent: 6:eea13746799a
750 user: test
750 user: test
751 date: Thu Jan 01 00:00:00 1970 +0000
751 date: Thu Jan 01 00:00:00 1970 +0000
752 summary: K
752 summary: K
753
753
754 $ hg tglog
754 $ hg tglog
755 @ 10: 882431a34a0e 'K'
755 @ 10: 882431a34a0e 'K'
756 |
756 |
757 | o 9: adb617877056 'I'
757 | o 9: adb617877056 'I'
758 |/
758 |/
759 | o 8: 1301922eeb0c 'J'
759 | o 8: 1301922eeb0c 'J'
760 | |
760 | |
761 | | o 7: 02de42196ebe 'H'
761 | | o 7: 02de42196ebe 'H'
762 | | |
762 | | |
763 o---+ 6: eea13746799a 'G'
763 o---+ 6: eea13746799a 'G'
764 |/ /
764 |/ /
765 | o 5: 24b6387c8c8c 'F'
765 | o 5: 24b6387c8c8c 'F'
766 | |
766 | |
767 o | 4: 9520eea781bc 'E'
767 o | 4: 9520eea781bc 'E'
768 |/
768 |/
769 | o 3: 32af7686d403 'D'
769 | o 3: 32af7686d403 'D'
770 | |
770 | |
771 | o 2: 5fddd98957c8 'C'
771 | o 2: 5fddd98957c8 'C'
772 | |
772 | |
773 | o 1: 42ccdea3bb16 'B'
773 | o 1: 42ccdea3bb16 'B'
774 |/
774 |/
775 o 0: cd010b8cd998 'A'
775 o 0: cd010b8cd998 'A'
776
776
777
777
778 Test that rebase is not confused by $CWD disappearing during rebase (issue4121)
778 Test that rebase is not confused by $CWD disappearing during rebase (issue4121)
779
779
780 $ cd ..
780 $ cd ..
781 $ hg init cwd-vanish
781 $ hg init cwd-vanish
782 $ cd cwd-vanish
782 $ cd cwd-vanish
783 $ touch initial-file
783 $ touch initial-file
784 $ hg add initial-file
784 $ hg add initial-file
785 $ hg commit -m 'initial commit'
785 $ hg commit -m 'initial commit'
786 $ touch dest-file
786 $ touch dest-file
787 $ hg add dest-file
787 $ hg add dest-file
788 $ hg commit -m 'dest commit'
788 $ hg commit -m 'dest commit'
789 $ hg up 0
789 $ hg up 0
790 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
790 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
791 $ touch other-file
791 $ touch other-file
792 $ hg add other-file
792 $ hg add other-file
793 $ hg commit -m 'first source commit'
793 $ hg commit -m 'first source commit'
794 created new head
794 created new head
795 $ mkdir subdir
795 $ mkdir subdir
796 $ cd subdir
796 $ cd subdir
797 $ touch subfile
797 $ touch subfile
798 $ hg add subfile
798 $ hg add subfile
799 $ hg commit -m 'second source with subdir'
799 $ hg commit -m 'second source with subdir'
800
800
801 $ hg rebase -b . -d 1 --traceback
801 $ hg rebase -b . -d 1 --traceback
802 rebasing 2:779a07b1b7a0 "first source commit"
802 rebasing 2:779a07b1b7a0 "first source commit"
803 current directory was removed (rmcwd !)
803 current directory was removed (rmcwd !)
804 (consider changing to repo root: $TESTTMP/cwd-vanish) (rmcwd !)
804 (consider changing to repo root: $TESTTMP/cwd-vanish) (rmcwd !)
805 rebasing 3:a7d6f3a00bf3 tip "second source with subdir"
805 rebasing 3:a7d6f3a00bf3 tip "second source with subdir"
806 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg
806 saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-rebase.hg
807
807
808 Get back to the root of cwd-vanish. Note that even though `cd ..`
808 Get back to the root of cwd-vanish. Note that even though `cd ..`
809 works on most systems, it does not work on FreeBSD 10, so we use an
809 works on most systems, it does not work on FreeBSD 10, so we use an
810 absolute path to get back to the repository.
810 absolute path to get back to the repository.
811 $ cd $TESTTMP
811 $ cd $TESTTMP
812
812
813 Test that rebase is done in topo order (issue5370)
813 Test that rebase is done in topo order (issue5370)
814
814
815 $ hg init order
815 $ hg init order
816 $ cd order
816 $ cd order
817 $ touch a && hg add a && hg ci -m A
817 $ touch a && hg add a && hg ci -m A
818 $ touch b && hg add b && hg ci -m B
818 $ touch b && hg add b && hg ci -m B
819 $ touch c && hg add c && hg ci -m C
819 $ touch c && hg add c && hg ci -m C
820 $ hg up 1
820 $ hg up 1
821 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
821 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
822 $ touch d && hg add d && hg ci -m D
822 $ touch d && hg add d && hg ci -m D
823 created new head
823 created new head
824 $ hg up 2
824 $ hg up 2
825 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
825 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
826 $ touch e && hg add e && hg ci -m E
826 $ touch e && hg add e && hg ci -m E
827 $ hg up 3
827 $ hg up 3
828 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
828 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
829 $ touch f && hg add f && hg ci -m F
829 $ touch f && hg add f && hg ci -m F
830 $ hg up 0
830 $ hg up 0
831 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
831 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
832 $ touch g && hg add g && hg ci -m G
832 $ touch g && hg add g && hg ci -m G
833 created new head
833 created new head
834
834
835 $ hg tglog
835 $ hg tglog
836 @ 6: 124bb27b6f28 'G'
836 @ 6: 124bb27b6f28 'G'
837 |
837 |
838 | o 5: 412b391de760 'F'
838 | o 5: 412b391de760 'F'
839 | |
839 | |
840 | | o 4: 82ae8dc7a9b7 'E'
840 | | o 4: 82ae8dc7a9b7 'E'
841 | | |
841 | | |
842 | o | 3: ab709c9f7171 'D'
842 | o | 3: ab709c9f7171 'D'
843 | | |
843 | | |
844 | | o 2: d84f5cfaaf14 'C'
844 | | o 2: d84f5cfaaf14 'C'
845 | |/
845 | |/
846 | o 1: 76035bbd54bd 'B'
846 | o 1: 76035bbd54bd 'B'
847 |/
847 |/
848 o 0: 216878401574 'A'
848 o 0: 216878401574 'A'
849
849
850
850
851 $ hg rebase -s 1 -d 6
851 $ hg rebase -s 1 -d 6
852 rebasing 1:76035bbd54bd "B"
852 rebasing 1:76035bbd54bd "B"
853 rebasing 2:d84f5cfaaf14 "C"
853 rebasing 2:d84f5cfaaf14 "C"
854 rebasing 4:82ae8dc7a9b7 "E"
854 rebasing 4:82ae8dc7a9b7 "E"
855 rebasing 3:ab709c9f7171 "D"
855 rebasing 3:ab709c9f7171 "D"
856 rebasing 5:412b391de760 "F"
856 rebasing 5:412b391de760 "F"
857 saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg
857 saved backup bundle to $TESTTMP/order/.hg/strip-backup/76035bbd54bd-e341bc99-rebase.hg
858
858
859 $ hg tglog
859 $ hg tglog
860 o 6: 31884cfb735e 'F'
860 o 6: 31884cfb735e 'F'
861 |
861 |
862 o 5: 6d89fa5b0909 'D'
862 o 5: 6d89fa5b0909 'D'
863 |
863 |
864 | o 4: de64d97c697b 'E'
864 | o 4: de64d97c697b 'E'
865 | |
865 | |
866 | o 3: b18e4d2d0aa1 'C'
866 | o 3: b18e4d2d0aa1 'C'
867 |/
867 |/
868 o 2: 0983daf9ff6a 'B'
868 o 2: 0983daf9ff6a 'B'
869 |
869 |
870 @ 1: 124bb27b6f28 'G'
870 @ 1: 124bb27b6f28 'G'
871 |
871 |
872 o 0: 216878401574 'A'
872 o 0: 216878401574 'A'
873
873
874
874
875 Test experimental revset
875 Test experimental revset
876 ========================
876 ========================
877
877
878 $ cd ../cwd-vanish
878 $ cd ../cwd-vanish
879
879
880 Make the repo a bit more interesting
880 Make the repo a bit more interesting
881
881
882 $ hg up 1
882 $ hg up 1
883 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
883 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
884 $ echo aaa > aaa
884 $ echo aaa > aaa
885 $ hg add aaa
885 $ hg add aaa
886 $ hg commit -m aaa
886 $ hg commit -m aaa
887 created new head
887 created new head
888 $ hg log -G
888 $ hg log -G
889 @ changeset: 4:5f7bc9025ed2
889 @ changeset: 4:5f7bc9025ed2
890 | tag: tip
890 | tag: tip
891 | parent: 1:58d79cc1cf43
891 | parent: 1:58d79cc1cf43
892 | user: test
892 | user: test
893 | date: Thu Jan 01 00:00:00 1970 +0000
893 | date: Thu Jan 01 00:00:00 1970 +0000
894 | summary: aaa
894 | summary: aaa
895 |
895 |
896 | o changeset: 3:1910d5ff34ea
896 | o changeset: 3:1910d5ff34ea
897 | | user: test
897 | | user: test
898 | | date: Thu Jan 01 00:00:00 1970 +0000
898 | | date: Thu Jan 01 00:00:00 1970 +0000
899 | | summary: second source with subdir
899 | | summary: second source with subdir
900 | |
900 | |
901 | o changeset: 2:82901330b6ef
901 | o changeset: 2:82901330b6ef
902 |/ user: test
902 |/ user: test
903 | date: Thu Jan 01 00:00:00 1970 +0000
903 | date: Thu Jan 01 00:00:00 1970 +0000
904 | summary: first source commit
904 | summary: first source commit
905 |
905 |
906 o changeset: 1:58d79cc1cf43
906 o changeset: 1:58d79cc1cf43
907 | user: test
907 | user: test
908 | date: Thu Jan 01 00:00:00 1970 +0000
908 | date: Thu Jan 01 00:00:00 1970 +0000
909 | summary: dest commit
909 | summary: dest commit
910 |
910 |
911 o changeset: 0:e94b687f7da3
911 o changeset: 0:e94b687f7da3
912 user: test
912 user: test
913 date: Thu Jan 01 00:00:00 1970 +0000
913 date: Thu Jan 01 00:00:00 1970 +0000
914 summary: initial commit
914 summary: initial commit
915
915
916
916
917 Testing from lower head
917 Testing from lower head
918
918
919 $ hg up 3
919 $ hg up 3
920 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
920 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
921 $ hg log -r '_destrebase()'
921 $ hg log -r '_destrebase()'
922 changeset: 4:5f7bc9025ed2
922 changeset: 4:5f7bc9025ed2
923 tag: tip
923 tag: tip
924 parent: 1:58d79cc1cf43
924 parent: 1:58d79cc1cf43
925 user: test
925 user: test
926 date: Thu Jan 01 00:00:00 1970 +0000
926 date: Thu Jan 01 00:00:00 1970 +0000
927 summary: aaa
927 summary: aaa
928
928
929
929
930 Testing from upper head
930 Testing from upper head
931
931
932 $ hg log -r '_destrebase(4)'
932 $ hg log -r '_destrebase(4)'
933 changeset: 3:1910d5ff34ea
933 changeset: 3:1910d5ff34ea
934 user: test
934 user: test
935 date: Thu Jan 01 00:00:00 1970 +0000
935 date: Thu Jan 01 00:00:00 1970 +0000
936 summary: second source with subdir
936 summary: second source with subdir
937
937
938 $ hg up 4
938 $ hg up 4
939 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
939 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
940 $ hg log -r '_destrebase()'
940 $ hg log -r '_destrebase()'
941 changeset: 3:1910d5ff34ea
941 changeset: 3:1910d5ff34ea
942 user: test
942 user: test
943 date: Thu Jan 01 00:00:00 1970 +0000
943 date: Thu Jan 01 00:00:00 1970 +0000
944 summary: second source with subdir
944 summary: second source with subdir
945
945
946 Testing rebase being called inside another transaction
946 Testing rebase being called inside another transaction
947
947
948 $ cd $TESTTMP
948 $ cd $TESTTMP
949 $ hg init tr-state
949 $ hg init tr-state
950 $ cd tr-state
950 $ cd tr-state
951 $ cat > $TESTTMP/wraprebase.py <<EOF
951 $ cat > $TESTTMP/wraprebase.py <<EOF
952 > from __future__ import absolute_import
952 > from __future__ import absolute_import
953 > from mercurial import extensions
953 > from mercurial import extensions
954 > def _rebase(orig, ui, repo, *args, **kwargs):
954 > def _rebase(orig, ui, repo, *args, **kwargs):
955 > with repo.wlock():
955 > with repo.wlock():
956 > with repo.lock():
956 > with repo.lock():
957 > with repo.transaction(b'wrappedrebase'):
957 > with repo.transaction(b'wrappedrebase'):
958 > return orig(ui, repo, *args, **kwargs)
958 > return orig(ui, repo, *args, **kwargs)
959 > def wraprebase(loaded):
959 > def wraprebase(loaded):
960 > assert loaded
960 > assert loaded
961 > rebasemod = extensions.find(b'rebase')
961 > rebasemod = extensions.find(b'rebase')
962 > extensions.wrapcommand(rebasemod.cmdtable, b'rebase', _rebase)
962 > extensions.wrapcommand(rebasemod.cmdtable, b'rebase', _rebase)
963 > def extsetup(ui):
963 > def extsetup(ui):
964 > extensions.afterloaded(b'rebase', wraprebase)
964 > extensions.afterloaded(b'rebase', wraprebase)
965 > EOF
965 > EOF
966
966
967 $ cat >> .hg/hgrc <<EOF
967 $ cat >> .hg/hgrc <<EOF
968 > [extensions]
968 > [extensions]
969 > wraprebase=$TESTTMP/wraprebase.py
969 > wraprebase=$TESTTMP/wraprebase.py
970 > [experimental]
970 > [experimental]
971 > evolution=true
971 > evolution=true
972 > EOF
972 > EOF
973
973
974 $ hg debugdrawdag <<'EOS'
974 $ hg debugdrawdag <<'EOS'
975 > B C
975 > B C
976 > |/
976 > |/
977 > A
977 > A
978 > EOS
978 > EOS
979
979
980 $ hg rebase -s C -d B
980 $ hg rebase -s C -d B
981 rebasing 2:dc0947a82db8 C tip "C"
981 rebasing 2:dc0947a82db8 C tip "C"
982
982
983 $ [ -f .hg/rebasestate ] && echo 'WRONG: rebasestate should not exist'
983 $ [ -f .hg/rebasestate ] && echo 'WRONG: rebasestate should not exist'
984 [1]
984 [1]
@@ -1,1146 +1,1148 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 [10]
54 [10]
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 [10]
63 [10]
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 [10]
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 [10]
106 [10]
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 [250]
162 [250]
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 (see 'hg help evolution.instability')
470 [10]
471 [10]
471 #else
472 #else
472 $ runsplit -r 1 --no-rebase >/dev/null
473 $ runsplit -r 1 --no-rebase >/dev/null
473 3 new orphan changesets
474 3 new orphan changesets
474 $ hg bookmark
475 $ hg bookmark
475 d1 2:b5c5ea414030
476 d1 2:b5c5ea414030
476 * d2 3:f4a0a8d004cc
477 * d2 3:f4a0a8d004cc
477 d3 4:777940761eba
478 d3 4:777940761eba
478 r1 0:a61bcde8c529
479 r1 0:a61bcde8c529
479 r2 7:00eebaf8d2e2
480 r2 7:00eebaf8d2e2
480
481
481 $ hg glog
482 $ hg glog
482 o 7:00eebaf8d2e2 split 3 r2
483 o 7:00eebaf8d2e2 split 3 r2
483 |
484 |
484 o 6:a09ad58faae3 split 2
485 o 6:a09ad58faae3 split 2
485 |
486 |
486 o 5:e704349bd21b split 1
487 o 5:e704349bd21b split 1
487 |
488 |
488 | * 4:777940761eba d3 d3
489 | * 4:777940761eba d3 d3
489 | |
490 | |
490 | @ 3:f4a0a8d004cc d2 d2
491 | @ 3:f4a0a8d004cc d2 d2
491 | |
492 | |
492 | * 2:b5c5ea414030 d1 d1
493 | * 2:b5c5ea414030 d1 d1
493 | |
494 | |
494 | x 1:1df0d5c5a3ab a2
495 | x 1:1df0d5c5a3ab a2
495 |/
496 |/
496 o 0:a61bcde8c529 a1 r1
497 o 0:a61bcde8c529 a1 r1
497
498
498 #endif
499 #endif
499
500
500 Split a non-head with obsoleted descendants
501 Split a non-head with obsoleted descendants
501
502
502 #if obsstore-on
503 #if obsstore-on
503 $ hg init $TESTTMP/e
504 $ hg init $TESTTMP/e
504 $ cd $TESTTMP/e
505 $ cd $TESTTMP/e
505 $ hg debugdrawdag <<'EOS'
506 $ hg debugdrawdag <<'EOS'
506 > H I J
507 > H I J
507 > | | |
508 > | | |
508 > F G1 G2 # amend: G1 -> G2
509 > F G1 G2 # amend: G1 -> G2
509 > | | / # prune: F
510 > | | / # prune: F
510 > C D E
511 > C D E
511 > \|/
512 > \|/
512 > B
513 > B
513 > |
514 > |
514 > A
515 > A
515 > EOS
516 > EOS
516 2 new orphan changesets
517 2 new orphan changesets
517 $ eval `hg tags -T '{tag}={node}\n'`
518 $ eval `hg tags -T '{tag}={node}\n'`
518 $ rm .hg/localtags
519 $ rm .hg/localtags
519 $ hg split $B --config experimental.evolution=createmarkers
520 $ hg split $B --config experimental.evolution=createmarkers
520 abort: cannot split changeset with children
521 abort: cannot split changeset with children
522 (see 'hg help evolution.instability')
521 [10]
523 [10]
522 $ cat > $TESTTMP/messages <<EOF
524 $ cat > $TESTTMP/messages <<EOF
523 > Split B
525 > Split B
524 > EOF
526 > EOF
525 $ cat <<EOF | hg split $B
527 $ cat <<EOF | hg split $B
526 > y
528 > y
527 > y
529 > y
528 > EOF
530 > EOF
529 diff --git a/B b/B
531 diff --git a/B b/B
530 new file mode 100644
532 new file mode 100644
531 examine changes to 'B'?
533 examine changes to 'B'?
532 (enter ? for help) [Ynesfdaq?] y
534 (enter ? for help) [Ynesfdaq?] y
533
535
534 @@ -0,0 +1,1 @@
536 @@ -0,0 +1,1 @@
535 +B
537 +B
536 \ No newline at end of file
538 \ No newline at end of file
537 record this change to 'B'?
539 record this change to 'B'?
538 (enter ? for help) [Ynesfdaq?] y
540 (enter ? for help) [Ynesfdaq?] y
539
541
540 EDITOR: HG: Splitting 112478962961. Write commit message for the first split changeset.
542 EDITOR: HG: Splitting 112478962961. Write commit message for the first split changeset.
541 EDITOR: B
543 EDITOR: B
542 EDITOR:
544 EDITOR:
543 EDITOR:
545 EDITOR:
544 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
546 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
545 EDITOR: HG: Leave message empty to abort commit.
547 EDITOR: HG: Leave message empty to abort commit.
546 EDITOR: HG: --
548 EDITOR: HG: --
547 EDITOR: HG: user: test
549 EDITOR: HG: user: test
548 EDITOR: HG: branch 'default'
550 EDITOR: HG: branch 'default'
549 EDITOR: HG: added B
551 EDITOR: HG: added B
550 created new head
552 created new head
551 rebasing 2:26805aba1e60 "C"
553 rebasing 2:26805aba1e60 "C"
552 rebasing 3:be0ef73c17ad "D"
554 rebasing 3:be0ef73c17ad "D"
553 rebasing 4:49cb92066bfd "E"
555 rebasing 4:49cb92066bfd "E"
554 rebasing 7:97a6268cc7ef "G2"
556 rebasing 7:97a6268cc7ef "G2"
555 rebasing 10:e2f1e425c0db "J"
557 rebasing 10:e2f1e425c0db "J"
556 $ hg glog -r 'sort(all(), topo)'
558 $ hg glog -r 'sort(all(), topo)'
557 o 16:556c085f8b52 J
559 o 16:556c085f8b52 J
558 |
560 |
559 o 15:8761f6c9123f G2
561 o 15:8761f6c9123f G2
560 |
562 |
561 o 14:a7aeffe59b65 E
563 o 14:a7aeffe59b65 E
562 |
564 |
563 | o 13:e1e914ede9ab D
565 | o 13:e1e914ede9ab D
564 |/
566 |/
565 | o 12:01947e9b98aa C
567 | o 12:01947e9b98aa C
566 |/
568 |/
567 o 11:0947baa74d47 Split B
569 o 11:0947baa74d47 Split B
568 |
570 |
569 | * 9:88ede1d5ee13 I
571 | * 9:88ede1d5ee13 I
570 | |
572 | |
571 | x 6:af8cbf225b7b G1
573 | x 6:af8cbf225b7b G1
572 | |
574 | |
573 | x 3:be0ef73c17ad D
575 | x 3:be0ef73c17ad D
574 | |
576 | |
575 | | * 8:74863e5b5074 H
577 | | * 8:74863e5b5074 H
576 | | |
578 | | |
577 | | x 5:ee481a2a1e69 F
579 | | x 5:ee481a2a1e69 F
578 | | |
580 | | |
579 | | x 2:26805aba1e60 C
581 | | x 2:26805aba1e60 C
580 | |/
582 | |/
581 | x 1:112478962961 B
583 | x 1:112478962961 B
582 |/
584 |/
583 o 0:426bada5c675 A
585 o 0:426bada5c675 A
584
586
585 #endif
587 #endif
586
588
587 Preserve secret phase in split
589 Preserve secret phase in split
588
590
589 $ cp -R $TESTTMP/clean $TESTTMP/phases1
591 $ cp -R $TESTTMP/clean $TESTTMP/phases1
590 $ cd $TESTTMP/phases1
592 $ cd $TESTTMP/phases1
591 $ hg phase --secret -fr tip
593 $ hg phase --secret -fr tip
592 $ hg log -T '{short(node)} {phase}\n'
594 $ hg log -T '{short(node)} {phase}\n'
593 1df0d5c5a3ab secret
595 1df0d5c5a3ab secret
594 a61bcde8c529 draft
596 a61bcde8c529 draft
595 $ runsplit tip >/dev/null
597 $ runsplit tip >/dev/null
596 $ hg log -T '{short(node)} {phase}\n'
598 $ hg log -T '{short(node)} {phase}\n'
597 00eebaf8d2e2 secret
599 00eebaf8d2e2 secret
598 a09ad58faae3 secret
600 a09ad58faae3 secret
599 e704349bd21b secret
601 e704349bd21b secret
600 a61bcde8c529 draft
602 a61bcde8c529 draft
601
603
602 Do not move things to secret even if phases.new-commit=secret
604 Do not move things to secret even if phases.new-commit=secret
603
605
604 $ cp -R $TESTTMP/clean $TESTTMP/phases2
606 $ cp -R $TESTTMP/clean $TESTTMP/phases2
605 $ cd $TESTTMP/phases2
607 $ cd $TESTTMP/phases2
606 $ cat >> .hg/hgrc <<EOF
608 $ cat >> .hg/hgrc <<EOF
607 > [phases]
609 > [phases]
608 > new-commit=secret
610 > new-commit=secret
609 > EOF
611 > EOF
610 $ hg log -T '{short(node)} {phase}\n'
612 $ hg log -T '{short(node)} {phase}\n'
611 1df0d5c5a3ab draft
613 1df0d5c5a3ab draft
612 a61bcde8c529 draft
614 a61bcde8c529 draft
613 $ runsplit tip >/dev/null
615 $ runsplit tip >/dev/null
614 $ hg log -T '{short(node)} {phase}\n'
616 $ hg log -T '{short(node)} {phase}\n'
615 00eebaf8d2e2 draft
617 00eebaf8d2e2 draft
616 a09ad58faae3 draft
618 a09ad58faae3 draft
617 e704349bd21b draft
619 e704349bd21b draft
618 a61bcde8c529 draft
620 a61bcde8c529 draft
619
621
620 `hg split` with ignoreblanklines=1 does not infinite loop
622 `hg split` with ignoreblanklines=1 does not infinite loop
621
623
622 $ mkdir $TESTTMP/f
624 $ mkdir $TESTTMP/f
623 $ hg init $TESTTMP/f/a
625 $ hg init $TESTTMP/f/a
624 $ cd $TESTTMP/f/a
626 $ cd $TESTTMP/f/a
625 $ printf '1\n2\n3\n4\n5\n' > foo
627 $ printf '1\n2\n3\n4\n5\n' > foo
626 $ cp foo bar
628 $ cp foo bar
627 $ hg ci -qAm initial
629 $ hg ci -qAm initial
628 $ printf '1\n\n2\n3\ntest\n4\n5\n' > bar
630 $ printf '1\n\n2\n3\ntest\n4\n5\n' > bar
629 $ printf '1\n2\n3\ntest\n4\n5\n' > foo
631 $ printf '1\n2\n3\ntest\n4\n5\n' > foo
630 $ hg ci -qm splitme
632 $ hg ci -qm splitme
631 $ cat > $TESTTMP/messages <<EOF
633 $ cat > $TESTTMP/messages <<EOF
632 > split 1
634 > split 1
633 > --
635 > --
634 > split 2
636 > split 2
635 > EOF
637 > EOF
636 $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split
638 $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split
637 diff --git a/bar b/bar
639 diff --git a/bar b/bar
638 2 hunks, 2 lines changed
640 2 hunks, 2 lines changed
639 examine changes to 'bar'?
641 examine changes to 'bar'?
640 (enter ? for help) [Ynesfdaq?] f
642 (enter ? for help) [Ynesfdaq?] f
641
643
642 diff --git a/foo b/foo
644 diff --git a/foo b/foo
643 1 hunks, 1 lines changed
645 1 hunks, 1 lines changed
644 examine changes to 'foo'?
646 examine changes to 'foo'?
645 (enter ? for help) [Ynesfdaq?] n
647 (enter ? for help) [Ynesfdaq?] n
646
648
647 EDITOR: HG: Splitting dd3c45017cbf. Write commit message for the first split changeset.
649 EDITOR: HG: Splitting dd3c45017cbf. Write commit message for the first split changeset.
648 EDITOR: splitme
650 EDITOR: splitme
649 EDITOR:
651 EDITOR:
650 EDITOR:
652 EDITOR:
651 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
653 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
652 EDITOR: HG: Leave message empty to abort commit.
654 EDITOR: HG: Leave message empty to abort commit.
653 EDITOR: HG: --
655 EDITOR: HG: --
654 EDITOR: HG: user: test
656 EDITOR: HG: user: test
655 EDITOR: HG: branch 'default'
657 EDITOR: HG: branch 'default'
656 EDITOR: HG: changed bar
658 EDITOR: HG: changed bar
657 created new head
659 created new head
658 diff --git a/foo b/foo
660 diff --git a/foo b/foo
659 1 hunks, 1 lines changed
661 1 hunks, 1 lines changed
660 examine changes to 'foo'?
662 examine changes to 'foo'?
661 (enter ? for help) [Ynesfdaq?] f
663 (enter ? for help) [Ynesfdaq?] f
662
664
663 EDITOR: HG: Splitting dd3c45017cbf. So far it has been split into:
665 EDITOR: HG: Splitting dd3c45017cbf. So far it has been split into:
664 EDITOR: HG: - 2:f205aea1c624 tip "split 1"
666 EDITOR: HG: - 2:f205aea1c624 tip "split 1"
665 EDITOR: HG: Write commit message for the next split changeset.
667 EDITOR: HG: Write commit message for the next split changeset.
666 EDITOR: splitme
668 EDITOR: splitme
667 EDITOR:
669 EDITOR:
668 EDITOR:
670 EDITOR:
669 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
671 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
670 EDITOR: HG: Leave message empty to abort commit.
672 EDITOR: HG: Leave message empty to abort commit.
671 EDITOR: HG: --
673 EDITOR: HG: --
672 EDITOR: HG: user: test
674 EDITOR: HG: user: test
673 EDITOR: HG: branch 'default'
675 EDITOR: HG: branch 'default'
674 EDITOR: HG: changed foo
676 EDITOR: HG: changed foo
675 saved backup bundle to $TESTTMP/f/a/.hg/strip-backup/dd3c45017cbf-463441b5-split.hg (obsstore-off !)
677 saved backup bundle to $TESTTMP/f/a/.hg/strip-backup/dd3c45017cbf-463441b5-split.hg (obsstore-off !)
676
678
677 Let's try that again, with a slightly different set of patches, to ensure that
679 Let's try that again, with a slightly different set of patches, to ensure that
678 the ignoreblanklines thing isn't somehow position dependent.
680 the ignoreblanklines thing isn't somehow position dependent.
679
681
680 $ hg init $TESTTMP/f/b
682 $ hg init $TESTTMP/f/b
681 $ cd $TESTTMP/f/b
683 $ cd $TESTTMP/f/b
682 $ printf '1\n2\n3\n4\n5\n' > foo
684 $ printf '1\n2\n3\n4\n5\n' > foo
683 $ cp foo bar
685 $ cp foo bar
684 $ hg ci -qAm initial
686 $ hg ci -qAm initial
685 $ printf '1\n2\n3\ntest\n4\n5\n' > bar
687 $ printf '1\n2\n3\ntest\n4\n5\n' > bar
686 $ printf '1\n2\n3\ntest\n4\n\n5\n' > foo
688 $ printf '1\n2\n3\ntest\n4\n\n5\n' > foo
687 $ hg ci -qm splitme
689 $ hg ci -qm splitme
688 $ cat > $TESTTMP/messages <<EOF
690 $ cat > $TESTTMP/messages <<EOF
689 > split 1
691 > split 1
690 > --
692 > --
691 > split 2
693 > split 2
692 > EOF
694 > EOF
693 $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split
695 $ printf 'f\nn\nf\n' | hg --config extensions.split= --config diff.ignoreblanklines=1 split
694 diff --git a/bar b/bar
696 diff --git a/bar b/bar
695 1 hunks, 1 lines changed
697 1 hunks, 1 lines changed
696 examine changes to 'bar'?
698 examine changes to 'bar'?
697 (enter ? for help) [Ynesfdaq?] f
699 (enter ? for help) [Ynesfdaq?] f
698
700
699 diff --git a/foo b/foo
701 diff --git a/foo b/foo
700 2 hunks, 2 lines changed
702 2 hunks, 2 lines changed
701 examine changes to 'foo'?
703 examine changes to 'foo'?
702 (enter ? for help) [Ynesfdaq?] n
704 (enter ? for help) [Ynesfdaq?] n
703
705
704 EDITOR: HG: Splitting 904c80b40a4a. Write commit message for the first split changeset.
706 EDITOR: HG: Splitting 904c80b40a4a. Write commit message for the first split changeset.
705 EDITOR: splitme
707 EDITOR: splitme
706 EDITOR:
708 EDITOR:
707 EDITOR:
709 EDITOR:
708 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
710 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
709 EDITOR: HG: Leave message empty to abort commit.
711 EDITOR: HG: Leave message empty to abort commit.
710 EDITOR: HG: --
712 EDITOR: HG: --
711 EDITOR: HG: user: test
713 EDITOR: HG: user: test
712 EDITOR: HG: branch 'default'
714 EDITOR: HG: branch 'default'
713 EDITOR: HG: changed bar
715 EDITOR: HG: changed bar
714 created new head
716 created new head
715 diff --git a/foo b/foo
717 diff --git a/foo b/foo
716 2 hunks, 2 lines changed
718 2 hunks, 2 lines changed
717 examine changes to 'foo'?
719 examine changes to 'foo'?
718 (enter ? for help) [Ynesfdaq?] f
720 (enter ? for help) [Ynesfdaq?] f
719
721
720 EDITOR: HG: Splitting 904c80b40a4a. So far it has been split into:
722 EDITOR: HG: Splitting 904c80b40a4a. So far it has been split into:
721 EDITOR: HG: - 2:ffecf40fa954 tip "split 1"
723 EDITOR: HG: - 2:ffecf40fa954 tip "split 1"
722 EDITOR: HG: Write commit message for the next split changeset.
724 EDITOR: HG: Write commit message for the next split changeset.
723 EDITOR: splitme
725 EDITOR: splitme
724 EDITOR:
726 EDITOR:
725 EDITOR:
727 EDITOR:
726 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
728 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
727 EDITOR: HG: Leave message empty to abort commit.
729 EDITOR: HG: Leave message empty to abort commit.
728 EDITOR: HG: --
730 EDITOR: HG: --
729 EDITOR: HG: user: test
731 EDITOR: HG: user: test
730 EDITOR: HG: branch 'default'
732 EDITOR: HG: branch 'default'
731 EDITOR: HG: changed foo
733 EDITOR: HG: changed foo
732 saved backup bundle to $TESTTMP/f/b/.hg/strip-backup/904c80b40a4a-47fb907f-split.hg (obsstore-off !)
734 saved backup bundle to $TESTTMP/f/b/.hg/strip-backup/904c80b40a4a-47fb907f-split.hg (obsstore-off !)
733
735
734
736
735 Testing the case in split when commiting flag-only file changes (issue5864)
737 Testing the case in split when commiting flag-only file changes (issue5864)
736 ---------------------------------------------------------------------------
738 ---------------------------------------------------------------------------
737 $ hg init $TESTTMP/issue5864
739 $ hg init $TESTTMP/issue5864
738 $ cd $TESTTMP/issue5864
740 $ cd $TESTTMP/issue5864
739 $ echo foo > foo
741 $ echo foo > foo
740 $ hg add foo
742 $ hg add foo
741 $ hg ci -m "initial"
743 $ hg ci -m "initial"
742 $ hg import -q --bypass -m "make executable" - <<EOF
744 $ hg import -q --bypass -m "make executable" - <<EOF
743 > diff --git a/foo b/foo
745 > diff --git a/foo b/foo
744 > old mode 100644
746 > old mode 100644
745 > new mode 100755
747 > new mode 100755
746 > EOF
748 > EOF
747 $ hg up -q
749 $ hg up -q
748
750
749 $ hg glog
751 $ hg glog
750 @ 1:3a2125f0f4cb make executable
752 @ 1:3a2125f0f4cb make executable
751 |
753 |
752 o 0:51f273a58d82 initial
754 o 0:51f273a58d82 initial
753
755
754
756
755 #if no-windows
757 #if no-windows
756 $ cat > $TESTTMP/messages <<EOF
758 $ cat > $TESTTMP/messages <<EOF
757 > split 1
759 > split 1
758 > EOF
760 > EOF
759 $ printf 'y\n' | hg split
761 $ printf 'y\n' | hg split
760 diff --git a/foo b/foo
762 diff --git a/foo b/foo
761 old mode 100644
763 old mode 100644
762 new mode 100755
764 new mode 100755
763 examine changes to 'foo'?
765 examine changes to 'foo'?
764 (enter ? for help) [Ynesfdaq?] y
766 (enter ? for help) [Ynesfdaq?] y
765
767
766 EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split changeset.
768 EDITOR: HG: Splitting 3a2125f0f4cb. Write commit message for the first split changeset.
767 EDITOR: make executable
769 EDITOR: make executable
768 EDITOR:
770 EDITOR:
769 EDITOR:
771 EDITOR:
770 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
772 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
771 EDITOR: HG: Leave message empty to abort commit.
773 EDITOR: HG: Leave message empty to abort commit.
772 EDITOR: HG: --
774 EDITOR: HG: --
773 EDITOR: HG: user: test
775 EDITOR: HG: user: test
774 EDITOR: HG: branch 'default'
776 EDITOR: HG: branch 'default'
775 EDITOR: HG: changed foo
777 EDITOR: HG: changed foo
776 created new head
778 created new head
777 saved backup bundle to $TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg (obsstore-off !)
779 saved backup bundle to $TESTTMP/issue5864/.hg/strip-backup/3a2125f0f4cb-629e4432-split.hg (obsstore-off !)
778
780
779 $ hg log -G -T "{node|short} {desc}\n"
781 $ hg log -G -T "{node|short} {desc}\n"
780 @ b154670c87da split 1
782 @ b154670c87da split 1
781 |
783 |
782 o 51f273a58d82 initial
784 o 51f273a58d82 initial
783
785
784 #else
786 #else
785
787
786 TODO: Fix this on Windows. See issue 2020 and 5883
788 TODO: Fix this on Windows. See issue 2020 and 5883
787
789
788 $ printf 'y\ny\ny\n' | hg split
790 $ printf 'y\ny\ny\n' | hg split
789 abort: cannot split an empty revision
791 abort: cannot split an empty revision
790 [10]
792 [10]
791 #endif
793 #endif
792
794
793 Test that splitting moves works properly (issue5723)
795 Test that splitting moves works properly (issue5723)
794 ----------------------------------------------------
796 ----------------------------------------------------
795
797
796 $ hg init $TESTTMP/issue5723-mv
798 $ hg init $TESTTMP/issue5723-mv
797 $ cd $TESTTMP/issue5723-mv
799 $ cd $TESTTMP/issue5723-mv
798 $ printf '1\n2\n' > file
800 $ printf '1\n2\n' > file
799 $ hg ci -qAm initial
801 $ hg ci -qAm initial
800 $ hg mv file file2
802 $ hg mv file file2
801 $ printf 'a\nb\n1\n2\n3\n4\n' > file2
803 $ printf 'a\nb\n1\n2\n3\n4\n' > file2
802 $ cat > $TESTTMP/messages <<EOF
804 $ cat > $TESTTMP/messages <<EOF
803 > split1, keeping only the numbered lines
805 > split1, keeping only the numbered lines
804 > --
806 > --
805 > split2, keeping the lettered lines
807 > split2, keeping the lettered lines
806 > EOF
808 > EOF
807 $ hg ci -m 'move and modify'
809 $ hg ci -m 'move and modify'
808 $ printf 'y\nn\na\na\n' | hg split
810 $ printf 'y\nn\na\na\n' | hg split
809 diff --git a/file b/file2
811 diff --git a/file b/file2
810 rename from file
812 rename from file
811 rename to file2
813 rename to file2
812 2 hunks, 4 lines changed
814 2 hunks, 4 lines changed
813 examine changes to 'file' and 'file2'?
815 examine changes to 'file' and 'file2'?
814 (enter ? for help) [Ynesfdaq?] y
816 (enter ? for help) [Ynesfdaq?] y
815
817
816 @@ -0,0 +1,2 @@
818 @@ -0,0 +1,2 @@
817 +a
819 +a
818 +b
820 +b
819 record change 1/2 to 'file2'?
821 record change 1/2 to 'file2'?
820 (enter ? for help) [Ynesfdaq?] n
822 (enter ? for help) [Ynesfdaq?] n
821
823
822 @@ -2,0 +5,2 @@ 2
824 @@ -2,0 +5,2 @@ 2
823 +3
825 +3
824 +4
826 +4
825 record change 2/2 to 'file2'?
827 record change 2/2 to 'file2'?
826 (enter ? for help) [Ynesfdaq?] a
828 (enter ? for help) [Ynesfdaq?] a
827
829
828 EDITOR: HG: Splitting 8c42fa635116. Write commit message for the first split changeset.
830 EDITOR: HG: Splitting 8c42fa635116. Write commit message for the first split changeset.
829 EDITOR: move and modify
831 EDITOR: move and modify
830 EDITOR:
832 EDITOR:
831 EDITOR:
833 EDITOR:
832 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
834 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
833 EDITOR: HG: Leave message empty to abort commit.
835 EDITOR: HG: Leave message empty to abort commit.
834 EDITOR: HG: --
836 EDITOR: HG: --
835 EDITOR: HG: user: test
837 EDITOR: HG: user: test
836 EDITOR: HG: branch 'default'
838 EDITOR: HG: branch 'default'
837 EDITOR: HG: added file2
839 EDITOR: HG: added file2
838 EDITOR: HG: removed file
840 EDITOR: HG: removed file
839 created new head
841 created new head
840 diff --git a/file2 b/file2
842 diff --git a/file2 b/file2
841 1 hunks, 2 lines changed
843 1 hunks, 2 lines changed
842 examine changes to 'file2'?
844 examine changes to 'file2'?
843 (enter ? for help) [Ynesfdaq?] a
845 (enter ? for help) [Ynesfdaq?] a
844
846
845 EDITOR: HG: Splitting 8c42fa635116. So far it has been split into:
847 EDITOR: HG: Splitting 8c42fa635116. So far it has been split into:
846 EDITOR: HG: - 2:478be2a70c27 tip "split1, keeping only the numbered lines"
848 EDITOR: HG: - 2:478be2a70c27 tip "split1, keeping only the numbered lines"
847 EDITOR: HG: Write commit message for the next split changeset.
849 EDITOR: HG: Write commit message for the next split changeset.
848 EDITOR: move and modify
850 EDITOR: move and modify
849 EDITOR:
851 EDITOR:
850 EDITOR:
852 EDITOR:
851 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
853 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
852 EDITOR: HG: Leave message empty to abort commit.
854 EDITOR: HG: Leave message empty to abort commit.
853 EDITOR: HG: --
855 EDITOR: HG: --
854 EDITOR: HG: user: test
856 EDITOR: HG: user: test
855 EDITOR: HG: branch 'default'
857 EDITOR: HG: branch 'default'
856 EDITOR: HG: changed file2
858 EDITOR: HG: changed file2
857 saved backup bundle to $TESTTMP/issue5723-mv/.hg/strip-backup/8c42fa635116-a38044d4-split.hg (obsstore-off !)
859 saved backup bundle to $TESTTMP/issue5723-mv/.hg/strip-backup/8c42fa635116-a38044d4-split.hg (obsstore-off !)
858 $ hg log -T '{desc}: {files%"{file} "}\n'
860 $ hg log -T '{desc}: {files%"{file} "}\n'
859 split2, keeping the lettered lines: file2
861 split2, keeping the lettered lines: file2
860 split1, keeping only the numbered lines: file file2
862 split1, keeping only the numbered lines: file file2
861 initial: file
863 initial: file
862 $ cat file2
864 $ cat file2
863 a
865 a
864 b
866 b
865 1
867 1
866 2
868 2
867 3
869 3
868 4
870 4
869 $ hg cat -r ".^" file2
871 $ hg cat -r ".^" file2
870 1
872 1
871 2
873 2
872 3
874 3
873 4
875 4
874 $ hg cat -r . file2
876 $ hg cat -r . file2
875 a
877 a
876 b
878 b
877 1
879 1
878 2
880 2
879 3
881 3
880 4
882 4
881
883
882
884
883 Test that splitting copies works properly (issue5723)
885 Test that splitting copies works properly (issue5723)
884 ----------------------------------------------------
886 ----------------------------------------------------
885
887
886 $ hg init $TESTTMP/issue5723-cp
888 $ hg init $TESTTMP/issue5723-cp
887 $ cd $TESTTMP/issue5723-cp
889 $ cd $TESTTMP/issue5723-cp
888 $ printf '1\n2\n' > file
890 $ printf '1\n2\n' > file
889 $ hg ci -qAm initial
891 $ hg ci -qAm initial
890 $ hg cp file file2
892 $ hg cp file file2
891 $ printf 'a\nb\n1\n2\n3\n4\n' > file2
893 $ printf 'a\nb\n1\n2\n3\n4\n' > file2
892 Also modify 'file' to prove that the changes aren't being pulled in
894 Also modify 'file' to prove that the changes aren't being pulled in
893 accidentally.
895 accidentally.
894 $ printf 'this is the new contents of "file"' > file
896 $ printf 'this is the new contents of "file"' > file
895 $ cat > $TESTTMP/messages <<EOF
897 $ cat > $TESTTMP/messages <<EOF
896 > split1, keeping "file" and only the numbered lines in file2
898 > split1, keeping "file" and only the numbered lines in file2
897 > --
899 > --
898 > split2, keeping the lettered lines in file2
900 > split2, keeping the lettered lines in file2
899 > EOF
901 > EOF
900 $ hg ci -m 'copy file->file2, modify both'
902 $ hg ci -m 'copy file->file2, modify both'
901 $ printf 'f\ny\nn\na\na\n' | hg split
903 $ printf 'f\ny\nn\na\na\n' | hg split
902 diff --git a/file b/file
904 diff --git a/file b/file
903 1 hunks, 2 lines changed
905 1 hunks, 2 lines changed
904 examine changes to 'file'?
906 examine changes to 'file'?
905 (enter ? for help) [Ynesfdaq?] f
907 (enter ? for help) [Ynesfdaq?] f
906
908
907 diff --git a/file b/file2
909 diff --git a/file b/file2
908 copy from file
910 copy from file
909 copy to file2
911 copy to file2
910 2 hunks, 4 lines changed
912 2 hunks, 4 lines changed
911 examine changes to 'file' and 'file2'?
913 examine changes to 'file' and 'file2'?
912 (enter ? for help) [Ynesfdaq?] y
914 (enter ? for help) [Ynesfdaq?] y
913
915
914 @@ -0,0 +1,2 @@
916 @@ -0,0 +1,2 @@
915 +a
917 +a
916 +b
918 +b
917 record change 2/3 to 'file2'?
919 record change 2/3 to 'file2'?
918 (enter ? for help) [Ynesfdaq?] n
920 (enter ? for help) [Ynesfdaq?] n
919
921
920 @@ -2,0 +5,2 @@ 2
922 @@ -2,0 +5,2 @@ 2
921 +3
923 +3
922 +4
924 +4
923 record change 3/3 to 'file2'?
925 record change 3/3 to 'file2'?
924 (enter ? for help) [Ynesfdaq?] a
926 (enter ? for help) [Ynesfdaq?] a
925
927
926 EDITOR: HG: Splitting 41c861dfa61e. Write commit message for the first split changeset.
928 EDITOR: HG: Splitting 41c861dfa61e. Write commit message for the first split changeset.
927 EDITOR: copy file->file2, modify both
929 EDITOR: copy file->file2, modify both
928 EDITOR:
930 EDITOR:
929 EDITOR:
931 EDITOR:
930 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
932 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
931 EDITOR: HG: Leave message empty to abort commit.
933 EDITOR: HG: Leave message empty to abort commit.
932 EDITOR: HG: --
934 EDITOR: HG: --
933 EDITOR: HG: user: test
935 EDITOR: HG: user: test
934 EDITOR: HG: branch 'default'
936 EDITOR: HG: branch 'default'
935 EDITOR: HG: added file2
937 EDITOR: HG: added file2
936 EDITOR: HG: changed file
938 EDITOR: HG: changed file
937 created new head
939 created new head
938 diff --git a/file2 b/file2
940 diff --git a/file2 b/file2
939 1 hunks, 2 lines changed
941 1 hunks, 2 lines changed
940 examine changes to 'file2'?
942 examine changes to 'file2'?
941 (enter ? for help) [Ynesfdaq?] a
943 (enter ? for help) [Ynesfdaq?] a
942
944
943 EDITOR: HG: Splitting 41c861dfa61e. So far it has been split into:
945 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"
946 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.
947 EDITOR: HG: Write commit message for the next split changeset.
946 EDITOR: copy file->file2, modify both
948 EDITOR: copy file->file2, modify both
947 EDITOR:
949 EDITOR:
948 EDITOR:
950 EDITOR:
949 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
951 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
950 EDITOR: HG: Leave message empty to abort commit.
952 EDITOR: HG: Leave message empty to abort commit.
951 EDITOR: HG: --
953 EDITOR: HG: --
952 EDITOR: HG: user: test
954 EDITOR: HG: user: test
953 EDITOR: HG: branch 'default'
955 EDITOR: HG: branch 'default'
954 EDITOR: HG: changed file2
956 EDITOR: HG: changed file2
955 saved backup bundle to $TESTTMP/issue5723-cp/.hg/strip-backup/41c861dfa61e-467e8d3c-split.hg (obsstore-off !)
957 saved backup bundle to $TESTTMP/issue5723-cp/.hg/strip-backup/41c861dfa61e-467e8d3c-split.hg (obsstore-off !)
956 $ hg log -T '{desc}: {files%"{file} "}\n'
958 $ hg log -T '{desc}: {files%"{file} "}\n'
957 split2, keeping the lettered lines in file2: file2
959 split2, keeping the lettered lines in file2: file2
958 split1, keeping "file" and only the numbered lines in file2: file file2
960 split1, keeping "file" and only the numbered lines in file2: file file2
959 initial: file
961 initial: file
960 $ cat file2
962 $ cat file2
961 a
963 a
962 b
964 b
963 1
965 1
964 2
966 2
965 3
967 3
966 4
968 4
967 $ hg cat -r ".^" file2
969 $ hg cat -r ".^" file2
968 1
970 1
969 2
971 2
970 3
972 3
971 4
973 4
972 $ hg cat -r . file2
974 $ hg cat -r . file2
973 a
975 a
974 b
976 b
975 1
977 1
976 2
978 2
977 3
979 3
978 4
980 4
979
981
980 Test that color codes don't end up in the commit message template
982 Test that color codes don't end up in the commit message template
981 ----------------------------------------------------
983 ----------------------------------------------------
982
984
983 $ hg init $TESTTMP/colorless
985 $ hg init $TESTTMP/colorless
984 $ cd $TESTTMP/colorless
986 $ cd $TESTTMP/colorless
985 $ echo 1 > file1
987 $ echo 1 > file1
986 $ echo 1 > file2
988 $ echo 1 > file2
987 $ hg ci -qAm initial
989 $ hg ci -qAm initial
988 $ echo 2 > file1
990 $ echo 2 > file1
989 $ echo 2 > file2
991 $ echo 2 > file2
990 $ cat > $TESTTMP/messages <<EOF
992 $ cat > $TESTTMP/messages <<EOF
991 > split1, modifying file1
993 > split1, modifying file1
992 > --
994 > --
993 > split2, modifying file2
995 > split2, modifying file2
994 > EOF
996 > EOF
995 $ hg ci
997 $ hg ci
996 EDITOR:
998 EDITOR:
997 EDITOR:
999 EDITOR:
998 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
1000 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
999 EDITOR: HG: Leave message empty to abort commit.
1001 EDITOR: HG: Leave message empty to abort commit.
1000 EDITOR: HG: --
1002 EDITOR: HG: --
1001 EDITOR: HG: user: test
1003 EDITOR: HG: user: test
1002 EDITOR: HG: branch 'default'
1004 EDITOR: HG: branch 'default'
1003 EDITOR: HG: changed file1
1005 EDITOR: HG: changed file1
1004 EDITOR: HG: changed file2
1006 EDITOR: HG: changed file2
1005 $ printf 'f\nn\na\n' | hg split --color=debug \
1007 $ printf 'f\nn\na\n' | hg split --color=debug \
1006 > --config command-templates.oneline-summary='{label("rev", rev)} {desc}'
1008 > --config command-templates.oneline-summary='{label("rev", rev)} {desc}'
1007 [diff.diffline|diff --git a/file1 b/file1]
1009 [diff.diffline|diff --git a/file1 b/file1]
1008 1 hunks, 1 lines changed
1010 1 hunks, 1 lines changed
1009 [ ui.prompt|examine changes to 'file1'?
1011 [ ui.prompt|examine changes to 'file1'?
1010 (enter ? for help) [Ynesfdaq?]] [ ui.promptecho|f]
1012 (enter ? for help) [Ynesfdaq?]] [ ui.promptecho|f]
1011
1013
1012 [diff.diffline|diff --git a/file2 b/file2]
1014 [diff.diffline|diff --git a/file2 b/file2]
1013 1 hunks, 1 lines changed
1015 1 hunks, 1 lines changed
1014 [ ui.prompt|examine changes to 'file2'?
1016 [ ui.prompt|examine changes to 'file2'?
1015 (enter ? for help) [Ynesfdaq?]] [ ui.promptecho|n]
1017 (enter ? for help) [Ynesfdaq?]] [ ui.promptecho|n]
1016
1018
1017 EDITOR: HG: Splitting 6432c65c3078. Write commit message for the first split changeset.
1019 EDITOR: HG: Splitting 6432c65c3078. Write commit message for the first split changeset.
1018 EDITOR: split1, modifying file1
1020 EDITOR: split1, modifying file1
1019 EDITOR:
1021 EDITOR:
1020 EDITOR:
1022 EDITOR:
1021 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
1023 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
1022 EDITOR: HG: Leave message empty to abort commit.
1024 EDITOR: HG: Leave message empty to abort commit.
1023 EDITOR: HG: --
1025 EDITOR: HG: --
1024 EDITOR: HG: user: test
1026 EDITOR: HG: user: test
1025 EDITOR: HG: branch 'default'
1027 EDITOR: HG: branch 'default'
1026 EDITOR: HG: changed file1
1028 EDITOR: HG: changed file1
1027 [ ui.status|created new head]
1029 [ ui.status|created new head]
1028 [diff.diffline|diff --git a/file2 b/file2]
1030 [diff.diffline|diff --git a/file2 b/file2]
1029 1 hunks, 1 lines changed
1031 1 hunks, 1 lines changed
1030 [ ui.prompt|examine changes to 'file2'?
1032 [ ui.prompt|examine changes to 'file2'?
1031 (enter ? for help) [Ynesfdaq?]] [ ui.promptecho|a]
1033 (enter ? for help) [Ynesfdaq?]] [ ui.promptecho|a]
1032
1034
1033 EDITOR: HG: Splitting 6432c65c3078. So far it has been split into:
1035 EDITOR: HG: Splitting 6432c65c3078. So far it has been split into:
1034 EDITOR: HG: - 2 split2, modifying file2
1036 EDITOR: HG: - 2 split2, modifying file2
1035 EDITOR: HG: Write commit message for the next split changeset.
1037 EDITOR: HG: Write commit message for the next split changeset.
1036 EDITOR: split1, modifying file1
1038 EDITOR: split1, modifying file1
1037 EDITOR:
1039 EDITOR:
1038 EDITOR:
1040 EDITOR:
1039 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
1041 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
1040 EDITOR: HG: Leave message empty to abort commit.
1042 EDITOR: HG: Leave message empty to abort commit.
1041 EDITOR: HG: --
1043 EDITOR: HG: --
1042 EDITOR: HG: user: test
1044 EDITOR: HG: user: test
1043 EDITOR: HG: branch 'default'
1045 EDITOR: HG: branch 'default'
1044 EDITOR: HG: changed file2
1046 EDITOR: HG: changed file2
1045 [ ui.warning|transaction abort!]
1047 [ ui.warning|transaction abort!]
1046 [ ui.warning|rollback completed]
1048 [ ui.warning|rollback completed]
1047 [ ui.error|abort: empty commit message]
1049 [ ui.error|abort: empty commit message]
1048 [10]
1050 [10]
1049
1051
1050 Test that creating an empty split or "no-op"
1052 Test that creating an empty split or "no-op"
1051 (identical to original) commit doesn't cause chaos
1053 (identical to original) commit doesn't cause chaos
1052 --------------------------------------------------
1054 --------------------------------------------------
1053
1055
1054 $ hg init $TESTTMP/noop
1056 $ hg init $TESTTMP/noop
1055 $ cd $TESTTMP/noop
1057 $ cd $TESTTMP/noop
1056 $ echo r0 > r0
1058 $ echo r0 > r0
1057 $ hg ci -qAm r0
1059 $ hg ci -qAm r0
1058 $ hg phase -p
1060 $ hg phase -p
1059 $ echo foo > foo
1061 $ echo foo > foo
1060 $ hg ci -qAm foo
1062 $ hg ci -qAm foo
1061 $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
1063 $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
1062 @ draft 1:ae694b2901bb foo
1064 @ draft 1:ae694b2901bb foo
1063 |
1065 |
1064 o public 0:222799e2f90b r0
1066 o public 0:222799e2f90b r0
1065
1067
1066 $ printf 'd\na\n' | HGEDITOR=cat hg split || true
1068 $ printf 'd\na\n' | HGEDITOR=cat hg split || true
1067 diff --git a/foo b/foo
1069 diff --git a/foo b/foo
1068 new file mode 100644
1070 new file mode 100644
1069 examine changes to 'foo'?
1071 examine changes to 'foo'?
1070 (enter ? for help) [Ynesfdaq?] d
1072 (enter ? for help) [Ynesfdaq?] d
1071
1073
1072 no changes to record
1074 no changes to record
1073 diff --git a/foo b/foo
1075 diff --git a/foo b/foo
1074 new file mode 100644
1076 new file mode 100644
1075 examine changes to 'foo'?
1077 examine changes to 'foo'?
1076 (enter ? for help) [Ynesfdaq?] a
1078 (enter ? for help) [Ynesfdaq?] a
1077
1079
1078 HG: Splitting ae694b2901bb. Write commit message for the first split changeset.
1080 HG: Splitting ae694b2901bb. Write commit message for the first split changeset.
1079 foo
1081 foo
1080
1082
1081
1083
1082 HG: Enter commit message. Lines beginning with 'HG:' are removed.
1084 HG: Enter commit message. Lines beginning with 'HG:' are removed.
1083 HG: Leave message empty to abort commit.
1085 HG: Leave message empty to abort commit.
1084 HG: --
1086 HG: --
1085 HG: user: test
1087 HG: user: test
1086 HG: branch 'default'
1088 HG: branch 'default'
1087 HG: added foo
1089 HG: added foo
1088 warning: commit already existed in the repository!
1090 warning: commit already existed in the repository!
1089 $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
1091 $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
1090 @ draft 1:ae694b2901bb foo
1092 @ draft 1:ae694b2901bb foo
1091 |
1093 |
1092 o public 0:222799e2f90b r0
1094 o public 0:222799e2f90b r0
1093
1095
1094
1096
1095 Now try the same thing but modifying the message so we don't trigger the
1097 Now try the same thing but modifying the message so we don't trigger the
1096 identical changeset failures
1098 identical changeset failures
1097
1099
1098 $ hg init $TESTTMP/noop2
1100 $ hg init $TESTTMP/noop2
1099 $ cd $TESTTMP/noop2
1101 $ cd $TESTTMP/noop2
1100 $ echo r0 > r0
1102 $ echo r0 > r0
1101 $ hg ci -qAm r0
1103 $ hg ci -qAm r0
1102 $ hg phase -p
1104 $ hg phase -p
1103 $ echo foo > foo
1105 $ echo foo > foo
1104 $ hg ci -qAm foo
1106 $ hg ci -qAm foo
1105 $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
1107 $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
1106 @ draft 1:ae694b2901bb foo
1108 @ draft 1:ae694b2901bb foo
1107 |
1109 |
1108 o public 0:222799e2f90b r0
1110 o public 0:222799e2f90b r0
1109
1111
1110 $ cat > $TESTTMP/messages <<EOF
1112 $ cat > $TESTTMP/messages <<EOF
1111 > message1
1113 > message1
1112 > EOF
1114 > EOF
1113 $ printf 'd\na\n' | HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py" hg split
1115 $ printf 'd\na\n' | HGEDITOR="\"$PYTHON\" $TESTTMP/editor.py" hg split
1114 diff --git a/foo b/foo
1116 diff --git a/foo b/foo
1115 new file mode 100644
1117 new file mode 100644
1116 examine changes to 'foo'?
1118 examine changes to 'foo'?
1117 (enter ? for help) [Ynesfdaq?] d
1119 (enter ? for help) [Ynesfdaq?] d
1118
1120
1119 no changes to record
1121 no changes to record
1120 diff --git a/foo b/foo
1122 diff --git a/foo b/foo
1121 new file mode 100644
1123 new file mode 100644
1122 examine changes to 'foo'?
1124 examine changes to 'foo'?
1123 (enter ? for help) [Ynesfdaq?] a
1125 (enter ? for help) [Ynesfdaq?] a
1124
1126
1125 EDITOR: HG: Splitting ae694b2901bb. Write commit message for the first split changeset.
1127 EDITOR: HG: Splitting ae694b2901bb. Write commit message for the first split changeset.
1126 EDITOR: foo
1128 EDITOR: foo
1127 EDITOR:
1129 EDITOR:
1128 EDITOR:
1130 EDITOR:
1129 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
1131 EDITOR: HG: Enter commit message. Lines beginning with 'HG:' are removed.
1130 EDITOR: HG: Leave message empty to abort commit.
1132 EDITOR: HG: Leave message empty to abort commit.
1131 EDITOR: HG: --
1133 EDITOR: HG: --
1132 EDITOR: HG: user: test
1134 EDITOR: HG: user: test
1133 EDITOR: HG: branch 'default'
1135 EDITOR: HG: branch 'default'
1134 EDITOR: HG: added foo
1136 EDITOR: HG: added foo
1135 created new head
1137 created new head
1136 saved backup bundle to $TESTTMP/noop2/.hg/strip-backup/ae694b2901bb-28e0b457-split.hg (obsstore-off !)
1138 saved backup bundle to $TESTTMP/noop2/.hg/strip-backup/ae694b2901bb-28e0b457-split.hg (obsstore-off !)
1137 $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
1139 $ hg log -G -T'{phase} {rev}:{node|short} {desc}'
1138 @ draft 1:de675559d3f9 message1 (obsstore-off !)
1140 @ draft 1:de675559d3f9 message1 (obsstore-off !)
1139 @ draft 2:de675559d3f9 message1 (obsstore-on !)
1141 @ draft 2:de675559d3f9 message1 (obsstore-on !)
1140 |
1142 |
1141 o public 0:222799e2f90b r0
1143 o public 0:222799e2f90b r0
1142
1144
1143 #if obsstore-on
1145 #if obsstore-on
1144 $ hg debugobsolete
1146 $ hg debugobsolete
1145 ae694b2901bb8b0f8c4b5e075ddec0d63468d57a de675559d3f93ffc822c6eb7490e5c73033f17c7 0 * (glob)
1147 ae694b2901bb8b0f8c4b5e075ddec0d63468d57a de675559d3f93ffc822c6eb7490e5c73033f17c7 0 * (glob)
1146 #endif
1148 #endif
@@ -1,421 +1,422 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 [10]
42 [10]
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 (see 'hg help evolution.instability')
287 [10]
288 [10]
288
289
289 $ hg unamend
290 $ hg unamend
290 3 new orphan changesets
291 3 new orphan changesets
291
292
292 Trying to unamend a public changeset
293 Trying to unamend a public changeset
293
294
294 $ hg up -C 23
295 $ hg up -C 23
295 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 $ hg phase -r . -p
297 $ hg phase -r . -p
297 1 new phase-divergent changesets
298 1 new phase-divergent changesets
298 $ hg unamend
299 $ hg unamend
299 abort: cannot unamend public changesets
300 abort: cannot unamend public changesets
300 (see 'hg help phases' for details)
301 (see 'hg help phases' for details)
301 [10]
302 [10]
302
303
303 Testing whether unamend retains copies or not
304 Testing whether unamend retains copies or not
304
305
305 $ hg status
306 $ hg status
306
307
307 $ hg mv a foo
308 $ hg mv a foo
308
309
309 $ hg ci -m "Moved a to foo"
310 $ hg ci -m "Moved a to foo"
310 $ hg exp --git
311 $ hg exp --git
311 # HG changeset patch
312 # HG changeset patch
312 # User test
313 # User test
313 # Date 0 0
314 # Date 0 0
314 # Thu Jan 01 00:00:00 1970 +0000
315 # Thu Jan 01 00:00:00 1970 +0000
315 # Node ID cfef290346fbee5126313d7e1aab51d877679b09
316 # Node ID cfef290346fbee5126313d7e1aab51d877679b09
316 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
317 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
317 Moved a to foo
318 Moved a to foo
318
319
319 diff --git a/a b/foo
320 diff --git a/a b/foo
320 rename from a
321 rename from a
321 rename to foo
322 rename to foo
322
323
323 $ hg mv b foobar
324 $ hg mv b foobar
324 $ hg diff --git
325 $ hg diff --git
325 diff --git a/b b/foobar
326 diff --git a/b b/foobar
326 rename from b
327 rename from b
327 rename to foobar
328 rename to foobar
328 $ hg amend
329 $ hg amend
329
330
330 $ hg exp --git
331 $ hg exp --git
331 # HG changeset patch
332 # HG changeset patch
332 # User test
333 # User test
333 # Date 0 0
334 # Date 0 0
334 # Thu Jan 01 00:00:00 1970 +0000
335 # Thu Jan 01 00:00:00 1970 +0000
335 # Node ID eca050985275bb271ce3092b54e56ea5c85d29a3
336 # Node ID eca050985275bb271ce3092b54e56ea5c85d29a3
336 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
337 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
337 Moved a to foo
338 Moved a to foo
338
339
339 diff --git a/a b/foo
340 diff --git a/a b/foo
340 rename from a
341 rename from a
341 rename to foo
342 rename to foo
342 diff --git a/b b/foobar
343 diff --git a/b b/foobar
343 rename from b
344 rename from b
344 rename to foobar
345 rename to foobar
345
346
346 $ hg mv c wat
347 $ hg mv c wat
347 $ hg unamend
348 $ hg unamend
348
349
349 $ hg verify -v
350 $ hg verify -v
350 repository uses revlog format 1
351 repository uses revlog format 1
351 checking changesets
352 checking changesets
352 checking manifests
353 checking manifests
353 crosschecking files in changesets and manifests
354 crosschecking files in changesets and manifests
354 checking files
355 checking files
355 checked 28 changesets with 16 changes to 11 files
356 checked 28 changesets with 16 changes to 11 files
356
357
357 Retained copies in new prdecessor commit
358 Retained copies in new prdecessor commit
358
359
359 $ hg exp --git
360 $ hg exp --git
360 # HG changeset patch
361 # HG changeset patch
361 # User test
362 # User test
362 # Date 0 0
363 # Date 0 0
363 # Thu Jan 01 00:00:00 1970 +0000
364 # Thu Jan 01 00:00:00 1970 +0000
364 # Node ID 552e3af4f01f620f88ca27be1f898316235b736a
365 # Node ID 552e3af4f01f620f88ca27be1f898316235b736a
365 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
366 # Parent 03ddd6fc5af19e028c44a2fd6d790dd22712f231
366 Moved a to foo
367 Moved a to foo
367
368
368 diff --git a/a b/foo
369 diff --git a/a b/foo
369 rename from a
370 rename from a
370 rename to foo
371 rename to foo
371
372
372 Retained copies in working directoy
373 Retained copies in working directoy
373
374
374 $ hg diff --git
375 $ hg diff --git
375 diff --git a/b b/foobar
376 diff --git a/b b/foobar
376 rename from b
377 rename from b
377 rename to foobar
378 rename to foobar
378 diff --git a/c b/wat
379 diff --git a/c b/wat
379 rename from c
380 rename from c
380 rename to wat
381 rename to wat
381 $ hg revert -qa
382 $ hg revert -qa
382 $ rm foobar wat
383 $ rm foobar wat
383
384
384 Rename a->b, then amend b->c. After unamend, should look like b->c.
385 Rename a->b, then amend b->c. After unamend, should look like b->c.
385
386
386 $ hg co -q 0
387 $ hg co -q 0
387 $ hg mv a b
388 $ hg mv a b
388 $ hg ci -qm 'move to a b'
389 $ hg ci -qm 'move to a b'
389 $ hg mv b c
390 $ hg mv b c
390 $ hg amend
391 $ hg amend
391 $ hg unamend
392 $ hg unamend
392 $ hg st --copies --change .
393 $ hg st --copies --change .
393 A b
394 A b
394 a
395 a
395 R a
396 R a
396 $ hg st --copies
397 $ hg st --copies
397 A c
398 A c
398 b
399 b
399 R b
400 R b
400 $ hg revert -qa
401 $ hg revert -qa
401 $ rm c
402 $ rm c
402
403
403 Rename a->b, then amend b->c, and working copy change c->d. After unamend, should look like b->d
404 Rename a->b, then amend b->c, and working copy change c->d. After unamend, should look like b->d
404
405
405 $ hg co -q 0
406 $ hg co -q 0
406 $ hg mv a b
407 $ hg mv a b
407 $ hg ci -qm 'move to a b'
408 $ hg ci -qm 'move to a b'
408 warning: commit already existed in the repository!
409 warning: commit already existed in the repository!
409 $ hg mv b c
410 $ hg mv b c
410 $ hg amend
411 $ hg amend
411 warning: commit already existed in the repository!
412 warning: commit already existed in the repository!
412 $ hg mv c d
413 $ hg mv c d
413 $ hg unamend
414 $ hg unamend
414 $ hg st --copies --change .
415 $ hg st --copies --change .
415 A b
416 A b
416 a
417 a
417 R a
418 R a
418 $ hg st --copies
419 $ hg st --copies
419 A d
420 A d
420 b
421 b
421 R b
422 R b
General Comments 0
You need to be logged in to leave comments. Login now