Show More
@@ -16,7 +16,7 class convert_git(converter_source): | |||
|
16 | 16 | # cannot remove environment variable. Just assume none have |
|
17 | 17 | # both issues. |
|
18 | 18 | if hasattr(os, 'unsetenv'): |
|
19 |
def git |
|
|
19 | def gitopen(self, s): | |
|
20 | 20 | prevgitdir = os.environ.get('GIT_DIR') |
|
21 | 21 | os.environ['GIT_DIR'] = self.path |
|
22 | 22 | try: |
@@ -27,7 +27,7 class convert_git(converter_source): | |||
|
27 | 27 | else: |
|
28 | 28 | os.environ['GIT_DIR'] = prevgitdir |
|
29 | 29 | else: |
|
30 |
def git |
|
|
30 | def gitopen(self, s): | |
|
31 | 31 | return util.popen('GIT_DIR=%s %s' % (self.path, s), 'rb') |
|
32 | 32 | |
|
33 | 33 | def __init__(self, ui, path, rev=None): |
@@ -44,16 +44,16 class convert_git(converter_source): | |||
|
44 | 44 | |
|
45 | 45 | def getheads(self): |
|
46 | 46 | if not self.rev: |
|
47 |
fh = self.git |
|
|
47 | fh = self.gitopen('git rev-parse --branches --remotes') | |
|
48 | 48 | return fh.read().splitlines() |
|
49 | 49 | else: |
|
50 |
fh = self.git |
|
|
50 | fh = self.gitopen("git rev-parse --verify %s" % self.rev) | |
|
51 | 51 | return [fh.read()[:-1]] |
|
52 | 52 | |
|
53 | 53 | def catfile(self, rev, type): |
|
54 | 54 | if rev == "0" * 40: |
|
55 | 55 | raise IOError() |
|
56 |
fh = self.git |
|
|
56 | fh = self.gitopen("git cat-file %s %s" % (type, rev)) | |
|
57 | 57 | return fh.read() |
|
58 | 58 | |
|
59 | 59 | def getfile(self, name, rev): |
@@ -64,7 +64,7 class convert_git(converter_source): | |||
|
64 | 64 | |
|
65 | 65 | def getchanges(self, version): |
|
66 | 66 | self.modecache = {} |
|
67 |
fh = self.git |
|
|
67 | fh = self.gitopen("git diff-tree -z --root -m -r %s" % version) | |
|
68 | 68 | changes = [] |
|
69 | 69 | seen = set() |
|
70 | 70 | entry = None |
@@ -123,7 +123,7 class convert_git(converter_source): | |||
|
123 | 123 | |
|
124 | 124 | def gettags(self): |
|
125 | 125 | tags = {} |
|
126 |
fh = self.git |
|
|
126 | fh = self.gitopen('git ls-remote --tags "%s"' % self.path) | |
|
127 | 127 | prefix = 'refs/tags/' |
|
128 | 128 | for line in fh: |
|
129 | 129 | line = line.strip() |
@@ -140,7 +140,7 class convert_git(converter_source): | |||
|
140 | 140 | def getchangedfiles(self, version, i): |
|
141 | 141 | changes = [] |
|
142 | 142 | if i is None: |
|
143 |
fh = self.git |
|
|
143 | fh = self.gitopen("git diff-tree --root -m -r %s" % version) | |
|
144 | 144 | for l in fh: |
|
145 | 145 | if "\t" not in l: |
|
146 | 146 | continue |
@@ -148,7 +148,7 class convert_git(converter_source): | |||
|
148 | 148 | changes.append(f) |
|
149 | 149 | fh.close() |
|
150 | 150 | else: |
|
151 |
fh = self.git |
|
|
151 | fh = self.gitopen('git diff-tree --name-only --root -r %s "%s^%s" --' | |
|
152 | 152 | % (version, version, i + 1)) |
|
153 | 153 | changes = [f.rstrip('\n') for f in fh] |
|
154 | 154 | fh.close() |
General Comments 0
You need to be logged in to leave comments.
Login now