##// END OF EJS Templates
rollback: detect "parentgone" case earlier...
marmoute -
r50964:81870c92 default
parent child Browse files
Show More
@@ -2709,6 +2709,8 b' class localrepository:'
2709 2709 @unfilteredmethod # Until we get smarter cache management
2710 2710 def _rollback(self, dryrun, force, dsguard):
2711 2711 ui = self.ui
2712
2713 parents = self.dirstate.parents()
2712 2714 try:
2713 2715 args = self.vfs.read(b'undo.desc').splitlines()
2714 2716 (oldlen, desc, detail) = (int(args[0]), args[1], None)
@@ -2725,9 +2727,11 b' class localrepository:'
2725 2727 msg = _(
2726 2728 b'repository tip rolled back to revision %d (undo %s)\n'
2727 2729 ) % (oldtip, desc)
2730 parentgone = any(self[p].rev() > oldtip for p in parents)
2728 2731 except IOError:
2729 2732 msg = _(b'rolling back unknown transaction\n')
2730 2733 desc = None
2734 parentgone = True
2731 2735
2732 2736 if not force and self[b'.'] != self[b'tip'] and desc == b'commit':
2733 2737 raise error.Abort(
@@ -2742,7 +2746,6 b' class localrepository:'
2742 2746 if dryrun:
2743 2747 return 0
2744 2748
2745 parents = self.dirstate.parents()
2746 2749 self.destroying()
2747 2750 vfsmap = {b'plain': self.vfs, b'': self.svfs}
2748 2751 transaction.rollback(
@@ -2757,8 +2760,6 b' class localrepository:'
2757 2760 self.svfs.rename(b'undo.phaseroots', b'phaseroots', checkambig=True)
2758 2761 self.invalidate()
2759 2762
2760 has_node = self.changelog.index.has_node
2761 parentgone = any(not has_node(p) for p in parents)
2762 2763 if parentgone:
2763 2764 # prevent dirstateguard from overwriting already restored one
2764 2765 dsguard.close()
@@ -200,6 +200,7 b' same again, but emulate an old client th'
200 200 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
201 201 $ hg rollback
202 202 rolling back unknown transaction
203 working directory now based on revision 0
203 204 $ cat a
204 205 a
205 206
General Comments 0
You need to be logged in to leave comments. Login now