diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -643,14 +643,7 @@ def unbundle(repo, cg, heads, source, ur try: check_heads(repo, heads, 'uploading changes') # push can proceed - try: - r = changegroup.addchangegroup(repo, cg, source, url) - except util.Abort, inst: - # The old code we moved used sys.stderr directly. - # We did not changed it to minise code change. - # This need to be moved to something proper. - # Feel free to do it. - sys.stderr.write("abort: %s\n" % inst) + r = changegroup.addchangegroup(repo, cg, source, url) finally: lock.release() return r diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -63,7 +63,7 @@ def unfilteredmethod(orig): return wrapper moderncaps = set(('lookup', 'branchmap', 'pushkey', 'known', 'getbundle', - 'bundle2')) + 'bundle2', 'unbundle')) legacycaps = moderncaps.union(set(['changegroupsubset'])) class localpeer(peer.peerrepository): @@ -112,6 +112,15 @@ class localpeer(peer.peerrepository): # TODO We might want to move the next two calls into legacypeer and add # unbundle instead. + def unbundle(self, cg, heads, url): + """apply a bundle on a repo + + This function handles the repo locking itself.""" + try: + return exchange.unbundle(self._repo, cg, heads, 'push', url) + except exchange.PushRaced, exc: + raise error.ResponseError(_('push failed:'), exc.message) + def lock(self): return self._repo.lock() diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -774,5 +774,12 @@ def unbundle(repo, proto, heads): finally: fp.close() os.unlink(tempname) + except util.Abort, inst: + # The old code we moved used sys.stderr directly. + # We did not changed it to minise code change. + # This need to be moved to something proper. + # Feel free to do it. + sys.stderr.write("abort: %s\n" % inst) + return pushres(0) except exchange.PushRaced, exc: return pusherr(str(exc)) diff --git a/tests/test-acl.t b/tests/test-acl.t --- a/tests/test-acl.t +++ b/tests/test-acl.t @@ -116,9 +116,9 @@ Extension disabled for lack of a hook adding quux/file.py revisions files: 3/3 chunks (100.00%) added 3 changesets with 3 changes to 3 files + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) @@ -177,9 +177,9 @@ Extension disabled for lack of acl.sourc added 3 changesets with 3 changes to 3 files calling hook pretxnchangegroup.acl: hgext.acl.hook acl: changes have source "push" - skipping + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) @@ -249,9 +249,9 @@ No [acl.allow]/[acl.deny] acl: path access granted: "f9cafe1212c8" acl: branch access granted: "911600dab2ae" on branch "default" acl: path access granted: "911600dab2ae" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) @@ -747,9 +747,9 @@ barney is allowed everywhere acl: path access granted: "f9cafe1212c8" acl: branch access granted: "911600dab2ae" on branch "default" acl: path access granted: "911600dab2ae" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) @@ -1067,9 +1067,9 @@ acl.config can set only [acl.allow]/[acl acl: path access granted: "f9cafe1212c8" acl: branch access granted: "911600dab2ae" on branch "default" acl: path access granted: "911600dab2ae" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) @@ -1147,9 +1147,9 @@ fred is always allowed acl: path access granted: "f9cafe1212c8" acl: branch access granted: "911600dab2ae" on branch "default" acl: path access granted: "911600dab2ae" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) @@ -1300,9 +1300,9 @@ OS-level groups acl: path access granted: "f9cafe1212c8" acl: branch access granted: "911600dab2ae" on branch "default" acl: path access granted: "911600dab2ae" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 0 (undo push) @@ -1501,9 +1501,9 @@ No branch acls specified acl: path access granted: "911600dab2ae" acl: branch access granted: "e8fc755d4d82" on branch "foobar" acl: path access granted: "e8fc755d4d82" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 2 (undo push) @@ -1807,9 +1807,9 @@ Branch acl allow other acl: path access granted: "911600dab2ae" acl: branch access granted: "e8fc755d4d82" on branch "foobar" acl: path access granted: "e8fc755d4d82" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 2 (undo push) @@ -1895,9 +1895,9 @@ push foobar into the remote acl: path access granted: "911600dab2ae" acl: branch access granted: "e8fc755d4d82" on branch "foobar" acl: path access granted: "e8fc755d4d82" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 2 (undo push) @@ -2056,9 +2056,9 @@ User 'astro' must not be denied acl: path access granted: "911600dab2ae" acl: branch access granted: "e8fc755d4d82" on branch "foobar" acl: path access granted: "e8fc755d4d82" + updating the branch cache listing keys for "phases" try to push obsolete markers to remote - updating the branch cache checking for updated bookmarks listing keys for "bookmarks" repository tip rolled back to revision 2 (undo push) diff --git a/tests/test-lock-badness.t b/tests/test-lock-badness.t --- a/tests/test-lock-badness.t +++ b/tests/test-lock-badness.t @@ -34,6 +34,7 @@ Pushing to a local read-only repo that c $ hg -R b push a pushing to a + searching for changes abort: could not lock repository a: Permission denied [255]