~ubuntu-branches/debian/jessie/bzr-git/jessie

« back to all changes in this revision

Viewing changes to refs.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-10-11 11:35:52 UTC
  • mfrom: (1.1.12 upstream) (8.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20101011113552-4ckvgh3ki33twlxi
* New upstream snapshot.
 + Fixes compatibility with Bazaar 2.3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    for k,v in refs.iteritems():
36
36
        if k.startswith("refs/tags/") and not k.endswith("^{}"):
37
37
            v = refs.get(k+"^{}", v)
38
 
            ret[k[len("refs/tags/"):]] = v
 
38
            try:
 
39
                tagname = ref_to_tag_name(k)
 
40
            except UnicodeDecodeError:
 
41
                pass
 
42
            else:
 
43
                ret[tagname] = v
39
44
    return ret
40
45
 
41
46
 
79
84
 
80
85
def ref_to_tag_name(ref):
81
86
    if ref.startswith("refs/tags/"):
82
 
        return ref[len('refs/tags/'):]
 
87
        return ref[len('refs/tags/'):].decode("utf-8")
83
88
    raise ValueError("unable to map ref %s back to branch name" % ref)
84
89
 
85
90