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