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