Show More
@@ -841,16 +841,21 b' def restorestatus(repo):' | |||||
841 | raise |
|
841 | raise | |
842 | raise util.Abort(_('no rebase in progress')) |
|
842 | raise util.Abort(_('no rebase in progress')) | |
843 |
|
843 | |||
844 |
def |
|
844 | def needupdate(repo, state): | |
845 | '''check whether the working dir is in an interrupted rebase''' |
|
845 | '''check whether we should `update --clean` away from a merge, or if | |
|
846 | somehow the working dir got forcibly updated, e.g. by older hg''' | |||
846 | parents = [p.rev() for p in repo.parents()] |
|
847 | parents = [p.rev() for p in repo.parents()] | |
847 | if originalwd in parents: |
|
848 | ||
|
849 | # Are we in a merge state at all? | |||
|
850 | if len(parents) < 2: | |||
|
851 | return False | |||
|
852 | ||||
|
853 | # We should be standing on the first as-of-yet unrebased commit. | |||
|
854 | firstunrebased = min([old for old, new in state.iteritems() | |||
|
855 | if new == nullrev]) | |||
|
856 | if firstunrebased in parents: | |||
848 | return True |
|
857 | return True | |
849 |
|
858 | |||
850 | for newrev in state.itervalues(): |
|
|||
851 | if newrev in parents: |
|
|||
852 | return True |
|
|||
853 |
|
||||
854 | return False |
|
859 | return False | |
855 |
|
860 | |||
856 | def abort(repo, originalwd, target, state, activebookmark=None): |
|
861 | def abort(repo, originalwd, target, state, activebookmark=None): | |
@@ -877,7 +882,7 b' def abort(repo, originalwd, target, stat' | |||||
877 |
|
882 | |||
878 | if cleanup: |
|
883 | if cleanup: | |
879 | # Update away from the rebase if necessary |
|
884 | # Update away from the rebase if necessary | |
880 |
if |
|
885 | if needupdate(repo, state): | |
881 | merge.update(repo, originalwd, False, True, False) |
|
886 | merge.update(repo, originalwd, False, True, False) | |
882 |
|
887 | |||
883 | # Strip from the first rebased revision |
|
888 | # Strip from the first rebased revision |
@@ -288,3 +288,36 b' user has somehow managed to update to a ' | |||||
288 | new |
|
288 | new | |
289 |
|
289 | |||
290 | $ cd .. |
|
290 | $ cd .. | |
|
291 | ||||
|
292 | On the other hand, make sure we *do* clobber changes whenever we | |||
|
293 | haven't somehow managed to update the repo to a different revision | |||
|
294 | during a rebase (issue4661) | |||
|
295 | ||||
|
296 | $ hg ini yesupdate | |||
|
297 | $ cd yesupdate | |||
|
298 | $ echo "initial data" > foo.txt | |||
|
299 | $ hg add | |||
|
300 | adding foo.txt | |||
|
301 | $ hg ci -m "initial checkin" | |||
|
302 | $ echo "change 1" > foo.txt | |||
|
303 | $ hg ci -m "change 1" | |||
|
304 | $ hg up 0 | |||
|
305 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
306 | $ echo "conflicting change 1" > foo.txt | |||
|
307 | $ hg ci -m "conflicting 1" | |||
|
308 | created new head | |||
|
309 | $ echo "conflicting change 2" > foo.txt | |||
|
310 | $ hg ci -m "conflicting 2" | |||
|
311 | ||||
|
312 | $ hg rebase -d 1 --tool 'internal:fail' | |||
|
313 | rebasing 2:e4ea5cdc9789 "conflicting 1" | |||
|
314 | unresolved conflicts (see hg resolve, then hg rebase --continue) | |||
|
315 | [1] | |||
|
316 | $ hg rebase --abort | |||
|
317 | rebase aborted | |||
|
318 | $ hg summary | |||
|
319 | parent: 3:b16646383533 tip | |||
|
320 | conflicting 2 | |||
|
321 | branch: default | |||
|
322 | commit: (clean) | |||
|
323 | update: 1 new changesets, 2 branch heads (merge) |
General Comments 0
You need to be logged in to leave comments.
Login now