##// END OF EJS Templates
rewriteutil: fix crash when a rewritten message references f{6,64}...
Augie Fackler -
r48591:48da5c32 stable
parent child Browse files
Show More
@@ -1,247 +1,252 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, as that will orphan %d descendants")
83 _(b"cannot %s changeset, as that will orphan %d descendants")
84 % (action, len(newunstable)),
84 % (action, len(newunstable)),
85 hint=hint,
85 hint=hint,
86 )
86 )
87
87
88 if not obsolete.isenabled(repo, obsolete.allowdivergenceopt):
88 if not obsolete.isenabled(repo, obsolete.allowdivergenceopt):
89 new_divergence = _find_new_divergence(repo, revs)
89 new_divergence = _find_new_divergence(repo, revs)
90 if new_divergence:
90 if new_divergence:
91 local_ctx, other_ctx, base_ctx = new_divergence
91 local_ctx, other_ctx, base_ctx = new_divergence
92 msg = _(
92 msg = _(
93 b'cannot %s %s, as that creates content-divergence with %s'
93 b'cannot %s %s, as that creates content-divergence with %s'
94 ) % (
94 ) % (
95 action,
95 action,
96 local_ctx,
96 local_ctx,
97 other_ctx,
97 other_ctx,
98 )
98 )
99 if local_ctx.rev() != base_ctx.rev():
99 if local_ctx.rev() != base_ctx.rev():
100 msg += _(b', from %s') % base_ctx
100 msg += _(b', from %s') % base_ctx
101 if repo.ui.verbose:
101 if repo.ui.verbose:
102 if local_ctx.rev() != base_ctx.rev():
102 if local_ctx.rev() != base_ctx.rev():
103 msg += _(
103 msg += _(
104 b'\n changeset %s is a successor of ' b'changeset %s'
104 b'\n changeset %s is a successor of ' b'changeset %s'
105 ) % (local_ctx, base_ctx)
105 ) % (local_ctx, base_ctx)
106 msg += _(
106 msg += _(
107 b'\n changeset %s already has a successor in '
107 b'\n changeset %s already has a successor in '
108 b'changeset %s\n'
108 b'changeset %s\n'
109 b' rewriting changeset %s would create '
109 b' rewriting changeset %s would create '
110 b'"content-divergence"\n'
110 b'"content-divergence"\n'
111 b' set experimental.evolution.allowdivergence=True to '
111 b' set experimental.evolution.allowdivergence=True to '
112 b'skip this check'
112 b'skip this check'
113 ) % (base_ctx, other_ctx, local_ctx)
113 ) % (base_ctx, other_ctx, local_ctx)
114 raise error.InputError(
114 raise error.InputError(
115 msg,
115 msg,
116 hint=_(
116 hint=_(
117 b"see 'hg help evolution.instability' for details on content-divergence"
117 b"see 'hg help evolution.instability' for details on content-divergence"
118 ),
118 ),
119 )
119 )
120 else:
120 else:
121 raise error.InputError(
121 raise error.InputError(
122 msg,
122 msg,
123 hint=_(
123 hint=_(
124 b"add --verbose for details or see "
124 b"add --verbose for details or see "
125 b"'hg help evolution.instability'"
125 b"'hg help evolution.instability'"
126 ),
126 ),
127 )
127 )
128
128
129
129
130 def disallowednewunstable(repo, revs):
130 def disallowednewunstable(repo, revs):
131 """Checks whether editing the revs will create new unstable changesets and
131 """Checks whether editing the revs will create new unstable changesets and
132 are we allowed to create them.
132 are we allowed to create them.
133
133
134 To allow new unstable changesets, set the config:
134 To allow new unstable changesets, set the config:
135 `experimental.evolution.allowunstable=True`
135 `experimental.evolution.allowunstable=True`
136 """
136 """
137 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
137 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
138 if allowunstable:
138 if allowunstable:
139 return revset.baseset()
139 return revset.baseset()
140 return repo.revs(b"(%ld::) - %ld", revs, revs)
140 return repo.revs(b"(%ld::) - %ld", revs, revs)
141
141
142
142
143 def _find_new_divergence(repo, revs):
143 def _find_new_divergence(repo, revs):
144 obsrevs = repo.revs(b'%ld and obsolete()', revs)
144 obsrevs = repo.revs(b'%ld and obsolete()', revs)
145 for r in obsrevs:
145 for r in obsrevs:
146 div = find_new_divergence_from(repo, repo[r])
146 div = find_new_divergence_from(repo, repo[r])
147 if div:
147 if div:
148 return (repo[r], repo[div[0]], repo.unfiltered()[div[1]])
148 return (repo[r], repo[div[0]], repo.unfiltered()[div[1]])
149 return None
149 return None
150
150
151
151
152 def find_new_divergence_from(repo, ctx):
152 def find_new_divergence_from(repo, ctx):
153 """return divergent revision if rewriting an obsolete cset (ctx) will
153 """return divergent revision if rewriting an obsolete cset (ctx) will
154 create divergence
154 create divergence
155
155
156 Returns (<other node>, <common ancestor node>) or None
156 Returns (<other node>, <common ancestor node>) or None
157 """
157 """
158 if not ctx.obsolete():
158 if not ctx.obsolete():
159 return None
159 return None
160 # We need to check two cases that can cause divergence:
160 # We need to check two cases that can cause divergence:
161 # case 1: the rev being rewritten has a non-obsolete successor (easily
161 # case 1: the rev being rewritten has a non-obsolete successor (easily
162 # detected by successorssets)
162 # detected by successorssets)
163 sset = obsutil.successorssets(repo, ctx.node())
163 sset = obsutil.successorssets(repo, ctx.node())
164 if sset:
164 if sset:
165 return (sset[0][0], ctx.node())
165 return (sset[0][0], ctx.node())
166 else:
166 else:
167 # case 2: one of the precursors of the rev being revived has a
167 # case 2: one of the precursors of the rev being revived has a
168 # non-obsolete successor (we need divergentsets for this)
168 # non-obsolete successor (we need divergentsets for this)
169 divsets = obsutil.divergentsets(repo, ctx)
169 divsets = obsutil.divergentsets(repo, ctx)
170 if divsets:
170 if divsets:
171 nsuccset = divsets[0][b'divergentnodes']
171 nsuccset = divsets[0][b'divergentnodes']
172 prec = divsets[0][b'commonpredecessor']
172 prec = divsets[0][b'commonpredecessor']
173 return (nsuccset[0], prec)
173 return (nsuccset[0], prec)
174 return None
174 return None
175
175
176
176
177 def skip_empty_successor(ui, command):
177 def skip_empty_successor(ui, command):
178 empty_successor = ui.config(b'rewrite', b'empty-successor')
178 empty_successor = ui.config(b'rewrite', b'empty-successor')
179 if empty_successor == b'skip':
179 if empty_successor == b'skip':
180 return True
180 return True
181 elif empty_successor == b'keep':
181 elif empty_successor == b'keep':
182 return False
182 return False
183 else:
183 else:
184 raise error.ConfigError(
184 raise error.ConfigError(
185 _(
185 _(
186 b"%s doesn't know how to handle config "
186 b"%s doesn't know how to handle config "
187 b"rewrite.empty-successor=%s (only 'skip' and 'keep' are "
187 b"rewrite.empty-successor=%s (only 'skip' and 'keep' are "
188 b"supported)"
188 b"supported)"
189 )
189 )
190 % (command, empty_successor)
190 % (command, empty_successor)
191 )
191 )
192
192
193
193
194 def update_hash_refs(repo, commitmsg, pending=None):
194 def update_hash_refs(repo, commitmsg, pending=None):
195 """Replace all obsolete commit hashes in the message with the current hash.
195 """Replace all obsolete commit hashes in the message with the current hash.
196
196
197 If the obsolete commit was split or is divergent, the hash is not replaced
197 If the obsolete commit was split or is divergent, the hash is not replaced
198 as there's no way to know which successor to choose.
198 as there's no way to know which successor to choose.
199
199
200 For commands that update a series of commits in the current transaction, the
200 For commands that update a series of commits in the current transaction, the
201 new obsolete markers can be considered by setting ``pending`` to a mapping
201 new obsolete markers can be considered by setting ``pending`` to a mapping
202 of ``pending[oldnode] = [successor_node1, successor_node2,..]``.
202 of ``pending[oldnode] = [successor_node1, successor_node2,..]``.
203 """
203 """
204 if not pending:
204 if not pending:
205 pending = {}
205 pending = {}
206 cache = {}
206 cache = {}
207 hashes = re.findall(NODE_RE, commitmsg)
207 hashes = re.findall(NODE_RE, commitmsg)
208 unfi = repo.unfiltered()
208 unfi = repo.unfiltered()
209 for h in hashes:
209 for h in hashes:
210 fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
210 try:
211 fullnode = scmutil.resolvehexnodeidprefix(unfi, h)
212 except error.WdirUnsupported:
213 # Someone has an fffff... in a commit message we're
214 # rewriting. Don't try rewriting that.
215 continue
211 if fullnode is None:
216 if fullnode is None:
212 continue
217 continue
213 ctx = unfi[fullnode]
218 ctx = unfi[fullnode]
214 if not ctx.obsolete():
219 if not ctx.obsolete():
215 successors = pending.get(fullnode)
220 successors = pending.get(fullnode)
216 if successors is None:
221 if successors is None:
217 continue
222 continue
218 # obsutil.successorssets() returns a list of list of nodes
223 # obsutil.successorssets() returns a list of list of nodes
219 successors = [successors]
224 successors = [successors]
220 else:
225 else:
221 successors = obsutil.successorssets(repo, ctx.node(), cache=cache)
226 successors = obsutil.successorssets(repo, ctx.node(), cache=cache)
222
227
223 # We can't make any assumptions about how to update the hash if the
228 # We can't make any assumptions about how to update the hash if the
224 # cset in question was split or diverged.
229 # cset in question was split or diverged.
225 if len(successors) == 1 and len(successors[0]) == 1:
230 if len(successors) == 1 and len(successors[0]) == 1:
226 successor = successors[0][0]
231 successor = successors[0][0]
227 if successor is not None:
232 if successor is not None:
228 newhash = hex(successor)
233 newhash = hex(successor)
229 commitmsg = commitmsg.replace(h, newhash[: len(h)])
234 commitmsg = commitmsg.replace(h, newhash[: len(h)])
230 else:
235 else:
231 repo.ui.note(
236 repo.ui.note(
232 _(
237 _(
233 b'The stale commit message reference to %s could '
238 b'The stale commit message reference to %s could '
234 b'not be updated\n(The referenced commit was dropped)\n'
239 b'not be updated\n(The referenced commit was dropped)\n'
235 )
240 )
236 % h
241 % h
237 )
242 )
238 else:
243 else:
239 repo.ui.note(
244 repo.ui.note(
240 _(
245 _(
241 b'The stale commit message reference to %s could '
246 b'The stale commit message reference to %s could '
242 b'not be updated\n'
247 b'not be updated\n'
243 )
248 )
244 % h
249 % h
245 )
250 )
246
251
247 return commitmsg
252 return commitmsg
@@ -1,1022 +1,1022 b''
1 #require symlink execbit
1 #require symlink execbit
2 $ cat << EOF >> $HGRCPATH
2 $ cat << EOF >> $HGRCPATH
3 > [phases]
3 > [phases]
4 > publish=False
4 > publish=False
5 > [extensions]
5 > [extensions]
6 > amend=
6 > amend=
7 > rebase=
7 > rebase=
8 > debugdrawdag=$TESTDIR/drawdag.py
8 > debugdrawdag=$TESTDIR/drawdag.py
9 > strip=
9 > strip=
10 > [rebase]
10 > [rebase]
11 > experimental.inmemory=1
11 > experimental.inmemory=1
12 > [diff]
12 > [diff]
13 > git=1
13 > git=1
14 > [alias]
14 > [alias]
15 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
15 > tglog = log -G --template "{rev}: {node|short} '{desc}'\n"
16 > EOF
16 > EOF
17
17
18 Rebase a simple DAG:
18 Rebase a simple DAG:
19 $ hg init repo1
19 $ hg init repo1
20 $ cd repo1
20 $ cd repo1
21 $ hg debugdrawdag <<'EOS'
21 $ hg debugdrawdag <<'EOS'
22 > c b
22 > c b
23 > |/
23 > |/
24 > d
24 > d
25 > |
25 > |
26 > a
26 > a
27 > EOS
27 > EOS
28 $ hg up -C a
28 $ hg up -C a
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 $ hg tglog
30 $ hg tglog
31 o 3: 814f6bd05178 'c'
31 o 3: 814f6bd05178 'c'
32 |
32 |
33 | o 2: db0e82a16a62 'b'
33 | o 2: db0e82a16a62 'b'
34 |/
34 |/
35 o 1: 02952614a83d 'd'
35 o 1: 02952614a83d 'd'
36 |
36 |
37 @ 0: b173517d0057 'a'
37 @ 0: b173517d0057 'a'
38
38
39 $ hg cat -r 3 c
39 $ hg cat -r 3 c
40 c (no-eol)
40 c (no-eol)
41 $ hg cat -r 2 b
41 $ hg cat -r 2 b
42 b (no-eol)
42 b (no-eol)
43 $ hg rebase --debug -r b -d c | grep rebasing
43 $ hg rebase --debug -r b -d c | grep rebasing
44 rebasing in memory
44 rebasing in memory
45 rebasing 2:db0e82a16a62 b "b"
45 rebasing 2:db0e82a16a62 b "b"
46 $ hg tglog
46 $ hg tglog
47 o 3: ca58782ad1e4 'b'
47 o 3: ca58782ad1e4 'b'
48 |
48 |
49 o 2: 814f6bd05178 'c'
49 o 2: 814f6bd05178 'c'
50 |
50 |
51 o 1: 02952614a83d 'd'
51 o 1: 02952614a83d 'd'
52 |
52 |
53 @ 0: b173517d0057 'a'
53 @ 0: b173517d0057 'a'
54
54
55 $ hg cat -r 3 b
55 $ hg cat -r 3 b
56 b (no-eol)
56 b (no-eol)
57 $ hg cat -r 2 c
57 $ hg cat -r 2 c
58 c (no-eol)
58 c (no-eol)
59 $ cd ..
59 $ cd ..
60
60
61 Case 2:
61 Case 2:
62 $ hg init repo2
62 $ hg init repo2
63 $ cd repo2
63 $ cd repo2
64 $ hg debugdrawdag <<'EOS'
64 $ hg debugdrawdag <<'EOS'
65 > c b
65 > c b
66 > |/
66 > |/
67 > d
67 > d
68 > |
68 > |
69 > a
69 > a
70 > EOS
70 > EOS
71
71
72 Add a symlink and executable file:
72 Add a symlink and executable file:
73 $ hg up -C c
73 $ hg up -C c
74 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
75 $ ln -s somefile e
75 $ ln -s somefile e
76 $ echo f > f
76 $ echo f > f
77 $ chmod +x f
77 $ chmod +x f
78 $ hg add e f
78 $ hg add e f
79 $ hg amend -q
79 $ hg amend -q
80 $ hg up -Cq a
80 $ hg up -Cq a
81
81
82 Write files to the working copy, and ensure they're still there after the rebase
82 Write files to the working copy, and ensure they're still there after the rebase
83 $ echo "abc" > a
83 $ echo "abc" > a
84 $ ln -s def b
84 $ ln -s def b
85 $ echo "ghi" > c
85 $ echo "ghi" > c
86 $ echo "jkl" > d
86 $ echo "jkl" > d
87 $ echo "mno" > e
87 $ echo "mno" > e
88 $ hg tglog
88 $ hg tglog
89 o 3: f56b71190a8f 'c'
89 o 3: f56b71190a8f 'c'
90 |
90 |
91 | o 2: db0e82a16a62 'b'
91 | o 2: db0e82a16a62 'b'
92 |/
92 |/
93 o 1: 02952614a83d 'd'
93 o 1: 02952614a83d 'd'
94 |
94 |
95 @ 0: b173517d0057 'a'
95 @ 0: b173517d0057 'a'
96
96
97 $ hg cat -r 3 c
97 $ hg cat -r 3 c
98 c (no-eol)
98 c (no-eol)
99 $ hg cat -r 2 b
99 $ hg cat -r 2 b
100 b (no-eol)
100 b (no-eol)
101 $ hg cat -r 3 e
101 $ hg cat -r 3 e
102 somefile (no-eol)
102 somefile (no-eol)
103 $ hg rebase --debug -s b -d a | grep rebasing
103 $ hg rebase --debug -s b -d a | grep rebasing
104 rebasing in memory
104 rebasing in memory
105 rebasing 2:db0e82a16a62 b "b"
105 rebasing 2:db0e82a16a62 b "b"
106 $ hg tglog
106 $ hg tglog
107 o 3: fc055c3b4d33 'b'
107 o 3: fc055c3b4d33 'b'
108 |
108 |
109 | o 2: f56b71190a8f 'c'
109 | o 2: f56b71190a8f 'c'
110 | |
110 | |
111 | o 1: 02952614a83d 'd'
111 | o 1: 02952614a83d 'd'
112 |/
112 |/
113 @ 0: b173517d0057 'a'
113 @ 0: b173517d0057 'a'
114
114
115 $ hg cat -r 2 c
115 $ hg cat -r 2 c
116 c (no-eol)
116 c (no-eol)
117 $ hg cat -r 3 b
117 $ hg cat -r 3 b
118 b (no-eol)
118 b (no-eol)
119 $ hg rebase --debug -s 1 -d 3 | grep rebasing
119 $ hg rebase --debug -s 1 -d 3 | grep rebasing
120 rebasing in memory
120 rebasing in memory
121 rebasing 1:02952614a83d d "d"
121 rebasing 1:02952614a83d d "d"
122 rebasing 2:f56b71190a8f "c"
122 rebasing 2:f56b71190a8f "c"
123 $ hg tglog
123 $ hg tglog
124 o 3: 753feb6fd12a 'c'
124 o 3: 753feb6fd12a 'c'
125 |
125 |
126 o 2: 09c044d2cb43 'd'
126 o 2: 09c044d2cb43 'd'
127 |
127 |
128 o 1: fc055c3b4d33 'b'
128 o 1: fc055c3b4d33 'b'
129 |
129 |
130 @ 0: b173517d0057 'a'
130 @ 0: b173517d0057 'a'
131
131
132 Ensure working copy files are still there:
132 Ensure working copy files are still there:
133 $ cat a
133 $ cat a
134 abc
134 abc
135 $ readlink.py b
135 $ readlink.py b
136 b -> def
136 b -> def
137 $ cat e
137 $ cat e
138 mno
138 mno
139
139
140 Ensure symlink and executable files were rebased properly:
140 Ensure symlink and executable files were rebased properly:
141 $ hg up -Cq 3
141 $ hg up -Cq 3
142 $ readlink.py e
142 $ readlink.py e
143 e -> somefile
143 e -> somefile
144 $ ls -l f | cut -c -10
144 $ ls -l f | cut -c -10
145 -rwxr-xr-x
145 -rwxr-xr-x
146
146
147 Rebase the working copy parent
147 Rebase the working copy parent
148 $ hg up -C 3
148 $ hg up -C 3
149 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
149 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 $ hg rebase -r 3 -d 0 --debug | grep rebasing
150 $ hg rebase -r 3 -d 0 --debug | grep rebasing
151 rebasing in memory
151 rebasing in memory
152 rebasing 3:753feb6fd12a tip "c"
152 rebasing 3:753feb6fd12a tip "c"
153 $ hg tglog
153 $ hg tglog
154 @ 3: 844a7de3e617 'c'
154 @ 3: 844a7de3e617 'c'
155 |
155 |
156 | o 2: 09c044d2cb43 'd'
156 | o 2: 09c044d2cb43 'd'
157 | |
157 | |
158 | o 1: fc055c3b4d33 'b'
158 | o 1: fc055c3b4d33 'b'
159 |/
159 |/
160 o 0: b173517d0057 'a'
160 o 0: b173517d0057 'a'
161
161
162
162
163 Test reporting of path conflicts
163 Test reporting of path conflicts
164
164
165 $ hg rm a
165 $ hg rm a
166 $ mkdir a
166 $ mkdir a
167 $ touch a/a
167 $ touch a/a
168 $ hg ci -Am "a/a"
168 $ hg ci -Am "a/a"
169 adding a/a
169 adding a/a
170 $ hg tglog
170 $ hg tglog
171 @ 4: daf7dfc139cb 'a/a'
171 @ 4: daf7dfc139cb 'a/a'
172 |
172 |
173 o 3: 844a7de3e617 'c'
173 o 3: 844a7de3e617 'c'
174 |
174 |
175 | o 2: 09c044d2cb43 'd'
175 | o 2: 09c044d2cb43 'd'
176 | |
176 | |
177 | o 1: fc055c3b4d33 'b'
177 | o 1: fc055c3b4d33 'b'
178 |/
178 |/
179 o 0: b173517d0057 'a'
179 o 0: b173517d0057 'a'
180
180
181 $ hg rebase -r . -d 2
181 $ hg rebase -r . -d 2
182 rebasing 4:daf7dfc139cb tip "a/a"
182 rebasing 4:daf7dfc139cb tip "a/a"
183 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/daf7dfc139cb-fdbfcf4f-rebase.hg
183 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/daf7dfc139cb-fdbfcf4f-rebase.hg
184
184
185 $ hg tglog
185 $ hg tglog
186 @ 4: c6ad37a4f250 'a/a'
186 @ 4: c6ad37a4f250 'a/a'
187 |
187 |
188 | o 3: 844a7de3e617 'c'
188 | o 3: 844a7de3e617 'c'
189 | |
189 | |
190 o | 2: 09c044d2cb43 'd'
190 o | 2: 09c044d2cb43 'd'
191 | |
191 | |
192 o | 1: fc055c3b4d33 'b'
192 o | 1: fc055c3b4d33 'b'
193 |/
193 |/
194 o 0: b173517d0057 'a'
194 o 0: b173517d0057 'a'
195
195
196 $ echo foo > foo
196 $ echo foo > foo
197 $ hg ci -Aqm "added foo"
197 $ hg ci -Aqm "added foo"
198 $ hg up '.^'
198 $ hg up '.^'
199 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
199 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
200 $ echo bar > bar
200 $ echo bar > bar
201 $ hg ci -Aqm "added bar"
201 $ hg ci -Aqm "added bar"
202 $ hg rm a/a
202 $ hg rm a/a
203 $ echo a > a
203 $ echo a > a
204 $ hg ci -Aqm "added a back!"
204 $ hg ci -Aqm "added a back!"
205 $ hg tglog
205 $ hg tglog
206 @ 7: 855e9797387e 'added a back!'
206 @ 7: 855e9797387e 'added a back!'
207 |
207 |
208 o 6: d14530e5e3e6 'added bar'
208 o 6: d14530e5e3e6 'added bar'
209 |
209 |
210 | o 5: 9b94b9373deb 'added foo'
210 | o 5: 9b94b9373deb 'added foo'
211 |/
211 |/
212 o 4: c6ad37a4f250 'a/a'
212 o 4: c6ad37a4f250 'a/a'
213 |
213 |
214 | o 3: 844a7de3e617 'c'
214 | o 3: 844a7de3e617 'c'
215 | |
215 | |
216 o | 2: 09c044d2cb43 'd'
216 o | 2: 09c044d2cb43 'd'
217 | |
217 | |
218 o | 1: fc055c3b4d33 'b'
218 o | 1: fc055c3b4d33 'b'
219 |/
219 |/
220 o 0: b173517d0057 'a'
220 o 0: b173517d0057 'a'
221
221
222 $ hg rebase -r . -d 5
222 $ hg rebase -r . -d 5
223 rebasing 7:855e9797387e tip "added a back!"
223 rebasing 7:855e9797387e tip "added a back!"
224 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/855e9797387e-81ee4c5d-rebase.hg
224 saved backup bundle to $TESTTMP/repo2/.hg/strip-backup/855e9797387e-81ee4c5d-rebase.hg
225
225
226 $ hg tglog
226 $ hg tglog
227 @ 7: bb3f02be2688 'added a back!'
227 @ 7: bb3f02be2688 'added a back!'
228 |
228 |
229 | o 6: d14530e5e3e6 'added bar'
229 | o 6: d14530e5e3e6 'added bar'
230 | |
230 | |
231 o | 5: 9b94b9373deb 'added foo'
231 o | 5: 9b94b9373deb 'added foo'
232 |/
232 |/
233 o 4: c6ad37a4f250 'a/a'
233 o 4: c6ad37a4f250 'a/a'
234 |
234 |
235 | o 3: 844a7de3e617 'c'
235 | o 3: 844a7de3e617 'c'
236 | |
236 | |
237 o | 2: 09c044d2cb43 'd'
237 o | 2: 09c044d2cb43 'd'
238 | |
238 | |
239 o | 1: fc055c3b4d33 'b'
239 o | 1: fc055c3b4d33 'b'
240 |/
240 |/
241 o 0: b173517d0057 'a'
241 o 0: b173517d0057 'a'
242
242
243 $ mkdir -p c/subdir
243 $ mkdir -p c/subdir
244 $ echo c > c/subdir/file.txt
244 $ echo c > c/subdir/file.txt
245 $ hg add c/subdir/file.txt
245 $ hg add c/subdir/file.txt
246 $ hg ci -m 'c/subdir/file.txt'
246 $ hg ci -m 'c/subdir/file.txt'
247 $ hg rebase -r . -d 3 -n
247 $ hg rebase -r . -d 3 -n
248 starting dry-run rebase; repository will not be changed
248 starting dry-run rebase; repository will not be changed
249 rebasing 8:e147e6e3c490 tip "c/subdir/file.txt"
249 rebasing 8:e147e6e3c490 tip "c/subdir/file.txt"
250 abort: error: 'c/subdir/file.txt' conflicts with file 'c' in 3.
250 abort: error: 'c/subdir/file.txt' conflicts with file 'c' in 3.
251 [255]
251 [255]
252 FIXME: shouldn't need this, but when we hit path conflicts in dryrun mode, we
252 FIXME: shouldn't need this, but when we hit path conflicts in dryrun mode, we
253 don't clean up rebasestate.
253 don't clean up rebasestate.
254 $ hg rebase --abort
254 $ hg rebase --abort
255 rebase aborted
255 rebase aborted
256 $ hg rebase -r 3 -d . -n
256 $ hg rebase -r 3 -d . -n
257 starting dry-run rebase; repository will not be changed
257 starting dry-run rebase; repository will not be changed
258 rebasing 3:844a7de3e617 "c"
258 rebasing 3:844a7de3e617 "c"
259 abort: error: file 'c' cannot be written because 'c/' is a directory in e147e6e3c490 (containing 1 entries: c/subdir/file.txt)
259 abort: error: file 'c' cannot be written because 'c/' is a directory in e147e6e3c490 (containing 1 entries: c/subdir/file.txt)
260 [255]
260 [255]
261
261
262 $ cd ..
262 $ cd ..
263
263
264 Test path auditing (issue5818)
264 Test path auditing (issue5818)
265
265
266 $ mkdir lib_
266 $ mkdir lib_
267 $ ln -s lib_ lib
267 $ ln -s lib_ lib
268 $ hg init repo
268 $ hg init repo
269 $ cd repo
269 $ cd repo
270 $ mkdir -p ".$TESTTMP/lib"
270 $ mkdir -p ".$TESTTMP/lib"
271 $ touch ".$TESTTMP/lib/a"
271 $ touch ".$TESTTMP/lib/a"
272 $ hg add ".$TESTTMP/lib/a"
272 $ hg add ".$TESTTMP/lib/a"
273 $ hg ci -m 'a'
273 $ hg ci -m 'a'
274
274
275 $ touch ".$TESTTMP/lib/b"
275 $ touch ".$TESTTMP/lib/b"
276 $ hg add ".$TESTTMP/lib/b"
276 $ hg add ".$TESTTMP/lib/b"
277 $ hg ci -m 'b'
277 $ hg ci -m 'b'
278
278
279 $ hg up -q '.^'
279 $ hg up -q '.^'
280 $ touch ".$TESTTMP/lib/c"
280 $ touch ".$TESTTMP/lib/c"
281 $ hg add ".$TESTTMP/lib/c"
281 $ hg add ".$TESTTMP/lib/c"
282 $ hg ci -m 'c'
282 $ hg ci -m 'c'
283 created new head
283 created new head
284 $ hg rebase -s 1 -d .
284 $ hg rebase -s 1 -d .
285 rebasing 1:* "b" (glob)
285 rebasing 1:* "b" (glob)
286 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-rebase.hg (glob)
286 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-rebase.hg (glob)
287 $ cd ..
287 $ cd ..
288
288
289 Test dry-run rebasing
289 Test dry-run rebasing
290
290
291 $ hg init repo3
291 $ hg init repo3
292 $ cd repo3
292 $ cd repo3
293 $ echo a>a
293 $ echo a>a
294 $ hg ci -Aqma
294 $ hg ci -Aqma
295 $ echo b>b
295 $ echo b>b
296 $ hg ci -Aqmb
296 $ hg ci -Aqmb
297 $ echo c>c
297 $ echo c>c
298 $ hg ci -Aqmc
298 $ hg ci -Aqmc
299 $ echo d>d
299 $ echo d>d
300 $ hg ci -Aqmd
300 $ hg ci -Aqmd
301 $ echo e>e
301 $ echo e>e
302 $ hg ci -Aqme
302 $ hg ci -Aqme
303
303
304 $ hg up 1 -q
304 $ hg up 1 -q
305 $ echo f>f
305 $ echo f>f
306 $ hg ci -Amf
306 $ hg ci -Amf
307 adding f
307 adding f
308 created new head
308 created new head
309 $ echo g>g
309 $ echo g>g
310 $ hg ci -Aqmg
310 $ hg ci -Aqmg
311 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
311 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
312 @ 6:baf10c5166d4 test
312 @ 6:baf10c5166d4 test
313 | g
313 | g
314 |
314 |
315 o 5:6343ca3eff20 test
315 o 5:6343ca3eff20 test
316 | f
316 | f
317 |
317 |
318 | o 4:e860deea161a test
318 | o 4:e860deea161a test
319 | | e
319 | | e
320 | |
320 | |
321 | o 3:055a42cdd887 test
321 | o 3:055a42cdd887 test
322 | | d
322 | | d
323 | |
323 | |
324 | o 2:177f92b77385 test
324 | o 2:177f92b77385 test
325 |/ c
325 |/ c
326 |
326 |
327 o 1:d2ae7f538514 test
327 o 1:d2ae7f538514 test
328 | b
328 | b
329 |
329 |
330 o 0:cb9a9f314b8b test
330 o 0:cb9a9f314b8b test
331 a
331 a
332
332
333 Make sure it throws error while passing --continue or --abort with --dry-run
333 Make sure it throws error while passing --continue or --abort with --dry-run
334 $ hg rebase -s 2 -d 6 -n --continue
334 $ hg rebase -s 2 -d 6 -n --continue
335 abort: cannot specify both --continue and --dry-run
335 abort: cannot specify both --continue and --dry-run
336 [10]
336 [10]
337 $ hg rebase -s 2 -d 6 -n --abort
337 $ hg rebase -s 2 -d 6 -n --abort
338 abort: cannot specify both --abort and --dry-run
338 abort: cannot specify both --abort and --dry-run
339 [10]
339 [10]
340
340
341 When nothing to rebase
341 When nothing to rebase
342 $ hg reb -r . -d '.^' -n
342 $ hg reb -r . -d '.^' -n
343 starting dry-run rebase; repository will not be changed
343 starting dry-run rebase; repository will not be changed
344 nothing to rebase
344 nothing to rebase
345 [1]
345 [1]
346
346
347 Check dryrun gives correct results when there is no conflict in rebasing
347 Check dryrun gives correct results when there is no conflict in rebasing
348 $ hg rebase -s 2 -d 6 -n
348 $ hg rebase -s 2 -d 6 -n
349 starting dry-run rebase; repository will not be changed
349 starting dry-run rebase; repository will not be changed
350 rebasing 2:177f92b77385 "c"
350 rebasing 2:177f92b77385 "c"
351 rebasing 3:055a42cdd887 "d"
351 rebasing 3:055a42cdd887 "d"
352 rebasing 4:e860deea161a "e"
352 rebasing 4:e860deea161a "e"
353 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
353 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
354
354
355 $ hg diff
355 $ hg diff
356 $ hg status
356 $ hg status
357
357
358 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
358 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
359 @ 6:baf10c5166d4 test
359 @ 6:baf10c5166d4 test
360 | g
360 | g
361 |
361 |
362 o 5:6343ca3eff20 test
362 o 5:6343ca3eff20 test
363 | f
363 | f
364 |
364 |
365 | o 4:e860deea161a test
365 | o 4:e860deea161a test
366 | | e
366 | | e
367 | |
367 | |
368 | o 3:055a42cdd887 test
368 | o 3:055a42cdd887 test
369 | | d
369 | | d
370 | |
370 | |
371 | o 2:177f92b77385 test
371 | o 2:177f92b77385 test
372 |/ c
372 |/ c
373 |
373 |
374 o 1:d2ae7f538514 test
374 o 1:d2ae7f538514 test
375 | b
375 | b
376 |
376 |
377 o 0:cb9a9f314b8b test
377 o 0:cb9a9f314b8b test
378 a
378 a
379
379
380 Check dryrun working with --collapse when there is no conflict
380 Check dryrun working with --collapse when there is no conflict
381 $ hg rebase -s 2 -d 6 -n --collapse
381 $ hg rebase -s 2 -d 6 -n --collapse
382 starting dry-run rebase; repository will not be changed
382 starting dry-run rebase; repository will not be changed
383 rebasing 2:177f92b77385 "c"
383 rebasing 2:177f92b77385 "c"
384 rebasing 3:055a42cdd887 "d"
384 rebasing 3:055a42cdd887 "d"
385 rebasing 4:e860deea161a "e"
385 rebasing 4:e860deea161a "e"
386 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
386 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
387
387
388 Check dryrun gives correct results when there is conflict in rebasing
388 Check dryrun gives correct results when there is conflict in rebasing
389 Make a conflict:
389 Make a conflict:
390 $ hg up 6 -q
390 $ hg up 6 -q
391 $ echo conflict>e
391 $ echo conflict>e
392 $ hg ci -Aqm "conflict with e"
392 $ hg ci -Aqm "conflict with e"
393 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
393 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
394 @ 7:d2c195b28050 test
394 @ 7:d2c195b28050 test
395 | conflict with e
395 | conflict with e
396 |
396 |
397 o 6:baf10c5166d4 test
397 o 6:baf10c5166d4 test
398 | g
398 | g
399 |
399 |
400 o 5:6343ca3eff20 test
400 o 5:6343ca3eff20 test
401 | f
401 | f
402 |
402 |
403 | o 4:e860deea161a test
403 | o 4:e860deea161a test
404 | | e
404 | | e
405 | |
405 | |
406 | o 3:055a42cdd887 test
406 | o 3:055a42cdd887 test
407 | | d
407 | | d
408 | |
408 | |
409 | o 2:177f92b77385 test
409 | o 2:177f92b77385 test
410 |/ c
410 |/ c
411 |
411 |
412 o 1:d2ae7f538514 test
412 o 1:d2ae7f538514 test
413 | b
413 | b
414 |
414 |
415 o 0:cb9a9f314b8b test
415 o 0:cb9a9f314b8b test
416 a
416 a
417
417
418 $ hg rebase -s 2 -d 7 -n
418 $ hg rebase -s 2 -d 7 -n
419 starting dry-run rebase; repository will not be changed
419 starting dry-run rebase; repository will not be changed
420 rebasing 2:177f92b77385 "c"
420 rebasing 2:177f92b77385 "c"
421 rebasing 3:055a42cdd887 "d"
421 rebasing 3:055a42cdd887 "d"
422 rebasing 4:e860deea161a "e"
422 rebasing 4:e860deea161a "e"
423 merging e
423 merging e
424 hit a merge conflict
424 hit a merge conflict
425 [1]
425 [1]
426 $ hg diff
426 $ hg diff
427 $ hg status
427 $ hg status
428 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
428 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
429 @ 7:d2c195b28050 test
429 @ 7:d2c195b28050 test
430 | conflict with e
430 | conflict with e
431 |
431 |
432 o 6:baf10c5166d4 test
432 o 6:baf10c5166d4 test
433 | g
433 | g
434 |
434 |
435 o 5:6343ca3eff20 test
435 o 5:6343ca3eff20 test
436 | f
436 | f
437 |
437 |
438 | o 4:e860deea161a test
438 | o 4:e860deea161a test
439 | | e
439 | | e
440 | |
440 | |
441 | o 3:055a42cdd887 test
441 | o 3:055a42cdd887 test
442 | | d
442 | | d
443 | |
443 | |
444 | o 2:177f92b77385 test
444 | o 2:177f92b77385 test
445 |/ c
445 |/ c
446 |
446 |
447 o 1:d2ae7f538514 test
447 o 1:d2ae7f538514 test
448 | b
448 | b
449 |
449 |
450 o 0:cb9a9f314b8b test
450 o 0:cb9a9f314b8b test
451 a
451 a
452
452
453 Check dryrun working with --collapse when there is conflicts
453 Check dryrun working with --collapse when there is conflicts
454 $ hg rebase -s 2 -d 7 -n --collapse
454 $ hg rebase -s 2 -d 7 -n --collapse
455 starting dry-run rebase; repository will not be changed
455 starting dry-run rebase; repository will not be changed
456 rebasing 2:177f92b77385 "c"
456 rebasing 2:177f92b77385 "c"
457 rebasing 3:055a42cdd887 "d"
457 rebasing 3:055a42cdd887 "d"
458 rebasing 4:e860deea161a "e"
458 rebasing 4:e860deea161a "e"
459 merging e
459 merging e
460 hit a merge conflict
460 hit a merge conflict
461 [1]
461 [1]
462
462
463 In-memory rebase that fails due to merge conflicts
463 In-memory rebase that fails due to merge conflicts
464
464
465 $ hg rebase -s 2 -d 7
465 $ hg rebase -s 2 -d 7
466 rebasing 2:177f92b77385 "c"
466 rebasing 2:177f92b77385 "c"
467 rebasing 3:055a42cdd887 "d"
467 rebasing 3:055a42cdd887 "d"
468 rebasing 4:e860deea161a "e"
468 rebasing 4:e860deea161a "e"
469 merging e
469 merging e
470 hit merge conflicts; rebasing that commit again in the working copy
470 hit merge conflicts; rebasing that commit again in the working copy
471 merging e
471 merging e
472 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
472 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
473 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
473 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
474 [240]
474 [240]
475 $ hg rebase --abort
475 $ hg rebase --abort
476 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/c1e524d4287c-f91f82e1-backup.hg
476 saved backup bundle to $TESTTMP/repo3/.hg/strip-backup/c1e524d4287c-f91f82e1-backup.hg
477 rebase aborted
477 rebase aborted
478
478
479 Retrying without in-memory merge won't lose working copy changes
479 Retrying without in-memory merge won't lose working copy changes
480 $ cd ..
480 $ cd ..
481 $ hg clone repo3 repo3-dirty -q
481 $ hg clone repo3 repo3-dirty -q
482 $ cd repo3-dirty
482 $ cd repo3-dirty
483 $ echo dirty > a
483 $ echo dirty > a
484 $ hg rebase -s 2 -d 7
484 $ hg rebase -s 2 -d 7
485 rebasing 2:177f92b77385 "c"
485 rebasing 2:177f92b77385 "c"
486 rebasing 3:055a42cdd887 "d"
486 rebasing 3:055a42cdd887 "d"
487 rebasing 4:e860deea161a "e"
487 rebasing 4:e860deea161a "e"
488 merging e
488 merging e
489 hit merge conflicts; rebasing that commit again in the working copy
489 hit merge conflicts; rebasing that commit again in the working copy
490 transaction abort!
490 transaction abort!
491 rollback completed
491 rollback completed
492 abort: uncommitted changes
492 abort: uncommitted changes
493 [20]
493 [20]
494 $ cat a
494 $ cat a
495 dirty
495 dirty
496 $ hg status -v
496 $ hg status -v
497 M a
497 M a
498
498
499 Retrying without in-memory merge won't lose merge state
499 Retrying without in-memory merge won't lose merge state
500 $ cd ..
500 $ cd ..
501 $ hg clone repo3 repo3-merge-state -q
501 $ hg clone repo3 repo3-merge-state -q
502 $ cd repo3-merge-state
502 $ cd repo3-merge-state
503 $ hg merge 4
503 $ hg merge 4
504 merging e
504 merging e
505 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
505 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
506 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
506 2 files updated, 0 files merged, 0 files removed, 1 files unresolved
507 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
507 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
508 [1]
508 [1]
509 $ hg resolve -l
509 $ hg resolve -l
510 U e
510 U e
511 $ hg rebase -s 2 -d 7
511 $ hg rebase -s 2 -d 7
512 abort: outstanding uncommitted merge
512 abort: outstanding uncommitted merge
513 (use 'hg commit' or 'hg merge --abort')
513 (use 'hg commit' or 'hg merge --abort')
514 [20]
514 [20]
515 $ hg resolve -l
515 $ hg resolve -l
516 U e
516 U e
517
517
518 ==========================
518 ==========================
519 Test for --confirm option|
519 Test for --confirm option|
520 ==========================
520 ==========================
521 $ cd ..
521 $ cd ..
522 $ hg clone repo3 repo4 -q
522 $ hg clone repo3 repo4 -q
523 $ cd repo4
523 $ cd repo4
524 $ hg strip 7 -q
524 $ hg strip 7 -q
525 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
525 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
526 @ 6:baf10c5166d4 test
526 @ 6:baf10c5166d4 test
527 | g
527 | g
528 |
528 |
529 o 5:6343ca3eff20 test
529 o 5:6343ca3eff20 test
530 | f
530 | f
531 |
531 |
532 | o 4:e860deea161a test
532 | o 4:e860deea161a test
533 | | e
533 | | e
534 | |
534 | |
535 | o 3:055a42cdd887 test
535 | o 3:055a42cdd887 test
536 | | d
536 | | d
537 | |
537 | |
538 | o 2:177f92b77385 test
538 | o 2:177f92b77385 test
539 |/ c
539 |/ c
540 |
540 |
541 o 1:d2ae7f538514 test
541 o 1:d2ae7f538514 test
542 | b
542 | b
543 |
543 |
544 o 0:cb9a9f314b8b test
544 o 0:cb9a9f314b8b test
545 a
545 a
546
546
547 Check it gives error when both --dryrun and --confirm is used:
547 Check it gives error when both --dryrun and --confirm is used:
548 $ hg rebase -s 2 -d . --confirm --dry-run
548 $ hg rebase -s 2 -d . --confirm --dry-run
549 abort: cannot specify both --confirm and --dry-run
549 abort: cannot specify both --confirm and --dry-run
550 [10]
550 [10]
551 $ hg rebase -s 2 -d . --confirm --abort
551 $ hg rebase -s 2 -d . --confirm --abort
552 abort: cannot specify both --abort and --confirm
552 abort: cannot specify both --abort and --confirm
553 [10]
553 [10]
554 $ hg rebase -s 2 -d . --confirm --continue
554 $ hg rebase -s 2 -d . --confirm --continue
555 abort: cannot specify both --continue and --confirm
555 abort: cannot specify both --continue and --confirm
556 [10]
556 [10]
557
557
558 Test --confirm option when there are no conflicts:
558 Test --confirm option when there are no conflicts:
559 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
559 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
560 > n
560 > n
561 > EOF
561 > EOF
562 starting in-memory rebase
562 starting in-memory rebase
563 rebasing 2:177f92b77385 "c"
563 rebasing 2:177f92b77385 "c"
564 rebasing 3:055a42cdd887 "d"
564 rebasing 3:055a42cdd887 "d"
565 rebasing 4:e860deea161a "e"
565 rebasing 4:e860deea161a "e"
566 rebase completed successfully
566 rebase completed successfully
567 apply changes (yn)? n
567 apply changes (yn)? n
568 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
568 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
569 @ 6:baf10c5166d4 test
569 @ 6:baf10c5166d4 test
570 | g
570 | g
571 |
571 |
572 o 5:6343ca3eff20 test
572 o 5:6343ca3eff20 test
573 | f
573 | f
574 |
574 |
575 | o 4:e860deea161a test
575 | o 4:e860deea161a test
576 | | e
576 | | e
577 | |
577 | |
578 | o 3:055a42cdd887 test
578 | o 3:055a42cdd887 test
579 | | d
579 | | d
580 | |
580 | |
581 | o 2:177f92b77385 test
581 | o 2:177f92b77385 test
582 |/ c
582 |/ c
583 |
583 |
584 o 1:d2ae7f538514 test
584 o 1:d2ae7f538514 test
585 | b
585 | b
586 |
586 |
587 o 0:cb9a9f314b8b test
587 o 0:cb9a9f314b8b test
588 a
588 a
589
589
590 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
590 $ hg rebase -s 2 -d . --keep --config ui.interactive=True --confirm << EOF
591 > y
591 > y
592 > EOF
592 > EOF
593 starting in-memory rebase
593 starting in-memory rebase
594 rebasing 2:177f92b77385 "c"
594 rebasing 2:177f92b77385 "c"
595 rebasing 3:055a42cdd887 "d"
595 rebasing 3:055a42cdd887 "d"
596 rebasing 4:e860deea161a "e"
596 rebasing 4:e860deea161a "e"
597 rebase completed successfully
597 rebase completed successfully
598 apply changes (yn)? y
598 apply changes (yn)? y
599 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
599 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
600 o 9:9fd28f55f6dc test
600 o 9:9fd28f55f6dc test
601 | e
601 | e
602 |
602 |
603 o 8:12cbf031f469 test
603 o 8:12cbf031f469 test
604 | d
604 | d
605 |
605 |
606 o 7:c83b1da5b1ae test
606 o 7:c83b1da5b1ae test
607 | c
607 | c
608 |
608 |
609 @ 6:baf10c5166d4 test
609 @ 6:baf10c5166d4 test
610 | g
610 | g
611 |
611 |
612 o 5:6343ca3eff20 test
612 o 5:6343ca3eff20 test
613 | f
613 | f
614 |
614 |
615 | o 4:e860deea161a test
615 | o 4:e860deea161a test
616 | | e
616 | | e
617 | |
617 | |
618 | o 3:055a42cdd887 test
618 | o 3:055a42cdd887 test
619 | | d
619 | | d
620 | |
620 | |
621 | o 2:177f92b77385 test
621 | o 2:177f92b77385 test
622 |/ c
622 |/ c
623 |
623 |
624 o 1:d2ae7f538514 test
624 o 1:d2ae7f538514 test
625 | b
625 | b
626 |
626 |
627 o 0:cb9a9f314b8b test
627 o 0:cb9a9f314b8b test
628 a
628 a
629
629
630 Test --confirm option when there is a conflict
630 Test --confirm option when there is a conflict
631 $ hg up tip -q
631 $ hg up tip -q
632 $ echo ee>e
632 $ echo ee>e
633 $ hg ci --amend -m "conflict with e" -q
633 $ hg ci --amend -m "conflict with e" -q
634 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
634 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
635 @ 9:906d72f66a59 test
635 @ 9:906d72f66a59 test
636 | conflict with e
636 | conflict with e
637 |
637 |
638 o 8:12cbf031f469 test
638 o 8:12cbf031f469 test
639 | d
639 | d
640 |
640 |
641 o 7:c83b1da5b1ae test
641 o 7:c83b1da5b1ae test
642 | c
642 | c
643 |
643 |
644 o 6:baf10c5166d4 test
644 o 6:baf10c5166d4 test
645 | g
645 | g
646 |
646 |
647 o 5:6343ca3eff20 test
647 o 5:6343ca3eff20 test
648 | f
648 | f
649 |
649 |
650 | o 4:e860deea161a test
650 | o 4:e860deea161a test
651 | | e
651 | | e
652 | |
652 | |
653 | o 3:055a42cdd887 test
653 | o 3:055a42cdd887 test
654 | | d
654 | | d
655 | |
655 | |
656 | o 2:177f92b77385 test
656 | o 2:177f92b77385 test
657 |/ c
657 |/ c
658 |
658 |
659 o 1:d2ae7f538514 test
659 o 1:d2ae7f538514 test
660 | b
660 | b
661 |
661 |
662 o 0:cb9a9f314b8b test
662 o 0:cb9a9f314b8b test
663 a
663 a
664
664
665 $ hg rebase -s 4 -d . --keep --confirm
665 $ hg rebase -s 4 -d . --keep --confirm
666 starting in-memory rebase
666 starting in-memory rebase
667 rebasing 4:e860deea161a "e"
667 rebasing 4:e860deea161a "e"
668 merging e
668 merging e
669 hit a merge conflict
669 hit a merge conflict
670 [1]
670 [1]
671 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
671 $ hg log -G --template "{rev}:{short(node)} {person(author)}\n{firstline(desc)} {topic}\n\n"
672 @ 9:906d72f66a59 test
672 @ 9:906d72f66a59 test
673 | conflict with e
673 | conflict with e
674 |
674 |
675 o 8:12cbf031f469 test
675 o 8:12cbf031f469 test
676 | d
676 | d
677 |
677 |
678 o 7:c83b1da5b1ae test
678 o 7:c83b1da5b1ae test
679 | c
679 | c
680 |
680 |
681 o 6:baf10c5166d4 test
681 o 6:baf10c5166d4 test
682 | g
682 | g
683 |
683 |
684 o 5:6343ca3eff20 test
684 o 5:6343ca3eff20 test
685 | f
685 | f
686 |
686 |
687 | o 4:e860deea161a test
687 | o 4:e860deea161a test
688 | | e
688 | | e
689 | |
689 | |
690 | o 3:055a42cdd887 test
690 | o 3:055a42cdd887 test
691 | | d
691 | | d
692 | |
692 | |
693 | o 2:177f92b77385 test
693 | o 2:177f92b77385 test
694 |/ c
694 |/ c
695 |
695 |
696 o 1:d2ae7f538514 test
696 o 1:d2ae7f538514 test
697 | b
697 | b
698 |
698 |
699 o 0:cb9a9f314b8b test
699 o 0:cb9a9f314b8b test
700 a
700 a
701
701
702 Test a metadata-only in-memory merge
702 Test a metadata-only in-memory merge
703 $ cd $TESTTMP
703 $ cd $TESTTMP
704 $ hg init no_exception
704 $ hg init no_exception
705 $ cd no_exception
705 $ cd no_exception
706 # Produce the following graph:
706 # Produce the following graph:
707 # o 'add +x to foo.txt'
707 # o 'add +x to foo.txt'
708 # | o r1 (adds bar.txt, just for something to rebase to)
708 # | o r1 (adds bar.txt, just for something to rebase to)
709 # |/
709 # |/
710 # o r0 (adds foo.txt, no +x)
710 # o r0 (adds foo.txt, no +x)
711 $ echo hi > foo.txt
711 $ echo hi > foo.txt
712 $ hg ci -qAm r0
712 $ hg ci -qAm r0
713 $ echo hi > bar.txt
713 $ echo hi > bar.txt
714 $ hg ci -qAm r1
714 $ hg ci -qAm r1
715 $ hg co -qr ".^"
715 $ hg co -qr ".^"
716 $ chmod +x foo.txt
716 $ chmod +x foo.txt
717 $ hg ci -qAm 'add +x to foo.txt'
717 $ hg ci -qAm 'add +x to foo.txt'
718 issue5960: this was raising an AttributeError exception
718 issue5960: this was raising an AttributeError exception
719 $ hg rebase -r . -d 1
719 $ hg rebase -r . -d 1
720 rebasing 2:539b93e77479 tip "add +x to foo.txt"
720 rebasing 2:539b93e77479 tip "add +x to foo.txt"
721 saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob)
721 saved backup bundle to $TESTTMP/no_exception/.hg/strip-backup/*.hg (glob)
722 $ hg diff -c tip
722 $ hg diff -c tip
723 diff --git a/foo.txt b/foo.txt
723 diff --git a/foo.txt b/foo.txt
724 old mode 100644
724 old mode 100644
725 new mode 100755
725 new mode 100755
726
726
727 Test rebasing a commit with copy information, but no content changes
727 Test rebasing a commit with copy information, but no content changes
728
728
729 $ cd ..
729 $ cd ..
730 $ hg clone -q repo1 merge-and-rename
730 $ hg clone -q repo1 merge-and-rename
731 $ cd merge-and-rename
731 $ cd merge-and-rename
732 $ cat << EOF >> .hg/hgrc
732 $ cat << EOF >> .hg/hgrc
733 > [experimental]
733 > [experimental]
734 > evolution.createmarkers=True
734 > evolution.createmarkers=True
735 > evolution.allowunstable=True
735 > evolution.allowunstable=True
736 > EOF
736 > EOF
737 $ hg co -q 1
737 $ hg co -q 1
738 $ hg mv d e
738 $ hg mv d e
739 $ hg ci -qm 'rename d to e'
739 $ hg ci -qm 'rename d to e'
740 $ hg co -q 3
740 $ hg co -q 3
741 $ hg merge -q 4
741 $ hg merge -q 4
742 $ hg ci -m 'merge'
742 $ hg ci -m 'merge'
743 $ hg co -q 2
743 $ hg co -q 2
744 $ mv d e
744 $ mv d e
745 $ hg addremove -qs 0
745 $ hg addremove -qs 0
746 $ hg ci -qm 'untracked rename of d to e'
746 $ hg ci -qm 'untracked rename of d to e'
747 $ hg debugobsolete -q `hg log -T '{node}' -r 4` `hg log -T '{node}' -r .`
747 $ hg debugobsolete -q `hg log -T '{node}' -r 4` `hg log -T '{node}' -r .`
748 1 new orphan changesets
748 1 new orphan changesets
749 $ hg tglog
749 $ hg tglog
750 @ 6: 676538af172d 'untracked rename of d to e'
750 @ 6: 676538af172d 'untracked rename of d to e'
751 |
751 |
752 | * 5: 574d92ad16fc 'merge'
752 | * 5: 574d92ad16fc 'merge'
753 | |\
753 | |\
754 | | x 4: 2c8b5dad7956 'rename d to e'
754 | | x 4: 2c8b5dad7956 'rename d to e'
755 | | |
755 | | |
756 | o | 3: ca58782ad1e4 'b'
756 | o | 3: ca58782ad1e4 'b'
757 |/ /
757 |/ /
758 o / 2: 814f6bd05178 'c'
758 o / 2: 814f6bd05178 'c'
759 |/
759 |/
760 o 1: 02952614a83d 'd'
760 o 1: 02952614a83d 'd'
761 |
761 |
762 o 0: b173517d0057 'a'
762 o 0: b173517d0057 'a'
763
763
764 $ hg rebase -b 5 -d tip
764 $ hg rebase -b 5 -d tip
765 rebasing 3:ca58782ad1e4 "b"
765 rebasing 3:ca58782ad1e4 "b"
766 rebasing 5:574d92ad16fc "merge"
766 rebasing 5:574d92ad16fc "merge"
767 note: not rebasing 5:574d92ad16fc "merge", its destination already has all its changes
767 note: not rebasing 5:574d92ad16fc "merge", its destination already has all its changes
768
768
769 $ cd ..
769 $ cd ..
770
770
771 Test rebasing a commit with copy information
771 Test rebasing a commit with copy information
772
772
773 $ hg init rebase-rename
773 $ hg init rebase-rename
774 $ cd rebase-rename
774 $ cd rebase-rename
775 $ echo a > a
775 $ echo a > a
776 $ hg ci -Aqm 'add a'
776 $ hg ci -Aqm 'add a'
777 $ echo a2 > a
777 $ echo a2 > a
778 $ hg ci -m 'modify a'
778 $ hg ci -m 'modify a'
779 $ hg co -q 0
779 $ hg co -q 0
780 $ hg mv a b
780 $ hg mv a b
781 $ hg ci -qm 'rename a to b'
781 $ hg ci -qm 'rename a to b'
782 $ hg rebase -d 1
782 $ hg rebase -d 1
783 rebasing 2:b977edf6f839 tip "rename a to b"
783 rebasing 2:b977edf6f839 tip "rename a to b"
784 merging a and b to b
784 merging a and b to b
785 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
785 saved backup bundle to $TESTTMP/rebase-rename/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
786 $ hg st --copies --change .
786 $ hg st --copies --change .
787 A b
787 A b
788 a
788 a
789 R a
789 R a
790 $ cd ..
790 $ cd ..
791
791
792 Test rebasing a commit with copy information, where the target is empty
792 Test rebasing a commit with copy information, where the target is empty
793
793
794 $ hg init rebase-rename-empty
794 $ hg init rebase-rename-empty
795 $ cd rebase-rename-empty
795 $ cd rebase-rename-empty
796 $ echo a > a
796 $ echo a > a
797 $ hg ci -Aqm 'add a'
797 $ hg ci -Aqm 'add a'
798 $ cat > a
798 $ cat > a
799 $ hg ci -m 'make a empty'
799 $ hg ci -m 'make a empty'
800 $ hg co -q 0
800 $ hg co -q 0
801 $ hg mv a b
801 $ hg mv a b
802 $ hg ci -qm 'rename a to b'
802 $ hg ci -qm 'rename a to b'
803 $ hg rebase -d 1
803 $ hg rebase -d 1
804 rebasing 2:b977edf6f839 tip "rename a to b"
804 rebasing 2:b977edf6f839 tip "rename a to b"
805 merging a and b to b
805 merging a and b to b
806 saved backup bundle to $TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
806 saved backup bundle to $TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
807 $ hg st --copies --change .
807 $ hg st --copies --change .
808 A b
808 A b
809 a
809 a
810 R a
810 R a
811 $ cd ..
811 $ cd ..
812 Rebase across a copy with --collapse
812 Rebase across a copy with --collapse
813
813
814 $ hg init rebase-rename-collapse
814 $ hg init rebase-rename-collapse
815 $ cd rebase-rename-collapse
815 $ cd rebase-rename-collapse
816 $ echo a > a
816 $ echo a > a
817 $ hg ci -Aqm 'add a'
817 $ hg ci -Aqm 'add a'
818 $ hg mv a b
818 $ hg mv a b
819 $ hg ci -m 'rename a to b'
819 $ hg ci -m 'rename a to b'
820 $ hg co -q 0
820 $ hg co -q 0
821 $ echo a2 > a
821 $ echo a2 > a
822 $ hg ci -qm 'modify a'
822 $ hg ci -qm 'modify a'
823 $ hg rebase -r . -d 1 --collapse
823 $ hg rebase -r . -d 1 --collapse
824 rebasing 2:41c4ea50d4cf tip "modify a"
824 rebasing 2:41c4ea50d4cf tip "modify a"
825 merging b and a to b
825 merging b and a to b
826 saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg
826 saved backup bundle to $TESTTMP/rebase-rename-collapse/.hg/strip-backup/41c4ea50d4cf-b90b7994-rebase.hg
827 $ cd ..
827 $ cd ..
828
828
829 Test rebasing when the file we are merging in destination is empty
829 Test rebasing when the file we are merging in destination is empty
830
830
831 $ hg init test
831 $ hg init test
832 $ cd test
832 $ cd test
833 $ echo a > foo
833 $ echo a > foo
834 $ hg ci -Aqm 'added a to foo'
834 $ hg ci -Aqm 'added a to foo'
835
835
836 $ rm foo
836 $ rm foo
837 $ touch foo
837 $ touch foo
838 $ hg di
838 $ hg di
839 diff --git a/foo b/foo
839 diff --git a/foo b/foo
840 --- a/foo
840 --- a/foo
841 +++ b/foo
841 +++ b/foo
842 @@ -1,1 +0,0 @@
842 @@ -1,1 +0,0 @@
843 -a
843 -a
844
844
845 $ hg ci -m "make foo an empty file"
845 $ hg ci -m "make foo an empty file"
846
846
847 $ hg up '.^'
847 $ hg up '.^'
848 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
848 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
849 $ echo b > foo
849 $ echo b > foo
850 $ hg di
850 $ hg di
851 diff --git a/foo b/foo
851 diff --git a/foo b/foo
852 --- a/foo
852 --- a/foo
853 +++ b/foo
853 +++ b/foo
854 @@ -1,1 +1,1 @@
854 @@ -1,1 +1,1 @@
855 -a
855 -a
856 +b
856 +b
857 $ hg ci -m "add b to foo"
857 $ hg ci -m "add b to foo"
858 created new head
858 created new head
859
859
860 $ hg rebase -r . -d 1 --config ui.merge=internal:merge3
860 $ hg rebase -r . -d 1 --config ui.merge=internal:merge3
861 rebasing 2:fb62b706688e tip "add b to foo"
861 rebasing 2:fb62b706688e tip "add b to foo"
862 merging foo
862 merging foo
863 hit merge conflicts; rebasing that commit again in the working copy
863 hit merge conflicts; rebasing that commit again in the working copy
864 merging foo
864 merging foo
865 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
865 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
866 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
866 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
867 [240]
867 [240]
868
868
869 $ cd $TESTTMP
869 $ cd $TESTTMP
870
870
871 Test rebasing when we're in the middle of a rebase already
871 Test rebasing when we're in the middle of a rebase already
872 $ hg init test_issue6214
872 $ hg init test_issue6214
873 $ cd test_issue6214
873 $ cd test_issue6214
874 $ echo r0 > r0
874 $ echo r0 > r0
875 $ hg ci -qAm 'r0'
875 $ hg ci -qAm 'r0'
876 $ echo hi > foo
876 $ echo hi > foo
877 $ hg ci -qAm 'hi from foo'
877 $ hg ci -qAm 'hi from foo'
878 $ hg co -q '.^'
878 $ hg co -q '.^'
879 $ echo bye > foo
879 $ echo bye > foo
880 $ hg ci -qAm 'bye from foo'
880 $ hg ci -qAm 'bye from foo'
881 $ hg co -q '.^'
881 $ hg co -q '.^'
882 $ echo unrelated > some_other_file
882 $ echo unrelated > some_other_file
883 $ hg ci -qAm 'some unrelated changes'
883 $ hg ci -qAm 'some unrelated changes'
884 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
884 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
885 @ 3: some unrelated changes
885 @ 3: some unrelated changes
886 | some_other_file
886 | some_other_file
887 | o 2: bye from foo
887 | o 2: bye from foo
888 |/ foo
888 |/ foo
889 | o 1: hi from foo
889 | o 1: hi from foo
890 |/ foo
890 |/ foo
891 o 0: r0
891 o 0: r0
892 r0
892 r0
893 $ hg rebase -r 2 -d 1 -t:merge3
893 $ hg rebase -r 2 -d 1 -t:merge3
894 rebasing 2:b4d249fbf8dd "bye from foo"
894 rebasing 2:b4d249fbf8dd "bye from foo"
895 merging foo
895 merging foo
896 hit merge conflicts; rebasing that commit again in the working copy
896 hit merge conflicts; rebasing that commit again in the working copy
897 merging foo
897 merging foo
898 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
898 warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
899 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
899 unresolved conflicts (see 'hg resolve', then 'hg rebase --continue')
900 [240]
900 [240]
901 $ hg rebase -r 3 -d 1 -t:merge3
901 $ hg rebase -r 3 -d 1 -t:merge3
902 abort: rebase in progress
902 abort: rebase in progress
903 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
903 (use 'hg rebase --continue', 'hg rebase --abort', or 'hg rebase --stop')
904 [20]
904 [20]
905 $ hg resolve --list
905 $ hg resolve --list
906 U foo
906 U foo
907 $ hg resolve --all --re-merge -t:other
907 $ hg resolve --all --re-merge -t:other
908 (no more unresolved files)
908 (no more unresolved files)
909 continue: hg rebase --continue
909 continue: hg rebase --continue
910 $ hg rebase --continue
910 $ hg rebase --continue
911 rebasing 2:b4d249fbf8dd "bye from foo"
911 rebasing 2:b4d249fbf8dd "bye from foo"
912 saved backup bundle to $TESTTMP/test_issue6214/.hg/strip-backup/b4d249fbf8dd-299ec25c-rebase.hg
912 saved backup bundle to $TESTTMP/test_issue6214/.hg/strip-backup/b4d249fbf8dd-299ec25c-rebase.hg
913 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
913 $ hg log -G -T'{rev}: {desc}\n{files%"{file}\n"}'
914 o 3: bye from foo
914 o 3: bye from foo
915 | foo
915 | foo
916 | @ 2: some unrelated changes
916 | @ 2: some unrelated changes
917 | | some_other_file
917 | | some_other_file
918 o | 1: hi from foo
918 o | 1: hi from foo
919 |/ foo
919 |/ foo
920 o 0: r0
920 o 0: r0
921 r0
921 r0
922
922
923 $ cd ..
923 $ cd ..
924
924
925 Changesets that become empty should not be committed. Merges are not empty by
925 Changesets that become empty should not be committed. Merges are not empty by
926 definition.
926 definition.
927
927
928 $ hg init keep_merge
928 $ hg init keep_merge
929 $ cd keep_merge
929 $ cd keep_merge
930 $ echo base > base; hg add base; hg ci -m base
930 $ echo base > base; hg add base; hg ci -m base
931 $ echo test > test; hg add test; hg ci -m a
931 $ echo test > test; hg add test; hg ci -m a
932 $ hg up 0 -q
932 $ hg up 0 -q
933 $ echo test > test; hg add test; hg ci -m b -q
933 $ echo test > test; hg add test; hg ci -m b -q
934 $ hg up 0 -q
934 $ hg up 0 -q
935 $ echo test > test; hg add test; hg ci -m c -q
935 $ echo test > test; hg add test; hg ci -m c -q
936 $ hg up 1 -q
936 $ hg up 1 -q
937 $ hg merge 2 -q
937 $ hg merge 2 -q
938 $ hg ci -m merge
938 $ hg ci -m merge
939 $ hg up null -q
939 $ hg up null -q
940 $ hg tglog
940 $ hg tglog
941 o 4: 59c8292117b1 'merge'
941 o 4: 59c8292117b1 'merge'
942 |\
942 |\
943 | | o 3: 531f80391e4a 'c'
943 | | o 3: 531f80391e4a 'c'
944 | | |
944 | | |
945 | o | 2: 0194f1db184a 'b'
945 | o | 2: 0194f1db184a 'b'
946 | |/
946 | |/
947 o / 1: 6f252845ea45 'a'
947 o / 1: 6f252845ea45 'a'
948 |/
948 |/
949 o 0: d20a80d4def3 'base'
949 o 0: d20a80d4def3 'base'
950
950
951 $ hg rebase -s 2 -d 3
951 $ hg rebase -s 2 -d 3
952 rebasing 2:0194f1db184a "b"
952 rebasing 2:0194f1db184a "b"
953 note: not rebasing 2:0194f1db184a "b", its destination already has all its changes
953 note: not rebasing 2:0194f1db184a "b", its destination already has all its changes
954 rebasing 4:59c8292117b1 tip "merge"
954 rebasing 4:59c8292117b1 tip "merge"
955 saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/0194f1db184a-aee31d03-rebase.hg
955 saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/0194f1db184a-aee31d03-rebase.hg
956 $ hg tglog
956 $ hg tglog
957 o 3: 506e2454484b 'merge'
957 o 3: 506e2454484b 'merge'
958 |\
958 |\
959 | o 2: 531f80391e4a 'c'
959 | o 2: 531f80391e4a 'c'
960 | |
960 | |
961 o | 1: 6f252845ea45 'a'
961 o | 1: 6f252845ea45 'a'
962 |/
962 |/
963 o 0: d20a80d4def3 'base'
963 o 0: d20a80d4def3 'base'
964
964
965
965
966 Test that update_hash_refs works.
966 Test that update_hash_refs works.
967 $ hg co 0
967 $ hg co 0
968 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
968 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
969 $ echo update_hash_refs > update_hash_refs
969 $ echo update_hash_refs > update_hash_refs
970 $ hg add update_hash_refs
970 $ hg add update_hash_refs
971 $ hg ci -m 'this will change hash'
971 $ hg ci -m 'this will change hash'
972 created new head
972 created new head
973 $ echo changed >> update_hash_refs
973 $ echo changed >> update_hash_refs
974 $ hg ci -m "this starts as the child of `hg log -r . -T'{node|short}'` but not 506e2454484b"
974 $ hg ci -m "this starts as the child of `hg log -r . -T'{node|short}'` but not 506e2454484b. Also, ffffffffffffffff"
975 $ hg tglog
975 $ hg tglog
976 @ 5: becd28036887 'this starts as the child of 98789aa60148 but not 506e2454484b'
976 @ 5: a8b42cbbde83 'this starts as the child of 98789aa60148 but not 506e2454484b. Also, ffffffffffffffff'
977 |
977 |
978 o 4: 98789aa60148 'this will change hash'
978 o 4: 98789aa60148 'this will change hash'
979 |
979 |
980 | o 3: 506e2454484b 'merge'
980 | o 3: 506e2454484b 'merge'
981 | |\
981 | |\
982 +---o 2: 531f80391e4a 'c'
982 +---o 2: 531f80391e4a 'c'
983 | |
983 | |
984 | o 1: 6f252845ea45 'a'
984 | o 1: 6f252845ea45 'a'
985 |/
985 |/
986 o 0: d20a80d4def3 'base'
986 o 0: d20a80d4def3 'base'
987
987
988 $ hg rebase -r '.^::' -d 3
988 $ hg rebase -r '.^::' -d 3
989 rebasing 4:98789aa60148 "this will change hash"
989 rebasing 4:98789aa60148 "this will change hash"
990 rebasing 5:becd28036887 tip "this starts as the child of 98789aa60148 but not 506e2454484b"
990 rebasing 5:a8b42cbbde83 tip "this starts as the child of 98789aa60148 but not 506e2454484b. Also, ffffffffffffffff"
991 saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/98789aa60148-72ec40bd-rebase.hg
991 saved backup bundle to $TESTTMP/keep_merge/.hg/strip-backup/98789aa60148-da3f4c2c-rebase.hg
992 $ hg tglog
992 $ hg tglog
993 @ 5: a445b8426f4b 'this starts as the child of c16c25696fe7 but not 506e2454484b'
993 @ 5: 0fd2912e6cc1 'this starts as the child of c16c25696fe7 but not 506e2454484b. Also, ffffffffffffffff'
994 |
994 |
995 o 4: c16c25696fe7 'this will change hash'
995 o 4: c16c25696fe7 'this will change hash'
996 |
996 |
997 o 3: 506e2454484b 'merge'
997 o 3: 506e2454484b 'merge'
998 |\
998 |\
999 | o 2: 531f80391e4a 'c'
999 | o 2: 531f80391e4a 'c'
1000 | |
1000 | |
1001 o | 1: 6f252845ea45 'a'
1001 o | 1: 6f252845ea45 'a'
1002 |/
1002 |/
1003 o 0: d20a80d4def3 'base'
1003 o 0: d20a80d4def3 'base'
1004
1004
1005
1005
1006 $ cd ..
1006 $ cd ..
1007
1007
1008 Test (virtual) working directory without changes, created by merge conflict
1008 Test (virtual) working directory without changes, created by merge conflict
1009 resolution. There was a regression where the file was incorrectly detected as
1009 resolution. There was a regression where the file was incorrectly detected as
1010 changed although the file contents were the same as in the parent.
1010 changed although the file contents were the same as in the parent.
1011
1011
1012 $ hg init nofilechanges
1012 $ hg init nofilechanges
1013 $ cd nofilechanges
1013 $ cd nofilechanges
1014 $ echo a > a; hg add a; hg ci -m a
1014 $ echo a > a; hg add a; hg ci -m a
1015 $ echo foo > test; hg add test; hg ci -m b
1015 $ echo foo > test; hg add test; hg ci -m b
1016 $ hg up 0 -q
1016 $ hg up 0 -q
1017 $ echo bar > test; hg add test; hg ci -m c
1017 $ echo bar > test; hg add test; hg ci -m c
1018 created new head
1018 created new head
1019 $ hg rebase -d 2 -d 1 --tool :local
1019 $ hg rebase -d 2 -d 1 --tool :local
1020 rebasing 2:ca2749322ee5 tip "c"
1020 rebasing 2:ca2749322ee5 tip "c"
1021 note: not rebasing 2:ca2749322ee5 tip "c", its destination already has all its changes
1021 note: not rebasing 2:ca2749322ee5 tip "c", its destination already has all its changes
1022 saved backup bundle to $TESTTMP/nofilechanges/.hg/strip-backup/ca2749322ee5-6dc7e94b-rebase.hg
1022 saved backup bundle to $TESTTMP/nofilechanges/.hg/strip-backup/ca2749322ee5-6dc7e94b-rebase.hg
General Comments 0
You need to be logged in to leave comments. Login now