Rev 2: Add stubs for testsuite, rebase-continue and rebase-abort commands. in file:///home/jelmer/bzr/bzr-rebase/

Jelmer Vernooij jelmer at samba.org
Wed Jul 4 01:01:45 BST 2007


At file:///home/jelmer/bzr/bzr-rebase/

------------------------------------------------------------
revno: 2
revision-id: jelmer at samba.org-20070626224945-gpt2exzzuak611qa
parent: jelmer at samba.org-20070626220011-tgu4eueha4j7b68m
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: bzr-rebase
timestamp: Wed 2007-06-27 00:49:45 +0200
message:
  Add stubs for testsuite, rebase-continue and rebase-abort commands.
added:
  rebase.py                      rebase.py-20070626221123-ellanmf93nw8z9r1-1
  test_rebase.py                 test_rebase.py-20070626221123-ellanmf93nw8z9r1-2
modified:
  README                         readme-20070626220000-c62864tuxlldx6uc-1
  __init__.py                    __init__.py-20070626215909-fi0s39bkwxn4gcto-1
=== added file 'rebase.py'
--- a/rebase.py	1970-01-01 00:00:00 +0000
+++ b/rebase.py	2007-06-26 22:49:45 +0000
@@ -0,0 +1,15 @@
+# Copyright (C) 2006-2007 by Jelmer Vernooij
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

=== added file 'test_rebase.py'
--- a/test_rebase.py	1970-01-01 00:00:00 +0000
+++ b/test_rebase.py	2007-06-26 22:49:45 +0000
@@ -0,0 +1,16 @@
+# Copyright (C) 2006-2007 by Jelmer Vernooij
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+

=== modified file 'README'
--- a/README	2007-06-26 22:00:11 +0000
+++ b/README	2007-06-26 22:49:45 +0000
@@ -1,2 +1,24 @@
 This plugin provides a 'bzr rebase' command, in the same fashion of the 
 famous git-rebase.
+
+
+How it works
+============
+The plugin will start off by writing a plan for the rebase, which it 
+will write to .bzr/checkout/rebase-state. If the rebase is interrupted and 
+needs to be continued or aborted, it will read this file to see what needs 
+(still) needs to be done.
+
+The rebase-state file contains the following information:
+ * last-revision-info when the rebase was started
+ * map of revisions that need to be replaced. In simple situations, 
+   this would just be one revision. In more complex situations 
+   (upgrading from one bzr-svn mapping version to another), it 
+   could be a longer list.
+
+   The map is from old to new revids.
+ * map of revisions that need to be rewritten. In simple situations, 
+   this would be the set of revisions between the upstream head and the 
+   local working tree head.
+
+   The map is from old to (planned) new revids.

=== modified file '__init__.py'
--- a/__init__.py	2007-06-26 22:00:11 +0000
+++ b/__init__.py	2007-06-26 22:49:45 +0000
@@ -1,5 +1,21 @@
+# Copyright (C) 2007 by Jelmer Vernooij
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-from bzrlib.command import Command
+from bzrlib.commands import Command, Option, display_command
+from bzrlib.workingtree import WorkingTree
 
 class cmd_rebase(Command):
     """Re-base a branch.
@@ -10,5 +26,57 @@
     
     @display_command
     def run(self, upstream, onto=None):
-        pass
+        wt = WorkingTree.open('.')
+        # TODO: Abort if there are any pending changes
+        # TODO: Abort if there are any conflicts
+        # TODO: Pull required revisions
+        # TODO: Write plan file
+        # TODO: Start executing plan
+        # If any conflicts occur:
+        #   TODO: Apply failed merge to the working tree
+        #   TODO: Inform user about rebase-continue and rebase-abort
+        #   TODO: Abort
+        # TODO: Remove plan file
+
+class cmd_rebase_abort(Command):
+    """Abort an interrupted rebase
+
+    """
+    
+    @display_command
+    def run(self):
+        wt = WorkingTree.open('.')
+        # TODO: Read plan file
+        # TODO: Set last revision
+
+
+class cmd_rebase_continue(Command):
+    """Continue an interrupted rebase after resolving conflicts
+
+    """
+    
+    @display_command
+    def run(self):
+        wt = WorkingTree.open('.')
+        # TODO: Read plan file
+        # TODO: Abort if there are any conflicts
+        # TODO: Start executing plan from current Branch.last_revision()
+        # If conflict appears:
+        #   TODO: Apply failed merge to the working tree
+        #   TODO: Inform user about rebase-continue and rebase-abort
+        #   TODO: Abort
+        # TODO: Remove plan file  
+
+
+def test_suite():
+    from unittest import TestSuite
+    from bzrlib.tests import TestUtil
+
+    loader = TestUtil.TestLoader()
+    suite = TestSuite()
+    testmod_names = [
+            'test_rebase']
+    suite.addTest(loader.loadTestsFromModuleNames(["%s.%s" % (__name__, i) for i in testmod_names]))
+
+    return suite
 




More information about the bazaar-commits mailing list