Mercurial > hg
comparison hgext/convert/git.py @ 5497:f0a3918abd42
convert: fail if an external required tool is not found
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Tue, 30 Oct 2007 22:14:15 +0100 |
parents | 67d3daa8ac42 |
children | 4d38e6970b8c |
comparison
equal
deleted
inserted
replaced
5496:5bff70ff0431 | 5497:f0a3918abd42 |
---|---|
1 # git support for the convert extension | 1 # git support for the convert extension |
2 | 2 |
3 import os | 3 import os |
4 from mercurial import util | 4 from mercurial import util |
5 | 5 |
6 from common import NoRepo, commit, converter_source | 6 from common import NoRepo, commit, converter_source, checktool |
7 | 7 |
8 class convert_git(converter_source): | 8 class convert_git(converter_source): |
9 # Windows does not support GIT_DIR= construct while other systems | 9 # Windows does not support GIT_DIR= construct while other systems |
10 # cannot remove environment variable. Just assume none have | 10 # cannot remove environment variable. Just assume none have |
11 # both issues. | 11 # both issues. |
29 | 29 |
30 if os.path.isdir(path + "/.git"): | 30 if os.path.isdir(path + "/.git"): |
31 path += "/.git" | 31 path += "/.git" |
32 if not os.path.exists(path + "/objects"): | 32 if not os.path.exists(path + "/objects"): |
33 raise NoRepo("couldn't open GIT repo %s" % path) | 33 raise NoRepo("couldn't open GIT repo %s" % path) |
34 | |
35 checktool('git-rev-parse', 'git') | |
36 | |
34 self.path = path | 37 self.path = path |
35 | 38 |
36 def getheads(self): | 39 def getheads(self): |
37 if not self.rev: | 40 if not self.rev: |
38 return self.gitcmd('git-rev-parse --branches').read().splitlines() | 41 return self.gitcmd('git-rev-parse --branches').read().splitlines() |