/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-04-02 19:15:13 UTC
  • mto: (0.200.951 trunk)
  • mto: This revision was merged to the branch mainline in revision 6960.
  • Revision ID: jelmer@samba.org-20100402191513-08c0c8y7oe9dr3z6
Also cache full contents of symlinks.

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,
74
71
        raise InvalidRevisionSpec(self.user_spec, branch)
75
72
 
76
73
    def _history(self, branch, revid):
77
 
        branch.lock_read()
78
 
        try:
79
 
            history = list(branch.repository.iter_reverse_revision_history(
80
 
                revid))
81
 
        finally:
82
 
            branch.unlock()
 
74
        history = list(branch.repository.iter_reverse_revision_history(revid))
83
75
        history.reverse()
84
76
        return history
85
77
 
86
78
    def __nonzero__(self):
 
79
        from bzrlib.revision import (
 
80
            NULL_REVISION,
 
81
            )
87
82
        # The default implementation uses branch.repository.has_revision()
88
83
        if self.rev_id is None:
89
84
            return False
93
88
 
94
89
    def _find_short_git_sha1(self, branch, sha1):
95
90
        from bzrlib.plugins.git.mapping import (
96
 
            ForeignGit,
97
91
            mapping_registry,
98
92
            )
99
93
        parse_revid = getattr(branch.repository, "lookup_bzr_revision_id",
102
96
        try:
103
97
            graph = branch.repository.get_graph()
104
98
            for revid, _ in graph.iter_ancestry([branch.last_revision()]):
105
 
                if revid == NULL_REVISION:
106
 
                    continue
107
99
                try:
108
100
                    foreign_revid, mapping = parse_revid(revid)
109
101
                except InvalidRevisionId:
110
102
                    continue
111
 
                if not isinstance(mapping.vcs, ForeignGit):
112
 
                    continue
113
103
                if foreign_revid.startswith(sha1):
114
104
                    history = self._history(branch, revid)
115
105
                    return RevisionInfo.from_revision_id(branch, revid, history)