Rev 12: Give sane error when branch is already rebased. in file:///data/jelmer/bzr-rebase/trunk/

Jelmer Vernooij jelmer at samba.org
Thu Jul 12 09:22:39 BST 2007


At file:///data/jelmer/bzr-rebase/trunk/

------------------------------------------------------------
revno: 12
revision-id: jelmer at samba.org-20070704222709-g4w9omwnp8frqeas
parent: jelmer at samba.org-20070704220938-qjvoljldyr2t6rqi
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: bzr-rebase
timestamp: Thu 2007-07-05 00:27:09 +0200
message:
  Give sane error when branch is already rebased.
modified:
  __init__.py                    __init__.py-20070626215909-fi0s39bkwxn4gcto-1
=== modified file '__init__.py'
--- a/__init__.py	2007-07-04 22:03:27 +0000
+++ b/__init__.py	2007-07-04 22:27:09 +0000
@@ -55,17 +55,22 @@
 
             wt.branch.repository.fetch(upstream_repository, onto)
 
-            start_revid = None
             revhistory = wt.branch.revision_history()
             revhistory.reverse()
+            common_revid = None
             for revid in revhistory:
                 if revid in upstream.revision_history():
-                    start_revid = wt.branch.get_rev_id(wt.branch.revision_id_to_revno(revid)+1)
+                    common_revid = revid
                     break
 
-            if start_revid is None:
+            if common_revid is None:
                 raise UnrelatedBranches()
 
+            if common_revid == upstream.last_revision():
+                raise BzrCommandError("Already rebased on %s" % upstream)
+
+            start_revid = wt.branch.get_rev_id(wt.branch.revision_id_to_revno(common_revid)+1)
+
             # Create plan
             replace_map = generate_simple_plan(
                     wt.branch.repository, 
@@ -84,6 +89,7 @@
         finally:
             wt.unlock()
 
+
 class cmd_rebase_abort(Command):
     """Abort an interrupted rebase
 




More information about the bazaar-commits mailing list