Show More
@@ -14,6 +14,9 b' def recode(s):' | |||||
14 | return s.decode("utf-8", "replace").encode("utf-8") |
|
14 | return s.decode("utf-8", "replace").encode("utf-8") | |
15 |
|
15 | |||
16 | class convert_git(converter_source): |
|
16 | class convert_git(converter_source): | |
|
17 | def gitcmd(self, s): | |||
|
18 | return os.popen('GIT_DIR=%s %s' % (self.path, s)) | |||
|
19 | ||||
17 | def __init__(self, ui, path): |
|
20 | def __init__(self, ui, path): | |
18 | if os.path.isdir(path + "/.git"): |
|
21 | if os.path.isdir(path + "/.git"): | |
19 | path += "/.git" |
|
22 | path += "/.git" | |
@@ -23,13 +26,12 b' class convert_git(converter_source):' | |||||
23 | raise NoRepo("couldn't open GIT repo %s" % path) |
|
26 | raise NoRepo("couldn't open GIT repo %s" % path) | |
24 |
|
27 | |||
25 | def getheads(self): |
|
28 | def getheads(self): | |
26 |
fh = |
|
29 | fh = self.gitcmd("git-rev-parse --verify HEAD") | |
27 | return [fh.read()[:-1]] |
|
30 | return [fh.read()[:-1]] | |
28 |
|
31 | |||
29 | def catfile(self, rev, type): |
|
32 | def catfile(self, rev, type): | |
30 | if rev == "0" * 40: raise IOError() |
|
33 | if rev == "0" * 40: raise IOError() | |
31 |
fh = |
|
34 | fh = self.gitcmd("git-cat-file %s %s 2>/dev/null" % (type, rev)) | |
32 | % (self.path, type, rev)) |
|
|||
33 | return fh.read() |
|
35 | return fh.read() | |
34 |
|
36 | |||
35 | def getfile(self, name, rev): |
|
37 | def getfile(self, name, rev): | |
@@ -40,8 +42,7 b' class convert_git(converter_source):' | |||||
40 |
|
42 | |||
41 | def getchanges(self, version): |
|
43 | def getchanges(self, version): | |
42 | self.modecache = {} |
|
44 | self.modecache = {} | |
43 |
fh = |
|
45 | fh = self.gitcmd("git-diff-tree --root -m -r %s" % version) | |
44 | % (self.path, version)) |
|
|||
45 | changes = [] |
|
46 | changes = [] | |
46 | for l in fh: |
|
47 | for l in fh: | |
47 | if "\t" not in l: continue |
|
48 | if "\t" not in l: continue | |
@@ -89,7 +90,7 b' class convert_git(converter_source):' | |||||
89 |
|
90 | |||
90 | def gettags(self): |
|
91 | def gettags(self): | |
91 | tags = {} |
|
92 | tags = {} | |
92 |
fh = |
|
93 | fh = self.gitcmd('git-ls-remote --tags "%s" 2>/dev/null' % self.path) | |
93 | prefix = 'refs/tags/' |
|
94 | prefix = 'refs/tags/' | |
94 | for line in fh: |
|
95 | for line in fh: | |
95 | line = line.strip() |
|
96 | line = line.strip() |
General Comments 0
You need to be logged in to leave comments.
Login now