Rev 5659: (jelmer) Fix ``bzr lp-mirror`` to work on command line branch URLs and in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Feb 11 11:49:28 UTC 2011


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5659 [merge]
revision-id: pqm at pqm.ubuntu.com-20110211114925-r8vawh0c4vlf2tfo
parent: pqm at pqm.ubuntu.com-20110210163054-0fv1ac5k18e8859h
parent: maxb at f2s.com-20110211053704-ywajvzlfspfisu2s
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2011-02-11 11:49:25 +0000
message:
  (jelmer) Fix ``bzr lp-mirror`` to work on command line branch URLs and
   branches without an explicit public location. (Max Bowsher)
modified:
  bzrlib/plugins/launchpad/__init__.py __init__.py-20060315182712-2d5feebd2a1032dc
  bzrlib/plugins/launchpad/lp_api.py lp_api.py-20090704082908-79il6zl4gugwl3wz-1
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/plugins/launchpad/__init__.py'
--- a/bzrlib/plugins/launchpad/__init__.py	2011-01-10 22:20:12 +0000
+++ b/bzrlib/plugins/launchpad/__init__.py	2011-02-11 05:37:04 +0000
@@ -296,11 +296,12 @@
     def run(self, location='.'):
         from bzrlib.plugins.launchpad import lp_api
         from bzrlib.plugins.launchpad.lp_registration import LaunchpadService
-        branch = _mod_branch.Branch.open(location)
+        branch, _ = _mod_branch.Branch.open_containing(location)
         service = LaunchpadService()
         launchpad = lp_api.login(service)
-        lp_branch = lp_api.load_branch(launchpad, branch)
-        lp_branch.requestMirror()
+        lp_branch = lp_api.LaunchpadBranch.from_bzr(launchpad, branch,
+                create_missing=False)
+        lp_branch.lp.requestMirror()
 
 
 register_command(cmd_launchpad_mirror)

=== modified file 'bzrlib/plugins/launchpad/lp_api.py'
--- a/bzrlib/plugins/launchpad/lp_api.py	2011-02-03 05:13:46 +0000
+++ b/bzrlib/plugins/launchpad/lp_api.py	2011-02-11 05:27:33 +0000
@@ -35,7 +35,6 @@
     )
 from bzrlib.plugins.launchpad.lp_registration import (
     InvalidLaunchpadInstance,
-    NotLaunchpadBranch,
     )
 
 try:
@@ -197,6 +196,9 @@
         url = bzr_branch.get_push_location()
         if url is not None:
             yield url
+        url = bzr_branch.get_parent()
+        if url is not None:
+            yield url
         yield bzr_branch.base
 
     @staticmethod
@@ -294,29 +296,6 @@
         return self.bzr.repository.revision_tree(lca)
 
 
-def load_branch(launchpad, branch):
-    """Return the launchpadlib Branch object corresponding to 'branch'.
-
-    :param launchpad: The root `Launchpad` object from launchpadlib.
-    :param branch: A `bzrlib.branch.Branch`.
-    :raise NotLaunchpadBranch: If we cannot determine the Launchpad URL of
-        `branch`.
-    :return: A launchpadlib Branch object.
-    """
-    # XXX: This duplicates the "What are possible URLs for the branch that
-    # Launchpad might recognize" logic found in cmd_lp_open.
-
-    # XXX: This makes multiple roundtrips to Launchpad for what is
-    # conceptually a single operation -- get me the branches that match these
-    # URLs. Unfortunately, Launchpad's support for such operations is poor, so
-    # we have to allow multiple roundtrips.
-    for url in branch.get_public_branch(), branch.get_push_location():
-        lp_branch = launchpad.branches.getByUrl(url=url)
-        if lp_branch:
-            return lp_branch
-    raise NotLaunchpadBranch(url)
-
-
 def canonical_url(object):
     """Return the canonical URL for a branch."""
     scheme, netloc, path, params, query, fragment = urlparse.urlparse(

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-02-10 16:30:54 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-02-11 11:49:25 +0000
@@ -89,6 +89,9 @@
 * ``bzr dump-btree --raw`` no longer tracebacks on a B-Tree file
   containing no rows. (Eric Siegerman, #715508)
 
+* Fix ``bzr lp-mirror`` to work on command line branch URLs and branches
+  without an explicit public location. (Max Bowsher)
+
 Documentation
 *************
 




More information about the bazaar-commits mailing list