Show More
@@ -1322,22 +1322,10 b" def export(repo, revs, template='hg-%h.p" | |||||
1322 | def diffstat(patchlines): |
|
1322 | def diffstat(patchlines): | |
1323 | if not util.find_exe('diffstat'): |
|
1323 | if not util.find_exe('diffstat'): | |
1324 | return |
|
1324 | return | |
1325 | fd, name = tempfile.mkstemp(prefix="hg-patchbomb-", suffix=".txt") |
|
1325 | output = util.filter('\n'.join(patchlines), | |
1326 | try: |
|
1326 | 'diffstat -p1 -w79 2>%s' % util.nulldev) | |
1327 | p = util.Popen3('diffstat -p1 -w79 2>/dev/null > ' + name) |
|
1327 | stat = [l.lstrip() for l in output.splitlines(True)] | |
1328 | try: |
|
1328 | last = stat.pop() | |
1329 | for line in patchlines: |
|
1329 | stat.insert(0, last) | |
1330 | p.tochild.write(line + "\n") |
|
1330 | stat = ''.join(stat) | |
1331 | p.tochild.close() |
|
1331 | return stat | |
1332 | if p.wait(): return |
|
|||
1333 | fp = os.fdopen(fd, 'r') |
|
|||
1334 | stat = [] |
|
|||
1335 | for line in fp: stat.append(line.lstrip()) |
|
|||
1336 | last = stat.pop() |
|
|||
1337 | stat.insert(0, last) |
|
|||
1338 | stat = ''.join(stat) |
|
|||
1339 | return stat |
|
|||
1340 | except: raise |
|
|||
1341 | finally: |
|
|||
1342 | try: os.unlink(name) |
|
|||
1343 | except: pass |
|
General Comments 0
You need to be logged in to leave comments.
Login now