Show More
@@ -151,24 +151,17 b' class p4_source(common.converter_source)' | |||||
151 | lastid = change |
|
151 | lastid = change | |
152 | continue |
|
152 | continue | |
153 |
|
153 | |||
154 | cmd = "p4 -G describe -s %s" % change |
|
|||
155 | stdout = util.popen(cmd, mode='rb') |
|
|||
156 | d = marshal.load(stdout) |
|
|||
157 | desc = self.recode(d.get("desc", "")) |
|
|||
158 | shortdesc = desc.split("\n", 1)[0] |
|
|||
159 | t = '%s %s' % (d["change"], repr(shortdesc)[1:-1]) |
|
|||
160 | ui.status(util.ellipsis(t, 80) + '\n') |
|
|||
161 |
|
||||
162 | if lastid: |
|
154 | if lastid: | |
163 | parents = [lastid] |
|
155 | parents = [lastid] | |
164 | else: |
|
156 | else: | |
165 | parents = [] |
|
157 | parents = [] | |
166 |
|
158 | |||
167 | date = (int(d["time"]), 0) # timezone not set |
|
159 | d = self._fetch_revision(change) | |
168 | c = common.commit(author=self.recode(d["user"]), |
|
160 | c = self._construct_commit(d, parents) | |
169 | date=util.datestr(date, '%Y-%m-%d %H:%M:%S %1%2'), |
|
161 | ||
170 | parents=parents, desc=desc, branch=None, |
|
162 | shortdesc = c.desc.splitlines(True)[0].rstrip('\r\n') | |
171 | extra={"p4": change, "convert_revision": change}) |
|
163 | t = '%s %s' % (c.rev, repr(shortdesc)[1:-1]) | |
|
164 | ui.status(util.ellipsis(t, 80) + '\n') | |||
172 |
|
165 | |||
173 | files = [] |
|
166 | files = [] | |
174 | copies = {} |
|
167 | copies = {} | |
@@ -303,6 +296,30 b' class p4_source(common.converter_source)' | |||||
303 | raise error.Abort(_("convert from p4 does not support --full")) |
|
296 | raise error.Abort(_("convert from p4 does not support --full")) | |
304 | return self.files[rev], self.copies[rev], set() |
|
297 | return self.files[rev], self.copies[rev], set() | |
305 |
|
298 | |||
|
299 | def _construct_commit(self, obj, parents=None): | |||
|
300 | """ | |||
|
301 | Constructs a common.commit object from an unmarshalled | |||
|
302 | `p4 describe` output | |||
|
303 | """ | |||
|
304 | desc = self.recode(obj.get("desc", "")) | |||
|
305 | shortdesc = desc.split("\n", 1)[0] | |||
|
306 | ||||
|
307 | date = (int(obj["time"]), 0) # timezone not set | |||
|
308 | if parents is None: | |||
|
309 | parents = [] | |||
|
310 | ||||
|
311 | return common.commit(author=self.recode(obj["user"]), | |||
|
312 | date=util.datestr(date, '%Y-%m-%d %H:%M:%S %1%2'), | |||
|
313 | parents=parents, desc=desc, branch=None, rev=obj['change'], | |||
|
314 | extra={"p4": obj['change'], "convert_revision": obj['change']}) | |||
|
315 | ||||
|
316 | def _fetch_revision(self, rev): | |||
|
317 | """Return an output of `p4 describe` including author, commit date as | |||
|
318 | a dictionary.""" | |||
|
319 | cmd = "p4 -G describe -s %s" % rev | |||
|
320 | stdout = util.popen(cmd, mode='rb') | |||
|
321 | return marshal.load(stdout) | |||
|
322 | ||||
306 | def getcommit(self, rev): |
|
323 | def getcommit(self, rev): | |
307 | return self.changeset[rev] |
|
324 | return self.changeset[rev] | |
308 |
|
325 |
General Comments 0
You need to be logged in to leave comments.
Login now