83 oldmemfilectx = context.memfilectx |
84 oldmemfilectx = context.memfilectx |
84 def memfilectx(repo, *args, **kwargs): |
85 def memfilectx(repo, *args, **kwargs): |
85 return oldmemfilectx(*args, **kwargs) |
86 return oldmemfilectx(*args, **kwargs) |
86 else: |
87 else: |
87 raise util.Abort('Your Mercurial is too old for this version of Evolve\n' |
88 raise util.Abort('Your Mercurial is too old for this version of Evolve\n' |
88 'requires version 3.2 or above') |
89 'requires version %s or above' % min(testedwith.split())) |
89 |
90 |
90 |
91 |
91 # This extension contains the following code |
92 # This extension contains the following code |
92 # |
93 # |
93 # - Extension Helper code |
94 # - Extension Helper code |
1300 for prec in repo.set('allprecursors(%d)', ctx): |
1300 for prec in repo.set('allprecursors(%d)', ctx): |
1301 yield prec |
1301 yield prec |
1302 |
1302 |
1303 # Look for an unstable which can be stabilized as a child of |
1303 # Look for an unstable which can be stabilized as a child of |
1304 # node. The unstable must be a child of one of node predecessors. |
1304 # node. The unstable must be a child of one of node predecessors. |
|
1305 directdesc = set([pctx.rev()]) |
1305 for ctx in selfanddescendants(repo, pctx): |
1306 for ctx in selfanddescendants(repo, pctx): |
1306 for child in ctx.children(): |
1307 for child in ctx.children(): |
1307 if child.unstable(): |
1308 if ctx.rev() in directdesc and not child.obsolete(): |
|
1309 directdesc.add(child.rev()) |
|
1310 elif child.unstable(): |
1308 return child |
1311 return child |
1309 return None |
1312 return None |
1310 |
1313 |
1311 def _solveunstable(ui, repo, orig, dryrun=False, confirm=False, |
1314 def _solveunstable(ui, repo, orig, dryrun=False, confirm=False, |
1312 progresscb=None): |
1315 progresscb=None): |
1313 """Stabilize a unstable changeset""" |
1316 """Stabilize a unstable changeset""" |
1314 obs = orig.parents()[0] |
1317 obs = orig.parents()[0] |
1315 if not obs.obsolete(): |
1318 if not obs.obsolete(): |
1316 print obs.rev(), orig.parents() |
1319 obs = orig.parents()[1] # second parent is obsolete ? |
1317 print orig.rev() |
|
1318 obs = orig.parents()[1] |
|
1319 assert obs.obsolete() |
1320 assert obs.obsolete() |
1320 newer = obsolete.successorssets(repo, obs.node()) |
1321 newer = obsolete.successorssets(repo, obs.node()) |
1321 # search of a parent which is not killed |
1322 # search of a parent which is not killed |
1322 while not newer or newer == [()]: |
1323 while not newer or newer == [()]: |
1323 ui.debug("stabilize target %s is plain dead," |
1324 ui.debug("stabilize target %s is plain dead," |
1412 # Create the new commit context |
1413 # Create the new commit context |
1413 repo.ui.status(_('computing new diff\n')) |
1414 repo.ui.status(_('computing new diff\n')) |
1414 files = set() |
1415 files = set() |
1415 copied = copies.pathcopies(prec, bumped) |
1416 copied = copies.pathcopies(prec, bumped) |
1416 precmanifest = prec.manifest() |
1417 precmanifest = prec.manifest() |
1417 for key, val in bumped.manifest().iteritems(): |
1418 for key, val in bumped.manifest().items(): |
1418 if precmanifest.pop(key, None) != val: |
1419 if precmanifest.pop(key, None) != val: |
1419 files.add(key) |
1420 files.add(key) |
1420 files.update(precmanifest) # add missing files |
1421 files.update(precmanifest) # add missing files |
1421 # commit it |
1422 # commit it |
1422 if files: # something to commit! |
1423 if files: # something to commit! |
1486 hint="You have to fallback to solving this by hand...\n" |
1487 hint="You have to fallback to solving this by hand...\n" |
1487 "| This probably means redoing the merge and using " |
1488 "| This probably means redoing the merge and using " |
1488 "| `hg prune` to kill older version.") |
1489 "| `hg prune` to kill older version.") |
1489 if other.p1() not in divergent.parents(): |
1490 if other.p1() not in divergent.parents(): |
1490 raise util.Abort("parents are not common (not handled yet)", |
1491 raise util.Abort("parents are not common (not handled yet)", |
1491 hint="| %(d)s, %(o)s are not based on the same changeset." |
1492 hint="| %(d)s, %(o)s are not based on the same changeset.\n" |
1492 "| With the current state of its implementation, " |
1493 "| With the current state of its implementation, \n" |
1493 "| evolve does not work in that case.\n" |
1494 "| evolve does not work in that case.\n" |
1494 "| rebase one of them next to the other and run " |
1495 "| rebase one of them next to the other and run \n" |
1495 "| this command again.\n" |
1496 "| this command again.\n" |
1496 "| - either: hg rebase -dest 'p1(%(d)s)' -r %(o)s" |
1497 "| - either: hg rebase --dest 'p1(%(d)s)' -r %(o)s\n" |
1497 "| - or: hg rebase -dest 'p1(%(d)s)' -r %(o)s" |
1498 "| - or: hg rebase --dest 'p1(%(o)s)' -r %(d)s" |
1498 % {'d': divergent, 'o': other}) |
1499 % {'d': divergent, 'o': other}) |
1499 |
1500 |
1500 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) |
1501 displayer = cmdutil.show_changeset(ui, repo, {'template': shorttemplate}) |
1501 if not ui.quiet or confirm: |
1502 if not ui.quiet or confirm: |
1502 ui.write(_('merge:')) |
1503 ui.write(_('merge:')) |