##// END OF EJS Templates
filemerge: normalize 'internal:foo' names to ':foo'...
Siddharth Agarwal -
r26517:d8463a74 default
parent child Browse files
Show More
@@ -1,563 +1,566
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 filecmp
11 11 import os
12 12 import re
13 13 import tempfile
14 14
15 15 from .i18n import _
16 16 from .node import short
17 17
18 18 from . import (
19 19 error,
20 20 match,
21 21 simplemerge,
22 22 tagmerge,
23 23 templatekw,
24 24 templater,
25 25 util,
26 26 )
27 27
28 28 def _toolstr(ui, tool, part, default=""):
29 29 return ui.config("merge-tools", tool + "." + part, default)
30 30
31 31 def _toolbool(ui, tool, part, default=False):
32 32 return ui.configbool("merge-tools", tool + "." + part, default)
33 33
34 34 def _toollist(ui, tool, part, default=[]):
35 35 return ui.configlist("merge-tools", tool + "." + part, default)
36 36
37 37 internals = {}
38 38 # Merge tools to document.
39 39 internalsdoc = {}
40 40
41 41 def internaltool(name, trymerge, onfailure=None, precheck=None):
42 42 '''return a decorator for populating internal merge tool table'''
43 43 def decorator(func):
44 44 fullname = ':' + name
45 45 func.__doc__ = "``%s``\n" % fullname + func.__doc__.strip()
46 46 internals[fullname] = func
47 47 internals['internal:' + name] = func
48 48 internalsdoc[fullname] = func
49 49 func.trymerge = trymerge
50 50 func.onfailure = onfailure
51 51 func.precheck = precheck
52 52 return func
53 53 return decorator
54 54
55 55 def _findtool(ui, tool):
56 56 if tool in internals:
57 57 return tool
58 58 return findexternaltool(ui, tool)
59 59
60 60 def findexternaltool(ui, tool):
61 61 for kn in ("regkey", "regkeyalt"):
62 62 k = _toolstr(ui, tool, kn)
63 63 if not k:
64 64 continue
65 65 p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
66 66 if p:
67 67 p = util.findexe(p + _toolstr(ui, tool, "regappend"))
68 68 if p:
69 69 return p
70 70 exe = _toolstr(ui, tool, "executable", tool)
71 71 return util.findexe(util.expandpath(exe))
72 72
73 73 def _picktool(repo, ui, path, binary, symlink):
74 74 def check(tool, pat, symlink, binary):
75 75 tmsg = tool
76 76 if pat:
77 77 tmsg += " specified for " + pat
78 78 if not _findtool(ui, tool):
79 79 if pat: # explicitly requested tool deserves a warning
80 80 ui.warn(_("couldn't find merge tool %s\n") % tmsg)
81 81 else: # configured but non-existing tools are more silent
82 82 ui.note(_("couldn't find merge tool %s\n") % tmsg)
83 83 elif symlink and not _toolbool(ui, tool, "symlink"):
84 84 ui.warn(_("tool %s can't handle symlinks\n") % tmsg)
85 85 elif binary and not _toolbool(ui, tool, "binary"):
86 86 ui.warn(_("tool %s can't handle binary\n") % tmsg)
87 87 elif not util.gui() and _toolbool(ui, tool, "gui"):
88 88 ui.warn(_("tool %s requires a GUI\n") % tmsg)
89 89 else:
90 90 return True
91 91 return False
92 92
93 93 # internal config: ui.forcemerge
94 94 # forcemerge comes from command line arguments, highest priority
95 95 force = ui.config('ui', 'forcemerge')
96 96 if force:
97 97 toolpath = _findtool(ui, force)
98 98 if toolpath:
99 99 return (force, util.shellquote(toolpath))
100 100 else:
101 101 # mimic HGMERGE if given tool not found
102 102 return (force, force)
103 103
104 104 # HGMERGE takes next precedence
105 105 hgmerge = os.environ.get("HGMERGE")
106 106 if hgmerge:
107 107 return (hgmerge, hgmerge)
108 108
109 109 # then patterns
110 110 for pat, tool in ui.configitems("merge-patterns"):
111 111 mf = match.match(repo.root, '', [pat])
112 112 if mf(path) and check(tool, pat, symlink, False):
113 113 toolpath = _findtool(ui, tool)
114 114 return (tool, util.shellquote(toolpath))
115 115
116 116 # then merge tools
117 117 tools = {}
118 118 for k, v in ui.configitems("merge-tools"):
119 119 t = k.split('.')[0]
120 120 if t not in tools:
121 121 tools[t] = int(_toolstr(ui, t, "priority", "0"))
122 122 names = tools.keys()
123 123 tools = sorted([(-p, t) for t, p in tools.items()])
124 124 uimerge = ui.config("ui", "merge")
125 125 if uimerge:
126 126 if uimerge not in names:
127 127 return (uimerge, uimerge)
128 128 tools.insert(0, (None, uimerge)) # highest priority
129 129 tools.append((None, "hgmerge")) # the old default, if found
130 130 for p, t in tools:
131 131 if check(t, None, symlink, binary):
132 132 toolpath = _findtool(ui, t)
133 133 return (t, util.shellquote(toolpath))
134 134
135 135 # internal merge or prompt as last resort
136 136 if symlink or binary:
137 137 return ":prompt", None
138 138 return ":merge", None
139 139
140 140 def _eoltype(data):
141 141 "Guess the EOL type of a file"
142 142 if '\0' in data: # binary
143 143 return None
144 144 if '\r\n' in data: # Windows
145 145 return '\r\n'
146 146 if '\r' in data: # Old Mac
147 147 return '\r'
148 148 if '\n' in data: # UNIX
149 149 return '\n'
150 150 return None # unknown
151 151
152 152 def _matcheol(file, origfile):
153 153 "Convert EOL markers in a file to match origfile"
154 154 tostyle = _eoltype(util.readfile(origfile))
155 155 if tostyle:
156 156 data = util.readfile(file)
157 157 style = _eoltype(data)
158 158 if style:
159 159 newdata = data.replace(style, tostyle)
160 160 if newdata != data:
161 161 util.writefile(file, newdata)
162 162
163 163 @internaltool('prompt', False)
164 164 def _iprompt(repo, mynode, orig, fcd, fco, fca, toolconf):
165 165 """Asks the user which of the local or the other version to keep as
166 166 the merged version."""
167 167 ui = repo.ui
168 168 fd = fcd.path()
169 169
170 170 if ui.promptchoice(_(" no tool found to merge %s\n"
171 171 "keep (l)ocal or take (o)ther?"
172 172 "$$ &Local $$ &Other") % fd, 0):
173 173 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf)
174 174 else:
175 175 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf)
176 176
177 177 @internaltool('local', False)
178 178 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf):
179 179 """Uses the local version of files as the merged version."""
180 180 return 0
181 181
182 182 @internaltool('other', False)
183 183 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf):
184 184 """Uses the other version of files as the merged version."""
185 185 repo.wwrite(fcd.path(), fco.data(), fco.flags())
186 186 return 0
187 187
188 188 @internaltool('fail', False)
189 189 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf):
190 190 """
191 191 Rather than attempting to merge files that were modified on both
192 192 branches, it marks them as unresolved. The resolve command must be
193 193 used to resolve these conflicts."""
194 194 return 1
195 195
196 196 def _premerge(repo, toolconf, files, labels=None):
197 197 tool, toolpath, binary, symlink = toolconf
198 198 if symlink:
199 199 return 1
200 200 a, b, c, back = files
201 201
202 202 ui = repo.ui
203 203
204 204 validkeep = ['keep', 'keep-merge3']
205 205
206 206 # do we attempt to simplemerge first?
207 207 try:
208 208 premerge = _toolbool(ui, tool, "premerge", not binary)
209 209 except error.ConfigError:
210 210 premerge = _toolstr(ui, tool, "premerge").lower()
211 211 if premerge not in validkeep:
212 212 _valid = ', '.join(["'" + v + "'" for v in validkeep])
213 213 raise error.ConfigError(_("%s.premerge not valid "
214 214 "('%s' is neither boolean nor %s)") %
215 215 (tool, premerge, _valid))
216 216
217 217 if premerge:
218 218 if premerge == 'keep-merge3':
219 219 if not labels:
220 220 labels = _defaultconflictlabels
221 221 if len(labels) < 3:
222 222 labels.append('base')
223 223 r = simplemerge.simplemerge(ui, a, b, c, quiet=True, label=labels)
224 224 if not r:
225 225 ui.debug(" premerge successful\n")
226 226 return 0
227 227 if premerge not in validkeep:
228 228 util.copyfile(back, a) # restore from backup and try again
229 229 return 1 # continue merging
230 230
231 231 def _symlinkcheck(repo, mynode, orig, fcd, fco, fca, toolconf):
232 232 tool, toolpath, binary, symlink = toolconf
233 233 if symlink:
234 234 repo.ui.warn(_('warning: internal :merge cannot merge symlinks '
235 235 'for %s\n') % fcd.path())
236 236 return False
237 237 return True
238 238
239 239 def _merge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels, mode):
240 240 """
241 241 Uses the internal non-interactive simple merge algorithm for merging
242 242 files. It will fail if there are any conflicts and leave markers in
243 243 the partially merged file. Markers will have two sections, one for each side
244 244 of merge, unless mode equals 'union' which suppresses the markers."""
245 245 r = _premerge(repo, toolconf, files, labels=labels)
246 246 if r:
247 247 a, b, c, back = files
248 248
249 249 ui = repo.ui
250 250
251 251 r = simplemerge.simplemerge(ui, a, b, c, label=labels, mode=mode)
252 252 return True, r
253 253 return False, 0
254 254
255 255 @internaltool('union', True,
256 256 _("merging %s incomplete! "
257 257 "(edit conflicts, then use 'hg resolve --mark')\n"),
258 258 precheck=_symlinkcheck)
259 259 def _iunion(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
260 260 """
261 261 Uses the internal non-interactive simple merge algorithm for merging
262 262 files. It will use both left and right sides for conflict regions.
263 263 No markers are inserted."""
264 264 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
265 265 files, labels, 'union')
266 266
267 267 @internaltool('merge', True,
268 268 _("merging %s incomplete! "
269 269 "(edit conflicts, then use 'hg resolve --mark')\n"),
270 270 precheck=_symlinkcheck)
271 271 def _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
272 272 """
273 273 Uses the internal non-interactive simple merge algorithm for merging
274 274 files. It will fail if there are any conflicts and leave markers in
275 275 the partially merged file. Markers will have two sections, one for each side
276 276 of merge."""
277 277 return _merge(repo, mynode, orig, fcd, fco, fca, toolconf,
278 278 files, labels, 'merge')
279 279
280 280 @internaltool('merge3', True,
281 281 _("merging %s incomplete! "
282 282 "(edit conflicts, then use 'hg resolve --mark')\n"))
283 283 def _imerge3(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
284 284 """
285 285 Uses the internal non-interactive simple merge algorithm for merging
286 286 files. It will fail if there are any conflicts and leave markers in
287 287 the partially merged file. Marker will have three sections, one from each
288 288 side of the merge and one for the base content."""
289 289 if not labels:
290 290 labels = _defaultconflictlabels
291 291 if len(labels) < 3:
292 292 labels.append('base')
293 293 return _imerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels)
294 294
295 295 def _imergeauto(repo, mynode, orig, fcd, fco, fca, toolconf, files,
296 296 labels=None, localorother=None):
297 297 """
298 298 Generic driver for _imergelocal and _imergeother
299 299 """
300 300 assert localorother is not None
301 301 tool, toolpath, binary, symlink = toolconf
302 302 if symlink:
303 303 repo.ui.warn(_('warning: :merge-%s cannot merge symlinks '
304 304 'for %s\n') % (localorother, fcd.path()))
305 305 return False, 1
306 306 a, b, c, back = files
307 307 r = simplemerge.simplemerge(repo.ui, a, b, c, label=labels,
308 308 localorother=localorother)
309 309 return True, r
310 310
311 311 @internaltool('merge-local', True)
312 312 def _imergelocal(*args, **kwargs):
313 313 """
314 314 Like :merge, but resolve all conflicts non-interactively in favor
315 315 of the local changes."""
316 316 success, status = _imergeauto(localorother='local', *args, **kwargs)
317 317 return success, status
318 318
319 319 @internaltool('merge-other', True)
320 320 def _imergeother(*args, **kwargs):
321 321 """
322 322 Like :merge, but resolve all conflicts non-interactively in favor
323 323 of the other changes."""
324 324 success, status = _imergeauto(localorother='other', *args, **kwargs)
325 325 return success, status
326 326
327 327 @internaltool('tagmerge', True,
328 328 _("automatic tag merging of %s failed! "
329 329 "(use 'hg resolve --tool :merge' or another merge "
330 330 "tool of your choice)\n"))
331 331 def _itagmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
332 332 """
333 333 Uses the internal tag merge algorithm (experimental).
334 334 """
335 335 return tagmerge.merge(repo, fcd, fco, fca)
336 336
337 337 @internaltool('dump', True)
338 338 def _idump(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
339 339 """
340 340 Creates three versions of the files to merge, containing the
341 341 contents of local, other and base. These files can then be used to
342 342 perform a merge manually. If the file to be merged is named
343 343 ``a.txt``, these files will accordingly be named ``a.txt.local``,
344 344 ``a.txt.other`` and ``a.txt.base`` and they will be placed in the
345 345 same directory as ``a.txt``."""
346 346 r = _premerge(repo, toolconf, files, labels=labels)
347 347 if r:
348 348 a, b, c, back = files
349 349
350 350 fd = fcd.path()
351 351
352 352 util.copyfile(a, a + ".local")
353 353 repo.wwrite(fd + ".other", fco.data(), fco.flags())
354 354 repo.wwrite(fd + ".base", fca.data(), fca.flags())
355 355 return False, r
356 356
357 357 def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
358 358 r = _premerge(repo, toolconf, files, labels=labels)
359 359 if r:
360 360 tool, toolpath, binary, symlink = toolconf
361 361 a, b, c, back = files
362 362 out = ""
363 363 env = {'HG_FILE': fcd.path(),
364 364 'HG_MY_NODE': short(mynode),
365 365 'HG_OTHER_NODE': str(fco.changectx()),
366 366 'HG_BASE_NODE': str(fca.changectx()),
367 367 'HG_MY_ISLINK': 'l' in fcd.flags(),
368 368 'HG_OTHER_ISLINK': 'l' in fco.flags(),
369 369 'HG_BASE_ISLINK': 'l' in fca.flags(),
370 370 }
371 371
372 372 ui = repo.ui
373 373
374 374 args = _toolstr(ui, tool, "args", '$local $base $other')
375 375 if "$output" in args:
376 376 out, a = a, back # read input from backup, write to original
377 377 replace = {'local': a, 'base': b, 'other': c, 'output': out}
378 378 args = util.interpolate(r'\$', replace, args,
379 379 lambda s: util.shellquote(util.localpath(s)))
380 380 cmd = toolpath + ' ' + args
381 381 repo.ui.debug('launching merge tool: %s\n' % cmd)
382 382 r = ui.system(cmd, cwd=repo.root, environ=env)
383 383 repo.ui.debug('merge tool returned: %s\n' % r)
384 384 return True, r
385 385 return False, 0
386 386
387 387 def _formatconflictmarker(repo, ctx, template, label, pad):
388 388 """Applies the given template to the ctx, prefixed by the label.
389 389
390 390 Pad is the minimum width of the label prefix, so that multiple markers
391 391 can have aligned templated parts.
392 392 """
393 393 if ctx.node() is None:
394 394 ctx = ctx.p1()
395 395
396 396 props = templatekw.keywords.copy()
397 397 props['templ'] = template
398 398 props['ctx'] = ctx
399 399 props['repo'] = repo
400 400 templateresult = template('conflictmarker', **props)
401 401
402 402 label = ('%s:' % label).ljust(pad + 1)
403 403 mark = '%s %s' % (label, templater.stringify(templateresult))
404 404
405 405 if mark:
406 406 mark = mark.splitlines()[0] # split for safety
407 407
408 408 # 8 for the prefix of conflict marker lines (e.g. '<<<<<<< ')
409 409 return util.ellipsis(mark, 80 - 8)
410 410
411 411 _defaultconflictmarker = ('{node|short} ' +
412 412 '{ifeq(tags, "tip", "", "{tags} ")}' +
413 413 '{if(bookmarks, "{bookmarks} ")}' +
414 414 '{ifeq(branch, "default", "", "{branch} ")}' +
415 415 '- {author|user}: {desc|firstline}')
416 416
417 417 _defaultconflictlabels = ['local', 'other']
418 418
419 419 def _formatlabels(repo, fcd, fco, fca, labels):
420 420 """Formats the given labels using the conflict marker template.
421 421
422 422 Returns a list of formatted labels.
423 423 """
424 424 cd = fcd.changectx()
425 425 co = fco.changectx()
426 426 ca = fca.changectx()
427 427
428 428 ui = repo.ui
429 429 template = ui.config('ui', 'mergemarkertemplate', _defaultconflictmarker)
430 430 tmpl = templater.templater(None, cache={'conflictmarker': template})
431 431
432 432 pad = max(len(l) for l in labels)
433 433
434 434 newlabels = [_formatconflictmarker(repo, cd, tmpl, labels[0], pad),
435 435 _formatconflictmarker(repo, co, tmpl, labels[1], pad)]
436 436 if len(labels) > 2:
437 437 newlabels.append(_formatconflictmarker(repo, ca, tmpl, labels[2], pad))
438 438 return newlabels
439 439
440 440 def filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
441 441 """perform a 3-way merge in the working directory
442 442
443 443 mynode = parent node before merge
444 444 orig = original local filename before merge
445 445 fco = other file context
446 446 fca = ancestor file context
447 447 fcd = local file context for current/destination file
448 448 """
449 449
450 450 if True:
451 451 def temp(prefix, ctx):
452 452 pre = "%s~%s." % (os.path.basename(ctx.path()), prefix)
453 453 (fd, name) = tempfile.mkstemp(prefix=pre)
454 454 data = repo.wwritedata(ctx.path(), ctx.data())
455 455 f = os.fdopen(fd, "wb")
456 456 f.write(data)
457 457 f.close()
458 458 return name
459 459
460 460 if not fco.cmp(fcd): # files identical?
461 461 return None
462 462
463 463 ui = repo.ui
464 464 fd = fcd.path()
465 465 binary = fcd.isbinary() or fco.isbinary() or fca.isbinary()
466 466 symlink = 'l' in fcd.flags() + fco.flags()
467 467 tool, toolpath = _picktool(repo, ui, fd, binary, symlink)
468 if tool in internals and tool.startswith('internal:'):
469 # normalize to new-style names (':merge' etc)
470 tool = tool[len('internal'):]
468 471 ui.debug("picked tool '%s' for %s (binary %s symlink %s)\n" %
469 472 (tool, fd, binary, symlink))
470 473
471 474 if tool in internals:
472 475 func = internals[tool]
473 476 trymerge = func.trymerge
474 477 onfailure = func.onfailure
475 478 precheck = func.precheck
476 479 else:
477 480 func = _xmerge
478 481 trymerge = True
479 482 onfailure = _("merging %s failed!\n")
480 483 precheck = None
481 484
482 485 toolconf = tool, toolpath, binary, symlink
483 486
484 487 if not trymerge:
485 488 return func(repo, mynode, orig, fcd, fco, fca, toolconf)
486 489
487 490 a = repo.wjoin(fd)
488 491 b = temp("base", fca)
489 492 c = temp("other", fco)
490 493 back = a + ".orig"
491 494 util.copyfile(a, back)
492 495
493 496 if orig != fco.path():
494 497 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd))
495 498 else:
496 499 ui.status(_("merging %s\n") % fd)
497 500
498 501 ui.debug("my %s other %s ancestor %s\n" % (fcd, fco, fca))
499 502
500 503 r = 0
501 504 if precheck and not precheck(repo, mynode, orig, fcd, fco, fca,
502 505 toolconf):
503 506 r = 1
504 507 needcheck = False
505 508
506 509 if not r: # precheck passed
507 510 markerstyle = ui.config('ui', 'mergemarkers', 'basic')
508 511 if not labels:
509 512 labels = _defaultconflictlabels
510 513 if markerstyle != 'basic':
511 514 labels = _formatlabels(repo, fcd, fco, fca, labels)
512 515
513 516 needcheck, r = func(repo, mynode, orig, fcd, fco, fca, toolconf,
514 517 (a, b, c, back), labels=labels)
515 518
516 519 if not needcheck:
517 520 if r:
518 521 if onfailure:
519 522 ui.warn(onfailure % fd)
520 523 else:
521 524 util.unlink(back)
522 525
523 526 util.unlink(b)
524 527 util.unlink(c)
525 528 return r
526 529
527 530 if not r and (_toolbool(ui, tool, "checkconflicts") or
528 531 'conflicts' in _toollist(ui, tool, "check")):
529 532 if re.search("^(<<<<<<< .*|=======|>>>>>>> .*)$", fcd.data(),
530 533 re.MULTILINE):
531 534 r = 1
532 535
533 536 checked = False
534 537 if 'prompt' in _toollist(ui, tool, "check"):
535 538 checked = True
536 539 if ui.promptchoice(_("was merge of '%s' successful (yn)?"
537 540 "$$ &Yes $$ &No") % fd, 1):
538 541 r = 1
539 542
540 543 if not r and not checked and (_toolbool(ui, tool, "checkchanged") or
541 544 'changed' in
542 545 _toollist(ui, tool, "check")):
543 546 if filecmp.cmp(a, back):
544 547 if ui.promptchoice(_(" output file %s appears unchanged\n"
545 548 "was merge successful (yn)?"
546 549 "$$ &Yes $$ &No") % fd, 1):
547 550 r = 1
548 551
549 552 if _toolbool(ui, tool, "fixeol"):
550 553 _matcheol(a, back)
551 554
552 555 if r:
553 556 if onfailure:
554 557 ui.warn(onfailure % fd)
555 558 else:
556 559 util.unlink(back)
557 560
558 561 util.unlink(b)
559 562 util.unlink(c)
560 563 return r
561 564
562 565 # tell hggettext to extract docstrings from these functions:
563 566 i18nfunctions = internals.values()
@@ -1,652 +1,652
1 1 $ hg init basic
2 2 $ cd basic
3 3
4 4 should complain
5 5
6 6 $ hg backout
7 7 abort: please specify a revision to backout
8 8 [255]
9 9 $ hg backout -r 0 0
10 10 abort: please specify just one revision
11 11 [255]
12 12
13 13 basic operation
14 14 (this also tests that editor is invoked if the commit message is not
15 15 specified explicitly)
16 16
17 17 $ echo a > a
18 18 $ hg commit -d '0 0' -A -m a
19 19 adding a
20 20 $ echo b >> a
21 21 $ hg commit -d '1 0' -m b
22 22
23 23 $ hg status --rev tip --rev "tip^1"
24 24 M a
25 25 $ HGEDITOR=cat hg backout -d '2 0' tip --tool=true
26 26 reverting a
27 27 Backed out changeset a820f4f40a57
28 28
29 29
30 30 HG: Enter commit message. Lines beginning with 'HG:' are removed.
31 31 HG: Leave message empty to abort commit.
32 32 HG: --
33 33 HG: user: test
34 34 HG: branch 'default'
35 35 HG: changed a
36 36 changeset 2:2929462c3dff backs out changeset 1:a820f4f40a57
37 37 $ cat a
38 38 a
39 39 $ hg summary
40 40 parent: 2:2929462c3dff tip
41 41 Backed out changeset a820f4f40a57
42 42 branch: default
43 43 commit: (clean)
44 44 update: (current)
45 45 phases: 3 draft
46 46
47 47 commit option
48 48
49 49 $ cd ..
50 50 $ hg init commit
51 51 $ cd commit
52 52
53 53 $ echo tomatoes > a
54 54 $ hg add a
55 55 $ hg commit -d '0 0' -m tomatoes
56 56
57 57 $ echo chair > b
58 58 $ hg add b
59 59 $ hg commit -d '1 0' -m chair
60 60
61 61 $ echo grapes >> a
62 62 $ hg commit -d '2 0' -m grapes
63 63
64 64 $ hg backout --commit -d '4 0' 1 --tool=:fail
65 65 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
66 66 changeset 3:1c2161e97c0a backs out changeset 1:22cb4f70d813
67 67 $ hg summary
68 68 parent: 3:1c2161e97c0a tip
69 69 Backed out changeset 22cb4f70d813
70 70 branch: default
71 71 commit: (clean)
72 72 update: (current)
73 73 phases: 4 draft
74 74
75 75 $ echo ypples > a
76 76 $ hg commit -d '5 0' -m ypples
77 77
78 78 $ hg backout --commit -d '6 0' 2 --tool=:fail
79 79 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
80 80 use 'hg resolve' to retry unresolved file merges
81 81 [1]
82 82 $ hg summary
83 83 parent: 4:ed99997b793d tip
84 84 ypples
85 85 branch: default
86 86 commit: 1 unresolved (clean)
87 87 update: (current)
88 88 phases: 5 draft
89 89
90 90 file that was removed is recreated
91 91 (this also tests that editor is not invoked if the commit message is
92 92 specified explicitly)
93 93
94 94 $ cd ..
95 95 $ hg init remove
96 96 $ cd remove
97 97
98 98 $ echo content > a
99 99 $ hg commit -d '0 0' -A -m a
100 100 adding a
101 101
102 102 $ hg rm a
103 103 $ hg commit -d '1 0' -m b
104 104
105 105 $ HGEDITOR=cat hg backout -d '2 0' tip --tool=true -m "Backed out changeset 76862dcce372"
106 106 adding a
107 107 changeset 2:de31bdc76c0d backs out changeset 1:76862dcce372
108 108 $ cat a
109 109 content
110 110 $ hg summary
111 111 parent: 2:de31bdc76c0d tip
112 112 Backed out changeset 76862dcce372
113 113 branch: default
114 114 commit: (clean)
115 115 update: (current)
116 116 phases: 3 draft
117 117
118 118 backout of backout is as if nothing happened
119 119
120 120 $ hg backout -d '3 0' --merge tip --tool=true
121 121 removing a
122 122 changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d
123 123 $ test -f a
124 124 [1]
125 125 $ hg summary
126 126 parent: 3:7f6d0f120113 tip
127 127 Backed out changeset de31bdc76c0d
128 128 branch: default
129 129 commit: (clean)
130 130 update: (current)
131 131 phases: 4 draft
132 132
133 133 Test that 'hg rollback' restores dirstate just before opening
134 134 transaction: in-memory dirstate changes should be written into
135 135 '.hg/journal.dirstate' as expected.
136 136
137 137 $ echo 'removed soon' > b
138 138 $ hg commit -A -d '4 0' -m 'prepare for subsequent removing'
139 139 adding b
140 140 $ echo 'newly added' > c
141 141 $ hg add c
142 142 $ hg remove b
143 143 $ hg commit -d '5 0' -m 'prepare for subsequent backout'
144 144 $ touch -t 200001010000 c
145 145 $ hg status -A
146 146 C c
147 147 $ hg debugstate --nodates
148 148 n 644 12 set c
149 149 $ hg backout -d '6 0' -m 'to be rollback-ed soon' -r .
150 150 adding b
151 151 removing c
152 152 changeset 6:4bfec048029d backs out changeset 5:fac0b729a654
153 153 $ hg rollback -q
154 154 $ hg status -A
155 155 A b
156 156 R c
157 157 $ hg debugstate --nodates
158 158 a 0 -1 unset b
159 159 r 0 0 set c
160 160
161 161 across branch
162 162
163 163 $ cd ..
164 164 $ hg init branch
165 165 $ cd branch
166 166 $ echo a > a
167 167 $ hg ci -Am0
168 168 adding a
169 169 $ echo b > b
170 170 $ hg ci -Am1
171 171 adding b
172 172 $ hg co -C 0
173 173 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
174 174 $ hg summary
175 175 parent: 0:f7b1eb17ad24
176 176 0
177 177 branch: default
178 178 commit: (clean)
179 179 update: 1 new changesets (update)
180 180 phases: 2 draft
181 181
182 182 should fail
183 183
184 184 $ hg backout 1
185 185 abort: cannot backout change that is not an ancestor
186 186 [255]
187 187 $ echo c > c
188 188 $ hg ci -Am2
189 189 adding c
190 190 created new head
191 191 $ hg summary
192 192 parent: 2:db815d6d32e6 tip
193 193 2
194 194 branch: default
195 195 commit: (clean)
196 196 update: 1 new changesets, 2 branch heads (merge)
197 197 phases: 3 draft
198 198
199 199 should fail
200 200
201 201 $ hg backout 1
202 202 abort: cannot backout change that is not an ancestor
203 203 [255]
204 204 $ hg summary
205 205 parent: 2:db815d6d32e6 tip
206 206 2
207 207 branch: default
208 208 commit: (clean)
209 209 update: 1 new changesets, 2 branch heads (merge)
210 210 phases: 3 draft
211 211
212 212 backout with merge
213 213
214 214 $ cd ..
215 215 $ hg init merge
216 216 $ cd merge
217 217
218 218 $ echo line 1 > a
219 219 $ echo line 2 >> a
220 220 $ hg commit -d '0 0' -A -m a
221 221 adding a
222 222 $ hg summary
223 223 parent: 0:59395513a13a tip
224 224 a
225 225 branch: default
226 226 commit: (clean)
227 227 update: (current)
228 228 phases: 1 draft
229 229
230 230 remove line 1
231 231
232 232 $ echo line 2 > a
233 233 $ hg commit -d '1 0' -m b
234 234
235 235 $ echo line 3 >> a
236 236 $ hg commit -d '2 0' -m c
237 237
238 238 $ hg backout --merge -d '3 0' 1 --tool=true
239 239 reverting a
240 240 created new head
241 241 changeset 3:26b8ccb9ad91 backs out changeset 1:5a50a024c182
242 242 merging with changeset 3:26b8ccb9ad91
243 243 merging a
244 244 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
245 245 (branch merge, don't forget to commit)
246 246 $ hg commit -d '4 0' -m d
247 247 $ hg summary
248 248 parent: 4:c7df5e0b9c09 tip
249 249 d
250 250 branch: default
251 251 commit: (clean)
252 252 update: (current)
253 253 phases: 5 draft
254 254
255 255 check line 1 is back
256 256
257 257 $ cat a
258 258 line 1
259 259 line 2
260 260 line 3
261 261
262 262 $ cd ..
263 263
264 264 backout should not back out subsequent changesets
265 265
266 266 $ hg init onecs
267 267 $ cd onecs
268 268 $ echo 1 > a
269 269 $ hg commit -d '0 0' -A -m a
270 270 adding a
271 271 $ echo 2 >> a
272 272 $ hg commit -d '1 0' -m b
273 273 $ echo 1 > b
274 274 $ hg commit -d '2 0' -A -m c
275 275 adding b
276 276 $ hg summary
277 277 parent: 2:882396649954 tip
278 278 c
279 279 branch: default
280 280 commit: (clean)
281 281 update: (current)
282 282 phases: 3 draft
283 283
284 284 without --merge
285 285 $ hg backout -d '3 0' 1 --tool=true
286 286 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
287 287 changeset 22bca4c721e5 backed out, don't forget to commit.
288 288 $ hg locate b
289 289 b
290 290 $ hg update -C tip
291 291 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
292 292 $ hg locate b
293 293 b
294 294 $ hg summary
295 295 parent: 2:882396649954 tip
296 296 c
297 297 branch: default
298 298 commit: (clean)
299 299 update: (current)
300 300 phases: 3 draft
301 301
302 302 with --merge
303 303 $ hg backout --merge -d '3 0' 1 --tool=true
304 304 reverting a
305 305 created new head
306 306 changeset 3:3202beb76721 backs out changeset 1:22bca4c721e5
307 307 merging with changeset 3:3202beb76721
308 308 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
309 309 (branch merge, don't forget to commit)
310 310 $ hg locate b
311 311 b
312 312 $ hg update -C tip
313 313 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
314 314 $ hg locate b
315 315 [1]
316 316
317 317 $ cd ..
318 318 $ hg init m
319 319 $ cd m
320 320 $ echo a > a
321 321 $ hg commit -d '0 0' -A -m a
322 322 adding a
323 323 $ echo b > b
324 324 $ hg commit -d '1 0' -A -m b
325 325 adding b
326 326 $ echo c > c
327 327 $ hg commit -d '2 0' -A -m b
328 328 adding c
329 329 $ hg update 1
330 330 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
331 331 $ echo d > d
332 332 $ hg commit -d '3 0' -A -m c
333 333 adding d
334 334 created new head
335 335 $ hg merge 2
336 336 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
337 337 (branch merge, don't forget to commit)
338 338 $ hg commit -d '4 0' -A -m d
339 339 $ hg summary
340 340 parent: 4:b2f3bb92043e tip
341 341 d
342 342 branch: default
343 343 commit: (clean)
344 344 update: (current)
345 345 phases: 5 draft
346 346
347 347 backout of merge should fail
348 348
349 349 $ hg backout 4
350 350 abort: cannot backout a merge changeset
351 351 [255]
352 352
353 353 backout of merge with bad parent should fail
354 354
355 355 $ hg backout --parent 0 4
356 356 abort: cb9a9f314b8b is not a parent of b2f3bb92043e
357 357 [255]
358 358
359 359 backout of non-merge with parent should fail
360 360
361 361 $ hg backout --parent 0 3
362 362 abort: cannot use --parent on non-merge changeset
363 363 [255]
364 364
365 365 backout with valid parent should be ok
366 366
367 367 $ hg backout -d '5 0' --parent 2 4 --tool=true
368 368 removing d
369 369 changeset 5:10e5328c8435 backs out changeset 4:b2f3bb92043e
370 370 $ hg summary
371 371 parent: 5:10e5328c8435 tip
372 372 Backed out changeset b2f3bb92043e
373 373 branch: default
374 374 commit: (clean)
375 375 update: (current)
376 376 phases: 6 draft
377 377
378 378 $ hg rollback
379 379 repository tip rolled back to revision 4 (undo commit)
380 380 working directory now based on revision 4
381 381 $ hg update -C
382 382 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
383 383 $ hg summary
384 384 parent: 4:b2f3bb92043e tip
385 385 d
386 386 branch: default
387 387 commit: (clean)
388 388 update: (current)
389 389 phases: 5 draft
390 390
391 391 $ hg backout -d '6 0' --parent 3 4 --tool=true
392 392 removing c
393 393 changeset 5:033590168430 backs out changeset 4:b2f3bb92043e
394 394 $ hg summary
395 395 parent: 5:033590168430 tip
396 396 Backed out changeset b2f3bb92043e
397 397 branch: default
398 398 commit: (clean)
399 399 update: (current)
400 400 phases: 6 draft
401 401
402 402 $ cd ..
403 403
404 404 named branches
405 405
406 406 $ hg init named_branches
407 407 $ cd named_branches
408 408
409 409 $ echo default > default
410 410 $ hg ci -d '0 0' -Am default
411 411 adding default
412 412 $ hg branch branch1
413 413 marked working directory as branch branch1
414 414 (branches are permanent and global, did you want a bookmark?)
415 415 $ echo branch1 > file1
416 416 $ hg ci -d '1 0' -Am file1
417 417 adding file1
418 418 $ hg branch branch2
419 419 marked working directory as branch branch2
420 420 $ echo branch2 > file2
421 421 $ hg ci -d '2 0' -Am file2
422 422 adding file2
423 423
424 424 without --merge
425 425 $ hg backout -r 1 --tool=true
426 426 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
427 427 changeset bf1602f437f3 backed out, don't forget to commit.
428 428 $ hg branch
429 429 branch2
430 430 $ hg status -A
431 431 R file1
432 432 C default
433 433 C file2
434 434 $ hg summary
435 435 parent: 2:45bbcd363bf0 tip
436 436 file2
437 437 branch: branch2
438 438 commit: 1 removed
439 439 update: (current)
440 440 phases: 3 draft
441 441
442 442 with --merge
443 443 (this also tests that editor is invoked if '--edit' is specified
444 444 explicitly regardless of '--message')
445 445
446 446 $ hg update -qC
447 447 $ HGEDITOR=cat hg backout --merge -d '3 0' -r 1 -m 'backout on branch1' --tool=true --edit
448 448 removing file1
449 449 backout on branch1
450 450
451 451
452 452 HG: Enter commit message. Lines beginning with 'HG:' are removed.
453 453 HG: Leave message empty to abort commit.
454 454 HG: --
455 455 HG: user: test
456 456 HG: branch 'branch2'
457 457 HG: removed file1
458 458 created new head
459 459 changeset 3:d4e8f6db59fb backs out changeset 1:bf1602f437f3
460 460 merging with changeset 3:d4e8f6db59fb
461 461 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
462 462 (branch merge, don't forget to commit)
463 463 $ hg summary
464 464 parent: 2:45bbcd363bf0
465 465 file2
466 466 parent: 3:d4e8f6db59fb tip
467 467 backout on branch1
468 468 branch: branch2
469 469 commit: 1 removed (merge)
470 470 update: (current)
471 471 phases: 4 draft
472 472 $ hg update -q -C 2
473 473
474 474 on branch2 with branch1 not merged, so file1 should still exist:
475 475
476 476 $ hg id
477 477 45bbcd363bf0 (branch2)
478 478 $ hg st -A
479 479 C default
480 480 C file1
481 481 C file2
482 482 $ hg summary
483 483 parent: 2:45bbcd363bf0
484 484 file2
485 485 branch: branch2
486 486 commit: (clean)
487 487 update: 1 new changesets, 2 branch heads (merge)
488 488 phases: 4 draft
489 489
490 490 on branch2 with branch1 merged, so file1 should be gone:
491 491
492 492 $ hg merge
493 493 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
494 494 (branch merge, don't forget to commit)
495 495 $ hg ci -d '4 0' -m 'merge backout of branch1'
496 496 $ hg id
497 497 22149cdde76d (branch2) tip
498 498 $ hg st -A
499 499 C default
500 500 C file2
501 501 $ hg summary
502 502 parent: 4:22149cdde76d tip
503 503 merge backout of branch1
504 504 branch: branch2
505 505 commit: (clean)
506 506 update: (current)
507 507 phases: 5 draft
508 508
509 509 on branch1, so no file1 and file2:
510 510
511 511 $ hg co -C branch1
512 512 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
513 513 $ hg id
514 514 bf1602f437f3 (branch1)
515 515 $ hg st -A
516 516 C default
517 517 C file1
518 518 $ hg summary
519 519 parent: 1:bf1602f437f3
520 520 file1
521 521 branch: branch1
522 522 commit: (clean)
523 523 update: (current)
524 524 phases: 5 draft
525 525
526 526 $ cd ..
527 527
528 528 backout of empty changeset (issue4190)
529 529
530 530 $ hg init emptycommit
531 531 $ cd emptycommit
532 532
533 533 $ touch file1
534 534 $ hg ci -Aqm file1
535 535 $ hg branch -q branch1
536 536 $ hg ci -qm branch1
537 537 $ hg backout -v 1
538 538 resolving manifests
539 539 nothing changed
540 540 [1]
541 541
542 542 $ cd ..
543 543
544 544
545 545 Test usage of `hg resolve` in case of conflict
546 546 (issue4163)
547 547
548 548 $ hg init issue4163
549 549 $ cd issue4163
550 550 $ touch foo
551 551 $ hg add foo
552 552 $ cat > foo << EOF
553 553 > one
554 554 > two
555 555 > three
556 556 > four
557 557 > five
558 558 > six
559 559 > seven
560 560 > height
561 561 > nine
562 562 > ten
563 563 > EOF
564 564 $ hg ci -m 'initial'
565 565 $ cat > foo << EOF
566 566 > one
567 567 > two
568 568 > THREE
569 569 > four
570 570 > five
571 571 > six
572 572 > seven
573 573 > height
574 574 > nine
575 575 > ten
576 576 > EOF
577 577 $ hg ci -m 'capital three'
578 578 $ cat > foo << EOF
579 579 > one
580 580 > two
581 581 > THREE
582 582 > four
583 583 > five
584 584 > six
585 585 > seven
586 586 > height
587 587 > nine
588 588 > TEN
589 589 > EOF
590 590 $ hg ci -m 'capital ten'
591 591 $ hg backout -r 'desc("capital three")' --tool internal:fail
592 592 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
593 593 use 'hg resolve' to retry unresolved file merges
594 594 [1]
595 595 $ hg status
596 596 $ hg debugmergestate
597 597 * version 2 records
598 598 local: b71750c4b0fdf719734971e3ef90dbeab5919a2d
599 599 other: a30dd8addae3ce71b8667868478542bc417439e6
600 600 file: foo (state "u", hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33)
601 601 local path: foo (flags "")
602 602 ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708)
603 603 other path: foo (node f50039b486d6fa1a90ae51778388cad161f425ee)
604 604 $ mv .hg/merge/state2 .hg/merge/state2-moved
605 605 $ hg debugmergestate
606 606 * version 1 records
607 607 local: b71750c4b0fdf719734971e3ef90dbeab5919a2d
608 608 file: foo (state "u", hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33)
609 609 local path: foo (flags "")
610 610 ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708)
611 611 other path: foo (node not stored in v1 format)
612 612 $ mv .hg/merge/state2-moved .hg/merge/state2
613 613 $ hg resolve -l # still unresolved
614 614 U foo
615 615 $ hg summary
616 616 parent: 2:b71750c4b0fd tip
617 617 capital ten
618 618 branch: default
619 619 commit: 1 unresolved (clean)
620 620 update: (current)
621 621 phases: 3 draft
622 622 $ hg resolve --all --debug
623 picked tool 'internal:merge' for foo (binary False symlink False)
623 picked tool ':merge' for foo (binary False symlink False)
624 624 merging foo
625 625 my foo@b71750c4b0fd+ other foo@a30dd8addae3 ancestor foo@913609522437
626 626 premerge successful
627 627 (no more unresolved files)
628 628 $ hg status
629 629 M foo
630 630 ? foo.orig
631 631 $ hg resolve -l
632 632 R foo
633 633 $ hg summary
634 634 parent: 2:b71750c4b0fd tip
635 635 capital ten
636 636 branch: default
637 637 commit: 1 modified, 1 unknown
638 638 update: (current)
639 639 phases: 3 draft
640 640 $ cat foo
641 641 one
642 642 two
643 643 three
644 644 four
645 645 five
646 646 six
647 647 seven
648 648 height
649 649 nine
650 650 TEN
651 651
652 652
@@ -1,165 +1,165
1 1 $ hg init t
2 2 $ cd t
3 3
4 4 $ echo 1 > a
5 5 $ hg ci -qAm "first"
6 6
7 7 $ hg cp a b
8 8 $ hg mv a c
9 9 $ echo 2 >> b
10 10 $ echo 2 >> c
11 11
12 12 $ hg ci -qAm "second"
13 13
14 14 $ hg co -C 0
15 15 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
16 16
17 17 $ echo 0 > a
18 18 $ echo 1 >> a
19 19
20 20 $ hg ci -qAm "other"
21 21
22 22 $ hg merge --debug
23 23 searching for copies back to rev 1
24 24 unmatched files in other:
25 25 b
26 26 c
27 27 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
28 28 src: 'a' -> dst: 'b' *
29 29 src: 'a' -> dst: 'c' *
30 30 checking for directory renames
31 31 resolving manifests
32 32 branchmerge: True, force: False, partial: False
33 33 ancestor: b8bf91eeebbc, local: add3f11052fa+, remote: 17c05bb7fcb6
34 34 preserving a for resolve of b
35 35 preserving a for resolve of c
36 36 removing a
37 37 b: remote moved from a -> m
38 picked tool 'internal:merge' for b (binary False symlink False)
38 picked tool ':merge' for b (binary False symlink False)
39 39 merging a and b to b
40 40 my b@add3f11052fa+ other b@17c05bb7fcb6 ancestor a@b8bf91eeebbc
41 41 premerge successful
42 42 c: remote moved from a -> m
43 picked tool 'internal:merge' for c (binary False symlink False)
43 picked tool ':merge' for c (binary False symlink False)
44 44 merging a and c to c
45 45 my c@add3f11052fa+ other c@17c05bb7fcb6 ancestor a@b8bf91eeebbc
46 46 premerge successful
47 47 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
48 48 (branch merge, don't forget to commit)
49 49
50 50 file b
51 51 $ cat b
52 52 0
53 53 1
54 54 2
55 55
56 56 file c
57 57 $ cat c
58 58 0
59 59 1
60 60 2
61 61
62 62 Test disabling copy tracing
63 63
64 64 - first verify copy metadata was kept
65 65
66 66 $ hg up -qC 2
67 67 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase=
68 68 rebasing 2:add3f11052fa "other" (tip)
69 69 merging b and a to b
70 70 merging c and a to c
71 71
72 72 $ cat b
73 73 0
74 74 1
75 75 2
76 76
77 77 - next verify copy metadata is lost when disabled
78 78
79 79 $ hg strip -r . --config extensions.strip=
80 80 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 81 saved backup bundle to $TESTTMP/t/.hg/strip-backup/550bd84c0cd3-fc575957-backup.hg (glob)
82 82 $ hg up -qC 2
83 83 $ hg rebase --keep -d 1 -b 2 --config extensions.rebase= --config experimental.disablecopytrace=True
84 84 rebasing 2:add3f11052fa "other" (tip)
85 85 remote changed a which local deleted
86 86 use (c)hanged version or leave (d)eleted? c
87 87
88 88 $ cat b
89 89 1
90 90 2
91 91
92 92 $ cd ..
93 93
94 94 Verify disabling copy tracing still keeps copies from rebase source
95 95
96 96 $ hg init copydisable
97 97 $ cd copydisable
98 98 $ touch a
99 99 $ hg ci -Aqm 'add a'
100 100 $ touch b
101 101 $ hg ci -Aqm 'add b, c'
102 102 $ hg cp b x
103 103 $ echo x >> x
104 104 $ hg ci -qm 'copy b->x'
105 105 $ hg up -q 1
106 106 $ touch z
107 107 $ hg ci -Aqm 'add z'
108 108 $ hg log -G -T '{rev} {desc}\n'
109 109 @ 3 add z
110 110 |
111 111 | o 2 copy b->x
112 112 |/
113 113 o 1 add b, c
114 114 |
115 115 o 0 add a
116 116
117 117 $ hg rebase -d . -b 2 --config extensions.rebase= --config experimental.disablecopytrace=True
118 118 rebasing 2:6adcf8c12e7d "copy b->x"
119 119 saved backup bundle to $TESTTMP/copydisable/.hg/strip-backup/6adcf8c12e7d-ce4b3e75-backup.hg (glob)
120 120 $ hg up -q 3
121 121 $ hg log -f x -T '{rev} {desc}\n'
122 122 3 copy b->x
123 123 1 add b, c
124 124
125 125 $ cd ../
126 126
127 127 Verify we duplicate existing copies, instead of detecting them
128 128
129 129 $ hg init copydisable3
130 130 $ cd copydisable3
131 131 $ touch a
132 132 $ hg ci -Aqm 'add a'
133 133 $ hg cp a b
134 134 $ hg ci -Aqm 'copy a->b'
135 135 $ hg mv b c
136 136 $ hg ci -Aqm 'move b->c'
137 137 $ hg up -q 0
138 138 $ hg cp a b
139 139 $ echo b >> b
140 140 $ hg ci -Aqm 'copy a->b (2)'
141 141 $ hg log -G -T '{rev} {desc}\n'
142 142 @ 3 copy a->b (2)
143 143 |
144 144 | o 2 move b->c
145 145 | |
146 146 | o 1 copy a->b
147 147 |/
148 148 o 0 add a
149 149
150 150 $ hg rebase -d 2 -s 3 --config extensions.rebase= --config experimental.disablecopytrace=True
151 151 rebasing 3:47e1a9e6273b "copy a->b (2)" (tip)
152 152 saved backup bundle to $TESTTMP/copydisable3/.hg/strip-backup/47e1a9e6273b-2d099c59-backup.hg (glob)
153 153
154 154 $ hg log -G -f b
155 155 @ changeset: 3:76024fb4b05b
156 156 | tag: tip
157 157 | user: test
158 158 | date: Thu Jan 01 00:00:00 1970 +0000
159 159 | summary: copy a->b (2)
160 160 |
161 161 o changeset: 0:ac82d8b1f7c4
162 162 user: test
163 163 date: Thu Jan 01 00:00:00 1970 +0000
164 164 summary: add a
165 165
@@ -1,65 +1,65
1 1 $ hg init repo
2 2 $ cd repo
3 3
4 4 $ echo line 1 > foo
5 5 $ hg ci -qAm 'add foo'
6 6
7 7 copy foo to bar and change both files
8 8 $ hg cp foo bar
9 9 $ echo line 2-1 >> foo
10 10 $ echo line 2-2 >> bar
11 11 $ hg ci -m 'cp foo bar; change both'
12 12
13 13 in another branch, change foo in a way that doesn't conflict with
14 14 the other changes
15 15 $ hg up -qC 0
16 16 $ echo line 0 > foo
17 17 $ hg cat foo >> foo
18 18 $ hg ci -m 'change foo'
19 19 created new head
20 20
21 21 we get conflicts that shouldn't be there
22 22 $ hg merge -P
23 23 changeset: 1:484bf6903104
24 24 user: test
25 25 date: Thu Jan 01 00:00:00 1970 +0000
26 26 summary: cp foo bar; change both
27 27
28 28 $ hg merge --debug
29 29 searching for copies back to rev 1
30 30 unmatched files in other:
31 31 bar
32 32 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
33 33 src: 'foo' -> dst: 'bar' *
34 34 checking for directory renames
35 35 resolving manifests
36 36 branchmerge: True, force: False, partial: False
37 37 ancestor: e6dc8efe11cc, local: 6a0df1dad128+, remote: 484bf6903104
38 38 preserving foo for resolve of bar
39 39 preserving foo for resolve of foo
40 40 bar: remote copied from foo -> m
41 picked tool 'internal:merge' for bar (binary False symlink False)
41 picked tool ':merge' for bar (binary False symlink False)
42 42 merging foo and bar to bar
43 43 my bar@6a0df1dad128+ other bar@484bf6903104 ancestor foo@e6dc8efe11cc
44 44 premerge successful
45 45 foo: versions differ -> m
46 picked tool 'internal:merge' for foo (binary False symlink False)
46 picked tool ':merge' for foo (binary False symlink False)
47 47 merging foo
48 48 my foo@6a0df1dad128+ other foo@484bf6903104 ancestor foo@e6dc8efe11cc
49 49 premerge successful
50 50 0 files updated, 2 files merged, 0 files removed, 0 files unresolved
51 51 (branch merge, don't forget to commit)
52 52
53 53 contents of foo
54 54 $ cat foo
55 55 line 0
56 56 line 1
57 57 line 2-1
58 58
59 59 contents of bar
60 60 $ cat bar
61 61 line 0
62 62 line 1
63 63 line 2-2
64 64
65 65 $ cd ..
@@ -1,819 +1,819
1 1 Create a repo with some stuff in it:
2 2
3 3 $ hg init a
4 4 $ cd a
5 5 $ echo a > a
6 6 $ echo a > d
7 7 $ echo a > e
8 8 $ hg ci -qAm0
9 9 $ echo b > a
10 10 $ hg ci -m1 -u bar
11 11 $ hg mv a b
12 12 $ hg ci -m2
13 13 $ hg cp b c
14 14 $ hg ci -m3 -u baz
15 15 $ echo b > d
16 16 $ echo f > e
17 17 $ hg ci -m4
18 18 $ hg up -q 3
19 19 $ echo b > e
20 20 $ hg branch -q stable
21 21 $ hg ci -m5
22 22 $ hg merge -q default --tool internal:local
23 23 $ hg branch -q default
24 24 $ hg ci -m6
25 25 $ hg phase --public 3
26 26 $ hg phase --force --secret 6
27 27
28 28 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
29 29 @ test@6.secret: 6
30 30 |\
31 31 | o test@5.draft: 5
32 32 | |
33 33 o | test@4.draft: 4
34 34 |/
35 35 o baz@3.public: 3
36 36 |
37 37 o test@2.public: 2
38 38 |
39 39 o bar@1.public: 1
40 40 |
41 41 o test@0.public: 0
42 42
43 43
44 44 Need to specify a rev:
45 45
46 46 $ hg graft
47 47 abort: no revisions specified
48 48 [255]
49 49
50 50 Can't graft ancestor:
51 51
52 52 $ hg graft 1 2
53 53 skipping ancestor revision 1:5d205f8b35b6
54 54 skipping ancestor revision 2:5c095ad7e90f
55 55 [255]
56 56
57 57 Specify revisions with -r:
58 58
59 59 $ hg graft -r 1 -r 2
60 60 skipping ancestor revision 1:5d205f8b35b6
61 61 skipping ancestor revision 2:5c095ad7e90f
62 62 [255]
63 63
64 64 $ hg graft -r 1 2
65 65 skipping ancestor revision 2:5c095ad7e90f
66 66 skipping ancestor revision 1:5d205f8b35b6
67 67 [255]
68 68
69 69 Can't graft with dirty wd:
70 70
71 71 $ hg up -q 0
72 72 $ echo foo > a
73 73 $ hg graft 1
74 74 abort: uncommitted changes
75 75 [255]
76 76 $ hg revert a
77 77
78 78 Graft a rename:
79 79 (this also tests that editor is invoked if '--edit' is specified)
80 80
81 81 $ hg status --rev "2^1" --rev 2
82 82 A b
83 83 R a
84 84 $ HGEDITOR=cat hg graft 2 -u foo --edit
85 85 grafting 2:5c095ad7e90f "2"
86 86 merging a and b to b
87 87 2
88 88
89 89
90 90 HG: Enter commit message. Lines beginning with 'HG:' are removed.
91 91 HG: Leave message empty to abort commit.
92 92 HG: --
93 93 HG: user: foo
94 94 HG: branch 'default'
95 95 HG: added b
96 96 HG: removed a
97 97 $ hg export tip --git
98 98 # HG changeset patch
99 99 # User foo
100 100 # Date 0 0
101 101 # Thu Jan 01 00:00:00 1970 +0000
102 102 # Node ID ef0ef43d49e79e81ddafdc7997401ba0041efc82
103 103 # Parent 68795b066622ca79a25816a662041d8f78f3cd9e
104 104 2
105 105
106 106 diff --git a/a b/b
107 107 rename from a
108 108 rename to b
109 109
110 110 Look for extra:source
111 111
112 112 $ hg log --debug -r tip
113 113 changeset: 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
114 114 tag: tip
115 115 phase: draft
116 116 parent: 0:68795b066622ca79a25816a662041d8f78f3cd9e
117 117 parent: -1:0000000000000000000000000000000000000000
118 118 manifest: 7:e59b6b228f9cbf9903d5e9abf996e083a1f533eb
119 119 user: foo
120 120 date: Thu Jan 01 00:00:00 1970 +0000
121 121 files+: b
122 122 files-: a
123 123 extra: branch=default
124 124 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
125 125 description:
126 126 2
127 127
128 128
129 129
130 130 Graft out of order, skipping a merge and a duplicate
131 131 (this also tests that editor is not invoked if '--edit' is not specified)
132 132
133 133 $ hg graft 1 5 4 3 'merge()' 2 -n
134 134 skipping ungraftable merge revision 6
135 135 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
136 136 grafting 1:5d205f8b35b6 "1"
137 137 grafting 5:97f8bfe72746 "5"
138 138 grafting 4:9c233e8e184d "4"
139 139 grafting 3:4c60f11aa304 "3"
140 140
141 141 $ HGEDITOR=cat hg graft 1 5 4 3 'merge()' 2 --debug
142 142 skipping ungraftable merge revision 6
143 143 scanning for duplicate grafts
144 144 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
145 145 grafting 1:5d205f8b35b6 "1"
146 146 searching for copies back to rev 1
147 147 unmatched files in local:
148 148 b
149 149 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
150 150 src: 'a' -> dst: 'b' *
151 151 checking for directory renames
152 152 resolving manifests
153 153 branchmerge: True, force: True, partial: False
154 154 ancestor: 68795b066622, local: ef0ef43d49e7+, remote: 5d205f8b35b6
155 155 preserving b for resolve of b
156 156 b: local copied/moved from a -> m
157 picked tool 'internal:merge' for b (binary False symlink False)
157 picked tool ':merge' for b (binary False symlink False)
158 158 merging b and a to b
159 159 my b@ef0ef43d49e7+ other a@5d205f8b35b6 ancestor a@68795b066622
160 160 premerge successful
161 161 committing files:
162 162 b
163 163 committing manifest
164 164 committing changelog
165 165 grafting 5:97f8bfe72746 "5"
166 166 searching for copies back to rev 1
167 167 resolving manifests
168 168 branchmerge: True, force: True, partial: False
169 169 ancestor: 4c60f11aa304, local: 6b9e5368ca4e+, remote: 97f8bfe72746
170 170 e: remote is newer -> g
171 171 getting e
172 172 b: remote unchanged -> k
173 173 committing files:
174 174 e
175 175 committing manifest
176 176 committing changelog
177 177 grafting 4:9c233e8e184d "4"
178 178 searching for copies back to rev 1
179 179 resolving manifests
180 180 branchmerge: True, force: True, partial: False
181 181 ancestor: 4c60f11aa304, local: 1905859650ec+, remote: 9c233e8e184d
182 182 preserving e for resolve of e
183 183 d: remote is newer -> g
184 184 getting d
185 185 b: remote unchanged -> k
186 186 e: versions differ -> m
187 picked tool 'internal:merge' for e (binary False symlink False)
187 picked tool ':merge' for e (binary False symlink False)
188 188 merging e
189 189 my e@1905859650ec+ other e@9c233e8e184d ancestor e@68795b066622
190 190 warning: conflicts during merge.
191 191 merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
192 192 abort: unresolved conflicts, can't continue
193 193 (use hg resolve and hg graft --continue)
194 194 [255]
195 195
196 196 Commit while interrupted should fail:
197 197
198 198 $ hg ci -m 'commit interrupted graft'
199 199 abort: graft in progress
200 200 (use 'hg graft --continue' or 'hg update' to abort)
201 201 [255]
202 202
203 203 Abort the graft and try committing:
204 204
205 205 $ hg up -C .
206 206 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 207 $ echo c >> e
208 208 $ hg ci -mtest
209 209
210 210 $ hg strip . --config extensions.strip=
211 211 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
212 212 saved backup bundle to $TESTTMP/a/.hg/strip-backup/*-backup.hg (glob)
213 213
214 214 Graft again:
215 215
216 216 $ hg graft 1 5 4 3 'merge()' 2
217 217 skipping ungraftable merge revision 6
218 218 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
219 219 skipping revision 1:5d205f8b35b6 (already grafted to 8:6b9e5368ca4e)
220 220 skipping revision 5:97f8bfe72746 (already grafted to 9:1905859650ec)
221 221 grafting 4:9c233e8e184d "4"
222 222 merging e
223 223 warning: conflicts during merge.
224 224 merging e incomplete! (edit conflicts, then use 'hg resolve --mark')
225 225 abort: unresolved conflicts, can't continue
226 226 (use hg resolve and hg graft --continue)
227 227 [255]
228 228
229 229 Continue without resolve should fail:
230 230
231 231 $ hg graft -c
232 232 grafting 4:9c233e8e184d "4"
233 233 abort: unresolved merge conflicts (see "hg help resolve")
234 234 [255]
235 235
236 236 Fix up:
237 237
238 238 $ echo b > e
239 239 $ hg resolve -m e
240 240 (no more unresolved files)
241 241
242 242 Continue with a revision should fail:
243 243
244 244 $ hg graft -c 6
245 245 abort: can't specify --continue and revisions
246 246 [255]
247 247
248 248 $ hg graft -c -r 6
249 249 abort: can't specify --continue and revisions
250 250 [255]
251 251
252 252 Continue for real, clobber usernames
253 253
254 254 $ hg graft -c -U
255 255 grafting 4:9c233e8e184d "4"
256 256 grafting 3:4c60f11aa304 "3"
257 257
258 258 Compare with original:
259 259
260 260 $ hg diff -r 6
261 261 $ hg status --rev 0:. -C
262 262 M d
263 263 M e
264 264 A b
265 265 a
266 266 A c
267 267 a
268 268 R a
269 269
270 270 View graph:
271 271
272 272 $ hg log -G --template '{author}@{rev}.{phase}: {desc}\n'
273 273 @ test@11.draft: 3
274 274 |
275 275 o test@10.draft: 4
276 276 |
277 277 o test@9.draft: 5
278 278 |
279 279 o bar@8.draft: 1
280 280 |
281 281 o foo@7.draft: 2
282 282 |
283 283 | o test@6.secret: 6
284 284 | |\
285 285 | | o test@5.draft: 5
286 286 | | |
287 287 | o | test@4.draft: 4
288 288 | |/
289 289 | o baz@3.public: 3
290 290 | |
291 291 | o test@2.public: 2
292 292 | |
293 293 | o bar@1.public: 1
294 294 |/
295 295 o test@0.public: 0
296 296
297 297 Graft again onto another branch should preserve the original source
298 298 $ hg up -q 0
299 299 $ echo 'g'>g
300 300 $ hg add g
301 301 $ hg ci -m 7
302 302 created new head
303 303 $ hg graft 7
304 304 grafting 7:ef0ef43d49e7 "2"
305 305
306 306 $ hg log -r 7 --template '{rev}:{node}\n'
307 307 7:ef0ef43d49e79e81ddafdc7997401ba0041efc82
308 308 $ hg log -r 2 --template '{rev}:{node}\n'
309 309 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
310 310
311 311 $ hg log --debug -r tip
312 312 changeset: 13:7a4785234d87ec1aa420ed6b11afe40fa73e12a9
313 313 tag: tip
314 314 phase: draft
315 315 parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
316 316 parent: -1:0000000000000000000000000000000000000000
317 317 manifest: 13:dc313617b8c32457c0d589e0dbbedfe71f3cd637
318 318 user: foo
319 319 date: Thu Jan 01 00:00:00 1970 +0000
320 320 files+: b
321 321 files-: a
322 322 extra: branch=default
323 323 extra: intermediate-source=ef0ef43d49e79e81ddafdc7997401ba0041efc82
324 324 extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
325 325 description:
326 326 2
327 327
328 328
329 329 Disallow grafting an already grafted cset onto its original branch
330 330 $ hg up -q 6
331 331 $ hg graft 7
332 332 skipping already grafted revision 7:ef0ef43d49e7 (was grafted from 2:5c095ad7e90f)
333 333 [255]
334 334
335 335 $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13
336 336 --- */hg-5c095ad7e90f.patch * +0000 (glob)
337 337 +++ */hg-7a4785234d87.patch * +0000 (glob)
338 338 @@ -1,18 +1,18 @@
339 339 # HG changeset patch
340 340 -# User test
341 341 +# User foo
342 342 # Date 0 0
343 343 # Thu Jan 01 00:00:00 1970 +0000
344 344 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
345 345 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
346 346 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
347 347 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
348 348 2
349 349
350 350 -diff -r 5d205f8b35b6 -r 5c095ad7e90f a
351 351 +diff -r b592ea63bb0c -r 7a4785234d87 a
352 352 --- a/a Thu Jan 01 00:00:00 1970 +0000
353 353 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
354 354 @@ -1,1 +0,0 @@
355 355 --b
356 356 -diff -r 5d205f8b35b6 -r 5c095ad7e90f b
357 357 +-a
358 358 +diff -r b592ea63bb0c -r 7a4785234d87 b
359 359 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
360 360 +++ b/b Thu Jan 01 00:00:00 1970 +0000
361 361 @@ -0,0 +1,1 @@
362 362 -+b
363 363 ++a
364 364 [1]
365 365
366 366 $ hg extdiff --config extensions.extdiff= --patch -r 2 -r 13 -X .
367 367 --- */hg-5c095ad7e90f.patch * +0000 (glob)
368 368 +++ */hg-7a4785234d87.patch * +0000 (glob)
369 369 @@ -1,8 +1,8 @@
370 370 # HG changeset patch
371 371 -# User test
372 372 +# User foo
373 373 # Date 0 0
374 374 # Thu Jan 01 00:00:00 1970 +0000
375 375 -# Node ID 5c095ad7e90f871700f02dd1fa5012cb4498a2d4
376 376 -# Parent 5d205f8b35b66bc36375c9534ffd3237730e8f04
377 377 +# Node ID 7a4785234d87ec1aa420ed6b11afe40fa73e12a9
378 378 +# Parent b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
379 379 2
380 380
381 381 [1]
382 382
383 383 Disallow grafting already grafted csets with the same origin onto each other
384 384 $ hg up -q 13
385 385 $ hg graft 2
386 386 skipping revision 2:5c095ad7e90f (already grafted to 13:7a4785234d87)
387 387 [255]
388 388 $ hg graft 7
389 389 skipping already grafted revision 7:ef0ef43d49e7 (13:7a4785234d87 also has origin 2:5c095ad7e90f)
390 390 [255]
391 391
392 392 $ hg up -q 7
393 393 $ hg graft 2
394 394 skipping revision 2:5c095ad7e90f (already grafted to 7:ef0ef43d49e7)
395 395 [255]
396 396 $ hg graft tip
397 397 skipping already grafted revision 13:7a4785234d87 (7:ef0ef43d49e7 also has origin 2:5c095ad7e90f)
398 398 [255]
399 399
400 400 Graft with --log
401 401
402 402 $ hg up -Cq 1
403 403 $ hg graft 3 --log -u foo
404 404 grafting 3:4c60f11aa304 "3"
405 405 warning: can't find ancestor for 'c' copied from 'b'!
406 406 $ hg log --template '{rev} {parents} {desc}\n' -r tip
407 407 14 1:5d205f8b35b6 3
408 408 (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
409 409
410 410 Resolve conflicted graft
411 411 $ hg up -q 0
412 412 $ echo b > a
413 413 $ hg ci -m 8
414 414 created new head
415 415 $ echo c > a
416 416 $ hg ci -m 9
417 417 $ hg graft 1 --tool internal:fail
418 418 grafting 1:5d205f8b35b6 "1"
419 419 abort: unresolved conflicts, can't continue
420 420 (use hg resolve and hg graft --continue)
421 421 [255]
422 422 $ hg resolve --all
423 423 merging a
424 424 warning: conflicts during merge.
425 425 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
426 426 [1]
427 427 $ cat a
428 428 <<<<<<< local: aaa4406d4f0a - test: 9
429 429 c
430 430 =======
431 431 b
432 432 >>>>>>> other: 5d205f8b35b6 - bar: 1
433 433 $ echo b > a
434 434 $ hg resolve -m a
435 435 (no more unresolved files)
436 436 $ hg graft -c
437 437 grafting 1:5d205f8b35b6 "1"
438 438 $ hg export tip --git
439 439 # HG changeset patch
440 440 # User bar
441 441 # Date 0 0
442 442 # Thu Jan 01 00:00:00 1970 +0000
443 443 # Node ID f67661df0c4804d301f064f332b57e7d5ddaf2be
444 444 # Parent aaa4406d4f0ae9befd6e58c82ec63706460cbca6
445 445 1
446 446
447 447 diff --git a/a b/a
448 448 --- a/a
449 449 +++ b/a
450 450 @@ -1,1 +1,1 @@
451 451 -c
452 452 +b
453 453
454 454 Resolve conflicted graft with rename
455 455 $ echo c > a
456 456 $ hg ci -m 10
457 457 $ hg graft 2 --tool internal:fail
458 458 grafting 2:5c095ad7e90f "2"
459 459 abort: unresolved conflicts, can't continue
460 460 (use hg resolve and hg graft --continue)
461 461 [255]
462 462 $ hg resolve --all
463 463 merging a and b to b
464 464 (no more unresolved files)
465 465 $ hg graft -c
466 466 grafting 2:5c095ad7e90f "2"
467 467 $ hg export tip --git
468 468 # HG changeset patch
469 469 # User test
470 470 # Date 0 0
471 471 # Thu Jan 01 00:00:00 1970 +0000
472 472 # Node ID 9627f653b421c61fc1ea4c4e366745070fa3d2bc
473 473 # Parent ee295f490a40b97f3d18dd4c4f1c8936c233b612
474 474 2
475 475
476 476 diff --git a/a b/b
477 477 rename from a
478 478 rename to b
479 479
480 480 Test simple origin(), with and without args
481 481 $ hg log -r 'origin()'
482 482 changeset: 1:5d205f8b35b6
483 483 user: bar
484 484 date: Thu Jan 01 00:00:00 1970 +0000
485 485 summary: 1
486 486
487 487 changeset: 2:5c095ad7e90f
488 488 user: test
489 489 date: Thu Jan 01 00:00:00 1970 +0000
490 490 summary: 2
491 491
492 492 changeset: 3:4c60f11aa304
493 493 user: baz
494 494 date: Thu Jan 01 00:00:00 1970 +0000
495 495 summary: 3
496 496
497 497 changeset: 4:9c233e8e184d
498 498 user: test
499 499 date: Thu Jan 01 00:00:00 1970 +0000
500 500 summary: 4
501 501
502 502 changeset: 5:97f8bfe72746
503 503 branch: stable
504 504 parent: 3:4c60f11aa304
505 505 user: test
506 506 date: Thu Jan 01 00:00:00 1970 +0000
507 507 summary: 5
508 508
509 509 $ hg log -r 'origin(7)'
510 510 changeset: 2:5c095ad7e90f
511 511 user: test
512 512 date: Thu Jan 01 00:00:00 1970 +0000
513 513 summary: 2
514 514
515 515 Now transplant a graft to test following through copies
516 516 $ hg up -q 0
517 517 $ hg branch -q dev
518 518 $ hg ci -qm "dev branch"
519 519 $ hg --config extensions.transplant= transplant -q 7
520 520 $ hg log -r 'origin(.)'
521 521 changeset: 2:5c095ad7e90f
522 522 user: test
523 523 date: Thu Jan 01 00:00:00 1970 +0000
524 524 summary: 2
525 525
526 526 Test that the graft and transplant markers in extra are converted, allowing
527 527 origin() to still work. Note that these recheck the immediately preceeding two
528 528 tests.
529 529 $ hg --quiet --config extensions.convert= --config convert.hg.saverev=True convert . ../converted
530 530
531 531 The graft case
532 532 $ hg -R ../converted log -r 7 --template "{rev}: {node}\n{join(extras, '\n')}\n"
533 533 7: 7ae846e9111fc8f57745634250c7b9ac0a60689b
534 534 branch=default
535 535 convert_revision=ef0ef43d49e79e81ddafdc7997401ba0041efc82
536 536 source=e0213322b2c1a5d5d236c74e79666441bee67a7d
537 537 $ hg -R ../converted log -r 'origin(7)'
538 538 changeset: 2:e0213322b2c1
539 539 user: test
540 540 date: Thu Jan 01 00:00:00 1970 +0000
541 541 summary: 2
542 542
543 543 Test that template correctly expands more than one 'extra' (issue4362), and that
544 544 'intermediate-source' is converted.
545 545 $ hg -R ../converted log -r 13 --template "{extras % ' Extra: {extra}\n'}"
546 546 Extra: branch=default
547 547 Extra: convert_revision=7a4785234d87ec1aa420ed6b11afe40fa73e12a9
548 548 Extra: intermediate-source=7ae846e9111fc8f57745634250c7b9ac0a60689b
549 549 Extra: source=e0213322b2c1a5d5d236c74e79666441bee67a7d
550 550
551 551 The transplant case
552 552 $ hg -R ../converted log -r tip --template "{rev}: {node}\n{join(extras, '\n')}\n"
553 553 21: fbb6c5cc81002f2b4b49c9d731404688bcae5ade
554 554 branch=dev
555 555 convert_revision=7e61b508e709a11d28194a5359bc3532d910af21
556 556 transplant_source=z\xe8F\xe9\x11\x1f\xc8\xf5wEcBP\xc7\xb9\xac (esc)
557 557 `h\x9b (esc)
558 558 $ hg -R ../converted log -r 'origin(tip)'
559 559 changeset: 2:e0213322b2c1
560 560 user: test
561 561 date: Thu Jan 01 00:00:00 1970 +0000
562 562 summary: 2
563 563
564 564
565 565 Test simple destination
566 566 $ hg log -r 'destination()'
567 567 changeset: 7:ef0ef43d49e7
568 568 parent: 0:68795b066622
569 569 user: foo
570 570 date: Thu Jan 01 00:00:00 1970 +0000
571 571 summary: 2
572 572
573 573 changeset: 8:6b9e5368ca4e
574 574 user: bar
575 575 date: Thu Jan 01 00:00:00 1970 +0000
576 576 summary: 1
577 577
578 578 changeset: 9:1905859650ec
579 579 user: test
580 580 date: Thu Jan 01 00:00:00 1970 +0000
581 581 summary: 5
582 582
583 583 changeset: 10:52dc0b4c6907
584 584 user: test
585 585 date: Thu Jan 01 00:00:00 1970 +0000
586 586 summary: 4
587 587
588 588 changeset: 11:882b35362a6b
589 589 user: test
590 590 date: Thu Jan 01 00:00:00 1970 +0000
591 591 summary: 3
592 592
593 593 changeset: 13:7a4785234d87
594 594 user: foo
595 595 date: Thu Jan 01 00:00:00 1970 +0000
596 596 summary: 2
597 597
598 598 changeset: 14:f64defefacee
599 599 parent: 1:5d205f8b35b6
600 600 user: foo
601 601 date: Thu Jan 01 00:00:00 1970 +0000
602 602 summary: 3
603 603
604 604 changeset: 17:f67661df0c48
605 605 user: bar
606 606 date: Thu Jan 01 00:00:00 1970 +0000
607 607 summary: 1
608 608
609 609 changeset: 19:9627f653b421
610 610 user: test
611 611 date: Thu Jan 01 00:00:00 1970 +0000
612 612 summary: 2
613 613
614 614 changeset: 21:7e61b508e709
615 615 branch: dev
616 616 tag: tip
617 617 user: foo
618 618 date: Thu Jan 01 00:00:00 1970 +0000
619 619 summary: 2
620 620
621 621 $ hg log -r 'destination(2)'
622 622 changeset: 7:ef0ef43d49e7
623 623 parent: 0:68795b066622
624 624 user: foo
625 625 date: Thu Jan 01 00:00:00 1970 +0000
626 626 summary: 2
627 627
628 628 changeset: 13:7a4785234d87
629 629 user: foo
630 630 date: Thu Jan 01 00:00:00 1970 +0000
631 631 summary: 2
632 632
633 633 changeset: 19:9627f653b421
634 634 user: test
635 635 date: Thu Jan 01 00:00:00 1970 +0000
636 636 summary: 2
637 637
638 638 changeset: 21:7e61b508e709
639 639 branch: dev
640 640 tag: tip
641 641 user: foo
642 642 date: Thu Jan 01 00:00:00 1970 +0000
643 643 summary: 2
644 644
645 645 Transplants of grafts can find a destination...
646 646 $ hg log -r 'destination(7)'
647 647 changeset: 21:7e61b508e709
648 648 branch: dev
649 649 tag: tip
650 650 user: foo
651 651 date: Thu Jan 01 00:00:00 1970 +0000
652 652 summary: 2
653 653
654 654 ... grafts of grafts unfortunately can't
655 655 $ hg graft -q 13
656 656 warning: can't find ancestor for 'b' copied from 'a'!
657 657 $ hg log -r 'destination(13)'
658 658 All copies of a cset
659 659 $ hg log -r 'origin(13) or destination(origin(13))'
660 660 changeset: 2:5c095ad7e90f
661 661 user: test
662 662 date: Thu Jan 01 00:00:00 1970 +0000
663 663 summary: 2
664 664
665 665 changeset: 7:ef0ef43d49e7
666 666 parent: 0:68795b066622
667 667 user: foo
668 668 date: Thu Jan 01 00:00:00 1970 +0000
669 669 summary: 2
670 670
671 671 changeset: 13:7a4785234d87
672 672 user: foo
673 673 date: Thu Jan 01 00:00:00 1970 +0000
674 674 summary: 2
675 675
676 676 changeset: 19:9627f653b421
677 677 user: test
678 678 date: Thu Jan 01 00:00:00 1970 +0000
679 679 summary: 2
680 680
681 681 changeset: 21:7e61b508e709
682 682 branch: dev
683 683 user: foo
684 684 date: Thu Jan 01 00:00:00 1970 +0000
685 685 summary: 2
686 686
687 687 changeset: 22:d1cb6591fa4b
688 688 branch: dev
689 689 tag: tip
690 690 user: foo
691 691 date: Thu Jan 01 00:00:00 1970 +0000
692 692 summary: 2
693 693
694 694
695 695 graft works on complex revset
696 696
697 697 $ hg graft 'origin(13) or destination(origin(13))'
698 698 skipping ancestor revision 21:7e61b508e709
699 699 skipping ancestor revision 22:d1cb6591fa4b
700 700 skipping revision 2:5c095ad7e90f (already grafted to 22:d1cb6591fa4b)
701 701 grafting 7:ef0ef43d49e7 "2"
702 702 warning: can't find ancestor for 'b' copied from 'a'!
703 703 grafting 13:7a4785234d87 "2"
704 704 warning: can't find ancestor for 'b' copied from 'a'!
705 705 grafting 19:9627f653b421 "2"
706 706 merging b
707 707 warning: can't find ancestor for 'b' copied from 'a'!
708 708
709 709 graft with --force (still doesn't graft merges)
710 710
711 711 $ hg graft 19 0 6
712 712 skipping ungraftable merge revision 6
713 713 skipping ancestor revision 0:68795b066622
714 714 skipping already grafted revision 19:9627f653b421 (22:d1cb6591fa4b also has origin 2:5c095ad7e90f)
715 715 [255]
716 716 $ hg graft 19 0 6 --force
717 717 skipping ungraftable merge revision 6
718 718 grafting 19:9627f653b421 "2"
719 719 merging b
720 720 warning: can't find ancestor for 'b' copied from 'a'!
721 721 grafting 0:68795b066622 "0"
722 722
723 723 graft --force after backout
724 724
725 725 $ echo abc > a
726 726 $ hg ci -m 28
727 727 $ hg backout 28
728 728 reverting a
729 729 changeset 29:53177ba928f6 backs out changeset 28:50a516bb8b57
730 730 $ hg graft 28
731 731 skipping ancestor revision 28:50a516bb8b57
732 732 [255]
733 733 $ hg graft 28 --force
734 734 grafting 28:50a516bb8b57 "28"
735 735 merging a
736 736 $ cat a
737 737 abc
738 738
739 739 graft --continue after --force
740 740
741 741 $ echo def > a
742 742 $ hg ci -m 31
743 743 $ hg graft 28 --force --tool internal:fail
744 744 grafting 28:50a516bb8b57 "28"
745 745 abort: unresolved conflicts, can't continue
746 746 (use hg resolve and hg graft --continue)
747 747 [255]
748 748 $ hg resolve --all
749 749 merging a
750 750 warning: conflicts during merge.
751 751 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
752 752 [1]
753 753 $ echo abc > a
754 754 $ hg resolve -m a
755 755 (no more unresolved files)
756 756 $ hg graft -c
757 757 grafting 28:50a516bb8b57 "28"
758 758 $ cat a
759 759 abc
760 760
761 761 Continue testing same origin policy, using revision numbers from test above
762 762 but do some destructive editing of the repo:
763 763
764 764 $ hg up -qC 7
765 765 $ hg tag -l -r 13 tmp
766 766 $ hg --config extensions.strip= strip 2
767 767 saved backup bundle to $TESTTMP/a/.hg/strip-backup/5c095ad7e90f-d323a1e4-backup.hg (glob)
768 768 $ hg graft tmp
769 769 skipping already grafted revision 8:7a4785234d87 (2:ef0ef43d49e7 also has unknown origin 5c095ad7e90f)
770 770 [255]
771 771
772 772 Empty graft
773 773
774 774 $ hg up -qr 26
775 775 $ hg tag -f something
776 776 $ hg graft -qr 27
777 777 $ hg graft -f 27
778 778 grafting 27:ed6c7e54e319 "28"
779 779 note: graft of 27:ed6c7e54e319 created no changes to commit
780 780
781 781 $ cd ..
782 782
783 783 Graft to duplicate a commit
784 784
785 785 $ hg init graftsibling
786 786 $ cd graftsibling
787 787 $ touch a
788 788 $ hg commit -qAm a
789 789 $ touch b
790 790 $ hg commit -qAm b
791 791 $ hg log -G -T '{rev}\n'
792 792 @ 1
793 793 |
794 794 o 0
795 795
796 796 $ hg up -q 0
797 797 $ hg graft -r 1
798 798 grafting 1:0e067c57feba "b" (tip)
799 799 $ hg log -G -T '{rev}\n'
800 800 @ 2
801 801 |
802 802 | o 1
803 803 |/
804 804 o 0
805 805
806 806 Graft to duplicate a commit twice
807 807
808 808 $ hg up -q 0
809 809 $ hg graft -r 2
810 810 grafting 2:044ec77f6389 "b" (tip)
811 811 $ hg log -G -T '{rev}\n'
812 812 @ 3
813 813 |
814 814 | o 2
815 815 |/
816 816 | o 1
817 817 |/
818 818 o 0
819 819
@@ -1,98 +1,98
1 1 https://bz.mercurial-scm.org/672
2 2
3 3 # 0-2-4
4 4 # \ \ \
5 5 # 1-3-5
6 6 #
7 7 # rename in #1, content change in #4.
8 8
9 9 $ hg init
10 10
11 11 $ touch 1
12 12 $ touch 2
13 13 $ hg commit -Am init # 0
14 14 adding 1
15 15 adding 2
16 16
17 17 $ hg rename 1 1a
18 18 $ hg commit -m rename # 1
19 19
20 20 $ hg co -C 0
21 21 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
22 22
23 23 $ echo unrelated >> 2
24 24 $ hg ci -m unrelated1 # 2
25 25 created new head
26 26
27 27 $ hg merge --debug 1
28 28 searching for copies back to rev 1
29 29 unmatched files in other:
30 30 1a
31 31 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
32 32 src: '1' -> dst: '1a'
33 33 checking for directory renames
34 34 resolving manifests
35 35 branchmerge: True, force: False, partial: False
36 36 ancestor: 81f4b099af3d, local: c64f439569a9+, remote: c12dcd37c90a
37 37 1: other deleted -> r
38 38 removing 1
39 39 1a: remote created -> g
40 40 getting 1a
41 41 2: remote unchanged -> k
42 42 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
43 43 (branch merge, don't forget to commit)
44 44
45 45 $ hg ci -m merge1 # 3
46 46
47 47 $ hg co -C 2
48 48 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
49 49
50 50 $ echo hello >> 1
51 51 $ hg ci -m unrelated2 # 4
52 52 created new head
53 53
54 54 $ hg co -C 3
55 55 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
56 56
57 57 $ hg merge -y --debug 4
58 58 searching for copies back to rev 1
59 59 unmatched files in local:
60 60 1a
61 61 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
62 62 src: '1' -> dst: '1a' *
63 63 checking for directory renames
64 64 resolving manifests
65 65 branchmerge: True, force: False, partial: False
66 66 ancestor: c64f439569a9, local: e327dca35ac8+, remote: 746e9549ea96
67 67 preserving 1a for resolve of 1a
68 68 1a: local copied/moved from 1 -> m
69 picked tool 'internal:merge' for 1a (binary False symlink False)
69 picked tool ':merge' for 1a (binary False symlink False)
70 70 merging 1a and 1 to 1a
71 71 my 1a@e327dca35ac8+ other 1@746e9549ea96 ancestor 1@81f4b099af3d
72 72 premerge successful
73 73 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
74 74 (branch merge, don't forget to commit)
75 75
76 76 $ hg co -C 4
77 77 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
78 78
79 79 $ hg merge -y --debug 3
80 80 searching for copies back to rev 1
81 81 unmatched files in other:
82 82 1a
83 83 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
84 84 src: '1' -> dst: '1a' *
85 85 checking for directory renames
86 86 resolving manifests
87 87 branchmerge: True, force: False, partial: False
88 88 ancestor: c64f439569a9, local: 746e9549ea96+, remote: e327dca35ac8
89 89 preserving 1 for resolve of 1a
90 90 removing 1
91 91 1a: remote moved from 1 -> m
92 picked tool 'internal:merge' for 1a (binary False symlink False)
92 picked tool ':merge' for 1a (binary False symlink False)
93 93 merging 1 and 1a to 1a
94 94 my 1a@746e9549ea96+ other 1a@e327dca35ac8 ancestor 1@81f4b099af3d
95 95 premerge successful
96 96 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
97 97 (branch merge, don't forget to commit)
98 98
@@ -1,182 +1,182
1 1 Check that renames are correctly saved by a commit after a merge
2 2
3 3 Test with the merge on 3 having the rename on the local parent
4 4
5 5 $ hg init a
6 6 $ cd a
7 7
8 8 $ echo line1 > foo
9 9 $ hg add foo
10 10 $ hg ci -m '0: add foo'
11 11
12 12 $ echo line2 >> foo
13 13 $ hg ci -m '1: change foo'
14 14
15 15 $ hg up -C 0
16 16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 17
18 18 $ hg mv foo bar
19 19 $ rm bar
20 20 $ echo line0 > bar
21 21 $ echo line1 >> bar
22 22 $ hg ci -m '2: mv foo bar; change bar'
23 23 created new head
24 24
25 25 $ hg merge 1
26 26 merging bar and foo to bar
27 27 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
28 28 (branch merge, don't forget to commit)
29 29
30 30 $ cat bar
31 31 line0
32 32 line1
33 33 line2
34 34
35 35 $ hg ci -m '3: merge with local rename'
36 36
37 37 $ hg debugindex bar
38 38 rev offset length ..... linkrev nodeid p1 p2 (re)
39 39 0 0 77 ..... 2 d35118874825 000000000000 000000000000 (re)
40 40 1 77 76 ..... 3 5345f5ab8abd 000000000000 d35118874825 (re)
41 41
42 42 $ hg debugrename bar
43 43 bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
44 44
45 45 $ hg debugindex foo
46 46 rev offset length ..... linkrev nodeid p1 p2 (re)
47 47 0 0 7 ..... 0 690b295714ae 000000000000 000000000000 (re)
48 48 1 7 13 ..... 1 9e25c27b8757 690b295714ae 000000000000 (re)
49 49
50 50
51 51 Revert the content change from rev 2:
52 52
53 53 $ hg up -C 2
54 54 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 55 $ rm bar
56 56 $ echo line1 > bar
57 57 $ hg ci -m '4: revert content change from rev 2'
58 58 created new head
59 59
60 60 $ hg log --template '{rev}:{node|short} {parents}\n'
61 61 4:2263c1be0967 2:0f2ff26688b9
62 62 3:0555950ead28 2:0f2ff26688b9 1:5cd961e4045d
63 63 2:0f2ff26688b9 0:2665aaee66e9
64 64 1:5cd961e4045d
65 65 0:2665aaee66e9
66 66
67 67 This should use bar@rev2 as the ancestor:
68 68
69 69 $ hg --debug merge 3
70 70 searching for copies back to rev 1
71 71 resolving manifests
72 72 branchmerge: True, force: False, partial: False
73 73 ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 0555950ead28
74 74 preserving bar for resolve of bar
75 75 bar: versions differ -> m
76 picked tool 'internal:merge' for bar (binary False symlink False)
76 picked tool ':merge' for bar (binary False symlink False)
77 77 merging bar
78 78 my bar@2263c1be0967+ other bar@0555950ead28 ancestor bar@0f2ff26688b9
79 79 premerge successful
80 80 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
81 81 (branch merge, don't forget to commit)
82 82
83 83 $ cat bar
84 84 line1
85 85 line2
86 86
87 87 $ hg ci -m '5: merge'
88 88
89 89 $ hg debugindex bar
90 90 rev offset length ..... linkrev nodeid p1 p2 (re)
91 91 0 0 77 ..... 2 d35118874825 000000000000 000000000000 (re)
92 92 1 77 76 ..... 3 5345f5ab8abd 000000000000 d35118874825 (re)
93 93 2 153 7 ..... 4 ff4b45017382 d35118874825 000000000000 (re)
94 94 3 160 13 ..... 5 3701b4893544 ff4b45017382 5345f5ab8abd (re)
95 95
96 96
97 97 Same thing, but with the merge on 3 having the rename
98 98 on the remote parent:
99 99
100 100 $ cd ..
101 101 $ hg clone -U -r 1 -r 2 a b
102 102 adding changesets
103 103 adding manifests
104 104 adding file changes
105 105 added 3 changesets with 3 changes to 2 files (+1 heads)
106 106 $ cd b
107 107
108 108 $ hg up -C 1
109 109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
110 110
111 111 $ hg merge 2
112 112 merging foo and bar to bar
113 113 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
114 114 (branch merge, don't forget to commit)
115 115
116 116 $ cat bar
117 117 line0
118 118 line1
119 119 line2
120 120
121 121 $ hg ci -m '3: merge with remote rename'
122 122
123 123 $ hg debugindex bar
124 124 rev offset length ..... linkrev nodeid p1 p2 (re)
125 125 0 0 77 ..... 2 d35118874825 000000000000 000000000000 (re)
126 126 1 77 76 ..... 3 5345f5ab8abd 000000000000 d35118874825 (re)
127 127
128 128 $ hg debugrename bar
129 129 bar renamed from foo:9e25c27b87571a1edee5ae4dddee5687746cc8e2
130 130
131 131 $ hg debugindex foo
132 132 rev offset length ..... linkrev nodeid p1 p2 (re)
133 133 0 0 7 ..... 0 690b295714ae 000000000000 000000000000 (re)
134 134 1 7 13 ..... 1 9e25c27b8757 690b295714ae 000000000000 (re)
135 135
136 136
137 137 Revert the content change from rev 2:
138 138
139 139 $ hg up -C 2
140 140 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
141 141 $ rm bar
142 142 $ echo line1 > bar
143 143 $ hg ci -m '4: revert content change from rev 2'
144 144 created new head
145 145
146 146 $ hg log --template '{rev}:{node|short} {parents}\n'
147 147 4:2263c1be0967 2:0f2ff26688b9
148 148 3:3ffa6b9e35f0 1:5cd961e4045d 2:0f2ff26688b9
149 149 2:0f2ff26688b9 0:2665aaee66e9
150 150 1:5cd961e4045d
151 151 0:2665aaee66e9
152 152
153 153 This should use bar@rev2 as the ancestor:
154 154
155 155 $ hg --debug merge 3
156 156 searching for copies back to rev 1
157 157 resolving manifests
158 158 branchmerge: True, force: False, partial: False
159 159 ancestor: 0f2ff26688b9, local: 2263c1be0967+, remote: 3ffa6b9e35f0
160 160 preserving bar for resolve of bar
161 161 bar: versions differ -> m
162 picked tool 'internal:merge' for bar (binary False symlink False)
162 picked tool ':merge' for bar (binary False symlink False)
163 163 merging bar
164 164 my bar@2263c1be0967+ other bar@3ffa6b9e35f0 ancestor bar@0f2ff26688b9
165 165 premerge successful
166 166 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
167 167 (branch merge, don't forget to commit)
168 168
169 169 $ cat bar
170 170 line1
171 171 line2
172 172
173 173 $ hg ci -m '5: merge'
174 174
175 175 $ hg debugindex bar
176 176 rev offset length ..... linkrev nodeid p1 p2 (re)
177 177 0 0 77 ..... 2 d35118874825 000000000000 000000000000 (re)
178 178 1 77 76 ..... 3 5345f5ab8abd 000000000000 d35118874825 (re)
179 179 2 153 7 ..... 4 ff4b45017382 d35118874825 000000000000 (re)
180 180 3 160 13 ..... 5 3701b4893544 ff4b45017382 5345f5ab8abd (re)
181 181
182 182 $ cd ..
@@ -1,349 +1,349
1 1 Criss cross merging
2 2
3 3 $ hg init criss-cross
4 4 $ cd criss-cross
5 5 $ echo '0 base' > f1
6 6 $ echo '0 base' > f2
7 7 $ hg ci -Aqm '0 base'
8 8
9 9 $ echo '1 first change' > f1
10 10 $ hg ci -m '1 first change f1'
11 11
12 12 $ hg up -qr0
13 13 $ echo '2 first change' > f2
14 14 $ hg ci -qm '2 first change f2'
15 15
16 16 $ hg merge -qr 1
17 17 $ hg ci -m '3 merge'
18 18
19 19 $ hg up -qr2
20 20 $ hg merge -qr1
21 21 $ hg ci -qm '4 merge'
22 22
23 23 $ echo '5 second change' > f1
24 24 $ hg ci -m '5 second change f1'
25 25
26 26 $ hg up -r3
27 27 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
28 28 $ echo '6 second change' > f2
29 29 $ hg ci -m '6 second change f2'
30 30
31 31 $ hg log -G
32 32 @ changeset: 6:3b08d01b0ab5
33 33 | tag: tip
34 34 | parent: 3:cf89f02107e5
35 35 | user: test
36 36 | date: Thu Jan 01 00:00:00 1970 +0000
37 37 | summary: 6 second change f2
38 38 |
39 39 | o changeset: 5:adfe50279922
40 40 | | user: test
41 41 | | date: Thu Jan 01 00:00:00 1970 +0000
42 42 | | summary: 5 second change f1
43 43 | |
44 44 | o changeset: 4:7d3e55501ae6
45 45 | |\ parent: 2:40663881a6dd
46 46 | | | parent: 1:0f6b37dbe527
47 47 | | | user: test
48 48 | | | date: Thu Jan 01 00:00:00 1970 +0000
49 49 | | | summary: 4 merge
50 50 | | |
51 51 o---+ changeset: 3:cf89f02107e5
52 52 | | | parent: 2:40663881a6dd
53 53 |/ / parent: 1:0f6b37dbe527
54 54 | | user: test
55 55 | | date: Thu Jan 01 00:00:00 1970 +0000
56 56 | | summary: 3 merge
57 57 | |
58 58 | o changeset: 2:40663881a6dd
59 59 | | parent: 0:40494bf2444c
60 60 | | user: test
61 61 | | date: Thu Jan 01 00:00:00 1970 +0000
62 62 | | summary: 2 first change f2
63 63 | |
64 64 o | changeset: 1:0f6b37dbe527
65 65 |/ user: test
66 66 | date: Thu Jan 01 00:00:00 1970 +0000
67 67 | summary: 1 first change f1
68 68 |
69 69 o changeset: 0:40494bf2444c
70 70 user: test
71 71 date: Thu Jan 01 00:00:00 1970 +0000
72 72 summary: 0 base
73 73
74 74
75 75 $ hg merge -v --debug --tool internal:dump 5 --config merge.preferancestor='!'
76 76 note: using 0f6b37dbe527 as ancestor of 3b08d01b0ab5 and adfe50279922
77 77 alternatively, use --config merge.preferancestor=40663881a6dd
78 78 searching for copies back to rev 3
79 79 resolving manifests
80 80 branchmerge: True, force: False, partial: False
81 81 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
82 82 preserving f2 for resolve of f2
83 83 f1: remote is newer -> g
84 84 getting f1
85 85 f2: versions differ -> m
86 picked tool 'internal:dump' for f2 (binary False symlink False)
86 picked tool ':dump' for f2 (binary False symlink False)
87 87 merging f2
88 88 my f2@3b08d01b0ab5+ other f2@adfe50279922 ancestor f2@40494bf2444c
89 89 1 files updated, 0 files merged, 0 files removed, 1 files unresolved
90 90 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
91 91 [1]
92 92
93 93 $ head *
94 94 ==> f1 <==
95 95 5 second change
96 96
97 97 ==> f2 <==
98 98 6 second change
99 99
100 100 ==> f2.base <==
101 101 0 base
102 102
103 103 ==> f2.local <==
104 104 6 second change
105 105
106 106 ==> f2.orig <==
107 107 6 second change
108 108
109 109 ==> f2.other <==
110 110 2 first change
111 111
112 112 $ hg up -qC .
113 113 $ hg merge -v --tool internal:dump 5 --config merge.preferancestor="null 40663881 3b08d"
114 114 note: using 40663881a6dd as ancestor of 3b08d01b0ab5 and adfe50279922
115 115 alternatively, use --config merge.preferancestor=0f6b37dbe527
116 116 resolving manifests
117 117 merging f1
118 118 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
119 119 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
120 120 [1]
121 121
122 122 Redo merge with merge.preferancestor="*" to enable bid merge
123 123
124 124 $ rm f*
125 125 $ hg up -qC .
126 126 $ hg merge -v --debug --tool internal:dump 5 --config merge.preferancestor="*"
127 127 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
128 128
129 129 calculating bids for ancestor 0f6b37dbe527
130 130 searching for copies back to rev 3
131 131 resolving manifests
132 132 branchmerge: True, force: False, partial: False
133 133 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
134 134 f1: remote is newer -> g
135 135 f2: versions differ -> m
136 136
137 137 calculating bids for ancestor 40663881a6dd
138 138 searching for copies back to rev 3
139 139 resolving manifests
140 140 branchmerge: True, force: False, partial: False
141 141 ancestor: 40663881a6dd, local: 3b08d01b0ab5+, remote: adfe50279922
142 142 f1: versions differ -> m
143 143 f2: remote unchanged -> k
144 144
145 145 auction for merging merge bids
146 146 f1: picking 'get' action
147 147 f2: picking 'keep' action
148 148 end of auction
149 149
150 150 f1: remote is newer -> g
151 151 getting f1
152 152 f2: remote unchanged -> k
153 153 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
154 154 (branch merge, don't forget to commit)
155 155
156 156 $ head *
157 157 ==> f1 <==
158 158 5 second change
159 159
160 160 ==> f2 <==
161 161 6 second change
162 162
163 163
164 164 The other way around:
165 165
166 166 $ hg up -C -r5
167 167 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
168 168 $ hg merge -v --debug --config merge.preferancestor="*"
169 169 note: merging adfe50279922+ and 3b08d01b0ab5 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
170 170
171 171 calculating bids for ancestor 0f6b37dbe527
172 172 searching for copies back to rev 3
173 173 resolving manifests
174 174 branchmerge: True, force: False, partial: False
175 175 ancestor: 0f6b37dbe527, local: adfe50279922+, remote: 3b08d01b0ab5
176 176 f1: remote unchanged -> k
177 177 f2: versions differ -> m
178 178
179 179 calculating bids for ancestor 40663881a6dd
180 180 searching for copies back to rev 3
181 181 resolving manifests
182 182 branchmerge: True, force: False, partial: False
183 183 ancestor: 40663881a6dd, local: adfe50279922+, remote: 3b08d01b0ab5
184 184 f1: versions differ -> m
185 185 f2: remote is newer -> g
186 186
187 187 auction for merging merge bids
188 188 f1: picking 'keep' action
189 189 f2: picking 'get' action
190 190 end of auction
191 191
192 192 f2: remote is newer -> g
193 193 getting f2
194 194 f1: remote unchanged -> k
195 195 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
196 196 (branch merge, don't forget to commit)
197 197
198 198 $ head *
199 199 ==> f1 <==
200 200 5 second change
201 201
202 202 ==> f2 <==
203 203 6 second change
204 204
205 205 Verify how the output looks and and how verbose it is:
206 206
207 207 $ hg up -qC
208 208 $ hg merge
209 209 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
210 210 (branch merge, don't forget to commit)
211 211
212 212 $ hg up -qC
213 213 $ hg merge -v
214 214 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
215 215
216 216 calculating bids for ancestor 0f6b37dbe527
217 217 resolving manifests
218 218
219 219 calculating bids for ancestor 40663881a6dd
220 220 resolving manifests
221 221
222 222 auction for merging merge bids
223 223 f1: picking 'get' action
224 224 f2: picking 'keep' action
225 225 end of auction
226 226
227 227 getting f1
228 228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
229 229 (branch merge, don't forget to commit)
230 230
231 231 $ hg up -qC
232 232 $ hg merge -v --debug --config merge.preferancestor="*"
233 233 note: merging 3b08d01b0ab5+ and adfe50279922 using bids from ancestors 0f6b37dbe527 and 40663881a6dd
234 234
235 235 calculating bids for ancestor 0f6b37dbe527
236 236 searching for copies back to rev 3
237 237 resolving manifests
238 238 branchmerge: True, force: False, partial: False
239 239 ancestor: 0f6b37dbe527, local: 3b08d01b0ab5+, remote: adfe50279922
240 240 f1: remote is newer -> g
241 241 f2: versions differ -> m
242 242
243 243 calculating bids for ancestor 40663881a6dd
244 244 searching for copies back to rev 3
245 245 resolving manifests
246 246 branchmerge: True, force: False, partial: False
247 247 ancestor: 40663881a6dd, local: 3b08d01b0ab5+, remote: adfe50279922
248 248 f1: versions differ -> m
249 249 f2: remote unchanged -> k
250 250
251 251 auction for merging merge bids
252 252 f1: picking 'get' action
253 253 f2: picking 'keep' action
254 254 end of auction
255 255
256 256 f1: remote is newer -> g
257 257 getting f1
258 258 f2: remote unchanged -> k
259 259 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
260 260 (branch merge, don't forget to commit)
261 261
262 262 $ cd ..
263 263
264 264 http://stackoverflow.com/questions/9350005/how-do-i-specify-a-merge-base-to-use-in-a-hg-merge/9430810
265 265
266 266 $ hg init ancestor-merging
267 267 $ cd ancestor-merging
268 268 $ echo a > x
269 269 $ hg commit -A -m a x
270 270 $ hg update -q 0
271 271 $ echo b >> x
272 272 $ hg commit -m b
273 273 $ hg update -q 0
274 274 $ echo c >> x
275 275 $ hg commit -qm c
276 276 $ hg update -q 1
277 277 $ hg merge -q --tool internal:local 2
278 278 $ echo c >> x
279 279 $ hg commit -m bc
280 280 $ hg update -q 2
281 281 $ hg merge -q --tool internal:local 1
282 282 $ echo b >> x
283 283 $ hg commit -qm cb
284 284
285 285 $ hg merge --config merge.preferancestor='!'
286 286 note: using 70008a2163f6 as ancestor of 0d355fdef312 and 4b8b546a3eef
287 287 alternatively, use --config merge.preferancestor=b211bbc6eb3c
288 288 merging x
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 $ cat x
292 292 a
293 293 c
294 294 b
295 295 c
296 296
297 297 $ hg up -qC .
298 298
299 299 $ hg merge --config merge.preferancestor=b211bbc6eb3c
300 300 note: using b211bbc6eb3c as ancestor of 0d355fdef312 and 4b8b546a3eef
301 301 alternatively, use --config merge.preferancestor=70008a2163f6
302 302 merging x
303 303 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
304 304 (branch merge, don't forget to commit)
305 305 $ cat x
306 306 a
307 307 b
308 308 c
309 309 b
310 310
311 311 $ hg up -qC .
312 312
313 313 $ hg merge -v --config merge.preferancestor="*"
314 314 note: merging 0d355fdef312+ and 4b8b546a3eef using bids from ancestors 70008a2163f6 and b211bbc6eb3c
315 315
316 316 calculating bids for ancestor 70008a2163f6
317 317 resolving manifests
318 318
319 319 calculating bids for ancestor b211bbc6eb3c
320 320 resolving manifests
321 321
322 322 auction for merging merge bids
323 323 x: multiple bids for merge action:
324 324 versions differ -> m
325 325 versions differ -> m
326 326 x: ambiguous merge - picked m action
327 327 end of auction
328 328
329 329 merging x
330 330 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
331 331 (branch merge, don't forget to commit)
332 332 $ cat x
333 333 a
334 334 c
335 335 b
336 336 c
337 337
338 338 Verify that the old context ancestor works with / despite preferancestor:
339 339
340 340 $ hg log -r 'ancestor(head())' --config merge.preferancestor=1 -T '{rev}\n'
341 341 1
342 342 $ hg log -r 'ancestor(head())' --config merge.preferancestor=2 -T '{rev}\n'
343 343 2
344 344 $ hg log -r 'ancestor(head())' --config merge.preferancestor=3 -T '{rev}\n'
345 345 1
346 346 $ hg log -r 'ancestor(head())' --config merge.preferancestor='1337 * - 2' -T '{rev}\n'
347 347 2
348 348
349 349 $ cd ..
@@ -1,376 +1,376
1 1 #require symlink execbit
2 2
3 3 $ tellmeabout() {
4 4 > if [ -h $1 ]; then
5 5 > echo $1 is a symlink:
6 6 > $TESTDIR/readlink.py $1
7 7 > elif [ -x $1 ]; then
8 8 > echo $1 is an executable file with content:
9 9 > cat $1
10 10 > else
11 11 > echo $1 is a plain file with content:
12 12 > cat $1
13 13 > fi
14 14 > }
15 15
16 16 $ hg init test1
17 17 $ cd test1
18 18
19 19 $ echo a > a
20 20 $ hg ci -Aqmadd
21 21 $ chmod +x a
22 22 $ hg ci -mexecutable
23 23
24 24 $ hg up -q 0
25 25 $ rm a
26 26 $ ln -s symlink a
27 27 $ hg ci -msymlink
28 28 created new head
29 29
30 30 Symlink is local parent, executable is other:
31 31
32 32 $ hg merge --debug
33 33 searching for copies back to rev 1
34 34 resolving manifests
35 35 branchmerge: True, force: False, partial: False
36 36 ancestor: c334dc3be0da, local: 521a1e40188f+, remote: 3574f3e69b1c
37 37 preserving a for resolve of a
38 38 a: versions differ -> m
39 picked tool 'internal:merge' for a (binary False symlink True)
39 picked tool ':merge' for a (binary False symlink True)
40 40 merging a
41 41 my a@521a1e40188f+ other a@3574f3e69b1c ancestor a@c334dc3be0da
42 42 warning: internal :merge cannot merge symlinks for a
43 43 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
44 44 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
45 45 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
46 46 [1]
47 47
48 48 $ tellmeabout a
49 49 a is a symlink:
50 50 a -> symlink
51 51 $ hg resolve a --tool internal:other
52 52 (no more unresolved files)
53 53 $ tellmeabout a
54 54 a is an executable file with content:
55 55 a
56 56 $ hg st
57 57 M a
58 58 ? a.orig
59 59
60 60 Symlink is other parent, executable is local:
61 61
62 62 $ hg update -C 1
63 63 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
64 64
65 65 $ hg merge --debug
66 66 searching for copies back to rev 1
67 67 resolving manifests
68 68 branchmerge: True, force: False, partial: False
69 69 ancestor: c334dc3be0da, local: 3574f3e69b1c+, remote: 521a1e40188f
70 70 preserving a for resolve of a
71 71 a: versions differ -> m
72 picked tool 'internal:merge' for a (binary False symlink True)
72 picked tool ':merge' for a (binary False symlink True)
73 73 merging a
74 74 my a@3574f3e69b1c+ other a@521a1e40188f ancestor a@c334dc3be0da
75 75 warning: internal :merge cannot merge symlinks for a
76 76 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
77 77 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
78 78 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
79 79 [1]
80 80
81 81 $ tellmeabout a
82 82 a is an executable file with content:
83 83 a
84 84
85 85 Update to link without local change should get us a symlink (issue3316):
86 86
87 87 $ hg up -C 0
88 88 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
89 89 $ hg up
90 90 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
91 91 $ hg st
92 92 ? a.orig
93 93
94 94 Update to link with local change should cause a merge prompt (issue3200):
95 95
96 96 $ hg up -Cq 0
97 97 $ echo data > a
98 98 $ HGMERGE= hg up -y --debug
99 99 searching for copies back to rev 2
100 100 resolving manifests
101 101 branchmerge: False, force: False, partial: False
102 102 ancestor: c334dc3be0da, local: c334dc3be0da+, remote: 521a1e40188f
103 103 preserving a for resolve of a
104 104 a: versions differ -> m
105 105 (couldn't find merge tool hgmerge|tool hgmerge can't handle symlinks) (re)
106 106 picked tool ':prompt' for a (binary False symlink True)
107 107 no tool found to merge a
108 108 keep (l)ocal or take (o)ther? l
109 109 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
110 110 $ hg diff --git
111 111 diff --git a/a b/a
112 112 old mode 120000
113 113 new mode 100644
114 114 --- a/a
115 115 +++ b/a
116 116 @@ -1,1 +1,1 @@
117 117 -symlink
118 118 \ No newline at end of file
119 119 +data
120 120
121 121
122 122 Test only 'l' change - happens rarely, except when recovering from situations
123 123 where that was what happened.
124 124
125 125 $ hg init test2
126 126 $ cd test2
127 127 $ printf base > f
128 128 $ hg ci -Aqm0
129 129 $ echo file > f
130 130 $ echo content >> f
131 131 $ hg ci -qm1
132 132 $ hg up -qr0
133 133 $ rm f
134 134 $ ln -s base f
135 135 $ hg ci -qm2
136 136 $ hg merge
137 137 merging f
138 138 warning: internal :merge cannot merge symlinks for f
139 139 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
140 140 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
141 141 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
142 142 [1]
143 143 $ tellmeabout f
144 144 f is a symlink:
145 145 f -> base
146 146
147 147 $ hg up -Cqr1
148 148 $ hg merge
149 149 merging f
150 150 warning: internal :merge cannot merge symlinks for f
151 151 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
152 152 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
153 153 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
154 154 [1]
155 155 $ tellmeabout f
156 156 f is a plain file with content:
157 157 file
158 158 content
159 159
160 160 $ cd ..
161 161
162 162 Test removed 'x' flag merged with change to symlink
163 163
164 164 $ hg init test3
165 165 $ cd test3
166 166 $ echo f > f
167 167 $ chmod +x f
168 168 $ hg ci -Aqm0
169 169 $ chmod -x f
170 170 $ hg ci -qm1
171 171 $ hg up -qr0
172 172 $ rm f
173 173 $ ln -s dangling f
174 174 $ hg ci -qm2
175 175 $ hg merge
176 176 merging f
177 177 warning: internal :merge cannot merge symlinks for f
178 178 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
179 179 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
180 180 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
181 181 [1]
182 182 $ tellmeabout f
183 183 f is a symlink:
184 184 f -> dangling
185 185
186 186 $ hg up -Cqr1
187 187 $ hg merge
188 188 merging f
189 189 warning: internal :merge cannot merge symlinks for f
190 190 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
191 191 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
192 192 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
193 193 [1]
194 194 $ tellmeabout f
195 195 f is a plain file with content:
196 196 f
197 197
198 198 Test removed 'x' flag merged with content change - both ways
199 199
200 200 $ hg up -Cqr0
201 201 $ echo change > f
202 202 $ hg ci -qm3
203 203 $ hg merge -r1
204 204 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
205 205 (branch merge, don't forget to commit)
206 206 $ tellmeabout f
207 207 f is a plain file with content:
208 208 change
209 209
210 210 $ hg up -qCr1
211 211 $ hg merge -r3
212 212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
213 213 (branch merge, don't forget to commit)
214 214 $ tellmeabout f
215 215 f is a plain file with content:
216 216 change
217 217
218 218 $ cd ..
219 219
220 220 Test merge with no common ancestor:
221 221 a: just different
222 222 b: x vs -, different (cannot calculate x, cannot ask merge tool)
223 223 c: x vs -, same (cannot calculate x, merge tool is no good)
224 224 d: x vs l, different
225 225 e: x vs l, same
226 226 f: - vs l, different
227 227 g: - vs l, same
228 228 h: l vs l, different
229 229 (where same means the filelog entry is shared and there thus is an ancestor!)
230 230
231 231 $ hg init test4
232 232 $ cd test4
233 233 $ echo 0 > 0
234 234 $ hg ci -Aqm0
235 235
236 236 $ echo 1 > a
237 237 $ echo 1 > b
238 238 $ chmod +x b
239 239 $ echo x > c
240 240 $ chmod +x c
241 241 $ echo 1 > d
242 242 $ chmod +x d
243 243 $ printf x > e
244 244 $ chmod +x e
245 245 $ echo 1 > f
246 246 $ printf x > g
247 247 $ ln -s 1 h
248 248 $ hg ci -qAm1
249 249
250 250 $ hg up -qr0
251 251 $ echo 2 > a
252 252 $ echo 2 > b
253 253 $ echo x > c
254 254 $ ln -s 2 d
255 255 $ ln -s x e
256 256 $ ln -s 2 f
257 257 $ ln -s x g
258 258 $ ln -s 2 h
259 259 $ hg ci -Aqm2
260 260
261 261 $ hg merge
262 262 merging a
263 263 warning: conflicts during merge.
264 264 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
265 265 warning: cannot merge flags for b
266 266 merging b
267 267 warning: conflicts during merge.
268 268 merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
269 269 warning: cannot merge flags for c
270 270 merging d
271 271 warning: internal :merge cannot merge symlinks for d
272 272 merging d incomplete! (edit conflicts, then use 'hg resolve --mark')
273 273 merging f
274 274 warning: internal :merge cannot merge symlinks for f
275 275 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
276 276 merging h
277 277 warning: internal :merge cannot merge symlinks for h
278 278 merging h incomplete! (edit conflicts, then use 'hg resolve --mark')
279 279 3 files updated, 0 files merged, 0 files removed, 5 files unresolved
280 280 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
281 281 [1]
282 282 $ hg resolve -l
283 283 U a
284 284 U b
285 285 U d
286 286 U f
287 287 U h
288 288 $ tellmeabout a
289 289 a is a plain file with content:
290 290 <<<<<<< local: 0139c5610547 - test: 2
291 291 2
292 292 =======
293 293 1
294 294 >>>>>>> other: 97e29675e796 - test: 1
295 295 $ tellmeabout b
296 296 b is a plain file with content:
297 297 <<<<<<< local: 0139c5610547 - test: 2
298 298 2
299 299 =======
300 300 1
301 301 >>>>>>> other: 97e29675e796 - test: 1
302 302 $ tellmeabout c
303 303 c is a plain file with content:
304 304 x
305 305 $ tellmeabout d
306 306 d is a symlink:
307 307 d -> 2
308 308 $ tellmeabout e
309 309 e is a symlink:
310 310 e -> x
311 311 $ tellmeabout f
312 312 f is a symlink:
313 313 f -> 2
314 314 $ tellmeabout g
315 315 g is a symlink:
316 316 g -> x
317 317 $ tellmeabout h
318 318 h is a symlink:
319 319 h -> 2
320 320
321 321 $ hg up -Cqr1
322 322 $ hg merge
323 323 merging a
324 324 warning: conflicts during merge.
325 325 merging a incomplete! (edit conflicts, then use 'hg resolve --mark')
326 326 warning: cannot merge flags for b
327 327 merging b
328 328 warning: conflicts during merge.
329 329 merging b incomplete! (edit conflicts, then use 'hg resolve --mark')
330 330 warning: cannot merge flags for c
331 331 merging d
332 332 warning: internal :merge cannot merge symlinks for d
333 333 merging d incomplete! (edit conflicts, then use 'hg resolve --mark')
334 334 merging f
335 335 warning: internal :merge cannot merge symlinks for f
336 336 merging f incomplete! (edit conflicts, then use 'hg resolve --mark')
337 337 merging h
338 338 warning: internal :merge cannot merge symlinks for h
339 339 merging h incomplete! (edit conflicts, then use 'hg resolve --mark')
340 340 3 files updated, 0 files merged, 0 files removed, 5 files unresolved
341 341 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
342 342 [1]
343 343 $ tellmeabout a
344 344 a is a plain file with content:
345 345 <<<<<<< local: 97e29675e796 - test: 1
346 346 1
347 347 =======
348 348 2
349 349 >>>>>>> other: 0139c5610547 - test: 2
350 350 $ tellmeabout b
351 351 b is an executable file with content:
352 352 <<<<<<< local: 97e29675e796 - test: 1
353 353 1
354 354 =======
355 355 2
356 356 >>>>>>> other: 0139c5610547 - test: 2
357 357 $ tellmeabout c
358 358 c is an executable file with content:
359 359 x
360 360 $ tellmeabout d
361 361 d is an executable file with content:
362 362 1
363 363 $ tellmeabout e
364 364 e is an executable file with content:
365 365 x (no-eol)
366 366 $ tellmeabout f
367 367 f is a plain file with content:
368 368 1
369 369 $ tellmeabout g
370 370 g is a plain file with content:
371 371 x (no-eol)
372 372 $ tellmeabout h
373 373 h is a symlink:
374 374 h -> 1
375 375
376 376 $ cd ..
@@ -1,147 +1,147
1 1 initial
2 2 $ hg init test-a
3 3 $ cd test-a
4 4 $ cat >test.txt <<"EOF"
5 5 > 1
6 6 > 2
7 7 > 3
8 8 > EOF
9 9 $ hg add test.txt
10 10 $ hg commit -m "Initial"
11 11
12 12 clone
13 13 $ cd ..
14 14 $ hg clone test-a test-b
15 15 updating to branch default
16 16 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
17 17
18 18 change test-a
19 19 $ cd test-a
20 20 $ cat >test.txt <<"EOF"
21 21 > one
22 22 > two
23 23 > three
24 24 > EOF
25 25 $ hg commit -m "Numbers as words"
26 26
27 27 change test-b
28 28 $ cd ../test-b
29 29 $ cat >test.txt <<"EOF"
30 30 > 1
31 31 > 2.5
32 32 > 3
33 33 > EOF
34 34 $ hg commit -m "2 -> 2.5"
35 35
36 36 now pull and merge from test-a
37 37 $ hg pull ../test-a
38 38 pulling from ../test-a
39 39 searching for changes
40 40 adding changesets
41 41 adding manifests
42 42 adding file changes
43 43 added 1 changesets with 1 changes to 1 files (+1 heads)
44 44 (run 'hg heads' to see heads, 'hg merge' to merge)
45 45 $ hg merge
46 46 merging test.txt
47 47 warning: conflicts during merge.
48 48 merging test.txt incomplete! (edit conflicts, then use 'hg resolve --mark')
49 49 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
50 50 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
51 51 [1]
52 52 resolve conflict
53 53 $ cat >test.txt <<"EOF"
54 54 > one
55 55 > two-point-five
56 56 > three
57 57 > EOF
58 58 $ rm -f *.orig
59 59 $ hg resolve -m test.txt
60 60 (no more unresolved files)
61 61 $ hg commit -m "Merge 1"
62 62
63 63 change test-a again
64 64 $ cd ../test-a
65 65 $ cat >test.txt <<"EOF"
66 66 > one
67 67 > two-point-one
68 68 > three
69 69 > EOF
70 70 $ hg commit -m "two -> two-point-one"
71 71
72 72 pull and merge from test-a again
73 73 $ cd ../test-b
74 74 $ hg pull ../test-a
75 75 pulling from ../test-a
76 76 searching for changes
77 77 adding changesets
78 78 adding manifests
79 79 adding file changes
80 80 added 1 changesets with 1 changes to 1 files (+1 heads)
81 81 (run 'hg heads' to see heads, 'hg merge' to merge)
82 82 $ hg merge --debug
83 83 searching for copies back to rev 1
84 84 resolving manifests
85 85 branchmerge: True, force: False, partial: False
86 86 ancestor: 96b70246a118, local: 50c3a7e29886+, remote: 40d11a4173a8
87 87 preserving test.txt for resolve of test.txt
88 88 test.txt: versions differ -> m
89 picked tool 'internal:merge' for test.txt (binary False symlink False)
89 picked tool ':merge' for test.txt (binary False symlink False)
90 90 merging test.txt
91 91 my test.txt@50c3a7e29886+ other test.txt@40d11a4173a8 ancestor test.txt@96b70246a118
92 92 warning: conflicts during merge.
93 93 merging test.txt incomplete! (edit conflicts, then use 'hg resolve --mark')
94 94 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
95 95 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
96 96 [1]
97 97
98 98 $ cat test.txt
99 99 one
100 100 <<<<<<< local: 50c3a7e29886 - test: Merge 1
101 101 two-point-five
102 102 =======
103 103 two-point-one
104 104 >>>>>>> other: 40d11a4173a8 - test: two -> two-point-one
105 105 three
106 106
107 107 $ hg debugindex test.txt
108 108 rev offset length ..... linkrev nodeid p1 p2 (re)
109 109 0 0 7 ..... 0 01365c4cca56 000000000000 000000000000 (re)
110 110 1 7 9 ..... 1 7b013192566a 01365c4cca56 000000000000 (re)
111 111 2 16 15 ..... 2 8fe46a3eb557 01365c4cca56 000000000000 (re)
112 112 3 31 2. ..... 3 fc3148072371 7b013192566a 8fe46a3eb557 (re)
113 113 4 5. 25 ..... 4 d40249267ae3 8fe46a3eb557 000000000000 (re)
114 114
115 115 $ hg log
116 116 changeset: 4:40d11a4173a8
117 117 tag: tip
118 118 parent: 2:96b70246a118
119 119 user: test
120 120 date: Thu Jan 01 00:00:00 1970 +0000
121 121 summary: two -> two-point-one
122 122
123 123 changeset: 3:50c3a7e29886
124 124 parent: 1:d1e159716d41
125 125 parent: 2:96b70246a118
126 126 user: test
127 127 date: Thu Jan 01 00:00:00 1970 +0000
128 128 summary: Merge 1
129 129
130 130 changeset: 2:96b70246a118
131 131 parent: 0:b1832b9d912a
132 132 user: test
133 133 date: Thu Jan 01 00:00:00 1970 +0000
134 134 summary: Numbers as words
135 135
136 136 changeset: 1:d1e159716d41
137 137 user: test
138 138 date: Thu Jan 01 00:00:00 1970 +0000
139 139 summary: 2 -> 2.5
140 140
141 141 changeset: 0:b1832b9d912a
142 142 user: test
143 143 date: Thu Jan 01 00:00:00 1970 +0000
144 144 summary: Initial
145 145
146 146
147 147 $ cd ..
@@ -1,188 +1,188
1 1 $ hg init
2 2
3 3 $ echo "[merge]" >> .hg/hgrc
4 4 $ echo "followcopies = 1" >> .hg/hgrc
5 5
6 6 $ echo foo > a
7 7 $ echo foo > a2
8 8 $ hg add a a2
9 9 $ hg ci -m "start"
10 10
11 11 $ hg mv a b
12 12 $ hg mv a2 b2
13 13 $ hg ci -m "rename"
14 14
15 15 $ hg co 0
16 16 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
17 17
18 18 $ echo blahblah > a
19 19 $ echo blahblah > a2
20 20 $ hg mv a2 c2
21 21 $ hg ci -m "modify"
22 22 created new head
23 23
24 24 $ hg merge -y --debug
25 25 searching for copies back to rev 1
26 26 unmatched files in local:
27 27 c2
28 28 unmatched files in other:
29 29 b
30 30 b2
31 31 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
32 32 src: 'a' -> dst: 'b' *
33 33 src: 'a2' -> dst: 'b2' !
34 34 src: 'a2' -> dst: 'c2' !
35 35 checking for directory renames
36 36 resolving manifests
37 37 branchmerge: True, force: False, partial: False
38 38 ancestor: af1939970a1c, local: 044f8520aeeb+, remote: 85c198ef2f6c
39 39 preserving a for resolve of b
40 40 removing a
41 41 b2: remote created -> g
42 42 getting b2
43 43 b: remote moved from a -> m
44 picked tool 'internal:merge' for b (binary False symlink False)
44 picked tool ':merge' for b (binary False symlink False)
45 45 merging a and b to b
46 46 my b@044f8520aeeb+ other b@85c198ef2f6c ancestor a@af1939970a1c
47 47 premerge successful
48 48 note: possible conflict - a2 was renamed multiple times to:
49 49 c2
50 50 b2
51 51 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
52 52 (branch merge, don't forget to commit)
53 53
54 54 $ hg status -AC
55 55 M b
56 56 a
57 57 M b2
58 58 R a
59 59 C c2
60 60
61 61 $ cat b
62 62 blahblah
63 63
64 64 $ hg ci -m "merge"
65 65
66 66 $ hg debugindex b
67 67 rev offset length ..... linkrev nodeid p1 p2 (re)
68 68 0 0 67 ..... 1 57eacc201a7f 000000000000 000000000000 (re)
69 69 1 67 72 ..... 3 4727ba907962 000000000000 57eacc201a7f (re)
70 70
71 71 $ hg debugrename b
72 72 b renamed from a:dd03b83622e78778b403775d0d074b9ac7387a66
73 73
74 74 This used to trigger a "divergent renames" warning, despite no renames
75 75
76 76 $ hg cp b b3
77 77 $ hg cp b b4
78 78 $ hg ci -A -m 'copy b twice'
79 79 $ hg up eb92d88a9712
80 80 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
81 81 $ hg up
82 82 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 83 $ hg rm b3 b4
84 84 $ hg ci -m 'clean up a bit of our mess'
85 85
86 86 We'd rather not warn on divergent renames done in the same changeset (issue2113)
87 87
88 88 $ hg cp b b3
89 89 $ hg mv b b4
90 90 $ hg ci -A -m 'divergent renames in same changeset'
91 91 $ hg up c761c6948de0
92 92 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
93 93 $ hg up
94 94 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
95 95
96 96 Check for issue2642
97 97
98 98 $ hg init t
99 99 $ cd t
100 100
101 101 $ echo c0 > f1
102 102 $ hg ci -Aqm0
103 103
104 104 $ hg up null -q
105 105 $ echo c1 > f1 # backport
106 106 $ hg ci -Aqm1
107 107 $ hg mv f1 f2
108 108 $ hg ci -qm2
109 109
110 110 $ hg up 0 -q
111 111 $ hg merge 1 -q --tool internal:local
112 112 $ hg ci -qm3
113 113
114 114 $ hg merge 2
115 115 merging f1 and f2 to f2
116 116 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
117 117 (branch merge, don't forget to commit)
118 118
119 119 $ cat f2
120 120 c0
121 121
122 122 $ cd ..
123 123
124 124 Check for issue2089
125 125
126 126 $ hg init repo2089
127 127 $ cd repo2089
128 128
129 129 $ echo c0 > f1
130 130 $ hg ci -Aqm0
131 131
132 132 $ hg up null -q
133 133 $ echo c1 > f1
134 134 $ hg ci -Aqm1
135 135
136 136 $ hg up 0 -q
137 137 $ hg merge 1 -q --tool internal:local
138 138 $ echo c2 > f1
139 139 $ hg ci -qm2
140 140
141 141 $ hg up 1 -q
142 142 $ hg mv f1 f2
143 143 $ hg ci -Aqm3
144 144
145 145 $ hg up 2 -q
146 146 $ hg merge 3
147 147 merging f1 and f2 to f2
148 148 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
149 149 (branch merge, don't forget to commit)
150 150
151 151 $ cat f2
152 152 c2
153 153
154 154 $ cd ..
155 155
156 156 Check for issue3074
157 157
158 158 $ hg init repo3074
159 159 $ cd repo3074
160 160 $ echo foo > file
161 161 $ hg add file
162 162 $ hg commit -m "added file"
163 163 $ hg mv file newfile
164 164 $ hg commit -m "renamed file"
165 165 $ hg update 0
166 166 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
167 167 $ hg rm file
168 168 $ hg commit -m "deleted file"
169 169 created new head
170 170 $ hg merge --debug
171 171 searching for copies back to rev 1
172 172 unmatched files in other:
173 173 newfile
174 174 all copies found (* = to merge, ! = divergent, % = renamed and deleted):
175 175 src: 'file' -> dst: 'newfile' %
176 176 checking for directory renames
177 177 resolving manifests
178 178 branchmerge: True, force: False, partial: False
179 179 ancestor: 19d7f95df299, local: 0084274f6b67+, remote: 5d32493049f0
180 180 newfile: remote created -> g
181 181 getting newfile
182 182 note: possible conflict - file was deleted and renamed to:
183 183 newfile
184 184 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
185 185 (branch merge, don't forget to commit)
186 186 $ hg status
187 187 M newfile
188 188 $ cd ..
@@ -1,1757 +1,1757
1 1 Let commit recurse into subrepos by default to match pre-2.0 behavior:
2 2
3 3 $ echo "[ui]" >> $HGRCPATH
4 4 $ echo "commitsubrepos = Yes" >> $HGRCPATH
5 5
6 6 $ hg init t
7 7 $ cd t
8 8
9 9 first revision, no sub
10 10
11 11 $ echo a > a
12 12 $ hg ci -Am0
13 13 adding a
14 14
15 15 add first sub
16 16
17 17 $ echo s = s > .hgsub
18 18 $ hg add .hgsub
19 19 $ hg init s
20 20 $ echo a > s/a
21 21
22 22 Issue2232: committing a subrepo without .hgsub
23 23
24 24 $ hg ci -mbad s
25 25 abort: can't commit subrepos without .hgsub
26 26 [255]
27 27
28 28 $ hg -R s add s/a
29 29 $ hg files -S
30 30 .hgsub
31 31 a
32 32 s/a (glob)
33 33
34 34 $ hg -R s ci -Ams0
35 35 $ hg sum
36 36 parent: 0:f7b1eb17ad24 tip
37 37 0
38 38 branch: default
39 39 commit: 1 added, 1 subrepos
40 40 update: (current)
41 41 phases: 1 draft
42 42 $ hg ci -m1
43 43
44 44 test handling .hgsubstate "added" explicitly.
45 45
46 46 $ hg parents --template '{node}\n{files}\n'
47 47 7cf8cfea66e410e8e3336508dfeec07b3192de51
48 48 .hgsub .hgsubstate
49 49 $ hg rollback -q
50 50 $ hg add .hgsubstate
51 51 $ hg ci -m1
52 52 $ hg parents --template '{node}\n{files}\n'
53 53 7cf8cfea66e410e8e3336508dfeec07b3192de51
54 54 .hgsub .hgsubstate
55 55
56 56 Revert subrepo and test subrepo fileset keyword:
57 57
58 58 $ echo b > s/a
59 59 $ hg revert --dry-run "set:subrepo('glob:s*')"
60 60 reverting subrepo s
61 61 reverting s/a (glob)
62 62 $ cat s/a
63 63 b
64 64 $ hg revert "set:subrepo('glob:s*')"
65 65 reverting subrepo s
66 66 reverting s/a (glob)
67 67 $ cat s/a
68 68 a
69 69 $ rm s/a.orig
70 70
71 71 Revert subrepo with no backup. The "reverting s/a" line is gone since
72 72 we're really running 'hg update' in the subrepo:
73 73
74 74 $ echo b > s/a
75 75 $ hg revert --no-backup s
76 76 reverting subrepo s
77 77
78 78 Issue2022: update -C
79 79
80 80 $ echo b > s/a
81 81 $ hg sum
82 82 parent: 1:7cf8cfea66e4 tip
83 83 1
84 84 branch: default
85 85 commit: 1 subrepos
86 86 update: (current)
87 87 phases: 2 draft
88 88 $ hg co -C 1
89 89 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 90 $ hg sum
91 91 parent: 1:7cf8cfea66e4 tip
92 92 1
93 93 branch: default
94 94 commit: (clean)
95 95 update: (current)
96 96 phases: 2 draft
97 97
98 98 commands that require a clean repo should respect subrepos
99 99
100 100 $ echo b >> s/a
101 101 $ hg backout tip
102 102 abort: uncommitted changes in subrepository 's'
103 103 [255]
104 104 $ hg revert -C -R s s/a
105 105
106 106 add sub sub
107 107
108 108 $ echo ss = ss > s/.hgsub
109 109 $ hg init s/ss
110 110 $ echo a > s/ss/a
111 111 $ hg -R s add s/.hgsub
112 112 $ hg -R s/ss add s/ss/a
113 113 $ hg sum
114 114 parent: 1:7cf8cfea66e4 tip
115 115 1
116 116 branch: default
117 117 commit: 1 subrepos
118 118 update: (current)
119 119 phases: 2 draft
120 120 $ hg ci -m2
121 121 committing subrepository s
122 122 committing subrepository s/ss (glob)
123 123 $ hg sum
124 124 parent: 2:df30734270ae tip
125 125 2
126 126 branch: default
127 127 commit: (clean)
128 128 update: (current)
129 129 phases: 3 draft
130 130
131 131 test handling .hgsubstate "modified" explicitly.
132 132
133 133 $ hg parents --template '{node}\n{files}\n'
134 134 df30734270ae757feb35e643b7018e818e78a9aa
135 135 .hgsubstate
136 136 $ hg rollback -q
137 137 $ hg status -A .hgsubstate
138 138 M .hgsubstate
139 139 $ hg ci -m2
140 140 $ hg parents --template '{node}\n{files}\n'
141 141 df30734270ae757feb35e643b7018e818e78a9aa
142 142 .hgsubstate
143 143
144 144 bump sub rev (and check it is ignored by ui.commitsubrepos)
145 145
146 146 $ echo b > s/a
147 147 $ hg -R s ci -ms1
148 148 $ hg --config ui.commitsubrepos=no ci -m3
149 149
150 150 leave sub dirty (and check ui.commitsubrepos=no aborts the commit)
151 151
152 152 $ echo c > s/a
153 153 $ hg --config ui.commitsubrepos=no ci -m4
154 154 abort: uncommitted changes in subrepository 's'
155 155 (use --subrepos for recursive commit)
156 156 [255]
157 157 $ hg id
158 158 f6affe3fbfaa+ tip
159 159 $ hg -R s ci -mc
160 160 $ hg id
161 161 f6affe3fbfaa+ tip
162 162 $ echo d > s/a
163 163 $ hg ci -m4
164 164 committing subrepository s
165 165 $ hg tip -R s
166 166 changeset: 4:02dcf1d70411
167 167 tag: tip
168 168 user: test
169 169 date: Thu Jan 01 00:00:00 1970 +0000
170 170 summary: 4
171 171
172 172
173 173 check caching
174 174
175 175 $ hg co 0
176 176 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
177 177 $ hg debugsub
178 178
179 179 restore
180 180
181 181 $ hg co
182 182 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
183 183 $ hg debugsub
184 184 path s
185 185 source s
186 186 revision 02dcf1d704118aee3ee306ccfa1910850d5b05ef
187 187
188 188 new branch for merge tests
189 189
190 190 $ hg co 1
191 191 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
192 192 $ echo t = t >> .hgsub
193 193 $ hg init t
194 194 $ echo t > t/t
195 195 $ hg -R t add t
196 196 adding t/t (glob)
197 197
198 198 5
199 199
200 200 $ hg ci -m5 # add sub
201 201 committing subrepository t
202 202 created new head
203 203 $ echo t2 > t/t
204 204
205 205 6
206 206
207 207 $ hg st -R s
208 208 $ hg ci -m6 # change sub
209 209 committing subrepository t
210 210 $ hg debugsub
211 211 path s
212 212 source s
213 213 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
214 214 path t
215 215 source t
216 216 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
217 217 $ echo t3 > t/t
218 218
219 219 7
220 220
221 221 $ hg ci -m7 # change sub again for conflict test
222 222 committing subrepository t
223 223 $ hg rm .hgsub
224 224
225 225 8
226 226
227 227 $ hg ci -m8 # remove sub
228 228
229 229 test handling .hgsubstate "removed" explicitly.
230 230
231 231 $ hg parents --template '{node}\n{files}\n'
232 232 96615c1dad2dc8e3796d7332c77ce69156f7b78e
233 233 .hgsub .hgsubstate
234 234 $ hg rollback -q
235 235 $ hg remove .hgsubstate
236 236 $ hg ci -m8
237 237 $ hg parents --template '{node}\n{files}\n'
238 238 96615c1dad2dc8e3796d7332c77ce69156f7b78e
239 239 .hgsub .hgsubstate
240 240
241 241 merge tests
242 242
243 243 $ hg co -C 3
244 244 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
245 245 $ hg merge 5 # test adding
246 246 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
247 247 (branch merge, don't forget to commit)
248 248 $ hg debugsub
249 249 path s
250 250 source s
251 251 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
252 252 path t
253 253 source t
254 254 revision 60ca1237c19474e7a3978b0dc1ca4e6f36d51382
255 255 $ hg ci -m9
256 256 created new head
257 257 $ hg merge 6 --debug # test change
258 258 searching for copies back to rev 2
259 259 resolving manifests
260 260 branchmerge: True, force: False, partial: False
261 261 ancestor: 1f14a2e2d3ec, local: f0d2028bf86d+, remote: 1831e14459c4
262 262 .hgsubstate: versions differ -> m
263 263 subrepo merge f0d2028bf86d+ 1831e14459c4 1f14a2e2d3ec
264 264 subrepo t: other changed, get t:6747d179aa9a688023c4b0cad32e4c92bb7f34ad:hg
265 265 getting subrepo t
266 266 resolving manifests
267 267 branchmerge: False, force: False, partial: False
268 268 ancestor: 60ca1237c194, local: 60ca1237c194+, remote: 6747d179aa9a
269 269 t: remote is newer -> g
270 270 getting t
271 271 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
272 272 (branch merge, don't forget to commit)
273 273 $ hg debugsub
274 274 path s
275 275 source s
276 276 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
277 277 path t
278 278 source t
279 279 revision 6747d179aa9a688023c4b0cad32e4c92bb7f34ad
280 280 $ echo conflict > t/t
281 281 $ hg ci -m10
282 282 committing subrepository t
283 283 $ HGMERGE=internal:merge hg merge --debug 7 # test conflict
284 284 searching for copies back to rev 2
285 285 resolving manifests
286 286 branchmerge: True, force: False, partial: False
287 287 ancestor: 1831e14459c4, local: e45c8b14af55+, remote: f94576341bcf
288 288 .hgsubstate: versions differ -> m
289 289 subrepo merge e45c8b14af55+ f94576341bcf 1831e14459c4
290 290 subrepo t: both sides changed
291 291 subrepository t diverged (local revision: 20a0db6fbf6c, remote revision: 7af322bc1198)
292 292 (M)erge, keep (l)ocal or keep (r)emote? m
293 293 merging subrepo t
294 294 searching for copies back to rev 2
295 295 resolving manifests
296 296 branchmerge: True, force: False, partial: False
297 297 ancestor: 6747d179aa9a, local: 20a0db6fbf6c+, remote: 7af322bc1198
298 298 preserving t for resolve of t
299 299 t: versions differ -> m
300 picked tool 'internal:merge' for t (binary False symlink False)
300 picked tool ':merge' for t (binary False symlink False)
301 301 merging t
302 302 my t@20a0db6fbf6c+ other t@7af322bc1198 ancestor t@6747d179aa9a
303 303 warning: conflicts during merge.
304 304 merging t incomplete! (edit conflicts, then use 'hg resolve --mark')
305 305 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
306 306 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
307 307 subrepo t: merge with t:7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4:hg
308 308 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
309 309 (branch merge, don't forget to commit)
310 310
311 311 should conflict
312 312
313 313 $ cat t/t
314 314 <<<<<<< local: 20a0db6fbf6c - test: 10
315 315 conflict
316 316 =======
317 317 t3
318 318 >>>>>>> other: 7af322bc1198 - test: 7
319 319
320 320 11: remove subrepo t
321 321
322 322 $ hg co -C 5
323 323 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
324 324 $ hg revert -r 4 .hgsub # remove t
325 325 $ hg ci -m11
326 326 created new head
327 327 $ hg debugsub
328 328 path s
329 329 source s
330 330 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
331 331
332 332 local removed, remote changed, keep changed
333 333
334 334 $ hg merge 6
335 335 remote changed subrepository t which local removed
336 336 use (c)hanged version or (d)elete? c
337 337 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
338 338 (branch merge, don't forget to commit)
339 339 BROKEN: should include subrepo t
340 340 $ hg debugsub
341 341 path s
342 342 source s
343 343 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
344 344 $ cat .hgsubstate
345 345 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
346 346 6747d179aa9a688023c4b0cad32e4c92bb7f34ad t
347 347 $ hg ci -m 'local removed, remote changed, keep changed'
348 348 BROKEN: should include subrepo t
349 349 $ hg debugsub
350 350 path s
351 351 source s
352 352 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
353 353 BROKEN: should include subrepo t
354 354 $ cat .hgsubstate
355 355 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
356 356 $ cat t/t
357 357 t2
358 358
359 359 local removed, remote changed, keep removed
360 360
361 361 $ hg co -C 11
362 362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 363 $ hg merge --config ui.interactive=true 6 <<EOF
364 364 > d
365 365 > EOF
366 366 remote changed subrepository t which local removed
367 367 use (c)hanged version or (d)elete? d
368 368 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
369 369 (branch merge, don't forget to commit)
370 370 $ hg debugsub
371 371 path s
372 372 source s
373 373 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
374 374 $ cat .hgsubstate
375 375 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
376 376 $ hg ci -m 'local removed, remote changed, keep removed'
377 377 created new head
378 378 $ hg debugsub
379 379 path s
380 380 source s
381 381 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
382 382 $ cat .hgsubstate
383 383 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
384 384
385 385 local changed, remote removed, keep changed
386 386
387 387 $ hg co -C 6
388 388 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 389 $ hg merge 11
390 390 local changed subrepository t which remote removed
391 391 use (c)hanged version or (d)elete? c
392 392 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
393 393 (branch merge, don't forget to commit)
394 394 BROKEN: should include subrepo t
395 395 $ hg debugsub
396 396 path s
397 397 source s
398 398 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
399 399 BROKEN: should include subrepo t
400 400 $ cat .hgsubstate
401 401 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
402 402 $ hg ci -m 'local changed, remote removed, keep changed'
403 403 created new head
404 404 BROKEN: should include subrepo t
405 405 $ hg debugsub
406 406 path s
407 407 source s
408 408 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
409 409 BROKEN: should include subrepo t
410 410 $ cat .hgsubstate
411 411 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
412 412 $ cat t/t
413 413 t2
414 414
415 415 local changed, remote removed, keep removed
416 416
417 417 $ hg co -C 6
418 418 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
419 419 $ hg merge --config ui.interactive=true 11 <<EOF
420 420 > d
421 421 > EOF
422 422 local changed subrepository t which remote removed
423 423 use (c)hanged version or (d)elete? d
424 424 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
425 425 (branch merge, don't forget to commit)
426 426 $ hg debugsub
427 427 path s
428 428 source s
429 429 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
430 430 $ cat .hgsubstate
431 431 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
432 432 $ hg ci -m 'local changed, remote removed, keep removed'
433 433 created new head
434 434 $ hg debugsub
435 435 path s
436 436 source s
437 437 revision e4ece1bf43360ddc8f6a96432201a37b7cd27ae4
438 438 $ cat .hgsubstate
439 439 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
440 440
441 441 clean up to avoid having to fix up the tests below
442 442
443 443 $ hg co -C 10
444 444 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
445 445 $ cat >> $HGRCPATH <<EOF
446 446 > [extensions]
447 447 > strip=
448 448 > EOF
449 449 $ hg strip -r 11:15
450 450 saved backup bundle to $TESTTMP/t/.hg/strip-backup/*-backup.hg (glob)
451 451
452 452 clone
453 453
454 454 $ cd ..
455 455 $ hg clone t tc
456 456 updating to branch default
457 457 cloning subrepo s from $TESTTMP/t/s
458 458 cloning subrepo s/ss from $TESTTMP/t/s/ss (glob)
459 459 cloning subrepo t from $TESTTMP/t/t
460 460 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
461 461 $ cd tc
462 462 $ hg debugsub
463 463 path s
464 464 source s
465 465 revision fc627a69481fcbe5f1135069e8a3881c023e4cf5
466 466 path t
467 467 source t
468 468 revision 20a0db6fbf6c3d2836e6519a642ae929bfc67c0e
469 469
470 470 push
471 471
472 472 $ echo bah > t/t
473 473 $ hg ci -m11
474 474 committing subrepository t
475 475 $ hg push
476 476 pushing to $TESTTMP/t (glob)
477 477 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
478 478 no changes made to subrepo s since last push to $TESTTMP/t/s
479 479 pushing subrepo t to $TESTTMP/t/t
480 480 searching for changes
481 481 adding changesets
482 482 adding manifests
483 483 adding file changes
484 484 added 1 changesets with 1 changes to 1 files
485 485 searching for changes
486 486 adding changesets
487 487 adding manifests
488 488 adding file changes
489 489 added 1 changesets with 1 changes to 1 files
490 490
491 491 push -f
492 492
493 493 $ echo bah > s/a
494 494 $ hg ci -m12
495 495 committing subrepository s
496 496 $ hg push
497 497 pushing to $TESTTMP/t (glob)
498 498 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
499 499 pushing subrepo s to $TESTTMP/t/s
500 500 searching for changes
501 501 abort: push creates new remote head 12a213df6fa9! (in subrepo s)
502 502 (merge or see "hg help push" for details about pushing new heads)
503 503 [255]
504 504 $ hg push -f
505 505 pushing to $TESTTMP/t (glob)
506 506 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
507 507 searching for changes
508 508 no changes found
509 509 pushing subrepo s to $TESTTMP/t/s
510 510 searching for changes
511 511 adding changesets
512 512 adding manifests
513 513 adding file changes
514 514 added 1 changesets with 1 changes to 1 files (+1 heads)
515 515 pushing subrepo t to $TESTTMP/t/t
516 516 searching for changes
517 517 no changes found
518 518 searching for changes
519 519 adding changesets
520 520 adding manifests
521 521 adding file changes
522 522 added 1 changesets with 1 changes to 1 files
523 523
524 524 check that unmodified subrepos are not pushed
525 525
526 526 $ hg clone . ../tcc
527 527 updating to branch default
528 528 cloning subrepo s from $TESTTMP/tc/s
529 529 cloning subrepo s/ss from $TESTTMP/tc/s/ss (glob)
530 530 cloning subrepo t from $TESTTMP/tc/t
531 531 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 532
533 533 the subrepos on the new clone have nothing to push to its source
534 534
535 535 $ hg push -R ../tcc .
536 536 pushing to .
537 537 no changes made to subrepo s/ss since last push to s/ss (glob)
538 538 no changes made to subrepo s since last push to s
539 539 no changes made to subrepo t since last push to t
540 540 searching for changes
541 541 no changes found
542 542 [1]
543 543
544 544 the subrepos on the source do not have a clean store versus the clone target
545 545 because they were never explicitly pushed to the source
546 546
547 547 $ hg push ../tcc
548 548 pushing to ../tcc
549 549 pushing subrepo s/ss to ../tcc/s/ss (glob)
550 550 searching for changes
551 551 no changes found
552 552 pushing subrepo s to ../tcc/s
553 553 searching for changes
554 554 no changes found
555 555 pushing subrepo t to ../tcc/t
556 556 searching for changes
557 557 no changes found
558 558 searching for changes
559 559 no changes found
560 560 [1]
561 561
562 562 after push their stores become clean
563 563
564 564 $ hg push ../tcc
565 565 pushing to ../tcc
566 566 no changes made to subrepo s/ss since last push to ../tcc/s/ss (glob)
567 567 no changes made to subrepo s since last push to ../tcc/s
568 568 no changes made to subrepo t since last push to ../tcc/t
569 569 searching for changes
570 570 no changes found
571 571 [1]
572 572
573 573 updating a subrepo to a different revision or changing
574 574 its working directory does not make its store dirty
575 575
576 576 $ hg -R s update '.^'
577 577 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
578 578 $ hg push
579 579 pushing to $TESTTMP/t (glob)
580 580 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
581 581 no changes made to subrepo s since last push to $TESTTMP/t/s
582 582 no changes made to subrepo t since last push to $TESTTMP/t/t
583 583 searching for changes
584 584 no changes found
585 585 [1]
586 586 $ echo foo >> s/a
587 587 $ hg push
588 588 pushing to $TESTTMP/t (glob)
589 589 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
590 590 no changes made to subrepo s since last push to $TESTTMP/t/s
591 591 no changes made to subrepo t since last push to $TESTTMP/t/t
592 592 searching for changes
593 593 no changes found
594 594 [1]
595 595 $ hg -R s update -C tip
596 596 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
597 597
598 598 committing into a subrepo makes its store (but not its parent's store) dirty
599 599
600 600 $ echo foo >> s/ss/a
601 601 $ hg -R s/ss commit -m 'test dirty store detection'
602 602
603 603 $ hg out -S -r `hg log -r tip -T "{node|short}"`
604 604 comparing with $TESTTMP/t (glob)
605 605 searching for changes
606 606 no changes found
607 607 comparing with $TESTTMP/t/s
608 608 searching for changes
609 609 no changes found
610 610 comparing with $TESTTMP/t/s/ss
611 611 searching for changes
612 612 changeset: 1:79ea5566a333
613 613 tag: tip
614 614 user: test
615 615 date: Thu Jan 01 00:00:00 1970 +0000
616 616 summary: test dirty store detection
617 617
618 618 comparing with $TESTTMP/t/t
619 619 searching for changes
620 620 no changes found
621 621
622 622 $ hg push
623 623 pushing to $TESTTMP/t (glob)
624 624 pushing subrepo s/ss to $TESTTMP/t/s/ss (glob)
625 625 searching for changes
626 626 adding changesets
627 627 adding manifests
628 628 adding file changes
629 629 added 1 changesets with 1 changes to 1 files
630 630 no changes made to subrepo s since last push to $TESTTMP/t/s
631 631 no changes made to subrepo t since last push to $TESTTMP/t/t
632 632 searching for changes
633 633 no changes found
634 634 [1]
635 635
636 636 a subrepo store may be clean versus one repo but not versus another
637 637
638 638 $ hg push
639 639 pushing to $TESTTMP/t (glob)
640 640 no changes made to subrepo s/ss since last push to $TESTTMP/t/s/ss (glob)
641 641 no changes made to subrepo s since last push to $TESTTMP/t/s
642 642 no changes made to subrepo t since last push to $TESTTMP/t/t
643 643 searching for changes
644 644 no changes found
645 645 [1]
646 646 $ hg push ../tcc
647 647 pushing to ../tcc
648 648 pushing subrepo s/ss to ../tcc/s/ss (glob)
649 649 searching for changes
650 650 adding changesets
651 651 adding manifests
652 652 adding file changes
653 653 added 1 changesets with 1 changes to 1 files
654 654 no changes made to subrepo s since last push to ../tcc/s
655 655 no changes made to subrepo t since last push to ../tcc/t
656 656 searching for changes
657 657 no changes found
658 658 [1]
659 659
660 660 update
661 661
662 662 $ cd ../t
663 663 $ hg up -C # discard our earlier merge
664 664 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
665 665 $ echo blah > t/t
666 666 $ hg ci -m13
667 667 committing subrepository t
668 668
669 669 backout calls revert internally with minimal opts, which should not raise
670 670 KeyError
671 671
672 672 $ hg backout ".^"
673 673 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
674 674 changeset c373c8102e68 backed out, don't forget to commit.
675 675
676 676 $ hg up -C # discard changes
677 677 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
678 678
679 679 pull
680 680
681 681 $ cd ../tc
682 682 $ hg pull
683 683 pulling from $TESTTMP/t (glob)
684 684 searching for changes
685 685 adding changesets
686 686 adding manifests
687 687 adding file changes
688 688 added 1 changesets with 1 changes to 1 files
689 689 (run 'hg update' to get a working copy)
690 690
691 691 should pull t
692 692
693 693 $ hg incoming -S -r `hg log -r tip -T "{node|short}"`
694 694 comparing with $TESTTMP/t (glob)
695 695 no changes found
696 696 comparing with $TESTTMP/t/s
697 697 searching for changes
698 698 no changes found
699 699 comparing with $TESTTMP/t/s/ss
700 700 searching for changes
701 701 no changes found
702 702 comparing with $TESTTMP/t/t
703 703 searching for changes
704 704 changeset: 5:52c0adc0515a
705 705 tag: tip
706 706 user: test
707 707 date: Thu Jan 01 00:00:00 1970 +0000
708 708 summary: 13
709 709
710 710
711 711 $ hg up
712 712 pulling subrepo t from $TESTTMP/t/t
713 713 searching for changes
714 714 adding changesets
715 715 adding manifests
716 716 adding file changes
717 717 added 1 changesets with 1 changes to 1 files
718 718 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
719 719 $ cat t/t
720 720 blah
721 721
722 722 bogus subrepo path aborts
723 723
724 724 $ echo 'bogus=[boguspath' >> .hgsub
725 725 $ hg ci -m 'bogus subrepo path'
726 726 abort: missing ] in subrepo source
727 727 [255]
728 728
729 729 Issue1986: merge aborts when trying to merge a subrepo that
730 730 shouldn't need merging
731 731
732 732 # subrepo layout
733 733 #
734 734 # o 5 br
735 735 # /|
736 736 # o | 4 default
737 737 # | |
738 738 # | o 3 br
739 739 # |/|
740 740 # o | 2 default
741 741 # | |
742 742 # | o 1 br
743 743 # |/
744 744 # o 0 default
745 745
746 746 $ cd ..
747 747 $ rm -rf sub
748 748 $ hg init main
749 749 $ cd main
750 750 $ hg init s
751 751 $ cd s
752 752 $ echo a > a
753 753 $ hg ci -Am1
754 754 adding a
755 755 $ hg branch br
756 756 marked working directory as branch br
757 757 (branches are permanent and global, did you want a bookmark?)
758 758 $ echo a >> a
759 759 $ hg ci -m1
760 760 $ hg up default
761 761 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
762 762 $ echo b > b
763 763 $ hg ci -Am1
764 764 adding b
765 765 $ hg up br
766 766 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
767 767 $ hg merge tip
768 768 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
769 769 (branch merge, don't forget to commit)
770 770 $ hg ci -m1
771 771 $ hg up 2
772 772 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
773 773 $ echo c > c
774 774 $ hg ci -Am1
775 775 adding c
776 776 $ hg up 3
777 777 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
778 778 $ hg merge 4
779 779 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
780 780 (branch merge, don't forget to commit)
781 781 $ hg ci -m1
782 782
783 783 # main repo layout:
784 784 #
785 785 # * <-- try to merge default into br again
786 786 # .`|
787 787 # . o 5 br --> substate = 5
788 788 # . |
789 789 # o | 4 default --> substate = 4
790 790 # | |
791 791 # | o 3 br --> substate = 2
792 792 # |/|
793 793 # o | 2 default --> substate = 2
794 794 # | |
795 795 # | o 1 br --> substate = 3
796 796 # |/
797 797 # o 0 default --> substate = 2
798 798
799 799 $ cd ..
800 800 $ echo 's = s' > .hgsub
801 801 $ hg -R s up 2
802 802 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
803 803 $ hg ci -Am1
804 804 adding .hgsub
805 805 $ hg branch br
806 806 marked working directory as branch br
807 807 (branches are permanent and global, did you want a bookmark?)
808 808 $ echo b > b
809 809 $ hg -R s up 3
810 810 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
811 811 $ hg ci -Am1
812 812 adding b
813 813 $ hg up default
814 814 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
815 815 $ echo c > c
816 816 $ hg ci -Am1
817 817 adding c
818 818 $ hg up 1
819 819 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
820 820 $ hg merge 2
821 821 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
822 822 (branch merge, don't forget to commit)
823 823 $ hg ci -m1
824 824 $ hg up 2
825 825 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
826 826 $ hg -R s up 4
827 827 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
828 828 $ echo d > d
829 829 $ hg ci -Am1
830 830 adding d
831 831 $ hg up 3
832 832 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
833 833 $ hg -R s up 5
834 834 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
835 835 $ echo e > e
836 836 $ hg ci -Am1
837 837 adding e
838 838
839 839 $ hg up 5
840 840 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
841 841 $ hg merge 4 # try to merge default into br again
842 842 subrepository s diverged (local revision: f8f13b33206e, remote revision: a3f9062a4f88)
843 843 (M)erge, keep (l)ocal or keep (r)emote? m
844 844 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
845 845 (branch merge, don't forget to commit)
846 846 $ cd ..
847 847
848 848 test subrepo delete from .hgsubstate
849 849
850 850 $ hg init testdelete
851 851 $ mkdir testdelete/nested testdelete/nested2
852 852 $ hg init testdelete/nested
853 853 $ hg init testdelete/nested2
854 854 $ echo test > testdelete/nested/foo
855 855 $ echo test > testdelete/nested2/foo
856 856 $ hg -R testdelete/nested add
857 857 adding testdelete/nested/foo (glob)
858 858 $ hg -R testdelete/nested2 add
859 859 adding testdelete/nested2/foo (glob)
860 860 $ hg -R testdelete/nested ci -m test
861 861 $ hg -R testdelete/nested2 ci -m test
862 862 $ echo nested = nested > testdelete/.hgsub
863 863 $ echo nested2 = nested2 >> testdelete/.hgsub
864 864 $ hg -R testdelete add
865 865 adding testdelete/.hgsub (glob)
866 866 $ hg -R testdelete ci -m "nested 1 & 2 added"
867 867 $ echo nested = nested > testdelete/.hgsub
868 868 $ hg -R testdelete ci -m "nested 2 deleted"
869 869 $ cat testdelete/.hgsubstate
870 870 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
871 871 $ hg -R testdelete remove testdelete/.hgsub
872 872 $ hg -R testdelete ci -m ".hgsub deleted"
873 873 $ cat testdelete/.hgsubstate
874 874 bdf5c9a3103743d900b12ae0db3ffdcfd7b0d878 nested
875 875
876 876 test repository cloning
877 877
878 878 $ mkdir mercurial mercurial2
879 879 $ hg init nested_absolute
880 880 $ echo test > nested_absolute/foo
881 881 $ hg -R nested_absolute add
882 882 adding nested_absolute/foo (glob)
883 883 $ hg -R nested_absolute ci -mtest
884 884 $ cd mercurial
885 885 $ hg init nested_relative
886 886 $ echo test2 > nested_relative/foo2
887 887 $ hg -R nested_relative add
888 888 adding nested_relative/foo2 (glob)
889 889 $ hg -R nested_relative ci -mtest2
890 890 $ hg init main
891 891 $ echo "nested_relative = ../nested_relative" > main/.hgsub
892 892 $ echo "nested_absolute = `pwd`/nested_absolute" >> main/.hgsub
893 893 $ hg -R main add
894 894 adding main/.hgsub (glob)
895 895 $ hg -R main ci -m "add subrepos"
896 896 $ cd ..
897 897 $ hg clone mercurial/main mercurial2/main
898 898 updating to branch default
899 899 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
900 900 $ cat mercurial2/main/nested_absolute/.hg/hgrc \
901 901 > mercurial2/main/nested_relative/.hg/hgrc
902 902 [paths]
903 903 default = $TESTTMP/mercurial/nested_absolute
904 904 [paths]
905 905 default = $TESTTMP/mercurial/nested_relative
906 906 $ rm -rf mercurial mercurial2
907 907
908 908 Issue1977: multirepo push should fail if subrepo push fails
909 909
910 910 $ hg init repo
911 911 $ hg init repo/s
912 912 $ echo a > repo/s/a
913 913 $ hg -R repo/s ci -Am0
914 914 adding a
915 915 $ echo s = s > repo/.hgsub
916 916 $ hg -R repo ci -Am1
917 917 adding .hgsub
918 918 $ hg clone repo repo2
919 919 updating to branch default
920 920 cloning subrepo s from $TESTTMP/repo/s
921 921 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
922 922 $ hg -q -R repo2 pull -u
923 923 $ echo 1 > repo2/s/a
924 924 $ hg -R repo2/s ci -m2
925 925 $ hg -q -R repo2/s push
926 926 $ hg -R repo2/s up -C 0
927 927 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
928 928 $ echo 2 > repo2/s/b
929 929 $ hg -R repo2/s ci -m3 -A
930 930 adding b
931 931 created new head
932 932 $ hg -R repo2 ci -m3
933 933 $ hg -q -R repo2 push
934 934 abort: push creates new remote head cc505f09a8b2! (in subrepo s)
935 935 (merge or see "hg help push" for details about pushing new heads)
936 936 [255]
937 937 $ hg -R repo update
938 938 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
939 939
940 940 test if untracked file is not overwritten
941 941
942 942 (this also tests that updated .hgsubstate is treated as "modified",
943 943 when 'merge.update()' is aborted before 'merge.recordupdates()', even
944 944 if none of mode, size and timestamp of it isn't changed on the
945 945 filesystem (see also issue4583))
946 946
947 947 $ echo issue3276_ok > repo/s/b
948 948 $ hg -R repo2 push -f -q
949 949 $ touch -t 200001010000 repo/.hgsubstate
950 950
951 951 $ cat >> repo/.hg/hgrc <<EOF
952 952 > [fakedirstatewritetime]
953 953 > # emulate invoking dirstate.write() via repo.status()
954 954 > # at 2000-01-01 00:00
955 955 > fakenow = 200001010000
956 956 >
957 957 > [extensions]
958 958 > fakedirstatewritetime = $TESTDIR/fakedirstatewritetime.py
959 959 > EOF
960 960 $ hg -R repo update
961 961 b: untracked file differs
962 962 abort: untracked files in working directory differ from files in requested revision (in subrepo s)
963 963 [255]
964 964 $ cat >> repo/.hg/hgrc <<EOF
965 965 > [extensions]
966 966 > fakedirstatewritetime = !
967 967 > EOF
968 968
969 969 $ cat repo/s/b
970 970 issue3276_ok
971 971 $ rm repo/s/b
972 972 $ touch -t 200001010000 repo/.hgsubstate
973 973 $ hg -R repo revert --all
974 974 reverting repo/.hgsubstate (glob)
975 975 reverting subrepo s
976 976 $ hg -R repo update
977 977 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
978 978 $ cat repo/s/b
979 979 2
980 980 $ rm -rf repo2 repo
981 981
982 982
983 983 Issue1852 subrepos with relative paths always push/pull relative to default
984 984
985 985 Prepare a repo with subrepo
986 986
987 987 $ hg init issue1852a
988 988 $ cd issue1852a
989 989 $ hg init sub/repo
990 990 $ echo test > sub/repo/foo
991 991 $ hg -R sub/repo add sub/repo/foo
992 992 $ echo sub/repo = sub/repo > .hgsub
993 993 $ hg add .hgsub
994 994 $ hg ci -mtest
995 995 committing subrepository sub/repo (glob)
996 996 $ echo test >> sub/repo/foo
997 997 $ hg ci -mtest
998 998 committing subrepository sub/repo (glob)
999 999 $ hg cat sub/repo/foo
1000 1000 test
1001 1001 test
1002 1002 $ mkdir -p tmp/sub/repo
1003 1003 $ hg cat -r 0 --output tmp/%p_p sub/repo/foo
1004 1004 $ cat tmp/sub/repo/foo_p
1005 1005 test
1006 1006 $ mv sub/repo sub_
1007 1007 $ hg cat sub/repo/baz
1008 1008 skipping missing subrepository: sub/repo
1009 1009 [1]
1010 1010 $ rm -rf sub/repo
1011 1011 $ mv sub_ sub/repo
1012 1012 $ cd ..
1013 1013
1014 1014 Create repo without default path, pull top repo, and see what happens on update
1015 1015
1016 1016 $ hg init issue1852b
1017 1017 $ hg -R issue1852b pull issue1852a
1018 1018 pulling from issue1852a
1019 1019 requesting all changes
1020 1020 adding changesets
1021 1021 adding manifests
1022 1022 adding file changes
1023 1023 added 2 changesets with 3 changes to 2 files
1024 1024 (run 'hg update' to get a working copy)
1025 1025 $ hg -R issue1852b update
1026 1026 abort: default path for subrepository not found (in subrepo sub/repo) (glob)
1027 1027 [255]
1028 1028
1029 1029 Ensure a full traceback, not just the SubrepoAbort part
1030 1030
1031 1031 $ hg -R issue1852b update --traceback 2>&1 | grep 'raise util\.Abort'
1032 1032 raise util.Abort(_("default path for subrepository not found"))
1033 1033
1034 1034 Pull -u now doesn't help
1035 1035
1036 1036 $ hg -R issue1852b pull -u issue1852a
1037 1037 pulling from issue1852a
1038 1038 searching for changes
1039 1039 no changes found
1040 1040
1041 1041 Try the same, but with pull -u
1042 1042
1043 1043 $ hg init issue1852c
1044 1044 $ hg -R issue1852c pull -r0 -u issue1852a
1045 1045 pulling from issue1852a
1046 1046 adding changesets
1047 1047 adding manifests
1048 1048 adding file changes
1049 1049 added 1 changesets with 2 changes to 2 files
1050 1050 cloning subrepo sub/repo from issue1852a/sub/repo (glob)
1051 1051 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1052 1052
1053 1053 Try to push from the other side
1054 1054
1055 1055 $ hg -R issue1852a push `pwd`/issue1852c
1056 1056 pushing to $TESTTMP/issue1852c (glob)
1057 1057 pushing subrepo sub/repo to $TESTTMP/issue1852c/sub/repo (glob)
1058 1058 searching for changes
1059 1059 no changes found
1060 1060 searching for changes
1061 1061 adding changesets
1062 1062 adding manifests
1063 1063 adding file changes
1064 1064 added 1 changesets with 1 changes to 1 files
1065 1065
1066 1066 Incoming and outgoing should not use the default path:
1067 1067
1068 1068 $ hg clone -q issue1852a issue1852d
1069 1069 $ hg -R issue1852d outgoing --subrepos issue1852c
1070 1070 comparing with issue1852c
1071 1071 searching for changes
1072 1072 no changes found
1073 1073 comparing with issue1852c/sub/repo
1074 1074 searching for changes
1075 1075 no changes found
1076 1076 [1]
1077 1077 $ hg -R issue1852d incoming --subrepos issue1852c
1078 1078 comparing with issue1852c
1079 1079 searching for changes
1080 1080 no changes found
1081 1081 comparing with issue1852c/sub/repo
1082 1082 searching for changes
1083 1083 no changes found
1084 1084 [1]
1085 1085
1086 1086 Check that merge of a new subrepo doesn't write the uncommitted state to
1087 1087 .hgsubstate (issue4622)
1088 1088
1089 1089 $ hg init issue1852a/addedsub
1090 1090 $ echo zzz > issue1852a/addedsub/zz.txt
1091 1091 $ hg -R issue1852a/addedsub ci -Aqm "initial ZZ"
1092 1092
1093 1093 $ hg clone issue1852a/addedsub issue1852d/addedsub
1094 1094 updating to branch default
1095 1095 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1096 1096
1097 1097 $ echo def > issue1852a/sub/repo/foo
1098 1098 $ hg -R issue1852a ci -SAm 'tweaked subrepo'
1099 1099 adding tmp/sub/repo/foo_p
1100 1100 committing subrepository sub/repo (glob)
1101 1101
1102 1102 $ echo 'addedsub = addedsub' >> issue1852d/.hgsub
1103 1103 $ echo xyz > issue1852d/sub/repo/foo
1104 1104 $ hg -R issue1852d pull -u
1105 1105 pulling from $TESTTMP/issue1852a (glob)
1106 1106 searching for changes
1107 1107 adding changesets
1108 1108 adding manifests
1109 1109 adding file changes
1110 1110 added 1 changesets with 2 changes to 2 files
1111 1111 subrepository sub/repo diverged (local revision: f42d5c7504a8, remote revision: 46cd4aac504c)
1112 1112 (M)erge, keep (l)ocal or keep (r)emote? m
1113 1113 pulling subrepo sub/repo from $TESTTMP/issue1852a/sub/repo (glob)
1114 1114 searching for changes
1115 1115 adding changesets
1116 1116 adding manifests
1117 1117 adding file changes
1118 1118 added 1 changesets with 1 changes to 1 files
1119 1119 subrepository sources for sub/repo differ (glob)
1120 1120 use (l)ocal source (f42d5c7504a8) or (r)emote source (46cd4aac504c)? l
1121 1121 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1122 1122 $ cat issue1852d/.hgsubstate
1123 1123 f42d5c7504a811dda50f5cf3e5e16c3330b87172 sub/repo
1124 1124
1125 1125 Check status of files when none of them belong to the first
1126 1126 subrepository:
1127 1127
1128 1128 $ hg init subrepo-status
1129 1129 $ cd subrepo-status
1130 1130 $ hg init subrepo-1
1131 1131 $ hg init subrepo-2
1132 1132 $ cd subrepo-2
1133 1133 $ touch file
1134 1134 $ hg add file
1135 1135 $ cd ..
1136 1136 $ echo subrepo-1 = subrepo-1 > .hgsub
1137 1137 $ echo subrepo-2 = subrepo-2 >> .hgsub
1138 1138 $ hg add .hgsub
1139 1139 $ hg ci -m 'Added subrepos'
1140 1140 committing subrepository subrepo-2
1141 1141 $ hg st subrepo-2/file
1142 1142
1143 1143 Check that share works with subrepo
1144 1144 $ hg --config extensions.share= share . ../shared
1145 1145 updating working directory
1146 1146 cloning subrepo subrepo-2 from $TESTTMP/subrepo-status/subrepo-2
1147 1147 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1148 1148 $ test -f ../shared/subrepo-1/.hg/sharedpath
1149 1149 [1]
1150 1150 $ hg -R ../shared in
1151 1151 abort: repository default not found!
1152 1152 [255]
1153 1153 $ hg -R ../shared/subrepo-2 showconfig paths
1154 1154 paths.default=$TESTTMP/subrepo-status/subrepo-2
1155 1155 $ hg -R ../shared/subrepo-1 sum --remote
1156 1156 parent: -1:000000000000 tip (empty repository)
1157 1157 branch: default
1158 1158 commit: (clean)
1159 1159 update: (current)
1160 1160 remote: (synced)
1161 1161
1162 1162 Check hg update --clean
1163 1163 $ cd $TESTTMP/t
1164 1164 $ rm -r t/t.orig
1165 1165 $ hg status -S --all
1166 1166 C .hgsub
1167 1167 C .hgsubstate
1168 1168 C a
1169 1169 C s/.hgsub
1170 1170 C s/.hgsubstate
1171 1171 C s/a
1172 1172 C s/ss/a
1173 1173 C t/t
1174 1174 $ echo c1 > s/a
1175 1175 $ cd s
1176 1176 $ echo c1 > b
1177 1177 $ echo c1 > c
1178 1178 $ hg add b
1179 1179 $ cd ..
1180 1180 $ hg status -S
1181 1181 M s/a
1182 1182 A s/b
1183 1183 ? s/c
1184 1184 $ hg update -C
1185 1185 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1186 1186 $ hg status -S
1187 1187 ? s/b
1188 1188 ? s/c
1189 1189
1190 1190 Sticky subrepositories, no changes
1191 1191 $ cd $TESTTMP/t
1192 1192 $ hg id
1193 1193 925c17564ef8 tip
1194 1194 $ hg -R s id
1195 1195 12a213df6fa9 tip
1196 1196 $ hg -R t id
1197 1197 52c0adc0515a tip
1198 1198 $ hg update 11
1199 1199 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1200 1200 $ hg id
1201 1201 365661e5936a
1202 1202 $ hg -R s id
1203 1203 fc627a69481f
1204 1204 $ hg -R t id
1205 1205 e95bcfa18a35
1206 1206
1207 1207 Sticky subrepositories, file changes
1208 1208 $ touch s/f1
1209 1209 $ touch t/f1
1210 1210 $ hg add -S s/f1
1211 1211 $ hg add -S t/f1
1212 1212 $ hg id
1213 1213 365661e5936a+
1214 1214 $ hg -R s id
1215 1215 fc627a69481f+
1216 1216 $ hg -R t id
1217 1217 e95bcfa18a35+
1218 1218 $ hg update tip
1219 1219 subrepository s diverged (local revision: fc627a69481f, remote revision: 12a213df6fa9)
1220 1220 (M)erge, keep (l)ocal or keep (r)emote? m
1221 1221 subrepository sources for s differ
1222 1222 use (l)ocal source (fc627a69481f) or (r)emote source (12a213df6fa9)? l
1223 1223 subrepository t diverged (local revision: e95bcfa18a35, remote revision: 52c0adc0515a)
1224 1224 (M)erge, keep (l)ocal or keep (r)emote? m
1225 1225 subrepository sources for t differ
1226 1226 use (l)ocal source (e95bcfa18a35) or (r)emote source (52c0adc0515a)? l
1227 1227 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1228 1228 $ hg id
1229 1229 925c17564ef8+ tip
1230 1230 $ hg -R s id
1231 1231 fc627a69481f+
1232 1232 $ hg -R t id
1233 1233 e95bcfa18a35+
1234 1234 $ hg update --clean tip
1235 1235 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1236 1236
1237 1237 Sticky subrepository, revision updates
1238 1238 $ hg id
1239 1239 925c17564ef8 tip
1240 1240 $ hg -R s id
1241 1241 12a213df6fa9 tip
1242 1242 $ hg -R t id
1243 1243 52c0adc0515a tip
1244 1244 $ cd s
1245 1245 $ hg update -r -2
1246 1246 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1247 1247 $ cd ../t
1248 1248 $ hg update -r 2
1249 1249 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1250 1250 $ cd ..
1251 1251 $ hg update 10
1252 1252 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1253 1253 (M)erge, keep (l)ocal or keep (r)emote? m
1254 1254 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 20a0db6fbf6c)
1255 1255 (M)erge, keep (l)ocal or keep (r)emote? m
1256 1256 subrepository sources for t differ (in checked out version)
1257 1257 use (l)ocal source (7af322bc1198) or (r)emote source (20a0db6fbf6c)? l
1258 1258 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1259 1259 $ hg id
1260 1260 e45c8b14af55+
1261 1261 $ hg -R s id
1262 1262 02dcf1d70411
1263 1263 $ hg -R t id
1264 1264 7af322bc1198
1265 1265
1266 1266 Sticky subrepository, file changes and revision updates
1267 1267 $ touch s/f1
1268 1268 $ touch t/f1
1269 1269 $ hg add -S s/f1
1270 1270 $ hg add -S t/f1
1271 1271 $ hg id
1272 1272 e45c8b14af55+
1273 1273 $ hg -R s id
1274 1274 02dcf1d70411+
1275 1275 $ hg -R t id
1276 1276 7af322bc1198+
1277 1277 $ hg update tip
1278 1278 subrepository s diverged (local revision: 12a213df6fa9, remote revision: 12a213df6fa9)
1279 1279 (M)erge, keep (l)ocal or keep (r)emote? m
1280 1280 subrepository sources for s differ
1281 1281 use (l)ocal source (02dcf1d70411) or (r)emote source (12a213df6fa9)? l
1282 1282 subrepository t diverged (local revision: 52c0adc0515a, remote revision: 52c0adc0515a)
1283 1283 (M)erge, keep (l)ocal or keep (r)emote? m
1284 1284 subrepository sources for t differ
1285 1285 use (l)ocal source (7af322bc1198) or (r)emote source (52c0adc0515a)? l
1286 1286 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1287 1287 $ hg id
1288 1288 925c17564ef8+ tip
1289 1289 $ hg -R s id
1290 1290 02dcf1d70411+
1291 1291 $ hg -R t id
1292 1292 7af322bc1198+
1293 1293
1294 1294 Sticky repository, update --clean
1295 1295 $ hg update --clean tip
1296 1296 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1297 1297 $ hg id
1298 1298 925c17564ef8 tip
1299 1299 $ hg -R s id
1300 1300 12a213df6fa9 tip
1301 1301 $ hg -R t id
1302 1302 52c0adc0515a tip
1303 1303
1304 1304 Test subrepo already at intended revision:
1305 1305 $ cd s
1306 1306 $ hg update fc627a69481f
1307 1307 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1308 1308 $ cd ..
1309 1309 $ hg update 11
1310 1310 subrepository s diverged (local revision: 12a213df6fa9, remote revision: fc627a69481f)
1311 1311 (M)erge, keep (l)ocal or keep (r)emote? m
1312 1312 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1313 1313 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
1314 1314 $ hg id -n
1315 1315 11+
1316 1316 $ hg -R s id
1317 1317 fc627a69481f
1318 1318 $ hg -R t id
1319 1319 e95bcfa18a35
1320 1320
1321 1321 Test that removing .hgsubstate doesn't break anything:
1322 1322
1323 1323 $ hg rm -f .hgsubstate
1324 1324 $ hg ci -mrm
1325 1325 nothing changed
1326 1326 [1]
1327 1327 $ hg log -vr tip
1328 1328 changeset: 13:925c17564ef8
1329 1329 tag: tip
1330 1330 user: test
1331 1331 date: Thu Jan 01 00:00:00 1970 +0000
1332 1332 files: .hgsubstate
1333 1333 description:
1334 1334 13
1335 1335
1336 1336
1337 1337
1338 1338 Test that removing .hgsub removes .hgsubstate:
1339 1339
1340 1340 $ hg rm .hgsub
1341 1341 $ hg ci -mrm2
1342 1342 created new head
1343 1343 $ hg log -vr tip
1344 1344 changeset: 14:2400bccd50af
1345 1345 tag: tip
1346 1346 parent: 11:365661e5936a
1347 1347 user: test
1348 1348 date: Thu Jan 01 00:00:00 1970 +0000
1349 1349 files: .hgsub .hgsubstate
1350 1350 description:
1351 1351 rm2
1352 1352
1353 1353
1354 1354 Test issue3153: diff -S with deleted subrepos
1355 1355
1356 1356 $ hg diff --nodates -S -c .
1357 1357 diff -r 365661e5936a -r 2400bccd50af .hgsub
1358 1358 --- a/.hgsub
1359 1359 +++ /dev/null
1360 1360 @@ -1,2 +0,0 @@
1361 1361 -s = s
1362 1362 -t = t
1363 1363 diff -r 365661e5936a -r 2400bccd50af .hgsubstate
1364 1364 --- a/.hgsubstate
1365 1365 +++ /dev/null
1366 1366 @@ -1,2 +0,0 @@
1367 1367 -fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1368 1368 -e95bcfa18a358dc4936da981ebf4147b4cad1362 t
1369 1369
1370 1370 Test behavior of add for explicit path in subrepo:
1371 1371 $ cd ..
1372 1372 $ hg init explicit
1373 1373 $ cd explicit
1374 1374 $ echo s = s > .hgsub
1375 1375 $ hg add .hgsub
1376 1376 $ hg init s
1377 1377 $ hg ci -m0
1378 1378 Adding with an explicit path in a subrepo adds the file
1379 1379 $ echo c1 > f1
1380 1380 $ echo c2 > s/f2
1381 1381 $ hg st -S
1382 1382 ? f1
1383 1383 ? s/f2
1384 1384 $ hg add s/f2
1385 1385 $ hg st -S
1386 1386 A s/f2
1387 1387 ? f1
1388 1388 $ hg ci -R s -m0
1389 1389 $ hg ci -Am1
1390 1390 adding f1
1391 1391 Adding with an explicit path in a subrepo with -S has the same behavior
1392 1392 $ echo c3 > f3
1393 1393 $ echo c4 > s/f4
1394 1394 $ hg st -S
1395 1395 ? f3
1396 1396 ? s/f4
1397 1397 $ hg add -S s/f4
1398 1398 $ hg st -S
1399 1399 A s/f4
1400 1400 ? f3
1401 1401 $ hg ci -R s -m1
1402 1402 $ hg ci -Ama2
1403 1403 adding f3
1404 1404 Adding without a path or pattern silently ignores subrepos
1405 1405 $ echo c5 > f5
1406 1406 $ echo c6 > s/f6
1407 1407 $ echo c7 > s/f7
1408 1408 $ hg st -S
1409 1409 ? f5
1410 1410 ? s/f6
1411 1411 ? s/f7
1412 1412 $ hg add
1413 1413 adding f5
1414 1414 $ hg st -S
1415 1415 A f5
1416 1416 ? s/f6
1417 1417 ? s/f7
1418 1418 $ hg ci -R s -Am2
1419 1419 adding f6
1420 1420 adding f7
1421 1421 $ hg ci -m3
1422 1422 Adding without a path or pattern with -S also adds files in subrepos
1423 1423 $ echo c8 > f8
1424 1424 $ echo c9 > s/f9
1425 1425 $ echo c10 > s/f10
1426 1426 $ hg st -S
1427 1427 ? f8
1428 1428 ? s/f10
1429 1429 ? s/f9
1430 1430 $ hg add -S
1431 1431 adding f8
1432 1432 adding s/f10 (glob)
1433 1433 adding s/f9 (glob)
1434 1434 $ hg st -S
1435 1435 A f8
1436 1436 A s/f10
1437 1437 A s/f9
1438 1438 $ hg ci -R s -m3
1439 1439 $ hg ci -m4
1440 1440 Adding with a pattern silently ignores subrepos
1441 1441 $ echo c11 > fm11
1442 1442 $ echo c12 > fn12
1443 1443 $ echo c13 > s/fm13
1444 1444 $ echo c14 > s/fn14
1445 1445 $ hg st -S
1446 1446 ? fm11
1447 1447 ? fn12
1448 1448 ? s/fm13
1449 1449 ? s/fn14
1450 1450 $ hg add 'glob:**fm*'
1451 1451 adding fm11
1452 1452 $ hg st -S
1453 1453 A fm11
1454 1454 ? fn12
1455 1455 ? s/fm13
1456 1456 ? s/fn14
1457 1457 $ hg ci -R s -Am4
1458 1458 adding fm13
1459 1459 adding fn14
1460 1460 $ hg ci -Am5
1461 1461 adding fn12
1462 1462 Adding with a pattern with -S also adds matches in subrepos
1463 1463 $ echo c15 > fm15
1464 1464 $ echo c16 > fn16
1465 1465 $ echo c17 > s/fm17
1466 1466 $ echo c18 > s/fn18
1467 1467 $ hg st -S
1468 1468 ? fm15
1469 1469 ? fn16
1470 1470 ? s/fm17
1471 1471 ? s/fn18
1472 1472 $ hg add -S 'glob:**fm*'
1473 1473 adding fm15
1474 1474 adding s/fm17 (glob)
1475 1475 $ hg st -S
1476 1476 A fm15
1477 1477 A s/fm17
1478 1478 ? fn16
1479 1479 ? s/fn18
1480 1480 $ hg ci -R s -Am5
1481 1481 adding fn18
1482 1482 $ hg ci -Am6
1483 1483 adding fn16
1484 1484
1485 1485 Test behavior of forget for explicit path in subrepo:
1486 1486 Forgetting an explicit path in a subrepo untracks the file
1487 1487 $ echo c19 > s/f19
1488 1488 $ hg add s/f19
1489 1489 $ hg st -S
1490 1490 A s/f19
1491 1491 $ hg forget s/f19
1492 1492 $ hg st -S
1493 1493 ? s/f19
1494 1494 $ rm s/f19
1495 1495 $ cd ..
1496 1496
1497 1497 Courtesy phases synchronisation to publishing server does not block the push
1498 1498 (issue3781)
1499 1499
1500 1500 $ cp -r main issue3781
1501 1501 $ cp -r main issue3781-dest
1502 1502 $ cd issue3781-dest/s
1503 1503 $ hg phase tip # show we have draft changeset
1504 1504 5: draft
1505 1505 $ chmod a-w .hg/store/phaseroots # prevent phase push
1506 1506 $ cd ../../issue3781
1507 1507 $ cat >> .hg/hgrc << EOF
1508 1508 > [paths]
1509 1509 > default=../issue3781-dest/
1510 1510 > EOF
1511 1511 $ hg push --config experimental.bundle2-exp=False
1512 1512 pushing to $TESTTMP/issue3781-dest (glob)
1513 1513 pushing subrepo s to $TESTTMP/issue3781-dest/s
1514 1514 searching for changes
1515 1515 no changes found
1516 1516 searching for changes
1517 1517 no changes found
1518 1518 [1]
1519 1519 # clean the push cache
1520 1520 $ rm s/.hg/cache/storehash/*
1521 1521 $ hg push --config experimental.bundle2-exp=True
1522 1522 pushing to $TESTTMP/issue3781-dest (glob)
1523 1523 pushing subrepo s to $TESTTMP/issue3781-dest/s
1524 1524 searching for changes
1525 1525 no changes found
1526 1526 searching for changes
1527 1527 no changes found
1528 1528 [1]
1529 1529 $ cd ..
1530 1530
1531 1531 Test phase choice for newly created commit with "phases.subrepochecks"
1532 1532 configuration
1533 1533
1534 1534 $ cd t
1535 1535 $ hg update -q -r 12
1536 1536
1537 1537 $ cat >> s/ss/.hg/hgrc <<EOF
1538 1538 > [phases]
1539 1539 > new-commit = secret
1540 1540 > EOF
1541 1541 $ cat >> s/.hg/hgrc <<EOF
1542 1542 > [phases]
1543 1543 > new-commit = draft
1544 1544 > EOF
1545 1545 $ echo phasecheck1 >> s/ss/a
1546 1546 $ hg -R s commit -S --config phases.checksubrepos=abort -m phasecheck1
1547 1547 committing subrepository ss
1548 1548 transaction abort!
1549 1549 rollback completed
1550 1550 abort: can't commit in draft phase conflicting secret from subrepository ss
1551 1551 [255]
1552 1552 $ echo phasecheck2 >> s/ss/a
1553 1553 $ hg -R s commit -S --config phases.checksubrepos=ignore -m phasecheck2
1554 1554 committing subrepository ss
1555 1555 $ hg -R s/ss phase tip
1556 1556 3: secret
1557 1557 $ hg -R s phase tip
1558 1558 6: draft
1559 1559 $ echo phasecheck3 >> s/ss/a
1560 1560 $ hg -R s commit -S -m phasecheck3
1561 1561 committing subrepository ss
1562 1562 warning: changes are committed in secret phase from subrepository ss
1563 1563 $ hg -R s/ss phase tip
1564 1564 4: secret
1565 1565 $ hg -R s phase tip
1566 1566 7: secret
1567 1567
1568 1568 $ cat >> t/.hg/hgrc <<EOF
1569 1569 > [phases]
1570 1570 > new-commit = draft
1571 1571 > EOF
1572 1572 $ cat >> .hg/hgrc <<EOF
1573 1573 > [phases]
1574 1574 > new-commit = public
1575 1575 > EOF
1576 1576 $ echo phasecheck4 >> s/ss/a
1577 1577 $ echo phasecheck4 >> t/t
1578 1578 $ hg commit -S -m phasecheck4
1579 1579 committing subrepository s
1580 1580 committing subrepository s/ss (glob)
1581 1581 warning: changes are committed in secret phase from subrepository ss
1582 1582 committing subrepository t
1583 1583 warning: changes are committed in secret phase from subrepository s
1584 1584 created new head
1585 1585 $ hg -R s/ss phase tip
1586 1586 5: secret
1587 1587 $ hg -R s phase tip
1588 1588 8: secret
1589 1589 $ hg -R t phase tip
1590 1590 6: draft
1591 1591 $ hg phase tip
1592 1592 15: secret
1593 1593
1594 1594 $ cd ..
1595 1595
1596 1596
1597 1597 Test that commit --secret works on both repo and subrepo (issue4182)
1598 1598
1599 1599 $ cd main
1600 1600 $ echo secret >> b
1601 1601 $ echo secret >> s/b
1602 1602 $ hg commit --secret --subrepo -m "secret"
1603 1603 committing subrepository s
1604 1604 $ hg phase -r .
1605 1605 6: secret
1606 1606 $ cd s
1607 1607 $ hg phase -r .
1608 1608 6: secret
1609 1609 $ cd ../../
1610 1610
1611 1611 Test "subrepos" template keyword
1612 1612
1613 1613 $ cd t
1614 1614 $ hg update -q 15
1615 1615 $ cat > .hgsub <<EOF
1616 1616 > s = s
1617 1617 > EOF
1618 1618 $ hg commit -m "16"
1619 1619 warning: changes are committed in secret phase from subrepository s
1620 1620
1621 1621 (addition of ".hgsub" itself)
1622 1622
1623 1623 $ hg diff --nodates -c 1 .hgsubstate
1624 1624 diff -r f7b1eb17ad24 -r 7cf8cfea66e4 .hgsubstate
1625 1625 --- /dev/null
1626 1626 +++ b/.hgsubstate
1627 1627 @@ -0,0 +1,1 @@
1628 1628 +e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1629 1629 $ hg log -r 1 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1630 1630 f7b1eb17ad24 000000000000
1631 1631 s
1632 1632
1633 1633 (modification of existing entry)
1634 1634
1635 1635 $ hg diff --nodates -c 2 .hgsubstate
1636 1636 diff -r 7cf8cfea66e4 -r df30734270ae .hgsubstate
1637 1637 --- a/.hgsubstate
1638 1638 +++ b/.hgsubstate
1639 1639 @@ -1,1 +1,1 @@
1640 1640 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1641 1641 +dc73e2e6d2675eb2e41e33c205f4bdab4ea5111d s
1642 1642 $ hg log -r 2 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1643 1643 7cf8cfea66e4 000000000000
1644 1644 s
1645 1645
1646 1646 (addition of entry)
1647 1647
1648 1648 $ hg diff --nodates -c 5 .hgsubstate
1649 1649 diff -r 7cf8cfea66e4 -r 1f14a2e2d3ec .hgsubstate
1650 1650 --- a/.hgsubstate
1651 1651 +++ b/.hgsubstate
1652 1652 @@ -1,1 +1,2 @@
1653 1653 e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1654 1654 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1655 1655 $ hg log -r 5 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1656 1656 7cf8cfea66e4 000000000000
1657 1657 t
1658 1658
1659 1659 (removal of existing entry)
1660 1660
1661 1661 $ hg diff --nodates -c 16 .hgsubstate
1662 1662 diff -r 8bec38d2bd0b -r f2f70bc3d3c9 .hgsubstate
1663 1663 --- a/.hgsubstate
1664 1664 +++ b/.hgsubstate
1665 1665 @@ -1,2 +1,1 @@
1666 1666 0731af8ca9423976d3743119d0865097c07bdc1b s
1667 1667 -e202dc79b04c88a636ea8913d9182a1346d9b3dc t
1668 1668 $ hg log -r 16 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1669 1669 8bec38d2bd0b 000000000000
1670 1670 t
1671 1671
1672 1672 (merging)
1673 1673
1674 1674 $ hg diff --nodates -c 9 .hgsubstate
1675 1675 diff -r f6affe3fbfaa -r f0d2028bf86d .hgsubstate
1676 1676 --- a/.hgsubstate
1677 1677 +++ b/.hgsubstate
1678 1678 @@ -1,1 +1,2 @@
1679 1679 fc627a69481fcbe5f1135069e8a3881c023e4cf5 s
1680 1680 +60ca1237c19474e7a3978b0dc1ca4e6f36d51382 t
1681 1681 $ hg log -r 9 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1682 1682 f6affe3fbfaa 1f14a2e2d3ec
1683 1683 t
1684 1684
1685 1685 (removal of ".hgsub" itself)
1686 1686
1687 1687 $ hg diff --nodates -c 8 .hgsubstate
1688 1688 diff -r f94576341bcf -r 96615c1dad2d .hgsubstate
1689 1689 --- a/.hgsubstate
1690 1690 +++ /dev/null
1691 1691 @@ -1,2 +0,0 @@
1692 1692 -e4ece1bf43360ddc8f6a96432201a37b7cd27ae4 s
1693 1693 -7af322bc1198a32402fe903e0b7ebcfc5c9bf8f4 t
1694 1694 $ hg log -r 8 --template "{p1node|short} {p2node|short}\n{subrepos % '{subrepo}\n'}"
1695 1695 f94576341bcf 000000000000
1696 1696
1697 1697 Test that '[paths]' is configured correctly at subrepo creation
1698 1698
1699 1699 $ cd $TESTTMP/tc
1700 1700 $ cat > .hgsub <<EOF
1701 1701 > # to clear bogus subrepo path 'bogus=[boguspath'
1702 1702 > s = s
1703 1703 > t = t
1704 1704 > EOF
1705 1705 $ hg update -q --clean null
1706 1706 $ rm -rf s t
1707 1707 $ cat >> .hg/hgrc <<EOF
1708 1708 > [paths]
1709 1709 > default-push = /foo/bar
1710 1710 > EOF
1711 1711 $ hg update -q
1712 1712 $ cat s/.hg/hgrc
1713 1713 [paths]
1714 1714 default = $TESTTMP/t/s
1715 1715 default-push = /foo/bar/s
1716 1716 $ cat s/ss/.hg/hgrc
1717 1717 [paths]
1718 1718 default = $TESTTMP/t/s/ss
1719 1719 default-push = /foo/bar/s/ss
1720 1720 $ cat t/.hg/hgrc
1721 1721 [paths]
1722 1722 default = $TESTTMP/t/t
1723 1723 default-push = /foo/bar/t
1724 1724
1725 1725 $ cd $TESTTMP/t
1726 1726 $ hg up -qC 0
1727 1727 $ echo 'bar' > bar.txt
1728 1728 $ hg ci -Am 'branch before subrepo add'
1729 1729 adding bar.txt
1730 1730 created new head
1731 1731 $ hg merge -r "first(subrepo('s'))"
1732 1732 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1733 1733 (branch merge, don't forget to commit)
1734 1734 $ hg status -S -X '.hgsub*'
1735 1735 A s/a
1736 1736 ? s/b
1737 1737 ? s/c
1738 1738 ? s/f1
1739 1739 $ hg status -S --rev 'p2()'
1740 1740 A bar.txt
1741 1741 ? s/b
1742 1742 ? s/c
1743 1743 ? s/f1
1744 1744 $ hg diff -S -X '.hgsub*' --nodates
1745 1745 diff -r 000000000000 s/a
1746 1746 --- /dev/null
1747 1747 +++ b/s/a
1748 1748 @@ -0,0 +1,1 @@
1749 1749 +a
1750 1750 $ hg diff -S --rev 'p2()' --nodates
1751 1751 diff -r 7cf8cfea66e4 bar.txt
1752 1752 --- /dev/null
1753 1753 +++ b/bar.txt
1754 1754 @@ -0,0 +1,1 @@
1755 1755 +bar
1756 1756
1757 1757 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now