[PATCH 1 of 3 next] outgoing: don't delete remote refs

23 views
Skip to first unread message

David Carr

unread,
Sep 27, 2012, 11:02:07 PM9/27/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1348799521 14400
# Node ID f6871baa79c94e37c7dbe1795fe78bbef2b81fa6
# Parent 3b82cf6ac73ad8455a632516735070610eb5cd32
outgoing: don't delete remote refs

There was a bug introduced in 8c1f2b07c04b such that calling hg outgoing on
a Git repository would result in all refs being deleted from the remote
repository (with the possible exception of the currently checked out branch).
It wasn't noticed before because the existing test for outgoing didn't actually
verify the refs on the remote. This changeset fixes the bug, as well as adding
test coverage to allow verifying that the fix works.

diff --git a/hggit/git_handler.py b/hggit/git_handler.py
--- a/hggit/git_handler.py
+++ b/hggit/git_handler.py
@@ -222,14 +222,10 @@
old_refs.update(refs)
to_push = set(self.local_heads().values() + self.tags.values())
new_refs.update(self.get_changed_refs(refs, to_push, True))
- # don't push anything
- return {}
+ return refs # always return the same refs to make the send a no-op

try:
- try:
- client.send_pack(path, changed, lambda have, want: [])
- except UpdateRefsError:
- pass # dulwich throws an error when send_pack doesn't upload
+ client.send_pack(path, changed, lambda have, want: [])

changed_refs = [ref for ref, sha in new_refs.iteritems()
if sha != old_refs.get(ref)]
diff --git a/tests/test-outgoing.t b/tests/test-outgoing.t
--- a/tests/test-outgoing.t
+++ b/tests/test-outgoing.t
@@ -35,6 +35,10 @@
$ echo alpha > alpha
$ git add alpha
$ commit -m "add alpha"
+ $ git branch alpha
+ $ git show-ref
+ 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 refs/heads/alpha
+ 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 refs/heads/master

$ cd ..
$ hg clone gitrepo hgrepo | grep -v '^updating'
@@ -42,6 +46,7 @@
1 files updated, 0 files merged, 0 files removed, 0 files unresolved

$ cd hgrepo
+ $ hg update -q master
$ echo beta > beta
$ hg add beta
$ hgcommit -m 'add beta'
@@ -99,6 +104,11 @@
% some more work on master from git
$ cd gitrepo

+Check state of refs after outgoing
+ $ git show-ref
+ 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 refs/heads/alpha
+ 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 refs/heads/master
+
$ git checkout master 2>&1 | sed s/\'/\"/g
Already on "master"
$ echo delta > delta

David Carr

unread,
Sep 27, 2012, 11:02:08 PM9/27/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1348800161 14400
# Node ID d6af82e71958000911427224a5d070f07a305597
# Parent f6871baa79c94e37c7dbe1795fe78bbef2b81fa6
docs: include buglink

Mercurial has support for including a link to an issue tracker when it detects
that an extension has broken. This change includes the appropriate attribute
in the extension, pointing it at the issue tracker for the main BitBucket repo.

diff --git a/hggit/__init__.py b/hggit/__init__.py
--- a/hggit/__init__.py
+++ b/hggit/__init__.py
@@ -42,6 +42,8 @@
import gitrepo, hgrepo
from git_handler import GitHandler

+buglink = 'https://bitbucket.org/durin42/hg-git/issues'
+
# support for `hg clone git://github.com/defunkt/facebox.git`
# also hg clone git+ssh://g...@github.com/schacon/simplegit.git
_gitschemes = ('git', 'git+ssh', 'git+http', 'git+https')

David Carr

unread,
Sep 27, 2012, 11:02:09 PM9/27/12
to hg-...@googlegroups.com
# HG changeset patch
# User David M. Carr <da...@carrclan.us>
# Date 1348800774 14400
# Node ID bd86c0c19fb4126eab5c4256ec31312f93871663
# Parent d6af82e71958000911427224a5d070f07a305597
docs: include testedwith

Mercurial has support for including information about the tested versions of
Mercurial for an extension when it detects that an extension has broken. This
change includes the appropriate attribute in the extension.

diff --git a/hggit/__init__.py b/hggit/__init__.py
--- a/hggit/__init__.py
+++ b/hggit/__init__.py
@@ -42,6 +42,7 @@
import gitrepo, hgrepo
from git_handler import GitHandler

+testedwith = '1.9.3 2.0.2 2.1.2 2.2.3 2.3.1'
buglink = 'https://bitbucket.org/durin42/hg-git/issues'

Augie Fackler

unread,
Oct 1, 2012, 2:09:48 PM10/1/12
to hg-...@googlegroups.com
queued these, thanks
> --
> You received this message because you are subscribed to the Google Groups "hg-git" group.
> To post to this group, send email to hg-...@googlegroups.com.
> To unsubscribe from this group, send email to hg-git+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/hg-git?hl=en.
>

Reply all
Reply to author
Forward
0 new messages