##// END OF EJS Templates
filemerge: fix the wrong placements of messages in prompt...
Pulkit Goyal -
r39321:a3fd84f4 default
parent child Browse files
Show More
@@ -1,1015 +1,1015 b''
1 1 # filemerge.py - file-level merge handling for Mercurial
2 2 #
3 3 # Copyright 2006, 2007, 2008 Matt Mackall <mpm@selenic.com>
4 4 #
5 5 # This software may be used and distributed according to the terms of the
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from __future__ import absolute_import
9 9
10 10 import contextlib
11 11 import os
12 12 import re
13 13 import shutil
14 14
15 15 from .i18n import _
16 16 from .node import nullid, short
17 17
18 18 from . import (
19 19 encoding,
20 20 error,
21 21 formatter,
22 22 match,
23 23 pycompat,
24 24 registrar,
25 25 scmutil,
26 26 simplemerge,
27 27 tagmerge,
28 28 templatekw,
29 29 templater,
30 30 util,
31 31 )
32 32
33 33 from .utils import (
34 34 procutil,
35 35 stringutil,
36 36 )
37 37
38 38 def _toolstr(ui, tool, part, *args):
39 39 return ui.config("merge-tools", tool + "." + part, *args)
40 40
41 41 def _toolbool(ui, tool, part,*args):
42 42 return ui.configbool("merge-tools", tool + "." + part, *args)
43 43
44 44 def _toollist(ui, tool, part):
45 45 return ui.configlist("merge-tools", tool + "." + part)
46 46
47 47 internals = {}
48 48 # Merge tools to document.
49 49 internalsdoc = {}
50 50
51 51 internaltool = registrar.internalmerge()
52 52
53 53 # internal tool merge types
54 54 nomerge = internaltool.nomerge
55 55 mergeonly = internaltool.mergeonly # just the full merge, no premerge
56 56 fullmerge = internaltool.fullmerge # both premerge and merge
57 57
58 58 _localchangedotherdeletedmsg = _(
59 "file '%(fd)s' was deleted in local%(l)s but was modified in other%(o)s.\n"
59 "file '%(fd)s' was deleted in other%(o)s but was modified in local%(l)s.\n"
60 60 "What do you want to do?\n"
61 61 "use (c)hanged version, (d)elete, or leave (u)nresolved?"
62 62 "$$ &Changed $$ &Delete $$ &Unresolved")
63 63
64 64 _otherchangedlocaldeletedmsg = _(
65 "file '%(fd)s' was deleted in other%(o)s but was modified in local%(l)s.\n"
65 "file '%(fd)s' was deleted in local%(l)s but was modified in other%(o)s.\n"
66 66 "What do you want to do?\n"
67 67 "use (c)hanged version, leave (d)eleted, or "
68 68 "leave (u)nresolved?"
69 69 "$$ &Changed $$ &Deleted $$ &Unresolved")
70 70
71 71 class absentfilectx(object):
72 72 """Represents a file that's ostensibly in a context but is actually not
73 73 present in it.
74 74
75 75 This is here because it's very specific to the filemerge code for now --
76 76 other code is likely going to break with the values this returns."""
77 77 def __init__(self, ctx, f):
78 78 self._ctx = ctx
79 79 self._f = f
80 80
81 81 def path(self):
82 82 return self._f
83 83
84 84 def size(self):
85 85 return None
86 86
87 87 def data(self):
88 88 return None
89 89
90 90 def filenode(self):
91 91 return nullid
92 92
93 93 _customcmp = True
94 94 def cmp(self, fctx):
95 95 """compare with other file context
96 96
97 97 returns True if different from fctx.
98 98 """
99 99 return not (fctx.isabsent() and
100 100 fctx.ctx() == self.ctx() and
101 101 fctx.path() == self.path())
102 102
103 103 def flags(self):
104 104 return ''
105 105
106 106 def changectx(self):
107 107 return self._ctx
108 108
109 109 def isbinary(self):
110 110 return False
111 111
112 112 def isabsent(self):
113 113 return True
114 114
115 115 def _findtool(ui, tool):
116 116 if tool in internals:
117 117 return tool
118 118 cmd = _toolstr(ui, tool, "executable", tool)
119 119 if cmd.startswith('python:'):
120 120 return cmd
121 121 return findexternaltool(ui, tool)
122 122
123 123 def _quotetoolpath(cmd):
124 124 if cmd.startswith('python:'):
125 125 return cmd
126 126 return procutil.shellquote(cmd)
127 127
128 128 def findexternaltool(ui, tool):
129 129 for kn in ("regkey", "regkeyalt"):
130 130 k = _toolstr(ui, tool, kn)
131 131 if not k:
132 132 continue
133 133 p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
134 134 if p:
135 135 p = procutil.findexe(p + _toolstr(ui, tool, "regappend", ""))
136 136 if p:
137 137 return p
138 138 exe = _toolstr(ui, tool, "executable", tool)
139 139 return procutil.findexe(util.expandpath(exe))
140 140
141 141 def _picktool(repo, ui, path, binary, symlink, changedelete):
142 142 strictcheck = ui.configbool('merge', 'strict-capability-check')
143 143
144 144 def hascapability(tool, capability, strict=False):
145 145 if tool in internals:
146 146 return strict and internals[tool].capabilities.get(capability)
147 147 return _toolbool(ui, tool, capability)
148 148
149 149 def supportscd(tool):
150 150 return tool in internals and internals[tool].mergetype == nomerge
151 151
152 152 def check(tool, pat, symlink, binary, changedelete):
153 153 tmsg = tool
154 154 if pat:
155 155 tmsg = _("%s (for pattern %s)") % (tool, pat)
156 156 if not _findtool(ui, tool):
157 157 if pat: # explicitly requested tool deserves a warning
158 158 ui.warn(_("couldn't find merge tool %s\n") % tmsg)
159 159 else: # configured but non-existing tools are more silent
160 160 ui.note(_("couldn't find merge tool %s\n") % tmsg)
161 161 elif symlink and not hascapability(tool, "symlink", strictcheck):
162 162 ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
163 163 elif binary and not hascapability(tool, "binary", strictcheck):
164 164 ui.warn(_("tool %s can't handle binary\n") % tmsg)
165 165 elif changedelete and not supportscd(tool):
166 166 # the nomerge tools are the only tools that support change/delete
167 167 # conflicts
168 168 pass
169 169 elif not procutil.gui() and _toolbool(ui, tool, "gui"):
170 170 ui.warn(_("tool %s requires a GUI\n") % tmsg)
171 171 else:
172 172 return True
173 173 return False
174 174
175 175 # internal config: ui.forcemerge
176 176 # forcemerge comes from command line arguments, highest priority
177 177 force = ui.config('ui', 'forcemerge')
178 178 if force:
179 179 toolpath = _findtool(ui, force)
180 180 if changedelete and not supportscd(toolpath):
181 181 return ":prompt", None
182 182 else:
183 183 if toolpath:
184 184 return (force, _quotetoolpath(toolpath))
185 185 else:
186 186 # mimic HGMERGE if given tool not found
187 187 return (force, force)
188 188
189 189 # HGMERGE takes next precedence
190 190 hgmerge = encoding.environ.get("HGMERGE")
191 191 if hgmerge:
192 192 if changedelete and not supportscd(hgmerge):
193 193 return ":prompt", None
194 194 else:
195 195 return (hgmerge, hgmerge)
196 196
197 197 # then patterns
198 198
199 199 # whether binary capability should be checked strictly
200 200 binarycap = binary and strictcheck
201 201
202 202 for pat, tool in ui.configitems("merge-patterns"):
203 203 mf = match.match(repo.root, '', [pat])
204 204 if mf(path) and check(tool, pat, symlink, binarycap, changedelete):
205 205 if binary and not hascapability(tool, "binary", strict=True):
206 206 ui.warn(_("warning: check merge-patterns configurations,"
207 207 " if %r for binary file %r is unintentional\n"
208 208 "(see 'hg help merge-tools'"
209 209 " for binary files capability)\n")
210 210 % (pycompat.bytestr(tool), pycompat.bytestr(path)))
211 211 toolpath = _findtool(ui, tool)
212 212 return (tool, _quotetoolpath(toolpath))
213 213
214 214 # then merge tools
215 215 tools = {}
216 216 disabled = set()
217 217 for k, v in ui.configitems("merge-tools"):
218 218 t = k.split('.')[0]
219 219 if t not in tools:
220 220 tools[t] = int(_toolstr(ui, t, "priority"))
221 221 if _toolbool(ui, t, "disabled"):
222 222 disabled.add(t)
223 223 names = tools.keys()
224 224 tools = sorted([(-p, tool) for tool, p in tools.items()
225 225 if tool not in disabled])
226 226 uimerge = ui.config("ui", "merge")
227 227 if uimerge:
228 228 # external tools defined in uimerge won't be able to handle
229 229 # change/delete conflicts
230 230 if check(uimerge, path, symlink, binary, changedelete):
231 231 if uimerge not in names and not changedelete:
232 232 return (uimerge, uimerge)
233 233 tools.insert(0, (None, uimerge)) # highest priority
234 234 tools.append((None, "hgmerge")) # the old default, if found
235 235 for p, t in tools:
236 236 if check(t, None, symlink, binary, changedelete):
237 237 toolpath = _findtool(ui, t)
238 238 return (t, _quotetoolpath(toolpath))
239 239
240 240 # internal merge or prompt as last resort
241 241 if symlink or binary or changedelete:
242 242 if not changedelete and len(tools):
243 243 # any tool is rejected by capability for symlink or binary
244 244 ui.warn(_("no tool found to merge %s\n") % path)
245 245 return ":prompt", None
246 246 return ":merge", None
247 247
248 248 def _eoltype(data):
249 249 "Guess the EOL type of a file"
250 250 if '\0' in data: # binary
251 251 return None
252 252 if '\r\n' in data: # Windows
253 253 return '\r\n'
254 254 if '\r' in data: # Old Mac
255 255 return '\r'
256 256 if '\n' in data: # UNIX
257 257 return '\n'
258 258 return None # unknown
259 259
260 260 def _matcheol(file, back):
261 261 "Convert EOL markers in a file to match origfile"
262 262 tostyle = _eoltype(back.data()) # No repo.wread filters?
263 263 if tostyle:
264 264 data = util.readfile(file)
265 265 style = _eoltype(data)
266 266 if style:
267 267 newdata = data.replace(style, tostyle)
268 268 if newdata != data:
269 269 util.writefile(file, newdata)
270 270
271 271 @internaltool('prompt', nomerge)
272 272 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
273 273 """Asks the user which of the local `p1()` or the other `p2()` version to
274 274 keep as the merged version."""
275 275 ui = repo.ui
276 276 fd = fcd.path()
277 277
278 278 # Avoid prompting during an in-memory merge since it doesn't support merge
279 279 # conflicts.
280 280 if fcd.changectx().isinmemory():
281 281 raise error.InMemoryMergeConflictsError('in-memory merge does not '
282 282 'support file conflicts')
283 283
284 284 prompts = partextras(labels)
285 285 prompts['fd'] = fd
286 286 try:
287 287 if fco.isabsent():
288 288 index = ui.promptchoice(
289 289 _localchangedotherdeletedmsg % prompts, 2)
290 290 choice = ['local', 'other', 'unresolved'][index]
291 291 elif fcd.isabsent():
292 292 index = ui.promptchoice(
293 293 _otherchangedlocaldeletedmsg % prompts, 2)
294 294 choice = ['other', 'local', 'unresolved'][index]
295 295 else:
296 296 index = ui.promptchoice(
297 297 _("keep (l)ocal%(l)s, take (o)ther%(o)s, or leave (u)nresolved"
298 298 " for %(fd)s?"
299 299 "$$ &Local $$ &Other $$ &Unresolved") % prompts, 2)
300 300 choice = ['local', 'other', 'unresolved'][index]
301 301
302 302 if choice == 'other':
303 303 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf,
304 304 labels)
305 305 elif choice == 'local':
306 306 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf,
307 307 labels)
308 308 elif choice == 'unresolved':
309 309 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
310 310 labels)
311 311 except error.ResponseExpected:
312 312 ui.write("\n")
313 313 return _ifail(repo, mynode, orig, fcd, fco, fca, toolconf,
314 314 labels)
315 315
316 316 @internaltool('local', nomerge)
317 317 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
318 318 """Uses the local `p1()` version of files as the merged version."""
319 319 return 0, fcd.isabsent()
320 320
321 321 @internaltool('other', nomerge)
322 322 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
323 323 """Uses the other `p2()` version of files as the merged version."""
324 324 if fco.isabsent():
325 325 # local changed, remote deleted -- 'deleted' picked
326 326 _underlyingfctxifabsent(fcd).remove()
327 327 deleted = True
328 328 else:
329 329 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
330 330 deleted = False
331 331 return 0, deleted
332 332
333 333 @internaltool('fail', nomerge)
334 334 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf, labels=None):
335 335 """
336 336 Rather than attempting to merge files that were modified on both
337 337 branches, it marks them as unresolved. The resolve command must be
338 338 used to resolve these conflicts."""
339 339 # for change/delete conflicts write out the changed version, then fail
340 340 if fcd.isabsent():
341 341 _underlyingfctxifabsent(fcd).write(fco.data(), fco.flags())
342 342 return 1, False
343 343
344 344 def _underlyingfctxifabsent(filectx):
345 345 """Sometimes when resolving, our fcd is actually an absentfilectx, but
346 346 we want to write to it (to do the resolve). This helper returns the
347 347 underyling workingfilectx in that case.
348 348 """
349 349 if filectx.isabsent():
350 350 return filectx.changectx()[filectx.path()]
351 351 else:
352 352 return filectx
353 353
354 354 def _premerge(repo, fcd, fco, fca, toolconf, files, labels=None):
355 355 tool, toolpath, binary, symlink, scriptfn = toolconf
356 356 if symlink or fcd.isabsent() or fco.isabsent():
357 357 return 1
358 358 unused, unused, unused, back = files
359 359
360 360 ui = repo.ui
361 361
362 362 validkeep = ['keep', 'keep-merge3']
363 363
364 364 # do we attempt to simplemerge first?
365 365 try:
366 366 premerge = _toolbool(ui, tool, "premerge", not binary)
367 367 except error.ConfigError:
368 368 premerge = _toolstr(ui, tool, "premerge", "").lower()
369 369 if premerge not in validkeep:
370 370 _valid = ', '.join(["'" + v + "'" for v in validkeep])
371 371 raise error.ConfigError(_("%s.premerge not valid "
372 372 "('%s' is neither boolean nor %s)") %
373 373 (tool, premerge, _valid))
374 374
375 375 if premerge:
376 376 if premerge == 'keep-merge3':
377 377 if not labels:
378 378 labels = _defaultconflictlabels
379 379 if len(labels) < 3:
380 380 labels.append('base')
381 381 r = simplemerge.simplemerge(ui, fcd, fca, fco, quiet=True, label=labels)
382 382 if not r:
383 383 ui.debug(" premerge successful\n")
384 384 return 0
385 385 if premerge not in validkeep:
386 386 # restore from backup and try again
387 387 _restorebackup(fcd, back)
388 388 return 1 # continue merging
389 389
390 390 def _mergecheck(repo, mynode, orig, fcd, fco, fca, toolconf):
391 391 tool, toolpath, binary, symlink, scriptfn = toolconf
392 392 if symlink:
393 393 repo.ui.warn(_('warning: internal %s cannot merge symlinks '
394 394 'for %s\n') % (tool, fcd.path()))
395 395 return False
396 396 if fcd.isabsent() or fco.isabsent():
397 397 repo.ui.warn(_('warning: internal %s cannot merge change/delete '
398 398 'conflict for %s\n') % (tool, fcd.path()))
399 399 return False
400 400 return True
401 401
402 402 def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
403 403 """
404 404 Uses the internal non-interactive simple merge algorithm for merging
405 405 files. It will fail if there are any conflicts and leave markers in
406 406 the partially merged file. Markers will have two sections, one for each side
407 407 of merge, unless mode equals 'union' which suppresses the markers."""
408 408 ui = repo.ui
409 409
410 410 r = simplemerge.simplemerge(ui, fcd, fca, fco, label=labels, mode=mode)
411 411 return True, r, False
412 412
413 413 @internaltool('union', fullmerge,
414 414 _("warning: conflicts while merging %s! "
415 415 "(edit, then use 'hg resolve --mark')\n"),
416 416 precheck=_mergecheck)
417 417 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
418 418 """
419 419 Uses the internal non-interactive simple merge algorithm for merging
420 420 files. It will use both left and right sides for conflict regions.
421 421 No markers are inserted."""
422 422 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
423 423 files, labels, 'union')
424 424
425 425 @internaltool('merge', fullmerge,
426 426 _("warning: conflicts while merging %s! "
427 427 "(edit, then use 'hg resolve --mark')\n"),
428 428 precheck=_mergecheck)
429 429 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
430 430 """
431 431 Uses the internal non-interactive simple merge algorithm for merging
432 432 files. It will fail if there are any conflicts and leave markers in
433 433 the partially merged file. Markers will have two sections, one for each side
434 434 of merge."""
435 435 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
436 436 files, labels, 'merge')
437 437
438 438 @internaltool('merge3', fullmerge,
439 439 _("warning: conflicts while merging %s! "
440 440 "(edit, then use 'hg resolve --mark')\n"),
441 441 precheck=_mergecheck)
442 442 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
443 443 """
444 444 Uses the internal non-interactive simple merge algorithm for merging
445 445 files. It will fail if there are any conflicts and leave markers in
446 446 the partially merged file. Marker will have three sections, one from each
447 447 side of the merge and one for the base content."""
448 448 if not labels:
449 449 labels = _defaultconflictlabels
450 450 if len(labels) < 3:
451 451 labels.append('base')
452 452 return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels)
453 453
454 454 def _imergeauto(repo, mynode, orig, fcd, fco, fca, toolconf, files,
455 455 labels=None, localorother=None):
456 456 """
457 457 Generic driver for _imergelocal and _imergeother
458 458 """
459 459 assert localorother is not None
460 460 tool, toolpath, binary, symlink, scriptfn = toolconf
461 461 r = simplemerge.simplemerge(repo.ui, fcd, fca, fco, label=labels,
462 462 localorother=localorother)
463 463 return True, r
464 464
465 465 @internaltool('merge-local', mergeonly, precheck=_mergecheck)
466 466 def _imergelocal(*args, **kwargs):
467 467 """
468 468 Like :merge, but resolve all conflicts non-interactively in favor
469 469 of the local `p1()` changes."""
470 470 success, status = _imergeauto(localorother='local', *args, **kwargs)
471 471 return success, status, False
472 472
473 473 @internaltool('merge-other', mergeonly, precheck=_mergecheck)
474 474 def _imergeother(*args, **kwargs):
475 475 """
476 476 Like :merge, but resolve all conflicts non-interactively in favor
477 477 of the other `p2()` changes."""
478 478 success, status = _imergeauto(localorother='other', *args, **kwargs)
479 479 return success, status, False
480 480
481 481 @internaltool('tagmerge', mergeonly,
482 482 _("automatic tag merging of %s failed! "
483 483 "(use 'hg resolve --tool :merge' or another merge "
484 484 "tool of your choice)\n"))
485 485 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
486 486 """
487 487 Uses the internal tag merge algorithm (experimental).
488 488 """
489 489 success, status = tagmerge.merge(repo, fcd, fco, fca)
490 490 return success, status, False
491 491
492 492 @internaltool('dump', fullmerge, binary=True, symlink=True)
493 493 def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
494 494 """
495 495 Creates three versions of the files to merge, containing the
496 496 contents of local, other and base. These files can then be used to
497 497 perform a merge manually. If the file to be merged is named
498 498 ``a.txt``, these files will accordingly be named ``a.txt.local``,
499 499 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
500 500 same directory as ``a.txt``.
501 501
502 502 This implies premerge. Therefore, files aren't dumped, if premerge
503 503 runs successfully. Use :forcedump to forcibly write files out.
504 504 """
505 505 a = _workingpath(repo, fcd)
506 506 fd = fcd.path()
507 507
508 508 from . import context
509 509 if isinstance(fcd, context.overlayworkingfilectx):
510 510 raise error.InMemoryMergeConflictsError('in-memory merge does not '
511 511 'support the :dump tool.')
512 512
513 513 util.writefile(a + ".local", fcd.decodeddata())
514 514 repo.wwrite(fd + ".other", fco.data(), fco.flags())
515 515 repo.wwrite(fd + ".base", fca.data(), fca.flags())
516 516 return False, 1, False
517 517
518 518 @internaltool('forcedump', mergeonly, binary=True, symlink=True)
519 519 def _forcedump(repo, mynode, orig, fcd, fco, fca, toolconf, files,
520 520 labels=None):
521 521 """
522 522 Creates three versions of the files as same as :dump, but omits premerge.
523 523 """
524 524 return _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files,
525 525 labels=labels)
526 526
527 527 def _xmergeimm(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
528 528 # In-memory merge simply raises an exception on all external merge tools,
529 529 # for now.
530 530 #
531 531 # It would be possible to run most tools with temporary files, but this
532 532 # raises the question of what to do if the user only partially resolves the
533 533 # file -- we can't leave a merge state. (Copy to somewhere in the .hg/
534 534 # directory and tell the user how to get it is my best idea, but it's
535 535 # clunky.)
536 536 raise error.InMemoryMergeConflictsError('in-memory merge does not support '
537 537 'external merge tools')
538 538
539 539 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
540 540 tool, toolpath, binary, symlink, scriptfn = toolconf
541 541 if fcd.isabsent() or fco.isabsent():
542 542 repo.ui.warn(_('warning: %s cannot merge change/delete conflict '
543 543 'for %s\n') % (tool, fcd.path()))
544 544 return False, 1, None
545 545 unused, unused, unused, back = files
546 546 localpath = _workingpath(repo, fcd)
547 547 args = _toolstr(repo.ui, tool, "args")
548 548
549 549 with _maketempfiles(repo, fco, fca, repo.wvfs.join(back.path()),
550 550 "$output" in args) as temppaths:
551 551 basepath, otherpath, localoutputpath = temppaths
552 552 outpath = ""
553 553 mylabel, otherlabel = labels[:2]
554 554 if len(labels) >= 3:
555 555 baselabel = labels[2]
556 556 else:
557 557 baselabel = 'base'
558 558 env = {'HG_FILE': fcd.path(),
559 559 'HG_MY_NODE': short(mynode),
560 560 'HG_OTHER_NODE': short(fco.changectx().node()),
561 561 'HG_BASE_NODE': short(fca.changectx().node()),
562 562 'HG_MY_ISLINK': 'l' in fcd.flags(),
563 563 'HG_OTHER_ISLINK': 'l' in fco.flags(),
564 564 'HG_BASE_ISLINK': 'l' in fca.flags(),
565 565 'HG_MY_LABEL': mylabel,
566 566 'HG_OTHER_LABEL': otherlabel,
567 567 'HG_BASE_LABEL': baselabel,
568 568 }
569 569 ui = repo.ui
570 570
571 571 if "$output" in args:
572 572 # read input from backup, write to original
573 573 outpath = localpath
574 574 localpath = localoutputpath
575 575 replace = {'local': localpath, 'base': basepath, 'other': otherpath,
576 576 'output': outpath, 'labellocal': mylabel,
577 577 'labelother': otherlabel, 'labelbase': baselabel}
578 578 args = util.interpolate(
579 579 br'\$', replace, args,
580 580 lambda s: procutil.shellquote(util.localpath(s)))
581 581 if _toolbool(ui, tool, "gui"):
582 582 repo.ui.status(_('running merge tool %s for file %s\n') %
583 583 (tool, fcd.path()))
584 584 if scriptfn is None:
585 585 cmd = toolpath + ' ' + args
586 586 repo.ui.debug('launching merge tool: %s\n' % cmd)
587 587 r = ui.system(cmd, cwd=repo.root, environ=env,
588 588 blockedtag='mergetool')
589 589 else:
590 590 repo.ui.debug('launching python merge script: %s:%s\n' %
591 591 (toolpath, scriptfn))
592 592 r = 0
593 593 try:
594 594 # avoid cycle cmdutil->merge->filemerge->extensions->cmdutil
595 595 from . import extensions
596 596 mod = extensions.loadpath(toolpath, 'hgmerge.%s' % tool)
597 597 except Exception:
598 598 raise error.Abort(_("loading python merge script failed: %s") %
599 599 toolpath)
600 600 mergefn = getattr(mod, scriptfn, None)
601 601 if mergefn is None:
602 602 raise error.Abort(_("%s does not have function: %s") %
603 603 (toolpath, scriptfn))
604 604 argslist = procutil.shellsplit(args)
605 605 # avoid cycle cmdutil->merge->filemerge->hook->extensions->cmdutil
606 606 from . import hook
607 607 ret, raised = hook.pythonhook(ui, repo, "merge", toolpath,
608 608 mergefn, {'args': argslist}, True)
609 609 if raised:
610 610 r = 1
611 611 repo.ui.debug('merge tool returned: %d\n' % r)
612 612 return True, r, False
613 613
614 614 def _formatconflictmarker(ctx, template, label, pad):
615 615 """Applies the given template to the ctx, prefixed by the label.
616 616
617 617 Pad is the minimum width of the label prefix, so that multiple markers
618 618 can have aligned templated parts.
619 619 """
620 620 if ctx.node() is None:
621 621 ctx = ctx.p1()
622 622
623 623 props = {'ctx': ctx}
624 624 templateresult = template.renderdefault(props)
625 625
626 626 label = ('%s:' % label).ljust(pad + 1)
627 627 mark = '%s %s' % (label, templateresult)
628 628
629 629 if mark:
630 630 mark = mark.splitlines()[0] # split for safety
631 631
632 632 # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ')
633 633 return stringutil.ellipsis(mark, 80 - 8)
634 634
635 635 _defaultconflictlabels = ['local', 'other']
636 636
637 637 def _formatlabels(repo, fcd, fco, fca, labels, tool=None):
638 638 """Formats the given labels using the conflict marker template.
639 639
640 640 Returns a list of formatted labels.
641 641 """
642 642 cd = fcd.changectx()
643 643 co = fco.changectx()
644 644 ca = fca.changectx()
645 645
646 646 ui = repo.ui
647 647 template = ui.config('ui', 'mergemarkertemplate')
648 648 if tool is not None:
649 649 template = _toolstr(ui, tool, 'mergemarkertemplate', template)
650 650 template = templater.unquotestring(template)
651 651 tres = formatter.templateresources(ui, repo)
652 652 tmpl = formatter.maketemplater(ui, template, defaults=templatekw.keywords,
653 653 resources=tres)
654 654
655 655 pad = max(len(l) for l in labels)
656 656
657 657 newlabels = [_formatconflictmarker(cd, tmpl, labels[0], pad),
658 658 _formatconflictmarker(co, tmpl, labels[1], pad)]
659 659 if len(labels) > 2:
660 660 newlabels.append(_formatconflictmarker(ca, tmpl, labels[2], pad))
661 661 return newlabels
662 662
663 663 def partextras(labels):
664 664 """Return a dictionary of extra labels for use in prompts to the user
665 665
666 666 Intended use is in strings of the form "(l)ocal%(l)s".
667 667 """
668 668 if labels is None:
669 669 return {
670 670 "l": "",
671 671 "o": "",
672 672 }
673 673
674 674 return {
675 675 "l": " [%s]" % labels[0],
676 676 "o": " [%s]" % labels[1],
677 677 }
678 678
679 679 def _restorebackup(fcd, back):
680 680 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
681 681 # util.copy here instead.
682 682 fcd.write(back.data(), fcd.flags())
683 683
684 684 def _makebackup(repo, ui, wctx, fcd, premerge):
685 685 """Makes and returns a filectx-like object for ``fcd``'s backup file.
686 686
687 687 In addition to preserving the user's pre-existing modifications to `fcd`
688 688 (if any), the backup is used to undo certain premerges, confirm whether a
689 689 merge changed anything, and determine what line endings the new file should
690 690 have.
691 691
692 692 Backups only need to be written once (right before the premerge) since their
693 693 content doesn't change afterwards.
694 694 """
695 695 if fcd.isabsent():
696 696 return None
697 697 # TODO: Break this import cycle somehow. (filectx -> ctx -> fileset ->
698 698 # merge -> filemerge). (I suspect the fileset import is the weakest link)
699 699 from . import context
700 700 a = _workingpath(repo, fcd)
701 701 back = scmutil.origpath(ui, repo, a)
702 702 inworkingdir = (back.startswith(repo.wvfs.base) and not
703 703 back.startswith(repo.vfs.base))
704 704 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
705 705 # If the backup file is to be in the working directory, and we're
706 706 # merging in-memory, we must redirect the backup to the memory context
707 707 # so we don't disturb the working directory.
708 708 relpath = back[len(repo.wvfs.base) + 1:]
709 709 if premerge:
710 710 wctx[relpath].write(fcd.data(), fcd.flags())
711 711 return wctx[relpath]
712 712 else:
713 713 if premerge:
714 714 # Otherwise, write to wherever path the user specified the backups
715 715 # should go. We still need to switch based on whether the source is
716 716 # in-memory so we can use the fast path of ``util.copy`` if both are
717 717 # on disk.
718 718 if isinstance(fcd, context.overlayworkingfilectx):
719 719 util.writefile(back, fcd.data())
720 720 else:
721 721 util.copyfile(a, back)
722 722 # A arbitraryfilectx is returned, so we can run the same functions on
723 723 # the backup context regardless of where it lives.
724 724 return context.arbitraryfilectx(back, repo=repo)
725 725
726 726 @contextlib.contextmanager
727 727 def _maketempfiles(repo, fco, fca, localpath, uselocalpath):
728 728 """Writes out `fco` and `fca` as temporary files, and (if uselocalpath)
729 729 copies `localpath` to another temporary file, so an external merge tool may
730 730 use them.
731 731 """
732 732 tmproot = None
733 733 tmprootprefix = repo.ui.config('experimental', 'mergetempdirprefix')
734 734 if tmprootprefix:
735 735 tmproot = pycompat.mkdtemp(prefix=tmprootprefix)
736 736
737 737 def maketempfrompath(prefix, path):
738 738 fullbase, ext = os.path.splitext(path)
739 739 pre = "%s~%s" % (os.path.basename(fullbase), prefix)
740 740 if tmproot:
741 741 name = os.path.join(tmproot, pre)
742 742 if ext:
743 743 name += ext
744 744 f = open(name, r"wb")
745 745 else:
746 746 fd, name = pycompat.mkstemp(prefix=pre + '.', suffix=ext)
747 747 f = os.fdopen(fd, r"wb")
748 748 return f, name
749 749
750 750 def tempfromcontext(prefix, ctx):
751 751 f, name = maketempfrompath(prefix, ctx.path())
752 752 data = repo.wwritedata(ctx.path(), ctx.data())
753 753 f.write(data)
754 754 f.close()
755 755 return name
756 756
757 757 b = tempfromcontext("base", fca)
758 758 c = tempfromcontext("other", fco)
759 759 d = localpath
760 760 if uselocalpath:
761 761 # We start off with this being the backup filename, so remove the .orig
762 762 # to make syntax-highlighting more likely.
763 763 if d.endswith('.orig'):
764 764 d, _ = os.path.splitext(d)
765 765 f, d = maketempfrompath("local", d)
766 766 with open(localpath, 'rb') as src:
767 767 f.write(src.read())
768 768 f.close()
769 769
770 770 try:
771 771 yield b, c, d
772 772 finally:
773 773 if tmproot:
774 774 shutil.rmtree(tmproot)
775 775 else:
776 776 util.unlink(b)
777 777 util.unlink(c)
778 778 # if not uselocalpath, d is the 'orig'/backup file which we
779 779 # shouldn't delete.
780 780 if d and uselocalpath:
781 781 util.unlink(d)
782 782
783 783 def _filemerge(premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
784 784 """perform a 3-way merge in the working directory
785 785
786 786 premerge = whether this is a premerge
787 787 mynode = parent node before merge
788 788 orig = original local filename before merge
789 789 fco = other file context
790 790 fca = ancestor file context
791 791 fcd = local file context for current/destination file
792 792
793 793 Returns whether the merge is complete, the return value of the merge, and
794 794 a boolean indicating whether the file was deleted from disk."""
795 795
796 796 if not fco.cmp(fcd): # files identical?
797 797 return True, None, False
798 798
799 799 ui = repo.ui
800 800 fd = fcd.path()
801 801 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
802 802 symlink = 'l' in fcd.flags() + fco.flags()
803 803 changedelete = fcd.isabsent() or fco.isabsent()
804 804 tool, toolpath = _picktool(repo, ui, fd, binary, symlink, changedelete)
805 805 scriptfn = None
806 806 if tool in internals and tool.startswith('internal:'):
807 807 # normalize to new-style names (':merge' etc)
808 808 tool = tool[len('internal'):]
809 809 if toolpath and toolpath.startswith('python:'):
810 810 invalidsyntax = False
811 811 if toolpath.count(':') >= 2:
812 812 script, scriptfn = toolpath[7:].rsplit(':', 1)
813 813 if not scriptfn:
814 814 invalidsyntax = True
815 815 # missing :callable can lead to spliting on windows drive letter
816 816 if '\\' in scriptfn or '/' in scriptfn:
817 817 invalidsyntax = True
818 818 else:
819 819 invalidsyntax = True
820 820 if invalidsyntax:
821 821 raise error.Abort(_("invalid 'python:' syntax: %s") % toolpath)
822 822 toolpath = script
823 823 ui.debug("picked tool '%s' for %s (binary %s symlink %s changedelete %s)\n"
824 824 % (tool, fd, pycompat.bytestr(binary), pycompat.bytestr(symlink),
825 825 pycompat.bytestr(changedelete)))
826 826
827 827 if tool in internals:
828 828 func = internals[tool]
829 829 mergetype = func.mergetype
830 830 onfailure = func.onfailure
831 831 precheck = func.precheck
832 832 isexternal = False
833 833 else:
834 834 if wctx.isinmemory():
835 835 func = _xmergeimm
836 836 else:
837 837 func = _xmerge
838 838 mergetype = fullmerge
839 839 onfailure = _("merging %s failed!\n")
840 840 precheck = None
841 841 isexternal = True
842 842
843 843 toolconf = tool, toolpath, binary, symlink, scriptfn
844 844
845 845 if mergetype == nomerge:
846 846 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf, labels)
847 847 return True, r, deleted
848 848
849 849 if premerge:
850 850 if orig != fco.path():
851 851 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
852 852 else:
853 853 ui.status(_("merging %s\n") % fd)
854 854
855 855 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
856 856
857 857 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca,
858 858 toolconf):
859 859 if onfailure:
860 860 if wctx.isinmemory():
861 861 raise error.InMemoryMergeConflictsError('in-memory merge does '
862 862 'not support merge '
863 863 'conflicts')
864 864 ui.warn(onfailure % fd)
865 865 return True, 1, False
866 866
867 867 back = _makebackup(repo, ui, wctx, fcd, premerge)
868 868 files = (None, None, None, back)
869 869 r = 1
870 870 try:
871 871 internalmarkerstyle = ui.config('ui', 'mergemarkers')
872 872 if isexternal:
873 873 markerstyle = _toolstr(ui, tool, 'mergemarkers')
874 874 else:
875 875 markerstyle = internalmarkerstyle
876 876
877 877 if not labels:
878 878 labels = _defaultconflictlabels
879 879 formattedlabels = labels
880 880 if markerstyle != 'basic':
881 881 formattedlabels = _formatlabels(repo, fcd, fco, fca, labels,
882 882 tool=tool)
883 883
884 884 if premerge and mergetype == fullmerge:
885 885 # conflict markers generated by premerge will use 'detailed'
886 886 # settings if either ui.mergemarkers or the tool's mergemarkers
887 887 # setting is 'detailed'. This way tools can have basic labels in
888 888 # space-constrained areas of the UI, but still get full information
889 889 # in conflict markers if premerge is 'keep' or 'keep-merge3'.
890 890 premergelabels = labels
891 891 labeltool = None
892 892 if markerstyle != 'basic':
893 893 # respect 'tool's mergemarkertemplate (which defaults to
894 894 # ui.mergemarkertemplate)
895 895 labeltool = tool
896 896 if internalmarkerstyle != 'basic' or markerstyle != 'basic':
897 897 premergelabels = _formatlabels(repo, fcd, fco, fca,
898 898 premergelabels, tool=labeltool)
899 899
900 900 r = _premerge(repo, fcd, fco, fca, toolconf, files,
901 901 labels=premergelabels)
902 902 # complete if premerge successful (r is 0)
903 903 return not r, r, False
904 904
905 905 needcheck, r, deleted = func(repo, mynode, orig, fcd, fco, fca,
906 906 toolconf, files, labels=formattedlabels)
907 907
908 908 if needcheck:
909 909 r = _check(repo, r, ui, tool, fcd, files)
910 910
911 911 if r:
912 912 if onfailure:
913 913 if wctx.isinmemory():
914 914 raise error.InMemoryMergeConflictsError('in-memory merge '
915 915 'does not support '
916 916 'merge conflicts')
917 917 ui.warn(onfailure % fd)
918 918 _onfilemergefailure(ui)
919 919
920 920 return True, r, deleted
921 921 finally:
922 922 if not r and back is not None:
923 923 back.remove()
924 924
925 925 def _haltmerge():
926 926 msg = _('merge halted after failed merge (see hg resolve)')
927 927 raise error.InterventionRequired(msg)
928 928
929 929 def _onfilemergefailure(ui):
930 930 action = ui.config('merge', 'on-failure')
931 931 if action == 'prompt':
932 932 msg = _('continue merge operation (yn)?' '$$ &Yes $$ &No')
933 933 if ui.promptchoice(msg, 0) == 1:
934 934 _haltmerge()
935 935 if action == 'halt':
936 936 _haltmerge()
937 937 # default action is 'continue', in which case we neither prompt nor halt
938 938
939 939 def hasconflictmarkers(data):
940 940 return bool(re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", data,
941 941 re.MULTILINE))
942 942
943 943 def _check(repo, r, ui, tool, fcd, files):
944 944 fd = fcd.path()
945 945 unused, unused, unused, back = files
946 946
947 947 if not r and (_toolbool(ui, tool, "checkconflicts") or
948 948 'conflicts' in _toollist(ui, tool, "check")):
949 949 if hasconflictmarkers(fcd.data()):
950 950 r = 1
951 951
952 952 checked = False
953 953 if 'prompt' in _toollist(ui, tool, "check"):
954 954 checked = True
955 955 if ui.promptchoice(_("was merge of '%s' successful (yn)?"
956 956 "$$ &Yes $$ &No") % fd, 1):
957 957 r = 1
958 958
959 959 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
960 960 'changed' in
961 961 _toollist(ui, tool, "check")):
962 962 if back is not None and not fcd.cmp(back):
963 963 if ui.promptchoice(_(" output file %s appears unchanged\n"
964 964 "was merge successful (yn)?"
965 965 "$$ &Yes $$ &No") % fd, 1):
966 966 r = 1
967 967
968 968 if back is not None and _toolbool(ui, tool, "fixeol"):
969 969 _matcheol(_workingpath(repo, fcd), back)
970 970
971 971 return r
972 972
973 973 def _workingpath(repo, ctx):
974 974 return repo.wjoin(ctx.path())
975 975
976 976 def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
977 977 return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca,
978 978 labels=labels)
979 979
980 980 def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
981 981 return _filemerge(False, repo, wctx, mynode, orig, fcd, fco, fca,
982 982 labels=labels)
983 983
984 984 def loadinternalmerge(ui, extname, registrarobj):
985 985 """Load internal merge tool from specified registrarobj
986 986 """
987 987 for name, func in registrarobj._table.iteritems():
988 988 fullname = ':' + name
989 989 internals[fullname] = func
990 990 internals['internal:' + name] = func
991 991 internalsdoc[fullname] = func
992 992
993 993 capabilities = sorted([k for k, v in func.capabilities.items() if v])
994 994 if capabilities:
995 995 capdesc = " (actual capabilities: %s)" % ', '.join(capabilities)
996 996 func.__doc__ = (func.__doc__ +
997 997 pycompat.sysstr("\n\n%s" % capdesc))
998 998
999 999 # to put i18n comments into hg.pot for automatically generated texts
1000 1000
1001 1001 # i18n: "binary" and "symlik" are keywords
1002 1002 # i18n: this text is added automatically
1003 1003 _(" (actual capabilities: binary, symlink)")
1004 1004 # i18n: "binary" is keyword
1005 1005 # i18n: this text is added automatically
1006 1006 _(" (actual capabilities: binary)")
1007 1007 # i18n: "symlink" is keyword
1008 1008 # i18n: this text is added automatically
1009 1009 _(" (actual capabilities: symlink)")
1010 1010
1011 1011 # load built-in merge tools explicitly to setup internalsdoc
1012 1012 loadinternalmerge(None, None, internaltool)
1013 1013
1014 1014 # tell hggettext to extract docstrings from these functions:
1015 1015 i18nfunctions = internals.values()
@@ -1,1284 +1,1284 b''
1 1 $ hg init
2 2
3 3 Setup:
4 4
5 5 $ echo a >> a
6 6 $ hg ci -Am 'base'
7 7 adding a
8 8
9 9 Refuse to amend public csets:
10 10
11 11 $ hg phase -r . -p
12 12 $ hg ci --amend
13 13 abort: cannot amend public changesets
14 14 (see 'hg help phases' for details)
15 15 [255]
16 16 $ hg phase -r . -f -d
17 17
18 18 $ echo a >> a
19 19 $ hg ci -Am 'base1'
20 20
21 21 Nothing to amend:
22 22
23 23 $ hg ci --amend -m 'base1'
24 24 nothing changed
25 25 [1]
26 26
27 27 $ cat >> $HGRCPATH <<EOF
28 28 > [hooks]
29 29 > pretxncommit.foo = sh -c "echo \\"pretxncommit \$HG_NODE\\"; hg id -r \$HG_NODE"
30 30 > EOF
31 31
32 32 Amending changeset with changes in working dir:
33 33 (and check that --message does not trigger an editor)
34 34
35 35 $ echo a >> a
36 36 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -m 'amend base1'
37 37 pretxncommit 43f1ba15f28a50abf0aae529cf8a16bfced7b149
38 38 43f1ba15f28a tip
39 39 saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-5ab4f721-amend.hg
40 40 $ echo 'pretxncommit.foo = ' >> $HGRCPATH
41 41 $ hg diff -c .
42 42 diff -r ad120869acf0 -r 43f1ba15f28a a
43 43 --- a/a Thu Jan 01 00:00:00 1970 +0000
44 44 +++ b/a Thu Jan 01 00:00:00 1970 +0000
45 45 @@ -1,1 +1,3 @@
46 46 a
47 47 +a
48 48 +a
49 49 $ hg log
50 50 changeset: 1:43f1ba15f28a
51 51 tag: tip
52 52 user: test
53 53 date: Thu Jan 01 00:00:00 1970 +0000
54 54 summary: amend base1
55 55
56 56 changeset: 0:ad120869acf0
57 57 user: test
58 58 date: Thu Jan 01 00:00:00 1970 +0000
59 59 summary: base
60 60
61 61
62 62 Check proper abort for empty message
63 63
64 64 $ cat > editor.sh << '__EOF__'
65 65 > #!/bin/sh
66 66 > echo "" > "$1"
67 67 > __EOF__
68 68
69 69 Update the existing file to ensure that the dirstate is not in pending state
70 70 (where the status of some files in the working copy is not known yet). This in
71 71 turn ensures that when the transaction is aborted due to an empty message during
72 72 the amend, there should be no rollback.
73 73 $ echo a >> a
74 74
75 75 $ echo b > b
76 76 $ hg add b
77 77 $ hg summary
78 78 parent: 1:43f1ba15f28a tip
79 79 amend base1
80 80 branch: default
81 81 commit: 1 modified, 1 added, 1 unknown
82 82 update: (current)
83 83 phases: 2 draft
84 84 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
85 85 abort: empty commit message
86 86 [255]
87 87 $ hg summary
88 88 parent: 1:43f1ba15f28a tip
89 89 amend base1
90 90 branch: default
91 91 commit: 1 modified, 1 added, 1 unknown
92 92 update: (current)
93 93 phases: 2 draft
94 94
95 95 Add new file along with modified existing file:
96 96 $ hg ci --amend -m 'amend base1 new file'
97 97 saved backup bundle to $TESTTMP/.hg/strip-backup/43f1ba15f28a-007467c2-amend.hg
98 98
99 99 Remove file that was added in amended commit:
100 100 (and test logfile option)
101 101 (and test that logfile option do not trigger an editor)
102 102
103 103 $ hg rm b
104 104 $ echo 'amend base1 remove new file' > ../logfile
105 105 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg ci --amend --logfile ../logfile
106 106 saved backup bundle to $TESTTMP/.hg/strip-backup/c16295aaf401-1ada9901-amend.hg
107 107
108 108 $ hg cat b
109 109 b: no such file in rev 47343646fa3d
110 110 [1]
111 111
112 112 No changes, just a different message:
113 113
114 114 $ hg ci -v --amend -m 'no changes, new message'
115 115 amending changeset 47343646fa3d
116 116 copying changeset 47343646fa3d to ad120869acf0
117 117 committing files:
118 118 a
119 119 committing manifest
120 120 committing changelog
121 121 1 changesets found
122 122 uncompressed size of bundle content:
123 123 254 (changelog)
124 124 163 (manifests)
125 125 131 a
126 126 saved backup bundle to $TESTTMP/.hg/strip-backup/47343646fa3d-c2758885-amend.hg
127 127 1 changesets found
128 128 uncompressed size of bundle content:
129 129 250 (changelog)
130 130 163 (manifests)
131 131 131 a
132 132 adding branch
133 133 adding changesets
134 134 adding manifests
135 135 adding file changes
136 136 added 1 changesets with 1 changes to 1 files
137 137 committed changeset 1:401431e913a1
138 138 $ hg diff -c .
139 139 diff -r ad120869acf0 -r 401431e913a1 a
140 140 --- a/a Thu Jan 01 00:00:00 1970 +0000
141 141 +++ b/a Thu Jan 01 00:00:00 1970 +0000
142 142 @@ -1,1 +1,4 @@
143 143 a
144 144 +a
145 145 +a
146 146 +a
147 147 $ hg log
148 148 changeset: 1:401431e913a1
149 149 tag: tip
150 150 user: test
151 151 date: Thu Jan 01 00:00:00 1970 +0000
152 152 summary: no changes, new message
153 153
154 154 changeset: 0:ad120869acf0
155 155 user: test
156 156 date: Thu Jan 01 00:00:00 1970 +0000
157 157 summary: base
158 158
159 159
160 160 Disable default date on commit so when -d isn't given, the old date is preserved:
161 161
162 162 $ echo '[defaults]' >> $HGRCPATH
163 163 $ echo 'commit=' >> $HGRCPATH
164 164
165 165 Test -u/-d:
166 166
167 167 $ cat > .hg/checkeditform.sh <<EOF
168 168 > env | grep HGEDITFORM
169 169 > true
170 170 > EOF
171 171 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -u foo -d '1 0'
172 172 HGEDITFORM=commit.amend.normal
173 173 saved backup bundle to $TESTTMP/.hg/strip-backup/401431e913a1-5e8e532c-amend.hg
174 174 $ echo a >> a
175 175 $ hg ci --amend -u foo -d '1 0'
176 176 saved backup bundle to $TESTTMP/.hg/strip-backup/d96b1d28ae33-677e0afb-amend.hg
177 177 $ hg log -r .
178 178 changeset: 1:a9a13940fc03
179 179 tag: tip
180 180 user: foo
181 181 date: Thu Jan 01 00:00:01 1970 +0000
182 182 summary: no changes, new message
183 183
184 184
185 185 Open editor with old commit message if a message isn't given otherwise:
186 186
187 187 $ cat > editor.sh << '__EOF__'
188 188 > #!/bin/sh
189 189 > cat $1
190 190 > echo "another precious commit message" > "$1"
191 191 > __EOF__
192 192
193 193 at first, test saving last-message.txt
194 194
195 195 $ cat > .hg/hgrc << '__EOF__'
196 196 > [hooks]
197 197 > pretxncommit.test-saving-last-message = false
198 198 > __EOF__
199 199
200 200 $ rm -f .hg/last-message.txt
201 201 $ hg commit --amend -v -m "message given from command line"
202 202 amending changeset a9a13940fc03
203 203 copying changeset a9a13940fc03 to ad120869acf0
204 204 committing files:
205 205 a
206 206 committing manifest
207 207 committing changelog
208 208 running hook pretxncommit.test-saving-last-message: false
209 209 transaction abort!
210 210 rollback completed
211 211 abort: pretxncommit.test-saving-last-message hook exited with status 1
212 212 [255]
213 213 $ cat .hg/last-message.txt
214 214 message given from command line (no-eol)
215 215
216 216 $ rm -f .hg/last-message.txt
217 217 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
218 218 amending changeset a9a13940fc03
219 219 copying changeset a9a13940fc03 to ad120869acf0
220 220 no changes, new message
221 221
222 222
223 223 HG: Enter commit message. Lines beginning with 'HG:' are removed.
224 224 HG: Leave message empty to abort commit.
225 225 HG: --
226 226 HG: user: foo
227 227 HG: branch 'default'
228 228 HG: changed a
229 229 committing files:
230 230 a
231 231 committing manifest
232 232 committing changelog
233 233 running hook pretxncommit.test-saving-last-message: false
234 234 transaction abort!
235 235 rollback completed
236 236 abort: pretxncommit.test-saving-last-message hook exited with status 1
237 237 [255]
238 238
239 239 $ cat .hg/last-message.txt
240 240 another precious commit message
241 241
242 242 $ cat > .hg/hgrc << '__EOF__'
243 243 > [hooks]
244 244 > pretxncommit.test-saving-last-message =
245 245 > __EOF__
246 246
247 247 then, test editing custom commit message
248 248
249 249 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
250 250 amending changeset a9a13940fc03
251 251 copying changeset a9a13940fc03 to ad120869acf0
252 252 no changes, new message
253 253
254 254
255 255 HG: Enter commit message. Lines beginning with 'HG:' are removed.
256 256 HG: Leave message empty to abort commit.
257 257 HG: --
258 258 HG: user: foo
259 259 HG: branch 'default'
260 260 HG: changed a
261 261 committing files:
262 262 a
263 263 committing manifest
264 264 committing changelog
265 265 1 changesets found
266 266 uncompressed size of bundle content:
267 267 249 (changelog)
268 268 163 (manifests)
269 269 133 a
270 270 saved backup bundle to $TESTTMP/.hg/strip-backup/a9a13940fc03-7c2e8674-amend.hg
271 271 1 changesets found
272 272 uncompressed size of bundle content:
273 273 257 (changelog)
274 274 163 (manifests)
275 275 133 a
276 276 adding branch
277 277 adding changesets
278 278 adding manifests
279 279 adding file changes
280 280 added 1 changesets with 1 changes to 1 files
281 281 committed changeset 1:64a124ba1b44
282 282
283 283 Same, but with changes in working dir (different code path):
284 284
285 285 $ echo a >> a
286 286 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend -v
287 287 amending changeset 64a124ba1b44
288 288 another precious commit message
289 289
290 290
291 291 HG: Enter commit message. Lines beginning with 'HG:' are removed.
292 292 HG: Leave message empty to abort commit.
293 293 HG: --
294 294 HG: user: foo
295 295 HG: branch 'default'
296 296 HG: changed a
297 297 committing files:
298 298 a
299 299 committing manifest
300 300 committing changelog
301 301 1 changesets found
302 302 uncompressed size of bundle content:
303 303 257 (changelog)
304 304 163 (manifests)
305 305 133 a
306 306 saved backup bundle to $TESTTMP/.hg/strip-backup/64a124ba1b44-10374b8f-amend.hg
307 307 1 changesets found
308 308 uncompressed size of bundle content:
309 309 257 (changelog)
310 310 163 (manifests)
311 311 135 a
312 312 adding branch
313 313 adding changesets
314 314 adding manifests
315 315 adding file changes
316 316 added 1 changesets with 1 changes to 1 files
317 317 committed changeset 1:7892795b8e38
318 318
319 319 $ rm editor.sh
320 320 $ hg log -r .
321 321 changeset: 1:7892795b8e38
322 322 tag: tip
323 323 user: foo
324 324 date: Thu Jan 01 00:00:01 1970 +0000
325 325 summary: another precious commit message
326 326
327 327
328 328 Moving bookmarks, preserve active bookmark:
329 329
330 330 $ hg book book1
331 331 $ hg book book2
332 332 $ hg ci --amend -m 'move bookmarks'
333 333 saved backup bundle to $TESTTMP/.hg/strip-backup/7892795b8e38-3fb46217-amend.hg
334 334 $ hg book
335 335 book1 1:8311f17e2616
336 336 * book2 1:8311f17e2616
337 337 $ echo a >> a
338 338 $ hg ci --amend -m 'move bookmarks'
339 339 saved backup bundle to $TESTTMP/.hg/strip-backup/8311f17e2616-f0504fe3-amend.hg
340 340 $ hg book
341 341 book1 1:a3b65065808c
342 342 * book2 1:a3b65065808c
343 343
344 344 abort does not loose bookmarks
345 345
346 346 $ cat > editor.sh << '__EOF__'
347 347 > #!/bin/sh
348 348 > echo "" > "$1"
349 349 > __EOF__
350 350 $ echo a >> a
351 351 $ HGEDITOR="\"sh\" \"`pwd`/editor.sh\"" hg commit --amend
352 352 abort: empty commit message
353 353 [255]
354 354 $ hg book
355 355 book1 1:a3b65065808c
356 356 * book2 1:a3b65065808c
357 357 $ hg revert -Caq
358 358 $ rm editor.sh
359 359
360 360 $ echo '[defaults]' >> $HGRCPATH
361 361 $ echo "commit=-d '0 0'" >> $HGRCPATH
362 362
363 363 Moving branches:
364 364
365 365 $ hg branch foo
366 366 marked working directory as branch foo
367 367 (branches are permanent and global, did you want a bookmark?)
368 368 $ echo a >> a
369 369 $ hg ci -m 'branch foo'
370 370 $ hg branch default -f
371 371 marked working directory as branch default
372 372 $ hg ci --amend -m 'back to default'
373 373 saved backup bundle to $TESTTMP/.hg/strip-backup/f8339a38efe1-c18453c9-amend.hg
374 374 $ hg branches
375 375 default 2:9c07515f2650
376 376
377 377 Close branch:
378 378
379 379 $ hg up -q 0
380 380 $ echo b >> b
381 381 $ hg branch foo
382 382 marked working directory as branch foo
383 383 (branches are permanent and global, did you want a bookmark?)
384 384 $ hg ci -Am 'fork'
385 385 adding b
386 386 $ echo b >> b
387 387 $ hg ci -mb
388 388 $ hg ci --amend --close-branch -m 'closing branch foo'
389 389 saved backup bundle to $TESTTMP/.hg/strip-backup/c962248fa264-54245dc7-amend.hg
390 390
391 391 Same thing, different code path:
392 392
393 393 $ echo b >> b
394 394 $ hg ci -m 'reopen branch'
395 395 reopening closed branch head 4
396 396 $ echo b >> b
397 397 $ hg ci --amend --close-branch
398 398 saved backup bundle to $TESTTMP/.hg/strip-backup/027371728205-b900d9fa-amend.hg
399 399 $ hg branches
400 400 default 2:9c07515f2650
401 401
402 402 Refuse to amend during a merge:
403 403
404 404 $ hg up -q default
405 405 $ hg merge foo
406 406 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
407 407 (branch merge, don't forget to commit)
408 408 $ hg ci --amend
409 409 abort: cannot amend while merging
410 410 [255]
411 411 $ hg ci -m 'merge'
412 412
413 413 Refuse to amend if there is a merge conflict (issue5805):
414 414
415 415 $ hg up -q foo
416 416 $ echo c > a
417 417 $ hg up default -t :fail
418 418 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
419 419 use 'hg resolve' to retry unresolved file merges
420 420 [1]
421 421 $ hg resolve -l
422 422 U a
423 423
424 424 $ hg ci --amend
425 425 abort: unresolved merge conflicts (see 'hg help resolve')
426 426 [255]
427 427
428 428 $ hg up -qC .
429 429
430 430 Follow copies/renames:
431 431
432 432 $ hg mv b c
433 433 $ hg ci -m 'b -> c'
434 434 $ hg mv c d
435 435 $ hg ci --amend -m 'b -> d'
436 436 saved backup bundle to $TESTTMP/.hg/strip-backup/42f3f27a067d-f23cc9f7-amend.hg
437 437 $ hg st --rev '.^' --copies d
438 438 A d
439 439 b
440 440 $ hg cp d e
441 441 $ hg ci -m 'e = d'
442 442 $ hg cp e f
443 443 $ hg ci --amend -m 'f = d'
444 444 saved backup bundle to $TESTTMP/.hg/strip-backup/9198f73182d5-251d584a-amend.hg
445 445 $ hg st --rev '.^' --copies f
446 446 A f
447 447 d
448 448
449 449 $ mv f f.orig
450 450 $ hg rm -A f
451 451 $ hg ci -m removef
452 452 $ hg cp a f
453 453 $ mv f.orig f
454 454 $ hg ci --amend -m replacef
455 455 saved backup bundle to $TESTTMP/.hg/strip-backup/f0993ab6b482-eda301bf-amend.hg
456 456 $ hg st --change . --copies
457 457 $ hg log -r . --template "{file_copies}\n"
458 458
459 459
460 460 Move added file (issue3410):
461 461
462 462 $ echo g >> g
463 463 $ hg ci -Am g
464 464 adding g
465 465 $ hg mv g h
466 466 $ hg ci --amend
467 467 saved backup bundle to $TESTTMP/.hg/strip-backup/58585e3f095c-0f5ebcda-amend.hg
468 468 $ hg st --change . --copies h
469 469 A h
470 470 $ hg log -r . --template "{file_copies}\n"
471 471
472 472
473 473 Can't rollback an amend:
474 474
475 475 $ hg rollback
476 476 no rollback information available
477 477 [1]
478 478
479 479 Preserve extra dict (issue3430):
480 480
481 481 $ hg branch a
482 482 marked working directory as branch a
483 483 (branches are permanent and global, did you want a bookmark?)
484 484 $ echo a >> a
485 485 $ hg ci -ma
486 486 $ hg ci --amend -m "a'"
487 487 saved backup bundle to $TESTTMP/.hg/strip-backup/39a162f1d65e-9dfe13d8-amend.hg
488 488 $ hg log -r . --template "{branch}\n"
489 489 a
490 490 $ hg ci --amend -m "a''"
491 491 saved backup bundle to $TESTTMP/.hg/strip-backup/d5ca7b1ac72b-0b4c1a34-amend.hg
492 492 $ hg log -r . --template "{branch}\n"
493 493 a
494 494
495 495 Also preserve other entries in the dict that are in the old commit,
496 496 first graft something so there's an additional entry:
497 497
498 498 $ hg up 0 -q
499 499 $ echo z > z
500 500 $ hg ci -Am 'fork'
501 501 adding z
502 502 created new head
503 503 $ hg up 11
504 504 5 files updated, 0 files merged, 1 files removed, 0 files unresolved
505 505 $ hg graft 12
506 506 grafting 12:2647734878ef "fork" (tip)
507 507 $ hg ci --amend -m 'graft amend'
508 508 saved backup bundle to $TESTTMP/.hg/strip-backup/fe8c6f7957ca-25638666-amend.hg
509 509 $ hg log -r . --debug | grep extra
510 510 extra: amend_source=fe8c6f7957ca1665ed77496ed7a07657d469ac60
511 511 extra: branch=a
512 512 extra: source=2647734878ef0236dda712fae9c1651cf694ea8a
513 513
514 514 Preserve phase
515 515
516 516 $ hg phase '.^::.'
517 517 11: draft
518 518 13: draft
519 519 $ hg phase --secret --force .
520 520 $ hg phase '.^::.'
521 521 11: draft
522 522 13: secret
523 523 $ hg commit --amend -m 'amend for phase' -q
524 524 $ hg phase '.^::.'
525 525 11: draft
526 526 13: secret
527 527
528 528 Test amend with obsolete
529 529 ---------------------------
530 530
531 531 Enable obsolete
532 532
533 533 $ cat >> $HGRCPATH << EOF
534 534 > [experimental]
535 535 > evolution.createmarkers=True
536 536 > evolution.allowunstable=True
537 537 > EOF
538 538
539 539 Amend with no files changes
540 540
541 541 $ hg id -n
542 542 13
543 543 $ hg ci --amend -m 'babar'
544 544 $ hg id -n
545 545 14
546 546 $ hg log -Gl 3 --style=compact
547 547 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
548 548 | babar
549 549 |
550 550 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
551 551 | | fork
552 552 | ~
553 553 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
554 554 | a''
555 555 ~
556 556 $ hg log -Gl 4 --hidden --style=compact
557 557 @ 14[tip]:11 682950e85999 1970-01-01 00:00 +0000 test
558 558 | babar
559 559 |
560 560 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
561 561 |/ amend for phase
562 562 |
563 563 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
564 564 | | fork
565 565 | ~
566 566 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
567 567 | a''
568 568 ~
569 569
570 570 Amend with files changes
571 571
572 572 (note: the extra commit over 15 is a temporary junk I would be happy to get
573 573 ride of)
574 574
575 575 $ echo 'babar' >> a
576 576 $ hg commit --amend
577 577 $ hg log -Gl 6 --hidden --style=compact
578 578 @ 15[tip]:11 a5b42b49b0d5 1970-01-01 00:00 +0000 test
579 579 | babar
580 580 |
581 581 | x 14:11 682950e85999 1970-01-01 00:00 +0000 test
582 582 |/ babar
583 583 |
584 584 | x 13:11 5167600b0f7a 1970-01-01 00:00 +0000 test
585 585 |/ amend for phase
586 586 |
587 587 | o 12:0 2647734878ef 1970-01-01 00:00 +0000 test
588 588 | | fork
589 589 | ~
590 590 o 11 0ddb275cfad1 1970-01-01 00:00 +0000 test
591 591 | a''
592 592 |
593 593 o 10 5fa75032e226 1970-01-01 00:00 +0000 test
594 594 | g
595 595 ~
596 596
597 597
598 598 Test that amend does not make it easy to create obsolescence cycle
599 599 ---------------------------------------------------------------------
600 600
601 601 $ hg id -r 14 --hidden
602 602 682950e85999 (a)
603 603 $ hg revert -ar 14 --hidden
604 604 reverting a
605 605 $ hg commit --amend
606 606 $ hg id
607 607 37973c7e0b61 (a) tip
608 608
609 609 Test that rewriting leaving instability behind is allowed
610 610 ---------------------------------------------------------------------
611 611
612 612 $ hg up '.^'
613 613 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
614 614 $ echo 'b' >> a
615 615 $ hg log --style compact -r 'children(.)'
616 616 16[tip]:11 37973c7e0b61 1970-01-01 00:00 +0000 test
617 617 babar
618 618
619 619 $ hg commit --amend
620 620 1 new orphan changesets
621 621 $ hg log -r 'orphan()'
622 622 changeset: 16:37973c7e0b61
623 623 branch: a
624 624 parent: 11:0ddb275cfad1
625 625 user: test
626 626 date: Thu Jan 01 00:00:00 1970 +0000
627 627 instability: orphan
628 628 summary: babar
629 629
630 630
631 631 Amend a merge changeset (with renames and conflicts from the second parent):
632 632
633 633 $ hg up -q default
634 634 $ hg branch -q bar
635 635 $ hg cp a aa
636 636 $ hg mv z zz
637 637 $ echo cc > cc
638 638 $ hg add cc
639 639 $ hg ci -m aazzcc
640 640 $ hg up -q default
641 641 $ echo a >> a
642 642 $ echo dd > cc
643 643 $ hg add cc
644 644 $ hg ci -m aa
645 645 $ hg merge -q bar
646 646 warning: conflicts while merging cc! (edit, then use 'hg resolve --mark')
647 647 [1]
648 648 $ hg resolve -m cc
649 649 (no more unresolved files)
650 650 $ hg ci -m 'merge bar'
651 651 $ hg log --config diff.git=1 -pr .
652 652 changeset: 20:163cfd7219f7
653 653 tag: tip
654 654 parent: 19:30d96aeaf27b
655 655 parent: 18:1aa437659d19
656 656 user: test
657 657 date: Thu Jan 01 00:00:00 1970 +0000
658 658 summary: merge bar
659 659
660 660 diff --git a/a b/aa
661 661 copy from a
662 662 copy to aa
663 663 diff --git a/cc b/cc
664 664 --- a/cc
665 665 +++ b/cc
666 666 @@ -1,1 +1,5 @@
667 667 +<<<<<<< working copy: 30d96aeaf27b - test: aa
668 668 dd
669 669 +=======
670 670 +cc
671 671 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
672 672 diff --git a/z b/zz
673 673 rename from z
674 674 rename to zz
675 675
676 676 $ hg debugrename aa
677 677 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
678 678 $ hg debugrename zz
679 679 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
680 680 $ hg debugrename cc
681 681 cc not renamed
682 682 $ HGEDITOR="sh .hg/checkeditform.sh" hg ci --amend -m 'merge bar (amend message)' --edit
683 683 HGEDITFORM=commit.amend.merge
684 684 $ hg log --config diff.git=1 -pr .
685 685 changeset: 21:bca52d4ed186
686 686 tag: tip
687 687 parent: 19:30d96aeaf27b
688 688 parent: 18:1aa437659d19
689 689 user: test
690 690 date: Thu Jan 01 00:00:00 1970 +0000
691 691 summary: merge bar (amend message)
692 692
693 693 diff --git a/a b/aa
694 694 copy from a
695 695 copy to aa
696 696 diff --git a/cc b/cc
697 697 --- a/cc
698 698 +++ b/cc
699 699 @@ -1,1 +1,5 @@
700 700 +<<<<<<< working copy: 30d96aeaf27b - test: aa
701 701 dd
702 702 +=======
703 703 +cc
704 704 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
705 705 diff --git a/z b/zz
706 706 rename from z
707 707 rename to zz
708 708
709 709 $ hg debugrename aa
710 710 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
711 711 $ hg debugrename zz
712 712 zz renamed from z:69a1b67522704ec122181c0890bd16e9d3e7516a
713 713 $ hg debugrename cc
714 714 cc not renamed
715 715 $ hg mv zz z
716 716 $ hg ci --amend -m 'merge bar (undo rename)'
717 717 $ hg log --config diff.git=1 -pr .
718 718 changeset: 22:12594a98ca3f
719 719 tag: tip
720 720 parent: 19:30d96aeaf27b
721 721 parent: 18:1aa437659d19
722 722 user: test
723 723 date: Thu Jan 01 00:00:00 1970 +0000
724 724 summary: merge bar (undo rename)
725 725
726 726 diff --git a/a b/aa
727 727 copy from a
728 728 copy to aa
729 729 diff --git a/cc b/cc
730 730 --- a/cc
731 731 +++ b/cc
732 732 @@ -1,1 +1,5 @@
733 733 +<<<<<<< working copy: 30d96aeaf27b - test: aa
734 734 dd
735 735 +=======
736 736 +cc
737 737 +>>>>>>> merge rev: 1aa437659d19 bar - test: aazzcc
738 738
739 739 $ hg debugrename z
740 740 z not renamed
741 741
742 742 Amend a merge changeset (with renames during the merge):
743 743
744 744 $ hg up -q bar
745 745 $ echo x > x
746 746 $ hg add x
747 747 $ hg ci -m x
748 748 $ hg up -q default
749 749 $ hg merge -q bar
750 750 $ hg mv aa aaa
751 751 $ echo aa >> aaa
752 752 $ hg ci -m 'merge bar again'
753 753 $ hg log --config diff.git=1 -pr .
754 754 changeset: 24:dffde028b388
755 755 tag: tip
756 756 parent: 22:12594a98ca3f
757 757 parent: 23:4c94d5bc65f5
758 758 user: test
759 759 date: Thu Jan 01 00:00:00 1970 +0000
760 760 summary: merge bar again
761 761
762 762 diff --git a/aa b/aa
763 763 deleted file mode 100644
764 764 --- a/aa
765 765 +++ /dev/null
766 766 @@ -1,2 +0,0 @@
767 767 -a
768 768 -a
769 769 diff --git a/aaa b/aaa
770 770 new file mode 100644
771 771 --- /dev/null
772 772 +++ b/aaa
773 773 @@ -0,0 +1,3 @@
774 774 +a
775 775 +a
776 776 +aa
777 777 diff --git a/x b/x
778 778 new file mode 100644
779 779 --- /dev/null
780 780 +++ b/x
781 781 @@ -0,0 +1,1 @@
782 782 +x
783 783
784 784 $ hg debugrename aaa
785 785 aaa renamed from aa:37d9b5d994eab34eda9c16b195ace52c7b129980
786 786 $ hg mv aaa aa
787 787 $ hg ci --amend -m 'merge bar again (undo rename)'
788 788 $ hg log --config diff.git=1 -pr .
789 789 changeset: 25:18e3ba160489
790 790 tag: tip
791 791 parent: 22:12594a98ca3f
792 792 parent: 23:4c94d5bc65f5
793 793 user: test
794 794 date: Thu Jan 01 00:00:00 1970 +0000
795 795 summary: merge bar again (undo rename)
796 796
797 797 diff --git a/aa b/aa
798 798 --- a/aa
799 799 +++ b/aa
800 800 @@ -1,2 +1,3 @@
801 801 a
802 802 a
803 803 +aa
804 804 diff --git a/x b/x
805 805 new file mode 100644
806 806 --- /dev/null
807 807 +++ b/x
808 808 @@ -0,0 +1,1 @@
809 809 +x
810 810
811 811 $ hg debugrename aa
812 812 aa not renamed
813 813 $ hg debugrename -r '.^' aa
814 814 aa renamed from a:a80d06849b333b8a3d5c445f8ba3142010dcdc9e
815 815
816 816 Amend a merge changeset (with manifest-level conflicts):
817 817
818 818 $ hg up -q bar
819 819 $ hg rm aa
820 820 $ hg ci -m 'rm aa'
821 821 $ hg up -q default
822 822 $ echo aa >> aa
823 823 $ hg ci -m aa
824 824 $ hg merge -q bar --config ui.interactive=True << EOF
825 825 > c
826 826 > EOF
827 file 'aa' was deleted in local [working copy] but was modified in other [merge rev].
827 file 'aa' was deleted in other [merge rev] but was modified in local [working copy].
828 828 What do you want to do?
829 829 use (c)hanged version, (d)elete, or leave (u)nresolved? c
830 830 $ hg ci -m 'merge bar (with conflicts)'
831 831 $ hg log --config diff.git=1 -pr .
832 832 changeset: 28:b4c3035e2544
833 833 tag: tip
834 834 parent: 27:4b216ca5ba97
835 835 parent: 26:67db8847a540
836 836 user: test
837 837 date: Thu Jan 01 00:00:00 1970 +0000
838 838 summary: merge bar (with conflicts)
839 839
840 840
841 841 $ hg rm aa
842 842 $ hg ci --amend -m 'merge bar (with conflicts, amended)'
843 843 $ hg log --config diff.git=1 -pr .
844 844 changeset: 29:1205ed810051
845 845 tag: tip
846 846 parent: 27:4b216ca5ba97
847 847 parent: 26:67db8847a540
848 848 user: test
849 849 date: Thu Jan 01 00:00:00 1970 +0000
850 850 summary: merge bar (with conflicts, amended)
851 851
852 852 diff --git a/aa b/aa
853 853 deleted file mode 100644
854 854 --- a/aa
855 855 +++ /dev/null
856 856 @@ -1,4 +0,0 @@
857 857 -a
858 858 -a
859 859 -aa
860 860 -aa
861 861
862 862 Issue 3445: amending with --close-branch a commit that created a new head should fail
863 863 This shouldn't be possible:
864 864
865 865 $ hg up -q default
866 866 $ hg branch closewithamend
867 867 marked working directory as branch closewithamend
868 868 $ echo foo > foo
869 869 $ hg add foo
870 870 $ hg ci -m..
871 871 $ hg ci --amend --close-branch -m 'closing'
872 872 abort: can only close branch heads
873 873 [255]
874 874
875 875 This silliness fails:
876 876
877 877 $ hg branch silliness
878 878 marked working directory as branch silliness
879 879 $ echo b >> b
880 880 $ hg ci --close-branch -m'open and close'
881 881 abort: can only close branch heads
882 882 [255]
883 883
884 884 Test that amend with --secret creates new secret changeset forcibly
885 885 ---------------------------------------------------------------------
886 886
887 887 $ hg phase '.^::.'
888 888 29: draft
889 889 30: draft
890 890 $ hg commit --amend --secret -m 'amend as secret' -q
891 891 $ hg phase '.^::.'
892 892 29: draft
893 893 31: secret
894 894
895 895 Test that amend with --edit invokes editor forcibly
896 896 ---------------------------------------------------
897 897
898 898 $ hg parents --template "{desc}\n"
899 899 amend as secret
900 900 $ HGEDITOR=cat hg commit --amend -m "editor should be suppressed"
901 901 $ hg parents --template "{desc}\n"
902 902 editor should be suppressed
903 903
904 904 $ hg status --rev '.^1::.'
905 905 A foo
906 906 $ HGEDITOR=cat hg commit --amend -m "editor should be invoked" --edit
907 907 editor should be invoked
908 908
909 909
910 910 HG: Enter commit message. Lines beginning with 'HG:' are removed.
911 911 HG: Leave message empty to abort commit.
912 912 HG: --
913 913 HG: user: test
914 914 HG: branch 'silliness'
915 915 HG: added foo
916 916 $ hg parents --template "{desc}\n"
917 917 editor should be invoked
918 918
919 919 Test that "diff()" in committemplate works correctly for amending
920 920 -----------------------------------------------------------------
921 921
922 922 $ cat >> .hg/hgrc <<EOF
923 923 > [committemplate]
924 924 > changeset.commit.amend = {desc}\n
925 925 > HG: M: {file_mods}
926 926 > HG: A: {file_adds}
927 927 > HG: R: {file_dels}
928 928 > {splitlines(diff()) % 'HG: {line}\n'}
929 929 > EOF
930 930
931 931 $ hg parents --template "M: {file_mods}\nA: {file_adds}\nR: {file_dels}\n"
932 932 M:
933 933 A: foo
934 934 R:
935 935 $ hg status -amr
936 936 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo"
937 937 expecting diff of foo
938 938
939 939 HG: M:
940 940 HG: A: foo
941 941 HG: R:
942 942 HG: diff -r 1205ed810051 foo
943 943 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
944 944 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
945 945 HG: @@ -0,0 +1,1 @@
946 946 HG: +foo
947 947
948 948 $ echo y > y
949 949 $ hg add y
950 950 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of foo and y"
951 951 expecting diff of foo and y
952 952
953 953 HG: M:
954 954 HG: A: foo y
955 955 HG: R:
956 956 HG: diff -r 1205ed810051 foo
957 957 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
958 958 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
959 959 HG: @@ -0,0 +1,1 @@
960 960 HG: +foo
961 961 HG: diff -r 1205ed810051 y
962 962 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
963 963 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
964 964 HG: @@ -0,0 +1,1 @@
965 965 HG: +y
966 966
967 967 $ hg rm a
968 968 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo and y"
969 969 expecting diff of a, foo and y
970 970
971 971 HG: M:
972 972 HG: A: foo y
973 973 HG: R: a
974 974 HG: diff -r 1205ed810051 a
975 975 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
976 976 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
977 977 HG: @@ -1,2 +0,0 @@
978 978 HG: -a
979 979 HG: -a
980 980 HG: diff -r 1205ed810051 foo
981 981 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
982 982 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
983 983 HG: @@ -0,0 +1,1 @@
984 984 HG: +foo
985 985 HG: diff -r 1205ed810051 y
986 986 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
987 987 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
988 988 HG: @@ -0,0 +1,1 @@
989 989 HG: +y
990 990
991 991 $ hg rm x
992 992 $ HGEDITOR=cat hg commit --amend -e -m "expecting diff of a, foo, x and y"
993 993 expecting diff of a, foo, x and y
994 994
995 995 HG: M:
996 996 HG: A: foo y
997 997 HG: R: a x
998 998 HG: diff -r 1205ed810051 a
999 999 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1000 1000 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1001 1001 HG: @@ -1,2 +0,0 @@
1002 1002 HG: -a
1003 1003 HG: -a
1004 1004 HG: diff -r 1205ed810051 foo
1005 1005 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1006 1006 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1007 1007 HG: @@ -0,0 +1,1 @@
1008 1008 HG: +foo
1009 1009 HG: diff -r 1205ed810051 x
1010 1010 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1011 1011 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1012 1012 HG: @@ -1,1 +0,0 @@
1013 1013 HG: -x
1014 1014 HG: diff -r 1205ed810051 y
1015 1015 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1016 1016 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1017 1017 HG: @@ -0,0 +1,1 @@
1018 1018 HG: +y
1019 1019
1020 1020 $ echo cccc >> cc
1021 1021 $ hg status -amr
1022 1022 M cc
1023 1023 $ HGEDITOR=cat hg commit --amend -e -m "cc should be excluded" -X cc
1024 1024 cc should be excluded
1025 1025
1026 1026 HG: M:
1027 1027 HG: A: foo y
1028 1028 HG: R: a x
1029 1029 HG: diff -r 1205ed810051 a
1030 1030 HG: --- a/a Thu Jan 01 00:00:00 1970 +0000
1031 1031 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1032 1032 HG: @@ -1,2 +0,0 @@
1033 1033 HG: -a
1034 1034 HG: -a
1035 1035 HG: diff -r 1205ed810051 foo
1036 1036 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1037 1037 HG: +++ b/foo Thu Jan 01 00:00:00 1970 +0000
1038 1038 HG: @@ -0,0 +1,1 @@
1039 1039 HG: +foo
1040 1040 HG: diff -r 1205ed810051 x
1041 1041 HG: --- a/x Thu Jan 01 00:00:00 1970 +0000
1042 1042 HG: +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1043 1043 HG: @@ -1,1 +0,0 @@
1044 1044 HG: -x
1045 1045 HG: diff -r 1205ed810051 y
1046 1046 HG: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1047 1047 HG: +++ b/y Thu Jan 01 00:00:00 1970 +0000
1048 1048 HG: @@ -0,0 +1,1 @@
1049 1049 HG: +y
1050 1050
1051 1051 Check for issue4405
1052 1052 -------------------
1053 1053
1054 1054 Setup the repo with a file that gets moved in a second commit.
1055 1055 $ hg init repo
1056 1056 $ cd repo
1057 1057 $ touch a0
1058 1058 $ hg add a0
1059 1059 $ hg commit -m a0
1060 1060 $ hg mv a0 a1
1061 1061 $ hg commit -m a1
1062 1062 $ hg up -q 0
1063 1063 $ hg log -G --template '{rev} {desc}'
1064 1064 o 1 a1
1065 1065 |
1066 1066 @ 0 a0
1067 1067
1068 1068
1069 1069 Now we branch the repro, but re-use the file contents, so we have a divergence
1070 1070 in the file revlog topology and the changelog topology.
1071 1071 $ hg revert --rev 1 --all
1072 1072 removing a0
1073 1073 adding a1
1074 1074 $ hg ci -qm 'a1-amend'
1075 1075 $ hg log -G --template '{rev} {desc}'
1076 1076 @ 2 a1-amend
1077 1077 |
1078 1078 | o 1 a1
1079 1079 |/
1080 1080 o 0 a0
1081 1081
1082 1082
1083 1083 The way mercurial does amends is by folding the working copy and old commit
1084 1084 together into another commit (rev 3). During this process, _findlimit is called
1085 1085 to check how far back to look for the transitive closure of file copy
1086 1086 information, but due to the divergence of the filelog and changelog graph
1087 1087 topologies, before _findlimit was fixed, it returned a rev which was not far
1088 1088 enough back in this case.
1089 1089 $ hg mv a1 a2
1090 1090 $ hg status --copies --rev 0
1091 1091 A a2
1092 1092 a0
1093 1093 R a0
1094 1094 $ hg ci --amend -q
1095 1095 $ hg log -G --template '{rev} {desc}'
1096 1096 @ 3 a1-amend
1097 1097 |
1098 1098 | o 1 a1
1099 1099 |/
1100 1100 o 0 a0
1101 1101
1102 1102
1103 1103 Before the fix, the copy information was lost.
1104 1104 $ hg status --copies --rev 0
1105 1105 A a2
1106 1106 a0
1107 1107 R a0
1108 1108 $ cd ..
1109 1109
1110 1110 Check that amend properly preserve rename from directory rename (issue-4516)
1111 1111
1112 1112 If a parent of the merge renames a full directory, any files added to the old
1113 1113 directory in the other parent will be renamed to the new directory. For some
1114 1114 reason, the rename metadata was when amending such merge. This test ensure we
1115 1115 do not regress. We have a dedicated repo because it needs a setup with renamed
1116 1116 directory)
1117 1117
1118 1118 $ hg init issue4516
1119 1119 $ cd issue4516
1120 1120 $ mkdir olddirname
1121 1121 $ echo line1 > olddirname/commonfile.py
1122 1122 $ hg add olddirname/commonfile.py
1123 1123 $ hg ci -m first
1124 1124
1125 1125 $ hg branch newdirname
1126 1126 marked working directory as branch newdirname
1127 1127 (branches are permanent and global, did you want a bookmark?)
1128 1128 $ hg mv olddirname newdirname
1129 1129 moving olddirname/commonfile.py to newdirname/commonfile.py
1130 1130 $ hg ci -m rename
1131 1131
1132 1132 $ hg update default
1133 1133 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
1134 1134 $ echo line1 > olddirname/newfile.py
1135 1135 $ hg add olddirname/newfile.py
1136 1136 $ hg ci -m log
1137 1137
1138 1138 $ hg up newdirname
1139 1139 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1140 1140 $ # create newdirname/newfile.py
1141 1141 $ hg merge default
1142 1142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1143 1143 (branch merge, don't forget to commit)
1144 1144 $ hg ci -m add
1145 1145 $
1146 1146 $ hg debugrename newdirname/newfile.py
1147 1147 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1148 1148 $ hg status -C --change .
1149 1149 A newdirname/newfile.py
1150 1150 $ hg status -C --rev 1
1151 1151 A newdirname/newfile.py
1152 1152 $ hg status -C --rev 2
1153 1153 A newdirname/commonfile.py
1154 1154 olddirname/commonfile.py
1155 1155 A newdirname/newfile.py
1156 1156 olddirname/newfile.py
1157 1157 R olddirname/commonfile.py
1158 1158 R olddirname/newfile.py
1159 1159 $ hg debugindex newdirname/newfile.py
1160 1160 rev linkrev nodeid p1 p2
1161 1161 0 3 34a4d536c0c0 000000000000 000000000000
1162 1162
1163 1163 $ echo a >> newdirname/commonfile.py
1164 1164 $ hg ci --amend -m bug
1165 1165 $ hg debugrename newdirname/newfile.py
1166 1166 newdirname/newfile.py renamed from olddirname/newfile.py:690b295714aed510803d3020da9c70fca8336def
1167 1167 $ hg debugindex newdirname/newfile.py
1168 1168 rev linkrev nodeid p1 p2
1169 1169 0 3 34a4d536c0c0 000000000000 000000000000
1170 1170
1171 1171 #if execbit
1172 1172
1173 1173 Test if amend preserves executable bit changes
1174 1174 $ chmod +x newdirname/commonfile.py
1175 1175 $ hg ci -m chmod
1176 1176 $ hg ci --amend -m "chmod amended"
1177 1177 $ hg ci --amend -m "chmod amended second time"
1178 1178 $ hg log -p --git -r .
1179 1179 changeset: 7:b1326f52dddf
1180 1180 branch: newdirname
1181 1181 tag: tip
1182 1182 parent: 4:7fd235f7cb2f
1183 1183 user: test
1184 1184 date: Thu Jan 01 00:00:00 1970 +0000
1185 1185 summary: chmod amended second time
1186 1186
1187 1187 diff --git a/newdirname/commonfile.py b/newdirname/commonfile.py
1188 1188 old mode 100644
1189 1189 new mode 100755
1190 1190
1191 1191 #endif
1192 1192
1193 1193 Test amend with file inclusion options
1194 1194 --------------------------------------
1195 1195
1196 1196 These tests ensure that we are always amending some files that were part of the
1197 1197 pre-amend commit. We want to test that the remaining files in the pre-amend
1198 1198 commit were not changed in the amended commit. We do so by performing a diff of
1199 1199 the amended commit against its parent commit.
1200 1200 $ cd ..
1201 1201 $ hg init testfileinclusions
1202 1202 $ cd testfileinclusions
1203 1203 $ echo a > a
1204 1204 $ echo b > b
1205 1205 $ hg commit -Aqm "Adding a and b"
1206 1206
1207 1207 Only add changes to a particular file
1208 1208 $ echo a >> a
1209 1209 $ echo b >> b
1210 1210 $ hg commit --amend -I a
1211 1211 $ hg diff --git -r null -r .
1212 1212 diff --git a/a b/a
1213 1213 new file mode 100644
1214 1214 --- /dev/null
1215 1215 +++ b/a
1216 1216 @@ -0,0 +1,2 @@
1217 1217 +a
1218 1218 +a
1219 1219 diff --git a/b b/b
1220 1220 new file mode 100644
1221 1221 --- /dev/null
1222 1222 +++ b/b
1223 1223 @@ -0,0 +1,1 @@
1224 1224 +b
1225 1225
1226 1226 $ echo a >> a
1227 1227 $ hg commit --amend b
1228 1228 $ hg diff --git -r null -r .
1229 1229 diff --git a/a b/a
1230 1230 new file mode 100644
1231 1231 --- /dev/null
1232 1232 +++ b/a
1233 1233 @@ -0,0 +1,2 @@
1234 1234 +a
1235 1235 +a
1236 1236 diff --git a/b b/b
1237 1237 new file mode 100644
1238 1238 --- /dev/null
1239 1239 +++ b/b
1240 1240 @@ -0,0 +1,2 @@
1241 1241 +b
1242 1242 +b
1243 1243
1244 1244 Exclude changes to a particular file
1245 1245 $ echo b >> b
1246 1246 $ hg commit --amend -X a
1247 1247 $ hg diff --git -r null -r .
1248 1248 diff --git a/a b/a
1249 1249 new file mode 100644
1250 1250 --- /dev/null
1251 1251 +++ b/a
1252 1252 @@ -0,0 +1,2 @@
1253 1253 +a
1254 1254 +a
1255 1255 diff --git a/b b/b
1256 1256 new file mode 100644
1257 1257 --- /dev/null
1258 1258 +++ b/b
1259 1259 @@ -0,0 +1,3 @@
1260 1260 +b
1261 1261 +b
1262 1262 +b
1263 1263
1264 1264 Check the addremove flag
1265 1265 $ echo c > c
1266 1266 $ rm a
1267 1267 $ hg commit --amend -A
1268 1268 removing a
1269 1269 adding c
1270 1270 $ hg diff --git -r null -r .
1271 1271 diff --git a/b b/b
1272 1272 new file mode 100644
1273 1273 --- /dev/null
1274 1274 +++ b/b
1275 1275 @@ -0,0 +1,3 @@
1276 1276 +b
1277 1277 +b
1278 1278 +b
1279 1279 diff --git a/c b/c
1280 1280 new file mode 100644
1281 1281 --- /dev/null
1282 1282 +++ b/c
1283 1283 @@ -0,0 +1,1 @@
1284 1284 +c
@@ -1,172 +1,172 b''
1 1 Test for the full copytracing algorithm
2 2 =======================================
3 3
4 4 $ hg init t
5 5 $ cd t
6 6
7 7 $ echo 1 > a
8 8 $ hg ci -qAm "first"
9 9
10 10 $ hg cp a b
11 11 $ hg mv a c
12 12 $ echo 2 >> b
13 13 $ echo 2 >> c
14 14
15 15 $ hg ci -qAm "second"
16 16
17 17 $ hg co -C 0
18 18 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
19 19
20 20 $ echo 0 > a
21 21 $ echo 1 >> a
22 22
23 23 $ hg ci -qAm "other"
24 24
25 25 $ hg merge --debug
26 26 searching for copies back to rev 1
27 27 unmatched files in other:
28 28 b
29 29 c
30 30 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
31 31 src: 'a' -> dst: 'b' *
32 32 src: 'a' -> dst: 'c' *
33 33 checking for directory renames
34 34 resolving manifests
35 35 branchmerge: True, force: False, partial: False
36 36 ancestor: b8bf91eeebbc, local: add3f11052fa+, remote: 17c05bb7fcb6
37 37 preserving a for resolve of b
38 38 preserving a for resolve of c
39 39 removing a
40 40 starting 4 threads for background file closing (?)
41 41 b: remote moved from a -> m (premerge)
42 42 picked tool ':merge' for b (binary False symlink False changedelete False)
43 43 merging a and b to b
44 44 my b@add3f11052fa+ other b@17c05bb7fcb6 ancestor a@b8bf91eeebbc
45 45 premerge successful
46 46 c: remote moved from a -> m (premerge)
47 47 picked tool ':merge' for c (binary False symlink False changedelete False)
48 48 merging a and c to c
49 49 my c@add3f11052fa+ other c@17c05bb7fcb6 ancestor a@b8bf91eeebbc
50 50 premerge successful
51 51 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
52 52 (branch merge, don't forget to commit)
53 53
54 54 file b
55 55 $ cat b
56 56 0
57 57 1
58 58 2
59 59
60 60 file c
61 61 $ cat c
62 62 0
63 63 1
64 64 2
65 65
66 66 Test disabling copy tracing
67 67
68 68 - first verify copy metadata was kept
69 69
70 70 $ hg up -qC 2
71 71 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase=
72 72 rebasing 2:add3f11052fa "other" (tip)
73 73 merging b and a to b
74 74 merging c and a to c
75 75
76 76 $ cat b
77 77 0
78 78 1
79 79 2
80 80
81 81 - next verify copy metadata is lost when disabled
82 82
83 83 $ hg strip -r . --config extensions.strip=
84 84 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
85 85 saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg
86 86 $ hg up -qC 2
87 87 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase= --config experimental.copytrace=off --config ui.interactive=True << EOF
88 88 > c
89 89 > EOF
90 90 rebasing 2:add3f11052fa "other" (tip)
91 file 'a' was deleted in other [source] but was modified in local [dest].
91 file 'a' was deleted in local [dest] but was modified in other [source].
92 92 What do you want to do?
93 93 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
94 94
95 95 $ cat b
96 96 1
97 97 2
98 98
99 99 $ cd ..
100 100
101 101 Verify disabling copy tracing still keeps copies from rebase source
102 102
103 103 $ hg init copydisable
104 104 $ cd copydisable
105 105 $ touch a
106 106 $ hg ci -Aqm 'add a'
107 107 $ touch b
108 108 $ hg ci -Aqm 'add b, c'
109 109 $ hg cp b x
110 110 $ echo x >> x
111 111 $ hg ci -qm 'copy b->x'
112 112 $ hg up -q 1
113 113 $ touch z
114 114 $ hg ci -Aqm 'add z'
115 115 $ hg log -G -T '{rev} {desc}\n'
116 116 @ 3 add z
117 117 |
118 118 | o 2 copy b->x
119 119 |/
120 120 o 1 add b, c
121 121 |
122 122 o 0 add a
123 123
124 124 $ hg rebase -d . -b 2 --config extensions.rebase= --config experimental.copytrace=off
125 125 rebasing 2:6adcf8c12e7d "copy b->x"
126 126 saved backup bundle to $TESTTMP/copydisable/.hg/strip-backup/6adcf8c12e7d-ce4b3e75-rebase.hg
127 127 $ hg up -q 3
128 128 $ hg log -f x -T '{rev} {desc}\n'
129 129 3 copy b->x
130 130 1 add b, c
131 131
132 132 $ cd ../
133 133
134 134 Verify we duplicate existing copies, instead of detecting them
135 135
136 136 $ hg init copydisable3
137 137 $ cd copydisable3
138 138 $ touch a
139 139 $ hg ci -Aqm 'add a'
140 140 $ hg cp a b
141 141 $ hg ci -Aqm 'copy a->b'
142 142 $ hg mv b c
143 143 $ hg ci -Aqm 'move b->c'
144 144 $ hg up -q 0
145 145 $ hg cp a b
146 146 $ echo b >> b
147 147 $ hg ci -Aqm 'copy a->b (2)'
148 148 $ hg log -G -T '{rev} {desc}\n'
149 149 @ 3 copy a->b (2)
150 150 |
151 151 | o 2 move b->c
152 152 | |
153 153 | o 1 copy a->b
154 154 |/
155 155 o 0 add a
156 156
157 157 $ hg rebase -d 2 -s 3 --config extensions.rebase= --config experimental.copytrace=off
158 158 rebasing 3:47e1a9e6273b "copy a->b (2)" (tip)
159 159 saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-rebase.hg
160 160
161 161 $ hg log -G -f b
162 162 @ changeset: 3:76024fb4b05b
163 163 : tag: tip
164 164 : user: test
165 165 : date: Thu Jan 01 00:00:00 1970 +0000
166 166 : summary: copy a->b (2)
167 167 :
168 168 o changeset: 0:ac82d8b1f7c4
169 169 user: test
170 170 date: Thu Jan 01 00:00:00 1970 +0000
171 171 summary: add a
172 172
@@ -1,718 +1,718 b''
1 1 Test for the heuristic copytracing algorithm
2 2 ============================================
3 3
4 4 $ cat >> $TESTTMP/copytrace.sh << '__EOF__'
5 5 > initclient() {
6 6 > cat >> $1/.hg/hgrc <<EOF
7 7 > [experimental]
8 8 > copytrace = heuristics
9 9 > copytrace.sourcecommitlimit = -1
10 10 > EOF
11 11 > }
12 12 > __EOF__
13 13 $ . "$TESTTMP/copytrace.sh"
14 14
15 15 $ cat >> $HGRCPATH << EOF
16 16 > [extensions]
17 17 > rebase=
18 18 > shelve=
19 19 > EOF
20 20
21 21 NOTE: calling initclient() set copytrace.sourcecommitlimit=-1 as we want to
22 22 prevent the full copytrace algorithm to run and test the heuristic algorithm
23 23 without complexing the test cases with public and draft commits.
24 24
25 25 Check filename heuristics (same dirname and same basename)
26 26 ----------------------------------------------------------
27 27
28 28 $ hg init repo
29 29 $ initclient repo
30 30 $ cd repo
31 31 $ echo a > a
32 32 $ mkdir dir
33 33 $ echo a > dir/file.txt
34 34 $ hg addremove
35 35 adding a
36 36 adding dir/file.txt
37 37 $ hg ci -m initial
38 38 $ hg mv a b
39 39 $ hg mv -q dir dir2
40 40 $ hg ci -m 'mv a b, mv dir/ dir2/'
41 41 $ hg up -q 0
42 42 $ echo b > a
43 43 $ echo b > dir/file.txt
44 44 $ hg ci -qm 'mod a, mod dir/file.txt'
45 45
46 46 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
47 47 @ changeset: 557f403c0afd2a3cf15d7e2fb1f1001a8b85e081
48 48 | desc: mod a, mod dir/file.txt
49 49 | o changeset: 928d74bc9110681920854d845c06959f6dfc9547
50 50 |/ desc: mv a b, mv dir/ dir2/
51 51 o changeset: 3c482b16e54596fed340d05ffaf155f156cda7ee
52 52 desc: initial
53 53
54 54 $ hg rebase -s . -d 1
55 55 rebasing 2:557f403c0afd "mod a, mod dir/file.txt" (tip)
56 56 merging b and a to b
57 57 merging dir2/file.txt and dir/file.txt to dir2/file.txt
58 58 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/557f403c0afd-9926eeff-rebase.hg
59 59 $ cd ..
60 60 $ rm -rf repo
61 61
62 62 Make sure filename heuristics do not when they are not related
63 63 --------------------------------------------------------------
64 64
65 65 $ hg init repo
66 66 $ initclient repo
67 67 $ cd repo
68 68 $ echo 'somecontent' > a
69 69 $ hg add a
70 70 $ hg ci -m initial
71 71 $ hg rm a
72 72 $ echo 'completelydifferentcontext' > b
73 73 $ hg add b
74 74 $ hg ci -m 'rm a, add b'
75 75 $ hg up -q 0
76 76 $ printf 'somecontent\nmoarcontent' > a
77 77 $ hg ci -qm 'mode a'
78 78
79 79 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
80 80 @ changeset: d526312210b9e8f795d576a77dc643796384d86e
81 81 | desc: mode a
82 82 | o changeset: 46985f76c7e5e5123433527f5c8526806145650b
83 83 |/ desc: rm a, add b
84 84 o changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
85 85 desc: initial
86 86
87 87 $ hg rebase -s . -d 1
88 88 rebasing 2:d526312210b9 "mode a" (tip)
89 file 'a' was deleted in other [source] but was modified in local [dest].
89 file 'a' was deleted in local [dest] but was modified in other [source].
90 90 What do you want to do?
91 91 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
92 92 unresolved conflicts (see hg resolve, then hg rebase --continue)
93 93 [1]
94 94
95 95 $ cd ..
96 96 $ rm -rf repo
97 97
98 98 Test when lca didn't modified the file that was moved
99 99 -----------------------------------------------------
100 100
101 101 $ hg init repo
102 102 $ initclient repo
103 103 $ cd repo
104 104 $ echo 'somecontent' > a
105 105 $ hg add a
106 106 $ hg ci -m initial
107 107 $ echo c > c
108 108 $ hg add c
109 109 $ hg ci -m randomcommit
110 110 $ hg mv a b
111 111 $ hg ci -m 'mv a b'
112 112 $ hg up -q 1
113 113 $ echo b > a
114 114 $ hg ci -qm 'mod a'
115 115
116 116 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
117 117 @ changeset: 9d5cf99c3d9f8e8b05ba55421f7f56530cfcf3bc
118 118 | desc: mod a, phase: draft
119 119 | o changeset: d760186dd240fc47b91eb9f0b58b0002aaeef95d
120 120 |/ desc: mv a b, phase: draft
121 121 o changeset: 48e1b6ba639d5d7fb313fa7989eebabf99c9eb83
122 122 | desc: randomcommit, phase: draft
123 123 o changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
124 124 desc: initial, phase: draft
125 125
126 126 $ hg rebase -s . -d 2
127 127 rebasing 3:9d5cf99c3d9f "mod a" (tip)
128 128 merging b and a to b
129 129 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9d5cf99c3d9f-f02358cc-rebase.hg
130 130 $ cd ..
131 131 $ rm -rf repo
132 132
133 133 Rebase "backwards"
134 134 ------------------
135 135
136 136 $ hg init repo
137 137 $ initclient repo
138 138 $ cd repo
139 139 $ echo 'somecontent' > a
140 140 $ hg add a
141 141 $ hg ci -m initial
142 142 $ echo c > c
143 143 $ hg add c
144 144 $ hg ci -m randomcommit
145 145 $ hg mv a b
146 146 $ hg ci -m 'mv a b'
147 147 $ hg up -q 2
148 148 $ echo b > b
149 149 $ hg ci -qm 'mod b'
150 150
151 151 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
152 152 @ changeset: fbe97126b3969056795c462a67d93faf13e4d298
153 153 | desc: mod b
154 154 o changeset: d760186dd240fc47b91eb9f0b58b0002aaeef95d
155 155 | desc: mv a b
156 156 o changeset: 48e1b6ba639d5d7fb313fa7989eebabf99c9eb83
157 157 | desc: randomcommit
158 158 o changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
159 159 desc: initial
160 160
161 161 $ hg rebase -s . -d 0
162 162 rebasing 3:fbe97126b396 "mod b" (tip)
163 163 merging a and b to a
164 164 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/fbe97126b396-cf5452a1-rebase.hg
165 165 $ cd ..
166 166 $ rm -rf repo
167 167
168 168 Check a few potential move candidates
169 169 -------------------------------------
170 170
171 171 $ hg init repo
172 172 $ initclient repo
173 173 $ cd repo
174 174 $ mkdir dir
175 175 $ echo a > dir/a
176 176 $ hg add dir/a
177 177 $ hg ci -qm initial
178 178 $ hg mv dir/a dir/b
179 179 $ hg ci -qm 'mv dir/a dir/b'
180 180 $ mkdir dir2
181 181 $ echo b > dir2/a
182 182 $ hg add dir2/a
183 183 $ hg ci -qm 'create dir2/a'
184 184 $ hg up -q 0
185 185 $ echo b > dir/a
186 186 $ hg ci -qm 'mod dir/a'
187 187
188 188 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
189 189 @ changeset: 6b2f4cece40fd320f41229f23821256ffc08efea
190 190 | desc: mod dir/a
191 191 | o changeset: 4494bf7efd2e0dfdd388e767fb913a8a3731e3fa
192 192 | | desc: create dir2/a
193 193 | o changeset: b1784dfab6ea6bfafeb11c0ac50a2981b0fe6ade
194 194 |/ desc: mv dir/a dir/b
195 195 o changeset: 36859b8907c513a3a87ae34ba5b1e7eea8c20944
196 196 desc: initial
197 197
198 198 $ hg rebase -s . -d 2
199 199 rebasing 3:6b2f4cece40f "mod dir/a" (tip)
200 200 merging dir/b and dir/a to dir/b
201 201 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/6b2f4cece40f-503efe60-rebase.hg
202 202 $ cd ..
203 203 $ rm -rf repo
204 204
205 205 Test the copytrace.movecandidateslimit with many move candidates
206 206 ----------------------------------------------------------------
207 207
208 208 $ hg init repo
209 209 $ initclient repo
210 210 $ cd repo
211 211 $ echo a > a
212 212 $ hg add a
213 213 $ hg ci -m initial
214 214 $ hg mv a foo
215 215 $ echo a > b
216 216 $ echo a > c
217 217 $ echo a > d
218 218 $ echo a > e
219 219 $ echo a > f
220 220 $ echo a > g
221 221 $ hg add b
222 222 $ hg add c
223 223 $ hg add d
224 224 $ hg add e
225 225 $ hg add f
226 226 $ hg add g
227 227 $ hg ci -m 'mv a foo, add many files'
228 228 $ hg up -q ".^"
229 229 $ echo b > a
230 230 $ hg ci -m 'mod a'
231 231 created new head
232 232
233 233 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
234 234 @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
235 235 | desc: mod a
236 236 | o changeset: 8329d5c6bf479ec5ca59b9864f3f45d07213f5a4
237 237 |/ desc: mv a foo, add many files
238 238 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
239 239 desc: initial
240 240
241 241 With small limit
242 242
243 243 $ hg rebase -s 2 -d 1 --config experimental.copytrace.movecandidateslimit=0
244 244 rebasing 2:ef716627c70b "mod a" (tip)
245 245 skipping copytracing for 'a', more candidates than the limit: 7
246 file 'a' was deleted in other [source] but was modified in local [dest].
246 file 'a' was deleted in local [dest] but was modified in other [source].
247 247 What do you want to do?
248 248 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
249 249 unresolved conflicts (see hg resolve, then hg rebase --continue)
250 250 [1]
251 251
252 252 $ hg rebase --abort
253 253 rebase aborted
254 254
255 255 With default limit which is 100
256 256
257 257 $ hg rebase -s 2 -d 1
258 258 rebasing 2:ef716627c70b "mod a" (tip)
259 259 merging foo and a to foo
260 260 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg
261 261
262 262 $ cd ..
263 263 $ rm -rf repo
264 264
265 265 Move file in one branch and delete it in another
266 266 -----------------------------------------------
267 267
268 268 $ hg init repo
269 269 $ initclient repo
270 270 $ cd repo
271 271 $ echo a > a
272 272 $ hg add a
273 273 $ hg ci -m initial
274 274 $ hg mv a b
275 275 $ hg ci -m 'mv a b'
276 276 $ hg up -q ".^"
277 277 $ hg rm a
278 278 $ hg ci -m 'del a'
279 279 created new head
280 280
281 281 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
282 282 @ changeset: 7d61ee3b1e48577891a072024968428ba465c47b
283 283 | desc: del a, phase: draft
284 284 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
285 285 |/ desc: mv a b, phase: draft
286 286 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
287 287 desc: initial, phase: draft
288 288
289 289 $ hg rebase -s 1 -d 2
290 290 rebasing 1:472e38d57782 "mv a b"
291 291 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-17d50e29-rebase.hg
292 292 $ hg up -q c492ed3c7e35dcd1dc938053b8adf56e2cfbd062
293 293 $ ls
294 294 b
295 295 $ cd ..
296 296 $ rm -rf repo
297 297
298 298 Move a directory in draft branch
299 299 --------------------------------
300 300
301 301 $ hg init repo
302 302 $ initclient repo
303 303 $ cd repo
304 304 $ mkdir dir
305 305 $ echo a > dir/a
306 306 $ hg add dir/a
307 307 $ hg ci -qm initial
308 308 $ echo b > dir/a
309 309 $ hg ci -qm 'mod dir/a'
310 310 $ hg up -q ".^"
311 311 $ hg mv -q dir/ dir2
312 312 $ hg ci -qm 'mv dir/ dir2/'
313 313
314 314 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
315 315 @ changeset: a33d80b6e352591dfd82784e1ad6cdd86b25a239
316 316 | desc: mv dir/ dir2/
317 317 | o changeset: 6b2f4cece40fd320f41229f23821256ffc08efea
318 318 |/ desc: mod dir/a
319 319 o changeset: 36859b8907c513a3a87ae34ba5b1e7eea8c20944
320 320 desc: initial
321 321
322 322 $ hg rebase -s . -d 1
323 323 rebasing 2:a33d80b6e352 "mv dir/ dir2/" (tip)
324 324 merging dir/a and dir2/a to dir2/a
325 325 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/a33d80b6e352-fecb9ada-rebase.hg
326 326 $ cd ..
327 327 $ rm -rf server
328 328 $ rm -rf repo
329 329
330 330 Move file twice and rebase mod on top of moves
331 331 ----------------------------------------------
332 332
333 333 $ hg init repo
334 334 $ initclient repo
335 335 $ cd repo
336 336 $ echo a > a
337 337 $ hg add a
338 338 $ hg ci -m initial
339 339 $ hg mv a b
340 340 $ hg ci -m 'mv a b'
341 341 $ hg mv b c
342 342 $ hg ci -m 'mv b c'
343 343 $ hg up -q 0
344 344 $ echo c > a
345 345 $ hg ci -m 'mod a'
346 346 created new head
347 347
348 348 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
349 349 @ changeset: d413169422167a3fa5275fc5d71f7dea9f5775f3
350 350 | desc: mod a
351 351 | o changeset: d3efd280421d24f9f229997c19e654761c942a71
352 352 | | desc: mv b c
353 353 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
354 354 |/ desc: mv a b
355 355 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
356 356 desc: initial
357 357 $ hg rebase -s . -d 2
358 358 rebasing 3:d41316942216 "mod a" (tip)
359 359 merging c and a to c
360 360 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d41316942216-2b5949bc-rebase.hg
361 361
362 362 $ cd ..
363 363 $ rm -rf repo
364 364
365 365 Move file twice and rebase moves on top of mods
366 366 -----------------------------------------------
367 367
368 368 $ hg init repo
369 369 $ initclient repo
370 370 $ cd repo
371 371 $ echo a > a
372 372 $ hg add a
373 373 $ hg ci -m initial
374 374 $ hg mv a b
375 375 $ hg ci -m 'mv a b'
376 376 $ hg mv b c
377 377 $ hg ci -m 'mv b c'
378 378 $ hg up -q 0
379 379 $ echo c > a
380 380 $ hg ci -m 'mod a'
381 381 created new head
382 382 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
383 383 @ changeset: d413169422167a3fa5275fc5d71f7dea9f5775f3
384 384 | desc: mod a
385 385 | o changeset: d3efd280421d24f9f229997c19e654761c942a71
386 386 | | desc: mv b c
387 387 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
388 388 |/ desc: mv a b
389 389 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
390 390 desc: initial
391 391 $ hg rebase -s 1 -d .
392 392 rebasing 1:472e38d57782 "mv a b"
393 393 merging a and b to b
394 394 rebasing 2:d3efd280421d "mv b c"
395 395 merging b and c to c
396 396 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/472e38d57782-ab8d3c58-rebase.hg
397 397
398 398 $ cd ..
399 399 $ rm -rf repo
400 400
401 401 Move one file and add another file in the same folder in one branch, modify file in another branch
402 402 --------------------------------------------------------------------------------------------------
403 403
404 404 $ hg init repo
405 405 $ initclient repo
406 406 $ cd repo
407 407 $ echo a > a
408 408 $ hg add a
409 409 $ hg ci -m initial
410 410 $ hg mv a b
411 411 $ hg ci -m 'mv a b'
412 412 $ echo c > c
413 413 $ hg add c
414 414 $ hg ci -m 'add c'
415 415 $ hg up -q 0
416 416 $ echo b > a
417 417 $ hg ci -m 'mod a'
418 418 created new head
419 419
420 420 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
421 421 @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
422 422 | desc: mod a
423 423 | o changeset: b1a6187e79fbce851bb584eadcb0cc4a80290fd9
424 424 | | desc: add c
425 425 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
426 426 |/ desc: mv a b
427 427 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
428 428 desc: initial
429 429
430 430 $ hg rebase -s . -d 2
431 431 rebasing 3:ef716627c70b "mod a" (tip)
432 432 merging b and a to b
433 433 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg
434 434 $ ls
435 435 b
436 436 c
437 437 $ cat b
438 438 b
439 439 $ rm -rf repo
440 440
441 441 Merge test
442 442 ----------
443 443
444 444 $ hg init repo
445 445 $ initclient repo
446 446 $ cd repo
447 447 $ echo a > a
448 448 $ hg add a
449 449 $ hg ci -m initial
450 450 $ echo b > a
451 451 $ hg ci -m 'modify a'
452 452 $ hg up -q 0
453 453 $ hg mv a b
454 454 $ hg ci -m 'mv a b'
455 455 created new head
456 456 $ hg up -q 2
457 457
458 458 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
459 459 @ changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
460 460 | desc: mv a b
461 461 | o changeset: b0357b07f79129a3d08a68621271ca1352ae8a09
462 462 |/ desc: modify a
463 463 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
464 464 desc: initial
465 465
466 466 $ hg merge 1
467 467 merging b and a to b
468 468 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
469 469 (branch merge, don't forget to commit)
470 470 $ hg ci -m merge
471 471 $ ls
472 472 b
473 473 $ cd ..
474 474 $ rm -rf repo
475 475
476 476 Copy and move file
477 477 ------------------
478 478
479 479 $ hg init repo
480 480 $ initclient repo
481 481 $ cd repo
482 482 $ echo a > a
483 483 $ hg add a
484 484 $ hg ci -m initial
485 485 $ hg cp a c
486 486 $ hg mv a b
487 487 $ hg ci -m 'cp a c, mv a b'
488 488 $ hg up -q 0
489 489 $ echo b > a
490 490 $ hg ci -m 'mod a'
491 491 created new head
492 492
493 493 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
494 494 @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
495 495 | desc: mod a
496 496 | o changeset: 4fc3fd13fbdb89ada6b75bfcef3911a689a0dde8
497 497 |/ desc: cp a c, mv a b
498 498 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
499 499 desc: initial
500 500
501 501 $ hg rebase -s . -d 1
502 502 rebasing 2:ef716627c70b "mod a" (tip)
503 503 merging b and a to b
504 504 merging c and a to c
505 505 saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/ef716627c70b-24681561-rebase.hg
506 506 $ ls
507 507 b
508 508 c
509 509 $ cat b
510 510 b
511 511 $ cat c
512 512 b
513 513 $ cd ..
514 514 $ rm -rf repo
515 515
516 516 Do a merge commit with many consequent moves in one branch
517 517 ----------------------------------------------------------
518 518
519 519 $ hg init repo
520 520 $ initclient repo
521 521 $ cd repo
522 522 $ echo a > a
523 523 $ hg add a
524 524 $ hg ci -m initial
525 525 $ echo b > a
526 526 $ hg ci -qm 'mod a'
527 527 $ hg up -q ".^"
528 528 $ hg mv a b
529 529 $ hg ci -qm 'mv a b'
530 530 $ hg mv b c
531 531 $ hg ci -qm 'mv b c'
532 532 $ hg up -q 1
533 533 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
534 534 o changeset: d3efd280421d24f9f229997c19e654761c942a71
535 535 | desc: mv b c
536 536 o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
537 537 | desc: mv a b
538 538 | @ changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
539 539 |/ desc: mod a
540 540 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
541 541 desc: initial
542 542
543 543 $ hg merge 3
544 544 merging a and c to c
545 545 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
546 546 (branch merge, don't forget to commit)
547 547 $ hg ci -qm 'merge'
548 548 $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
549 549 @ changeset: cd29b0d08c0f39bfed4cde1b40e30f419db0c825
550 550 |\ desc: merge, phase: draft
551 551 | o changeset: d3efd280421d24f9f229997c19e654761c942a71
552 552 | | desc: mv b c, phase: draft
553 553 | o changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
554 554 | | desc: mv a b, phase: draft
555 555 o | changeset: ef716627c70bf4ca0bdb623cfb0d6fe5b9acc51e
556 556 |/ desc: mod a, phase: draft
557 557 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
558 558 desc: initial, phase: draft
559 559 $ ls
560 560 c
561 561 $ cd ..
562 562 $ rm -rf repo
563 563
564 564 Test shelve/unshelve
565 565 -------------------
566 566
567 567 $ hg init repo
568 568 $ initclient repo
569 569 $ cd repo
570 570 $ echo a > a
571 571 $ hg add a
572 572 $ hg ci -m initial
573 573 $ echo b > a
574 574 $ hg shelve
575 575 shelved as default
576 576 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
577 577 $ hg mv a b
578 578 $ hg ci -m 'mv a b'
579 579
580 580 $ hg log -G -T 'changeset: {node}\n desc: {desc}\n'
581 581 @ changeset: 472e38d57782172f6c6abed82a94ca0d998c3a22
582 582 | desc: mv a b
583 583 o changeset: 1451231c87572a7d3f92fc210b4b35711c949a98
584 584 desc: initial
585 585 $ hg unshelve
586 586 unshelving change 'default'
587 587 rebasing shelved changes
588 588 merging b and a to b
589 589 $ ls
590 590 b
591 591 $ cat b
592 592 b
593 593 $ cd ..
594 594 $ rm -rf repo
595 595
596 596 Test full copytrace ability on draft branch
597 597 -------------------------------------------
598 598
599 599 File directory and base name changed in same move
600 600 $ hg init repo
601 601 $ initclient repo
602 602 $ mkdir repo/dir1
603 603 $ cd repo/dir1
604 604 $ echo a > a
605 605 $ hg add a
606 606 $ hg ci -qm initial
607 607 $ cd ..
608 608 $ hg mv -q dir1 dir2
609 609 $ hg mv dir2/a dir2/b
610 610 $ hg ci -qm 'mv a b; mv dir1 dir2'
611 611 $ hg up -q '.^'
612 612 $ cd dir1
613 613 $ echo b >> a
614 614 $ cd ..
615 615 $ hg ci -qm 'mod a'
616 616
617 617 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
618 618 @ changeset 6207d2d318e710b882e3d5ada2a89770efc42c96
619 619 | desc mod a, phase: draft
620 620 | o changeset abffdd4e3dfc04bc375034b970299b2a309a1cce
621 621 |/ desc mv a b; mv dir1 dir2, phase: draft
622 622 o changeset 81973cd24b58db2fdf18ce3d64fb2cc3284e9ab3
623 623 desc initial, phase: draft
624 624
625 625 $ hg rebase -s . -d 1 --config experimental.copytrace.sourcecommitlimit=100
626 626 rebasing 2:6207d2d318e7 "mod a" (tip)
627 627 merging dir2/b and dir1/a to dir2/b
628 628 saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/6207d2d318e7-1c9779ad-rebase.hg
629 629 $ cat dir2/b
630 630 a
631 631 b
632 632 $ cd ..
633 633 $ rm -rf repo
634 634
635 635 Move directory in one merge parent, while adding file to original directory
636 636 in other merge parent. File moved on rebase.
637 637
638 638 $ hg init repo
639 639 $ initclient repo
640 640 $ mkdir repo/dir1
641 641 $ cd repo/dir1
642 642 $ echo dummy > dummy
643 643 $ hg add dummy
644 644 $ cd ..
645 645 $ hg ci -qm initial
646 646 $ cd dir1
647 647 $ echo a > a
648 648 $ hg add a
649 649 $ cd ..
650 650 $ hg ci -qm 'hg add dir1/a'
651 651 $ hg up -q '.^'
652 652 $ hg mv -q dir1 dir2
653 653 $ hg ci -qm 'mv dir1 dir2'
654 654
655 655 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
656 656 @ changeset e8919e7df8d036e07b906045eddcd4a42ff1915f
657 657 | desc mv dir1 dir2, phase: draft
658 658 | o changeset 7c7c6f339be00f849c3cb2df738ca91db78b32c8
659 659 |/ desc hg add dir1/a, phase: draft
660 660 o changeset a235dcce55dcf42034c4e374cb200662d0bb4a13
661 661 desc initial, phase: draft
662 662
663 663 $ hg rebase -s . -d 1 --config experimental.copytrace.sourcecommitlimit=100
664 664 rebasing 2:e8919e7df8d0 "mv dir1 dir2" (tip)
665 665 saved backup bundle to $TESTTMP/repo/repo/.hg/strip-backup/e8919e7df8d0-f62fab62-rebase.hg
666 666 $ ls dir2
667 667 a
668 668 dummy
669 669 $ rm -rf repo
670 670
671 671 Testing the sourcecommitlimit config
672 672 -----------------------------------
673 673
674 674 $ hg init repo
675 675 $ initclient repo
676 676 $ cd repo
677 677 $ echo a > a
678 678 $ hg ci -Aqm "added a"
679 679 $ echo "more things" >> a
680 680 $ hg ci -qm "added more things to a"
681 681 $ hg up 0
682 682 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
683 683 $ echo b > b
684 684 $ hg ci -Aqm "added b"
685 685 $ mkdir foo
686 686 $ hg mv a foo/bar
687 687 $ hg ci -m "Moved a to foo/bar"
688 688 $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
689 689 @ changeset b4b0f7880e500b5c364a5f07b4a2b167de7a6fb0
690 690 | desc Moved a to foo/bar, phase: draft
691 691 o changeset 5f6d8a4bf34ab274ccc9f631c2536964b8a3666d
692 692 | desc added b, phase: draft
693 693 | o changeset 8b6e13696c38e8445a759516474640c2f8dddef6
694 694 |/ desc added more things to a, phase: draft
695 695 o changeset 9092f1db7931481f93b37d5c9fbcfc341bcd7318
696 696 desc added a, phase: draft
697 697
698 698 When the sourcecommitlimit is small and we have more drafts, we use heuristics only
699 699
700 700 $ hg rebase -s 8b6e13696 -d .
701 701 rebasing 1:8b6e13696c38 "added more things to a"
702 file 'a' was deleted in other [source] but was modified in local [dest].
702 file 'a' was deleted in local [dest] but was modified in other [source].
703 703 What do you want to do?
704 704 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
705 705 unresolved conflicts (see hg resolve, then hg rebase --continue)
706 706 [1]
707 707
708 708 But when we have "sourcecommitlimit > (no. of drafts from base to c1)", we do
709 709 fullcopytracing
710 710
711 711 $ hg rebase --abort
712 712 rebase aborted
713 713 $ hg rebase -s 8b6e13696 -d . --config experimental.copytrace.sourcecommitlimit=100
714 714 rebasing 1:8b6e13696c38 "added more things to a"
715 715 merging foo/bar and a to foo/bar
716 716 saved backup bundle to $TESTTMP/repo/repo/repo/.hg/strip-backup/8b6e13696c38-fc14ac83-rebase.hg
717 717 $ cd ..
718 718 $ rm -rf repo
@@ -1,795 +1,795 b''
1 1 #require no-reposimplestore
2 2
3 3 This file focuses mainly on updating largefiles in the working
4 4 directory (and ".hg/largefiles/dirstate")
5 5
6 6 $ cat >> $HGRCPATH <<EOF
7 7 > [ui]
8 8 > merge = internal:fail
9 9 > [extensions]
10 10 > largefiles =
11 11 > [extdiff]
12 12 > # for portability:
13 13 > pdiff = sh "$RUNTESTDIR/pdiff"
14 14 > EOF
15 15
16 16 $ hg init repo
17 17 $ cd repo
18 18
19 19 $ echo large1 > large1
20 20 $ echo large2 > large2
21 21 $ hg add --large large1 large2
22 22 $ echo normal1 > normal1
23 23 $ hg add normal1
24 24 $ hg commit -m '#0'
25 25 $ echo 'large1 in #1' > large1
26 26 $ echo 'normal1 in #1' > normal1
27 27 $ hg commit -m '#1'
28 28 $ hg pdiff -r '.^' --config extensions.extdiff=
29 29 diff -Nru repo.0d9d9b8dc9a3/.hglf/large1 repo/.hglf/large1
30 30 --- repo.0d9d9b8dc9a3/.hglf/large1 * (glob)
31 31 +++ repo/.hglf/large1 * (glob)
32 32 @@ -1* +1* @@ (glob)
33 33 -4669e532d5b2c093a78eca010077e708a071bb64
34 34 +58e24f733a964da346e2407a2bee99d9001184f5
35 35 diff -Nru repo.0d9d9b8dc9a3/normal1 repo/normal1
36 36 --- repo.0d9d9b8dc9a3/normal1 * (glob)
37 37 +++ repo/normal1 * (glob)
38 38 @@ -1* +1* @@ (glob)
39 39 -normal1
40 40 +normal1 in #1
41 41 [1]
42 42 $ hg update -q -C 0
43 43 $ echo 'large2 in #2' > large2
44 44 $ hg commit -m '#2'
45 45 created new head
46 46
47 47 Test that update also updates the lfdirstate of 'unsure' largefiles after
48 48 hashing them:
49 49
50 50 The previous operations will usually have left us with largefiles with a mtime
51 51 within the same second as the dirstate was written.
52 52 The lfdirstate entries will thus have been written with an invalidated/unset
53 53 mtime to make sure further changes within the same second is detected.
54 54 We will however occasionally be "lucky" and get a tick between writing
55 55 largefiles and writing dirstate so we get valid lfdirstate timestamps. The
56 56 following verification is thus disabled but can be verified manually.
57 57
58 58 #if false
59 59 $ hg debugdirstate --large --nodate
60 60 n 644 7 unset large1
61 61 n 644 13 unset large2
62 62 #endif
63 63
64 64 Wait to make sure we get a tick so the mtime of the largefiles become valid.
65 65
66 66 $ sleep 1
67 67
68 68 A linear merge will update standins before performing the actual merge. It will
69 69 do a lfdirstate status walk and find 'unset'/'unsure' files, hash them, and
70 70 update the corresponding standins.
71 71 Verify that it actually marks the clean files as clean in lfdirstate so
72 72 we don't have to hash them again next time we update.
73 73
74 74 $ hg up
75 75 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
76 76 updated to "f74e50bd9e55: #2"
77 77 1 other heads for branch "default"
78 78 $ hg debugdirstate --large --nodate
79 79 n 644 7 set large1
80 80 n 644 13 set large2
81 81
82 82 Test that lfdirstate keeps track of last modification of largefiles and
83 83 prevents unnecessary hashing of content - also after linear/noop update
84 84
85 85 $ sleep 1
86 86 $ hg st
87 87 $ hg debugdirstate --large --nodate
88 88 n 644 7 set large1
89 89 n 644 13 set large2
90 90 $ hg up
91 91 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
92 92 updated to "f74e50bd9e55: #2"
93 93 1 other heads for branch "default"
94 94 $ hg debugdirstate --large --nodate
95 95 n 644 7 set large1
96 96 n 644 13 set large2
97 97
98 98 Test that "hg merge" updates largefiles from "other" correctly
99 99
100 100 (getting largefiles from "other" normally)
101 101
102 102 $ hg status -A large1
103 103 C large1
104 104 $ cat large1
105 105 large1
106 106 $ cat .hglf/large1
107 107 4669e532d5b2c093a78eca010077e708a071bb64
108 108 $ hg merge --config debug.dirstate.delaywrite=2
109 109 getting changed largefiles
110 110 1 largefiles updated, 0 removed
111 111 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 112 (branch merge, don't forget to commit)
113 113 $ hg status -A large1
114 114 M large1
115 115 $ cat large1
116 116 large1 in #1
117 117 $ cat .hglf/large1
118 118 58e24f733a964da346e2407a2bee99d9001184f5
119 119 $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
120 120 -4669e532d5b2c093a78eca010077e708a071bb64
121 121 +58e24f733a964da346e2407a2bee99d9001184f5
122 122
123 123 (getting largefiles from "other" via conflict prompt)
124 124
125 125 $ hg update -q -C 2
126 126 $ echo 'large1 in #3' > large1
127 127 $ echo 'normal1 in #3' > normal1
128 128 $ hg commit -m '#3'
129 129 $ cat .hglf/large1
130 130 e5bb990443d6a92aaf7223813720f7566c9dd05b
131 131 $ hg merge --config debug.dirstate.delaywrite=2 --config ui.interactive=True <<EOF
132 132 > o
133 133 > EOF
134 134 largefile large1 has a merge conflict
135 135 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
136 136 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
137 137 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
138 138 merging normal1
139 139 warning: conflicts while merging normal1! (edit, then use 'hg resolve --mark')
140 140 getting changed largefiles
141 141 1 largefiles updated, 0 removed
142 142 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
143 143 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
144 144 [1]
145 145 $ hg status -A large1
146 146 M large1
147 147 $ cat large1
148 148 large1 in #1
149 149 $ cat .hglf/large1
150 150 58e24f733a964da346e2407a2bee99d9001184f5
151 151 $ rm normal1.orig
152 152
153 153 (merge non-existing largefiles from "other" via conflict prompt -
154 154 make sure the following commit doesn't abort in a confusing way when trying to
155 155 mark the non-existing file as normal in lfdirstate)
156 156
157 157 $ mv .hg/largefiles/58e24f733a964da346e2407a2bee99d9001184f5 .
158 158 $ hg update -q -C 3
159 159 $ hg merge --config largefiles.usercache=not --config debug.dirstate.delaywrite=2 --tool :local --config ui.interactive=True <<EOF
160 160 > o
161 161 > EOF
162 162 largefile large1 has a merge conflict
163 163 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
164 164 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
165 165 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
166 166 getting changed largefiles
167 167 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from file:/*/$TESTTMP/repo (glob)
168 168 0 largefiles updated, 0 removed
169 169 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
170 170 (branch merge, don't forget to commit)
171 171 $ hg commit -m '1-2-3 testing' --config largefiles.usercache=not
172 172 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from local store
173 173 $ hg up -C . --config largefiles.usercache=not
174 174 getting changed largefiles
175 175 large1: largefile 58e24f733a964da346e2407a2bee99d9001184f5 not available from file:/*/$TESTTMP/repo (glob)
176 176 0 largefiles updated, 0 removed
177 177 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
178 178 $ hg st large1
179 179 ! large1
180 180 $ hg rollback -q
181 181 $ mv 58e24f733a964da346e2407a2bee99d9001184f5 .hg/largefiles/
182 182
183 183 Test that "hg revert -r REV" updates largefiles from "REV" correctly
184 184
185 185 $ hg update -q -C 3
186 186 $ hg status -A large1
187 187 C large1
188 188 $ cat large1
189 189 large1 in #3
190 190 $ cat .hglf/large1
191 191 e5bb990443d6a92aaf7223813720f7566c9dd05b
192 192 $ hg diff -c 1 --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
193 193 -4669e532d5b2c093a78eca010077e708a071bb64
194 194 +58e24f733a964da346e2407a2bee99d9001184f5
195 195 $ hg revert --no-backup -r 1 --config debug.dirstate.delaywrite=2 large1
196 196 $ hg status -A large1
197 197 M large1
198 198 $ cat large1
199 199 large1 in #1
200 200 $ cat .hglf/large1
201 201 58e24f733a964da346e2407a2bee99d9001184f5
202 202
203 203 Test that "hg rollback" restores status of largefiles correctly
204 204
205 205 $ hg update -C -q
206 206 $ hg remove large1
207 207 $ test -f .hglf/large1
208 208 [1]
209 209 $ hg forget large2
210 210 $ test -f .hglf/large2
211 211 [1]
212 212 $ echo largeX > largeX
213 213 $ hg add --large largeX
214 214 $ cat .hglf/largeX
215 215
216 216 $ hg commit -m 'will be rollback-ed soon'
217 217 $ echo largeY > largeY
218 218 $ hg add --large largeY
219 219
220 220 $ hg status -A large1
221 221 large1: $ENOENT$
222 222
223 223 $ hg status -A large2
224 224 ? large2
225 225 $ hg status -A largeX
226 226 C largeX
227 227 $ hg status -A largeY
228 228 A largeY
229 229 $ hg rollback
230 230 repository tip rolled back to revision 3 (undo commit)
231 231 working directory now based on revision 3
232 232 $ hg status -A large1
233 233 R large1
234 234 $ test -f .hglf/large1
235 235 [1]
236 236 $ hg status -A large2
237 237 R large2
238 238 $ test -f .hglf/large2
239 239 [1]
240 240 $ hg status -A largeX
241 241 A largeX
242 242 $ cat .hglf/largeX
243 243
244 244 $ hg status -A largeY
245 245 ? largeY
246 246 $ test -f .hglf/largeY
247 247 [1]
248 248 $ rm largeY
249 249
250 250 Test that "hg rollback" restores standins correctly
251 251
252 252 $ hg commit -m 'will be rollback-ed soon'
253 253 $ hg update -q -C 2
254 254 $ cat large1
255 255 large1
256 256 $ cat .hglf/large1
257 257 4669e532d5b2c093a78eca010077e708a071bb64
258 258 $ cat large2
259 259 large2 in #2
260 260 $ cat .hglf/large2
261 261 3cfce6277e7668985707b6887ce56f9f62f6ccd9
262 262
263 263 $ hg rollback -q -f
264 264 $ cat large1
265 265 large1
266 266 $ cat .hglf/large1
267 267 4669e532d5b2c093a78eca010077e708a071bb64
268 268 $ cat large2
269 269 large2 in #2
270 270 $ cat .hglf/large2
271 271 3cfce6277e7668985707b6887ce56f9f62f6ccd9
272 272
273 273 (rollback the parent of the working directory, when the parent of it
274 274 is not branch-tip)
275 275
276 276 $ hg update -q -C 1
277 277 $ cat .hglf/large1
278 278 58e24f733a964da346e2407a2bee99d9001184f5
279 279 $ cat .hglf/large2
280 280 1deebade43c8c498a3c8daddac0244dc55d1331d
281 281
282 282 $ echo normalX > normalX
283 283 $ hg add normalX
284 284 $ hg commit -m 'will be rollback-ed soon'
285 285 $ hg rollback -q
286 286
287 287 $ cat .hglf/large1
288 288 58e24f733a964da346e2407a2bee99d9001184f5
289 289 $ cat .hglf/large2
290 290 1deebade43c8c498a3c8daddac0244dc55d1331d
291 291 $ rm normalX
292 292
293 293 Test that "hg status" shows status of largefiles correctly just after
294 294 automated commit like rebase/transplant
295 295
296 296 $ cat >> .hg/hgrc <<EOF
297 297 > [extensions]
298 298 > rebase =
299 299 > strip =
300 300 > transplant =
301 301 > EOF
302 302 $ hg update -q -C 1
303 303 $ hg remove large1
304 304 $ echo largeX > largeX
305 305 $ hg add --large largeX
306 306 $ hg commit -m '#4'
307 307
308 308 $ hg rebase -s 1 -d 2 --keep
309 309 rebasing 1:72518492caa6 "#1"
310 310 rebasing 4:07d6153b5c04 "#4" (tip)
311 311
312 312 $ hg status -A large1
313 313 large1: $ENOENT$
314 314
315 315 $ hg status -A largeX
316 316 C largeX
317 317 $ hg strip -q 5
318 318
319 319 $ hg update -q -C 2
320 320 $ hg transplant -q 1 4
321 321
322 322 $ hg status -A large1
323 323 large1: $ENOENT$
324 324
325 325 $ hg status -A largeX
326 326 C largeX
327 327 $ hg strip -q 5
328 328
329 329 $ hg update -q -C 2
330 330 $ hg transplant -q --merge 1 --merge 4
331 331
332 332 $ hg status -A large1
333 333 large1: $ENOENT$
334 334
335 335 $ hg status -A largeX
336 336 C largeX
337 337 $ hg strip -q 5
338 338
339 339 Test that linear merge can detect modification (and conflict) correctly
340 340
341 341 (linear merge without conflict)
342 342
343 343 $ echo 'large2 for linear merge (no conflict)' > large2
344 344 $ hg update 3 --config debug.dirstate.delaywrite=2
345 345 getting changed largefiles
346 346 1 largefiles updated, 0 removed
347 347 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
348 348 $ hg status -A large2
349 349 M large2
350 350 $ cat large2
351 351 large2 for linear merge (no conflict)
352 352 $ cat .hglf/large2
353 353 9c4bf8f1b33536d6e5f89447e10620cfe52ea710
354 354
355 355 (linear merge with conflict, choosing "other")
356 356
357 357 $ hg update -q -C 2
358 358 $ echo 'large1 for linear merge (conflict)' > large1
359 359 $ hg update 3 --config ui.interactive=True <<EOF
360 360 > o
361 361 > EOF
362 362 largefile large1 has a merge conflict
363 363 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
364 364 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
365 365 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? o
366 366 getting changed largefiles
367 367 1 largefiles updated, 0 removed
368 368 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
369 369 $ hg status -A large1
370 370 C large1
371 371 $ cat large1
372 372 large1 in #3
373 373 $ cat .hglf/large1
374 374 e5bb990443d6a92aaf7223813720f7566c9dd05b
375 375
376 376 (linear merge with conflict, choosing "local")
377 377
378 378 $ hg update -q -C 2
379 379 $ echo 'large1 for linear merge (conflict)' > large1
380 380 $ hg update 3 --config debug.dirstate.delaywrite=2
381 381 largefile large1 has a merge conflict
382 382 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
383 383 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
384 384 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
385 385 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
386 386 $ hg status -A large1
387 387 M large1
388 388 $ cat large1
389 389 large1 for linear merge (conflict)
390 390 $ cat .hglf/large1
391 391 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
392 392
393 393 Test a linear merge to a revision containing same-name normal file
394 394
395 395 $ hg update -q -C 3
396 396 $ hg remove large2
397 397 $ echo 'large2 as normal file' > large2
398 398 $ hg add large2
399 399 $ echo 'large3 as normal file' > large3
400 400 $ hg add large3
401 401 $ hg commit -m '#5'
402 402 $ hg manifest
403 403 .hglf/large1
404 404 large2
405 405 large3
406 406 normal1
407 407
408 408 (modified largefile is already switched to normal)
409 409
410 410 $ hg update -q -C 2
411 411 $ echo 'modified large2 for linear merge' > large2
412 412 $ hg update -q 5
413 413 remote turned local largefile large2 into a normal file
414 414 keep (l)argefile or use (n)ormal file? l
415 415 $ hg debugdirstate --nodates | grep large2
416 416 a 0 -1 unset .hglf/large2
417 417 r 0 0 set large2
418 418 $ hg status -A large2
419 419 A large2
420 420 $ cat large2
421 421 modified large2 for linear merge
422 422
423 423 (added largefile is already committed as normal)
424 424
425 425 $ hg update -q -C 2
426 426 $ echo 'large3 as large file for linear merge' > large3
427 427 $ hg add --large large3
428 428 $ hg update -q 5
429 429 remote turned local largefile large3 into a normal file
430 430 keep (l)argefile or use (n)ormal file? l
431 431 $ hg debugdirstate --nodates | grep large3
432 432 a 0 -1 unset .hglf/large3
433 433 r 0 0 set large3
434 434 $ hg status -A large3
435 435 A large3
436 436 $ cat large3
437 437 large3 as large file for linear merge
438 438 $ rm -f large3 .hglf/large3
439 439
440 440 Test that the internal linear merging works correctly
441 441 (both heads are stripped to keep pairing of revision number and commit log)
442 442
443 443 $ hg update -q -C 2
444 444 $ hg strip 3 4
445 445 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/9530e27857f7-2e7b195d-backup.hg
446 446 $ mv .hg/strip-backup/9530e27857f7-2e7b195d-backup.hg $TESTTMP
447 447
448 448 (internal linear merging at "hg pull --update")
449 449
450 450 $ echo 'large1 for linear merge (conflict)' > large1
451 451 $ echo 'large2 for linear merge (conflict with normal file)' > large2
452 452 $ hg pull --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
453 453 pulling from $TESTTMP/9530e27857f7-2e7b195d-backup.hg
454 454 searching for changes
455 455 adding changesets
456 456 adding manifests
457 457 adding file changes
458 458 added 3 changesets with 5 changes to 5 files
459 459 new changesets 9530e27857f7:d65e59e952a9
460 460 remote turned local largefile large2 into a normal file
461 461 keep (l)argefile or use (n)ormal file? l
462 462 largefile large1 has a merge conflict
463 463 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
464 464 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
465 465 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
466 466 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
467 467 updated to "d65e59e952a9: #5"
468 468 1 other heads for branch "default"
469 469
470 470 $ hg status -A large1
471 471 M large1
472 472 $ cat large1
473 473 large1 for linear merge (conflict)
474 474 $ cat .hglf/large1
475 475 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
476 476 $ hg status -A large2
477 477 A large2
478 478 $ cat large2
479 479 large2 for linear merge (conflict with normal file)
480 480 $ cat .hglf/large2
481 481 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
482 482
483 483 (internal linear merging at "hg unbundle --update")
484 484
485 485 $ hg update -q -C 2
486 486 $ hg rollback -q
487 487
488 488 $ echo 'large1 for linear merge (conflict)' > large1
489 489 $ echo 'large2 for linear merge (conflict with normal file)' > large2
490 490 $ hg unbundle --update --config debug.dirstate.delaywrite=2 $TESTTMP/9530e27857f7-2e7b195d-backup.hg
491 491 adding changesets
492 492 adding manifests
493 493 adding file changes
494 494 added 3 changesets with 5 changes to 5 files
495 495 new changesets 9530e27857f7:d65e59e952a9
496 496 remote turned local largefile large2 into a normal file
497 497 keep (l)argefile or use (n)ormal file? l
498 498 largefile large1 has a merge conflict
499 499 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
500 500 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
501 501 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
502 502 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
503 503 updated to "d65e59e952a9: #5"
504 504 1 other heads for branch "default"
505 505
506 506 $ hg status -A large1
507 507 M large1
508 508 $ cat large1
509 509 large1 for linear merge (conflict)
510 510 $ cat .hglf/large1
511 511 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
512 512 $ hg status -A large2
513 513 A large2
514 514 $ cat large2
515 515 large2 for linear merge (conflict with normal file)
516 516 $ cat .hglf/large2
517 517 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
518 518
519 519 (internal linear merging in subrepo at "hg update")
520 520
521 521 $ cd ..
522 522 $ hg init subparent
523 523 $ cd subparent
524 524
525 525 $ hg clone -q -u 2 ../repo sub
526 526 $ cat > .hgsub <<EOF
527 527 > sub = sub
528 528 > EOF
529 529 $ hg add .hgsub
530 530 $ hg commit -m '#0@parent'
531 531 $ cat .hgsubstate
532 532 f74e50bd9e5594b7cf1e6c5cbab86ddd25f3ca2f sub
533 533 $ hg -R sub update -q
534 534 $ hg commit -m '#1@parent'
535 535 $ cat .hgsubstate
536 536 d65e59e952a9638e2ce863b41a420ca723dd3e8d sub
537 537 $ hg update -q 0
538 538
539 539 $ echo 'large1 for linear merge (conflict)' > sub/large1
540 540 $ echo 'large2 for linear merge (conflict with normal file)' > sub/large2
541 541 $ hg update --config ui.interactive=True --config debug.dirstate.delaywrite=2 <<EOF
542 542 > m
543 543 > r
544 544 > l
545 545 > l
546 546 > EOF
547 547 subrepository sub diverged (local revision: f74e50bd9e55, remote revision: d65e59e952a9)
548 548 (M)erge, keep (l)ocal [working copy] or keep (r)emote [destination]? m
549 549 subrepository sources for sub differ (in checked out version)
550 550 use (l)ocal source (f74e50bd9e55) or (r)emote source (d65e59e952a9)? r
551 551 remote turned local largefile large2 into a normal file
552 552 keep (l)argefile or use (n)ormal file? l
553 553 largefile large1 has a merge conflict
554 554 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
555 555 keep (l)ocal ba94c2efe5b7c5e0af8d189295ce00553b0612b7 or
556 556 take (o)ther e5bb990443d6a92aaf7223813720f7566c9dd05b? l
557 557 2 files updated, 1 files merged, 0 files removed, 0 files unresolved
558 558 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
559 559
560 560 $ hg -R sub status -A sub/large1
561 561 M sub/large1
562 562 $ cat sub/large1
563 563 large1 for linear merge (conflict)
564 564 $ cat sub/.hglf/large1
565 565 ba94c2efe5b7c5e0af8d189295ce00553b0612b7
566 566 $ hg -R sub status -A sub/large2
567 567 A sub/large2
568 568 $ cat sub/large2
569 569 large2 for linear merge (conflict with normal file)
570 570 $ cat sub/.hglf/large2
571 571 d7591fe9be0f6227d90bddf3e4f52ff41fc1f544
572 572
573 573 $ cd ..
574 574 $ cd repo
575 575
576 576 Test that rebase updates largefiles in the working directory even if
577 577 it is aborted by conflict.
578 578
579 579 $ hg update -q -C 3
580 580 $ cat .hglf/large1
581 581 e5bb990443d6a92aaf7223813720f7566c9dd05b
582 582 $ cat large1
583 583 large1 in #3
584 584 $ hg rebase -s 1 -d 3 --keep --config ui.interactive=True <<EOF
585 585 > o
586 586 > EOF
587 587 rebasing 1:72518492caa6 "#1"
588 588 largefile large1 has a merge conflict
589 589 ancestor was 4669e532d5b2c093a78eca010077e708a071bb64
590 590 keep (l)ocal e5bb990443d6a92aaf7223813720f7566c9dd05b or
591 591 take (o)ther 58e24f733a964da346e2407a2bee99d9001184f5? o
592 592 merging normal1
593 593 warning: conflicts while merging normal1! (edit, then use 'hg resolve --mark')
594 594 unresolved conflicts (see hg resolve, then hg rebase --continue)
595 595 [1]
596 596 $ cat .hglf/large1
597 597 58e24f733a964da346e2407a2bee99d9001184f5
598 598 $ cat large1
599 599 large1 in #1
600 600 $ rm normal1.orig
601 601
602 602 Test that rebase updates standins for manually modified largefiles at
603 603 the 1st commit of resuming.
604 604
605 605 $ echo "manually modified before 'hg rebase --continue'" > large1
606 606 $ hg resolve -m normal1
607 607 (no more unresolved files)
608 608 continue: hg rebase --continue
609 609 $ hg rebase --continue --config ui.interactive=True <<EOF
610 610 > c
611 611 > EOF
612 612 rebasing 1:72518492caa6 "#1"
613 613 rebasing 4:07d6153b5c04 "#4"
614 file '.hglf/large1' was deleted in local [dest] but was modified in other [source].
614 file '.hglf/large1' was deleted in other [source] but was modified in local [dest].
615 615 What do you want to do?
616 616 use (c)hanged version, (d)elete, or leave (u)nresolved? c
617 617
618 618 $ hg diff -c "tip~1" --nodates .hglf/large1 | grep '^[+-][0-9a-z]'
619 619 -e5bb990443d6a92aaf7223813720f7566c9dd05b
620 620 +8a4f783556e7dea21139ca0466eafce954c75c13
621 621 $ rm -f large1
622 622 $ hg update -q -C tip
623 623 $ cat large1
624 624 manually modified before 'hg rebase --continue'
625 625
626 626 Test that transplant updates largefiles, of which standins are safely
627 627 changed, even if it is aborted by conflict of other.
628 628
629 629 $ hg update -q -C 5
630 630 $ cat .hglf/large1
631 631 e5bb990443d6a92aaf7223813720f7566c9dd05b
632 632 $ cat large1
633 633 large1 in #3
634 634 $ hg diff -c 4 .hglf/largeX | grep '^[+-][0-9a-z]'
635 635 +fa44618ea25181aff4f48b70428294790cec9f61
636 636 $ hg transplant 4
637 637 applying 07d6153b5c04
638 638 patching file .hglf/large1
639 639 Hunk #1 FAILED at 0
640 640 1 out of 1 hunks FAILED -- saving rejects to file .hglf/large1.rej
641 641 patch failed to apply
642 642 abort: fix up the working directory and run hg transplant --continue
643 643 [255]
644 644 $ hg status -A large1
645 645 C large1
646 646 $ cat .hglf/large1
647 647 e5bb990443d6a92aaf7223813720f7566c9dd05b
648 648 $ cat large1
649 649 large1 in #3
650 650 $ hg status -A largeX
651 651 A largeX
652 652 $ cat .hglf/largeX
653 653 fa44618ea25181aff4f48b70428294790cec9f61
654 654 $ cat largeX
655 655 largeX
656 656
657 657 Test that transplant updates standins for manually modified largefiles
658 658 at the 1st commit of resuming.
659 659
660 660 $ echo "manually modified before 'hg transplant --continue'" > large1
661 661 $ hg transplant --continue
662 662 07d6153b5c04 transplanted as f1bf30eb88cc
663 663 $ hg diff -c tip .hglf/large1 | grep '^[+-][0-9a-z]'
664 664 -e5bb990443d6a92aaf7223813720f7566c9dd05b
665 665 +6a4f36d4075fbe0f30ec1d26ca44e63c05903671
666 666 $ rm -f large1
667 667 $ hg update -q -C tip
668 668 $ cat large1
669 669 manually modified before 'hg transplant --continue'
670 670
671 671 Test that "hg status" doesn't show removal of largefiles not managed
672 672 in the target context.
673 673
674 674 $ hg update -q -C 4
675 675 $ hg remove largeX
676 676 $ hg status -A largeX
677 677 R largeX
678 678 $ hg status -A --rev '.^1' largeX
679 679
680 680 #if execbit
681 681
682 682 Test that "hg status" against revisions other than parent notices exec
683 683 bit changes of largefiles.
684 684
685 685 $ hg update -q -C 4
686 686
687 687 (the case that large2 doesn't have exec bit in the target context but
688 688 in the working context)
689 689
690 690 $ chmod +x large2
691 691 $ hg status -A --rev 0 large2
692 692 M large2
693 693 $ hg commit -m 'chmod +x large2'
694 694
695 695 (the case that large2 has exec bit in the target context but not in
696 696 the working context)
697 697
698 698 $ echo dummy > dummy
699 699 $ hg add dummy
700 700 $ hg commit -m 'revision for separation'
701 701 $ chmod -x large2
702 702 $ hg status -A --rev '.^1' large2
703 703 M large2
704 704
705 705 #else
706 706
707 707 Test that "hg status" against revisions other than parent ignores exec
708 708 bit correctly on the platform being unaware of it.
709 709
710 710 $ hg update -q -C 4
711 711
712 712 $ cat > ../exec-bit.patch <<EOF
713 713 > # HG changeset patch
714 714 > # User test
715 715 > # Date 0 0
716 716 > # Thu Jan 01 00:00:00 1970 +0000
717 717 > # Node ID be1b433a65b12b27b5519d92213e14f7e1769b90
718 718 > # Parent 07d6153b5c04313efb75deec9ba577de7faeb727
719 719 > chmod +x large2
720 720 >
721 721 > diff --git a/.hglf/large2 b/.hglf/large2
722 722 > old mode 100644
723 723 > new mode 100755
724 724 > EOF
725 725 $ hg import --exact --bypass ../exec-bit.patch
726 726 applying ../exec-bit.patch
727 727 $ hg status -A --rev tip large2
728 728 C large2
729 729
730 730 #endif
731 731
732 732 The fileset revset is evaluated for each revision, instead of once on wdir(),
733 733 and then patterns matched on each revision. Here, no exec bits are set in
734 734 wdir(), but a matching revision is detected.
735 735
736 736 (Teach large2 is not an executable. Maybe this is a bug of largefiles.)
737 737 #if execbit
738 738 $ chmod -x .hglf/large2
739 739 #endif
740 740
741 741 $ hg files 'set:exec()'
742 742 [1]
743 743 $ hg log -qr 'file("set:exec()")'
744 744 9:be1b433a65b1
745 745
746 746 Test a fatal error interrupting an update. Verify that status report dirty
747 747 files correctly after an interrupted update. Also verify that checking all
748 748 hashes reveals it isn't clean.
749 749
750 750 Start with clean dirstates:
751 751 $ hg up --quiet --clean --rev "8^"
752 752 $ sleep 1
753 753 $ hg st
754 754 Update standins without updating largefiles - large1 is modified and largeX is
755 755 added:
756 756 $ cat << EOF > ../crashupdatelfiles.py
757 757 > import hgext.largefiles.lfutil
758 758 > def getlfilestoupdate(oldstandins, newstandins):
759 759 > raise SystemExit(7)
760 760 > hgext.largefiles.lfutil.getlfilestoupdate = getlfilestoupdate
761 761 > EOF
762 762 $ hg up -Cr "8" --config extensions.crashupdatelfiles=../crashupdatelfiles.py
763 763 [7]
764 764 Check large1 content and status ... and that update will undo modifications:
765 765 $ cat large1
766 766 large1 in #3
767 767 $ hg st
768 768 M large1
769 769 ! largeX
770 770 $ hg up -Cr .
771 771 getting changed largefiles
772 772 2 largefiles updated, 0 removed
773 773 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
774 774 $ cat large1
775 775 manually modified before 'hg transplant --continue'
776 776 $ hg st
777 777 Force largefiles rehashing and check that all changes have been caught by
778 778 status and update:
779 779 $ rm .hg/largefiles/dirstate
780 780 $ hg st
781 781
782 782 $ cd ..
783 783
784 784 Test that "hg convert" avoids copying largefiles from the working
785 785 directory into store, because "hg convert" doesn't update largefiles
786 786 in the working directory (removing files under ".cache/largefiles"
787 787 forces "hg convert" to copy corresponding largefiles)
788 788
789 789 $ cat >> $HGRCPATH <<EOF
790 790 > [extensions]
791 791 > convert =
792 792 > EOF
793 793
794 794 $ rm $TESTTMP/.cache/largefiles/6a4f36d4075fbe0f30ec1d26ca44e63c05903671
795 795 $ hg convert -q repo repo.converted
@@ -1,1130 +1,1130 b''
1 1 Tests for change/delete conflicts, including:
2 2 b5605d88dc27: Make ui.prompt repeat on "unrecognized response" again
3 3 (issue897)
4 4
5 5 840e2b315c1f: Fix misleading error and prompts during update/merge
6 6 (issue556)
7 7
8 8 Make sure HGMERGE doesn't interfere with the test
9 9 $ unset HGMERGE
10 10
11 11 $ status() {
12 12 > echo "--- status ---"
13 13 > hg st -A file1 file2 file3
14 14 > echo "--- resolve --list ---"
15 15 > hg resolve --list file1 file2 file3
16 16 > echo "--- debugmergestate ---"
17 17 > hg debugmergestate
18 18 > for file in file1 file2 file3; do
19 19 > if [ -f $file ]; then
20 20 > echo "--- $file ---"
21 21 > cat $file
22 22 > else
23 23 > echo "*** $file does not exist"
24 24 > fi
25 25 > done
26 26 > }
27 27
28 28 $ hg init repo
29 29 $ cd repo
30 30
31 31 $ echo 1 > file1
32 32 $ echo 2 > file2
33 33 $ echo 3 > file3
34 34 $ hg ci -Am 'added files'
35 35 adding file1
36 36 adding file2
37 37 adding file3
38 38
39 39 $ hg rm file1
40 40 $ echo changed >> file2
41 41 $ echo changed1 >> file3
42 42 $ hg ci -m 'removed file1, changed file2, changed file3'
43 43
44 44 $ hg co 0
45 45 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 46
47 47 $ echo changed >> file1
48 48 $ hg rm file2
49 49 $ echo changed2 >> file3
50 50 $ hg ci -m 'changed file1, removed file2, changed file3'
51 51 created new head
52 52
53 53
54 54 Non-interactive merge:
55 55
56 56 $ hg merge -y
57 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
57 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
58 58 What do you want to do?
59 59 use (c)hanged version, (d)elete, or leave (u)nresolved? u
60 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
60 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
61 61 What do you want to do?
62 62 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
63 63 merging file3
64 64 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
65 65 0 files updated, 0 files merged, 0 files removed, 3 files unresolved
66 66 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
67 67 [1]
68 68
69 69 $ status
70 70 --- status ---
71 71 M file2
72 72 M file3
73 73 C file1
74 74 --- resolve --list ---
75 75 U file1
76 76 U file2
77 77 U file3
78 78 --- debugmergestate ---
79 79 * version 2 records
80 80 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
81 81 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
82 82 labels:
83 83 local: working copy
84 84 other: merge rev
85 85 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
86 86 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
87 87 local path: file1 (flags "")
88 88 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
89 89 other path: file1 (node null)
90 90 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
91 91 file: file2 (record type "C", state "u", hash null)
92 92 local path: file2 (flags "")
93 93 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
94 94 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
95 95 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
96 96 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
97 97 local path: file3 (flags "")
98 98 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
99 99 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
100 100 --- file1 ---
101 101 1
102 102 changed
103 103 --- file2 ---
104 104 2
105 105 changed
106 106 --- file3 ---
107 107 3
108 108 <<<<<<< working copy: 13910f48cf7b - test: changed file1, removed file2, chan...
109 109 changed2
110 110 =======
111 111 changed1
112 112 >>>>>>> merge rev: 10f9a0a634e8 - test: removed file1, changed file2, chan...
113 113
114 114
115 115 Interactive merge:
116 116
117 117 $ hg co -C
118 118 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
119 119 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
120 120 1 other heads for branch "default"
121 121
122 122 $ hg merge --config ui.interactive=true <<EOF
123 123 > c
124 124 > d
125 125 > EOF
126 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
126 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
127 127 What do you want to do?
128 128 use (c)hanged version, (d)elete, or leave (u)nresolved? c
129 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
129 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
130 130 What do you want to do?
131 131 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? d
132 132 merging file3
133 133 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
134 134 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
135 135 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
136 136 [1]
137 137
138 138 $ status
139 139 --- status ---
140 140 file2: * (glob)
141 141 M file3
142 142 C file1
143 143 --- resolve --list ---
144 144 R file1
145 145 R file2
146 146 U file3
147 147 --- debugmergestate ---
148 148 * version 2 records
149 149 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
150 150 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
151 151 labels:
152 152 local: working copy
153 153 other: merge rev
154 154 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
155 155 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
156 156 local path: file1 (flags "")
157 157 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
158 158 other path: file1 (node null)
159 159 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
160 160 file: file2 (record type "C", state "r", hash null)
161 161 local path: file2 (flags "")
162 162 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
163 163 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
164 164 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
165 165 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
166 166 local path: file3 (flags "")
167 167 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
168 168 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
169 169 --- file1 ---
170 170 1
171 171 changed
172 172 *** file2 does not exist
173 173 --- file3 ---
174 174 3
175 175 <<<<<<< working copy: 13910f48cf7b - test: changed file1, removed file2, chan...
176 176 changed2
177 177 =======
178 178 changed1
179 179 >>>>>>> merge rev: 10f9a0a634e8 - test: removed file1, changed file2, chan...
180 180
181 181
182 182 Interactive merge with bad input:
183 183
184 184 $ hg co -C
185 185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 186 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
187 187 1 other heads for branch "default"
188 188
189 189 $ hg merge --config ui.interactive=true <<EOF
190 190 > foo
191 191 > bar
192 192 > d
193 193 > baz
194 194 > c
195 195 > EOF
196 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
196 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
197 197 What do you want to do?
198 198 use (c)hanged version, (d)elete, or leave (u)nresolved? foo
199 199 unrecognized response
200 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
200 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
201 201 What do you want to do?
202 202 use (c)hanged version, (d)elete, or leave (u)nresolved? bar
203 203 unrecognized response
204 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
204 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
205 205 What do you want to do?
206 206 use (c)hanged version, (d)elete, or leave (u)nresolved? d
207 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
207 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
208 208 What do you want to do?
209 209 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? baz
210 210 unrecognized response
211 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
211 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
212 212 What do you want to do?
213 213 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
214 214 merging file3
215 215 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
216 216 0 files updated, 1 files merged, 1 files removed, 1 files unresolved
217 217 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
218 218 [1]
219 219
220 220 $ status
221 221 --- status ---
222 222 M file2
223 223 M file3
224 224 R file1
225 225 --- resolve --list ---
226 226 R file1
227 227 R file2
228 228 U file3
229 229 --- debugmergestate ---
230 230 * version 2 records
231 231 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
232 232 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
233 233 labels:
234 234 local: working copy
235 235 other: merge rev
236 236 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
237 237 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
238 238 local path: file1 (flags "")
239 239 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
240 240 other path: file1 (node null)
241 241 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
242 242 file: file2 (record type "C", state "r", hash null)
243 243 local path: file2 (flags "")
244 244 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
245 245 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
246 246 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
247 247 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
248 248 local path: file3 (flags "")
249 249 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
250 250 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
251 251 *** file1 does not exist
252 252 --- file2 ---
253 253 2
254 254 changed
255 255 --- file3 ---
256 256 3
257 257 <<<<<<< working copy: 13910f48cf7b - test: changed file1, removed file2, chan...
258 258 changed2
259 259 =======
260 260 changed1
261 261 >>>>>>> merge rev: 10f9a0a634e8 - test: removed file1, changed file2, chan...
262 262
263 263
264 264 Interactive merge with not enough input:
265 265
266 266 $ hg co -C
267 267 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
268 268 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
269 269 1 other heads for branch "default"
270 270
271 271 $ hg merge --config ui.interactive=true <<EOF
272 272 > d
273 273 > EOF
274 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
274 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
275 275 What do you want to do?
276 276 use (c)hanged version, (d)elete, or leave (u)nresolved? d
277 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
277 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
278 278 What do you want to do?
279 279 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
280 280 merging file3
281 281 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
282 282 0 files updated, 0 files merged, 1 files removed, 2 files unresolved
283 283 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
284 284 [1]
285 285
286 286 $ status
287 287 --- status ---
288 288 M file2
289 289 M file3
290 290 R file1
291 291 --- resolve --list ---
292 292 R file1
293 293 U file2
294 294 U file3
295 295 --- debugmergestate ---
296 296 * version 2 records
297 297 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
298 298 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
299 299 labels:
300 300 local: working copy
301 301 other: merge rev
302 302 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
303 303 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
304 304 local path: file1 (flags "")
305 305 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
306 306 other path: file1 (node null)
307 307 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
308 308 file: file2 (record type "C", state "u", hash null)
309 309 local path: file2 (flags "")
310 310 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
311 311 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
312 312 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
313 313 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
314 314 local path: file3 (flags "")
315 315 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
316 316 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
317 317 *** file1 does not exist
318 318 --- file2 ---
319 319 2
320 320 changed
321 321 --- file3 ---
322 322 3
323 323 <<<<<<< working copy: 13910f48cf7b - test: changed file1, removed file2, chan...
324 324 changed2
325 325 =======
326 326 changed1
327 327 >>>>>>> merge rev: 10f9a0a634e8 - test: removed file1, changed file2, chan...
328 328
329 329 Choose local versions of files
330 330
331 331 $ hg co -C
332 332 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
333 333 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
334 334 1 other heads for branch "default"
335 335
336 336 $ hg merge --tool :local
337 337 0 files updated, 3 files merged, 0 files removed, 0 files unresolved
338 338 (branch merge, don't forget to commit)
339 339 $ status 2>&1 | tee $TESTTMP/local.status
340 340 --- status ---
341 341 file2: * (glob)
342 342 M file3
343 343 C file1
344 344 --- resolve --list ---
345 345 R file1
346 346 R file2
347 347 R file3
348 348 --- debugmergestate ---
349 349 * version 2 records
350 350 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
351 351 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
352 352 labels:
353 353 local: working copy
354 354 other: merge rev
355 355 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
356 356 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
357 357 local path: file1 (flags "")
358 358 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
359 359 other path: file1 (node null)
360 360 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
361 361 file: file2 (record type "C", state "r", hash null)
362 362 local path: file2 (flags "")
363 363 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
364 364 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
365 365 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
366 366 file: file3 (record type "F", state "r", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
367 367 local path: file3 (flags "")
368 368 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
369 369 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
370 370 --- file1 ---
371 371 1
372 372 changed
373 373 *** file2 does not exist
374 374 --- file3 ---
375 375 3
376 376 changed2
377 377
378 378 Choose other versions of files
379 379
380 380 $ hg co -C
381 381 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
382 382 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
383 383 1 other heads for branch "default"
384 384
385 385 $ hg merge --tool :other
386 386 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
387 387 (branch merge, don't forget to commit)
388 388 $ status 2>&1 | tee $TESTTMP/other.status
389 389 --- status ---
390 390 M file2
391 391 M file3
392 392 R file1
393 393 --- resolve --list ---
394 394 R file1
395 395 R file2
396 396 R file3
397 397 --- debugmergestate ---
398 398 * version 2 records
399 399 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
400 400 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
401 401 labels:
402 402 local: working copy
403 403 other: merge rev
404 404 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
405 405 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
406 406 local path: file1 (flags "")
407 407 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
408 408 other path: file1 (node null)
409 409 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
410 410 file: file2 (record type "C", state "r", hash null)
411 411 local path: file2 (flags "")
412 412 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
413 413 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
414 414 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
415 415 file: file3 (record type "F", state "r", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
416 416 local path: file3 (flags "")
417 417 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
418 418 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
419 419 *** file1 does not exist
420 420 --- file2 ---
421 421 2
422 422 changed
423 423 --- file3 ---
424 424 3
425 425 changed1
426 426
427 427 Fail
428 428
429 429 $ hg co -C
430 430 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
431 431 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
432 432 1 other heads for branch "default"
433 433
434 434 $ hg merge --tool :fail
435 435 0 files updated, 0 files merged, 0 files removed, 3 files unresolved
436 436 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
437 437 [1]
438 438 $ status 2>&1 | tee $TESTTMP/fail.status
439 439 --- status ---
440 440 M file2
441 441 M file3
442 442 C file1
443 443 --- resolve --list ---
444 444 U file1
445 445 U file2
446 446 U file3
447 447 --- debugmergestate ---
448 448 * version 2 records
449 449 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
450 450 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
451 451 labels:
452 452 local: working copy
453 453 other: merge rev
454 454 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
455 455 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
456 456 local path: file1 (flags "")
457 457 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
458 458 other path: file1 (node null)
459 459 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
460 460 file: file2 (record type "C", state "u", hash null)
461 461 local path: file2 (flags "")
462 462 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
463 463 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
464 464 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
465 465 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
466 466 local path: file3 (flags "")
467 467 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
468 468 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
469 469 --- file1 ---
470 470 1
471 471 changed
472 472 --- file2 ---
473 473 2
474 474 changed
475 475 --- file3 ---
476 476 3
477 477 changed2
478 478
479 479 Force prompts with no input (should be similar to :fail)
480 480
481 481 $ hg co -C
482 482 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
483 483 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
484 484 1 other heads for branch "default"
485 485
486 486 $ hg merge --config ui.interactive=True --tool :prompt
487 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
487 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
488 488 What do you want to do?
489 489 use (c)hanged version, (d)elete, or leave (u)nresolved?
490 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
490 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
491 491 What do you want to do?
492 492 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
493 493 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for file3?
494 494 0 files updated, 0 files merged, 0 files removed, 3 files unresolved
495 495 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
496 496 [1]
497 497 $ status 2>&1 | tee $TESTTMP/prompt.status
498 498 --- status ---
499 499 M file2
500 500 M file3
501 501 C file1
502 502 --- resolve --list ---
503 503 U file1
504 504 U file2
505 505 U file3
506 506 --- debugmergestate ---
507 507 * version 2 records
508 508 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
509 509 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
510 510 labels:
511 511 local: working copy
512 512 other: merge rev
513 513 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
514 514 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
515 515 local path: file1 (flags "")
516 516 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
517 517 other path: file1 (node null)
518 518 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
519 519 file: file2 (record type "C", state "u", hash null)
520 520 local path: file2 (flags "")
521 521 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
522 522 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
523 523 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
524 524 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
525 525 local path: file3 (flags "")
526 526 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
527 527 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
528 528 --- file1 ---
529 529 1
530 530 changed
531 531 --- file2 ---
532 532 2
533 533 changed
534 534 --- file3 ---
535 535 3
536 536 changed2
537 537 $ cmp $TESTTMP/fail.status $TESTTMP/prompt.status || diff -U8 $TESTTMP/fail.status $TESTTMP/prompt.status
538 538
539 539
540 540 Force prompts
541 541
542 542 $ hg co -C
543 543 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
544 544 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
545 545 1 other heads for branch "default"
546 546
547 547 $ hg merge --tool :prompt
548 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
548 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
549 549 What do you want to do?
550 550 use (c)hanged version, (d)elete, or leave (u)nresolved? u
551 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
551 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
552 552 What do you want to do?
553 553 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
554 554 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for file3? u
555 555 0 files updated, 0 files merged, 0 files removed, 3 files unresolved
556 556 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
557 557 [1]
558 558 $ status
559 559 --- status ---
560 560 M file2
561 561 M file3
562 562 C file1
563 563 --- resolve --list ---
564 564 U file1
565 565 U file2
566 566 U file3
567 567 --- debugmergestate ---
568 568 * version 2 records
569 569 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
570 570 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
571 571 labels:
572 572 local: working copy
573 573 other: merge rev
574 574 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
575 575 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
576 576 local path: file1 (flags "")
577 577 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
578 578 other path: file1 (node null)
579 579 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
580 580 file: file2 (record type "C", state "u", hash null)
581 581 local path: file2 (flags "")
582 582 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
583 583 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
584 584 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
585 585 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
586 586 local path: file3 (flags "")
587 587 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
588 588 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
589 589 --- file1 ---
590 590 1
591 591 changed
592 592 --- file2 ---
593 593 2
594 594 changed
595 595 --- file3 ---
596 596 3
597 597 changed2
598 598
599 599 Choose to merge all files
600 600
601 601 $ hg co -C
602 602 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
603 603 updated to "13910f48cf7b: changed file1, removed file2, changed file3"
604 604 1 other heads for branch "default"
605 605
606 606 $ hg merge --tool :merge3
607 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
607 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
608 608 What do you want to do?
609 609 use (c)hanged version, (d)elete, or leave (u)nresolved? u
610 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
610 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
611 611 What do you want to do?
612 612 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
613 613 merging file3
614 614 warning: conflicts while merging file3! (edit, then use 'hg resolve --mark')
615 615 0 files updated, 0 files merged, 0 files removed, 3 files unresolved
616 616 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
617 617 [1]
618 618 $ status
619 619 --- status ---
620 620 M file2
621 621 M file3
622 622 C file1
623 623 --- resolve --list ---
624 624 U file1
625 625 U file2
626 626 U file3
627 627 --- debugmergestate ---
628 628 * version 2 records
629 629 local: 13910f48cf7bdb2a0ba6e24b4900e4fdd5739dd4
630 630 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
631 631 labels:
632 632 local: working copy
633 633 other: merge rev
634 634 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
635 635 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
636 636 local path: file1 (flags "")
637 637 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
638 638 other path: file1 (node null)
639 639 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
640 640 file: file2 (record type "C", state "u", hash null)
641 641 local path: file2 (flags "")
642 642 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
643 643 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
644 644 file extras: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
645 645 file: file3 (record type "F", state "u", hash d5b0a58bc47161b1b8a831084b366f757c4f0b11)
646 646 local path: file3 (flags "")
647 647 ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
648 648 other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
649 649 --- file1 ---
650 650 1
651 651 changed
652 652 --- file2 ---
653 653 2
654 654 changed
655 655 --- file3 ---
656 656 3
657 657 <<<<<<< working copy: 13910f48cf7b - test: changed file1, removed file2, chan...
658 658 changed2
659 659 ||||||| base
660 660 =======
661 661 changed1
662 662 >>>>>>> merge rev: 10f9a0a634e8 - test: removed file1, changed file2, chan...
663 663
664 664 Exercise transitions between local, other, fail and prompt, and make sure the
665 665 dirstate stays consistent. (Compare with each other and to the above
666 666 invocations.)
667 667
668 668 $ testtransitions() {
669 669 > # this traversal order covers every transition
670 670 > tools="local other prompt local fail other local prompt other fail prompt fail local"
671 671 > lasttool="merge3"
672 672 > for tool in $tools; do
673 673 > echo "=== :$lasttool -> :$tool ==="
674 674 > ref="$TESTTMP/$tool.status"
675 675 > hg resolve --unmark --all
676 676 > hg resolve --tool ":$tool" --all --config ui.interactive=True
677 677 > status > "$TESTTMP/compare.status" 2>&1
678 678 > echo '--- diff of status ---'
679 679 > if cmp "$TESTTMP/$tool.status" "$TESTTMP/compare.status" || diff -U8 "$TESTTMP/$tool.status" "$TESTTMP/compare.status"; then
680 680 > echo '(status identical)'
681 681 > fi
682 682 > lasttool="$tool"
683 683 > echo
684 684 > done
685 685 > }
686 686
687 687 $ testtransitions
688 688 === :merge3 -> :local ===
689 689 (no more unresolved files)
690 690 --- diff of status ---
691 691 (status identical)
692 692
693 693 === :local -> :other ===
694 694 (no more unresolved files)
695 695 --- diff of status ---
696 696 (status identical)
697 697
698 698 === :other -> :prompt ===
699 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
699 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
700 700 What do you want to do?
701 701 use (c)hanged version, (d)elete, or leave (u)nresolved?
702 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
702 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
703 703 What do you want to do?
704 704 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
705 705 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for file3?
706 706 --- diff of status ---
707 707 (status identical)
708 708
709 709 === :prompt -> :local ===
710 710 (no more unresolved files)
711 711 --- diff of status ---
712 712 (status identical)
713 713
714 714 === :local -> :fail ===
715 715 --- diff of status ---
716 716 (status identical)
717 717
718 718 === :fail -> :other ===
719 719 (no more unresolved files)
720 720 --- diff of status ---
721 721 (status identical)
722 722
723 723 === :other -> :local ===
724 724 (no more unresolved files)
725 725 --- diff of status ---
726 726 (status identical)
727 727
728 728 === :local -> :prompt ===
729 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
729 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
730 730 What do you want to do?
731 731 use (c)hanged version, (d)elete, or leave (u)nresolved?
732 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
732 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
733 733 What do you want to do?
734 734 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
735 735 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for file3?
736 736 --- diff of status ---
737 737 (status identical)
738 738
739 739 === :prompt -> :other ===
740 740 (no more unresolved files)
741 741 --- diff of status ---
742 742 (status identical)
743 743
744 744 === :other -> :fail ===
745 745 --- diff of status ---
746 746 (status identical)
747 747
748 748 === :fail -> :prompt ===
749 file 'file1' was deleted in local [working copy] but was modified in other [merge rev].
749 file 'file1' was deleted in other [merge rev] but was modified in local [working copy].
750 750 What do you want to do?
751 751 use (c)hanged version, (d)elete, or leave (u)nresolved?
752 file 'file2' was deleted in other [merge rev] but was modified in local [working copy].
752 file 'file2' was deleted in local [working copy] but was modified in other [merge rev].
753 753 What do you want to do?
754 754 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
755 755 keep (l)ocal [working copy], take (o)ther [merge rev], or leave (u)nresolved for file3?
756 756 --- diff of status ---
757 757 (status identical)
758 758
759 759 === :prompt -> :fail ===
760 760 --- diff of status ---
761 761 (status identical)
762 762
763 763 === :fail -> :local ===
764 764 (no more unresolved files)
765 765 --- diff of status ---
766 766 (status identical)
767 767
768 768
769 769
770 770 Non-interactive linear update
771 771
772 772 $ hg co -C 0
773 773 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
774 774 $ echo changed >> file1
775 775 $ hg rm file2
776 776 $ hg update 1 -y
777 file 'file1' was deleted in local [working copy] but was modified in other [destination].
777 file 'file1' was deleted in other [destination] but was modified in local [working copy].
778 778 What do you want to do?
779 779 use (c)hanged version, (d)elete, or leave (u)nresolved? u
780 file 'file2' was deleted in other [destination] but was modified in local [working copy].
780 file 'file2' was deleted in local [working copy] but was modified in other [destination].
781 781 What do you want to do?
782 782 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
783 783 1 files updated, 0 files merged, 0 files removed, 2 files unresolved
784 784 use 'hg resolve' to retry unresolved file merges
785 785 [1]
786 786 $ status
787 787 --- status ---
788 788 A file1
789 789 C file2
790 790 C file3
791 791 --- resolve --list ---
792 792 U file1
793 793 U file2
794 794 --- debugmergestate ---
795 795 * version 2 records
796 796 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
797 797 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
798 798 labels:
799 799 local: working copy
800 800 other: destination
801 801 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
802 802 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
803 803 local path: file1 (flags "")
804 804 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
805 805 other path: file1 (node null)
806 806 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
807 807 file: file2 (record type "C", state "u", hash null)
808 808 local path: file2 (flags "")
809 809 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
810 810 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
811 811 --- file1 ---
812 812 1
813 813 changed
814 814 --- file2 ---
815 815 2
816 816 changed
817 817 --- file3 ---
818 818 3
819 819 changed1
820 820
821 821 Choose local versions of files
822 822
823 823 $ hg co -C 0
824 824 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
825 825 $ echo changed >> file1
826 826 $ hg rm file2
827 827 $ hg update 1 --tool :local
828 828 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
829 829 $ status 2>&1 | tee $TESTTMP/local.status
830 830 --- status ---
831 831 file2: * (glob)
832 832 A file1
833 833 C file3
834 834 --- resolve --list ---
835 835 R file1
836 836 R file2
837 837 --- debugmergestate ---
838 838 * version 2 records
839 839 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
840 840 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
841 841 labels:
842 842 local: working copy
843 843 other: destination
844 844 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
845 845 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
846 846 local path: file1 (flags "")
847 847 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
848 848 other path: file1 (node null)
849 849 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
850 850 file: file2 (record type "C", state "r", hash null)
851 851 local path: file2 (flags "")
852 852 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
853 853 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
854 854 --- file1 ---
855 855 1
856 856 changed
857 857 *** file2 does not exist
858 858 --- file3 ---
859 859 3
860 860 changed1
861 861
862 862 Choose other versions of files
863 863
864 864 $ hg co -C 0
865 865 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
866 866 $ echo changed >> file1
867 867 $ hg rm file2
868 868 $ hg update 1 --tool :other
869 869 1 files updated, 1 files merged, 1 files removed, 0 files unresolved
870 870 $ status 2>&1 | tee $TESTTMP/other.status
871 871 --- status ---
872 872 file1: * (glob)
873 873 C file2
874 874 C file3
875 875 --- resolve --list ---
876 876 R file1
877 877 R file2
878 878 --- debugmergestate ---
879 879 * version 2 records
880 880 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
881 881 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
882 882 labels:
883 883 local: working copy
884 884 other: destination
885 885 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
886 886 file: file1 (record type "C", state "r", hash 60b27f004e454aca81b0480209cce5081ec52390)
887 887 local path: file1 (flags "")
888 888 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
889 889 other path: file1 (node null)
890 890 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
891 891 file: file2 (record type "C", state "r", hash null)
892 892 local path: file2 (flags "")
893 893 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
894 894 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
895 895 *** file1 does not exist
896 896 --- file2 ---
897 897 2
898 898 changed
899 899 --- file3 ---
900 900 3
901 901 changed1
902 902
903 903 Fail
904 904
905 905 $ hg co -C 0
906 906 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
907 907 $ echo changed >> file1
908 908 $ hg rm file2
909 909 $ hg update 1 --tool :fail
910 910 1 files updated, 0 files merged, 0 files removed, 2 files unresolved
911 911 use 'hg resolve' to retry unresolved file merges
912 912 [1]
913 913 $ status 2>&1 | tee $TESTTMP/fail.status
914 914 --- status ---
915 915 A file1
916 916 C file2
917 917 C file3
918 918 --- resolve --list ---
919 919 U file1
920 920 U file2
921 921 --- debugmergestate ---
922 922 * version 2 records
923 923 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
924 924 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
925 925 labels:
926 926 local: working copy
927 927 other: destination
928 928 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
929 929 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
930 930 local path: file1 (flags "")
931 931 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
932 932 other path: file1 (node null)
933 933 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
934 934 file: file2 (record type "C", state "u", hash null)
935 935 local path: file2 (flags "")
936 936 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
937 937 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
938 938 --- file1 ---
939 939 1
940 940 changed
941 941 --- file2 ---
942 942 2
943 943 changed
944 944 --- file3 ---
945 945 3
946 946 changed1
947 947
948 948 Force prompts with no input
949 949
950 950 $ hg co -C 0
951 951 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
952 952 $ echo changed >> file1
953 953 $ hg rm file2
954 954 $ hg update 1 --config ui.interactive=True --tool :prompt
955 file 'file1' was deleted in local [working copy] but was modified in other [destination].
955 file 'file1' was deleted in other [destination] but was modified in local [working copy].
956 956 What do you want to do?
957 957 use (c)hanged version, (d)elete, or leave (u)nresolved?
958 file 'file2' was deleted in other [destination] but was modified in local [working copy].
958 file 'file2' was deleted in local [working copy] but was modified in other [destination].
959 959 What do you want to do?
960 960 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
961 961 1 files updated, 0 files merged, 0 files removed, 2 files unresolved
962 962 use 'hg resolve' to retry unresolved file merges
963 963 [1]
964 964 $ status 2>&1 | tee $TESTTMP/prompt.status
965 965 --- status ---
966 966 A file1
967 967 C file2
968 968 C file3
969 969 --- resolve --list ---
970 970 U file1
971 971 U file2
972 972 --- debugmergestate ---
973 973 * version 2 records
974 974 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
975 975 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
976 976 labels:
977 977 local: working copy
978 978 other: destination
979 979 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
980 980 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
981 981 local path: file1 (flags "")
982 982 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
983 983 other path: file1 (node null)
984 984 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
985 985 file: file2 (record type "C", state "u", hash null)
986 986 local path: file2 (flags "")
987 987 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
988 988 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
989 989 --- file1 ---
990 990 1
991 991 changed
992 992 --- file2 ---
993 993 2
994 994 changed
995 995 --- file3 ---
996 996 3
997 997 changed1
998 998 $ cmp $TESTTMP/fail.status $TESTTMP/prompt.status || diff -U8 $TESTTMP/fail.status $TESTTMP/prompt.status
999 999
1000 1000 Choose to merge all files
1001 1001
1002 1002 $ hg co -C 0
1003 1003 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1004 1004 $ echo changed >> file1
1005 1005 $ hg rm file2
1006 1006 $ hg update 1 --tool :merge3
1007 file 'file1' was deleted in local [working copy] but was modified in other [destination].
1007 file 'file1' was deleted in other [destination] but was modified in local [working copy].
1008 1008 What do you want to do?
1009 1009 use (c)hanged version, (d)elete, or leave (u)nresolved? u
1010 file 'file2' was deleted in other [destination] but was modified in local [working copy].
1010 file 'file2' was deleted in local [working copy] but was modified in other [destination].
1011 1011 What do you want to do?
1012 1012 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
1013 1013 1 files updated, 0 files merged, 0 files removed, 2 files unresolved
1014 1014 use 'hg resolve' to retry unresolved file merges
1015 1015 [1]
1016 1016 $ status
1017 1017 --- status ---
1018 1018 A file1
1019 1019 C file2
1020 1020 C file3
1021 1021 --- resolve --list ---
1022 1022 U file1
1023 1023 U file2
1024 1024 --- debugmergestate ---
1025 1025 * version 2 records
1026 1026 local: ab57bf49aa276a22d35a473592d4c34b5abc3eff
1027 1027 other: 10f9a0a634e82080907e62f075ab119cbc565ea6
1028 1028 labels:
1029 1029 local: working copy
1030 1030 other: destination
1031 1031 file extras: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
1032 1032 file: file1 (record type "C", state "u", hash 60b27f004e454aca81b0480209cce5081ec52390)
1033 1033 local path: file1 (flags "")
1034 1034 ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
1035 1035 other path: file1 (node null)
1036 1036 file extras: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
1037 1037 file: file2 (record type "C", state "u", hash null)
1038 1038 local path: file2 (flags "")
1039 1039 ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
1040 1040 other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
1041 1041 --- file1 ---
1042 1042 1
1043 1043 changed
1044 1044 --- file2 ---
1045 1045 2
1046 1046 changed
1047 1047 --- file3 ---
1048 1048 3
1049 1049 changed1
1050 1050
1051 1051 Test transitions between different merge tools
1052 1052
1053 1053 $ testtransitions
1054 1054 === :merge3 -> :local ===
1055 1055 (no more unresolved files)
1056 1056 --- diff of status ---
1057 1057 (status identical)
1058 1058
1059 1059 === :local -> :other ===
1060 1060 (no more unresolved files)
1061 1061 --- diff of status ---
1062 1062 (status identical)
1063 1063
1064 1064 === :other -> :prompt ===
1065 file 'file1' was deleted in local [working copy] but was modified in other [destination].
1065 file 'file1' was deleted in other [destination] but was modified in local [working copy].
1066 1066 What do you want to do?
1067 1067 use (c)hanged version, (d)elete, or leave (u)nresolved?
1068 file 'file2' was deleted in other [destination] but was modified in local [working copy].
1068 file 'file2' was deleted in local [working copy] but was modified in other [destination].
1069 1069 What do you want to do?
1070 1070 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
1071 1071 --- diff of status ---
1072 1072 (status identical)
1073 1073
1074 1074 === :prompt -> :local ===
1075 1075 (no more unresolved files)
1076 1076 --- diff of status ---
1077 1077 (status identical)
1078 1078
1079 1079 === :local -> :fail ===
1080 1080 --- diff of status ---
1081 1081 (status identical)
1082 1082
1083 1083 === :fail -> :other ===
1084 1084 (no more unresolved files)
1085 1085 --- diff of status ---
1086 1086 (status identical)
1087 1087
1088 1088 === :other -> :local ===
1089 1089 (no more unresolved files)
1090 1090 --- diff of status ---
1091 1091 (status identical)
1092 1092
1093 1093 === :local -> :prompt ===
1094 file 'file1' was deleted in local [working copy] but was modified in other [destination].
1094 file 'file1' was deleted in other [destination] but was modified in local [working copy].
1095 1095 What do you want to do?
1096 1096 use (c)hanged version, (d)elete, or leave (u)nresolved?
1097 file 'file2' was deleted in other [destination] but was modified in local [working copy].
1097 file 'file2' was deleted in local [working copy] but was modified in other [destination].
1098 1098 What do you want to do?
1099 1099 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
1100 1100 --- diff of status ---
1101 1101 (status identical)
1102 1102
1103 1103 === :prompt -> :other ===
1104 1104 (no more unresolved files)
1105 1105 --- diff of status ---
1106 1106 (status identical)
1107 1107
1108 1108 === :other -> :fail ===
1109 1109 --- diff of status ---
1110 1110 (status identical)
1111 1111
1112 1112 === :fail -> :prompt ===
1113 file 'file1' was deleted in local [working copy] but was modified in other [destination].
1113 file 'file1' was deleted in other [destination] but was modified in local [working copy].
1114 1114 What do you want to do?
1115 1115 use (c)hanged version, (d)elete, or leave (u)nresolved?
1116 file 'file2' was deleted in other [destination] but was modified in local [working copy].
1116 file 'file2' was deleted in local [working copy] but was modified in other [destination].
1117 1117 What do you want to do?
1118 1118 use (c)hanged version, leave (d)eleted, or leave (u)nresolved?
1119 1119 --- diff of status ---
1120 1120 (status identical)
1121 1121
1122 1122 === :prompt -> :fail ===
1123 1123 --- diff of status ---
1124 1124 (status identical)
1125 1125
1126 1126 === :fail -> :local ===
1127 1127 (no more unresolved files)
1128 1128 --- diff of status ---
1129 1129 (status identical)
1130 1130
@@ -1,845 +1,845 b''
1 1 Set up a base, local, and remote changeset, as well as the working copy state.
2 2 Files names are of the form base_remote_local_working-copy. For example,
3 3 content1_content2_content1_content2-untracked represents a
4 4 file that was modified in the remote changeset, left untouched in the
5 5 local changeset, and then modified in the working copy to match the
6 6 remote content, then finally forgotten.
7 7
8 8 $ hg init repo
9 9 $ cd repo
10 10
11 11 Create base changeset
12 12
13 13 $ $PYTHON $TESTDIR/generate-working-copy-states.py state 3 1
14 14 $ hg addremove -q --similarity 0
15 15 $ hg commit -qm 'base'
16 16
17 17 Create remote changeset
18 18
19 19 $ $PYTHON $TESTDIR/generate-working-copy-states.py state 3 2
20 20 $ hg addremove -q --similarity 0
21 21 $ hg commit -qm 'remote'
22 22
23 23 Create local changeset
24 24
25 25 $ hg update -q 0
26 26 $ $PYTHON $TESTDIR/generate-working-copy-states.py state 3 3
27 27 $ hg addremove -q --similarity 0
28 28 $ hg commit -qm 'local'
29 29
30 30 Set up working directory
31 31
32 32 $ $PYTHON $TESTDIR/generate-working-copy-states.py state 3 wc
33 33 $ hg addremove -q --similarity 0
34 34 $ hg forget *_*_*_*-untracked
35 35 $ rm *_*_*_missing-*
36 36
37 37 $ hg status -A
38 38 M content1_content1_content1_content4-tracked
39 39 M content1_content1_content3_content1-tracked
40 40 M content1_content1_content3_content4-tracked
41 41 M content1_content2_content1_content2-tracked
42 42 M content1_content2_content1_content4-tracked
43 43 M content1_content2_content2_content1-tracked
44 44 M content1_content2_content2_content4-tracked
45 45 M content1_content2_content3_content1-tracked
46 46 M content1_content2_content3_content2-tracked
47 47 M content1_content2_content3_content4-tracked
48 48 M content1_missing_content1_content4-tracked
49 49 M content1_missing_content3_content1-tracked
50 50 M content1_missing_content3_content4-tracked
51 51 M missing_content2_content2_content4-tracked
52 52 M missing_content2_content3_content2-tracked
53 53 M missing_content2_content3_content4-tracked
54 54 M missing_missing_content3_content4-tracked
55 55 A content1_content1_missing_content1-tracked
56 56 A content1_content1_missing_content4-tracked
57 57 A content1_content2_missing_content1-tracked
58 58 A content1_content2_missing_content2-tracked
59 59 A content1_content2_missing_content4-tracked
60 60 A content1_missing_missing_content1-tracked
61 61 A content1_missing_missing_content4-tracked
62 62 A missing_content2_missing_content2-tracked
63 63 A missing_content2_missing_content4-tracked
64 64 A missing_missing_missing_content4-tracked
65 65 R content1_content1_content1_content1-untracked
66 66 R content1_content1_content1_content4-untracked
67 67 R content1_content1_content1_missing-untracked
68 68 R content1_content1_content3_content1-untracked
69 69 R content1_content1_content3_content3-untracked
70 70 R content1_content1_content3_content4-untracked
71 71 R content1_content1_content3_missing-untracked
72 72 R content1_content2_content1_content1-untracked
73 73 R content1_content2_content1_content2-untracked
74 74 R content1_content2_content1_content4-untracked
75 75 R content1_content2_content1_missing-untracked
76 76 R content1_content2_content2_content1-untracked
77 77 R content1_content2_content2_content2-untracked
78 78 R content1_content2_content2_content4-untracked
79 79 R content1_content2_content2_missing-untracked
80 80 R content1_content2_content3_content1-untracked
81 81 R content1_content2_content3_content2-untracked
82 82 R content1_content2_content3_content3-untracked
83 83 R content1_content2_content3_content4-untracked
84 84 R content1_content2_content3_missing-untracked
85 85 R content1_missing_content1_content1-untracked
86 86 R content1_missing_content1_content4-untracked
87 87 R content1_missing_content1_missing-untracked
88 88 R content1_missing_content3_content1-untracked
89 89 R content1_missing_content3_content3-untracked
90 90 R content1_missing_content3_content4-untracked
91 91 R content1_missing_content3_missing-untracked
92 92 R missing_content2_content2_content2-untracked
93 93 R missing_content2_content2_content4-untracked
94 94 R missing_content2_content2_missing-untracked
95 95 R missing_content2_content3_content2-untracked
96 96 R missing_content2_content3_content3-untracked
97 97 R missing_content2_content3_content4-untracked
98 98 R missing_content2_content3_missing-untracked
99 99 R missing_missing_content3_content3-untracked
100 100 R missing_missing_content3_content4-untracked
101 101 R missing_missing_content3_missing-untracked
102 102 ! content1_content1_content1_missing-tracked
103 103 ! content1_content1_content3_missing-tracked
104 104 ! content1_content1_missing_missing-tracked
105 105 ! content1_content2_content1_missing-tracked
106 106 ! content1_content2_content2_missing-tracked
107 107 ! content1_content2_content3_missing-tracked
108 108 ! content1_content2_missing_missing-tracked
109 109 ! content1_missing_content1_missing-tracked
110 110 ! content1_missing_content3_missing-tracked
111 111 ! content1_missing_missing_missing-tracked
112 112 ! missing_content2_content2_missing-tracked
113 113 ! missing_content2_content3_missing-tracked
114 114 ! missing_content2_missing_missing-tracked
115 115 ! missing_missing_content3_missing-tracked
116 116 ! missing_missing_missing_missing-tracked
117 117 ? content1_content1_missing_content1-untracked
118 118 ? content1_content1_missing_content4-untracked
119 119 ? content1_content2_missing_content1-untracked
120 120 ? content1_content2_missing_content2-untracked
121 121 ? content1_content2_missing_content4-untracked
122 122 ? content1_missing_missing_content1-untracked
123 123 ? content1_missing_missing_content4-untracked
124 124 ? missing_content2_missing_content2-untracked
125 125 ? missing_content2_missing_content4-untracked
126 126 ? missing_missing_missing_content4-untracked
127 127 C content1_content1_content1_content1-tracked
128 128 C content1_content1_content3_content3-tracked
129 129 C content1_content2_content1_content1-tracked
130 130 C content1_content2_content2_content2-tracked
131 131 C content1_content2_content3_content3-tracked
132 132 C content1_missing_content1_content1-tracked
133 133 C content1_missing_content3_content3-tracked
134 134 C missing_content2_content2_content2-tracked
135 135 C missing_content2_content3_content3-tracked
136 136 C missing_missing_content3_content3-tracked
137 137
138 138 Merge with remote
139 139
140 140 # Notes:
141 141 # - local and remote changed content1_content2_*_content2-untracked
142 142 # in the same way, so it could potentially be left alone
143 143
144 144 $ hg merge -f --tool internal:merge3 'desc("remote")' 2>&1 | tee $TESTTMP/merge-output-1
145 file 'content1_missing_content1_content4-tracked' was deleted in local [working copy] but was modified in other [merge rev].
145 file 'content1_missing_content1_content4-tracked' was deleted in other [merge rev] but was modified in local [working copy].
146 146 What do you want to do?
147 147 use (c)hanged version, (d)elete, or leave (u)nresolved? u
148 file 'content1_missing_content3_content3-tracked' was deleted in local [working copy] but was modified in other [merge rev].
148 file 'content1_missing_content3_content3-tracked' was deleted in other [merge rev] but was modified in local [working copy].
149 149 What do you want to do?
150 150 use (c)hanged version, (d)elete, or leave (u)nresolved? u
151 file 'content1_missing_content3_content4-tracked' was deleted in local [working copy] but was modified in other [merge rev].
151 file 'content1_missing_content3_content4-tracked' was deleted in other [merge rev] but was modified in local [working copy].
152 152 What do you want to do?
153 153 use (c)hanged version, (d)elete, or leave (u)nresolved? u
154 file 'content1_missing_missing_content4-tracked' was deleted in local [working copy] but was modified in other [merge rev].
154 file 'content1_missing_missing_content4-tracked' was deleted in other [merge rev] but was modified in local [working copy].
155 155 What do you want to do?
156 156 use (c)hanged version, (d)elete, or leave (u)nresolved? u
157 file 'content1_content2_content1_content1-untracked' was deleted in other [merge rev] but was modified in local [working copy].
157 file 'content1_content2_content1_content1-untracked' was deleted in local [working copy] but was modified in other [merge rev].
158 158 What do you want to do?
159 159 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
160 file 'content1_content2_content1_content2-untracked' was deleted in other [merge rev] but was modified in local [working copy].
160 file 'content1_content2_content1_content2-untracked' was deleted in local [working copy] but was modified in other [merge rev].
161 161 What do you want to do?
162 162 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
163 file 'content1_content2_content1_content4-untracked' was deleted in other [merge rev] but was modified in local [working copy].
163 file 'content1_content2_content1_content4-untracked' was deleted in local [working copy] but was modified in other [merge rev].
164 164 What do you want to do?
165 165 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
166 file 'content1_content2_content1_missing-tracked' was deleted in other [merge rev] but was modified in local [working copy].
166 file 'content1_content2_content1_missing-tracked' was deleted in local [working copy] but was modified in other [merge rev].
167 167 What do you want to do?
168 168 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
169 file 'content1_content2_content1_missing-untracked' was deleted in other [merge rev] but was modified in local [working copy].
169 file 'content1_content2_content1_missing-untracked' was deleted in local [working copy] but was modified in other [merge rev].
170 170 What do you want to do?
171 171 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
172 file 'content1_content2_content2_content1-untracked' was deleted in other [merge rev] but was modified in local [working copy].
172 file 'content1_content2_content2_content1-untracked' was deleted in local [working copy] but was modified in other [merge rev].
173 173 What do you want to do?
174 174 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
175 file 'content1_content2_content2_content2-untracked' was deleted in other [merge rev] but was modified in local [working copy].
175 file 'content1_content2_content2_content2-untracked' was deleted in local [working copy] but was modified in other [merge rev].
176 176 What do you want to do?
177 177 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
178 file 'content1_content2_content2_content4-untracked' was deleted in other [merge rev] but was modified in local [working copy].
178 file 'content1_content2_content2_content4-untracked' was deleted in local [working copy] but was modified in other [merge rev].
179 179 What do you want to do?
180 180 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
181 file 'content1_content2_content2_missing-tracked' was deleted in other [merge rev] but was modified in local [working copy].
181 file 'content1_content2_content2_missing-tracked' was deleted in local [working copy] but was modified in other [merge rev].
182 182 What do you want to do?
183 183 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
184 file 'content1_content2_content2_missing-untracked' was deleted in other [merge rev] but was modified in local [working copy].
184 file 'content1_content2_content2_missing-untracked' was deleted in local [working copy] but was modified in other [merge rev].
185 185 What do you want to do?
186 186 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
187 file 'content1_content2_content3_content1-untracked' was deleted in other [merge rev] but was modified in local [working copy].
187 file 'content1_content2_content3_content1-untracked' was deleted in local [working copy] but was modified in other [merge rev].
188 188 What do you want to do?
189 189 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
190 file 'content1_content2_content3_content2-untracked' was deleted in other [merge rev] but was modified in local [working copy].
190 file 'content1_content2_content3_content2-untracked' was deleted in local [working copy] but was modified in other [merge rev].
191 191 What do you want to do?
192 192 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
193 file 'content1_content2_content3_content3-untracked' was deleted in other [merge rev] but was modified in local [working copy].
193 file 'content1_content2_content3_content3-untracked' was deleted in local [working copy] but was modified in other [merge rev].
194 194 What do you want to do?
195 195 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
196 file 'content1_content2_content3_content4-untracked' was deleted in other [merge rev] but was modified in local [working copy].
196 file 'content1_content2_content3_content4-untracked' was deleted in local [working copy] but was modified in other [merge rev].
197 197 What do you want to do?
198 198 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
199 file 'content1_content2_content3_missing-tracked' was deleted in other [merge rev] but was modified in local [working copy].
199 file 'content1_content2_content3_missing-tracked' was deleted in local [working copy] but was modified in other [merge rev].
200 200 What do you want to do?
201 201 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
202 file 'content1_content2_content3_missing-untracked' was deleted in other [merge rev] but was modified in local [working copy].
202 file 'content1_content2_content3_missing-untracked' was deleted in local [working copy] but was modified in other [merge rev].
203 203 What do you want to do?
204 204 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
205 file 'content1_content2_missing_content1-untracked' was deleted in other [merge rev] but was modified in local [working copy].
205 file 'content1_content2_missing_content1-untracked' was deleted in local [working copy] but was modified in other [merge rev].
206 206 What do you want to do?
207 207 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
208 file 'content1_content2_missing_content2-untracked' was deleted in other [merge rev] but was modified in local [working copy].
208 file 'content1_content2_missing_content2-untracked' was deleted in local [working copy] but was modified in other [merge rev].
209 209 What do you want to do?
210 210 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
211 file 'content1_content2_missing_content4-untracked' was deleted in other [merge rev] but was modified in local [working copy].
211 file 'content1_content2_missing_content4-untracked' was deleted in local [working copy] but was modified in other [merge rev].
212 212 What do you want to do?
213 213 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
214 file 'content1_content2_missing_missing-tracked' was deleted in other [merge rev] but was modified in local [working copy].
214 file 'content1_content2_missing_missing-tracked' was deleted in local [working copy] but was modified in other [merge rev].
215 215 What do you want to do?
216 216 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
217 file 'content1_content2_missing_missing-untracked' was deleted in other [merge rev] but was modified in local [working copy].
217 file 'content1_content2_missing_missing-untracked' was deleted in local [working copy] but was modified in other [merge rev].
218 218 What do you want to do?
219 219 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
220 220 merging content1_content2_content1_content4-tracked
221 221 merging content1_content2_content2_content1-tracked
222 222 merging content1_content2_content2_content4-tracked
223 223 merging content1_content2_content3_content1-tracked
224 224 merging content1_content2_content3_content3-tracked
225 225 merging content1_content2_content3_content4-tracked
226 226 merging content1_content2_missing_content1-tracked
227 227 merging content1_content2_missing_content4-tracked
228 228 merging missing_content2_content2_content4-tracked
229 229 merging missing_content2_content3_content3-tracked
230 230 merging missing_content2_content3_content4-tracked
231 231 merging missing_content2_missing_content4-tracked
232 232 merging missing_content2_missing_content4-untracked
233 233 warning: conflicts while merging content1_content2_content1_content4-tracked! (edit, then use 'hg resolve --mark')
234 234 warning: conflicts while merging content1_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
235 235 warning: conflicts while merging content1_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
236 236 warning: conflicts while merging content1_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
237 237 warning: conflicts while merging content1_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
238 238 warning: conflicts while merging missing_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
239 239 warning: conflicts while merging missing_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
240 240 warning: conflicts while merging missing_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
241 241 warning: conflicts while merging missing_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
242 242 warning: conflicts while merging missing_content2_missing_content4-untracked! (edit, then use 'hg resolve --mark')
243 243 18 files updated, 3 files merged, 8 files removed, 35 files unresolved
244 244 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
245 245
246 246 Check which files need to be resolved (should correspond to the output above).
247 247 This should be the files for which the base (1st filename segment), the remote
248 248 (2nd segment) and the working copy (4th segment) are all different.
249 249
250 250 Interestingly, one untracked file got merged and added, which corresponds to the
251 251 odd 'if force and branchmerge and different' case in manifestmerge().
252 252
253 253 $ hg resolve -l
254 254 U content1_content2_content1_content1-untracked
255 255 U content1_content2_content1_content2-untracked
256 256 U content1_content2_content1_content4-tracked
257 257 U content1_content2_content1_content4-untracked
258 258 U content1_content2_content1_missing-tracked
259 259 U content1_content2_content1_missing-untracked
260 260 R content1_content2_content2_content1-tracked
261 261 U content1_content2_content2_content1-untracked
262 262 U content1_content2_content2_content2-untracked
263 263 U content1_content2_content2_content4-tracked
264 264 U content1_content2_content2_content4-untracked
265 265 U content1_content2_content2_missing-tracked
266 266 U content1_content2_content2_missing-untracked
267 267 R content1_content2_content3_content1-tracked
268 268 U content1_content2_content3_content1-untracked
269 269 U content1_content2_content3_content2-untracked
270 270 U content1_content2_content3_content3-tracked
271 271 U content1_content2_content3_content3-untracked
272 272 U content1_content2_content3_content4-tracked
273 273 U content1_content2_content3_content4-untracked
274 274 U content1_content2_content3_missing-tracked
275 275 U content1_content2_content3_missing-untracked
276 276 R content1_content2_missing_content1-tracked
277 277 U content1_content2_missing_content1-untracked
278 278 U content1_content2_missing_content2-untracked
279 279 U content1_content2_missing_content4-tracked
280 280 U content1_content2_missing_content4-untracked
281 281 U content1_content2_missing_missing-tracked
282 282 U content1_content2_missing_missing-untracked
283 283 U content1_missing_content1_content4-tracked
284 284 U content1_missing_content3_content3-tracked
285 285 U content1_missing_content3_content4-tracked
286 286 U content1_missing_missing_content4-tracked
287 287 U missing_content2_content2_content4-tracked
288 288 U missing_content2_content3_content3-tracked
289 289 U missing_content2_content3_content4-tracked
290 290 U missing_content2_missing_content4-tracked
291 291 U missing_content2_missing_content4-untracked
292 292
293 293 Check status and file content
294 294
295 295 Some files get added (e.g. content1_content2_content1_content1-untracked)
296 296
297 297 It is not intuitive that content1_content2_content1_content4-tracked gets
298 298 merged while content1_content2_content1_content4-untracked gets overwritten.
299 299 Any *_content2_*-untracked triggers the modified/deleted prompt and then gets
300 300 overwritten.
301 301
302 302 A lot of untracked files become tracked, for example
303 303 content1_content2_content2_content2-untracked.
304 304
305 305 *_missing_missing_missing-tracked is reported as removed ('R'), which
306 306 doesn't make sense since the file did not exist in the parent, but on the
307 307 other hand, merged-in additions are reported as modifications, which is
308 308 almost as strange.
309 309
310 310 missing_missing_content3_missing-tracked becomes removed ('R'), even though
311 311 the remote side did not touch the file
312 312
313 313 $ checkstatus() {
314 314 > for f in `$PYTHON $TESTDIR/generate-working-copy-states.py filelist 3`
315 315 > do
316 316 > echo
317 317 > hg status -A $f
318 318 > if test -f $f
319 319 > then
320 320 > cat $f
321 321 > else
322 322 > echo '<missing>'
323 323 > fi
324 324 > done
325 325 > }
326 326 $ checkstatus 2>&1 | tee $TESTTMP/status1
327 327
328 328 C content1_content1_content1_content1-tracked
329 329 content1
330 330
331 331 R content1_content1_content1_content1-untracked
332 332 content1
333 333
334 334 M content1_content1_content1_content4-tracked
335 335 content4
336 336
337 337 R content1_content1_content1_content4-untracked
338 338 content4
339 339
340 340 ! content1_content1_content1_missing-tracked
341 341 <missing>
342 342
343 343 R content1_content1_content1_missing-untracked
344 344 <missing>
345 345
346 346 M content1_content1_content3_content1-tracked
347 347 content1
348 348
349 349 R content1_content1_content3_content1-untracked
350 350 content1
351 351
352 352 C content1_content1_content3_content3-tracked
353 353 content3
354 354
355 355 R content1_content1_content3_content3-untracked
356 356 content3
357 357
358 358 M content1_content1_content3_content4-tracked
359 359 content4
360 360
361 361 R content1_content1_content3_content4-untracked
362 362 content4
363 363
364 364 ! content1_content1_content3_missing-tracked
365 365 <missing>
366 366
367 367 R content1_content1_content3_missing-untracked
368 368 <missing>
369 369
370 370 A content1_content1_missing_content1-tracked
371 371 content1
372 372
373 373 ? content1_content1_missing_content1-untracked
374 374 content1
375 375
376 376 A content1_content1_missing_content4-tracked
377 377 content4
378 378
379 379 ? content1_content1_missing_content4-untracked
380 380 content4
381 381
382 382 ! content1_content1_missing_missing-tracked
383 383 <missing>
384 384
385 385 content1_content1_missing_missing-untracked: * (glob)
386 386 <missing>
387 387
388 388 M content1_content2_content1_content1-tracked
389 389 content2
390 390
391 391 M content1_content2_content1_content1-untracked
392 392 content2
393 393
394 394 M content1_content2_content1_content2-tracked
395 395 content2
396 396
397 397 M content1_content2_content1_content2-untracked
398 398 content2
399 399
400 400 M content1_content2_content1_content4-tracked
401 401 <<<<<<< working copy: 0447570f1af6 - test: local
402 402 content4
403 403 ||||||| base
404 404 content1
405 405 =======
406 406 content2
407 407 >>>>>>> merge rev: 85100b8c675b - test: remote
408 408
409 409 M content1_content2_content1_content4-untracked
410 410 content2
411 411
412 412 M content1_content2_content1_missing-tracked
413 413 content2
414 414
415 415 M content1_content2_content1_missing-untracked
416 416 content2
417 417
418 418 M content1_content2_content2_content1-tracked
419 419 content2
420 420
421 421 M content1_content2_content2_content1-untracked
422 422 content2
423 423
424 424 C content1_content2_content2_content2-tracked
425 425 content2
426 426
427 427 M content1_content2_content2_content2-untracked
428 428 content2
429 429
430 430 M content1_content2_content2_content4-tracked
431 431 <<<<<<< working copy: 0447570f1af6 - test: local
432 432 content4
433 433 ||||||| base
434 434 content1
435 435 =======
436 436 content2
437 437 >>>>>>> merge rev: 85100b8c675b - test: remote
438 438
439 439 M content1_content2_content2_content4-untracked
440 440 content2
441 441
442 442 M content1_content2_content2_missing-tracked
443 443 content2
444 444
445 445 M content1_content2_content2_missing-untracked
446 446 content2
447 447
448 448 M content1_content2_content3_content1-tracked
449 449 content2
450 450
451 451 M content1_content2_content3_content1-untracked
452 452 content2
453 453
454 454 M content1_content2_content3_content2-tracked
455 455 content2
456 456
457 457 M content1_content2_content3_content2-untracked
458 458 content2
459 459
460 460 M content1_content2_content3_content3-tracked
461 461 <<<<<<< working copy: 0447570f1af6 - test: local
462 462 content3
463 463 ||||||| base
464 464 content1
465 465 =======
466 466 content2
467 467 >>>>>>> merge rev: 85100b8c675b - test: remote
468 468
469 469 M content1_content2_content3_content3-untracked
470 470 content2
471 471
472 472 M content1_content2_content3_content4-tracked
473 473 <<<<<<< working copy: 0447570f1af6 - test: local
474 474 content4
475 475 ||||||| base
476 476 content1
477 477 =======
478 478 content2
479 479 >>>>>>> merge rev: 85100b8c675b - test: remote
480 480
481 481 M content1_content2_content3_content4-untracked
482 482 content2
483 483
484 484 M content1_content2_content3_missing-tracked
485 485 content2
486 486
487 487 M content1_content2_content3_missing-untracked
488 488 content2
489 489
490 490 M content1_content2_missing_content1-tracked
491 491 content2
492 492
493 493 M content1_content2_missing_content1-untracked
494 494 content2
495 495
496 496 M content1_content2_missing_content2-tracked
497 497 content2
498 498
499 499 M content1_content2_missing_content2-untracked
500 500 content2
501 501
502 502 M content1_content2_missing_content4-tracked
503 503 <<<<<<< working copy: 0447570f1af6 - test: local
504 504 content4
505 505 ||||||| base
506 506 content1
507 507 =======
508 508 content2
509 509 >>>>>>> merge rev: 85100b8c675b - test: remote
510 510
511 511 M content1_content2_missing_content4-untracked
512 512 content2
513 513
514 514 M content1_content2_missing_missing-tracked
515 515 content2
516 516
517 517 M content1_content2_missing_missing-untracked
518 518 content2
519 519
520 520 R content1_missing_content1_content1-tracked
521 521 <missing>
522 522
523 523 R content1_missing_content1_content1-untracked
524 524 content1
525 525
526 526 M content1_missing_content1_content4-tracked
527 527 content4
528 528
529 529 R content1_missing_content1_content4-untracked
530 530 content4
531 531
532 532 R content1_missing_content1_missing-tracked
533 533 <missing>
534 534
535 535 R content1_missing_content1_missing-untracked
536 536 <missing>
537 537
538 538 R content1_missing_content3_content1-tracked
539 539 <missing>
540 540
541 541 R content1_missing_content3_content1-untracked
542 542 content1
543 543
544 544 C content1_missing_content3_content3-tracked
545 545 content3
546 546
547 547 R content1_missing_content3_content3-untracked
548 548 content3
549 549
550 550 M content1_missing_content3_content4-tracked
551 551 content4
552 552
553 553 R content1_missing_content3_content4-untracked
554 554 content4
555 555
556 556 R content1_missing_content3_missing-tracked
557 557 <missing>
558 558
559 559 R content1_missing_content3_missing-untracked
560 560 <missing>
561 561
562 562 R content1_missing_missing_content1-tracked
563 563 <missing>
564 564
565 565 ? content1_missing_missing_content1-untracked
566 566 content1
567 567
568 568 A content1_missing_missing_content4-tracked
569 569 content4
570 570
571 571 ? content1_missing_missing_content4-untracked
572 572 content4
573 573
574 574 R content1_missing_missing_missing-tracked
575 575 <missing>
576 576
577 577 content1_missing_missing_missing-untracked: * (glob)
578 578 <missing>
579 579
580 580 C missing_content2_content2_content2-tracked
581 581 content2
582 582
583 583 M missing_content2_content2_content2-untracked
584 584 content2
585 585
586 586 M missing_content2_content2_content4-tracked
587 587 <<<<<<< working copy: 0447570f1af6 - test: local
588 588 content4
589 589 ||||||| base
590 590 =======
591 591 content2
592 592 >>>>>>> merge rev: 85100b8c675b - test: remote
593 593
594 594 M missing_content2_content2_content4-untracked
595 595 content2
596 596
597 597 M missing_content2_content2_missing-tracked
598 598 content2
599 599
600 600 M missing_content2_content2_missing-untracked
601 601 content2
602 602
603 603 M missing_content2_content3_content2-tracked
604 604 content2
605 605
606 606 M missing_content2_content3_content2-untracked
607 607 content2
608 608
609 609 M missing_content2_content3_content3-tracked
610 610 <<<<<<< working copy: 0447570f1af6 - test: local
611 611 content3
612 612 ||||||| base
613 613 =======
614 614 content2
615 615 >>>>>>> merge rev: 85100b8c675b - test: remote
616 616
617 617 M missing_content2_content3_content3-untracked
618 618 content2
619 619
620 620 M missing_content2_content3_content4-tracked
621 621 <<<<<<< working copy: 0447570f1af6 - test: local
622 622 content4
623 623 ||||||| base
624 624 =======
625 625 content2
626 626 >>>>>>> merge rev: 85100b8c675b - test: remote
627 627
628 628 M missing_content2_content3_content4-untracked
629 629 content2
630 630
631 631 M missing_content2_content3_missing-tracked
632 632 content2
633 633
634 634 M missing_content2_content3_missing-untracked
635 635 content2
636 636
637 637 M missing_content2_missing_content2-tracked
638 638 content2
639 639
640 640 M missing_content2_missing_content2-untracked
641 641 content2
642 642
643 643 M missing_content2_missing_content4-tracked
644 644 <<<<<<< working copy: 0447570f1af6 - test: local
645 645 content4
646 646 ||||||| base
647 647 =======
648 648 content2
649 649 >>>>>>> merge rev: 85100b8c675b - test: remote
650 650
651 651 M missing_content2_missing_content4-untracked
652 652 <<<<<<< working copy: 0447570f1af6 - test: local
653 653 content4
654 654 ||||||| base
655 655 =======
656 656 content2
657 657 >>>>>>> merge rev: 85100b8c675b - test: remote
658 658
659 659 M missing_content2_missing_missing-tracked
660 660 content2
661 661
662 662 M missing_content2_missing_missing-untracked
663 663 content2
664 664
665 665 C missing_missing_content3_content3-tracked
666 666 content3
667 667
668 668 R missing_missing_content3_content3-untracked
669 669 content3
670 670
671 671 M missing_missing_content3_content4-tracked
672 672 content4
673 673
674 674 R missing_missing_content3_content4-untracked
675 675 content4
676 676
677 677 R missing_missing_content3_missing-tracked
678 678 <missing>
679 679
680 680 R missing_missing_content3_missing-untracked
681 681 <missing>
682 682
683 683 A missing_missing_missing_content4-tracked
684 684 content4
685 685
686 686 ? missing_missing_missing_content4-untracked
687 687 content4
688 688
689 689 R missing_missing_missing_missing-tracked
690 690 <missing>
691 691
692 692 missing_missing_missing_missing-untracked: * (glob)
693 693 <missing>
694 694
695 695 $ for f in `$PYTHON $TESTDIR/generate-working-copy-states.py filelist 3`
696 696 > do
697 697 > if test -f ${f}.orig
698 698 > then
699 699 > echo ${f}.orig:
700 700 > cat ${f}.orig
701 701 > fi
702 702 > done
703 703 content1_content2_content1_content4-tracked.orig:
704 704 content4
705 705 content1_content2_content2_content4-tracked.orig:
706 706 content4
707 707 content1_content2_content3_content3-tracked.orig:
708 708 content3
709 709 content1_content2_content3_content4-tracked.orig:
710 710 content4
711 711 content1_content2_missing_content4-tracked.orig:
712 712 content4
713 713 missing_content2_content2_content4-tracked.orig:
714 714 content4
715 715 missing_content2_content3_content3-tracked.orig:
716 716 content3
717 717 missing_content2_content3_content4-tracked.orig:
718 718 content4
719 719 missing_content2_missing_content4-tracked.orig:
720 720 content4
721 721 missing_content2_missing_content4-untracked.orig:
722 722 content4
723 723
724 724 Re-resolve and check status
725 725
726 726 $ hg resolve --unmark --all
727 727 $ hg resolve --all --tool :local
728 728 (no more unresolved files)
729 729 $ hg resolve --unmark --all
730 730 $ hg resolve --all --tool internal:merge3
731 file 'content1_content2_content1_content1-untracked' was deleted in other [merge rev] but was modified in local [working copy].
731 file 'content1_content2_content1_content1-untracked' was deleted in local [working copy] but was modified in other [merge rev].
732 732 What do you want to do?
733 733 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
734 file 'content1_content2_content1_content2-untracked' was deleted in other [merge rev] but was modified in local [working copy].
734 file 'content1_content2_content1_content2-untracked' was deleted in local [working copy] but was modified in other [merge rev].
735 735 What do you want to do?
736 736 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
737 737 merging content1_content2_content1_content4-tracked
738 file 'content1_content2_content1_content4-untracked' was deleted in other [merge rev] but was modified in local [working copy].
738 file 'content1_content2_content1_content4-untracked' was deleted in local [working copy] but was modified in other [merge rev].
739 739 What do you want to do?
740 740 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
741 file 'content1_content2_content1_missing-tracked' was deleted in other [merge rev] but was modified in local [working copy].
741 file 'content1_content2_content1_missing-tracked' was deleted in local [working copy] but was modified in other [merge rev].
742 742 What do you want to do?
743 743 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
744 file 'content1_content2_content1_missing-untracked' was deleted in other [merge rev] but was modified in local [working copy].
744 file 'content1_content2_content1_missing-untracked' was deleted in local [working copy] but was modified in other [merge rev].
745 745 What do you want to do?
746 746 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
747 747 merging content1_content2_content2_content1-tracked
748 file 'content1_content2_content2_content1-untracked' was deleted in other [merge rev] but was modified in local [working copy].
748 file 'content1_content2_content2_content1-untracked' was deleted in local [working copy] but was modified in other [merge rev].
749 749 What do you want to do?
750 750 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
751 file 'content1_content2_content2_content2-untracked' was deleted in other [merge rev] but was modified in local [working copy].
751 file 'content1_content2_content2_content2-untracked' was deleted in local [working copy] but was modified in other [merge rev].
752 752 What do you want to do?
753 753 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
754 754 merging content1_content2_content2_content4-tracked
755 file 'content1_content2_content2_content4-untracked' was deleted in other [merge rev] but was modified in local [working copy].
755 file 'content1_content2_content2_content4-untracked' was deleted in local [working copy] but was modified in other [merge rev].
756 756 What do you want to do?
757 757 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
758 file 'content1_content2_content2_missing-tracked' was deleted in other [merge rev] but was modified in local [working copy].
758 file 'content1_content2_content2_missing-tracked' was deleted in local [working copy] but was modified in other [merge rev].
759 759 What do you want to do?
760 760 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
761 file 'content1_content2_content2_missing-untracked' was deleted in other [merge rev] but was modified in local [working copy].
761 file 'content1_content2_content2_missing-untracked' was deleted in local [working copy] but was modified in other [merge rev].
762 762 What do you want to do?
763 763 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
764 764 merging content1_content2_content3_content1-tracked
765 file 'content1_content2_content3_content1-untracked' was deleted in other [merge rev] but was modified in local [working copy].
765 file 'content1_content2_content3_content1-untracked' was deleted in local [working copy] but was modified in other [merge rev].
766 766 What do you want to do?
767 767 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
768 file 'content1_content2_content3_content2-untracked' was deleted in other [merge rev] but was modified in local [working copy].
768 file 'content1_content2_content3_content2-untracked' was deleted in local [working copy] but was modified in other [merge rev].
769 769 What do you want to do?
770 770 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
771 771 merging content1_content2_content3_content3-tracked
772 file 'content1_content2_content3_content3-untracked' was deleted in other [merge rev] but was modified in local [working copy].
772 file 'content1_content2_content3_content3-untracked' was deleted in local [working copy] but was modified in other [merge rev].
773 773 What do you want to do?
774 774 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
775 775 merging content1_content2_content3_content4-tracked
776 file 'content1_content2_content3_content4-untracked' was deleted in other [merge rev] but was modified in local [working copy].
776 file 'content1_content2_content3_content4-untracked' was deleted in local [working copy] but was modified in other [merge rev].
777 777 What do you want to do?
778 778 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
779 file 'content1_content2_content3_missing-tracked' was deleted in other [merge rev] but was modified in local [working copy].
779 file 'content1_content2_content3_missing-tracked' was deleted in local [working copy] but was modified in other [merge rev].
780 780 What do you want to do?
781 781 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
782 file 'content1_content2_content3_missing-untracked' was deleted in other [merge rev] but was modified in local [working copy].
782 file 'content1_content2_content3_missing-untracked' was deleted in local [working copy] but was modified in other [merge rev].
783 783 What do you want to do?
784 784 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
785 785 merging content1_content2_missing_content1-tracked
786 file 'content1_content2_missing_content1-untracked' was deleted in other [merge rev] but was modified in local [working copy].
786 file 'content1_content2_missing_content1-untracked' was deleted in local [working copy] but was modified in other [merge rev].
787 787 What do you want to do?
788 788 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
789 file 'content1_content2_missing_content2-untracked' was deleted in other [merge rev] but was modified in local [working copy].
789 file 'content1_content2_missing_content2-untracked' was deleted in local [working copy] but was modified in other [merge rev].
790 790 What do you want to do?
791 791 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
792 792 merging content1_content2_missing_content4-tracked
793 file 'content1_content2_missing_content4-untracked' was deleted in other [merge rev] but was modified in local [working copy].
793 file 'content1_content2_missing_content4-untracked' was deleted in local [working copy] but was modified in other [merge rev].
794 794 What do you want to do?
795 795 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
796 file 'content1_content2_missing_missing-tracked' was deleted in other [merge rev] but was modified in local [working copy].
796 file 'content1_content2_missing_missing-tracked' was deleted in local [working copy] but was modified in other [merge rev].
797 797 What do you want to do?
798 798 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
799 file 'content1_content2_missing_missing-untracked' was deleted in other [merge rev] but was modified in local [working copy].
799 file 'content1_content2_missing_missing-untracked' was deleted in local [working copy] but was modified in other [merge rev].
800 800 What do you want to do?
801 801 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
802 file 'content1_missing_content1_content4-tracked' was deleted in local [working copy] but was modified in other [merge rev].
802 file 'content1_missing_content1_content4-tracked' was deleted in other [merge rev] but was modified in local [working copy].
803 803 What do you want to do?
804 804 use (c)hanged version, (d)elete, or leave (u)nresolved? u
805 file 'content1_missing_content3_content3-tracked' was deleted in local [working copy] but was modified in other [merge rev].
805 file 'content1_missing_content3_content3-tracked' was deleted in other [merge rev] but was modified in local [working copy].
806 806 What do you want to do?
807 807 use (c)hanged version, (d)elete, or leave (u)nresolved? u
808 file 'content1_missing_content3_content4-tracked' was deleted in local [working copy] but was modified in other [merge rev].
808 file 'content1_missing_content3_content4-tracked' was deleted in other [merge rev] but was modified in local [working copy].
809 809 What do you want to do?
810 810 use (c)hanged version, (d)elete, or leave (u)nresolved? u
811 file 'content1_missing_missing_content4-tracked' was deleted in local [working copy] but was modified in other [merge rev].
811 file 'content1_missing_missing_content4-tracked' was deleted in other [merge rev] but was modified in local [working copy].
812 812 What do you want to do?
813 813 use (c)hanged version, (d)elete, or leave (u)nresolved? u
814 814 merging missing_content2_content2_content4-tracked
815 815 merging missing_content2_content3_content3-tracked
816 816 merging missing_content2_content3_content4-tracked
817 817 merging missing_content2_missing_content4-tracked
818 818 merging missing_content2_missing_content4-untracked
819 819 warning: conflicts while merging content1_content2_content1_content4-tracked! (edit, then use 'hg resolve --mark')
820 820 warning: conflicts while merging content1_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
821 821 warning: conflicts while merging content1_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
822 822 warning: conflicts while merging content1_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
823 823 warning: conflicts while merging content1_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
824 824 warning: conflicts while merging missing_content2_content2_content4-tracked! (edit, then use 'hg resolve --mark')
825 825 warning: conflicts while merging missing_content2_content3_content3-tracked! (edit, then use 'hg resolve --mark')
826 826 warning: conflicts while merging missing_content2_content3_content4-tracked! (edit, then use 'hg resolve --mark')
827 827 warning: conflicts while merging missing_content2_missing_content4-tracked! (edit, then use 'hg resolve --mark')
828 828 warning: conflicts while merging missing_content2_missing_content4-untracked! (edit, then use 'hg resolve --mark')
829 829 [1]
830 830 $ checkstatus > $TESTTMP/status2 2>&1
831 831 $ cmp $TESTTMP/status1 $TESTTMP/status2 || diff -U8 $TESTTMP/status1 $TESTTMP/status2
832 832
833 833 Set up working directory again
834 834
835 835 $ hg -q update --clean 2
836 836 $ hg --config extensions.purge= purge
837 837 $ $PYTHON $TESTDIR/generate-working-copy-states.py state 3 wc
838 838 $ hg addremove -q --similarity 0
839 839 $ hg forget *_*_*_*-untracked
840 840 $ rm *_*_*_missing-*
841 841
842 842 Merge with checkunknown = warn, see that behavior is the same as before
843 843 $ hg merge -f --tool internal:merge3 'desc("remote")' --config merge.checkunknown=warn > $TESTTMP/merge-output-2 2>&1
844 844 [1]
845 845 $ cmp $TESTTMP/merge-output-1 $TESTTMP/merge-output-2 || diff -U8 $TESTTMP/merge-output-1 $TESTTMP/merge-output-2
@@ -1,116 +1,116 b''
1 1 $ hg init
2 2
3 3 $ echo foo > foo
4 4 $ echo bar > bar
5 5 $ hg ci -qAm 'add foo bar'
6 6
7 7 $ echo foo2 >> foo
8 8 $ echo bleh > bar
9 9 $ hg ci -m 'change foo bar'
10 10
11 11 $ hg up -qC 0
12 12 $ hg mv foo foo1
13 13 $ echo foo1 > foo1
14 14 $ hg cat foo >> foo1
15 15 $ hg ci -m 'mv foo foo1'
16 16 created new head
17 17
18 18 $ hg merge
19 19 merging foo1 and foo to foo1
20 20 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
21 21 (branch merge, don't forget to commit)
22 22
23 23 $ hg debugstate --nodates
24 24 m 0 -2 unset bar
25 25 m 0 -2 unset foo1
26 26 copy: foo -> foo1
27 27
28 28 $ hg st -q
29 29 M bar
30 30 M foo1
31 31
32 32
33 33 Removing foo1 and bar:
34 34
35 35 $ cp foo1 F
36 36 $ cp bar B
37 37 $ hg rm -f foo1 bar
38 38
39 39 $ hg debugstate --nodates
40 40 r 0 -1 set bar
41 41 r 0 -1 set foo1
42 42 copy: foo -> foo1
43 43
44 44 $ hg st -qC
45 45 R bar
46 46 R foo1
47 47
48 48
49 49 Re-adding foo1 and bar:
50 50
51 51 $ cp F foo1
52 52 $ cp B bar
53 53 $ hg add -v foo1 bar
54 54 adding bar
55 55 adding foo1
56 56
57 57 $ hg debugstate --nodates
58 58 n 0 -2 unset bar
59 59 n 0 -2 unset foo1
60 60 copy: foo -> foo1
61 61
62 62 $ hg st -qC
63 63 M bar
64 64 M foo1
65 65 foo
66 66
67 67
68 68 Reverting foo1 and bar:
69 69
70 70 $ hg revert -vr . foo1 bar
71 71 saving current version of bar as bar.orig
72 72 reverting bar
73 73 saving current version of foo1 as foo1.orig
74 74 reverting foo1
75 75
76 76 $ hg debugstate --nodates
77 77 n 0 -2 unset bar
78 78 n 0 -2 unset foo1
79 79 copy: foo -> foo1
80 80
81 81 $ hg st -qC
82 82 M bar
83 83 M foo1
84 84 foo
85 85
86 86 $ hg diff
87 87
88 88 Merge should not overwrite local file that is untracked after remove
89 89
90 90 $ rm *
91 91 $ hg up -qC
92 92 $ hg rm bar
93 93 $ hg ci -m 'remove bar'
94 94 $ echo 'memories of buried pirate treasure' > bar
95 95 $ hg merge
96 96 bar: untracked file differs
97 97 abort: untracked files in working directory differ from files in requested revision
98 98 [255]
99 99 $ cat bar
100 100 memories of buried pirate treasure
101 101
102 102 Those who use force will lose
103 103
104 104 $ hg merge -f
105 file 'bar' was deleted in other [merge rev] but was modified in local [working copy].
105 file 'bar' was deleted in local [working copy] but was modified in other [merge rev].
106 106 What do you want to do?
107 107 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
108 108 merging foo1 and foo to foo1
109 109 0 files updated, 1 files merged, 0 files removed, 1 files unresolved
110 110 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
111 111 [1]
112 112 $ cat bar
113 113 bleh
114 114 $ hg st
115 115 M bar
116 116 M foo1
@@ -1,140 +1,140 b''
1 1 $ hg init
2 2
3 3 $ echo a > a
4 4 $ hg ci -qAm 'add a'
5 5
6 6 $ hg init subrepo
7 7 $ echo 'subrepo = http://example.net/libfoo' > .hgsub
8 8 $ hg ci -qAm 'added subrepo'
9 9
10 10 $ hg up -qC 0
11 11 $ echo ax > a
12 12 $ hg ci -m 'changed a'
13 13 created new head
14 14
15 15 $ hg up -qC 1
16 16 $ cd subrepo
17 17 $ echo b > b
18 18 $ hg add b
19 19 $ cd ..
20 20
21 21 Should fail, since there are added files to subrepo:
22 22
23 23 $ hg merge
24 24 abort: uncommitted changes in subrepository "subrepo"
25 25 [255]
26 26
27 27 Deleted files trigger a '+' marker in top level repos. Deleted files are also
28 28 noticed by `update --check` in the top level repo.
29 29
30 30 $ hg ci -Sqm 'add b'
31 31 $ echo change > subrepo/b
32 32
33 33 $ hg ci -Sm 'change b'
34 34 committing subrepository subrepo
35 35
36 36 $ rm a
37 37 $ hg id
38 38 9bfe45a197d7+ tip
39 39 $ hg sum
40 40 parent: 4:9bfe45a197d7 tip
41 41 change b
42 42 branch: default
43 43 commit: 1 deleted (clean)
44 44 update: 1 new changesets, 2 branch heads (merge)
45 45 phases: 5 draft
46 46
47 47 $ hg up --check -r '.^'
48 48 abort: uncommitted changes
49 49 [255]
50 50 $ hg st -S
51 51 ! a
52 52 $ hg up -Cq .
53 53
54 54 Test that dirty is consistent through subrepos
55 55
56 56 $ rm subrepo/b
57 57
58 58 A deleted subrepo file is flagged as dirty, like the top level repo
59 59
60 60 $ hg id --config extensions.blackbox= --config blackbox.dirty=True
61 61 9bfe45a197d7+ tip
62 62 $ cat .hg/blackbox.log
63 63 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> serve --cmdserver chgunix * (glob) (chg !)
64 64 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* (glob)
65 65 * @9bfe45a197d7b0ab09bf287729dd57e9619c9da5+ (*)> id --config *extensions.blackbox=* --config *blackbox.dirty=True* exited 0 * (glob)
66 66
67 67 TODO: a deleted file should be listed as such, like the top level repo
68 68
69 69 $ hg sum
70 70 parent: 4:9bfe45a197d7 tip
71 71 change b
72 72 branch: default
73 73 commit: (clean)
74 74 update: 1 new changesets, 2 branch heads (merge)
75 75 phases: 5 draft
76 76
77 77 Modified subrepo files are noticed by `update --check` and `summary`
78 78
79 79 $ echo mod > subrepo/b
80 80 $ hg st -S
81 81 M subrepo/b
82 82
83 83 $ hg up -r '.^' --check
84 84 abort: uncommitted changes in subrepository "subrepo"
85 85 [255]
86 86
87 87 $ hg sum
88 88 parent: 4:9bfe45a197d7 tip
89 89 change b
90 90 branch: default
91 91 commit: 1 subrepos
92 92 update: 1 new changesets, 2 branch heads (merge)
93 93 phases: 5 draft
94 94
95 95 TODO: why is -R needed here? If it's because the subrepo is treated as a
96 96 discrete unit, then this should probably warn or something.
97 97 $ hg revert -R subrepo --no-backup subrepo/b -r .
98 98
99 99 $ rm subrepo/b
100 100 $ hg st -S
101 101 ! subrepo/b
102 102
103 103 `hg update --check` notices a subrepo with a missing file, like it notices a
104 104 missing file in the top level repo.
105 105
106 106 $ hg up -r '.^' --check
107 107 abort: uncommitted changes in subrepository "subrepo"
108 108 [255]
109 109
110 110 $ hg up -r '.^' --config ui.interactive=True << EOF
111 111 > d
112 112 > EOF
113 file 'b' was deleted in other [destination] but was modified in local [working copy].
113 file 'b' was deleted in local [working copy] but was modified in other [destination].
114 114 What do you want to do?
115 115 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? d
116 116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 117
118 118 XXX: There's a difference between wdir() and '.', so there should be a status.
119 119 `hg files -S` from the top is also missing 'subrepo/b'.
120 120
121 121 $ hg st -S
122 122 $ hg st -R subrepo
123 123 $ hg files -R subrepo
124 124 [1]
125 125 $ hg files -R subrepo -r '.'
126 126 subrepo/b
127 127
128 128 $ hg bookmark -r tip @other
129 129 $ echo xyz > subrepo/c
130 130 $ hg ci -SAm 'add c'
131 131 adding subrepo/c
132 132 committing subrepository subrepo
133 133 created new head
134 134 $ rm subrepo/c
135 135
136 136 Merge sees deleted subrepo files as an uncommitted change
137 137
138 138 $ hg merge @other
139 139 abort: uncommitted changes in subrepository "subrepo"
140 140 [255]
@@ -1,426 +1,426 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > rebase=
4 4 > drawdag=$TESTDIR/drawdag.py
5 5 > [alias]
6 6 > tglog = log -G --template "{rev}: {node|short} '{desc}' {branches}\n"
7 7 > EOF
8 8
9 9 $ hg init repo
10 10 $ cd repo
11 11
12 12 $ echo A > a
13 13 $ echo >> a
14 14 $ hg ci -Am A
15 15 adding a
16 16
17 17 $ echo B > a
18 18 $ echo >> a
19 19 $ hg ci -m B
20 20
21 21 $ echo C > a
22 22 $ echo >> a
23 23 $ hg ci -m C
24 24
25 25 $ hg up -q -C 0
26 26
27 27 $ echo D >> a
28 28 $ hg ci -Am AD
29 29 created new head
30 30
31 31 $ hg tglog
32 32 @ 3: 3878212183bd 'AD'
33 33 |
34 34 | o 2: 30ae917c0e4f 'C'
35 35 | |
36 36 | o 1: 0f4f7cb4f549 'B'
37 37 |/
38 38 o 0: 1e635d440a73 'A'
39 39
40 40 $ hg rebase -s 1 -d 3
41 41 rebasing 1:0f4f7cb4f549 "B"
42 42 merging a
43 43 rebasing 2:30ae917c0e4f "C"
44 44 merging a
45 45 saved backup bundle to $TESTTMP/repo/.hg/strip-backup/0f4f7cb4f549-82b3b163-rebase.hg
46 46
47 47 $ hg tglog
48 48 o 3: 25773bc4b4b0 'C'
49 49 |
50 50 o 2: c09015405f75 'B'
51 51 |
52 52 @ 1: 3878212183bd 'AD'
53 53 |
54 54 o 0: 1e635d440a73 'A'
55 55
56 56
57 57 $ cd ..
58 58
59 59
60 60 Test rebasing of merges with ancestors of the rebase destination - a situation
61 61 that often happens when trying to recover from repeated merging with a mainline
62 62 branch.
63 63
64 64 The test case creates a dev branch that contains a couple of merges from the
65 65 default branch. When rebasing to the default branch, these merges would be
66 66 merges with ancestors on the same branch. The merges _could_ contain some
67 67 interesting conflict resolutions or additional changes in the merge commit, but
68 68 that is mixed up with the actual merge stuff and there is in general no way to
69 69 separate them.
70 70
71 71 Note: The dev branch contains _no_ changes to f-default. It might be unclear
72 72 how rebasing of ancestor merges should be handled, but the current behavior
73 73 with spurious prompts for conflicts in files that didn't change seems very
74 74 wrong.
75 75
76 76 $ hg init ancestor-merge
77 77 $ cd ancestor-merge
78 78
79 79 $ touch f-default
80 80 $ hg ci -Aqm 'default: create f-default'
81 81
82 82 $ hg branch -q dev
83 83 $ hg ci -qm 'dev: create branch'
84 84
85 85 $ echo stuff > f-dev
86 86 $ hg ci -Aqm 'dev: f-dev stuff'
87 87
88 88 $ hg up -q default
89 89 $ echo stuff > f-default
90 90 $ hg ci -m 'default: f-default stuff'
91 91
92 92 $ hg up -q dev
93 93 $ hg merge -q default
94 94 $ hg ci -m 'dev: merge default'
95 95
96 96 $ hg up -q default
97 97 $ hg rm f-default
98 98 $ hg ci -m 'default: remove f-default'
99 99
100 100 $ hg up -q dev
101 101 $ hg merge -q default
102 102 $ hg ci -m 'dev: merge default'
103 103
104 104 $ hg up -q default
105 105 $ echo stuff > f-other
106 106 $ hg ci -Aqm 'default: f-other stuff'
107 107
108 108 $ hg tglog
109 109 @ 7: e08089805d82 'default: f-other stuff'
110 110 |
111 111 | o 6: 9455ee510502 'dev: merge default' dev
112 112 |/|
113 113 o | 5: 462860db70a1 'default: remove f-default'
114 114 | |
115 115 | o 4: 4b019212aaf6 'dev: merge default' dev
116 116 |/|
117 117 o | 3: f157ecfd2b6b 'default: f-default stuff'
118 118 | |
119 119 | o 2: ec2c14fb2984 'dev: f-dev stuff' dev
120 120 | |
121 121 | o 1: 1d1a643d390e 'dev: create branch' dev
122 122 |/
123 123 o 0: e90e8eb90b6f 'default: create f-default'
124 124
125 125 $ hg clone -qU . ../ancestor-merge-2
126 126
127 127 Full rebase all the way back from branching point:
128 128
129 129 $ hg rebase -r 'only(dev,default)' -d default --config ui.interactive=True << EOF
130 130 > c
131 131 > EOF
132 132 rebasing 1:1d1a643d390e "dev: create branch"
133 133 note: rebase of 1:1d1a643d390e created no changes to commit
134 134 rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
135 135 rebasing 4:4b019212aaf6 "dev: merge default"
136 file 'f-default' was deleted in other [source] but was modified in local [dest].
136 file 'f-default' was deleted in local [dest] but was modified in other [source].
137 137 What do you want to do?
138 138 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
139 139 rebasing 6:9455ee510502 "dev: merge default"
140 140 saved backup bundle to $TESTTMP/ancestor-merge/.hg/strip-backup/1d1a643d390e-43e9e04b-rebase.hg
141 141 $ hg tglog
142 142 o 6: fbc098e72227 'dev: merge default'
143 143 |
144 144 o 5: eda7b7f46f5d 'dev: merge default'
145 145 |
146 146 o 4: 3e075b1c0a40 'dev: f-dev stuff'
147 147 |
148 148 @ 3: e08089805d82 'default: f-other stuff'
149 149 |
150 150 o 2: 462860db70a1 'default: remove f-default'
151 151 |
152 152 o 1: f157ecfd2b6b 'default: f-default stuff'
153 153 |
154 154 o 0: e90e8eb90b6f 'default: create f-default'
155 155
156 156 Grafty cherry picking rebasing:
157 157
158 158 $ cd ../ancestor-merge-2
159 159
160 160 $ hg phase -fdr0:
161 161 $ hg rebase -r 'children(only(dev,default))' -d default --config ui.interactive=True << EOF
162 162 > c
163 163 > EOF
164 164 rebasing 2:ec2c14fb2984 "dev: f-dev stuff"
165 165 rebasing 4:4b019212aaf6 "dev: merge default"
166 file 'f-default' was deleted in other [source] but was modified in local [dest].
166 file 'f-default' was deleted in local [dest] but was modified in other [source].
167 167 What do you want to do?
168 168 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? c
169 169 rebasing 6:9455ee510502 "dev: merge default"
170 170 saved backup bundle to $TESTTMP/ancestor-merge-2/.hg/strip-backup/ec2c14fb2984-62d0b222-rebase.hg
171 171 $ hg tglog
172 172 o 7: fbc098e72227 'dev: merge default'
173 173 |
174 174 o 6: eda7b7f46f5d 'dev: merge default'
175 175 |
176 176 o 5: 3e075b1c0a40 'dev: f-dev stuff'
177 177 |
178 178 o 4: e08089805d82 'default: f-other stuff'
179 179 |
180 180 o 3: 462860db70a1 'default: remove f-default'
181 181 |
182 182 o 2: f157ecfd2b6b 'default: f-default stuff'
183 183 |
184 184 | o 1: 1d1a643d390e 'dev: create branch' dev
185 185 |/
186 186 o 0: e90e8eb90b6f 'default: create f-default'
187 187
188 188 $ cd ..
189 189
190 190
191 191 Test order of parents of rebased merged with un-rebased changes as p1.
192 192
193 193 $ hg init parentorder
194 194 $ cd parentorder
195 195 $ touch f
196 196 $ hg ci -Aqm common
197 197 $ touch change
198 198 $ hg ci -Aqm change
199 199 $ touch target
200 200 $ hg ci -Aqm target
201 201 $ hg up -qr 0
202 202 $ touch outside
203 203 $ hg ci -Aqm outside
204 204 $ hg merge -qr 1
205 205 $ hg ci -m 'merge p1 3=outside p2 1=ancestor'
206 206 $ hg par
207 207 changeset: 4:6990226659be
208 208 tag: tip
209 209 parent: 3:f59da8fc0fcf
210 210 parent: 1:dd40c13f7a6f
211 211 user: test
212 212 date: Thu Jan 01 00:00:00 1970 +0000
213 213 summary: merge p1 3=outside p2 1=ancestor
214 214
215 215 $ hg up -qr 1
216 216 $ hg merge -qr 3
217 217 $ hg ci -qm 'merge p1 1=ancestor p2 3=outside'
218 218 $ hg par
219 219 changeset: 5:a57575f79074
220 220 tag: tip
221 221 parent: 1:dd40c13f7a6f
222 222 parent: 3:f59da8fc0fcf
223 223 user: test
224 224 date: Thu Jan 01 00:00:00 1970 +0000
225 225 summary: merge p1 1=ancestor p2 3=outside
226 226
227 227 $ hg tglog
228 228 @ 5: a57575f79074 'merge p1 1=ancestor p2 3=outside'
229 229 |\
230 230 +---o 4: 6990226659be 'merge p1 3=outside p2 1=ancestor'
231 231 | |/
232 232 | o 3: f59da8fc0fcf 'outside'
233 233 | |
234 234 +---o 2: a60552eb93fb 'target'
235 235 | |
236 236 o | 1: dd40c13f7a6f 'change'
237 237 |/
238 238 o 0: 02f0f58d5300 'common'
239 239
240 240 $ hg rebase -r 4 -d 2
241 241 rebasing 4:6990226659be "merge p1 3=outside p2 1=ancestor"
242 242 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/6990226659be-4d67a0d3-rebase.hg
243 243 $ hg tip
244 244 changeset: 5:cca50676b1c5
245 245 tag: tip
246 246 parent: 2:a60552eb93fb
247 247 parent: 3:f59da8fc0fcf
248 248 user: test
249 249 date: Thu Jan 01 00:00:00 1970 +0000
250 250 summary: merge p1 3=outside p2 1=ancestor
251 251
252 252 $ hg rebase -r 4 -d 2
253 253 rebasing 4:a57575f79074 "merge p1 1=ancestor p2 3=outside"
254 254 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/a57575f79074-385426e5-rebase.hg
255 255 $ hg tip
256 256 changeset: 5:f9daf77ffe76
257 257 tag: tip
258 258 parent: 2:a60552eb93fb
259 259 parent: 3:f59da8fc0fcf
260 260 user: test
261 261 date: Thu Jan 01 00:00:00 1970 +0000
262 262 summary: merge p1 1=ancestor p2 3=outside
263 263
264 264 $ hg tglog
265 265 @ 5: f9daf77ffe76 'merge p1 1=ancestor p2 3=outside'
266 266 |\
267 267 +---o 4: cca50676b1c5 'merge p1 3=outside p2 1=ancestor'
268 268 | |/
269 269 | o 3: f59da8fc0fcf 'outside'
270 270 | |
271 271 o | 2: a60552eb93fb 'target'
272 272 | |
273 273 o | 1: dd40c13f7a6f 'change'
274 274 |/
275 275 o 0: 02f0f58d5300 'common'
276 276
277 277 rebase of merge of ancestors
278 278
279 279 $ hg up -qr 2
280 280 $ hg merge -qr 3
281 281 $ echo 'other change while merging future "rebase ancestors"' > other
282 282 $ hg ci -Aqm 'merge rebase ancestors'
283 283 $ hg rebase -d 5 -v
284 284 rebasing 6:4c5f12f25ebe "merge rebase ancestors" (tip)
285 285 resolving manifests
286 286 removing other
287 287 note: merging f9daf77ffe76+ and 4c5f12f25ebe using bids from ancestors a60552eb93fb and f59da8fc0fcf
288 288
289 289 calculating bids for ancestor a60552eb93fb
290 290 resolving manifests
291 291
292 292 calculating bids for ancestor f59da8fc0fcf
293 293 resolving manifests
294 294
295 295 auction for merging merge bids
296 296 other: consensus for g
297 297 end of auction
298 298
299 299 getting other
300 300 committing files:
301 301 other
302 302 committing manifest
303 303 committing changelog
304 304 rebase merging completed
305 305 1 changesets found
306 306 uncompressed size of bundle content:
307 307 199 (changelog)
308 308 216 (manifests)
309 309 182 other
310 310 saved backup bundle to $TESTTMP/parentorder/.hg/strip-backup/4c5f12f25ebe-f46990e5-rebase.hg
311 311 1 changesets found
312 312 uncompressed size of bundle content:
313 313 254 (changelog)
314 314 167 (manifests)
315 315 182 other
316 316 adding branch
317 317 adding changesets
318 318 adding manifests
319 319 adding file changes
320 320 added 1 changesets with 1 changes to 1 files
321 321 rebase completed
322 322 $ hg tglog
323 323 @ 6: 113755df812b 'merge rebase ancestors'
324 324 |
325 325 o 5: f9daf77ffe76 'merge p1 1=ancestor p2 3=outside'
326 326 |\
327 327 +---o 4: cca50676b1c5 'merge p1 3=outside p2 1=ancestor'
328 328 | |/
329 329 | o 3: f59da8fc0fcf 'outside'
330 330 | |
331 331 o | 2: a60552eb93fb 'target'
332 332 | |
333 333 o | 1: dd40c13f7a6f 'change'
334 334 |/
335 335 o 0: 02f0f58d5300 'common'
336 336
337 337 Due to the limitation of 3-way merge algorithm (1 merge base), rebasing a merge
338 338 may include unwanted content:
339 339
340 340 $ hg init $TESTTMP/dual-merge-base1
341 341 $ cd $TESTTMP/dual-merge-base1
342 342 $ hg debugdrawdag <<'EOS'
343 343 > F
344 344 > /|
345 345 > D E
346 346 > | |
347 347 > B C
348 348 > |/
349 349 > A Z
350 350 > |/
351 351 > R
352 352 > EOS
353 353 $ hg rebase -r D+E+F -d Z
354 354 rebasing 5:5f2c926dfecf "D" (D)
355 355 rebasing 6:b296604d9846 "E" (E)
356 356 rebasing 7:caa9781e507d "F" (F tip)
357 357 abort: rebasing 7:caa9781e507d will include unwanted changes from 4:d6003a550c2c or 3:c1e6b162678d
358 358 [255]
359 359
360 360 The warning does not get printed if there is no unwanted change detected:
361 361
362 362 $ hg init $TESTTMP/dual-merge-base2
363 363 $ cd $TESTTMP/dual-merge-base2
364 364 $ hg debugdrawdag <<'EOS'
365 365 > D
366 366 > /|
367 367 > B C
368 368 > |/
369 369 > A Z
370 370 > |/
371 371 > R
372 372 > EOS
373 373 $ hg rebase -r B+C+D -d Z
374 374 rebasing 3:c1e6b162678d "B" (B)
375 375 rebasing 4:d6003a550c2c "C" (C)
376 376 rebasing 5:c8f78076273e "D" (D tip)
377 377 saved backup bundle to $TESTTMP/dual-merge-base2/.hg/strip-backup/d6003a550c2c-6f1424b6-rebase.hg
378 378 $ hg manifest -r 'desc(D)'
379 379 B
380 380 C
381 381 R
382 382 Z
383 383
384 384 The merge base could be different from old p1 (changed parent becomes new p1):
385 385
386 386 $ hg init $TESTTMP/chosen-merge-base1
387 387 $ cd $TESTTMP/chosen-merge-base1
388 388 $ hg debugdrawdag <<'EOS'
389 389 > F
390 390 > /|
391 391 > D E
392 392 > | |
393 393 > B C Z
394 394 > EOS
395 395 $ hg rebase -r D+F -d Z
396 396 rebasing 3:004dc1679908 "D" (D)
397 397 rebasing 5:4be4cbf6f206 "F" (F tip)
398 398 saved backup bundle to $TESTTMP/chosen-merge-base1/.hg/strip-backup/004dc1679908-06a66a3c-rebase.hg
399 399 $ hg manifest -r 'desc(F)'
400 400 C
401 401 D
402 402 E
403 403 Z
404 404 $ hg log -r `hg log -r 'desc(F)' -T '{p1node}'` -T '{desc}\n'
405 405 D
406 406
407 407 $ hg init $TESTTMP/chosen-merge-base2
408 408 $ cd $TESTTMP/chosen-merge-base2
409 409 $ hg debugdrawdag <<'EOS'
410 410 > F
411 411 > /|
412 412 > D E
413 413 > | |
414 414 > B C Z
415 415 > EOS
416 416 $ hg rebase -r E+F -d Z
417 417 rebasing 4:974e4943c210 "E" (E)
418 418 rebasing 5:4be4cbf6f206 "F" (F tip)
419 419 saved backup bundle to $TESTTMP/chosen-merge-base2/.hg/strip-backup/974e4943c210-b2874da5-rebase.hg
420 420 $ hg manifest -r 'desc(F)'
421 421 B
422 422 D
423 423 E
424 424 Z
425 425 $ hg log -r `hg log -r 'desc(F)' -T '{p1node}'` -T '{desc}\n'
426 426 E
@@ -1,1071 +1,1071 b''
1 1
2 2 $ mkdir -p t
3 3 $ cd t
4 4 $ cat <<EOF > merge
5 5 > import sys, os
6 6 > f = open(sys.argv[1], "wb")
7 7 > f.write("merge %s %s %s" % (sys.argv[1], sys.argv[2], sys.argv[3]))
8 8 > f.close()
9 9 > EOF
10 10
11 11 perform a test merge with possible renaming
12 12 args:
13 13 $1 = action in local branch
14 14 $2 = action in remote branch
15 15 $3 = action in working dir
16 16 $4 = expected result
17 17
18 18 $ tm()
19 19 > {
20 20 > hg init t
21 21 > cd t
22 22 > echo "[merge]" >> .hg/hgrc
23 23 > echo "followcopies = 1" >> .hg/hgrc
24 24 >
25 25 > # base
26 26 > echo base > a
27 27 > echo base > rev # used to force commits
28 28 > hg add a rev
29 29 > hg ci -m "base"
30 30 >
31 31 > # remote
32 32 > echo remote > rev
33 33 > if [ "$2" != "" ] ; then $2 ; fi
34 34 > hg ci -m "remote"
35 35 >
36 36 > # local
37 37 > hg co -q 0
38 38 > echo local > rev
39 39 > if [ "$1" != "" ] ; then $1 ; fi
40 40 > hg ci -m "local"
41 41 >
42 42 > # working dir
43 43 > echo local > rev
44 44 > if [ "$3" != "" ] ; then $3 ; fi
45 45 >
46 46 > # merge
47 47 > echo "--------------"
48 48 > echo "test L:$1 R:$2 W:$3 - $4"
49 49 > echo "--------------"
50 50 > hg merge -y --debug --traceback --tool="$PYTHON ../merge"
51 51 >
52 52 > echo "--------------"
53 53 > hg status -camC -X rev
54 54 >
55 55 > hg ci -m "merge"
56 56 >
57 57 > echo "--------------"
58 58 > echo
59 59 >
60 60 > cd ..
61 61 > rm -r t
62 62 > }
63 63 $ up() {
64 64 > cp rev $1
65 65 > hg add $1 2> /dev/null
66 66 > if [ "$2" != "" ] ; then
67 67 > cp rev $2
68 68 > hg add $2 2> /dev/null
69 69 > fi
70 70 > }
71 71 $ uc() { up $1; hg cp $1 $2; } # update + copy
72 72 $ um() { up $1; hg mv $1 $2; }
73 73 $ nc() { hg cp $1 $2; } # just copy
74 74 $ nm() { hg mv $1 $2; } # just move
75 75 $ tm "up a " "nc a b" " " "1 get local a to b"
76 76 created new head
77 77 --------------
78 78 test L:up a R:nc a b W: - 1 get local a to b
79 79 --------------
80 80 searching for copies back to rev 1
81 81 unmatched files in other:
82 82 b
83 83 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
84 84 src: 'a' -> dst: 'b' *
85 85 checking for directory renames
86 86 resolving manifests
87 87 branchmerge: True, force: False, partial: False
88 88 ancestor: 924404dff337, local: e300d1c794ec+, remote: 4ce40f5aca24
89 89 preserving a for resolve of b
90 90 preserving rev for resolve of rev
91 91 starting 4 threads for background file closing (?)
92 92 b: remote copied from a -> m (premerge)
93 93 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
94 94 merging a and b to b
95 95 my b@e300d1c794ec+ other b@4ce40f5aca24 ancestor a@924404dff337
96 96 premerge successful
97 97 rev: versions differ -> m (premerge)
98 98 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
99 99 merging rev
100 100 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
101 101 rev: versions differ -> m (merge)
102 102 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
103 103 my rev@e300d1c794ec+ other rev@4ce40f5aca24 ancestor rev@924404dff337
104 104 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
105 105 merge tool returned: 0
106 106 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
107 107 (branch merge, don't forget to commit)
108 108 --------------
109 109 M b
110 110 a
111 111 C a
112 112 --------------
113 113
114 114 $ tm "nc a b" "up a " " " "2 get rem change to a and b"
115 115 created new head
116 116 --------------
117 117 test L:nc a b R:up a W: - 2 get rem change to a and b
118 118 --------------
119 119 searching for copies back to rev 1
120 120 unmatched files in local:
121 121 b
122 122 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
123 123 src: 'a' -> dst: 'b' *
124 124 checking for directory renames
125 125 resolving manifests
126 126 branchmerge: True, force: False, partial: False
127 127 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: f4db7e329e71
128 128 preserving b for resolve of b
129 129 preserving rev for resolve of rev
130 130 a: remote is newer -> g
131 131 getting a
132 132 b: local copied/moved from a -> m (premerge)
133 133 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
134 134 merging b and a to b
135 135 my b@86a2aa42fc76+ other a@f4db7e329e71 ancestor a@924404dff337
136 136 premerge successful
137 137 rev: versions differ -> m (premerge)
138 138 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
139 139 merging rev
140 140 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
141 141 rev: versions differ -> m (merge)
142 142 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
143 143 my rev@86a2aa42fc76+ other rev@f4db7e329e71 ancestor rev@924404dff337
144 144 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
145 145 merge tool returned: 0
146 146 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
147 147 (branch merge, don't forget to commit)
148 148 --------------
149 149 M a
150 150 M b
151 151 a
152 152 --------------
153 153
154 154 $ tm "up a " "nm a b" " " "3 get local a change to b, remove a"
155 155 created new head
156 156 --------------
157 157 test L:up a R:nm a b W: - 3 get local a change to b, remove a
158 158 --------------
159 159 searching for copies back to rev 1
160 160 unmatched files in other:
161 161 b
162 162 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
163 163 src: 'a' -> dst: 'b' *
164 164 checking for directory renames
165 165 resolving manifests
166 166 branchmerge: True, force: False, partial: False
167 167 ancestor: 924404dff337, local: e300d1c794ec+, remote: bdb19105162a
168 168 preserving a for resolve of b
169 169 preserving rev for resolve of rev
170 170 removing a
171 171 starting 4 threads for background file closing (?)
172 172 b: remote moved from a -> m (premerge)
173 173 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
174 174 merging a and b to b
175 175 my b@e300d1c794ec+ other b@bdb19105162a ancestor a@924404dff337
176 176 premerge successful
177 177 rev: versions differ -> m (premerge)
178 178 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
179 179 merging rev
180 180 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
181 181 rev: versions differ -> m (merge)
182 182 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
183 183 my rev@e300d1c794ec+ other rev@bdb19105162a ancestor rev@924404dff337
184 184 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
185 185 merge tool returned: 0
186 186 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
187 187 (branch merge, don't forget to commit)
188 188 --------------
189 189 M b
190 190 a
191 191 --------------
192 192
193 193 $ tm "nm a b" "up a " " " "4 get remote change to b"
194 194 created new head
195 195 --------------
196 196 test L:nm a b R:up a W: - 4 get remote change to b
197 197 --------------
198 198 searching for copies back to rev 1
199 199 unmatched files in local:
200 200 b
201 201 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
202 202 src: 'a' -> dst: 'b' *
203 203 checking for directory renames
204 204 resolving manifests
205 205 branchmerge: True, force: False, partial: False
206 206 ancestor: 924404dff337, local: 02963e448370+, remote: f4db7e329e71
207 207 preserving b for resolve of b
208 208 preserving rev for resolve of rev
209 209 starting 4 threads for background file closing (?)
210 210 b: local copied/moved from a -> m (premerge)
211 211 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
212 212 merging b and a to b
213 213 my b@02963e448370+ other a@f4db7e329e71 ancestor a@924404dff337
214 214 premerge successful
215 215 rev: versions differ -> m (premerge)
216 216 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
217 217 merging rev
218 218 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
219 219 rev: versions differ -> m (merge)
220 220 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
221 221 my rev@02963e448370+ other rev@f4db7e329e71 ancestor rev@924404dff337
222 222 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
223 223 merge tool returned: 0
224 224 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
225 225 (branch merge, don't forget to commit)
226 226 --------------
227 227 M b
228 228 a
229 229 --------------
230 230
231 231 $ tm " " "nc a b" " " "5 get b"
232 232 created new head
233 233 --------------
234 234 test L: R:nc a b W: - 5 get b
235 235 --------------
236 236 searching for copies back to rev 1
237 237 unmatched files in other:
238 238 b
239 239 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
240 240 src: 'a' -> dst: 'b'
241 241 checking for directory renames
242 242 resolving manifests
243 243 branchmerge: True, force: False, partial: False
244 244 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: 4ce40f5aca24
245 245 preserving rev for resolve of rev
246 246 b: remote created -> g
247 247 getting b
248 248 rev: versions differ -> m (premerge)
249 249 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
250 250 merging rev
251 251 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
252 252 rev: versions differ -> m (merge)
253 253 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
254 254 my rev@94b33a1b7f2d+ other rev@4ce40f5aca24 ancestor rev@924404dff337
255 255 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
256 256 merge tool returned: 0
257 257 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
258 258 (branch merge, don't forget to commit)
259 259 --------------
260 260 M b
261 261 C a
262 262 --------------
263 263
264 264 $ tm "nc a b" " " " " "6 nothing"
265 265 created new head
266 266 --------------
267 267 test L:nc a b R: W: - 6 nothing
268 268 --------------
269 269 searching for copies back to rev 1
270 270 unmatched files in local:
271 271 b
272 272 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
273 273 src: 'a' -> dst: 'b'
274 274 checking for directory renames
275 275 resolving manifests
276 276 branchmerge: True, force: False, partial: False
277 277 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 97c705ade336
278 278 preserving rev for resolve of rev
279 279 starting 4 threads for background file closing (?)
280 280 rev: versions differ -> m (premerge)
281 281 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
282 282 merging rev
283 283 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
284 284 rev: versions differ -> m (merge)
285 285 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
286 286 my rev@86a2aa42fc76+ other rev@97c705ade336 ancestor rev@924404dff337
287 287 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
288 288 merge tool returned: 0
289 289 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
290 290 (branch merge, don't forget to commit)
291 291 --------------
292 292 C a
293 293 C b
294 294 --------------
295 295
296 296 $ tm " " "nm a b" " " "7 get b"
297 297 created new head
298 298 --------------
299 299 test L: R:nm a b W: - 7 get b
300 300 --------------
301 301 searching for copies back to rev 1
302 302 unmatched files in other:
303 303 b
304 304 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
305 305 src: 'a' -> dst: 'b'
306 306 checking for directory renames
307 307 resolving manifests
308 308 branchmerge: True, force: False, partial: False
309 309 ancestor: 924404dff337, local: 94b33a1b7f2d+, remote: bdb19105162a
310 310 preserving rev for resolve of rev
311 311 a: other deleted -> r
312 312 removing a
313 313 b: remote created -> g
314 314 getting b
315 315 rev: versions differ -> m (premerge)
316 316 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
317 317 merging rev
318 318 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
319 319 rev: versions differ -> m (merge)
320 320 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
321 321 my rev@94b33a1b7f2d+ other rev@bdb19105162a ancestor rev@924404dff337
322 322 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
323 323 merge tool returned: 0
324 324 1 files updated, 1 files merged, 1 files removed, 0 files unresolved
325 325 (branch merge, don't forget to commit)
326 326 --------------
327 327 M b
328 328 --------------
329 329
330 330 $ tm "nm a b" " " " " "8 nothing"
331 331 created new head
332 332 --------------
333 333 test L:nm a b R: W: - 8 nothing
334 334 --------------
335 335 searching for copies back to rev 1
336 336 unmatched files in local:
337 337 b
338 338 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
339 339 src: 'a' -> dst: 'b'
340 340 checking for directory renames
341 341 resolving manifests
342 342 branchmerge: True, force: False, partial: False
343 343 ancestor: 924404dff337, local: 02963e448370+, remote: 97c705ade336
344 344 preserving rev for resolve of rev
345 345 starting 4 threads for background file closing (?)
346 346 rev: versions differ -> m (premerge)
347 347 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
348 348 merging rev
349 349 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
350 350 rev: versions differ -> m (merge)
351 351 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
352 352 my rev@02963e448370+ other rev@97c705ade336 ancestor rev@924404dff337
353 353 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
354 354 merge tool returned: 0
355 355 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
356 356 (branch merge, don't forget to commit)
357 357 --------------
358 358 C b
359 359 --------------
360 360
361 361 $ tm "um a b" "um a b" " " "9 do merge with ancestor in a"
362 362 created new head
363 363 --------------
364 364 test L:um a b R:um a b W: - 9 do merge with ancestor in a
365 365 --------------
366 366 searching for copies back to rev 1
367 367 unmatched files new in both:
368 368 b
369 369 resolving manifests
370 370 branchmerge: True, force: False, partial: False
371 371 ancestor: 924404dff337, local: 62e7bf090eba+, remote: 49b6d8032493
372 372 preserving b for resolve of b
373 373 preserving rev for resolve of rev
374 374 starting 4 threads for background file closing (?)
375 375 b: both renamed from a -> m (premerge)
376 376 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
377 377 merging b
378 378 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
379 379 rev: versions differ -> m (premerge)
380 380 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
381 381 merging rev
382 382 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
383 383 b: both renamed from a -> m (merge)
384 384 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
385 385 my b@62e7bf090eba+ other b@49b6d8032493 ancestor a@924404dff337
386 386 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
387 387 merge tool returned: 0
388 388 rev: versions differ -> m (merge)
389 389 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
390 390 my rev@62e7bf090eba+ other rev@49b6d8032493 ancestor rev@924404dff337
391 391 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
392 392 merge tool returned: 0
393 393 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
394 394 (branch merge, don't forget to commit)
395 395 --------------
396 396 M b
397 397 --------------
398 398
399 399
400 400 m "um a c" "um x c" " " "10 do merge with no ancestor"
401 401
402 402 $ tm "nm a b" "nm a c" " " "11 get c, keep b"
403 403 created new head
404 404 --------------
405 405 test L:nm a b R:nm a c W: - 11 get c, keep b
406 406 --------------
407 407 searching for copies back to rev 1
408 408 unmatched files in local:
409 409 b
410 410 unmatched files in other:
411 411 c
412 412 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
413 413 src: 'a' -> dst: 'b' !
414 414 src: 'a' -> dst: 'c' !
415 415 checking for directory renames
416 416 resolving manifests
417 417 branchmerge: True, force: False, partial: False
418 418 ancestor: 924404dff337, local: 02963e448370+, remote: fe905ef2c33e
419 419 note: possible conflict - a was renamed multiple times to:
420 420 b
421 421 c
422 422 preserving rev for resolve of rev
423 423 c: remote created -> g
424 424 getting c
425 425 rev: versions differ -> m (premerge)
426 426 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
427 427 merging rev
428 428 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
429 429 rev: versions differ -> m (merge)
430 430 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
431 431 my rev@02963e448370+ other rev@fe905ef2c33e ancestor rev@924404dff337
432 432 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
433 433 merge tool returned: 0
434 434 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
435 435 (branch merge, don't forget to commit)
436 436 --------------
437 437 M c
438 438 C b
439 439 --------------
440 440
441 441 $ tm "nc a b" "up b " " " "12 merge b no ancestor"
442 442 created new head
443 443 --------------
444 444 test L:nc a b R:up b W: - 12 merge b no ancestor
445 445 --------------
446 446 searching for copies back to rev 1
447 447 unmatched files new in both:
448 448 b
449 449 resolving manifests
450 450 branchmerge: True, force: False, partial: False
451 451 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: af30c7647fc7
452 452 preserving b for resolve of b
453 453 preserving rev for resolve of rev
454 454 starting 4 threads for background file closing (?)
455 455 b: both created -> m (premerge)
456 456 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
457 457 merging b
458 458 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
459 459 rev: versions differ -> m (premerge)
460 460 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
461 461 merging rev
462 462 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
463 463 b: both created -> m (merge)
464 464 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
465 465 my b@86a2aa42fc76+ other b@af30c7647fc7 ancestor b@000000000000
466 466 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
467 467 merge tool returned: 0
468 468 rev: versions differ -> m (merge)
469 469 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
470 470 my rev@86a2aa42fc76+ other rev@af30c7647fc7 ancestor rev@924404dff337
471 471 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
472 472 merge tool returned: 0
473 473 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
474 474 (branch merge, don't forget to commit)
475 475 --------------
476 476 M b
477 477 C a
478 478 --------------
479 479
480 480 $ tm "up b " "nm a b" " " "13 merge b no ancestor"
481 481 created new head
482 482 --------------
483 483 test L:up b R:nm a b W: - 13 merge b no ancestor
484 484 --------------
485 485 searching for copies back to rev 1
486 486 unmatched files new in both:
487 487 b
488 488 resolving manifests
489 489 branchmerge: True, force: False, partial: False
490 490 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
491 491 preserving b for resolve of b
492 492 preserving rev for resolve of rev
493 493 a: other deleted -> r
494 494 removing a
495 495 starting 4 threads for background file closing (?)
496 496 b: both created -> m (premerge)
497 497 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
498 498 merging b
499 499 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
500 500 rev: versions differ -> m (premerge)
501 501 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
502 502 merging rev
503 503 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
504 504 b: both created -> m (merge)
505 505 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
506 506 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
507 507 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
508 508 merge tool returned: 0
509 509 rev: versions differ -> m (merge)
510 510 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
511 511 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
512 512 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
513 513 merge tool returned: 0
514 514 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
515 515 (branch merge, don't forget to commit)
516 516 --------------
517 517 M b
518 518 --------------
519 519
520 520 $ tm "nc a b" "up a b" " " "14 merge b no ancestor"
521 521 created new head
522 522 --------------
523 523 test L:nc a b R:up a b W: - 14 merge b no ancestor
524 524 --------------
525 525 searching for copies back to rev 1
526 526 unmatched files new in both:
527 527 b
528 528 resolving manifests
529 529 branchmerge: True, force: False, partial: False
530 530 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
531 531 preserving b for resolve of b
532 532 preserving rev for resolve of rev
533 533 a: remote is newer -> g
534 534 getting a
535 535 b: both created -> m (premerge)
536 536 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
537 537 merging b
538 538 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
539 539 rev: versions differ -> m (premerge)
540 540 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
541 541 merging rev
542 542 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
543 543 b: both created -> m (merge)
544 544 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
545 545 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
546 546 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
547 547 merge tool returned: 0
548 548 rev: versions differ -> m (merge)
549 549 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
550 550 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
551 551 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
552 552 merge tool returned: 0
553 553 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
554 554 (branch merge, don't forget to commit)
555 555 --------------
556 556 M a
557 557 M b
558 558 --------------
559 559
560 560 $ tm "up b " "nm a b" " " "15 merge b no ancestor, remove a"
561 561 created new head
562 562 --------------
563 563 test L:up b R:nm a b W: - 15 merge b no ancestor, remove a
564 564 --------------
565 565 searching for copies back to rev 1
566 566 unmatched files new in both:
567 567 b
568 568 resolving manifests
569 569 branchmerge: True, force: False, partial: False
570 570 ancestor: 924404dff337, local: 59318016310c+, remote: bdb19105162a
571 571 preserving b for resolve of b
572 572 preserving rev for resolve of rev
573 573 a: other deleted -> r
574 574 removing a
575 575 starting 4 threads for background file closing (?)
576 576 b: both created -> m (premerge)
577 577 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
578 578 merging b
579 579 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
580 580 rev: versions differ -> m (premerge)
581 581 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
582 582 merging rev
583 583 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
584 584 b: both created -> m (merge)
585 585 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
586 586 my b@59318016310c+ other b@bdb19105162a ancestor b@000000000000
587 587 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
588 588 merge tool returned: 0
589 589 rev: versions differ -> m (merge)
590 590 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
591 591 my rev@59318016310c+ other rev@bdb19105162a ancestor rev@924404dff337
592 592 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
593 593 merge tool returned: 0
594 594 0 files updated, 2 files merged, 1 files removed, 0 files unresolved
595 595 (branch merge, don't forget to commit)
596 596 --------------
597 597 M b
598 598 --------------
599 599
600 600 $ tm "nc a b" "up a b" " " "16 get a, merge b no ancestor"
601 601 created new head
602 602 --------------
603 603 test L:nc a b R:up a b W: - 16 get a, merge b no ancestor
604 604 --------------
605 605 searching for copies back to rev 1
606 606 unmatched files new in both:
607 607 b
608 608 resolving manifests
609 609 branchmerge: True, force: False, partial: False
610 610 ancestor: 924404dff337, local: 86a2aa42fc76+, remote: 8dbce441892a
611 611 preserving b for resolve of b
612 612 preserving rev for resolve of rev
613 613 a: remote is newer -> g
614 614 getting a
615 615 b: both created -> m (premerge)
616 616 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
617 617 merging b
618 618 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
619 619 rev: versions differ -> m (premerge)
620 620 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
621 621 merging rev
622 622 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
623 623 b: both created -> m (merge)
624 624 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
625 625 my b@86a2aa42fc76+ other b@8dbce441892a ancestor b@000000000000
626 626 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
627 627 merge tool returned: 0
628 628 rev: versions differ -> m (merge)
629 629 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
630 630 my rev@86a2aa42fc76+ other rev@8dbce441892a ancestor rev@924404dff337
631 631 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
632 632 merge tool returned: 0
633 633 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
634 634 (branch merge, don't forget to commit)
635 635 --------------
636 636 M a
637 637 M b
638 638 --------------
639 639
640 640 $ tm "up a b" "nc a b" " " "17 keep a, merge b no ancestor"
641 641 created new head
642 642 --------------
643 643 test L:up a b R:nc a b W: - 17 keep a, merge b no ancestor
644 644 --------------
645 645 searching for copies back to rev 1
646 646 unmatched files new in both:
647 647 b
648 648 resolving manifests
649 649 branchmerge: True, force: False, partial: False
650 650 ancestor: 924404dff337, local: 0b76e65c8289+, remote: 4ce40f5aca24
651 651 preserving b for resolve of b
652 652 preserving rev for resolve of rev
653 653 starting 4 threads for background file closing (?)
654 654 b: both created -> m (premerge)
655 655 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
656 656 merging b
657 657 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
658 658 rev: versions differ -> m (premerge)
659 659 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
660 660 merging rev
661 661 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
662 662 b: both created -> m (merge)
663 663 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
664 664 my b@0b76e65c8289+ other b@4ce40f5aca24 ancestor b@000000000000
665 665 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
666 666 merge tool returned: 0
667 667 rev: versions differ -> m (merge)
668 668 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
669 669 my rev@0b76e65c8289+ other rev@4ce40f5aca24 ancestor rev@924404dff337
670 670 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
671 671 merge tool returned: 0
672 672 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
673 673 (branch merge, don't forget to commit)
674 674 --------------
675 675 M b
676 676 C a
677 677 --------------
678 678
679 679 $ tm "nm a b" "up a b" " " "18 merge b no ancestor"
680 680 created new head
681 681 --------------
682 682 test L:nm a b R:up a b W: - 18 merge b no ancestor
683 683 --------------
684 684 searching for copies back to rev 1
685 685 unmatched files new in both:
686 686 b
687 687 resolving manifests
688 688 branchmerge: True, force: False, partial: False
689 689 ancestor: 924404dff337, local: 02963e448370+, remote: 8dbce441892a
690 690 preserving b for resolve of b
691 691 preserving rev for resolve of rev
692 692 starting 4 threads for background file closing (?)
693 693 a: prompt deleted/changed -> m (premerge)
694 694 picked tool ':prompt' for a (binary False symlink False changedelete True)
695 file 'a' was deleted in other [merge rev] but was modified in local [working copy].
695 file 'a' was deleted in local [working copy] but was modified in other [merge rev].
696 696 What do you want to do?
697 697 use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
698 698 b: both created -> m (premerge)
699 699 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
700 700 merging b
701 701 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
702 702 rev: versions differ -> m (premerge)
703 703 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
704 704 merging rev
705 705 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
706 706 b: both created -> m (merge)
707 707 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
708 708 my b@02963e448370+ other b@8dbce441892a ancestor b@000000000000
709 709 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
710 710 merge tool returned: 0
711 711 rev: versions differ -> m (merge)
712 712 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
713 713 my rev@02963e448370+ other rev@8dbce441892a ancestor rev@924404dff337
714 714 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
715 715 merge tool returned: 0
716 716 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
717 717 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
718 718 --------------
719 719 M a
720 720 M b
721 721 abort: unresolved merge conflicts (see 'hg help resolve')
722 722 --------------
723 723
724 724 $ tm "up a b" "nm a b" " " "19 merge b no ancestor, prompt remove a"
725 725 created new head
726 726 --------------
727 727 test L:up a b R:nm a b W: - 19 merge b no ancestor, prompt remove a
728 728 --------------
729 729 searching for copies back to rev 1
730 730 unmatched files new in both:
731 731 b
732 732 resolving manifests
733 733 branchmerge: True, force: False, partial: False
734 734 ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a
735 735 preserving a for resolve of a
736 736 preserving b for resolve of b
737 737 preserving rev for resolve of rev
738 738 starting 4 threads for background file closing (?)
739 739 a: prompt changed/deleted -> m (premerge)
740 740 picked tool ':prompt' for a (binary False symlink False changedelete True)
741 file 'a' was deleted in local [working copy] but was modified in other [merge rev].
741 file 'a' was deleted in other [merge rev] but was modified in local [working copy].
742 742 What do you want to do?
743 743 use (c)hanged version, (d)elete, or leave (u)nresolved? u
744 744 b: both created -> m (premerge)
745 745 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
746 746 merging b
747 747 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
748 748 rev: versions differ -> m (premerge)
749 749 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
750 750 merging rev
751 751 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
752 752 b: both created -> m (merge)
753 753 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
754 754 my b@0b76e65c8289+ other b@bdb19105162a ancestor b@000000000000
755 755 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
756 756 merge tool returned: 0
757 757 rev: versions differ -> m (merge)
758 758 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
759 759 my rev@0b76e65c8289+ other rev@bdb19105162a ancestor rev@924404dff337
760 760 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
761 761 merge tool returned: 0
762 762 0 files updated, 2 files merged, 0 files removed, 1 files unresolved
763 763 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
764 764 --------------
765 765 M b
766 766 C a
767 767 abort: unresolved merge conflicts (see 'hg help resolve')
768 768 --------------
769 769
770 770 $ tm "up a " "um a b" " " "20 merge a and b to b, remove a"
771 771 created new head
772 772 --------------
773 773 test L:up a R:um a b W: - 20 merge a and b to b, remove a
774 774 --------------
775 775 searching for copies back to rev 1
776 776 unmatched files in other:
777 777 b
778 778 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
779 779 src: 'a' -> dst: 'b' *
780 780 checking for directory renames
781 781 resolving manifests
782 782 branchmerge: True, force: False, partial: False
783 783 ancestor: 924404dff337, local: e300d1c794ec+, remote: 49b6d8032493
784 784 preserving a for resolve of b
785 785 preserving rev for resolve of rev
786 786 removing a
787 787 starting 4 threads for background file closing (?)
788 788 b: remote moved from a -> m (premerge)
789 789 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
790 790 merging a and b to b
791 791 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
792 792 rev: versions differ -> m (premerge)
793 793 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
794 794 merging rev
795 795 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
796 796 b: remote moved from a -> m (merge)
797 797 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
798 798 my b@e300d1c794ec+ other b@49b6d8032493 ancestor a@924404dff337
799 799 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
800 800 merge tool returned: 0
801 801 rev: versions differ -> m (merge)
802 802 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
803 803 my rev@e300d1c794ec+ other rev@49b6d8032493 ancestor rev@924404dff337
804 804 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
805 805 merge tool returned: 0
806 806 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
807 807 (branch merge, don't forget to commit)
808 808 --------------
809 809 M b
810 810 a
811 811 --------------
812 812
813 813 $ tm "um a b" "up a " " " "21 merge a and b to b"
814 814 created new head
815 815 --------------
816 816 test L:um a b R:up a W: - 21 merge a and b to b
817 817 --------------
818 818 searching for copies back to rev 1
819 819 unmatched files in local:
820 820 b
821 821 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
822 822 src: 'a' -> dst: 'b' *
823 823 checking for directory renames
824 824 resolving manifests
825 825 branchmerge: True, force: False, partial: False
826 826 ancestor: 924404dff337, local: 62e7bf090eba+, remote: f4db7e329e71
827 827 preserving b for resolve of b
828 828 preserving rev for resolve of rev
829 829 starting 4 threads for background file closing (?)
830 830 b: local copied/moved from a -> m (premerge)
831 831 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
832 832 merging b and a to b
833 833 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
834 834 rev: versions differ -> m (premerge)
835 835 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
836 836 merging rev
837 837 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
838 838 b: local copied/moved from a -> m (merge)
839 839 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
840 840 my b@62e7bf090eba+ other a@f4db7e329e71 ancestor a@924404dff337
841 841 launching merge tool: * ../merge *$TESTTMP/t/t/b* * * (glob)
842 842 merge tool returned: 0
843 843 rev: versions differ -> m (merge)
844 844 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
845 845 my rev@62e7bf090eba+ other rev@f4db7e329e71 ancestor rev@924404dff337
846 846 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
847 847 merge tool returned: 0
848 848 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
849 849 (branch merge, don't forget to commit)
850 850 --------------
851 851 M b
852 852 a
853 853 --------------
854 854
855 855
856 856 m "nm a b" "um x a" " " "22 get a, keep b"
857 857
858 858 $ tm "nm a b" "up a c" " " "23 get c, keep b"
859 859 created new head
860 860 --------------
861 861 test L:nm a b R:up a c W: - 23 get c, keep b
862 862 --------------
863 863 searching for copies back to rev 1
864 864 unmatched files in local:
865 865 b
866 866 unmatched files in other:
867 867 c
868 868 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
869 869 src: 'a' -> dst: 'b' *
870 870 checking for directory renames
871 871 resolving manifests
872 872 branchmerge: True, force: False, partial: False
873 873 ancestor: 924404dff337, local: 02963e448370+, remote: 2b958612230f
874 874 preserving b for resolve of b
875 875 preserving rev for resolve of rev
876 876 c: remote created -> g
877 877 getting c
878 878 b: local copied/moved from a -> m (premerge)
879 879 picked tool '* ../merge' for b (binary False symlink False changedelete False) (glob)
880 880 merging b and a to b
881 881 my b@02963e448370+ other a@2b958612230f ancestor a@924404dff337
882 882 premerge successful
883 883 rev: versions differ -> m (premerge)
884 884 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
885 885 merging rev
886 886 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
887 887 rev: versions differ -> m (merge)
888 888 picked tool '* ../merge' for rev (binary False symlink False changedelete False) (glob)
889 889 my rev@02963e448370+ other rev@2b958612230f ancestor rev@924404dff337
890 890 launching merge tool: * ../merge *$TESTTMP/t/t/rev* * * (glob)
891 891 merge tool returned: 0
892 892 1 files updated, 2 files merged, 0 files removed, 0 files unresolved
893 893 (branch merge, don't forget to commit)
894 894 --------------
895 895 M b
896 896 a
897 897 M c
898 898 --------------
899 899
900 900
901 901 $ cd ..
902 902
903 903
904 904 Systematic and terse testing of merge merges and ancestor calculation:
905 905
906 906 Expected result:
907 907
908 908 \ a m1 m2 dst
909 909 0 - f f f "versions differ"
910 910 1 f g g g "versions differ"
911 911 2 f f f f "versions differ"
912 912 3 f f g f+g "remote copied to " + f
913 913 4 f f g g "remote moved to " + f
914 914 5 f g f f+g "local copied to " + f2
915 915 6 f g f g "local moved to " + f2
916 916 7 - (f) f f "remote differs from untracked local"
917 917 8 f (f) f f "remote differs from untracked local"
918 918
919 919 $ hg init ancestortest
920 920 $ cd ancestortest
921 921 $ for x in 1 2 3 4 5 6 8; do mkdir $x; echo a > $x/f; done
922 922 $ hg ci -Aqm "a"
923 923 $ mkdir 0
924 924 $ touch 0/f
925 925 $ hg mv 1/f 1/g
926 926 $ hg cp 5/f 5/g
927 927 $ hg mv 6/f 6/g
928 928 $ hg rm 8/f
929 929 $ for x in */*; do echo m1 > $x; done
930 930 $ hg ci -Aqm "m1"
931 931 $ hg up -qr0
932 932 $ mkdir 0 7
933 933 $ touch 0/f 7/f
934 934 $ hg mv 1/f 1/g
935 935 $ hg cp 3/f 3/g
936 936 $ hg mv 4/f 4/g
937 937 $ for x in */*; do echo m2 > $x; done
938 938 $ hg ci -Aqm "m2"
939 939 $ hg up -qr1
940 940 $ mkdir 7 8
941 941 $ echo m > 7/f
942 942 $ echo m > 8/f
943 943 $ hg merge -f --tool internal:dump -v --debug -r2 | sed '/^resolving manifests/,$d' 2> /dev/null
944 944 searching for copies back to rev 1
945 945 unmatched files in local:
946 946 5/g
947 947 6/g
948 948 unmatched files in other:
949 949 3/g
950 950 4/g
951 951 7/f
952 952 unmatched files new in both:
953 953 0/f
954 954 1/g
955 955 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
956 956 src: '3/f' -> dst: '3/g' *
957 957 src: '4/f' -> dst: '4/g' *
958 958 src: '5/f' -> dst: '5/g' *
959 959 src: '6/f' -> dst: '6/g' *
960 960 checking for directory renames
961 961 $ hg mani
962 962 0/f
963 963 1/g
964 964 2/f
965 965 3/f
966 966 4/f
967 967 5/f
968 968 5/g
969 969 6/g
970 970 $ for f in */*; do echo $f:; cat $f; done
971 971 0/f:
972 972 m1
973 973 0/f.base:
974 974 0/f.local:
975 975 m1
976 976 0/f.orig:
977 977 m1
978 978 0/f.other:
979 979 m2
980 980 1/g:
981 981 m1
982 982 1/g.base:
983 983 a
984 984 1/g.local:
985 985 m1
986 986 1/g.orig:
987 987 m1
988 988 1/g.other:
989 989 m2
990 990 2/f:
991 991 m1
992 992 2/f.base:
993 993 a
994 994 2/f.local:
995 995 m1
996 996 2/f.orig:
997 997 m1
998 998 2/f.other:
999 999 m2
1000 1000 3/f:
1001 1001 m1
1002 1002 3/f.base:
1003 1003 a
1004 1004 3/f.local:
1005 1005 m1
1006 1006 3/f.orig:
1007 1007 m1
1008 1008 3/f.other:
1009 1009 m2
1010 1010 3/g:
1011 1011 m1
1012 1012 3/g.base:
1013 1013 a
1014 1014 3/g.local:
1015 1015 m1
1016 1016 3/g.orig:
1017 1017 m1
1018 1018 3/g.other:
1019 1019 m2
1020 1020 4/g:
1021 1021 m1
1022 1022 4/g.base:
1023 1023 a
1024 1024 4/g.local:
1025 1025 m1
1026 1026 4/g.orig:
1027 1027 m1
1028 1028 4/g.other:
1029 1029 m2
1030 1030 5/f:
1031 1031 m1
1032 1032 5/f.base:
1033 1033 a
1034 1034 5/f.local:
1035 1035 m1
1036 1036 5/f.orig:
1037 1037 m1
1038 1038 5/f.other:
1039 1039 m2
1040 1040 5/g:
1041 1041 m1
1042 1042 5/g.base:
1043 1043 a
1044 1044 5/g.local:
1045 1045 m1
1046 1046 5/g.orig:
1047 1047 m1
1048 1048 5/g.other:
1049 1049 m2
1050 1050 6/g:
1051 1051 m1
1052 1052 6/g.base:
1053 1053 a
1054 1054 6/g.local:
1055 1055 m1
1056 1056 6/g.orig:
1057 1057 m1
1058 1058 6/g.other:
1059 1059 m2
1060 1060 7/f:
1061 1061 m
1062 1062 7/f.base:
1063 1063 7/f.local:
1064 1064 m
1065 1065 7/f.orig:
1066 1066 m
1067 1067 7/f.other:
1068 1068 m2
1069 1069 8/f:
1070 1070 m2
1071 1071 $ cd ..
@@ -1,121 +1,121 b''
1 1 test merging things outside of the sparse checkout
2 2
3 3 $ hg init myrepo
4 4 $ cd myrepo
5 5 $ cat > .hg/hgrc <<EOF
6 6 > [extensions]
7 7 > sparse=
8 8 > EOF
9 9
10 10 $ echo foo > foo
11 11 $ echo bar > bar
12 12 $ hg add foo bar
13 13 $ hg commit -m initial
14 14
15 15 $ hg branch feature
16 16 marked working directory as branch feature
17 17 (branches are permanent and global, did you want a bookmark?)
18 18 $ echo bar2 >> bar
19 19 $ hg commit -m 'feature - bar2'
20 20
21 21 $ hg update -q default
22 22 $ hg debugsparse --exclude 'bar**'
23 23
24 24 $ hg merge feature
25 25 temporarily included 1 file(s) in the sparse checkout for merging
26 26 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
27 27 (branch merge, don't forget to commit)
28 28
29 29 Verify bar was merged temporarily
30 30
31 31 $ ls
32 32 bar
33 33 foo
34 34 $ hg status
35 35 M bar
36 36
37 37 Verify bar disappears automatically when the working copy becomes clean
38 38
39 39 $ hg commit -m "merged"
40 40 cleaned up 1 temporarily added file(s) from the sparse checkout
41 41 $ hg status
42 42 $ ls
43 43 foo
44 44
45 45 $ hg cat -r . bar
46 46 bar
47 47 bar2
48 48
49 49 Test merging things outside of the sparse checkout that are not in the working
50 50 copy
51 51
52 52 $ hg strip -q -r . --config extensions.strip=
53 53 $ hg up -q feature
54 54 $ touch branchonly
55 55 $ hg ci -Aqm 'add branchonly'
56 56
57 57 $ hg up -q default
58 58 $ hg debugsparse -X branchonly
59 59 $ hg merge feature
60 60 temporarily included 2 file(s) in the sparse checkout for merging
61 61 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
62 62 (branch merge, don't forget to commit)
63 63
64 64 $ cd ..
65 65
66 66 Tests merging a file which is modified in one branch and deleted in another and
67 67 file is excluded from sparse checkout
68 68
69 69 $ hg init ytest
70 70 $ cd ytest
71 71 $ echo "syntax: glob" >> .hgignore
72 72 $ echo "*.orig" >> .hgignore
73 73 $ hg ci -Aqm "added .hgignore"
74 74 $ for ch in a d; do echo foo > $ch; hg ci -Aqm "added "$ch; done;
75 75 $ cat >> .hg/hgrc <<EOF
76 76 > [alias]
77 77 > glog = log -GT "{rev}:{node|short} {desc}"
78 78 > [extensions]
79 79 > sparse =
80 80 > EOF
81 81
82 82 $ hg glog
83 83 @ 2:f29feff37cfc added d
84 84 |
85 85 o 1:617125d27d6b added a
86 86 |
87 87 o 0:53f3774ed939 added .hgignore
88 88
89 89 $ hg rm d
90 90 $ hg ci -m "removed d"
91 91
92 92 $ hg up '.^'
93 93 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
94 94 $ hg debugsparse --reset
95 95 $ echo bar >> d
96 96 $ hg ci -Am "added bar to d"
97 97 created new head
98 98
99 99 $ hg glog
100 100 @ 4:6527874a90e4 added bar to d
101 101 |
102 102 | o 3:372c8558de45 removed d
103 103 |/
104 104 o 2:f29feff37cfc added d
105 105 |
106 106 o 1:617125d27d6b added a
107 107 |
108 108 o 0:53f3774ed939 added .hgignore
109 109
110 110 $ hg debugsparse --exclude "d"
111 111 $ ls
112 112 a
113 113
114 114 $ hg merge
115 115 temporarily included 1 file(s) in the sparse checkout for merging
116 file 'd' was deleted in local [working copy] but was modified in other [merge rev].
116 file 'd' was deleted in other [merge rev] but was modified in local [working copy].
117 117 What do you want to do?
118 118 use (c)hanged version, (d)elete, or leave (u)nresolved? u
119 119 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
120 120 use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to abandon
121 121 [1]
General Comments 0
You need to be logged in to leave comments. Login now