##// END OF EJS Templates
rebase: avoid clobbering wdir() with --dry-run or --confirm (issue6291)...
Matt Harbison -
r45458:1f114c79 stable
parent child Browse files
Show More
@@ -367,7 +367,9 b' class rebaseruntime(object):'
367 367 skippedset.update(obsoleteextinctsuccessors)
368 368 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
369 369
370 def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
370 def _prepareabortorcontinue(
371 self, isabort, backup=True, suppwarns=False, dryrun=False, confirm=False
372 ):
371 373 self.resume = True
372 374 try:
373 375 self.restorestatus()
@@ -390,7 +392,12 b' class rebaseruntime(object):'
390 392
391 393 if isabort:
392 394 backup = backup and self.backupf
393 return self._abort(backup=backup, suppwarns=suppwarns)
395 return self._abort(
396 backup=backup,
397 suppwarns=suppwarns,
398 dryrun=dryrun,
399 confirm=confirm,
400 )
394 401
395 402 def _preparenewrebase(self, destmap):
396 403 if not destmap:
@@ -749,7 +756,7 b' class rebaseruntime(object):'
749 756 ):
750 757 bookmarks.activate(repo, self.activebookmark)
751 758
752 def _abort(self, backup=True, suppwarns=False):
759 def _abort(self, backup=True, suppwarns=False, dryrun=False, confirm=False):
753 760 '''Restore the repository to its original state.'''
754 761
755 762 repo = self.repo
@@ -793,7 +800,10 b' class rebaseruntime(object):'
793 800
794 801 updateifonnodes = set(rebased)
795 802 updateifonnodes.update(self.destmap.values())
796 updateifonnodes.add(self.originalwd)
803
804 if not dryrun and not confirm:
805 updateifonnodes.add(self.originalwd)
806
797 807 shouldupdate = repo[b'.'].rev() in updateifonnodes
798 808
799 809 # Update away from the rebase if necessary
@@ -1119,7 +1129,10 b' def _dryrunrebase(ui, repo, action, opts'
1119 1129 rbsrt._finishrebase()
1120 1130 else:
1121 1131 rbsrt._prepareabortorcontinue(
1122 isabort=True, backup=False, suppwarns=True
1132 isabort=True,
1133 backup=False,
1134 suppwarns=True,
1135 confirm=confirm,
1123 1136 )
1124 1137 needsabort = False
1125 1138 else:
@@ -1134,7 +1147,10 b' def _dryrunrebase(ui, repo, action, opts'
1134 1147 if needsabort:
1135 1148 # no need to store backup in case of dryrun
1136 1149 rbsrt._prepareabortorcontinue(
1137 isabort=True, backup=False, suppwarns=True
1150 isabort=True,
1151 backup=False,
1152 suppwarns=True,
1153 dryrun=opts.get(b'dry_run'),
1138 1154 )
1139 1155
1140 1156
@@ -339,15 +339,23 b' Reopen branch by rebase'
339 339 -A
340 340 +A-mod
341 341
342 BUG: This shouldn't affect wdir
342 --dry-run doesn't affect a dirty working directory that is unrelated to the
343 source or destination.
343 344
344 345 $ hg rebase -s tip -d 4 --dry-run
345 346 starting dry-run rebase; repository will not be changed
346 347 rebasing 11:be1dea60f2a6 "D" (tip)
347 348 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
348 349 $ hg diff
350 diff -r 2b586e70108d A
351 --- a/A Thu Jan 01 00:00:00 1970 +0000
352 +++ b/A Thu Jan 01 00:00:00 1970 +0000
353 @@ -1,1 +1,1 @@
354 -A
355 +A-mod
349 356
350 BUG: This shouldn't affect wdir
357 Bailing out on --confirm doesn't affect a dirty working directory that is
358 unrelated to the source or destination.
351 359
352 360 $ echo A-mod > A
353 361 $ echo n | hg rebase -s tip -d 4 --confirm --config ui.interactive=True
@@ -356,6 +364,12 b" BUG: This shouldn't affect wdir"
356 364 rebase completed successfully
357 365 apply changes (yn)? n
358 366 $ hg diff
367 diff -r 2b586e70108d A
368 --- a/A Thu Jan 01 00:00:00 1970 +0000
369 +++ b/A Thu Jan 01 00:00:00 1970 +0000
370 @@ -1,1 +1,1 @@
371 -A
372 +A-mod
359 373
360 374 $ echo A-mod > A
361 375 $ hg rebase -s tip -d 4 --confirm
General Comments 0
You need to be logged in to leave comments. Login now