diff --git a/hggit/git_handler.py b/hggit/git_handler.py index 1c9ac8cf90f463a185f8921e3b29465109f9d32f_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..78cbae27e9743ddc4a4f840c208c38ed3e42e1dc_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -22,7 +22,6 @@ from mercurial.utils import dateutil from mercurial import ( bookmarks, - commands, context, encoding, error, @@ -1177,26 +1176,11 @@ def get_changed_refs(self, refs, exportable, force): new_refs = refs.copy() - # The remote repo is empty and the local one doesn't have - # bookmarks/tags - # - # (older dulwich versions return the proto-level - # capabilities^{} key when the dict should have been - # empty. That check can probably be removed at some point in - # the future.) - if not refs or next(iter(refs.keys())) == b'capabilities^{}': - if not exportable: - tip = self.repo.filtered(b'served').lookup(b'tip') - if tip != nullid: - if b'capabilities^{}' in new_refs: - del new_refs[b'capabilities^{}'] - tip = hex(tip) - commands.bookmark(self.ui, self.repo, b'master', - rev=tip, force=True) - bookmarks.activate(self.repo, b'master') - new_refs[LOCAL_BRANCH_PREFIX + b'master'] = ( - self.map_git_get(tip) - ) + if not exportable: + raise error.Abort( + b'no bookmarks or tags to push to git', + hint=b'see "hg help bookmarks" for details on creating them', + ) # mapped nodes might be hidden unfiltered = self.repo.unfiltered() diff --git a/tests/test-gitignore-share.t b/tests/test-gitignore-share.t index 1c9ac8cf90f463a185f8921e3b29465109f9d32f_dGVzdHMvdGVzdC1naXRpZ25vcmUtc2hhcmUudA==..78cbae27e9743ddc4a4f840c208c38ed3e42e1dc_dGVzdHMvdGVzdC1naXRpZ25vcmUtc2hhcmUudA== 100644 --- a/tests/test-gitignore-share.t +++ b/tests/test-gitignore-share.t @@ -19,6 +19,7 @@ $ echo ignored > .gitignore $ hg add .gitignore $ hg ci -m ignore + $ hg book master $ hg push pushing to $TESTTMP/repo.git searching for changes diff --git a/tests/test-push-authors.t b/tests/test-push-authors.t index 1c9ac8cf90f463a185f8921e3b29465109f9d32f_dGVzdHMvdGVzdC1wdXNoLWF1dGhvcnMudA==..78cbae27e9743ddc4a4f840c208c38ed3e42e1dc_dGVzdHMvdGVzdC1wdXNoLWF1dGhvcnMudA== 100644 --- a/tests/test-push-authors.t +++ b/tests/test-push-authors.t @@ -12,6 +12,7 @@ updating to branch default 0 files updated, 0 files merged, 0 files removed, 0 files unresolved $ cd hgrepo + $ hg book master Configure an author map diff --git a/tests/test-push-phases.t b/tests/test-push-phases.t index 1c9ac8cf90f463a185f8921e3b29465109f9d32f_dGVzdHMvdGVzdC1wdXNoLXBoYXNlcy50..78cbae27e9743ddc4a4f840c208c38ed3e42e1dc_dGVzdHMvdGVzdC1wdXNoLXBoYXNlcy50 100644 --- a/tests/test-push-phases.t +++ b/tests/test-push-phases.t @@ -20,6 +20,7 @@ $ touch alpha $ hg add alpha $ fn_hg_commit -m alpha + $ hg book -r . master $ touch beta $ hg add beta $ fn_hg_commit --secret -m beta diff --git a/tests/test-push.t b/tests/test-push.t index 1c9ac8cf90f463a185f8921e3b29465109f9d32f_dGVzdHMvdGVzdC1wdXNoLnQ=..78cbae27e9743ddc4a4f840c208c38ed3e42e1dc_dGVzdHMvdGVzdC1wdXNoLnQ= 100644 --- a/tests/test-push.t +++ b/tests/test-push.t @@ -195,8 +195,9 @@ $ hg -R hgrepo2 push gitrepo2 pushing to gitrepo2 searching for changes - no changes found - [1] + abort: no bookmarks or tags to push to git + (see "hg help bookmarks" for details on creating them) + [255] The remote repo is empty and the local one doesn't have any bookmarks/tags $ cd hgrepo2 @@ -209,12 +210,12 @@ $ hg push ../gitrepo2 pushing to ../gitrepo2 searching for changes - adding objects - added 1 commits with 1 trees and 1 blobs - adding reference refs/heads/master + abort: no bookmarks or tags to push to git + (see "hg help bookmarks" for details on creating them) + [255] $ hg summary parent: -1:000000000000 (no revision checked out) branch: default commit: (clean) update: 1 new changesets (update) phases: 1 draft @@ -215,8 +216,8 @@ $ hg summary parent: -1:000000000000 (no revision checked out) branch: default commit: (clean) update: 1 new changesets (update) phases: 1 draft -Only one bookmark 'master' should be created +That should not create any bookmarks $ hg bookmarks @@ -222,5 +223,5 @@ $ hg bookmarks - * master 0:8aded40be5af + no bookmarks set test for ssh vulnerability