Rev 1188: Rename svn-dpush -> dpush. in file:///data/jelmer/bzr-svn/dpush/

Jelmer Vernooij jelmer at samba.org
Sun Jun 29 02:38:05 BST 2008


At file:///data/jelmer/bzr-svn/dpush/

------------------------------------------------------------
revno: 1188
revision-id: jelmer at samba.org-20080629013804-dfkyd0zksxngb1b3
parent: jelmer at samba.org-20080629010425-a4iyg0fm6zr0iw2f
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: dpush
timestamp: Sun 2008-06-29 03:38:04 +0200
message:
  Rename svn-dpush -> dpush.
modified:
  __init__.py                    __init__.py-20051008155114-eae558e6cf149e1d
  tests/test_blackbox.py         test_blackbox.py-20070325150839-d10llf8arptpcfl6-1
=== modified file '__init__.py'
--- a/__init__.py	2008-06-29 01:04:25 +0000
+++ b/__init__.py	2008-06-29 01:38:04 +0000
@@ -369,7 +369,7 @@
 
 register_command(cmd_svn_push)
 
-class cmd_svn_dpush(Command):
+class cmd_dpush(Command):
     """Push revisions to Subversion without setting any magic Bazaar-specific 
     properties.
 
@@ -385,13 +385,14 @@
             ),
             Option('no-rebase', help="Don't rebase after push")]
 
-    def run(self, location=None, remember=False, 
-            directory=None, no_rebase=False):
+    def run(self, location=None, remember=False, directory=None, no_rebase=False):
+        from bzrlib import urlutils
         from bzrlib.bzrdir import BzrDir
         from bzrlib.branch import Branch
         from bzrlib.errors import NotBranchError, BzrCommandError, NoWorkingTree
-        from bzrlib.commit import dpush
-        from bzrlib import urlutils
+        from bzrlib.workingtree import WorkingTree
+
+        from bzrlib.plugins.svn.commit import dpush
 
         if directory is None:
             directory = "."
@@ -412,14 +413,6 @@
                 location = stored_loc
 
         bzrdir = BzrDir.open(location)
-        if revision is not None:
-            if len(revision) > 1:
-                raise BzrCommandError(
-                    'bzr svn-dpush --revision takes exactly one revision' 
-                    ' identifier')
-            revision_id = revision[0].as_revision_id(source_branch)
-        else:
-            revision_id = None
         target_branch = bzrdir.open_branch()
         target_branch.lock_write()
         revid_map = dpush(target_branch, source_branch)
@@ -427,13 +420,15 @@
         if source_branch.get_push_location() is None or remember:
             source_branch.set_push_location(target_branch.base)
         if not no_rebase:
-            new_last_revid = revid_map[source_branch.last_revision()]
-            source_branch.set_last_revision(new_last_revid)
+            revno, old_last_revid = source_branch.last_revision_info()
+            new_last_revid = revid_map[old_last_revid]
+            source_branch.repository.fetch(target_branch.repository, new_last_revid)
+            source_branch.set_last_revision_info(revno, new_last_revid)
             if source_wt is not None:
                 source_wt.set_last_revision(new_last_revid)
 
 
-register_command(cmd_svn_dpush)
+register_command(cmd_dpush)
 
 
 class cmd_svn_branching_scheme(Command):

=== modified file 'tests/test_blackbox.py'
--- a/tests/test_blackbox.py	2008-06-26 16:34:37 +0000
+++ b/tests/test_blackbox.py	2008-06-29 01:38:04 +0000
@@ -46,6 +46,46 @@
         repos_url = self.make_repository('d')
         self.run_bzr('info -v %s' % repos_url)
 
+    def test_push(self):
+        repos_url = self.make_repository('d')
+        
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("foo").modify()
+        dc.close()
+
+        self.run_bzr("branch %s dc" % repos_url)
+        self.build_tree({"dc/foo": "blaaaa"})
+        self.run_bzr("commit -m msg dc")
+        self.run_bzr("push -d dc %s" % repos_url)
+        self.check_output("", "status dc")
+
+    def test_dpush(self):
+        repos_url = self.make_repository('d')
+        
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("foo").modify()
+        dc.close()
+
+        self.run_bzr("branch %s dc" % repos_url)
+        self.build_tree({"dc/foo": "blaaaa"})
+        self.run_bzr("commit -m msg dc")
+        self.run_bzr("dpush -d dc %s" % repos_url)
+        self.check_output("", "status dc")
+
+    def test_dpush_new(self):
+        repos_url = self.make_repository('d')
+        
+        dc = self.get_commit_editor(repos_url)
+        dc.add_file("foo").modify()
+        dc.close()
+
+        self.run_bzr("branch %s dc" % repos_url)
+        self.build_tree({"dc/foofile": "blaaaa"})
+        self.run_bzr("add dc/foofile")
+        self.run_bzr("commit -m msg dc")
+        self.run_bzr("dpush -d dc %s" % repos_url)
+        self.check_output("", "status dc")
+
     def test_info_workingtree(self):
         repos_url = self.make_client('d', 'dc')
         self.run_bzr('info -v dc')




More information about the bazaar-commits mailing list