Mercurial > hg
comparison mercurial/commands.py @ 1085:6f94688b81b6
status: added option -p and -0 to assist xargs
The -p option strips the status prefix of each file, while
-0 ends each file with a NUL character, instead of a newline.
Together, selected group of files can be passed to 'xargs -0'
for further processing.
author | TK Soh <teekaysoh@yahoo.com> |
---|---|
date | Sat, 27 Aug 2005 01:49:41 -0700 |
parents | 8b7d63489db3 |
children | 1bca39b85615 a906b018eaef |
comparison
equal
deleted
inserted
replaced
1084:069b4311a81b | 1085:6f94688b81b6 |
---|---|
1345 changetypes = [('modified', 'M', c), | 1345 changetypes = [('modified', 'M', c), |
1346 ('added', 'A', a), | 1346 ('added', 'A', a), |
1347 ('removed', 'R', d), | 1347 ('removed', 'R', d), |
1348 ('unknown', '?', u)] | 1348 ('unknown', '?', u)] |
1349 | 1349 |
1350 end = opts['print0'] and '\0' or '\n' | |
1351 | |
1350 for opt, char, changes in ([ct for ct in changetypes if opts[ct[0]]] | 1352 for opt, char, changes in ([ct for ct in changetypes if opts[ct[0]]] |
1351 or changetypes): | 1353 or changetypes): |
1354 if opts['strip']: | |
1355 format = "%%s%s" % end | |
1356 else: | |
1357 format = "%s %%s%s" % (char, end); | |
1358 | |
1352 for f in changes: | 1359 for f in changes: |
1353 ui.write("%s %s\n" % (char, f)) | 1360 ui.write(format % f) |
1354 | 1361 |
1355 def tag(ui, repo, name, rev=None, **opts): | 1362 def tag(ui, repo, name, rev=None, **opts): |
1356 """add a tag for the current tip or a given revision""" | 1363 """add a tag for the current tip or a given revision""" |
1357 if opts['text']: | 1364 if opts['text']: |
1358 ui.warn("Warning: -t and --text is deprecated," | 1365 ui.warn("Warning: -t and --text is deprecated," |
1626 (status, | 1633 (status, |
1627 [('m', 'modified', None, 'show only modified files'), | 1634 [('m', 'modified', None, 'show only modified files'), |
1628 ('a', 'added', None, 'show only added files'), | 1635 ('a', 'added', None, 'show only added files'), |
1629 ('r', 'removed', None, 'show only removed files'), | 1636 ('r', 'removed', None, 'show only removed files'), |
1630 ('u', 'unknown', None, 'show only unknown (not tracked) files'), | 1637 ('u', 'unknown', None, 'show only unknown (not tracked) files'), |
1638 ('p', 'strip', None, 'strip status prefix'), | |
1639 ('0', 'print0', None, 'end records with NUL'), | |
1631 ('I', 'include', [], 'include path in search'), | 1640 ('I', 'include', [], 'include path in search'), |
1632 ('X', 'exclude', [], 'exclude path from search')], | 1641 ('X', 'exclude', [], 'exclude path from search')], |
1633 "hg status [OPTION]... [FILE]..."), | 1642 "hg status [OPTION]... [FILE]..."), |
1634 "tag": | 1643 "tag": |
1635 (tag, | 1644 (tag, |