[SoC] Rebase feature - Nested revisions

Javier Merino cibervicho at gmail.com
Fri May 30 12:15:35 CDT 2008


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.

# HG changeset patch
# User Javier Merino <cibervicho at gmail.com>
# Date 1212167652 -7200
# Node ID f9061368a9ea0442fe65fd1085edbf6fac77801c
# Parent  ae29cc0ed86a697187442673f5a54ea369b3064e
Refuse to run if the working directory is not clean.

diff -r ae29cc0ed86a -r f9061368a9ea rebase.py
--- a/rebase.py Fri May 30 18:00:56 2008 +0200
+++ b/rebase.py Fri May 30 19:14:12 2008 +0200
@@ -21,9 +21,15 @@
         self.ui = ui
         self.repo = repo
         self.opts = opts
+        self._checkwdclean()
         self._checkheads()
         self._definepoints()
         self._rebase()
+
+    def _checkwdclean(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())


More information about the Mercurial-devel mailing list