##// END OF EJS Templates
copies: calculate mergecopies() based on pathcopies()...
Martin von Zweigbergk -
r42408:57203e02 default
parent child Browse files
Show More
@@ -1,1018 +1,796 b''
1 # copies.py - copy detection for Mercurial
1 # copies.py - copy detection for Mercurial
2 #
2 #
3 # Copyright 2008 Matt Mackall <mpm@selenic.com>
3 # Copyright 2008 Matt Mackall <mpm@selenic.com>
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 collections
10 import collections
11 import heapq
11 import heapq
12 import os
12 import os
13
13
14 from .i18n import _
14 from .i18n import _
15
15
16 from . import (
16 from . import (
17 match as matchmod,
17 match as matchmod,
18 node,
18 node,
19 pathutil,
19 pathutil,
20 util,
20 util,
21 )
21 )
22 from .utils import (
22 from .utils import (
23 stringutil,
23 stringutil,
24 )
24 )
25
25
26 def _findlimit(repo, ctxa, ctxb):
26 def _findlimit(repo, ctxa, ctxb):
27 """
27 """
28 Find the last revision that needs to be checked to ensure that a full
28 Find the last revision that needs to be checked to ensure that a full
29 transitive closure for file copies can be properly calculated.
29 transitive closure for file copies can be properly calculated.
30 Generally, this means finding the earliest revision number that's an
30 Generally, this means finding the earliest revision number that's an
31 ancestor of a or b but not both, except when a or b is a direct descendent
31 ancestor of a or b but not both, except when a or b is a direct descendent
32 of the other, in which case we can return the minimum revnum of a and b.
32 of the other, in which case we can return the minimum revnum of a and b.
33 """
33 """
34
34
35 # basic idea:
35 # basic idea:
36 # - mark a and b with different sides
36 # - mark a and b with different sides
37 # - if a parent's children are all on the same side, the parent is
37 # - if a parent's children are all on the same side, the parent is
38 # on that side, otherwise it is on no side
38 # on that side, otherwise it is on no side
39 # - walk the graph in topological order with the help of a heap;
39 # - walk the graph in topological order with the help of a heap;
40 # - add unseen parents to side map
40 # - add unseen parents to side map
41 # - clear side of any parent that has children on different sides
41 # - clear side of any parent that has children on different sides
42 # - track number of interesting revs that might still be on a side
42 # - track number of interesting revs that might still be on a side
43 # - track the lowest interesting rev seen
43 # - track the lowest interesting rev seen
44 # - quit when interesting revs is zero
44 # - quit when interesting revs is zero
45
45
46 cl = repo.changelog
46 cl = repo.changelog
47 wdirparents = None
47 wdirparents = None
48 a = ctxa.rev()
48 a = ctxa.rev()
49 b = ctxb.rev()
49 b = ctxb.rev()
50 if a is None:
50 if a is None:
51 wdirparents = (ctxa.p1(), ctxa.p2())
51 wdirparents = (ctxa.p1(), ctxa.p2())
52 a = node.wdirrev
52 a = node.wdirrev
53 if b is None:
53 if b is None:
54 assert not wdirparents
54 assert not wdirparents
55 wdirparents = (ctxb.p1(), ctxb.p2())
55 wdirparents = (ctxb.p1(), ctxb.p2())
56 b = node.wdirrev
56 b = node.wdirrev
57
57
58 side = {a: -1, b: 1}
58 side = {a: -1, b: 1}
59 visit = [-a, -b]
59 visit = [-a, -b]
60 heapq.heapify(visit)
60 heapq.heapify(visit)
61 interesting = len(visit)
61 interesting = len(visit)
62 limit = node.wdirrev
62 limit = node.wdirrev
63
63
64 while interesting:
64 while interesting:
65 r = -heapq.heappop(visit)
65 r = -heapq.heappop(visit)
66 if r == node.wdirrev:
66 if r == node.wdirrev:
67 parents = [pctx.rev() for pctx in wdirparents]
67 parents = [pctx.rev() for pctx in wdirparents]
68 else:
68 else:
69 parents = cl.parentrevs(r)
69 parents = cl.parentrevs(r)
70 if parents[1] == node.nullrev:
70 if parents[1] == node.nullrev:
71 parents = parents[:1]
71 parents = parents[:1]
72 for p in parents:
72 for p in parents:
73 if p not in side:
73 if p not in side:
74 # first time we see p; add it to visit
74 # first time we see p; add it to visit
75 side[p] = side[r]
75 side[p] = side[r]
76 if side[p]:
76 if side[p]:
77 interesting += 1
77 interesting += 1
78 heapq.heappush(visit, -p)
78 heapq.heappush(visit, -p)
79 elif side[p] and side[p] != side[r]:
79 elif side[p] and side[p] != side[r]:
80 # p was interesting but now we know better
80 # p was interesting but now we know better
81 side[p] = 0
81 side[p] = 0
82 interesting -= 1
82 interesting -= 1
83 if side[r]:
83 if side[r]:
84 limit = r # lowest rev visited
84 limit = r # lowest rev visited
85 interesting -= 1
85 interesting -= 1
86
86
87 # Consider the following flow (see test-commit-amend.t under issue4405):
87 # Consider the following flow (see test-commit-amend.t under issue4405):
88 # 1/ File 'a0' committed
88 # 1/ File 'a0' committed
89 # 2/ File renamed from 'a0' to 'a1' in a new commit (call it 'a1')
89 # 2/ File renamed from 'a0' to 'a1' in a new commit (call it 'a1')
90 # 3/ Move back to first commit
90 # 3/ Move back to first commit
91 # 4/ Create a new commit via revert to contents of 'a1' (call it 'a1-amend')
91 # 4/ Create a new commit via revert to contents of 'a1' (call it 'a1-amend')
92 # 5/ Rename file from 'a1' to 'a2' and commit --amend 'a1-msg'
92 # 5/ Rename file from 'a1' to 'a2' and commit --amend 'a1-msg'
93 #
93 #
94 # During the amend in step five, we will be in this state:
94 # During the amend in step five, we will be in this state:
95 #
95 #
96 # @ 3 temporary amend commit for a1-amend
96 # @ 3 temporary amend commit for a1-amend
97 # |
97 # |
98 # o 2 a1-amend
98 # o 2 a1-amend
99 # |
99 # |
100 # | o 1 a1
100 # | o 1 a1
101 # |/
101 # |/
102 # o 0 a0
102 # o 0 a0
103 #
103 #
104 # When _findlimit is called, a and b are revs 3 and 0, so limit will be 2,
104 # When _findlimit is called, a and b are revs 3 and 0, so limit will be 2,
105 # yet the filelog has the copy information in rev 1 and we will not look
105 # yet the filelog has the copy information in rev 1 and we will not look
106 # back far enough unless we also look at the a and b as candidates.
106 # back far enough unless we also look at the a and b as candidates.
107 # This only occurs when a is a descendent of b or visa-versa.
107 # This only occurs when a is a descendent of b or visa-versa.
108 return min(limit, a, b)
108 return min(limit, a, b)
109
109
110 def _chain(src, dst, a, b):
110 def _chain(src, dst, a, b):
111 """chain two sets of copies a->b"""
111 """chain two sets of copies a->b"""
112 t = a.copy()
112 t = a.copy()
113 for k, v in b.iteritems():
113 for k, v in b.iteritems():
114 if v in t:
114 if v in t:
115 # found a chain
115 # found a chain
116 if t[v] != k:
116 if t[v] != k:
117 # file wasn't renamed back to itself
117 # file wasn't renamed back to itself
118 t[k] = t[v]
118 t[k] = t[v]
119 if v not in dst:
119 if v not in dst:
120 # chain was a rename, not a copy
120 # chain was a rename, not a copy
121 del t[v]
121 del t[v]
122 if v in src:
122 if v in src:
123 # file is a copy of an existing file
123 # file is a copy of an existing file
124 t[k] = v
124 t[k] = v
125
125
126 for k, v in list(t.items()):
126 for k, v in list(t.items()):
127 # remove criss-crossed copies
127 # remove criss-crossed copies
128 if k in src and v in dst:
128 if k in src and v in dst:
129 del t[k]
129 del t[k]
130 # remove copies to files that were then removed
130 # remove copies to files that were then removed
131 elif k not in dst:
131 elif k not in dst:
132 del t[k]
132 del t[k]
133
133
134 return t
134 return t
135
135
136 def _tracefile(fctx, am, limit=node.nullrev):
136 def _tracefile(fctx, am, limit=node.nullrev):
137 """return file context that is the ancestor of fctx present in ancestor
137 """return file context that is the ancestor of fctx present in ancestor
138 manifest am, stopping after the first ancestor lower than limit"""
138 manifest am, stopping after the first ancestor lower than limit"""
139
139
140 for f in fctx.ancestors():
140 for f in fctx.ancestors():
141 if am.get(f.path(), None) == f.filenode():
141 if am.get(f.path(), None) == f.filenode():
142 return f
142 return f
143 if limit >= 0 and not f.isintroducedafter(limit):
143 if limit >= 0 and not f.isintroducedafter(limit):
144 return None
144 return None
145
145
146 def _dirstatecopies(repo, match=None):
146 def _dirstatecopies(repo, match=None):
147 ds = repo.dirstate
147 ds = repo.dirstate
148 c = ds.copies().copy()
148 c = ds.copies().copy()
149 for k in list(c):
149 for k in list(c):
150 if ds[k] not in 'anm' or (match and not match(k)):
150 if ds[k] not in 'anm' or (match and not match(k)):
151 del c[k]
151 del c[k]
152 return c
152 return c
153
153
154 def _computeforwardmissing(a, b, match=None):
154 def _computeforwardmissing(a, b, match=None):
155 """Computes which files are in b but not a.
155 """Computes which files are in b but not a.
156 This is its own function so extensions can easily wrap this call to see what
156 This is its own function so extensions can easily wrap this call to see what
157 files _forwardcopies is about to process.
157 files _forwardcopies is about to process.
158 """
158 """
159 ma = a.manifest()
159 ma = a.manifest()
160 mb = b.manifest()
160 mb = b.manifest()
161 return mb.filesnotin(ma, match=match)
161 return mb.filesnotin(ma, match=match)
162
162
163 def usechangesetcentricalgo(repo):
163 def usechangesetcentricalgo(repo):
164 """Checks if we should use changeset-centric copy algorithms"""
164 """Checks if we should use changeset-centric copy algorithms"""
165 return (repo.ui.config('experimental', 'copies.read-from') in
165 return (repo.ui.config('experimental', 'copies.read-from') in
166 ('changeset-only', 'compatibility'))
166 ('changeset-only', 'compatibility'))
167
167
168 def _committedforwardcopies(a, b, match):
168 def _committedforwardcopies(a, b, match):
169 """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
169 """Like _forwardcopies(), but b.rev() cannot be None (working copy)"""
170 # files might have to be traced back to the fctx parent of the last
170 # files might have to be traced back to the fctx parent of the last
171 # one-side-only changeset, but not further back than that
171 # one-side-only changeset, but not further back than that
172 repo = a._repo
172 repo = a._repo
173
173
174 if usechangesetcentricalgo(repo):
174 if usechangesetcentricalgo(repo):
175 return _changesetforwardcopies(a, b, match)
175 return _changesetforwardcopies(a, b, match)
176
176
177 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
177 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
178 dbg = repo.ui.debug
178 dbg = repo.ui.debug
179 if debug:
179 if debug:
180 dbg('debug.copies: looking into rename from %s to %s\n'
180 dbg('debug.copies: looking into rename from %s to %s\n'
181 % (a, b))
181 % (a, b))
182 limit = _findlimit(repo, a, b)
182 limit = _findlimit(repo, a, b)
183 if debug:
183 if debug:
184 dbg('debug.copies: search limit: %d\n' % limit)
184 dbg('debug.copies: search limit: %d\n' % limit)
185 am = a.manifest()
185 am = a.manifest()
186
186
187 # find where new files came from
187 # find where new files came from
188 # we currently don't try to find where old files went, too expensive
188 # we currently don't try to find where old files went, too expensive
189 # this means we can miss a case like 'hg rm b; hg cp a b'
189 # this means we can miss a case like 'hg rm b; hg cp a b'
190 cm = {}
190 cm = {}
191
191
192 # Computing the forward missing is quite expensive on large manifests, since
192 # Computing the forward missing is quite expensive on large manifests, since
193 # it compares the entire manifests. We can optimize it in the common use
193 # it compares the entire manifests. We can optimize it in the common use
194 # case of computing what copies are in a commit versus its parent (like
194 # case of computing what copies are in a commit versus its parent (like
195 # during a rebase or histedit). Note, we exclude merge commits from this
195 # during a rebase or histedit). Note, we exclude merge commits from this
196 # optimization, since the ctx.files() for a merge commit is not correct for
196 # optimization, since the ctx.files() for a merge commit is not correct for
197 # this comparison.
197 # this comparison.
198 forwardmissingmatch = match
198 forwardmissingmatch = match
199 if b.p1() == a and b.p2().node() == node.nullid:
199 if b.p1() == a and b.p2().node() == node.nullid:
200 filesmatcher = matchmod.exact(b.files())
200 filesmatcher = matchmod.exact(b.files())
201 forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher)
201 forwardmissingmatch = matchmod.intersectmatchers(match, filesmatcher)
202 missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
202 missing = _computeforwardmissing(a, b, match=forwardmissingmatch)
203
203
204 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
204 ancestrycontext = a._repo.changelog.ancestors([b.rev()], inclusive=True)
205
205
206 if debug:
206 if debug:
207 dbg('debug.copies: missing files to search: %d\n' % len(missing))
207 dbg('debug.copies: missing files to search: %d\n' % len(missing))
208
208
209 for f in sorted(missing):
209 for f in sorted(missing):
210 if debug:
210 if debug:
211 dbg('debug.copies: tracing file: %s\n' % f)
211 dbg('debug.copies: tracing file: %s\n' % f)
212 fctx = b[f]
212 fctx = b[f]
213 fctx._ancestrycontext = ancestrycontext
213 fctx._ancestrycontext = ancestrycontext
214
214
215 if debug:
215 if debug:
216 start = util.timer()
216 start = util.timer()
217 ofctx = _tracefile(fctx, am, limit)
217 ofctx = _tracefile(fctx, am, limit)
218 if ofctx:
218 if ofctx:
219 if debug:
219 if debug:
220 dbg('debug.copies: rename of: %s\n' % ofctx._path)
220 dbg('debug.copies: rename of: %s\n' % ofctx._path)
221 cm[f] = ofctx.path()
221 cm[f] = ofctx.path()
222 if debug:
222 if debug:
223 dbg('debug.copies: time: %f seconds\n'
223 dbg('debug.copies: time: %f seconds\n'
224 % (util.timer() - start))
224 % (util.timer() - start))
225 return cm
225 return cm
226
226
227 def _changesetforwardcopies(a, b, match):
227 def _changesetforwardcopies(a, b, match):
228 if a.rev() == node.nullrev:
228 if a.rev() == node.nullrev:
229 return {}
229 return {}
230
230
231 repo = a.repo()
231 repo = a.repo()
232 children = {}
232 children = {}
233 cl = repo.changelog
233 cl = repo.changelog
234 missingrevs = cl.findmissingrevs(common=[a.rev()], heads=[b.rev()])
234 missingrevs = cl.findmissingrevs(common=[a.rev()], heads=[b.rev()])
235 for r in missingrevs:
235 for r in missingrevs:
236 for p in cl.parentrevs(r):
236 for p in cl.parentrevs(r):
237 if p == node.nullrev:
237 if p == node.nullrev:
238 continue
238 continue
239 if p not in children:
239 if p not in children:
240 children[p] = [r]
240 children[p] = [r]
241 else:
241 else:
242 children[p].append(r)
242 children[p].append(r)
243
243
244 roots = set(children) - set(missingrevs)
244 roots = set(children) - set(missingrevs)
245 # 'work' contains 3-tuples of a (revision number, parent number, copies).
245 # 'work' contains 3-tuples of a (revision number, parent number, copies).
246 # The parent number is only used for knowing which parent the copies dict
246 # The parent number is only used for knowing which parent the copies dict
247 # came from.
247 # came from.
248 work = [(r, 1, {}) for r in roots]
248 work = [(r, 1, {}) for r in roots]
249 heapq.heapify(work)
249 heapq.heapify(work)
250 while work:
250 while work:
251 r, i1, copies1 = heapq.heappop(work)
251 r, i1, copies1 = heapq.heappop(work)
252 if work and work[0][0] == r:
252 if work and work[0][0] == r:
253 # We are tracing copies from both parents
253 # We are tracing copies from both parents
254 r, i2, copies2 = heapq.heappop(work)
254 r, i2, copies2 = heapq.heappop(work)
255 copies = {}
255 copies = {}
256 ctx = repo[r]
256 ctx = repo[r]
257 p1man, p2man = ctx.p1().manifest(), ctx.p2().manifest()
257 p1man, p2man = ctx.p1().manifest(), ctx.p2().manifest()
258 allcopies = set(copies1) | set(copies2)
258 allcopies = set(copies1) | set(copies2)
259 # TODO: perhaps this filtering should be done as long as ctx
259 # TODO: perhaps this filtering should be done as long as ctx
260 # is merge, whether or not we're tracing from both parent.
260 # is merge, whether or not we're tracing from both parent.
261 for dst in allcopies:
261 for dst in allcopies:
262 if not match(dst):
262 if not match(dst):
263 continue
263 continue
264 if dst not in copies2:
264 if dst not in copies2:
265 # Copied on p1 side: mark as copy from p1 side if it didn't
265 # Copied on p1 side: mark as copy from p1 side if it didn't
266 # already exist on p2 side
266 # already exist on p2 side
267 if dst not in p2man:
267 if dst not in p2man:
268 copies[dst] = copies1[dst]
268 copies[dst] = copies1[dst]
269 elif dst not in copies1:
269 elif dst not in copies1:
270 # Copied on p2 side: mark as copy from p2 side if it didn't
270 # Copied on p2 side: mark as copy from p2 side if it didn't
271 # already exist on p1 side
271 # already exist on p1 side
272 if dst not in p1man:
272 if dst not in p1man:
273 copies[dst] = copies2[dst]
273 copies[dst] = copies2[dst]
274 else:
274 else:
275 # Copied on both sides: mark as copy from p1 side
275 # Copied on both sides: mark as copy from p1 side
276 copies[dst] = copies1[dst]
276 copies[dst] = copies1[dst]
277 else:
277 else:
278 copies = copies1
278 copies = copies1
279 if r == b.rev():
279 if r == b.rev():
280 return copies
280 return copies
281 for c in children[r]:
281 for c in children[r]:
282 childctx = repo[c]
282 childctx = repo[c]
283 if r == childctx.p1().rev():
283 if r == childctx.p1().rev():
284 parent = 1
284 parent = 1
285 childcopies = childctx.p1copies()
285 childcopies = childctx.p1copies()
286 else:
286 else:
287 assert r == childctx.p2().rev()
287 assert r == childctx.p2().rev()
288 parent = 2
288 parent = 2
289 childcopies = childctx.p2copies()
289 childcopies = childctx.p2copies()
290 if not match.always():
290 if not match.always():
291 childcopies = {dst: src for dst, src in childcopies.items()
291 childcopies = {dst: src for dst, src in childcopies.items()
292 if match(dst)}
292 if match(dst)}
293 childcopies = _chain(a, childctx, copies, childcopies)
293 childcopies = _chain(a, childctx, copies, childcopies)
294 heapq.heappush(work, (c, parent, childcopies))
294 heapq.heappush(work, (c, parent, childcopies))
295 assert False
295 assert False
296
296
297 def _forwardcopies(a, b, match=None):
297 def _forwardcopies(a, b, match=None):
298 """find {dst@b: src@a} copy mapping where a is an ancestor of b"""
298 """find {dst@b: src@a} copy mapping where a is an ancestor of b"""
299
299
300 match = a.repo().narrowmatch(match)
300 match = a.repo().narrowmatch(match)
301 # check for working copy
301 # check for working copy
302 if b.rev() is None:
302 if b.rev() is None:
303 if a == b.p1():
303 if a == b.p1():
304 # short-circuit to avoid issues with merge states
304 # short-circuit to avoid issues with merge states
305 return _dirstatecopies(b._repo, match)
305 return _dirstatecopies(b._repo, match)
306
306
307 cm = _committedforwardcopies(a, b.p1(), match)
307 cm = _committedforwardcopies(a, b.p1(), match)
308 # combine copies from dirstate if necessary
308 # combine copies from dirstate if necessary
309 return _chain(a, b, cm, _dirstatecopies(b._repo, match))
309 return _chain(a, b, cm, _dirstatecopies(b._repo, match))
310 return _committedforwardcopies(a, b, match)
310 return _committedforwardcopies(a, b, match)
311
311
312 def _backwardrenames(a, b, match):
312 def _backwardrenames(a, b, match):
313 if a._repo.ui.config('experimental', 'copytrace') == 'off':
313 if a._repo.ui.config('experimental', 'copytrace') == 'off':
314 return {}
314 return {}
315
315
316 # Even though we're not taking copies into account, 1:n rename situations
316 # Even though we're not taking copies into account, 1:n rename situations
317 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
317 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
318 # arbitrarily pick one of the renames.
318 # arbitrarily pick one of the renames.
319 # We don't want to pass in "match" here, since that would filter
319 # We don't want to pass in "match" here, since that would filter
320 # the destination by it. Since we're reversing the copies, we want
320 # the destination by it. Since we're reversing the copies, we want
321 # to filter the source instead.
321 # to filter the source instead.
322 f = _forwardcopies(b, a)
322 f = _forwardcopies(b, a)
323 r = {}
323 r = {}
324 for k, v in sorted(f.iteritems()):
324 for k, v in sorted(f.iteritems()):
325 if match and not match(v):
325 if match and not match(v):
326 continue
326 continue
327 # remove copies
327 # remove copies
328 if v in a:
328 if v in a:
329 continue
329 continue
330 r[v] = k
330 r[v] = k
331 return r
331 return r
332
332
333 def pathcopies(x, y, match=None):
333 def pathcopies(x, y, match=None):
334 """find {dst@y: src@x} copy mapping for directed compare"""
334 """find {dst@y: src@x} copy mapping for directed compare"""
335 repo = x._repo
335 repo = x._repo
336 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
336 debug = repo.ui.debugflag and repo.ui.configbool('devel', 'debug.copies')
337 if debug:
337 if debug:
338 repo.ui.debug('debug.copies: searching copies from %s to %s\n'
338 repo.ui.debug('debug.copies: searching copies from %s to %s\n'
339 % (x, y))
339 % (x, y))
340 if x == y or not x or not y:
340 if x == y or not x or not y:
341 return {}
341 return {}
342 a = y.ancestor(x)
342 a = y.ancestor(x)
343 if a == x:
343 if a == x:
344 if debug:
344 if debug:
345 repo.ui.debug('debug.copies: search mode: forward\n')
345 repo.ui.debug('debug.copies: search mode: forward\n')
346 return _forwardcopies(x, y, match=match)
346 return _forwardcopies(x, y, match=match)
347 if a == y:
347 if a == y:
348 if debug:
348 if debug:
349 repo.ui.debug('debug.copies: search mode: backward\n')
349 repo.ui.debug('debug.copies: search mode: backward\n')
350 return _backwardrenames(x, y, match=match)
350 return _backwardrenames(x, y, match=match)
351 if debug:
351 if debug:
352 repo.ui.debug('debug.copies: search mode: combined\n')
352 repo.ui.debug('debug.copies: search mode: combined\n')
353 return _chain(x, y, _backwardrenames(x, a, match=match),
353 return _chain(x, y, _backwardrenames(x, a, match=match),
354 _forwardcopies(a, y, match=match))
354 _forwardcopies(a, y, match=match))
355
355
356 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, debug=True):
356 def _computenonoverlap(repo, c1, c2, addedinm1, addedinm2, debug=True):
357 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
357 """Computes, based on addedinm1 and addedinm2, the files exclusive to c1
358 and c2. This is its own function so extensions can easily wrap this call
358 and c2. This is its own function so extensions can easily wrap this call
359 to see what files mergecopies is about to process.
359 to see what files mergecopies is about to process.
360
360
361 Even though c1 and c2 are not used in this function, they are useful in
361 Even though c1 and c2 are not used in this function, they are useful in
362 other extensions for being able to read the file nodes of the changed files.
362 other extensions for being able to read the file nodes of the changed files.
363 """
363 """
364 u1 = sorted(addedinm1 - addedinm2)
364 u1 = sorted(addedinm1 - addedinm2)
365 u2 = sorted(addedinm2 - addedinm1)
365 u2 = sorted(addedinm2 - addedinm1)
366
366
367 if debug:
367 if debug:
368 header = " unmatched files in %s"
368 header = " unmatched files in %s"
369 if u1:
369 if u1:
370 repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1)))
370 repo.ui.debug("%s:\n %s\n" % (header % 'local', "\n ".join(u1)))
371 if u2:
371 if u2:
372 repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2)))
372 repo.ui.debug("%s:\n %s\n" % (header % 'other', "\n ".join(u2)))
373
373
374 return u1, u2
374 return u1, u2
375
375
376 def _makegetfctx(ctx):
377 """return a 'getfctx' function suitable for _checkcopies usage
378
379 We have to re-setup the function building 'filectx' for each
380 '_checkcopies' to ensure the linkrev adjustment is properly setup for
381 each. Linkrev adjustment is important to avoid bug in rename
382 detection. Moreover, having a proper '_ancestrycontext' setup ensures
383 the performance impact of this adjustment is kept limited. Without it,
384 each file could do a full dag traversal making the time complexity of
385 the operation explode (see issue4537).
386
387 This function exists here mostly to limit the impact on stable. Feel
388 free to refactor on default.
389 """
390 rev = ctx.rev()
391 repo = ctx._repo
392 ac = getattr(ctx, '_ancestrycontext', None)
393 if ac is None:
394 revs = [rev]
395 if rev is None:
396 revs = [p.rev() for p in ctx.parents()]
397 ac = repo.changelog.ancestors(revs, inclusive=True)
398 ctx._ancestrycontext = ac
399 def makectx(f, n):
400 if n in node.wdirfilenodeids: # in a working context?
401 if ctx.rev() is None:
402 return ctx.filectx(f)
403 return repo[None][f]
404 fctx = repo.filectx(f, fileid=n)
405 # setup only needed for filectx not create from a changectx
406 fctx._ancestrycontext = ac
407 fctx._descendantrev = rev
408 return fctx
409 return util.lrucachefunc(makectx)
410
411 def _combinecopies(copyfrom, copyto, finalcopy, diverge, incompletediverge):
412 """combine partial copy paths"""
413 remainder = {}
414 for f in copyfrom:
415 if f in copyto:
416 finalcopy[copyto[f]] = copyfrom[f]
417 del copyto[f]
418 for f in incompletediverge:
419 assert f not in diverge
420 ic = incompletediverge[f]
421 if ic[0] in copyto:
422 diverge[f] = [copyto[ic[0]], ic[1]]
423 else:
424 remainder[f] = ic
425 return remainder
426
427 def mergecopies(repo, c1, c2, base):
376 def mergecopies(repo, c1, c2, base):
428 """
377 """
429 Finds moves and copies between context c1 and c2 that are relevant for
378 Finds moves and copies between context c1 and c2 that are relevant for
430 merging. 'base' will be used as the merge base.
379 merging. 'base' will be used as the merge base.
431
380
432 Copytracing is used in commands like rebase, merge, unshelve, etc to merge
381 Copytracing is used in commands like rebase, merge, unshelve, etc to merge
433 files that were moved/ copied in one merge parent and modified in another.
382 files that were moved/ copied in one merge parent and modified in another.
434 For example:
383 For example:
435
384
436 o ---> 4 another commit
385 o ---> 4 another commit
437 |
386 |
438 | o ---> 3 commit that modifies a.txt
387 | o ---> 3 commit that modifies a.txt
439 | /
388 | /
440 o / ---> 2 commit that moves a.txt to b.txt
389 o / ---> 2 commit that moves a.txt to b.txt
441 |/
390 |/
442 o ---> 1 merge base
391 o ---> 1 merge base
443
392
444 If we try to rebase revision 3 on revision 4, since there is no a.txt in
393 If we try to rebase revision 3 on revision 4, since there is no a.txt in
445 revision 4, and if user have copytrace disabled, we prints the following
394 revision 4, and if user have copytrace disabled, we prints the following
446 message:
395 message:
447
396
448 ```other changed <file> which local deleted```
397 ```other changed <file> which local deleted```
449
398
450 Returns five dicts: "copy", "movewithdir", "diverge", "renamedelete" and
399 Returns five dicts: "copy", "movewithdir", "diverge", "renamedelete" and
451 "dirmove".
400 "dirmove".
452
401
453 "copy" is a mapping from destination name -> source name,
402 "copy" is a mapping from destination name -> source name,
454 where source is in c1 and destination is in c2 or vice-versa.
403 where source is in c1 and destination is in c2 or vice-versa.
455
404
456 "movewithdir" is a mapping from source name -> destination name,
405 "movewithdir" is a mapping from source name -> destination name,
457 where the file at source present in one context but not the other
406 where the file at source present in one context but not the other
458 needs to be moved to destination by the merge process, because the
407 needs to be moved to destination by the merge process, because the
459 other context moved the directory it is in.
408 other context moved the directory it is in.
460
409
461 "diverge" is a mapping of source name -> list of destination names
410 "diverge" is a mapping of source name -> list of destination names
462 for divergent renames.
411 for divergent renames.
463
412
464 "renamedelete" is a mapping of source name -> list of destination
413 "renamedelete" is a mapping of source name -> list of destination
465 names for files deleted in c1 that were renamed in c2 or vice-versa.
414 names for files deleted in c1 that were renamed in c2 or vice-versa.
466
415
467 "dirmove" is a mapping of detected source dir -> destination dir renames.
416 "dirmove" is a mapping of detected source dir -> destination dir renames.
468 This is needed for handling changes to new files previously grafted into
417 This is needed for handling changes to new files previously grafted into
469 renamed directories.
418 renamed directories.
470
419
471 This function calls different copytracing algorithms based on config.
420 This function calls different copytracing algorithms based on config.
472 """
421 """
473 # avoid silly behavior for update from empty dir
422 # avoid silly behavior for update from empty dir
474 if not c1 or not c2 or c1 == c2:
423 if not c1 or not c2 or c1 == c2:
475 return {}, {}, {}, {}, {}
424 return {}, {}, {}, {}, {}
476
425
477 narrowmatch = c1.repo().narrowmatch()
426 narrowmatch = c1.repo().narrowmatch()
478
427
479 # avoid silly behavior for parent -> working dir
428 # avoid silly behavior for parent -> working dir
480 if c2.node() is None and c1.node() == repo.dirstate.p1():
429 if c2.node() is None and c1.node() == repo.dirstate.p1():
481 return _dirstatecopies(repo, narrowmatch), {}, {}, {}, {}
430 return _dirstatecopies(repo, narrowmatch), {}, {}, {}, {}
482
431
483 copytracing = repo.ui.config('experimental', 'copytrace')
432 copytracing = repo.ui.config('experimental', 'copytrace')
484 boolctrace = stringutil.parsebool(copytracing)
433 boolctrace = stringutil.parsebool(copytracing)
485
434
486 # Copy trace disabling is explicitly below the node == p1 logic above
435 # Copy trace disabling is explicitly below the node == p1 logic above
487 # because the logic above is required for a simple copy to be kept across a
436 # because the logic above is required for a simple copy to be kept across a
488 # rebase.
437 # rebase.
489 if copytracing == 'heuristics':
438 if copytracing == 'heuristics':
490 # Do full copytracing if only non-public revisions are involved as
439 # Do full copytracing if only non-public revisions are involved as
491 # that will be fast enough and will also cover the copies which could
440 # that will be fast enough and will also cover the copies which could
492 # be missed by heuristics
441 # be missed by heuristics
493 if _isfullcopytraceable(repo, c1, base):
442 if _isfullcopytraceable(repo, c1, base):
494 return _fullcopytracing(repo, c1, c2, base)
443 return _fullcopytracing(repo, c1, c2, base)
495 return _heuristicscopytracing(repo, c1, c2, base)
444 return _heuristicscopytracing(repo, c1, c2, base)
496 elif boolctrace is False:
445 elif boolctrace is False:
497 # stringutil.parsebool() returns None when it is unable to parse the
446 # stringutil.parsebool() returns None when it is unable to parse the
498 # value, so we should rely on making sure copytracing is on such cases
447 # value, so we should rely on making sure copytracing is on such cases
499 return {}, {}, {}, {}, {}
448 return {}, {}, {}, {}, {}
500 else:
449 else:
501 return _fullcopytracing(repo, c1, c2, base)
450 return _fullcopytracing(repo, c1, c2, base)
502
451
503 def _isfullcopytraceable(repo, c1, base):
452 def _isfullcopytraceable(repo, c1, base):
504 """ Checks that if base, source and destination are all no-public branches,
453 """ Checks that if base, source and destination are all no-public branches,
505 if yes let's use the full copytrace algorithm for increased capabilities
454 if yes let's use the full copytrace algorithm for increased capabilities
506 since it will be fast enough.
455 since it will be fast enough.
507
456
508 `experimental.copytrace.sourcecommitlimit` can be used to set a limit for
457 `experimental.copytrace.sourcecommitlimit` can be used to set a limit for
509 number of changesets from c1 to base such that if number of changesets are
458 number of changesets from c1 to base such that if number of changesets are
510 more than the limit, full copytracing algorithm won't be used.
459 more than the limit, full copytracing algorithm won't be used.
511 """
460 """
512 if c1.rev() is None:
461 if c1.rev() is None:
513 c1 = c1.p1()
462 c1 = c1.p1()
514 if c1.mutable() and base.mutable():
463 if c1.mutable() and base.mutable():
515 sourcecommitlimit = repo.ui.configint('experimental',
464 sourcecommitlimit = repo.ui.configint('experimental',
516 'copytrace.sourcecommitlimit')
465 'copytrace.sourcecommitlimit')
517 commits = len(repo.revs('%d::%d', base.rev(), c1.rev()))
466 commits = len(repo.revs('%d::%d', base.rev(), c1.rev()))
518 return commits < sourcecommitlimit
467 return commits < sourcecommitlimit
519 return False
468 return False
520
469
470 def _checksinglesidecopies(src, dsts1, m1, m2, mb, c2, base,
471 copy, renamedelete):
472 if src not in m2:
473 # deleted on side 2
474 if src not in m1:
475 # renamed on side 1, deleted on side 2
476 renamedelete[src] = dsts1
477 elif m2[src] != mb[src]:
478 if not _related(c2[src], base[src]):
479 return
480 # modified on side 2
481 for dst in dsts1:
482 if dst not in m2:
483 # dst not added on side 2 (handle as regular
484 # "both created" case in manifestmerge otherwise)
485 copy[dst] = src
486
521 def _fullcopytracing(repo, c1, c2, base):
487 def _fullcopytracing(repo, c1, c2, base):
522 """ The full copytracing algorithm which finds all the new files that were
488 """ The full copytracing algorithm which finds all the new files that were
523 added from merge base up to the top commit and for each file it checks if
489 added from merge base up to the top commit and for each file it checks if
524 this file was copied from another file.
490 this file was copied from another file.
525
491
526 This is pretty slow when a lot of changesets are involved but will track all
492 This is pretty slow when a lot of changesets are involved but will track all
527 the copies.
493 the copies.
528 """
494 """
529 # In certain scenarios (e.g. graft, update or rebase), base can be
530 # overridden We still need to know a real common ancestor in this case We
531 # can't just compute _c1.ancestor(_c2) and compare it to ca, because there
532 # can be multiple common ancestors, e.g. in case of bidmerge. Because our
533 # caller may not know if the revision passed in lieu of the CA is a genuine
534 # common ancestor or not without explicitly checking it, it's better to
535 # determine that here.
536 #
537 # base.isancestorof(wc) is False, work around that
538 _c1 = c1.p1() if c1.rev() is None else c1
539 _c2 = c2.p1() if c2.rev() is None else c2
540 # an endpoint is "dirty" if it isn't a descendant of the merge base
541 # if we have a dirty endpoint, we need to trigger graft logic, and also
542 # keep track of which endpoint is dirty
543 dirtyc1 = not base.isancestorof(_c1)
544 dirtyc2 = not base.isancestorof(_c2)
545 graft = dirtyc1 or dirtyc2
546 tca = base
547 if graft:
548 tca = _c1.ancestor(_c2)
549
550 limit = _findlimit(repo, c1, c2)
551
552 m1 = c1.manifest()
495 m1 = c1.manifest()
553 m2 = c2.manifest()
496 m2 = c2.manifest()
554 mb = base.manifest()
497 mb = base.manifest()
555
498
556 # gather data from _checkcopies:
499 copies1 = pathcopies(base, c1)
557 # - diverge = record all diverges in this dict
500 copies2 = pathcopies(base, c2)
558 # - copy = record all non-divergent copies in this dict
501
559 # - fullcopy = record all copies in this dict
502 inversecopies1 = {}
560 # - incomplete = record non-divergent partial copies here
503 inversecopies2 = {}
561 # - incompletediverge = record divergent partial copies here
504 for dst, src in copies1.items():
562 diverge = {} # divergence data is shared
505 inversecopies1.setdefault(src, []).append(dst)
563 incompletediverge = {}
506 for dst, src in copies2.items():
564 data1 = {'copy': {},
507 inversecopies2.setdefault(src, []).append(dst)
565 'fullcopy': {},
508
566 'incomplete': {},
509 copy = {}
567 'diverge': diverge,
510 diverge = {}
568 'incompletediverge': incompletediverge,
511 renamedelete = {}
569 }
512 allsources = set(inversecopies1) | set(inversecopies2)
570 data2 = {'copy': {},
513 for src in allsources:
571 'fullcopy': {},
514 dsts1 = inversecopies1.get(src)
572 'incomplete': {},
515 dsts2 = inversecopies2.get(src)
573 'diverge': diverge,
516 if dsts1 and dsts2:
574 'incompletediverge': incompletediverge,
517 # copied/renamed on both sides
575 }
518 if src not in m1 and src not in m2:
519 # renamed on both sides
520 dsts1 = set(dsts1)
521 dsts2 = set(dsts2)
522 # If there's some overlap in the rename destinations, we
523 # consider it not divergent. For example, if side 1 copies 'a'
524 # to 'b' and 'c' and deletes 'a', and side 2 copies 'a' to 'c'
525 # and 'd' and deletes 'a'.
526 if dsts1 & dsts2:
527 for dst in (dsts1 & dsts2):
528 copy[dst] = src
529 else:
530 diverge[src] = sorted(dsts1 | dsts2)
531 elif src in m1 and src in m2:
532 # copied on both sides
533 dsts1 = set(dsts1)
534 dsts2 = set(dsts2)
535 for dst in (dsts1 & dsts2):
536 copy[dst] = src
537 # TODO: Handle cases where it was renamed on one side and copied
538 # on the other side
539 elif dsts1:
540 # copied/renamed only on side 1
541 _checksinglesidecopies(src, dsts1, m1, m2, mb, c2, base,
542 copy, renamedelete)
543 elif dsts2:
544 # copied/renamed only on side 2
545 _checksinglesidecopies(src, dsts2, m2, m1, mb, c1, base,
546 copy, renamedelete)
547
548 renamedeleteset = set()
549 divergeset = set()
550 for src, dsts in diverge.items():
551 divergeset.update(dsts)
552 for src, dsts in renamedelete.items():
553 renamedeleteset.update(dsts)
576
554
577 # find interesting file sets from manifests
555 # find interesting file sets from manifests
578 addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
556 addedinm1 = m1.filesnotin(mb, repo.narrowmatch())
579 addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
557 addedinm2 = m2.filesnotin(mb, repo.narrowmatch())
580 bothnew = sorted(addedinm1 & addedinm2)
558 u1, u2 = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
581 if tca == base:
582 # unmatched file from base
583 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
584 u1u, u2u = u1r, u2r
585 else:
586 # unmatched file from base (DAG rotation in the graft case)
587 u1r, u2r = _computenonoverlap(repo, c1, c2, addedinm1, addedinm2)
588 # unmatched file from topological common ancestors (no DAG rotation)
589 # need to recompute this for directory move handling when grafting
590 mta = tca.manifest()
591 u1u, u2u = _computenonoverlap(repo, c1, c2,
592 m1.filesnotin(mta, repo.narrowmatch()),
593 m2.filesnotin(mta, repo.narrowmatch()),
594 debug=False)
595
596 for f in u1u:
597 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, data1)
598
599 for f in u2u:
600 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, data2)
601
602 copy = dict(data1['copy'])
603 copy.update(data2['copy'])
604 fullcopy = dict(data1['fullcopy'])
605 fullcopy.update(data2['fullcopy'])
606
607 if dirtyc1:
608 _combinecopies(data2['incomplete'], data1['incomplete'], copy, diverge,
609 incompletediverge)
610 if dirtyc2:
611 _combinecopies(data1['incomplete'], data2['incomplete'], copy, diverge,
612 incompletediverge)
613
614 renamedelete = {}
615 renamedeleteset = set()
616 divergeset = set()
617 for of, fl in list(diverge.items()):
618 if len(fl) == 1 or of in c1 or of in c2:
619 del diverge[of] # not actually divergent, or not a rename
620 if of not in c1 and of not in c2:
621 # renamed on one side, deleted on the other side, but filter
622 # out files that have been renamed and then deleted
623 renamedelete[of] = [f for f in fl if f in c1 or f in c2]
624 renamedeleteset.update(fl) # reverse map for below
625 else:
626 divergeset.update(fl) # reverse map for below
627
559
628 bothdiverge = {}
560 fullcopy = copies1.copy()
629 bothincompletediverge = {}
561 fullcopy.update(copies2)
630 remainder = {}
631 both1 = {'copy': {},
632 'fullcopy': {},
633 'incomplete': {},
634 'diverge': bothdiverge,
635 'incompletediverge': bothincompletediverge
636 }
637 both2 = {'copy': {},
638 'fullcopy': {},
639 'incomplete': {},
640 'diverge': bothdiverge,
641 'incompletediverge': bothincompletediverge
642 }
643 for f in bothnew:
644 _checkcopies(c1, c2, f, base, tca, dirtyc1, limit, both1)
645 _checkcopies(c2, c1, f, base, tca, dirtyc2, limit, both2)
646 if dirtyc1 and dirtyc2:
647 remainder = _combinecopies(both2['incomplete'], both1['incomplete'],
648 copy, bothdiverge, bothincompletediverge)
649 remainder1 = _combinecopies(both1['incomplete'], both2['incomplete'],
650 copy, bothdiverge, bothincompletediverge)
651 remainder.update(remainder1)
652 elif dirtyc1:
653 # incomplete copies may only be found on the "dirty" side for bothnew
654 assert not both2['incomplete']
655 remainder = _combinecopies({}, both1['incomplete'], copy, bothdiverge,
656 bothincompletediverge)
657 elif dirtyc2:
658 assert not both1['incomplete']
659 remainder = _combinecopies({}, both2['incomplete'], copy, bothdiverge,
660 bothincompletediverge)
661 else:
662 # incomplete copies and divergences can't happen outside grafts
663 assert not both1['incomplete']
664 assert not both2['incomplete']
665 assert not bothincompletediverge
666 for f in remainder:
667 assert f not in bothdiverge
668 ic = remainder[f]
669 if ic[0] in (m1 if dirtyc1 else m2):
670 # backed-out rename on one side, but watch out for deleted files
671 bothdiverge[f] = ic
672 for of, fl in bothdiverge.items():
673 if len(fl) == 2 and fl[0] == fl[1]:
674 copy[fl[0]] = of # not actually divergent, just matching renames
675
676 # Sometimes we get invalid copies here (the "and not remotebase" in
677 # _checkcopies() seems suspicious). Filter them out.
678 for dst, src in fullcopy.copy().items():
679 if src not in mb:
680 del fullcopy[dst]
681 # Sometimes we forget to add entries from "copy" to "fullcopy", so fix
682 # that up here
683 for dst, src in copy.items():
684 fullcopy[dst] = src
685 # Sometimes we forget to add entries from "diverge" to "fullcopy", so fix
686 # that up here
687 for src, dsts in diverge.items():
688 for dst in dsts:
689 fullcopy[dst] = src
690
691 if not fullcopy:
562 if not fullcopy:
692 return copy, {}, diverge, renamedelete, {}
563 return copy, {}, diverge, renamedelete, {}
693
564
694 if repo.ui.debugflag:
565 if repo.ui.debugflag:
695 repo.ui.debug(" all copies found (* = to merge, ! = divergent, "
566 repo.ui.debug(" all copies found (* = to merge, ! = divergent, "
696 "% = renamed and deleted):\n")
567 "% = renamed and deleted):\n")
697 for f in sorted(fullcopy):
568 for f in sorted(fullcopy):
698 note = ""
569 note = ""
699 if f in copy:
570 if f in copy:
700 note += "*"
571 note += "*"
701 if f in divergeset:
572 if f in divergeset:
702 note += "!"
573 note += "!"
703 if f in renamedeleteset:
574 if f in renamedeleteset:
704 note += "%"
575 note += "%"
705 repo.ui.debug(" src: '%s' -> dst: '%s' %s\n" % (fullcopy[f], f,
576 repo.ui.debug(" src: '%s' -> dst: '%s' %s\n" % (fullcopy[f], f,
706 note))
577 note))
707 del divergeset
578 del divergeset
708
579
709 repo.ui.debug(" checking for directory renames\n")
580 repo.ui.debug(" checking for directory renames\n")
710
581
711 # generate a directory move map
582 # generate a directory move map
712 d1, d2 = c1.dirs(), c2.dirs()
583 d1, d2 = c1.dirs(), c2.dirs()
713 # Hack for adding '', which is not otherwise added, to d1 and d2
584 # Hack for adding '', which is not otherwise added, to d1 and d2
714 d1.addpath('/')
585 d1.addpath('/')
715 d2.addpath('/')
586 d2.addpath('/')
716 invalid = set()
587 invalid = set()
717 dirmove = {}
588 dirmove = {}
718
589
719 # examine each file copy for a potential directory move, which is
590 # examine each file copy for a potential directory move, which is
720 # when all the files in a directory are moved to a new directory
591 # when all the files in a directory are moved to a new directory
721 for dst, src in fullcopy.iteritems():
592 for dst, src in fullcopy.iteritems():
722 dsrc, ddst = pathutil.dirname(src), pathutil.dirname(dst)
593 dsrc, ddst = pathutil.dirname(src), pathutil.dirname(dst)
723 if dsrc in invalid:
594 if dsrc in invalid:
724 # already seen to be uninteresting
595 # already seen to be uninteresting
725 continue
596 continue
726 elif dsrc in d1 and ddst in d1:
597 elif dsrc in d1 and ddst in d1:
727 # directory wasn't entirely moved locally
598 # directory wasn't entirely moved locally
728 invalid.add(dsrc)
599 invalid.add(dsrc)
729 elif dsrc in d2 and ddst in d2:
600 elif dsrc in d2 and ddst in d2:
730 # directory wasn't entirely moved remotely
601 # directory wasn't entirely moved remotely
731 invalid.add(dsrc)
602 invalid.add(dsrc)
732 elif dsrc in dirmove and dirmove[dsrc] != ddst:
603 elif dsrc in dirmove and dirmove[dsrc] != ddst:
733 # files from the same directory moved to two different places
604 # files from the same directory moved to two different places
734 invalid.add(dsrc)
605 invalid.add(dsrc)
735 else:
606 else:
736 # looks good so far
607 # looks good so far
737 dirmove[dsrc] = ddst
608 dirmove[dsrc] = ddst
738
609
739 for i in invalid:
610 for i in invalid:
740 if i in dirmove:
611 if i in dirmove:
741 del dirmove[i]
612 del dirmove[i]
742 del d1, d2, invalid
613 del d1, d2, invalid
743
614
744 if not dirmove:
615 if not dirmove:
745 return copy, {}, diverge, renamedelete, {}
616 return copy, {}, diverge, renamedelete, {}
746
617
747 dirmove = {k + "/": v + "/" for k, v in dirmove.iteritems()}
618 dirmove = {k + "/": v + "/" for k, v in dirmove.iteritems()}
748
619
749 for d in dirmove:
620 for d in dirmove:
750 repo.ui.debug(" discovered dir src: '%s' -> dst: '%s'\n" %
621 repo.ui.debug(" discovered dir src: '%s' -> dst: '%s'\n" %
751 (d, dirmove[d]))
622 (d, dirmove[d]))
752
623
753 movewithdir = {}
624 movewithdir = {}
754 # check unaccounted nonoverlapping files against directory moves
625 # check unaccounted nonoverlapping files against directory moves
755 for f in u1r + u2r:
626 for f in u1 + u2:
756 if f not in fullcopy:
627 if f not in fullcopy:
757 for d in dirmove:
628 for d in dirmove:
758 if f.startswith(d):
629 if f.startswith(d):
759 # new file added in a directory that was moved, move it
630 # new file added in a directory that was moved, move it
760 df = dirmove[d] + f[len(d):]
631 df = dirmove[d] + f[len(d):]
761 if df not in copy:
632 if df not in copy:
762 movewithdir[f] = df
633 movewithdir[f] = df
763 repo.ui.debug((" pending file src: '%s' -> "
634 repo.ui.debug((" pending file src: '%s' -> "
764 "dst: '%s'\n") % (f, df))
635 "dst: '%s'\n") % (f, df))
765 break
636 break
766
637
767 return copy, movewithdir, diverge, renamedelete, dirmove
638 return copy, movewithdir, diverge, renamedelete, dirmove
768
639
769 def _heuristicscopytracing(repo, c1, c2, base):
640 def _heuristicscopytracing(repo, c1, c2, base):
770 """ Fast copytracing using filename heuristics
641 """ Fast copytracing using filename heuristics
771
642
772 Assumes that moves or renames are of following two types:
643 Assumes that moves or renames are of following two types:
773
644
774 1) Inside a directory only (same directory name but different filenames)
645 1) Inside a directory only (same directory name but different filenames)
775 2) Move from one directory to another
646 2) Move from one directory to another
776 (same filenames but different directory names)
647 (same filenames but different directory names)
777
648
778 Works only when there are no merge commits in the "source branch".
649 Works only when there are no merge commits in the "source branch".
779 Source branch is commits from base up to c2 not including base.
650 Source branch is commits from base up to c2 not including base.
780
651
781 If merge is involved it fallbacks to _fullcopytracing().
652 If merge is involved it fallbacks to _fullcopytracing().
782
653
783 Can be used by setting the following config:
654 Can be used by setting the following config:
784
655
785 [experimental]
656 [experimental]
786 copytrace = heuristics
657 copytrace = heuristics
787
658
788 In some cases the copy/move candidates found by heuristics can be very large
659 In some cases the copy/move candidates found by heuristics can be very large
789 in number and that will make the algorithm slow. The number of possible
660 in number and that will make the algorithm slow. The number of possible
790 candidates to check can be limited by using the config
661 candidates to check can be limited by using the config
791 `experimental.copytrace.movecandidateslimit` which defaults to 100.
662 `experimental.copytrace.movecandidateslimit` which defaults to 100.
792 """
663 """
793
664
794 if c1.rev() is None:
665 if c1.rev() is None:
795 c1 = c1.p1()
666 c1 = c1.p1()
796 if c2.rev() is None:
667 if c2.rev() is None:
797 c2 = c2.p1()
668 c2 = c2.p1()
798
669
799 copies = {}
670 copies = {}
800
671
801 changedfiles = set()
672 changedfiles = set()
802 m1 = c1.manifest()
673 m1 = c1.manifest()
803 if not repo.revs('%d::%d', base.rev(), c2.rev()):
674 if not repo.revs('%d::%d', base.rev(), c2.rev()):
804 # If base is not in c2 branch, we switch to fullcopytracing
675 # If base is not in c2 branch, we switch to fullcopytracing
805 repo.ui.debug("switching to full copytracing as base is not "
676 repo.ui.debug("switching to full copytracing as base is not "
806 "an ancestor of c2\n")
677 "an ancestor of c2\n")
807 return _fullcopytracing(repo, c1, c2, base)
678 return _fullcopytracing(repo, c1, c2, base)
808
679
809 ctx = c2
680 ctx = c2
810 while ctx != base:
681 while ctx != base:
811 if len(ctx.parents()) == 2:
682 if len(ctx.parents()) == 2:
812 # To keep things simple let's not handle merges
683 # To keep things simple let's not handle merges
813 repo.ui.debug("switching to full copytracing because of merges\n")
684 repo.ui.debug("switching to full copytracing because of merges\n")
814 return _fullcopytracing(repo, c1, c2, base)
685 return _fullcopytracing(repo, c1, c2, base)
815 changedfiles.update(ctx.files())
686 changedfiles.update(ctx.files())
816 ctx = ctx.p1()
687 ctx = ctx.p1()
817
688
818 cp = _forwardcopies(base, c2)
689 cp = _forwardcopies(base, c2)
819 for dst, src in cp.iteritems():
690 for dst, src in cp.iteritems():
820 if src in m1:
691 if src in m1:
821 copies[dst] = src
692 copies[dst] = src
822
693
823 # file is missing if it isn't present in the destination, but is present in
694 # file is missing if it isn't present in the destination, but is present in
824 # the base and present in the source.
695 # the base and present in the source.
825 # Presence in the base is important to exclude added files, presence in the
696 # Presence in the base is important to exclude added files, presence in the
826 # source is important to exclude removed files.
697 # source is important to exclude removed files.
827 filt = lambda f: f not in m1 and f in base and f in c2
698 filt = lambda f: f not in m1 and f in base and f in c2
828 missingfiles = [f for f in changedfiles if filt(f)]
699 missingfiles = [f for f in changedfiles if filt(f)]
829
700
830 if missingfiles:
701 if missingfiles:
831 basenametofilename = collections.defaultdict(list)
702 basenametofilename = collections.defaultdict(list)
832 dirnametofilename = collections.defaultdict(list)
703 dirnametofilename = collections.defaultdict(list)
833
704
834 for f in m1.filesnotin(base.manifest()):
705 for f in m1.filesnotin(base.manifest()):
835 basename = os.path.basename(f)
706 basename = os.path.basename(f)
836 dirname = os.path.dirname(f)
707 dirname = os.path.dirname(f)
837 basenametofilename[basename].append(f)
708 basenametofilename[basename].append(f)
838 dirnametofilename[dirname].append(f)
709 dirnametofilename[dirname].append(f)
839
710
840 for f in missingfiles:
711 for f in missingfiles:
841 basename = os.path.basename(f)
712 basename = os.path.basename(f)
842 dirname = os.path.dirname(f)
713 dirname = os.path.dirname(f)
843 samebasename = basenametofilename[basename]
714 samebasename = basenametofilename[basename]
844 samedirname = dirnametofilename[dirname]
715 samedirname = dirnametofilename[dirname]
845 movecandidates = samebasename + samedirname
716 movecandidates = samebasename + samedirname
846 # f is guaranteed to be present in c2, that's why
717 # f is guaranteed to be present in c2, that's why
847 # c2.filectx(f) won't fail
718 # c2.filectx(f) won't fail
848 f2 = c2.filectx(f)
719 f2 = c2.filectx(f)
849 # we can have a lot of candidates which can slow down the heuristics
720 # we can have a lot of candidates which can slow down the heuristics
850 # config value to limit the number of candidates moves to check
721 # config value to limit the number of candidates moves to check
851 maxcandidates = repo.ui.configint('experimental',
722 maxcandidates = repo.ui.configint('experimental',
852 'copytrace.movecandidateslimit')
723 'copytrace.movecandidateslimit')
853
724
854 if len(movecandidates) > maxcandidates:
725 if len(movecandidates) > maxcandidates:
855 repo.ui.status(_("skipping copytracing for '%s', more "
726 repo.ui.status(_("skipping copytracing for '%s', more "
856 "candidates than the limit: %d\n")
727 "candidates than the limit: %d\n")
857 % (f, len(movecandidates)))
728 % (f, len(movecandidates)))
858 continue
729 continue
859
730
860 for candidate in movecandidates:
731 for candidate in movecandidates:
861 f1 = c1.filectx(candidate)
732 f1 = c1.filectx(candidate)
862 if _related(f1, f2):
733 if _related(f1, f2):
863 # if there are a few related copies then we'll merge
734 # if there are a few related copies then we'll merge
864 # changes into all of them. This matches the behaviour
735 # changes into all of them. This matches the behaviour
865 # of upstream copytracing
736 # of upstream copytracing
866 copies[candidate] = f
737 copies[candidate] = f
867
738
868 return copies, {}, {}, {}, {}
739 return copies, {}, {}, {}, {}
869
740
870 def _related(f1, f2):
741 def _related(f1, f2):
871 """return True if f1 and f2 filectx have a common ancestor
742 """return True if f1 and f2 filectx have a common ancestor
872
743
873 Walk back to common ancestor to see if the two files originate
744 Walk back to common ancestor to see if the two files originate
874 from the same file. Since workingfilectx's rev() is None it messes
745 from the same file. Since workingfilectx's rev() is None it messes
875 up the integer comparison logic, hence the pre-step check for
746 up the integer comparison logic, hence the pre-step check for
876 None (f1 and f2 can only be workingfilectx's initially).
747 None (f1 and f2 can only be workingfilectx's initially).
877 """
748 """
878
749
879 if f1 == f2:
750 if f1 == f2:
880 return True # a match
751 return True # a match
881
752
882 g1, g2 = f1.ancestors(), f2.ancestors()
753 g1, g2 = f1.ancestors(), f2.ancestors()
883 try:
754 try:
884 f1r, f2r = f1.linkrev(), f2.linkrev()
755 f1r, f2r = f1.linkrev(), f2.linkrev()
885
756
886 if f1r is None:
757 if f1r is None:
887 f1 = next(g1)
758 f1 = next(g1)
888 if f2r is None:
759 if f2r is None:
889 f2 = next(g2)
760 f2 = next(g2)
890
761
891 while True:
762 while True:
892 f1r, f2r = f1.linkrev(), f2.linkrev()
763 f1r, f2r = f1.linkrev(), f2.linkrev()
893 if f1r > f2r:
764 if f1r > f2r:
894 f1 = next(g1)
765 f1 = next(g1)
895 elif f2r > f1r:
766 elif f2r > f1r:
896 f2 = next(g2)
767 f2 = next(g2)
897 else: # f1 and f2 point to files in the same linkrev
768 else: # f1 and f2 point to files in the same linkrev
898 return f1 == f2 # true if they point to the same file
769 return f1 == f2 # true if they point to the same file
899 except StopIteration:
770 except StopIteration:
900 return False
771 return False
901
772
902 def _checkcopies(srcctx, dstctx, f, base, tca, remotebase, limit, data):
903 """
904 check possible copies of f from msrc to mdst
905
906 srcctx = starting context for f in msrc
907 dstctx = destination context for f in mdst
908 f = the filename to check (as in msrc)
909 base = the changectx used as a merge base
910 tca = topological common ancestor for graft-like scenarios
911 remotebase = True if base is outside tca::srcctx, False otherwise
912 limit = the rev number to not search beyond
913 data = dictionary of dictionary to store copy data. (see mergecopies)
914
915 note: limit is only an optimization, and provides no guarantee that
916 irrelevant revisions will not be visited
917 there is no easy way to make this algorithm stop in a guaranteed way
918 once it "goes behind a certain revision".
919 """
920
921 msrc = srcctx.manifest()
922 mdst = dstctx.manifest()
923 mb = base.manifest()
924 mta = tca.manifest()
925 # Might be true if this call is about finding backward renames,
926 # This happens in the case of grafts because the DAG is then rotated.
927 # If the file exists in both the base and the source, we are not looking
928 # for a rename on the source side, but on the part of the DAG that is
929 # traversed backwards.
930 #
931 # In the case there is both backward and forward renames (before and after
932 # the base) this is more complicated as we must detect a divergence.
933 # We use 'backwards = False' in that case.
934 backwards = not remotebase and base != tca and f in mb
935 getsrcfctx = _makegetfctx(srcctx)
936 getdstfctx = _makegetfctx(dstctx)
937
938 if msrc[f] == mb.get(f) and not remotebase:
939 # Nothing to merge
940 return
941
942 of = None
943 seen = {f}
944 for oc in getsrcfctx(f, msrc[f]).ancestors():
945 of = oc.path()
946 if of in seen:
947 # check limit late - grab last rename before
948 if oc.linkrev() < limit:
949 break
950 continue
951 seen.add(of)
952
953 # remember for dir rename detection
954 if backwards:
955 data['fullcopy'][of] = f # grafting backwards through renames
956 else:
957 data['fullcopy'][f] = of
958 if of not in mdst:
959 continue # no match, keep looking
960 if mdst[of] == mb.get(of):
961 return # no merge needed, quit early
962 c2 = getdstfctx(of, mdst[of])
963 # c2 might be a plain new file on added on destination side that is
964 # unrelated to the droids we are looking for.
965 cr = _related(oc, c2)
966 if cr and (of == f or of == c2.path()): # non-divergent
967 if backwards:
968 data['copy'][of] = f
969 elif of in mb:
970 data['copy'][f] = of
971 elif remotebase: # special case: a <- b <- a -> b "ping-pong" rename
972 data['copy'][of] = f
973 del data['fullcopy'][f]
974 data['fullcopy'][of] = f
975 else: # divergence w.r.t. graft CA on one side of topological CA
976 for sf in seen:
977 if sf in mb:
978 assert sf not in data['diverge']
979 data['diverge'][sf] = [f, of]
980 break
981 return
982
983 if of in mta:
984 if backwards or remotebase:
985 data['incomplete'][of] = f
986 else:
987 for sf in seen:
988 if sf in mb:
989 if tca == base:
990 data['diverge'].setdefault(sf, []).append(f)
991 else:
992 data['incompletediverge'][sf] = [of, f]
993 return
994
995 def duplicatecopies(repo, wctx, rev, fromrev, skiprev=None):
773 def duplicatecopies(repo, wctx, rev, fromrev, skiprev=None):
996 """reproduce copies from fromrev to rev in the dirstate
774 """reproduce copies from fromrev to rev in the dirstate
997
775
998 If skiprev is specified, it's a revision that should be used to
776 If skiprev is specified, it's a revision that should be used to
999 filter copy records. Any copies that occur between fromrev and
777 filter copy records. Any copies that occur between fromrev and
1000 skiprev will not be duplicated, even if they appear in the set of
778 skiprev will not be duplicated, even if they appear in the set of
1001 copies between fromrev and rev.
779 copies between fromrev and rev.
1002 """
780 """
1003 exclude = {}
781 exclude = {}
1004 ctraceconfig = repo.ui.config('experimental', 'copytrace')
782 ctraceconfig = repo.ui.config('experimental', 'copytrace')
1005 bctrace = stringutil.parsebool(ctraceconfig)
783 bctrace = stringutil.parsebool(ctraceconfig)
1006 if (skiprev is not None and
784 if (skiprev is not None and
1007 (ctraceconfig == 'heuristics' or bctrace or bctrace is None)):
785 (ctraceconfig == 'heuristics' or bctrace or bctrace is None)):
1008 # copytrace='off' skips this line, but not the entire function because
786 # copytrace='off' skips this line, but not the entire function because
1009 # the line below is O(size of the repo) during a rebase, while the rest
787 # the line below is O(size of the repo) during a rebase, while the rest
1010 # of the function is much faster (and is required for carrying copy
788 # of the function is much faster (and is required for carrying copy
1011 # metadata across the rebase anyway).
789 # metadata across the rebase anyway).
1012 exclude = pathcopies(repo[fromrev], repo[skiprev])
790 exclude = pathcopies(repo[fromrev], repo[skiprev])
1013 for dst, src in pathcopies(repo[fromrev], repo[rev]).iteritems():
791 for dst, src in pathcopies(repo[fromrev], repo[rev]).iteritems():
1014 # copies.pathcopies returns backward renames, so dst might not
792 # copies.pathcopies returns backward renames, so dst might not
1015 # actually be in the dirstate
793 # actually be in the dirstate
1016 if dst in exclude:
794 if dst in exclude:
1017 continue
795 continue
1018 wctx[dst].markcopied(src)
796 wctx[dst].markcopied(src)
@@ -1,1210 +1,1183 b''
1 $ cat >> "$HGRCPATH" << EOF
1 $ cat >> "$HGRCPATH" << EOF
2 > [ui]
2 > [ui]
3 > merge = :merge3
3 > merge = :merge3
4 > EOF
4 > EOF
5
5
6 init
6 init
7
7
8 $ hg init repo
8 $ hg init repo
9 $ cd repo
9 $ cd repo
10
10
11 commit
11 commit
12
12
13 $ echo 'a' > a
13 $ echo 'a' > a
14 $ hg ci -A -m test -u nobody -d '1 0'
14 $ hg ci -A -m test -u nobody -d '1 0'
15 adding a
15 adding a
16
16
17 annotate -c
17 annotate -c
18
18
19 $ hg annotate -c a
19 $ hg annotate -c a
20 8435f90966e4: a
20 8435f90966e4: a
21
21
22 annotate -cl
22 annotate -cl
23
23
24 $ hg annotate -cl a
24 $ hg annotate -cl a
25 8435f90966e4:1: a
25 8435f90966e4:1: a
26
26
27 annotate -d
27 annotate -d
28
28
29 $ hg annotate -d a
29 $ hg annotate -d a
30 Thu Jan 01 00:00:01 1970 +0000: a
30 Thu Jan 01 00:00:01 1970 +0000: a
31
31
32 annotate -n
32 annotate -n
33
33
34 $ hg annotate -n a
34 $ hg annotate -n a
35 0: a
35 0: a
36
36
37 annotate -nl
37 annotate -nl
38
38
39 $ hg annotate -nl a
39 $ hg annotate -nl a
40 0:1: a
40 0:1: a
41
41
42 annotate -u
42 annotate -u
43
43
44 $ hg annotate -u a
44 $ hg annotate -u a
45 nobody: a
45 nobody: a
46
46
47 annotate -cdnu
47 annotate -cdnu
48
48
49 $ hg annotate -cdnu a
49 $ hg annotate -cdnu a
50 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
50 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
51
51
52 annotate -cdnul
52 annotate -cdnul
53
53
54 $ hg annotate -cdnul a
54 $ hg annotate -cdnul a
55 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
55 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
56
56
57 annotate (JSON)
57 annotate (JSON)
58
58
59 $ hg annotate -Tjson a
59 $ hg annotate -Tjson a
60 [
60 [
61 {
61 {
62 "lines": [{"line": "a\n", "rev": 0}],
62 "lines": [{"line": "a\n", "rev": 0}],
63 "path": "a"
63 "path": "a"
64 }
64 }
65 ]
65 ]
66
66
67 $ hg annotate -Tjson -cdfnul a
67 $ hg annotate -Tjson -cdfnul a
68 [
68 [
69 {
69 {
70 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
70 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
71 "path": "a"
71 "path": "a"
72 }
72 }
73 ]
73 ]
74
74
75 log-like templating
75 log-like templating
76
76
77 $ hg annotate -T'{lines % "{rev} {node|shortest}: {line}"}' a
77 $ hg annotate -T'{lines % "{rev} {node|shortest}: {line}"}' a
78 0 8435: a
78 0 8435: a
79
79
80 '{lineno}' field should be populated as necessary
80 '{lineno}' field should be populated as necessary
81
81
82 $ hg annotate -T'{lines % "{rev}:{lineno}: {line}"}' a
82 $ hg annotate -T'{lines % "{rev}:{lineno}: {line}"}' a
83 0:1: a
83 0:1: a
84 $ hg annotate -Ta a \
84 $ hg annotate -Ta a \
85 > --config templates.a='"{lines % "{rev}:{lineno}: {line}"}"'
85 > --config templates.a='"{lines % "{rev}:{lineno}: {line}"}"'
86 0:1: a
86 0:1: a
87
87
88 $ cat <<EOF >>a
88 $ cat <<EOF >>a
89 > a
89 > a
90 > a
90 > a
91 > EOF
91 > EOF
92 $ hg ci -ma1 -d '1 0'
92 $ hg ci -ma1 -d '1 0'
93 $ hg cp a b
93 $ hg cp a b
94 $ hg ci -mb -d '1 0'
94 $ hg ci -mb -d '1 0'
95 $ cat <<EOF >> b
95 $ cat <<EOF >> b
96 > b4
96 > b4
97 > b5
97 > b5
98 > b6
98 > b6
99 > EOF
99 > EOF
100 $ hg ci -mb2 -d '2 0'
100 $ hg ci -mb2 -d '2 0'
101
101
102 default output of '{lines}' should be readable
102 default output of '{lines}' should be readable
103
103
104 $ hg annotate -T'{lines}' a
104 $ hg annotate -T'{lines}' a
105 0: a
105 0: a
106 1: a
106 1: a
107 1: a
107 1: a
108 $ hg annotate -T'{join(lines, "\n")}' a
108 $ hg annotate -T'{join(lines, "\n")}' a
109 0: a
109 0: a
110
110
111 1: a
111 1: a
112
112
113 1: a
113 1: a
114
114
115 several filters can be applied to '{lines}'
115 several filters can be applied to '{lines}'
116
116
117 $ hg annotate -T'{lines|json}\n' a
117 $ hg annotate -T'{lines|json}\n' a
118 [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}]
118 [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}]
119 $ hg annotate -T'{lines|stringify}' a
119 $ hg annotate -T'{lines|stringify}' a
120 0: a
120 0: a
121 1: a
121 1: a
122 1: a
122 1: a
123 $ hg annotate -T'{lines|count}\n' a
123 $ hg annotate -T'{lines|count}\n' a
124 3
124 3
125
125
126 annotate multiple files (JSON)
126 annotate multiple files (JSON)
127
127
128 $ hg annotate -Tjson a b
128 $ hg annotate -Tjson a b
129 [
129 [
130 {
130 {
131 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}],
131 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}],
132 "path": "a"
132 "path": "a"
133 },
133 },
134 {
134 {
135 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}],
135 "lines": [{"line": "a\n", "rev": 0}, {"line": "a\n", "rev": 1}, {"line": "a\n", "rev": 1}, {"line": "b4\n", "rev": 3}, {"line": "b5\n", "rev": 3}, {"line": "b6\n", "rev": 3}],
136 "path": "b"
136 "path": "b"
137 }
137 }
138 ]
138 ]
139
139
140 annotate multiple files (template)
140 annotate multiple files (template)
141
141
142 $ hg annotate -T'== {path} ==\n{lines % "{rev}: {line}"}' a b
142 $ hg annotate -T'== {path} ==\n{lines % "{rev}: {line}"}' a b
143 == a ==
143 == a ==
144 0: a
144 0: a
145 1: a
145 1: a
146 1: a
146 1: a
147 == b ==
147 == b ==
148 0: a
148 0: a
149 1: a
149 1: a
150 1: a
150 1: a
151 3: b4
151 3: b4
152 3: b5
152 3: b5
153 3: b6
153 3: b6
154
154
155 annotate -n b
155 annotate -n b
156
156
157 $ hg annotate -n b
157 $ hg annotate -n b
158 0: a
158 0: a
159 1: a
159 1: a
160 1: a
160 1: a
161 3: b4
161 3: b4
162 3: b5
162 3: b5
163 3: b6
163 3: b6
164
164
165 annotate --no-follow b
165 annotate --no-follow b
166
166
167 $ hg annotate --no-follow b
167 $ hg annotate --no-follow b
168 2: a
168 2: a
169 2: a
169 2: a
170 2: a
170 2: a
171 3: b4
171 3: b4
172 3: b5
172 3: b5
173 3: b6
173 3: b6
174
174
175 annotate -nl b
175 annotate -nl b
176
176
177 $ hg annotate -nl b
177 $ hg annotate -nl b
178 0:1: a
178 0:1: a
179 1:2: a
179 1:2: a
180 1:3: a
180 1:3: a
181 3:4: b4
181 3:4: b4
182 3:5: b5
182 3:5: b5
183 3:6: b6
183 3:6: b6
184
184
185 annotate -nf b
185 annotate -nf b
186
186
187 $ hg annotate -nf b
187 $ hg annotate -nf b
188 0 a: a
188 0 a: a
189 1 a: a
189 1 a: a
190 1 a: a
190 1 a: a
191 3 b: b4
191 3 b: b4
192 3 b: b5
192 3 b: b5
193 3 b: b6
193 3 b: b6
194
194
195 annotate -nlf b
195 annotate -nlf b
196
196
197 $ hg annotate -nlf b
197 $ hg annotate -nlf b
198 0 a:1: a
198 0 a:1: a
199 1 a:2: a
199 1 a:2: a
200 1 a:3: a
200 1 a:3: a
201 3 b:4: b4
201 3 b:4: b4
202 3 b:5: b5
202 3 b:5: b5
203 3 b:6: b6
203 3 b:6: b6
204
204
205 $ hg up -C 2
205 $ hg up -C 2
206 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
206 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 $ cat <<EOF >> b
207 $ cat <<EOF >> b
208 > b4
208 > b4
209 > c
209 > c
210 > b5
210 > b5
211 > EOF
211 > EOF
212 $ hg ci -mb2.1 -d '2 0'
212 $ hg ci -mb2.1 -d '2 0'
213 created new head
213 created new head
214 $ hg merge
214 $ hg merge
215 merging b
215 merging b
216 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
216 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
217 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
217 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
218 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
218 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
219 [1]
219 [1]
220 $ cat b
220 $ cat b
221 a
221 a
222 a
222 a
223 a
223 a
224 <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
224 <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
225 b4
225 b4
226 c
226 c
227 b5
227 b5
228 ||||||| base
228 ||||||| base
229 =======
229 =======
230 b4
230 b4
231 b5
231 b5
232 b6
232 b6
233 >>>>>>> merge rev: 37ec9f5c3d1f - test: b2
233 >>>>>>> merge rev: 37ec9f5c3d1f - test: b2
234 $ cat <<EOF > b
234 $ cat <<EOF > b
235 > a
235 > a
236 > a
236 > a
237 > a
237 > a
238 > b4
238 > b4
239 > c
239 > c
240 > b5
240 > b5
241 > EOF
241 > EOF
242 $ hg resolve --mark -q
242 $ hg resolve --mark -q
243 $ rm b.orig
243 $ rm b.orig
244 $ hg ci -mmergeb -d '3 0'
244 $ hg ci -mmergeb -d '3 0'
245
245
246 annotate after merge
246 annotate after merge
247
247
248 $ hg annotate -nf b
248 $ hg annotate -nf b
249 0 a: a
249 0 a: a
250 1 a: a
250 1 a: a
251 1 a: a
251 1 a: a
252 3 b: b4
252 3 b: b4
253 4 b: c
253 4 b: c
254 3 b: b5
254 3 b: b5
255
255
256 annotate after merge with -l
256 annotate after merge with -l
257
257
258 $ hg annotate -nlf b
258 $ hg annotate -nlf b
259 0 a:1: a
259 0 a:1: a
260 1 a:2: a
260 1 a:2: a
261 1 a:3: a
261 1 a:3: a
262 3 b:4: b4
262 3 b:4: b4
263 4 b:5: c
263 4 b:5: c
264 3 b:5: b5
264 3 b:5: b5
265
265
266 $ hg up -C 1
266 $ hg up -C 1
267 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
267 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
268 $ hg cp a b
268 $ hg cp a b
269 $ cat <<EOF > b
269 $ cat <<EOF > b
270 > a
270 > a
271 > z
271 > z
272 > a
272 > a
273 > EOF
273 > EOF
274 $ hg ci -mc -d '3 0'
274 $ hg ci -mc -d '3 0'
275 created new head
275 created new head
276 BROKEN: 'a' was copied to 'b' on both sides. We should not get a merge conflict here
277 $ hg merge
276 $ hg merge
278 merging b
277 merging b
279 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
278 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
280 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
279 (branch merge, don't forget to commit)
281 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
282 [1]
283 $ cat b
284 <<<<<<< working copy: b80e3e32f75a - test: c
285 a
286 z
287 a
288 ||||||| base
289 =======
290 a
291 a
292 a
293 b4
294 c
295 b5
296 >>>>>>> merge rev: 64afcdf8e29e - test: mergeb
297 $ cat <<EOF > b
298 > a
299 > z
300 > a
301 > b4
302 > c
303 > b5
304 > EOF
305 $ hg resolve --mark -q
306 $ rm b.orig
307 $ echo d >> b
280 $ echo d >> b
308 $ hg ci -mmerge2 -d '4 0'
281 $ hg ci -mmerge2 -d '4 0'
309
282
310 annotate after rename merge
283 annotate after rename merge
311
284
312 $ hg annotate -nf b
285 $ hg annotate -nf b
313 0 a: a
286 0 a: a
314 6 b: z
287 6 b: z
315 1 a: a
288 1 a: a
316 3 b: b4
289 3 b: b4
317 4 b: c
290 4 b: c
318 3 b: b5
291 3 b: b5
319 7 b: d
292 7 b: d
320
293
321 annotate after rename merge with -l
294 annotate after rename merge with -l
322
295
323 $ hg annotate -nlf b
296 $ hg annotate -nlf b
324 0 a:1: a
297 0 a:1: a
325 6 b:2: z
298 6 b:2: z
326 1 a:3: a
299 1 a:3: a
327 3 b:4: b4
300 3 b:4: b4
328 4 b:5: c
301 4 b:5: c
329 3 b:5: b5
302 3 b:5: b5
330 7 b:7: d
303 7 b:7: d
331
304
332 --skip nothing (should be the same as no --skip at all)
305 --skip nothing (should be the same as no --skip at all)
333
306
334 $ hg annotate -nlf b --skip '1::0'
307 $ hg annotate -nlf b --skip '1::0'
335 0 a:1: a
308 0 a:1: a
336 6 b:2: z
309 6 b:2: z
337 1 a:3: a
310 1 a:3: a
338 3 b:4: b4
311 3 b:4: b4
339 4 b:5: c
312 4 b:5: c
340 3 b:5: b5
313 3 b:5: b5
341 7 b:7: d
314 7 b:7: d
342
315
343 --skip a modified line. Note a slight behavior difference in pure - this is
316 --skip a modified line. Note a slight behavior difference in pure - this is
344 because the pure code comes up with slightly different deltas internally.
317 because the pure code comes up with slightly different deltas internally.
345
318
346 $ hg annotate -nlf b --skip 6
319 $ hg annotate -nlf b --skip 6
347 0 a:1: a
320 0 a:1: a
348 1 a:2* z (no-pure !)
321 1 a:2* z (no-pure !)
349 0 a:1* z (pure !)
322 0 a:1* z (pure !)
350 1 a:3: a
323 1 a:3: a
351 3 b:4: b4
324 3 b:4: b4
352 4 b:5: c
325 4 b:5: c
353 3 b:5: b5
326 3 b:5: b5
354 7 b:7: d
327 7 b:7: d
355
328
356 --skip added lines (and test multiple skip)
329 --skip added lines (and test multiple skip)
357
330
358 $ hg annotate -nlf b --skip 3
331 $ hg annotate -nlf b --skip 3
359 0 a:1: a
332 0 a:1: a
360 6 b:2: z
333 6 b:2: z
361 1 a:3: a
334 1 a:3: a
362 1 a:3* b4
335 1 a:3* b4
363 4 b:5: c
336 4 b:5: c
364 1 a:3* b5
337 1 a:3* b5
365 7 b:7: d
338 7 b:7: d
366
339
367 $ hg annotate -nlf b --skip 4
340 $ hg annotate -nlf b --skip 4
368 0 a:1: a
341 0 a:1: a
369 6 b:2: z
342 6 b:2: z
370 1 a:3: a
343 1 a:3: a
371 3 b:4: b4
344 3 b:4: b4
372 1 a:3* c
345 1 a:3* c
373 3 b:5: b5
346 3 b:5: b5
374 7 b:7: d
347 7 b:7: d
375
348
376 $ hg annotate -nlf b --skip 3 --skip 4
349 $ hg annotate -nlf b --skip 3 --skip 4
377 0 a:1: a
350 0 a:1: a
378 6 b:2: z
351 6 b:2: z
379 1 a:3: a
352 1 a:3: a
380 1 a:3* b4
353 1 a:3* b4
381 1 a:3* c
354 1 a:3* c
382 1 a:3* b5
355 1 a:3* b5
383 7 b:7: d
356 7 b:7: d
384
357
385 $ hg annotate -nlf b --skip 'merge()'
358 $ hg annotate -nlf b --skip 'merge()'
386 0 a:1: a
359 0 a:1: a
387 6 b:2: z
360 6 b:2: z
388 1 a:3: a
361 1 a:3: a
389 3 b:4: b4
362 3 b:4: b4
390 4 b:5: c
363 4 b:5: c
391 3 b:5: b5
364 3 b:5: b5
392 3 b:5* d
365 3 b:5* d
393
366
394 --skip everything -- use the revision the file was introduced in
367 --skip everything -- use the revision the file was introduced in
395
368
396 $ hg annotate -nlf b --skip 'all()'
369 $ hg annotate -nlf b --skip 'all()'
397 0 a:1: a
370 0 a:1: a
398 0 a:1* z
371 0 a:1* z
399 0 a:1* a
372 0 a:1* a
400 0 a:1* b4
373 0 a:1* b4
401 0 a:1* c
374 0 a:1* c
402 0 a:1* b5
375 0 a:1* b5
403 0 a:1* d
376 0 a:1* d
404
377
405 Issue2807: alignment of line numbers with -l
378 Issue2807: alignment of line numbers with -l
406
379
407 $ echo more >> b
380 $ echo more >> b
408 $ hg ci -mmore -d '5 0'
381 $ hg ci -mmore -d '5 0'
409 $ echo more >> b
382 $ echo more >> b
410 $ hg ci -mmore -d '6 0'
383 $ hg ci -mmore -d '6 0'
411 $ echo more >> b
384 $ echo more >> b
412 $ hg ci -mmore -d '7 0'
385 $ hg ci -mmore -d '7 0'
413 $ hg annotate -nlf b
386 $ hg annotate -nlf b
414 0 a: 1: a
387 0 a: 1: a
415 6 b: 2: z
388 6 b: 2: z
416 1 a: 3: a
389 1 a: 3: a
417 3 b: 4: b4
390 3 b: 4: b4
418 4 b: 5: c
391 4 b: 5: c
419 3 b: 5: b5
392 3 b: 5: b5
420 7 b: 7: d
393 7 b: 7: d
421 8 b: 8: more
394 8 b: 8: more
422 9 b: 9: more
395 9 b: 9: more
423 10 b:10: more
396 10 b:10: more
424
397
425 linkrev vs rev
398 linkrev vs rev
426
399
427 $ hg annotate -r tip -n a
400 $ hg annotate -r tip -n a
428 0: a
401 0: a
429 1: a
402 1: a
430 1: a
403 1: a
431
404
432 linkrev vs rev with -l
405 linkrev vs rev with -l
433
406
434 $ hg annotate -r tip -nl a
407 $ hg annotate -r tip -nl a
435 0:1: a
408 0:1: a
436 1:2: a
409 1:2: a
437 1:3: a
410 1:3: a
438
411
439 Issue589: "undelete" sequence leads to crash
412 Issue589: "undelete" sequence leads to crash
440
413
441 annotate was crashing when trying to --follow something
414 annotate was crashing when trying to --follow something
442
415
443 like A -> B -> A
416 like A -> B -> A
444
417
445 generate ABA rename configuration
418 generate ABA rename configuration
446
419
447 $ echo foo > foo
420 $ echo foo > foo
448 $ hg add foo
421 $ hg add foo
449 $ hg ci -m addfoo
422 $ hg ci -m addfoo
450 $ hg rename foo bar
423 $ hg rename foo bar
451 $ hg ci -m renamefoo
424 $ hg ci -m renamefoo
452 $ hg rename bar foo
425 $ hg rename bar foo
453 $ hg ci -m renamebar
426 $ hg ci -m renamebar
454
427
455 annotate after ABA with follow
428 annotate after ABA with follow
456
429
457 $ hg annotate --follow foo
430 $ hg annotate --follow foo
458 foo: foo
431 foo: foo
459
432
460 missing file
433 missing file
461
434
462 $ hg ann nosuchfile
435 $ hg ann nosuchfile
463 abort: nosuchfile: no such file in rev e9e6b4fa872f
436 abort: nosuchfile: no such file in rev e9e6b4fa872f
464 [255]
437 [255]
465
438
466 annotate file without '\n' on last line
439 annotate file without '\n' on last line
467
440
468 $ printf "" > c
441 $ printf "" > c
469 $ hg ci -A -m test -u nobody -d '1 0'
442 $ hg ci -A -m test -u nobody -d '1 0'
470 adding c
443 adding c
471 $ hg annotate c
444 $ hg annotate c
472 $ printf "a\nb" > c
445 $ printf "a\nb" > c
473 $ hg ci -m test
446 $ hg ci -m test
474 $ hg annotate c
447 $ hg annotate c
475 [0-9]+: a (re)
448 [0-9]+: a (re)
476 [0-9]+: b (re)
449 [0-9]+: b (re)
477
450
478 Issue3841: check annotation of the file of which filelog includes
451 Issue3841: check annotation of the file of which filelog includes
479 merging between the revision and its ancestor
452 merging between the revision and its ancestor
480
453
481 to reproduce the situation with recent Mercurial, this script uses (1)
454 to reproduce the situation with recent Mercurial, this script uses (1)
482 "hg debugsetparents" to merge without ancestor check by "hg merge",
455 "hg debugsetparents" to merge without ancestor check by "hg merge",
483 and (2) the extension to allow filelog merging between the revision
456 and (2) the extension to allow filelog merging between the revision
484 and its ancestor by overriding "repo._filecommit".
457 and its ancestor by overriding "repo._filecommit".
485
458
486 $ cat > ../legacyrepo.py <<EOF
459 $ cat > ../legacyrepo.py <<EOF
487 > from __future__ import absolute_import
460 > from __future__ import absolute_import
488 > from mercurial import error, node
461 > from mercurial import error, node
489 > def reposetup(ui, repo):
462 > def reposetup(ui, repo):
490 > class legacyrepo(repo.__class__):
463 > class legacyrepo(repo.__class__):
491 > def _filecommit(self, fctx, manifest1, manifest2,
464 > def _filecommit(self, fctx, manifest1, manifest2,
492 > linkrev, tr, changelist, includecopymeta):
465 > linkrev, tr, changelist, includecopymeta):
493 > fname = fctx.path()
466 > fname = fctx.path()
494 > text = fctx.data()
467 > text = fctx.data()
495 > flog = self.file(fname)
468 > flog = self.file(fname)
496 > fparent1 = manifest1.get(fname, node.nullid)
469 > fparent1 = manifest1.get(fname, node.nullid)
497 > fparent2 = manifest2.get(fname, node.nullid)
470 > fparent2 = manifest2.get(fname, node.nullid)
498 > meta = {}
471 > meta = {}
499 > copy = fctx.copysource()
472 > copy = fctx.copysource()
500 > if copy and copy != fname:
473 > if copy and copy != fname:
501 > raise error.Abort('copying is not supported')
474 > raise error.Abort('copying is not supported')
502 > if fparent2 != node.nullid:
475 > if fparent2 != node.nullid:
503 > changelist.append(fname)
476 > changelist.append(fname)
504 > return flog.add(text, meta, tr, linkrev,
477 > return flog.add(text, meta, tr, linkrev,
505 > fparent1, fparent2)
478 > fparent1, fparent2)
506 > raise error.Abort('only merging is supported')
479 > raise error.Abort('only merging is supported')
507 > repo.__class__ = legacyrepo
480 > repo.__class__ = legacyrepo
508 > EOF
481 > EOF
509
482
510 $ cat > baz <<EOF
483 $ cat > baz <<EOF
511 > 1
484 > 1
512 > 2
485 > 2
513 > 3
486 > 3
514 > 4
487 > 4
515 > 5
488 > 5
516 > EOF
489 > EOF
517 $ hg add baz
490 $ hg add baz
518 $ hg commit -m "baz:0"
491 $ hg commit -m "baz:0"
519
492
520 $ cat > baz <<EOF
493 $ cat > baz <<EOF
521 > 1 baz:1
494 > 1 baz:1
522 > 2
495 > 2
523 > 3
496 > 3
524 > 4
497 > 4
525 > 5
498 > 5
526 > EOF
499 > EOF
527 $ hg commit -m "baz:1"
500 $ hg commit -m "baz:1"
528
501
529 $ cat > baz <<EOF
502 $ cat > baz <<EOF
530 > 1 baz:1
503 > 1 baz:1
531 > 2 baz:2
504 > 2 baz:2
532 > 3
505 > 3
533 > 4
506 > 4
534 > 5
507 > 5
535 > EOF
508 > EOF
536 $ hg debugsetparents 17 17
509 $ hg debugsetparents 17 17
537 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
510 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
538 $ hg debugindexdot baz
511 $ hg debugindexdot baz
539 digraph G {
512 digraph G {
540 -1 -> 0
513 -1 -> 0
541 0 -> 1
514 0 -> 1
542 1 -> 2
515 1 -> 2
543 1 -> 2
516 1 -> 2
544 }
517 }
545 $ hg annotate baz
518 $ hg annotate baz
546 17: 1 baz:1
519 17: 1 baz:1
547 18: 2 baz:2
520 18: 2 baz:2
548 16: 3
521 16: 3
549 16: 4
522 16: 4
550 16: 5
523 16: 5
551
524
552 $ cat > baz <<EOF
525 $ cat > baz <<EOF
553 > 1 baz:1
526 > 1 baz:1
554 > 2 baz:2
527 > 2 baz:2
555 > 3 baz:3
528 > 3 baz:3
556 > 4
529 > 4
557 > 5
530 > 5
558 > EOF
531 > EOF
559 $ hg commit -m "baz:3"
532 $ hg commit -m "baz:3"
560
533
561 $ cat > baz <<EOF
534 $ cat > baz <<EOF
562 > 1 baz:1
535 > 1 baz:1
563 > 2 baz:2
536 > 2 baz:2
564 > 3 baz:3
537 > 3 baz:3
565 > 4 baz:4
538 > 4 baz:4
566 > 5
539 > 5
567 > EOF
540 > EOF
568 $ hg debugsetparents 19 18
541 $ hg debugsetparents 19 18
569 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
542 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
570 $ hg debugindexdot baz
543 $ hg debugindexdot baz
571 digraph G {
544 digraph G {
572 -1 -> 0
545 -1 -> 0
573 0 -> 1
546 0 -> 1
574 1 -> 2
547 1 -> 2
575 1 -> 2
548 1 -> 2
576 2 -> 3
549 2 -> 3
577 3 -> 4
550 3 -> 4
578 2 -> 4
551 2 -> 4
579 }
552 }
580 $ hg annotate baz
553 $ hg annotate baz
581 17: 1 baz:1
554 17: 1 baz:1
582 18: 2 baz:2
555 18: 2 baz:2
583 19: 3 baz:3
556 19: 3 baz:3
584 20: 4 baz:4
557 20: 4 baz:4
585 16: 5
558 16: 5
586
559
587 annotate clean file
560 annotate clean file
588
561
589 $ hg annotate -ncr "wdir()" foo
562 $ hg annotate -ncr "wdir()" foo
590 11 472b18db256d : foo
563 11 472b18db256d : foo
591
564
592 annotate modified file
565 annotate modified file
593
566
594 $ echo foofoo >> foo
567 $ echo foofoo >> foo
595 $ hg annotate -r "wdir()" foo
568 $ hg annotate -r "wdir()" foo
596 11 : foo
569 11 : foo
597 20+: foofoo
570 20+: foofoo
598
571
599 $ hg annotate -cr "wdir()" foo
572 $ hg annotate -cr "wdir()" foo
600 472b18db256d : foo
573 472b18db256d : foo
601 b6bedd5477e7+: foofoo
574 b6bedd5477e7+: foofoo
602
575
603 $ hg annotate -ncr "wdir()" foo
576 $ hg annotate -ncr "wdir()" foo
604 11 472b18db256d : foo
577 11 472b18db256d : foo
605 20 b6bedd5477e7+: foofoo
578 20 b6bedd5477e7+: foofoo
606
579
607 $ hg annotate --debug -ncr "wdir()" foo
580 $ hg annotate --debug -ncr "wdir()" foo
608 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
581 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
609 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
582 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
610
583
611 $ hg annotate -udr "wdir()" foo
584 $ hg annotate -udr "wdir()" foo
612 test Thu Jan 01 00:00:00 1970 +0000: foo
585 test Thu Jan 01 00:00:00 1970 +0000: foo
613 test [A-Za-z0-9:+ ]+: foofoo (re)
586 test [A-Za-z0-9:+ ]+: foofoo (re)
614
587
615 $ hg annotate -ncr "wdir()" -Tjson foo
588 $ hg annotate -ncr "wdir()" -Tjson foo
616 [
589 [
617 {
590 {
618 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
591 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
619 "path": "foo"
592 "path": "foo"
620 }
593 }
621 ]
594 ]
622
595
623 annotate added file
596 annotate added file
624
597
625 $ echo bar > bar
598 $ echo bar > bar
626 $ hg add bar
599 $ hg add bar
627 $ hg annotate -ncr "wdir()" bar
600 $ hg annotate -ncr "wdir()" bar
628 20 b6bedd5477e7+: bar
601 20 b6bedd5477e7+: bar
629
602
630 annotate renamed file
603 annotate renamed file
631
604
632 $ hg rename foo renamefoo2
605 $ hg rename foo renamefoo2
633 $ hg annotate -ncr "wdir()" renamefoo2
606 $ hg annotate -ncr "wdir()" renamefoo2
634 11 472b18db256d : foo
607 11 472b18db256d : foo
635 20 b6bedd5477e7+: foofoo
608 20 b6bedd5477e7+: foofoo
636
609
637 annotate missing file
610 annotate missing file
638
611
639 $ rm baz
612 $ rm baz
640
613
641 $ hg annotate -ncr "wdir()" baz
614 $ hg annotate -ncr "wdir()" baz
642 abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
615 abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
643 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
616 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
644 [255]
617 [255]
645
618
646 annotate removed file
619 annotate removed file
647
620
648 $ hg rm baz
621 $ hg rm baz
649
622
650 $ hg annotate -ncr "wdir()" baz
623 $ hg annotate -ncr "wdir()" baz
651 abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
624 abort: $TESTTMP\repo\baz: $ENOENT$ (windows !)
652 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
625 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
653 [255]
626 [255]
654
627
655 $ hg revert --all --no-backup --quiet
628 $ hg revert --all --no-backup --quiet
656 $ hg id -n
629 $ hg id -n
657 20
630 20
658
631
659 Test followlines() revset; we usually check both followlines(pat, range) and
632 Test followlines() revset; we usually check both followlines(pat, range) and
660 followlines(pat, range, descend=True) to make sure both give the same result
633 followlines(pat, range, descend=True) to make sure both give the same result
661 when they should.
634 when they should.
662
635
663 $ echo a >> foo
636 $ echo a >> foo
664 $ hg ci -m 'foo: add a'
637 $ hg ci -m 'foo: add a'
665 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
638 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5)'
666 16: baz:0
639 16: baz:0
667 19: baz:3
640 19: baz:3
668 20: baz:4
641 20: baz:4
669 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
642 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=20)'
670 16: baz:0
643 16: baz:0
671 19: baz:3
644 19: baz:3
672 20: baz:4
645 20: baz:4
673 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19)'
646 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19)'
674 16: baz:0
647 16: baz:0
675 19: baz:3
648 19: baz:3
676 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=True)'
649 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=True)'
677 19: baz:3
650 19: baz:3
678 20: baz:4
651 20: baz:4
679 $ printf "0\n0\n" | cat - baz > baz1
652 $ printf "0\n0\n" | cat - baz > baz1
680 $ mv baz1 baz
653 $ mv baz1 baz
681 $ hg ci -m 'added two lines with 0'
654 $ hg ci -m 'added two lines with 0'
682 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
655 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
683 16: baz:0
656 16: baz:0
684 19: baz:3
657 19: baz:3
685 20: baz:4
658 20: baz:4
686 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, descend=true, startrev=19)'
659 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, descend=true, startrev=19)'
687 19: baz:3
660 19: baz:3
688 20: baz:4
661 20: baz:4
689 $ echo 6 >> baz
662 $ echo 6 >> baz
690 $ hg ci -m 'added line 8'
663 $ hg ci -m 'added line 8'
691 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
664 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
692 16: baz:0
665 16: baz:0
693 19: baz:3
666 19: baz:3
694 20: baz:4
667 20: baz:4
695 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=1)'
668 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=19, descend=1)'
696 19: baz:3
669 19: baz:3
697 20: baz:4
670 20: baz:4
698 $ sed 's/3/3+/' baz > baz.new
671 $ sed 's/3/3+/' baz > baz.new
699 $ mv baz.new baz
672 $ mv baz.new baz
700 $ hg ci -m 'baz:3->3+'
673 $ hg ci -m 'baz:3->3+'
701 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
674 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, descend=0)'
702 16: baz:0
675 16: baz:0
703 19: baz:3
676 19: baz:3
704 20: baz:4
677 20: baz:4
705 24: baz:3->3+
678 24: baz:3->3+
706 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
679 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:5, startrev=17, descend=True)'
707 19: baz:3
680 19: baz:3
708 20: baz:4
681 20: baz:4
709 24: baz:3->3+
682 24: baz:3->3+
710 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
683 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 1:2, descend=false)'
711 22: added two lines with 0
684 22: added two lines with 0
712
685
713 file patterns are okay
686 file patterns are okay
714 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
687 $ hg log -T '{rev}: {desc}\n' -r 'followlines("path:baz", 1:2)'
715 22: added two lines with 0
688 22: added two lines with 0
716
689
717 renames are followed
690 renames are followed
718 $ hg mv baz qux
691 $ hg mv baz qux
719 $ sed 's/4/4+/' qux > qux.new
692 $ sed 's/4/4+/' qux > qux.new
720 $ mv qux.new qux
693 $ mv qux.new qux
721 $ hg ci -m 'qux:4->4+'
694 $ hg ci -m 'qux:4->4+'
722 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
695 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
723 16: baz:0
696 16: baz:0
724 19: baz:3
697 19: baz:3
725 20: baz:4
698 20: baz:4
726 24: baz:3->3+
699 24: baz:3->3+
727 25: qux:4->4+
700 25: qux:4->4+
728
701
729 but are missed when following children
702 but are missed when following children
730 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
703 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=22, descend=True)'
731 24: baz:3->3+
704 24: baz:3->3+
732
705
733 merge
706 merge
734 $ hg up 24 --quiet
707 $ hg up 24 --quiet
735 $ echo 7 >> baz
708 $ echo 7 >> baz
736 $ hg ci -m 'one more line, out of line range'
709 $ hg ci -m 'one more line, out of line range'
737 created new head
710 created new head
738 $ sed 's/3+/3-/' baz > baz.new
711 $ sed 's/3+/3-/' baz > baz.new
739 $ mv baz.new baz
712 $ mv baz.new baz
740 $ hg ci -m 'baz:3+->3-'
713 $ hg ci -m 'baz:3+->3-'
741 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
714 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7)'
742 16: baz:0
715 16: baz:0
743 19: baz:3
716 19: baz:3
744 20: baz:4
717 20: baz:4
745 24: baz:3->3+
718 24: baz:3->3+
746 27: baz:3+->3-
719 27: baz:3+->3-
747 $ hg merge 25
720 $ hg merge 25
748 merging baz and qux to qux
721 merging baz and qux to qux
749 warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
722 warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
750 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
723 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
751 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
724 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
752 [1]
725 [1]
753 $ cat qux
726 $ cat qux
754 0
727 0
755 0
728 0
756 1 baz:1
729 1 baz:1
757 2 baz:2
730 2 baz:2
758 <<<<<<< working copy: 863de62655ef - test: baz:3+->3-
731 <<<<<<< working copy: 863de62655ef - test: baz:3+->3-
759 3- baz:3
732 3- baz:3
760 4 baz:4
733 4 baz:4
761 ||||||| base
734 ||||||| base
762 3+ baz:3
735 3+ baz:3
763 4 baz:4
736 4 baz:4
764 =======
737 =======
765 3+ baz:3
738 3+ baz:3
766 4+ baz:4
739 4+ baz:4
767 >>>>>>> merge rev: cb8df70ae185 - test: qux:4->4+
740 >>>>>>> merge rev: cb8df70ae185 - test: qux:4->4+
768 5
741 5
769 6
742 6
770 7
743 7
771 $ cat > qux <<EOF
744 $ cat > qux <<EOF
772 > 0
745 > 0
773 > 0
746 > 0
774 > 1 baz:1
747 > 1 baz:1
775 > 2 baz:2
748 > 2 baz:2
776 > 3- baz:3
749 > 3- baz:3
777 > 4 baz:4
750 > 4 baz:4
778 > 5
751 > 5
779 > 6
752 > 6
780 > 7
753 > 7
781 > EOF
754 > EOF
782 $ hg resolve --mark -q
755 $ hg resolve --mark -q
783 $ rm qux.orig
756 $ rm qux.orig
784 $ hg ci -m merge
757 $ hg ci -m merge
785 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
758 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
786 16: baz:0
759 16: baz:0
787 19: baz:3
760 19: baz:3
788 20: baz:4
761 20: baz:4
789 24: baz:3->3+
762 24: baz:3->3+
790 25: qux:4->4+
763 25: qux:4->4+
791 27: baz:3+->3-
764 27: baz:3+->3-
792 28: merge
765 28: merge
793 $ hg up 25 --quiet
766 $ hg up 25 --quiet
794 $ hg merge 27
767 $ hg merge 27
795 merging qux and baz to qux
768 merging qux and baz to qux
796 warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
769 warning: conflicts while merging qux! (edit, then use 'hg resolve --mark')
797 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
770 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
798 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
771 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
799 [1]
772 [1]
800 $ cat qux
773 $ cat qux
801 0
774 0
802 0
775 0
803 1 baz:1
776 1 baz:1
804 2 baz:2
777 2 baz:2
805 <<<<<<< working copy: cb8df70ae185 - test: qux:4->4+
778 <<<<<<< working copy: cb8df70ae185 - test: qux:4->4+
806 3+ baz:3
779 3+ baz:3
807 4+ baz:4
780 4+ baz:4
808 ||||||| base
781 ||||||| base
809 3+ baz:3
782 3+ baz:3
810 4 baz:4
783 4 baz:4
811 =======
784 =======
812 3- baz:3
785 3- baz:3
813 4 baz:4
786 4 baz:4
814 >>>>>>> merge rev: 863de62655ef - test: baz:3+->3-
787 >>>>>>> merge rev: 863de62655ef - test: baz:3+->3-
815 5
788 5
816 6
789 6
817 7
790 7
818 $ cat > qux <<EOF
791 $ cat > qux <<EOF
819 > 0
792 > 0
820 > 0
793 > 0
821 > 1 baz:1
794 > 1 baz:1
822 > 2 baz:2
795 > 2 baz:2
823 > 3+ baz:3
796 > 3+ baz:3
824 > 4+ baz:4
797 > 4+ baz:4
825 > 5
798 > 5
826 > 6
799 > 6
827 > EOF
800 > EOF
828 $ hg resolve --mark -q
801 $ hg resolve --mark -q
829 $ rm qux.orig
802 $ rm qux.orig
830 $ hg ci -m 'merge from other side'
803 $ hg ci -m 'merge from other side'
831 created new head
804 created new head
832 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
805 $ hg log -T '{rev}: {desc}\n' -r 'followlines(qux, 5:7)'
833 16: baz:0
806 16: baz:0
834 19: baz:3
807 19: baz:3
835 20: baz:4
808 20: baz:4
836 24: baz:3->3+
809 24: baz:3->3+
837 25: qux:4->4+
810 25: qux:4->4+
838 27: baz:3+->3-
811 27: baz:3+->3-
839 29: merge from other side
812 29: merge from other side
840 $ hg up 24 --quiet
813 $ hg up 24 --quiet
841
814
842 we are missing the branch with rename when following children
815 we are missing the branch with rename when following children
843 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
816 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 5:7, startrev=26, descend=True)'
844 27: baz:3+->3-
817 27: baz:3+->3-
845
818
846 we follow all branches in descending direction
819 we follow all branches in descending direction
847 $ hg up 23 --quiet
820 $ hg up 23 --quiet
848 $ sed 's/3/+3/' baz > baz.new
821 $ sed 's/3/+3/' baz > baz.new
849 $ mv baz.new baz
822 $ mv baz.new baz
850 $ hg ci -m 'baz:3->+3'
823 $ hg ci -m 'baz:3->+3'
851 created new head
824 created new head
852 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
825 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 2:5, startrev=16, descend=True)' --graph
853 @ 30: baz:3->+3
826 @ 30: baz:3->+3
854 :
827 :
855 : o 27: baz:3+->3-
828 : o 27: baz:3+->3-
856 : :
829 : :
857 : o 24: baz:3->3+
830 : o 24: baz:3->3+
858 :/
831 :/
859 o 20: baz:4
832 o 20: baz:4
860 |\
833 |\
861 | o 19: baz:3
834 | o 19: baz:3
862 |/
835 |/
863 o 18: baz:2
836 o 18: baz:2
864 :
837 :
865 o 16: baz:0
838 o 16: baz:0
866 |
839 |
867 ~
840 ~
868
841
869 Issue5595: on a merge changeset with different line ranges depending on
842 Issue5595: on a merge changeset with different line ranges depending on
870 parent, be conservative and use the surrounding interval to avoid loosing
843 parent, be conservative and use the surrounding interval to avoid loosing
871 track of possible further descendants in specified range.
844 track of possible further descendants in specified range.
872
845
873 $ hg up 23 --quiet
846 $ hg up 23 --quiet
874 $ hg cat baz -r 24
847 $ hg cat baz -r 24
875 0
848 0
876 0
849 0
877 1 baz:1
850 1 baz:1
878 2 baz:2
851 2 baz:2
879 3+ baz:3
852 3+ baz:3
880 4 baz:4
853 4 baz:4
881 5
854 5
882 6
855 6
883 $ cat > baz << EOF
856 $ cat > baz << EOF
884 > 0
857 > 0
885 > 0
858 > 0
886 > a
859 > a
887 > b
860 > b
888 > 3+ baz:3
861 > 3+ baz:3
889 > 4 baz:4
862 > 4 baz:4
890 > y
863 > y
891 > z
864 > z
892 > EOF
865 > EOF
893 $ hg ci -m 'baz: mostly rewrite with some content from 24'
866 $ hg ci -m 'baz: mostly rewrite with some content from 24'
894 created new head
867 created new head
895 $ hg merge --tool :merge-other 24
868 $ hg merge --tool :merge-other 24
896 merging baz
869 merging baz
897 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
870 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
898 (branch merge, don't forget to commit)
871 (branch merge, don't forget to commit)
899 $ hg ci -m 'merge forgetting about baz rewrite'
872 $ hg ci -m 'merge forgetting about baz rewrite'
900 $ cat > baz << EOF
873 $ cat > baz << EOF
901 > 0
874 > 0
902 > 0
875 > 0
903 > 1 baz:1
876 > 1 baz:1
904 > 2+ baz:2
877 > 2+ baz:2
905 > 3+ baz:3
878 > 3+ baz:3
906 > 4 baz:4
879 > 4 baz:4
907 > 5
880 > 5
908 > 6
881 > 6
909 > EOF
882 > EOF
910 $ hg ci -m 'baz: narrow change (2->2+)'
883 $ hg ci -m 'baz: narrow change (2->2+)'
911 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:4, startrev=20, descend=True)' --graph
884 $ hg log -T '{rev}: {desc}\n' -r 'followlines(baz, 3:4, startrev=20, descend=True)' --graph
912 @ 33: baz: narrow change (2->2+)
885 @ 33: baz: narrow change (2->2+)
913 |
886 |
914 o 32: merge forgetting about baz rewrite
887 o 32: merge forgetting about baz rewrite
915 |\
888 |\
916 | o 31: baz: mostly rewrite with some content from 24
889 | o 31: baz: mostly rewrite with some content from 24
917 | :
890 | :
918 | : o 30: baz:3->+3
891 | : o 30: baz:3->+3
919 | :/
892 | :/
920 +---o 27: baz:3+->3-
893 +---o 27: baz:3+->3-
921 | :
894 | :
922 o : 24: baz:3->3+
895 o : 24: baz:3->3+
923 :/
896 :/
924 o 20: baz:4
897 o 20: baz:4
925 |\
898 |\
926 ~ ~
899 ~ ~
927
900
928 An integer as a line range, which is parsed as '1:1'
901 An integer as a line range, which is parsed as '1:1'
929
902
930 $ hg log -r 'followlines(baz, 1)'
903 $ hg log -r 'followlines(baz, 1)'
931 changeset: 22:2174d0bf352a
904 changeset: 22:2174d0bf352a
932 user: test
905 user: test
933 date: Thu Jan 01 00:00:00 1970 +0000
906 date: Thu Jan 01 00:00:00 1970 +0000
934 summary: added two lines with 0
907 summary: added two lines with 0
935
908
936
909
937 check error cases
910 check error cases
938 $ hg up 24 --quiet
911 $ hg up 24 --quiet
939 $ hg log -r 'followlines()'
912 $ hg log -r 'followlines()'
940 hg: parse error: followlines takes at least 1 positional arguments
913 hg: parse error: followlines takes at least 1 positional arguments
941 [255]
914 [255]
942 $ hg log -r 'followlines(baz)'
915 $ hg log -r 'followlines(baz)'
943 hg: parse error: followlines requires a line range
916 hg: parse error: followlines requires a line range
944 [255]
917 [255]
945 $ hg log -r 'followlines(baz, x)'
918 $ hg log -r 'followlines(baz, x)'
946 hg: parse error: followlines expects a line number or a range
919 hg: parse error: followlines expects a line number or a range
947 [255]
920 [255]
948 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
921 $ hg log -r 'followlines(baz, 1:2, startrev=desc("b"))'
949 hg: parse error: followlines expects exactly one revision
922 hg: parse error: followlines expects exactly one revision
950 [255]
923 [255]
951 $ hg log -r 'followlines("glob:*", 1:2)'
924 $ hg log -r 'followlines("glob:*", 1:2)'
952 hg: parse error: followlines expects exactly one file
925 hg: parse error: followlines expects exactly one file
953 [255]
926 [255]
954 $ hg log -r 'followlines(baz, 1:)'
927 $ hg log -r 'followlines(baz, 1:)'
955 hg: parse error: line range bounds must be integers
928 hg: parse error: line range bounds must be integers
956 [255]
929 [255]
957 $ hg log -r 'followlines(baz, :1)'
930 $ hg log -r 'followlines(baz, :1)'
958 hg: parse error: line range bounds must be integers
931 hg: parse error: line range bounds must be integers
959 [255]
932 [255]
960 $ hg log -r 'followlines(baz, x:4)'
933 $ hg log -r 'followlines(baz, x:4)'
961 hg: parse error: line range bounds must be integers
934 hg: parse error: line range bounds must be integers
962 [255]
935 [255]
963 $ hg log -r 'followlines(baz, 5:4)'
936 $ hg log -r 'followlines(baz, 5:4)'
964 hg: parse error: line range must be positive
937 hg: parse error: line range must be positive
965 [255]
938 [255]
966 $ hg log -r 'followlines(baz, 0:4)'
939 $ hg log -r 'followlines(baz, 0:4)'
967 hg: parse error: fromline must be strictly positive
940 hg: parse error: fromline must be strictly positive
968 [255]
941 [255]
969 $ hg log -r 'followlines(baz, 2:40)'
942 $ hg log -r 'followlines(baz, 2:40)'
970 abort: line range exceeds file size
943 abort: line range exceeds file size
971 [255]
944 [255]
972 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
945 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])'
973 hg: parse error at 43: not a prefix: [
946 hg: parse error at 43: not a prefix: [
974 (followlines(baz, 2:4, startrev=20, descend=[1])
947 (followlines(baz, 2:4, startrev=20, descend=[1])
975 ^ here)
948 ^ here)
976 [255]
949 [255]
977 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
950 $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)'
978 hg: parse error: descend argument must be a boolean
951 hg: parse error: descend argument must be a boolean
979 [255]
952 [255]
980
953
981 Test empty annotate output
954 Test empty annotate output
982
955
983 $ printf '\0' > binary
956 $ printf '\0' > binary
984 $ touch empty
957 $ touch empty
985 $ hg ci -qAm 'add binary and empty files'
958 $ hg ci -qAm 'add binary and empty files'
986
959
987 $ hg annotate binary empty
960 $ hg annotate binary empty
988 binary: binary file
961 binary: binary file
989
962
990 $ hg annotate -Tjson binary empty
963 $ hg annotate -Tjson binary empty
991 [
964 [
992 {
965 {
993 "path": "binary"
966 "path": "binary"
994 },
967 },
995 {
968 {
996 "lines": [],
969 "lines": [],
997 "path": "empty"
970 "path": "empty"
998 }
971 }
999 ]
972 ]
1000
973
1001 Test annotate with whitespace options
974 Test annotate with whitespace options
1002
975
1003 $ cd ..
976 $ cd ..
1004 $ hg init repo-ws
977 $ hg init repo-ws
1005 $ cd repo-ws
978 $ cd repo-ws
1006 $ cat > a <<EOF
979 $ cat > a <<EOF
1007 > aa
980 > aa
1008 >
981 >
1009 > b b
982 > b b
1010 > EOF
983 > EOF
1011 $ hg ci -Am "adda"
984 $ hg ci -Am "adda"
1012 adding a
985 adding a
1013 $ sed 's/EOL$//g' > a <<EOF
986 $ sed 's/EOL$//g' > a <<EOF
1014 > a a
987 > a a
1015 >
988 >
1016 > EOL
989 > EOL
1017 > b b
990 > b b
1018 > EOF
991 > EOF
1019 $ hg ci -m "changea"
992 $ hg ci -m "changea"
1020
993
1021 Annotate with no option
994 Annotate with no option
1022
995
1023 $ hg annotate a
996 $ hg annotate a
1024 1: a a
997 1: a a
1025 0:
998 0:
1026 1:
999 1:
1027 1: b b
1000 1: b b
1028
1001
1029 Annotate with --ignore-space-change
1002 Annotate with --ignore-space-change
1030
1003
1031 $ hg annotate --ignore-space-change a
1004 $ hg annotate --ignore-space-change a
1032 1: a a
1005 1: a a
1033 1:
1006 1:
1034 0:
1007 0:
1035 0: b b
1008 0: b b
1036
1009
1037 Annotate with --ignore-all-space
1010 Annotate with --ignore-all-space
1038
1011
1039 $ hg annotate --ignore-all-space a
1012 $ hg annotate --ignore-all-space a
1040 0: a a
1013 0: a a
1041 0:
1014 0:
1042 1:
1015 1:
1043 0: b b
1016 0: b b
1044
1017
1045 Annotate with --ignore-blank-lines (similar to no options case)
1018 Annotate with --ignore-blank-lines (similar to no options case)
1046
1019
1047 $ hg annotate --ignore-blank-lines a
1020 $ hg annotate --ignore-blank-lines a
1048 1: a a
1021 1: a a
1049 0:
1022 0:
1050 1:
1023 1:
1051 1: b b
1024 1: b b
1052
1025
1053 $ cd ..
1026 $ cd ..
1054
1027
1055 Annotate with orphaned CR (issue5798)
1028 Annotate with orphaned CR (issue5798)
1056 -------------------------------------
1029 -------------------------------------
1057
1030
1058 $ hg init repo-cr
1031 $ hg init repo-cr
1059 $ cd repo-cr
1032 $ cd repo-cr
1060
1033
1061 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
1034 $ cat <<'EOF' >> "$TESTTMP/substcr.py"
1062 > import sys
1035 > import sys
1063 > from mercurial.utils import procutil
1036 > from mercurial.utils import procutil
1064 > procutil.setbinary(sys.stdin)
1037 > procutil.setbinary(sys.stdin)
1065 > procutil.setbinary(sys.stdout)
1038 > procutil.setbinary(sys.stdout)
1066 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
1039 > stdin = getattr(sys.stdin, 'buffer', sys.stdin)
1067 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
1040 > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
1068 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
1041 > stdout.write(stdin.read().replace(b'\r', b'[CR]'))
1069 > EOF
1042 > EOF
1070
1043
1071 >>> with open('a', 'wb') as f:
1044 >>> with open('a', 'wb') as f:
1072 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') and None
1045 ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') and None
1073 $ hg ci -qAm0
1046 $ hg ci -qAm0
1074 >>> with open('a', 'wb') as f:
1047 >>> with open('a', 'wb') as f:
1075 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') and None
1048 ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') and None
1076 $ hg ci -m1
1049 $ hg ci -m1
1077
1050
1078 $ hg annotate -r0 a | "$PYTHON" "$TESTTMP/substcr.py"
1051 $ hg annotate -r0 a | "$PYTHON" "$TESTTMP/substcr.py"
1079 0: 0a[CR]0b[CR]
1052 0: 0a[CR]0b[CR]
1080 0: 0c[CR]0d[CR]
1053 0: 0c[CR]0d[CR]
1081 0: 0e
1054 0: 0e
1082 0: 0f
1055 0: 0f
1083 0: 0g
1056 0: 0g
1084 $ hg annotate -r1 a | "$PYTHON" "$TESTTMP/substcr.py"
1057 $ hg annotate -r1 a | "$PYTHON" "$TESTTMP/substcr.py"
1085 0: 0a[CR]0b[CR]
1058 0: 0a[CR]0b[CR]
1086 1: 1c[CR]1d[CR]
1059 1: 1c[CR]1d[CR]
1087 0: 0e
1060 0: 0e
1088 1: 1f
1061 1: 1f
1089 0: 0g
1062 0: 0g
1090
1063
1091 $ cd ..
1064 $ cd ..
1092
1065
1093 Annotate with linkrev pointing to another branch
1066 Annotate with linkrev pointing to another branch
1094 ------------------------------------------------
1067 ------------------------------------------------
1095
1068
1096 create history with a filerev whose linkrev points to another branch
1069 create history with a filerev whose linkrev points to another branch
1097
1070
1098 $ hg init branchedlinkrev
1071 $ hg init branchedlinkrev
1099 $ cd branchedlinkrev
1072 $ cd branchedlinkrev
1100 $ echo A > a
1073 $ echo A > a
1101 $ hg commit -Am 'contentA'
1074 $ hg commit -Am 'contentA'
1102 adding a
1075 adding a
1103 $ echo B >> a
1076 $ echo B >> a
1104 $ hg commit -m 'contentB'
1077 $ hg commit -m 'contentB'
1105 $ hg up --rev 'desc(contentA)'
1078 $ hg up --rev 'desc(contentA)'
1106 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1079 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1107 $ echo unrelated > unrelated
1080 $ echo unrelated > unrelated
1108 $ hg commit -Am 'unrelated'
1081 $ hg commit -Am 'unrelated'
1109 adding unrelated
1082 adding unrelated
1110 created new head
1083 created new head
1111 $ hg graft -r 'desc(contentB)'
1084 $ hg graft -r 'desc(contentB)'
1112 grafting 1:fd27c222e3e6 "contentB"
1085 grafting 1:fd27c222e3e6 "contentB"
1113 $ echo C >> a
1086 $ echo C >> a
1114 $ hg commit -m 'contentC'
1087 $ hg commit -m 'contentC'
1115 $ echo W >> a
1088 $ echo W >> a
1116 $ hg log -G
1089 $ hg log -G
1117 @ changeset: 4:072f1e8df249
1090 @ changeset: 4:072f1e8df249
1118 | tag: tip
1091 | tag: tip
1119 | user: test
1092 | user: test
1120 | date: Thu Jan 01 00:00:00 1970 +0000
1093 | date: Thu Jan 01 00:00:00 1970 +0000
1121 | summary: contentC
1094 | summary: contentC
1122 |
1095 |
1123 o changeset: 3:ff38df03cc4b
1096 o changeset: 3:ff38df03cc4b
1124 | user: test
1097 | user: test
1125 | date: Thu Jan 01 00:00:00 1970 +0000
1098 | date: Thu Jan 01 00:00:00 1970 +0000
1126 | summary: contentB
1099 | summary: contentB
1127 |
1100 |
1128 o changeset: 2:62aaf3f6fc06
1101 o changeset: 2:62aaf3f6fc06
1129 | parent: 0:f0932f74827e
1102 | parent: 0:f0932f74827e
1130 | user: test
1103 | user: test
1131 | date: Thu Jan 01 00:00:00 1970 +0000
1104 | date: Thu Jan 01 00:00:00 1970 +0000
1132 | summary: unrelated
1105 | summary: unrelated
1133 |
1106 |
1134 | o changeset: 1:fd27c222e3e6
1107 | o changeset: 1:fd27c222e3e6
1135 |/ user: test
1108 |/ user: test
1136 | date: Thu Jan 01 00:00:00 1970 +0000
1109 | date: Thu Jan 01 00:00:00 1970 +0000
1137 | summary: contentB
1110 | summary: contentB
1138 |
1111 |
1139 o changeset: 0:f0932f74827e
1112 o changeset: 0:f0932f74827e
1140 user: test
1113 user: test
1141 date: Thu Jan 01 00:00:00 1970 +0000
1114 date: Thu Jan 01 00:00:00 1970 +0000
1142 summary: contentA
1115 summary: contentA
1143
1116
1144
1117
1145 Annotate should list ancestor of starting revision only
1118 Annotate should list ancestor of starting revision only
1146
1119
1147 $ hg annotate a
1120 $ hg annotate a
1148 0: A
1121 0: A
1149 3: B
1122 3: B
1150 4: C
1123 4: C
1151
1124
1152 $ hg annotate a -r 'wdir()'
1125 $ hg annotate a -r 'wdir()'
1153 0 : A
1126 0 : A
1154 3 : B
1127 3 : B
1155 4 : C
1128 4 : C
1156 4+: W
1129 4+: W
1157
1130
1158 Even when the starting revision is the linkrev-shadowed one:
1131 Even when the starting revision is the linkrev-shadowed one:
1159
1132
1160 $ hg annotate a -r 3
1133 $ hg annotate a -r 3
1161 0: A
1134 0: A
1162 3: B
1135 3: B
1163
1136
1164 $ cd ..
1137 $ cd ..
1165
1138
1166 Issue5360: Deleted chunk in p1 of a merge changeset
1139 Issue5360: Deleted chunk in p1 of a merge changeset
1167
1140
1168 $ hg init repo-5360
1141 $ hg init repo-5360
1169 $ cd repo-5360
1142 $ cd repo-5360
1170 $ echo 1 > a
1143 $ echo 1 > a
1171 $ hg commit -A a -m 1
1144 $ hg commit -A a -m 1
1172 $ echo 2 >> a
1145 $ echo 2 >> a
1173 $ hg commit -m 2
1146 $ hg commit -m 2
1174 $ echo a > a
1147 $ echo a > a
1175 $ hg commit -m a
1148 $ hg commit -m a
1176 $ hg update '.^' -q
1149 $ hg update '.^' -q
1177 $ echo 3 >> a
1150 $ echo 3 >> a
1178 $ hg commit -m 3 -q
1151 $ hg commit -m 3 -q
1179 $ hg merge 2 -q
1152 $ hg merge 2 -q
1180 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1153 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
1181 [1]
1154 [1]
1182 $ cat a
1155 $ cat a
1183 <<<<<<< working copy: 0a068f0261cf - test: 3
1156 <<<<<<< working copy: 0a068f0261cf - test: 3
1184 1
1157 1
1185 2
1158 2
1186 3
1159 3
1187 ||||||| base
1160 ||||||| base
1188 1
1161 1
1189 2
1162 2
1190 =======
1163 =======
1191 a
1164 a
1192 >>>>>>> merge rev: 9409851bc20a - test: a
1165 >>>>>>> merge rev: 9409851bc20a - test: a
1193 $ cat > a << EOF
1166 $ cat > a << EOF
1194 > b
1167 > b
1195 > 1
1168 > 1
1196 > 2
1169 > 2
1197 > 3
1170 > 3
1198 > a
1171 > a
1199 > EOF
1172 > EOF
1200 $ hg resolve --mark -q
1173 $ hg resolve --mark -q
1201 $ rm a.orig
1174 $ rm a.orig
1202 $ hg commit -m m
1175 $ hg commit -m m
1203 $ hg annotate a
1176 $ hg annotate a
1204 4: b
1177 4: b
1205 0: 1
1178 0: 1
1206 1: 2
1179 1: 2
1207 3: 3
1180 3: 3
1208 2: a
1181 2: a
1209
1182
1210 $ cd ..
1183 $ cd ..
@@ -1,1299 +1,1298 b''
1 $ hg init
1 $ hg init
2
2
3 Setup:
3 Setup:
4
4
5 $ echo a >> a
5 $ echo a >> a
6 $ hg ci -Am 'base'
6 $ hg ci -Am 'base'
7 adding a
7 adding a
8
8
9 Refuse to amend public csets:
9 Refuse to amend public csets:
10
10
11 $ hg phase -r . -p
11 $ hg phase -r . -p
12 $ hg ci --amend
12 $ hg ci --amend
13 abort: cannot amend public changesets
13 abort: cannot amend public changesets
14 (see 'hg help phases' for details)
14 (see 'hg help phases' for details)
15 [255]
15 [255]
16 $ hg phase -r . -f -d
16 $ hg phase -r . -f -d
17
17
18 $ echo a >> a
18 $ echo a >> a
19 $ hg ci -Am 'base1'
19 $ hg ci -Am 'base1'
20
20
21 Nothing to amend:
21 Nothing to amend:
22
22
23 $ hg ci --amend -m 'base1'
23 $ hg ci --amend -m 'base1'
24 nothing changed
24 nothing changed
25 [1]
25 [1]
26
26
27 $ cat >> $HGRCPATH <<EOF
27 $ cat >> $HGRCPATH <<EOF
28 > [hooks]
28 > [hooks]
29 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
29 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
30 > EOF
30 > EOF
31
31
32 Amending changeset with changes in working dir:
32 Amending changeset with changes in working dir:
33 (and check that --message does not trigger an editor)
33 (and check that --message does not trigger an editor)
34
34
35 $ echo a >> a
35 $ echo a >> a
36 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
36 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
37 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
37 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
38 43f1ba15f28a tip
38 43f1ba15f28a tip
39 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
39 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
40 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
40 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
41 $ hg diff -c .
41 $ hg diff -c .
42 diff -r ad120869acf0 -r 43f1ba15f28a a
42 diff -r ad120869acf0 -r 43f1ba15f28a a
43 --- a/a Thu Jan 01 00:00:00 1970 +0000
43 --- a/a Thu Jan 01 00:00:00 1970 +0000
44 +++ b/a Thu Jan 01 00:00:00 1970 +0000
44 +++ b/a Thu Jan 01 00:00:00 1970 +0000
45 @@ -1,1 +1,3 @@
45 @@ -1,1 +1,3 @@
46 a
46 a
47 +a
47 +a
48 +a
48 +a
49 $ hg log
49 $ hg log
50 changeset: 1:43f1ba15f28a
50 changeset: 1:43f1ba15f28a
51 tag: tip
51 tag: tip
52 user: test
52 user: test
53 date: Thu Jan 01 00:00:00 1970 +0000
53 date: Thu Jan 01 00:00:00 1970 +0000
54 summary: amend base1
54 summary: amend base1
55
55
56 changeset: 0:ad120869acf0
56 changeset: 0:ad120869acf0
57 user: test
57 user: test
58 date: Thu Jan 01 00:00:00 1970 +0000
58 date: Thu Jan 01 00:00:00 1970 +0000
59 summary: base
59 summary: base
60
60
61
61
62 Check proper abort for empty message
62 Check proper abort for empty message
63
63
64 $ cat > editor.sh << '__EOF__'
64 $ cat > editor.sh << '__EOF__'
65 > #!/bin/sh
65 > #!/bin/sh
66 > echo "" > "$1"
66 > echo "" > "$1"
67 > __EOF__
67 > __EOF__
68
68
69 Update the existing file to ensure that the dirstate is not in pending state
69 Update the existing file to ensure that the dirstate is not in pending state
70 (where the status of some files in the working copy is not known yet). This in
70 (where the status of some files in the working copy is not known yet). This in
71 turn ensures that when the transaction is aborted due to an empty message during
71 turn ensures that when the transaction is aborted due to an empty message during
72 the amend, there should be no rollback.
72 the amend, there should be no rollback.
73 $ echo a >> a
73 $ echo a >> a
74
74
75 $ echo b > b
75 $ echo b > b
76 $ hg add b
76 $ hg add b
77 $ hg summary
77 $ hg summary
78 parent: 1:43f1ba15f28a tip
78 parent: 1:43f1ba15f28a tip
79 amend base1
79 amend base1
80 branch: default
80 branch: default
81 commit: 1 modified, 1 added, 1 unknown
81 commit: 1 modified, 1 added, 1 unknown
82 update: (current)
82 update: (current)
83 phases: 2 draft
83 phases: 2 draft
84 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
84 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
85 abort: empty commit message
85 abort: empty commit message
86 [255]
86 [255]
87 $ hg summary
87 $ hg summary
88 parent: 1:43f1ba15f28a tip
88 parent: 1:43f1ba15f28a tip
89 amend base1
89 amend base1
90 branch: default
90 branch: default
91 commit: 1 modified, 1 added, 1 unknown
91 commit: 1 modified, 1 added, 1 unknown
92 update: (current)
92 update: (current)
93 phases: 2 draft
93 phases: 2 draft
94
94
95 Add new file along with modified existing file:
95 Add new file along with modified existing file:
96 $ hg ci --amend -m 'amend base1 new file'
96 $ hg ci --amend -m 'amend base1 new file'
97 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
97 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
98
98
99 Remove file that was added in amended commit:
99 Remove file that was added in amended commit:
100 (and test logfile option)
100 (and test logfile option)
101 (and test that logfile option do not trigger an editor)
101 (and test that logfile option do not trigger an editor)
102
102
103 $ hg rm b
103 $ hg rm b
104 $ echo 'amend base1 remove new file' > ../logfile
104 $ echo 'amend base1 remove new file' > ../logfile
105 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
105 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
106 saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
106 saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
107
107
108 $ hg cat b
108 $ hg cat b
109 b: no such file in rev 47343646fa3d
109 b: no such file in rev 47343646fa3d
110 [1]
110 [1]
111
111
112 No changes, just a different message:
112 No changes, just a different message:
113
113
114 $ hg ci -v --amend -m 'no changes, new message'
114 $ hg ci -v --amend -m 'no changes, new message'
115 amending changeset 47343646fa3d
115 amending changeset 47343646fa3d
116 copying changeset 47343646fa3d to ad120869acf0
116 copying changeset 47343646fa3d to ad120869acf0
117 committing files:
117 committing files:
118 a
118 a
119 committing manifest
119 committing manifest
120 committing changelog
120 committing changelog
121 1 changesets found
121 1 changesets found
122 uncompressed size of bundle content:
122 uncompressed size of bundle content:
123 254 (changelog)
123 254 (changelog)
124 163 (manifests)
124 163 (manifests)
125 131 a
125 131 a
126 saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
126 saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
127 1 changesets found
127 1 changesets found
128 uncompressed size of bundle content:
128 uncompressed size of bundle content:
129 250 (changelog)
129 250 (changelog)
130 163 (manifests)
130 163 (manifests)
131 131 a
131 131 a
132 adding branch
132 adding branch
133 adding changesets
133 adding changesets
134 adding manifests
134 adding manifests
135 adding file changes
135 adding file changes
136 added 1 changesets with 1 changes to 1 files
136 added 1 changesets with 1 changes to 1 files
137 committed changeset 1:401431e913a1
137 committed changeset 1:401431e913a1
138 $ hg diff -c .
138 $ hg diff -c .
139 diff -r ad120869acf0 -r 401431e913a1 a
139 diff -r ad120869acf0 -r 401431e913a1 a
140 --- a/a Thu Jan 01 00:00:00 1970 +0000
140 --- a/a Thu Jan 01 00:00:00 1970 +0000
141 +++ b/a Thu Jan 01 00:00:00 1970 +0000
141 +++ b/a Thu Jan 01 00:00:00 1970 +0000
142 @@ -1,1 +1,4 @@
142 @@ -1,1 +1,4 @@
143 a
143 a
144 +a
144 +a
145 +a
145 +a
146 +a
146 +a
147 $ hg log
147 $ hg log
148 changeset: 1:401431e913a1
148 changeset: 1:401431e913a1
149 tag: tip
149 tag: tip
150 user: test
150 user: test
151 date: Thu Jan 01 00:00:00 1970 +0000
151 date: Thu Jan 01 00:00:00 1970 +0000
152 summary: no changes, new message
152 summary: no changes, new message
153
153
154 changeset: 0:ad120869acf0
154 changeset: 0:ad120869acf0
155 user: test
155 user: test
156 date: Thu Jan 01 00:00:00 1970 +0000
156 date: Thu Jan 01 00:00:00 1970 +0000
157 summary: base
157 summary: base
158
158
159
159
160 Disable default date on commit so when -d isn't given, the old date is preserved:
160 Disable default date on commit so when -d isn't given, the old date is preserved:
161
161
162 $ echo '[defaults]' >> $HGRCPATH
162 $ echo '[defaults]' >> $HGRCPATH
163 $ echo 'commit=' >> $HGRCPATH
163 $ echo 'commit=' >> $HGRCPATH
164
164
165 Test -u/-d:
165 Test -u/-d:
166
166
167 $ cat > .hg/checkeditform.sh <<EOF
167 $ cat > .hg/checkeditform.sh <<EOF
168 > env | grep HGEDITFORM
168 > env | grep HGEDITFORM
169 > true
169 > true
170 > EOF
170 > EOF
171 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
171 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
172 HGEDITFORM=commit.amend.normal
172 HGEDITFORM=commit.amend.normal
173 saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
173 saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
174 $ echo a >> a
174 $ echo a >> a
175 $ hg ci --amend -u foo -d '1 0'
175 $ hg ci --amend -u foo -d '1 0'
176 saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
176 saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
177 $ hg log -r .
177 $ hg log -r .
178 changeset: 1:a9a13940fc03
178 changeset: 1:a9a13940fc03
179 tag: tip
179 tag: tip
180 user: foo
180 user: foo
181 date: Thu Jan 01 00:00:01 1970 +0000
181 date: Thu Jan 01 00:00:01 1970 +0000
182 summary: no changes, new message
182 summary: no changes, new message
183
183
184
184
185 Open editor with old commit message if a message isn't given otherwise:
185 Open editor with old commit message if a message isn't given otherwise:
186
186
187 $ cat > editor.sh << '__EOF__'
187 $ cat > editor.sh << '__EOF__'
188 > #!/bin/sh
188 > #!/bin/sh
189 > cat $1
189 > cat $1
190 > echo "another precious commit message" > "$1"
190 > echo "another precious commit message" > "$1"
191 > __EOF__
191 > __EOF__
192
192
193 at first, test saving last-message.txt
193 at first, test saving last-message.txt
194
194
195 $ cat > .hg/hgrc << '__EOF__'
195 $ cat > .hg/hgrc << '__EOF__'
196 > [hooks]
196 > [hooks]
197 > pretxncommit.test-saving-last-message = false
197 > pretxncommit.test-saving-last-message = false
198 > __EOF__
198 > __EOF__
199
199
200 $ rm -f .hg/last-message.txt
200 $ rm -f .hg/last-message.txt
201 $ hg commit --amend -v -m "message given from command line"
201 $ hg commit --amend -v -m "message given from command line"
202 amending changeset a9a13940fc03
202 amending changeset a9a13940fc03
203 copying changeset a9a13940fc03 to ad120869acf0
203 copying changeset a9a13940fc03 to ad120869acf0
204 committing files:
204 committing files:
205 a
205 a
206 committing manifest
206 committing manifest
207 committing changelog
207 committing changelog
208 running hook pretxncommit.test-saving-last-message: false
208 running hook pretxncommit.test-saving-last-message: false
209 transaction abort!
209 transaction abort!
210 rollback completed
210 rollback completed
211 abort: pretxncommit.test-saving-last-message hook exited with status 1
211 abort: pretxncommit.test-saving-last-message hook exited with status 1
212 [255]
212 [255]
213 $ cat .hg/last-message.txt
213 $ cat .hg/last-message.txt
214 message given from command line (no-eol)
214 message given from command line (no-eol)
215
215
216 $ rm -f .hg/last-message.txt
216 $ rm -f .hg/last-message.txt
217 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
217 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
218 amending changeset a9a13940fc03
218 amending changeset a9a13940fc03
219 copying changeset a9a13940fc03 to ad120869acf0
219 copying changeset a9a13940fc03 to ad120869acf0
220 no changes, new message
220 no changes, new message
221
221
222
222
223 HG: Enter commit message. Lines beginning with 'HG:' are removed.
223 HG: Enter commit message. Lines beginning with 'HG:' are removed.
224 HG: Leave message empty to abort commit.
224 HG: Leave message empty to abort commit.
225 HG: --
225 HG: --
226 HG: user: foo
226 HG: user: foo
227 HG: branch 'default'
227 HG: branch 'default'
228 HG: changed a
228 HG: changed a
229 committing files:
229 committing files:
230 a
230 a
231 committing manifest
231 committing manifest
232 committing changelog
232 committing changelog
233 running hook pretxncommit.test-saving-last-message: false
233 running hook pretxncommit.test-saving-last-message: false
234 transaction abort!
234 transaction abort!
235 rollback completed
235 rollback completed
236 abort: pretxncommit.test-saving-last-message hook exited with status 1
236 abort: pretxncommit.test-saving-last-message hook exited with status 1
237 [255]
237 [255]
238
238
239 $ cat .hg/last-message.txt
239 $ cat .hg/last-message.txt
240 another precious commit message
240 another precious commit message
241
241
242 $ cat > .hg/hgrc << '__EOF__'
242 $ cat > .hg/hgrc << '__EOF__'
243 > [hooks]
243 > [hooks]
244 > pretxncommit.test-saving-last-message =
244 > pretxncommit.test-saving-last-message =
245 > __EOF__
245 > __EOF__
246
246
247 then, test editing custom commit message
247 then, test editing custom commit message
248
248
249 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
249 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
250 amending changeset a9a13940fc03
250 amending changeset a9a13940fc03
251 copying changeset a9a13940fc03 to ad120869acf0
251 copying changeset a9a13940fc03 to ad120869acf0
252 no changes, new message
252 no changes, new message
253
253
254
254
255 HG: Enter commit message. Lines beginning with 'HG:' are removed.
255 HG: Enter commit message. Lines beginning with 'HG:' are removed.
256 HG: Leave message empty to abort commit.
256 HG: Leave message empty to abort commit.
257 HG: --
257 HG: --
258 HG: user: foo
258 HG: user: foo
259 HG: branch 'default'
259 HG: branch 'default'
260 HG: changed a
260 HG: changed a
261 committing files:
261 committing files:
262 a
262 a
263 committing manifest
263 committing manifest
264 committing changelog
264 committing changelog
265 1 changesets found
265 1 changesets found
266 uncompressed size of bundle content:
266 uncompressed size of bundle content:
267 249 (changelog)
267 249 (changelog)
268 163 (manifests)
268 163 (manifests)
269 133 a
269 133 a
270 saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
270 saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
271 1 changesets found
271 1 changesets found
272 uncompressed size of bundle content:
272 uncompressed size of bundle content:
273 257 (changelog)
273 257 (changelog)
274 163 (manifests)
274 163 (manifests)
275 133 a
275 133 a
276 adding branch
276 adding branch
277 adding changesets
277 adding changesets
278 adding manifests
278 adding manifests
279 adding file changes
279 adding file changes
280 added 1 changesets with 1 changes to 1 files
280 added 1 changesets with 1 changes to 1 files
281 committed changeset 1:64a124ba1b44
281 committed changeset 1:64a124ba1b44
282
282
283 Same, but with changes in working dir (different code path):
283 Same, but with changes in working dir (different code path):
284
284
285 $ echo a >> a
285 $ echo a >> a
286 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
286 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
287 amending changeset 64a124ba1b44
287 amending changeset 64a124ba1b44
288 another precious commit message
288 another precious commit message
289
289
290
290
291 HG: Enter commit message. Lines beginning with 'HG:' are removed.
291 HG: Enter commit message. Lines beginning with 'HG:' are removed.
292 HG: Leave message empty to abort commit.
292 HG: Leave message empty to abort commit.
293 HG: --
293 HG: --
294 HG: user: foo
294 HG: user: foo
295 HG: branch 'default'
295 HG: branch 'default'
296 HG: changed a
296 HG: changed a
297 committing files:
297 committing files:
298 a
298 a
299 committing manifest
299 committing manifest
300 committing changelog
300 committing changelog
301 1 changesets found
301 1 changesets found
302 uncompressed size of bundle content:
302 uncompressed size of bundle content:
303 257 (changelog)
303 257 (changelog)
304 163 (manifests)
304 163 (manifests)
305 133 a
305 133 a
306 saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
306 saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
307 1 changesets found
307 1 changesets found
308 uncompressed size of bundle content:
308 uncompressed size of bundle content:
309 257 (changelog)
309 257 (changelog)
310 163 (manifests)
310 163 (manifests)
311 135 a
311 135 a
312 adding branch
312 adding branch
313 adding changesets
313 adding changesets
314 adding manifests
314 adding manifests
315 adding file changes
315 adding file changes
316 added 1 changesets with 1 changes to 1 files
316 added 1 changesets with 1 changes to 1 files
317 committed changeset 1:7892795b8e38
317 committed changeset 1:7892795b8e38
318
318
319 $ rm editor.sh
319 $ rm editor.sh
320 $ hg log -r .
320 $ hg log -r .
321 changeset: 1:7892795b8e38
321 changeset: 1:7892795b8e38
322 tag: tip
322 tag: tip
323 user: foo
323 user: foo
324 date: Thu Jan 01 00:00:01 1970 +0000
324 date: Thu Jan 01 00:00:01 1970 +0000
325 summary: another precious commit message
325 summary: another precious commit message
326
326
327
327
328 Moving bookmarks, preserve active bookmark:
328 Moving bookmarks, preserve active bookmark:
329
329
330 $ hg book book1
330 $ hg book book1
331 $ hg book book2
331 $ hg book book2
332 $ hg ci --amend -m 'move bookmarks'
332 $ hg ci --amend -m 'move bookmarks'
333 saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
333 saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
334 $ hg book
334 $ hg book
335 book1 1:8311f17e2616
335 book1 1:8311f17e2616
336 * book2 1:8311f17e2616
336 * book2 1:8311f17e2616
337 $ echo a >> a
337 $ echo a >> a
338 $ hg ci --amend -m 'move bookmarks'
338 $ hg ci --amend -m 'move bookmarks'
339 saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
339 saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
340 $ hg book
340 $ hg book
341 book1 1:a3b65065808c
341 book1 1:a3b65065808c
342 * book2 1:a3b65065808c
342 * book2 1:a3b65065808c
343
343
344 abort does not loose bookmarks
344 abort does not loose bookmarks
345
345
346 $ cat > editor.sh << '__EOF__'
346 $ cat > editor.sh << '__EOF__'
347 > #!/bin/sh
347 > #!/bin/sh
348 > echo "" > "$1"
348 > echo "" > "$1"
349 > __EOF__
349 > __EOF__
350 $ echo a >> a
350 $ echo a >> a
351 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
351 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
352 abort: empty commit message
352 abort: empty commit message
353 [255]
353 [255]
354 $ hg book
354 $ hg book
355 book1 1:a3b65065808c
355 book1 1:a3b65065808c
356 * book2 1:a3b65065808c
356 * book2 1:a3b65065808c
357 $ hg revert -Caq
357 $ hg revert -Caq
358 $ rm editor.sh
358 $ rm editor.sh
359
359
360 $ echo '[defaults]' >> $HGRCPATH
360 $ echo '[defaults]' >> $HGRCPATH
361 $ echo "commit=-d '0 0'" >> $HGRCPATH
361 $ echo "commit=-d '0 0'" >> $HGRCPATH
362
362
363 Moving branches:
363 Moving branches:
364
364
365 $ hg branch foo
365 $ hg branch foo
366 marked working directory as branch foo
366 marked working directory as branch foo
367 (branches are permanent and global, did you want a bookmark?)
367 (branches are permanent and global, did you want a bookmark?)
368 $ echo a >> a
368 $ echo a >> a
369 $ hg ci -m 'branch foo'
369 $ hg ci -m 'branch foo'
370 $ hg branch default -f
370 $ hg branch default -f
371 marked working directory as branch default
371 marked working directory as branch default
372 $ hg ci --amend -m 'back to default'
372 $ hg ci --amend -m 'back to default'
373 saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
373 saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
374 $ hg branches
374 $ hg branches
375 default 2:9c07515f2650
375 default 2:9c07515f2650
376
376
377 Close branch:
377 Close branch:
378
378
379 $ hg up -q 0
379 $ hg up -q 0
380 $ echo b >> b
380 $ echo b >> b
381 $ hg branch foo
381 $ hg branch foo
382 marked working directory as branch foo
382 marked working directory as branch foo
383 (branches are permanent and global, did you want a bookmark?)
383 (branches are permanent and global, did you want a bookmark?)
384 $ hg ci -Am 'fork'
384 $ hg ci -Am 'fork'
385 adding b
385 adding b
386 $ echo b >> b
386 $ echo b >> b
387 $ hg ci -mb
387 $ hg ci -mb
388 $ hg ci --amend --close-branch -m 'closing branch foo'
388 $ hg ci --amend --close-branch -m 'closing branch foo'
389 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
389 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
390
390
391 Same thing, different code path:
391 Same thing, different code path:
392
392
393 $ echo b >> b
393 $ echo b >> b
394 $ hg ci -m 'reopen branch'
394 $ hg ci -m 'reopen branch'
395 reopening closed branch head 4
395 reopening closed branch head 4
396 $ echo b >> b
396 $ echo b >> b
397 $ hg ci --amend --close-branch
397 $ hg ci --amend --close-branch
398 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
398 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
399 $ hg branches
399 $ hg branches
400 default 2:9c07515f2650
400 default 2:9c07515f2650
401
401
402 Refuse to amend during a merge:
402 Refuse to amend during a merge:
403
403
404 $ hg up -q default
404 $ hg up -q default
405 $ hg merge foo
405 $ hg merge foo
406 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
406 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 (branch merge, don't forget to commit)
407 (branch merge, don't forget to commit)
408 $ hg ci --amend
408 $ hg ci --amend
409 abort: cannot amend while merging
409 abort: cannot amend while merging
410 [255]
410 [255]
411 $ hg ci -m 'merge'
411 $ hg ci -m 'merge'
412
412
413 Refuse to amend if there is a merge conflict (issue5805):
413 Refuse to amend if there is a merge conflict (issue5805):
414
414
415 $ hg up -q foo
415 $ hg up -q foo
416 $ echo c > a
416 $ echo c > a
417 $ hg up default -t :fail
417 $ hg up default -t :fail
418 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
418 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
419 use 'hg resolve' to retry unresolved file merges
419 use 'hg resolve' to retry unresolved file merges
420 [1]
420 [1]
421 $ hg resolve -l
421 $ hg resolve -l
422 U a
422 U a
423
423
424 $ hg ci --amend
424 $ hg ci --amend
425 abort: unresolved merge conflicts (see 'hg help resolve')
425 abort: unresolved merge conflicts (see 'hg help resolve')
426 [255]
426 [255]
427
427
428 $ hg up -qC .
428 $ hg up -qC .
429
429
430 Follow copies/renames:
430 Follow copies/renames:
431
431
432 $ hg mv b c
432 $ hg mv b c
433 $ hg ci -m 'b -> c'
433 $ hg ci -m 'b -> c'
434 $ hg mv c d
434 $ hg mv c d
435 $ hg ci --amend -m 'b -> d'
435 $ hg ci --amend -m 'b -> d'
436 saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
436 saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
437 $ hg st --rev '.^' --copies d
437 $ hg st --rev '.^' --copies d
438 A d
438 A d
439 b
439 b
440 $ hg cp d e
440 $ hg cp d e
441 $ hg ci -m 'e = d'
441 $ hg ci -m 'e = d'
442 $ hg cp e f
442 $ hg cp e f
443 $ hg ci --amend -m 'f = d'
443 $ hg ci --amend -m 'f = d'
444 saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
444 saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
445 $ hg st --rev '.^' --copies f
445 $ hg st --rev '.^' --copies f
446 A f
446 A f
447 d
447 d
448
448
449 $ mv f f.orig
449 $ mv f f.orig
450 $ hg rm -A f
450 $ hg rm -A f
451 $ hg ci -m removef
451 $ hg ci -m removef
452 $ hg cp a f
452 $ hg cp a f
453 $ mv f.orig f
453 $ mv f.orig f
454 $ hg ci --amend -m replacef
454 $ hg ci --amend -m replacef
455 saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
455 saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
456 $ hg st --change . --copies
456 $ hg st --change . --copies
457 $ hg log -r . --template "{file_copies}\n"
457 $ hg log -r . --template "{file_copies}\n"
458
458
459
459
460 Move added file (issue3410):
460 Move added file (issue3410):
461
461
462 $ echo g >> g
462 $ echo g >> g
463 $ hg ci -Am g
463 $ hg ci -Am g
464 adding g
464 adding g
465 $ hg mv g h
465 $ hg mv g h
466 $ hg ci --amend
466 $ hg ci --amend
467 saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
467 saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
468 $ hg st --change . --copies h
468 $ hg st --change . --copies h
469 A h
469 A h
470 $ hg log -r . --template "{file_copies}\n"
470 $ hg log -r . --template "{file_copies}\n"
471
471
472
472
473 Can't rollback an amend:
473 Can't rollback an amend:
474
474
475 $ hg rollback
475 $ hg rollback
476 no rollback information available
476 no rollback information available
477 [1]
477 [1]
478
478
479 Preserve extra dict (issue3430):
479 Preserve extra dict (issue3430):
480
480
481 $ hg branch a
481 $ hg branch a
482 marked working directory as branch a
482 marked working directory as branch a
483 (branches are permanent and global, did you want a bookmark?)
483 (branches are permanent and global, did you want a bookmark?)
484 $ echo a >> a
484 $ echo a >> a
485 $ hg ci -ma
485 $ hg ci -ma
486 $ hg ci --amend -m "a'"
486 $ hg ci --amend -m "a'"
487 saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
487 saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
488 $ hg log -r . --template "{branch}\n"
488 $ hg log -r . --template "{branch}\n"
489 a
489 a
490 $ hg ci --amend -m "a''"
490 $ hg ci --amend -m "a''"
491 saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
491 saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
492 $ hg log -r . --template "{branch}\n"
492 $ hg log -r . --template "{branch}\n"
493 a
493 a
494
494
495 Also preserve other entries in the dict that are in the old commit,
495 Also preserve other entries in the dict that are in the old commit,
496 first graft something so there's an additional entry:
496 first graft something so there's an additional entry:
497
497
498 $ hg up 0 -q
498 $ hg up 0 -q
499 $ echo z > z
499 $ echo z > z
500 $ hg ci -Am 'fork'
500 $ hg ci -Am 'fork'
501 adding z
501 adding z
502 created new head
502 created new head
503 $ hg up 11
503 $ hg up 11
504 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
504 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
505 $ hg graft 12
505 $ hg graft 12
506 grafting 12:2647734878ef "fork" (tip)
506 grafting 12:2647734878ef "fork" (tip)
507 $ hg ci --amend -m 'graft amend'
507 $ hg ci --amend -m 'graft amend'
508 saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
508 saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
509 $ hg log -r . --debug | grep extra
509 $ hg log -r . --debug | grep extra
510 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
510 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
511 extra: branch=a
511 extra: branch=a
512 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
512 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
513
513
514 Preserve phase
514 Preserve phase
515
515
516 $ hg phase '.^::.'
516 $ hg phase '.^::.'
517 11: draft
517 11: draft
518 13: draft
518 13: draft
519 $ hg phase --secret --force .
519 $ hg phase --secret --force .
520 $ hg phase '.^::.'
520 $ hg phase '.^::.'
521 11: draft
521 11: draft
522 13: secret
522 13: secret
523 $ hg commit --amend -m 'amend for phase' -q
523 $ hg commit --amend -m 'amend for phase' -q
524 $ hg phase '.^::.'
524 $ hg phase '.^::.'
525 11: draft
525 11: draft
526 13: secret
526 13: secret
527
527
528 Test amend with obsolete
528 Test amend with obsolete
529 ---------------------------
529 ---------------------------
530
530
531 Enable obsolete
531 Enable obsolete
532
532
533 $ cat >> $HGRCPATH << EOF
533 $ cat >> $HGRCPATH << EOF
534 > [experimental]
534 > [experimental]
535 > evolution.createmarkers=True
535 > evolution.createmarkers=True
536 > evolution.allowunstable=True
536 > evolution.allowunstable=True
537 > EOF
537 > EOF
538
538
539 Amend with no files changes
539 Amend with no files changes
540
540
541 $ hg id -n
541 $ hg id -n
542 13
542 13
543 $ hg ci --amend -m 'babar'
543 $ hg ci --amend -m 'babar'
544 $ hg id -n
544 $ hg id -n
545 14
545 14
546 $ hg log -Gl 3 --style=compact
546 $ hg log -Gl 3 --style=compact
547 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
547 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
548 | babar
548 | babar
549 |
549 |
550 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
550 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
551 | | fork
551 | | fork
552 | ~
552 | ~
553 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
553 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
554 | a''
554 | a''
555 ~
555 ~
556 $ hg log -Gl 4 --hidden --style=compact
556 $ hg log -Gl 4 --hidden --style=compact
557 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
557 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
558 | babar
558 | babar
559 |
559 |
560 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
560 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
561 |/ amend for phase
561 |/ amend for phase
562 |
562 |
563 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
563 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
564 | | fork
564 | | fork
565 | ~
565 | ~
566 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
566 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
567 | a''
567 | a''
568 ~
568 ~
569
569
570 Amend with files changes
570 Amend with files changes
571
571
572 (note: the extra commit over 15 is a temporary junk I would be happy to get
572 (note: the extra commit over 15 is a temporary junk I would be happy to get
573 ride of)
573 ride of)
574
574
575 $ echo 'babar' >> a
575 $ echo 'babar' >> a
576 $ hg commit --amend
576 $ hg commit --amend
577 $ hg log -Gl 6 --hidden --style=compact
577 $ hg log -Gl 6 --hidden --style=compact
578 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
578 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
579 | babar
579 | babar
580 |
580 |
581 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
581 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
582 |/ babar
582 |/ babar
583 |
583 |
584 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
584 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
585 |/ amend for phase
585 |/ amend for phase
586 |
586 |
587 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
587 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
588 | | fork
588 | | fork
589 | ~
589 | ~
590 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
590 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
591 | a''
591 | a''
592 |
592 |
593 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
593 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
594 | g
594 | g
595 ~
595 ~
596
596
597
597
598 Test that amend does not make it easy to create obsolescence cycle
598 Test that amend does not make it easy to create obsolescence cycle
599 ---------------------------------------------------------------------
599 ---------------------------------------------------------------------
600
600
601 $ hg id -r 14 --hidden
601 $ hg id -r 14 --hidden
602 682950e85999 (a)
602 682950e85999 (a)
603 $ hg revert -ar 14 --hidden
603 $ hg revert -ar 14 --hidden
604 reverting a
604 reverting a
605 $ hg commit --amend
605 $ hg commit --amend
606 $ hg id
606 $ hg id
607 37973c7e0b61 (a) tip
607 37973c7e0b61 (a) tip
608
608
609 Test that rewriting leaving instability behind is allowed
609 Test that rewriting leaving instability behind is allowed
610 ---------------------------------------------------------------------
610 ---------------------------------------------------------------------
611
611
612 $ hg up '.^'
612 $ hg up '.^'
613 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
613 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
614 $ echo 'b' >> a
614 $ echo 'b' >> a
615 $ hg log --style compact -r 'children(.)'
615 $ hg log --style compact -r 'children(.)'
616 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
616 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
617 babar
617 babar
618
618
619 $ hg commit --amend
619 $ hg commit --amend
620 1 new orphan changesets
620 1 new orphan changesets
621 $ hg log -r 'orphan()'
621 $ hg log -r 'orphan()'
622 changeset: 16:37973c7e0b61
622 changeset: 16:37973c7e0b61
623 branch: a
623 branch: a
624 parent: 11:0ddb275cfad1
624 parent: 11:0ddb275cfad1
625 user: test
625 user: test
626 date: Thu Jan 01 00:00:00 1970 +0000
626 date: Thu Jan 01 00:00:00 1970 +0000
627 instability: orphan
627 instability: orphan
628 summary: babar
628 summary: babar
629
629
630
630
631 Amend a merge changeset (with renames and conflicts from the second parent):
631 Amend a merge changeset (with renames and conflicts from the second parent):
632
632
633 $ hg up -q default
633 $ hg up -q default
634 $ hg branch -q bar
634 $ hg branch -q bar
635 $ hg cp a aa
635 $ hg cp a aa
636 $ hg mv z zz
636 $ hg mv z zz
637 $ echo cc > cc
637 $ echo cc > cc
638 $ hg add cc
638 $ hg add cc
639 $ hg ci -m aazzcc
639 $ hg ci -m aazzcc
640 $ hg up -q default
640 $ hg up -q default
641 $ echo a >> a
641 $ echo a >> a
642 $ echo dd > cc
642 $ echo dd > cc
643 $ hg add cc
643 $ hg add cc
644 $ hg ci -m aa
644 $ hg ci -m aa
645 $ hg merge -q bar
645 $ hg merge -q bar
646 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
646 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
647 [1]
647 [1]
648 $ hg resolve -m cc
648 $ hg resolve -m cc
649 (no more unresolved files)
649 (no more unresolved files)
650 $ hg ci -m 'merge bar'
650 $ hg ci -m 'merge bar'
651 $ hg log --config diff.git=1 -pr .
651 $ hg log --config diff.git=1 -pr .
652 changeset: 20:163cfd7219f7
652 changeset: 20:163cfd7219f7
653 tag: tip
653 tag: tip
654 parent: 19:30d96aeaf27b
654 parent: 19:30d96aeaf27b
655 parent: 18:1aa437659d19
655 parent: 18:1aa437659d19
656 user: test
656 user: test
657 date: Thu Jan 01 00:00:00 1970 +0000
657 date: Thu Jan 01 00:00:00 1970 +0000
658 summary: merge bar
658 summary: merge bar
659
659
660 diff --git a/a b/aa
660 diff --git a/a b/aa
661 copy from a
661 copy from a
662 copy to aa
662 copy to aa
663 diff --git a/cc b/cc
663 diff --git a/cc b/cc
664 --- a/cc
664 --- a/cc
665 +++ b/cc
665 +++ b/cc
666 @@ -1,1 +1,5 @@
666 @@ -1,1 +1,5 @@
667 +<<<<<<< working copy: 30d96aeaf27b - test: aa
667 +<<<<<<< working copy: 30d96aeaf27b - test: aa
668 dd
668 dd
669 +=======
669 +=======
670 +cc
670 +cc
671 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
671 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
672 diff --git a/z b/zz
672 diff --git a/z b/zz
673 rename from z
673 rename from z
674 rename to zz
674 rename to zz
675
675
676 $ hg debugrename aa
676 $ hg debugrename aa
677 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
677 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
678 $ hg debugrename zz
678 $ hg debugrename zz
679 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
679 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
680 $ hg debugrename cc
680 $ hg debugrename cc
681 cc not renamed
681 cc not renamed
682 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
682 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
683 HGEDITFORM=commit.amend.merge
683 HGEDITFORM=commit.amend.merge
684 $ hg log --config diff.git=1 -pr .
684 $ hg log --config diff.git=1 -pr .
685 changeset: 21:bca52d4ed186
685 changeset: 21:bca52d4ed186
686 tag: tip
686 tag: tip
687 parent: 19:30d96aeaf27b
687 parent: 19:30d96aeaf27b
688 parent: 18:1aa437659d19
688 parent: 18:1aa437659d19
689 user: test
689 user: test
690 date: Thu Jan 01 00:00:00 1970 +0000
690 date: Thu Jan 01 00:00:00 1970 +0000
691 summary: merge bar (amend message)
691 summary: merge bar (amend message)
692
692
693 diff --git a/a b/aa
693 diff --git a/a b/aa
694 copy from a
694 copy from a
695 copy to aa
695 copy to aa
696 diff --git a/cc b/cc
696 diff --git a/cc b/cc
697 --- a/cc
697 --- a/cc
698 +++ b/cc
698 +++ b/cc
699 @@ -1,1 +1,5 @@
699 @@ -1,1 +1,5 @@
700 +<<<<<<< working copy: 30d96aeaf27b - test: aa
700 +<<<<<<< working copy: 30d96aeaf27b - test: aa
701 dd
701 dd
702 +=======
702 +=======
703 +cc
703 +cc
704 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
704 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
705 diff --git a/z b/zz
705 diff --git a/z b/zz
706 rename from z
706 rename from z
707 rename to zz
707 rename to zz
708
708
709 $ hg debugrename aa
709 $ hg debugrename aa
710 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
710 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
711 $ hg debugrename zz
711 $ hg debugrename zz
712 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
712 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
713 $ hg debugrename cc
713 $ hg debugrename cc
714 cc not renamed
714 cc not renamed
715 $ hg mv zz z
715 $ hg mv zz z
716 $ hg ci --amend -m 'merge bar (undo rename)'
716 $ hg ci --amend -m 'merge bar (undo rename)'
717 $ hg log --config diff.git=1 -pr .
717 $ hg log --config diff.git=1 -pr .
718 changeset: 22:12594a98ca3f
718 changeset: 22:12594a98ca3f
719 tag: tip
719 tag: tip
720 parent: 19:30d96aeaf27b
720 parent: 19:30d96aeaf27b
721 parent: 18:1aa437659d19
721 parent: 18:1aa437659d19
722 user: test
722 user: test
723 date: Thu Jan 01 00:00:00 1970 +0000
723 date: Thu Jan 01 00:00:00 1970 +0000
724 summary: merge bar (undo rename)
724 summary: merge bar (undo rename)
725
725
726 diff --git a/a b/aa
726 diff --git a/a b/aa
727 copy from a
727 copy from a
728 copy to aa
728 copy to aa
729 diff --git a/cc b/cc
729 diff --git a/cc b/cc
730 --- a/cc
730 --- a/cc
731 +++ b/cc
731 +++ b/cc
732 @@ -1,1 +1,5 @@
732 @@ -1,1 +1,5 @@
733 +<<<<<<< working copy: 30d96aeaf27b - test: aa
733 +<<<<<<< working copy: 30d96aeaf27b - test: aa
734 dd
734 dd
735 +=======
735 +=======
736 +cc
736 +cc
737 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
737 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
738
738
739 $ hg debugrename z
739 $ hg debugrename z
740 z not renamed
740 z not renamed
741
741
742 Amend a merge changeset (with renames during the merge):
742 Amend a merge changeset (with renames during the merge):
743
743
744 $ hg up -q bar
744 $ hg up -q bar
745 $ echo x > x
745 $ echo x > x
746 $ hg add x
746 $ hg add x
747 $ hg ci -m x
747 $ hg ci -m x
748 $ hg up -q default
748 $ hg up -q default
749 $ hg merge -q bar
749 $ hg merge -q bar
750 $ hg mv aa aaa
750 $ hg mv aa aaa
751 $ echo aa >> aaa
751 $ echo aa >> aaa
752 $ hg ci -m 'merge bar again'
752 $ hg ci -m 'merge bar again'
753 $ hg log --config diff.git=1 -pr .
753 $ hg log --config diff.git=1 -pr .
754 changeset: 24:dffde028b388
754 changeset: 24:dffde028b388
755 tag: tip
755 tag: tip
756 parent: 22:12594a98ca3f
756 parent: 22:12594a98ca3f
757 parent: 23:4c94d5bc65f5
757 parent: 23:4c94d5bc65f5
758 user: test
758 user: test
759 date: Thu Jan 01 00:00:00 1970 +0000
759 date: Thu Jan 01 00:00:00 1970 +0000
760 summary: merge bar again
760 summary: merge bar again
761
761
762 diff --git a/aa b/aa
762 diff --git a/aa b/aa
763 deleted file mode 100644
763 deleted file mode 100644
764 --- a/aa
764 --- a/aa
765 +++ /dev/null
765 +++ /dev/null
766 @@ -1,2 +0,0 @@
766 @@ -1,2 +0,0 @@
767 -a
767 -a
768 -a
768 -a
769 diff --git a/aaa b/aaa
769 diff --git a/aaa b/aaa
770 new file mode 100644
770 new file mode 100644
771 --- /dev/null
771 --- /dev/null
772 +++ b/aaa
772 +++ b/aaa
773 @@ -0,0 +1,3 @@
773 @@ -0,0 +1,3 @@
774 +a
774 +a
775 +a
775 +a
776 +aa
776 +aa
777 diff --git a/x b/x
777 diff --git a/x b/x
778 new file mode 100644
778 new file mode 100644
779 --- /dev/null
779 --- /dev/null
780 +++ b/x
780 +++ b/x
781 @@ -0,0 +1,1 @@
781 @@ -0,0 +1,1 @@
782 +x
782 +x
783
783
784 $ hg debugrename aaa
784 $ hg debugrename aaa
785 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
785 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
786
786
787 Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists
787 Update to p1 with 'aaa' modified. 'aaa' was renamed from 'aa' in p2. 'aa' exists
788 in p1 too, but it was recorded as copied from p2.
788 in p1 too, but it was recorded as copied from p2.
789 $ echo modified >> aaa
789 $ echo modified >> aaa
790 BROKEN: should not be follow the rename back to 'aa' here, since the rename
791 happened compared to p2
792 $ hg co -m '.^' -t :merge3
790 $ hg co -m '.^' -t :merge3
793 merging aaa and aa to aa
791 file 'aaa' was deleted in other [destination] but was modified in local [working copy].
794 warning: conflicts while merging aa! (edit, then use 'hg resolve --mark')
792 What do you want to do?
795 0 files updated, 0 files merged, 1 files removed, 1 files unresolved
793 use (c)hanged version, (d)elete, or leave (u)nresolved? u
794 1 files updated, 0 files merged, 1 files removed, 1 files unresolved
796 use 'hg resolve' to retry unresolved file merges
795 use 'hg resolve' to retry unresolved file merges
797 [1]
796 [1]
798 $ hg co -C tip
797 $ hg co -C tip
799 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
798 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
800
799
801 $ hg mv aaa aa
800 $ hg mv aaa aa
802 $ hg ci --amend -m 'merge bar again (undo rename)'
801 $ hg ci --amend -m 'merge bar again (undo rename)'
803 $ hg log --config diff.git=1 -pr .
802 $ hg log --config diff.git=1 -pr .
804 changeset: 25:18e3ba160489
803 changeset: 25:18e3ba160489
805 tag: tip
804 tag: tip
806 parent: 22:12594a98ca3f
805 parent: 22:12594a98ca3f
807 parent: 23:4c94d5bc65f5
806 parent: 23:4c94d5bc65f5
808 user: test
807 user: test
809 date: Thu Jan 01 00:00:00 1970 +0000
808 date: Thu Jan 01 00:00:00 1970 +0000
810 summary: merge bar again (undo rename)
809 summary: merge bar again (undo rename)
811
810
812 diff --git a/aa b/aa
811 diff --git a/aa b/aa
813 --- a/aa
812 --- a/aa
814 +++ b/aa
813 +++ b/aa
815 @@ -1,2 +1,3 @@
814 @@ -1,2 +1,3 @@
816 a
815 a
817 a
816 a
818 +aa
817 +aa
819 diff --git a/x b/x
818 diff --git a/x b/x
820 new file mode 100644
819 new file mode 100644
821 --- /dev/null
820 --- /dev/null
822 +++ b/x
821 +++ b/x
823 @@ -0,0 +1,1 @@
822 @@ -0,0 +1,1 @@
824 +x
823 +x
825
824
826 $ hg debugrename aa
825 $ hg debugrename aa
827 aa not renamed
826 aa not renamed
828 $ hg debugrename -r '.^' aa
827 $ hg debugrename -r '.^' aa
829 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
828 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
830
829
831 Amend a merge changeset (with manifest-level conflicts):
830 Amend a merge changeset (with manifest-level conflicts):
832
831
833 $ hg up -q bar
832 $ hg up -q bar
834 $ hg rm aa
833 $ hg rm aa
835 $ hg ci -m 'rm aa'
834 $ hg ci -m 'rm aa'
836 $ hg up -q default
835 $ hg up -q default
837 $ echo aa >> aa
836 $ echo aa >> aa
838 $ hg ci -m aa
837 $ hg ci -m aa
839 $ hg merge -q bar --config ui.interactive=True << EOF
838 $ hg merge -q bar --config ui.interactive=True << EOF
840 > c
839 > c
841 > EOF
840 > EOF
842 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
841 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
843 What do you want to do?
842 What do you want to do?
844 use (c)hanged version, (d)elete, or leave (u)nresolved? c
843 use (c)hanged version, (d)elete, or leave (u)nresolved? c
845 $ hg ci -m 'merge bar (with conflicts)'
844 $ hg ci -m 'merge bar (with conflicts)'
846 $ hg log --config diff.git=1 -pr .
845 $ hg log --config diff.git=1 -pr .
847 changeset: 28:b4c3035e2544
846 changeset: 28:b4c3035e2544
848 tag: tip
847 tag: tip
849 parent: 27:4b216ca5ba97
848 parent: 27:4b216ca5ba97
850 parent: 26:67db8847a540
849 parent: 26:67db8847a540
851 user: test
850 user: test
852 date: Thu Jan 01 00:00:00 1970 +0000
851 date: Thu Jan 01 00:00:00 1970 +0000
853 summary: merge bar (with conflicts)
852 summary: merge bar (with conflicts)
854
853
855
854
856 $ hg rm aa
855 $ hg rm aa
857 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
856 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
858 $ hg log --config diff.git=1 -pr .
857 $ hg log --config diff.git=1 -pr .
859 changeset: 29:1205ed810051
858 changeset: 29:1205ed810051
860 tag: tip
859 tag: tip
861 parent: 27:4b216ca5ba97
860 parent: 27:4b216ca5ba97
862 parent: 26:67db8847a540
861 parent: 26:67db8847a540
863 user: test
862 user: test
864 date: Thu Jan 01 00:00:00 1970 +0000
863 date: Thu Jan 01 00:00:00 1970 +0000
865 summary: merge bar (with conflicts, amended)
864 summary: merge bar (with conflicts, amended)
866
865
867 diff --git a/aa b/aa
866 diff --git a/aa b/aa
868 deleted file mode 100644
867 deleted file mode 100644
869 --- a/aa
868 --- a/aa
870 +++ /dev/null
869 +++ /dev/null
871 @@ -1,4 +0,0 @@
870 @@ -1,4 +0,0 @@
872 -a
871 -a
873 -a
872 -a
874 -aa
873 -aa
875 -aa
874 -aa
876
875
877 Issue 3445: amending with --close-branch a commit that created a new head should fail
876 Issue 3445: amending with --close-branch a commit that created a new head should fail
878 This shouldn't be possible:
877 This shouldn't be possible:
879
878
880 $ hg up -q default
879 $ hg up -q default
881 $ hg branch closewithamend
880 $ hg branch closewithamend
882 marked working directory as branch closewithamend
881 marked working directory as branch closewithamend
883 $ echo foo > foo
882 $ echo foo > foo
884 $ hg add foo
883 $ hg add foo
885 $ hg ci -m..
884 $ hg ci -m..
886 $ hg ci --amend --close-branch -m 'closing'
885 $ hg ci --amend --close-branch -m 'closing'
887 abort: can only close branch heads
886 abort: can only close branch heads
888 [255]
887 [255]
889
888
890 This silliness fails:
889 This silliness fails:
891
890
892 $ hg branch silliness
891 $ hg branch silliness
893 marked working directory as branch silliness
892 marked working directory as branch silliness
894 $ echo b >> b
893 $ echo b >> b
895 $ hg ci --close-branch -m'open and close'
894 $ hg ci --close-branch -m'open and close'
896 abort: can only close branch heads
895 abort: can only close branch heads
897 [255]
896 [255]
898
897
899 Test that amend with --secret creates new secret changeset forcibly
898 Test that amend with --secret creates new secret changeset forcibly
900 ---------------------------------------------------------------------
899 ---------------------------------------------------------------------
901
900
902 $ hg phase '.^::.'
901 $ hg phase '.^::.'
903 29: draft
902 29: draft
904 30: draft
903 30: draft
905 $ hg commit --amend --secret -m 'amend as secret' -q
904 $ hg commit --amend --secret -m 'amend as secret' -q
906 $ hg phase '.^::.'
905 $ hg phase '.^::.'
907 29: draft
906 29: draft
908 31: secret
907 31: secret
909
908
910 Test that amend with --edit invokes editor forcibly
909 Test that amend with --edit invokes editor forcibly
911 ---------------------------------------------------
910 ---------------------------------------------------
912
911
913 $ hg parents --template "{desc}\n"
912 $ hg parents --template "{desc}\n"
914 amend as secret
913 amend as secret
915 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
914 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
916 $ hg parents --template "{desc}\n"
915 $ hg parents --template "{desc}\n"
917 editor should be suppressed
916 editor should be suppressed
918
917
919 $ hg status --rev '.^1::.'
918 $ hg status --rev '.^1::.'
920 A foo
919 A foo
921 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
920 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
922 editor should be invoked
921 editor should be invoked
923
922
924
923
925 HG: Enter commit message. Lines beginning with 'HG:' are removed.
924 HG: Enter commit message. Lines beginning with 'HG:' are removed.
926 HG: Leave message empty to abort commit.
925 HG: Leave message empty to abort commit.
927 HG: --
926 HG: --
928 HG: user: test
927 HG: user: test
929 HG: branch 'silliness'
928 HG: branch 'silliness'
930 HG: added foo
929 HG: added foo
931 $ hg parents --template "{desc}\n"
930 $ hg parents --template "{desc}\n"
932 editor should be invoked
931 editor should be invoked
933
932
934 Test that "diff()" in committemplate works correctly for amending
933 Test that "diff()" in committemplate works correctly for amending
935 -----------------------------------------------------------------
934 -----------------------------------------------------------------
936
935
937 $ cat >> .hg/hgrc <<EOF
936 $ cat >> .hg/hgrc <<EOF
938 > [committemplate]
937 > [committemplate]
939 > changeset.commit.amend = {desc}\n
938 > changeset.commit.amend = {desc}\n
940 > HG: M: {file_mods}
939 > HG: M: {file_mods}
941 > HG: A: {file_adds}
940 > HG: A: {file_adds}
942 > HG: R: {file_dels}
941 > HG: R: {file_dels}
943 > {splitlines(diff()) % 'HG: {line}\n'}
942 > {splitlines(diff()) % 'HG: {line}\n'}
944 > EOF
943 > EOF
945
944
946 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
945 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
947 M:
946 M:
948 A: foo
947 A: foo
949 R:
948 R:
950 $ hg status -amr
949 $ hg status -amr
951 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
950 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
952 expecting diff of foo
951 expecting diff of foo
953
952
954 HG: M:
953 HG: M:
955 HG: A: foo
954 HG: A: foo
956 HG: R:
955 HG: R:
957 HG: diff -r 1205ed810051 foo
956 HG: diff -r 1205ed810051 foo
958 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
957 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
959 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
958 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
960 HG: @@ -0,0 +1,1 @@
959 HG: @@ -0,0 +1,1 @@
961 HG: +foo
960 HG: +foo
962
961
963 $ echo y > y
962 $ echo y > y
964 $ hg add y
963 $ hg add y
965 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
964 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
966 expecting diff of foo and y
965 expecting diff of foo and y
967
966
968 HG: M:
967 HG: M:
969 HG: A: foo y
968 HG: A: foo y
970 HG: R:
969 HG: R:
971 HG: diff -r 1205ed810051 foo
970 HG: diff -r 1205ed810051 foo
972 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
971 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
973 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
972 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
974 HG: @@ -0,0 +1,1 @@
973 HG: @@ -0,0 +1,1 @@
975 HG: +foo
974 HG: +foo
976 HG: diff -r 1205ed810051 y
975 HG: diff -r 1205ed810051 y
977 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
976 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
978 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
977 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
979 HG: @@ -0,0 +1,1 @@
978 HG: @@ -0,0 +1,1 @@
980 HG: +y
979 HG: +y
981
980
982 $ hg rm a
981 $ hg rm a
983 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
982 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
984 expecting diff of a, foo and y
983 expecting diff of a, foo and y
985
984
986 HG: M:
985 HG: M:
987 HG: A: foo y
986 HG: A: foo y
988 HG: R: a
987 HG: R: a
989 HG: diff -r 1205ed810051 a
988 HG: diff -r 1205ed810051 a
990 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
989 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
991 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
990 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
992 HG: @@ -1,2 +0,0 @@
991 HG: @@ -1,2 +0,0 @@
993 HG: -a
992 HG: -a
994 HG: -a
993 HG: -a
995 HG: diff -r 1205ed810051 foo
994 HG: diff -r 1205ed810051 foo
996 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
995 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
997 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
996 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
998 HG: @@ -0,0 +1,1 @@
997 HG: @@ -0,0 +1,1 @@
999 HG: +foo
998 HG: +foo
1000 HG: diff -r 1205ed810051 y
999 HG: diff -r 1205ed810051 y
1001 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1000 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1002 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1001 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1003 HG: @@ -0,0 +1,1 @@
1002 HG: @@ -0,0 +1,1 @@
1004 HG: +y
1003 HG: +y
1005
1004
1006 $ hg rm x
1005 $ hg rm x
1007 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
1006 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
1008 expecting diff of a, foo, x and y
1007 expecting diff of a, foo, x and y
1009
1008
1010 HG: M:
1009 HG: M:
1011 HG: A: foo y
1010 HG: A: foo y
1012 HG: R: a x
1011 HG: R: a x
1013 HG: diff -r 1205ed810051 a
1012 HG: diff -r 1205ed810051 a
1014 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1013 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1015 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1014 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1016 HG: @@ -1,2 +0,0 @@
1015 HG: @@ -1,2 +0,0 @@
1017 HG: -a
1016 HG: -a
1018 HG: -a
1017 HG: -a
1019 HG: diff -r 1205ed810051 foo
1018 HG: diff -r 1205ed810051 foo
1020 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1019 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1021 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1020 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1022 HG: @@ -0,0 +1,1 @@
1021 HG: @@ -0,0 +1,1 @@
1023 HG: +foo
1022 HG: +foo
1024 HG: diff -r 1205ed810051 x
1023 HG: diff -r 1205ed810051 x
1025 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1024 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1026 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1025 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1027 HG: @@ -1,1 +0,0 @@
1026 HG: @@ -1,1 +0,0 @@
1028 HG: -x
1027 HG: -x
1029 HG: diff -r 1205ed810051 y
1028 HG: diff -r 1205ed810051 y
1030 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1029 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1031 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1030 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1032 HG: @@ -0,0 +1,1 @@
1031 HG: @@ -0,0 +1,1 @@
1033 HG: +y
1032 HG: +y
1034
1033
1035 $ echo cccc >> cc
1034 $ echo cccc >> cc
1036 $ hg status -amr
1035 $ hg status -amr
1037 M cc
1036 M cc
1038 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1037 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1039 cc should be excluded
1038 cc should be excluded
1040
1039
1041 HG: M:
1040 HG: M:
1042 HG: A: foo y
1041 HG: A: foo y
1043 HG: R: a x
1042 HG: R: a x
1044 HG: diff -r 1205ed810051 a
1043 HG: diff -r 1205ed810051 a
1045 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1044 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1046 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1045 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1047 HG: @@ -1,2 +0,0 @@
1046 HG: @@ -1,2 +0,0 @@
1048 HG: -a
1047 HG: -a
1049 HG: -a
1048 HG: -a
1050 HG: diff -r 1205ed810051 foo
1049 HG: diff -r 1205ed810051 foo
1051 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1050 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1052 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1051 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1053 HG: @@ -0,0 +1,1 @@
1052 HG: @@ -0,0 +1,1 @@
1054 HG: +foo
1053 HG: +foo
1055 HG: diff -r 1205ed810051 x
1054 HG: diff -r 1205ed810051 x
1056 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1055 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1057 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1056 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1058 HG: @@ -1,1 +0,0 @@
1057 HG: @@ -1,1 +0,0 @@
1059 HG: -x
1058 HG: -x
1060 HG: diff -r 1205ed810051 y
1059 HG: diff -r 1205ed810051 y
1061 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1060 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1062 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1061 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1063 HG: @@ -0,0 +1,1 @@
1062 HG: @@ -0,0 +1,1 @@
1064 HG: +y
1063 HG: +y
1065
1064
1066 Check for issue4405
1065 Check for issue4405
1067 -------------------
1066 -------------------
1068
1067
1069 Setup the repo with a file that gets moved in a second commit.
1068 Setup the repo with a file that gets moved in a second commit.
1070 $ hg init repo
1069 $ hg init repo
1071 $ cd repo
1070 $ cd repo
1072 $ touch a0
1071 $ touch a0
1073 $ hg add a0
1072 $ hg add a0
1074 $ hg commit -m a0
1073 $ hg commit -m a0
1075 $ hg mv a0 a1
1074 $ hg mv a0 a1
1076 $ hg commit -m a1
1075 $ hg commit -m a1
1077 $ hg up -q 0
1076 $ hg up -q 0
1078 $ hg log -G --template '{rev} {desc}'
1077 $ hg log -G --template '{rev} {desc}'
1079 o 1 a1
1078 o 1 a1
1080 |
1079 |
1081 @ 0 a0
1080 @ 0 a0
1082
1081
1083
1082
1084 Now we branch the repro, but re-use the file contents, so we have a divergence
1083 Now we branch the repro, but re-use the file contents, so we have a divergence
1085 in the file revlog topology and the changelog topology.
1084 in the file revlog topology and the changelog topology.
1086 $ hg revert --rev 1 --all
1085 $ hg revert --rev 1 --all
1087 removing a0
1086 removing a0
1088 adding a1
1087 adding a1
1089 $ hg ci -qm 'a1-amend'
1088 $ hg ci -qm 'a1-amend'
1090 $ hg log -G --template '{rev} {desc}'
1089 $ hg log -G --template '{rev} {desc}'
1091 @ 2 a1-amend
1090 @ 2 a1-amend
1092 |
1091 |
1093 | o 1 a1
1092 | o 1 a1
1094 |/
1093 |/
1095 o 0 a0
1094 o 0 a0
1096
1095
1097
1096
1098 The way mercurial does amends is by folding the working copy and old commit
1097 The way mercurial does amends is by folding the working copy and old commit
1099 together into another commit (rev 3). During this process, _findlimit is called
1098 together into another commit (rev 3). During this process, _findlimit is called
1100 to check how far back to look for the transitive closure of file copy
1099 to check how far back to look for the transitive closure of file copy
1101 information, but due to the divergence of the filelog and changelog graph
1100 information, but due to the divergence of the filelog and changelog graph
1102 topologies, before _findlimit was fixed, it returned a rev which was not far
1101 topologies, before _findlimit was fixed, it returned a rev which was not far
1103 enough back in this case.
1102 enough back in this case.
1104 $ hg mv a1 a2
1103 $ hg mv a1 a2
1105 $ hg status --copies --rev 0
1104 $ hg status --copies --rev 0
1106 A a2
1105 A a2
1107 a0
1106 a0
1108 R a0
1107 R a0
1109 $ hg ci --amend -q
1108 $ hg ci --amend -q
1110 $ hg log -G --template '{rev} {desc}'
1109 $ hg log -G --template '{rev} {desc}'
1111 @ 3 a1-amend
1110 @ 3 a1-amend
1112 |
1111 |
1113 | o 1 a1
1112 | o 1 a1
1114 |/
1113 |/
1115 o 0 a0
1114 o 0 a0
1116
1115
1117
1116
1118 Before the fix, the copy information was lost.
1117 Before the fix, the copy information was lost.
1119 $ hg status --copies --rev 0
1118 $ hg status --copies --rev 0
1120 A a2
1119 A a2
1121 a0
1120 a0
1122 R a0
1121 R a0
1123 $ cd ..
1122 $ cd ..
1124
1123
1125 Check that amend properly preserve rename from directory rename (issue-4516)
1124 Check that amend properly preserve rename from directory rename (issue-4516)
1126
1125
1127 If a parent of the merge renames a full directory, any files added to the old
1126 If a parent of the merge renames a full directory, any files added to the old
1128 directory in the other parent will be renamed to the new directory. For some
1127 directory in the other parent will be renamed to the new directory. For some
1129 reason, the rename metadata was when amending such merge. This test ensure we
1128 reason, the rename metadata was when amending such merge. This test ensure we
1130 do not regress. We have a dedicated repo because it needs a setup with renamed
1129 do not regress. We have a dedicated repo because it needs a setup with renamed
1131 directory)
1130 directory)
1132
1131
1133 $ hg init issue4516
1132 $ hg init issue4516
1134 $ cd issue4516
1133 $ cd issue4516
1135 $ mkdir olddirname
1134 $ mkdir olddirname
1136 $ echo line1 > olddirname/commonfile.py
1135 $ echo line1 > olddirname/commonfile.py
1137 $ hg add olddirname/commonfile.py
1136 $ hg add olddirname/commonfile.py
1138 $ hg ci -m first
1137 $ hg ci -m first
1139
1138
1140 $ hg branch newdirname
1139 $ hg branch newdirname
1141 marked working directory as branch newdirname
1140 marked working directory as branch newdirname
1142 (branches are permanent and global, did you want a bookmark?)
1141 (branches are permanent and global, did you want a bookmark?)
1143 $ hg mv olddirname newdirname
1142 $ hg mv olddirname newdirname
1144 moving olddirname/commonfile.py to newdirname/commonfile.py
1143 moving olddirname/commonfile.py to newdirname/commonfile.py
1145 $ hg ci -m rename
1144 $ hg ci -m rename
1146
1145
1147 $ hg update default
1146 $ hg update default
1148 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1147 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1149 $ echo line1 > olddirname/newfile.py
1148 $ echo line1 > olddirname/newfile.py
1150 $ hg add olddirname/newfile.py
1149 $ hg add olddirname/newfile.py
1151 $ hg ci -m log
1150 $ hg ci -m log
1152
1151
1153 $ hg up newdirname
1152 $ hg up newdirname
1154 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1153 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1155 $ # create newdirname/newfile.py
1154 $ # create newdirname/newfile.py
1156 $ hg merge default
1155 $ hg merge default
1157 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1156 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1158 (branch merge, don't forget to commit)
1157 (branch merge, don't forget to commit)
1159 $ hg ci -m add
1158 $ hg ci -m add
1160 $
1159 $
1161 $ hg debugrename newdirname/newfile.py
1160 $ hg debugrename newdirname/newfile.py
1162 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1161 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1163 $ hg status -C --change .
1162 $ hg status -C --change .
1164 A newdirname/newfile.py
1163 A newdirname/newfile.py
1165 $ hg status -C --rev 1
1164 $ hg status -C --rev 1
1166 A newdirname/newfile.py
1165 A newdirname/newfile.py
1167 $ hg status -C --rev 2
1166 $ hg status -C --rev 2
1168 A newdirname/commonfile.py
1167 A newdirname/commonfile.py
1169 olddirname/commonfile.py
1168 olddirname/commonfile.py
1170 A newdirname/newfile.py
1169 A newdirname/newfile.py
1171 olddirname/newfile.py
1170 olddirname/newfile.py
1172 R olddirname/commonfile.py
1171 R olddirname/commonfile.py
1173 R olddirname/newfile.py
1172 R olddirname/newfile.py
1174 $ hg debugindex newdirname/newfile.py
1173 $ hg debugindex newdirname/newfile.py
1175 rev linkrev nodeid p1 p2
1174 rev linkrev nodeid p1 p2
1176 0 3 34a4d536c0c0 000000000000 000000000000
1175 0 3 34a4d536c0c0 000000000000 000000000000
1177
1176
1178 $ echo a >> newdirname/commonfile.py
1177 $ echo a >> newdirname/commonfile.py
1179 $ hg ci --amend -m bug
1178 $ hg ci --amend -m bug
1180 $ hg debugrename newdirname/newfile.py
1179 $ hg debugrename newdirname/newfile.py
1181 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1180 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1182 $ hg debugindex newdirname/newfile.py
1181 $ hg debugindex newdirname/newfile.py
1183 rev linkrev nodeid p1 p2
1182 rev linkrev nodeid p1 p2
1184 0 3 34a4d536c0c0 000000000000 000000000000
1183 0 3 34a4d536c0c0 000000000000 000000000000
1185
1184
1186 #if execbit
1185 #if execbit
1187
1186
1188 Test if amend preserves executable bit changes
1187 Test if amend preserves executable bit changes
1189 $ chmod +x newdirname/commonfile.py
1188 $ chmod +x newdirname/commonfile.py
1190 $ hg ci -m chmod
1189 $ hg ci -m chmod
1191 $ hg ci --amend -m "chmod amended"
1190 $ hg ci --amend -m "chmod amended"
1192 $ hg ci --amend -m "chmod amended second time"
1191 $ hg ci --amend -m "chmod amended second time"
1193 $ hg log -p --git -r .
1192 $ hg log -p --git -r .
1194 changeset: 7:b1326f52dddf
1193 changeset: 7:b1326f52dddf
1195 branch: newdirname
1194 branch: newdirname
1196 tag: tip
1195 tag: tip
1197 parent: 4:7fd235f7cb2f
1196 parent: 4:7fd235f7cb2f
1198 user: test
1197 user: test
1199 date: Thu Jan 01 00:00:00 1970 +0000
1198 date: Thu Jan 01 00:00:00 1970 +0000
1200 summary: chmod amended second time
1199 summary: chmod amended second time
1201
1200
1202 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1201 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1203 old mode 100644
1202 old mode 100644
1204 new mode 100755
1203 new mode 100755
1205
1204
1206 #endif
1205 #endif
1207
1206
1208 Test amend with file inclusion options
1207 Test amend with file inclusion options
1209 --------------------------------------
1208 --------------------------------------
1210
1209
1211 These tests ensure that we are always amending some files that were part of the
1210 These tests ensure that we are always amending some files that were part of the
1212 pre-amend commit. We want to test that the remaining files in the pre-amend
1211 pre-amend commit. We want to test that the remaining files in the pre-amend
1213 commit were not changed in the amended commit. We do so by performing a diff of
1212 commit were not changed in the amended commit. We do so by performing a diff of
1214 the amended commit against its parent commit.
1213 the amended commit against its parent commit.
1215 $ cd ..
1214 $ cd ..
1216 $ hg init testfileinclusions
1215 $ hg init testfileinclusions
1217 $ cd testfileinclusions
1216 $ cd testfileinclusions
1218 $ echo a > a
1217 $ echo a > a
1219 $ echo b > b
1218 $ echo b > b
1220 $ hg commit -Aqm "Adding a and b"
1219 $ hg commit -Aqm "Adding a and b"
1221
1220
1222 Only add changes to a particular file
1221 Only add changes to a particular file
1223 $ echo a >> a
1222 $ echo a >> a
1224 $ echo b >> b
1223 $ echo b >> b
1225 $ hg commit --amend -I a
1224 $ hg commit --amend -I a
1226 $ hg diff --git -r null -r .
1225 $ hg diff --git -r null -r .
1227 diff --git a/a b/a
1226 diff --git a/a b/a
1228 new file mode 100644
1227 new file mode 100644
1229 --- /dev/null
1228 --- /dev/null
1230 +++ b/a
1229 +++ b/a
1231 @@ -0,0 +1,2 @@
1230 @@ -0,0 +1,2 @@
1232 +a
1231 +a
1233 +a
1232 +a
1234 diff --git a/b b/b
1233 diff --git a/b b/b
1235 new file mode 100644
1234 new file mode 100644
1236 --- /dev/null
1235 --- /dev/null
1237 +++ b/b
1236 +++ b/b
1238 @@ -0,0 +1,1 @@
1237 @@ -0,0 +1,1 @@
1239 +b
1238 +b
1240
1239
1241 $ echo a >> a
1240 $ echo a >> a
1242 $ hg commit --amend b
1241 $ hg commit --amend b
1243 $ hg diff --git -r null -r .
1242 $ hg diff --git -r null -r .
1244 diff --git a/a b/a
1243 diff --git a/a b/a
1245 new file mode 100644
1244 new file mode 100644
1246 --- /dev/null
1245 --- /dev/null
1247 +++ b/a
1246 +++ b/a
1248 @@ -0,0 +1,2 @@
1247 @@ -0,0 +1,2 @@
1249 +a
1248 +a
1250 +a
1249 +a
1251 diff --git a/b b/b
1250 diff --git a/b b/b
1252 new file mode 100644
1251 new file mode 100644
1253 --- /dev/null
1252 --- /dev/null
1254 +++ b/b
1253 +++ b/b
1255 @@ -0,0 +1,2 @@
1254 @@ -0,0 +1,2 @@
1256 +b
1255 +b
1257 +b
1256 +b
1258
1257
1259 Exclude changes to a particular file
1258 Exclude changes to a particular file
1260 $ echo b >> b
1259 $ echo b >> b
1261 $ hg commit --amend -X a
1260 $ hg commit --amend -X a
1262 $ hg diff --git -r null -r .
1261 $ hg diff --git -r null -r .
1263 diff --git a/a b/a
1262 diff --git a/a b/a
1264 new file mode 100644
1263 new file mode 100644
1265 --- /dev/null
1264 --- /dev/null
1266 +++ b/a
1265 +++ b/a
1267 @@ -0,0 +1,2 @@
1266 @@ -0,0 +1,2 @@
1268 +a
1267 +a
1269 +a
1268 +a
1270 diff --git a/b b/b
1269 diff --git a/b b/b
1271 new file mode 100644
1270 new file mode 100644
1272 --- /dev/null
1271 --- /dev/null
1273 +++ b/b
1272 +++ b/b
1274 @@ -0,0 +1,3 @@
1273 @@ -0,0 +1,3 @@
1275 +b
1274 +b
1276 +b
1275 +b
1277 +b
1276 +b
1278
1277
1279 Check the addremove flag
1278 Check the addremove flag
1280 $ echo c > c
1279 $ echo c > c
1281 $ rm a
1280 $ rm a
1282 $ hg commit --amend -A
1281 $ hg commit --amend -A
1283 removing a
1282 removing a
1284 adding c
1283 adding c
1285 $ hg diff --git -r null -r .
1284 $ hg diff --git -r null -r .
1286 diff --git a/b b/b
1285 diff --git a/b b/b
1287 new file mode 100644
1286 new file mode 100644
1288 --- /dev/null
1287 --- /dev/null
1289 +++ b/b
1288 +++ b/b
1290 @@ -0,0 +1,3 @@
1289 @@ -0,0 +1,3 @@
1291 +b
1290 +b
1292 +b
1291 +b
1293 +b
1292 +b
1294 diff --git a/c b/c
1293 diff --git a/c b/c
1295 new file mode 100644
1294 new file mode 100644
1296 --- /dev/null
1295 --- /dev/null
1297 +++ b/c
1296 +++ b/c
1298 @@ -0,0 +1,1 @@
1297 @@ -0,0 +1,1 @@
1299 +c
1298 +c
@@ -1,648 +1,644 b''
1 #testcases filelog compatibility changeset
1 #testcases filelog compatibility changeset
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [extensions]
4 > [extensions]
5 > rebase=
5 > rebase=
6 > [alias]
6 > [alias]
7 > l = log -G -T '{rev} {desc}\n{files}\n'
7 > l = log -G -T '{rev} {desc}\n{files}\n'
8 > EOF
8 > EOF
9
9
10 #if compatibility
10 #if compatibility
11 $ cat >> $HGRCPATH << EOF
11 $ cat >> $HGRCPATH << EOF
12 > [experimental]
12 > [experimental]
13 > copies.read-from = compatibility
13 > copies.read-from = compatibility
14 > EOF
14 > EOF
15 #endif
15 #endif
16
16
17 #if changeset
17 #if changeset
18 $ cat >> $HGRCPATH << EOF
18 $ cat >> $HGRCPATH << EOF
19 > [experimental]
19 > [experimental]
20 > copies.read-from = changeset-only
20 > copies.read-from = changeset-only
21 > copies.write-to = changeset-only
21 > copies.write-to = changeset-only
22 > EOF
22 > EOF
23 #endif
23 #endif
24
24
25 $ REPONUM=0
25 $ REPONUM=0
26 $ newrepo() {
26 $ newrepo() {
27 > cd $TESTTMP
27 > cd $TESTTMP
28 > REPONUM=`expr $REPONUM + 1`
28 > REPONUM=`expr $REPONUM + 1`
29 > hg init repo-$REPONUM
29 > hg init repo-$REPONUM
30 > cd repo-$REPONUM
30 > cd repo-$REPONUM
31 > }
31 > }
32
32
33 Simple rename case
33 Simple rename case
34 $ newrepo
34 $ newrepo
35 $ echo x > x
35 $ echo x > x
36 $ hg ci -Aqm 'add x'
36 $ hg ci -Aqm 'add x'
37 $ hg mv x y
37 $ hg mv x y
38 $ hg debugp1copies
38 $ hg debugp1copies
39 x -> y
39 x -> y
40 $ hg debugp2copies
40 $ hg debugp2copies
41 $ hg ci -m 'rename x to y'
41 $ hg ci -m 'rename x to y'
42 $ hg l
42 $ hg l
43 @ 1 rename x to y
43 @ 1 rename x to y
44 | x y
44 | x y
45 o 0 add x
45 o 0 add x
46 x
46 x
47 $ hg debugp1copies -r 1
47 $ hg debugp1copies -r 1
48 x -> y
48 x -> y
49 $ hg debugpathcopies 0 1
49 $ hg debugpathcopies 0 1
50 x -> y
50 x -> y
51 $ hg debugpathcopies 1 0
51 $ hg debugpathcopies 1 0
52 y -> x
52 y -> x
53 Test filtering copies by path. We do filtering by destination.
53 Test filtering copies by path. We do filtering by destination.
54 $ hg debugpathcopies 0 1 x
54 $ hg debugpathcopies 0 1 x
55 $ hg debugpathcopies 1 0 x
55 $ hg debugpathcopies 1 0 x
56 y -> x
56 y -> x
57 $ hg debugpathcopies 0 1 y
57 $ hg debugpathcopies 0 1 y
58 x -> y
58 x -> y
59 $ hg debugpathcopies 1 0 y
59 $ hg debugpathcopies 1 0 y
60
60
61 Copy a file onto another file
61 Copy a file onto another file
62 $ newrepo
62 $ newrepo
63 $ echo x > x
63 $ echo x > x
64 $ echo y > y
64 $ echo y > y
65 $ hg ci -Aqm 'add x and y'
65 $ hg ci -Aqm 'add x and y'
66 $ hg cp -f x y
66 $ hg cp -f x y
67 $ hg debugp1copies
67 $ hg debugp1copies
68 x -> y
68 x -> y
69 $ hg debugp2copies
69 $ hg debugp2copies
70 $ hg ci -m 'copy x onto y'
70 $ hg ci -m 'copy x onto y'
71 $ hg l
71 $ hg l
72 @ 1 copy x onto y
72 @ 1 copy x onto y
73 | y
73 | y
74 o 0 add x and y
74 o 0 add x and y
75 x y
75 x y
76 $ hg debugp1copies -r 1
76 $ hg debugp1copies -r 1
77 x -> y
77 x -> y
78 Incorrectly doesn't show the rename
78 Incorrectly doesn't show the rename
79 $ hg debugpathcopies 0 1
79 $ hg debugpathcopies 0 1
80
80
81 Copy a file onto another file with same content. If metadata is stored in changeset, this does not
81 Copy a file onto another file with same content. If metadata is stored in changeset, this does not
82 produce a new filelog entry. The changeset's "files" entry should still list the file.
82 produce a new filelog entry. The changeset's "files" entry should still list the file.
83 $ newrepo
83 $ newrepo
84 $ echo x > x
84 $ echo x > x
85 $ echo x > x2
85 $ echo x > x2
86 $ hg ci -Aqm 'add x and x2 with same content'
86 $ hg ci -Aqm 'add x and x2 with same content'
87 $ hg cp -f x x2
87 $ hg cp -f x x2
88 $ hg ci -m 'copy x onto x2'
88 $ hg ci -m 'copy x onto x2'
89 $ hg l
89 $ hg l
90 @ 1 copy x onto x2
90 @ 1 copy x onto x2
91 | x2
91 | x2
92 o 0 add x and x2 with same content
92 o 0 add x and x2 with same content
93 x x2
93 x x2
94 $ hg debugp1copies -r 1
94 $ hg debugp1copies -r 1
95 x -> x2
95 x -> x2
96 Incorrectly doesn't show the rename
96 Incorrectly doesn't show the rename
97 $ hg debugpathcopies 0 1
97 $ hg debugpathcopies 0 1
98
98
99 Copy a file, then delete destination, then copy again. This does not create a new filelog entry.
99 Copy a file, then delete destination, then copy again. This does not create a new filelog entry.
100 $ newrepo
100 $ newrepo
101 $ echo x > x
101 $ echo x > x
102 $ hg ci -Aqm 'add x'
102 $ hg ci -Aqm 'add x'
103 $ hg cp x y
103 $ hg cp x y
104 $ hg ci -m 'copy x to y'
104 $ hg ci -m 'copy x to y'
105 $ hg rm y
105 $ hg rm y
106 $ hg ci -m 'remove y'
106 $ hg ci -m 'remove y'
107 $ hg cp -f x y
107 $ hg cp -f x y
108 $ hg ci -m 'copy x onto y (again)'
108 $ hg ci -m 'copy x onto y (again)'
109 $ hg l
109 $ hg l
110 @ 3 copy x onto y (again)
110 @ 3 copy x onto y (again)
111 | y
111 | y
112 o 2 remove y
112 o 2 remove y
113 | y
113 | y
114 o 1 copy x to y
114 o 1 copy x to y
115 | y
115 | y
116 o 0 add x
116 o 0 add x
117 x
117 x
118 $ hg debugp1copies -r 3
118 $ hg debugp1copies -r 3
119 x -> y
119 x -> y
120 $ hg debugpathcopies 0 3
120 $ hg debugpathcopies 0 3
121 x -> y
121 x -> y
122
122
123 Rename file in a loop: x->y->z->x
123 Rename file in a loop: x->y->z->x
124 $ newrepo
124 $ newrepo
125 $ echo x > x
125 $ echo x > x
126 $ hg ci -Aqm 'add x'
126 $ hg ci -Aqm 'add x'
127 $ hg mv x y
127 $ hg mv x y
128 $ hg debugp1copies
128 $ hg debugp1copies
129 x -> y
129 x -> y
130 $ hg debugp2copies
130 $ hg debugp2copies
131 $ hg ci -m 'rename x to y'
131 $ hg ci -m 'rename x to y'
132 $ hg mv y z
132 $ hg mv y z
133 $ hg ci -m 'rename y to z'
133 $ hg ci -m 'rename y to z'
134 $ hg mv z x
134 $ hg mv z x
135 $ hg ci -m 'rename z to x'
135 $ hg ci -m 'rename z to x'
136 $ hg l
136 $ hg l
137 @ 3 rename z to x
137 @ 3 rename z to x
138 | x z
138 | x z
139 o 2 rename y to z
139 o 2 rename y to z
140 | y z
140 | y z
141 o 1 rename x to y
141 o 1 rename x to y
142 | x y
142 | x y
143 o 0 add x
143 o 0 add x
144 x
144 x
145 $ hg debugpathcopies 0 3
145 $ hg debugpathcopies 0 3
146
146
147 Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily
147 Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily
148 end up reporting y as copied from x (if we don't unmark it as a copy when it's removed).
148 end up reporting y as copied from x (if we don't unmark it as a copy when it's removed).
149 $ newrepo
149 $ newrepo
150 $ echo x > x
150 $ echo x > x
151 $ hg ci -Aqm 'add x'
151 $ hg ci -Aqm 'add x'
152 $ hg mv x y
152 $ hg mv x y
153 $ hg ci -m 'rename x to y'
153 $ hg ci -m 'rename x to y'
154 $ hg rm y
154 $ hg rm y
155 $ hg ci -qm 'remove y'
155 $ hg ci -qm 'remove y'
156 $ echo x > y
156 $ echo x > y
157 $ hg ci -Aqm 'add back y'
157 $ hg ci -Aqm 'add back y'
158 $ hg l
158 $ hg l
159 @ 3 add back y
159 @ 3 add back y
160 | y
160 | y
161 o 2 remove y
161 o 2 remove y
162 | y
162 | y
163 o 1 rename x to y
163 o 1 rename x to y
164 | x y
164 | x y
165 o 0 add x
165 o 0 add x
166 x
166 x
167 $ hg debugp1copies -r 3
167 $ hg debugp1copies -r 3
168 $ hg debugpathcopies 0 3
168 $ hg debugpathcopies 0 3
169
169
170 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the
170 Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the
171 changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point
171 changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point
172 to the first commit that added the file. We should still report the copy as being from x2.
172 to the first commit that added the file. We should still report the copy as being from x2.
173 $ newrepo
173 $ newrepo
174 $ echo x > x
174 $ echo x > x
175 $ echo x > x2
175 $ echo x > x2
176 $ hg ci -Aqm 'add x and x2 with same content'
176 $ hg ci -Aqm 'add x and x2 with same content'
177 $ hg cp x z
177 $ hg cp x z
178 $ hg ci -qm 'copy x to z'
178 $ hg ci -qm 'copy x to z'
179 $ hg rm z
179 $ hg rm z
180 $ hg ci -m 'remove z'
180 $ hg ci -m 'remove z'
181 $ hg cp x2 z
181 $ hg cp x2 z
182 $ hg ci -m 'copy x2 to z'
182 $ hg ci -m 'copy x2 to z'
183 $ hg l
183 $ hg l
184 @ 3 copy x2 to z
184 @ 3 copy x2 to z
185 | z
185 | z
186 o 2 remove z
186 o 2 remove z
187 | z
187 | z
188 o 1 copy x to z
188 o 1 copy x to z
189 | z
189 | z
190 o 0 add x and x2 with same content
190 o 0 add x and x2 with same content
191 x x2
191 x x2
192 $ hg debugp1copies -r 3
192 $ hg debugp1copies -r 3
193 x2 -> z
193 x2 -> z
194 $ hg debugpathcopies 0 3
194 $ hg debugpathcopies 0 3
195 x2 -> z
195 x2 -> z
196
196
197 Create x and y, then rename them both to the same name, but on different sides of a fork
197 Create x and y, then rename them both to the same name, but on different sides of a fork
198 $ newrepo
198 $ newrepo
199 $ echo x > x
199 $ echo x > x
200 $ echo y > y
200 $ echo y > y
201 $ hg ci -Aqm 'add x and y'
201 $ hg ci -Aqm 'add x and y'
202 $ hg mv x z
202 $ hg mv x z
203 $ hg ci -qm 'rename x to z'
203 $ hg ci -qm 'rename x to z'
204 $ hg co -q 0
204 $ hg co -q 0
205 $ hg mv y z
205 $ hg mv y z
206 $ hg ci -qm 'rename y to z'
206 $ hg ci -qm 'rename y to z'
207 $ hg l
207 $ hg l
208 @ 2 rename y to z
208 @ 2 rename y to z
209 | y z
209 | y z
210 | o 1 rename x to z
210 | o 1 rename x to z
211 |/ x z
211 |/ x z
212 o 0 add x and y
212 o 0 add x and y
213 x y
213 x y
214 $ hg debugpathcopies 1 2
214 $ hg debugpathcopies 1 2
215 z -> x
215 z -> x
216 y -> z
216 y -> z
217
217
218 Fork renames x to y on one side and removes x on the other
218 Fork renames x to y on one side and removes x on the other
219 $ newrepo
219 $ newrepo
220 $ echo x > x
220 $ echo x > x
221 $ hg ci -Aqm 'add x'
221 $ hg ci -Aqm 'add x'
222 $ hg mv x y
222 $ hg mv x y
223 $ hg ci -m 'rename x to y'
223 $ hg ci -m 'rename x to y'
224 $ hg co -q 0
224 $ hg co -q 0
225 $ hg rm x
225 $ hg rm x
226 $ hg ci -m 'remove x'
226 $ hg ci -m 'remove x'
227 created new head
227 created new head
228 $ hg l
228 $ hg l
229 @ 2 remove x
229 @ 2 remove x
230 | x
230 | x
231 | o 1 rename x to y
231 | o 1 rename x to y
232 |/ x y
232 |/ x y
233 o 0 add x
233 o 0 add x
234 x
234 x
235 $ hg debugpathcopies 1 2
235 $ hg debugpathcopies 1 2
236
236
237 Copies via null revision (there shouldn't be any)
237 Copies via null revision (there shouldn't be any)
238 $ newrepo
238 $ newrepo
239 $ echo x > x
239 $ echo x > x
240 $ hg ci -Aqm 'add x'
240 $ hg ci -Aqm 'add x'
241 $ hg cp x y
241 $ hg cp x y
242 $ hg ci -m 'copy x to y'
242 $ hg ci -m 'copy x to y'
243 $ hg co -q null
243 $ hg co -q null
244 $ echo x > x
244 $ echo x > x
245 $ hg ci -Aqm 'add x (again)'
245 $ hg ci -Aqm 'add x (again)'
246 $ hg l
246 $ hg l
247 @ 2 add x (again)
247 @ 2 add x (again)
248 x
248 x
249 o 1 copy x to y
249 o 1 copy x to y
250 | y
250 | y
251 o 0 add x
251 o 0 add x
252 x
252 x
253 $ hg debugpathcopies 1 2
253 $ hg debugpathcopies 1 2
254 $ hg debugpathcopies 2 1
254 $ hg debugpathcopies 2 1
255
255
256 Merge rename from other branch
256 Merge rename from other branch
257 $ newrepo
257 $ newrepo
258 $ echo x > x
258 $ echo x > x
259 $ hg ci -Aqm 'add x'
259 $ hg ci -Aqm 'add x'
260 $ hg mv x y
260 $ hg mv x y
261 $ hg ci -m 'rename x to y'
261 $ hg ci -m 'rename x to y'
262 $ hg co -q 0
262 $ hg co -q 0
263 $ echo z > z
263 $ echo z > z
264 $ hg ci -Aqm 'add z'
264 $ hg ci -Aqm 'add z'
265 $ hg merge -q 1
265 $ hg merge -q 1
266 $ hg debugp1copies
266 $ hg debugp1copies
267 $ hg debugp2copies
267 $ hg debugp2copies
268 $ hg ci -m 'merge rename from p2'
268 $ hg ci -m 'merge rename from p2'
269 $ hg l
269 $ hg l
270 @ 3 merge rename from p2
270 @ 3 merge rename from p2
271 |\ x
271 |\ x
272 | o 2 add z
272 | o 2 add z
273 | | z
273 | | z
274 o | 1 rename x to y
274 o | 1 rename x to y
275 |/ x y
275 |/ x y
276 o 0 add x
276 o 0 add x
277 x
277 x
278 Perhaps we should indicate the rename here, but `hg status` is documented to be weird during
278 Perhaps we should indicate the rename here, but `hg status` is documented to be weird during
279 merges, so...
279 merges, so...
280 $ hg debugp1copies -r 3
280 $ hg debugp1copies -r 3
281 $ hg debugp2copies -r 3
281 $ hg debugp2copies -r 3
282 $ hg debugpathcopies 0 3
282 $ hg debugpathcopies 0 3
283 x -> y
283 x -> y
284 $ hg debugpathcopies 1 2
284 $ hg debugpathcopies 1 2
285 y -> x
285 y -> x
286 $ hg debugpathcopies 1 3
286 $ hg debugpathcopies 1 3
287 $ hg debugpathcopies 2 3
287 $ hg debugpathcopies 2 3
288 x -> y
288 x -> y
289
289
290 Copy file from either side in a merge
290 Copy file from either side in a merge
291 $ newrepo
291 $ newrepo
292 $ echo x > x
292 $ echo x > x
293 $ hg ci -Aqm 'add x'
293 $ hg ci -Aqm 'add x'
294 $ hg co -q null
294 $ hg co -q null
295 $ echo y > y
295 $ echo y > y
296 $ hg ci -Aqm 'add y'
296 $ hg ci -Aqm 'add y'
297 $ hg merge -q 0
297 $ hg merge -q 0
298 $ hg cp y z
298 $ hg cp y z
299 $ hg debugp1copies
299 $ hg debugp1copies
300 y -> z
300 y -> z
301 $ hg debugp2copies
301 $ hg debugp2copies
302 $ hg ci -m 'copy file from p1 in merge'
302 $ hg ci -m 'copy file from p1 in merge'
303 $ hg co -q 1
303 $ hg co -q 1
304 $ hg merge -q 0
304 $ hg merge -q 0
305 $ hg cp x z
305 $ hg cp x z
306 $ hg debugp1copies
306 $ hg debugp1copies
307 $ hg debugp2copies
307 $ hg debugp2copies
308 x -> z
308 x -> z
309 $ hg ci -qm 'copy file from p2 in merge'
309 $ hg ci -qm 'copy file from p2 in merge'
310 $ hg l
310 $ hg l
311 @ 3 copy file from p2 in merge
311 @ 3 copy file from p2 in merge
312 |\ z
312 |\ z
313 +---o 2 copy file from p1 in merge
313 +---o 2 copy file from p1 in merge
314 | |/ z
314 | |/ z
315 | o 1 add y
315 | o 1 add y
316 | y
316 | y
317 o 0 add x
317 o 0 add x
318 x
318 x
319 $ hg debugp1copies -r 2
319 $ hg debugp1copies -r 2
320 y -> z
320 y -> z
321 $ hg debugp2copies -r 2
321 $ hg debugp2copies -r 2
322 $ hg debugpathcopies 1 2
322 $ hg debugpathcopies 1 2
323 y -> z
323 y -> z
324 $ hg debugpathcopies 0 2
324 $ hg debugpathcopies 0 2
325 $ hg debugp1copies -r 3
325 $ hg debugp1copies -r 3
326 $ hg debugp2copies -r 3
326 $ hg debugp2copies -r 3
327 x -> z
327 x -> z
328 $ hg debugpathcopies 1 3
328 $ hg debugpathcopies 1 3
329 $ hg debugpathcopies 0 3
329 $ hg debugpathcopies 0 3
330 x -> z
330 x -> z
331
331
332 Copy file that exists on both sides of the merge, same content on both sides
332 Copy file that exists on both sides of the merge, same content on both sides
333 $ newrepo
333 $ newrepo
334 $ echo x > x
334 $ echo x > x
335 $ hg ci -Aqm 'add x on branch 1'
335 $ hg ci -Aqm 'add x on branch 1'
336 $ hg co -q null
336 $ hg co -q null
337 $ echo x > x
337 $ echo x > x
338 $ hg ci -Aqm 'add x on branch 2'
338 $ hg ci -Aqm 'add x on branch 2'
339 $ hg merge -q 0
339 $ hg merge -q 0
340 $ hg cp x z
340 $ hg cp x z
341 $ hg debugp1copies
341 $ hg debugp1copies
342 x -> z
342 x -> z
343 $ hg debugp2copies
343 $ hg debugp2copies
344 $ hg ci -qm 'merge'
344 $ hg ci -qm 'merge'
345 $ hg l
345 $ hg l
346 @ 2 merge
346 @ 2 merge
347 |\ z
347 |\ z
348 | o 1 add x on branch 2
348 | o 1 add x on branch 2
349 | x
349 | x
350 o 0 add x on branch 1
350 o 0 add x on branch 1
351 x
351 x
352 $ hg debugp1copies -r 2
352 $ hg debugp1copies -r 2
353 x -> z
353 x -> z
354 $ hg debugp2copies -r 2
354 $ hg debugp2copies -r 2
355 It's a little weird that it shows up on both sides
355 It's a little weird that it shows up on both sides
356 $ hg debugpathcopies 1 2
356 $ hg debugpathcopies 1 2
357 x -> z
357 x -> z
358 $ hg debugpathcopies 0 2
358 $ hg debugpathcopies 0 2
359 x -> z (filelog !)
359 x -> z (filelog !)
360
360
361 Copy file that exists on both sides of the merge, different content
361 Copy file that exists on both sides of the merge, different content
362 $ newrepo
362 $ newrepo
363 $ echo branch1 > x
363 $ echo branch1 > x
364 $ hg ci -Aqm 'add x on branch 1'
364 $ hg ci -Aqm 'add x on branch 1'
365 $ hg co -q null
365 $ hg co -q null
366 $ echo branch2 > x
366 $ echo branch2 > x
367 $ hg ci -Aqm 'add x on branch 2'
367 $ hg ci -Aqm 'add x on branch 2'
368 $ hg merge -q 0
368 $ hg merge -q 0
369 warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
369 warning: conflicts while merging x! (edit, then use 'hg resolve --mark')
370 [1]
370 [1]
371 $ echo resolved > x
371 $ echo resolved > x
372 $ hg resolve -m x
372 $ hg resolve -m x
373 (no more unresolved files)
373 (no more unresolved files)
374 $ hg cp x z
374 $ hg cp x z
375 $ hg debugp1copies
375 $ hg debugp1copies
376 x -> z
376 x -> z
377 $ hg debugp2copies
377 $ hg debugp2copies
378 $ hg ci -qm 'merge'
378 $ hg ci -qm 'merge'
379 $ hg l
379 $ hg l
380 @ 2 merge
380 @ 2 merge
381 |\ x z
381 |\ x z
382 | o 1 add x on branch 2
382 | o 1 add x on branch 2
383 | x
383 | x
384 o 0 add x on branch 1
384 o 0 add x on branch 1
385 x
385 x
386 $ hg debugp1copies -r 2
386 $ hg debugp1copies -r 2
387 x -> z (changeset !)
387 x -> z (changeset !)
388 $ hg debugp2copies -r 2
388 $ hg debugp2copies -r 2
389 x -> z (no-changeset !)
389 x -> z (no-changeset !)
390 $ hg debugpathcopies 1 2
390 $ hg debugpathcopies 1 2
391 x -> z (changeset !)
391 x -> z (changeset !)
392 $ hg debugpathcopies 0 2
392 $ hg debugpathcopies 0 2
393 x -> z (no-changeset !)
393 x -> z (no-changeset !)
394
394
395 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
395 Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent
396 of the merge to the merge should include the copy from the other side.
396 of the merge to the merge should include the copy from the other side.
397 $ newrepo
397 $ newrepo
398 $ echo x > x
398 $ echo x > x
399 $ hg ci -Aqm 'add x'
399 $ hg ci -Aqm 'add x'
400 $ hg cp x y
400 $ hg cp x y
401 $ hg ci -qm 'copy x to y'
401 $ hg ci -qm 'copy x to y'
402 $ hg co -q 0
402 $ hg co -q 0
403 $ hg cp x z
403 $ hg cp x z
404 $ hg ci -qm 'copy x to z'
404 $ hg ci -qm 'copy x to z'
405 $ hg merge -q 1
405 $ hg merge -q 1
406 $ hg ci -m 'merge copy x->y and copy x->z'
406 $ hg ci -m 'merge copy x->y and copy x->z'
407 $ hg l
407 $ hg l
408 @ 3 merge copy x->y and copy x->z
408 @ 3 merge copy x->y and copy x->z
409 |\
409 |\
410 | o 2 copy x to z
410 | o 2 copy x to z
411 | | z
411 | | z
412 o | 1 copy x to y
412 o | 1 copy x to y
413 |/ y
413 |/ y
414 o 0 add x
414 o 0 add x
415 x
415 x
416 $ hg debugp1copies -r 3
416 $ hg debugp1copies -r 3
417 $ hg debugp2copies -r 3
417 $ hg debugp2copies -r 3
418 $ hg debugpathcopies 2 3
418 $ hg debugpathcopies 2 3
419 x -> y
419 x -> y
420 $ hg debugpathcopies 1 3
420 $ hg debugpathcopies 1 3
421 x -> z
421 x -> z
422
422
423 Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the
423 Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the
424 first side should not include the y->z rename since y didn't exist in the merge base.
424 first side should not include the y->z rename since y didn't exist in the merge base.
425 $ newrepo
425 $ newrepo
426 $ echo x > x
426 $ echo x > x
427 $ hg ci -Aqm 'add x'
427 $ hg ci -Aqm 'add x'
428 $ hg cp x y
428 $ hg cp x y
429 $ hg ci -qm 'copy x to y'
429 $ hg ci -qm 'copy x to y'
430 $ hg co -q 0
430 $ hg co -q 0
431 $ echo y > y
431 $ echo y > y
432 $ hg ci -Aqm 'add y'
432 $ hg ci -Aqm 'add y'
433 $ hg mv y z
433 $ hg mv y z
434 $ hg ci -m 'rename y to z'
434 $ hg ci -m 'rename y to z'
435 $ hg merge -q 1
435 $ hg merge -q 1
436 $ hg ci -m 'merge'
436 $ hg ci -m 'merge'
437 $ hg l
437 $ hg l
438 @ 4 merge
438 @ 4 merge
439 |\
439 |\
440 | o 3 rename y to z
440 | o 3 rename y to z
441 | | y z
441 | | y z
442 | o 2 add y
442 | o 2 add y
443 | | y
443 | | y
444 o | 1 copy x to y
444 o | 1 copy x to y
445 |/ y
445 |/ y
446 o 0 add x
446 o 0 add x
447 x
447 x
448 $ hg debugp1copies -r 3
448 $ hg debugp1copies -r 3
449 y -> z
449 y -> z
450 $ hg debugp2copies -r 3
450 $ hg debugp2copies -r 3
451 $ hg debugpathcopies 2 3
451 $ hg debugpathcopies 2 3
452 y -> z
452 y -> z
453 $ hg debugpathcopies 1 3
453 $ hg debugpathcopies 1 3
454
454
455 Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the
455 Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the
456 other side.
456 other side.
457 $ newrepo
457 $ newrepo
458 $ echo x > x
458 $ echo x > x
459 $ echo y > y
459 $ echo y > y
460 $ hg ci -Aqm 'add x and y'
460 $ hg ci -Aqm 'add x and y'
461 $ hg mv x z
461 $ hg mv x z
462 $ hg ci -qm 'rename x to z'
462 $ hg ci -qm 'rename x to z'
463 $ hg co -q 0
463 $ hg co -q 0
464 $ hg mv y z
464 $ hg mv y z
465 $ hg ci -qm 'rename y to z'
465 $ hg ci -qm 'rename y to z'
466 $ echo z >> z
466 $ echo z >> z
467 $ hg ci -m 'modify z'
467 $ hg ci -m 'modify z'
468 $ hg merge -q 1
468 $ hg merge -q 1
469 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
469 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
470 [1]
470 [1]
471 $ echo z > z
471 $ echo z > z
472 $ hg resolve -qm z
472 $ hg resolve -qm z
473 $ hg ci -m 'merge 1 into 3'
473 $ hg ci -m 'merge 1 into 3'
474 Try merging the other direction too
474 Try merging the other direction too
475 $ hg co -q 1
475 $ hg co -q 1
476 $ hg merge -q 3
476 $ hg merge -q 3
477 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
477 warning: conflicts while merging z! (edit, then use 'hg resolve --mark')
478 [1]
478 [1]
479 $ echo z > z
479 $ echo z > z
480 $ hg resolve -qm z
480 $ hg resolve -qm z
481 $ hg ci -m 'merge 3 into 1'
481 $ hg ci -m 'merge 3 into 1'
482 created new head
482 created new head
483 $ hg l
483 $ hg l
484 @ 5 merge 3 into 1
484 @ 5 merge 3 into 1
485 |\ y z
485 |\ y z
486 +---o 4 merge 1 into 3
486 +---o 4 merge 1 into 3
487 | |/ x z
487 | |/ x z
488 | o 3 modify z
488 | o 3 modify z
489 | | z
489 | | z
490 | o 2 rename y to z
490 | o 2 rename y to z
491 | | y z
491 | | y z
492 o | 1 rename x to z
492 o | 1 rename x to z
493 |/ x z
493 |/ x z
494 o 0 add x and y
494 o 0 add x and y
495 x y
495 x y
496 $ hg debugpathcopies 1 4
496 $ hg debugpathcopies 1 4
497 $ hg debugpathcopies 2 4
497 $ hg debugpathcopies 2 4
498 $ hg debugpathcopies 0 4
498 $ hg debugpathcopies 0 4
499 x -> z (filelog !)
499 x -> z (filelog !)
500 y -> z (compatibility !)
500 y -> z (compatibility !)
501 $ hg debugpathcopies 1 5
501 $ hg debugpathcopies 1 5
502 $ hg debugpathcopies 2 5
502 $ hg debugpathcopies 2 5
503 $ hg debugpathcopies 0 5
503 $ hg debugpathcopies 0 5
504 x -> z
504 x -> z
505
505
506
506
507 Test for a case in fullcopytracing algorithm where both the merging csets are
507 Test for a case in fullcopytracing algorithm where both the merging csets are
508 "dirty"; where a dirty cset means that cset is descendant of merge base. This
508 "dirty"; where a dirty cset means that cset is descendant of merge base. This
509 test reflect that for this particular case this algorithm correctly find the copies:
509 test reflect that for this particular case this algorithm correctly find the copies:
510
510
511 $ cat >> $HGRCPATH << EOF
511 $ cat >> $HGRCPATH << EOF
512 > [experimental]
512 > [experimental]
513 > evolution.createmarkers=True
513 > evolution.createmarkers=True
514 > evolution.allowunstable=True
514 > evolution.allowunstable=True
515 > EOF
515 > EOF
516
516
517 $ newrepo
517 $ newrepo
518 $ echo a > a
518 $ echo a > a
519 $ hg add a
519 $ hg add a
520 $ hg ci -m "added a"
520 $ hg ci -m "added a"
521 $ echo b > b
521 $ echo b > b
522 $ hg add b
522 $ hg add b
523 $ hg ci -m "added b"
523 $ hg ci -m "added b"
524
524
525 $ hg mv b b1
525 $ hg mv b b1
526 $ hg ci -m "rename b to b1"
526 $ hg ci -m "rename b to b1"
527
527
528 $ hg up ".^"
528 $ hg up ".^"
529 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
529 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
530 $ echo d > d
530 $ echo d > d
531 $ hg add d
531 $ hg add d
532 $ hg ci -m "added d"
532 $ hg ci -m "added d"
533 created new head
533 created new head
534
534
535 $ echo baba >> b
535 $ echo baba >> b
536 $ hg ci --amend -m "added d, modified b"
536 $ hg ci --amend -m "added d, modified b"
537
537
538 $ hg l --hidden
538 $ hg l --hidden
539 @ 4 added d, modified b
539 @ 4 added d, modified b
540 | b d
540 | b d
541 | x 3 added d
541 | x 3 added d
542 |/ d
542 |/ d
543 | o 2 rename b to b1
543 | o 2 rename b to b1
544 |/ b b1
544 |/ b b1
545 o 1 added b
545 o 1 added b
546 | b
546 | b
547 o 0 added a
547 o 0 added a
548 a
548 a
549
549
550 Grafting revision 4 on top of revision 2, showing that it respect the rename:
550 Grafting revision 4 on top of revision 2, showing that it respect the rename:
551
551
552 TODO: Make this work with copy info in changesets (probably by writing a
553 changeset-centric version of copies.mergecopies())
554 #if no-changeset
555 $ hg up 2 -q
552 $ hg up 2 -q
556 $ hg graft -r 4 --base 3 --hidden
553 $ hg graft -r 4 --base 3 --hidden
557 grafting 4:af28412ec03c "added d, modified b" (tip)
554 grafting 4:af28412ec03c "added d, modified b" (tip)
558 merging b1 and b to b1
555 merging b1 and b to b1
559
556
560 $ hg l -l1 -p
557 $ hg l -l1 -p
561 @ 5 added d, modified b
558 @ 5 added d, modified b
562 | b1
559 | b1
563 ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1
560 ~ diff -r 5a4825cc2926 -r 94a2f1a0e8e2 b1 (no-changeset !)
561 ~ diff -r f5474f5023a8 -r ef7c02d69f3d b1 (changeset !)
564 --- a/b1 Thu Jan 01 00:00:00 1970 +0000
562 --- a/b1 Thu Jan 01 00:00:00 1970 +0000
565 +++ b/b1 Thu Jan 01 00:00:00 1970 +0000
563 +++ b/b1 Thu Jan 01 00:00:00 1970 +0000
566 @@ -1,1 +1,2 @@
564 @@ -1,1 +1,2 @@
567 b
565 b
568 +baba
566 +baba
569
567
570 #endif
571
572 Test to make sure that fullcopytracing algorithm don't fail when both the merging csets are dirty
568 Test to make sure that fullcopytracing algorithm don't fail when both the merging csets are dirty
573 (a dirty cset is one who is not the descendant of merge base)
569 (a dirty cset is one who is not the descendant of merge base)
574 -------------------------------------------------------------------------------------------------
570 -------------------------------------------------------------------------------------------------
575
571
576 $ newrepo
572 $ newrepo
577 $ echo a > a
573 $ echo a > a
578 $ hg add a
574 $ hg add a
579 $ hg ci -m "added a"
575 $ hg ci -m "added a"
580 $ echo b > b
576 $ echo b > b
581 $ hg add b
577 $ hg add b
582 $ hg ci -m "added b"
578 $ hg ci -m "added b"
583
579
584 $ echo foobar > willconflict
580 $ echo foobar > willconflict
585 $ hg add willconflict
581 $ hg add willconflict
586 $ hg ci -m "added willconflict"
582 $ hg ci -m "added willconflict"
587 $ echo c > c
583 $ echo c > c
588 $ hg add c
584 $ hg add c
589 $ hg ci -m "added c"
585 $ hg ci -m "added c"
590
586
591 $ hg l
587 $ hg l
592 @ 3 added c
588 @ 3 added c
593 | c
589 | c
594 o 2 added willconflict
590 o 2 added willconflict
595 | willconflict
591 | willconflict
596 o 1 added b
592 o 1 added b
597 | b
593 | b
598 o 0 added a
594 o 0 added a
599 a
595 a
600
596
601 $ hg up ".^^"
597 $ hg up ".^^"
602 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
598 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
603 $ echo d > d
599 $ echo d > d
604 $ hg add d
600 $ hg add d
605 $ hg ci -m "added d"
601 $ hg ci -m "added d"
606 created new head
602 created new head
607
603
608 $ echo barfoo > willconflict
604 $ echo barfoo > willconflict
609 $ hg add willconflict
605 $ hg add willconflict
610 $ hg ci --amend -m "added willconflict and d"
606 $ hg ci --amend -m "added willconflict and d"
611
607
612 $ hg l
608 $ hg l
613 @ 5 added willconflict and d
609 @ 5 added willconflict and d
614 | d willconflict
610 | d willconflict
615 | o 3 added c
611 | o 3 added c
616 | | c
612 | | c
617 | o 2 added willconflict
613 | o 2 added willconflict
618 |/ willconflict
614 |/ willconflict
619 o 1 added b
615 o 1 added b
620 | b
616 | b
621 o 0 added a
617 o 0 added a
622 a
618 a
623
619
624 $ hg rebase -r . -d 2 -t :other
620 $ hg rebase -r . -d 2 -t :other
625 rebasing 5:5018b1509e94 "added willconflict and d" (tip)
621 rebasing 5:5018b1509e94 "added willconflict and d" (tip)
626
622
627 $ hg up 3 -q
623 $ hg up 3 -q
628 $ hg l --hidden
624 $ hg l --hidden
629 o 6 added willconflict and d
625 o 6 added willconflict and d
630 | d willconflict
626 | d willconflict
631 | x 5 added willconflict and d
627 | x 5 added willconflict and d
632 | | d willconflict
628 | | d willconflict
633 | | x 4 added d
629 | | x 4 added d
634 | |/ d
630 | |/ d
635 +---@ 3 added c
631 +---@ 3 added c
636 | | c
632 | | c
637 o | 2 added willconflict
633 o | 2 added willconflict
638 |/ willconflict
634 |/ willconflict
639 o 1 added b
635 o 1 added b
640 | b
636 | b
641 o 0 added a
637 o 0 added a
642 a
638 a
643
639
644 Now if we trigger a merge between cset revision 3 and 6 using base revision 4, in this case
640 Now if we trigger a merge between cset revision 3 and 6 using base revision 4, in this case
645 both the merging csets will be dirty as no one is descendent of base revision:
641 both the merging csets will be dirty as no one is descendent of base revision:
646
642
647 $ hg graft -r 6 --base 4 --hidden -t :other
643 $ hg graft -r 6 --base 4 --hidden -t :other
648 grafting 6:99802e4f1e46 "added willconflict and d" (tip)
644 grafting 6:99802e4f1e46 "added willconflict and d" (tip)
@@ -1,826 +1,799 b''
1 (this file is backported from core hg tests/test-annotate.t)
1 (this file is backported from core hg tests/test-annotate.t)
2
2
3 $ cat >> $HGRCPATH << EOF
3 $ cat >> $HGRCPATH << EOF
4 > [ui]
4 > [ui]
5 > merge = :merge3
5 > merge = :merge3
6 > [diff]
6 > [diff]
7 > git=1
7 > git=1
8 > [extensions]
8 > [extensions]
9 > fastannotate=
9 > fastannotate=
10 > [fastannotate]
10 > [fastannotate]
11 > modes=fctx
11 > modes=fctx
12 > forcefollow=False
12 > forcefollow=False
13 > mainbranch=.
13 > mainbranch=.
14 > EOF
14 > EOF
15
15
16 init
16 init
17
17
18 $ hg init repo
18 $ hg init repo
19 $ cd repo
19 $ cd repo
20
20
21 commit
21 commit
22
22
23 $ echo 'a' > a
23 $ echo 'a' > a
24 $ hg ci -A -m test -u nobody -d '1 0'
24 $ hg ci -A -m test -u nobody -d '1 0'
25 adding a
25 adding a
26
26
27 annotate -c
27 annotate -c
28
28
29 $ hg annotate -c a
29 $ hg annotate -c a
30 8435f90966e4: a
30 8435f90966e4: a
31
31
32 annotate -cl
32 annotate -cl
33
33
34 $ hg annotate -cl a
34 $ hg annotate -cl a
35 8435f90966e4:1: a
35 8435f90966e4:1: a
36
36
37 annotate -d
37 annotate -d
38
38
39 $ hg annotate -d a
39 $ hg annotate -d a
40 Thu Jan 01 00:00:01 1970 +0000: a
40 Thu Jan 01 00:00:01 1970 +0000: a
41
41
42 annotate -n
42 annotate -n
43
43
44 $ hg annotate -n a
44 $ hg annotate -n a
45 0: a
45 0: a
46
46
47 annotate -nl
47 annotate -nl
48
48
49 $ hg annotate -nl a
49 $ hg annotate -nl a
50 0:1: a
50 0:1: a
51
51
52 annotate -u
52 annotate -u
53
53
54 $ hg annotate -u a
54 $ hg annotate -u a
55 nobody: a
55 nobody: a
56
56
57 annotate -cdnu
57 annotate -cdnu
58
58
59 $ hg annotate -cdnu a
59 $ hg annotate -cdnu a
60 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
60 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000: a
61
61
62 annotate -cdnul
62 annotate -cdnul
63
63
64 $ hg annotate -cdnul a
64 $ hg annotate -cdnul a
65 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
65 nobody 0 8435f90966e4 Thu Jan 01 00:00:01 1970 +0000:1: a
66
66
67 annotate (JSON)
67 annotate (JSON)
68
68
69 $ hg annotate -Tjson a
69 $ hg annotate -Tjson a
70 [
70 [
71 {
71 {
72 "lines": [{"line": "a\n", "rev": 0}],
72 "lines": [{"line": "a\n", "rev": 0}],
73 "path": "a"
73 "path": "a"
74 }
74 }
75 ]
75 ]
76
76
77 $ hg annotate -Tjson -cdfnul a
77 $ hg annotate -Tjson -cdfnul a
78 [
78 [
79 {
79 {
80 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
80 "lines": [{"date": [1.0, 0], "line": "a\n", "lineno": 1, "node": "8435f90966e442695d2ded29fdade2bac5ad8065", "path": "a", "rev": 0, "user": "nobody"}],
81 "path": "a"
81 "path": "a"
82 }
82 }
83 ]
83 ]
84
84
85 $ cat <<EOF >>a
85 $ cat <<EOF >>a
86 > a
86 > a
87 > a
87 > a
88 > EOF
88 > EOF
89 $ hg ci -ma1 -d '1 0'
89 $ hg ci -ma1 -d '1 0'
90 $ hg cp a b
90 $ hg cp a b
91 $ hg ci -mb -d '1 0'
91 $ hg ci -mb -d '1 0'
92 $ cat <<EOF >> b
92 $ cat <<EOF >> b
93 > b4
93 > b4
94 > b5
94 > b5
95 > b6
95 > b6
96 > EOF
96 > EOF
97 $ hg ci -mb2 -d '2 0'
97 $ hg ci -mb2 -d '2 0'
98
98
99 annotate -n b
99 annotate -n b
100
100
101 $ hg annotate -n b
101 $ hg annotate -n b
102 0: a
102 0: a
103 1: a
103 1: a
104 1: a
104 1: a
105 3: b4
105 3: b4
106 3: b5
106 3: b5
107 3: b6
107 3: b6
108
108
109 annotate --no-follow b
109 annotate --no-follow b
110
110
111 $ hg annotate --no-follow b
111 $ hg annotate --no-follow b
112 2: a
112 2: a
113 2: a
113 2: a
114 2: a
114 2: a
115 3: b4
115 3: b4
116 3: b5
116 3: b5
117 3: b6
117 3: b6
118
118
119 annotate -nl b
119 annotate -nl b
120
120
121 $ hg annotate -nl b
121 $ hg annotate -nl b
122 0:1: a
122 0:1: a
123 1:2: a
123 1:2: a
124 1:3: a
124 1:3: a
125 3:4: b4
125 3:4: b4
126 3:5: b5
126 3:5: b5
127 3:6: b6
127 3:6: b6
128
128
129 annotate -nf b
129 annotate -nf b
130
130
131 $ hg annotate -nf b
131 $ hg annotate -nf b
132 0 a: a
132 0 a: a
133 1 a: a
133 1 a: a
134 1 a: a
134 1 a: a
135 3 b: b4
135 3 b: b4
136 3 b: b5
136 3 b: b5
137 3 b: b6
137 3 b: b6
138
138
139 annotate -nlf b
139 annotate -nlf b
140
140
141 $ hg annotate -nlf b
141 $ hg annotate -nlf b
142 0 a:1: a
142 0 a:1: a
143 1 a:2: a
143 1 a:2: a
144 1 a:3: a
144 1 a:3: a
145 3 b:4: b4
145 3 b:4: b4
146 3 b:5: b5
146 3 b:5: b5
147 3 b:6: b6
147 3 b:6: b6
148
148
149 $ hg up -C 2
149 $ hg up -C 2
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
151 $ cat <<EOF >> b
151 $ cat <<EOF >> b
152 > b4
152 > b4
153 > c
153 > c
154 > b5
154 > b5
155 > EOF
155 > EOF
156 $ hg ci -mb2.1 -d '2 0'
156 $ hg ci -mb2.1 -d '2 0'
157 created new head
157 created new head
158 $ hg merge
158 $ hg merge
159 merging b
159 merging b
160 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
160 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
161 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
161 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
162 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
162 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
163 [1]
163 [1]
164 $ cat b
164 $ cat b
165 a
165 a
166 a
166 a
167 a
167 a
168 <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
168 <<<<<<< working copy: 5fbdc1152d97 - test: b2.1
169 b4
169 b4
170 c
170 c
171 b5
171 b5
172 ||||||| base
172 ||||||| base
173 =======
173 =======
174 b4
174 b4
175 b5
175 b5
176 b6
176 b6
177 >>>>>>> merge rev: 37ec9f5c3d1f - test: b2
177 >>>>>>> merge rev: 37ec9f5c3d1f - test: b2
178 $ cat <<EOF > b
178 $ cat <<EOF > b
179 > a
179 > a
180 > a
180 > a
181 > a
181 > a
182 > b4
182 > b4
183 > c
183 > c
184 > b5
184 > b5
185 > EOF
185 > EOF
186 $ hg resolve --mark -q
186 $ hg resolve --mark -q
187 $ rm b.orig
187 $ rm b.orig
188 $ hg ci -mmergeb -d '3 0'
188 $ hg ci -mmergeb -d '3 0'
189
189
190 annotate after merge
190 annotate after merge
191 (note: the first one falls back to the vanilla annotate which does not use linelog)
191 (note: the first one falls back to the vanilla annotate which does not use linelog)
192
192
193 $ hg annotate -nf b --debug
193 $ hg annotate -nf b --debug
194 fastannotate: b: rebuilding broken cache
194 fastannotate: b: rebuilding broken cache
195 fastannotate: b: 5 new changesets in the main branch
195 fastannotate: b: 5 new changesets in the main branch
196 0 a: a
196 0 a: a
197 1 a: a
197 1 a: a
198 1 a: a
198 1 a: a
199 3 b: b4
199 3 b: b4
200 4 b: c
200 4 b: c
201 3 b: b5
201 3 b: b5
202
202
203 (difference explained below)
203 (difference explained below)
204
204
205 $ hg annotate -nf b --debug
205 $ hg annotate -nf b --debug
206 fastannotate: b: using fast path (resolved fctx: False)
206 fastannotate: b: using fast path (resolved fctx: False)
207 0 a: a
207 0 a: a
208 1 a: a
208 1 a: a
209 1 a: a
209 1 a: a
210 4 b: b4
210 4 b: b4
211 4 b: c
211 4 b: c
212 4 b: b5
212 4 b: b5
213
213
214 annotate after merge with -l
214 annotate after merge with -l
215 (fastannotate differs from annotate)
215 (fastannotate differs from annotate)
216
216
217 $ hg log -Gp -T '{rev}:{node}' -r '2..5'
217 $ hg log -Gp -T '{rev}:{node}' -r '2..5'
218 @ 5:64afcdf8e29e063c635be123d8d2fb160af00f7e
218 @ 5:64afcdf8e29e063c635be123d8d2fb160af00f7e
219 |\
219 |\
220 | o 4:5fbdc1152d97597717021ad9e063061b200f146bdiff --git a/b b/b
220 | o 4:5fbdc1152d97597717021ad9e063061b200f146bdiff --git a/b b/b
221 | | --- a/b
221 | | --- a/b
222 | | +++ b/b
222 | | +++ b/b
223 | | @@ -1,3 +1,6 @@
223 | | @@ -1,3 +1,6 @@
224 | | a
224 | | a
225 | | a
225 | | a
226 | | a
226 | | a
227 | | +b4
227 | | +b4
228 | | +c
228 | | +c
229 | | +b5
229 | | +b5
230 | |
230 | |
231 o | 3:37ec9f5c3d1f99572d7075971cb4876e2139b52fdiff --git a/b b/b
231 o | 3:37ec9f5c3d1f99572d7075971cb4876e2139b52fdiff --git a/b b/b
232 |/ --- a/b
232 |/ --- a/b
233 | +++ b/b
233 | +++ b/b
234 | @@ -1,3 +1,6 @@
234 | @@ -1,3 +1,6 @@
235 | a
235 | a
236 | a
236 | a
237 | a
237 | a
238 | +b4
238 | +b4
239 | +b5
239 | +b5
240 | +b6
240 | +b6
241 |
241 |
242 o 2:3086dbafde1ce745abfc8d2d367847280aabae9ddiff --git a/a b/b
242 o 2:3086dbafde1ce745abfc8d2d367847280aabae9ddiff --git a/a b/b
243 | copy from a
243 | copy from a
244 ~ copy to b
244 ~ copy to b
245
245
246
246
247 (in this case, "b4", "b5" could be considered introduced by either rev 3, or rev 4.
247 (in this case, "b4", "b5" could be considered introduced by either rev 3, or rev 4.
248 and that causes the rev number difference)
248 and that causes the rev number difference)
249
249
250 $ hg annotate -nlf b --config fastannotate.modes=
250 $ hg annotate -nlf b --config fastannotate.modes=
251 0 a:1: a
251 0 a:1: a
252 1 a:2: a
252 1 a:2: a
253 1 a:3: a
253 1 a:3: a
254 3 b:4: b4
254 3 b:4: b4
255 4 b:5: c
255 4 b:5: c
256 3 b:5: b5
256 3 b:5: b5
257
257
258 $ hg annotate -nlf b
258 $ hg annotate -nlf b
259 0 a:1: a
259 0 a:1: a
260 1 a:2: a
260 1 a:2: a
261 1 a:3: a
261 1 a:3: a
262 4 b:4: b4
262 4 b:4: b4
263 4 b:5: c
263 4 b:5: c
264 4 b:6: b5
264 4 b:6: b5
265
265
266 $ hg up -C 1
266 $ hg up -C 1
267 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
267 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
268 $ hg cp a b
268 $ hg cp a b
269 $ cat <<EOF > b
269 $ cat <<EOF > b
270 > a
270 > a
271 > z
271 > z
272 > a
272 > a
273 > EOF
273 > EOF
274 $ hg ci -mc -d '3 0'
274 $ hg ci -mc -d '3 0'
275 created new head
275 created new head
276 BROKEN: 'a' was copied to 'b' on both sides. We should not get a merge conflict here
277 $ hg merge
276 $ hg merge
278 merging b
277 merging b
279 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
278 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
280 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
279 (branch merge, don't forget to commit)
281 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
282 [1]
283 $ cat b
284 <<<<<<< working copy: b80e3e32f75a - test: c
285 a
286 z
287 a
288 ||||||| base
289 =======
290 a
291 a
292 a
293 b4
294 c
295 b5
296 >>>>>>> merge rev: 64afcdf8e29e - test: mergeb
297 $ cat <<EOF > b
298 > a
299 > z
300 > a
301 > b4
302 > c
303 > b5
304 > EOF
305 $ hg resolve --mark -q
306 $ rm b.orig
307 $ echo d >> b
280 $ echo d >> b
308 $ hg ci -mmerge2 -d '4 0'
281 $ hg ci -mmerge2 -d '4 0'
309
282
310 annotate after rename merge
283 annotate after rename merge
311
284
312 $ hg annotate -nf b
285 $ hg annotate -nf b
313 0 a: a
286 0 a: a
314 6 b: z
287 6 b: z
315 1 a: a
288 1 a: a
316 3 b: b4
289 3 b: b4
317 4 b: c
290 4 b: c
318 3 b: b5
291 3 b: b5
319 7 b: d
292 7 b: d
320
293
321 annotate after rename merge with -l
294 annotate after rename merge with -l
322 (fastannotate differs from annotate)
295 (fastannotate differs from annotate)
323
296
324 $ hg log -Gp -T '{rev}:{node}' -r '0+1+6+7'
297 $ hg log -Gp -T '{rev}:{node}' -r '0+1+6+7'
325 @ 7:6284bb6c38fef984a929862a53bbc71ce9eafa81diff --git a/b b/b
298 @ 7:6284bb6c38fef984a929862a53bbc71ce9eafa81diff --git a/b b/b
326 |\ --- a/b
299 |\ --- a/b
327 | : +++ b/b
300 | : +++ b/b
328 | : @@ -1,3 +1,7 @@
301 | : @@ -1,3 +1,7 @@
329 | : a
302 | : a
330 | : z
303 | : z
331 | : a
304 | : a
332 | : +b4
305 | : +b4
333 | : +c
306 | : +c
334 | : +b5
307 | : +b5
335 | : +d
308 | : +d
336 | :
309 | :
337 o : 6:b80e3e32f75a6a67cd4ac85496a11511e9112816diff --git a/a b/b
310 o : 6:b80e3e32f75a6a67cd4ac85496a11511e9112816diff --git a/a b/b
338 :/ copy from a
311 :/ copy from a
339 : copy to b
312 : copy to b
340 : --- a/a
313 : --- a/a
341 : +++ b/b
314 : +++ b/b
342 : @@ -1,3 +1,3 @@
315 : @@ -1,3 +1,3 @@
343 : -a (?)
316 : -a (?)
344 : a
317 : a
345 : +z
318 : +z
346 : a
319 : a
347 : -a (?)
320 : -a (?)
348 :
321 :
349 o 1:762f04898e6684ff713415f7b8a8d53d33f96c92diff --git a/a b/a
322 o 1:762f04898e6684ff713415f7b8a8d53d33f96c92diff --git a/a b/a
350 | --- a/a
323 | --- a/a
351 | +++ b/a
324 | +++ b/a
352 | @@ -1,1 +1,3 @@
325 | @@ -1,1 +1,3 @@
353 | a
326 | a
354 | +a
327 | +a
355 | +a
328 | +a
356 |
329 |
357 o 0:8435f90966e442695d2ded29fdade2bac5ad8065diff --git a/a b/a
330 o 0:8435f90966e442695d2ded29fdade2bac5ad8065diff --git a/a b/a
358 new file mode 100644
331 new file mode 100644
359 --- /dev/null
332 --- /dev/null
360 +++ b/a
333 +++ b/a
361 @@ -0,0 +1,1 @@
334 @@ -0,0 +1,1 @@
362 +a
335 +a
363
336
364
337
365 (note on question marks:
338 (note on question marks:
366 the upstream bdiff change (96f2f50d923f+3633403888ae+8c0c75aa3ff4+5c4e2636c1a9
339 the upstream bdiff change (96f2f50d923f+3633403888ae+8c0c75aa3ff4+5c4e2636c1a9
367 +38ed54888617) alters the output so deletion is not always at the end of the
340 +38ed54888617) alters the output so deletion is not always at the end of the
368 output. for example:
341 output. for example:
369 | a | b | old | new | # old: e1d6aa0e4c3a, new: 8836f13e3c5b
342 | a | b | old | new | # old: e1d6aa0e4c3a, new: 8836f13e3c5b
370 |-------------------|
343 |-------------------|
371 | a | a | a | -a |
344 | a | a | a | -a |
372 | a | z | +z | a |
345 | a | z | +z | a |
373 | a | a | a | +z |
346 | a | a | a | +z |
374 | | | -a | a |
347 | | | -a | a |
375 |-------------------|
348 |-------------------|
376 | a | a | a |
349 | a | a | a |
377 | a | a | a |
350 | a | a | a |
378 | a | | -a |
351 | a | | -a |
379 this leads to more question marks below)
352 this leads to more question marks below)
380
353
381 (rev 1 adds two "a"s and rev 6 deletes one "a".
354 (rev 1 adds two "a"s and rev 6 deletes one "a".
382 the "a" that rev 6 deletes could be either the first or the second "a" of those two "a"s added by rev 1.
355 the "a" that rev 6 deletes could be either the first or the second "a" of those two "a"s added by rev 1.
383 and that causes the line number difference)
356 and that causes the line number difference)
384
357
385 $ hg annotate -nlf b --config fastannotate.modes=
358 $ hg annotate -nlf b --config fastannotate.modes=
386 0 a:1: a
359 0 a:1: a
387 6 b:2: z
360 6 b:2: z
388 1 a:3: a
361 1 a:3: a
389 3 b:4: b4
362 3 b:4: b4
390 4 b:5: c
363 4 b:5: c
391 3 b:5: b5
364 3 b:5: b5
392 7 b:7: d
365 7 b:7: d
393
366
394 $ hg annotate -nlf b
367 $ hg annotate -nlf b
395 0 a:1: a (?)
368 0 a:1: a (?)
396 1 a:2: a (?)
369 1 a:2: a (?)
397 6 b:2: z
370 6 b:2: z
398 1 a:2: a (?)
371 1 a:2: a (?)
399 1 a:3: a (?)
372 1 a:3: a (?)
400 3 b:4: b4
373 3 b:4: b4
401 4 b:5: c
374 4 b:5: c
402 3 b:5: b5
375 3 b:5: b5
403 7 b:7: d
376 7 b:7: d
404
377
405 Issue2807: alignment of line numbers with -l
378 Issue2807: alignment of line numbers with -l
406 (fastannotate differs from annotate, same reason as above)
379 (fastannotate differs from annotate, same reason as above)
407
380
408 $ echo more >> b
381 $ echo more >> b
409 $ hg ci -mmore -d '5 0'
382 $ hg ci -mmore -d '5 0'
410 $ echo more >> b
383 $ echo more >> b
411 $ hg ci -mmore -d '6 0'
384 $ hg ci -mmore -d '6 0'
412 $ echo more >> b
385 $ echo more >> b
413 $ hg ci -mmore -d '7 0'
386 $ hg ci -mmore -d '7 0'
414 $ hg annotate -nlf b
387 $ hg annotate -nlf b
415 0 a: 1: a (?)
388 0 a: 1: a (?)
416 1 a: 2: a (?)
389 1 a: 2: a (?)
417 6 b: 2: z
390 6 b: 2: z
418 1 a: 2: a (?)
391 1 a: 2: a (?)
419 1 a: 3: a (?)
392 1 a: 3: a (?)
420 3 b: 4: b4
393 3 b: 4: b4
421 4 b: 5: c
394 4 b: 5: c
422 3 b: 5: b5
395 3 b: 5: b5
423 7 b: 7: d
396 7 b: 7: d
424 8 b: 8: more
397 8 b: 8: more
425 9 b: 9: more
398 9 b: 9: more
426 10 b:10: more
399 10 b:10: more
427
400
428 linkrev vs rev
401 linkrev vs rev
429
402
430 $ hg annotate -r tip -n a
403 $ hg annotate -r tip -n a
431 0: a
404 0: a
432 1: a
405 1: a
433 1: a
406 1: a
434
407
435 linkrev vs rev with -l
408 linkrev vs rev with -l
436
409
437 $ hg annotate -r tip -nl a
410 $ hg annotate -r tip -nl a
438 0:1: a
411 0:1: a
439 1:2: a
412 1:2: a
440 1:3: a
413 1:3: a
441
414
442 Issue589: "undelete" sequence leads to crash
415 Issue589: "undelete" sequence leads to crash
443
416
444 annotate was crashing when trying to --follow something
417 annotate was crashing when trying to --follow something
445
418
446 like A -> B -> A
419 like A -> B -> A
447
420
448 generate ABA rename configuration
421 generate ABA rename configuration
449
422
450 $ echo foo > foo
423 $ echo foo > foo
451 $ hg add foo
424 $ hg add foo
452 $ hg ci -m addfoo
425 $ hg ci -m addfoo
453 $ hg rename foo bar
426 $ hg rename foo bar
454 $ hg ci -m renamefoo
427 $ hg ci -m renamefoo
455 $ hg rename bar foo
428 $ hg rename bar foo
456 $ hg ci -m renamebar
429 $ hg ci -m renamebar
457
430
458 annotate after ABA with follow
431 annotate after ABA with follow
459
432
460 $ hg annotate --follow foo
433 $ hg annotate --follow foo
461 foo: foo
434 foo: foo
462
435
463 missing file
436 missing file
464
437
465 $ hg ann nosuchfile
438 $ hg ann nosuchfile
466 abort: nosuchfile: no such file in rev e9e6b4fa872f
439 abort: nosuchfile: no such file in rev e9e6b4fa872f
467 [255]
440 [255]
468
441
469 annotate file without '\n' on last line
442 annotate file without '\n' on last line
470
443
471 $ printf "" > c
444 $ printf "" > c
472 $ hg ci -A -m test -u nobody -d '1 0'
445 $ hg ci -A -m test -u nobody -d '1 0'
473 adding c
446 adding c
474 $ hg annotate c
447 $ hg annotate c
475 $ printf "a\nb" > c
448 $ printf "a\nb" > c
476 $ hg ci -m test
449 $ hg ci -m test
477 $ hg annotate c
450 $ hg annotate c
478 [0-9]+: a (re)
451 [0-9]+: a (re)
479 [0-9]+: b (re)
452 [0-9]+: b (re)
480
453
481 Issue3841: check annotation of the file of which filelog includes
454 Issue3841: check annotation of the file of which filelog includes
482 merging between the revision and its ancestor
455 merging between the revision and its ancestor
483
456
484 to reproduce the situation with recent Mercurial, this script uses (1)
457 to reproduce the situation with recent Mercurial, this script uses (1)
485 "hg debugsetparents" to merge without ancestor check by "hg merge",
458 "hg debugsetparents" to merge without ancestor check by "hg merge",
486 and (2) the extension to allow filelog merging between the revision
459 and (2) the extension to allow filelog merging between the revision
487 and its ancestor by overriding "repo._filecommit".
460 and its ancestor by overriding "repo._filecommit".
488
461
489 $ cat > ../legacyrepo.py <<EOF
462 $ cat > ../legacyrepo.py <<EOF
490 > from mercurial import error, node
463 > from mercurial import error, node
491 > def reposetup(ui, repo):
464 > def reposetup(ui, repo):
492 > class legacyrepo(repo.__class__):
465 > class legacyrepo(repo.__class__):
493 > def _filecommit(self, fctx, manifest1, manifest2,
466 > def _filecommit(self, fctx, manifest1, manifest2,
494 > linkrev, tr, changelist, includecopymeta):
467 > linkrev, tr, changelist, includecopymeta):
495 > fname = fctx.path()
468 > fname = fctx.path()
496 > text = fctx.data()
469 > text = fctx.data()
497 > flog = self.file(fname)
470 > flog = self.file(fname)
498 > fparent1 = manifest1.get(fname, node.nullid)
471 > fparent1 = manifest1.get(fname, node.nullid)
499 > fparent2 = manifest2.get(fname, node.nullid)
472 > fparent2 = manifest2.get(fname, node.nullid)
500 > meta = {}
473 > meta = {}
501 > copy = fctx.renamed()
474 > copy = fctx.renamed()
502 > if copy and copy[0] != fname:
475 > if copy and copy[0] != fname:
503 > raise error.Abort('copying is not supported')
476 > raise error.Abort('copying is not supported')
504 > if fparent2 != node.nullid:
477 > if fparent2 != node.nullid:
505 > changelist.append(fname)
478 > changelist.append(fname)
506 > return flog.add(text, meta, tr, linkrev,
479 > return flog.add(text, meta, tr, linkrev,
507 > fparent1, fparent2)
480 > fparent1, fparent2)
508 > raise error.Abort('only merging is supported')
481 > raise error.Abort('only merging is supported')
509 > repo.__class__ = legacyrepo
482 > repo.__class__ = legacyrepo
510 > EOF
483 > EOF
511
484
512 $ cat > baz <<EOF
485 $ cat > baz <<EOF
513 > 1
486 > 1
514 > 2
487 > 2
515 > 3
488 > 3
516 > 4
489 > 4
517 > 5
490 > 5
518 > EOF
491 > EOF
519 $ hg add baz
492 $ hg add baz
520 $ hg commit -m "baz:0"
493 $ hg commit -m "baz:0"
521
494
522 $ cat > baz <<EOF
495 $ cat > baz <<EOF
523 > 1 baz:1
496 > 1 baz:1
524 > 2
497 > 2
525 > 3
498 > 3
526 > 4
499 > 4
527 > 5
500 > 5
528 > EOF
501 > EOF
529 $ hg commit -m "baz:1"
502 $ hg commit -m "baz:1"
530
503
531 $ cat > baz <<EOF
504 $ cat > baz <<EOF
532 > 1 baz:1
505 > 1 baz:1
533 > 2 baz:2
506 > 2 baz:2
534 > 3
507 > 3
535 > 4
508 > 4
536 > 5
509 > 5
537 > EOF
510 > EOF
538 $ hg debugsetparents 17 17
511 $ hg debugsetparents 17 17
539 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
512 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:2"
540 $ hg debugindexdot baz
513 $ hg debugindexdot baz
541 digraph G {
514 digraph G {
542 -1 -> 0
515 -1 -> 0
543 0 -> 1
516 0 -> 1
544 1 -> 2
517 1 -> 2
545 1 -> 2
518 1 -> 2
546 }
519 }
547 $ hg annotate baz
520 $ hg annotate baz
548 17: 1 baz:1
521 17: 1 baz:1
549 18: 2 baz:2
522 18: 2 baz:2
550 16: 3
523 16: 3
551 16: 4
524 16: 4
552 16: 5
525 16: 5
553
526
554 $ cat > baz <<EOF
527 $ cat > baz <<EOF
555 > 1 baz:1
528 > 1 baz:1
556 > 2 baz:2
529 > 2 baz:2
557 > 3 baz:3
530 > 3 baz:3
558 > 4
531 > 4
559 > 5
532 > 5
560 > EOF
533 > EOF
561 $ hg commit -m "baz:3"
534 $ hg commit -m "baz:3"
562
535
563 $ cat > baz <<EOF
536 $ cat > baz <<EOF
564 > 1 baz:1
537 > 1 baz:1
565 > 2 baz:2
538 > 2 baz:2
566 > 3 baz:3
539 > 3 baz:3
567 > 4 baz:4
540 > 4 baz:4
568 > 5
541 > 5
569 > EOF
542 > EOF
570 $ hg debugsetparents 19 18
543 $ hg debugsetparents 19 18
571 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
544 $ hg --config extensions.legacyrepo=../legacyrepo.py commit -m "baz:4"
572 $ hg debugindexdot baz
545 $ hg debugindexdot baz
573 digraph G {
546 digraph G {
574 -1 -> 0
547 -1 -> 0
575 0 -> 1
548 0 -> 1
576 1 -> 2
549 1 -> 2
577 1 -> 2
550 1 -> 2
578 2 -> 3
551 2 -> 3
579 3 -> 4
552 3 -> 4
580 2 -> 4
553 2 -> 4
581 }
554 }
582 $ hg annotate baz
555 $ hg annotate baz
583 17: 1 baz:1
556 17: 1 baz:1
584 18: 2 baz:2
557 18: 2 baz:2
585 19: 3 baz:3
558 19: 3 baz:3
586 20: 4 baz:4
559 20: 4 baz:4
587 16: 5
560 16: 5
588
561
589 annotate clean file
562 annotate clean file
590
563
591 $ hg annotate -ncr "wdir()" foo
564 $ hg annotate -ncr "wdir()" foo
592 11 472b18db256d : foo
565 11 472b18db256d : foo
593
566
594 annotate modified file
567 annotate modified file
595
568
596 $ echo foofoo >> foo
569 $ echo foofoo >> foo
597 $ hg annotate -r "wdir()" foo
570 $ hg annotate -r "wdir()" foo
598 11 : foo
571 11 : foo
599 20+: foofoo
572 20+: foofoo
600
573
601 $ hg annotate -cr "wdir()" foo
574 $ hg annotate -cr "wdir()" foo
602 472b18db256d : foo
575 472b18db256d : foo
603 b6bedd5477e7+: foofoo
576 b6bedd5477e7+: foofoo
604
577
605 $ hg annotate -ncr "wdir()" foo
578 $ hg annotate -ncr "wdir()" foo
606 11 472b18db256d : foo
579 11 472b18db256d : foo
607 20 b6bedd5477e7+: foofoo
580 20 b6bedd5477e7+: foofoo
608
581
609 $ hg annotate --debug -ncr "wdir()" foo
582 $ hg annotate --debug -ncr "wdir()" foo
610 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
583 11 472b18db256d1e8282064eab4bfdaf48cbfe83cd : foo
611 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
584 20 b6bedd5477e797f25e568a6402d4697f3f895a72+: foofoo
612
585
613 $ hg annotate -udr "wdir()" foo
586 $ hg annotate -udr "wdir()" foo
614 test Thu Jan 01 00:00:00 1970 +0000: foo
587 test Thu Jan 01 00:00:00 1970 +0000: foo
615 test [A-Za-z0-9:+ ]+: foofoo (re)
588 test [A-Za-z0-9:+ ]+: foofoo (re)
616
589
617 $ hg annotate -ncr "wdir()" -Tjson foo
590 $ hg annotate -ncr "wdir()" -Tjson foo
618 [
591 [
619 {
592 {
620 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
593 "lines": [{"line": "foo\n", "node": "472b18db256d1e8282064eab4bfdaf48cbfe83cd", "rev": 11}, {"line": "foofoo\n", "node": "ffffffffffffffffffffffffffffffffffffffff", "rev": 2147483647}],
621 "path": "foo"
594 "path": "foo"
622 }
595 }
623 ]
596 ]
624
597
625 annotate added file
598 annotate added file
626
599
627 $ echo bar > bar
600 $ echo bar > bar
628 $ hg add bar
601 $ hg add bar
629 $ hg annotate -ncr "wdir()" bar
602 $ hg annotate -ncr "wdir()" bar
630 20 b6bedd5477e7+: bar
603 20 b6bedd5477e7+: bar
631
604
632 annotate renamed file
605 annotate renamed file
633
606
634 $ hg rename foo renamefoo2
607 $ hg rename foo renamefoo2
635 $ hg annotate -ncr "wdir()" renamefoo2
608 $ hg annotate -ncr "wdir()" renamefoo2
636 11 472b18db256d : foo
609 11 472b18db256d : foo
637 20 b6bedd5477e7+: foofoo
610 20 b6bedd5477e7+: foofoo
638
611
639 annotate missing file
612 annotate missing file
640
613
641 $ rm baz
614 $ rm baz
642 $ hg annotate -ncr "wdir()" baz
615 $ hg annotate -ncr "wdir()" baz
643 abort: $TESTTMP/repo/baz: $ENOENT$ (windows !)
616 abort: $TESTTMP/repo/baz: $ENOENT$ (windows !)
644 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
617 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
645 [255]
618 [255]
646
619
647 annotate removed file
620 annotate removed file
648
621
649 $ hg rm baz
622 $ hg rm baz
650 $ hg annotate -ncr "wdir()" baz
623 $ hg annotate -ncr "wdir()" baz
651 abort: $TESTTMP/repo/baz: $ENOENT$ (windows !)
624 abort: $TESTTMP/repo/baz: $ENOENT$ (windows !)
652 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
625 abort: $ENOENT$: '$TESTTMP/repo/baz' (no-windows !)
653 [255]
626 [255]
654
627
655 Test annotate with whitespace options
628 Test annotate with whitespace options
656
629
657 $ cd ..
630 $ cd ..
658 $ hg init repo-ws
631 $ hg init repo-ws
659 $ cd repo-ws
632 $ cd repo-ws
660 $ cat > a <<EOF
633 $ cat > a <<EOF
661 > aa
634 > aa
662 >
635 >
663 > b b
636 > b b
664 > EOF
637 > EOF
665 $ hg ci -Am "adda"
638 $ hg ci -Am "adda"
666 adding a
639 adding a
667 $ sed 's/EOL$//g' > a <<EOF
640 $ sed 's/EOL$//g' > a <<EOF
668 > a a
641 > a a
669 >
642 >
670 > EOL
643 > EOL
671 > b b
644 > b b
672 > EOF
645 > EOF
673 $ hg ci -m "changea"
646 $ hg ci -m "changea"
674
647
675 Annotate with no option
648 Annotate with no option
676
649
677 $ hg annotate a
650 $ hg annotate a
678 1: a a
651 1: a a
679 0:
652 0:
680 1:
653 1:
681 1: b b
654 1: b b
682
655
683 Annotate with --ignore-space-change
656 Annotate with --ignore-space-change
684
657
685 $ hg annotate --ignore-space-change a
658 $ hg annotate --ignore-space-change a
686 1: a a
659 1: a a
687 1:
660 1:
688 0:
661 0:
689 0: b b
662 0: b b
690
663
691 Annotate with --ignore-all-space
664 Annotate with --ignore-all-space
692
665
693 $ hg annotate --ignore-all-space a
666 $ hg annotate --ignore-all-space a
694 0: a a
667 0: a a
695 0:
668 0:
696 1:
669 1:
697 0: b b
670 0: b b
698
671
699 Annotate with --ignore-blank-lines (similar to no options case)
672 Annotate with --ignore-blank-lines (similar to no options case)
700
673
701 $ hg annotate --ignore-blank-lines a
674 $ hg annotate --ignore-blank-lines a
702 1: a a
675 1: a a
703 0:
676 0:
704 1:
677 1:
705 1: b b
678 1: b b
706
679
707 $ cd ..
680 $ cd ..
708
681
709 Annotate with linkrev pointing to another branch
682 Annotate with linkrev pointing to another branch
710 ------------------------------------------------
683 ------------------------------------------------
711
684
712 create history with a filerev whose linkrev points to another branch
685 create history with a filerev whose linkrev points to another branch
713
686
714 $ hg init branchedlinkrev
687 $ hg init branchedlinkrev
715 $ cd branchedlinkrev
688 $ cd branchedlinkrev
716 $ echo A > a
689 $ echo A > a
717 $ hg commit -Am 'contentA'
690 $ hg commit -Am 'contentA'
718 adding a
691 adding a
719 $ echo B >> a
692 $ echo B >> a
720 $ hg commit -m 'contentB'
693 $ hg commit -m 'contentB'
721 $ hg up --rev 'desc(contentA)'
694 $ hg up --rev 'desc(contentA)'
722 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
695 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
723 $ echo unrelated > unrelated
696 $ echo unrelated > unrelated
724 $ hg commit -Am 'unrelated'
697 $ hg commit -Am 'unrelated'
725 adding unrelated
698 adding unrelated
726 created new head
699 created new head
727 $ hg graft -r 'desc(contentB)'
700 $ hg graft -r 'desc(contentB)'
728 grafting 1:fd27c222e3e6 "contentB"
701 grafting 1:fd27c222e3e6 "contentB"
729 $ echo C >> a
702 $ echo C >> a
730 $ hg commit -m 'contentC'
703 $ hg commit -m 'contentC'
731 $ echo W >> a
704 $ echo W >> a
732 $ hg log -G
705 $ hg log -G
733 @ changeset: 4:072f1e8df249
706 @ changeset: 4:072f1e8df249
734 | tag: tip
707 | tag: tip
735 | user: test
708 | user: test
736 | date: Thu Jan 01 00:00:00 1970 +0000
709 | date: Thu Jan 01 00:00:00 1970 +0000
737 | summary: contentC
710 | summary: contentC
738 |
711 |
739 o changeset: 3:ff38df03cc4b
712 o changeset: 3:ff38df03cc4b
740 | user: test
713 | user: test
741 | date: Thu Jan 01 00:00:00 1970 +0000
714 | date: Thu Jan 01 00:00:00 1970 +0000
742 | summary: contentB
715 | summary: contentB
743 |
716 |
744 o changeset: 2:62aaf3f6fc06
717 o changeset: 2:62aaf3f6fc06
745 | parent: 0:f0932f74827e
718 | parent: 0:f0932f74827e
746 | user: test
719 | user: test
747 | date: Thu Jan 01 00:00:00 1970 +0000
720 | date: Thu Jan 01 00:00:00 1970 +0000
748 | summary: unrelated
721 | summary: unrelated
749 |
722 |
750 | o changeset: 1:fd27c222e3e6
723 | o changeset: 1:fd27c222e3e6
751 |/ user: test
724 |/ user: test
752 | date: Thu Jan 01 00:00:00 1970 +0000
725 | date: Thu Jan 01 00:00:00 1970 +0000
753 | summary: contentB
726 | summary: contentB
754 |
727 |
755 o changeset: 0:f0932f74827e
728 o changeset: 0:f0932f74827e
756 user: test
729 user: test
757 date: Thu Jan 01 00:00:00 1970 +0000
730 date: Thu Jan 01 00:00:00 1970 +0000
758 summary: contentA
731 summary: contentA
759
732
760
733
761 Annotate should list ancestor of starting revision only
734 Annotate should list ancestor of starting revision only
762
735
763 $ hg annotate a
736 $ hg annotate a
764 0: A
737 0: A
765 3: B
738 3: B
766 4: C
739 4: C
767
740
768 $ hg annotate a -r 'wdir()'
741 $ hg annotate a -r 'wdir()'
769 0 : A
742 0 : A
770 3 : B
743 3 : B
771 4 : C
744 4 : C
772 4+: W
745 4+: W
773
746
774 Even when the starting revision is the linkrev-shadowed one:
747 Even when the starting revision is the linkrev-shadowed one:
775
748
776 $ hg annotate a -r 3
749 $ hg annotate a -r 3
777 0: A
750 0: A
778 3: B
751 3: B
779
752
780 $ cd ..
753 $ cd ..
781
754
782 Issue5360: Deleted chunk in p1 of a merge changeset
755 Issue5360: Deleted chunk in p1 of a merge changeset
783
756
784 $ hg init repo-5360
757 $ hg init repo-5360
785 $ cd repo-5360
758 $ cd repo-5360
786 $ echo 1 > a
759 $ echo 1 > a
787 $ hg commit -A a -m 1
760 $ hg commit -A a -m 1
788 $ echo 2 >> a
761 $ echo 2 >> a
789 $ hg commit -m 2
762 $ hg commit -m 2
790 $ echo a > a
763 $ echo a > a
791 $ hg commit -m a
764 $ hg commit -m a
792 $ hg update '.^' -q
765 $ hg update '.^' -q
793 $ echo 3 >> a
766 $ echo 3 >> a
794 $ hg commit -m 3 -q
767 $ hg commit -m 3 -q
795 $ hg merge 2 -q
768 $ hg merge 2 -q
796 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
769 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
797 [1]
770 [1]
798 $ cat a
771 $ cat a
799 <<<<<<< working copy: 0a068f0261cf - test: 3
772 <<<<<<< working copy: 0a068f0261cf - test: 3
800 1
773 1
801 2
774 2
802 3
775 3
803 ||||||| base
776 ||||||| base
804 1
777 1
805 2
778 2
806 =======
779 =======
807 a
780 a
808 >>>>>>> merge rev: 9409851bc20a - test: a
781 >>>>>>> merge rev: 9409851bc20a - test: a
809 $ cat > a << EOF
782 $ cat > a << EOF
810 > b
783 > b
811 > 1
784 > 1
812 > 2
785 > 2
813 > 3
786 > 3
814 > a
787 > a
815 > EOF
788 > EOF
816 $ hg resolve --mark -q
789 $ hg resolve --mark -q
817 $ rm a.orig
790 $ rm a.orig
818 $ hg commit -m m
791 $ hg commit -m m
819 $ hg annotate a
792 $ hg annotate a
820 4: b
793 4: b
821 0: 1
794 0: 1
822 1: 2
795 1: 2
823 3: 3
796 3: 3
824 2: a
797 2: a
825
798
826 $ cd ..
799 $ cd ..
@@ -1,2403 +1,2410 b''
1 $ cat >> $HGRCPATH <<EOF
1 $ cat >> $HGRCPATH <<EOF
2 > [extdiff]
2 > [extdiff]
3 > # for portability:
3 > # for portability:
4 > pdiff = sh "$RUNTESTDIR/pdiff"
4 > pdiff = sh "$RUNTESTDIR/pdiff"
5 > EOF
5 > EOF
6
6
7 Create a repo with some stuff in it:
7 Create a repo with some stuff in it:
8
8
9 $ hg init a
9 $ hg init a
10 $ cd a
10 $ cd a
11 $ echo a > a
11 $ echo a > a
12 $ echo a > d
12 $ echo a > d
13 $ echo a > e
13 $ echo a > e
14 $ hg ci -qAm0
14 $ hg ci -qAm0
15 $ echo b > a
15 $ echo b > a
16 $ hg ci -m1 -u bar
16 $ hg ci -m1 -u bar
17 $ hg mv a b
17 $ hg mv a b
18 $ hg ci -m2
18 $ hg ci -m2
19 $ hg cp b c
19 $ hg cp b c
20 $ hg ci -m3 -u baz
20 $ hg ci -m3 -u baz
21 $ echo b > d
21 $ echo b > d
22 $ echo f > e
22 $ echo f > e
23 $ hg ci -m4
23 $ hg ci -m4
24 $ hg up -q 3
24 $ hg up -q 3
25 $ echo b > e
25 $ echo b > e
26 $ hg branch -q stable
26 $ hg branch -q stable
27 $ hg ci -m5
27 $ hg ci -m5
28 $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4
28 $ hg merge -q default --tool internal:local # for conflicts in e, choose 5 and ignore 4
29 $ hg branch -q default
29 $ hg branch -q default
30 $ hg ci -m6
30 $ hg ci -m6
31 $ hg phase --public 3
31 $ hg phase --public 3
32 $ hg phase --force --secret 6
32 $ hg phase --force --secret 6
33
33
34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
34 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
35 @ test@6.secret: 6
35 @ test@6.secret: 6
36 |\
36 |\
37 | o test@5.draft: 5
37 | o test@5.draft: 5
38 | |
38 | |
39 o | test@4.draft: 4
39 o | test@4.draft: 4
40 |/
40 |/
41 o baz@3.public: 3
41 o baz@3.public: 3
42 |
42 |
43 o test@2.public: 2
43 o test@2.public: 2
44 |
44 |
45 o bar@1.public: 1
45 o bar@1.public: 1
46 |
46 |
47 o test@0.public: 0
47 o test@0.public: 0
48
48
49 Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d
49 Test --base for grafting the merge of 4 from the perspective of 5, thus only getting the change to d
50
50
51 $ hg up -cqr 3
51 $ hg up -cqr 3
52 $ hg graft -r 6 --base 5
52 $ hg graft -r 6 --base 5
53 grafting 6:25a2b029d3ae "6" (tip)
53 grafting 6:25a2b029d3ae "6" (tip)
54 merging e
54 merging e
55 $ hg st --change .
55 $ hg st --change .
56 M d
56 M d
57
57
58 $ hg -q strip . --config extensions.strip=
58 $ hg -q strip . --config extensions.strip=
59
59
60 Test --base for collapsing changesets 2 and 3, thus getting both b and c
60 Test --base for collapsing changesets 2 and 3, thus getting both b and c
61
61
62 $ hg up -cqr 0
62 $ hg up -cqr 0
63 $ hg graft -r 3 --base 1
63 $ hg graft -r 3 --base 1
64 grafting 3:4c60f11aa304 "3"
64 grafting 3:4c60f11aa304 "3"
65 merging a and b to b
65 merging a and b to b
66 merging a and c to c
66 merging a and c to c
67 $ hg st --change .
67 $ hg st --change .
68 A b
68 A b
69 A c
69 A c
70 R a
70 R a
71
71
72 $ hg -q strip . --config extensions.strip=
72 $ hg -q strip . --config extensions.strip=
73
73
74 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
74 Specifying child as --base revision fails safely (perhaps slightly confusing, but consistent)
75
75
76 $ hg graft -r 2 --base 3
76 $ hg graft -r 2 --base 3
77 grafting 2:5c095ad7e90f "2"
77 grafting 2:5c095ad7e90f "2"
78 note: possible conflict - c was deleted and renamed to:
79 a
78 note: graft of 2:5c095ad7e90f created no changes to commit
80 note: graft of 2:5c095ad7e90f created no changes to commit
79
81
80 Can't continue without starting:
82 Can't continue without starting:
81
83
82 $ hg -q up -cr tip
84 $ hg -q up -cr tip
83 $ hg rm -q e
85 $ hg rm -q e
84 $ hg graft --continue
86 $ hg graft --continue
85 abort: no graft in progress
87 abort: no graft in progress
86 [255]
88 [255]
87 $ hg revert -r . -q e
89 $ hg revert -r . -q e
88
90
89 Need to specify a rev:
91 Need to specify a rev:
90
92
91 $ hg graft
93 $ hg graft
92 abort: no revisions specified
94 abort: no revisions specified
93 [255]
95 [255]
94
96
95 Can't graft ancestor:
97 Can't graft ancestor:
96
98
97 $ hg graft 1 2
99 $ hg graft 1 2
98 skipping ancestor revision 1:5d205f8b35b6
100 skipping ancestor revision 1:5d205f8b35b6
99 skipping ancestor revision 2:5c095ad7e90f
101 skipping ancestor revision 2:5c095ad7e90f
100 [255]
102 [255]
101
103
102 Specify revisions with -r:
104 Specify revisions with -r:
103
105
104 $ hg graft -r 1 -r 2
106 $ hg graft -r 1 -r 2
105 skipping ancestor revision 1:5d205f8b35b6
107 skipping ancestor revision 1:5d205f8b35b6
106 skipping ancestor revision 2:5c095ad7e90f
108 skipping ancestor revision 2:5c095ad7e90f
107 [255]
109 [255]
108
110
109 $ hg graft -r 1 2
111 $ hg graft -r 1 2
110 warning: inconsistent use of --rev might give unexpected revision ordering!
112 warning: inconsistent use of --rev might give unexpected revision ordering!
111 skipping ancestor revision 2:5c095ad7e90f
113 skipping ancestor revision 2:5c095ad7e90f
112 skipping ancestor revision 1:5d205f8b35b6
114 skipping ancestor revision 1:5d205f8b35b6
113 [255]
115 [255]
114
116
115 Conflicting date/user options:
117 Conflicting date/user options:
116
118
117 $ hg up -q 0
119 $ hg up -q 0
118 $ hg graft -U --user foo 2
120 $ hg graft -U --user foo 2
119 abort: --user and --currentuser are mutually exclusive
121 abort: --user and --currentuser are mutually exclusive
120 [255]
122 [255]
121 $ hg graft -D --date '0 0' 2
123 $ hg graft -D --date '0 0' 2
122 abort: --date and --currentdate are mutually exclusive
124 abort: --date and --currentdate are mutually exclusive
123 [255]
125 [255]
124
126
125 Can't graft with dirty wd:
127 Can't graft with dirty wd:
126
128
127 $ hg up -q 0
129 $ hg up -q 0
128 $ echo foo > a
130 $ echo foo > a
129 $ hg graft 1
131 $ hg graft 1
130 abort: uncommitted changes
132 abort: uncommitted changes
131 [255]
133 [255]
132 $ hg revert a
134 $ hg revert a
133
135
134 Graft a rename:
136 Graft a rename:
135 (this also tests that editor is invoked if '--edit' is specified)
137 (this also tests that editor is invoked if '--edit' is specified)
136
138
137 $ hg status --rev "2^1" --rev 2
139 $ hg status --rev "2^1" --rev 2
138 A b
140 A b
139 R a
141 R a
140 $ HGEDITOR=cat hg graft 2 -u foo --edit
142 $ HGEDITOR=cat hg graft 2 -u foo --edit
141 grafting 2:5c095ad7e90f "2"
143 grafting 2:5c095ad7e90f "2"
142 merging a and b to b
144 merging a and b to b
143 2
145 2
144
146
145
147
146 HG: Enter commit message. Lines beginning with 'HG:' are removed.
148 HG: Enter commit message. Lines beginning with 'HG:' are removed.
147 HG: Leave message empty to abort commit.
149 HG: Leave message empty to abort commit.
148 HG: --
150 HG: --
149 HG: user: foo
151 HG: user: foo
150 HG: branch 'default'
152 HG: branch 'default'
151 HG: added b
153 HG: added b
152 HG: removed a
154 HG: removed a
153 $ hg export tip --git
155 $ hg export tip --git
154 # HG changeset patch
156 # HG changeset patch
155 # User foo
157 # User foo
156 # Date 0 0
158 # Date 0 0
157 # Thu Jan 01 00:00:00 1970 +0000
159 # Thu Jan 01 00:00:00 1970 +0000
158 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
160 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
159 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
161 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
160 2
162 2
161
163
162 diff --git a/a b/b
164 diff --git a/a b/b
163 rename from a
165 rename from a
164 rename to b
166 rename to b
165
167
166 Look for extra:source
168 Look for extra:source
167
169
168 $ hg log --debug -r tip
170 $ hg log --debug -r tip
169 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
171 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
170 tag: tip
172 tag: tip
171 phase: draft
173 phase: draft
172 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
174 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
173 parent: -1:0000000000000000000000000000000000000000
175 parent: -1:0000000000000000000000000000000000000000
174 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
176 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
175 user: foo
177 user: foo
176 date: Thu Jan 01 00:00:00 1970 +0000
178 date: Thu Jan 01 00:00:00 1970 +0000
177 files+: b
179 files+: b
178 files-: a
180 files-: a
179 extra: branch=default
181 extra: branch=default
180 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
182 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
181 description:
183 description:
182 2
184 2
183
185
184
186
185
187
186 Graft out of order, skipping a merge and a duplicate
188 Graft out of order, skipping a merge and a duplicate
187 (this also tests that editor is not invoked if '--edit' is not specified)
189 (this also tests that editor is not invoked if '--edit' is not specified)
188
190
189 $ hg graft 1 5 4 3 'merge()' 2 -n
191 $ hg graft 1 5 4 3 'merge()' 2 -n
190 skipping ungraftable merge revision 6
192 skipping ungraftable merge revision 6
191 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
193 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
192 grafting 1:5d205f8b35b6 "1"
194 grafting 1:5d205f8b35b6 "1"
193 grafting 5:97f8bfe72746 "5"
195 grafting 5:97f8bfe72746 "5"
194 grafting 4:9c233e8e184d "4"
196 grafting 4:9c233e8e184d "4"
195 grafting 3:4c60f11aa304 "3"
197 grafting 3:4c60f11aa304 "3"
196
198
197 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
199 $ HGEDITOR=cat hg graft 1 5 'merge()' 2 --debug
198 skipping ungraftable merge revision 6
200 skipping ungraftable merge revision 6
199 scanning for duplicate grafts
201 scanning for duplicate grafts
200 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
202 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
201 grafting 1:5d205f8b35b6 "1"
203 grafting 1:5d205f8b35b6 "1"
202 unmatched files in local:
204 unmatched files in local:
203 b
205 b
204 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
206 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
205 src: 'a' -> dst: 'b' *
207 src: 'a' -> dst: 'b' *
206 checking for directory renames
208 checking for directory renames
207 resolving manifests
209 resolving manifests
208 branchmerge: True, force: True, partial: False
210 branchmerge: True, force: True, partial: False
209 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
211 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
210 preserving b for resolve of b
212 preserving b for resolve of b
211 starting 4 threads for background file closing (?)
213 starting 4 threads for background file closing (?)
212 b: local copied/moved from a -> m (premerge)
214 b: local copied/moved from a -> m (premerge)
213 picked tool ':merge' for b (binary False symlink False changedelete False)
215 picked tool ':merge' for b (binary False symlink False changedelete False)
214 merging b and a to b
216 merging b and a to b
215 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
217 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
216 premerge successful
218 premerge successful
217 committing files:
219 committing files:
218 b
220 b
219 committing manifest
221 committing manifest
220 committing changelog
222 committing changelog
221 updating the branch cache
223 updating the branch cache
222 grafting 5:97f8bfe72746 "5"
224 grafting 5:97f8bfe72746 "5"
225 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
226 src: 'c' -> dst: 'b'
227 checking for directory renames
223 resolving manifests
228 resolving manifests
224 branchmerge: True, force: True, partial: False
229 branchmerge: True, force: True, partial: False
225 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
230 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
226 e: remote is newer -> g
231 e: remote is newer -> g
227 getting e
232 getting e
228 committing files:
233 committing files:
229 e
234 e
230 committing manifest
235 committing manifest
231 committing changelog
236 committing changelog
232 updating the branch cache
237 updating the branch cache
233 $ HGEDITOR=cat hg graft 4 3 --log --debug
238 $ HGEDITOR=cat hg graft 4 3 --log --debug
234 scanning for duplicate grafts
239 scanning for duplicate grafts
235 grafting 4:9c233e8e184d "4"
240 grafting 4:9c233e8e184d "4"
241 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
242 src: 'c' -> dst: 'b'
243 checking for directory renames
236 resolving manifests
244 resolving manifests
237 branchmerge: True, force: True, partial: False
245 branchmerge: True, force: True, partial: False
238 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
246 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
239 preserving e for resolve of e
247 preserving e for resolve of e
240 d: remote is newer -> g
248 d: remote is newer -> g
241 getting d
249 getting d
242 e: versions differ -> m (premerge)
250 e: versions differ -> m (premerge)
243 picked tool ':merge' for e (binary False symlink False changedelete False)
251 picked tool ':merge' for e (binary False symlink False changedelete False)
244 merging e
252 merging e
245 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
253 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
246 e: versions differ -> m (merge)
254 e: versions differ -> m (merge)
247 picked tool ':merge' for e (binary False symlink False changedelete False)
255 picked tool ':merge' for e (binary False symlink False changedelete False)
248 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
256 my e@1905859650ec+ other e@9c233e8e184d ancestor e@4c60f11aa304
249 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
257 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
250 abort: unresolved conflicts, can't continue
258 abort: unresolved conflicts, can't continue
251 (use 'hg resolve' and 'hg graft --continue')
259 (use 'hg resolve' and 'hg graft --continue')
252 [255]
260 [255]
253
261
254 Summary should mention graft:
262 Summary should mention graft:
255
263
256 $ hg summary |grep graft
264 $ hg summary |grep graft
257 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
265 commit: 2 modified, 2 unknown, 1 unresolved (graft in progress)
258
266
259 Using status to get more context
267 Using status to get more context
260
268
261 $ hg status --verbose
269 $ hg status --verbose
262 M d
270 M d
263 M e
271 M e
264 ? a.orig
272 ? a.orig
265 ? e.orig
273 ? e.orig
266 # The repository is in an unfinished *graft* state.
274 # The repository is in an unfinished *graft* state.
267
275
268 # Unresolved merge conflicts:
276 # Unresolved merge conflicts:
269 #
277 #
270 # e
278 # e
271 #
279 #
272 # To mark files as resolved: hg resolve --mark FILE
280 # To mark files as resolved: hg resolve --mark FILE
273
281
274 # To continue: hg graft --continue
282 # To continue: hg graft --continue
275 # To abort: hg graft --abort
283 # To abort: hg graft --abort
276
284
277
285
278 Commit while interrupted should fail:
286 Commit while interrupted should fail:
279
287
280 $ hg ci -m 'commit interrupted graft'
288 $ hg ci -m 'commit interrupted graft'
281 abort: graft in progress
289 abort: graft in progress
282 (use 'hg graft --continue' or 'hg graft --stop' to stop)
290 (use 'hg graft --continue' or 'hg graft --stop' to stop)
283 [255]
291 [255]
284
292
285 Abort the graft and try committing:
293 Abort the graft and try committing:
286
294
287 $ hg up -C .
295 $ hg up -C .
288 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
289 $ echo c >> e
297 $ echo c >> e
290 $ hg ci -mtest
298 $ hg ci -mtest
291
299
292 $ hg strip . --config extensions.strip=
300 $ hg strip . --config extensions.strip=
293 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
301 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
302 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
295
303
296 Graft again:
304 Graft again:
297
305
298 $ hg graft 1 5 4 3 'merge()' 2
306 $ hg graft 1 5 4 3 'merge()' 2
299 skipping ungraftable merge revision 6
307 skipping ungraftable merge revision 6
300 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
308 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
301 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
309 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
302 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
310 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
303 grafting 4:9c233e8e184d "4"
311 grafting 4:9c233e8e184d "4"
304 merging e
312 merging e
305 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
313 warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
306 abort: unresolved conflicts, can't continue
314 abort: unresolved conflicts, can't continue
307 (use 'hg resolve' and 'hg graft --continue')
315 (use 'hg resolve' and 'hg graft --continue')
308 [255]
316 [255]
309
317
310 Continue without resolve should fail:
318 Continue without resolve should fail:
311
319
312 $ hg graft -c
320 $ hg graft -c
313 grafting 4:9c233e8e184d "4"
321 grafting 4:9c233e8e184d "4"
314 abort: unresolved merge conflicts (see 'hg help resolve')
322 abort: unresolved merge conflicts (see 'hg help resolve')
315 [255]
323 [255]
316
324
317 Fix up:
325 Fix up:
318
326
319 $ echo b > e
327 $ echo b > e
320 $ hg resolve -m e
328 $ hg resolve -m e
321 (no more unresolved files)
329 (no more unresolved files)
322 continue: hg graft --continue
330 continue: hg graft --continue
323
331
324 Continue with a revision should fail:
332 Continue with a revision should fail:
325
333
326 $ hg graft -c 6
334 $ hg graft -c 6
327 abort: can't specify --continue and revisions
335 abort: can't specify --continue and revisions
328 [255]
336 [255]
329
337
330 $ hg graft -c -r 6
338 $ hg graft -c -r 6
331 abort: can't specify --continue and revisions
339 abort: can't specify --continue and revisions
332 [255]
340 [255]
333
341
334 Continue for real, clobber usernames
342 Continue for real, clobber usernames
335
343
336 $ hg graft -c -U
344 $ hg graft -c -U
337 grafting 4:9c233e8e184d "4"
345 grafting 4:9c233e8e184d "4"
338 grafting 3:4c60f11aa304 "3"
346 grafting 3:4c60f11aa304 "3"
339
347
340 Compare with original:
348 Compare with original:
341
349
342 $ hg diff -r 6
350 $ hg diff -r 6
343 $ hg status --rev 0:. -C
351 $ hg status --rev 0:. -C
344 M d
352 M d
345 M e
353 M e
346 A b
354 A b
347 a
355 a
348 A c
356 A c
349 a
357 a
350 R a
358 R a
351
359
352 View graph:
360 View graph:
353
361
354 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
362 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
355 @ test@11.draft: 3
363 @ test@11.draft: 3
356 |
364 |
357 o test@10.draft: 4
365 o test@10.draft: 4
358 |
366 |
359 o test@9.draft: 5
367 o test@9.draft: 5
360 |
368 |
361 o bar@8.draft: 1
369 o bar@8.draft: 1
362 |
370 |
363 o foo@7.draft: 2
371 o foo@7.draft: 2
364 |
372 |
365 | o test@6.secret: 6
373 | o test@6.secret: 6
366 | |\
374 | |\
367 | | o test@5.draft: 5
375 | | o test@5.draft: 5
368 | | |
376 | | |
369 | o | test@4.draft: 4
377 | o | test@4.draft: 4
370 | |/
378 | |/
371 | o baz@3.public: 3
379 | o baz@3.public: 3
372 | |
380 | |
373 | o test@2.public: 2
381 | o test@2.public: 2
374 | |
382 | |
375 | o bar@1.public: 1
383 | o bar@1.public: 1
376 |/
384 |/
377 o test@0.public: 0
385 o test@0.public: 0
378
386
379 Graft again onto another branch should preserve the original source
387 Graft again onto another branch should preserve the original source
380 $ hg up -q 0
388 $ hg up -q 0
381 $ echo 'g'>g
389 $ echo 'g'>g
382 $ hg add g
390 $ hg add g
383 $ hg ci -m 7
391 $ hg ci -m 7
384 created new head
392 created new head
385 $ hg graft 7
393 $ hg graft 7
386 grafting 7:ef0ef43d49e7 "2"
394 grafting 7:ef0ef43d49e7 "2"
387
395
388 $ hg log -r 7 --template '{rev}:{node}\n'
396 $ hg log -r 7 --template '{rev}:{node}\n'
389 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
397 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
390 $ hg log -r 2 --template '{rev}:{node}\n'
398 $ hg log -r 2 --template '{rev}:{node}\n'
391 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
399 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
392
400
393 $ hg log --debug -r tip
401 $ hg log --debug -r tip
394 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
402 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
395 tag: tip
403 tag: tip
396 phase: draft
404 phase: draft
397 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
405 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
398 parent: -1:0000000000000000000000000000000000000000
406 parent: -1:0000000000000000000000000000000000000000
399 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
407 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
400 user: foo
408 user: foo
401 date: Thu Jan 01 00:00:00 1970 +0000
409 date: Thu Jan 01 00:00:00 1970 +0000
402 files+: b
410 files+: b
403 files-: a
411 files-: a
404 extra: branch=default
412 extra: branch=default
405 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
413 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
406 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
414 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
407 description:
415 description:
408 2
416 2
409
417
410
418
411 Disallow grafting an already grafted cset onto its original branch
419 Disallow grafting an already grafted cset onto its original branch
412 $ hg up -q 6
420 $ hg up -q 6
413 $ hg graft 7
421 $ hg graft 7
414 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
422 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
415 [255]
423 [255]
416
424
417 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
425 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13
418 --- */hg-5c095ad7e90f.patch * (glob)
426 --- */hg-5c095ad7e90f.patch * (glob)
419 +++ */hg-7a4785234d87.patch * (glob)
427 +++ */hg-7a4785234d87.patch * (glob)
420 @@ -1,18 +1,18 @@
428 @@ -1,18 +1,18 @@
421 # HG changeset patch
429 # HG changeset patch
422 -# User test
430 -# User test
423 +# User foo
431 +# User foo
424 # Date 0 0
432 # Date 0 0
425 # Thu Jan 01 00:00:00 1970 +0000
433 # Thu Jan 01 00:00:00 1970 +0000
426 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
434 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
427 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
435 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
428 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
436 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
429 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
437 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
430 2
438 2
431
439
432 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
440 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
433 +diff -r b592ea63bb0c -r 7a4785234d87 a
441 +diff -r b592ea63bb0c -r 7a4785234d87 a
434 --- a/a Thu Jan 01 00:00:00 1970 +0000
442 --- a/a Thu Jan 01 00:00:00 1970 +0000
435 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
443 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
436 @@ -1,1 +0,0 @@
444 @@ -1,1 +0,0 @@
437 --b
445 --b
438 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
446 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
439 +-a
447 +-a
440 +diff -r b592ea63bb0c -r 7a4785234d87 b
448 +diff -r b592ea63bb0c -r 7a4785234d87 b
441 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
449 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
442 +++ b/b Thu Jan 01 00:00:00 1970 +0000
450 +++ b/b Thu Jan 01 00:00:00 1970 +0000
443 @@ -0,0 +1,1 @@
451 @@ -0,0 +1,1 @@
444 -+b
452 -+b
445 ++a
453 ++a
446 [1]
454 [1]
447
455
448 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
456 $ hg pdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
449 --- */hg-5c095ad7e90f.patch * (glob)
457 --- */hg-5c095ad7e90f.patch * (glob)
450 +++ */hg-7a4785234d87.patch * (glob)
458 +++ */hg-7a4785234d87.patch * (glob)
451 @@ -1,8 +1,8 @@
459 @@ -1,8 +1,8 @@
452 # HG changeset patch
460 # HG changeset patch
453 -# User test
461 -# User test
454 +# User foo
462 +# User foo
455 # Date 0 0
463 # Date 0 0
456 # Thu Jan 01 00:00:00 1970 +0000
464 # Thu Jan 01 00:00:00 1970 +0000
457 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
465 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
458 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
466 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
459 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
467 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
460 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
468 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
461 2
469 2
462
470
463 [1]
471 [1]
464
472
465 Disallow grafting already grafted csets with the same origin onto each other
473 Disallow grafting already grafted csets with the same origin onto each other
466 $ hg up -q 13
474 $ hg up -q 13
467 $ hg graft 2
475 $ hg graft 2
468 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
476 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
469 [255]
477 [255]
470 $ hg graft 7
478 $ hg graft 7
471 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
479 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
472 [255]
480 [255]
473
481
474 $ hg up -q 7
482 $ hg up -q 7
475 $ hg graft 2
483 $ hg graft 2
476 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
484 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
477 [255]
485 [255]
478 $ hg graft tip
486 $ hg graft tip
479 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
487 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
480 [255]
488 [255]
481
489
482 Graft with --log
490 Graft with --log
483
491
484 $ hg up -Cq 1
492 $ hg up -Cq 1
485 $ hg graft 3 --log -u foo
493 $ hg graft 3 --log -u foo
486 grafting 3:4c60f11aa304 "3"
494 grafting 3:4c60f11aa304 "3"
487 warning: can't find ancestor for 'c' copied from 'b'!
495 warning: can't find ancestor for 'c' copied from 'b'!
488 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
496 $ hg log --template '{rev}:{node|short} {parents} {desc}\n' -r tip
489 14:0c921c65ef1e 1:5d205f8b35b6 3
497 14:0c921c65ef1e 1:5d205f8b35b6 3
490 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
498 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
491
499
492 Resolve conflicted graft
500 Resolve conflicted graft
493 $ hg up -q 0
501 $ hg up -q 0
494 $ echo b > a
502 $ echo b > a
495 $ hg ci -m 8
503 $ hg ci -m 8
496 created new head
504 created new head
497 $ echo c > a
505 $ echo c > a
498 $ hg ci -m 9
506 $ hg ci -m 9
499 $ hg graft 1 --tool internal:fail
507 $ hg graft 1 --tool internal:fail
500 grafting 1:5d205f8b35b6 "1"
508 grafting 1:5d205f8b35b6 "1"
501 abort: unresolved conflicts, can't continue
509 abort: unresolved conflicts, can't continue
502 (use 'hg resolve' and 'hg graft --continue')
510 (use 'hg resolve' and 'hg graft --continue')
503 [255]
511 [255]
504 $ hg resolve --all
512 $ hg resolve --all
505 merging a
513 merging a
506 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
514 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
507 [1]
515 [1]
508 $ cat a
516 $ cat a
509 <<<<<<< local: aaa4406d4f0a - test: 9
517 <<<<<<< local: aaa4406d4f0a - test: 9
510 c
518 c
511 =======
519 =======
512 b
520 b
513 >>>>>>> graft: 5d205f8b35b6 - bar: 1
521 >>>>>>> graft: 5d205f8b35b6 - bar: 1
514 $ echo b > a
522 $ echo b > a
515 $ hg resolve -m a
523 $ hg resolve -m a
516 (no more unresolved files)
524 (no more unresolved files)
517 continue: hg graft --continue
525 continue: hg graft --continue
518 $ hg graft -c
526 $ hg graft -c
519 grafting 1:5d205f8b35b6 "1"
527 grafting 1:5d205f8b35b6 "1"
520 $ hg export tip --git
528 $ hg export tip --git
521 # HG changeset patch
529 # HG changeset patch
522 # User bar
530 # User bar
523 # Date 0 0
531 # Date 0 0
524 # Thu Jan 01 00:00:00 1970 +0000
532 # Thu Jan 01 00:00:00 1970 +0000
525 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
533 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
526 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
534 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
527 1
535 1
528
536
529 diff --git a/a b/a
537 diff --git a/a b/a
530 --- a/a
538 --- a/a
531 +++ b/a
539 +++ b/a
532 @@ -1,1 +1,1 @@
540 @@ -1,1 +1,1 @@
533 -c
541 -c
534 +b
542 +b
535
543
536 Resolve conflicted graft with rename
544 Resolve conflicted graft with rename
537 $ echo c > a
545 $ echo c > a
538 $ hg ci -m 10
546 $ hg ci -m 10
539 $ hg graft 2 --tool internal:fail
547 $ hg graft 2 --tool internal:fail
540 grafting 2:5c095ad7e90f "2"
548 grafting 2:5c095ad7e90f "2"
541 abort: unresolved conflicts, can't continue
549 abort: unresolved conflicts, can't continue
542 (use 'hg resolve' and 'hg graft --continue')
550 (use 'hg resolve' and 'hg graft --continue')
543 [255]
551 [255]
544 $ hg resolve --all
552 $ hg resolve --all
545 merging a and b to b
553 merging a and b to b
546 (no more unresolved files)
554 (no more unresolved files)
547 continue: hg graft --continue
555 continue: hg graft --continue
548 $ hg graft -c
556 $ hg graft -c
549 grafting 2:5c095ad7e90f "2"
557 grafting 2:5c095ad7e90f "2"
550 $ hg export tip --git
558 $ hg export tip --git
551 # HG changeset patch
559 # HG changeset patch
552 # User test
560 # User test
553 # Date 0 0
561 # Date 0 0
554 # Thu Jan 01 00:00:00 1970 +0000
562 # Thu Jan 01 00:00:00 1970 +0000
555 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
563 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
556 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
564 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
557 2
565 2
558
566
559 diff --git a/a b/b
567 diff --git a/a b/b
560 rename from a
568 rename from a
561 rename to b
569 rename to b
562
570
563 Test simple origin(), with and without args
571 Test simple origin(), with and without args
564 $ hg log -r 'origin()'
572 $ hg log -r 'origin()'
565 changeset: 1:5d205f8b35b6
573 changeset: 1:5d205f8b35b6
566 user: bar
574 user: bar
567 date: Thu Jan 01 00:00:00 1970 +0000
575 date: Thu Jan 01 00:00:00 1970 +0000
568 summary: 1
576 summary: 1
569
577
570 changeset: 2:5c095ad7e90f
578 changeset: 2:5c095ad7e90f
571 user: test
579 user: test
572 date: Thu Jan 01 00:00:00 1970 +0000
580 date: Thu Jan 01 00:00:00 1970 +0000
573 summary: 2
581 summary: 2
574
582
575 changeset: 3:4c60f11aa304
583 changeset: 3:4c60f11aa304
576 user: baz
584 user: baz
577 date: Thu Jan 01 00:00:00 1970 +0000
585 date: Thu Jan 01 00:00:00 1970 +0000
578 summary: 3
586 summary: 3
579
587
580 changeset: 4:9c233e8e184d
588 changeset: 4:9c233e8e184d
581 user: test
589 user: test
582 date: Thu Jan 01 00:00:00 1970 +0000
590 date: Thu Jan 01 00:00:00 1970 +0000
583 summary: 4
591 summary: 4
584
592
585 changeset: 5:97f8bfe72746
593 changeset: 5:97f8bfe72746
586 branch: stable
594 branch: stable
587 parent: 3:4c60f11aa304
595 parent: 3:4c60f11aa304
588 user: test
596 user: test
589 date: Thu Jan 01 00:00:00 1970 +0000
597 date: Thu Jan 01 00:00:00 1970 +0000
590 summary: 5
598 summary: 5
591
599
592 $ hg log -r 'origin(7)'
600 $ hg log -r 'origin(7)'
593 changeset: 2:5c095ad7e90f
601 changeset: 2:5c095ad7e90f
594 user: test
602 user: test
595 date: Thu Jan 01 00:00:00 1970 +0000
603 date: Thu Jan 01 00:00:00 1970 +0000
596 summary: 2
604 summary: 2
597
605
598 Now transplant a graft to test following through copies
606 Now transplant a graft to test following through copies
599 $ hg up -q 0
607 $ hg up -q 0
600 $ hg branch -q dev
608 $ hg branch -q dev
601 $ hg ci -qm "dev branch"
609 $ hg ci -qm "dev branch"
602 $ hg --config extensions.transplant= transplant -q 7
610 $ hg --config extensions.transplant= transplant -q 7
603 $ hg log -r 'origin(.)'
611 $ hg log -r 'origin(.)'
604 changeset: 2:5c095ad7e90f
612 changeset: 2:5c095ad7e90f
605 user: test
613 user: test
606 date: Thu Jan 01 00:00:00 1970 +0000
614 date: Thu Jan 01 00:00:00 1970 +0000
607 summary: 2
615 summary: 2
608
616
609 Test that the graft and transplant markers in extra are converted, allowing
617 Test that the graft and transplant markers in extra are converted, allowing
610 origin() to still work. Note that these recheck the immediately preceeding two
618 origin() to still work. Note that these recheck the immediately preceeding two
611 tests.
619 tests.
612 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
620 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
613
621
614 The graft case
622 The graft case
615 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
623 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
616 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
624 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
617 branch=default
625 branch=default
618 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
626 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
619 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
627 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
620 $ hg -R ../converted log -r 'origin(7)'
628 $ hg -R ../converted log -r 'origin(7)'
621 changeset: 2:e0213322b2c1
629 changeset: 2:e0213322b2c1
622 user: test
630 user: test
623 date: Thu Jan 01 00:00:00 1970 +0000
631 date: Thu Jan 01 00:00:00 1970 +0000
624 summary: 2
632 summary: 2
625
633
626 Test that template correctly expands more than one 'extra' (issue4362), and that
634 Test that template correctly expands more than one 'extra' (issue4362), and that
627 'intermediate-source' is converted.
635 'intermediate-source' is converted.
628 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
636 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
629 Extra: branch=default
637 Extra: branch=default
630 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
638 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
631 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
639 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
632 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
640 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
633
641
634 The transplant case
642 The transplant case
635 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
643 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
636 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
644 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
637 branch=dev
645 branch=dev
638 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
646 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
639 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
647 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac\n`h\x9b
640 $ hg -R ../converted log -r 'origin(tip)'
648 $ hg -R ../converted log -r 'origin(tip)'
641 changeset: 2:e0213322b2c1
649 changeset: 2:e0213322b2c1
642 user: test
650 user: test
643 date: Thu Jan 01 00:00:00 1970 +0000
651 date: Thu Jan 01 00:00:00 1970 +0000
644 summary: 2
652 summary: 2
645
653
646
654
647 Test simple destination
655 Test simple destination
648 $ hg log -r 'destination()'
656 $ hg log -r 'destination()'
649 changeset: 7:ef0ef43d49e7
657 changeset: 7:ef0ef43d49e7
650 parent: 0:68795b066622
658 parent: 0:68795b066622
651 user: foo
659 user: foo
652 date: Thu Jan 01 00:00:00 1970 +0000
660 date: Thu Jan 01 00:00:00 1970 +0000
653 summary: 2
661 summary: 2
654
662
655 changeset: 8:6b9e5368ca4e
663 changeset: 8:6b9e5368ca4e
656 user: bar
664 user: bar
657 date: Thu Jan 01 00:00:00 1970 +0000
665 date: Thu Jan 01 00:00:00 1970 +0000
658 summary: 1
666 summary: 1
659
667
660 changeset: 9:1905859650ec
668 changeset: 9:1905859650ec
661 user: test
669 user: test
662 date: Thu Jan 01 00:00:00 1970 +0000
670 date: Thu Jan 01 00:00:00 1970 +0000
663 summary: 5
671 summary: 5
664
672
665 changeset: 10:52dc0b4c6907
673 changeset: 10:52dc0b4c6907
666 user: test
674 user: test
667 date: Thu Jan 01 00:00:00 1970 +0000
675 date: Thu Jan 01 00:00:00 1970 +0000
668 summary: 4
676 summary: 4
669
677
670 changeset: 11:882b35362a6b
678 changeset: 11:882b35362a6b
671 user: test
679 user: test
672 date: Thu Jan 01 00:00:00 1970 +0000
680 date: Thu Jan 01 00:00:00 1970 +0000
673 summary: 3
681 summary: 3
674
682
675 changeset: 13:7a4785234d87
683 changeset: 13:7a4785234d87
676 user: foo
684 user: foo
677 date: Thu Jan 01 00:00:00 1970 +0000
685 date: Thu Jan 01 00:00:00 1970 +0000
678 summary: 2
686 summary: 2
679
687
680 changeset: 14:0c921c65ef1e
688 changeset: 14:0c921c65ef1e
681 parent: 1:5d205f8b35b6
689 parent: 1:5d205f8b35b6
682 user: foo
690 user: foo
683 date: Thu Jan 01 00:00:00 1970 +0000
691 date: Thu Jan 01 00:00:00 1970 +0000
684 summary: 3
692 summary: 3
685
693
686 changeset: 17:f67661df0c48
694 changeset: 17:f67661df0c48
687 user: bar
695 user: bar
688 date: Thu Jan 01 00:00:00 1970 +0000
696 date: Thu Jan 01 00:00:00 1970 +0000
689 summary: 1
697 summary: 1
690
698
691 changeset: 19:9627f653b421
699 changeset: 19:9627f653b421
692 user: test
700 user: test
693 date: Thu Jan 01 00:00:00 1970 +0000
701 date: Thu Jan 01 00:00:00 1970 +0000
694 summary: 2
702 summary: 2
695
703
696 changeset: 21:7e61b508e709
704 changeset: 21:7e61b508e709
697 branch: dev
705 branch: dev
698 tag: tip
706 tag: tip
699 user: foo
707 user: foo
700 date: Thu Jan 01 00:00:00 1970 +0000
708 date: Thu Jan 01 00:00:00 1970 +0000
701 summary: 2
709 summary: 2
702
710
703 $ hg log -r 'destination(2)'
711 $ hg log -r 'destination(2)'
704 changeset: 7:ef0ef43d49e7
712 changeset: 7:ef0ef43d49e7
705 parent: 0:68795b066622
713 parent: 0:68795b066622
706 user: foo
714 user: foo
707 date: Thu Jan 01 00:00:00 1970 +0000
715 date: Thu Jan 01 00:00:00 1970 +0000
708 summary: 2
716 summary: 2
709
717
710 changeset: 13:7a4785234d87
718 changeset: 13:7a4785234d87
711 user: foo
719 user: foo
712 date: Thu Jan 01 00:00:00 1970 +0000
720 date: Thu Jan 01 00:00:00 1970 +0000
713 summary: 2
721 summary: 2
714
722
715 changeset: 19:9627f653b421
723 changeset: 19:9627f653b421
716 user: test
724 user: test
717 date: Thu Jan 01 00:00:00 1970 +0000
725 date: Thu Jan 01 00:00:00 1970 +0000
718 summary: 2
726 summary: 2
719
727
720 changeset: 21:7e61b508e709
728 changeset: 21:7e61b508e709
721 branch: dev
729 branch: dev
722 tag: tip
730 tag: tip
723 user: foo
731 user: foo
724 date: Thu Jan 01 00:00:00 1970 +0000
732 date: Thu Jan 01 00:00:00 1970 +0000
725 summary: 2
733 summary: 2
726
734
727 Transplants of grafts can find a destination...
735 Transplants of grafts can find a destination...
728 $ hg log -r 'destination(7)'
736 $ hg log -r 'destination(7)'
729 changeset: 21:7e61b508e709
737 changeset: 21:7e61b508e709
730 branch: dev
738 branch: dev
731 tag: tip
739 tag: tip
732 user: foo
740 user: foo
733 date: Thu Jan 01 00:00:00 1970 +0000
741 date: Thu Jan 01 00:00:00 1970 +0000
734 summary: 2
742 summary: 2
735
743
736 ... grafts of grafts unfortunately can't
744 ... grafts of grafts unfortunately can't
737 $ hg graft -q 13 --debug
745 $ hg graft -q 13 --debug
738 scanning for duplicate grafts
746 scanning for duplicate grafts
739 grafting 13:7a4785234d87 "2"
747 grafting 13:7a4785234d87 "2"
740 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
748 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
741 src: 'a' -> dst: 'b' *
749 src: 'a' -> dst: 'b' *
742 checking for directory renames
750 checking for directory renames
743 resolving manifests
751 resolving manifests
744 branchmerge: True, force: True, partial: False
752 branchmerge: True, force: True, partial: False
745 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
753 ancestor: b592ea63bb0c, local: 7e61b508e709+, remote: 7a4785234d87
746 starting 4 threads for background file closing (?)
754 starting 4 threads for background file closing (?)
747 committing files:
755 committing files:
748 b
756 b
749 warning: can't find ancestor for 'b' copied from 'a'!
757 warning: can't find ancestor for 'b' copied from 'a'!
750 reusing manifest form p1 (listed files actually unchanged)
758 reusing manifest form p1 (listed files actually unchanged)
751 committing changelog
759 committing changelog
752 updating the branch cache
760 updating the branch cache
753 $ hg log -r 'destination(13)'
761 $ hg log -r 'destination(13)'
754 All copies of a cset
762 All copies of a cset
755 $ hg log -r 'origin(13) or destination(origin(13))'
763 $ hg log -r 'origin(13) or destination(origin(13))'
756 changeset: 2:5c095ad7e90f
764 changeset: 2:5c095ad7e90f
757 user: test
765 user: test
758 date: Thu Jan 01 00:00:00 1970 +0000
766 date: Thu Jan 01 00:00:00 1970 +0000
759 summary: 2
767 summary: 2
760
768
761 changeset: 7:ef0ef43d49e7
769 changeset: 7:ef0ef43d49e7
762 parent: 0:68795b066622
770 parent: 0:68795b066622
763 user: foo
771 user: foo
764 date: Thu Jan 01 00:00:00 1970 +0000
772 date: Thu Jan 01 00:00:00 1970 +0000
765 summary: 2
773 summary: 2
766
774
767 changeset: 13:7a4785234d87
775 changeset: 13:7a4785234d87
768 user: foo
776 user: foo
769 date: Thu Jan 01 00:00:00 1970 +0000
777 date: Thu Jan 01 00:00:00 1970 +0000
770 summary: 2
778 summary: 2
771
779
772 changeset: 19:9627f653b421
780 changeset: 19:9627f653b421
773 user: test
781 user: test
774 date: Thu Jan 01 00:00:00 1970 +0000
782 date: Thu Jan 01 00:00:00 1970 +0000
775 summary: 2
783 summary: 2
776
784
777 changeset: 21:7e61b508e709
785 changeset: 21:7e61b508e709
778 branch: dev
786 branch: dev
779 user: foo
787 user: foo
780 date: Thu Jan 01 00:00:00 1970 +0000
788 date: Thu Jan 01 00:00:00 1970 +0000
781 summary: 2
789 summary: 2
782
790
783 changeset: 22:3a4e92d81b97
791 changeset: 22:3a4e92d81b97
784 branch: dev
792 branch: dev
785 tag: tip
793 tag: tip
786 user: foo
794 user: foo
787 date: Thu Jan 01 00:00:00 1970 +0000
795 date: Thu Jan 01 00:00:00 1970 +0000
788 summary: 2
796 summary: 2
789
797
790
798
791 graft works on complex revset
799 graft works on complex revset
792
800
793 $ hg graft 'origin(13) or destination(origin(13))'
801 $ hg graft 'origin(13) or destination(origin(13))'
794 skipping ancestor revision 21:7e61b508e709
802 skipping ancestor revision 21:7e61b508e709
795 skipping ancestor revision 22:3a4e92d81b97
803 skipping ancestor revision 22:3a4e92d81b97
796 skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97)
804 skipping revision 2:5c095ad7e90f (already grafted to 22:3a4e92d81b97)
797 grafting 7:ef0ef43d49e7 "2"
805 grafting 7:ef0ef43d49e7 "2"
798 warning: can't find ancestor for 'b' copied from 'a'!
806 warning: can't find ancestor for 'b' copied from 'a'!
799 grafting 13:7a4785234d87 "2"
807 grafting 13:7a4785234d87 "2"
800 warning: can't find ancestor for 'b' copied from 'a'!
808 warning: can't find ancestor for 'b' copied from 'a'!
801 grafting 19:9627f653b421 "2"
809 grafting 19:9627f653b421 "2"
802 merging b
810 merging b
803 warning: can't find ancestor for 'b' copied from 'a'!
811 warning: can't find ancestor for 'b' copied from 'a'!
804
812
805 graft with --force (still doesn't graft merges)
813 graft with --force (still doesn't graft merges)
806
814
807 $ hg graft 19 0 6
815 $ hg graft 19 0 6
808 skipping ungraftable merge revision 6
816 skipping ungraftable merge revision 6
809 skipping ancestor revision 0:68795b066622
817 skipping ancestor revision 0:68795b066622
810 skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f)
818 skipping already grafted revision 19:9627f653b421 (22:3a4e92d81b97 also has origin 2:5c095ad7e90f)
811 [255]
819 [255]
812 $ hg graft 19 0 6 --force
820 $ hg graft 19 0 6 --force
813 skipping ungraftable merge revision 6
821 skipping ungraftable merge revision 6
814 grafting 19:9627f653b421 "2"
822 grafting 19:9627f653b421 "2"
815 merging b
823 merging b
816 warning: can't find ancestor for 'b' copied from 'a'!
824 warning: can't find ancestor for 'b' copied from 'a'!
817 grafting 0:68795b066622 "0"
825 grafting 0:68795b066622 "0"
818
826
819 graft --force after backout
827 graft --force after backout
820
828
821 $ echo abc > a
829 $ echo abc > a
822 $ hg ci -m 28
830 $ hg ci -m 28
823 $ hg backout 28
831 $ hg backout 28
824 reverting a
832 reverting a
825 changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d
833 changeset 29:9d95e865b00c backs out changeset 28:cc20d29aec8d
826 $ hg graft 28
834 $ hg graft 28
827 skipping ancestor revision 28:cc20d29aec8d
835 skipping ancestor revision 28:cc20d29aec8d
828 [255]
836 [255]
829 $ hg graft 28 --force
837 $ hg graft 28 --force
830 grafting 28:cc20d29aec8d "28"
838 grafting 28:cc20d29aec8d "28"
831 merging a
839 merging a
832 $ cat a
840 $ cat a
833 abc
841 abc
834
842
835 graft --continue after --force
843 graft --continue after --force
836
844
837 $ echo def > a
845 $ echo def > a
838 $ hg ci -m 31
846 $ hg ci -m 31
839 $ hg graft 28 --force --tool internal:fail
847 $ hg graft 28 --force --tool internal:fail
840 grafting 28:cc20d29aec8d "28"
848 grafting 28:cc20d29aec8d "28"
841 abort: unresolved conflicts, can't continue
849 abort: unresolved conflicts, can't continue
842 (use 'hg resolve' and 'hg graft --continue')
850 (use 'hg resolve' and 'hg graft --continue')
843 [255]
851 [255]
844 $ hg resolve --all
852 $ hg resolve --all
845 merging a
853 merging a
846 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
854 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
847 [1]
855 [1]
848 $ echo abc > a
856 $ echo abc > a
849 $ hg resolve -m a
857 $ hg resolve -m a
850 (no more unresolved files)
858 (no more unresolved files)
851 continue: hg graft --continue
859 continue: hg graft --continue
852 $ hg graft -c
860 $ hg graft -c
853 grafting 28:cc20d29aec8d "28"
861 grafting 28:cc20d29aec8d "28"
854 $ cat a
862 $ cat a
855 abc
863 abc
856
864
857 Continue testing same origin policy, using revision numbers from test above
865 Continue testing same origin policy, using revision numbers from test above
858 but do some destructive editing of the repo:
866 but do some destructive editing of the repo:
859
867
860 $ hg up -qC 7
868 $ hg up -qC 7
861 $ hg tag -l -r 13 tmp
869 $ hg tag -l -r 13 tmp
862 $ hg --config extensions.strip= strip 2
870 $ hg --config extensions.strip= strip 2
863 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
871 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg
864 $ hg graft tmp
872 $ hg graft tmp
865 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
873 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
866 [255]
874 [255]
867
875
868 Empty graft
876 Empty graft
869
877
870 $ hg up -qr 26
878 $ hg up -qr 26
871 $ hg tag -f something
879 $ hg tag -f something
872 $ hg graft -qr 27
880 $ hg graft -qr 27
873 $ hg graft -f 27
881 $ hg graft -f 27
874 grafting 27:17d42b8f5d50 "28"
882 grafting 27:17d42b8f5d50 "28"
875 note: graft of 27:17d42b8f5d50 created no changes to commit
883 note: graft of 27:17d42b8f5d50 created no changes to commit
876
884
877 $ cd ..
885 $ cd ..
878
886
879 Graft to duplicate a commit
887 Graft to duplicate a commit
880
888
881 $ hg init graftsibling
889 $ hg init graftsibling
882 $ cd graftsibling
890 $ cd graftsibling
883 $ touch a
891 $ touch a
884 $ hg commit -qAm a
892 $ hg commit -qAm a
885 $ touch b
893 $ touch b
886 $ hg commit -qAm b
894 $ hg commit -qAm b
887 $ hg log -G -T '{rev}\n'
895 $ hg log -G -T '{rev}\n'
888 @ 1
896 @ 1
889 |
897 |
890 o 0
898 o 0
891
899
892 $ hg up -q 0
900 $ hg up -q 0
893 $ hg graft -r 1
901 $ hg graft -r 1
894 grafting 1:0e067c57feba "b" (tip)
902 grafting 1:0e067c57feba "b" (tip)
895 $ hg log -G -T '{rev}\n'
903 $ hg log -G -T '{rev}\n'
896 @ 2
904 @ 2
897 |
905 |
898 | o 1
906 | o 1
899 |/
907 |/
900 o 0
908 o 0
901
909
902 Graft to duplicate a commit twice
910 Graft to duplicate a commit twice
903
911
904 $ hg up -q 0
912 $ hg up -q 0
905 $ hg graft -r 2
913 $ hg graft -r 2
906 grafting 2:044ec77f6389 "b" (tip)
914 grafting 2:044ec77f6389 "b" (tip)
907 $ hg log -G -T '{rev}\n'
915 $ hg log -G -T '{rev}\n'
908 @ 3
916 @ 3
909 |
917 |
910 | o 2
918 | o 2
911 |/
919 |/
912 | o 1
920 | o 1
913 |/
921 |/
914 o 0
922 o 0
915
923
916 Graft from behind a move or rename
924 Graft from behind a move or rename
917 ==================================
925 ==================================
918
926
919 NOTE: This is affected by issue5343, and will need updating when it's fixed
927 NOTE: This is affected by issue5343, and will need updating when it's fixed
920
928
921 Consider this topology for a regular graft:
929 Consider this topology for a regular graft:
922
930
923 o c1
931 o c1
924 |
932 |
925 | o c2
933 | o c2
926 | |
934 | |
927 | o ca # stands for "common ancestor"
935 | o ca # stands for "common ancestor"
928 |/
936 |/
929 o cta # stands for "common topological ancestor"
937 o cta # stands for "common topological ancestor"
930
938
931 Note that in issue5343, ca==cta.
939 Note that in issue5343, ca==cta.
932
940
933 The following table shows the possible cases. Here, "x->y" and, equivalently,
941 The following table shows the possible cases. Here, "x->y" and, equivalently,
934 "y<-x", where x is an ancestor of y, means that some copy happened from x to y.
942 "y<-x", where x is an ancestor of y, means that some copy happened from x to y.
935
943
936 name | c1<-cta | cta<->ca | ca->c2
944 name | c1<-cta | cta<->ca | ca->c2
937 A.0 | | |
945 A.0 | | |
938 A.1 | X | |
946 A.1 | X | |
939 A.2 | | X |
947 A.2 | | X |
940 A.3 | | | X
948 A.3 | | | X
941 A.4 | X | X |
949 A.4 | X | X |
942 A.5 | X | | X
950 A.5 | X | | X
943 A.6 | | X | X
951 A.6 | | X | X
944 A.7 | X | X | X
952 A.7 | X | X | X
945
953
946 A.0 is trivial, and doesn't need copy tracking.
954 A.0 is trivial, and doesn't need copy tracking.
947 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
955 For A.1, a forward rename is recorded in the c1 pass, to be followed later.
948 In A.2, the rename is recorded in the c2 pass and followed backwards.
956 In A.2, the rename is recorded in the c2 pass and followed backwards.
949 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
957 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target.
950 In A.4, both passes of checkcopies record incomplete renames, which are
958 In A.4, both passes of checkcopies record incomplete renames, which are
951 then joined in mergecopies to record a rename to be followed.
959 then joined in mergecopies to record a rename to be followed.
952 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
960 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass
953 records an incomplete divergence. The incomplete rename is then joined to the
961 records an incomplete divergence. The incomplete rename is then joined to the
954 appropriate side of the incomplete divergence, and the result is recorded as a
962 appropriate side of the incomplete divergence, and the result is recorded as a
955 divergence. The code doesn't distinguish at all between these two cases, since
963 divergence. The code doesn't distinguish at all between these two cases, since
956 the end result of them is the same: an incomplete divergence joined with an
964 the end result of them is the same: an incomplete divergence joined with an
957 incomplete rename into a divergence.
965 incomplete rename into a divergence.
958 Finally, A.6 records a divergence entirely in the c2 pass.
966 Finally, A.6 records a divergence entirely in the c2 pass.
959
967
960 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
968 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all.
961 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
969 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge.
962 A.5 has issue5343 as a special case.
970 A.5 has issue5343 as a special case.
963 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
971 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious
964 incomplete divergence, which is in fact complete. This is handled later in
972 incomplete divergence, which is in fact complete. This is handled later in
965 mergecopies.
973 mergecopies.
966 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
974 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b,
967 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
975 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting,
968 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
976 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base
969 case, a<-b<-c->a is treated the same as a<-b<-b->a).
977 case, a<-b<-c->a is treated the same as a<-b<-b->a).
970
978
971 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
979 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the
972 same name on both branches, then the rename is backed out on one branch, and
980 same name on both branches, then the rename is backed out on one branch, and
973 the backout is grafted to the other branch. This creates a challenging rename
981 the backout is grafted to the other branch. This creates a challenging rename
974 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
982 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft
975 source, respectively. Since rename detection will run on the c1 side for such a
983 source, respectively. Since rename detection will run on the c1 side for such a
976 sequence (as for technical reasons, we split the c1 and c2 sides not at the
984 sequence (as for technical reasons, we split the c1 and c2 sides not at the
977 graft CA, but rather at the topological CA), it will pick up a false rename,
985 graft CA, but rather at the topological CA), it will pick up a false rename,
978 and cause a spurious merge conflict. This false rename is always exactly the
986 and cause a spurious merge conflict. This false rename is always exactly the
979 reverse of the true rename that would be detected on the c2 side, so we can
987 reverse of the true rename that would be detected on the c2 side, so we can
980 correct for it by detecting this condition and reversing as necessary.
988 correct for it by detecting this condition and reversing as necessary.
981
989
982 First, set up the repository with commits to be grafted
990 First, set up the repository with commits to be grafted
983
991
984 $ hg init ../graftmove
992 $ hg init ../graftmove
985 $ cd ../graftmove
993 $ cd ../graftmove
986 $ echo c1a > f1a
994 $ echo c1a > f1a
987 $ echo c2a > f2a
995 $ echo c2a > f2a
988 $ echo c3a > f3a
996 $ echo c3a > f3a
989 $ echo c4a > f4a
997 $ echo c4a > f4a
990 $ echo c5a > f5a
998 $ echo c5a > f5a
991 $ hg ci -qAm A0
999 $ hg ci -qAm A0
992 $ hg mv f1a f1b
1000 $ hg mv f1a f1b
993 $ hg mv f3a f3b
1001 $ hg mv f3a f3b
994 $ hg mv f5a f5b
1002 $ hg mv f5a f5b
995 $ hg ci -qAm B0
1003 $ hg ci -qAm B0
996 $ echo c1c > f1b
1004 $ echo c1c > f1b
997 $ hg mv f2a f2c
1005 $ hg mv f2a f2c
998 $ hg mv f5b f5a
1006 $ hg mv f5b f5a
999 $ echo c5c > f5a
1007 $ echo c5c > f5a
1000 $ hg ci -qAm C0
1008 $ hg ci -qAm C0
1001 $ hg mv f3b f3d
1009 $ hg mv f3b f3d
1002 $ echo c4d > f4a
1010 $ echo c4d > f4a
1003 $ hg ci -qAm D0
1011 $ hg ci -qAm D0
1004 $ hg log -G
1012 $ hg log -G
1005 @ changeset: 3:b69f5839d2d9
1013 @ changeset: 3:b69f5839d2d9
1006 | tag: tip
1014 | tag: tip
1007 | user: test
1015 | user: test
1008 | date: Thu Jan 01 00:00:00 1970 +0000
1016 | date: Thu Jan 01 00:00:00 1970 +0000
1009 | summary: D0
1017 | summary: D0
1010 |
1018 |
1011 o changeset: 2:f58c7e2b28fa
1019 o changeset: 2:f58c7e2b28fa
1012 | user: test
1020 | user: test
1013 | date: Thu Jan 01 00:00:00 1970 +0000
1021 | date: Thu Jan 01 00:00:00 1970 +0000
1014 | summary: C0
1022 | summary: C0
1015 |
1023 |
1016 o changeset: 1:3d7bba921b5d
1024 o changeset: 1:3d7bba921b5d
1017 | user: test
1025 | user: test
1018 | date: Thu Jan 01 00:00:00 1970 +0000
1026 | date: Thu Jan 01 00:00:00 1970 +0000
1019 | summary: B0
1027 | summary: B0
1020 |
1028 |
1021 o changeset: 0:11f7a1b56675
1029 o changeset: 0:11f7a1b56675
1022 user: test
1030 user: test
1023 date: Thu Jan 01 00:00:00 1970 +0000
1031 date: Thu Jan 01 00:00:00 1970 +0000
1024 summary: A0
1032 summary: A0
1025
1033
1026
1034
1027 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
1035 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the
1028 two renames actually converge to the same name (thus no actual divergence).
1036 two renames actually converge to the same name (thus no actual divergence).
1029
1037
1030 $ hg up -q 'desc("A0")'
1038 $ hg up -q 'desc("A0")'
1031 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
1039 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit
1032 grafting 2:f58c7e2b28fa "C0"
1040 grafting 2:f58c7e2b28fa "C0"
1033 merging f1a and f1b to f1a
1041 merging f1a and f1b to f1a
1034 merging f5a
1042 merging f5a
1035 warning: can't find ancestor for 'f5a' copied from 'f5b'!
1043 warning: can't find ancestor for 'f5a' copied from 'f5b'!
1036 $ hg status --change .
1044 $ hg status --change .
1037 M f1a
1045 M f1a
1038 M f5a
1046 M f5a
1039 A f2c
1047 A f2c
1040 R f2a
1048 R f2a
1041 $ hg cat f1a
1049 $ hg cat f1a
1042 c1c
1050 c1c
1043 $ hg cat f1b
1051 $ hg cat f1b
1044 f1b: no such file in rev c9763722f9bd
1052 f1b: no such file in rev c9763722f9bd
1045 [1]
1053 [1]
1046
1054
1047 Test the cases A.0 (f4x) and A.6 (f3x)
1055 Test the cases A.0 (f4x) and A.6 (f3x)
1048
1056
1049 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
1057 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit
1050 grafting 3:b69f5839d2d9 "D0"
1058 grafting 3:b69f5839d2d9 "D0"
1051 note: possible conflict - f3b was renamed multiple times to:
1059 note: possible conflict - f3b was renamed multiple times to:
1052 f3a
1060 f3a
1053 f3d
1061 f3d
1054 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1062 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1055
1063
1056 Set up the repository for some further tests
1064 Set up the repository for some further tests
1057
1065
1058 $ hg up -q "min(desc("A0"))"
1066 $ hg up -q "min(desc("A0"))"
1059 $ hg mv f1a f1e
1067 $ hg mv f1a f1e
1060 $ echo c2e > f2a
1068 $ echo c2e > f2a
1061 $ hg mv f3a f3e
1069 $ hg mv f3a f3e
1062 $ hg mv f4a f4e
1070 $ hg mv f4a f4e
1063 $ hg mv f5a f5b
1071 $ hg mv f5a f5b
1064 $ hg ci -qAm "E0"
1072 $ hg ci -qAm "E0"
1065 $ hg up -q "min(desc("A0"))"
1073 $ hg up -q "min(desc("A0"))"
1066 $ hg cp f1a f1f
1074 $ hg cp f1a f1f
1067 $ hg ci -qAm "F0"
1075 $ hg ci -qAm "F0"
1068 $ hg up -q "min(desc("A0"))"
1076 $ hg up -q "min(desc("A0"))"
1069 $ hg cp f1a f1g
1077 $ hg cp f1a f1g
1070 $ echo c1g > f1g
1078 $ echo c1g > f1g
1071 $ hg ci -qAm "G0"
1079 $ hg ci -qAm "G0"
1072 $ hg log -G
1080 $ hg log -G
1073 @ changeset: 8:ba67f08fb15a
1081 @ changeset: 8:ba67f08fb15a
1074 | tag: tip
1082 | tag: tip
1075 | parent: 0:11f7a1b56675
1083 | parent: 0:11f7a1b56675
1076 | user: test
1084 | user: test
1077 | date: Thu Jan 01 00:00:00 1970 +0000
1085 | date: Thu Jan 01 00:00:00 1970 +0000
1078 | summary: G0
1086 | summary: G0
1079 |
1087 |
1080 | o changeset: 7:d376ab0d7fda
1088 | o changeset: 7:d376ab0d7fda
1081 |/ parent: 0:11f7a1b56675
1089 |/ parent: 0:11f7a1b56675
1082 | user: test
1090 | user: test
1083 | date: Thu Jan 01 00:00:00 1970 +0000
1091 | date: Thu Jan 01 00:00:00 1970 +0000
1084 | summary: F0
1092 | summary: F0
1085 |
1093 |
1086 | o changeset: 6:6bd1736cab86
1094 | o changeset: 6:6bd1736cab86
1087 |/ parent: 0:11f7a1b56675
1095 |/ parent: 0:11f7a1b56675
1088 | user: test
1096 | user: test
1089 | date: Thu Jan 01 00:00:00 1970 +0000
1097 | date: Thu Jan 01 00:00:00 1970 +0000
1090 | summary: E0
1098 | summary: E0
1091 |
1099 |
1092 | o changeset: 5:560daee679da
1100 | o changeset: 5:560daee679da
1093 | | user: test
1101 | | user: test
1094 | | date: Thu Jan 01 00:00:00 1970 +0000
1102 | | date: Thu Jan 01 00:00:00 1970 +0000
1095 | | summary: D1
1103 | | summary: D1
1096 | |
1104 | |
1097 | o changeset: 4:c9763722f9bd
1105 | o changeset: 4:c9763722f9bd
1098 |/ parent: 0:11f7a1b56675
1106 |/ parent: 0:11f7a1b56675
1099 | user: test
1107 | user: test
1100 | date: Thu Jan 01 00:00:00 1970 +0000
1108 | date: Thu Jan 01 00:00:00 1970 +0000
1101 | summary: C1
1109 | summary: C1
1102 |
1110 |
1103 | o changeset: 3:b69f5839d2d9
1111 | o changeset: 3:b69f5839d2d9
1104 | | user: test
1112 | | user: test
1105 | | date: Thu Jan 01 00:00:00 1970 +0000
1113 | | date: Thu Jan 01 00:00:00 1970 +0000
1106 | | summary: D0
1114 | | summary: D0
1107 | |
1115 | |
1108 | o changeset: 2:f58c7e2b28fa
1116 | o changeset: 2:f58c7e2b28fa
1109 | | user: test
1117 | | user: test
1110 | | date: Thu Jan 01 00:00:00 1970 +0000
1118 | | date: Thu Jan 01 00:00:00 1970 +0000
1111 | | summary: C0
1119 | | summary: C0
1112 | |
1120 | |
1113 | o changeset: 1:3d7bba921b5d
1121 | o changeset: 1:3d7bba921b5d
1114 |/ user: test
1122 |/ user: test
1115 | date: Thu Jan 01 00:00:00 1970 +0000
1123 | date: Thu Jan 01 00:00:00 1970 +0000
1116 | summary: B0
1124 | summary: B0
1117 |
1125 |
1118 o changeset: 0:11f7a1b56675
1126 o changeset: 0:11f7a1b56675
1119 user: test
1127 user: test
1120 date: Thu Jan 01 00:00:00 1970 +0000
1128 date: Thu Jan 01 00:00:00 1970 +0000
1121 summary: A0
1129 summary: A0
1122
1130
1123
1131
1124 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
1132 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x),
1125 and A.3 with a local content change to be preserved (f2x).
1133 and A.3 with a local content change to be preserved (f2x).
1126
1134
1127 $ hg up -q "desc("E0")"
1135 $ hg up -q "desc("E0")"
1128 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
1136 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit
1129 grafting 2:f58c7e2b28fa "C0"
1137 grafting 2:f58c7e2b28fa "C0"
1130 merging f1e and f1b to f1e
1138 merging f1e and f1b to f1e
1131 merging f2a and f2c to f2c
1139 merging f2a and f2c to f2c
1132 merging f5b and f5a to f5a
1133
1140
1134 Test the cases A.1 (f4x) and A.7 (f3x).
1141 Test the cases A.1 (f4x) and A.7 (f3x).
1135
1142
1136 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
1143 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit
1137 grafting 3:b69f5839d2d9 "D0"
1144 grafting 3:b69f5839d2d9 "D0"
1138 note: possible conflict - f3b was renamed multiple times to:
1145 note: possible conflict - f3b was renamed multiple times to:
1139 f3d
1146 f3d
1140 f3e
1147 f3e
1141 merging f4e and f4a to f4e
1148 merging f4e and f4a to f4e
1142 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1149 warning: can't find ancestor for 'f3d' copied from 'f3b'!
1143
1150
1144 $ hg cat f2c
1151 $ hg cat f2c
1145 c2e
1152 c2e
1146
1153
1147 Test the case A.5 (move case, f1x).
1154 Test the case A.5 (move case, f1x).
1148
1155
1149 $ hg up -q "desc("C0")"
1156 $ hg up -q "desc("C0")"
1150 BROKEN: Shouldn't get the warning about missing ancestor
1157 BROKEN: Shouldn't get the warning about missing ancestor
1151 $ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit
1158 $ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit
1152 grafting 6:6bd1736cab86 "E0"
1159 grafting 6:6bd1736cab86 "E0"
1153 note: possible conflict - f1a was renamed multiple times to:
1160 note: possible conflict - f1a was renamed multiple times to:
1154 f1b
1161 f1b
1155 f1e
1162 f1e
1156 note: possible conflict - f3a was renamed multiple times to:
1163 note: possible conflict - f3a was renamed multiple times to:
1157 f3b
1164 f3b
1158 f3e
1165 f3e
1159 merging f2c and f2a to f2c
1166 merging f2c and f2a to f2c
1160 merging f5a and f5b to f5b
1167 merging f5a and f5b to f5b
1161 warning: can't find ancestor for 'f1e' copied from 'f1a'!
1168 warning: can't find ancestor for 'f1e' copied from 'f1a'!
1162 warning: can't find ancestor for 'f3e' copied from 'f3a'!
1169 warning: can't find ancestor for 'f3e' copied from 'f3a'!
1163 $ cat f1e
1170 $ cat f1e
1164 c1a
1171 c1a
1165
1172
1166 Test the case A.5 (copy case, f1x).
1173 Test the case A.5 (copy case, f1x).
1167
1174
1168 $ hg up -q "desc("C0")"
1175 $ hg up -q "desc("C0")"
1169 BROKEN: Shouldn't get the warning about missing ancestor
1176 BROKEN: Shouldn't get the warning about missing ancestor
1170 $ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit
1177 $ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit
1171 grafting 7:d376ab0d7fda "F0"
1178 grafting 7:d376ab0d7fda "F0"
1172 warning: can't find ancestor for 'f1f' copied from 'f1a'!
1179 warning: can't find ancestor for 'f1f' copied from 'f1a'!
1173 BROKEN: f1f should be marked a copy from f1b
1180 BROKEN: f1f should be marked a copy from f1b
1174 $ hg st --copies --change .
1181 $ hg st --copies --change .
1175 A f1f
1182 A f1f
1176 BROKEN: f1f should have the new content from f1b (i.e. "c1c")
1183 BROKEN: f1f should have the new content from f1b (i.e. "c1c")
1177 $ cat f1f
1184 $ cat f1f
1178 c1a
1185 c1a
1179
1186
1180 Test the case A.5 (copy+modify case, f1x).
1187 Test the case A.5 (copy+modify case, f1x).
1181
1188
1182 $ hg up -q "desc("C0")"
1189 $ hg up -q "desc("C0")"
1183 BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0
1190 BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0
1184 (content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content
1191 (content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content
1185 "c1a")
1192 "c1a")
1186 $ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit
1193 $ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit
1187 grafting 8:ba67f08fb15a "G0"
1194 grafting 8:ba67f08fb15a "G0"
1188 warning: can't find ancestor for 'f1g' copied from 'f1a'!
1195 warning: can't find ancestor for 'f1g' copied from 'f1a'!
1189
1196
1190 Check the results of the grafts tested
1197 Check the results of the grafts tested
1191
1198
1192 $ hg log -CGv --patch --git
1199 $ hg log -CGv --patch --git
1193 @ changeset: 13:ef3adf6c20a4
1200 @ changeset: 13:ef3adf6c20a4
1194 | tag: tip
1201 | tag: tip
1195 | parent: 2:f58c7e2b28fa
1202 | parent: 2:f58c7e2b28fa
1196 | user: test
1203 | user: test
1197 | date: Thu Jan 01 00:00:00 1970 +0000
1204 | date: Thu Jan 01 00:00:00 1970 +0000
1198 | files: f1g
1205 | files: f1g
1199 | description:
1206 | description:
1200 | G1
1207 | G1
1201 |
1208 |
1202 |
1209 |
1203 | diff --git a/f1g b/f1g
1210 | diff --git a/f1g b/f1g
1204 | new file mode 100644
1211 | new file mode 100644
1205 | --- /dev/null
1212 | --- /dev/null
1206 | +++ b/f1g
1213 | +++ b/f1g
1207 | @@ -0,0 +1,1 @@
1214 | @@ -0,0 +1,1 @@
1208 | +c1g
1215 | +c1g
1209 |
1216 |
1210 | o changeset: 12:b5542d755b54
1217 | o changeset: 12:b5542d755b54
1211 |/ parent: 2:f58c7e2b28fa
1218 |/ parent: 2:f58c7e2b28fa
1212 | user: test
1219 | user: test
1213 | date: Thu Jan 01 00:00:00 1970 +0000
1220 | date: Thu Jan 01 00:00:00 1970 +0000
1214 | files: f1f
1221 | files: f1f
1215 | description:
1222 | description:
1216 | F1
1223 | F1
1217 |
1224 |
1218 |
1225 |
1219 | diff --git a/f1f b/f1f
1226 | diff --git a/f1f b/f1f
1220 | new file mode 100644
1227 | new file mode 100644
1221 | --- /dev/null
1228 | --- /dev/null
1222 | +++ b/f1f
1229 | +++ b/f1f
1223 | @@ -0,0 +1,1 @@
1230 | @@ -0,0 +1,1 @@
1224 | +c1a
1231 | +c1a
1225 |
1232 |
1226 | o changeset: 11:f8a162271246
1233 | o changeset: 11:f8a162271246
1227 |/ parent: 2:f58c7e2b28fa
1234 |/ parent: 2:f58c7e2b28fa
1228 | user: test
1235 | user: test
1229 | date: Thu Jan 01 00:00:00 1970 +0000
1236 | date: Thu Jan 01 00:00:00 1970 +0000
1230 | files: f1e f2c f3e f4a f4e f5a f5b
1237 | files: f1e f2c f3e f4a f4e f5a f5b
1231 | copies: f4e (f4a) f5b (f5a)
1238 | copies: f4e (f4a) f5b (f5a)
1232 | description:
1239 | description:
1233 | E1
1240 | E1
1234 |
1241 |
1235 |
1242 |
1236 | diff --git a/f1e b/f1e
1243 | diff --git a/f1e b/f1e
1237 | new file mode 100644
1244 | new file mode 100644
1238 | --- /dev/null
1245 | --- /dev/null
1239 | +++ b/f1e
1246 | +++ b/f1e
1240 | @@ -0,0 +1,1 @@
1247 | @@ -0,0 +1,1 @@
1241 | +c1a
1248 | +c1a
1242 | diff --git a/f2c b/f2c
1249 | diff --git a/f2c b/f2c
1243 | --- a/f2c
1250 | --- a/f2c
1244 | +++ b/f2c
1251 | +++ b/f2c
1245 | @@ -1,1 +1,1 @@
1252 | @@ -1,1 +1,1 @@
1246 | -c2a
1253 | -c2a
1247 | +c2e
1254 | +c2e
1248 | diff --git a/f3e b/f3e
1255 | diff --git a/f3e b/f3e
1249 | new file mode 100644
1256 | new file mode 100644
1250 | --- /dev/null
1257 | --- /dev/null
1251 | +++ b/f3e
1258 | +++ b/f3e
1252 | @@ -0,0 +1,1 @@
1259 | @@ -0,0 +1,1 @@
1253 | +c3a
1260 | +c3a
1254 | diff --git a/f4a b/f4e
1261 | diff --git a/f4a b/f4e
1255 | rename from f4a
1262 | rename from f4a
1256 | rename to f4e
1263 | rename to f4e
1257 | diff --git a/f5a b/f5b
1264 | diff --git a/f5a b/f5b
1258 | rename from f5a
1265 | rename from f5a
1259 | rename to f5b
1266 | rename to f5b
1260 |
1267 |
1261 | o changeset: 10:93ee502e8b0a
1268 | o changeset: 10:93ee502e8b0a
1262 | | user: test
1269 | | user: test
1263 | | date: Thu Jan 01 00:00:00 1970 +0000
1270 | | date: Thu Jan 01 00:00:00 1970 +0000
1264 | | files: f3d f4e
1271 | | files: f3d f4e
1265 | | description:
1272 | | description:
1266 | | D2
1273 | | D2
1267 | |
1274 | |
1268 | |
1275 | |
1269 | | diff --git a/f3d b/f3d
1276 | | diff --git a/f3d b/f3d
1270 | | new file mode 100644
1277 | | new file mode 100644
1271 | | --- /dev/null
1278 | | --- /dev/null
1272 | | +++ b/f3d
1279 | | +++ b/f3d
1273 | | @@ -0,0 +1,1 @@
1280 | | @@ -0,0 +1,1 @@
1274 | | +c3a
1281 | | +c3a
1275 | | diff --git a/f4e b/f4e
1282 | | diff --git a/f4e b/f4e
1276 | | --- a/f4e
1283 | | --- a/f4e
1277 | | +++ b/f4e
1284 | | +++ b/f4e
1278 | | @@ -1,1 +1,1 @@
1285 | | @@ -1,1 +1,1 @@
1279 | | -c4a
1286 | | -c4a
1280 | | +c4d
1287 | | +c4d
1281 | |
1288 | |
1282 | o changeset: 9:539cf145f496
1289 | o changeset: 9:539cf145f496
1283 | | parent: 6:6bd1736cab86
1290 | | parent: 6:6bd1736cab86
1284 | | user: test
1291 | | user: test
1285 | | date: Thu Jan 01 00:00:00 1970 +0000
1292 | | date: Thu Jan 01 00:00:00 1970 +0000
1286 | | files: f1e f2a f2c f5a f5b
1293 | | files: f1e f2a f2c f5a f5b
1287 | | copies: f2c (f2a) f5a (f5b)
1294 | | copies: f2c (f2a) f5a (f5b)
1288 | | description:
1295 | | description:
1289 | | C2
1296 | | C2
1290 | |
1297 | |
1291 | |
1298 | |
1292 | | diff --git a/f1e b/f1e
1299 | | diff --git a/f1e b/f1e
1293 | | --- a/f1e
1300 | | --- a/f1e
1294 | | +++ b/f1e
1301 | | +++ b/f1e
1295 | | @@ -1,1 +1,1 @@
1302 | | @@ -1,1 +1,1 @@
1296 | | -c1a
1303 | | -c1a
1297 | | +c1c
1304 | | +c1c
1298 | | diff --git a/f2a b/f2c
1305 | | diff --git a/f2a b/f2c
1299 | | rename from f2a
1306 | | rename from f2a
1300 | | rename to f2c
1307 | | rename to f2c
1301 | | diff --git a/f5b b/f5a
1308 | | diff --git a/f5b b/f5a
1302 | | rename from f5b
1309 | | rename from f5b
1303 | | rename to f5a
1310 | | rename to f5a
1304 | | --- a/f5b
1311 | | --- a/f5b
1305 | | +++ b/f5a
1312 | | +++ b/f5a
1306 | | @@ -1,1 +1,1 @@
1313 | | @@ -1,1 +1,1 @@
1307 | | -c5a
1314 | | -c5a
1308 | | +c5c
1315 | | +c5c
1309 | |
1316 | |
1310 | | o changeset: 8:ba67f08fb15a
1317 | | o changeset: 8:ba67f08fb15a
1311 | | | parent: 0:11f7a1b56675
1318 | | | parent: 0:11f7a1b56675
1312 | | | user: test
1319 | | | user: test
1313 | | | date: Thu Jan 01 00:00:00 1970 +0000
1320 | | | date: Thu Jan 01 00:00:00 1970 +0000
1314 | | | files: f1g
1321 | | | files: f1g
1315 | | | copies: f1g (f1a)
1322 | | | copies: f1g (f1a)
1316 | | | description:
1323 | | | description:
1317 | | | G0
1324 | | | G0
1318 | | |
1325 | | |
1319 | | |
1326 | | |
1320 | | | diff --git a/f1a b/f1g
1327 | | | diff --git a/f1a b/f1g
1321 | | | copy from f1a
1328 | | | copy from f1a
1322 | | | copy to f1g
1329 | | | copy to f1g
1323 | | | --- a/f1a
1330 | | | --- a/f1a
1324 | | | +++ b/f1g
1331 | | | +++ b/f1g
1325 | | | @@ -1,1 +1,1 @@
1332 | | | @@ -1,1 +1,1 @@
1326 | | | -c1a
1333 | | | -c1a
1327 | | | +c1g
1334 | | | +c1g
1328 | | |
1335 | | |
1329 | | | o changeset: 7:d376ab0d7fda
1336 | | | o changeset: 7:d376ab0d7fda
1330 | | |/ parent: 0:11f7a1b56675
1337 | | |/ parent: 0:11f7a1b56675
1331 | | | user: test
1338 | | | user: test
1332 | | | date: Thu Jan 01 00:00:00 1970 +0000
1339 | | | date: Thu Jan 01 00:00:00 1970 +0000
1333 | | | files: f1f
1340 | | | files: f1f
1334 | | | copies: f1f (f1a)
1341 | | | copies: f1f (f1a)
1335 | | | description:
1342 | | | description:
1336 | | | F0
1343 | | | F0
1337 | | |
1344 | | |
1338 | | |
1345 | | |
1339 | | | diff --git a/f1a b/f1f
1346 | | | diff --git a/f1a b/f1f
1340 | | | copy from f1a
1347 | | | copy from f1a
1341 | | | copy to f1f
1348 | | | copy to f1f
1342 | | |
1349 | | |
1343 | o | changeset: 6:6bd1736cab86
1350 | o | changeset: 6:6bd1736cab86
1344 | |/ parent: 0:11f7a1b56675
1351 | |/ parent: 0:11f7a1b56675
1345 | | user: test
1352 | | user: test
1346 | | date: Thu Jan 01 00:00:00 1970 +0000
1353 | | date: Thu Jan 01 00:00:00 1970 +0000
1347 | | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b
1354 | | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b
1348 | | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
1355 | | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a)
1349 | | description:
1356 | | description:
1350 | | E0
1357 | | E0
1351 | |
1358 | |
1352 | |
1359 | |
1353 | | diff --git a/f1a b/f1e
1360 | | diff --git a/f1a b/f1e
1354 | | rename from f1a
1361 | | rename from f1a
1355 | | rename to f1e
1362 | | rename to f1e
1356 | | diff --git a/f2a b/f2a
1363 | | diff --git a/f2a b/f2a
1357 | | --- a/f2a
1364 | | --- a/f2a
1358 | | +++ b/f2a
1365 | | +++ b/f2a
1359 | | @@ -1,1 +1,1 @@
1366 | | @@ -1,1 +1,1 @@
1360 | | -c2a
1367 | | -c2a
1361 | | +c2e
1368 | | +c2e
1362 | | diff --git a/f3a b/f3e
1369 | | diff --git a/f3a b/f3e
1363 | | rename from f3a
1370 | | rename from f3a
1364 | | rename to f3e
1371 | | rename to f3e
1365 | | diff --git a/f4a b/f4e
1372 | | diff --git a/f4a b/f4e
1366 | | rename from f4a
1373 | | rename from f4a
1367 | | rename to f4e
1374 | | rename to f4e
1368 | | diff --git a/f5a b/f5b
1375 | | diff --git a/f5a b/f5b
1369 | | rename from f5a
1376 | | rename from f5a
1370 | | rename to f5b
1377 | | rename to f5b
1371 | |
1378 | |
1372 | | o changeset: 5:560daee679da
1379 | | o changeset: 5:560daee679da
1373 | | | user: test
1380 | | | user: test
1374 | | | date: Thu Jan 01 00:00:00 1970 +0000
1381 | | | date: Thu Jan 01 00:00:00 1970 +0000
1375 | | | files: f3d f4a
1382 | | | files: f3d f4a
1376 | | | description:
1383 | | | description:
1377 | | | D1
1384 | | | D1
1378 | | |
1385 | | |
1379 | | |
1386 | | |
1380 | | | diff --git a/f3d b/f3d
1387 | | | diff --git a/f3d b/f3d
1381 | | | new file mode 100644
1388 | | | new file mode 100644
1382 | | | --- /dev/null
1389 | | | --- /dev/null
1383 | | | +++ b/f3d
1390 | | | +++ b/f3d
1384 | | | @@ -0,0 +1,1 @@
1391 | | | @@ -0,0 +1,1 @@
1385 | | | +c3a
1392 | | | +c3a
1386 | | | diff --git a/f4a b/f4a
1393 | | | diff --git a/f4a b/f4a
1387 | | | --- a/f4a
1394 | | | --- a/f4a
1388 | | | +++ b/f4a
1395 | | | +++ b/f4a
1389 | | | @@ -1,1 +1,1 @@
1396 | | | @@ -1,1 +1,1 @@
1390 | | | -c4a
1397 | | | -c4a
1391 | | | +c4d
1398 | | | +c4d
1392 | | |
1399 | | |
1393 | | o changeset: 4:c9763722f9bd
1400 | | o changeset: 4:c9763722f9bd
1394 | |/ parent: 0:11f7a1b56675
1401 | |/ parent: 0:11f7a1b56675
1395 | | user: test
1402 | | user: test
1396 | | date: Thu Jan 01 00:00:00 1970 +0000
1403 | | date: Thu Jan 01 00:00:00 1970 +0000
1397 | | files: f1a f2a f2c f5a
1404 | | files: f1a f2a f2c f5a
1398 | | copies: f2c (f2a)
1405 | | copies: f2c (f2a)
1399 | | description:
1406 | | description:
1400 | | C1
1407 | | C1
1401 | |
1408 | |
1402 | |
1409 | |
1403 | | diff --git a/f1a b/f1a
1410 | | diff --git a/f1a b/f1a
1404 | | --- a/f1a
1411 | | --- a/f1a
1405 | | +++ b/f1a
1412 | | +++ b/f1a
1406 | | @@ -1,1 +1,1 @@
1413 | | @@ -1,1 +1,1 @@
1407 | | -c1a
1414 | | -c1a
1408 | | +c1c
1415 | | +c1c
1409 | | diff --git a/f2a b/f2c
1416 | | diff --git a/f2a b/f2c
1410 | | rename from f2a
1417 | | rename from f2a
1411 | | rename to f2c
1418 | | rename to f2c
1412 | | diff --git a/f5a b/f5a
1419 | | diff --git a/f5a b/f5a
1413 | | --- a/f5a
1420 | | --- a/f5a
1414 | | +++ b/f5a
1421 | | +++ b/f5a
1415 | | @@ -1,1 +1,1 @@
1422 | | @@ -1,1 +1,1 @@
1416 | | -c5a
1423 | | -c5a
1417 | | +c5c
1424 | | +c5c
1418 | |
1425 | |
1419 +---o changeset: 3:b69f5839d2d9
1426 +---o changeset: 3:b69f5839d2d9
1420 | | user: test
1427 | | user: test
1421 | | date: Thu Jan 01 00:00:00 1970 +0000
1428 | | date: Thu Jan 01 00:00:00 1970 +0000
1422 | | files: f3b f3d f4a
1429 | | files: f3b f3d f4a
1423 | | copies: f3d (f3b)
1430 | | copies: f3d (f3b)
1424 | | description:
1431 | | description:
1425 | | D0
1432 | | D0
1426 | |
1433 | |
1427 | |
1434 | |
1428 | | diff --git a/f3b b/f3d
1435 | | diff --git a/f3b b/f3d
1429 | | rename from f3b
1436 | | rename from f3b
1430 | | rename to f3d
1437 | | rename to f3d
1431 | | diff --git a/f4a b/f4a
1438 | | diff --git a/f4a b/f4a
1432 | | --- a/f4a
1439 | | --- a/f4a
1433 | | +++ b/f4a
1440 | | +++ b/f4a
1434 | | @@ -1,1 +1,1 @@
1441 | | @@ -1,1 +1,1 @@
1435 | | -c4a
1442 | | -c4a
1436 | | +c4d
1443 | | +c4d
1437 | |
1444 | |
1438 o | changeset: 2:f58c7e2b28fa
1445 o | changeset: 2:f58c7e2b28fa
1439 | | user: test
1446 | | user: test
1440 | | date: Thu Jan 01 00:00:00 1970 +0000
1447 | | date: Thu Jan 01 00:00:00 1970 +0000
1441 | | files: f1b f2a f2c f5a f5b
1448 | | files: f1b f2a f2c f5a f5b
1442 | | copies: f2c (f2a) f5a (f5b)
1449 | | copies: f2c (f2a) f5a (f5b)
1443 | | description:
1450 | | description:
1444 | | C0
1451 | | C0
1445 | |
1452 | |
1446 | |
1453 | |
1447 | | diff --git a/f1b b/f1b
1454 | | diff --git a/f1b b/f1b
1448 | | --- a/f1b
1455 | | --- a/f1b
1449 | | +++ b/f1b
1456 | | +++ b/f1b
1450 | | @@ -1,1 +1,1 @@
1457 | | @@ -1,1 +1,1 @@
1451 | | -c1a
1458 | | -c1a
1452 | | +c1c
1459 | | +c1c
1453 | | diff --git a/f2a b/f2c
1460 | | diff --git a/f2a b/f2c
1454 | | rename from f2a
1461 | | rename from f2a
1455 | | rename to f2c
1462 | | rename to f2c
1456 | | diff --git a/f5b b/f5a
1463 | | diff --git a/f5b b/f5a
1457 | | rename from f5b
1464 | | rename from f5b
1458 | | rename to f5a
1465 | | rename to f5a
1459 | | --- a/f5b
1466 | | --- a/f5b
1460 | | +++ b/f5a
1467 | | +++ b/f5a
1461 | | @@ -1,1 +1,1 @@
1468 | | @@ -1,1 +1,1 @@
1462 | | -c5a
1469 | | -c5a
1463 | | +c5c
1470 | | +c5c
1464 | |
1471 | |
1465 o | changeset: 1:3d7bba921b5d
1472 o | changeset: 1:3d7bba921b5d
1466 |/ user: test
1473 |/ user: test
1467 | date: Thu Jan 01 00:00:00 1970 +0000
1474 | date: Thu Jan 01 00:00:00 1970 +0000
1468 | files: f1a f1b f3a f3b f5a f5b
1475 | files: f1a f1b f3a f3b f5a f5b
1469 | copies: f1b (f1a) f3b (f3a) f5b (f5a)
1476 | copies: f1b (f1a) f3b (f3a) f5b (f5a)
1470 | description:
1477 | description:
1471 | B0
1478 | B0
1472 |
1479 |
1473 |
1480 |
1474 | diff --git a/f1a b/f1b
1481 | diff --git a/f1a b/f1b
1475 | rename from f1a
1482 | rename from f1a
1476 | rename to f1b
1483 | rename to f1b
1477 | diff --git a/f3a b/f3b
1484 | diff --git a/f3a b/f3b
1478 | rename from f3a
1485 | rename from f3a
1479 | rename to f3b
1486 | rename to f3b
1480 | diff --git a/f5a b/f5b
1487 | diff --git a/f5a b/f5b
1481 | rename from f5a
1488 | rename from f5a
1482 | rename to f5b
1489 | rename to f5b
1483 |
1490 |
1484 o changeset: 0:11f7a1b56675
1491 o changeset: 0:11f7a1b56675
1485 user: test
1492 user: test
1486 date: Thu Jan 01 00:00:00 1970 +0000
1493 date: Thu Jan 01 00:00:00 1970 +0000
1487 files: f1a f2a f3a f4a f5a
1494 files: f1a f2a f3a f4a f5a
1488 description:
1495 description:
1489 A0
1496 A0
1490
1497
1491
1498
1492 diff --git a/f1a b/f1a
1499 diff --git a/f1a b/f1a
1493 new file mode 100644
1500 new file mode 100644
1494 --- /dev/null
1501 --- /dev/null
1495 +++ b/f1a
1502 +++ b/f1a
1496 @@ -0,0 +1,1 @@
1503 @@ -0,0 +1,1 @@
1497 +c1a
1504 +c1a
1498 diff --git a/f2a b/f2a
1505 diff --git a/f2a b/f2a
1499 new file mode 100644
1506 new file mode 100644
1500 --- /dev/null
1507 --- /dev/null
1501 +++ b/f2a
1508 +++ b/f2a
1502 @@ -0,0 +1,1 @@
1509 @@ -0,0 +1,1 @@
1503 +c2a
1510 +c2a
1504 diff --git a/f3a b/f3a
1511 diff --git a/f3a b/f3a
1505 new file mode 100644
1512 new file mode 100644
1506 --- /dev/null
1513 --- /dev/null
1507 +++ b/f3a
1514 +++ b/f3a
1508 @@ -0,0 +1,1 @@
1515 @@ -0,0 +1,1 @@
1509 +c3a
1516 +c3a
1510 diff --git a/f4a b/f4a
1517 diff --git a/f4a b/f4a
1511 new file mode 100644
1518 new file mode 100644
1512 --- /dev/null
1519 --- /dev/null
1513 +++ b/f4a
1520 +++ b/f4a
1514 @@ -0,0 +1,1 @@
1521 @@ -0,0 +1,1 @@
1515 +c4a
1522 +c4a
1516 diff --git a/f5a b/f5a
1523 diff --git a/f5a b/f5a
1517 new file mode 100644
1524 new file mode 100644
1518 --- /dev/null
1525 --- /dev/null
1519 +++ b/f5a
1526 +++ b/f5a
1520 @@ -0,0 +1,1 @@
1527 @@ -0,0 +1,1 @@
1521 +c5a
1528 +c5a
1522
1529
1523 Check superfluous filemerge of files renamed in the past but untouched by graft
1530 Check superfluous filemerge of files renamed in the past but untouched by graft
1524
1531
1525 $ echo a > a
1532 $ echo a > a
1526 $ hg ci -qAma
1533 $ hg ci -qAma
1527 $ hg mv a b
1534 $ hg mv a b
1528 $ echo b > b
1535 $ echo b > b
1529 $ hg ci -qAmb
1536 $ hg ci -qAmb
1530 $ echo c > c
1537 $ echo c > c
1531 $ hg ci -qAmc
1538 $ hg ci -qAmc
1532 $ hg up -q .~2
1539 $ hg up -q .~2
1533 $ hg graft tip -qt:fail
1540 $ hg graft tip -qt:fail
1534
1541
1535 $ cd ..
1542 $ cd ..
1536
1543
1537 Graft a change into a new file previously grafted into a renamed directory
1544 Graft a change into a new file previously grafted into a renamed directory
1538
1545
1539 $ hg init dirmovenewfile
1546 $ hg init dirmovenewfile
1540 $ cd dirmovenewfile
1547 $ cd dirmovenewfile
1541 $ mkdir a
1548 $ mkdir a
1542 $ echo a > a/a
1549 $ echo a > a/a
1543 $ hg ci -qAma
1550 $ hg ci -qAma
1544 $ echo x > a/x
1551 $ echo x > a/x
1545 $ hg ci -qAmx
1552 $ hg ci -qAmx
1546 $ hg up -q 0
1553 $ hg up -q 0
1547 $ hg mv -q a b
1554 $ hg mv -q a b
1548 $ hg ci -qAmb
1555 $ hg ci -qAmb
1549 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
1556 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded
1550 $ hg up -q 1
1557 $ hg up -q 1
1551 $ echo y > a/x
1558 $ echo y > a/x
1552 $ hg ci -qAmy
1559 $ hg ci -qAmy
1553 $ hg up -q 3
1560 $ hg up -q 3
1554 $ hg graft -q 4
1561 $ hg graft -q 4
1555 $ hg status --change .
1562 $ hg status --change .
1556 M b/x
1563 M b/x
1557
1564
1558 Prepare for test of skipped changesets and how merges can influence it:
1565 Prepare for test of skipped changesets and how merges can influence it:
1559
1566
1560 $ hg merge -q -r 1 --tool :local
1567 $ hg merge -q -r 1 --tool :local
1561 $ hg ci -m m
1568 $ hg ci -m m
1562 $ echo xx >> b/x
1569 $ echo xx >> b/x
1563 $ hg ci -m xx
1570 $ hg ci -m xx
1564
1571
1565 $ hg log -G -T '{rev} {desc|firstline}'
1572 $ hg log -G -T '{rev} {desc|firstline}'
1566 @ 7 xx
1573 @ 7 xx
1567 |
1574 |
1568 o 6 m
1575 o 6 m
1569 |\
1576 |\
1570 | o 5 y
1577 | o 5 y
1571 | |
1578 | |
1572 +---o 4 y
1579 +---o 4 y
1573 | |
1580 | |
1574 | o 3 x
1581 | o 3 x
1575 | |
1582 | |
1576 | o 2 b
1583 | o 2 b
1577 | |
1584 | |
1578 o | 1 x
1585 o | 1 x
1579 |/
1586 |/
1580 o 0 a
1587 o 0 a
1581
1588
1582 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
1589 Grafting of plain changes correctly detects that 3 and 5 should be skipped:
1583
1590
1584 $ hg up -qCr 4
1591 $ hg up -qCr 4
1585 $ hg graft --tool :local -r 2::5
1592 $ hg graft --tool :local -r 2::5
1586 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1593 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1587 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1594 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1588 grafting 2:42127f193bcd "b"
1595 grafting 2:42127f193bcd "b"
1589
1596
1590 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
1597 Extending the graft range to include a (skipped) merge of 3 will not prevent us from
1591 also detecting that both 3 and 5 should be skipped:
1598 also detecting that both 3 and 5 should be skipped:
1592
1599
1593 $ hg up -qCr 4
1600 $ hg up -qCr 4
1594 $ hg graft --tool :local -r 2::7
1601 $ hg graft --tool :local -r 2::7
1595 skipping ungraftable merge revision 6
1602 skipping ungraftable merge revision 6
1596 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1603 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a)
1597 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1604 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1)
1598 grafting 2:42127f193bcd "b"
1605 grafting 2:42127f193bcd "b"
1599 grafting 7:d3c3f2b38ecc "xx"
1606 grafting 7:d3c3f2b38ecc "xx"
1600 note: graft of 7:d3c3f2b38ecc created no changes to commit
1607 note: graft of 7:d3c3f2b38ecc created no changes to commit
1601
1608
1602 $ cd ..
1609 $ cd ..
1603
1610
1604 Grafted revision should be warned and skipped only once. (issue6024)
1611 Grafted revision should be warned and skipped only once. (issue6024)
1605
1612
1606 $ mkdir issue6024
1613 $ mkdir issue6024
1607 $ cd issue6024
1614 $ cd issue6024
1608
1615
1609 $ hg init base
1616 $ hg init base
1610 $ cd base
1617 $ cd base
1611 $ touch x
1618 $ touch x
1612 $ hg commit -qAminit
1619 $ hg commit -qAminit
1613 $ echo a > x
1620 $ echo a > x
1614 $ hg commit -mchange
1621 $ hg commit -mchange
1615 $ hg update -q 0
1622 $ hg update -q 0
1616 $ hg graft -r 1
1623 $ hg graft -r 1
1617 grafting 1:a0b923c546aa "change" (tip)
1624 grafting 1:a0b923c546aa "change" (tip)
1618 $ cd ..
1625 $ cd ..
1619
1626
1620 $ hg clone -qr 2 base clone
1627 $ hg clone -qr 2 base clone
1621 $ cd clone
1628 $ cd clone
1622 $ hg pull -q
1629 $ hg pull -q
1623 $ hg merge -q 2
1630 $ hg merge -q 2
1624 $ hg commit -mmerge
1631 $ hg commit -mmerge
1625 $ hg update -q 0
1632 $ hg update -q 0
1626 $ hg graft -r 1
1633 $ hg graft -r 1
1627 grafting 1:04fc6d444368 "change"
1634 grafting 1:04fc6d444368 "change"
1628 $ hg update -q 3
1635 $ hg update -q 3
1629 $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n'
1636 $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n'
1630 o 4:4e16 <- a0b9
1637 o 4:4e16 <- a0b9
1631 |
1638 |
1632 | @ 3:f0ac <-
1639 | @ 3:f0ac <-
1633 | |\
1640 | |\
1634 +---o 2:a0b9 <-
1641 +---o 2:a0b9 <-
1635 | |
1642 | |
1636 | o 1:04fc <- a0b9
1643 | o 1:04fc <- a0b9
1637 |/
1644 |/
1638 o 0:7848 <-
1645 o 0:7848 <-
1639
1646
1640
1647
1641 the source of rev 4 is an ancestor of the working parent, and was also
1648 the source of rev 4 is an ancestor of the working parent, and was also
1642 grafted as rev 1. it should be stripped from the target revisions only once.
1649 grafted as rev 1. it should be stripped from the target revisions only once.
1643
1650
1644 $ hg graft -r 4
1651 $ hg graft -r 4
1645 skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa)
1652 skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa)
1646 [255]
1653 [255]
1647
1654
1648 $ cd ../..
1655 $ cd ../..
1649
1656
1650 Testing the reading of old format graftstate file with newer mercurial
1657 Testing the reading of old format graftstate file with newer mercurial
1651
1658
1652 $ hg init oldgraft
1659 $ hg init oldgraft
1653 $ cd oldgraft
1660 $ cd oldgraft
1654 $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1661 $ for ch in a b c; do echo foo > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1655 $ hg log -GT "{rev}:{node|short} {desc}\n"
1662 $ hg log -GT "{rev}:{node|short} {desc}\n"
1656 @ 2:8be98ac1a569 added c
1663 @ 2:8be98ac1a569 added c
1657 |
1664 |
1658 o 1:80e6d2c47cfe added b
1665 o 1:80e6d2c47cfe added b
1659 |
1666 |
1660 o 0:f7ad41964313 added a
1667 o 0:f7ad41964313 added a
1661
1668
1662 $ hg up 0
1669 $ hg up 0
1663 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1670 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1664 $ echo bar > b
1671 $ echo bar > b
1665 $ hg add b
1672 $ hg add b
1666 $ hg ci -m "bar to b"
1673 $ hg ci -m "bar to b"
1667 created new head
1674 created new head
1668 $ hg graft -r 1 -r 2
1675 $ hg graft -r 1 -r 2
1669 grafting 1:80e6d2c47cfe "added b"
1676 grafting 1:80e6d2c47cfe "added b"
1670 merging b
1677 merging b
1671 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1678 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1672 abort: unresolved conflicts, can't continue
1679 abort: unresolved conflicts, can't continue
1673 (use 'hg resolve' and 'hg graft --continue')
1680 (use 'hg resolve' and 'hg graft --continue')
1674 [255]
1681 [255]
1675
1682
1676 Writing the nodes in old format to graftstate
1683 Writing the nodes in old format to graftstate
1677
1684
1678 $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate
1685 $ hg log -r 1 -r 2 -T '{node}\n' > .hg/graftstate
1679 $ echo foo > b
1686 $ echo foo > b
1680 $ hg resolve -m
1687 $ hg resolve -m
1681 (no more unresolved files)
1688 (no more unresolved files)
1682 continue: hg graft --continue
1689 continue: hg graft --continue
1683 $ hg graft --continue
1690 $ hg graft --continue
1684 grafting 1:80e6d2c47cfe "added b"
1691 grafting 1:80e6d2c47cfe "added b"
1685 grafting 2:8be98ac1a569 "added c"
1692 grafting 2:8be98ac1a569 "added c"
1686
1693
1687 Testing that --user is preserved during conflicts and value is reused while
1694 Testing that --user is preserved during conflicts and value is reused while
1688 running `hg graft --continue`
1695 running `hg graft --continue`
1689
1696
1690 $ hg log -G
1697 $ hg log -G
1691 @ changeset: 5:711e9fa999f1
1698 @ changeset: 5:711e9fa999f1
1692 | tag: tip
1699 | tag: tip
1693 | user: test
1700 | user: test
1694 | date: Thu Jan 01 00:00:00 1970 +0000
1701 | date: Thu Jan 01 00:00:00 1970 +0000
1695 | summary: added c
1702 | summary: added c
1696 |
1703 |
1697 o changeset: 4:e5ad7353b408
1704 o changeset: 4:e5ad7353b408
1698 | user: test
1705 | user: test
1699 | date: Thu Jan 01 00:00:00 1970 +0000
1706 | date: Thu Jan 01 00:00:00 1970 +0000
1700 | summary: added b
1707 | summary: added b
1701 |
1708 |
1702 o changeset: 3:9e887f7a939c
1709 o changeset: 3:9e887f7a939c
1703 | parent: 0:f7ad41964313
1710 | parent: 0:f7ad41964313
1704 | user: test
1711 | user: test
1705 | date: Thu Jan 01 00:00:00 1970 +0000
1712 | date: Thu Jan 01 00:00:00 1970 +0000
1706 | summary: bar to b
1713 | summary: bar to b
1707 |
1714 |
1708 | o changeset: 2:8be98ac1a569
1715 | o changeset: 2:8be98ac1a569
1709 | | user: test
1716 | | user: test
1710 | | date: Thu Jan 01 00:00:00 1970 +0000
1717 | | date: Thu Jan 01 00:00:00 1970 +0000
1711 | | summary: added c
1718 | | summary: added c
1712 | |
1719 | |
1713 | o changeset: 1:80e6d2c47cfe
1720 | o changeset: 1:80e6d2c47cfe
1714 |/ user: test
1721 |/ user: test
1715 | date: Thu Jan 01 00:00:00 1970 +0000
1722 | date: Thu Jan 01 00:00:00 1970 +0000
1716 | summary: added b
1723 | summary: added b
1717 |
1724 |
1718 o changeset: 0:f7ad41964313
1725 o changeset: 0:f7ad41964313
1719 user: test
1726 user: test
1720 date: Thu Jan 01 00:00:00 1970 +0000
1727 date: Thu Jan 01 00:00:00 1970 +0000
1721 summary: added a
1728 summary: added a
1722
1729
1723
1730
1724 $ hg up '.^^'
1731 $ hg up '.^^'
1725 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1732 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1726
1733
1727 $ hg graft -r 1 -r 2 --user batman
1734 $ hg graft -r 1 -r 2 --user batman
1728 grafting 1:80e6d2c47cfe "added b"
1735 grafting 1:80e6d2c47cfe "added b"
1729 merging b
1736 merging b
1730 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1737 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1731 abort: unresolved conflicts, can't continue
1738 abort: unresolved conflicts, can't continue
1732 (use 'hg resolve' and 'hg graft --continue')
1739 (use 'hg resolve' and 'hg graft --continue')
1733 [255]
1740 [255]
1734
1741
1735 $ echo wat > b
1742 $ echo wat > b
1736 $ hg resolve -m
1743 $ hg resolve -m
1737 (no more unresolved files)
1744 (no more unresolved files)
1738 continue: hg graft --continue
1745 continue: hg graft --continue
1739
1746
1740 $ hg graft --continue
1747 $ hg graft --continue
1741 grafting 1:80e6d2c47cfe "added b"
1748 grafting 1:80e6d2c47cfe "added b"
1742 grafting 2:8be98ac1a569 "added c"
1749 grafting 2:8be98ac1a569 "added c"
1743
1750
1744 $ hg log -Gr 3::
1751 $ hg log -Gr 3::
1745 @ changeset: 7:11a36ffaacf2
1752 @ changeset: 7:11a36ffaacf2
1746 | tag: tip
1753 | tag: tip
1747 | user: batman
1754 | user: batman
1748 | date: Thu Jan 01 00:00:00 1970 +0000
1755 | date: Thu Jan 01 00:00:00 1970 +0000
1749 | summary: added c
1756 | summary: added c
1750 |
1757 |
1751 o changeset: 6:76803afc6511
1758 o changeset: 6:76803afc6511
1752 | parent: 3:9e887f7a939c
1759 | parent: 3:9e887f7a939c
1753 | user: batman
1760 | user: batman
1754 | date: Thu Jan 01 00:00:00 1970 +0000
1761 | date: Thu Jan 01 00:00:00 1970 +0000
1755 | summary: added b
1762 | summary: added b
1756 |
1763 |
1757 | o changeset: 5:711e9fa999f1
1764 | o changeset: 5:711e9fa999f1
1758 | | user: test
1765 | | user: test
1759 | | date: Thu Jan 01 00:00:00 1970 +0000
1766 | | date: Thu Jan 01 00:00:00 1970 +0000
1760 | | summary: added c
1767 | | summary: added c
1761 | |
1768 | |
1762 | o changeset: 4:e5ad7353b408
1769 | o changeset: 4:e5ad7353b408
1763 |/ user: test
1770 |/ user: test
1764 | date: Thu Jan 01 00:00:00 1970 +0000
1771 | date: Thu Jan 01 00:00:00 1970 +0000
1765 | summary: added b
1772 | summary: added b
1766 |
1773 |
1767 o changeset: 3:9e887f7a939c
1774 o changeset: 3:9e887f7a939c
1768 | parent: 0:f7ad41964313
1775 | parent: 0:f7ad41964313
1769 ~ user: test
1776 ~ user: test
1770 date: Thu Jan 01 00:00:00 1970 +0000
1777 date: Thu Jan 01 00:00:00 1970 +0000
1771 summary: bar to b
1778 summary: bar to b
1772
1779
1773 Test that --date is preserved and reused in `hg graft --continue`
1780 Test that --date is preserved and reused in `hg graft --continue`
1774
1781
1775 $ hg up '.^^'
1782 $ hg up '.^^'
1776 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1783 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1777 $ hg graft -r 1 -r 2 --date '1234560000 120'
1784 $ hg graft -r 1 -r 2 --date '1234560000 120'
1778 grafting 1:80e6d2c47cfe "added b"
1785 grafting 1:80e6d2c47cfe "added b"
1779 merging b
1786 merging b
1780 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1787 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1781 abort: unresolved conflicts, can't continue
1788 abort: unresolved conflicts, can't continue
1782 (use 'hg resolve' and 'hg graft --continue')
1789 (use 'hg resolve' and 'hg graft --continue')
1783 [255]
1790 [255]
1784
1791
1785 $ echo foobar > b
1792 $ echo foobar > b
1786 $ hg resolve -m
1793 $ hg resolve -m
1787 (no more unresolved files)
1794 (no more unresolved files)
1788 continue: hg graft --continue
1795 continue: hg graft --continue
1789 $ hg graft --continue
1796 $ hg graft --continue
1790 grafting 1:80e6d2c47cfe "added b"
1797 grafting 1:80e6d2c47cfe "added b"
1791 grafting 2:8be98ac1a569 "added c"
1798 grafting 2:8be98ac1a569 "added c"
1792
1799
1793 $ hg log -Gr '.^^::.'
1800 $ hg log -Gr '.^^::.'
1794 @ changeset: 9:1896b76e007a
1801 @ changeset: 9:1896b76e007a
1795 | tag: tip
1802 | tag: tip
1796 | user: test
1803 | user: test
1797 | date: Fri Feb 13 21:18:00 2009 -0002
1804 | date: Fri Feb 13 21:18:00 2009 -0002
1798 | summary: added c
1805 | summary: added c
1799 |
1806 |
1800 o changeset: 8:ce2b4f1632af
1807 o changeset: 8:ce2b4f1632af
1801 | parent: 3:9e887f7a939c
1808 | parent: 3:9e887f7a939c
1802 | user: test
1809 | user: test
1803 | date: Fri Feb 13 21:18:00 2009 -0002
1810 | date: Fri Feb 13 21:18:00 2009 -0002
1804 | summary: added b
1811 | summary: added b
1805 |
1812 |
1806 o changeset: 3:9e887f7a939c
1813 o changeset: 3:9e887f7a939c
1807 | parent: 0:f7ad41964313
1814 | parent: 0:f7ad41964313
1808 ~ user: test
1815 ~ user: test
1809 date: Thu Jan 01 00:00:00 1970 +0000
1816 date: Thu Jan 01 00:00:00 1970 +0000
1810 summary: bar to b
1817 summary: bar to b
1811
1818
1812 Test that --log is preserved and reused in `hg graft --continue`
1819 Test that --log is preserved and reused in `hg graft --continue`
1813
1820
1814 $ hg up '.^^'
1821 $ hg up '.^^'
1815 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1822 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1816 $ hg graft -r 1 -r 2 --log
1823 $ hg graft -r 1 -r 2 --log
1817 grafting 1:80e6d2c47cfe "added b"
1824 grafting 1:80e6d2c47cfe "added b"
1818 merging b
1825 merging b
1819 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1826 warning: conflicts while merging b! (edit, then use 'hg resolve --mark')
1820 abort: unresolved conflicts, can't continue
1827 abort: unresolved conflicts, can't continue
1821 (use 'hg resolve' and 'hg graft --continue')
1828 (use 'hg resolve' and 'hg graft --continue')
1822 [255]
1829 [255]
1823
1830
1824 $ echo foobar > b
1831 $ echo foobar > b
1825 $ hg resolve -m
1832 $ hg resolve -m
1826 (no more unresolved files)
1833 (no more unresolved files)
1827 continue: hg graft --continue
1834 continue: hg graft --continue
1828
1835
1829 $ hg graft --continue
1836 $ hg graft --continue
1830 grafting 1:80e6d2c47cfe "added b"
1837 grafting 1:80e6d2c47cfe "added b"
1831 grafting 2:8be98ac1a569 "added c"
1838 grafting 2:8be98ac1a569 "added c"
1832
1839
1833 $ hg log -GT "{rev}:{node|short} {desc}" -r '.^^::.'
1840 $ hg log -GT "{rev}:{node|short} {desc}" -r '.^^::.'
1834 @ 11:30c1050a58b2 added c
1841 @ 11:30c1050a58b2 added c
1835 | (grafted from 8be98ac1a56990c2d9ca6861041b8390af7bd6f3)
1842 | (grafted from 8be98ac1a56990c2d9ca6861041b8390af7bd6f3)
1836 o 10:ec7eda2313e2 added b
1843 o 10:ec7eda2313e2 added b
1837 | (grafted from 80e6d2c47cfe5b3185519568327a17a061c7efb6)
1844 | (grafted from 80e6d2c47cfe5b3185519568327a17a061c7efb6)
1838 o 3:9e887f7a939c bar to b
1845 o 3:9e887f7a939c bar to b
1839 |
1846 |
1840 ~
1847 ~
1841
1848
1842 $ cd ..
1849 $ cd ..
1843
1850
1844 Testing the --stop flag of `hg graft` which stops the interrupted graft
1851 Testing the --stop flag of `hg graft` which stops the interrupted graft
1845
1852
1846 $ hg init stopgraft
1853 $ hg init stopgraft
1847 $ cd stopgraft
1854 $ cd stopgraft
1848 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1855 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1849
1856
1850 $ hg log -G
1857 $ hg log -G
1851 @ changeset: 3:9150fe93bec6
1858 @ changeset: 3:9150fe93bec6
1852 | tag: tip
1859 | tag: tip
1853 | user: test
1860 | user: test
1854 | date: Thu Jan 01 00:00:00 1970 +0000
1861 | date: Thu Jan 01 00:00:00 1970 +0000
1855 | summary: added d
1862 | summary: added d
1856 |
1863 |
1857 o changeset: 2:155349b645be
1864 o changeset: 2:155349b645be
1858 | user: test
1865 | user: test
1859 | date: Thu Jan 01 00:00:00 1970 +0000
1866 | date: Thu Jan 01 00:00:00 1970 +0000
1860 | summary: added c
1867 | summary: added c
1861 |
1868 |
1862 o changeset: 1:5f6d8a4bf34a
1869 o changeset: 1:5f6d8a4bf34a
1863 | user: test
1870 | user: test
1864 | date: Thu Jan 01 00:00:00 1970 +0000
1871 | date: Thu Jan 01 00:00:00 1970 +0000
1865 | summary: added b
1872 | summary: added b
1866 |
1873 |
1867 o changeset: 0:9092f1db7931
1874 o changeset: 0:9092f1db7931
1868 user: test
1875 user: test
1869 date: Thu Jan 01 00:00:00 1970 +0000
1876 date: Thu Jan 01 00:00:00 1970 +0000
1870 summary: added a
1877 summary: added a
1871
1878
1872 $ hg up '.^^'
1879 $ hg up '.^^'
1873 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1880 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1874
1881
1875 $ echo foo > d
1882 $ echo foo > d
1876 $ hg ci -Aqm "added foo to d"
1883 $ hg ci -Aqm "added foo to d"
1877
1884
1878 $ hg graft --stop
1885 $ hg graft --stop
1879 abort: no interrupted graft found
1886 abort: no interrupted graft found
1880 [255]
1887 [255]
1881
1888
1882 $ hg graft -r 3
1889 $ hg graft -r 3
1883 grafting 3:9150fe93bec6 "added d"
1890 grafting 3:9150fe93bec6 "added d"
1884 merging d
1891 merging d
1885 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1892 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1886 abort: unresolved conflicts, can't continue
1893 abort: unresolved conflicts, can't continue
1887 (use 'hg resolve' and 'hg graft --continue')
1894 (use 'hg resolve' and 'hg graft --continue')
1888 [255]
1895 [255]
1889
1896
1890 $ hg graft --stop --continue
1897 $ hg graft --stop --continue
1891 abort: cannot use '--continue' and '--stop' together
1898 abort: cannot use '--continue' and '--stop' together
1892 [255]
1899 [255]
1893
1900
1894 $ hg graft --stop -U
1901 $ hg graft --stop -U
1895 abort: cannot specify any other flag with '--stop'
1902 abort: cannot specify any other flag with '--stop'
1896 [255]
1903 [255]
1897 $ hg graft --stop --rev 4
1904 $ hg graft --stop --rev 4
1898 abort: cannot specify any other flag with '--stop'
1905 abort: cannot specify any other flag with '--stop'
1899 [255]
1906 [255]
1900 $ hg graft --stop --log
1907 $ hg graft --stop --log
1901 abort: cannot specify any other flag with '--stop'
1908 abort: cannot specify any other flag with '--stop'
1902 [255]
1909 [255]
1903
1910
1904 $ hg graft --stop
1911 $ hg graft --stop
1905 stopped the interrupted graft
1912 stopped the interrupted graft
1906 working directory is now at a0deacecd59d
1913 working directory is now at a0deacecd59d
1907
1914
1908 $ hg diff
1915 $ hg diff
1909
1916
1910 $ hg log -Gr '.'
1917 $ hg log -Gr '.'
1911 @ changeset: 4:a0deacecd59d
1918 @ changeset: 4:a0deacecd59d
1912 | tag: tip
1919 | tag: tip
1913 ~ parent: 1:5f6d8a4bf34a
1920 ~ parent: 1:5f6d8a4bf34a
1914 user: test
1921 user: test
1915 date: Thu Jan 01 00:00:00 1970 +0000
1922 date: Thu Jan 01 00:00:00 1970 +0000
1916 summary: added foo to d
1923 summary: added foo to d
1917
1924
1918 $ hg graft -r 2 -r 3
1925 $ hg graft -r 2 -r 3
1919 grafting 2:155349b645be "added c"
1926 grafting 2:155349b645be "added c"
1920 grafting 3:9150fe93bec6 "added d"
1927 grafting 3:9150fe93bec6 "added d"
1921 merging d
1928 merging d
1922 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1929 warning: conflicts while merging d! (edit, then use 'hg resolve --mark')
1923 abort: unresolved conflicts, can't continue
1930 abort: unresolved conflicts, can't continue
1924 (use 'hg resolve' and 'hg graft --continue')
1931 (use 'hg resolve' and 'hg graft --continue')
1925 [255]
1932 [255]
1926
1933
1927 $ hg graft --stop
1934 $ hg graft --stop
1928 stopped the interrupted graft
1935 stopped the interrupted graft
1929 working directory is now at 75b447541a9e
1936 working directory is now at 75b447541a9e
1930
1937
1931 $ hg diff
1938 $ hg diff
1932
1939
1933 $ hg log -G -T "{rev}:{node|short} {desc}"
1940 $ hg log -G -T "{rev}:{node|short} {desc}"
1934 @ 5:75b447541a9e added c
1941 @ 5:75b447541a9e added c
1935 |
1942 |
1936 o 4:a0deacecd59d added foo to d
1943 o 4:a0deacecd59d added foo to d
1937 |
1944 |
1938 | o 3:9150fe93bec6 added d
1945 | o 3:9150fe93bec6 added d
1939 | |
1946 | |
1940 | o 2:155349b645be added c
1947 | o 2:155349b645be added c
1941 |/
1948 |/
1942 o 1:5f6d8a4bf34a added b
1949 o 1:5f6d8a4bf34a added b
1943 |
1950 |
1944 o 0:9092f1db7931 added a
1951 o 0:9092f1db7931 added a
1945
1952
1946 $ cd ..
1953 $ cd ..
1947
1954
1948 Testing the --abort flag for `hg graft` which aborts and rollback to state
1955 Testing the --abort flag for `hg graft` which aborts and rollback to state
1949 before the graft
1956 before the graft
1950
1957
1951 $ hg init abortgraft
1958 $ hg init abortgraft
1952 $ cd abortgraft
1959 $ cd abortgraft
1953 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1960 $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done;
1954
1961
1955 $ hg up '.^^'
1962 $ hg up '.^^'
1956 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1963 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1957
1964
1958 $ echo x > x
1965 $ echo x > x
1959 $ hg ci -Aqm "added x"
1966 $ hg ci -Aqm "added x"
1960 $ hg up '.^'
1967 $ hg up '.^'
1961 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1968 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1962 $ echo foo > c
1969 $ echo foo > c
1963 $ hg ci -Aqm "added foo to c"
1970 $ hg ci -Aqm "added foo to c"
1964
1971
1965 $ hg log -GT "{rev}:{node|short} {desc}"
1972 $ hg log -GT "{rev}:{node|short} {desc}"
1966 @ 5:36b793615f78 added foo to c
1973 @ 5:36b793615f78 added foo to c
1967 |
1974 |
1968 | o 4:863a25e1a9ea added x
1975 | o 4:863a25e1a9ea added x
1969 |/
1976 |/
1970 | o 3:9150fe93bec6 added d
1977 | o 3:9150fe93bec6 added d
1971 | |
1978 | |
1972 | o 2:155349b645be added c
1979 | o 2:155349b645be added c
1973 |/
1980 |/
1974 o 1:5f6d8a4bf34a added b
1981 o 1:5f6d8a4bf34a added b
1975 |
1982 |
1976 o 0:9092f1db7931 added a
1983 o 0:9092f1db7931 added a
1977
1984
1978 $ hg up 9150fe93bec6
1985 $ hg up 9150fe93bec6
1979 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1986 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1980
1987
1981 $ hg graft --abort
1988 $ hg graft --abort
1982 abort: no interrupted graft to abort
1989 abort: no interrupted graft to abort
1983 [255]
1990 [255]
1984
1991
1985 when stripping is required
1992 when stripping is required
1986 $ hg graft -r 4 -r 5
1993 $ hg graft -r 4 -r 5
1987 grafting 4:863a25e1a9ea "added x"
1994 grafting 4:863a25e1a9ea "added x"
1988 grafting 5:36b793615f78 "added foo to c" (tip)
1995 grafting 5:36b793615f78 "added foo to c" (tip)
1989 merging c
1996 merging c
1990 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
1997 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
1991 abort: unresolved conflicts, can't continue
1998 abort: unresolved conflicts, can't continue
1992 (use 'hg resolve' and 'hg graft --continue')
1999 (use 'hg resolve' and 'hg graft --continue')
1993 [255]
2000 [255]
1994
2001
1995 $ hg graft --continue --abort
2002 $ hg graft --continue --abort
1996 abort: cannot use '--continue' and '--abort' together
2003 abort: cannot use '--continue' and '--abort' together
1997 [255]
2004 [255]
1998
2005
1999 $ hg graft --abort --stop
2006 $ hg graft --abort --stop
2000 abort: cannot use '--abort' and '--stop' together
2007 abort: cannot use '--abort' and '--stop' together
2001 [255]
2008 [255]
2002
2009
2003 $ hg graft --abort --currentuser
2010 $ hg graft --abort --currentuser
2004 abort: cannot specify any other flag with '--abort'
2011 abort: cannot specify any other flag with '--abort'
2005 [255]
2012 [255]
2006
2013
2007 $ hg graft --abort --edit
2014 $ hg graft --abort --edit
2008 abort: cannot specify any other flag with '--abort'
2015 abort: cannot specify any other flag with '--abort'
2009 [255]
2016 [255]
2010
2017
2011 $ hg graft --abort
2018 $ hg graft --abort
2012 graft aborted
2019 graft aborted
2013 working directory is now at 9150fe93bec6
2020 working directory is now at 9150fe93bec6
2014 $ hg log -GT "{rev}:{node|short} {desc}"
2021 $ hg log -GT "{rev}:{node|short} {desc}"
2015 o 5:36b793615f78 added foo to c
2022 o 5:36b793615f78 added foo to c
2016 |
2023 |
2017 | o 4:863a25e1a9ea added x
2024 | o 4:863a25e1a9ea added x
2018 |/
2025 |/
2019 | @ 3:9150fe93bec6 added d
2026 | @ 3:9150fe93bec6 added d
2020 | |
2027 | |
2021 | o 2:155349b645be added c
2028 | o 2:155349b645be added c
2022 |/
2029 |/
2023 o 1:5f6d8a4bf34a added b
2030 o 1:5f6d8a4bf34a added b
2024 |
2031 |
2025 o 0:9092f1db7931 added a
2032 o 0:9092f1db7931 added a
2026
2033
2027 when stripping is not required
2034 when stripping is not required
2028 $ hg graft -r 5
2035 $ hg graft -r 5
2029 grafting 5:36b793615f78 "added foo to c" (tip)
2036 grafting 5:36b793615f78 "added foo to c" (tip)
2030 merging c
2037 merging c
2031 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2038 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2032 abort: unresolved conflicts, can't continue
2039 abort: unresolved conflicts, can't continue
2033 (use 'hg resolve' and 'hg graft --continue')
2040 (use 'hg resolve' and 'hg graft --continue')
2034 [255]
2041 [255]
2035
2042
2036 $ hg graft --abort
2043 $ hg graft --abort
2037 graft aborted
2044 graft aborted
2038 working directory is now at 9150fe93bec6
2045 working directory is now at 9150fe93bec6
2039 $ hg log -GT "{rev}:{node|short} {desc}"
2046 $ hg log -GT "{rev}:{node|short} {desc}"
2040 o 5:36b793615f78 added foo to c
2047 o 5:36b793615f78 added foo to c
2041 |
2048 |
2042 | o 4:863a25e1a9ea added x
2049 | o 4:863a25e1a9ea added x
2043 |/
2050 |/
2044 | @ 3:9150fe93bec6 added d
2051 | @ 3:9150fe93bec6 added d
2045 | |
2052 | |
2046 | o 2:155349b645be added c
2053 | o 2:155349b645be added c
2047 |/
2054 |/
2048 o 1:5f6d8a4bf34a added b
2055 o 1:5f6d8a4bf34a added b
2049 |
2056 |
2050 o 0:9092f1db7931 added a
2057 o 0:9092f1db7931 added a
2051
2058
2052 when some of the changesets became public
2059 when some of the changesets became public
2053
2060
2054 $ hg graft -r 4 -r 5
2061 $ hg graft -r 4 -r 5
2055 grafting 4:863a25e1a9ea "added x"
2062 grafting 4:863a25e1a9ea "added x"
2056 grafting 5:36b793615f78 "added foo to c" (tip)
2063 grafting 5:36b793615f78 "added foo to c" (tip)
2057 merging c
2064 merging c
2058 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2065 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2059 abort: unresolved conflicts, can't continue
2066 abort: unresolved conflicts, can't continue
2060 (use 'hg resolve' and 'hg graft --continue')
2067 (use 'hg resolve' and 'hg graft --continue')
2061 [255]
2068 [255]
2062
2069
2063 $ hg log -GT "{rev}:{node|short} {desc}"
2070 $ hg log -GT "{rev}:{node|short} {desc}"
2064 @ 6:6ec71c037d94 added x
2071 @ 6:6ec71c037d94 added x
2065 |
2072 |
2066 | o 5:36b793615f78 added foo to c
2073 | o 5:36b793615f78 added foo to c
2067 | |
2074 | |
2068 | | o 4:863a25e1a9ea added x
2075 | | o 4:863a25e1a9ea added x
2069 | |/
2076 | |/
2070 o | 3:9150fe93bec6 added d
2077 o | 3:9150fe93bec6 added d
2071 | |
2078 | |
2072 o | 2:155349b645be added c
2079 o | 2:155349b645be added c
2073 |/
2080 |/
2074 o 1:5f6d8a4bf34a added b
2081 o 1:5f6d8a4bf34a added b
2075 |
2082 |
2076 o 0:9092f1db7931 added a
2083 o 0:9092f1db7931 added a
2077
2084
2078 $ hg phase -r 6 --public
2085 $ hg phase -r 6 --public
2079
2086
2080 $ hg graft --abort
2087 $ hg graft --abort
2081 cannot clean up public changesets 6ec71c037d94
2088 cannot clean up public changesets 6ec71c037d94
2082 graft aborted
2089 graft aborted
2083 working directory is now at 6ec71c037d94
2090 working directory is now at 6ec71c037d94
2084
2091
2085 when we created new changesets on top of existing one
2092 when we created new changesets on top of existing one
2086
2093
2087 $ hg up '.^^'
2094 $ hg up '.^^'
2088 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
2095 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
2089 $ echo y > y
2096 $ echo y > y
2090 $ hg ci -Aqm "added y"
2097 $ hg ci -Aqm "added y"
2091 $ echo z > z
2098 $ echo z > z
2092 $ hg ci -Aqm "added z"
2099 $ hg ci -Aqm "added z"
2093
2100
2094 $ hg up 3
2101 $ hg up 3
2095 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
2102 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
2096 $ hg log -GT "{rev}:{node|short} {desc}"
2103 $ hg log -GT "{rev}:{node|short} {desc}"
2097 o 8:637f9e9bbfd4 added z
2104 o 8:637f9e9bbfd4 added z
2098 |
2105 |
2099 o 7:123221671fd4 added y
2106 o 7:123221671fd4 added y
2100 |
2107 |
2101 | o 6:6ec71c037d94 added x
2108 | o 6:6ec71c037d94 added x
2102 | |
2109 | |
2103 | | o 5:36b793615f78 added foo to c
2110 | | o 5:36b793615f78 added foo to c
2104 | | |
2111 | | |
2105 | | | o 4:863a25e1a9ea added x
2112 | | | o 4:863a25e1a9ea added x
2106 | | |/
2113 | | |/
2107 | @ | 3:9150fe93bec6 added d
2114 | @ | 3:9150fe93bec6 added d
2108 |/ /
2115 |/ /
2109 o / 2:155349b645be added c
2116 o / 2:155349b645be added c
2110 |/
2117 |/
2111 o 1:5f6d8a4bf34a added b
2118 o 1:5f6d8a4bf34a added b
2112 |
2119 |
2113 o 0:9092f1db7931 added a
2120 o 0:9092f1db7931 added a
2114
2121
2115 $ hg graft -r 8 -r 7 -r 5
2122 $ hg graft -r 8 -r 7 -r 5
2116 grafting 8:637f9e9bbfd4 "added z" (tip)
2123 grafting 8:637f9e9bbfd4 "added z" (tip)
2117 grafting 7:123221671fd4 "added y"
2124 grafting 7:123221671fd4 "added y"
2118 grafting 5:36b793615f78 "added foo to c"
2125 grafting 5:36b793615f78 "added foo to c"
2119 merging c
2126 merging c
2120 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2127 warning: conflicts while merging c! (edit, then use 'hg resolve --mark')
2121 abort: unresolved conflicts, can't continue
2128 abort: unresolved conflicts, can't continue
2122 (use 'hg resolve' and 'hg graft --continue')
2129 (use 'hg resolve' and 'hg graft --continue')
2123 [255]
2130 [255]
2124
2131
2125 $ cd ..
2132 $ cd ..
2126 $ hg init pullrepo
2133 $ hg init pullrepo
2127 $ cd pullrepo
2134 $ cd pullrepo
2128 $ cat >> .hg/hgrc <<EOF
2135 $ cat >> .hg/hgrc <<EOF
2129 > [phases]
2136 > [phases]
2130 > publish=False
2137 > publish=False
2131 > EOF
2138 > EOF
2132 $ hg pull ../abortgraft --config phases.publish=False
2139 $ hg pull ../abortgraft --config phases.publish=False
2133 pulling from ../abortgraft
2140 pulling from ../abortgraft
2134 requesting all changes
2141 requesting all changes
2135 adding changesets
2142 adding changesets
2136 adding manifests
2143 adding manifests
2137 adding file changes
2144 adding file changes
2138 added 11 changesets with 9 changes to 8 files (+4 heads)
2145 added 11 changesets with 9 changes to 8 files (+4 heads)
2139 new changesets 9092f1db7931:6b98ff0062dd (6 drafts)
2146 new changesets 9092f1db7931:6b98ff0062dd (6 drafts)
2140 (run 'hg heads' to see heads, 'hg merge' to merge)
2147 (run 'hg heads' to see heads, 'hg merge' to merge)
2141 $ hg up 9
2148 $ hg up 9
2142 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
2149 5 files updated, 0 files merged, 0 files removed, 0 files unresolved
2143 $ echo w > w
2150 $ echo w > w
2144 $ hg ci -Aqm "added w" --config phases.publish=False
2151 $ hg ci -Aqm "added w" --config phases.publish=False
2145
2152
2146 $ cd ../abortgraft
2153 $ cd ../abortgraft
2147 $ hg pull ../pullrepo
2154 $ hg pull ../pullrepo
2148 pulling from ../pullrepo
2155 pulling from ../pullrepo
2149 searching for changes
2156 searching for changes
2150 adding changesets
2157 adding changesets
2151 adding manifests
2158 adding manifests
2152 adding file changes
2159 adding file changes
2153 added 1 changesets with 1 changes to 1 files (+1 heads)
2160 added 1 changesets with 1 changes to 1 files (+1 heads)
2154 new changesets 311dfc6cf3bf (1 drafts)
2161 new changesets 311dfc6cf3bf (1 drafts)
2155 (run 'hg heads .' to see heads, 'hg merge' to merge)
2162 (run 'hg heads .' to see heads, 'hg merge' to merge)
2156
2163
2157 $ hg graft --abort
2164 $ hg graft --abort
2158 new changesets detected on destination branch, can't strip
2165 new changesets detected on destination branch, can't strip
2159 graft aborted
2166 graft aborted
2160 working directory is now at 6b98ff0062dd
2167 working directory is now at 6b98ff0062dd
2161
2168
2162 $ cd ..
2169 $ cd ..
2163
2170
2164 ============================
2171 ============================
2165 Testing --no-commit option:|
2172 Testing --no-commit option:|
2166 ============================
2173 ============================
2167
2174
2168 $ hg init nocommit
2175 $ hg init nocommit
2169 $ cd nocommit
2176 $ cd nocommit
2170 $ echo a > a
2177 $ echo a > a
2171 $ hg ci -qAma
2178 $ hg ci -qAma
2172 $ echo b > b
2179 $ echo b > b
2173 $ hg ci -qAmb
2180 $ hg ci -qAmb
2174 $ hg up -q 0
2181 $ hg up -q 0
2175 $ echo c > c
2182 $ echo c > c
2176 $ hg ci -qAmc
2183 $ hg ci -qAmc
2177 $ hg log -GT "{rev}:{node|short} {desc}\n"
2184 $ hg log -GT "{rev}:{node|short} {desc}\n"
2178 @ 2:d36c0562f908 c
2185 @ 2:d36c0562f908 c
2179 |
2186 |
2180 | o 1:d2ae7f538514 b
2187 | o 1:d2ae7f538514 b
2181 |/
2188 |/
2182 o 0:cb9a9f314b8b a
2189 o 0:cb9a9f314b8b a
2183
2190
2184
2191
2185 Check reporting when --no-commit used with non-applicable options:
2192 Check reporting when --no-commit used with non-applicable options:
2186
2193
2187 $ hg graft 1 --no-commit -e
2194 $ hg graft 1 --no-commit -e
2188 abort: cannot specify --no-commit and --edit together
2195 abort: cannot specify --no-commit and --edit together
2189 [255]
2196 [255]
2190
2197
2191 $ hg graft 1 --no-commit --log
2198 $ hg graft 1 --no-commit --log
2192 abort: cannot specify --no-commit and --log together
2199 abort: cannot specify --no-commit and --log together
2193 [255]
2200 [255]
2194
2201
2195 $ hg graft 1 --no-commit -D
2202 $ hg graft 1 --no-commit -D
2196 abort: cannot specify --no-commit and --currentdate together
2203 abort: cannot specify --no-commit and --currentdate together
2197 [255]
2204 [255]
2198
2205
2199 Test --no-commit is working:
2206 Test --no-commit is working:
2200 $ hg graft 1 --no-commit
2207 $ hg graft 1 --no-commit
2201 grafting 1:d2ae7f538514 "b"
2208 grafting 1:d2ae7f538514 "b"
2202
2209
2203 $ hg log -GT "{rev}:{node|short} {desc}\n"
2210 $ hg log -GT "{rev}:{node|short} {desc}\n"
2204 @ 2:d36c0562f908 c
2211 @ 2:d36c0562f908 c
2205 |
2212 |
2206 | o 1:d2ae7f538514 b
2213 | o 1:d2ae7f538514 b
2207 |/
2214 |/
2208 o 0:cb9a9f314b8b a
2215 o 0:cb9a9f314b8b a
2209
2216
2210
2217
2211 $ hg diff
2218 $ hg diff
2212 diff -r d36c0562f908 b
2219 diff -r d36c0562f908 b
2213 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2220 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2214 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2221 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2215 @@ -0,0 +1,1 @@
2222 @@ -0,0 +1,1 @@
2216 +b
2223 +b
2217
2224
2218 Prepare wrdir to check --no-commit is resepected after --continue:
2225 Prepare wrdir to check --no-commit is resepected after --continue:
2219
2226
2220 $ hg up -qC
2227 $ hg up -qC
2221 $ echo A>a
2228 $ echo A>a
2222 $ hg ci -qm "A in file a"
2229 $ hg ci -qm "A in file a"
2223 $ hg up -q 1
2230 $ hg up -q 1
2224 $ echo B>a
2231 $ echo B>a
2225 $ hg ci -qm "B in file a"
2232 $ hg ci -qm "B in file a"
2226 $ hg log -GT "{rev}:{node|short} {desc}\n"
2233 $ hg log -GT "{rev}:{node|short} {desc}\n"
2227 @ 4:2aa9ad1006ff B in file a
2234 @ 4:2aa9ad1006ff B in file a
2228 |
2235 |
2229 | o 3:09e253b87e17 A in file a
2236 | o 3:09e253b87e17 A in file a
2230 | |
2237 | |
2231 | o 2:d36c0562f908 c
2238 | o 2:d36c0562f908 c
2232 | |
2239 | |
2233 o | 1:d2ae7f538514 b
2240 o | 1:d2ae7f538514 b
2234 |/
2241 |/
2235 o 0:cb9a9f314b8b a
2242 o 0:cb9a9f314b8b a
2236
2243
2237
2244
2238 $ hg graft 3 --no-commit
2245 $ hg graft 3 --no-commit
2239 grafting 3:09e253b87e17 "A in file a"
2246 grafting 3:09e253b87e17 "A in file a"
2240 merging a
2247 merging a
2241 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2248 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2242 abort: unresolved conflicts, can't continue
2249 abort: unresolved conflicts, can't continue
2243 (use 'hg resolve' and 'hg graft --continue')
2250 (use 'hg resolve' and 'hg graft --continue')
2244 [255]
2251 [255]
2245
2252
2246 Resolve conflict:
2253 Resolve conflict:
2247 $ echo A>a
2254 $ echo A>a
2248 $ hg resolve --mark
2255 $ hg resolve --mark
2249 (no more unresolved files)
2256 (no more unresolved files)
2250 continue: hg graft --continue
2257 continue: hg graft --continue
2251
2258
2252 $ hg graft --continue
2259 $ hg graft --continue
2253 grafting 3:09e253b87e17 "A in file a"
2260 grafting 3:09e253b87e17 "A in file a"
2254 $ hg log -GT "{rev}:{node|short} {desc}\n"
2261 $ hg log -GT "{rev}:{node|short} {desc}\n"
2255 @ 4:2aa9ad1006ff B in file a
2262 @ 4:2aa9ad1006ff B in file a
2256 |
2263 |
2257 | o 3:09e253b87e17 A in file a
2264 | o 3:09e253b87e17 A in file a
2258 | |
2265 | |
2259 | o 2:d36c0562f908 c
2266 | o 2:d36c0562f908 c
2260 | |
2267 | |
2261 o | 1:d2ae7f538514 b
2268 o | 1:d2ae7f538514 b
2262 |/
2269 |/
2263 o 0:cb9a9f314b8b a
2270 o 0:cb9a9f314b8b a
2264
2271
2265 $ hg diff
2272 $ hg diff
2266 diff -r 2aa9ad1006ff a
2273 diff -r 2aa9ad1006ff a
2267 --- a/a Thu Jan 01 00:00:00 1970 +0000
2274 --- a/a Thu Jan 01 00:00:00 1970 +0000
2268 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2275 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2269 @@ -1,1 +1,1 @@
2276 @@ -1,1 +1,1 @@
2270 -B
2277 -B
2271 +A
2278 +A
2272
2279
2273 $ hg up -qC
2280 $ hg up -qC
2274
2281
2275 Check --no-commit is resepected when passed with --continue:
2282 Check --no-commit is resepected when passed with --continue:
2276
2283
2277 $ hg graft 3
2284 $ hg graft 3
2278 grafting 3:09e253b87e17 "A in file a"
2285 grafting 3:09e253b87e17 "A in file a"
2279 merging a
2286 merging a
2280 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2287 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2281 abort: unresolved conflicts, can't continue
2288 abort: unresolved conflicts, can't continue
2282 (use 'hg resolve' and 'hg graft --continue')
2289 (use 'hg resolve' and 'hg graft --continue')
2283 [255]
2290 [255]
2284
2291
2285 Resolve conflict:
2292 Resolve conflict:
2286 $ echo A>a
2293 $ echo A>a
2287 $ hg resolve --mark
2294 $ hg resolve --mark
2288 (no more unresolved files)
2295 (no more unresolved files)
2289 continue: hg graft --continue
2296 continue: hg graft --continue
2290
2297
2291 $ hg graft --continue --no-commit
2298 $ hg graft --continue --no-commit
2292 grafting 3:09e253b87e17 "A in file a"
2299 grafting 3:09e253b87e17 "A in file a"
2293 $ hg diff
2300 $ hg diff
2294 diff -r 2aa9ad1006ff a
2301 diff -r 2aa9ad1006ff a
2295 --- a/a Thu Jan 01 00:00:00 1970 +0000
2302 --- a/a Thu Jan 01 00:00:00 1970 +0000
2296 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2303 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2297 @@ -1,1 +1,1 @@
2304 @@ -1,1 +1,1 @@
2298 -B
2305 -B
2299 +A
2306 +A
2300
2307
2301 $ hg log -GT "{rev}:{node|short} {desc}\n"
2308 $ hg log -GT "{rev}:{node|short} {desc}\n"
2302 @ 4:2aa9ad1006ff B in file a
2309 @ 4:2aa9ad1006ff B in file a
2303 |
2310 |
2304 | o 3:09e253b87e17 A in file a
2311 | o 3:09e253b87e17 A in file a
2305 | |
2312 | |
2306 | o 2:d36c0562f908 c
2313 | o 2:d36c0562f908 c
2307 | |
2314 | |
2308 o | 1:d2ae7f538514 b
2315 o | 1:d2ae7f538514 b
2309 |/
2316 |/
2310 o 0:cb9a9f314b8b a
2317 o 0:cb9a9f314b8b a
2311
2318
2312 $ hg up -qC
2319 $ hg up -qC
2313
2320
2314 Test --no-commit when graft multiple revisions:
2321 Test --no-commit when graft multiple revisions:
2315 When there is conflict:
2322 When there is conflict:
2316 $ hg graft -r "2::3" --no-commit
2323 $ hg graft -r "2::3" --no-commit
2317 grafting 2:d36c0562f908 "c"
2324 grafting 2:d36c0562f908 "c"
2318 grafting 3:09e253b87e17 "A in file a"
2325 grafting 3:09e253b87e17 "A in file a"
2319 merging a
2326 merging a
2320 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2327 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
2321 abort: unresolved conflicts, can't continue
2328 abort: unresolved conflicts, can't continue
2322 (use 'hg resolve' and 'hg graft --continue')
2329 (use 'hg resolve' and 'hg graft --continue')
2323 [255]
2330 [255]
2324
2331
2325 $ echo A>a
2332 $ echo A>a
2326 $ hg resolve --mark
2333 $ hg resolve --mark
2327 (no more unresolved files)
2334 (no more unresolved files)
2328 continue: hg graft --continue
2335 continue: hg graft --continue
2329 $ hg graft --continue
2336 $ hg graft --continue
2330 grafting 3:09e253b87e17 "A in file a"
2337 grafting 3:09e253b87e17 "A in file a"
2331 $ hg diff
2338 $ hg diff
2332 diff -r 2aa9ad1006ff a
2339 diff -r 2aa9ad1006ff a
2333 --- a/a Thu Jan 01 00:00:00 1970 +0000
2340 --- a/a Thu Jan 01 00:00:00 1970 +0000
2334 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2341 +++ b/a Thu Jan 01 00:00:00 1970 +0000
2335 @@ -1,1 +1,1 @@
2342 @@ -1,1 +1,1 @@
2336 -B
2343 -B
2337 +A
2344 +A
2338 diff -r 2aa9ad1006ff c
2345 diff -r 2aa9ad1006ff c
2339 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2346 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2340 +++ b/c Thu Jan 01 00:00:00 1970 +0000
2347 +++ b/c Thu Jan 01 00:00:00 1970 +0000
2341 @@ -0,0 +1,1 @@
2348 @@ -0,0 +1,1 @@
2342 +c
2349 +c
2343
2350
2344 $ hg log -GT "{rev}:{node|short} {desc}\n"
2351 $ hg log -GT "{rev}:{node|short} {desc}\n"
2345 @ 4:2aa9ad1006ff B in file a
2352 @ 4:2aa9ad1006ff B in file a
2346 |
2353 |
2347 | o 3:09e253b87e17 A in file a
2354 | o 3:09e253b87e17 A in file a
2348 | |
2355 | |
2349 | o 2:d36c0562f908 c
2356 | o 2:d36c0562f908 c
2350 | |
2357 | |
2351 o | 1:d2ae7f538514 b
2358 o | 1:d2ae7f538514 b
2352 |/
2359 |/
2353 o 0:cb9a9f314b8b a
2360 o 0:cb9a9f314b8b a
2354
2361
2355 $ hg up -qC
2362 $ hg up -qC
2356
2363
2357 When there is no conflict:
2364 When there is no conflict:
2358 $ echo d>d
2365 $ echo d>d
2359 $ hg add d -q
2366 $ hg add d -q
2360 $ hg ci -qmd
2367 $ hg ci -qmd
2361 $ hg up 3 -q
2368 $ hg up 3 -q
2362 $ hg log -GT "{rev}:{node|short} {desc}\n"
2369 $ hg log -GT "{rev}:{node|short} {desc}\n"
2363 o 5:baefa8927fc0 d
2370 o 5:baefa8927fc0 d
2364 |
2371 |
2365 o 4:2aa9ad1006ff B in file a
2372 o 4:2aa9ad1006ff B in file a
2366 |
2373 |
2367 | @ 3:09e253b87e17 A in file a
2374 | @ 3:09e253b87e17 A in file a
2368 | |
2375 | |
2369 | o 2:d36c0562f908 c
2376 | o 2:d36c0562f908 c
2370 | |
2377 | |
2371 o | 1:d2ae7f538514 b
2378 o | 1:d2ae7f538514 b
2372 |/
2379 |/
2373 o 0:cb9a9f314b8b a
2380 o 0:cb9a9f314b8b a
2374
2381
2375
2382
2376 $ hg graft -r 1 -r 5 --no-commit
2383 $ hg graft -r 1 -r 5 --no-commit
2377 grafting 1:d2ae7f538514 "b"
2384 grafting 1:d2ae7f538514 "b"
2378 grafting 5:baefa8927fc0 "d" (tip)
2385 grafting 5:baefa8927fc0 "d" (tip)
2379 $ hg diff
2386 $ hg diff
2380 diff -r 09e253b87e17 b
2387 diff -r 09e253b87e17 b
2381 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2388 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2382 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2389 +++ b/b Thu Jan 01 00:00:00 1970 +0000
2383 @@ -0,0 +1,1 @@
2390 @@ -0,0 +1,1 @@
2384 +b
2391 +b
2385 diff -r 09e253b87e17 d
2392 diff -r 09e253b87e17 d
2386 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2393 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2387 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2394 +++ b/d Thu Jan 01 00:00:00 1970 +0000
2388 @@ -0,0 +1,1 @@
2395 @@ -0,0 +1,1 @@
2389 +d
2396 +d
2390 $ hg log -GT "{rev}:{node|short} {desc}\n"
2397 $ hg log -GT "{rev}:{node|short} {desc}\n"
2391 o 5:baefa8927fc0 d
2398 o 5:baefa8927fc0 d
2392 |
2399 |
2393 o 4:2aa9ad1006ff B in file a
2400 o 4:2aa9ad1006ff B in file a
2394 |
2401 |
2395 | @ 3:09e253b87e17 A in file a
2402 | @ 3:09e253b87e17 A in file a
2396 | |
2403 | |
2397 | o 2:d36c0562f908 c
2404 | o 2:d36c0562f908 c
2398 | |
2405 | |
2399 o | 1:d2ae7f538514 b
2406 o | 1:d2ae7f538514 b
2400 |/
2407 |/
2401 o 0:cb9a9f314b8b a
2408 o 0:cb9a9f314b8b a
2402
2409
2403 $ cd ..
2410 $ cd ..
@@ -1,1700 +1,1695 b''
1
1
2 $ add()
2 $ add()
3 > {
3 > {
4 > echo $2 >> $1
4 > echo $2 >> $1
5 > }
5 > }
6 $ hg init t
6 $ hg init t
7 $ cd t
7 $ cd t
8
8
9 set up a boring main branch
9 set up a boring main branch
10
10
11 $ add a a
11 $ add a a
12 $ hg add a
12 $ hg add a
13 $ mkdir x
13 $ mkdir x
14 $ add x/x x
14 $ add x/x x
15 $ hg add x/x
15 $ hg add x/x
16 $ hg ci -m0
16 $ hg ci -m0
17 $ add a m1
17 $ add a m1
18 $ hg ci -m1
18 $ hg ci -m1
19 $ add a m2
19 $ add a m2
20 $ add x/y y1
20 $ add x/y y1
21 $ hg add x/y
21 $ hg add x/y
22 $ hg ci -m2
22 $ hg ci -m2
23 $ cd ..
23 $ cd ..
24
24
25 $ show()
25 $ show()
26 > {
26 > {
27 > echo "# $2:"
27 > echo "# $2:"
28 > echo
28 > echo
29 > echo "% hg st -C $1"
29 > echo "% hg st -C $1"
30 > hg st -C $1
30 > hg st -C $1
31 > echo
31 > echo
32 > echo "% hg diff --git $1"
32 > echo "% hg diff --git $1"
33 > hg diff --git $1
33 > hg diff --git $1
34 > echo
34 > echo
35 > }
35 > }
36 $ count=0
36 $ count=0
37
37
38 make a new branch and get diff/status output
38 make a new branch and get diff/status output
39 $1 - first commit
39 $1 - first commit
40 $2 - second commit
40 $2 - second commit
41 $3 - working dir action
41 $3 - working dir action
42
42
43 $ tb()
43 $ tb()
44 > {
44 > {
45 > hg clone -q t t2 ; cd t2
45 > hg clone -q t t2 ; cd t2
46 > hg co -q -C 0
46 > hg co -q -C 0
47 >
47 >
48 > echo % add a $count
48 > echo % add a $count
49 > add a $count
49 > add a $count
50 > count=`expr $count + 1`
50 > count=`expr $count + 1`
51 > echo % hg ci -m "t0"
51 > echo % hg ci -m "t0"
52 > hg ci -m "t0"
52 > hg ci -m "t0"
53 > echo % $1
53 > echo % $1
54 > $1
54 > $1
55 > echo % hg ci -m "t1"
55 > echo % hg ci -m "t1"
56 > hg ci -m "t1"
56 > hg ci -m "t1"
57 > echo % $2
57 > echo % $2
58 > $2
58 > $2
59 > echo % hg ci -m "t2"
59 > echo % hg ci -m "t2"
60 > hg ci -m "t2"
60 > hg ci -m "t2"
61 > echo % $3
61 > echo % $3
62 > $3
62 > $3
63 > echo
63 > echo
64 > show "" "working to parent"
64 > show "" "working to parent"
65 > show "--rev 0" "working to root"
65 > show "--rev 0" "working to root"
66 > show "--rev 2" "working to branch"
66 > show "--rev 2" "working to branch"
67 > show "--rev 0 --rev ." "root to parent"
67 > show "--rev 0 --rev ." "root to parent"
68 > show "--rev . --rev 0" "parent to root"
68 > show "--rev . --rev 0" "parent to root"
69 > show "--rev 2 --rev ." "branch to parent"
69 > show "--rev 2 --rev ." "branch to parent"
70 > show "--rev . --rev 2" "parent to branch"
70 > show "--rev . --rev 2" "parent to branch"
71 > echo
71 > echo
72 > cd ..
72 > cd ..
73 > rm -rf t2
73 > rm -rf t2
74 > }
74 > }
75
75
76 rename in working dir
76 rename in working dir
77
77
78 $ tb "add a a1" "add a a2" "hg mv a b"
78 $ tb "add a a1" "add a a2" "hg mv a b"
79 % add a 0
79 % add a 0
80 % hg ci -m t0
80 % hg ci -m t0
81 created new head
81 created new head
82 % add a a1
82 % add a a1
83 % hg ci -m t1
83 % hg ci -m t1
84 % add a a2
84 % add a a2
85 % hg ci -m t2
85 % hg ci -m t2
86 % hg mv a b
86 % hg mv a b
87
87
88 # working to parent:
88 # working to parent:
89
89
90 % hg st -C
90 % hg st -C
91 A b
91 A b
92 a
92 a
93 R a
93 R a
94
94
95 % hg diff --git
95 % hg diff --git
96 diff --git a/a b/b
96 diff --git a/a b/b
97 rename from a
97 rename from a
98 rename to b
98 rename to b
99
99
100 # working to root:
100 # working to root:
101
101
102 % hg st -C --rev 0
102 % hg st -C --rev 0
103 A b
103 A b
104 a
104 a
105 R a
105 R a
106
106
107 % hg diff --git --rev 0
107 % hg diff --git --rev 0
108 diff --git a/a b/b
108 diff --git a/a b/b
109 rename from a
109 rename from a
110 rename to b
110 rename to b
111 --- a/a
111 --- a/a
112 +++ b/b
112 +++ b/b
113 @@ -1,1 +1,4 @@
113 @@ -1,1 +1,4 @@
114 a
114 a
115 +0
115 +0
116 +a1
116 +a1
117 +a2
117 +a2
118
118
119 # working to branch:
119 # working to branch:
120
120
121 % hg st -C --rev 2
121 % hg st -C --rev 2
122 A b
122 A b
123 a
123 a
124 R a
124 R a
125 R x/y
125 R x/y
126
126
127 % hg diff --git --rev 2
127 % hg diff --git --rev 2
128 diff --git a/a b/b
128 diff --git a/a b/b
129 rename from a
129 rename from a
130 rename to b
130 rename to b
131 --- a/a
131 --- a/a
132 +++ b/b
132 +++ b/b
133 @@ -1,3 +1,4 @@
133 @@ -1,3 +1,4 @@
134 a
134 a
135 -m1
135 -m1
136 -m2
136 -m2
137 +0
137 +0
138 +a1
138 +a1
139 +a2
139 +a2
140 diff --git a/x/y b/x/y
140 diff --git a/x/y b/x/y
141 deleted file mode 100644
141 deleted file mode 100644
142 --- a/x/y
142 --- a/x/y
143 +++ /dev/null
143 +++ /dev/null
144 @@ -1,1 +0,0 @@
144 @@ -1,1 +0,0 @@
145 -y1
145 -y1
146
146
147 # root to parent:
147 # root to parent:
148
148
149 % hg st -C --rev 0 --rev .
149 % hg st -C --rev 0 --rev .
150 M a
150 M a
151
151
152 % hg diff --git --rev 0 --rev .
152 % hg diff --git --rev 0 --rev .
153 diff --git a/a b/a
153 diff --git a/a b/a
154 --- a/a
154 --- a/a
155 +++ b/a
155 +++ b/a
156 @@ -1,1 +1,4 @@
156 @@ -1,1 +1,4 @@
157 a
157 a
158 +0
158 +0
159 +a1
159 +a1
160 +a2
160 +a2
161
161
162 # parent to root:
162 # parent to root:
163
163
164 % hg st -C --rev . --rev 0
164 % hg st -C --rev . --rev 0
165 M a
165 M a
166
166
167 % hg diff --git --rev . --rev 0
167 % hg diff --git --rev . --rev 0
168 diff --git a/a b/a
168 diff --git a/a b/a
169 --- a/a
169 --- a/a
170 +++ b/a
170 +++ b/a
171 @@ -1,4 +1,1 @@
171 @@ -1,4 +1,1 @@
172 a
172 a
173 -0
173 -0
174 -a1
174 -a1
175 -a2
175 -a2
176
176
177 # branch to parent:
177 # branch to parent:
178
178
179 % hg st -C --rev 2 --rev .
179 % hg st -C --rev 2 --rev .
180 M a
180 M a
181 R x/y
181 R x/y
182
182
183 % hg diff --git --rev 2 --rev .
183 % hg diff --git --rev 2 --rev .
184 diff --git a/a b/a
184 diff --git a/a b/a
185 --- a/a
185 --- a/a
186 +++ b/a
186 +++ b/a
187 @@ -1,3 +1,4 @@
187 @@ -1,3 +1,4 @@
188 a
188 a
189 -m1
189 -m1
190 -m2
190 -m2
191 +0
191 +0
192 +a1
192 +a1
193 +a2
193 +a2
194 diff --git a/x/y b/x/y
194 diff --git a/x/y b/x/y
195 deleted file mode 100644
195 deleted file mode 100644
196 --- a/x/y
196 --- a/x/y
197 +++ /dev/null
197 +++ /dev/null
198 @@ -1,1 +0,0 @@
198 @@ -1,1 +0,0 @@
199 -y1
199 -y1
200
200
201 # parent to branch:
201 # parent to branch:
202
202
203 % hg st -C --rev . --rev 2
203 % hg st -C --rev . --rev 2
204 M a
204 M a
205 A x/y
205 A x/y
206
206
207 % hg diff --git --rev . --rev 2
207 % hg diff --git --rev . --rev 2
208 diff --git a/a b/a
208 diff --git a/a b/a
209 --- a/a
209 --- a/a
210 +++ b/a
210 +++ b/a
211 @@ -1,4 +1,3 @@
211 @@ -1,4 +1,3 @@
212 a
212 a
213 -0
213 -0
214 -a1
214 -a1
215 -a2
215 -a2
216 +m1
216 +m1
217 +m2
217 +m2
218 diff --git a/x/y b/x/y
218 diff --git a/x/y b/x/y
219 new file mode 100644
219 new file mode 100644
220 --- /dev/null
220 --- /dev/null
221 +++ b/x/y
221 +++ b/x/y
222 @@ -0,0 +1,1 @@
222 @@ -0,0 +1,1 @@
223 +y1
223 +y1
224
224
225
225
226 copy in working dir
226 copy in working dir
227
227
228 $ tb "add a a1" "add a a2" "hg cp a b"
228 $ tb "add a a1" "add a a2" "hg cp a b"
229 % add a 1
229 % add a 1
230 % hg ci -m t0
230 % hg ci -m t0
231 created new head
231 created new head
232 % add a a1
232 % add a a1
233 % hg ci -m t1
233 % hg ci -m t1
234 % add a a2
234 % add a a2
235 % hg ci -m t2
235 % hg ci -m t2
236 % hg cp a b
236 % hg cp a b
237
237
238 # working to parent:
238 # working to parent:
239
239
240 % hg st -C
240 % hg st -C
241 A b
241 A b
242 a
242 a
243
243
244 % hg diff --git
244 % hg diff --git
245 diff --git a/a b/b
245 diff --git a/a b/b
246 copy from a
246 copy from a
247 copy to b
247 copy to b
248
248
249 # working to root:
249 # working to root:
250
250
251 % hg st -C --rev 0
251 % hg st -C --rev 0
252 M a
252 M a
253 A b
253 A b
254 a
254 a
255
255
256 % hg diff --git --rev 0
256 % hg diff --git --rev 0
257 diff --git a/a b/a
257 diff --git a/a b/a
258 --- a/a
258 --- a/a
259 +++ b/a
259 +++ b/a
260 @@ -1,1 +1,4 @@
260 @@ -1,1 +1,4 @@
261 a
261 a
262 +1
262 +1
263 +a1
263 +a1
264 +a2
264 +a2
265 diff --git a/a b/b
265 diff --git a/a b/b
266 copy from a
266 copy from a
267 copy to b
267 copy to b
268 --- a/a
268 --- a/a
269 +++ b/b
269 +++ b/b
270 @@ -1,1 +1,4 @@
270 @@ -1,1 +1,4 @@
271 a
271 a
272 +1
272 +1
273 +a1
273 +a1
274 +a2
274 +a2
275
275
276 # working to branch:
276 # working to branch:
277
277
278 % hg st -C --rev 2
278 % hg st -C --rev 2
279 M a
279 M a
280 A b
280 A b
281 a
281 a
282 R x/y
282 R x/y
283
283
284 % hg diff --git --rev 2
284 % hg diff --git --rev 2
285 diff --git a/a b/a
285 diff --git a/a b/a
286 --- a/a
286 --- a/a
287 +++ b/a
287 +++ b/a
288 @@ -1,3 +1,4 @@
288 @@ -1,3 +1,4 @@
289 a
289 a
290 -m1
290 -m1
291 -m2
291 -m2
292 +1
292 +1
293 +a1
293 +a1
294 +a2
294 +a2
295 diff --git a/a b/b
295 diff --git a/a b/b
296 copy from a
296 copy from a
297 copy to b
297 copy to b
298 --- a/a
298 --- a/a
299 +++ b/b
299 +++ b/b
300 @@ -1,3 +1,4 @@
300 @@ -1,3 +1,4 @@
301 a
301 a
302 -m1
302 -m1
303 -m2
303 -m2
304 +1
304 +1
305 +a1
305 +a1
306 +a2
306 +a2
307 diff --git a/x/y b/x/y
307 diff --git a/x/y b/x/y
308 deleted file mode 100644
308 deleted file mode 100644
309 --- a/x/y
309 --- a/x/y
310 +++ /dev/null
310 +++ /dev/null
311 @@ -1,1 +0,0 @@
311 @@ -1,1 +0,0 @@
312 -y1
312 -y1
313
313
314 # root to parent:
314 # root to parent:
315
315
316 % hg st -C --rev 0 --rev .
316 % hg st -C --rev 0 --rev .
317 M a
317 M a
318
318
319 % hg diff --git --rev 0 --rev .
319 % hg diff --git --rev 0 --rev .
320 diff --git a/a b/a
320 diff --git a/a b/a
321 --- a/a
321 --- a/a
322 +++ b/a
322 +++ b/a
323 @@ -1,1 +1,4 @@
323 @@ -1,1 +1,4 @@
324 a
324 a
325 +1
325 +1
326 +a1
326 +a1
327 +a2
327 +a2
328
328
329 # parent to root:
329 # parent to root:
330
330
331 % hg st -C --rev . --rev 0
331 % hg st -C --rev . --rev 0
332 M a
332 M a
333
333
334 % hg diff --git --rev . --rev 0
334 % hg diff --git --rev . --rev 0
335 diff --git a/a b/a
335 diff --git a/a b/a
336 --- a/a
336 --- a/a
337 +++ b/a
337 +++ b/a
338 @@ -1,4 +1,1 @@
338 @@ -1,4 +1,1 @@
339 a
339 a
340 -1
340 -1
341 -a1
341 -a1
342 -a2
342 -a2
343
343
344 # branch to parent:
344 # branch to parent:
345
345
346 % hg st -C --rev 2 --rev .
346 % hg st -C --rev 2 --rev .
347 M a
347 M a
348 R x/y
348 R x/y
349
349
350 % hg diff --git --rev 2 --rev .
350 % hg diff --git --rev 2 --rev .
351 diff --git a/a b/a
351 diff --git a/a b/a
352 --- a/a
352 --- a/a
353 +++ b/a
353 +++ b/a
354 @@ -1,3 +1,4 @@
354 @@ -1,3 +1,4 @@
355 a
355 a
356 -m1
356 -m1
357 -m2
357 -m2
358 +1
358 +1
359 +a1
359 +a1
360 +a2
360 +a2
361 diff --git a/x/y b/x/y
361 diff --git a/x/y b/x/y
362 deleted file mode 100644
362 deleted file mode 100644
363 --- a/x/y
363 --- a/x/y
364 +++ /dev/null
364 +++ /dev/null
365 @@ -1,1 +0,0 @@
365 @@ -1,1 +0,0 @@
366 -y1
366 -y1
367
367
368 # parent to branch:
368 # parent to branch:
369
369
370 % hg st -C --rev . --rev 2
370 % hg st -C --rev . --rev 2
371 M a
371 M a
372 A x/y
372 A x/y
373
373
374 % hg diff --git --rev . --rev 2
374 % hg diff --git --rev . --rev 2
375 diff --git a/a b/a
375 diff --git a/a b/a
376 --- a/a
376 --- a/a
377 +++ b/a
377 +++ b/a
378 @@ -1,4 +1,3 @@
378 @@ -1,4 +1,3 @@
379 a
379 a
380 -1
380 -1
381 -a1
381 -a1
382 -a2
382 -a2
383 +m1
383 +m1
384 +m2
384 +m2
385 diff --git a/x/y b/x/y
385 diff --git a/x/y b/x/y
386 new file mode 100644
386 new file mode 100644
387 --- /dev/null
387 --- /dev/null
388 +++ b/x/y
388 +++ b/x/y
389 @@ -0,0 +1,1 @@
389 @@ -0,0 +1,1 @@
390 +y1
390 +y1
391
391
392
392
393 single rename
393 single rename
394
394
395 $ tb "hg mv a b" "add b b1" "add b w"
395 $ tb "hg mv a b" "add b b1" "add b w"
396 % add a 2
396 % add a 2
397 % hg ci -m t0
397 % hg ci -m t0
398 created new head
398 created new head
399 % hg mv a b
399 % hg mv a b
400 % hg ci -m t1
400 % hg ci -m t1
401 % add b b1
401 % add b b1
402 % hg ci -m t2
402 % hg ci -m t2
403 % add b w
403 % add b w
404
404
405 # working to parent:
405 # working to parent:
406
406
407 % hg st -C
407 % hg st -C
408 M b
408 M b
409
409
410 % hg diff --git
410 % hg diff --git
411 diff --git a/b b/b
411 diff --git a/b b/b
412 --- a/b
412 --- a/b
413 +++ b/b
413 +++ b/b
414 @@ -1,3 +1,4 @@
414 @@ -1,3 +1,4 @@
415 a
415 a
416 2
416 2
417 b1
417 b1
418 +w
418 +w
419
419
420 # working to root:
420 # working to root:
421
421
422 % hg st -C --rev 0
422 % hg st -C --rev 0
423 A b
423 A b
424 a
424 a
425 R a
425 R a
426
426
427 % hg diff --git --rev 0
427 % hg diff --git --rev 0
428 diff --git a/a b/b
428 diff --git a/a b/b
429 rename from a
429 rename from a
430 rename to b
430 rename to b
431 --- a/a
431 --- a/a
432 +++ b/b
432 +++ b/b
433 @@ -1,1 +1,4 @@
433 @@ -1,1 +1,4 @@
434 a
434 a
435 +2
435 +2
436 +b1
436 +b1
437 +w
437 +w
438
438
439 # working to branch:
439 # working to branch:
440
440
441 % hg st -C --rev 2
441 % hg st -C --rev 2
442 A b
442 A b
443 a
443 a
444 R a
444 R a
445 R x/y
445 R x/y
446
446
447 % hg diff --git --rev 2
447 % hg diff --git --rev 2
448 diff --git a/a b/b
448 diff --git a/a b/b
449 rename from a
449 rename from a
450 rename to b
450 rename to b
451 --- a/a
451 --- a/a
452 +++ b/b
452 +++ b/b
453 @@ -1,3 +1,4 @@
453 @@ -1,3 +1,4 @@
454 a
454 a
455 -m1
455 -m1
456 -m2
456 -m2
457 +2
457 +2
458 +b1
458 +b1
459 +w
459 +w
460 diff --git a/x/y b/x/y
460 diff --git a/x/y b/x/y
461 deleted file mode 100644
461 deleted file mode 100644
462 --- a/x/y
462 --- a/x/y
463 +++ /dev/null
463 +++ /dev/null
464 @@ -1,1 +0,0 @@
464 @@ -1,1 +0,0 @@
465 -y1
465 -y1
466
466
467 # root to parent:
467 # root to parent:
468
468
469 % hg st -C --rev 0 --rev .
469 % hg st -C --rev 0 --rev .
470 A b
470 A b
471 a
471 a
472 R a
472 R a
473
473
474 % hg diff --git --rev 0 --rev .
474 % hg diff --git --rev 0 --rev .
475 diff --git a/a b/b
475 diff --git a/a b/b
476 rename from a
476 rename from a
477 rename to b
477 rename to b
478 --- a/a
478 --- a/a
479 +++ b/b
479 +++ b/b
480 @@ -1,1 +1,3 @@
480 @@ -1,1 +1,3 @@
481 a
481 a
482 +2
482 +2
483 +b1
483 +b1
484
484
485 # parent to root:
485 # parent to root:
486
486
487 % hg st -C --rev . --rev 0
487 % hg st -C --rev . --rev 0
488 A a
488 A a
489 b
489 b
490 R b
490 R b
491
491
492 % hg diff --git --rev . --rev 0
492 % hg diff --git --rev . --rev 0
493 diff --git a/b b/a
493 diff --git a/b b/a
494 rename from b
494 rename from b
495 rename to a
495 rename to a
496 --- a/b
496 --- a/b
497 +++ b/a
497 +++ b/a
498 @@ -1,3 +1,1 @@
498 @@ -1,3 +1,1 @@
499 a
499 a
500 -2
500 -2
501 -b1
501 -b1
502
502
503 # branch to parent:
503 # branch to parent:
504
504
505 % hg st -C --rev 2 --rev .
505 % hg st -C --rev 2 --rev .
506 A b
506 A b
507 a
507 a
508 R a
508 R a
509 R x/y
509 R x/y
510
510
511 % hg diff --git --rev 2 --rev .
511 % hg diff --git --rev 2 --rev .
512 diff --git a/a b/b
512 diff --git a/a b/b
513 rename from a
513 rename from a
514 rename to b
514 rename to b
515 --- a/a
515 --- a/a
516 +++ b/b
516 +++ b/b
517 @@ -1,3 +1,3 @@
517 @@ -1,3 +1,3 @@
518 a
518 a
519 -m1
519 -m1
520 -m2
520 -m2
521 +2
521 +2
522 +b1
522 +b1
523 diff --git a/x/y b/x/y
523 diff --git a/x/y b/x/y
524 deleted file mode 100644
524 deleted file mode 100644
525 --- a/x/y
525 --- a/x/y
526 +++ /dev/null
526 +++ /dev/null
527 @@ -1,1 +0,0 @@
527 @@ -1,1 +0,0 @@
528 -y1
528 -y1
529
529
530 # parent to branch:
530 # parent to branch:
531
531
532 % hg st -C --rev . --rev 2
532 % hg st -C --rev . --rev 2
533 A a
533 A a
534 b
534 b
535 A x/y
535 A x/y
536 R b
536 R b
537
537
538 % hg diff --git --rev . --rev 2
538 % hg diff --git --rev . --rev 2
539 diff --git a/b b/a
539 diff --git a/b b/a
540 rename from b
540 rename from b
541 rename to a
541 rename to a
542 --- a/b
542 --- a/b
543 +++ b/a
543 +++ b/a
544 @@ -1,3 +1,3 @@
544 @@ -1,3 +1,3 @@
545 a
545 a
546 -2
546 -2
547 -b1
547 -b1
548 +m1
548 +m1
549 +m2
549 +m2
550 diff --git a/x/y b/x/y
550 diff --git a/x/y b/x/y
551 new file mode 100644
551 new file mode 100644
552 --- /dev/null
552 --- /dev/null
553 +++ b/x/y
553 +++ b/x/y
554 @@ -0,0 +1,1 @@
554 @@ -0,0 +1,1 @@
555 +y1
555 +y1
556
556
557
557
558 single copy
558 single copy
559
559
560 $ tb "hg cp a b" "add b b1" "add a w"
560 $ tb "hg cp a b" "add b b1" "add a w"
561 % add a 3
561 % add a 3
562 % hg ci -m t0
562 % hg ci -m t0
563 created new head
563 created new head
564 % hg cp a b
564 % hg cp a b
565 % hg ci -m t1
565 % hg ci -m t1
566 % add b b1
566 % add b b1
567 % hg ci -m t2
567 % hg ci -m t2
568 % add a w
568 % add a w
569
569
570 # working to parent:
570 # working to parent:
571
571
572 % hg st -C
572 % hg st -C
573 M a
573 M a
574
574
575 % hg diff --git
575 % hg diff --git
576 diff --git a/a b/a
576 diff --git a/a b/a
577 --- a/a
577 --- a/a
578 +++ b/a
578 +++ b/a
579 @@ -1,2 +1,3 @@
579 @@ -1,2 +1,3 @@
580 a
580 a
581 3
581 3
582 +w
582 +w
583
583
584 # working to root:
584 # working to root:
585
585
586 % hg st -C --rev 0
586 % hg st -C --rev 0
587 M a
587 M a
588 A b
588 A b
589 a
589 a
590
590
591 % hg diff --git --rev 0
591 % hg diff --git --rev 0
592 diff --git a/a b/a
592 diff --git a/a b/a
593 --- a/a
593 --- a/a
594 +++ b/a
594 +++ b/a
595 @@ -1,1 +1,3 @@
595 @@ -1,1 +1,3 @@
596 a
596 a
597 +3
597 +3
598 +w
598 +w
599 diff --git a/a b/b
599 diff --git a/a b/b
600 copy from a
600 copy from a
601 copy to b
601 copy to b
602 --- a/a
602 --- a/a
603 +++ b/b
603 +++ b/b
604 @@ -1,1 +1,3 @@
604 @@ -1,1 +1,3 @@
605 a
605 a
606 +3
606 +3
607 +b1
607 +b1
608
608
609 # working to branch:
609 # working to branch:
610
610
611 % hg st -C --rev 2
611 % hg st -C --rev 2
612 M a
612 M a
613 A b
613 A b
614 a
614 a
615 R x/y
615 R x/y
616
616
617 % hg diff --git --rev 2
617 % hg diff --git --rev 2
618 diff --git a/a b/a
618 diff --git a/a b/a
619 --- a/a
619 --- a/a
620 +++ b/a
620 +++ b/a
621 @@ -1,3 +1,3 @@
621 @@ -1,3 +1,3 @@
622 a
622 a
623 -m1
623 -m1
624 -m2
624 -m2
625 +3
625 +3
626 +w
626 +w
627 diff --git a/a b/b
627 diff --git a/a b/b
628 copy from a
628 copy from a
629 copy to b
629 copy to b
630 --- a/a
630 --- a/a
631 +++ b/b
631 +++ b/b
632 @@ -1,3 +1,3 @@
632 @@ -1,3 +1,3 @@
633 a
633 a
634 -m1
634 -m1
635 -m2
635 -m2
636 +3
636 +3
637 +b1
637 +b1
638 diff --git a/x/y b/x/y
638 diff --git a/x/y b/x/y
639 deleted file mode 100644
639 deleted file mode 100644
640 --- a/x/y
640 --- a/x/y
641 +++ /dev/null
641 +++ /dev/null
642 @@ -1,1 +0,0 @@
642 @@ -1,1 +0,0 @@
643 -y1
643 -y1
644
644
645 # root to parent:
645 # root to parent:
646
646
647 % hg st -C --rev 0 --rev .
647 % hg st -C --rev 0 --rev .
648 M a
648 M a
649 A b
649 A b
650 a
650 a
651
651
652 % hg diff --git --rev 0 --rev .
652 % hg diff --git --rev 0 --rev .
653 diff --git a/a b/a
653 diff --git a/a b/a
654 --- a/a
654 --- a/a
655 +++ b/a
655 +++ b/a
656 @@ -1,1 +1,2 @@
656 @@ -1,1 +1,2 @@
657 a
657 a
658 +3
658 +3
659 diff --git a/a b/b
659 diff --git a/a b/b
660 copy from a
660 copy from a
661 copy to b
661 copy to b
662 --- a/a
662 --- a/a
663 +++ b/b
663 +++ b/b
664 @@ -1,1 +1,3 @@
664 @@ -1,1 +1,3 @@
665 a
665 a
666 +3
666 +3
667 +b1
667 +b1
668
668
669 # parent to root:
669 # parent to root:
670
670
671 % hg st -C --rev . --rev 0
671 % hg st -C --rev . --rev 0
672 M a
672 M a
673 R b
673 R b
674
674
675 % hg diff --git --rev . --rev 0
675 % hg diff --git --rev . --rev 0
676 diff --git a/a b/a
676 diff --git a/a b/a
677 --- a/a
677 --- a/a
678 +++ b/a
678 +++ b/a
679 @@ -1,2 +1,1 @@
679 @@ -1,2 +1,1 @@
680 a
680 a
681 -3
681 -3
682 diff --git a/b b/b
682 diff --git a/b b/b
683 deleted file mode 100644
683 deleted file mode 100644
684 --- a/b
684 --- a/b
685 +++ /dev/null
685 +++ /dev/null
686 @@ -1,3 +0,0 @@
686 @@ -1,3 +0,0 @@
687 -a
687 -a
688 -3
688 -3
689 -b1
689 -b1
690
690
691 # branch to parent:
691 # branch to parent:
692
692
693 % hg st -C --rev 2 --rev .
693 % hg st -C --rev 2 --rev .
694 M a
694 M a
695 A b
695 A b
696 a
696 a
697 R x/y
697 R x/y
698
698
699 % hg diff --git --rev 2 --rev .
699 % hg diff --git --rev 2 --rev .
700 diff --git a/a b/a
700 diff --git a/a b/a
701 --- a/a
701 --- a/a
702 +++ b/a
702 +++ b/a
703 @@ -1,3 +1,2 @@
703 @@ -1,3 +1,2 @@
704 a
704 a
705 -m1
705 -m1
706 -m2
706 -m2
707 +3
707 +3
708 diff --git a/a b/b
708 diff --git a/a b/b
709 copy from a
709 copy from a
710 copy to b
710 copy to b
711 --- a/a
711 --- a/a
712 +++ b/b
712 +++ b/b
713 @@ -1,3 +1,3 @@
713 @@ -1,3 +1,3 @@
714 a
714 a
715 -m1
715 -m1
716 -m2
716 -m2
717 +3
717 +3
718 +b1
718 +b1
719 diff --git a/x/y b/x/y
719 diff --git a/x/y b/x/y
720 deleted file mode 100644
720 deleted file mode 100644
721 --- a/x/y
721 --- a/x/y
722 +++ /dev/null
722 +++ /dev/null
723 @@ -1,1 +0,0 @@
723 @@ -1,1 +0,0 @@
724 -y1
724 -y1
725
725
726 # parent to branch:
726 # parent to branch:
727
727
728 % hg st -C --rev . --rev 2
728 % hg st -C --rev . --rev 2
729 M a
729 M a
730 A x/y
730 A x/y
731 R b
731 R b
732
732
733 % hg diff --git --rev . --rev 2
733 % hg diff --git --rev . --rev 2
734 diff --git a/a b/a
734 diff --git a/a b/a
735 --- a/a
735 --- a/a
736 +++ b/a
736 +++ b/a
737 @@ -1,2 +1,3 @@
737 @@ -1,2 +1,3 @@
738 a
738 a
739 -3
739 -3
740 +m1
740 +m1
741 +m2
741 +m2
742 diff --git a/b b/b
742 diff --git a/b b/b
743 deleted file mode 100644
743 deleted file mode 100644
744 --- a/b
744 --- a/b
745 +++ /dev/null
745 +++ /dev/null
746 @@ -1,3 +0,0 @@
746 @@ -1,3 +0,0 @@
747 -a
747 -a
748 -3
748 -3
749 -b1
749 -b1
750 diff --git a/x/y b/x/y
750 diff --git a/x/y b/x/y
751 new file mode 100644
751 new file mode 100644
752 --- /dev/null
752 --- /dev/null
753 +++ b/x/y
753 +++ b/x/y
754 @@ -0,0 +1,1 @@
754 @@ -0,0 +1,1 @@
755 +y1
755 +y1
756
756
757
757
758 rename chain
758 rename chain
759
759
760 $ tb "hg mv a b" "hg mv b c" "hg mv c d"
760 $ tb "hg mv a b" "hg mv b c" "hg mv c d"
761 % add a 4
761 % add a 4
762 % hg ci -m t0
762 % hg ci -m t0
763 created new head
763 created new head
764 % hg mv a b
764 % hg mv a b
765 % hg ci -m t1
765 % hg ci -m t1
766 % hg mv b c
766 % hg mv b c
767 % hg ci -m t2
767 % hg ci -m t2
768 % hg mv c d
768 % hg mv c d
769
769
770 # working to parent:
770 # working to parent:
771
771
772 % hg st -C
772 % hg st -C
773 A d
773 A d
774 c
774 c
775 R c
775 R c
776
776
777 % hg diff --git
777 % hg diff --git
778 diff --git a/c b/d
778 diff --git a/c b/d
779 rename from c
779 rename from c
780 rename to d
780 rename to d
781
781
782 # working to root:
782 # working to root:
783
783
784 % hg st -C --rev 0
784 % hg st -C --rev 0
785 A d
785 A d
786 a
786 a
787 R a
787 R a
788
788
789 % hg diff --git --rev 0
789 % hg diff --git --rev 0
790 diff --git a/a b/d
790 diff --git a/a b/d
791 rename from a
791 rename from a
792 rename to d
792 rename to d
793 --- a/a
793 --- a/a
794 +++ b/d
794 +++ b/d
795 @@ -1,1 +1,2 @@
795 @@ -1,1 +1,2 @@
796 a
796 a
797 +4
797 +4
798
798
799 # working to branch:
799 # working to branch:
800
800
801 % hg st -C --rev 2
801 % hg st -C --rev 2
802 A d
802 A d
803 a
803 a
804 R a
804 R a
805 R x/y
805 R x/y
806
806
807 % hg diff --git --rev 2
807 % hg diff --git --rev 2
808 diff --git a/a b/d
808 diff --git a/a b/d
809 rename from a
809 rename from a
810 rename to d
810 rename to d
811 --- a/a
811 --- a/a
812 +++ b/d
812 +++ b/d
813 @@ -1,3 +1,2 @@
813 @@ -1,3 +1,2 @@
814 a
814 a
815 -m1
815 -m1
816 -m2
816 -m2
817 +4
817 +4
818 diff --git a/x/y b/x/y
818 diff --git a/x/y b/x/y
819 deleted file mode 100644
819 deleted file mode 100644
820 --- a/x/y
820 --- a/x/y
821 +++ /dev/null
821 +++ /dev/null
822 @@ -1,1 +0,0 @@
822 @@ -1,1 +0,0 @@
823 -y1
823 -y1
824
824
825 # root to parent:
825 # root to parent:
826
826
827 % hg st -C --rev 0 --rev .
827 % hg st -C --rev 0 --rev .
828 A c
828 A c
829 a
829 a
830 R a
830 R a
831
831
832 % hg diff --git --rev 0 --rev .
832 % hg diff --git --rev 0 --rev .
833 diff --git a/a b/c
833 diff --git a/a b/c
834 rename from a
834 rename from a
835 rename to c
835 rename to c
836 --- a/a
836 --- a/a
837 +++ b/c
837 +++ b/c
838 @@ -1,1 +1,2 @@
838 @@ -1,1 +1,2 @@
839 a
839 a
840 +4
840 +4
841
841
842 # parent to root:
842 # parent to root:
843
843
844 % hg st -C --rev . --rev 0
844 % hg st -C --rev . --rev 0
845 A a
845 A a
846 c
846 c
847 R c
847 R c
848
848
849 % hg diff --git --rev . --rev 0
849 % hg diff --git --rev . --rev 0
850 diff --git a/c b/a
850 diff --git a/c b/a
851 rename from c
851 rename from c
852 rename to a
852 rename to a
853 --- a/c
853 --- a/c
854 +++ b/a
854 +++ b/a
855 @@ -1,2 +1,1 @@
855 @@ -1,2 +1,1 @@
856 a
856 a
857 -4
857 -4
858
858
859 # branch to parent:
859 # branch to parent:
860
860
861 % hg st -C --rev 2 --rev .
861 % hg st -C --rev 2 --rev .
862 A c
862 A c
863 a
863 a
864 R a
864 R a
865 R x/y
865 R x/y
866
866
867 % hg diff --git --rev 2 --rev .
867 % hg diff --git --rev 2 --rev .
868 diff --git a/a b/c
868 diff --git a/a b/c
869 rename from a
869 rename from a
870 rename to c
870 rename to c
871 --- a/a
871 --- a/a
872 +++ b/c
872 +++ b/c
873 @@ -1,3 +1,2 @@
873 @@ -1,3 +1,2 @@
874 a
874 a
875 -m1
875 -m1
876 -m2
876 -m2
877 +4
877 +4
878 diff --git a/x/y b/x/y
878 diff --git a/x/y b/x/y
879 deleted file mode 100644
879 deleted file mode 100644
880 --- a/x/y
880 --- a/x/y
881 +++ /dev/null
881 +++ /dev/null
882 @@ -1,1 +0,0 @@
882 @@ -1,1 +0,0 @@
883 -y1
883 -y1
884
884
885 # parent to branch:
885 # parent to branch:
886
886
887 % hg st -C --rev . --rev 2
887 % hg st -C --rev . --rev 2
888 A a
888 A a
889 c
889 c
890 A x/y
890 A x/y
891 R c
891 R c
892
892
893 % hg diff --git --rev . --rev 2
893 % hg diff --git --rev . --rev 2
894 diff --git a/c b/a
894 diff --git a/c b/a
895 rename from c
895 rename from c
896 rename to a
896 rename to a
897 --- a/c
897 --- a/c
898 +++ b/a
898 +++ b/a
899 @@ -1,2 +1,3 @@
899 @@ -1,2 +1,3 @@
900 a
900 a
901 -4
901 -4
902 +m1
902 +m1
903 +m2
903 +m2
904 diff --git a/x/y b/x/y
904 diff --git a/x/y b/x/y
905 new file mode 100644
905 new file mode 100644
906 --- /dev/null
906 --- /dev/null
907 +++ b/x/y
907 +++ b/x/y
908 @@ -0,0 +1,1 @@
908 @@ -0,0 +1,1 @@
909 +y1
909 +y1
910
910
911
911
912 copy chain
912 copy chain
913
913
914 $ tb "hg cp a b" "hg cp b c" "hg cp c d"
914 $ tb "hg cp a b" "hg cp b c" "hg cp c d"
915 % add a 5
915 % add a 5
916 % hg ci -m t0
916 % hg ci -m t0
917 created new head
917 created new head
918 % hg cp a b
918 % hg cp a b
919 % hg ci -m t1
919 % hg ci -m t1
920 % hg cp b c
920 % hg cp b c
921 % hg ci -m t2
921 % hg ci -m t2
922 % hg cp c d
922 % hg cp c d
923
923
924 # working to parent:
924 # working to parent:
925
925
926 % hg st -C
926 % hg st -C
927 A d
927 A d
928 c
928 c
929
929
930 % hg diff --git
930 % hg diff --git
931 diff --git a/c b/d
931 diff --git a/c b/d
932 copy from c
932 copy from c
933 copy to d
933 copy to d
934
934
935 # working to root:
935 # working to root:
936
936
937 % hg st -C --rev 0
937 % hg st -C --rev 0
938 M a
938 M a
939 A b
939 A b
940 a
940 a
941 A c
941 A c
942 a
942 a
943 A d
943 A d
944 a
944 a
945
945
946 % hg diff --git --rev 0
946 % hg diff --git --rev 0
947 diff --git a/a b/a
947 diff --git a/a b/a
948 --- a/a
948 --- a/a
949 +++ b/a
949 +++ b/a
950 @@ -1,1 +1,2 @@
950 @@ -1,1 +1,2 @@
951 a
951 a
952 +5
952 +5
953 diff --git a/a b/b
953 diff --git a/a b/b
954 copy from a
954 copy from a
955 copy to b
955 copy to b
956 --- a/a
956 --- a/a
957 +++ b/b
957 +++ b/b
958 @@ -1,1 +1,2 @@
958 @@ -1,1 +1,2 @@
959 a
959 a
960 +5
960 +5
961 diff --git a/a b/c
961 diff --git a/a b/c
962 copy from a
962 copy from a
963 copy to c
963 copy to c
964 --- a/a
964 --- a/a
965 +++ b/c
965 +++ b/c
966 @@ -1,1 +1,2 @@
966 @@ -1,1 +1,2 @@
967 a
967 a
968 +5
968 +5
969 diff --git a/a b/d
969 diff --git a/a b/d
970 copy from a
970 copy from a
971 copy to d
971 copy to d
972 --- a/a
972 --- a/a
973 +++ b/d
973 +++ b/d
974 @@ -1,1 +1,2 @@
974 @@ -1,1 +1,2 @@
975 a
975 a
976 +5
976 +5
977
977
978 # working to branch:
978 # working to branch:
979
979
980 % hg st -C --rev 2
980 % hg st -C --rev 2
981 M a
981 M a
982 A b
982 A b
983 a
983 a
984 A c
984 A c
985 a
985 a
986 A d
986 A d
987 a
987 a
988 R x/y
988 R x/y
989
989
990 % hg diff --git --rev 2
990 % hg diff --git --rev 2
991 diff --git a/a b/a
991 diff --git a/a b/a
992 --- a/a
992 --- a/a
993 +++ b/a
993 +++ b/a
994 @@ -1,3 +1,2 @@
994 @@ -1,3 +1,2 @@
995 a
995 a
996 -m1
996 -m1
997 -m2
997 -m2
998 +5
998 +5
999 diff --git a/a b/b
999 diff --git a/a b/b
1000 copy from a
1000 copy from a
1001 copy to b
1001 copy to b
1002 --- a/a
1002 --- a/a
1003 +++ b/b
1003 +++ b/b
1004 @@ -1,3 +1,2 @@
1004 @@ -1,3 +1,2 @@
1005 a
1005 a
1006 -m1
1006 -m1
1007 -m2
1007 -m2
1008 +5
1008 +5
1009 diff --git a/a b/c
1009 diff --git a/a b/c
1010 copy from a
1010 copy from a
1011 copy to c
1011 copy to c
1012 --- a/a
1012 --- a/a
1013 +++ b/c
1013 +++ b/c
1014 @@ -1,3 +1,2 @@
1014 @@ -1,3 +1,2 @@
1015 a
1015 a
1016 -m1
1016 -m1
1017 -m2
1017 -m2
1018 +5
1018 +5
1019 diff --git a/a b/d
1019 diff --git a/a b/d
1020 copy from a
1020 copy from a
1021 copy to d
1021 copy to d
1022 --- a/a
1022 --- a/a
1023 +++ b/d
1023 +++ b/d
1024 @@ -1,3 +1,2 @@
1024 @@ -1,3 +1,2 @@
1025 a
1025 a
1026 -m1
1026 -m1
1027 -m2
1027 -m2
1028 +5
1028 +5
1029 diff --git a/x/y b/x/y
1029 diff --git a/x/y b/x/y
1030 deleted file mode 100644
1030 deleted file mode 100644
1031 --- a/x/y
1031 --- a/x/y
1032 +++ /dev/null
1032 +++ /dev/null
1033 @@ -1,1 +0,0 @@
1033 @@ -1,1 +0,0 @@
1034 -y1
1034 -y1
1035
1035
1036 # root to parent:
1036 # root to parent:
1037
1037
1038 % hg st -C --rev 0 --rev .
1038 % hg st -C --rev 0 --rev .
1039 M a
1039 M a
1040 A b
1040 A b
1041 a
1041 a
1042 A c
1042 A c
1043 a
1043 a
1044
1044
1045 % hg diff --git --rev 0 --rev .
1045 % hg diff --git --rev 0 --rev .
1046 diff --git a/a b/a
1046 diff --git a/a b/a
1047 --- a/a
1047 --- a/a
1048 +++ b/a
1048 +++ b/a
1049 @@ -1,1 +1,2 @@
1049 @@ -1,1 +1,2 @@
1050 a
1050 a
1051 +5
1051 +5
1052 diff --git a/a b/b
1052 diff --git a/a b/b
1053 copy from a
1053 copy from a
1054 copy to b
1054 copy to b
1055 --- a/a
1055 --- a/a
1056 +++ b/b
1056 +++ b/b
1057 @@ -1,1 +1,2 @@
1057 @@ -1,1 +1,2 @@
1058 a
1058 a
1059 +5
1059 +5
1060 diff --git a/a b/c
1060 diff --git a/a b/c
1061 copy from a
1061 copy from a
1062 copy to c
1062 copy to c
1063 --- a/a
1063 --- a/a
1064 +++ b/c
1064 +++ b/c
1065 @@ -1,1 +1,2 @@
1065 @@ -1,1 +1,2 @@
1066 a
1066 a
1067 +5
1067 +5
1068
1068
1069 # parent to root:
1069 # parent to root:
1070
1070
1071 % hg st -C --rev . --rev 0
1071 % hg st -C --rev . --rev 0
1072 M a
1072 M a
1073 R b
1073 R b
1074 R c
1074 R c
1075
1075
1076 % hg diff --git --rev . --rev 0
1076 % hg diff --git --rev . --rev 0
1077 diff --git a/a b/a
1077 diff --git a/a b/a
1078 --- a/a
1078 --- a/a
1079 +++ b/a
1079 +++ b/a
1080 @@ -1,2 +1,1 @@
1080 @@ -1,2 +1,1 @@
1081 a
1081 a
1082 -5
1082 -5
1083 diff --git a/b b/b
1083 diff --git a/b b/b
1084 deleted file mode 100644
1084 deleted file mode 100644
1085 --- a/b
1085 --- a/b
1086 +++ /dev/null
1086 +++ /dev/null
1087 @@ -1,2 +0,0 @@
1087 @@ -1,2 +0,0 @@
1088 -a
1088 -a
1089 -5
1089 -5
1090 diff --git a/c b/c
1090 diff --git a/c b/c
1091 deleted file mode 100644
1091 deleted file mode 100644
1092 --- a/c
1092 --- a/c
1093 +++ /dev/null
1093 +++ /dev/null
1094 @@ -1,2 +0,0 @@
1094 @@ -1,2 +0,0 @@
1095 -a
1095 -a
1096 -5
1096 -5
1097
1097
1098 # branch to parent:
1098 # branch to parent:
1099
1099
1100 % hg st -C --rev 2 --rev .
1100 % hg st -C --rev 2 --rev .
1101 M a
1101 M a
1102 A b
1102 A b
1103 a
1103 a
1104 A c
1104 A c
1105 a
1105 a
1106 R x/y
1106 R x/y
1107
1107
1108 % hg diff --git --rev 2 --rev .
1108 % hg diff --git --rev 2 --rev .
1109 diff --git a/a b/a
1109 diff --git a/a b/a
1110 --- a/a
1110 --- a/a
1111 +++ b/a
1111 +++ b/a
1112 @@ -1,3 +1,2 @@
1112 @@ -1,3 +1,2 @@
1113 a
1113 a
1114 -m1
1114 -m1
1115 -m2
1115 -m2
1116 +5
1116 +5
1117 diff --git a/a b/b
1117 diff --git a/a b/b
1118 copy from a
1118 copy from a
1119 copy to b
1119 copy to b
1120 --- a/a
1120 --- a/a
1121 +++ b/b
1121 +++ b/b
1122 @@ -1,3 +1,2 @@
1122 @@ -1,3 +1,2 @@
1123 a
1123 a
1124 -m1
1124 -m1
1125 -m2
1125 -m2
1126 +5
1126 +5
1127 diff --git a/a b/c
1127 diff --git a/a b/c
1128 copy from a
1128 copy from a
1129 copy to c
1129 copy to c
1130 --- a/a
1130 --- a/a
1131 +++ b/c
1131 +++ b/c
1132 @@ -1,3 +1,2 @@
1132 @@ -1,3 +1,2 @@
1133 a
1133 a
1134 -m1
1134 -m1
1135 -m2
1135 -m2
1136 +5
1136 +5
1137 diff --git a/x/y b/x/y
1137 diff --git a/x/y b/x/y
1138 deleted file mode 100644
1138 deleted file mode 100644
1139 --- a/x/y
1139 --- a/x/y
1140 +++ /dev/null
1140 +++ /dev/null
1141 @@ -1,1 +0,0 @@
1141 @@ -1,1 +0,0 @@
1142 -y1
1142 -y1
1143
1143
1144 # parent to branch:
1144 # parent to branch:
1145
1145
1146 % hg st -C --rev . --rev 2
1146 % hg st -C --rev . --rev 2
1147 M a
1147 M a
1148 A x/y
1148 A x/y
1149 R b
1149 R b
1150 R c
1150 R c
1151
1151
1152 % hg diff --git --rev . --rev 2
1152 % hg diff --git --rev . --rev 2
1153 diff --git a/a b/a
1153 diff --git a/a b/a
1154 --- a/a
1154 --- a/a
1155 +++ b/a
1155 +++ b/a
1156 @@ -1,2 +1,3 @@
1156 @@ -1,2 +1,3 @@
1157 a
1157 a
1158 -5
1158 -5
1159 +m1
1159 +m1
1160 +m2
1160 +m2
1161 diff --git a/b b/b
1161 diff --git a/b b/b
1162 deleted file mode 100644
1162 deleted file mode 100644
1163 --- a/b
1163 --- a/b
1164 +++ /dev/null
1164 +++ /dev/null
1165 @@ -1,2 +0,0 @@
1165 @@ -1,2 +0,0 @@
1166 -a
1166 -a
1167 -5
1167 -5
1168 diff --git a/c b/c
1168 diff --git a/c b/c
1169 deleted file mode 100644
1169 deleted file mode 100644
1170 --- a/c
1170 --- a/c
1171 +++ /dev/null
1171 +++ /dev/null
1172 @@ -1,2 +0,0 @@
1172 @@ -1,2 +0,0 @@
1173 -a
1173 -a
1174 -5
1174 -5
1175 diff --git a/x/y b/x/y
1175 diff --git a/x/y b/x/y
1176 new file mode 100644
1176 new file mode 100644
1177 --- /dev/null
1177 --- /dev/null
1178 +++ b/x/y
1178 +++ b/x/y
1179 @@ -0,0 +1,1 @@
1179 @@ -0,0 +1,1 @@
1180 +y1
1180 +y1
1181
1181
1182
1182
1183 circular rename
1183 circular rename
1184
1184
1185 $ tb "add a a1" "hg mv a b" "hg mv b a"
1185 $ tb "add a a1" "hg mv a b" "hg mv b a"
1186 % add a 6
1186 % add a 6
1187 % hg ci -m t0
1187 % hg ci -m t0
1188 created new head
1188 created new head
1189 % add a a1
1189 % add a a1
1190 % hg ci -m t1
1190 % hg ci -m t1
1191 % hg mv a b
1191 % hg mv a b
1192 % hg ci -m t2
1192 % hg ci -m t2
1193 % hg mv b a
1193 % hg mv b a
1194
1194
1195 # working to parent:
1195 # working to parent:
1196
1196
1197 % hg st -C
1197 % hg st -C
1198 A a
1198 A a
1199 b
1199 b
1200 R b
1200 R b
1201
1201
1202 % hg diff --git
1202 % hg diff --git
1203 diff --git a/b b/a
1203 diff --git a/b b/a
1204 rename from b
1204 rename from b
1205 rename to a
1205 rename to a
1206
1206
1207 # working to root:
1207 # working to root:
1208
1208
1209 % hg st -C --rev 0
1209 % hg st -C --rev 0
1210 M a
1210 M a
1211
1211
1212 % hg diff --git --rev 0
1212 % hg diff --git --rev 0
1213 diff --git a/a b/a
1213 diff --git a/a b/a
1214 --- a/a
1214 --- a/a
1215 +++ b/a
1215 +++ b/a
1216 @@ -1,1 +1,3 @@
1216 @@ -1,1 +1,3 @@
1217 a
1217 a
1218 +6
1218 +6
1219 +a1
1219 +a1
1220
1220
1221 # working to branch:
1221 # working to branch:
1222
1222
1223 % hg st -C --rev 2
1223 % hg st -C --rev 2
1224 M a
1224 M a
1225 R x/y
1225 R x/y
1226
1226
1227 % hg diff --git --rev 2
1227 % hg diff --git --rev 2
1228 diff --git a/a b/a
1228 diff --git a/a b/a
1229 --- a/a
1229 --- a/a
1230 +++ b/a
1230 +++ b/a
1231 @@ -1,3 +1,3 @@
1231 @@ -1,3 +1,3 @@
1232 a
1232 a
1233 -m1
1233 -m1
1234 -m2
1234 -m2
1235 +6
1235 +6
1236 +a1
1236 +a1
1237 diff --git a/x/y b/x/y
1237 diff --git a/x/y b/x/y
1238 deleted file mode 100644
1238 deleted file mode 100644
1239 --- a/x/y
1239 --- a/x/y
1240 +++ /dev/null
1240 +++ /dev/null
1241 @@ -1,1 +0,0 @@
1241 @@ -1,1 +0,0 @@
1242 -y1
1242 -y1
1243
1243
1244 # root to parent:
1244 # root to parent:
1245
1245
1246 % hg st -C --rev 0 --rev .
1246 % hg st -C --rev 0 --rev .
1247 A b
1247 A b
1248 a
1248 a
1249 R a
1249 R a
1250
1250
1251 % hg diff --git --rev 0 --rev .
1251 % hg diff --git --rev 0 --rev .
1252 diff --git a/a b/b
1252 diff --git a/a b/b
1253 rename from a
1253 rename from a
1254 rename to b
1254 rename to b
1255 --- a/a
1255 --- a/a
1256 +++ b/b
1256 +++ b/b
1257 @@ -1,1 +1,3 @@
1257 @@ -1,1 +1,3 @@
1258 a
1258 a
1259 +6
1259 +6
1260 +a1
1260 +a1
1261
1261
1262 # parent to root:
1262 # parent to root:
1263
1263
1264 % hg st -C --rev . --rev 0
1264 % hg st -C --rev . --rev 0
1265 A a
1265 A a
1266 b
1266 b
1267 R b
1267 R b
1268
1268
1269 % hg diff --git --rev . --rev 0
1269 % hg diff --git --rev . --rev 0
1270 diff --git a/b b/a
1270 diff --git a/b b/a
1271 rename from b
1271 rename from b
1272 rename to a
1272 rename to a
1273 --- a/b
1273 --- a/b
1274 +++ b/a
1274 +++ b/a
1275 @@ -1,3 +1,1 @@
1275 @@ -1,3 +1,1 @@
1276 a
1276 a
1277 -6
1277 -6
1278 -a1
1278 -a1
1279
1279
1280 # branch to parent:
1280 # branch to parent:
1281
1281
1282 % hg st -C --rev 2 --rev .
1282 % hg st -C --rev 2 --rev .
1283 A b
1283 A b
1284 a
1284 a
1285 R a
1285 R a
1286 R x/y
1286 R x/y
1287
1287
1288 % hg diff --git --rev 2 --rev .
1288 % hg diff --git --rev 2 --rev .
1289 diff --git a/a b/b
1289 diff --git a/a b/b
1290 rename from a
1290 rename from a
1291 rename to b
1291 rename to b
1292 --- a/a
1292 --- a/a
1293 +++ b/b
1293 +++ b/b
1294 @@ -1,3 +1,3 @@
1294 @@ -1,3 +1,3 @@
1295 a
1295 a
1296 -m1
1296 -m1
1297 -m2
1297 -m2
1298 +6
1298 +6
1299 +a1
1299 +a1
1300 diff --git a/x/y b/x/y
1300 diff --git a/x/y b/x/y
1301 deleted file mode 100644
1301 deleted file mode 100644
1302 --- a/x/y
1302 --- a/x/y
1303 +++ /dev/null
1303 +++ /dev/null
1304 @@ -1,1 +0,0 @@
1304 @@ -1,1 +0,0 @@
1305 -y1
1305 -y1
1306
1306
1307 # parent to branch:
1307 # parent to branch:
1308
1308
1309 % hg st -C --rev . --rev 2
1309 % hg st -C --rev . --rev 2
1310 A a
1310 A a
1311 b
1311 b
1312 A x/y
1312 A x/y
1313 R b
1313 R b
1314
1314
1315 % hg diff --git --rev . --rev 2
1315 % hg diff --git --rev . --rev 2
1316 diff --git a/b b/a
1316 diff --git a/b b/a
1317 rename from b
1317 rename from b
1318 rename to a
1318 rename to a
1319 --- a/b
1319 --- a/b
1320 +++ b/a
1320 +++ b/a
1321 @@ -1,3 +1,3 @@
1321 @@ -1,3 +1,3 @@
1322 a
1322 a
1323 -6
1323 -6
1324 -a1
1324 -a1
1325 +m1
1325 +m1
1326 +m2
1326 +m2
1327 diff --git a/x/y b/x/y
1327 diff --git a/x/y b/x/y
1328 new file mode 100644
1328 new file mode 100644
1329 --- /dev/null
1329 --- /dev/null
1330 +++ b/x/y
1330 +++ b/x/y
1331 @@ -0,0 +1,1 @@
1331 @@ -0,0 +1,1 @@
1332 +y1
1332 +y1
1333
1333
1334
1334
1335 directory move
1335 directory move
1336
1336
1337 $ tb "hg mv x y" "add y/x x1" "add y/x x2"
1337 $ tb "hg mv x y" "add y/x x1" "add y/x x2"
1338 % add a 7
1338 % add a 7
1339 % hg ci -m t0
1339 % hg ci -m t0
1340 created new head
1340 created new head
1341 % hg mv x y
1341 % hg mv x y
1342 moving x/x to y/x
1342 moving x/x to y/x
1343 % hg ci -m t1
1343 % hg ci -m t1
1344 % add y/x x1
1344 % add y/x x1
1345 % hg ci -m t2
1345 % hg ci -m t2
1346 % add y/x x2
1346 % add y/x x2
1347
1347
1348 # working to parent:
1348 # working to parent:
1349
1349
1350 % hg st -C
1350 % hg st -C
1351 M y/x
1351 M y/x
1352
1352
1353 % hg diff --git
1353 % hg diff --git
1354 diff --git a/y/x b/y/x
1354 diff --git a/y/x b/y/x
1355 --- a/y/x
1355 --- a/y/x
1356 +++ b/y/x
1356 +++ b/y/x
1357 @@ -1,2 +1,3 @@
1357 @@ -1,2 +1,3 @@
1358 x
1358 x
1359 x1
1359 x1
1360 +x2
1360 +x2
1361
1361
1362 # working to root:
1362 # working to root:
1363
1363
1364 % hg st -C --rev 0
1364 % hg st -C --rev 0
1365 M a
1365 M a
1366 A y/x
1366 A y/x
1367 x/x
1367 x/x
1368 R x/x
1368 R x/x
1369
1369
1370 % hg diff --git --rev 0
1370 % hg diff --git --rev 0
1371 diff --git a/a b/a
1371 diff --git a/a b/a
1372 --- a/a
1372 --- a/a
1373 +++ b/a
1373 +++ b/a
1374 @@ -1,1 +1,2 @@
1374 @@ -1,1 +1,2 @@
1375 a
1375 a
1376 +7
1376 +7
1377 diff --git a/x/x b/y/x
1377 diff --git a/x/x b/y/x
1378 rename from x/x
1378 rename from x/x
1379 rename to y/x
1379 rename to y/x
1380 --- a/x/x
1380 --- a/x/x
1381 +++ b/y/x
1381 +++ b/y/x
1382 @@ -1,1 +1,3 @@
1382 @@ -1,1 +1,3 @@
1383 x
1383 x
1384 +x1
1384 +x1
1385 +x2
1385 +x2
1386
1386
1387 # working to branch:
1387 # working to branch:
1388
1388
1389 % hg st -C --rev 2
1389 % hg st -C --rev 2
1390 M a
1390 M a
1391 A y/x
1391 A y/x
1392 x/x
1392 x/x
1393 R x/x
1393 R x/x
1394 R x/y
1394 R x/y
1395
1395
1396 % hg diff --git --rev 2
1396 % hg diff --git --rev 2
1397 diff --git a/a b/a
1397 diff --git a/a b/a
1398 --- a/a
1398 --- a/a
1399 +++ b/a
1399 +++ b/a
1400 @@ -1,3 +1,2 @@
1400 @@ -1,3 +1,2 @@
1401 a
1401 a
1402 -m1
1402 -m1
1403 -m2
1403 -m2
1404 +7
1404 +7
1405 diff --git a/x/y b/x/y
1405 diff --git a/x/y b/x/y
1406 deleted file mode 100644
1406 deleted file mode 100644
1407 --- a/x/y
1407 --- a/x/y
1408 +++ /dev/null
1408 +++ /dev/null
1409 @@ -1,1 +0,0 @@
1409 @@ -1,1 +0,0 @@
1410 -y1
1410 -y1
1411 diff --git a/x/x b/y/x
1411 diff --git a/x/x b/y/x
1412 rename from x/x
1412 rename from x/x
1413 rename to y/x
1413 rename to y/x
1414 --- a/x/x
1414 --- a/x/x
1415 +++ b/y/x
1415 +++ b/y/x
1416 @@ -1,1 +1,3 @@
1416 @@ -1,1 +1,3 @@
1417 x
1417 x
1418 +x1
1418 +x1
1419 +x2
1419 +x2
1420
1420
1421 # root to parent:
1421 # root to parent:
1422
1422
1423 % hg st -C --rev 0 --rev .
1423 % hg st -C --rev 0 --rev .
1424 M a
1424 M a
1425 A y/x
1425 A y/x
1426 x/x
1426 x/x
1427 R x/x
1427 R x/x
1428
1428
1429 % hg diff --git --rev 0 --rev .
1429 % hg diff --git --rev 0 --rev .
1430 diff --git a/a b/a
1430 diff --git a/a b/a
1431 --- a/a
1431 --- a/a
1432 +++ b/a
1432 +++ b/a
1433 @@ -1,1 +1,2 @@
1433 @@ -1,1 +1,2 @@
1434 a
1434 a
1435 +7
1435 +7
1436 diff --git a/x/x b/y/x
1436 diff --git a/x/x b/y/x
1437 rename from x/x
1437 rename from x/x
1438 rename to y/x
1438 rename to y/x
1439 --- a/x/x
1439 --- a/x/x
1440 +++ b/y/x
1440 +++ b/y/x
1441 @@ -1,1 +1,2 @@
1441 @@ -1,1 +1,2 @@
1442 x
1442 x
1443 +x1
1443 +x1
1444
1444
1445 # parent to root:
1445 # parent to root:
1446
1446
1447 % hg st -C --rev . --rev 0
1447 % hg st -C --rev . --rev 0
1448 M a
1448 M a
1449 A x/x
1449 A x/x
1450 y/x
1450 y/x
1451 R y/x
1451 R y/x
1452
1452
1453 % hg diff --git --rev . --rev 0
1453 % hg diff --git --rev . --rev 0
1454 diff --git a/a b/a
1454 diff --git a/a b/a
1455 --- a/a
1455 --- a/a
1456 +++ b/a
1456 +++ b/a
1457 @@ -1,2 +1,1 @@
1457 @@ -1,2 +1,1 @@
1458 a
1458 a
1459 -7
1459 -7
1460 diff --git a/y/x b/x/x
1460 diff --git a/y/x b/x/x
1461 rename from y/x
1461 rename from y/x
1462 rename to x/x
1462 rename to x/x
1463 --- a/y/x
1463 --- a/y/x
1464 +++ b/x/x
1464 +++ b/x/x
1465 @@ -1,2 +1,1 @@
1465 @@ -1,2 +1,1 @@
1466 x
1466 x
1467 -x1
1467 -x1
1468
1468
1469 # branch to parent:
1469 # branch to parent:
1470
1470
1471 % hg st -C --rev 2 --rev .
1471 % hg st -C --rev 2 --rev .
1472 M a
1472 M a
1473 A y/x
1473 A y/x
1474 x/x
1474 x/x
1475 R x/x
1475 R x/x
1476 R x/y
1476 R x/y
1477
1477
1478 % hg diff --git --rev 2 --rev .
1478 % hg diff --git --rev 2 --rev .
1479 diff --git a/a b/a
1479 diff --git a/a b/a
1480 --- a/a
1480 --- a/a
1481 +++ b/a
1481 +++ b/a
1482 @@ -1,3 +1,2 @@
1482 @@ -1,3 +1,2 @@
1483 a
1483 a
1484 -m1
1484 -m1
1485 -m2
1485 -m2
1486 +7
1486 +7
1487 diff --git a/x/y b/x/y
1487 diff --git a/x/y b/x/y
1488 deleted file mode 100644
1488 deleted file mode 100644
1489 --- a/x/y
1489 --- a/x/y
1490 +++ /dev/null
1490 +++ /dev/null
1491 @@ -1,1 +0,0 @@
1491 @@ -1,1 +0,0 @@
1492 -y1
1492 -y1
1493 diff --git a/x/x b/y/x
1493 diff --git a/x/x b/y/x
1494 rename from x/x
1494 rename from x/x
1495 rename to y/x
1495 rename to y/x
1496 --- a/x/x
1496 --- a/x/x
1497 +++ b/y/x
1497 +++ b/y/x
1498 @@ -1,1 +1,2 @@
1498 @@ -1,1 +1,2 @@
1499 x
1499 x
1500 +x1
1500 +x1
1501
1501
1502 # parent to branch:
1502 # parent to branch:
1503
1503
1504 % hg st -C --rev . --rev 2
1504 % hg st -C --rev . --rev 2
1505 M a
1505 M a
1506 A x/x
1506 A x/x
1507 y/x
1507 y/x
1508 A x/y
1508 A x/y
1509 R y/x
1509 R y/x
1510
1510
1511 % hg diff --git --rev . --rev 2
1511 % hg diff --git --rev . --rev 2
1512 diff --git a/a b/a
1512 diff --git a/a b/a
1513 --- a/a
1513 --- a/a
1514 +++ b/a
1514 +++ b/a
1515 @@ -1,2 +1,3 @@
1515 @@ -1,2 +1,3 @@
1516 a
1516 a
1517 -7
1517 -7
1518 +m1
1518 +m1
1519 +m2
1519 +m2
1520 diff --git a/y/x b/x/x
1520 diff --git a/y/x b/x/x
1521 rename from y/x
1521 rename from y/x
1522 rename to x/x
1522 rename to x/x
1523 --- a/y/x
1523 --- a/y/x
1524 +++ b/x/x
1524 +++ b/x/x
1525 @@ -1,2 +1,1 @@
1525 @@ -1,2 +1,1 @@
1526 x
1526 x
1527 -x1
1527 -x1
1528 diff --git a/x/y b/x/y
1528 diff --git a/x/y b/x/y
1529 new file mode 100644
1529 new file mode 100644
1530 --- /dev/null
1530 --- /dev/null
1531 +++ b/x/y
1531 +++ b/x/y
1532 @@ -0,0 +1,1 @@
1532 @@ -0,0 +1,1 @@
1533 +y1
1533 +y1
1534
1534
1535
1535
1536
1536
1537 Cannot implement unrelated branch with tb
1537 Cannot implement unrelated branch with tb
1538 testing copies with unrelated branch
1538 testing copies with unrelated branch
1539
1539
1540 $ hg init unrelated
1540 $ hg init unrelated
1541 $ cd unrelated
1541 $ cd unrelated
1542 $ echo a >> a
1542 $ echo a >> a
1543 $ hg ci -Am adda
1543 $ hg ci -Am adda
1544 adding a
1544 adding a
1545 $ hg mv a b
1545 $ hg mv a b
1546 $ hg ci -m movea
1546 $ hg ci -m movea
1547 $ hg up -C null
1547 $ hg up -C null
1548 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1548 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
1549 $ echo a >> a
1549 $ echo a >> a
1550 $ hg ci -Am addunrelateda
1550 $ hg ci -Am addunrelateda
1551 adding a
1551 adding a
1552 created new head
1552 created new head
1553
1553
1554 unrelated branch diff
1554 unrelated branch diff
1555
1555
1556 $ hg diff --git -r 2 -r 1
1556 $ hg diff --git -r 2 -r 1
1557 diff --git a/a b/a
1557 diff --git a/a b/a
1558 deleted file mode 100644
1558 deleted file mode 100644
1559 --- a/a
1559 --- a/a
1560 +++ /dev/null
1560 +++ /dev/null
1561 @@ -1,1 +0,0 @@
1561 @@ -1,1 +0,0 @@
1562 -a
1562 -a
1563 diff --git a/b b/b
1563 diff --git a/b b/b
1564 new file mode 100644
1564 new file mode 100644
1565 --- /dev/null
1565 --- /dev/null
1566 +++ b/b
1566 +++ b/b
1567 @@ -0,0 +1,1 @@
1567 @@ -0,0 +1,1 @@
1568 +a
1568 +a
1569 $ cd ..
1569 $ cd ..
1570
1570
1571
1571
1572 test for case where we didn't look sufficiently far back to find rename ancestor
1572 test for case where we didn't look sufficiently far back to find rename ancestor
1573
1573
1574 $ hg init diffstop
1574 $ hg init diffstop
1575 $ cd diffstop
1575 $ cd diffstop
1576 $ echo > f
1576 $ echo > f
1577 $ hg ci -qAmf
1577 $ hg ci -qAmf
1578 $ hg mv f g
1578 $ hg mv f g
1579 $ hg ci -m'f->g'
1579 $ hg ci -m'f->g'
1580 $ hg up -qr0
1580 $ hg up -qr0
1581 $ touch x
1581 $ touch x
1582 $ hg ci -qAmx
1582 $ hg ci -qAmx
1583 $ echo f > f
1583 $ echo f > f
1584 $ hg ci -qmf=f
1584 $ hg ci -qmf=f
1585 $ hg merge -q
1585 $ hg merge -q
1586 $ hg ci -mmerge
1586 $ hg ci -mmerge
1587 $ hg log -G --template '{rev} {desc}'
1587 $ hg log -G --template '{rev} {desc}'
1588 @ 4 merge
1588 @ 4 merge
1589 |\
1589 |\
1590 | o 3 f=f
1590 | o 3 f=f
1591 | |
1591 | |
1592 | o 2 x
1592 | o 2 x
1593 | |
1593 | |
1594 o | 1 f->g
1594 o | 1 f->g
1595 |/
1595 |/
1596 o 0 f
1596 o 0 f
1597
1597
1598 $ hg diff --git -r 2
1598 $ hg diff --git -r 2
1599 diff --git a/f b/g
1599 diff --git a/f b/g
1600 rename from f
1600 rename from f
1601 rename to g
1601 rename to g
1602 --- a/f
1602 --- a/f
1603 +++ b/g
1603 +++ b/g
1604 @@ -1,1 +1,1 @@
1604 @@ -1,1 +1,1 @@
1605 -
1605 -
1606 +f
1606 +f
1607 $ cd ..
1607 $ cd ..
1608
1608
1609 Additional tricky linkrev case
1609 Additional tricky linkrev case
1610 ------------------------------
1610 ------------------------------
1611
1611
1612 If the first file revision after the diff base has a linkrev pointing to a
1612 If the first file revision after the diff base has a linkrev pointing to a
1613 changeset on another branch with a revision lower that the diff base, we can
1613 changeset on another branch with a revision lower that the diff base, we can
1614 jump past the copy detection limit and fail to detect the rename.
1614 jump past the copy detection limit and fail to detect the rename.
1615
1615
1616 $ hg init diffstoplinkrev
1616 $ hg init diffstoplinkrev
1617 $ cd diffstoplinkrev
1617 $ cd diffstoplinkrev
1618
1618
1619 $ touch f
1619 $ touch f
1620 $ hg ci -Aqm 'empty f'
1620 $ hg ci -Aqm 'empty f'
1621
1621
1622 Make a simple change
1622 Make a simple change
1623
1623
1624 $ echo change > f
1624 $ echo change > f
1625 $ hg ci -m 'change f'
1625 $ hg ci -m 'change f'
1626
1626
1627 Make a rename because we want to track renames. It is also important that the
1627 Make a rename because we want to track renames. It is also important that the
1628 faulty linkrev is not only the "start" commit to ensure the linkrev will be
1628 faulty linkrev is not only the "start" commit to ensure the linkrev will be
1629 used.
1629 used.
1630
1630
1631 $ hg mv f renamed
1631 $ hg mv f renamed
1632 $ hg ci -m renamed
1632 $ hg ci -m renamed
1633
1633
1634 Make a second branch, we use a named branch to create a simple commit
1634 Make a second branch, we use a named branch to create a simple commit
1635 that does not touch f.
1635 that does not touch f.
1636
1636
1637 $ hg up -qr 'desc(empty)'
1637 $ hg up -qr 'desc(empty)'
1638 $ hg branch -q dev
1638 $ hg branch -q dev
1639 $ hg ci -Aqm dev
1639 $ hg ci -Aqm dev
1640
1640
1641 Graft the initial change and the rename. As f was untouched, we reuse the same
1641 Graft the initial change and the rename. As f was untouched, we reuse the same
1642 entry and the linkrev point to the older branch.
1642 entry and the linkrev point to the older branch.
1643
1643
1644 $ hg graft -q 'desc(change)'
1644 $ hg graft -q 'desc(change)'
1645 $ hg graft -q 'desc(renamed)'
1645 $ hg graft -q 'desc(renamed)'
1646
1646
1647 $ hg log -G -T '{rev} {desc}'
1647 $ hg log -G -T '{rev} {desc}'
1648 @ 5 renamed
1648 @ 5 renamed
1649 |
1649 |
1650 o 4 change f
1650 o 4 change f
1651 |
1651 |
1652 o 3 dev
1652 o 3 dev
1653 |
1653 |
1654 | o 2 renamed
1654 | o 2 renamed
1655 | |
1655 | |
1656 | o 1 change f
1656 | o 1 change f
1657 |/
1657 |/
1658 o 0 empty f
1658 o 0 empty f
1659
1659
1660
1660
1661 The copy tracking should still reach rev 3 (branch creation).
1661 The copy tracking should still reach rev 3 (branch creation).
1662 accessing the parent of 5 (renamed) should not jump use to revision 1.
1662 accessing the parent of 5 (renamed) should not jump use to revision 1.
1663
1663
1664 $ hg diff --git -r 'desc(dev)' -r .
1664 $ hg diff --git -r 'desc(dev)' -r .
1665 diff --git a/f b/renamed
1665 diff --git a/f b/renamed
1666 rename from f
1666 rename from f
1667 rename to renamed
1667 rename to renamed
1668 --- a/f
1668 --- a/f
1669 +++ b/renamed
1669 +++ b/renamed
1670 @@ -0,0 +1,1 @@
1670 @@ -0,0 +1,1 @@
1671 +change
1671 +change
1672
1672
1673 Check debug output for copy tracing
1673 Check debug output for copy tracing
1674
1674
1675 $ hg status --copies --rev 'desc(dev)' --rev . --config devel.debug.copies=yes --debug
1675 $ hg status --copies --rev 'desc(dev)' --rev . --config devel.debug.copies=yes --debug
1676 debug.copies: searching copies from a51f36ab1704 to 1f4aa1fd627b
1676 debug.copies: searching copies from a51f36ab1704 to 1f4aa1fd627b
1677 debug.copies: search mode: forward
1677 debug.copies: search mode: forward
1678 debug.copies: looking into rename from a51f36ab1704 to 1f4aa1fd627b
1678 debug.copies: looking into rename from a51f36ab1704 to 1f4aa1fd627b
1679 debug.copies: search limit: 3
1679 debug.copies: search limit: 3
1680 debug.copies: missing files to search: 1
1680 debug.copies: missing files to search: 1
1681 debug.copies: tracing file: renamed
1681 debug.copies: tracing file: renamed
1682 debug.copies: rename of: f
1682 debug.copies: rename of: f
1683 debug.copies: time: * seconds (glob)
1683 debug.copies: time: * seconds (glob)
1684 A renamed
1684 A renamed
1685 f
1685 f
1686 R f
1686 R f
1687
1687
1688 Check that merging across the rename works
1688 Check that merging across the rename works
1689
1689
1690 $ echo modified >> renamed
1690 $ echo modified >> renamed
1691 BROKEN: This should propagate the change to 'f'
1692 $ hg co -m 4
1691 $ hg co -m 4
1693 file 'renamed' was deleted in other [destination] but was modified in local [working copy].
1692 merging renamed and f to f
1694 What do you want to do?
1693 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
1695 use (c)hanged version, (d)elete, or leave (u)nresolved? u
1696 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
1697 use 'hg resolve' to retry unresolved file merges
1698 [1]
1699
1694
1700 $ cd ..
1695 $ cd ..
@@ -1,1031 +1,1055 b''
1
1
2 $ mkdir -p t
2 $ mkdir -p t
3 $ cd t
3 $ cd t
4 $ cat <<EOF > merge
4 $ cat <<EOF > merge
5 > import sys, os
5 > import sys, os
6 > f = open(sys.argv[1], "w")
6 > f = open(sys.argv[1], "w")
7 > f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3]))
7 > f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3]))
8 > f.close()
8 > f.close()
9 > EOF
9 > EOF
10
10
11 perform a test merge with possible renaming
11 perform a test merge with possible renaming
12 args:
12 args:
13 $1 = action in local branch
13 $1 = action in local branch
14 $2 = action in remote branch
14 $2 = action in remote branch
15 $3 = action in working dir
15 $3 = action in working dir
16 $4 = expected result
16 $4 = expected result
17
17
18 $ tm()
18 $ tm()
19 > {
19 > {
20 > hg init t
20 > hg init t
21 > cd t
21 > cd t
22 > echo "[merge]" >> .hg/hgrc
22 > echo "[merge]" >> .hg/hgrc
23 > echo "followcopies = 1" >> .hg/hgrc
23 > echo "followcopies = 1" >> .hg/hgrc
24 >
24 >
25 > # base
25 > # base
26 > echo base > a
26 > echo base > a
27 > echo base > rev # used to force commits
27 > echo base > rev # used to force commits
28 > hg add a rev
28 > hg add a rev
29 > hg ci -m "base"
29 > hg ci -m "base"
30 >
30 >
31 > # remote
31 > # remote
32 > echo remote > rev
32 > echo remote > rev
33 > if [ "$2" != "" ] ; then $2 ; fi
33 > if [ "$2" != "" ] ; then $2 ; fi
34 > hg ci -m "remote"
34 > hg ci -m "remote"
35 >
35 >
36 > # local
36 > # local
37 > hg co -q 0
37 > hg co -q 0
38 > echo local > rev
38 > echo local > rev
39 > if [ "$1" != "" ] ; then $1 ; fi
39 > if [ "$1" != "" ] ; then $1 ; fi
40 > hg ci -m "local"
40 > hg ci -m "local"
41 >
41 >
42 > # working dir
42 > # working dir
43 > echo local > rev
43 > echo local > rev
44 > if [ "$3" != "" ] ; then $3 ; fi
44 > if [ "$3" != "" ] ; then $3 ; fi
45 >
45 >
46 > # merge
46 > # merge
47 > echo "--------------"
47 > echo "--------------"
48 > echo "test L:$1 R:$2 W:$3 - $4"
48 > echo "test L:$1 R:$2 W:$3 - $4"
49 > echo "--------------"
49 > echo "--------------"
50 > hg merge -y --debug --traceback --tool="\"$PYTHON\" ../merge"
50 > hg merge -y --debug --traceback --tool="\"$PYTHON\" ../merge"
51 >
51 >
52 > echo "--------------"
52 > echo "--------------"
53 > hg status -camC -X rev
53 > hg status -camC -X rev
54 >
54 >
55 > hg ci -m "merge"
55 > hg ci -m "merge"
56 >
56 >
57 > echo "--------------"
57 > echo "--------------"
58 > echo
58 > echo
59 >
59 >
60 > cd ..
60 > cd ..
61 > rm -r t
61 > rm -r t
62 > }
62 > }
63 $ up() {
63 $ up() {
64 > cp rev $1
64 > cp rev $1
65 > hg add $1 2> /dev/null
65 > hg add $1 2> /dev/null
66 > if [ "$2" != "" ] ; then
66 > if [ "$2" != "" ] ; then
67 > cp rev $2
67 > cp rev $2
68 > hg add $2 2> /dev/null
68 > hg add $2 2> /dev/null
69 > fi
69 > fi
70 > }
70 > }
71 $ um() { up $1; hg mv $1 $2; }
71 $ um() { up $1; hg mv $1 $2; }
72 $ nc() { hg cp $1 $2; } # just copy
72 $ nc() { hg cp $1 $2; } # just copy
73 $ nm() { hg mv $1 $2; } # just move
73 $ nm() { hg mv $1 $2; } # just move
74 $ tm "up a " "nc a b" " " "1 get local a to b"
74 $ tm "up a " "nc a b" " " "1 get local a to b"
75 created new head
75 created new head
76 --------------
76 --------------
77 test L:up a R:nc a b W: - 1 get local a to b
77 test L:up a R:nc a b W: - 1 get local a to b
78 --------------
78 --------------
79 unmatched files in other:
79 unmatched files in other:
80 b
80 b
81 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
81 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
82 src: 'a' -> dst: 'b' *
82 src: 'a' -> dst: 'b' *
83 checking for directory renames
83 checking for directory renames
84 resolving manifests
84 resolving manifests
85 branchmerge: True, force: False, partial: False
85 branchmerge: True, force: False, partial: False
86 ancestor: 924404dff337, local: e300d1c794ec+, remote: 4ce40f5aca24
86 ancestor: 924404dff337, local: e300d1c794ec+, remote: 4ce40f5aca24
87 preserving a for resolve of b
87 preserving a for resolve of b
88 preserving rev for resolve of rev
88 preserving rev for resolve of rev
89 starting 4 threads for background file closing (?)
89 starting 4 threads for background file closing (?)
90 b: remote copied from a -> m (premerge)
90 b: remote copied from a -> m (premerge)
91 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
91 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
92 merging a and b to b
92 merging a and b to b
93 my b@e300d1c794ec+ other b@4ce40f5aca24 ancestor a@924404dff337
93 my b@e300d1c794ec+ other b@4ce40f5aca24 ancestor a@924404dff337
94 premerge successful
94 premerge successful
95 rev: versions differ -> m (premerge)
95 rev: versions differ -> m (premerge)
96 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
96 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
97 merging rev
97 merging rev
98 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
98 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
99 rev: versions differ -> m (merge)
99 rev: versions differ -> m (merge)
100 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
100 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
101 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
101 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
102 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
102 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
103 merge tool returned: 0
103 merge tool returned: 0
104 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
104 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
105 (branch merge, don't forget to commit)
105 (branch merge, don't forget to commit)
106 --------------
106 --------------
107 M b
107 M b
108 a
108 a
109 C a
109 C a
110 --------------
110 --------------
111
111
112 $ tm "nc a b" "up a " " " "2 get rem change to a and b"
112 $ tm "nc a b" "up a " " " "2 get rem change to a and b"
113 created new head
113 created new head
114 --------------
114 --------------
115 test L:nc a b R:up a W: - 2 get rem change to a and b
115 test L:nc a b R:up a W: - 2 get rem change to a and b
116 --------------
116 --------------
117 unmatched files in local:
117 unmatched files in local:
118 b
118 b
119 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
119 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
120 src: 'a' -> dst: 'b' *
120 src: 'a' -> dst: 'b' *
121 checking for directory renames
121 checking for directory renames
122 resolving manifests
122 resolving manifests
123 branchmerge: True, force: False, partial: False
123 branchmerge: True, force: False, partial: False
124 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: f4db7e329e71
124 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: f4db7e329e71
125 preserving b for resolve of b
125 preserving b for resolve of b
126 preserving rev for resolve of rev
126 preserving rev for resolve of rev
127 a: remote is newer -> g
127 a: remote is newer -> g
128 getting a
128 getting a
129 b: local copied/moved from a -> m (premerge)
129 b: local copied/moved from a -> m (premerge)
130 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
130 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
131 merging b and a to b
131 merging b and a to b
132 my b@86a2aa42fc76+ other a@f4db7e329e71 ancestor a@924404dff337
132 my b@86a2aa42fc76+ other a@f4db7e329e71 ancestor a@924404dff337
133 premerge successful
133 premerge successful
134 rev: versions differ -> m (premerge)
134 rev: versions differ -> m (premerge)
135 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
135 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
136 merging rev
136 merging rev
137 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
137 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
138 rev: versions differ -> m (merge)
138 rev: versions differ -> m (merge)
139 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
139 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
140 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
140 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
141 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
141 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
142 merge tool returned: 0
142 merge tool returned: 0
143 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
143 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
144 (branch merge, don't forget to commit)
144 (branch merge, don't forget to commit)
145 --------------
145 --------------
146 M a
146 M a
147 M b
147 M b
148 a
148 a
149 --------------
149 --------------
150
150
151 $ tm "up a " "nm a b" " " "3 get local a change to b, remove a"
151 $ tm "up a " "nm a b" " " "3 get local a change to b, remove a"
152 created new head
152 created new head
153 --------------
153 --------------
154 test L:up a R:nm a b W: - 3 get local a change to b, remove a
154 test L:up a R:nm a b W: - 3 get local a change to b, remove a
155 --------------
155 --------------
156 unmatched files in other:
156 unmatched files in other:
157 b
157 b
158 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
158 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
159 src: 'a' -> dst: 'b' *
159 src: 'a' -> dst: 'b' *
160 checking for directory renames
160 checking for directory renames
161 resolving manifests
161 resolving manifests
162 branchmerge: True, force: False, partial: False
162 branchmerge: True, force: False, partial: False
163 ancestor: 924404dff337, local: e300d1c794ec+, remote: bdb19105162a
163 ancestor: 924404dff337, local: e300d1c794ec+, remote: bdb19105162a
164 preserving a for resolve of b
164 preserving a for resolve of b
165 preserving rev for resolve of rev
165 preserving rev for resolve of rev
166 removing a
166 removing a
167 starting 4 threads for background file closing (?)
167 starting 4 threads for background file closing (?)
168 b: remote moved from a -> m (premerge)
168 b: remote moved from a -> m (premerge)
169 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
169 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
170 merging a and b to b
170 merging a and b to b
171 my b@e300d1c794ec+ other b@bdb19105162a ancestor a@924404dff337
171 my b@e300d1c794ec+ other b@bdb19105162a ancestor a@924404dff337
172 premerge successful
172 premerge successful
173 rev: versions differ -> m (premerge)
173 rev: versions differ -> m (premerge)
174 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
174 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
175 merging rev
175 merging rev
176 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
176 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
177 rev: versions differ -> m (merge)
177 rev: versions differ -> m (merge)
178 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
178 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
179 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
179 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
180 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
180 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
181 merge tool returned: 0
181 merge tool returned: 0
182 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
182 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
183 (branch merge, don't forget to commit)
183 (branch merge, don't forget to commit)
184 --------------
184 --------------
185 M b
185 M b
186 a
186 a
187 --------------
187 --------------
188
188
189 $ tm "nm a b" "up a " " " "4 get remote change to b"
189 $ tm "nm a b" "up a " " " "4 get remote change to b"
190 created new head
190 created new head
191 --------------
191 --------------
192 test L:nm a b R:up a W: - 4 get remote change to b
192 test L:nm a b R:up a W: - 4 get remote change to b
193 --------------
193 --------------
194 unmatched files in local:
194 unmatched files in local:
195 b
195 b
196 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
196 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
197 src: 'a' -> dst: 'b' *
197 src: 'a' -> dst: 'b' *
198 checking for directory renames
198 checking for directory renames
199 resolving manifests
199 resolving manifests
200 branchmerge: True, force: False, partial: False
200 branchmerge: True, force: False, partial: False
201 ancestor: 924404dff337, local: 02963e448370+, remote: f4db7e329e71
201 ancestor: 924404dff337, local: 02963e448370+, remote: f4db7e329e71
202 preserving b for resolve of b
202 preserving b for resolve of b
203 preserving rev for resolve of rev
203 preserving rev for resolve of rev
204 starting 4 threads for background file closing (?)
204 starting 4 threads for background file closing (?)
205 b: local copied/moved from a -> m (premerge)
205 b: local copied/moved from a -> m (premerge)
206 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
206 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
207 merging b and a to b
207 merging b and a to b
208 my b@02963e448370+ other a@f4db7e329e71 ancestor a@924404dff337
208 my b@02963e448370+ other a@f4db7e329e71 ancestor a@924404dff337
209 premerge successful
209 premerge successful
210 rev: versions differ -> m (premerge)
210 rev: versions differ -> m (premerge)
211 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
211 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
212 merging rev
212 merging rev
213 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
213 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
214 rev: versions differ -> m (merge)
214 rev: versions differ -> m (merge)
215 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
215 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
216 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
216 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
217 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
217 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
218 merge tool returned: 0
218 merge tool returned: 0
219 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
219 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
220 (branch merge, don't forget to commit)
220 (branch merge, don't forget to commit)
221 --------------
221 --------------
222 M b
222 M b
223 a
223 a
224 --------------
224 --------------
225
225
226 $ tm " " "nc a b" " " "5 get b"
226 $ tm " " "nc a b" " " "5 get b"
227 created new head
227 created new head
228 --------------
228 --------------
229 test L: R:nc a b W: - 5 get b
229 test L: R:nc a b W: - 5 get b
230 --------------
230 --------------
231 unmatched files in other:
231 unmatched files in other:
232 b
232 b
233 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
233 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
234 src: 'a' -> dst: 'b'
234 src: 'a' -> dst: 'b'
235 checking for directory renames
235 checking for directory renames
236 resolving manifests
236 resolving manifests
237 branchmerge: True, force: False, partial: False
237 branchmerge: True, force: False, partial: False
238 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: 4ce40f5aca24
238 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: 4ce40f5aca24
239 preserving rev for resolve of rev
239 preserving rev for resolve of rev
240 b: remote created -> g
240 b: remote created -> g
241 getting b
241 getting b
242 rev: versions differ -> m (premerge)
242 rev: versions differ -> m (premerge)
243 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
243 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
244 merging rev
244 merging rev
245 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
245 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
246 rev: versions differ -> m (merge)
246 rev: versions differ -> m (merge)
247 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
247 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
248 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
248 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
249 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
249 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
250 merge tool returned: 0
250 merge tool returned: 0
251 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
251 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
252 (branch merge, don't forget to commit)
252 (branch merge, don't forget to commit)
253 --------------
253 --------------
254 M b
254 M b
255 C a
255 C a
256 --------------
256 --------------
257
257
258 $ tm "nc a b" " " " " "6 nothing"
258 $ tm "nc a b" " " " " "6 nothing"
259 created new head
259 created new head
260 --------------
260 --------------
261 test L:nc a b R: W: - 6 nothing
261 test L:nc a b R: W: - 6 nothing
262 --------------
262 --------------
263 unmatched files in local:
263 unmatched files in local:
264 b
264 b
265 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
265 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
266 src: 'a' -> dst: 'b'
266 src: 'a' -> dst: 'b'
267 checking for directory renames
267 checking for directory renames
268 resolving manifests
268 resolving manifests
269 branchmerge: True, force: False, partial: False
269 branchmerge: True, force: False, partial: False
270 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 97c705ade336
270 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 97c705ade336
271 preserving rev for resolve of rev
271 preserving rev for resolve of rev
272 starting 4 threads for background file closing (?)
272 starting 4 threads for background file closing (?)
273 rev: versions differ -> m (premerge)
273 rev: versions differ -> m (premerge)
274 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
274 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
275 merging rev
275 merging rev
276 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
276 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
277 rev: versions differ -> m (merge)
277 rev: versions differ -> m (merge)
278 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
278 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
279 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
279 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
280 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
280 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
281 merge tool returned: 0
281 merge tool returned: 0
282 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
282 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
283 (branch merge, don't forget to commit)
283 (branch merge, don't forget to commit)
284 --------------
284 --------------
285 C a
285 C a
286 C b
286 C b
287 --------------
287 --------------
288
288
289 $ tm " " "nm a b" " " "7 get b"
289 $ tm " " "nm a b" " " "7 get b"
290 created new head
290 created new head
291 --------------
291 --------------
292 test L: R:nm a b W: - 7 get b
292 test L: R:nm a b W: - 7 get b
293 --------------
293 --------------
294 unmatched files in other:
294 unmatched files in other:
295 b
295 b
296 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
296 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
297 src: 'a' -> dst: 'b'
297 src: 'a' -> dst: 'b'
298 checking for directory renames
298 checking for directory renames
299 resolving manifests
299 resolving manifests
300 branchmerge: True, force: False, partial: False
300 branchmerge: True, force: False, partial: False
301 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: bdb19105162a
301 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: bdb19105162a
302 preserving rev for resolve of rev
302 preserving rev for resolve of rev
303 a: other deleted -> r
303 a: other deleted -> r
304 removing a
304 removing a
305 b: remote created -> g
305 b: remote created -> g
306 getting b
306 getting b
307 rev: versions differ -> m (premerge)
307 rev: versions differ -> m (premerge)
308 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
308 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
309 merging rev
309 merging rev
310 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
310 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
311 rev: versions differ -> m (merge)
311 rev: versions differ -> m (merge)
312 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
312 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
313 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
313 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
314 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
314 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
315 merge tool returned: 0
315 merge tool returned: 0
316 1 files updated, 1 files merged, 1 files removed, 0 files unresolved
316 1 files updated, 1 files merged, 1 files removed, 0 files unresolved
317 (branch merge, don't forget to commit)
317 (branch merge, don't forget to commit)
318 --------------
318 --------------
319 M b
319 M b
320 --------------
320 --------------
321
321
322 $ tm "nm a b" " " " " "8 nothing"
322 $ tm "nm a b" " " " " "8 nothing"
323 created new head
323 created new head
324 --------------
324 --------------
325 test L:nm a b R: W: - 8 nothing
325 test L:nm a b R: W: - 8 nothing
326 --------------
326 --------------
327 unmatched files in local:
327 unmatched files in local:
328 b
328 b
329 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
329 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
330 src: 'a' -> dst: 'b'
330 src: 'a' -> dst: 'b'
331 checking for directory renames
331 checking for directory renames
332 resolving manifests
332 resolving manifests
333 branchmerge: True, force: False, partial: False
333 branchmerge: True, force: False, partial: False
334 ancestor: 924404dff337, local: 02963e448370+, remote: 97c705ade336
334 ancestor: 924404dff337, local: 02963e448370+, remote: 97c705ade336
335 preserving rev for resolve of rev
335 preserving rev for resolve of rev
336 starting 4 threads for background file closing (?)
336 starting 4 threads for background file closing (?)
337 rev: versions differ -> m (premerge)
337 rev: versions differ -> m (premerge)
338 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
338 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
339 merging rev
339 merging rev
340 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
340 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
341 rev: versions differ -> m (merge)
341 rev: versions differ -> m (merge)
342 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
342 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
343 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
343 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
344 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
344 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
345 merge tool returned: 0
345 merge tool returned: 0
346 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
346 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
347 (branch merge, don't forget to commit)
347 (branch merge, don't forget to commit)
348 --------------
348 --------------
349 C b
349 C b
350 --------------
350 --------------
351
351
352 $ tm "um a b" "um a b" " " "9 do merge with ancestor in a"
352 $ tm "um a b" "um a b" " " "9 do merge with ancestor in a"
353 created new head
353 created new head
354 --------------
354 --------------
355 test L:um a b R:um a b W: - 9 do merge with ancestor in a
355 test L:um a b R:um a b W: - 9 do merge with ancestor in a
356 --------------
356 --------------
357 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
357 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
358 src: 'a' -> dst: 'b' *
358 src: 'a' -> dst: 'b' *
359 checking for directory renames
359 checking for directory renames
360 resolving manifests
360 resolving manifests
361 branchmerge: True, force: False, partial: False
361 branchmerge: True, force: False, partial: False
362 ancestor: 924404dff337, local: 62e7bf090eba+, remote: 49b6d8032493
362 ancestor: 924404dff337, local: 62e7bf090eba+, remote: 49b6d8032493
363 preserving b for resolve of b
363 preserving b for resolve of b
364 preserving rev for resolve of rev
364 preserving rev for resolve of rev
365 starting 4 threads for background file closing (?)
365 starting 4 threads for background file closing (?)
366 b: both renamed from a -> m (premerge)
366 b: both renamed from a -> m (premerge)
367 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
367 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
368 merging b
368 merging b
369 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
369 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
370 rev: versions differ -> m (premerge)
370 rev: versions differ -> m (premerge)
371 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
371 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
372 merging rev
372 merging rev
373 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
373 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
374 b: both renamed from a -> m (merge)
374 b: both renamed from a -> m (merge)
375 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
375 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
376 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
376 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
377 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
377 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
378 merge tool returned: 0
378 merge tool returned: 0
379 rev: versions differ -> m (merge)
379 rev: versions differ -> m (merge)
380 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
380 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
381 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
381 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
382 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
382 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
383 merge tool returned: 0
383 merge tool returned: 0
384 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
384 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
385 (branch merge, don't forget to commit)
385 (branch merge, don't forget to commit)
386 --------------
386 --------------
387 M b
387 M b
388 --------------
388 --------------
389
389
390
390
391 m "um a c" "um x c" " " "10 do merge with no ancestor"
391 m "um a c" "um x c" " " "10 do merge with no ancestor"
392
392
393 $ tm "nm a b" "nm a c" " " "11 get c, keep b"
393 $ tm "nm a b" "nm a c" " " "11 get c, keep b"
394 created new head
394 created new head
395 --------------
395 --------------
396 test L:nm a b R:nm a c W: - 11 get c, keep b
396 test L:nm a b R:nm a c W: - 11 get c, keep b
397 --------------
397 --------------
398 unmatched files in local:
398 unmatched files in local:
399 b
399 b
400 unmatched files in other:
400 unmatched files in other:
401 c
401 c
402 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
402 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
403 src: 'a' -> dst: 'b' !
403 src: 'a' -> dst: 'b' !
404 src: 'a' -> dst: 'c' !
404 src: 'a' -> dst: 'c' !
405 checking for directory renames
405 checking for directory renames
406 resolving manifests
406 resolving manifests
407 branchmerge: True, force: False, partial: False
407 branchmerge: True, force: False, partial: False
408 ancestor: 924404dff337, local: 02963e448370+, remote: fe905ef2c33e
408 ancestor: 924404dff337, local: 02963e448370+, remote: fe905ef2c33e
409 note: possible conflict - a was renamed multiple times to:
409 note: possible conflict - a was renamed multiple times to:
410 b
410 b
411 c
411 c
412 preserving rev for resolve of rev
412 preserving rev for resolve of rev
413 c: remote created -> g
413 c: remote created -> g
414 getting c
414 getting c
415 rev: versions differ -> m (premerge)
415 rev: versions differ -> m (premerge)
416 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
416 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
417 merging rev
417 merging rev
418 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
418 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
419 rev: versions differ -> m (merge)
419 rev: versions differ -> m (merge)
420 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
420 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
421 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
421 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
422 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
422 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
423 merge tool returned: 0
423 merge tool returned: 0
424 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
424 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
425 (branch merge, don't forget to commit)
425 (branch merge, don't forget to commit)
426 --------------
426 --------------
427 M c
427 M c
428 C b
428 C b
429 --------------
429 --------------
430
430
431 $ tm "nc a b" "up b " " " "12 merge b no ancestor"
431 $ tm "nc a b" "up b " " " "12 merge b no ancestor"
432 created new head
432 created new head
433 --------------
433 --------------
434 test L:nc a b R:up b W: - 12 merge b no ancestor
434 test L:nc a b R:up b W: - 12 merge b no ancestor
435 --------------
435 --------------
436 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
437 src: 'a' -> dst: 'b'
438 checking for directory renames
436 resolving manifests
439 resolving manifests
437 branchmerge: True, force: False, partial: False
440 branchmerge: True, force: False, partial: False
438 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7
441 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7
439 preserving b for resolve of b
442 preserving b for resolve of b
440 preserving rev for resolve of rev
443 preserving rev for resolve of rev
441 starting 4 threads for background file closing (?)
444 starting 4 threads for background file closing (?)
442 b: both created -> m (premerge)
445 b: both created -> m (premerge)
443 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
446 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
444 merging b
447 merging b
445 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
448 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
446 rev: versions differ -> m (premerge)
449 rev: versions differ -> m (premerge)
447 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
450 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
448 merging rev
451 merging rev
449 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
452 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
450 b: both created -> m (merge)
453 b: both created -> m (merge)
451 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
454 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
452 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
455 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
453 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
456 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
454 merge tool returned: 0
457 merge tool returned: 0
455 rev: versions differ -> m (merge)
458 rev: versions differ -> m (merge)
456 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
459 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
457 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
460 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
458 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
461 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
459 merge tool returned: 0
462 merge tool returned: 0
460 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
463 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
461 (branch merge, don't forget to commit)
464 (branch merge, don't forget to commit)
462 --------------
465 --------------
463 M b
466 M b
464 C a
467 C a
465 --------------
468 --------------
466
469
467 $ tm "up b " "nm a b" " " "13 merge b no ancestor"
470 $ tm "up b " "nm a b" " " "13 merge b no ancestor"
468 created new head
471 created new head
469 --------------
472 --------------
470 test L:up b R:nm a b W: - 13 merge b no ancestor
473 test L:up b R:nm a b W: - 13 merge b no ancestor
471 --------------
474 --------------
475 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
476 src: 'a' -> dst: 'b'
477 checking for directory renames
472 resolving manifests
478 resolving manifests
473 branchmerge: True, force: False, partial: False
479 branchmerge: True, force: False, partial: False
474 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
480 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
475 preserving b for resolve of b
481 preserving b for resolve of b
476 preserving rev for resolve of rev
482 preserving rev for resolve of rev
477 a: other deleted -> r
483 a: other deleted -> r
478 removing a
484 removing a
479 starting 4 threads for background file closing (?)
485 starting 4 threads for background file closing (?)
480 b: both created -> m (premerge)
486 b: both created -> m (premerge)
481 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
487 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
482 merging b
488 merging b
483 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
489 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
484 rev: versions differ -> m (premerge)
490 rev: versions differ -> m (premerge)
485 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
491 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
486 merging rev
492 merging rev
487 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
493 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
488 b: both created -> m (merge)
494 b: both created -> m (merge)
489 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
495 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
490 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
496 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
491 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
497 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
492 merge tool returned: 0
498 merge tool returned: 0
493 rev: versions differ -> m (merge)
499 rev: versions differ -> m (merge)
494 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
500 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
495 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
501 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
496 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
502 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
497 merge tool returned: 0
503 merge tool returned: 0
498 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
504 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
499 (branch merge, don't forget to commit)
505 (branch merge, don't forget to commit)
500 --------------
506 --------------
501 M b
507 M b
502 --------------
508 --------------
503
509
504 $ tm "nc a b" "up a b" " " "14 merge b no ancestor"
510 $ tm "nc a b" "up a b" " " "14 merge b no ancestor"
505 created new head
511 created new head
506 --------------
512 --------------
507 test L:nc a b R:up a b W: - 14 merge b no ancestor
513 test L:nc a b R:up a b W: - 14 merge b no ancestor
508 --------------
514 --------------
515 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
516 src: 'a' -> dst: 'b'
517 checking for directory renames
509 resolving manifests
518 resolving manifests
510 branchmerge: True, force: False, partial: False
519 branchmerge: True, force: False, partial: False
511 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
520 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
512 preserving b for resolve of b
521 preserving b for resolve of b
513 preserving rev for resolve of rev
522 preserving rev for resolve of rev
514 a: remote is newer -> g
523 a: remote is newer -> g
515 getting a
524 getting a
516 b: both created -> m (premerge)
525 b: both created -> m (premerge)
517 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
526 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
518 merging b
527 merging b
519 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
528 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
520 rev: versions differ -> m (premerge)
529 rev: versions differ -> m (premerge)
521 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
530 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
522 merging rev
531 merging rev
523 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
532 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
524 b: both created -> m (merge)
533 b: both created -> m (merge)
525 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
534 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
526 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
535 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
527 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
536 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
528 merge tool returned: 0
537 merge tool returned: 0
529 rev: versions differ -> m (merge)
538 rev: versions differ -> m (merge)
530 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
539 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
531 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
540 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
532 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
541 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
533 merge tool returned: 0
542 merge tool returned: 0
534 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
543 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
535 (branch merge, don't forget to commit)
544 (branch merge, don't forget to commit)
536 --------------
545 --------------
537 M a
546 M a
538 M b
547 M b
539 --------------
548 --------------
540
549
541 $ tm "up b " "nm a b" " " "15 merge b no ancestor, remove a"
550 $ tm "up b " "nm a b" " " "15 merge b no ancestor, remove a"
542 created new head
551 created new head
543 --------------
552 --------------
544 test L:up b R:nm a b W: - 15 merge b no ancestor, remove a
553 test L:up b R:nm a b W: - 15 merge b no ancestor, remove a
545 --------------
554 --------------
555 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
556 src: 'a' -> dst: 'b'
557 checking for directory renames
546 resolving manifests
558 resolving manifests
547 branchmerge: True, force: False, partial: False
559 branchmerge: True, force: False, partial: False
548 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
560 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
549 preserving b for resolve of b
561 preserving b for resolve of b
550 preserving rev for resolve of rev
562 preserving rev for resolve of rev
551 a: other deleted -> r
563 a: other deleted -> r
552 removing a
564 removing a
553 starting 4 threads for background file closing (?)
565 starting 4 threads for background file closing (?)
554 b: both created -> m (premerge)
566 b: both created -> m (premerge)
555 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
567 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
556 merging b
568 merging b
557 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
569 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
558 rev: versions differ -> m (premerge)
570 rev: versions differ -> m (premerge)
559 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
571 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
560 merging rev
572 merging rev
561 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
573 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
562 b: both created -> m (merge)
574 b: both created -> m (merge)
563 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
575 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
564 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
576 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
565 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
577 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
566 merge tool returned: 0
578 merge tool returned: 0
567 rev: versions differ -> m (merge)
579 rev: versions differ -> m (merge)
568 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
580 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
569 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
581 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
570 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
582 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
571 merge tool returned: 0
583 merge tool returned: 0
572 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
584 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
573 (branch merge, don't forget to commit)
585 (branch merge, don't forget to commit)
574 --------------
586 --------------
575 M b
587 M b
576 --------------
588 --------------
577
589
578 $ tm "nc a b" "up a b" " " "16 get a, merge b no ancestor"
590 $ tm "nc a b" "up a b" " " "16 get a, merge b no ancestor"
579 created new head
591 created new head
580 --------------
592 --------------
581 test L:nc a b R:up a b W: - 16 get a, merge b no ancestor
593 test L:nc a b R:up a b W: - 16 get a, merge b no ancestor
582 --------------
594 --------------
595 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
596 src: 'a' -> dst: 'b'
597 checking for directory renames
583 resolving manifests
598 resolving manifests
584 branchmerge: True, force: False, partial: False
599 branchmerge: True, force: False, partial: False
585 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
600 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
586 preserving b for resolve of b
601 preserving b for resolve of b
587 preserving rev for resolve of rev
602 preserving rev for resolve of rev
588 a: remote is newer -> g
603 a: remote is newer -> g
589 getting a
604 getting a
590 b: both created -> m (premerge)
605 b: both created -> m (premerge)
591 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
606 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
592 merging b
607 merging b
593 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
608 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
594 rev: versions differ -> m (premerge)
609 rev: versions differ -> m (premerge)
595 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
610 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
596 merging rev
611 merging rev
597 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
612 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
598 b: both created -> m (merge)
613 b: both created -> m (merge)
599 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
614 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
600 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
615 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
601 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
616 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
602 merge tool returned: 0
617 merge tool returned: 0
603 rev: versions differ -> m (merge)
618 rev: versions differ -> m (merge)
604 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
619 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
605 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
620 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
606 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
621 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
607 merge tool returned: 0
622 merge tool returned: 0
608 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
623 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
609 (branch merge, don't forget to commit)
624 (branch merge, don't forget to commit)
610 --------------
625 --------------
611 M a
626 M a
612 M b
627 M b
613 --------------
628 --------------
614
629
615 $ tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor"
630 $ tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor"
616 created new head
631 created new head
617 --------------
632 --------------
618 test L:up a b R:nc a b W: - 17 keep a, merge b no ancestor
633 test L:up a b R:nc a b W: - 17 keep a, merge b no ancestor
619 --------------
634 --------------
635 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
636 src: 'a' -> dst: 'b'
637 checking for directory renames
620 resolving manifests
638 resolving manifests
621 branchmerge: True, force: False, partial: False
639 branchmerge: True, force: False, partial: False
622 ancestor: 924404dff337, local: 0b76e65c8289+, remote: 4ce40f5aca24
640 ancestor: 924404dff337, local: 0b76e65c8289+, remote: 4ce40f5aca24
623 preserving b for resolve of b
641 preserving b for resolve of b
624 preserving rev for resolve of rev
642 preserving rev for resolve of rev
625 starting 4 threads for background file closing (?)
643 starting 4 threads for background file closing (?)
626 b: both created -> m (premerge)
644 b: both created -> m (premerge)
627 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
645 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
628 merging b
646 merging b
629 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
647 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
630 rev: versions differ -> m (premerge)
648 rev: versions differ -> m (premerge)
631 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
649 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
632 merging rev
650 merging rev
633 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
651 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
634 b: both created -> m (merge)
652 b: both created -> m (merge)
635 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
653 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
636 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
654 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
637 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
655 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
638 merge tool returned: 0
656 merge tool returned: 0
639 rev: versions differ -> m (merge)
657 rev: versions differ -> m (merge)
640 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
658 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
641 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
659 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
642 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
660 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
643 merge tool returned: 0
661 merge tool returned: 0
644 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
662 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
645 (branch merge, don't forget to commit)
663 (branch merge, don't forget to commit)
646 --------------
664 --------------
647 M b
665 M b
648 C a
666 C a
649 --------------
667 --------------
650
668
651 $ tm "nm a b" "up a b" " " "18 merge b no ancestor"
669 $ tm "nm a b" "up a b" " " "18 merge b no ancestor"
652 created new head
670 created new head
653 --------------
671 --------------
654 test L:nm a b R:up a b W: - 18 merge b no ancestor
672 test L:nm a b R:up a b W: - 18 merge b no ancestor
655 --------------
673 --------------
674 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
675 src: 'a' -> dst: 'b'
676 checking for directory renames
656 resolving manifests
677 resolving manifests
657 branchmerge: True, force: False, partial: False
678 branchmerge: True, force: False, partial: False
658 ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a
679 ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a
659 preserving b for resolve of b
680 preserving b for resolve of b
660 preserving rev for resolve of rev
681 preserving rev for resolve of rev
661 starting 4 threads for background file closing (?)
682 starting 4 threads for background file closing (?)
662 a: prompt deleted/changed -> m (premerge)
683 a: prompt deleted/changed -> m (premerge)
663 picked tool ':prompt' for a (binary False symlink False changedelete True)
684 picked tool ':prompt' for a (binary False symlink False changedelete True)
664 file 'a' was deleted in local [working copy] but was modified in other [merge rev].
685 file 'a' was deleted in local [working copy] but was modified in other [merge rev].
665 What do you want to do?
686 What do you want to do?
666 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
687 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
667 b: both created -> m (premerge)
688 b: both created -> m (premerge)
668 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
689 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
669 merging b
690 merging b
670 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
691 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
671 rev: versions differ -> m (premerge)
692 rev: versions differ -> m (premerge)
672 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
693 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
673 merging rev
694 merging rev
674 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
695 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
675 b: both created -> m (merge)
696 b: both created -> m (merge)
676 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
697 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
677 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
698 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
678 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
699 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
679 merge tool returned: 0
700 merge tool returned: 0
680 rev: versions differ -> m (merge)
701 rev: versions differ -> m (merge)
681 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
702 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
682 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
703 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
683 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
704 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
684 merge tool returned: 0
705 merge tool returned: 0
685 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
706 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
686 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
707 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
687 --------------
708 --------------
688 M a
709 M a
689 M b
710 M b
690 abort: unresolved merge conflicts (see 'hg help resolve')
711 abort: unresolved merge conflicts (see 'hg help resolve')
691 --------------
712 --------------
692
713
693 $ tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a"
714 $ tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a"
694 created new head
715 created new head
695 --------------
716 --------------
696 test L:up a b R:nm a b W: - 19 merge b no ancestor, prompt remove a
717 test L:up a b R:nm a b W: - 19 merge b no ancestor, prompt remove a
697 --------------
718 --------------
719 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
720 src: 'a' -> dst: 'b'
721 checking for directory renames
698 resolving manifests
722 resolving manifests
699 branchmerge: True, force: False, partial: False
723 branchmerge: True, force: False, partial: False
700 ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a
724 ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a
701 preserving a for resolve of a
725 preserving a for resolve of a
702 preserving b for resolve of b
726 preserving b for resolve of b
703 preserving rev for resolve of rev
727 preserving rev for resolve of rev
704 starting 4 threads for background file closing (?)
728 starting 4 threads for background file closing (?)
705 a: prompt changed/deleted -> m (premerge)
729 a: prompt changed/deleted -> m (premerge)
706 picked tool ':prompt' for a (binary False symlink False changedelete True)
730 picked tool ':prompt' for a (binary False symlink False changedelete True)
707 file 'a' was deleted in other [merge rev] but was modified in local [working copy].
731 file 'a' was deleted in other [merge rev] but was modified in local [working copy].
708 What do you want to do?
732 What do you want to do?
709 use (c)hanged version, (d)elete, or leave (u)nresolved? u
733 use (c)hanged version, (d)elete, or leave (u)nresolved? u
710 b: both created -> m (premerge)
734 b: both created -> m (premerge)
711 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
735 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
712 merging b
736 merging b
713 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
737 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
714 rev: versions differ -> m (premerge)
738 rev: versions differ -> m (premerge)
715 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
739 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
716 merging rev
740 merging rev
717 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
741 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
718 b: both created -> m (merge)
742 b: both created -> m (merge)
719 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
743 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
720 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
744 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
721 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
745 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
722 merge tool returned: 0
746 merge tool returned: 0
723 rev: versions differ -> m (merge)
747 rev: versions differ -> m (merge)
724 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
748 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
725 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
749 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
726 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
750 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
727 merge tool returned: 0
751 merge tool returned: 0
728 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
752 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
729 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
753 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
730 --------------
754 --------------
731 M b
755 M b
732 C a
756 C a
733 abort: unresolved merge conflicts (see 'hg help resolve')
757 abort: unresolved merge conflicts (see 'hg help resolve')
734 --------------
758 --------------
735
759
736 $ tm "up a " "um a b" " " "20 merge a and b to b, remove a"
760 $ tm "up a " "um a b" " " "20 merge a and b to b, remove a"
737 created new head
761 created new head
738 --------------
762 --------------
739 test L:up a R:um a b W: - 20 merge a and b to b, remove a
763 test L:up a R:um a b W: - 20 merge a and b to b, remove a
740 --------------
764 --------------
741 unmatched files in other:
765 unmatched files in other:
742 b
766 b
743 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
767 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
744 src: 'a' -> dst: 'b' *
768 src: 'a' -> dst: 'b' *
745 checking for directory renames
769 checking for directory renames
746 resolving manifests
770 resolving manifests
747 branchmerge: True, force: False, partial: False
771 branchmerge: True, force: False, partial: False
748 ancestor: 924404dff337, local: e300d1c794ec+, remote: 49b6d8032493
772 ancestor: 924404dff337, local: e300d1c794ec+, remote: 49b6d8032493
749 preserving a for resolve of b
773 preserving a for resolve of b
750 preserving rev for resolve of rev
774 preserving rev for resolve of rev
751 removing a
775 removing a
752 starting 4 threads for background file closing (?)
776 starting 4 threads for background file closing (?)
753 b: remote moved from a -> m (premerge)
777 b: remote moved from a -> m (premerge)
754 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
778 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
755 merging a and b to b
779 merging a and b to b
756 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
780 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
757 rev: versions differ -> m (premerge)
781 rev: versions differ -> m (premerge)
758 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
782 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
759 merging rev
783 merging rev
760 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
784 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
761 b: remote moved from a -> m (merge)
785 b: remote moved from a -> m (merge)
762 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
786 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
763 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
787 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
764 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
788 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
765 merge tool returned: 0
789 merge tool returned: 0
766 rev: versions differ -> m (merge)
790 rev: versions differ -> m (merge)
767 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
791 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
768 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
792 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
769 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
793 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
770 merge tool returned: 0
794 merge tool returned: 0
771 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
795 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
772 (branch merge, don't forget to commit)
796 (branch merge, don't forget to commit)
773 --------------
797 --------------
774 M b
798 M b
775 a
799 a
776 --------------
800 --------------
777
801
778 $ tm "um a b" "up a " " " "21 merge a and b to b"
802 $ tm "um a b" "up a " " " "21 merge a and b to b"
779 created new head
803 created new head
780 --------------
804 --------------
781 test L:um a b R:up a W: - 21 merge a and b to b
805 test L:um a b R:up a W: - 21 merge a and b to b
782 --------------
806 --------------
783 unmatched files in local:
807 unmatched files in local:
784 b
808 b
785 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
809 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
786 src: 'a' -> dst: 'b' *
810 src: 'a' -> dst: 'b' *
787 checking for directory renames
811 checking for directory renames
788 resolving manifests
812 resolving manifests
789 branchmerge: True, force: False, partial: False
813 branchmerge: True, force: False, partial: False
790 ancestor: 924404dff337, local: 62e7bf090eba+, remote: f4db7e329e71
814 ancestor: 924404dff337, local: 62e7bf090eba+, remote: f4db7e329e71
791 preserving b for resolve of b
815 preserving b for resolve of b
792 preserving rev for resolve of rev
816 preserving rev for resolve of rev
793 starting 4 threads for background file closing (?)
817 starting 4 threads for background file closing (?)
794 b: local copied/moved from a -> m (premerge)
818 b: local copied/moved from a -> m (premerge)
795 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
819 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
796 merging b and a to b
820 merging b and a to b
797 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
821 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
798 rev: versions differ -> m (premerge)
822 rev: versions differ -> m (premerge)
799 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
823 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
800 merging rev
824 merging rev
801 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
825 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
802 b: local copied/moved from a -> m (merge)
826 b: local copied/moved from a -> m (merge)
803 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
827 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
804 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
828 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
805 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
829 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
806 merge tool returned: 0
830 merge tool returned: 0
807 rev: versions differ -> m (merge)
831 rev: versions differ -> m (merge)
808 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
832 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
809 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
833 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
810 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
834 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
811 merge tool returned: 0
835 merge tool returned: 0
812 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
836 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
813 (branch merge, don't forget to commit)
837 (branch merge, don't forget to commit)
814 --------------
838 --------------
815 M b
839 M b
816 a
840 a
817 --------------
841 --------------
818
842
819
843
820 m "nm a b" "um x a" " " "22 get a, keep b"
844 m "nm a b" "um x a" " " "22 get a, keep b"
821
845
822 $ tm "nm a b" "up a c" " " "23 get c, keep b"
846 $ tm "nm a b" "up a c" " " "23 get c, keep b"
823 created new head
847 created new head
824 --------------
848 --------------
825 test L:nm a b R:up a c W: - 23 get c, keep b
849 test L:nm a b R:up a c W: - 23 get c, keep b
826 --------------
850 --------------
827 unmatched files in local:
851 unmatched files in local:
828 b
852 b
829 unmatched files in other:
853 unmatched files in other:
830 c
854 c
831 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
855 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
832 src: 'a' -> dst: 'b' *
856 src: 'a' -> dst: 'b' *
833 checking for directory renames
857 checking for directory renames
834 resolving manifests
858 resolving manifests
835 branchmerge: True, force: False, partial: False
859 branchmerge: True, force: False, partial: False
836 ancestor: 924404dff337, local: 02963e448370+, remote: 2b958612230f
860 ancestor: 924404dff337, local: 02963e448370+, remote: 2b958612230f
837 preserving b for resolve of b
861 preserving b for resolve of b
838 preserving rev for resolve of rev
862 preserving rev for resolve of rev
839 c: remote created -> g
863 c: remote created -> g
840 getting c
864 getting c
841 b: local copied/moved from a -> m (premerge)
865 b: local copied/moved from a -> m (premerge)
842 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
866 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
843 merging b and a to b
867 merging b and a to b
844 my b@02963e448370+ other a@2b958612230f ancestor a@924404dff337
868 my b@02963e448370+ other a@2b958612230f ancestor a@924404dff337
845 premerge successful
869 premerge successful
846 rev: versions differ -> m (premerge)
870 rev: versions differ -> m (premerge)
847 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
871 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
848 merging rev
872 merging rev
849 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
873 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
850 rev: versions differ -> m (merge)
874 rev: versions differ -> m (merge)
851 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
875 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
852 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
876 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
853 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
877 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
854 merge tool returned: 0
878 merge tool returned: 0
855 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
879 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
856 (branch merge, don't forget to commit)
880 (branch merge, don't forget to commit)
857 --------------
881 --------------
858 M b
882 M b
859 a
883 a
860 M c
884 M c
861 --------------
885 --------------
862
886
863
887
864 $ cd ..
888 $ cd ..
865
889
866
890
867 Systematic and terse testing of merge merges and ancestor calculation:
891 Systematic and terse testing of merge merges and ancestor calculation:
868
892
869 Expected result:
893 Expected result:
870
894
871 \ a m1 m2 dst
895 \ a m1 m2 dst
872 0 - f f f "versions differ"
896 0 - f f f "versions differ"
873 1 f g g g "versions differ"
897 1 f g g g "versions differ"
874 2 f f f f "versions differ"
898 2 f f f f "versions differ"
875 3 f f g f+g "remote copied to " + f
899 3 f f g f+g "remote copied to " + f
876 4 f f g g "remote moved to " + f
900 4 f f g g "remote moved to " + f
877 5 f g f f+g "local copied to " + f2
901 5 f g f f+g "local copied to " + f2
878 6 f g f g "local moved to " + f2
902 6 f g f g "local moved to " + f2
879 7 - (f) f f "remote differs from untracked local"
903 7 - (f) f f "remote differs from untracked local"
880 8 f (f) f f "remote differs from untracked local"
904 8 f (f) f f "remote differs from untracked local"
881
905
882 $ hg init ancestortest
906 $ hg init ancestortest
883 $ cd ancestortest
907 $ cd ancestortest
884 $ for x in 1 2 3 4 5 6 8; do mkdir $x; echo a > $x/f; done
908 $ for x in 1 2 3 4 5 6 8; do mkdir $x; echo a > $x/f; done
885 $ hg ci -Aqm "a"
909 $ hg ci -Aqm "a"
886 $ mkdir 0
910 $ mkdir 0
887 $ touch 0/f
911 $ touch 0/f
888 $ hg mv 1/f 1/g
912 $ hg mv 1/f 1/g
889 $ hg cp 5/f 5/g
913 $ hg cp 5/f 5/g
890 $ hg mv 6/f 6/g
914 $ hg mv 6/f 6/g
891 $ hg rm 8/f
915 $ hg rm 8/f
892 $ for x in */*; do echo m1 > $x; done
916 $ for x in */*; do echo m1 > $x; done
893 $ hg ci -Aqm "m1"
917 $ hg ci -Aqm "m1"
894 $ hg up -qr0
918 $ hg up -qr0
895 $ mkdir 0 7
919 $ mkdir 0 7
896 $ touch 0/f 7/f
920 $ touch 0/f 7/f
897 $ hg mv 1/f 1/g
921 $ hg mv 1/f 1/g
898 $ hg cp 3/f 3/g
922 $ hg cp 3/f 3/g
899 $ hg mv 4/f 4/g
923 $ hg mv 4/f 4/g
900 $ for x in */*; do echo m2 > $x; done
924 $ for x in */*; do echo m2 > $x; done
901 $ hg ci -Aqm "m2"
925 $ hg ci -Aqm "m2"
902 $ hg up -qr1
926 $ hg up -qr1
903 $ mkdir 7 8
927 $ mkdir 7 8
904 $ echo m > 7/f
928 $ echo m > 7/f
905 $ echo m > 8/f
929 $ echo m > 8/f
906 $ hg merge -f --tool internal:dump -v --debug -r2 | sed '/^resolving manifests/,$d' 2> /dev/null
930 $ hg merge -f --tool internal:dump -v --debug -r2 | sed '/^resolving manifests/,$d' 2> /dev/null
907 unmatched files in local:
931 unmatched files in local:
908 5/g
932 5/g
909 6/g
933 6/g
910 unmatched files in other:
934 unmatched files in other:
911 3/g
935 3/g
912 4/g
936 4/g
913 7/f
937 7/f
914 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
938 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
915 src: '1/f' -> dst: '1/g' *
939 src: '1/f' -> dst: '1/g' *
916 src: '3/f' -> dst: '3/g' *
940 src: '3/f' -> dst: '3/g' *
917 src: '4/f' -> dst: '4/g' *
941 src: '4/f' -> dst: '4/g' *
918 src: '5/f' -> dst: '5/g' *
942 src: '5/f' -> dst: '5/g' *
919 src: '6/f' -> dst: '6/g' *
943 src: '6/f' -> dst: '6/g' *
920 checking for directory renames
944 checking for directory renames
921 $ hg mani
945 $ hg mani
922 0/f
946 0/f
923 1/g
947 1/g
924 2/f
948 2/f
925 3/f
949 3/f
926 4/f
950 4/f
927 5/f
951 5/f
928 5/g
952 5/g
929 6/g
953 6/g
930 $ for f in */*; do echo $f:; cat $f; done
954 $ for f in */*; do echo $f:; cat $f; done
931 0/f:
955 0/f:
932 m1
956 m1
933 0/f.base:
957 0/f.base:
934 0/f.local:
958 0/f.local:
935 m1
959 m1
936 0/f.orig:
960 0/f.orig:
937 m1
961 m1
938 0/f.other:
962 0/f.other:
939 m2
963 m2
940 1/g:
964 1/g:
941 m1
965 m1
942 1/g.base:
966 1/g.base:
943 a
967 a
944 1/g.local:
968 1/g.local:
945 m1
969 m1
946 1/g.orig:
970 1/g.orig:
947 m1
971 m1
948 1/g.other:
972 1/g.other:
949 m2
973 m2
950 2/f:
974 2/f:
951 m1
975 m1
952 2/f.base:
976 2/f.base:
953 a
977 a
954 2/f.local:
978 2/f.local:
955 m1
979 m1
956 2/f.orig:
980 2/f.orig:
957 m1
981 m1
958 2/f.other:
982 2/f.other:
959 m2
983 m2
960 3/f:
984 3/f:
961 m1
985 m1
962 3/f.base:
986 3/f.base:
963 a
987 a
964 3/f.local:
988 3/f.local:
965 m1
989 m1
966 3/f.orig:
990 3/f.orig:
967 m1
991 m1
968 3/f.other:
992 3/f.other:
969 m2
993 m2
970 3/g:
994 3/g:
971 m1
995 m1
972 3/g.base:
996 3/g.base:
973 a
997 a
974 3/g.local:
998 3/g.local:
975 m1
999 m1
976 3/g.orig:
1000 3/g.orig:
977 m1
1001 m1
978 3/g.other:
1002 3/g.other:
979 m2
1003 m2
980 4/g:
1004 4/g:
981 m1
1005 m1
982 4/g.base:
1006 4/g.base:
983 a
1007 a
984 4/g.local:
1008 4/g.local:
985 m1
1009 m1
986 4/g.orig:
1010 4/g.orig:
987 m1
1011 m1
988 4/g.other:
1012 4/g.other:
989 m2
1013 m2
990 5/f:
1014 5/f:
991 m1
1015 m1
992 5/f.base:
1016 5/f.base:
993 a
1017 a
994 5/f.local:
1018 5/f.local:
995 m1
1019 m1
996 5/f.orig:
1020 5/f.orig:
997 m1
1021 m1
998 5/f.other:
1022 5/f.other:
999 m2
1023 m2
1000 5/g:
1024 5/g:
1001 m1
1025 m1
1002 5/g.base:
1026 5/g.base:
1003 a
1027 a
1004 5/g.local:
1028 5/g.local:
1005 m1
1029 m1
1006 5/g.orig:
1030 5/g.orig:
1007 m1
1031 m1
1008 5/g.other:
1032 5/g.other:
1009 m2
1033 m2
1010 6/g:
1034 6/g:
1011 m1
1035 m1
1012 6/g.base:
1036 6/g.base:
1013 a
1037 a
1014 6/g.local:
1038 6/g.local:
1015 m1
1039 m1
1016 6/g.orig:
1040 6/g.orig:
1017 m1
1041 m1
1018 6/g.other:
1042 6/g.other:
1019 m2
1043 m2
1020 7/f:
1044 7/f:
1021 m
1045 m
1022 7/f.base:
1046 7/f.base:
1023 7/f.local:
1047 7/f.local:
1024 m
1048 m
1025 7/f.orig:
1049 7/f.orig:
1026 m
1050 m
1027 7/f.other:
1051 7/f.other:
1028 m2
1052 m2
1029 8/f:
1053 8/f:
1030 m2
1054 m2
1031 $ cd ..
1055 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now