##// END OF EJS Templates
diff: search beyond ancestor when detecting renames...
Mads Kiilerich -
r20294:243ea5ff default
parent child Browse files
Show More
@@ -1,406 +1,412 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 import util
8 import util
9 import heapq
9 import heapq
10
10
11 def _nonoverlap(d1, d2, d3):
11 def _nonoverlap(d1, d2, d3):
12 "Return list of elements in d1 not in d2 or d3"
12 "Return list of elements in d1 not in d2 or d3"
13 return sorted([d for d in d1 if d not in d3 and d not in d2])
13 return sorted([d for d in d1 if d not in d3 and d not in d2])
14
14
15 def _dirname(f):
15 def _dirname(f):
16 s = f.rfind("/")
16 s = f.rfind("/")
17 if s == -1:
17 if s == -1:
18 return ""
18 return ""
19 return f[:s]
19 return f[:s]
20
20
21 def _findlimit(repo, a, b):
21 def _findlimit(repo, a, b):
22 """Find the earliest revision that's an ancestor of a or b but not both,
22 """Find the earliest revision that's an ancestor of a or b but not both,
23 None if no such revision exists.
23 None if no such revision exists.
24 """
24 """
25 # basic idea:
25 # basic idea:
26 # - mark a and b with different sides
26 # - mark a and b with different sides
27 # - if a parent's children are all on the same side, the parent is
27 # - if a parent's children are all on the same side, the parent is
28 # on that side, otherwise it is on no side
28 # on that side, otherwise it is on no side
29 # - walk the graph in topological order with the help of a heap;
29 # - walk the graph in topological order with the help of a heap;
30 # - add unseen parents to side map
30 # - add unseen parents to side map
31 # - clear side of any parent that has children on different sides
31 # - clear side of any parent that has children on different sides
32 # - track number of interesting revs that might still be on a side
32 # - track number of interesting revs that might still be on a side
33 # - track the lowest interesting rev seen
33 # - track the lowest interesting rev seen
34 # - quit when interesting revs is zero
34 # - quit when interesting revs is zero
35
35
36 cl = repo.changelog
36 cl = repo.changelog
37 working = len(cl) # pseudo rev for the working directory
37 working = len(cl) # pseudo rev for the working directory
38 if a is None:
38 if a is None:
39 a = working
39 a = working
40 if b is None:
40 if b is None:
41 b = working
41 b = working
42
42
43 side = {a: -1, b: 1}
43 side = {a: -1, b: 1}
44 visit = [-a, -b]
44 visit = [-a, -b]
45 heapq.heapify(visit)
45 heapq.heapify(visit)
46 interesting = len(visit)
46 interesting = len(visit)
47 hascommonancestor = False
47 hascommonancestor = False
48 limit = working
48 limit = working
49
49
50 while interesting:
50 while interesting:
51 r = -heapq.heappop(visit)
51 r = -heapq.heappop(visit)
52 if r == working:
52 if r == working:
53 parents = [cl.rev(p) for p in repo.dirstate.parents()]
53 parents = [cl.rev(p) for p in repo.dirstate.parents()]
54 else:
54 else:
55 parents = cl.parentrevs(r)
55 parents = cl.parentrevs(r)
56 for p in parents:
56 for p in parents:
57 if p < 0:
57 if p < 0:
58 continue
58 continue
59 if p not in side:
59 if p not in side:
60 # first time we see p; add it to visit
60 # first time we see p; add it to visit
61 side[p] = side[r]
61 side[p] = side[r]
62 if side[p]:
62 if side[p]:
63 interesting += 1
63 interesting += 1
64 heapq.heappush(visit, -p)
64 heapq.heappush(visit, -p)
65 elif side[p] and side[p] != side[r]:
65 elif side[p] and side[p] != side[r]:
66 # p was interesting but now we know better
66 # p was interesting but now we know better
67 side[p] = 0
67 side[p] = 0
68 interesting -= 1
68 interesting -= 1
69 hascommonancestor = True
69 hascommonancestor = True
70 if side[r]:
70 if side[r]:
71 limit = r # lowest rev visited
71 limit = r # lowest rev visited
72 interesting -= 1
72 interesting -= 1
73
73
74 if not hascommonancestor:
74 if not hascommonancestor:
75 return None
75 return None
76 return limit
76 return limit
77
77
78 def _chain(src, dst, a, b):
78 def _chain(src, dst, a, b):
79 '''chain two sets of copies a->b'''
79 '''chain two sets of copies a->b'''
80 t = a.copy()
80 t = a.copy()
81 for k, v in b.iteritems():
81 for k, v in b.iteritems():
82 if v in t:
82 if v in t:
83 # found a chain
83 # found a chain
84 if t[v] != k:
84 if t[v] != k:
85 # file wasn't renamed back to itself
85 # file wasn't renamed back to itself
86 t[k] = t[v]
86 t[k] = t[v]
87 if v not in dst:
87 if v not in dst:
88 # chain was a rename, not a copy
88 # chain was a rename, not a copy
89 del t[v]
89 del t[v]
90 if v in src:
90 if v in src:
91 # file is a copy of an existing file
91 # file is a copy of an existing file
92 t[k] = v
92 t[k] = v
93
93
94 # remove criss-crossed copies
94 # remove criss-crossed copies
95 for k, v in t.items():
95 for k, v in t.items():
96 if k in src and v in dst:
96 if k in src and v in dst:
97 del t[k]
97 del t[k]
98
98
99 return t
99 return t
100
100
101 def _tracefile(fctx, actx):
101 def _tracefile(fctx, am, limit=-1):
102 '''return file context that is the ancestor of fctx present in actx'''
102 '''return file context that is the ancestor of fctx present in ancestor
103 stop = actx.rev()
103 manifest am, stopping after the first ancestor lower than limit'''
104 am = actx.manifest()
105
104
106 for f in fctx.ancestors():
105 for f in fctx.ancestors():
107 if am.get(f.path(), None) == f.filenode():
106 if am.get(f.path(), None) == f.filenode():
108 return f
107 return f
109 if f.rev() < stop:
108 if f.rev() < limit:
110 return None
109 return None
111
110
112 def _dirstatecopies(d):
111 def _dirstatecopies(d):
113 ds = d._repo.dirstate
112 ds = d._repo.dirstate
114 c = ds.copies().copy()
113 c = ds.copies().copy()
115 for k in c.keys():
114 for k in c.keys():
116 if ds[k] not in 'anm':
115 if ds[k] not in 'anm':
117 del c[k]
116 del c[k]
118 return c
117 return c
119
118
120 def _forwardcopies(a, b):
119 def _forwardcopies(a, b):
121 '''find {dst@b: src@a} copy mapping where a is an ancestor of b'''
120 '''find {dst@b: src@a} copy mapping where a is an ancestor of b'''
122
121
123 # check for working copy
122 # check for working copy
124 w = None
123 w = None
125 if b.rev() is None:
124 if b.rev() is None:
126 w = b
125 w = b
127 b = w.p1()
126 b = w.p1()
128 if a == b:
127 if a == b:
129 # short-circuit to avoid issues with merge states
128 # short-circuit to avoid issues with merge states
130 return _dirstatecopies(w)
129 return _dirstatecopies(w)
131
130
131 # files might have to be traced back to the fctx parent of the last
132 # one-side-only changeset, but not further back than that
133 limit = _findlimit(a._repo, a.rev(), b.rev())
134 if limit is None:
135 limit = -1
136 am = a.manifest()
137
132 # find where new files came from
138 # find where new files came from
133 # we currently don't try to find where old files went, too expensive
139 # we currently don't try to find where old files went, too expensive
134 # this means we can miss a case like 'hg rm b; hg cp a b'
140 # this means we can miss a case like 'hg rm b; hg cp a b'
135 cm = {}
141 cm = {}
136 missing = set(b.manifest().iterkeys())
142 missing = set(b.manifest().iterkeys())
137 missing.difference_update(a.manifest().iterkeys())
143 missing.difference_update(a.manifest().iterkeys())
138
144
139 for f in missing:
145 for f in missing:
140 ofctx = _tracefile(b[f], a)
146 ofctx = _tracefile(b[f], am, limit)
141 if ofctx:
147 if ofctx:
142 cm[f] = ofctx.path()
148 cm[f] = ofctx.path()
143
149
144 # combine copies from dirstate if necessary
150 # combine copies from dirstate if necessary
145 if w is not None:
151 if w is not None:
146 cm = _chain(a, w, cm, _dirstatecopies(w))
152 cm = _chain(a, w, cm, _dirstatecopies(w))
147
153
148 return cm
154 return cm
149
155
150 def _backwardrenames(a, b):
156 def _backwardrenames(a, b):
151 # Even though we're not taking copies into account, 1:n rename situations
157 # Even though we're not taking copies into account, 1:n rename situations
152 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
158 # can still exist (e.g. hg cp a b; hg mv a c). In those cases we
153 # arbitrarily pick one of the renames.
159 # arbitrarily pick one of the renames.
154 f = _forwardcopies(b, a)
160 f = _forwardcopies(b, a)
155 r = {}
161 r = {}
156 for k, v in sorted(f.iteritems()):
162 for k, v in sorted(f.iteritems()):
157 # remove copies
163 # remove copies
158 if v in a:
164 if v in a:
159 continue
165 continue
160 r[v] = k
166 r[v] = k
161 return r
167 return r
162
168
163 def pathcopies(x, y):
169 def pathcopies(x, y):
164 '''find {dst@y: src@x} copy mapping for directed compare'''
170 '''find {dst@y: src@x} copy mapping for directed compare'''
165 if x == y or not x or not y:
171 if x == y or not x or not y:
166 return {}
172 return {}
167 a = y.ancestor(x)
173 a = y.ancestor(x)
168 if a == x:
174 if a == x:
169 return _forwardcopies(x, y)
175 return _forwardcopies(x, y)
170 if a == y:
176 if a == y:
171 return _backwardrenames(x, y)
177 return _backwardrenames(x, y)
172 return _chain(x, y, _backwardrenames(x, a), _forwardcopies(a, y))
178 return _chain(x, y, _backwardrenames(x, a), _forwardcopies(a, y))
173
179
174 def mergecopies(repo, c1, c2, ca):
180 def mergecopies(repo, c1, c2, ca):
175 """
181 """
176 Find moves and copies between context c1 and c2 that are relevant
182 Find moves and copies between context c1 and c2 that are relevant
177 for merging.
183 for merging.
178
184
179 Returns four dicts: "copy", "movewithdir", "diverge", and
185 Returns four dicts: "copy", "movewithdir", "diverge", and
180 "renamedelete".
186 "renamedelete".
181
187
182 "copy" is a mapping from destination name -> source name,
188 "copy" is a mapping from destination name -> source name,
183 where source is in c1 and destination is in c2 or vice-versa.
189 where source is in c1 and destination is in c2 or vice-versa.
184
190
185 "movewithdir" is a mapping from source name -> destination name,
191 "movewithdir" is a mapping from source name -> destination name,
186 where the file at source present in one context but not the other
192 where the file at source present in one context but not the other
187 needs to be moved to destination by the merge process, because the
193 needs to be moved to destination by the merge process, because the
188 other context moved the directory it is in.
194 other context moved the directory it is in.
189
195
190 "diverge" is a mapping of source name -> list of destination names
196 "diverge" is a mapping of source name -> list of destination names
191 for divergent renames.
197 for divergent renames.
192
198
193 "renamedelete" is a mapping of source name -> list of destination
199 "renamedelete" is a mapping of source name -> list of destination
194 names for files deleted in c1 that were renamed in c2 or vice-versa.
200 names for files deleted in c1 that were renamed in c2 or vice-versa.
195 """
201 """
196 # avoid silly behavior for update from empty dir
202 # avoid silly behavior for update from empty dir
197 if not c1 or not c2 or c1 == c2:
203 if not c1 or not c2 or c1 == c2:
198 return {}, {}, {}, {}
204 return {}, {}, {}, {}
199
205
200 # avoid silly behavior for parent -> working dir
206 # avoid silly behavior for parent -> working dir
201 if c2.node() is None and c1.node() == repo.dirstate.p1():
207 if c2.node() is None and c1.node() == repo.dirstate.p1():
202 return repo.dirstate.copies(), {}, {}, {}
208 return repo.dirstate.copies(), {}, {}, {}
203
209
204 limit = _findlimit(repo, c1.rev(), c2.rev())
210 limit = _findlimit(repo, c1.rev(), c2.rev())
205 if limit is None:
211 if limit is None:
206 # no common ancestor, no copies
212 # no common ancestor, no copies
207 return {}, {}, {}, {}
213 return {}, {}, {}, {}
208 m1 = c1.manifest()
214 m1 = c1.manifest()
209 m2 = c2.manifest()
215 m2 = c2.manifest()
210 ma = ca.manifest()
216 ma = ca.manifest()
211
217
212 def makectx(f, n):
218 def makectx(f, n):
213 if len(n) != 20: # in a working context?
219 if len(n) != 20: # in a working context?
214 if c1.rev() is None:
220 if c1.rev() is None:
215 return c1.filectx(f)
221 return c1.filectx(f)
216 return c2.filectx(f)
222 return c2.filectx(f)
217 return repo.filectx(f, fileid=n)
223 return repo.filectx(f, fileid=n)
218
224
219 ctx = util.lrucachefunc(makectx)
225 ctx = util.lrucachefunc(makectx)
220 copy = {}
226 copy = {}
221 movewithdir = {}
227 movewithdir = {}
222 fullcopy = {}
228 fullcopy = {}
223 diverge = {}
229 diverge = {}
224
230
225 def _checkcopies(f, m1, m2):
231 def _checkcopies(f, m1, m2):
226 checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy)
232 checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy)
227
233
228 repo.ui.debug(" searching for copies back to rev %d\n" % limit)
234 repo.ui.debug(" searching for copies back to rev %d\n" % limit)
229
235
230 u1 = _nonoverlap(m1, m2, ma)
236 u1 = _nonoverlap(m1, m2, ma)
231 u2 = _nonoverlap(m2, m1, ma)
237 u2 = _nonoverlap(m2, m1, ma)
232
238
233 if u1:
239 if u1:
234 repo.ui.debug(" unmatched files in local:\n %s\n"
240 repo.ui.debug(" unmatched files in local:\n %s\n"
235 % "\n ".join(u1))
241 % "\n ".join(u1))
236 if u2:
242 if u2:
237 repo.ui.debug(" unmatched files in other:\n %s\n"
243 repo.ui.debug(" unmatched files in other:\n %s\n"
238 % "\n ".join(u2))
244 % "\n ".join(u2))
239
245
240 for f in u1:
246 for f in u1:
241 _checkcopies(f, m1, m2)
247 _checkcopies(f, m1, m2)
242 for f in u2:
248 for f in u2:
243 _checkcopies(f, m2, m1)
249 _checkcopies(f, m2, m1)
244
250
245 renamedelete = {}
251 renamedelete = {}
246 renamedelete2 = set()
252 renamedelete2 = set()
247 diverge2 = set()
253 diverge2 = set()
248 for of, fl in diverge.items():
254 for of, fl in diverge.items():
249 if len(fl) == 1 or of in c1 or of in c2:
255 if len(fl) == 1 or of in c1 or of in c2:
250 del diverge[of] # not actually divergent, or not a rename
256 del diverge[of] # not actually divergent, or not a rename
251 if of not in c1 and of not in c2:
257 if of not in c1 and of not in c2:
252 # renamed on one side, deleted on the other side, but filter
258 # renamed on one side, deleted on the other side, but filter
253 # out files that have been renamed and then deleted
259 # out files that have been renamed and then deleted
254 renamedelete[of] = [f for f in fl if f in c1 or f in c2]
260 renamedelete[of] = [f for f in fl if f in c1 or f in c2]
255 renamedelete2.update(fl) # reverse map for below
261 renamedelete2.update(fl) # reverse map for below
256 else:
262 else:
257 diverge2.update(fl) # reverse map for below
263 diverge2.update(fl) # reverse map for below
258
264
259 if fullcopy:
265 if fullcopy:
260 repo.ui.debug(" all copies found (* = to merge, ! = divergent, "
266 repo.ui.debug(" all copies found (* = to merge, ! = divergent, "
261 "% = renamed and deleted):\n")
267 "% = renamed and deleted):\n")
262 for f in sorted(fullcopy):
268 for f in sorted(fullcopy):
263 note = ""
269 note = ""
264 if f in copy:
270 if f in copy:
265 note += "*"
271 note += "*"
266 if f in diverge2:
272 if f in diverge2:
267 note += "!"
273 note += "!"
268 if f in renamedelete2:
274 if f in renamedelete2:
269 note += "%"
275 note += "%"
270 repo.ui.debug(" src: '%s' -> dst: '%s' %s\n" % (fullcopy[f], f,
276 repo.ui.debug(" src: '%s' -> dst: '%s' %s\n" % (fullcopy[f], f,
271 note))
277 note))
272 del diverge2
278 del diverge2
273
279
274 if not fullcopy:
280 if not fullcopy:
275 return copy, movewithdir, diverge, renamedelete
281 return copy, movewithdir, diverge, renamedelete
276
282
277 repo.ui.debug(" checking for directory renames\n")
283 repo.ui.debug(" checking for directory renames\n")
278
284
279 # generate a directory move map
285 # generate a directory move map
280 d1, d2 = c1.dirs(), c2.dirs()
286 d1, d2 = c1.dirs(), c2.dirs()
281 d1.addpath('/')
287 d1.addpath('/')
282 d2.addpath('/')
288 d2.addpath('/')
283 invalid = set()
289 invalid = set()
284 dirmove = {}
290 dirmove = {}
285
291
286 # examine each file copy for a potential directory move, which is
292 # examine each file copy for a potential directory move, which is
287 # when all the files in a directory are moved to a new directory
293 # when all the files in a directory are moved to a new directory
288 for dst, src in fullcopy.iteritems():
294 for dst, src in fullcopy.iteritems():
289 dsrc, ddst = _dirname(src), _dirname(dst)
295 dsrc, ddst = _dirname(src), _dirname(dst)
290 if dsrc in invalid:
296 if dsrc in invalid:
291 # already seen to be uninteresting
297 # already seen to be uninteresting
292 continue
298 continue
293 elif dsrc in d1 and ddst in d1:
299 elif dsrc in d1 and ddst in d1:
294 # directory wasn't entirely moved locally
300 # directory wasn't entirely moved locally
295 invalid.add(dsrc)
301 invalid.add(dsrc)
296 elif dsrc in d2 and ddst in d2:
302 elif dsrc in d2 and ddst in d2:
297 # directory wasn't entirely moved remotely
303 # directory wasn't entirely moved remotely
298 invalid.add(dsrc)
304 invalid.add(dsrc)
299 elif dsrc in dirmove and dirmove[dsrc] != ddst:
305 elif dsrc in dirmove and dirmove[dsrc] != ddst:
300 # files from the same directory moved to two different places
306 # files from the same directory moved to two different places
301 invalid.add(dsrc)
307 invalid.add(dsrc)
302 else:
308 else:
303 # looks good so far
309 # looks good so far
304 dirmove[dsrc + "/"] = ddst + "/"
310 dirmove[dsrc + "/"] = ddst + "/"
305
311
306 for i in invalid:
312 for i in invalid:
307 if i in dirmove:
313 if i in dirmove:
308 del dirmove[i]
314 del dirmove[i]
309 del d1, d2, invalid
315 del d1, d2, invalid
310
316
311 if not dirmove:
317 if not dirmove:
312 return copy, movewithdir, diverge, renamedelete
318 return copy, movewithdir, diverge, renamedelete
313
319
314 for d in dirmove:
320 for d in dirmove:
315 repo.ui.debug(" discovered dir src: '%s' -> dst: '%s'\n" %
321 repo.ui.debug(" discovered dir src: '%s' -> dst: '%s'\n" %
316 (d, dirmove[d]))
322 (d, dirmove[d]))
317
323
318 # check unaccounted nonoverlapping files against directory moves
324 # check unaccounted nonoverlapping files against directory moves
319 for f in u1 + u2:
325 for f in u1 + u2:
320 if f not in fullcopy:
326 if f not in fullcopy:
321 for d in dirmove:
327 for d in dirmove:
322 if f.startswith(d):
328 if f.startswith(d):
323 # new file added in a directory that was moved, move it
329 # new file added in a directory that was moved, move it
324 df = dirmove[d] + f[len(d):]
330 df = dirmove[d] + f[len(d):]
325 if df not in copy:
331 if df not in copy:
326 movewithdir[f] = df
332 movewithdir[f] = df
327 repo.ui.debug((" pending file src: '%s' -> "
333 repo.ui.debug((" pending file src: '%s' -> "
328 "dst: '%s'\n") % (f, df))
334 "dst: '%s'\n") % (f, df))
329 break
335 break
330
336
331 return copy, movewithdir, diverge, renamedelete
337 return copy, movewithdir, diverge, renamedelete
332
338
333 def checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy):
339 def checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy):
334 """
340 """
335 check possible copies of f from m1 to m2
341 check possible copies of f from m1 to m2
336
342
337 ctx = function accepting (filename, node) that returns a filectx.
343 ctx = function accepting (filename, node) that returns a filectx.
338 f = the filename to check
344 f = the filename to check
339 m1 = the source manifest
345 m1 = the source manifest
340 m2 = the destination manifest
346 m2 = the destination manifest
341 ca = the changectx of the common ancestor
347 ca = the changectx of the common ancestor
342 limit = the rev number to not search beyond
348 limit = the rev number to not search beyond
343 diverge = record all diverges in this dict
349 diverge = record all diverges in this dict
344 copy = record all non-divergent copies in this dict
350 copy = record all non-divergent copies in this dict
345 fullcopy = record all copies in this dict
351 fullcopy = record all copies in this dict
346 """
352 """
347
353
348 ma = ca.manifest()
354 ma = ca.manifest()
349
355
350 def _related(f1, f2, limit):
356 def _related(f1, f2, limit):
351 # Walk back to common ancestor to see if the two files originate
357 # Walk back to common ancestor to see if the two files originate
352 # from the same file. Since workingfilectx's rev() is None it messes
358 # from the same file. Since workingfilectx's rev() is None it messes
353 # up the integer comparison logic, hence the pre-step check for
359 # up the integer comparison logic, hence the pre-step check for
354 # None (f1 and f2 can only be workingfilectx's initially).
360 # None (f1 and f2 can only be workingfilectx's initially).
355
361
356 if f1 == f2:
362 if f1 == f2:
357 return f1 # a match
363 return f1 # a match
358
364
359 g1, g2 = f1.ancestors(), f2.ancestors()
365 g1, g2 = f1.ancestors(), f2.ancestors()
360 try:
366 try:
361 f1r, f2r = f1.rev(), f2.rev()
367 f1r, f2r = f1.rev(), f2.rev()
362
368
363 if f1r is None:
369 if f1r is None:
364 f1 = g1.next()
370 f1 = g1.next()
365 if f2r is None:
371 if f2r is None:
366 f2 = g2.next()
372 f2 = g2.next()
367
373
368 while True:
374 while True:
369 f1r, f2r = f1.rev(), f2.rev()
375 f1r, f2r = f1.rev(), f2.rev()
370 if f1r > f2r:
376 if f1r > f2r:
371 f1 = g1.next()
377 f1 = g1.next()
372 elif f2r > f1r:
378 elif f2r > f1r:
373 f2 = g2.next()
379 f2 = g2.next()
374 elif f1 == f2:
380 elif f1 == f2:
375 return f1 # a match
381 return f1 # a match
376 elif f1r == f2r or f1r < limit or f2r < limit:
382 elif f1r == f2r or f1r < limit or f2r < limit:
377 return False # copy no longer relevant
383 return False # copy no longer relevant
378 except StopIteration:
384 except StopIteration:
379 return False
385 return False
380
386
381 of = None
387 of = None
382 seen = set([f])
388 seen = set([f])
383 for oc in ctx(f, m1[f]).ancestors():
389 for oc in ctx(f, m1[f]).ancestors():
384 ocr = oc.rev()
390 ocr = oc.rev()
385 of = oc.path()
391 of = oc.path()
386 if of in seen:
392 if of in seen:
387 # check limit late - grab last rename before
393 # check limit late - grab last rename before
388 if ocr < limit:
394 if ocr < limit:
389 break
395 break
390 continue
396 continue
391 seen.add(of)
397 seen.add(of)
392
398
393 fullcopy[f] = of # remember for dir rename detection
399 fullcopy[f] = of # remember for dir rename detection
394 if of not in m2:
400 if of not in m2:
395 continue # no match, keep looking
401 continue # no match, keep looking
396 if m2[of] == ma.get(of):
402 if m2[of] == ma.get(of):
397 break # no merge needed, quit early
403 break # no merge needed, quit early
398 c2 = ctx(of, m2[of])
404 c2 = ctx(of, m2[of])
399 cr = _related(oc, c2, ca.rev())
405 cr = _related(oc, c2, ca.rev())
400 if cr and (of == f or of == c2.path()): # non-divergent
406 if cr and (of == f or of == c2.path()): # non-divergent
401 copy[f] = of
407 copy[f] = of
402 of = None
408 of = None
403 break
409 break
404
410
405 if of in ma:
411 if of in ma:
406 diverge.setdefault(of, []).append(f)
412 diverge.setdefault(of, []).append(f)
@@ -1,173 +1,175 b''
1 Setup extension:
1 Setup extension:
2
2
3 $ echo "[extensions]" >> $HGRCPATH
3 $ echo "[extensions]" >> $HGRCPATH
4 $ echo "mq =" >> $HGRCPATH
4 $ echo "mq =" >> $HGRCPATH
5 $ echo "[mq]" >> $HGRCPATH
5 $ echo "[mq]" >> $HGRCPATH
6 $ echo "git = keep" >> $HGRCPATH
6 $ echo "git = keep" >> $HGRCPATH
7
7
8 Test merge with mq changeset as the second parent:
8 Test merge with mq changeset as the second parent:
9
9
10 $ hg init m
10 $ hg init m
11 $ cd m
11 $ cd m
12 $ touch a b c
12 $ touch a b c
13 $ hg add a
13 $ hg add a
14 $ hg commit -m a
14 $ hg commit -m a
15 $ hg add b
15 $ hg add b
16 $ hg qnew -d "0 0" b
16 $ hg qnew -d "0 0" b
17 $ hg update 0
17 $ hg update 0
18 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
18 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
19 $ hg add c
19 $ hg add c
20 $ hg commit -m c
20 $ hg commit -m c
21 created new head
21 created new head
22 $ hg merge
22 $ hg merge
23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 (branch merge, don't forget to commit)
24 (branch merge, don't forget to commit)
25 $ hg commit -m merge
25 $ hg commit -m merge
26 abort: cannot commit over an applied mq patch
26 abort: cannot commit over an applied mq patch
27 [255]
27 [255]
28 $ cd ..
28 $ cd ..
29
29
30 Issue529: mq aborts when merging patch deleting files
30 Issue529: mq aborts when merging patch deleting files
31
31
32 $ checkundo()
32 $ checkundo()
33 > {
33 > {
34 > if [ -f .hg/store/undo ]; then
34 > if [ -f .hg/store/undo ]; then
35 > echo ".hg/store/undo still exists"
35 > echo ".hg/store/undo still exists"
36 > fi
36 > fi
37 > }
37 > }
38
38
39 Commit two dummy files in "init" changeset:
39 Commit two dummy files in "init" changeset:
40
40
41 $ hg init t
41 $ hg init t
42 $ cd t
42 $ cd t
43 $ echo a > a
43 $ echo a > a
44 $ echo b > b
44 $ echo b > b
45 $ hg ci -Am init
45 $ hg ci -Am init
46 adding a
46 adding a
47 adding b
47 adding b
48 $ hg tag -l init
48 $ hg tag -l init
49
49
50 Create a patch removing a:
50 Create a patch removing a:
51
51
52 $ hg qnew rm_a
52 $ hg qnew rm_a
53 $ hg rm a
53 $ hg rm a
54 $ hg qrefresh -m "rm a"
54 $ hg qrefresh -m "rm a"
55
55
56 Save the patch queue so we can merge it later:
56 Save the patch queue so we can merge it later:
57
57
58 $ hg qsave -c -e
58 $ hg qsave -c -e
59 copy $TESTTMP/t/.hg/patches to $TESTTMP/t/.hg/patches.1 (glob)
59 copy $TESTTMP/t/.hg/patches to $TESTTMP/t/.hg/patches.1 (glob)
60 $ checkundo
60 $ checkundo
61
61
62 Update b and commit in an "update" changeset:
62 Update b and commit in an "update" changeset:
63
63
64 $ hg up -C init
64 $ hg up -C init
65 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
65 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
66 $ echo b >> b
66 $ echo b >> b
67 $ hg st
67 $ hg st
68 M b
68 M b
69 $ hg ci -m update
69 $ hg ci -m update
70 created new head
70 created new head
71
71
72 # Here, qpush used to abort with :
72 # Here, qpush used to abort with :
73 # The system cannot find the file specified => a
73 # The system cannot find the file specified => a
74 $ hg manifest
74 $ hg manifest
75 a
75 a
76 b
76 b
77
77
78 $ hg qpush -a -m
78 $ hg qpush -a -m
79 merging with queue at: $TESTTMP/t/.hg/patches.1 (glob)
79 merging with queue at: $TESTTMP/t/.hg/patches.1 (glob)
80 applying rm_a
80 applying rm_a
81 now at: rm_a
81 now at: rm_a
82
82
83 $ checkundo
83 $ checkundo
84 $ hg manifest
84 $ hg manifest
85 b
85 b
86
86
87 Ensure status is correct after merge:
87 Ensure status is correct after merge:
88
88
89 $ hg qpop -a
89 $ hg qpop -a
90 popping rm_a
90 popping rm_a
91 popping .hg.patches.merge.marker
91 popping .hg.patches.merge.marker
92 patch queue now empty
92 patch queue now empty
93
93
94 $ cd ..
94 $ cd ..
95
95
96 Classic MQ merge sequence *with an explicit named queue*:
96 Classic MQ merge sequence *with an explicit named queue*:
97
97
98 $ hg init t2
98 $ hg init t2
99 $ cd t2
99 $ cd t2
100 $ echo '[diff]' > .hg/hgrc
100 $ echo '[diff]' > .hg/hgrc
101 $ echo 'nodates = 1' >> .hg/hgrc
101 $ echo 'nodates = 1' >> .hg/hgrc
102 $ echo a > a
102 $ echo a > a
103 $ hg ci -Am init
103 $ hg ci -Am init
104 adding a
104 adding a
105 $ echo b > a
105 $ echo b > a
106 $ hg ci -m changea
106 $ hg ci -m changea
107 $ hg up -C 0
107 $ hg up -C 0
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
108 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
109 $ hg cp a aa
109 $ hg cp a aa
110 $ echo c >> a
110 $ echo c >> a
111 $ hg qnew --git -f -e patcha
111 $ hg qnew --git -f -e patcha
112 $ echo d >> a
112 $ echo d >> a
113 $ hg qnew -d '0 0' -f -e patcha2
113 $ hg qnew -d '0 0' -f -e patcha2
114
114
115 Create the reference queue:
115 Create the reference queue:
116
116
117 $ hg qsave -c -e -n refqueue
117 $ hg qsave -c -e -n refqueue
118 copy $TESTTMP/t2/.hg/patches to $TESTTMP/t2/.hg/refqueue (glob)
118 copy $TESTTMP/t2/.hg/patches to $TESTTMP/t2/.hg/refqueue (glob)
119 $ hg up -C 1
119 $ hg up -C 1
120 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
120 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
121
121
122 Merge:
122 Merge:
123
123
124 $ HGMERGE=internal:other hg qpush -a -m -n refqueue
124 $ HGMERGE=internal:other hg qpush -a -m -n refqueue
125 merging with queue at: $TESTTMP/t2/.hg/refqueue (glob)
125 merging with queue at: $TESTTMP/t2/.hg/refqueue (glob)
126 applying patcha
126 applying patcha
127 patching file a
127 patching file a
128 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
128 Hunk #1 succeeded at 2 with fuzz 1 (offset 0 lines).
129 fuzz found when applying patch, stopping
129 fuzz found when applying patch, stopping
130 patch didn't work out, merging patcha
130 patch didn't work out, merging patcha
131 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
131 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
132 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
132 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
133 (branch merge, don't forget to commit)
133 (branch merge, don't forget to commit)
134 applying patcha2
134 applying patcha2
135 now at: patcha2
135 now at: patcha2
136
136
137 Check patcha is still a git patch:
137 Check patcha is still a git patch:
138
138
139 $ cat .hg/patches/patcha
139 $ cat .hg/patches/patcha
140 # HG changeset patch
140 # HG changeset patch
141 # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
141 # Parent d3873e73d99ef67873dac33fbcc66268d5d2b6f4
142
142
143 diff --git a/a b/a
143 diff --git a/a b/a
144 --- a/a
144 --- a/a
145 +++ b/a
145 +++ b/a
146 @@ -1,1 +1,2 @@
146 @@ -1,1 +1,2 @@
147 -b
147 -b
148 +a
148 +a
149 +c
149 +c
150 diff --git a/aa b/aa
150 diff --git a/a b/aa
151 new file mode 100644
151 copy from a
152 --- /dev/null
152 copy to aa
153 --- a/a
153 +++ b/aa
154 +++ b/aa
154 @@ -0,0 +1,1 @@
155 @@ -1,1 +1,1 @@
156 -b
155 +a
157 +a
156
158
157 Check patcha2 is still a regular patch:
159 Check patcha2 is still a regular patch:
158
160
159 $ cat .hg/patches/patcha2
161 $ cat .hg/patches/patcha2
160 # HG changeset patch
162 # HG changeset patch
161 # Parent ???????????????????????????????????????? (glob)
163 # Parent ???????????????????????????????????????? (glob)
162 # Date 0 0
164 # Date 0 0
163
165
164 diff -r ???????????? -r ???????????? a (glob)
166 diff -r ???????????? -r ???????????? a (glob)
165 --- a/a
167 --- a/a
166 +++ b/a
168 +++ b/a
167 @@ -1,2 +1,3 @@
169 @@ -1,2 +1,3 @@
168 a
170 a
169 c
171 c
170 +d
172 +d
171
173
172 $ cd ..
174 $ cd ..
173
175
@@ -1,1569 +1,1607 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 (glob)
1342 moving x/x to y/x (glob)
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
1571
1572 test for case where we didn't look sufficiently far back to find rename ancestor
1573
1574 $ hg init diffstop
1575 $ cd diffstop
1576 $ echo > f
1577 $ hg ci -qAmf
1578 $ hg mv f g
1579 $ hg ci -m'f->g'
1580 $ hg up -qr0
1581 $ touch x
1582 $ hg ci -qAmx
1583 $ echo f > f
1584 $ hg ci -qmf=f
1585 $ hg merge -q
1586 $ hg ci -mmerge
1587 $ hg log -G --template '{rev} {desc}'
1588 @ 4 merge
1589 |\
1590 | o 3 f=f
1591 | |
1592 | o 2 x
1593 | |
1594 o | 1 f->g
1595 |/
1596 o 0 f
1597
1598 $ hg diff --git -r 2
1599 diff --git a/f b/g
1600 rename from f
1601 rename to g
1602 --- a/f
1603 +++ b/g
1604 @@ -1,1 +1,1 @@
1605 -
1606 +f
1607 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now