Show More
@@ -5,6 +5,9 b' import os' | |||||
5 | from common import NoRepo, commit, converter_source |
|
5 | from common import NoRepo, commit, converter_source | |
6 |
|
6 | |||
7 | class convert_git(converter_source): |
|
7 | class convert_git(converter_source): | |
|
8 | def gitcmd(self, s): | |||
|
9 | return os.popen('GIT_DIR=%s %s' % (self.path, s)) | |||
|
10 | ||||
8 | def __init__(self, ui, path, rev=None): |
|
11 | def __init__(self, ui, path, rev=None): | |
9 | if os.path.isdir(path + "/.git"): |
|
12 | if os.path.isdir(path + "/.git"): | |
10 | path += "/.git" |
|
13 | path += "/.git" | |
@@ -18,13 +21,12 b' class convert_git(converter_source):' | |||||
18 |
|
21 | |||
19 | def getheads(self): |
|
22 | def getheads(self): | |
20 | rev = self.rev or 'HEAD' |
|
23 | rev = self.rev or 'HEAD' | |
21 |
fh = |
|
24 | fh = self.gitcmd("git-rev-parse --verify %s" % rev) | |
22 | return [fh.read()[:-1]] |
|
25 | return [fh.read()[:-1]] | |
23 |
|
26 | |||
24 | def catfile(self, rev, type): |
|
27 | def catfile(self, rev, type): | |
25 | if rev == "0" * 40: raise IOError() |
|
28 | if rev == "0" * 40: raise IOError() | |
26 |
fh = |
|
29 | fh = self.gitcmd("git-cat-file %s %s 2>/dev/null" % (type, rev)) | |
27 | % (self.path, type, rev)) |
|
|||
28 | return fh.read() |
|
30 | return fh.read() | |
29 |
|
31 | |||
30 | def getfile(self, name, rev): |
|
32 | def getfile(self, name, rev): | |
@@ -35,8 +37,7 b' class convert_git(converter_source):' | |||||
35 |
|
37 | |||
36 | def getchanges(self, version): |
|
38 | def getchanges(self, version): | |
37 | self.modecache = {} |
|
39 | self.modecache = {} | |
38 |
fh = |
|
40 | fh = self.gitcmd("git-diff-tree --root -m -r %s" % version) | |
39 | % (self.path, version)) |
|
|||
40 | changes = [] |
|
41 | changes = [] | |
41 | for l in fh: |
|
42 | for l in fh: | |
42 | if "\t" not in l: continue |
|
43 | if "\t" not in l: continue | |
@@ -84,7 +85,7 b' class convert_git(converter_source):' | |||||
84 |
|
85 | |||
85 | def gettags(self): |
|
86 | def gettags(self): | |
86 | tags = {} |
|
87 | tags = {} | |
87 |
fh = |
|
88 | fh = self.gitcmd('git-ls-remote --tags "%s" 2>/dev/null' % self.path) | |
88 | prefix = 'refs/tags/' |
|
89 | prefix = 'refs/tags/' | |
89 | for line in fh: |
|
90 | for line in fh: | |
90 | line = line.strip() |
|
91 | line = line.strip() |
General Comments 0
You need to be logged in to leave comments.
Login now