Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/mq.py @ 2747:0016fc748f61
Add command qheader to display the header of a given patch.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Mon, 31 Jul 2006 18:39:31 -0700 |
parents | 0503eb5c0a33 |
children | 752b9475a700 |
comparison
equal
deleted
inserted
replaced
2746:0503eb5c0a33 | 2747:0016fc748f61 |
---|---|
1287 """diff of the current patch""" | 1287 """diff of the current patch""" |
1288 # deep in the dirstate code, the walkhelper method wants a list, not a tuple | 1288 # deep in the dirstate code, the walkhelper method wants a list, not a tuple |
1289 repo.mq.diff(repo, list(files)) | 1289 repo.mq.diff(repo, list(files)) |
1290 return 0 | 1290 return 0 |
1291 | 1291 |
1292 def header(ui, repo, patch=None): | |
1293 """Print the header of the topmost or specified patch""" | |
1294 q = repo.mq | |
1295 | |
1296 if patch: | |
1297 patch = q.lookup(patch) | |
1298 else: | |
1299 if not q.applied: | |
1300 ui.write('No patches applied\n') | |
1301 return | |
1302 patch = q.lookup('qtip') | |
1303 message = repo.mq.readheaders(patch)[0] | |
1304 | |
1305 ui.write('\n'.join(message) + '\n') | |
1306 | |
1292 def lastsavename(path): | 1307 def lastsavename(path): |
1293 (dir, base) = os.path.split(path) | 1308 (dir, base) = os.path.split(path) |
1294 names = os.listdir(dir) | 1309 names = os.listdir(dir) |
1295 namere = re.compile("%s.([0-9]+)" % base) | 1310 namere = re.compile("%s.([0-9]+)" % base) |
1296 max = None | 1311 max = None |
1445 (commit, | 1460 (commit, |
1446 commands.table["^commit|ci"][1], | 1461 commands.table["^commit|ci"][1], |
1447 'hg qcommit [OPTION]... [FILE]...'), | 1462 'hg qcommit [OPTION]... [FILE]...'), |
1448 "^qdiff": (diff, [], 'hg qdiff [FILE]...'), | 1463 "^qdiff": (diff, [], 'hg qdiff [FILE]...'), |
1449 "qdelete": (delete, [], 'hg qdelete PATCH'), | 1464 "qdelete": (delete, [], 'hg qdelete PATCH'), |
1465 'qheader': (header, [], | |
1466 _('hg qheader [PATCH]')), | |
1450 "^qimport": | 1467 "^qimport": |
1451 (qimport, | 1468 (qimport, |
1452 [('e', 'existing', None, 'import file in patch dir'), | 1469 [('e', 'existing', None, 'import file in patch dir'), |
1453 ('n', 'name', '', 'patch file name'), | 1470 ('n', 'name', '', 'patch file name'), |
1454 ('f', 'force', None, 'overwrite existing files')], | 1471 ('f', 'force', None, 'overwrite existing files')], |