Rev 1536: Support push --overwrite. in http://people.samba.org/bzr/jelmer/bzr-svn/trunk

Jelmer Vernooij jelmer at samba.org
Sat Aug 2 22:38:51 BST 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/trunk

------------------------------------------------------------
revno: 1536
revision-id: jelmer at samba.org-20080802213849-ek8i3wuewwon5d4a
parent: jelmer at samba.org-20080802212007-iqtbuyv3wnd7oe3v
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Sat 2008-08-02 23:38:49 +0200
message:
  Support push --overwrite.
modified:
  NEWS                           news-20061231030336-h9fhq245ie0de8bs-1
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  branch.py                      svnbranch.py-20051017135706-11c749eb0dab04a7
  tests/test_push.py             test_push.py-20070201165715-g2ievcdfqi33wqsy-1
=== modified file 'NEWS'
--- a/NEWS	2008-08-02 21:20:07 +0000
+++ b/NEWS	2008-08-02 21:38:49 +0000
@@ -44,6 +44,8 @@
 
    * Much faster Repository.get_revision_delta(). (#127030)
 
+   * Support push --overwrite. (#118787)
+
   BUG FIXES
 
    * Now uses absolute imports and no longer adds plugin directory to the 

=== modified file '__init__.py'
--- a/__init__.py	2008-07-31 01:30:15 +0000
+++ b/__init__.py	2008-08-02 21:38:49 +0000
@@ -22,7 +22,6 @@
 commands at the moment do not:
 
  - bzr uncommit
- - bzr push --overwrite
 
 bzr-svn also adds two new commands to Bazaar:
 

=== modified file 'branch.py'
--- a/branch.py	2008-07-23 00:14:53 +0000
+++ b/branch.py	2008-08-02 21:38:49 +0000
@@ -436,13 +436,7 @@
         source.lock_read()
         try:
             (result.old_revno, result.old_revid) = self.last_revision_info()
-            try:
-                self.update_revisions(source, stop_revision)
-            except DivergedBranches:
-                if overwrite:
-                    raise NotImplementedError('overwrite not supported for '
-                                              'Subversion branches')
-                raise
+            self.update_revisions(source, stop_revision, overwrite)
             result.tag_conflicts = source.tags.merge_to(self.tags, overwrite)
             (result.new_revno, result.new_revid) = self.last_revision_info()
             return result
@@ -483,8 +477,6 @@
     def update_revisions(self, other, stop_revision=None, overwrite=False, 
                          graph=None):
         """See Branch.update_revisions()."""
-        if overwrite:
-            raise NotImplementedError("overwrite not supported for Subversion branches")
         if stop_revision is None:
             stop_revision = ensure_null(other.last_revision())
         if (self.last_revision() == stop_revision or
@@ -494,10 +486,10 @@
             graph = self.repository.get_graph()
         if not other.repository.get_graph().is_ancestor(self.last_revision(), 
                                                         stop_revision):
-            if graph.is_ancestor(stop_revision, 
-                                                       self.last_revision()):
+            if graph.is_ancestor(stop_revision, self.last_revision()):
                 return
-            raise DivergedBranches(self, other)
+            if not overwrite:
+                raise DivergedBranches(self, other)
         todo = self.mainline_missing_revisions(other, stop_revision)
         if todo is None:
             # Not possible to add cleanly onto mainline, perhaps need a replace operation

=== modified file 'tests/test_push.py'
--- a/tests/test_push.py	2008-07-23 18:57:39 +0000
+++ b/tests/test_push.py	2008-08-02 21:38:49 +0000
@@ -692,15 +692,15 @@
 
         self.build_tree({'d2/myfile': "France"})
         bzrwt2.add("myfile")
-        revid2 = bzrwt1.commit("Do a commit")
+        revid2 = bzrwt2.commit("Do a commit")
 
         bzrwt1.branch.push(Branch.open(repos_url+"/trunk"))
-
-        raise KnownFailure("push --overwrite not supported yet")
+        self.assertEquals(bzrwt1.branch.revision_history(),
+                Branch.open(repos_url+"/trunk").revision_history())
 
         bzrwt2.branch.push(Branch.open(repos_url+"/trunk"), overwrite=True)
 
-        self.assertEquals([revid2], 
+        self.assertEquals(bzrwt2.branch.revision_history(),
                 Branch.open(repos_url+"/trunk").revision_history())
 
     def test_complex_rename(self):




More information about the bazaar-commits mailing list