##// END OF EJS Templates
convert: use git executable only, with subcommands...
Dhruva Krishnamurthy -
r6837:e30c56f3 default
parent child Browse files
Show More
@@ -32,20 +32,20 b' class convert_git(converter_source):'
32 if not os.path.exists(path + "/objects"):
32 if not os.path.exists(path + "/objects"):
33 raise NoRepo("%s does not look like a Git repo" % path)
33 raise NoRepo("%s does not look like a Git repo" % path)
34
34
35 checktool('git-rev-parse', 'git')
35 checktool('git', 'git')
36
36
37 self.path = path
37 self.path = path
38
38
39 def getheads(self):
39 def getheads(self):
40 if not self.rev:
40 if not self.rev:
41 return self.gitcmd('git-rev-parse --branches').read().splitlines()
41 return self.gitcmd('git rev-parse --branches').read().splitlines()
42 else:
42 else:
43 fh = self.gitcmd("git-rev-parse --verify %s" % self.rev)
43 fh = self.gitcmd("git rev-parse --verify %s" % self.rev)
44 return [fh.read()[:-1]]
44 return [fh.read()[:-1]]
45
45
46 def catfile(self, rev, type):
46 def catfile(self, rev, type):
47 if rev == "0" * 40: raise IOError()
47 if rev == "0" * 40: raise IOError()
48 fh = self.gitcmd("git-cat-file %s %s" % (type, rev))
48 fh = self.gitcmd("git cat-file %s %s" % (type, rev))
49 return fh.read()
49 return fh.read()
50
50
51 def getfile(self, name, rev):
51 def getfile(self, name, rev):
@@ -56,7 +56,7 b' class convert_git(converter_source):'
56
56
57 def getchanges(self, version):
57 def getchanges(self, version):
58 self.modecache = {}
58 self.modecache = {}
59 fh = self.gitcmd("git-diff-tree --root -m -r %s" % version)
59 fh = self.gitcmd("git diff-tree --root -m -r %s" % version)
60 changes = []
60 changes = []
61 seen = {}
61 seen = {}
62 for l in fh:
62 for l in fh:
@@ -109,7 +109,7 b' class convert_git(converter_source):'
109
109
110 def gettags(self):
110 def gettags(self):
111 tags = {}
111 tags = {}
112 fh = self.gitcmd('git-ls-remote --tags "%s"' % self.path)
112 fh = self.gitcmd('git ls-remote --tags "%s"' % self.path)
113 prefix = 'refs/tags/'
113 prefix = 'refs/tags/'
114 for line in fh:
114 for line in fh:
115 line = line.strip()
115 line = line.strip()
@@ -126,7 +126,7 b' class convert_git(converter_source):'
126 def getchangedfiles(self, version, i):
126 def getchangedfiles(self, version, i):
127 changes = []
127 changes = []
128 if i is None:
128 if i is None:
129 fh = self.gitcmd("git-diff-tree --root -m -r %s" % version)
129 fh = self.gitcmd("git diff-tree --root -m -r %s" % version)
130 for l in fh:
130 for l in fh:
131 if "\t" not in l:
131 if "\t" not in l:
132 continue
132 continue
@@ -134,7 +134,7 b' class convert_git(converter_source):'
134 changes.append(f)
134 changes.append(f)
135 fh.close()
135 fh.close()
136 else:
136 else:
137 fh = self.gitcmd('git-diff-tree --name-only --root -r %s "%s^%s" --'
137 fh = self.gitcmd('git diff-tree --name-only --root -r %s "%s^%s" --'
138 % (version, version, i+1))
138 % (version, version, i+1))
139 changes = [f.rstrip('\n') for f in fh]
139 changes = [f.rstrip('\n') for f in fh]
140 fh.close()
140 fh.close()
General Comments 0
You need to be logged in to leave comments. Login now