/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to revspec.py

  • Committer: Jelmer Vernooij
  • Date: 2010-05-01 23:16:11 UTC
  • mfrom: (0.200.904 trunk)
  • mto: (0.200.912 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100501231611-t8hh69jq6krevlwi
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    InvalidRevisionId,
23
23
    InvalidRevisionSpec,
24
24
    )
25
 
from bzrlib.revision import (
26
 
    NULL_REVISION,
27
 
)
28
25
from bzrlib.revisionspec import (
29
26
    RevisionInfo,
30
27
    RevisionSpec,
84
81
        return history
85
82
 
86
83
    def __nonzero__(self):
 
84
        from bzrlib.revision import (
 
85
            NULL_REVISION,
 
86
            )
87
87
        # The default implementation uses branch.repository.has_revision()
88
88
        if self.rev_id is None:
89
89
            return False
93
93
 
94
94
    def _find_short_git_sha1(self, branch, sha1):
95
95
        from bzrlib.plugins.git.mapping import (
96
 
            ForeignGit,
97
96
            mapping_registry,
98
97
            )
99
98
        parse_revid = getattr(branch.repository, "lookup_bzr_revision_id",
102
101
        try:
103
102
            graph = branch.repository.get_graph()
104
103
            for revid, _ in graph.iter_ancestry([branch.last_revision()]):
105
 
                if revid == NULL_REVISION:
106
 
                    continue
107
104
                try:
108
105
                    foreign_revid, mapping = parse_revid(revid)
109
106
                except InvalidRevisionId:
110
107
                    continue
111
 
                if not isinstance(mapping.vcs, ForeignGit):
112
 
                    continue
113
108
                if foreign_revid.startswith(sha1):
114
109
                    history = self._history(branch, revid)
115
110
                    return RevisionInfo.from_revision_id(branch, revid, history)