[SoC] Rebase feature - Nested revisions
Javier Merino
cibervicho at gmail.com
Sat May 31 10:17:09 UTC 2008
2008/5/31 Christian Ebert wrote:
> * Javier Merino on Friday, May 30, 2008 at 19:15:35 +0200
>> Hi, I think it would be nice if rebase refused to run if it found
>> changes in the working directory. One of the first steps when rebasing
>> is hg.clean(), so local changes are lost without even prompting the
>> user! I think this patch fixes it.
>> [...]
>
> Depending on context, one could simply use
> cmdutil.bail_if_changed instead.
Yes, it is much better. Sorry, I didn't knew that command.
# HG changeset patch
# User Javier Merino <cibervicho at gmail.com>
# Date 1212228763 -7200
# Node ID 7929b6f636c45415aa9f2eebfe9b284d58783d80
# Parent b98d2ff28f37687d845dc0e39fa2801f762aa15a
Use the already existing cmdutil bail_if_changed() instead of making a
new function.
As Christian Ebert suggests, there's no point in reinventing the wheel.
diff -r b98d2ff28f37 -r 7929b6f636c4 rebase.py
--- a/rebase.py Fri May 30 19:14:12 2008 +0200
+++ b/rebase.py Sat May 31 12:12:43 2008 +0200
@@ -13,6 +13,7 @@
from mercurial import util, revlog, repair, merge
from mercurial.commands import templateopts
+from mercurial.cmdutil import bail_if_changed
from mercurial.i18n import _
import os, errno
@@ -21,15 +22,10 @@
self.ui = ui
self.repo = repo
self.opts = opts
- self._checkworkingdirstatus()
+ bail_if_changed(repo)
self._checkheads()
self._definepoints()
self._rebase()
-
- def _checkworkingdirstatus(self):
- m, a, r, d = self.repo.status()[:4]
- if m or a or r or d:
- raise util.Abort(_("local changes found"))
def _checkheads(self):
numheads = len(self.repo.heads())
diff -r b98d2ff28f37 -r 7929b6f636c4 tests/test-rebase-validate.out
--- a/tests/test-rebase-validate.out Fri May 30 19:14:12 2008 +0200
+++ b/tests/test-rebase-validate.out Sat May 31 12:12:43 2008 +0200
@@ -40,4 +40,4 @@
abort: cannot rebase an intermediate point
% - uncommitted changes
-abort: local changes found
+abort: outstanding uncommitted changes
More information about the Mercurial-devel
mailing list