Rev 5325: (Martin von Gagern) Deal with branch: revision specs in readonly in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Jun 28 22:45:13 BST 2010


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

------------------------------------------------------------
revno: 5325 [merge]
revision-id: pqm at pqm.ubuntu.com-20100628214510-y3vbugut3gjm66u6
parent: pqm at pqm.ubuntu.com-20100628044207-67md0bfc3ojod6of
parent: john at arbash-meinel.com-20100628192124-myeiawlilr1h0znz
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2010-06-28 22:45:10 +0100
message:
  (Martin von Gagern) Deal with branch: revision specs in readonly
  	transactions
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
  bzrlib/tests/blackbox/test_log.py test_log.py-20060112090212-78f6ea560c868e24
=== modified file 'NEWS'
--- a/NEWS	2010-06-28 03:23:26 +0000
+++ b/NEWS	2010-06-28 21:45:10 +0000
@@ -54,6 +54,10 @@
 * ``bzr log --exclude-common-ancestry`` is now taken into account for
   linear ancetries. (Vincent Ladeuil, #575631)
 
+* ``bzr log -r branch:REMOTE`` can now properly log the remote branch,
+  rather than trying to fetch the data locally and failing because of a
+  readonly error. (Martin von Gagern, #149270)
+
 * ``bzr pull`` now works when a lp: URL is explicitly defined as the parent
   or pull location in locations.conf or branch.conf.
   (Gordon Tyler, #534787)

=== modified file 'bzrlib/revisionspec.py'
--- a/bzrlib/revisionspec.py	2010-02-17 17:11:16 +0000
+++ b/bzrlib/revisionspec.py	2010-06-24 20:51:59 +0000
@@ -813,8 +813,14 @@
         revision_b = other_branch.last_revision()
         if revision_b in (None, revision.NULL_REVISION):
             raise errors.NoCommits(other_branch)
-        # pull in the remote revisions so we can diff
-        branch.fetch(other_branch, revision_b)
+        if branch is None:
+            branch = other_branch
+        else:
+            try:
+                # pull in the remote revisions so we can diff
+                branch.fetch(other_branch, revision_b)
+            except errors.ReadOnlyError:
+                branch = other_branch
         try:
             revno = branch.revision_id_to_revno(revision_b)
         except errors.NoSuchRevision:
@@ -840,6 +846,12 @@
             raise errors.NoCommits(other_branch)
         return other_branch.repository.revision_tree(last_revision)
 
+    def needs_branch(self):
+        return False
+
+    def get_branch(self):
+        return self.spec
+
 
 
 class RevisionSpec_submit(RevisionSpec_ancestor):

=== modified file 'bzrlib/tests/blackbox/test_log.py'
--- a/bzrlib/tests/blackbox/test_log.py	2010-06-08 08:24:39 +0000
+++ b/bzrlib/tests/blackbox/test_log.py	2010-06-25 08:01:24 +0000
@@ -158,6 +158,19 @@
         self.make_linear_branch()
         self.assertLogRevnos(['-c1'], ['1'])
 
+    def test_branch_revspec(self):
+        foo = self.make_branch_and_tree('foo')
+        bar = self.make_branch_and_tree('bar')
+        self.build_tree(['foo/foo.txt', 'bar/bar.txt'])
+        foo.add('foo.txt')
+        bar.add('bar.txt')
+        foo.commit(message='foo')
+        bar.commit(message='bar')
+        self.run_bzr('log -r branch:../bar', working_dir='foo')
+        self.assertEqual([bar.branch.get_rev_id(1)],
+                         [r.rev.revision_id
+                          for r in self.get_captured_revisions()])
+
 
 class TestLogExcludeCommonAncestry(TestLogWithLogCatcher):
 




More information about the bazaar-commits mailing list