Mercurial > hg > hg-git
changeset 337:6cea997ee302
enforce stricter matching for pull -r
Use an exact match with the ref name ('foo' in 'refs/heads/foo'),
instead of just checking if it ended with '/foo'.
This allows
$ hg pull -r foo
to run successfully on a repo containing the branches
- 'foo',
- 'mine/foo',
- 'theirs/foo'
author | Tay Ray Chuan <rctay89@gmail.com> |
---|---|
date | Wed, 02 Jun 2010 20:14:26 +0800 |
parents | d61881f463ce |
children | 203095c5cb25 |
files | hggit/git_handler.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -624,8 +624,13 @@ def determine_wants(refs): if heads: want = [] + # contains pairs of ('refs/(heads|tags|...)/foo', 'foo') + # if ref is just '<foo>', then we get ('foo', 'foo') + stripped_refs = [ + (r, r[r.find('/', r.find('/')+1)+1:]) + for r in refs] for h in heads: - r = [ref for ref in refs if ref.endswith('/'+h)] + r = [pair[0] for pair in stripped_refs if pair[1] == h] if not r: raise hgutil.Abort("ref %s not found on remote server" % h) elif len(r) == 1: