/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

Add tests for revspec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
 
31
31
def valid_git_sha1(hex):
 
32
    """Check if `hex` is a validly formatted Git SHA1.
 
33
    
 
34
    :param hex: Hex string to validate
 
35
    :return: Boolean
 
36
    """
32
37
    import binascii
33
38
    try:
34
39
        binascii.unhexlify(hex)
51
56
        from bzrlib.plugins.git.errors import (
52
57
            GitSmartRemoteNotSupported,
53
58
            )
 
59
        from bzrlib.plugins.git.mapping import (
 
60
            default_mapping,
 
61
            )
54
62
 
55
 
        bzr_revid = branch.mapping.revision_id_foreign_to_bzr(sha1)
 
63
        bzr_revid = getattr(branch.repository, "lookup_foreign_revision_id",
 
64
                              default_mapping.revision_id_foreign_to_bzr)(sha1)
56
65
        try:
57
66
            if branch.repository.has_revision(bzr_revid):
58
67
                history = self._history(branch, bzr_revid)