author | Vadim Gelfer <vadim.gelfer@gmail.com> |
Thu, 10 Aug 2006 15:02:18 -0700 | |
changeset 2846 | b8d587cfa3bb |
parent 2812 | 3aeab7bb5adc |
child 2836 | e78cad1f6b1f |
child 2847 | 2ff57e3113a4 |
permissions | -rw-r--r-- |
249 | 1 |
# commands.py - command processing for mercurial |
2 |
# |
|
3 |
# Copyright 2005 Matt Mackall <mpm@selenic.com> |
|
4 |
# |
|
5 |
# This software may be used and distributed according to the terms |
|
6 |
# of the GNU General Public License, incorporated herein by reference. |
|
7 |
||
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
8 |
from demandload import demandload |
1092 | 9 |
from node import * |
1400
cf9a1233738a
i18n first part: make '_' available for files who need it
Benoit Boissinot <benoit.boissinot@ens-lyon.org
parents:
1395
diff
changeset
|
10 |
from i18n import gettext as _ |
2461
ff9ee834e3b6
tidy up mtime patch of andrea, get back half of performance loss.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2460
diff
changeset
|
11 |
demandload(globals(), "os re sys signal shutil imp urllib pdb") |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
12 |
demandload(globals(), "fancyopts ui hg util lock revlog templater bundlerepo") |
2356
2db831b33e8f
Final stage of the hgweb split up.
Eric Hopper <hopper@omnifarious.org>
parents:
2355
diff
changeset
|
13 |
demandload(globals(), "fnmatch mdiff random signal tempfile time") |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
14 |
demandload(globals(), "traceback errno socket version struct atexit sets bz2") |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
15 |
demandload(globals(), "archival cStringIO changegroup email.Parser") |
2396
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
16 |
demandload(globals(), "hgweb.server sshserver") |
209 | 17 |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
18 |
class UnknownCommand(Exception): |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
19 |
"""Exception raised if command is not in the command table.""" |
1518
ac4ca6bf2383
Improved error message for ambiguous command shortcuts.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1517
diff
changeset
|
20 |
class AmbiguousCommand(Exception): |
ac4ca6bf2383
Improved error message for ambiguous command shortcuts.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1517
diff
changeset
|
21 |
"""Exception raised if command shortcut matches more than one command.""" |
209 | 22 |
|
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
23 |
def bail_if_changed(repo): |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
24 |
modified, added, removed, deleted, unknown = repo.changes() |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
25 |
if modified or added or removed or deleted: |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
26 |
raise util.Abort(_("outstanding uncommitted changes")) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
27 |
|
245 | 28 |
def filterfiles(filters, files): |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
29 |
l = [x for x in files if x in filters] |
213 | 30 |
|
245 | 31 |
for t in filters: |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
32 |
if t and t[-1] != "/": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
33 |
t += "/" |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
34 |
l += [x for x in files if x.startswith(t)] |
213 | 35 |
return l |
36 |
||
209 | 37 |
def relpath(repo, args): |
628
8d7f6e68828a
Use repo.getcwd() in a few obvious places.
Bryan O'Sullivan <bos@serpentine.com>
parents:
627
diff
changeset
|
38 |
cwd = repo.getcwd() |
8d7f6e68828a
Use repo.getcwd() in a few obvious places.
Bryan O'Sullivan <bos@serpentine.com>
parents:
627
diff
changeset
|
39 |
if cwd: |
886
509de8ab6f31
Fix walk path handling on Windows
Bryan O'Sullivan <bos@serpentine.com>
parents:
884
diff
changeset
|
40 |
return [util.normpath(os.path.join(cwd, x)) for x in args] |
209 | 41 |
return args |
245 | 42 |
|
2799
bd8a9a94139f
commands.logmessage: simplify calling.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2789
diff
changeset
|
43 |
def logmessage(opts): |
2694
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
44 |
""" get the log message according to -m and -l option """ |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
45 |
message = opts['message'] |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
46 |
logfile = opts['logfile'] |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
47 |
|
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
48 |
if message and logfile: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
49 |
raise util.Abort(_('options --message and --logfile are mutually ' |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
50 |
'exclusive')) |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
51 |
if not message and logfile: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
52 |
try: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
53 |
if logfile == '-': |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
54 |
message = sys.stdin.read() |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
55 |
else: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
56 |
message = open(logfile).read() |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
57 |
except IOError, inst: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
58 |
raise util.Abort(_("can't read commit message '%s': %s") % |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
59 |
(logfile, inst.strerror)) |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
60 |
return message |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
61 |
|
1568
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
62 |
def matchpats(repo, pats=[], opts={}, head=''): |
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
63 |
cwd = repo.getcwd() |
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
64 |
if not pats and cwd: |
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
65 |
opts['include'] = [os.path.join(cwd, i) for i in opts['include']] |
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
66 |
opts['exclude'] = [os.path.join(cwd, x) for x in opts['exclude']] |
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
67 |
cwd = '' |
1413
1c64c628d15f
Do not use 'glob' expansion by default on OS != 'nt'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1405
diff
changeset
|
68 |
return util.cmdmatcher(repo.root, cwd, pats or ['.'], opts.get('include'), |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
69 |
opts.get('exclude'), head) |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
70 |
|
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
71 |
def makewalk(repo, pats, opts, node=None, head='', badmatch=None): |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
72 |
files, matchfn, anypats = matchpats(repo, pats, opts, head) |
942
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
73 |
exact = dict(zip(files, files)) |
837
a95c9b3fc3bf
Fix performance of hg diff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
823
diff
changeset
|
74 |
def walk(): |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
75 |
for src, fn in repo.walk(node=node, files=files, match=matchfn, |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
76 |
badmatch=badmatch): |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
77 |
yield src, fn, util.pathto(repo.getcwd(), fn), fn in exact |
837
a95c9b3fc3bf
Fix performance of hg diff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
823
diff
changeset
|
78 |
return files, matchfn, walk() |
a95c9b3fc3bf
Fix performance of hg diff.
Bryan O'Sullivan <bos@serpentine.com>
parents:
823
diff
changeset
|
79 |
|
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
80 |
def walk(repo, pats, opts, node=None, head='', badmatch=None): |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
81 |
files, matchfn, results = makewalk(repo, pats, opts, node, head, badmatch) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
82 |
for r in results: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
83 |
yield r |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
84 |
|
1568
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
85 |
def walkchangerevs(ui, repo, pats, opts): |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
86 |
'''Iterate over files and the revs they changed in. |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
87 |
|
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
88 |
Callers most commonly need to iterate backwards over the history |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
89 |
it is interested in. Doing so has awful (quadratic-looking) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
90 |
performance, so we use iterators in a "windowed" way. |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
91 |
|
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
92 |
We walk a window of revisions in the desired order. Within the |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
93 |
window, we first walk forwards to gather data, then in the desired |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
94 |
order (usually backwards) to display it. |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
95 |
|
1570
6a104941d56a
hg log -p should show file deletions
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1568
diff
changeset
|
96 |
This function returns an (iterator, getchange, matchfn) tuple. The |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
97 |
getchange function returns the changelog entry for a numeric |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
98 |
revision. The iterator yields 3-tuples. They will be of one of |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
99 |
the following forms: |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
100 |
|
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
101 |
"window", incrementing, lastrev: stepping through a window, |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
102 |
positive if walking forwards through revs, last rev in the |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
103 |
sequence iterated over - use to reset state for the current window |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
104 |
|
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
105 |
"add", rev, fns: out-of-order traversal of the given file names |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
106 |
fns, which changed during revision rev - use to gather data for |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
107 |
possible display |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
108 |
|
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
109 |
"iter", rev, None: in-order traversal of the revs earlier iterated |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
110 |
over with "add" - use to display data''' |
1337
d4b25df77a9e
Fix up some bugs for log and grep with empty repo
mpm@selenic.com
parents:
1331
diff
changeset
|
111 |
|
1799
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
112 |
def increasing_windows(start, end, windowsize=8, sizelimit=512): |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
113 |
if start < end: |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
114 |
while start < end: |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
115 |
yield start, min(windowsize, end-start) |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
116 |
start += windowsize |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
117 |
if windowsize < sizelimit: |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
118 |
windowsize *= 2 |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
119 |
else: |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
120 |
while start > end: |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
121 |
yield start, min(windowsize, start-end-1) |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
122 |
start -= windowsize |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
123 |
if windowsize < sizelimit: |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
124 |
windowsize *= 2 |
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
125 |
|
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
126 |
|
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
127 |
files, matchfn, anypats = matchpats(repo, pats, opts) |
2784
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
128 |
follow = opts.get('follow') or opts.get('follow_first') |
1570
6a104941d56a
hg log -p should show file deletions
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1568
diff
changeset
|
129 |
|
1337
d4b25df77a9e
Fix up some bugs for log and grep with empty repo
mpm@selenic.com
parents:
1331
diff
changeset
|
130 |
if repo.changelog.count() == 0: |
1570
6a104941d56a
hg log -p should show file deletions
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1568
diff
changeset
|
131 |
return [], False, matchfn |
1337
d4b25df77a9e
Fix up some bugs for log and grep with empty repo
mpm@selenic.com
parents:
1331
diff
changeset
|
132 |
|
2783
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
133 |
if follow: |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
134 |
p = repo.dirstate.parents()[0] |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
135 |
if p == nullid: |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
136 |
ui.warn(_('No working directory revision; defaulting to tip\n')) |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
137 |
start = 'tip' |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
138 |
else: |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
139 |
start = repo.changelog.rev(p) |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
140 |
defrange = '%s:0' % start |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
141 |
else: |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
142 |
defrange = 'tip:0' |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
143 |
revs = map(int, revrange(ui, repo, opts['rev'] or [defrange])) |
1057 | 144 |
wanted = {} |
145 |
slowpath = anypats |
|
146 |
fncache = {} |
|
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
147 |
|
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
148 |
chcache = {} |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
149 |
def getchange(rev): |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
150 |
ch = chcache.get(rev) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
151 |
if ch is None: |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
152 |
chcache[rev] = ch = repo.changelog.read(repo.lookup(str(rev))) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
153 |
return ch |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
154 |
|
1057 | 155 |
if not slowpath and not files: |
156 |
# No files, no patterns. Display all revs. |
|
157 |
wanted = dict(zip(revs, revs)) |
|
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
158 |
copies = [] |
1057 | 159 |
if not slowpath: |
160 |
# Only files, no patterns. Check the history of each file. |
|
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
161 |
def filerevgen(filelog, node): |
2626
f84e166eb0de
walkchangerevs: fix race in fast path
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2625
diff
changeset
|
162 |
cl_count = repo.changelog.count() |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
163 |
if node is None: |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
164 |
last = filelog.count() - 1 |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
165 |
else: |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
166 |
last = filelog.rev(node) |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
167 |
for i, window in increasing_windows(last, -1): |
1057 | 168 |
revs = [] |
1800
414e81ae971f
Removed now obsolete min/max check in walkchangerevs().
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1799
diff
changeset
|
169 |
for j in xrange(i - window, i + 1): |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
170 |
n = filelog.node(j) |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
171 |
revs.append((filelog.linkrev(n), |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
172 |
follow and filelog.renamed(n))) |
1057 | 173 |
revs.reverse() |
174 |
for rev in revs: |
|
2626
f84e166eb0de
walkchangerevs: fix race in fast path
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2625
diff
changeset
|
175 |
# only yield rev for which we have the changelog, it can |
f84e166eb0de
walkchangerevs: fix race in fast path
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2625
diff
changeset
|
176 |
# happen while doing "hg log" during a pull or commit |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
177 |
if rev[0] < cl_count: |
2626
f84e166eb0de
walkchangerevs: fix race in fast path
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2625
diff
changeset
|
178 |
yield rev |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
179 |
def iterfiles(): |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
180 |
for filename in files: |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
181 |
yield filename, None |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
182 |
for filename_node in copies: |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
183 |
yield filename_node |
1057 | 184 |
minrev, maxrev = min(revs), max(revs) |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
185 |
for file_, node in iterfiles(): |
1749
d457fec76ab0
fix warnings from pychecker (unused variables and shadowing)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1747
diff
changeset
|
186 |
filelog = repo.file(file_) |
1057 | 187 |
# A zero count may be a directory or deleted file, so |
188 |
# try to find matching entries on the slow path. |
|
189 |
if filelog.count() == 0: |
|
190 |
slowpath = True |
|
191 |
break |
|
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
192 |
for rev, copied in filerevgen(filelog, node): |
1057 | 193 |
if rev <= maxrev: |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
194 |
if rev < minrev: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
195 |
break |
1057 | 196 |
fncache.setdefault(rev, []) |
1749
d457fec76ab0
fix warnings from pychecker (unused variables and shadowing)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1747
diff
changeset
|
197 |
fncache[rev].append(file_) |
1057 | 198 |
wanted[rev] = 1 |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
199 |
if follow and copied: |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
200 |
copies.append(copied) |
1057 | 201 |
if slowpath: |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
202 |
if follow: |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
203 |
raise util.Abort(_('can only follow copies/renames for explicit ' |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
204 |
'file names')) |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
205 |
|
1057 | 206 |
# The slow path checks files modified in every changeset. |
207 |
def changerevgen(): |
|
1799
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
208 |
for i, window in increasing_windows(repo.changelog.count()-1, -1): |
1800
414e81ae971f
Removed now obsolete min/max check in walkchangerevs().
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1799
diff
changeset
|
209 |
for j in xrange(i - window, i + 1): |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
210 |
yield j, getchange(j)[3] |
1057 | 211 |
|
212 |
for rev, changefiles in changerevgen(): |
|
213 |
matches = filter(matchfn, changefiles) |
|
214 |
if matches: |
|
215 |
fncache[rev] = matches |
|
216 |
wanted[rev] = 1 |
|
217 |
||
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
218 |
def iterate(): |
2782
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
219 |
class followfilter: |
2784
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
220 |
def __init__(self, onlyfirst=False): |
2782
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
221 |
self.startrev = -1 |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
222 |
self.roots = [] |
2784
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
223 |
self.onlyfirst = onlyfirst |
2782
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
224 |
|
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
225 |
def match(self, rev): |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
226 |
def realparents(rev): |
2784
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
227 |
if self.onlyfirst: |
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
228 |
return repo.changelog.parentrevs(rev)[0:1] |
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
229 |
else: |
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
230 |
return filter(lambda x: x != -1, repo.changelog.parentrevs(rev)) |
2782
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
231 |
|
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
232 |
if self.startrev == -1: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
233 |
self.startrev = rev |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
234 |
return True |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
235 |
|
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
236 |
if rev > self.startrev: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
237 |
# forward: all descendants |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
238 |
if not self.roots: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
239 |
self.roots.append(self.startrev) |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
240 |
for parent in realparents(rev): |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
241 |
if parent in self.roots: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
242 |
self.roots.append(rev) |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
243 |
return True |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
244 |
else: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
245 |
# backwards: all parents |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
246 |
if not self.roots: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
247 |
self.roots.extend(realparents(self.startrev)) |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
248 |
if rev in self.roots: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
249 |
self.roots.remove(rev) |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
250 |
self.roots.extend(realparents(rev)) |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
251 |
return True |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
252 |
|
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
253 |
return False |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
254 |
|
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
255 |
if follow and not files: |
2784
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
256 |
ff = followfilter(onlyfirst=opts.get('follow_first')) |
2782
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
257 |
def want(rev): |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
258 |
if rev not in wanted: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
259 |
return False |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
260 |
return ff.match(rev) |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
261 |
else: |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
262 |
def want(rev): |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
263 |
return rev in wanted |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
264 |
|
1799
b942f5cfd326
Replaced fixed window size for walkchangerevs with an increasing one. Window
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1782
diff
changeset
|
265 |
for i, window in increasing_windows(0, len(revs)): |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
266 |
yield 'window', revs[0] < revs[-1], revs[-1] |
2782
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
267 |
nrevs = [rev for rev in revs[i:i+window] if want(rev)] |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
268 |
srevs = list(nrevs) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
269 |
srevs.sort() |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
270 |
for rev in srevs: |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
271 |
fns = fncache.get(rev) or filter(matchfn, getchange(rev)[3]) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
272 |
yield 'add', rev, fns |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
273 |
for rev in nrevs: |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
274 |
yield 'iter', rev, None |
1570
6a104941d56a
hg log -p should show file deletions
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1568
diff
changeset
|
275 |
return iterate(), getchange, matchfn |
1057 | 276 |
|
580 | 277 |
revrangesep = ':' |
278 |
||
2331
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
279 |
def revfix(repo, val, defval): |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
280 |
'''turn user-level id of changeset into rev number. |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
281 |
user-level id can be tag, changeset, rev number, or negative rev |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
282 |
number relative to number of revs (-1 is tip, etc).''' |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
283 |
if not val: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
284 |
return defval |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
285 |
try: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
286 |
num = int(val) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
287 |
if str(num) != val: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
288 |
raise ValueError |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
289 |
if num < 0: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
290 |
num += repo.changelog.count() |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
291 |
if num < 0: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
292 |
num = 0 |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
293 |
elif num >= repo.changelog.count(): |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
294 |
raise ValueError |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
295 |
except ValueError: |
580 | 296 |
try: |
2331
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
297 |
num = repo.changelog.rev(repo.lookup(val)) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
298 |
except KeyError: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
299 |
raise util.Abort(_('invalid revision identifier %s'), val) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
300 |
return num |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
301 |
|
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
302 |
def revpair(ui, repo, revs): |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
303 |
'''return pair of nodes, given list of revisions. second item can |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
304 |
be None, meaning use working dir.''' |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
305 |
if not revs: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
306 |
return repo.dirstate.parents()[0], None |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
307 |
end = None |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
308 |
if len(revs) == 1: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
309 |
start = revs[0] |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
310 |
if revrangesep in start: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
311 |
start, end = start.split(revrangesep, 1) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
312 |
start = revfix(repo, start, 0) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
313 |
end = revfix(repo, end, repo.changelog.count() - 1) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
314 |
else: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
315 |
start = revfix(repo, start, None) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
316 |
elif len(revs) == 2: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
317 |
if revrangesep in revs[0] or revrangesep in revs[1]: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
318 |
raise util.Abort(_('too many revisions specified')) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
319 |
start = revfix(repo, revs[0], None) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
320 |
end = revfix(repo, revs[1], None) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
321 |
else: |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
322 |
raise util.Abort(_('too many revisions specified')) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
323 |
if end is not None: end = repo.lookup(str(end)) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
324 |
return repo.lookup(str(start)), end |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
325 |
|
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
326 |
def revrange(ui, repo, revs): |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
327 |
"""Yield revision as strings from a list of revision specifications.""" |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
328 |
seen = {} |
580 | 329 |
for spec in revs: |
2579
0875cda033fd
use __contains__, index or split instead of str.find
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2574
diff
changeset
|
330 |
if revrangesep in spec: |
580 | 331 |
start, end = spec.split(revrangesep, 1) |
2331
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
332 |
start = revfix(repo, start, 0) |
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
333 |
end = revfix(repo, end, repo.changelog.count() - 1) |
1066
ea878688221e
Shortened commands.revrange() a little bit, added docstring.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1065
diff
changeset
|
334 |
step = start > end and -1 or 1 |
ea878688221e
Shortened commands.revrange() a little bit, added docstring.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1065
diff
changeset
|
335 |
for rev in xrange(start, end+step, step): |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
336 |
if rev in seen: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
337 |
continue |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
338 |
seen[rev] = 1 |
580 | 339 |
yield str(rev) |
340 |
else: |
|
2331
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
341 |
rev = revfix(repo, spec, None) |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
342 |
if rev in seen: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
343 |
continue |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
344 |
seen[rev] = 1 |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
345 |
yield str(rev) |
580 | 346 |
|
2562
a020024c5870
simplify make_filename, fix hg cat bug
Matt Mackall <mpm@selenic.com>
parents:
2494
diff
changeset
|
347 |
def make_filename(repo, pat, node, |
1254
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
348 |
total=None, seqno=None, revwidth=None, pathname=None): |
632 | 349 |
node_expander = { |
1092 | 350 |
'H': lambda: hex(node), |
2562
a020024c5870
simplify make_filename, fix hg cat bug
Matt Mackall <mpm@selenic.com>
parents:
2494
diff
changeset
|
351 |
'R': lambda: str(repo.changelog.rev(node)), |
1092 | 352 |
'h': lambda: short(node), |
632 | 353 |
} |
354 |
expander = { |
|
355 |
'%': lambda: '%', |
|
356 |
'b': lambda: os.path.basename(repo.root), |
|
357 |
} |
|
358 |
||
727
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
359 |
try: |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
360 |
if node: |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
361 |
expander.update(node_expander) |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
362 |
if node and revwidth is not None: |
2736
eb1bde9560bc
fix output file format %r
Christian Ebert <blacktrash@gmx.net>
parents:
2733
diff
changeset
|
363 |
expander['r'] = (lambda: |
eb1bde9560bc
fix output file format %r
Christian Ebert <blacktrash@gmx.net>
parents:
2733
diff
changeset
|
364 |
str(repo.changelog.rev(node)).zfill(revwidth)) |
727
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
365 |
if total is not None: |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
366 |
expander['N'] = lambda: str(total) |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
367 |
if seqno is not None: |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
368 |
expander['n'] = lambda: str(seqno) |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
369 |
if total is not None and seqno is not None: |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
370 |
expander['n'] = lambda:str(seqno).zfill(len(str(total))) |
1254
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
371 |
if pathname is not None: |
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
372 |
expander['s'] = lambda: os.path.basename(pathname) |
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
373 |
expander['d'] = lambda: os.path.dirname(pathname) or '.' |
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
374 |
expander['p'] = lambda: pathname |
632 | 375 |
|
727
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
376 |
newname = [] |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
377 |
patlen = len(pat) |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
378 |
i = 0 |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
379 |
while i < patlen: |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
380 |
c = pat[i] |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
381 |
if c == '%': |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
382 |
i += 1 |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
383 |
c = pat[i] |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
384 |
c = expander[c]() |
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
385 |
newname.append(c) |
632 | 386 |
i += 1 |
739
36edb39e8e8c
Split make_file back out into make_filename and make_file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
738
diff
changeset
|
387 |
return ''.join(newname) |
727
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
388 |
except KeyError, inst: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
389 |
raise util.Abort(_("invalid format spec '%%%s' in output file name"), |
727
acee766fcb79
Get commands to raise Abort instead of ui.warn(...),sys.exit(1).
Bryan O'Sullivan <bos@serpentine.com>
parents:
726
diff
changeset
|
390 |
inst.args[0]) |
632 | 391 |
|
2562
a020024c5870
simplify make_filename, fix hg cat bug
Matt Mackall <mpm@selenic.com>
parents:
2494
diff
changeset
|
392 |
def make_file(repo, pat, node=None, |
1254
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
393 |
total=None, seqno=None, revwidth=None, mode='wb', pathname=None): |
739
36edb39e8e8c
Split make_file back out into make_filename and make_file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
738
diff
changeset
|
394 |
if not pat or pat == '-': |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
395 |
return 'w' in mode and sys.stdout or sys.stdin |
739
36edb39e8e8c
Split make_file back out into make_filename and make_file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
738
diff
changeset
|
396 |
if hasattr(pat, 'write') and 'w' in mode: |
36edb39e8e8c
Split make_file back out into make_filename and make_file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
738
diff
changeset
|
397 |
return pat |
36edb39e8e8c
Split make_file back out into make_filename and make_file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
738
diff
changeset
|
398 |
if hasattr(pat, 'read') and 'r' in mode: |
36edb39e8e8c
Split make_file back out into make_filename and make_file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
738
diff
changeset
|
399 |
return pat |
2562
a020024c5870
simplify make_filename, fix hg cat bug
Matt Mackall <mpm@selenic.com>
parents:
2494
diff
changeset
|
400 |
return open(make_filename(repo, pat, node, total, seqno, revwidth, |
1254
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
401 |
pathname), |
739
36edb39e8e8c
Split make_file back out into make_filename and make_file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
738
diff
changeset
|
402 |
mode) |
36edb39e8e8c
Split make_file back out into make_filename and make_file.
Bryan O'Sullivan <bos@serpentine.com>
parents:
738
diff
changeset
|
403 |
|
1974
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
404 |
def write_bundle(cg, filename=None, compress=True): |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
405 |
"""Write a bundle file and return its filename. |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
406 |
|
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
407 |
Existing files will not be overwritten. |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
408 |
If no filename is specified, a temporary file is created. |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
409 |
bz2 compression can be turned off. |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
410 |
The bundle file will be deleted in case of errors. |
1972
ce127cb4ee6e
Documented behaviour of write_bundle regarding file handles.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1971
diff
changeset
|
411 |
""" |
1943
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
412 |
class nocompress(object): |
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
413 |
def compress(self, x): |
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
414 |
return x |
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
415 |
def flush(self): |
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
416 |
return "" |
1974
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
417 |
|
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
418 |
fh = None |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
419 |
cleanup = None |
1943
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
420 |
try: |
1974
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
421 |
if filename: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
422 |
if os.path.exists(filename): |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
423 |
raise util.Abort(_("file '%s' already exists"), filename) |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
424 |
fh = open(filename, "wb") |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
425 |
else: |
2165
d821918e3bee
Use better names (hg-{usage}-{random}.{suffix}) for temporary files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2160
diff
changeset
|
426 |
fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg") |
1974
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
427 |
fh = os.fdopen(fd, "wb") |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
428 |
cleanup = filename |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
429 |
|
1943
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
430 |
if compress: |
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
431 |
fh.write("HG10") |
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
432 |
z = bz2.BZ2Compressor(9) |
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
433 |
else: |
1980
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
434 |
fh.write("HG10UN") |
1943
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
435 |
z = nocompress() |
1981
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
436 |
# parse the changegroup data, otherwise we will block |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
437 |
# in case of sshrepo because we don't know the end of the stream |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
438 |
|
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
439 |
# an empty chunkiter is the end of the changegroup |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
440 |
empty = False |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
441 |
while not empty: |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
442 |
empty = True |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
443 |
for chunk in changegroup.chunkiter(cg): |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
444 |
empty = False |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
445 |
fh.write(z.compress(changegroup.genchunk(chunk))) |
736b6c96bbbc
make incoming work via ssh (issue139); move chunk code into separate module.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1980
diff
changeset
|
446 |
fh.write(z.compress(changegroup.closechunk())) |
1943
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
447 |
fh.write(z.flush()) |
1974
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
448 |
cleanup = None |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
449 |
return filename |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
450 |
finally: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
451 |
if fh is not None: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
452 |
fh.close() |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
453 |
if cleanup is not None: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
454 |
os.unlink(cleanup) |
1943
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
455 |
|
1014 | 456 |
def dodiff(fp, ui, repo, node1, node2, files=None, match=util.always, |
1728
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
457 |
changes=None, text=False, opts={}): |
1804
c3f959c1c3ff
refactor the dodiff optimization
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1803
diff
changeset
|
458 |
if not node1: |
c3f959c1c3ff
refactor the dodiff optimization
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1803
diff
changeset
|
459 |
node1 = repo.dirstate.parents()[0] |
c3f959c1c3ff
refactor the dodiff optimization
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1803
diff
changeset
|
460 |
# reading the data for node1 early allows it to play nicely |
c3f959c1c3ff
refactor the dodiff optimization
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1803
diff
changeset
|
461 |
# with repo.changes and the revlog cache. |
c3f959c1c3ff
refactor the dodiff optimization
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1803
diff
changeset
|
462 |
change = repo.changelog.read(node1) |
c3f959c1c3ff
refactor the dodiff optimization
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1803
diff
changeset
|
463 |
mmap = repo.manifest.read(change[0]) |
c3f959c1c3ff
refactor the dodiff optimization
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1803
diff
changeset
|
464 |
date1 = util.datestr(change[2]) |
1803
06e7447c7302
speed up hg log --patch
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
1801
diff
changeset
|
465 |
|
904
969647d5100a
Add optional parameter for changed/added/del/unknown files to commands.dodiff
mason@suse.com
parents:
899
diff
changeset
|
466 |
if not changes: |
1618
ff339dd21976
Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1615
diff
changeset
|
467 |
changes = repo.changes(node1, node2, files, match=match) |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
468 |
modified, added, removed, deleted, unknown = changes |
537 | 469 |
if files: |
1626
f2b1df3dbcbb
make the order of the arguments for filterfiles consistent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1625
diff
changeset
|
470 |
modified, added, removed = map(lambda x: filterfiles(files, x), |
1618
ff339dd21976
Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1615
diff
changeset
|
471 |
(modified, added, removed)) |
537 | 472 |
|
1618
ff339dd21976
Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1615
diff
changeset
|
473 |
if not modified and not added and not removed: |
537 | 474 |
return |
475 |
||
245 | 476 |
if node2: |
477 |
change = repo.changelog.read(node2) |
|
478 |
mmap2 = repo.manifest.read(change[0]) |
|
2460 | 479 |
_date2 = util.datestr(change[2]) |
480 |
def date2(f): |
|
481 |
return _date2 |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
482 |
def read(f): |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
483 |
return repo.file(f).read(mmap2[f]) |
245 | 484 |
else: |
2461
ff9ee834e3b6
tidy up mtime patch of andrea, get back half of performance loss.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2460
diff
changeset
|
485 |
tz = util.makedate()[1] |
2460 | 486 |
_date2 = util.datestr() |
487 |
def date2(f): |
|
488 |
try: |
|
2461
ff9ee834e3b6
tidy up mtime patch of andrea, get back half of performance loss.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2460
diff
changeset
|
489 |
return util.datestr((os.lstat(repo.wjoin(f)).st_mtime, tz)) |
2482 | 490 |
except OSError, err: |
2461
ff9ee834e3b6
tidy up mtime patch of andrea, get back half of performance loss.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2460
diff
changeset
|
491 |
if err.errno != errno.ENOENT: raise |
2460 | 492 |
return _date2 |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
493 |
def read(f): |
1648
80640ef93aec
Process working files through encode filters in dodiff()
Petr Mazanec <petr.mazanec@tiscali.cz>
parents:
1637
diff
changeset
|
494 |
return repo.wread(f) |
245 | 495 |
|
396
8f8bb77d560e
Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
395
diff
changeset
|
496 |
if ui.quiet: |
8f8bb77d560e
Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
395
diff
changeset
|
497 |
r = None |
8f8bb77d560e
Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
395
diff
changeset
|
498 |
else: |
1092 | 499 |
hexfunc = ui.verbose and hex or short |
396
8f8bb77d560e
Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
395
diff
changeset
|
500 |
r = [hexfunc(node) for node in [node1, node2] if node] |
8f8bb77d560e
Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
395
diff
changeset
|
501 |
|
1637 | 502 |
diffopts = ui.diffopts() |
1728
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
503 |
showfunc = opts.get('show_function') or diffopts['showfunc'] |
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
504 |
ignorews = opts.get('ignore_all_space') or diffopts['ignorews'] |
2580
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
505 |
ignorewsamount = opts.get('ignore_space_change') or \ |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
506 |
diffopts['ignorewsamount'] |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
507 |
ignoreblanklines = opts.get('ignore_blank_lines') or \ |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
508 |
diffopts['ignoreblanklines'] |
2718
a593813241e5
makes 'hg diff' diff the file in sorted order
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2717
diff
changeset
|
509 |
|
a593813241e5
makes 'hg diff' diff the file in sorted order
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2717
diff
changeset
|
510 |
all = modified + added + removed |
a593813241e5
makes 'hg diff' diff the file in sorted order
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2717
diff
changeset
|
511 |
all.sort() |
a593813241e5
makes 'hg diff' diff the file in sorted order
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2717
diff
changeset
|
512 |
for f in all: |
275 | 513 |
to = None |
2718
a593813241e5
makes 'hg diff' diff the file in sorted order
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2717
diff
changeset
|
514 |
tn = None |
275 | 515 |
if f in mmap: |
516 |
to = repo.file(f).read(mmap[f]) |
|
2718
a593813241e5
makes 'hg diff' diff the file in sorted order
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2717
diff
changeset
|
517 |
if f not in removed: |
a593813241e5
makes 'hg diff' diff the file in sorted order
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2717
diff
changeset
|
518 |
tn = read(f) |
2460 | 519 |
fp.write(mdiff.unidiff(to, date1, tn, date2(f), f, r, text=text, |
2580
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
520 |
showfunc=showfunc, ignorews=ignorews, |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
521 |
ignorewsamount=ignorewsamount, |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
522 |
ignoreblanklines=ignoreblanklines)) |
329
67c19ad374a9
Use common output function show_changeset() for hg heads|history|log|tip.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
320
diff
changeset
|
523 |
|
1147 | 524 |
def trimuser(ui, name, rev, revcache): |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
525 |
"""trim the name of the user who committed a change""" |
1147 | 526 |
user = revcache.get(rev) |
527 |
if user is None: |
|
528 |
user = revcache[rev] = ui.shortuser(name) |
|
529 |
return user |
|
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
530 |
|
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
531 |
class changeset_printer(object): |
1909
37b9f80a5fbb
add doc comments to template code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1908
diff
changeset
|
532 |
'''show changeset information when templating not requested.''' |
37b9f80a5fbb
add doc comments to template code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1908
diff
changeset
|
533 |
|
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
534 |
def __init__(self, ui, repo): |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
535 |
self.ui = ui |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
536 |
self.repo = repo |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
537 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
538 |
def show(self, rev=0, changenode=None, brinfo=None): |
1909
37b9f80a5fbb
add doc comments to template code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1908
diff
changeset
|
539 |
'''show a single changeset or file revision''' |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
540 |
log = self.repo.changelog |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
541 |
if changenode is None: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
542 |
changenode = log.node(rev) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
543 |
elif not rev: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
544 |
rev = log.rev(changenode) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
545 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
546 |
if self.ui.quiet: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
547 |
self.ui.write("%d:%s\n" % (rev, short(changenode))) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
548 |
return |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
549 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
550 |
changes = log.read(changenode) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
551 |
date = util.datestr(changes[2]) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
552 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
553 |
parents = [(log.rev(p), self.ui.verbose and hex(p) or short(p)) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
554 |
for p in log.parents(changenode) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
555 |
if self.ui.debugflag or p != nullid] |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
556 |
if (not self.ui.debugflag and len(parents) == 1 and |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
557 |
parents[0][0] == rev-1): |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
558 |
parents = [] |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
559 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
560 |
if self.ui.verbose: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
561 |
self.ui.write(_("changeset: %d:%s\n") % (rev, hex(changenode))) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
562 |
else: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
563 |
self.ui.write(_("changeset: %d:%s\n") % (rev, short(changenode))) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
564 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
565 |
for tag in self.repo.nodetags(changenode): |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
566 |
self.ui.status(_("tag: %s\n") % tag) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
567 |
for parent in parents: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
568 |
self.ui.write(_("parent: %d:%s\n") % parent) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
569 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
570 |
if brinfo and changenode in brinfo: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
571 |
br = brinfo[changenode] |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
572 |
self.ui.write(_("branch: %s\n") % " ".join(br)) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
573 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
574 |
self.ui.debug(_("manifest: %d:%s\n") % |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
575 |
(self.repo.manifest.rev(changes[0]), hex(changes[0]))) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
576 |
self.ui.status(_("user: %s\n") % changes[1]) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
577 |
self.ui.status(_("date: %s\n") % date) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
578 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
579 |
if self.ui.debugflag: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
580 |
files = self.repo.changes(log.parents(changenode)[0], changenode) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
581 |
for key, value in zip([_("files:"), _("files+:"), _("files-:")], |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
582 |
files): |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
583 |
if value: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
584 |
self.ui.note("%-12s %s\n" % (key, " ".join(value))) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
585 |
else: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
586 |
self.ui.note(_("files: %s\n") % " ".join(changes[3])) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
587 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
588 |
description = changes[4].strip() |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
589 |
if description: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
590 |
if self.ui.verbose: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
591 |
self.ui.status(_("description:\n")) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
592 |
self.ui.status(description) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
593 |
self.ui.status("\n\n") |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
594 |
else: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
595 |
self.ui.status(_("summary: %s\n") % |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
596 |
description.splitlines()[0]) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
597 |
self.ui.status("\n") |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
598 |
|
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
599 |
def show_changeset(ui, repo, opts): |
1909
37b9f80a5fbb
add doc comments to template code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1908
diff
changeset
|
600 |
'''show one changeset. uses template or regular display. caller |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
601 |
can pass in 'style' and 'template' options in opts.''' |
1909
37b9f80a5fbb
add doc comments to template code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1908
diff
changeset
|
602 |
|
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
603 |
tmpl = opts.get('template') |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
604 |
if tmpl: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
605 |
tmpl = templater.parsestring(tmpl, quoted=False) |
778 | 606 |
else: |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
607 |
tmpl = ui.config('ui', 'logtemplate') |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
608 |
if tmpl: tmpl = templater.parsestring(tmpl) |
1914
a5bf0030df5f
make --style=compact look for map-cmdline.compact.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1913
diff
changeset
|
609 |
mapfile = opts.get('style') or ui.config('ui', 'style') |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
610 |
if tmpl or mapfile: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
611 |
if mapfile: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
612 |
if not os.path.isfile(mapfile): |
1914
a5bf0030df5f
make --style=compact look for map-cmdline.compact.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1913
diff
changeset
|
613 |
mapname = templater.templatepath('map-cmdline.' + mapfile) |
a5bf0030df5f
make --style=compact look for map-cmdline.compact.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1913
diff
changeset
|
614 |
if not mapname: mapname = templater.templatepath(mapfile) |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
615 |
if mapname: mapfile = mapname |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
616 |
try: |
2189
e3eba577a0ae
move changeset_templater into templater module.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2184
diff
changeset
|
617 |
t = templater.changeset_templater(ui, repo, mapfile) |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
618 |
except SyntaxError, inst: |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
619 |
raise util.Abort(inst.args[0]) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
620 |
if tmpl: t.use_template(tmpl) |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
621 |
return t |
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
622 |
return changeset_printer(ui, repo) |
329
67c19ad374a9
Use common output function show_changeset() for hg heads|history|log|tip.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
320
diff
changeset
|
623 |
|
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
624 |
def setremoteconfig(ui, opts): |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
625 |
"copy remote options to ui tree" |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
626 |
if opts.get('ssh'): |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
627 |
ui.setconfig("ui", "ssh", opts['ssh']) |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
628 |
if opts.get('remotecmd'): |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
629 |
ui.setconfig("ui", "remotecmd", opts['remotecmd']) |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
630 |
|
470
0ab093b473c5
Fix up version module name and command conflict
mpm@selenic.com
parents:
468
diff
changeset
|
631 |
def show_version(ui): |
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
396
diff
changeset
|
632 |
"""output version and copyright information""" |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
633 |
ui.write(_("Mercurial Distributed SCM (version %s)\n") |
849
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
634 |
% version.get_version()) |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
635 |
ui.status(_( |
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
396
diff
changeset
|
636 |
"\nCopyright (C) 2005 Matt Mackall <mpm@selenic.com>\n" |
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
396
diff
changeset
|
637 |
"This is free software; see the source for copying conditions. " |
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
396
diff
changeset
|
638 |
"There is NO\nwarranty; " |
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
396
diff
changeset
|
639 |
"not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
640 |
)) |
423
25afb21d97ba
Support for 'hg --version'. setup.py stores version from hg repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
396
diff
changeset
|
641 |
|
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
642 |
def help_(ui, name=None, with_version=False): |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
643 |
"""show help for a command, extension, or list of commands |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
644 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
645 |
With no arguments, print a list of commands and short help. |
2600
c4325f0a9b91
clean up trailing white space.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2598
diff
changeset
|
646 |
|
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
647 |
Given a command name, print help for that command. |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
648 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
649 |
Given an extension name, print help for that extension, and the |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
650 |
commands it provides.""" |
1052
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
651 |
option_lists = [] |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
652 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
653 |
def helpcmd(name): |
1049
160a68cd393f
Allow --help and --version being used together.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1048
diff
changeset
|
654 |
if with_version: |
160a68cd393f
Allow --help and --version being used together.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1048
diff
changeset
|
655 |
show_version(ui) |
160a68cd393f
Allow --help and --version being used together.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1048
diff
changeset
|
656 |
ui.write('\n') |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
657 |
aliases, i = findcmd(name) |
849
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
658 |
# synopsis |
848
221628fe9b62
Always show short help when an unknown command is given.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
846
diff
changeset
|
659 |
ui.write("%s\n\n" % i[2]) |
293 | 660 |
|
849
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
661 |
# description |
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
662 |
doc = i[0].__doc__ |
1710
c65113f3627a
Show "(No help text available)" for commands without doc string.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1661
diff
changeset
|
663 |
if not doc: |
c65113f3627a
Show "(No help text available)" for commands without doc string.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1661
diff
changeset
|
664 |
doc = _("(No help text available)") |
849
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
665 |
if ui.quiet: |
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
666 |
doc = doc.splitlines(0)[0] |
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
667 |
ui.write("%s\n" % doc.rstrip()) |
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
668 |
|
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
669 |
if not ui.quiet: |
1052
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
670 |
# aliases |
1517
b582dbc16165
Canonicalize command when using aliases or prefix matching.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1507
diff
changeset
|
671 |
if len(aliases) > 1: |
b582dbc16165
Canonicalize command when using aliases or prefix matching.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1507
diff
changeset
|
672 |
ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:])) |
849
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
673 |
|
1052
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
674 |
# options |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
675 |
if i[1]: |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
676 |
option_lists.append(("options", i[1])) |
2600
c4325f0a9b91
clean up trailing white space.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2598
diff
changeset
|
677 |
|
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
678 |
def helplist(select=None): |
255 | 679 |
h = {} |
844
5a717cfa7406
'hg help -v' mentions the alias of the commands
kreijack@inwind.REMOVEME.it
parents:
843
diff
changeset
|
680 |
cmds = {} |
479
7293cb91bf2a
Cleaned up command alias handling in help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
477
diff
changeset
|
681 |
for c, e in table.items(): |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
682 |
f = c.split("|", 1)[0] |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
683 |
if select and not select(f): |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
684 |
continue |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
685 |
if name == "shortlist" and not f.startswith("^"): |
479
7293cb91bf2a
Cleaned up command alias handling in help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
477
diff
changeset
|
686 |
continue |
849
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
687 |
f = f.lstrip("^") |
593 | 688 |
if not ui.debugflag and f.startswith("debug"): |
689 |
continue |
|
1710
c65113f3627a
Show "(No help text available)" for commands without doc string.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1661
diff
changeset
|
690 |
doc = e[0].__doc__ |
c65113f3627a
Show "(No help text available)" for commands without doc string.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1661
diff
changeset
|
691 |
if not doc: |
c65113f3627a
Show "(No help text available)" for commands without doc string.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1661
diff
changeset
|
692 |
doc = _("(No help text available)") |
c65113f3627a
Show "(No help text available)" for commands without doc string.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1661
diff
changeset
|
693 |
h[f] = doc.splitlines(0)[0].rstrip() |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
694 |
cmds[f] = c.lstrip("^") |
255 | 695 |
|
696 |
fns = h.keys() |
|
697 |
fns.sort() |
|
698 |
m = max(map(len, fns)) |
|
699 |
for f in fns: |
|
844
5a717cfa7406
'hg help -v' mentions the alias of the commands
kreijack@inwind.REMOVEME.it
parents:
843
diff
changeset
|
700 |
if ui.verbose: |
5a717cfa7406
'hg help -v' mentions the alias of the commands
kreijack@inwind.REMOVEME.it
parents:
843
diff
changeset
|
701 |
commands = cmds[f].replace("|",", ") |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
702 |
ui.write(" %s:\n %s\n"%(commands, h[f])) |
844
5a717cfa7406
'hg help -v' mentions the alias of the commands
kreijack@inwind.REMOVEME.it
parents:
843
diff
changeset
|
703 |
else: |
5a717cfa7406
'hg help -v' mentions the alias of the commands
kreijack@inwind.REMOVEME.it
parents:
843
diff
changeset
|
704 |
ui.write(' %-*s %s\n' % (m, f, h[f])) |
255 | 705 |
|
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
706 |
def helpext(name): |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
707 |
try: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
708 |
mod = findext(name) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
709 |
except KeyError: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
710 |
raise UnknownCommand(name) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
711 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
712 |
doc = (mod.__doc__ or _('No help text available')).splitlines(0) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
713 |
ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0])) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
714 |
for d in doc[1:]: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
715 |
ui.write(d, '\n') |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
716 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
717 |
ui.status('\n') |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
718 |
if ui.verbose: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
719 |
ui.status(_('list of commands:\n\n')) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
720 |
else: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
721 |
ui.status(_('list of commands (use "hg help -v %s" ' |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
722 |
'to show aliases and global options):\n\n') % name) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
723 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
724 |
modcmds = dict.fromkeys([c.split('|', 1)[0] for c in mod.cmdtable]) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
725 |
helplist(modcmds.has_key) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
726 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
727 |
if name and name != 'shortlist': |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
728 |
try: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
729 |
helpcmd(name) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
730 |
except UnknownCommand: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
731 |
helpext(name) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
732 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
733 |
else: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
734 |
# program name |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
735 |
if ui.verbose or with_version: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
736 |
show_version(ui) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
737 |
else: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
738 |
ui.status(_("Mercurial Distributed SCM\n")) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
739 |
ui.status('\n') |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
740 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
741 |
# list of commands |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
742 |
if name == "shortlist": |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
743 |
ui.status(_('basic commands (use "hg help" ' |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
744 |
'for the full list or option "-v" for details):\n\n')) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
745 |
elif ui.verbose: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
746 |
ui.status(_('list of commands:\n\n')) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
747 |
else: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
748 |
ui.status(_('list of commands (use "hg help -v" ' |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
749 |
'to show aliases and global options):\n\n')) |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
750 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
751 |
helplist() |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
752 |
|
849
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
753 |
# global options |
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
754 |
if ui.verbose: |
1052
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
755 |
option_lists.append(("global options", globalopts)) |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
756 |
|
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
757 |
# list all option lists |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
758 |
opt_output = [] |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
759 |
for title, options in option_lists: |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
760 |
opt_output.append(("\n%s:\n" % title, None)) |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
761 |
for shortopt, longopt, default, desc in options: |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
762 |
opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt, |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
763 |
longopt and " --%s" % longopt), |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
764 |
"%s%s" % (desc, |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
765 |
default |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
766 |
and _(" (default: %s)") % default |
1052
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
767 |
or ""))) |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
768 |
|
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
769 |
if opt_output: |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
770 |
opts_len = max([len(line[0]) for line in opt_output if line[1]]) |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
771 |
for first, second in opt_output: |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
772 |
if second: |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
773 |
ui.write(" %-*s %s\n" % (opts_len, first, second)) |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
774 |
else: |
d8279ca39dc7
Adjust display and alignment of command options to match global options.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1051
diff
changeset
|
775 |
ui.write("%s\n" % first) |
849
8933ef744325
Further help improvements:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
848
diff
changeset
|
776 |
|
255 | 777 |
# Commands start here, listed alphabetically |
209 | 778 |
|
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
779 |
def add(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
780 |
"""add the specified files on the next commit |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
781 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
782 |
Schedule files to be version controlled and added to the repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
783 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
784 |
The files will be added to the repository at the next commit. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
785 |
|
1568
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
786 |
If no names are given, add all files in the repository. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
787 |
""" |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
788 |
|
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
789 |
names = [] |
942
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
790 |
for src, abs, rel, exact in walk(repo, pats, opts): |
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
791 |
if exact: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
792 |
if ui.verbose: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
793 |
ui.status(_('adding %s\n') % rel) |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
794 |
names.append(abs) |
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
795 |
elif repo.dirstate.state(abs) == '?': |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
796 |
ui.status(_('adding %s\n') % rel) |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
797 |
names.append(abs) |
2503
37655f10ced6
Don't require opts['dry_run'] to be set to fix external tools like tailor.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2494
diff
changeset
|
798 |
if not opts.get('dry_run'): |
2411
734df6333ca4
add: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2410
diff
changeset
|
799 |
repo.add(names) |
213 | 800 |
|
766
b444a7e053f1
Get addremove to use new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
764
diff
changeset
|
801 |
def addremove(ui, repo, *pats, **opts): |
2181
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
802 |
"""add all new files, delete all missing files (DEPRECATED) |
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
803 |
|
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
804 |
(DEPRECATED) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
805 |
Add all new files and remove all missing files from the repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
806 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
807 |
New files are ignored if they match any of the patterns in .hgignore. As |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
808 |
with add, these changes take effect at the next commit. |
2181
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
809 |
|
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
810 |
This command is now deprecated and will be removed in a future |
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
811 |
release. Please use add and remove --after instead. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
812 |
""" |
2181
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
813 |
ui.warn(_('(the addremove command is deprecated; use add and remove ' |
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
814 |
'--after instead)\n')) |
1712
21dcf38e5d7d
Allow callers to pass in the dirstate lock in most localrepo.py funcs.
mason@suse.com
parents:
1710
diff
changeset
|
815 |
return addremove_lock(ui, repo, pats, opts) |
21dcf38e5d7d
Allow callers to pass in the dirstate lock in most localrepo.py funcs.
mason@suse.com
parents:
1710
diff
changeset
|
816 |
|
21dcf38e5d7d
Allow callers to pass in the dirstate lock in most localrepo.py funcs.
mason@suse.com
parents:
1710
diff
changeset
|
817 |
def addremove_lock(ui, repo, pats, opts, wlock=None): |
809
d0fb9efa2b2d
Fix performance regression in addremove command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
783
diff
changeset
|
818 |
add, remove = [], [] |
942
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
819 |
for src, abs, rel, exact in walk(repo, pats, opts): |
880
409a9a7b0da2
addremove was not correctly finding removed files when given
mason@suse.com
parents:
879
diff
changeset
|
820 |
if src == 'f' and repo.dirstate.state(abs) == '?': |
409a9a7b0da2
addremove was not correctly finding removed files when given
mason@suse.com
parents:
879
diff
changeset
|
821 |
add.append(abs) |
1255
e825dfea3823
Get all commands that operate on files to honour --verbose and --quiet.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1254
diff
changeset
|
822 |
if ui.verbose or not exact: |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
823 |
ui.status(_('adding %s\n') % ((pats and rel) or abs)) |
880
409a9a7b0da2
addremove was not correctly finding removed files when given
mason@suse.com
parents:
879
diff
changeset
|
824 |
if repo.dirstate.state(abs) != 'r' and not os.path.exists(rel): |
809
d0fb9efa2b2d
Fix performance regression in addremove command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
783
diff
changeset
|
825 |
remove.append(abs) |
1255
e825dfea3823
Get all commands that operate on files to honour --verbose and --quiet.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1254
diff
changeset
|
826 |
if ui.verbose or not exact: |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
827 |
ui.status(_('removing %s\n') % ((pats and rel) or abs)) |
2412
e5cb39577b9f
addremove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2411
diff
changeset
|
828 |
if not opts.get('dry_run'): |
e5cb39577b9f
addremove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2411
diff
changeset
|
829 |
repo.add(add, wlock=wlock) |
e5cb39577b9f
addremove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2411
diff
changeset
|
830 |
repo.remove(remove, wlock=wlock) |
219
8ff4532376a4
hg checkout: refuse to checkout if there are outstanding changes
mpm@selenic.com
parents:
214
diff
changeset
|
831 |
|
733
1966c553f652
Convert annotate over to walk interface.
Bryan O'Sullivan <bos@serpentine.com>
parents:
732
diff
changeset
|
832 |
def annotate(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
833 |
"""show changeset information per file line |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
834 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
835 |
List changes in files, showing the revision id responsible for each line |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
836 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
837 |
This command is useful to discover who did a change or when a change took |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
838 |
place. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
839 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
840 |
Without the -a option, annotate will avoid processing files it |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
841 |
detects as binary. With -a, annotate will generate an annotation |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
842 |
anyway, probably with undesirable results. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
843 |
""" |
209 | 844 |
def getnode(rev): |
1092 | 845 |
return short(repo.changelog.node(rev)) |
209 | 846 |
|
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
847 |
ucache = {} |
209 | 848 |
def getname(rev): |
2566
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
849 |
try: |
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
850 |
return ucache[rev] |
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
851 |
except: |
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
852 |
u = trimuser(ui, repo.changectx(rev).user(), rev, ucache) |
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
853 |
ucache[rev] = u |
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
854 |
return u |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
855 |
|
1522 | 856 |
dcache = {} |
857 |
def getdate(rev): |
|
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
858 |
datestr = dcache.get(rev) |
1522 | 859 |
if datestr is None: |
2566
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
860 |
datestr = dcache[rev] = util.datestr(repo.changectx(rev).date()) |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
861 |
return datestr |
1522 | 862 |
|
744 | 863 |
if not pats: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
864 |
raise util.Abort(_('at least one file name or pattern required')) |
744 | 865 |
|
1523 | 866 |
opmap = [['user', getname], ['number', str], ['changeset', getnode], |
867 |
['date', getdate]] |
|
1522 | 868 |
if not opts['user'] and not opts['changeset'] and not opts['date']: |
714
29fcd195e056
Some cleanups in commands.annotate().
Thomas Arendsen Hein <thomas@intevation.de>
parents:
712
diff
changeset
|
869 |
opts['number'] = 1 |
209 | 870 |
|
2566
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
871 |
ctx = repo.changectx(opts['rev'] or repo.dirstate.parents()[0]) |
1016 | 872 |
|
2568 | 873 |
for src, abs, rel, exact in walk(repo, pats, opts, node=ctx.node()): |
2566
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
874 |
fctx = ctx.filectx(abs) |
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
875 |
if not opts['text'] and util.binary(fctx.data()): |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
876 |
ui.write(_("%s: binary file\n") % ((pats and rel) or abs)) |
1016 | 877 |
continue |
878 |
||
2566
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
879 |
lines = fctx.annotate() |
209 | 880 |
pieces = [] |
881 |
||
882 |
for o, f in opmap: |
|
714
29fcd195e056
Some cleanups in commands.annotate().
Thomas Arendsen Hein <thomas@intevation.de>
parents:
712
diff
changeset
|
883 |
if opts[o]: |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
884 |
l = [f(n) for n, dummy in lines] |
771 | 885 |
if l: |
886 |
m = max(map(len, l)) |
|
887 |
pieces.append(["%*s" % (m, x) for x in l]) |
|
209 | 888 |
|
771 | 889 |
if pieces: |
890 |
for p, l in zip(zip(*pieces), lines): |
|
891 |
ui.write("%s: %s" % (" ".join(p), l[1])) |
|
209 | 892 |
|
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
893 |
def archive(ui, repo, dest, **opts): |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
894 |
'''create unversioned archive of a repository revision |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
895 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
896 |
By default, the revision used is the parent of the working |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
897 |
directory; use "-r" to specify a different revision. |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
898 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
899 |
To specify the type of archive to create, use "-t". Valid |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
900 |
types are: |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
901 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
902 |
"files" (default): a directory full of files |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
903 |
"tar": tar archive, uncompressed |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
904 |
"tbz2": tar archive, compressed using bzip2 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
905 |
"tgz": tar archive, compressed using gzip |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
906 |
"uzip": zip archive, uncompressed |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
907 |
"zip": zip archive, compressed using deflate |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
908 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
909 |
The exact name of the destination archive or directory is given |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
910 |
using a format string; see "hg help export" for details. |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
911 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
912 |
Each member added to an archive file has a directory prefix |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
913 |
prepended. Use "-p" to specify a format string for the prefix. |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
914 |
The default is the basename of the archive, with suffixes removed. |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
915 |
''' |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
916 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
917 |
if opts['rev']: |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
918 |
node = repo.lookup(opts['rev']) |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
919 |
else: |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
920 |
node, p2 = repo.dirstate.parents() |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
921 |
if p2 != nullid: |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
922 |
raise util.Abort(_('uncommitted merge - please provide a ' |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
923 |
'specific revision')) |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
924 |
|
2562
a020024c5870
simplify make_filename, fix hg cat bug
Matt Mackall <mpm@selenic.com>
parents:
2494
diff
changeset
|
925 |
dest = make_filename(repo, dest, node) |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
926 |
if os.path.realpath(dest) == repo.root: |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
927 |
raise util.Abort(_('repository root cannot be destination')) |
2160
858df1f354c1
Cleanup archive command: Don't overwrite gettext, quoting in cmd table entry.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2159
diff
changeset
|
928 |
dummy, matchfn, dummy = matchpats(repo, [], opts) |
2476
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
929 |
kind = opts.get('type') or 'files' |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
930 |
prefix = opts['prefix'] |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
931 |
if dest == '-': |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
932 |
if kind == 'files': |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
933 |
raise util.Abort(_('cannot archive plain files to stdout')) |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
934 |
dest = sys.stdout |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
935 |
if not prefix: prefix = os.path.basename(repo.root) + '-%h' |
2562
a020024c5870
simplify make_filename, fix hg cat bug
Matt Mackall <mpm@selenic.com>
parents:
2494
diff
changeset
|
936 |
prefix = make_filename(repo, prefix, node) |
2476
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
937 |
archival.archive(repo, dest, node, kind, not opts['no_decode'], |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
938 |
matchfn, prefix) |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
939 |
|
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
940 |
def backout(ui, repo, rev, **opts): |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
941 |
'''reverse effect of earlier changeset |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
942 |
|
2254
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
943 |
Commit the backed out changes as a new changeset. The new |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
944 |
changeset is a child of the backed out changeset. |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
945 |
|
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
946 |
If you back out a changeset other than the tip, a new head is |
2254
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
947 |
created. This head is the parent of the working directory. If |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
948 |
you back out an old changeset, your working directory will appear |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
949 |
old after the backout. You should merge the backout changeset |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
950 |
with another head. |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
951 |
|
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
952 |
The --merge option remembers the parent of the working directory |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
953 |
before starting the backout, then merges the new head with that |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
954 |
changeset afterwards. This saves you from doing the merge by |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
955 |
hand. The result of this merge is not committed, as for a normal |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
956 |
merge.''' |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
957 |
|
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
958 |
bail_if_changed(repo) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
959 |
op1, op2 = repo.dirstate.parents() |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
960 |
if op2 != nullid: |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
961 |
raise util.Abort(_('outstanding uncommitted merge')) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
962 |
node = repo.lookup(rev) |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
963 |
p1, p2 = repo.changelog.parents(node) |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
964 |
if p1 == nullid: |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
965 |
raise util.Abort(_('cannot back out a change with no parents')) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
966 |
if p2 != nullid: |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
967 |
if not opts['parent']: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
968 |
raise util.Abort(_('cannot back out a merge changeset without ' |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
969 |
'--parent')) |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
970 |
p = repo.lookup(opts['parent']) |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
971 |
if p not in (p1, p2): |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
972 |
raise util.Abort(_('%s is not a parent of %s' % |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
973 |
(short(p), short(node)))) |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
974 |
parent = p |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
975 |
else: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
976 |
if opts['parent']: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
977 |
raise util.Abort(_('cannot use --parent on non-merge changeset')) |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
978 |
parent = p1 |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
979 |
hg.clean(repo, node, show_stats=False) |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
980 |
revert_opts = opts.copy() |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
981 |
revert_opts['rev'] = hex(parent) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
982 |
revert(ui, repo, **revert_opts) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
983 |
commit_opts = opts.copy() |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
984 |
commit_opts['addremove'] = False |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
985 |
if not commit_opts['message'] and not commit_opts['logfile']: |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
986 |
commit_opts['message'] = _("Backed out changeset %s") % (hex(node)) |
2268
6c9305fbebaf
fix coding style of backout editor change.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2267
diff
changeset
|
987 |
commit_opts['force_editor'] = True |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
988 |
commit(ui, repo, **commit_opts) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
989 |
def nice(node): |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
990 |
return '%d:%s' % (repo.changelog.rev(node), short(node)) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
991 |
ui.status(_('changeset %s backs out changeset %s\n') % |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
992 |
(nice(repo.changelog.tip()), nice(node))) |
2493
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
993 |
if op1 != node: |
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
994 |
if opts['merge']: |
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
995 |
ui.status(_('merging with changeset %s\n') % nice(op1)) |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
996 |
n = _lookup(repo, hex(op1)) |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
997 |
hg.merge(repo, n) |
2493
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
998 |
else: |
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
999 |
ui.status(_('the backout changeset is a new head - ' |
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
1000 |
'do not forget to merge\n')) |
2761
0aa458261901
fix hg backup option recommendation for auto-merge
Christian Ebert <blacktrash@gmx.net>
parents:
2760
diff
changeset
|
1001 |
ui.status(_('(use "backout --merge" ' |
0aa458261901
fix hg backup option recommendation for auto-merge
Christian Ebert <blacktrash@gmx.net>
parents:
2760
diff
changeset
|
1002 |
'if you want to auto-merge)\n')) |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
1003 |
|
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
1004 |
def bundle(ui, repo, fname, dest=None, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1005 |
"""create a changegroup file |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1006 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1007 |
Generate a compressed changegroup file collecting all changesets |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1008 |
not found in the other repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1009 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1010 |
This file can then be transferred using conventional means and |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1011 |
applied to another repository with the unbundle command. This is |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1012 |
useful when native push and pull are not available or when |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1013 |
exporting an entire repository is undesirable. The standard file |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1014 |
extension is ".hg". |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1015 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1016 |
Unlike import/export, this exactly preserves all changeset |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1017 |
contents including permissions, rename data, and revision history. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1018 |
""" |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
1019 |
dest = ui.expandpath(dest or 'default-push', dest or 'default') |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
1020 |
other = hg.repository(ui, dest) |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
1021 |
o = repo.findoutgoing(other, force=opts['force']) |
1736
50de0887bbcd
add preoutgoing and outgoing hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1734
diff
changeset
|
1022 |
cg = repo.changegroup(o, 'bundle') |
1943
8198c60f7914
refactor the bundle writing code, since we will reuse it later
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1940
diff
changeset
|
1023 |
write_bundle(cg, fname) |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
1024 |
|
1254
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
1025 |
def cat(ui, repo, file1, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1026 |
"""output the latest or given revisions of files |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1027 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1028 |
Print the specified files as they were at the given revision. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1029 |
If no revision is given then the tip is used. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1030 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1031 |
Output may be to a file, in which case the name of the file is |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1032 |
given using a format string. The formatting rules are the same as |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1033 |
for the export command, with the following additions: |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1034 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1035 |
%s basename of file being printed |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1036 |
%d dirname of file being printed, or '.' if in repo root |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1037 |
%p root-relative path name of file being printed |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1038 |
""" |
2645
9bd3d44c32f6
fix 'hg cat' broken by 156fb1feab62
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2644
diff
changeset
|
1039 |
ctx = repo.changectx(opts['rev'] or "-1") |
2565
7f78ca2c7977
convert hg cat to new context api
Matt Mackall <mpm@selenic.com>
parents:
2562
diff
changeset
|
1040 |
for src, abs, rel, exact in walk(repo, (file1,) + pats, opts, ctx.node()): |
7f78ca2c7977
convert hg cat to new context api
Matt Mackall <mpm@selenic.com>
parents:
2562
diff
changeset
|
1041 |
fp = make_file(repo, opts['output'], ctx.node(), pathname=abs) |
7f78ca2c7977
convert hg cat to new context api
Matt Mackall <mpm@selenic.com>
parents:
2562
diff
changeset
|
1042 |
fp.write(ctx.filectx(abs).data()) |
248 | 1043 |
|
698
df78d8ccac4c
Use python function instead of external 'cp' command when cloning repos.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
697
diff
changeset
|
1044 |
def clone(ui, source, dest=None, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1045 |
"""make a copy of an existing repository |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1046 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1047 |
Create a copy of an existing repository in a new directory. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1048 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1049 |
If no destination directory name is specified, it defaults to the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1050 |
basename of the source. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1051 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1052 |
The location of the source is added to the new repository's |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1053 |
.hg/hgrc file, as the default to be used for future pulls. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1054 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1055 |
For efficiency, hardlinks are used for cloning whenever the source |
2762
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1056 |
and destination are on the same filesystem (note this applies only |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1057 |
to the repository data, not to the checked out files). Some |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1058 |
filesystems, such as AFS, implement hardlinking incorrectly, but |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1059 |
do not report errors. In these cases, use the --pull option to |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1060 |
avoid hardlinking. |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1061 |
|
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1062 |
You can safely clone repositories and checked out files using full |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1063 |
hardlinks with |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1064 |
|
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1065 |
$ cp -al REPO REPOCLONE |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1066 |
|
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1067 |
which is the fastest way to clone. However, the operation is not |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1068 |
atomic (making sure REPO is not modified during the operation is |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1069 |
up to you) and you have to make sure your editor breaks hardlinks |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
1070 |
(Emacs and most Linux Kernel tools do so). |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
1071 |
|
2764
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
1072 |
If you use the -r option to clone up to a specific revision, no |
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
1073 |
subsequent revisions will be present in the cloned repository. |
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
1074 |
This option implies --pull, even on local repositories. |
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
1075 |
|
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
1076 |
See pull for valid source format details. |
2590
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1077 |
|
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1078 |
It is possible to specify an ssh:// URL as the destination, but no |
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1079 |
.hg/hgrc will be created on the remote side. Look at the help text |
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1080 |
for the pull command for important details about ssh:// URLs. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1081 |
""" |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
1082 |
setremoteconfig(ui, opts) |
2597
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
1083 |
hg.clone(ui, ui.expandpath(source), dest, |
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
1084 |
pull=opts['pull'], |
2620
de82749d3a71
clone: change name of --stream to --uncompressed.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2618
diff
changeset
|
1085 |
stream=opts['uncompressed'], |
2597
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
1086 |
rev=opts['rev'], |
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
1087 |
update=not opts['noupdate']) |
515 | 1088 |
|
813
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
1089 |
def commit(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1090 |
"""commit the specified files or all outstanding changes |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1091 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1092 |
Commit changes to the given files into the repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1093 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1094 |
If a list of files is omitted, all changes reported by "hg status" |
1995
2da2d46862fb
Spelling fix: "commited" -> "committed"
mcmillen@cs.cmu.edu
parents:
1994
diff
changeset
|
1095 |
will be committed. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1096 |
|
1996
4c70b10f0418
Don't mention deprecated HGEDITOR variable in the help text of commit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1995
diff
changeset
|
1097 |
If no commit message is specified, the editor configured in your hgrc |
4c70b10f0418
Don't mention deprecated HGEDITOR variable in the help text of commit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1995
diff
changeset
|
1098 |
or in the EDITOR environment variable is started to enter a message. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1099 |
""" |
2799
bd8a9a94139f
commands.logmessage: simplify calling.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2789
diff
changeset
|
1100 |
message = logmessage(opts) |
289 | 1101 |
|
354 | 1102 |
if opts['addremove']: |
2181
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
1103 |
addremove_lock(ui, repo, pats, opts) |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
1104 |
fns, match, anypats = matchpats(repo, pats, opts) |
813
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
1105 |
if pats: |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
1106 |
modified, added, removed, deleted, unknown = ( |
1618
ff339dd21976
Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1615
diff
changeset
|
1107 |
repo.changes(files=fns, match=match)) |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
1108 |
files = modified + added + removed |
813
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
1109 |
else: |
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
1110 |
files = [] |
1202
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
1111 |
try: |
2267
d812d91c5a84
Force editor to appear for an 'hg backout' if a message or logfile aren't
john.levon@sun.com
parents:
2254
diff
changeset
|
1112 |
repo.commit(files, message, opts['user'], opts['date'], match, |
2268
6c9305fbebaf
fix coding style of backout editor change.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2267
diff
changeset
|
1113 |
force_editor=opts.get('force_editor')) |
1202
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
1114 |
except ValueError, inst: |
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
1115 |
raise util.Abort(str(inst)) |
245 | 1116 |
|
1822
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1117 |
def docopy(ui, repo, pats, opts, wlock): |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1118 |
# called with the repo lock held |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1119 |
cwd = repo.getcwd() |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1120 |
errors = 0 |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1121 |
copied = [] |
1514
faf46d810a85
avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents:
1513
diff
changeset
|
1122 |
targets = {} |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1123 |
|
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1124 |
def okaytocopy(abs, rel, exact): |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1125 |
reasons = {'?': _('is not managed'), |
1634
f49f602fae92
copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents:
1633
diff
changeset
|
1126 |
'a': _('has been marked for add'), |
f49f602fae92
copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents:
1633
diff
changeset
|
1127 |
'r': _('has been marked for remove')} |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1128 |
state = repo.dirstate.state(abs) |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1129 |
reason = reasons.get(state) |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1130 |
if reason: |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1131 |
if state == 'a': |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1132 |
origsrc = repo.dirstate.copied(abs) |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1133 |
if origsrc is not None: |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1134 |
return origsrc |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1135 |
if exact: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1136 |
ui.warn(_('%s: not copying - file %s\n') % (rel, reason)) |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1137 |
else: |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1138 |
return abs |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1139 |
|
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1140 |
def copy(origsrc, abssrc, relsrc, target, exact): |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1141 |
abstarget = util.canonpath(repo.root, cwd, target) |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1142 |
reltarget = util.pathto(cwd, abstarget) |
1514
faf46d810a85
avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents:
1513
diff
changeset
|
1143 |
prevsrc = targets.get(abstarget) |
faf46d810a85
avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents:
1513
diff
changeset
|
1144 |
if prevsrc is not None: |
faf46d810a85
avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents:
1513
diff
changeset
|
1145 |
ui.warn(_('%s: not overwriting - %s collides with %s\n') % |
faf46d810a85
avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents:
1513
diff
changeset
|
1146 |
(reltarget, abssrc, prevsrc)) |
faf46d810a85
avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents:
1513
diff
changeset
|
1147 |
return |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1148 |
if (not opts['after'] and os.path.exists(reltarget) or |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1149 |
opts['after'] and repo.dirstate.state(abstarget) not in '?r'): |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1150 |
if not opts['force']: |
1513
5c3b93b244aa
copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents:
1512
diff
changeset
|
1151 |
ui.warn(_('%s: not overwriting - file exists\n') % |
5c3b93b244aa
copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents:
1512
diff
changeset
|
1152 |
reltarget) |
5c3b93b244aa
copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents:
1512
diff
changeset
|
1153 |
return |
2503
37655f10ced6
Don't require opts['dry_run'] to be set to fix external tools like tailor.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2494
diff
changeset
|
1154 |
if not opts['after'] and not opts.get('dry_run'): |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1155 |
os.unlink(reltarget) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1156 |
if opts['after']: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1157 |
if not os.path.exists(reltarget): |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1158 |
return |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1159 |
else: |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1160 |
targetdir = os.path.dirname(reltarget) or '.' |
2503
37655f10ced6
Don't require opts['dry_run'] to be set to fix external tools like tailor.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2494
diff
changeset
|
1161 |
if not os.path.isdir(targetdir) and not opts.get('dry_run'): |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1162 |
os.makedirs(targetdir) |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1163 |
try: |
1822
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1164 |
restore = repo.dirstate.state(abstarget) == 'r' |
2503
37655f10ced6
Don't require opts['dry_run'] to be set to fix external tools like tailor.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2494
diff
changeset
|
1165 |
if restore and not opts.get('dry_run'): |
1822
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1166 |
repo.undelete([abstarget], wlock) |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1167 |
try: |
2503
37655f10ced6
Don't require opts['dry_run'] to be set to fix external tools like tailor.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2494
diff
changeset
|
1168 |
if not opts.get('dry_run'): |
2414
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
1169 |
shutil.copyfile(relsrc, reltarget) |
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
1170 |
shutil.copymode(relsrc, reltarget) |
1822
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1171 |
restore = False |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1172 |
finally: |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1173 |
if restore: |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1174 |
repo.remove([abstarget], wlock) |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
1175 |
except shutil.Error, inst: |
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
1176 |
raise util.Abort(str(inst)) |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1177 |
except IOError, inst: |
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1178 |
if inst.errno == errno.ENOENT: |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1179 |
ui.warn(_('%s: deleted in working copy\n') % relsrc) |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1180 |
else: |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1181 |
ui.warn(_('%s: cannot copy - %s\n') % |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1182 |
(relsrc, inst.strerror)) |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1183 |
errors += 1 |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1184 |
return |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1185 |
if ui.verbose or not exact: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1186 |
ui.status(_('copying %s to %s\n') % (relsrc, reltarget)) |
1514
faf46d810a85
avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents:
1513
diff
changeset
|
1187 |
targets[abstarget] = abssrc |
2503
37655f10ced6
Don't require opts['dry_run'] to be set to fix external tools like tailor.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2494
diff
changeset
|
1188 |
if abstarget != origsrc and not opts.get('dry_run'): |
1822
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
1189 |
repo.copy(origsrc, abstarget, wlock) |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1190 |
copied.append((abssrc, relsrc, exact)) |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1191 |
|
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1192 |
def targetpathfn(pat, dest, srcs): |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1193 |
if os.path.isdir(pat): |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1194 |
abspfx = util.canonpath(repo.root, cwd, pat) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1195 |
if destdirexists: |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1196 |
striplen = len(os.path.split(abspfx)[0]) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1197 |
else: |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1198 |
striplen = len(abspfx) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1199 |
if striplen: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1200 |
striplen += len(os.sep) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1201 |
res = lambda p: os.path.join(dest, p[striplen:]) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1202 |
elif destdirexists: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1203 |
res = lambda p: os.path.join(dest, os.path.basename(p)) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1204 |
else: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1205 |
res = lambda p: dest |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1206 |
return res |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1207 |
|
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1208 |
def targetpathafterfn(pat, dest, srcs): |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1209 |
if util.patkind(pat, None)[0]: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1210 |
# a mercurial pattern |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1211 |
res = lambda p: os.path.join(dest, os.path.basename(p)) |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1212 |
else: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1213 |
abspfx = util.canonpath(repo.root, cwd, pat) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1214 |
if len(abspfx) < len(srcs[0][0]): |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1215 |
# A directory. Either the target path contains the last |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1216 |
# component of the source path or it does not. |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1217 |
def evalpath(striplen): |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1218 |
score = 0 |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1219 |
for s in srcs: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1220 |
t = os.path.join(dest, s[0][striplen:]) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1221 |
if os.path.exists(t): |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1222 |
score += 1 |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1223 |
return score |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1224 |
|
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1225 |
striplen = len(abspfx) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1226 |
if striplen: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1227 |
striplen += len(os.sep) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1228 |
if os.path.isdir(os.path.join(dest, os.path.split(abspfx)[1])): |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1229 |
score = evalpath(striplen) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1230 |
striplen1 = len(os.path.split(abspfx)[0]) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1231 |
if striplen1: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1232 |
striplen1 += len(os.sep) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1233 |
if evalpath(striplen1) > score: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1234 |
striplen = striplen1 |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1235 |
res = lambda p: os.path.join(dest, p[striplen:]) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1236 |
else: |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1237 |
# a file |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1238 |
if destdirexists: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1239 |
res = lambda p: os.path.join(dest, os.path.basename(p)) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1240 |
else: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
1241 |
res = lambda p: dest |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1242 |
return res |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1243 |
|
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1244 |
|
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1245 |
pats = list(pats) |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1246 |
if not pats: |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1247 |
raise util.Abort(_('no source or destination specified')) |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1248 |
if len(pats) == 1: |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1249 |
raise util.Abort(_('no destination specified')) |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1250 |
dest = pats.pop() |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1251 |
destdirexists = os.path.isdir(dest) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1252 |
if (len(pats) > 1 or util.patkind(pats[0], None)[0]) and not destdirexists: |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1253 |
raise util.Abort(_('with multiple sources, destination must be an ' |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1254 |
'existing directory')) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1255 |
if opts['after']: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1256 |
tfn = targetpathafterfn |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1257 |
else: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1258 |
tfn = targetpathfn |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1259 |
copylist = [] |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1260 |
for pat in pats: |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1261 |
srcs = [] |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1262 |
for tag, abssrc, relsrc, exact in walk(repo, [pat], opts): |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1263 |
origsrc = okaytocopy(abssrc, relsrc, exact) |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1264 |
if origsrc: |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
1265 |
srcs.append((origsrc, abssrc, relsrc, exact)) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1266 |
if not srcs: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1267 |
continue |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1268 |
copylist.append((tfn(pat, dest, srcs), srcs)) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1269 |
if not copylist: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1270 |
raise util.Abort(_('no files to copy')) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
1271 |
|
2414
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
1272 |
for targetpath, srcs in copylist: |
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
1273 |
for origsrc, abssrc, relsrc, exact in srcs: |
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
1274 |
copy(origsrc, abssrc, relsrc, targetpath(abssrc), exact) |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1275 |
|
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1276 |
if errors: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1277 |
ui.warn(_('(consider using --after)\n')) |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
1278 |
return errors, copied |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
1279 |
|
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
1280 |
def copy(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1281 |
"""mark files as copied for the next commit |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1282 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1283 |
Mark dest as having copies of source files. If dest is a |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1284 |
directory, copies are put in that directory. If dest is a file, |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1285 |
there can only be one source. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1286 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1287 |
By default, this command copies the contents of files as they |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1288 |
stand in the working directory. If invoked with --after, the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1289 |
operation is recorded, but no copying is performed. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1290 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1291 |
This command takes effect in the next commit. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1292 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1293 |
NOTE: This command should be treated as experimental. While it |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1294 |
should properly record copied files, this information is not yet |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1295 |
fully used by merge, nor fully reported by log. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1296 |
""" |
2016
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1297 |
wlock = repo.wlock(0) |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1298 |
errs, copied = docopy(ui, repo, pats, opts, wlock) |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
1299 |
return errs |
363 | 1300 |
|
1262 | 1301 |
def debugancestor(ui, index, rev1, rev2): |
1302 |
"""find the ancestor revision of two revisions in a given index""" |
|
2072 | 1303 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "", 0) |
1262 | 1304 |
a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) |
1305 |
ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
|
1306 |
||
2034
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1307 |
def debugcomplete(ui, cmd='', **opts): |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
1308 |
"""returns the completion list associated with the given command""" |
2034
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1309 |
|
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1310 |
if opts['options']: |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1311 |
options = [] |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1312 |
otables = [globalopts] |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1313 |
if cmd: |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
1314 |
aliases, entry = findcmd(cmd) |
2034
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1315 |
otables.append(entry[1]) |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1316 |
for t in otables: |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1317 |
for o in t: |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1318 |
if o[0]: |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1319 |
options.append('-%s' % o[0]) |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1320 |
options.append('--%s' % o[1]) |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1321 |
ui.write("%s\n" % "\n".join(options)) |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1322 |
return |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1323 |
|
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
1324 |
clist = findpossible(cmd).keys() |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
1325 |
clist.sort() |
2034
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
1326 |
ui.write("%s\n" % "\n".join(clist)) |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
1327 |
|
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1328 |
def debugrebuildstate(ui, repo, rev=None): |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1329 |
"""rebuild the dirstate as it would look like for the given revision""" |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1330 |
if not rev: |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1331 |
rev = repo.changelog.tip() |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1332 |
else: |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1333 |
rev = repo.lookup(rev) |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1334 |
change = repo.changelog.read(rev) |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1335 |
n = change[0] |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1336 |
files = repo.manifest.readflags(n) |
1760
13f8e068d13c
fix typo in debugrebuildstate
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1755
diff
changeset
|
1337 |
wlock = repo.wlock() |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1338 |
repo.dirstate.rebuild(rev, files.iteritems()) |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
1339 |
|
596 | 1340 |
def debugcheckstate(ui, repo): |
1341 |
"""validate the correctness of the current dirstate""" |
|
460 | 1342 |
parent1, parent2 = repo.dirstate.parents() |
555 | 1343 |
repo.dirstate.read() |
1344 |
dc = repo.dirstate.map |
|
460 | 1345 |
keys = dc.keys() |
1346 |
keys.sort() |
|
1347 |
m1n = repo.changelog.read(parent1)[0] |
|
1348 |
m2n = repo.changelog.read(parent2)[0] |
|
1349 |
m1 = repo.manifest.read(m1n) |
|
1350 |
m2 = repo.manifest.read(m2n) |
|
1351 |
errors = 0 |
|
1352 |
for f in dc: |
|
1353 |
state = repo.dirstate.state(f) |
|
1354 |
if state in "nr" and f not in m1: |
|
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1355 |
ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
460 | 1356 |
errors += 1 |
1357 |
if state in "a" and f in m1: |
|
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1358 |
ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
460 | 1359 |
errors += 1 |
1360 |
if state in "m" and f not in m1 and f not in m2: |
|
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1361 |
ui.warn(_("%s in state %s, but not in either manifest\n") % |
582 | 1362 |
(f, state)) |
460 | 1363 |
errors += 1 |
1364 |
for f in m1: |
|
1365 |
state = repo.dirstate.state(f) |
|
1366 |
if state not in "nrm": |
|
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1367 |
ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
460 | 1368 |
errors += 1 |
1369 |
if errors: |
|
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
1370 |
error = _(".hg/dirstate inconsistent with current parent's manifest") |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
1371 |
raise util.Abort(error) |
460 | 1372 |
|
2410
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1373 |
def debugconfig(ui, repo, *values): |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1374 |
"""show combined config settings from all hgrc files |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1375 |
|
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1376 |
With no args, print names and values of all config items. |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1377 |
|
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1378 |
With one arg of the form section.name, print just the value of |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1379 |
that config item. |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1380 |
|
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1381 |
With multiple args, print names and values of all config items |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1382 |
with matching section names.""" |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1383 |
|
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1384 |
if values: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1385 |
if len([v for v in values if '.' in v]) > 1: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1386 |
raise util.Abort(_('only one config item permitted')) |
1028
25e7ea0f2cff
Add commands.debugconfig.
Bryan O'Sullivan <bos@serpentine.com>
parents:
989
diff
changeset
|
1387 |
for section, name, value in ui.walkconfig(): |
2410
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1388 |
sectname = section + '.' + name |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1389 |
if values: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1390 |
for v in values: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1391 |
if v == section: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1392 |
ui.write('%s=%s\n' % (sectname, value)) |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1393 |
elif v == sectname: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1394 |
ui.write(value, '\n') |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1395 |
else: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
1396 |
ui.write('%s=%s\n' % (sectname, value)) |
1028
25e7ea0f2cff
Add commands.debugconfig.
Bryan O'Sullivan <bos@serpentine.com>
parents:
989
diff
changeset
|
1397 |
|
1395
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1398 |
def debugsetparents(ui, repo, rev1, rev2=None): |
1470
fb9b84c91222
minor fix on command help docstrings
TK Soh <teekaysoh@yahoo.com>
parents:
1469
diff
changeset
|
1399 |
"""manually set the parents of the current working directory |
1395
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1400 |
|
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1401 |
This is useful for writing repository conversion tools, but should |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1402 |
be used with care. |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1403 |
""" |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1404 |
|
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1405 |
if not rev2: |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1406 |
rev2 = hex(nullid) |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1407 |
|
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1408 |
repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2)) |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
1409 |
|
596 | 1410 |
def debugstate(ui, repo): |
1411 |
"""show the contents of the current dirstate""" |
|
555 | 1412 |
repo.dirstate.read() |
1413 |
dc = repo.dirstate.map |
|
460 | 1414 |
keys = dc.keys() |
1415 |
keys.sort() |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
1416 |
for file_ in keys: |
791
040655ea0cc4
Show all dirstate info for 'hg debugstate'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
770
diff
changeset
|
1417 |
ui.write("%c %3o %10d %s %s\n" |
040655ea0cc4
Show all dirstate info for 'hg debugstate'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
770
diff
changeset
|
1418 |
% (dc[file_][0], dc[file_][1] & 0777, dc[file_][2], |
040655ea0cc4
Show all dirstate info for 'hg debugstate'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
770
diff
changeset
|
1419 |
time.strftime("%x %X", |
040655ea0cc4
Show all dirstate info for 'hg debugstate'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
770
diff
changeset
|
1420 |
time.localtime(dc[file_][3])), file_)) |
1116 | 1421 |
for f in repo.dirstate.copies: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1422 |
ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copies[f], f)) |
460 | 1423 |
|
1039
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
1424 |
def debugdata(ui, file_, rev): |
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
1425 |
"""dump the contents of an data file revision""" |
1835
bdfb524d728a
Validate paths before reading or writing files in repository or working dir.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1833
diff
changeset
|
1426 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), |
2072 | 1427 |
file_[:-2] + ".i", file_, 0) |
1313
1cc7c0cbc30b
Fix traceback during invalid rev identifier for debugdata
Anupam Kapoor<anupam.kapoor@gmail.com>
parents:
1312
diff
changeset
|
1428 |
try: |
1cc7c0cbc30b
Fix traceback during invalid rev identifier for debugdata
Anupam Kapoor<anupam.kapoor@gmail.com>
parents:
1312
diff
changeset
|
1429 |
ui.write(r.revision(r.lookup(rev))) |
1cc7c0cbc30b
Fix traceback during invalid rev identifier for debugdata
Anupam Kapoor<anupam.kapoor@gmail.com>
parents:
1312
diff
changeset
|
1430 |
except KeyError: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1431 |
raise util.Abort(_('invalid revision identifier %s'), rev) |
1039
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
1432 |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
1433 |
def debugindex(ui, file_): |
596 | 1434 |
"""dump the contents of an index file""" |
2072 | 1435 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) |
582 | 1436 |
ui.write(" rev offset length base linkrev" + |
989 | 1437 |
" nodeid p1 p2\n") |
248 | 1438 |
for i in range(r.count()): |
2072 | 1439 |
node = r.node(i) |
1440 |
pp = r.parents(node) |
|
989 | 1441 |
ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( |
2072 | 1442 |
i, r.start(i), r.length(i), r.base(i), r.linkrev(node), |
1443 |
short(node), short(pp[0]), short(pp[1]))) |
|
248 | 1444 |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
1445 |
def debugindexdot(ui, file_): |
596 | 1446 |
"""dump an index DAG as a .dot file""" |
2072 | 1447 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) |
582 | 1448 |
ui.write("digraph G {\n") |
248 | 1449 |
for i in range(r.count()): |
2287
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
1450 |
node = r.node(i) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
1451 |
pp = r.parents(node) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
1452 |
ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
1453 |
if pp[1] != nullid: |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
1454 |
ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
582 | 1455 |
ui.write("}\n") |
248 | 1456 |
|
1116 | 1457 |
def debugrename(ui, repo, file, rev=None): |
1194
c165cbf56bb1
Add doc string for debugrename.
bos@serpentine.internal.keyresearch.com
parents:
1193
diff
changeset
|
1458 |
"""dump rename information""" |
1116 | 1459 |
r = repo.file(relpath(repo, [file])[0]) |
1460 |
if rev: |
|
1461 |
try: |
|
1462 |
# assume all revision numbers are for changesets |
|
1463 |
n = repo.lookup(rev) |
|
1464 |
change = repo.changelog.read(n) |
|
1465 |
m = repo.manifest.read(change[0]) |
|
1466 |
n = m[relpath(repo, [file])[0]] |
|
1541
bf4e7ef08741
fixed some stuff pychecker shows, marked unclear/wrong stuff with XXX
twaldmann@thinkmo.de
parents:
1526
diff
changeset
|
1467 |
except (hg.RepoError, KeyError): |
1116 | 1468 |
n = r.lookup(rev) |
1469 |
else: |
|
1470 |
n = r.tip() |
|
1471 |
m = r.renamed(n) |
|
1472 |
if m: |
|
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1473 |
ui.write(_("renamed from %s:%s\n") % (m[0], hex(m[1]))) |
1116 | 1474 |
else: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1475 |
ui.write(_("not renamed\n")) |
1116 | 1476 |
|
820
89985a1b3427
Clean up walk and changes code to use normalised names properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
815
diff
changeset
|
1477 |
def debugwalk(ui, repo, *pats, **opts): |
1053
1539ca091d86
Added missing doc strings for two new debug commmands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1052
diff
changeset
|
1478 |
"""show how files match on given patterns""" |
820
89985a1b3427
Clean up walk and changes code to use normalised names properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
815
diff
changeset
|
1479 |
items = list(walk(repo, pats, opts)) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1480 |
if not items: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1481 |
return |
1309
332f225b835c
Make debugwalk strip trailing spaces and remove these from test-walk.out
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1285
diff
changeset
|
1482 |
fmt = '%%s %%-%ds %%-%ds %%s' % ( |
942
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
1483 |
max([len(abs) for (src, abs, rel, exact) in items]), |
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
1484 |
max([len(rel) for (src, abs, rel, exact) in items])) |
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
1485 |
for src, abs, rel, exact in items: |
1309
332f225b835c
Make debugwalk strip trailing spaces and remove these from test-walk.out
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1285
diff
changeset
|
1486 |
line = fmt % (src, abs, rel, exact and 'exact' or '') |
332f225b835c
Make debugwalk strip trailing spaces and remove these from test-walk.out
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1285
diff
changeset
|
1487 |
ui.write("%s\n" % line.rstrip()) |
820
89985a1b3427
Clean up walk and changes code to use normalised names properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
815
diff
changeset
|
1488 |
|
732
ba0b6d17a6de
Convert diff command over to using walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
731
diff
changeset
|
1489 |
def diff(ui, repo, *pats, **opts): |
1568
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
1490 |
"""diff repository (or selected files) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1491 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1492 |
Show differences between revisions for the specified files. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1493 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1494 |
Differences between files are shown using the unified diff format. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1495 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1496 |
When two revision arguments are given, then changes are shown |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1497 |
between those revisions. If only one revision is specified then |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1498 |
that revision is compared to the working directory, and, when no |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1499 |
revisions are specified, the working directory files are compared |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1500 |
to its parent. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1501 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1502 |
Without the -a option, diff will avoid generating diffs of files |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1503 |
it detects as binary. With -a, diff will generate a diff anyway, |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1504 |
probably with undesirable results. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1505 |
""" |
2331
953dbfb2824c
diff: allow to use -rA:B syntax as well as -rA -rB
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2330
diff
changeset
|
1506 |
node1, node2 = revpair(ui, repo, opts['rev']) |
245 | 1507 |
|
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
1508 |
fns, matchfn, anypats = matchpats(repo, pats, opts) |
1014 | 1509 |
|
1267
b0633406c07a
Fix diff command so it doesn't walk the dirstate unnecessarily.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1262
diff
changeset
|
1510 |
dodiff(sys.stdout, ui, repo, node1, node2, fns, match=matchfn, |
1728
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
1511 |
text=opts['text'], opts=opts) |
245 | 1512 |
|
580 | 1513 |
def doexport(ui, repo, changeset, seqno, total, revwidth, opts): |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
1514 |
node = repo.lookup(changeset) |
1571
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
1515 |
parents = [p for p in repo.changelog.parents(node) if p != nullid] |
1589
fce5292866c6
fix a bug in hg export --switch-parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1586
diff
changeset
|
1516 |
if opts['switch_parent']: |
fce5292866c6
fix a bug in hg export --switch-parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1586
diff
changeset
|
1517 |
parents.reverse() |
1571
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
1518 |
prev = (parents and parents[0]) or nullid |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
1519 |
change = repo.changelog.read(node) |
580 | 1520 |
|
2562
a020024c5870
simplify make_filename, fix hg cat bug
Matt Mackall <mpm@selenic.com>
parents:
2494
diff
changeset
|
1521 |
fp = make_file(repo, opts['output'], node, total=total, seqno=seqno, |
729
626aa658e2a9
Turn make_filename into make_file, which returns a file handle.
Bryan O'Sullivan <bos@serpentine.com>
parents:
727
diff
changeset
|
1522 |
revwidth=revwidth) |
626aa658e2a9
Turn make_filename into make_file, which returns a file handle.
Bryan O'Sullivan <bos@serpentine.com>
parents:
727
diff
changeset
|
1523 |
if fp != sys.stdout: |
755
87e2b094ab86
Show filenames for hg export in verbose mode on a separate lines.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
750
diff
changeset
|
1524 |
ui.note("%s\n" % fp.name) |
580 | 1525 |
|
582 | 1526 |
fp.write("# HG changeset patch\n") |
1527 |
fp.write("# User %s\n" % change[1]) |
|
2300
52b9b6751b2c
Use "# Date" instead of "# Timestamp" for dated export/import of patches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2299
diff
changeset
|
1528 |
fp.write("# Date %d %d\n" % change[2]) |
1092 | 1529 |
fp.write("# Node ID %s\n" % hex(node)) |
1530 |
fp.write("# Parent %s\n" % hex(prev)) |
|
1571
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
1531 |
if len(parents) > 1: |
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
1532 |
fp.write("# Parent %s\n" % hex(parents[1])) |
582 | 1533 |
fp.write(change[4].rstrip()) |
1534 |
fp.write("\n\n") |
|
580 | 1535 |
|
1015
22571b8d35d3
Add automatic binary file detection to diff and export
mpm@selenic.com
parents:
1014
diff
changeset
|
1536 |
dodiff(fp, ui, repo, prev, node, text=opts['text']) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1537 |
if fp != sys.stdout: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1538 |
fp.close() |
396
8f8bb77d560e
Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
395
diff
changeset
|
1539 |
|
580 | 1540 |
def export(ui, repo, *changesets, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1541 |
"""dump the header and diffs for one or more changesets |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1542 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1543 |
Print the changeset header and diffs for one or more revisions. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1544 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1545 |
The information shown in the changeset header is: author, |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1546 |
changeset hash, parent and commit comment. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1547 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1548 |
Output may be to a file, in which case the name of the file is |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1549 |
given using a format string. The formatting rules are as follows: |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1550 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1551 |
%% literal "%" character |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1552 |
%H changeset hash (40 bytes of hexadecimal) |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1553 |
%N number of patches being generated |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1554 |
%R changeset revision number |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1555 |
%b basename of the exporting repository |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1556 |
%h short-form changeset hash (12 bytes of hexadecimal) |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1557 |
%n zero-padded sequence number, starting at 1 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1558 |
%r zero-padded changeset revision number |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1559 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1560 |
Without the -a option, export will avoid generating diffs of files |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1561 |
it detects as binary. With -a, export will generate a diff anyway, |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1562 |
probably with undesirable results. |
1571
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
1563 |
|
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
1564 |
With the --switch-parent option, the diff will be against the second |
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
1565 |
parent. It can be useful to review a merge. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1566 |
""" |
610
4c02464cb9f0
check export options for changeset before running
shaleh@speakeasy.net
parents:
609
diff
changeset
|
1567 |
if not changesets: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1568 |
raise util.Abort(_("export requires at least one changeset")) |
580 | 1569 |
seqno = 0 |
1570 |
revs = list(revrange(ui, repo, changesets)) |
|
1571 |
total = len(revs) |
|
1067
fae1204603dc
Fixed zero-padded filenames with %r if there is a longer number in the middle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1066
diff
changeset
|
1572 |
revwidth = max(map(len, revs)) |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
1573 |
msg = len(revs) > 1 and _("Exporting patches:\n") or _("Exporting patch:\n") |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
1574 |
ui.note(msg) |
580 | 1575 |
for cset in revs: |
1576 |
seqno += 1 |
|
1577 |
doexport(ui, repo, cset, seqno, total, revwidth, opts) |
|
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
1578 |
|
810
790a0ff306f2
Move commands.forget over to using new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
809
diff
changeset
|
1579 |
def forget(ui, repo, *pats, **opts): |
2135
11ad47f22023
mark forget command as deprecated.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2134
diff
changeset
|
1580 |
"""don't add the specified files on the next commit (DEPRECATED) |
11ad47f22023
mark forget command as deprecated.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2134
diff
changeset
|
1581 |
|
11ad47f22023
mark forget command as deprecated.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2134
diff
changeset
|
1582 |
(DEPRECATED) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1583 |
Undo an 'hg add' scheduled for the next commit. |
2135
11ad47f22023
mark forget command as deprecated.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2134
diff
changeset
|
1584 |
|
11ad47f22023
mark forget command as deprecated.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2134
diff
changeset
|
1585 |
This command is now deprecated and will be removed in a future |
11ad47f22023
mark forget command as deprecated.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2134
diff
changeset
|
1586 |
release. Please use revert instead. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1587 |
""" |
2135
11ad47f22023
mark forget command as deprecated.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2134
diff
changeset
|
1588 |
ui.warn(_("(the forget command is deprecated; use revert instead)\n")) |
810
790a0ff306f2
Move commands.forget over to using new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
809
diff
changeset
|
1589 |
forget = [] |
942
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
1590 |
for src, abs, rel, exact in walk(repo, pats, opts): |
810
790a0ff306f2
Move commands.forget over to using new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
809
diff
changeset
|
1591 |
if repo.dirstate.state(abs) == 'a': |
790a0ff306f2
Move commands.forget over to using new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
809
diff
changeset
|
1592 |
forget.append(abs) |
1255
e825dfea3823
Get all commands that operate on files to honour --verbose and --quiet.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1254
diff
changeset
|
1593 |
if ui.verbose or not exact: |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
1594 |
ui.status(_('forgetting %s\n') % ((pats and rel) or abs)) |
810
790a0ff306f2
Move commands.forget over to using new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
809
diff
changeset
|
1595 |
repo.forget(forget) |
245 | 1596 |
|
1108
7a75d8fbbdaf
Remove some options from 'hg grep':
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1106
diff
changeset
|
1597 |
def grep(ui, repo, pattern, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1598 |
"""search for a pattern in specified files and revisions |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1599 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1600 |
Search revisions of files for a regular expression. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1601 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1602 |
This command behaves differently than Unix grep. It only accepts |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1603 |
Python/Perl regexps. It searches repository history, not the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1604 |
working directory. It always prints the revision number in which |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1605 |
a match appears. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1606 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1607 |
By default, grep only prints output for the first revision of a |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1608 |
file in which it finds a match. To get it to print every revision |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1609 |
that contains a change in match status ("-" for a match that |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1610 |
becomes a non-match, or "+" for a non-match that becomes a match), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1611 |
use the --all flag. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1612 |
""" |
1057 | 1613 |
reflags = 0 |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1614 |
if opts['ignore_case']: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1615 |
reflags |= re.I |
1057 | 1616 |
regexp = re.compile(pattern, reflags) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1617 |
sep, eol = ':', '\n' |
1108
7a75d8fbbdaf
Remove some options from 'hg grep':
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1106
diff
changeset
|
1618 |
if opts['print0']: |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1619 |
sep = eol = '\0' |
1057 | 1620 |
|
1621 |
fcache = {} |
|
1622 |
def getfile(fn): |
|
1623 |
if fn not in fcache: |
|
1624 |
fcache[fn] = repo.file(fn) |
|
1625 |
return fcache[fn] |
|
1626 |
||
1627 |
def matchlines(body): |
|
1059
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1628 |
begin = 0 |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1629 |
linenum = 0 |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1630 |
while True: |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1631 |
match = regexp.search(body, begin) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1632 |
if not match: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1633 |
break |
1059
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1634 |
mstart, mend = match.span() |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1635 |
linenum += body.count('\n', begin, mstart) + 1 |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1636 |
lstart = body.rfind('\n', begin, mstart) + 1 or begin |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1637 |
lend = body.find('\n', mend) |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1638 |
yield linenum, mstart - lstart, mend - lstart, body[lstart:lend] |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1639 |
begin = lend + 1 |
1057 | 1640 |
|
1559
59b3639df0a9
Convert all classes to new-style classes by deriving them from object.
Eric Hopper <hopper@omnifarious.org>
parents:
1552
diff
changeset
|
1641 |
class linestate(object): |
1057 | 1642 |
def __init__(self, line, linenum, colstart, colend): |
1643 |
self.line = line |
|
1644 |
self.linenum = linenum |
|
1645 |
self.colstart = colstart |
|
1646 |
self.colend = colend |
|
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1647 |
def __eq__(self, other): |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1648 |
return self.line == other.line |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1649 |
def __hash__(self): |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1650 |
return hash(self.line) |
1057 | 1651 |
|
1652 |
matches = {} |
|
1653 |
def grepbody(fn, rev, body): |
|
1654 |
matches[rev].setdefault(fn, {}) |
|
1655 |
m = matches[rev][fn] |
|
1656 |
for lnum, cstart, cend, line in matchlines(body): |
|
1657 |
s = linestate(line, lnum, cstart, cend) |
|
1658 |
m[s] = s |
|
1659 |
||
1749
d457fec76ab0
fix warnings from pychecker (unused variables and shadowing)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1747
diff
changeset
|
1660 |
# FIXME: prev isn't used, why ? |
1057 | 1661 |
prev = {} |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1662 |
ucache = {} |
1057 | 1663 |
def display(fn, rev, states, prevstates): |
1061 | 1664 |
diff = list(sets.Set(states).symmetric_difference(sets.Set(prevstates))) |
1057 | 1665 |
diff.sort(lambda x, y: cmp(x.linenum, y.linenum)) |
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
1666 |
counts = {'-': 0, '+': 0} |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1667 |
filerevmatches = {} |
1057 | 1668 |
for l in diff: |
1212 | 1669 |
if incrementing or not opts['all']: |
1057 | 1670 |
change = ((l in prevstates) and '-') or '+' |
1671 |
r = rev |
|
1672 |
else: |
|
1673 |
change = ((l in states) and '-') or '+' |
|
1674 |
r = prev[fn] |
|
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1675 |
cols = [fn, str(rev)] |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1676 |
if opts['line_number']: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1677 |
cols.append(str(l.linenum)) |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1678 |
if opts['all']: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1679 |
cols.append(change) |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1680 |
if opts['user']: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1681 |
cols.append(trimuser(ui, getchange(rev)[1], rev, |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1682 |
ucache)) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1683 |
if opts['files_with_matches']: |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1684 |
c = (fn, rev) |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1685 |
if c in filerevmatches: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1686 |
continue |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1687 |
filerevmatches[c] = 1 |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1688 |
else: |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1689 |
cols.append(l.line) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1690 |
ui.write(sep.join(cols), eol) |
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
1691 |
counts[change] += 1 |
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
1692 |
return counts['+'], counts['-'] |
1057 | 1693 |
|
1694 |
fstate = {} |
|
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
1695 |
skip = {} |
1570
6a104941d56a
hg log -p should show file deletions
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1568
diff
changeset
|
1696 |
changeiter, getchange, matchfn = walkchangerevs(ui, repo, pats, opts) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1697 |
count = 0 |
1337
d4b25df77a9e
Fix up some bugs for log and grep with empty repo
mpm@selenic.com
parents:
1331
diff
changeset
|
1698 |
incrementing = False |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1699 |
for st, rev, fns in changeiter: |
1057 | 1700 |
if st == 'window': |
1701 |
incrementing = rev |
|
1702 |
matches.clear() |
|
1703 |
elif st == 'add': |
|
1704 |
change = repo.changelog.read(repo.lookup(str(rev))) |
|
1705 |
mf = repo.manifest.read(change[0]) |
|
1706 |
matches[rev] = {} |
|
1707 |
for fn in fns: |
|
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1708 |
if fn in skip: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1709 |
continue |
1057 | 1710 |
fstate.setdefault(fn, {}) |
1711 |
try: |
|
1712 |
grepbody(fn, rev, getfile(fn).read(mf[fn])) |
|
1713 |
except KeyError: |
|
1714 |
pass |
|
1715 |
elif st == 'iter': |
|
1716 |
states = matches[rev].items() |
|
1717 |
states.sort() |
|
1718 |
for fn, m in states: |
|
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1719 |
if fn in skip: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1720 |
continue |
1212 | 1721 |
if incrementing or not opts['all'] or fstate[fn]: |
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
1722 |
pos, neg = display(fn, rev, m, fstate[fn]) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1723 |
count += pos + neg |
1212 | 1724 |
if pos and not opts['all']: |
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
1725 |
skip[fn] = True |
1057 | 1726 |
fstate[fn] = m |
1727 |
prev[fn] = rev |
|
1728 |
||
1729 |
if not incrementing: |
|
1730 |
fstate = fstate.items() |
|
1731 |
fstate.sort() |
|
1732 |
for fn, state in fstate: |
|
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1733 |
if fn in skip: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1734 |
continue |
1057 | 1735 |
display(fn, rev, {}, state) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1736 |
return (count == 0 and 1) or 0 |
1057 | 1737 |
|
898 | 1738 |
def heads(ui, repo, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1739 |
"""show current repository heads |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1740 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1741 |
Show all repository head changesets. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1742 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1743 |
Repository "heads" are changesets that don't have children |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1744 |
changesets. They are where development generally takes place and |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1745 |
are the usual targets for update and merge operations. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1746 |
""" |
1550
ccb9b62de892
add a -r/--rev option to heads to show only heads descendant from rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1547
diff
changeset
|
1747 |
if opts['rev']: |
1551
e793cbc8be00
Fixes to "hg heads -r FOO":
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1550
diff
changeset
|
1748 |
heads = repo.heads(repo.lookup(opts['rev'])) |
1550
ccb9b62de892
add a -r/--rev option to heads to show only heads descendant from rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1547
diff
changeset
|
1749 |
else: |
ccb9b62de892
add a -r/--rev option to heads to show only heads descendant from rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1547
diff
changeset
|
1750 |
heads = repo.heads() |
898 | 1751 |
br = None |
1752 |
if opts['branches']: |
|
1551
e793cbc8be00
Fixes to "hg heads -r FOO":
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1550
diff
changeset
|
1753 |
br = repo.branchlookup(heads) |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
1754 |
displayer = show_changeset(ui, repo, opts) |
1550
ccb9b62de892
add a -r/--rev option to heads to show only heads descendant from rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1547
diff
changeset
|
1755 |
for n in heads: |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
1756 |
displayer.show(changenode=n, brinfo=br) |
221 | 1757 |
|
339
a76fc9c4b67b
added hg identify|id (based on a patch from Andrew Thompson)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
338
diff
changeset
|
1758 |
def identify(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1759 |
"""print information about the working copy |
1470
fb9b84c91222
minor fix on command help docstrings
TK Soh <teekaysoh@yahoo.com>
parents:
1469
diff
changeset
|
1760 |
|
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1761 |
Print a short summary of the current state of the repo. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1762 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1763 |
This summary identifies the repository state using one or two parent |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1764 |
hash identifiers, followed by a "+" if there are uncommitted changes |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1765 |
in the working directory, followed by a list of tags for this revision. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1766 |
""" |
1092 | 1767 |
parents = [p for p in repo.dirstate.parents() if p != nullid] |
340
97a897d32dfc
Handle the case where the current working copy is not based on a checkout.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
339
diff
changeset
|
1768 |
if not parents: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
1769 |
ui.write(_("unknown\n")) |
340
97a897d32dfc
Handle the case where the current working copy is not based on a checkout.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
339
diff
changeset
|
1770 |
return |
97a897d32dfc
Handle the case where the current working copy is not based on a checkout.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
339
diff
changeset
|
1771 |
|
1092 | 1772 |
hexfunc = ui.verbose and hex or short |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
1773 |
modified, added, removed, deleted, unknown = repo.changes() |
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
1774 |
output = ["%s%s" % |
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
1775 |
('+'.join([hexfunc(parent) for parent in parents]), |
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
1776 |
(modified or added or removed or deleted) and "+" or "")] |
386
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1777 |
|
339
a76fc9c4b67b
added hg identify|id (based on a patch from Andrew Thompson)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
338
diff
changeset
|
1778 |
if not ui.quiet: |
386
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1779 |
# multiple tags for a single parent separated by '/' |
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1780 |
parenttags = ['/'.join(tags) |
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1781 |
for tags in map(repo.nodetags, parents) if tags] |
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1782 |
# tags for multiple parents separated by ' + ' |
758
c5db9581bfa6
There was an extra space after 'hg id' when there are no tags.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
757
diff
changeset
|
1783 |
if parenttags: |
c5db9581bfa6
There was an extra space after 'hg id' when there are no tags.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
757
diff
changeset
|
1784 |
output.append(' + '.join(parenttags)) |
339
a76fc9c4b67b
added hg identify|id (based on a patch from Andrew Thompson)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
338
diff
changeset
|
1785 |
|
386
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1786 |
ui.write("%s\n" % ' '.join(output)) |
339
a76fc9c4b67b
added hg identify|id (based on a patch from Andrew Thompson)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
338
diff
changeset
|
1787 |
|
437 | 1788 |
def import_(ui, repo, patch1, *patches, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1789 |
"""import an ordered set of patches |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1790 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1791 |
Import a list of patches and commit them individually. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1792 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1793 |
If there are outstanding changes in the working directory, import |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1794 |
will abort unless given the -f flag. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1795 |
|
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1796 |
You can import a patch straight from a mail message. Even patches |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1797 |
as attachments work (body part must be type text/plain or |
2515
a6700c222314
import: make help clearer. suggested by asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2513
diff
changeset
|
1798 |
text/x-patch to be used). From and Subject headers of email |
a6700c222314
import: make help clearer. suggested by asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2513
diff
changeset
|
1799 |
message are used as default committer and commit message. All |
a6700c222314
import: make help clearer. suggested by asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2513
diff
changeset
|
1800 |
text/plain body parts before first diff are added to commit |
a6700c222314
import: make help clearer. suggested by asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2513
diff
changeset
|
1801 |
message. |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1802 |
|
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1803 |
If imported patch was generated by hg export, user and description |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1804 |
from patch override values from message headers and body. Values |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1805 |
given on command line with -m and -u override these. |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1806 |
|
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1807 |
To read a patch from standard input, use patch name "-". |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1808 |
""" |
437 | 1809 |
patches = (patch1,) + patches |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
1810 |
|
966
022bcc738389
hg import: abort with uncommitted changes, override with --force
mpm@selenic.com
parents:
965
diff
changeset
|
1811 |
if not opts['force']: |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
1812 |
bail_if_changed(repo) |
966
022bcc738389
hg import: abort with uncommitted changes, override with --force
mpm@selenic.com
parents:
965
diff
changeset
|
1813 |
|
437 | 1814 |
d = opts["base"] |
1815 |
strip = opts["strip"] |
|
1816 |
||
1193
04d1ca8ae9ec
Fortify the recognition of a diff header.
bos@serpentine.internal.keyresearch.com
parents:
1192
diff
changeset
|
1817 |
mailre = re.compile(r'(?:From |[\w-]+:)') |
1390
ce95599eedac
Borrow patch header detection heuristic from quilt
Matt Mackall <mpm@selenic.com>
parents:
1381
diff
changeset
|
1818 |
|
ce95599eedac
Borrow patch header detection heuristic from quilt
Matt Mackall <mpm@selenic.com>
parents:
1381
diff
changeset
|
1819 |
# attempt to detect the start of a patch |
ce95599eedac
Borrow patch header detection heuristic from quilt
Matt Mackall <mpm@selenic.com>
parents:
1381
diff
changeset
|
1820 |
# (this heuristic is borrowed from quilt) |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1821 |
diffre = re.compile(r'^(?:Index:[ \t]|diff[ \t]|RCS file: |' + |
1390
ce95599eedac
Borrow patch header detection heuristic from quilt
Matt Mackall <mpm@selenic.com>
parents:
1381
diff
changeset
|
1822 |
'retrieving revision [0-9]+(\.[0-9]+)*$|' + |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1823 |
'(---|\*\*\*)[ \t])', re.MULTILINE) |
1190
737f9b90c571
Make import command reject patches that resemble email messages.
bos@serpentine.internal.keyresearch.com
parents:
1189
diff
changeset
|
1824 |
|
437 | 1825 |
for patch in patches: |
1826 |
pf = os.path.join(d, patch) |
|
1827 |
||
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1828 |
message = None |
701
80ed193efff7
On importing the result of 'hg export', parse while reading and drop headers.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
700
diff
changeset
|
1829 |
user = None |
2299
dacf718e1d48
Add timestamp field to export format. Make import and mq use it.
Danek Duvall <danek.duvall@sun.com>
parents:
2293
diff
changeset
|
1830 |
date = None |
701
80ed193efff7
On importing the result of 'hg export', parse while reading and drop headers.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
700
diff
changeset
|
1831 |
hgpatch = False |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1832 |
|
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1833 |
p = email.Parser.Parser() |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1834 |
if pf == '-': |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1835 |
msg = p.parse(sys.stdin) |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1836 |
ui.status(_("applying patch from stdin\n")) |
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1837 |
else: |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1838 |
msg = p.parse(file(pf)) |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1839 |
ui.status(_("applying %s\n") % patch) |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1840 |
|
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1841 |
fd, tmpname = tempfile.mkstemp(prefix='hg-patch-') |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1842 |
tmpfp = os.fdopen(fd, 'w') |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1843 |
try: |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1844 |
message = msg['Subject'] |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1845 |
if message: |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1846 |
message = message.replace('\n\t', ' ') |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1847 |
ui.debug('Subject: %s\n' % message) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1848 |
user = msg['From'] |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1849 |
if user: |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1850 |
ui.debug('From: %s\n' % user) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1851 |
diffs_seen = 0 |
2743
a31f0f2997e9
import: switch from application/x-patch to text/x-diff
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2741
diff
changeset
|
1852 |
ok_types = ('text/plain', 'text/x-diff', 'text/x-patch') |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1853 |
for part in msg.walk(): |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1854 |
content_type = part.get_content_type() |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1855 |
ui.debug('Content-Type: %s\n' % content_type) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1856 |
if content_type not in ok_types: |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1857 |
continue |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1858 |
payload = part.get_payload(decode=True) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1859 |
m = diffre.search(payload) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1860 |
if m: |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1861 |
ui.debug(_('found patch at byte %d\n') % m.start(0)) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1862 |
diffs_seen += 1 |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1863 |
hgpatch = False |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1864 |
fp = cStringIO.StringIO() |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2510
diff
changeset
|
1865 |
if message: |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2510
diff
changeset
|
1866 |
fp.write(message) |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2510
diff
changeset
|
1867 |
fp.write('\n') |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1868 |
for line in payload[:m.start(0)].splitlines(): |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1869 |
if line.startswith('# HG changeset patch'): |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1870 |
ui.debug(_('patch generated by hg export\n')) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1871 |
hgpatch = True |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2510
diff
changeset
|
1872 |
# drop earlier commit message content |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2510
diff
changeset
|
1873 |
fp.seek(0) |
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2510
diff
changeset
|
1874 |
fp.truncate() |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1875 |
elif hgpatch: |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1876 |
if line.startswith('# User '): |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1877 |
user = line[7:] |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1878 |
ui.debug('From: %s\n' % user) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1879 |
elif line.startswith("# Date "): |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1880 |
date = line[7:] |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1881 |
if not line.startswith('# '): |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1882 |
fp.write(line) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1883 |
fp.write('\n') |
2513
f22e3e8fd457
import: added tests, fixed bugs found by tests and asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2510
diff
changeset
|
1884 |
message = fp.getvalue() |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1885 |
if tmpfp: |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1886 |
tmpfp.write(payload) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1887 |
if not payload.endswith('\n'): |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1888 |
tmpfp.write('\n') |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1889 |
elif not diffs_seen and message and content_type == 'text/plain': |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1890 |
message += '\n' + payload |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1891 |
|
2458
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1892 |
if opts['message']: |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1893 |
# pickup the cmdline msg |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1894 |
message = opts['message'] |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1895 |
elif message: |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1896 |
# pickup the patch msg |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1897 |
message = message.strip() |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1898 |
else: |
2458
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1899 |
# launch the editor |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1900 |
message = None |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1901 |
ui.debug(_('message:\n%s\n') % message) |
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1902 |
|
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1903 |
tmpfp.close() |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1904 |
if not diffs_seen: |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1905 |
raise util.Abort(_('no diffs found')) |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1906 |
|
2760
e6bef16b6cec
import: make patch apply if run in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2755
diff
changeset
|
1907 |
files = util.patch(strip, tmpname, ui, cwd=repo.root) |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1908 |
if len(files) > 0: |
2760
e6bef16b6cec
import: make patch apply if run in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2755
diff
changeset
|
1909 |
cfiles = files |
e6bef16b6cec
import: make patch apply if run in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2755
diff
changeset
|
1910 |
cwd = repo.getcwd() |
e6bef16b6cec
import: make patch apply if run in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2755
diff
changeset
|
1911 |
if cwd: |
e6bef16b6cec
import: make patch apply if run in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2755
diff
changeset
|
1912 |
cfiles = [util.pathto(cwd, f) for f in files] |
e6bef16b6cec
import: make patch apply if run in subdir
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2755
diff
changeset
|
1913 |
addremove_lock(ui, repo, cfiles, {}) |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1914 |
repo.commit(files, message, user, date) |
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1915 |
finally: |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1916 |
os.unlink(tmpname) |
437 | 1917 |
|
1192
6e165de907c5
Add -p to incoming and outgoing commands to show patch
TK Soh <teekaysoh@yahoo.com>
parents:
1191
diff
changeset
|
1918 |
def incoming(ui, repo, source="default", **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1919 |
"""show new changesets found in source |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1920 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1921 |
Show new changesets found in the specified path/URL or the default |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1922 |
pull location. These are the changesets that would be pulled if a pull |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1923 |
was requested. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1924 |
|
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1925 |
For remote repository, using --bundle avoids downloading the changesets |
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1926 |
twice if the incoming is followed by a pull. |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1927 |
|
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1928 |
See pull for valid source format details. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1929 |
""" |
1893
6569651a4f1e
Read paths specified in .hg/hgrc relative to repo root, otherwise to home dir.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1892
diff
changeset
|
1930 |
source = ui.expandpath(source) |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
1931 |
setremoteconfig(ui, opts) |
1965
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
1932 |
|
927
5a830d7bea52
Add hg incoming command for local repositories
mpm@selenic.com
parents:
924
diff
changeset
|
1933 |
other = hg.repository(ui, source) |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
1934 |
incoming = repo.findincoming(other, force=opts["force"]) |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1935 |
if not incoming: |
1993
fb6ca9801d04
show message if no changes found on incoming
TK Soh <teekaysoh@yahoo.com>
parents:
1981
diff
changeset
|
1936 |
ui.status(_("no changes found\n")) |
931 | 1937 |
return |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1938 |
|
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1939 |
cleanup = None |
1974
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1940 |
try: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1941 |
fname = opts["bundle"] |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1942 |
if fname or not other.local(): |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1943 |
# create a bundle (uncompressed if other repo is not local) |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1944 |
cg = other.changegroup(incoming, "incoming") |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1945 |
fname = cleanup = write_bundle(cg, fname, compress=other.local()) |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1946 |
# keep written bundle? |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1947 |
if opts["bundle"]: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1948 |
cleanup = None |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1949 |
if not other.local(): |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1950 |
# use the created uncompressed bundlerepo |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1951 |
other = bundlerepo.bundlerepository(ui, repo.root, fname) |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1952 |
|
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1953 |
revs = None |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1954 |
if opts['rev']: |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1955 |
revs = [other.lookup(rev) for rev in opts['rev']] |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1956 |
o = other.changelog.nodesbetween(incoming, revs)[0] |
1974
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1957 |
if opts['newest_first']: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1958 |
o.reverse() |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1959 |
displayer = show_changeset(ui, other, opts) |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1960 |
for n in o: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1961 |
parents = [p for p in other.changelog.parents(n) if p != nullid] |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1962 |
if opts['no_merges'] and len(parents) == 2: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1963 |
continue |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1964 |
displayer.show(changenode=n) |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1965 |
if opts['patch']: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1966 |
prev = (parents and parents[0]) or nullid |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1967 |
dodiff(ui, ui, other, prev, n) |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1968 |
ui.write("\n") |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1969 |
finally: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1970 |
if hasattr(other, 'close'): |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1971 |
other.close() |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1972 |
if cleanup: |
0d54675cd566
Delete bundle file of hg incoming in case of errors, preserve existing files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1973
diff
changeset
|
1973 |
os.unlink(cleanup) |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1974 |
|
2598
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
1975 |
def init(ui, dest=".", **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1976 |
"""create a new repository in the given directory |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1977 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1978 |
Initialize a new repository in the given directory. If the given |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1979 |
directory does not exist, it is created. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1980 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1981 |
If no directory is given, the current directory is used. |
2590
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1982 |
|
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1983 |
It is possible to specify an ssh:// URL as the destination. |
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1984 |
Look at the help text for the pull command for important details |
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1985 |
about ssh:// URLs. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1986 |
""" |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
1987 |
setremoteconfig(ui, opts) |
907
652507dc9fce
Modify init command to take an optional directory to set up.
Bryan O'Sullivan <bos@serpentine.com>
parents:
906
diff
changeset
|
1988 |
hg.repository(ui, dest, create=1) |
338 | 1989 |
|
627 | 1990 |
def locate(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1991 |
"""locate files matching specific patterns |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1992 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1993 |
Print all files under Mercurial control whose names match the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1994 |
given patterns. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1995 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1996 |
This command searches the current directory and its |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1997 |
subdirectories. To search an entire repository, move to the root |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1998 |
of the repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1999 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2000 |
If no patterns are given to match, this command prints all file |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2001 |
names. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2002 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2003 |
If you want to feed the output of this command into the "xargs" |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2004 |
command, use the "-0" option to both this command and "xargs". |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2005 |
This will avoid the problem of "xargs" treating single filenames |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2006 |
that contain white space as multiple filenames. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2007 |
""" |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2008 |
end = opts['print0'] and '\0' or '\n' |
1622
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
2009 |
rev = opts['rev'] |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
2010 |
if rev: |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
2011 |
node = repo.lookup(rev) |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
2012 |
else: |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
2013 |
node = None |
742 | 2014 |
|
1622
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
2015 |
for src, abs, rel, exact in walk(repo, pats, opts, node=node, |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
2016 |
head='(?:.*/|)'): |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
2017 |
if not node and repo.dirstate.state(abs) == '?': |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2018 |
continue |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2019 |
if opts['fullpath']: |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
2020 |
ui.write(os.path.join(repo.root, abs), end) |
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
2021 |
else: |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
2022 |
ui.write(((pats and rel) or abs), end) |
627 | 2023 |
|
1031
503aaf19a040
Rewrite log command. New version is faster and more featureful.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1030
diff
changeset
|
2024 |
def log(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2025 |
"""show revision history of entire repository or files |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2026 |
|
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
2027 |
Print the revision history of the specified files or the entire |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
2028 |
project. |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
2029 |
|
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
2030 |
File history is shown without following rename or copy history of |
2782
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
2031 |
files. Use -f/--follow with a file name to follow history across |
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
2032 |
renames and copies. --follow without a file name will only show |
2784
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
2033 |
ancestors or descendants of the starting revision. --follow-first |
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
2034 |
only follows the first parent of merge revisions. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2035 |
|
2783
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
2036 |
If no revision range is specified, the default is tip:0 unless |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
2037 |
--follow is set, in which case the working directory parent is |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
2038 |
used as the starting revision. |
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
2039 |
|
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2040 |
By default this command outputs: changeset id and hash, tags, |
1557
f7d9823e65df
Updated help text for 'hg log'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1552
diff
changeset
|
2041 |
non-trivial parents, user, date and time, and a summary for each |
f7d9823e65df
Updated help text for 'hg log'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1552
diff
changeset
|
2042 |
commit. When the -v/--verbose switch is used, the list of changed |
f7d9823e65df
Updated help text for 'hg log'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1552
diff
changeset
|
2043 |
files and full commit message is shown. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2044 |
""" |
1559
59b3639df0a9
Convert all classes to new-style classes by deriving them from object.
Eric Hopper <hopper@omnifarious.org>
parents:
1552
diff
changeset
|
2045 |
class dui(object): |
1057 | 2046 |
# Implement and delegate some ui protocol. Save hunks of |
2047 |
# output for later display in the desired order. |
|
2048 |
def __init__(self, ui): |
|
2049 |
self.ui = ui |
|
2050 |
self.hunk = {} |
|
2033
e3280d350792
Group changes done by the same developer on the same with --style=changelog
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2051 |
self.header = {} |
1057 | 2052 |
def bump(self, rev): |
2053 |
self.rev = rev |
|
2054 |
self.hunk[rev] = [] |
|
2033
e3280d350792
Group changes done by the same developer on the same with --style=changelog
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2055 |
self.header[rev] = [] |
1057 | 2056 |
def note(self, *args): |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2057 |
if self.verbose: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2058 |
self.write(*args) |
1057 | 2059 |
def status(self, *args): |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2060 |
if not self.quiet: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2061 |
self.write(*args) |
1057 | 2062 |
def write(self, *args): |
2063 |
self.hunk[self.rev].append(args) |
|
2033
e3280d350792
Group changes done by the same developer on the same with --style=changelog
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2064 |
def write_header(self, *args): |
e3280d350792
Group changes done by the same developer on the same with --style=changelog
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2065 |
self.header[self.rev].append(args) |
1381
c29c36745c6e
log --debug: fix misplaced manifest field
TK Soh <teekaysoh@yahoo.com>
parents:
1380
diff
changeset
|
2066 |
def debug(self, *args): |
c29c36745c6e
log --debug: fix misplaced manifest field
TK Soh <teekaysoh@yahoo.com>
parents:
1380
diff
changeset
|
2067 |
if self.debugflag: |
c29c36745c6e
log --debug: fix misplaced manifest field
TK Soh <teekaysoh@yahoo.com>
parents:
1380
diff
changeset
|
2068 |
self.write(*args) |
1057 | 2069 |
def __getattr__(self, key): |
2070 |
return getattr(self.ui, key) |
|
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2071 |
|
1570
6a104941d56a
hg log -p should show file deletions
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1568
diff
changeset
|
2072 |
changeiter, getchange, matchfn = walkchangerevs(ui, repo, pats, opts) |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2073 |
|
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2074 |
if opts['limit']: |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2075 |
try: |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2076 |
limit = int(opts['limit']) |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2077 |
except ValueError: |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2078 |
raise util.Abort(_('limit must be a positive integer')) |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2079 |
if limit <= 0: raise util.Abort(_('limit must be positive')) |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2080 |
else: |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2081 |
limit = sys.maxint |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2082 |
count = 0 |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2083 |
|
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
2084 |
displayer = show_changeset(ui, repo, opts) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
2085 |
for st, rev, fns in changeiter: |
1057 | 2086 |
if st == 'window': |
1031
503aaf19a040
Rewrite log command. New version is faster and more featureful.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1030
diff
changeset
|
2087 |
du = dui(ui) |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
2088 |
displayer.ui = du |
1057 | 2089 |
elif st == 'add': |
2090 |
du.bump(rev) |
|
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2091 |
changenode = repo.changelog.node(rev) |
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2092 |
parents = [p for p in repo.changelog.parents(changenode) |
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2093 |
if p != nullid] |
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2094 |
if opts['no_merges'] and len(parents) == 2: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2095 |
continue |
1436
db6d7b4005ba
add --only-merges (-m) log
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1435
diff
changeset
|
2096 |
if opts['only_merges'] and len(parents) != 2: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2097 |
continue |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2098 |
|
1373
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2099 |
if opts['keyword']: |
1570
6a104941d56a
hg log -p should show file deletions
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1568
diff
changeset
|
2100 |
changes = getchange(rev) |
1373
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2101 |
miss = 0 |
1404
67e20e27d8df
log: make keyword search truly case-insensitive
TK Soh <teekaysoh@yahoo.com>
parents:
1402
diff
changeset
|
2102 |
for k in [kw.lower() for kw in opts['keyword']]: |
1373
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2103 |
if not (k in changes[1].lower() or |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2104 |
k in changes[4].lower() or |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2105 |
k in " ".join(changes[3][:20]).lower()): |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2106 |
miss = 1 |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2107 |
break |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2108 |
if miss: |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2109 |
continue |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
2110 |
|
1764
4671078dbfe7
Cleanup: Put initialization of br in front of --branches option handling.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1763
diff
changeset
|
2111 |
br = None |
1763
fa34a74efc40
Make option --branch vs. --branches more consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1762
diff
changeset
|
2112 |
if opts['branches']: |
1405
6fd6527f95eb
log: speedup keyword search when used with --branch
TK Soh <teekaysoh@yahoo.com>
parents:
1404
diff
changeset
|
2113 |
br = repo.branchlookup([repo.changelog.node(rev)]) |
6fd6527f95eb
log: speedup keyword search when used with --branch
TK Soh <teekaysoh@yahoo.com>
parents:
1404
diff
changeset
|
2114 |
|
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
2115 |
displayer.show(rev, brinfo=br) |
1057 | 2116 |
if opts['patch']: |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2117 |
prev = (parents and parents[0]) or nullid |
1570
6a104941d56a
hg log -p should show file deletions
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1568
diff
changeset
|
2118 |
dodiff(du, du, repo, prev, changenode, match=matchfn) |
1057 | 2119 |
du.write("\n\n") |
2120 |
elif st == 'iter': |
|
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2121 |
if count == limit: break |
2033
e3280d350792
Group changes done by the same developer on the same with --style=changelog
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2122 |
if du.header[rev]: |
e3280d350792
Group changes done by the same developer on the same with --style=changelog
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2123 |
for args in du.header[rev]: |
e3280d350792
Group changes done by the same developer on the same with --style=changelog
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2124 |
ui.write_header(*args) |
1765
b9fac31f34c9
hg log --limit shouldn't count unprinted revisions (found by TK Soh)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1764
diff
changeset
|
2125 |
if du.hunk[rev]: |
b9fac31f34c9
hg log --limit shouldn't count unprinted revisions (found by TK Soh)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1764
diff
changeset
|
2126 |
count += 1 |
b9fac31f34c9
hg log --limit shouldn't count unprinted revisions (found by TK Soh)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1764
diff
changeset
|
2127 |
for args in du.hunk[rev]: |
b9fac31f34c9
hg log --limit shouldn't count unprinted revisions (found by TK Soh)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1764
diff
changeset
|
2128 |
ui.write(*args) |
255 | 2129 |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2130 |
def manifest(ui, repo, rev=None): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2131 |
"""output the latest or given revision of the project manifest |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2132 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2133 |
Print a list of version controlled files for the given revision. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2134 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2135 |
The manifest is the list of files being version controlled. If no revision |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2136 |
is given then the tip is used. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2137 |
""" |
255 | 2138 |
if rev: |
689 | 2139 |
try: |
2140 |
# assume all revision numbers are for changesets |
|
2141 |
n = repo.lookup(rev) |
|
2142 |
change = repo.changelog.read(n) |
|
2143 |
n = change[0] |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2144 |
except hg.RepoError: |
689 | 2145 |
n = repo.manifest.lookup(rev) |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2146 |
else: |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2147 |
n = repo.manifest.tip() |
255 | 2148 |
m = repo.manifest.read(n) |
276 | 2149 |
mf = repo.manifest.readflags(n) |
255 | 2150 |
files = m.keys() |
2151 |
files.sort() |
|
2152 |
||
2153 |
for f in files: |
|
1092 | 2154 |
ui.write("%40s %3s %s\n" % (hex(m[f]), mf[f] and "755" or "644", f)) |
255 | 2155 |
|
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2156 |
def merge(ui, repo, node=None, force=None, branch=None): |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2157 |
"""Merge working directory with another revision |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2158 |
|
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2159 |
Merge the contents of the current working directory and the |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2160 |
requested revision. Files that changed between either parent are |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2161 |
marked as changed for the next commit and a commit must be |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2162 |
performed before any further updates are allowed. |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2163 |
""" |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2164 |
|
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2165 |
node = _lookup(repo, node, branch) |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2166 |
return hg.merge(repo, node, force=force) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2167 |
|
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
2168 |
def outgoing(ui, repo, dest=None, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2169 |
"""show changesets not found in destination |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2170 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2171 |
Show changesets not found in the specified destination repository or |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2172 |
the default push location. These are the changesets that would be pushed |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2173 |
if a push was requested. |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2174 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2175 |
See pull for valid destination format details. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2176 |
""" |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
2177 |
dest = ui.expandpath(dest or 'default-push', dest or 'default') |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
2178 |
setremoteconfig(ui, opts) |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
2179 |
revs = None |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
2180 |
if opts['rev']: |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
2181 |
revs = [repo.lookup(rev) for rev in opts['rev']] |
1965
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
2182 |
|
920 | 2183 |
other = hg.repository(ui, dest) |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
2184 |
o = repo.findoutgoing(other, force=opts['force']) |
1994
78ef83c9e9e1
show message if no changes found on outgoing
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1993
diff
changeset
|
2185 |
if not o: |
78ef83c9e9e1
show message if no changes found on outgoing
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1993
diff
changeset
|
2186 |
ui.status(_("no changes found\n")) |
78ef83c9e9e1
show message if no changes found on outgoing
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1993
diff
changeset
|
2187 |
return |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
2188 |
o = repo.changelog.nodesbetween(o, revs)[0] |
1439
65cbe22b03fa
allow 'hg out' / 'hg in' to show newest commit first
Michal Kvasnica <kvasnica@gmail.com>
parents:
1437
diff
changeset
|
2189 |
if opts['newest_first']: |
65cbe22b03fa
allow 'hg out' / 'hg in' to show newest commit first
Michal Kvasnica <kvasnica@gmail.com>
parents:
1437
diff
changeset
|
2190 |
o.reverse() |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
2191 |
displayer = show_changeset(ui, repo, opts) |
920 | 2192 |
for n in o: |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2193 |
parents = [p for p in repo.changelog.parents(n) if p != nullid] |
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2194 |
if opts['no_merges'] and len(parents) == 2: |
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2195 |
continue |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
2196 |
displayer.show(changenode=n) |
1192
6e165de907c5
Add -p to incoming and outgoing commands to show patch
TK Soh <teekaysoh@yahoo.com>
parents:
1191
diff
changeset
|
2197 |
if opts['patch']: |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
2198 |
prev = (parents and parents[0]) or nullid |
1192
6e165de907c5
Add -p to incoming and outgoing commands to show patch
TK Soh <teekaysoh@yahoo.com>
parents:
1191
diff
changeset
|
2199 |
dodiff(ui, ui, repo, prev, n) |
6e165de907c5
Add -p to incoming and outgoing commands to show patch
TK Soh <teekaysoh@yahoo.com>
parents:
1191
diff
changeset
|
2200 |
ui.write("\n") |
920 | 2201 |
|
2644
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2202 |
def parents(ui, repo, file_=None, rev=None, branches=None, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2203 |
"""show the parents of the working dir or revision |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2204 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2205 |
Print the working directory's parent revisions. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2206 |
""" |
2644
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2207 |
# legacy |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2208 |
if file_ and not rev: |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2209 |
try: |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2210 |
rev = repo.lookup(file_) |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2211 |
file_ = None |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2212 |
except hg.RepoError: |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2213 |
pass |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2214 |
else: |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2215 |
ui.warn(_("'hg parent REV' is deprecated, " |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2216 |
"please use 'hg parents -r REV instead\n")) |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2217 |
|
706
5107a7b6b14a
Make "hg parents REV" work (again?)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
705
diff
changeset
|
2218 |
if rev: |
2644
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2219 |
if file_: |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2220 |
ctx = repo.filectx(file_, changeid=rev) |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2221 |
else: |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2222 |
ctx = repo.changectx(rev) |
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
2223 |
p = [cp.node() for cp in ctx.parents()] |
255 | 2224 |
else: |
2225 |
p = repo.dirstate.parents() |
|
2226 |
||
1724
5a36609f73a7
add a -b/--branch option to 'hg parents'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1720
diff
changeset
|
2227 |
br = None |
1763
fa34a74efc40
Make option --branch vs. --branches more consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1762
diff
changeset
|
2228 |
if branches is not None: |
1724
5a36609f73a7
add a -b/--branch option to 'hg parents'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1720
diff
changeset
|
2229 |
br = repo.branchlookup(p) |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
2230 |
displayer = show_changeset(ui, repo, opts) |
255 | 2231 |
for n in p: |
1092 | 2232 |
if n != nullid: |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
2233 |
displayer.show(changenode=n, brinfo=br) |
255 | 2234 |
|
1858
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
2235 |
def paths(ui, repo, search=None): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2236 |
"""show definition of symbolic path names |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2237 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2238 |
Show definition of symbolic path name NAME. If no name is given, show |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2239 |
definition of available names. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2240 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2241 |
Path names are defined in the [paths] section of /etc/mercurial/hgrc |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2242 |
and $HOME/.hgrc. If run inside a repository, .hg/hgrc is used, too. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2243 |
""" |
779 | 2244 |
if search: |
2245 |
for name, path in ui.configitems("paths"): |
|
2246 |
if name == search: |
|
2247 |
ui.write("%s\n" % path) |
|
2248 |
return |
|
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
2249 |
ui.warn(_("not found!\n")) |
779 | 2250 |
return 1 |
2251 |
else: |
|
2252 |
for name, path in ui.configitems("paths"): |
|
2253 |
ui.write("%s = %s\n" % (name, path)) |
|
2254 |
||
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2255 |
def postincoming(ui, repo, modheads, optupdate): |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2256 |
if modheads == 0: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2257 |
return |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2258 |
if optupdate: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2259 |
if modheads == 1: |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2260 |
return hg.update(repo, repo.changelog.tip()) # update |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2261 |
else: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2262 |
ui.status(_("not updating, since new heads added\n")) |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2263 |
if modheads > 1: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2264 |
ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2265 |
else: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2266 |
ui.status(_("(run 'hg update' to get a working copy)\n")) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2267 |
|
404 | 2268 |
def pull(ui, repo, source="default", **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2269 |
"""pull changes from the specified source |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2270 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2271 |
Pull changes from a remote repository to a local one. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2272 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2273 |
This finds all changes from the repository at the specified path |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2274 |
or URL and adds them to the local repository. By default, this |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2275 |
does not update the copy of the project in the working directory. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2276 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2277 |
Valid URLs are of the form: |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2278 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2279 |
local/filesystem/path |
2589
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2280 |
http://[user@]host[:port]/[path] |
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2281 |
https://[user@]host[:port]/[path] |
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2282 |
ssh://[user@]host[:port]/[path] |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2283 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2284 |
Some notes about using SSH with Mercurial: |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2285 |
- SSH requires an accessible shell account on the destination machine |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2286 |
and a copy of hg in the remote path or specified with as remotecmd. |
2589
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2287 |
- path is relative to the remote user's home directory by default. |
2590
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
2288 |
Use an extra slash at the start of a path to specify an absolute path: |
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
2289 |
ssh://example.com//tmp/repository |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2290 |
- Mercurial doesn't use its own compression via SSH; the right thing |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2291 |
to do is to configure it in your ~/.ssh/ssh_config, e.g.: |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2292 |
Host *.mylocalnetwork.example.com |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2293 |
Compression off |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2294 |
Host * |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2295 |
Compression on |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2296 |
Alternatively specify "ssh -C" as your ssh command in your hgrc or |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2297 |
with the --ssh command line option. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2298 |
""" |
1893
6569651a4f1e
Read paths specified in .hg/hgrc relative to repo root, otherwise to home dir.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1892
diff
changeset
|
2299 |
source = ui.expandpath(source) |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
2300 |
setremoteconfig(ui, opts) |
963
84355e3e4493
Add -e and --remotecmd for clone and pull too
mpm@selenic.com
parents:
961
diff
changeset
|
2301 |
|
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
2302 |
other = hg.repository(ui, source) |
2473
30c267cb4c2f
change some repo messages in small ways.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2461
diff
changeset
|
2303 |
ui.status(_('pulling from %s\n') % (source)) |
1465
be6b5ce60b7f
Implementing pull -r and changing clone -r. Both now support
Eric Hopper <hopper@omnifarious.org>
parents:
1461
diff
changeset
|
2304 |
revs = None |
be6b5ce60b7f
Implementing pull -r and changing clone -r. Both now support
Eric Hopper <hopper@omnifarious.org>
parents:
1461
diff
changeset
|
2305 |
if opts['rev'] and not other.local(): |
1607
d72d27ee72b9
add '_' to several strings
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1602
diff
changeset
|
2306 |
raise util.Abort(_("pull -r doesn't work for remote repositories yet")) |
1465
be6b5ce60b7f
Implementing pull -r and changing clone -r. Both now support
Eric Hopper <hopper@omnifarious.org>
parents:
1461
diff
changeset
|
2307 |
elif opts['rev']: |
be6b5ce60b7f
Implementing pull -r and changing clone -r. Both now support
Eric Hopper <hopper@omnifarious.org>
parents:
1461
diff
changeset
|
2308 |
revs = [other.lookup(rev) for rev in opts['rev']] |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2309 |
modheads = repo.pull(other, heads=revs, force=opts['force']) |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2310 |
return postincoming(ui, repo, modheads, opts['update']) |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
2311 |
|
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
2312 |
def push(ui, repo, dest=None, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2313 |
"""push changes to the specified destination |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2314 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2315 |
Push changes from the local repository to the given destination. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2316 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2317 |
This is the symmetrical operation for pull. It helps to move |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2318 |
changes from the current repository to a different one. If the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2319 |
destination is local this is identical to a pull in that directory |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2320 |
from the current one. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2321 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2322 |
By default, push will refuse to run if it detects the result would |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2323 |
increase the number of remote heads. This generally indicates the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2324 |
the client has forgotten to sync and merge before pushing. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2325 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2326 |
Valid URLs are of the form: |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2327 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2328 |
local/filesystem/path |
2589
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2329 |
ssh://[user@]host[:port]/[path] |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2330 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2331 |
Look at the help text for the pull command for important details |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2332 |
about ssh:// URLs. |
2590
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
2333 |
|
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
2334 |
Pushing to http:// and https:// URLs is possible, too, if this |
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
2335 |
feature is enabled on the remote Mercurial server. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2336 |
""" |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
2337 |
dest = ui.expandpath(dest or 'default-push', dest or 'default') |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
2338 |
setremoteconfig(ui, opts) |
961 | 2339 |
|
640
b48b91d3fb4a
Switch push over to the new scheme
Matt Mackall <mpm@selenic.com>
parents:
639
diff
changeset
|
2340 |
other = hg.repository(ui, dest) |
2473
30c267cb4c2f
change some repo messages in small ways.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2461
diff
changeset
|
2341 |
ui.status('pushing to %s\n' % (dest)) |
1781
284fc722c342
add an optional argument to push only the specified revisions (push -r)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1712
diff
changeset
|
2342 |
revs = None |
284fc722c342
add an optional argument to push only the specified revisions (push -r)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1712
diff
changeset
|
2343 |
if opts['rev']: |
284fc722c342
add an optional argument to push only the specified revisions (push -r)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1712
diff
changeset
|
2344 |
revs = [repo.lookup(rev) for rev in opts['rev']] |
284fc722c342
add an optional argument to push only the specified revisions (push -r)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1712
diff
changeset
|
2345 |
r = repo.push(other, opts['force'], revs=revs) |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2346 |
return r == 0 |
319 | 2347 |
|
403 | 2348 |
def rawcommit(ui, repo, *flist, **rc): |
1812
a81f99dfaa2a
fix the synopsis of some commands, mark rawcommit as deprecated in short help
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1811
diff
changeset
|
2349 |
"""raw commit interface (DEPRECATED) |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2350 |
|
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2351 |
(DEPRECATED) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2352 |
Lowlevel commit, for use in helper scripts. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2353 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2354 |
This command is not intended to be used by normal users, as it is |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2355 |
primarily useful for importing from other SCMs. |
1657
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2356 |
|
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2357 |
This command is now deprecated and will be removed in a future |
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2358 |
release, please use debugsetparents and commit instead. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2359 |
""" |
1657
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2360 |
|
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2361 |
ui.warn(_("(the rawcommit command is deprecated)\n")) |
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2362 |
|
1496
3cf287a03664
remove the deprecated --text (t) option to rawcommit and tag
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1490
diff
changeset
|
2363 |
message = rc['message'] |
762
312b4a10d862
Changed more occurances of 'text' to 'message'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
761
diff
changeset
|
2364 |
if not message and rc['logfile']: |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2365 |
try: |
762
312b4a10d862
Changed more occurances of 'text' to 'message'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
761
diff
changeset
|
2366 |
message = open(rc['logfile']).read() |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2367 |
except IOError: |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2368 |
pass |
762
312b4a10d862
Changed more occurances of 'text' to 'message'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
761
diff
changeset
|
2369 |
if not message and not rc['logfile']: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
2370 |
raise util.Abort(_("missing commit message")) |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
2371 |
|
403 | 2372 |
files = relpath(repo, list(flist)) |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
2373 |
if rc['files']: |
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
2374 |
files += open(rc['files']).read().splitlines() |
452
a1e91c24dab5
rawcommit: do lookup of parents at the appropriate layer
mpm@selenic.com
parents:
443
diff
changeset
|
2375 |
|
a1e91c24dab5
rawcommit: do lookup of parents at the appropriate layer
mpm@selenic.com
parents:
443
diff
changeset
|
2376 |
rc['parent'] = map(repo.lookup, rc['parent']) |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
2377 |
|
1202
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
2378 |
try: |
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
2379 |
repo.rawcommit(files, message, rc['user'], rc['date'], *rc['parent']) |
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
2380 |
except ValueError, inst: |
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
2381 |
raise util.Abort(str(inst)) |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
2382 |
|
245 | 2383 |
def recover(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2384 |
"""roll back an interrupted transaction |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2385 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2386 |
Recover from an interrupted commit or pull. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2387 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2388 |
This command tries to fix the repository status after an interrupted |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2389 |
operation. It should only be necessary when Mercurial suggests it. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2390 |
""" |
1516
0b1b029b4de3
Automatically run "verify" whenever we run "recover"
Matt Mackall <mpm@selenic.com>
parents:
1514
diff
changeset
|
2391 |
if repo.recover(): |
2778 | 2392 |
return hg.verify(repo) |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
2393 |
return 1 |
245 | 2394 |
|
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
2395 |
def remove(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2396 |
"""remove the specified files on the next commit |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2397 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2398 |
Schedule the indicated files for removal from the repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2399 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2400 |
This command schedules the files to be removed at the next commit. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2401 |
This only removes files from the current branch, not from the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2402 |
entire project history. If the files still exist in the working |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
2403 |
directory, they will be deleted from it. If invoked with --after, |
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
2404 |
files that have been manually deleted are marked as removed. |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2405 |
|
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2406 |
Modified files and added files are not removed by default. To |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2407 |
remove them, use the -f/--force option. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2408 |
""" |
1188
b3ceb2d470fc
Fix up remove command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1187
diff
changeset
|
2409 |
names = [] |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
2410 |
if not opts['after'] and not pats: |
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
2411 |
raise util.Abort(_('no files specified')) |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2412 |
files, matchfn, anypats = matchpats(repo, pats, opts) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2413 |
exact = dict.fromkeys(files) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2414 |
mardu = map(dict.fromkeys, repo.changes(files=files, match=matchfn)) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2415 |
modified, added, removed, deleted, unknown = mardu |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2416 |
remove, forget = [], [] |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2417 |
for src, abs, rel, exact in walk(repo, pats, opts): |
1189
4cbcc54695b2
Make removal check more complete and informative.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1188
diff
changeset
|
2418 |
reason = None |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2419 |
if abs not in deleted and opts['after']: |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
2420 |
reason = _('is still present') |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2421 |
elif abs in modified and not opts['force']: |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2422 |
reason = _('is modified (use -f to force removal)') |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2423 |
elif abs in added: |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2424 |
if opts['force']: |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2425 |
forget.append(abs) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2426 |
continue |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2427 |
reason = _('has been marked for add (use -f to force removal)') |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2428 |
elif abs in unknown: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2429 |
reason = _('is not managed') |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2430 |
elif abs in removed: |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2431 |
continue |
1255
e825dfea3823
Get all commands that operate on files to honour --verbose and --quiet.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1254
diff
changeset
|
2432 |
if reason: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2433 |
if exact: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2434 |
ui.warn(_('not removing %s: file %s\n') % (rel, reason)) |
1189
4cbcc54695b2
Make removal check more complete and informative.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1188
diff
changeset
|
2435 |
else: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2436 |
if ui.verbose or not exact: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2437 |
ui.status(_('removing %s\n') % rel) |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2438 |
remove.append(abs) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2439 |
repo.forget(forget) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2440 |
repo.remove(remove, unlink=not opts['after']) |
245 | 2441 |
|
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
2442 |
def rename(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2443 |
"""rename files; equivalent of copy + remove |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2444 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2445 |
Mark dest as copies of sources; mark sources for deletion. If |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2446 |
dest is a directory, copies are put in that directory. If dest is |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2447 |
a file, there can only be one source. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2448 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2449 |
By default, this command copies the contents of files as they |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2450 |
stand in the working directory. If invoked with --after, the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2451 |
operation is recorded, but no copying is performed. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2452 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2453 |
This command takes effect in the next commit. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2454 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2455 |
NOTE: This command should be treated as experimental. While it |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2456 |
should properly record rename files, this information is not yet |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2457 |
fully used by merge, nor fully reported by log. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2458 |
""" |
2016
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2459 |
wlock = repo.wlock(0) |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2460 |
errs, copied = docopy(ui, repo, pats, opts, wlock) |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2461 |
names = [] |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2462 |
for abs, rel, exact in copied: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2463 |
if ui.verbose or not exact: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2464 |
ui.status(_('removing %s\n') % rel) |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2465 |
names.append(abs) |
2503
37655f10ced6
Don't require opts['dry_run'] to be set to fix external tools like tailor.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2494
diff
changeset
|
2466 |
if not opts.get('dry_run'): |
2414
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
2467 |
repo.remove(names, True, wlock) |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
2468 |
return errs |
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
2469 |
|
1472
3c909a747d7f
make revert use standard matcher
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1470
diff
changeset
|
2470 |
def revert(ui, repo, *pats, **opts): |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2471 |
"""revert files or dirs to their states as of some revision |
2204
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
2472 |
|
2212
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2473 |
With no revision specified, revert the named files or directories |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2474 |
to the contents they had in the parent of the working directory. |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2475 |
This restores the contents of the affected files to an unmodified |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2476 |
state. If the working directory has two parents, you must |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2477 |
explicitly specify the revision to revert to. |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2478 |
|
2036
c9226bcc288d
Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2479 |
Modified files are saved with a .orig suffix before reverting. |
c9226bcc288d
Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2480 |
To disable these backups, use --no-backup. |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2481 |
|
2204
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
2482 |
Using the -r option, revert the given files or directories to |
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
2483 |
their contents as of a specific revision. This can be helpful to"roll |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2484 |
back" some or all of a change that should not have been committed. |
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2485 |
|
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2486 |
Revert modifies the working directory. It does not commit any |
2204
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
2487 |
changes, or change the parent of the working directory. If you |
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
2488 |
revert to a revision other than the parent of the working |
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
2489 |
directory, the reverted files will thus appear modified |
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
2490 |
afterwards. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2491 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2492 |
If a file has been deleted, it is recreated. If the executable |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2493 |
mode of a file was changed, it is reset. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2494 |
|
1472
3c909a747d7f
make revert use standard matcher
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1470
diff
changeset
|
2495 |
If names are given, all files matching the names are reverted. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2496 |
|
1568
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
2497 |
If no arguments are given, all files in the repository are reverted. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2498 |
""" |
2212
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2499 |
parent, p2 = repo.dirstate.parents() |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2500 |
if opts['rev']: |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2501 |
node = repo.lookup(opts['rev']) |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2502 |
elif p2 != nullid: |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2503 |
raise util.Abort(_('working dir has two parents; ' |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2504 |
'you must specify the revision to revert to')) |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2505 |
else: |
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2506 |
node = parent |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2507 |
mf = repo.manifest.read(repo.changelog.read(node)[0]) |
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2508 |
if node == parent: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2509 |
pmf = mf |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2510 |
else: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2511 |
pmf = None |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2512 |
|
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2513 |
wlock = repo.wlock() |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2514 |
|
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2515 |
# need all matching names in dirstate and manifest of target rev, |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2516 |
# so have to walk both. do not print errors if files exist in one |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2517 |
# but not other. |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2518 |
|
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2519 |
names = {} |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2520 |
target_only = {} |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2521 |
|
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2522 |
# walk dirstate. |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2523 |
|
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2524 |
for src, abs, rel, exact in walk(repo, pats, opts, badmatch=mf.has_key): |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2525 |
names[abs] = (rel, exact) |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2526 |
if src == 'b': |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2527 |
target_only[abs] = True |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2528 |
|
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2529 |
# walk target manifest. |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2530 |
|
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2531 |
for src, abs, rel, exact in walk(repo, pats, opts, node=node, |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2532 |
badmatch=names.has_key): |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2533 |
if abs in names: continue |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2534 |
names[abs] = (rel, exact) |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2535 |
target_only[abs] = True |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2536 |
|
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2537 |
changes = repo.changes(match=names.has_key, wlock=wlock) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2538 |
modified, added, removed, deleted, unknown = map(dict.fromkeys, changes) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2539 |
|
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2540 |
revert = ([], _('reverting %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2541 |
add = ([], _('adding %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2542 |
remove = ([], _('removing %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2543 |
forget = ([], _('forgetting %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2544 |
undelete = ([], _('undeleting %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2545 |
update = {} |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2546 |
|
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2547 |
disptable = ( |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2548 |
# dispatch table: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2549 |
# file state |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2550 |
# action if in target manifest |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2551 |
# action if not in target manifest |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2552 |
# make backup if in target manifest |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2553 |
# make backup if not in target manifest |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2554 |
(modified, revert, remove, True, True), |
2043
968f036f93a4
Minor fix for revert: No need to make a backup when forgetting added files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2042
diff
changeset
|
2555 |
(added, revert, forget, True, False), |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2556 |
(removed, undelete, None, False, False), |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2557 |
(deleted, revert, remove, False, False), |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2558 |
(unknown, add, None, True, False), |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2559 |
(target_only, add, None, False, False), |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2560 |
) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2561 |
|
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2562 |
entries = names.items() |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2563 |
entries.sort() |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2564 |
|
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2565 |
for abs, (rel, exact) in entries: |
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2566 |
mfentry = mf.get(abs) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2567 |
def handle(xlist, dobackup): |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2568 |
xlist[0].append(abs) |
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2569 |
update[abs] = 1 |
2036
c9226bcc288d
Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2570 |
if dobackup and not opts['no_backup'] and os.path.exists(rel): |
c9226bcc288d
Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2571 |
bakname = "%s.orig" % rel |
c9226bcc288d
Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2572 |
ui.note(_('saving current version of %s as %s\n') % |
c9226bcc288d
Don't abort when backup files already exist. Don't allow alternative names.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2029
diff
changeset
|
2573 |
(rel, bakname)) |
2415
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2574 |
if not opts.get('dry_run'): |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2575 |
shutil.copyfile(rel, bakname) |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2576 |
shutil.copymode(rel, bakname) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2577 |
if ui.verbose or not exact: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2578 |
ui.status(xlist[1] % rel) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2579 |
for table, hitlist, misslist, backuphit, backupmiss in disptable: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2580 |
if abs not in table: continue |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2581 |
# file has changed in dirstate |
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2582 |
if mfentry: |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2583 |
handle(hitlist, backuphit) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2584 |
elif misslist is not None: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2585 |
handle(misslist, backupmiss) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2586 |
else: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2587 |
if exact: ui.warn(_('file not managed: %s\n' % rel)) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2588 |
break |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2589 |
else: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2590 |
# file has not changed in dirstate |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2591 |
if node == parent: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2592 |
if exact: ui.warn(_('no changes needed to %s\n' % rel)) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2593 |
continue |
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2594 |
if pmf is None: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2595 |
# only need parent manifest in this unlikely case, |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2596 |
# so do not read by default |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2597 |
pmf = repo.manifest.read(repo.changelog.read(parent)[0]) |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2598 |
if abs in pmf: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2599 |
if mfentry: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2600 |
# if version of file is same in parent and target |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2601 |
# manifests, do nothing |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2602 |
if pmf[abs] != mfentry: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2603 |
handle(revert, False) |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2604 |
else: |
2272
e9a0ed9ed4d9
revert: fix corner case found by faheem mitha.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2268
diff
changeset
|
2605 |
handle(remove, False) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2606 |
|
2415
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2607 |
if not opts.get('dry_run'): |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2608 |
repo.dirstate.forget(forget[0]) |
2812
3aeab7bb5adc
Refactor update locking slightly
Matt Mackall <mpm@selenic.com>
parents:
2808
diff
changeset
|
2609 |
r = hg.revert(repo, node, update.has_key, wlock) |
2415
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2610 |
repo.dirstate.update(add[0], 'a') |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2611 |
repo.dirstate.update(undelete[0], 'n') |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2612 |
repo.dirstate.update(remove[0], 'r') |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
2613 |
return r |
588 | 2614 |
|
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2615 |
def rollback(ui, repo): |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2616 |
"""roll back the last transaction in this repository |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2617 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2618 |
Roll back the last transaction in this repository, restoring the |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2619 |
project to its state prior to the transaction. |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2620 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2621 |
Transactions are used to encapsulate the effects of all commands |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2622 |
that create new changesets or propagate existing changesets into a |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2623 |
repository. For example, the following commands are transactional, |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2624 |
and their effects can be rolled back: |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2625 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2626 |
commit |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2627 |
import |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2628 |
pull |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2629 |
push (with this repository as destination) |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2630 |
unbundle |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2631 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2632 |
This command should be used with care. There is only one level of |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2633 |
rollback, and there is no way to undo a rollback. |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2634 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2635 |
This command is not intended for use on public repositories. Once |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2636 |
changes are visible for pull by other users, rolling a transaction |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2637 |
back locally is ineffective (someone else may already have pulled |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2638 |
the changes). Furthermore, a race is possible with readers of the |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2639 |
repository; for example an in-progress pull from the repository |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2640 |
may fail if a rollback is performed. |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2641 |
""" |
2362
482d3fb47d80
Renamed localrepo.undo() to rollback() and talk about "rollback information".
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2356
diff
changeset
|
2642 |
repo.rollback() |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2643 |
|
468 | 2644 |
def root(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2645 |
"""print the root (top) of the current working dir |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2646 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2647 |
Print the root directory of the current repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2648 |
""" |
468 | 2649 |
ui.write(repo.root + "\n") |
2650 |
||
245 | 2651 |
def serve(ui, repo, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2652 |
"""export the repository via HTTP |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2653 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2654 |
Start a local HTTP repository browser and pull server. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2655 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2656 |
By default, the server logs accesses to stdout and errors to |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2657 |
stderr. Use the "-A" and "-E" options to log to files. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2658 |
""" |
624
876333a295ff
Add an sshrepository class and hg serve --stdio
Matt Mackall <mpm@selenic.com>
parents:
618
diff
changeset
|
2659 |
|
876333a295ff
Add an sshrepository class and hg serve --stdio
Matt Mackall <mpm@selenic.com>
parents:
618
diff
changeset
|
2660 |
if opts["stdio"]: |
2127
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
2661 |
if repo is None: |
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
2662 |
raise hg.RepoError(_('no repo found')) |
2396
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
2663 |
s = sshserver.sshserver(ui, repo) |
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
2664 |
s.serve_forever() |
2363
fa4c11751367
Give a response to unknown SSH commands
Matt Mackall <mpm@selenic.com>
parents:
2362
diff
changeset
|
2665 |
|
2125
3610d9468b1e
Use string literal concatenation for optlist and import -p option
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2124
diff
changeset
|
2666 |
optlist = ("name templates style address port ipv6" |
3610d9468b1e
Use string literal concatenation for optlist and import -p option
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2124
diff
changeset
|
2667 |
" accesslog errorlog webdir_conf") |
987 | 2668 |
for o in optlist.split(): |
2669 |
if opts[o]: |
|
2670 |
ui.setconfig("web", o, opts[o]) |
|
2671 |
||
2127
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
2672 |
if repo is None and not ui.config("web", "webdir_conf"): |
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
2673 |
raise hg.RepoError(_('no repo found')) |
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
2674 |
|
1741
9777298fed84
stop read end of pipe from staying open forever in child process.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1740
diff
changeset
|
2675 |
if opts['daemon'] and not opts['daemon_pipefds']: |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2676 |
rfd, wfd = os.pipe() |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2677 |
args = sys.argv[:] |
1741
9777298fed84
stop read end of pipe from staying open forever in child process.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1740
diff
changeset
|
2678 |
args.append('--daemon-pipefds=%d,%d' % (rfd, wfd)) |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2679 |
pid = os.spawnvp(os.P_NOWAIT | getattr(os, 'P_DETACH', 0), |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2680 |
args[0], args) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2681 |
os.close(wfd) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2682 |
os.read(rfd, 1) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2683 |
os._exit(0) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2684 |
|
1177
862f53c1d0f9
hg serve: print a more useful error message if server can't start.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1147
diff
changeset
|
2685 |
try: |
2392
8238a3f039e6
Adjusting hgweb splitup to be a little cleaner.
Eric Hopper <hopper@omnifarious.org>
parents:
2362
diff
changeset
|
2686 |
httpd = hgweb.server.create_server(ui, repo) |
1177
862f53c1d0f9
hg serve: print a more useful error message if server can't start.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1147
diff
changeset
|
2687 |
except socket.error, inst: |
1607
d72d27ee72b9
add '_' to several strings
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1602
diff
changeset
|
2688 |
raise util.Abort(_('cannot start server: ') + inst.args[1]) |
987 | 2689 |
|
603
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2690 |
if ui.verbose: |
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2691 |
addr, port = httpd.socket.getsockname() |
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2692 |
if addr == '0.0.0.0': |
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2693 |
addr = socket.gethostname() |
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2694 |
else: |
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2695 |
try: |
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2696 |
addr = socket.gethostbyaddr(addr)[0] |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2697 |
except socket.error: |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2698 |
pass |
603
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2699 |
if port != 80: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
2700 |
ui.status(_('listening at http://%s:%d/\n') % (addr, port)) |
603
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2701 |
else: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
2702 |
ui.status(_('listening at http://%s/\n') % addr) |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2703 |
|
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2704 |
if opts['pid_file']: |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2705 |
fp = open(opts['pid_file'], 'w') |
2571
83cfd95eafb5
tests: add timeouts, make run-tests.py clean up dead daemon processes
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2567
diff
changeset
|
2706 |
fp.write(str(os.getpid()) + '\n') |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2707 |
fp.close() |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2708 |
|
1741
9777298fed84
stop read end of pipe from staying open forever in child process.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1740
diff
changeset
|
2709 |
if opts['daemon_pipefds']: |
9777298fed84
stop read end of pipe from staying open forever in child process.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1740
diff
changeset
|
2710 |
rfd, wfd = [int(x) for x in opts['daemon_pipefds'].split(',')] |
9777298fed84
stop read end of pipe from staying open forever in child process.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1740
diff
changeset
|
2711 |
os.close(rfd) |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2712 |
os.write(wfd, 'y') |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2713 |
os.close(wfd) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2714 |
sys.stdout.flush() |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2715 |
sys.stderr.flush() |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2716 |
fd = os.open(util.nulldev, os.O_RDWR) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2717 |
if fd != 0: os.dup2(fd, 0) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2718 |
if fd != 1: os.dup2(fd, 1) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2719 |
if fd != 2: os.dup2(fd, 2) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2720 |
if fd not in (0, 1, 2): os.close(fd) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2721 |
|
603
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2722 |
httpd.serve_forever() |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
2723 |
|
731
91ca3afab8e8
Add name matching to status command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
729
diff
changeset
|
2724 |
def status(ui, repo, *pats, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2725 |
"""show changed files in the working directory |
213 | 2726 |
|
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2727 |
Show status of files in the repository. If names are given, only |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2728 |
files that match are shown. Files that are clean or ignored, are |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2729 |
not listed unless -c (clean), -i (ignored) or -A is given. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2730 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2731 |
The codes used to show the status of files are: |
746 | 2732 |
M = modified |
245 | 2733 |
A = added |
2734 |
R = removed |
|
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2735 |
C = clean |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
2736 |
! = deleted, but still tracked |
842
8fb488773063
Rewritten change type selection for hg status.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
841
diff
changeset
|
2737 |
? = not tracked |
2022
a59da8cc35e4
New option -i/--ignored for 'hg status' to show ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2020
diff
changeset
|
2738 |
I = ignored (not shown by default) |
2639
001703ec311d
Add an option '-C|--copies' to hg status to show the source of copied files.
Brendan Cully <brendan@kublai.com>
parents:
2630
diff
changeset
|
2739 |
= the previous added file was copied from here |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2740 |
""" |
312 | 2741 |
|
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2742 |
all = opts['all'] |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2743 |
|
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
2744 |
files, matchfn, anypats = matchpats(repo, pats, opts) |
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
2745 |
cwd = (pats and repo.getcwd()) or '' |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2746 |
modified, added, removed, deleted, unknown, ignored, clean = [ |
1618
ff339dd21976
Renamed c, a, d, u to modified, added, removed, unknown for users of changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1615
diff
changeset
|
2747 |
[util.pathto(cwd, x) for x in n] |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2748 |
for n in repo.status(files=files, match=matchfn, |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2749 |
list_ignored=all or opts['ignored'], |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2750 |
list_clean=all or opts['clean'])] |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2751 |
|
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2752 |
changetypes = (('modified', 'M', modified), |
1966
f8b0e73e320f
hg status cleanups: Don't translate long options, remove stray semicolon.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1965
diff
changeset
|
2753 |
('added', 'A', added), |
f8b0e73e320f
hg status cleanups: Don't translate long options, remove stray semicolon.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1965
diff
changeset
|
2754 |
('removed', 'R', removed), |
f8b0e73e320f
hg status cleanups: Don't translate long options, remove stray semicolon.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1965
diff
changeset
|
2755 |
('deleted', '!', deleted), |
2022
a59da8cc35e4
New option -i/--ignored for 'hg status' to show ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2020
diff
changeset
|
2756 |
('unknown', '?', unknown), |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2757 |
('ignored', 'I', ignored)) |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2758 |
|
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2759 |
explicit_changetypes = changetypes + (('clean', 'C', clean),) |
842
8fb488773063
Rewritten change type selection for hg status.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
841
diff
changeset
|
2760 |
|
1085
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2761 |
end = opts['print0'] and '\0' or '\n' |
1106
95a044b73bd5
Whitespace cleanup.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1105
diff
changeset
|
2762 |
|
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2763 |
for opt, char, changes in ([ct for ct in explicit_changetypes |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2764 |
if all or opts[ct[0]]] |
842
8fb488773063
Rewritten change type selection for hg status.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
841
diff
changeset
|
2765 |
or changetypes): |
1105
a906b018eaef
Replaced hg status -p/--strip with -n/--no-status to not confuse with patch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1085
diff
changeset
|
2766 |
if opts['no_status']: |
1085
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2767 |
format = "%%s%s" % end |
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2768 |
else: |
1966
f8b0e73e320f
hg status cleanups: Don't translate long options, remove stray semicolon.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1965
diff
changeset
|
2769 |
format = "%s %%s%s" % (char, end) |
1106
95a044b73bd5
Whitespace cleanup.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1105
diff
changeset
|
2770 |
|
842
8fb488773063
Rewritten change type selection for hg status.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
841
diff
changeset
|
2771 |
for f in changes: |
1085
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2772 |
ui.write(format % f) |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2773 |
if ((all or opts.get('copies')) and not opts.get('no_status') |
2639
001703ec311d
Add an option '-C|--copies' to hg status to show the source of copied files.
Brendan Cully <brendan@kublai.com>
parents:
2630
diff
changeset
|
2774 |
and opt == 'added' and repo.dirstate.copies.has_key(f)): |
001703ec311d
Add an option '-C|--copies' to hg status to show the source of copied files.
Brendan Cully <brendan@kublai.com>
parents:
2630
diff
changeset
|
2775 |
ui.write(' %s%s' % (repo.dirstate.copies[f], end)) |
213 | 2776 |
|
1596
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2777 |
def tag(ui, repo, name, rev_=None, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2778 |
"""add a tag for the current tip or a given revision |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2779 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2780 |
Name a particular revision using <name>. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2781 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2782 |
Tags are used to name particular revisions of the repository and are |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2783 |
very useful to compare different revision, to go back to significant |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2784 |
earlier versions or to mark branch points as releases, etc. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2785 |
|
2647
46182568b4ce
change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2639
diff
changeset
|
2786 |
If no revision is given, the parent of the working directory is used. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2787 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2788 |
To facilitate version control, distribution, and merging of tags, |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2789 |
they are stored as a file named ".hgtags" which is managed |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2790 |
similarly to other project files and can be hand-edited if |
1654
b7fc961507db
deprecate the use of 'hg tag NAME [REV]'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1648
diff
changeset
|
2791 |
necessary. The file '.hg/localtags' is used for local tags (not |
b7fc961507db
deprecate the use of 'hg tag NAME [REV]'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1648
diff
changeset
|
2792 |
shared among repositories). |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2793 |
""" |
2789
e3564699409c
Add '.' as a shortcut revision name for the working directory parent.
Brendan Cully <brendan@kublai.com>
parents:
2784
diff
changeset
|
2794 |
if name in ['tip', '.']: |
e3564699409c
Add '.' as a shortcut revision name for the working directory parent.
Brendan Cully <brendan@kublai.com>
parents:
2784
diff
changeset
|
2795 |
raise util.Abort(_("the name '%s' is reserved") % name) |
1654
b7fc961507db
deprecate the use of 'hg tag NAME [REV]'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1648
diff
changeset
|
2796 |
if rev_ is not None: |
b7fc961507db
deprecate the use of 'hg tag NAME [REV]'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1648
diff
changeset
|
2797 |
ui.warn(_("use of 'hg tag NAME [REV]' is deprecated, " |
1661
b11507d6d16d
Added missing quote in warning text.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1657
diff
changeset
|
2798 |
"please use 'hg tag [-r REV] NAME' instead\n")) |
1654
b7fc961507db
deprecate the use of 'hg tag NAME [REV]'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1648
diff
changeset
|
2799 |
if opts['rev']: |
b7fc961507db
deprecate the use of 'hg tag NAME [REV]'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1648
diff
changeset
|
2800 |
raise util.Abort(_("use only one form to specify the revision")) |
1596
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2801 |
if opts['rev']: |
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2802 |
rev_ = opts['rev'] |
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2803 |
if rev_: |
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2804 |
r = hex(repo.lookup(rev_)) |
609
2acf1f5df2e6
[PATCH] hg tag: local tag support in file .hg/localtags
Matt Mackall <mpm@selenic.com>
parents:
607
diff
changeset
|
2805 |
else: |
2647
46182568b4ce
change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2639
diff
changeset
|
2806 |
p1, p2 = repo.dirstate.parents() |
46182568b4ce
change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2639
diff
changeset
|
2807 |
if p1 == nullid: |
46182568b4ce
change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2639
diff
changeset
|
2808 |
raise util.Abort(_('no revision to tag')) |
46182568b4ce
change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2639
diff
changeset
|
2809 |
if p2 != nullid: |
2648
f47432ae5376
spelling fix
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2647
diff
changeset
|
2810 |
raise util.Abort(_('outstanding uncommitted merges')) |
2647
46182568b4ce
change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2639
diff
changeset
|
2811 |
r = hex(p1) |
609
2acf1f5df2e6
[PATCH] hg tag: local tag support in file .hg/localtags
Matt Mackall <mpm@selenic.com>
parents:
607
diff
changeset
|
2812 |
|
2601
00fc88b0b256
move most of tag code to localrepository class.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2600
diff
changeset
|
2813 |
repo.tag(name, r, opts['local'], opts['message'], opts['user'], |
00fc88b0b256
move most of tag code to localrepository class.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2600
diff
changeset
|
2814 |
opts['date']) |
401
af4848f83e68
From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
396
diff
changeset
|
2815 |
|
248 | 2816 |
def tags(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2817 |
"""list repository tags |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2818 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2819 |
List the repository tags. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2820 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2821 |
This lists both regular and local tags. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2822 |
""" |
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
2823 |
|
343 | 2824 |
l = repo.tagslist() |
2825 |
l.reverse() |
|
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
2826 |
for t, n in l: |
248 | 2827 |
try: |
1092 | 2828 |
r = "%5d:%s" % (repo.changelog.rev(n), hex(n)) |
248 | 2829 |
except KeyError: |
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
2830 |
r = " ?:?" |
2035
107dc72880f8
Make 'hg tags -q' only list tag names without revision numbers and hashes,
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2034
diff
changeset
|
2831 |
if ui.quiet: |
107dc72880f8
Make 'hg tags -q' only list tag names without revision numbers and hashes,
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2034
diff
changeset
|
2832 |
ui.write("%s\n" % t) |
107dc72880f8
Make 'hg tags -q' only list tag names without revision numbers and hashes,
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2034
diff
changeset
|
2833 |
else: |
107dc72880f8
Make 'hg tags -q' only list tag names without revision numbers and hashes,
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2034
diff
changeset
|
2834 |
ui.write("%-30s %s\n" % (t, r)) |
248 | 2835 |
|
1731
251729df9cc6
add -p option to tip. for issue 64.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1728
diff
changeset
|
2836 |
def tip(ui, repo, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2837 |
"""show the tip revision |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2838 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2839 |
Show the tip revision. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2840 |
""" |
245 | 2841 |
n = repo.changelog.tip() |
1762
8eaa8e06a364
Add option -b/--branch to hg tip (as done for hg parents).
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1761
diff
changeset
|
2842 |
br = None |
1763
fa34a74efc40
Make option --branch vs. --branches more consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1762
diff
changeset
|
2843 |
if opts['branches']: |
1762
8eaa8e06a364
Add option -b/--branch to hg tip (as done for hg parents).
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1761
diff
changeset
|
2844 |
br = repo.branchlookup([n]) |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
2845 |
show_changeset(ui, repo, opts).show(changenode=n, brinfo=br) |
1731
251729df9cc6
add -p option to tip. for issue 64.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1728
diff
changeset
|
2846 |
if opts['patch']: |
251729df9cc6
add -p option to tip. for issue 64.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1728
diff
changeset
|
2847 |
dodiff(ui, ui, repo, repo.changelog.parents(n)[0], n) |
245 | 2848 |
|
1600
728fd9584993
add --update support to 'hg unbundle'
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1596
diff
changeset
|
2849 |
def unbundle(ui, repo, fname, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2850 |
"""apply a changegroup file |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2851 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2852 |
Apply a compressed changegroup file generated by the bundle |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2853 |
command. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2854 |
""" |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2855 |
f = urllib.urlopen(fname) |
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2856 |
|
1980
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2857 |
header = f.read(6) |
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2858 |
if not header.startswith("HG"): |
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2859 |
raise util.Abort(_("%s: not a Mercurial bundle file") % fname) |
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2860 |
elif not header.startswith("HG10"): |
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2861 |
raise util.Abort(_("%s: unknown bundle version") % fname) |
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2862 |
elif header == "HG10BZ": |
1940
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2863 |
def generator(f): |
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2864 |
zd = bz2.BZ2Decompressor() |
1980
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2865 |
zd.decompress("BZ") |
1940
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2866 |
for chunk in f: |
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2867 |
yield zd.decompress(chunk) |
1980
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2868 |
elif header == "HG10UN": |
1940
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2869 |
def generator(f): |
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2870 |
for chunk in f: |
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2871 |
yield chunk |
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2872 |
else: |
1980
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2873 |
raise util.Abort(_("%s: unknown bundle compression type") |
dfb796786337
use HG10UN header for uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1979
diff
changeset
|
2874 |
% fname) |
1940
7ae177a70f54
add a new bundle type: uncompressed bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1920
diff
changeset
|
2875 |
gen = generator(util.filechunkiter(f, 4096)) |
2673
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2662
diff
changeset
|
2876 |
modheads = repo.addchangegroup(util.chunkbuffer(gen), 'unbundle', |
109a22f5434a
hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2662
diff
changeset
|
2877 |
'bundle:' + fname) |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2878 |
return postincoming(ui, repo, modheads, opts['update']) |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2879 |
|
212
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
2880 |
def undo(ui, repo): |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2881 |
"""undo the last commit or pull (DEPRECATED) |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2882 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2883 |
(DEPRECATED) |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2884 |
This command is now deprecated and will be removed in a future |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2885 |
release. Please use the rollback command instead. For usage |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2886 |
instructions, see the rollback command. |
596 | 2887 |
""" |
2238
25af3f17ce95
undo: add "deprecated" message to output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2230
diff
changeset
|
2888 |
ui.warn(_('(the undo command is deprecated; use rollback instead)\n')) |
2362
482d3fb47d80
Renamed localrepo.undo() to rollback() and talk about "rollback information".
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2356
diff
changeset
|
2889 |
repo.rollback() |
210 | 2890 |
|
1581
db10b7114de0
abort when merging two heads and repository has local changes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1571
diff
changeset
|
2891 |
def update(ui, repo, node=None, merge=False, clean=False, force=None, |
2776
557ea210fd9f
Remove **opts arg from commands.doupdate
Matt Mackall <mpm@selenic.com>
parents:
2775
diff
changeset
|
2892 |
branch=None): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2893 |
"""update or merge working directory |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2894 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2895 |
Update the working directory to the specified revision. |
254 | 2896 |
|
2897 |
If there are no outstanding changes in the working directory and |
|
2898 |
there is a linear relationship between the current version and the |
|
2899 |
requested version, the result is the requested version. |
|
2900 |
||
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2272
diff
changeset
|
2901 |
To merge the working directory with another revision, use the |
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2272
diff
changeset
|
2902 |
merge command. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2903 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2904 |
By default, update will refuse to run if doing so would require |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2905 |
merging or discarding local changes. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2906 |
""" |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2907 |
node = _lookup(repo, node, branch) |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2272
diff
changeset
|
2908 |
if merge: |
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2272
diff
changeset
|
2909 |
ui.warn(_('(the -m/--merge option is deprecated; ' |
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2272
diff
changeset
|
2910 |
'use the merge command instead)\n')) |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2911 |
return hg.merge(repo, node, force=force) |
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2912 |
elif clean: |
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2913 |
return hg.clean(repo, node) |
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2914 |
else: |
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2915 |
return hg.update(repo, node) |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2916 |
|
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2917 |
def _lookup(repo, node, branch=None): |
898 | 2918 |
if branch: |
2919 |
br = repo.branchlookup(branch=branch) |
|
2920 |
found = [] |
|
2921 |
for x in br: |
|
2922 |
if branch in br[x]: |
|
2923 |
found.append(x) |
|
2924 |
if len(found) > 1: |
|
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2925 |
repo.ui.warn(_("Found multiple heads for %s\n") % branch) |
898 | 2926 |
for x in found: |
2776
557ea210fd9f
Remove **opts arg from commands.doupdate
Matt Mackall <mpm@selenic.com>
parents:
2775
diff
changeset
|
2927 |
show_changeset(ui, repo, {}).show(changenode=x, brinfo=br) |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2928 |
raise util.Abort("") |
898 | 2929 |
if len(found) == 1: |
2930 |
node = found[0] |
|
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2931 |
repo.ui.warn(_("Using head %s for branch %s\n") |
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2932 |
% (short(node), branch)) |
898 | 2933 |
else: |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2934 |
raise util.Abort(_("branch %s not found\n") % (branch)) |
898 | 2935 |
else: |
2936 |
node = node and repo.lookup(node) or repo.changelog.tip() |
|
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2937 |
return node |
254 | 2938 |
|
247 | 2939 |
def verify(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2940 |
"""verify the integrity of the repository |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2941 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2942 |
Verify the integrity of the current repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2943 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2944 |
This will perform an extensive check of the repository's |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2945 |
integrity, validating the hashes and checksums of each entry in |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2946 |
the changelog, manifest, and tracked files, as well as the |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2947 |
integrity of their crosslinks and indices. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2948 |
""" |
2778 | 2949 |
return hg.verify(repo) |
247 | 2950 |
|
255 | 2951 |
# Command options and aliases are listed here, alphabetically |
2952 |
||
209 | 2953 |
table = { |
841
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
2954 |
"^add": |
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
2955 |
(add, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2956 |
[('I', 'include', [], _('include names matching the given patterns')), |
2411
734df6333ca4
add: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2410
diff
changeset
|
2957 |
('X', 'exclude', [], _('exclude names matching the given patterns')), |
2416
04736f38d74f
make description of -n option better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2415
diff
changeset
|
2958 |
('n', 'dry-run', None, _('do not perform actions, just print output'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2959 |
_('hg add [OPTION]... [FILE]...')), |
2184
2477a7183a6f
Add debugaddremove alias to addremove, so it doesn't show up in 'hg help'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2181
diff
changeset
|
2960 |
"debugaddremove|addremove": |
841
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
2961 |
(addremove, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2962 |
[('I', 'include', [], _('include names matching the given patterns')), |
2412
e5cb39577b9f
addremove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2411
diff
changeset
|
2963 |
('X', 'exclude', [], _('exclude names matching the given patterns')), |
2416
04736f38d74f
make description of -n option better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2415
diff
changeset
|
2964 |
('n', 'dry-run', None, _('do not perform actions, just print output'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2965 |
_('hg addremove [OPTION]... [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2966 |
"^annotate": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2967 |
(annotate, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2968 |
[('r', 'rev', '', _('annotate the specified revision')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
2969 |
('a', 'text', None, _('treat all files as text')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2970 |
('u', 'user', None, _('list the author')), |
1522 | 2971 |
('d', 'date', None, _('list the date')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2972 |
('n', 'number', None, _('list the revision number (default)')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2973 |
('c', 'changeset', None, _('list the changeset')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2974 |
('I', 'include', [], _('include names matching the given patterns')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2975 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2976 |
_('hg annotate [-r REV] [-a] [-u] [-d] [-n] [-c] FILE...')), |
2160
858df1f354c1
Cleanup archive command: Don't overwrite gettext, quoting in cmd table entry.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2159
diff
changeset
|
2977 |
"archive": |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2978 |
(archive, |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2979 |
[('', 'no-decode', None, _('do not pass files through decoders')), |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2980 |
('p', 'prefix', '', _('directory prefix for files in archive')), |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2981 |
('r', 'rev', '', _('revision to distribute')), |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2982 |
('t', 'type', '', _('type of distribution to create')), |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2983 |
('I', 'include', [], _('include names matching the given patterns')), |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2984 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2985 |
_('hg archive [OPTION]... DEST')), |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2986 |
"backout": |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2987 |
(backout, |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2988 |
[('', 'merge', None, |
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2989 |
_('merge with old dirstate parent after backout')), |
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2990 |
('m', 'message', '', _('use <text> as commit message')), |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2991 |
('l', 'logfile', '', _('read commit message from <file>')), |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2992 |
('d', 'date', '', _('record datecode as commit date')), |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
2993 |
('', 'parent', '', _('parent to choose when backing out merge')), |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2994 |
('u', 'user', '', _('record user as committer')), |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2995 |
('I', 'include', [], _('include names matching the given patterns')), |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2996 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2997 |
_('hg backout [OPTION]... REV')), |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2998 |
"bundle": |
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2999 |
(bundle, |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3000 |
[('f', 'force', None, |
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3001 |
_('run even when remote repository is unrelated'))], |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3002 |
_('hg bundle FILE DEST')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3003 |
"cat": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3004 |
(cat, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3005 |
[('o', 'output', '', _('print output to file with formatted name')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3006 |
('r', 'rev', '', _('print the given revision')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3007 |
('I', 'include', [], _('include names matching the given patterns')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3008 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3009 |
_('hg cat [OPTION]... FILE...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3010 |
"^clone": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3011 |
(clone, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3012 |
[('U', 'noupdate', None, _('do not update the new working directory')), |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3013 |
('r', 'rev', [], |
2764
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
3014 |
_('a changeset you would like to have after cloning')), |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3015 |
('', 'pull', None, _('use pull protocol to copy metadata')), |
2620
de82749d3a71
clone: change name of --stream to --uncompressed.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2618
diff
changeset
|
3016 |
('', 'uncompressed', None, |
de82749d3a71
clone: change name of --stream to --uncompressed.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2618
diff
changeset
|
3017 |
_('use uncompressed transfer (fast over LAN)')), |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3018 |
('e', 'ssh', '', _('specify ssh command to use')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3019 |
('', 'remotecmd', '', |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3020 |
_('specify hg command to run on the remote side'))], |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3021 |
_('hg clone [OPTION]... SOURCE [DEST]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3022 |
"^commit|ci": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3023 |
(commit, |
2184
2477a7183a6f
Add debugaddremove alias to addremove, so it doesn't show up in 'hg help'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2181
diff
changeset
|
3024 |
[('A', 'addremove', None, |
2477a7183a6f
Add debugaddremove alias to addremove, so it doesn't show up in 'hg help'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2181
diff
changeset
|
3025 |
_('mark new/missing files as added/removed before committing')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3026 |
('m', 'message', '', _('use <text> as commit message')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3027 |
('l', 'logfile', '', _('read the commit message from <file>')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3028 |
('d', 'date', '', _('record datecode as commit date')), |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3029 |
('u', 'user', '', _('record user as commiter')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3030 |
('I', 'include', [], _('include names matching the given patterns')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3031 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3032 |
_('hg commit [OPTION]... [FILE]...')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3033 |
"copy|cp": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3034 |
(copy, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3035 |
[('A', 'after', None, _('record a copy that has already occurred')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3036 |
('f', 'force', None, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3037 |
_('forcibly copy over an existing managed file')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3038 |
('I', 'include', [], _('include names matching the given patterns')), |
2413
c1ec81319870
copy: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2412
diff
changeset
|
3039 |
('X', 'exclude', [], _('exclude names matching the given patterns')), |
2416
04736f38d74f
make description of -n option better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2415
diff
changeset
|
3040 |
('n', 'dry-run', None, _('do not perform actions, just print output'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3041 |
_('hg copy [OPTION]... [SOURCE]... DEST')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3042 |
"debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')), |
2034
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
3043 |
"debugcomplete": |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
3044 |
(debugcomplete, |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
3045 |
[('o', 'options', None, _('show the command options'))], |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
3046 |
_('debugcomplete [-o] CMD')), |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
3047 |
"debugrebuildstate": |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
3048 |
(debugrebuildstate, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3049 |
[('r', 'rev', '', _('revision to rebuild to'))], |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
3050 |
_('debugrebuildstate [-r REV] [REV]')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3051 |
"debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
2410
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
3052 |
"debugconfig": (debugconfig, [], _('debugconfig [NAME]...')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3053 |
"debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3054 |
"debugstate": (debugstate, [], _('debugstate')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3055 |
"debugdata": (debugdata, [], _('debugdata FILE REV')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3056 |
"debugindex": (debugindex, [], _('debugindex FILE')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3057 |
"debugindexdot": (debugindexdot, [], _('debugindexdot FILE')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3058 |
"debugrename": (debugrename, [], _('debugrename FILE [REV]')), |
841
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
3059 |
"debugwalk": |
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
3060 |
(debugwalk, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3061 |
[('I', 'include', [], _('include names matching the given patterns')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3062 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3063 |
_('debugwalk [OPTION]... [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3064 |
"^diff": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3065 |
(diff, |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3066 |
[('r', 'rev', [], _('revision')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3067 |
('a', 'text', None, _('treat all files as text')), |
1728
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
3068 |
('p', 'show-function', None, |
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
3069 |
_('show which function each change is in')), |
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
3070 |
('w', 'ignore-all-space', None, |
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
3071 |
_('ignore white space when comparing lines')), |
2580
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
3072 |
('b', 'ignore-space-change', None, |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
3073 |
_('ignore changes in the amount of white space')), |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
3074 |
('B', 'ignore-blank-lines', None, |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
3075 |
_('ignore changes whose lines are all blank')), |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3076 |
('I', 'include', [], _('include names matching the given patterns')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3077 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3078 |
_('hg diff [-a] [-I] [-X] [-r REV1 [-r REV2]] [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3079 |
"^export": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3080 |
(export, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3081 |
[('o', 'output', '', _('print output to file with formatted name')), |
1571
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
3082 |
('a', 'text', None, _('treat all files as text')), |
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
3083 |
('', 'switch-parent', None, _('diff against the second parent'))], |
1812
a81f99dfaa2a
fix the synopsis of some commands, mark rawcommit as deprecated in short help
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1811
diff
changeset
|
3084 |
_('hg export [-a] [-o OUTFILESPEC] REV...')), |
2140
6447a32aefce
Make the deprecated forget an alias of debugforget.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2135
diff
changeset
|
3085 |
"debugforget|forget": |
841
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
3086 |
(forget, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3087 |
[('I', 'include', [], _('include names matching the given patterns')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3088 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3089 |
_('hg forget [OPTION]... FILE...')), |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3090 |
"grep": |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3091 |
(grep, |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3092 |
[('0', 'print0', None, _('end fields with NUL')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3093 |
('', 'all', None, _('print all revisions that match')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3094 |
('i', 'ignore-case', None, _('ignore case when matching')), |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3095 |
('l', 'files-with-matches', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3096 |
_('print only filenames and revs that match')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3097 |
('n', 'line-number', None, _('print matching line numbers')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3098 |
('r', 'rev', [], _('search in given revision range')), |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3099 |
('u', 'user', None, _('print user who committed change')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3100 |
('I', 'include', [], _('include names matching the given patterns')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3101 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3102 |
_('hg grep [OPTION]... PATTERN [FILE]...')), |
905
65763ff9fa53
Update online help of hg heads for new --branches option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
904
diff
changeset
|
3103 |
"heads": |
65763ff9fa53
Update online help of hg heads for new --branches option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
904
diff
changeset
|
3104 |
(heads, |
1763
fa34a74efc40
Make option --branch vs. --branches more consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1762
diff
changeset
|
3105 |
[('b', 'branches', None, _('show branches')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3106 |
('', 'style', '', _('display using template map file')), |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
3107 |
('r', 'rev', '', _('show only heads which are descendants of rev')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3108 |
('', 'template', '', _('display with template'))], |
1550
ccb9b62de892
add a -r/--rev option to heads to show only heads descendant from rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1547
diff
changeset
|
3109 |
_('hg heads [-b] [-r <rev>]')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3110 |
"help": (help_, [], _('hg help [COMMAND]')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3111 |
"identify|id": (identify, [], _('hg identify')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3112 |
"import|patch": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3113 |
(import_, |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3114 |
[('p', 'strip', 1, |
2125
3610d9468b1e
Use string literal concatenation for optlist and import -p option
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2124
diff
changeset
|
3115 |
_('directory strip option for patch. This has the same\n' |
3610d9468b1e
Use string literal concatenation for optlist and import -p option
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2124
diff
changeset
|
3116 |
'meaning as the corresponding patch option')), |
2458
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
3117 |
('m', 'message', '', _('use <text> as commit message')), |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3118 |
('b', 'base', '', _('base path')), |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3119 |
('f', 'force', None, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3120 |
_('skip check for outstanding uncommitted changes'))], |
2458
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
3121 |
_('hg import [-p NUM] [-b BASE] [-m MESSAGE] [-f] PATCH...')), |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
3122 |
"incoming|in": (incoming, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3123 |
[('M', 'no-merges', None, _('do not show merges')), |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3124 |
('f', 'force', None, |
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3125 |
_('run even when remote repository is unrelated')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3126 |
('', 'style', '', _('display using template map file')), |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
3127 |
('n', 'newest-first', None, _('show newest record first')), |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
3128 |
('', 'bundle', '', _('file to store the bundles into')), |
1439
65cbe22b03fa
allow 'hg out' / 'hg in' to show newest commit first
Michal Kvasnica <kvasnica@gmail.com>
parents:
1437
diff
changeset
|
3129 |
('p', 'patch', None, _('show patch')), |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
3130 |
('r', 'rev', [], _('a specific revision you would like to pull')), |
1965
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
3131 |
('', 'template', '', _('display with template')), |
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
3132 |
('e', 'ssh', '', _('specify ssh command to use')), |
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
3133 |
('', 'remotecmd', '', |
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
3134 |
_('specify hg command to run on the remote side'))], |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
3135 |
_('hg incoming [-p] [-n] [-M] [-r REV]...' |
2544
0ab63318bc36
Added missing space in continued string.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2521
diff
changeset
|
3136 |
' [--bundle FILENAME] [SOURCE]')), |
2598
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
3137 |
"^init": |
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
3138 |
(init, |
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
3139 |
[('e', 'ssh', '', _('specify ssh command to use')), |
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
3140 |
('', 'remotecmd', '', |
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
3141 |
_('specify hg command to run on the remote side'))], |
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
3142 |
_('hg init [-e FILE] [--remotecmd FILE] [DEST]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3143 |
"locate": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3144 |
(locate, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3145 |
[('r', 'rev', '', _('search the repository as it stood at rev')), |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3146 |
('0', 'print0', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3147 |
_('end filenames with NUL, for use with xargs')), |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3148 |
('f', 'fullpath', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3149 |
_('print complete paths from the filesystem root')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3150 |
('I', 'include', [], _('include names matching the given patterns')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3151 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3152 |
_('hg locate [OPTION]... [PATTERN]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3153 |
"^log|history": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3154 |
(log, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3155 |
[('b', 'branches', None, _('show branches')), |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
3156 |
('f', 'follow', None, |
2782
21e571c21a6b
Make log --follow without a file list follow a single head.
Brendan Cully <brendan@kublai.com>
parents:
2764
diff
changeset
|
3157 |
_('follow changeset history, or file history across copies and renames')), |
2784
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
3158 |
('', 'follow-first', None, |
12a7bfcafd8f
Add log option --follow-first to follow only the first parent of
Brendan Cully <brendan@kublai.com>
parents:
2783
diff
changeset
|
3159 |
_('only follow the first parent of merge changesets')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3160 |
('k', 'keyword', [], _('search for a keyword')), |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
3161 |
('l', 'limit', '', _('limit number of changes displayed')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3162 |
('r', 'rev', [], _('show the specified revision or range')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3163 |
('M', 'no-merges', None, _('do not show merges')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3164 |
('', 'style', '', _('display using template map file')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3165 |
('m', 'only-merges', None, _('show only merges')), |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3166 |
('p', 'patch', None, _('show patch')), |
1920 | 3167 |
('', 'template', '', _('display with template')), |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3168 |
('I', 'include', [], _('include names matching the given patterns')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3169 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3170 |
_('hg log [OPTION]... [FILE]')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3171 |
"manifest": (manifest, [], _('hg manifest [REV]')), |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3172 |
"merge": |
2044
b343e7d454b4
Don't allow --style and --template for hg update and hg merge.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2043
diff
changeset
|
3173 |
(merge, |
b343e7d454b4
Don't allow --style and --template for hg update and hg merge.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2043
diff
changeset
|
3174 |
[('b', 'branch', '', _('merge with head of a specific branch')), |
b343e7d454b4
Don't allow --style and --template for hg update and hg merge.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2043
diff
changeset
|
3175 |
('f', 'force', None, _('force a merge with outstanding changes'))], |
b343e7d454b4
Don't allow --style and --template for hg update and hg merge.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2043
diff
changeset
|
3176 |
_('hg merge [-b TAG] [-f] [REV]')), |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
3177 |
"outgoing|out": (outgoing, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3178 |
[('M', 'no-merges', None, _('do not show merges')), |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3179 |
('f', 'force', None, |
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3180 |
_('run even when remote repository is unrelated')), |
1439
65cbe22b03fa
allow 'hg out' / 'hg in' to show newest commit first
Michal Kvasnica <kvasnica@gmail.com>
parents:
1437
diff
changeset
|
3181 |
('p', 'patch', None, _('show patch')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3182 |
('', 'style', '', _('display using template map file')), |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
3183 |
('r', 'rev', [], _('a specific revision you would like to push')), |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
3184 |
('n', 'newest-first', None, _('show newest record first')), |
1965
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
3185 |
('', 'template', '', _('display with template')), |
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
3186 |
('e', 'ssh', '', _('specify ssh command to use')), |
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
3187 |
('', 'remotecmd', '', |
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
3188 |
_('specify hg command to run on the remote side'))], |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
3189 |
_('hg outgoing [-M] [-p] [-n] [-r REV]... [DEST]')), |
1724
5a36609f73a7
add a -b/--branch option to 'hg parents'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1720
diff
changeset
|
3190 |
"^parents": |
5a36609f73a7
add a -b/--branch option to 'hg parents'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1720
diff
changeset
|
3191 |
(parents, |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
3192 |
[('b', 'branches', None, _('show branches')), |
2644
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
3193 |
('r', 'rev', '', _('show parents from the specified rev')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3194 |
('', 'style', '', _('display using template map file')), |
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3195 |
('', 'template', '', _('display with template'))], |
2644
b24efed24e8f
allow specifying a file to hg parents, change the syntax to use -r/--rev
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2626
diff
changeset
|
3196 |
_('hg parents [-b] [-r REV] [FILE]')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3197 |
"paths": (paths, [], _('hg paths [NAME]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3198 |
"^pull": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3199 |
(pull, |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3200 |
[('u', 'update', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3201 |
_('update the working directory to tip after pull')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3202 |
('e', 'ssh', '', _('specify ssh command to use')), |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3203 |
('f', 'force', None, |
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3204 |
_('run even when remote repository is unrelated')), |
1469 | 3205 |
('r', 'rev', [], _('a specific revision you would like to pull')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3206 |
('', 'remotecmd', '', |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3207 |
_('specify hg command to run on the remote side'))], |
2598
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
3208 |
_('hg pull [-u] [-r REV]... [-e FILE] [--remotecmd FILE] [SOURCE]')), |
818 | 3209 |
"^push": |
3210 |
(push, |
|
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3211 |
[('f', 'force', None, _('force push')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3212 |
('e', 'ssh', '', _('specify ssh command to use')), |
1781
284fc722c342
add an optional argument to push only the specified revisions (push -r)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1712
diff
changeset
|
3213 |
('r', 'rev', [], _('a specific revision you would like to push')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3214 |
('', 'remotecmd', '', |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3215 |
_('specify hg command to run on the remote side'))], |
2598
b898afee9d0d
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2597
diff
changeset
|
3216 |
_('hg push [-f] [-r REV]... [-e FILE] [--remotecmd FILE] [DEST]')), |
1818
9bbc7b304c34
Make the deprecated rawcommit an alias of debugrawcommit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1816
diff
changeset
|
3217 |
"debugrawcommit|rawcommit": |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3218 |
(rawcommit, |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3219 |
[('p', 'parent', [], _('parent')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3220 |
('d', 'date', '', _('date code')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3221 |
('u', 'user', '', _('user')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3222 |
('F', 'files', '', _('file list')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3223 |
('m', 'message', '', _('commit message')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3224 |
('l', 'logfile', '', _('commit message file'))], |
1818
9bbc7b304c34
Make the deprecated rawcommit an alias of debugrawcommit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1816
diff
changeset
|
3225 |
_('hg debugrawcommit [OPTION]... [FILE]...')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3226 |
"recover": (recover, [], _('hg recover')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3227 |
"^remove|rm": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3228 |
(remove, |
2245
d2118a0926bd
Added -A as an alias for --after to hg remove, like for other commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2241
diff
changeset
|
3229 |
[('A', 'after', None, _('record remove that has already occurred')), |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
3230 |
('f', 'force', None, _('remove file even if modified')), |
1869
42c76ec7a8d4
Reordered options for remove, fixed synopsis for rename.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1867
diff
changeset
|
3231 |
('I', 'include', [], _('include names matching the given patterns')), |
42c76ec7a8d4
Reordered options for remove, fixed synopsis for rename.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1867
diff
changeset
|
3232 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3233 |
_('hg remove [OPTION]... FILE...')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3234 |
"rename|mv": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3235 |
(rename, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3236 |
[('A', 'after', None, _('record a rename that has already occurred')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3237 |
('f', 'force', None, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3238 |
_('forcibly copy over an existing managed file')), |
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3239 |
('I', 'include', [], _('include names matching the given patterns')), |
2414
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
3240 |
('X', 'exclude', [], _('exclude names matching the given patterns')), |
2416
04736f38d74f
make description of -n option better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2415
diff
changeset
|
3241 |
('n', 'dry-run', None, _('do not perform actions, just print output'))], |
1869
42c76ec7a8d4
Reordered options for remove, fixed synopsis for rename.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1867
diff
changeset
|
3242 |
_('hg rename [OPTION]... SOURCE... DEST')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3243 |
"^revert": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3244 |
(revert, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3245 |
[('r', 'rev', '', _('revision to revert to')), |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
3246 |
('', 'no-backup', None, _('do not save backup copies of files')), |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
3247 |
('I', 'include', [], _('include names matching given patterns')), |
2415
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
3248 |
('X', 'exclude', [], _('exclude names matching given patterns')), |
2416
04736f38d74f
make description of -n option better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2415
diff
changeset
|
3249 |
('n', 'dry-run', None, _('do not perform actions, just print output'))], |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3250 |
_('hg revert [-r REV] [NAME]...')), |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
3251 |
"rollback": (rollback, [], _('hg rollback')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3252 |
"root": (root, [], _('hg root')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3253 |
"^serve": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3254 |
(serve, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3255 |
[('A', 'accesslog', '', _('name of access log file to write to')), |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
3256 |
('d', 'daemon', None, _('run server in background')), |
1742
1e5bb6c929cd
Added help string for --daemon-pipefds
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1741
diff
changeset
|
3257 |
('', 'daemon-pipefds', '', _('used internally by daemon mode')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3258 |
('E', 'errorlog', '', _('name of error log file to write to')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3259 |
('p', 'port', 0, _('port to use (default: 8000)')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3260 |
('a', 'address', '', _('address to use')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3261 |
('n', 'name', '', |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3262 |
_('name to show in web pages (default: working dir)')), |
2124
27fd8b7a6c51
Cleaned trailing whitespace in hgweb.py, removed command line shortcut for webdir-conf.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2122
diff
changeset
|
3263 |
('', 'webdir-conf', '', _('name of the webdir config file' |
27fd8b7a6c51
Cleaned trailing whitespace in hgweb.py, removed command line shortcut for webdir-conf.
Alexander Schremmer <alex AT alexanderweb DOT de>
parents:
2122
diff
changeset
|
3264 |
' (serve more than one repo)')), |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
3265 |
('', 'pid-file', '', _('name of file to write process ID to')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3266 |
('', 'stdio', None, _('for remote clients')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3267 |
('t', 'templates', '', _('web templates to use')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3268 |
('', 'style', '', _('template style to use')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3269 |
('6', 'ipv6', None, _('use IPv6 in addition to IPv4'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3270 |
_('hg serve [OPTION]...')), |
1507
cd8fadd8c689
Add explicit 'st' alias for status
Matt Mackall <mpm@selenic.com>
parents:
1506
diff
changeset
|
3271 |
"^status|st": |
840
141744605b51
hg status: added options to select files by status.
tksoh@users.sourceforge.net
parents:
839
diff
changeset
|
3272 |
(status, |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
3273 |
[('A', 'all', None, _('show status of all files')), |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
3274 |
('m', 'modified', None, _('show only modified files')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3275 |
('a', 'added', None, _('show only added files')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3276 |
('r', 'removed', None, _('show only removed files')), |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
3277 |
('d', 'deleted', None, _('show only deleted (but tracked) files')), |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
3278 |
('c', 'clean', None, _('show only files without changes')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3279 |
('u', 'unknown', None, _('show only unknown (not tracked) files')), |
2022
a59da8cc35e4
New option -i/--ignored for 'hg status' to show ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2020
diff
changeset
|
3280 |
('i', 'ignored', None, _('show ignored files')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3281 |
('n', 'no-status', None, _('hide status prefix')), |
2639
001703ec311d
Add an option '-C|--copies' to hg status to show the source of copied files.
Brendan Cully <brendan@kublai.com>
parents:
2630
diff
changeset
|
3282 |
('C', 'copies', None, _('show source of copied files')), |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3283 |
('0', 'print0', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3284 |
_('end filenames with NUL, for use with xargs')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3285 |
('I', 'include', [], _('include names matching the given patterns')), |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3286 |
('X', 'exclude', [], _('exclude names matching the given patterns'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3287 |
_('hg status [OPTION]... [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3288 |
"tag": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3289 |
(tag, |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3290 |
[('l', 'local', None, _('make the tag local')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3291 |
('m', 'message', '', _('message for tag commit log entry')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3292 |
('d', 'date', '', _('record datecode as commit date')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3293 |
('u', 'user', '', _('record user as commiter')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3294 |
('r', 'rev', '', _('revision to tag'))], |
1812
a81f99dfaa2a
fix the synopsis of some commands, mark rawcommit as deprecated in short help
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1811
diff
changeset
|
3295 |
_('hg tag [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3296 |
"tags": (tags, [], _('hg tags')), |
1762
8eaa8e06a364
Add option -b/--branch to hg tip (as done for hg parents).
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1761
diff
changeset
|
3297 |
"tip": |
8eaa8e06a364
Add option -b/--branch to hg tip (as done for hg parents).
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1761
diff
changeset
|
3298 |
(tip, |
1763
fa34a74efc40
Make option --branch vs. --branches more consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1762
diff
changeset
|
3299 |
[('b', 'branches', None, _('show branches')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3300 |
('', 'style', '', _('display using template map file')), |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
3301 |
('p', 'patch', None, _('show patch')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
3302 |
('', 'template', '', _('display with template'))], |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
3303 |
_('hg tip [-b] [-p]')), |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
3304 |
"unbundle": |
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
3305 |
(unbundle, |
1601
a1b25fb2e764
Error handling for unbundle, fix option line wrapping
Matt Mackall <mpm@selenic.com>
parents:
1600
diff
changeset
|
3306 |
[('u', 'update', None, |
a1b25fb2e764
Error handling for unbundle, fix option line wrapping
Matt Mackall <mpm@selenic.com>
parents:
1600
diff
changeset
|
3307 |
_('update the working directory to tip after unbundle'))], |
1600
728fd9584993
add --update support to 'hg unbundle'
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1596
diff
changeset
|
3308 |
_('hg unbundle [-u] FILE')), |
2241
abd70a92e06f
hide deprecated undo command by making it an alias for debugundo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2238
diff
changeset
|
3309 |
"debugundo|undo": (undo, [], _('hg undo')), |
593 | 3310 |
"^update|up|checkout|co": |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3311 |
(update, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3312 |
[('b', 'branch', '', _('checkout the head of a specific branch')), |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2272
diff
changeset
|
3313 |
('m', 'merge', None, _('allow merging of branches (DEPRECATED)')), |
1581
db10b7114de0
abort when merging two heads and repository has local changes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1571
diff
changeset
|
3314 |
('C', 'clean', None, _('overwrite locally modified files')), |
2044
b343e7d454b4
Don't allow --style and --template for hg update and hg merge.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2043
diff
changeset
|
3315 |
('f', 'force', None, _('force a merge with outstanding changes'))], |
1581
db10b7114de0
abort when merging two heads and repository has local changes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1571
diff
changeset
|
3316 |
_('hg update [-b TAG] [-m] [-C] [-f] [REV]')), |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3317 |
"verify": (verify, [], _('hg verify')), |
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3318 |
"version": (show_version, [], _('hg version')), |
1046
772507daaa17
Sort global options by topic: directories, ui, timing, other
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1044
diff
changeset
|
3319 |
} |
209 | 3320 |
|
1046
772507daaa17
Sort global options by topic: directories, ui, timing, other
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1044
diff
changeset
|
3321 |
globalopts = [ |
1894
4c53aaf2d153
Allow symbolic path names in global -R/--repository parameter.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1893
diff
changeset
|
3322 |
('R', 'repository', '', |
4c53aaf2d153
Allow symbolic path names in global -R/--repository parameter.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1893
diff
changeset
|
3323 |
_('repository root directory or symbolic path name')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3324 |
('', 'cwd', '', _('change working directory')), |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3325 |
('y', 'noninteractive', None, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3326 |
_('do not prompt, assume \'yes\' for any required answers')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3327 |
('q', 'quiet', None, _('suppress output')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3328 |
('v', 'verbose', None, _('enable additional output')), |
2293
3dc6f2501dbc
add --config global option. allows to set hgrc option on command line.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2287
diff
changeset
|
3329 |
('', 'config', [], _('set/override config option')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3330 |
('', 'debug', None, _('enable debugging output')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3331 |
('', 'debugger', None, _('start debugger')), |
2422
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3332 |
('', 'lsprof', None, _('print improved command execution profile')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3333 |
('', 'traceback', None, _('print traceback on exception')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3334 |
('', 'time', None, _('time how long the command takes')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3335 |
('', 'profile', None, _('print command execution profile')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3336 |
('', 'version', None, _('output version information and exit')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3337 |
('h', 'help', None, _('display help and exit')), |
1046
772507daaa17
Sort global options by topic: directories, ui, timing, other
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1044
diff
changeset
|
3338 |
] |
596 | 3339 |
|
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3340 |
norepo = ("clone init version help debugancestor debugcomplete debugdata" |
1858
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
3341 |
" debugindex debugindexdot") |
2127
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
3342 |
optionalrepo = ("paths serve debugconfig") |
209 | 3343 |
|
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3344 |
def findpossible(cmd): |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3345 |
""" |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3346 |
Return cmd -> (aliases, command table entry) |
2049
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3347 |
for each matching command. |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3348 |
Return debug commands (or their aliases) only if no normal command matches. |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3349 |
""" |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3350 |
choice = {} |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3351 |
debugchoice = {} |
212
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3352 |
for e in table.keys(): |
1506
11c8b81f95fe
if unambigious command name are passed, use them
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1505
diff
changeset
|
3353 |
aliases = e.lstrip("^").split("|") |
2049
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3354 |
found = None |
1506
11c8b81f95fe
if unambigious command name are passed, use them
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1505
diff
changeset
|
3355 |
if cmd in aliases: |
2049
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3356 |
found = cmd |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3357 |
else: |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3358 |
for a in aliases: |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3359 |
if a.startswith(cmd): |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3360 |
found = a |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3361 |
break |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3362 |
if found is not None: |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3363 |
if aliases[0].startswith("debug"): |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3364 |
debugchoice[found] = (aliases, table[e]) |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3365 |
else: |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
3366 |
choice[found] = (aliases, table[e]) |
1739
57de7e1a81d2
AmbiguousCommand is raised too soon.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
1736
diff
changeset
|
3367 |
|
1850
05f6c0d1bad8
Hide debug commands in ambiguous command list, unless no normal command matches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1849
diff
changeset
|
3368 |
if not choice and debugchoice: |
05f6c0d1bad8
Hide debug commands in ambiguous command list, unless no normal command matches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1849
diff
changeset
|
3369 |
choice = debugchoice |
05f6c0d1bad8
Hide debug commands in ambiguous command list, unless no normal command matches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1849
diff
changeset
|
3370 |
|
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3371 |
return choice |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3372 |
|
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3373 |
def findcmd(cmd): |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3374 |
"""Return (aliases, command table entry) for command string.""" |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3375 |
choice = findpossible(cmd) |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3376 |
|
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3377 |
if choice.has_key(cmd): |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3378 |
return choice[cmd] |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3379 |
|
1848
bb70ffebe77b
show choices on ambiguous commands
TK Soh <teekaysoh@yahoo.com>
parents:
1840
diff
changeset
|
3380 |
if len(choice) > 1: |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3381 |
clist = choice.keys() |
1849
360d0f8d9d6f
Show ambiguous aliases, if they are not simple abbreviations. Sort output.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1848
diff
changeset
|
3382 |
clist.sort() |
1848
bb70ffebe77b
show choices on ambiguous commands
TK Soh <teekaysoh@yahoo.com>
parents:
1840
diff
changeset
|
3383 |
raise AmbiguousCommand(cmd, clist) |
1739
57de7e1a81d2
AmbiguousCommand is raised too soon.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
1736
diff
changeset
|
3384 |
|
1517
b582dbc16165
Canonicalize command when using aliases or prefix matching.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1507
diff
changeset
|
3385 |
if choice: |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
3386 |
return choice.values()[0] |
212
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3387 |
|
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3388 |
raise UnknownCommand(cmd) |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3389 |
|
214 | 3390 |
def catchterm(*args): |
2153
635653cd73ab
move SignalInterrupt class into util module.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2140
diff
changeset
|
3391 |
raise util.SignalInterrupt |
214 | 3392 |
|
249 | 3393 |
def run(): |
3394 |
sys.exit(dispatch(sys.argv[1:])) |
|
3395 |
||
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3396 |
class ParseError(Exception): |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3397 |
"""Exception raised on errors in parsing the command line.""" |
592 | 3398 |
|
1453
6fbb13b7a59f
get command defaults from hgrc
TK Soh <teekaysoh@yahoo.com>
parents:
1447
diff
changeset
|
3399 |
def parse(ui, args): |
209 | 3400 |
options = {} |
596 | 3401 |
cmdoptions = {} |
209 | 3402 |
|
592 | 3403 |
try: |
596 | 3404 |
args = fancyopts.fancyopts(args, globalopts, options) |
592 | 3405 |
except fancyopts.getopt.GetoptError, inst: |
618
4051b78c53c7
Handle unrecognised options correctly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
617
diff
changeset
|
3406 |
raise ParseError(None, inst) |
209 | 3407 |
|
1047
a0538ea1ac50
Moved special handling of --version and no hg command from parse to dispatch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1046
diff
changeset
|
3408 |
if args: |
a0538ea1ac50
Moved special handling of --version and no hg command from parse to dispatch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1046
diff
changeset
|
3409 |
cmd, args = args[0], args[1:] |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3410 |
aliases, i = findcmd(cmd) |
1567
b4956bbbadc9
make command defaults works for aliases
TK Soh <teekaysoh@yahoo.com>
parents:
1565
diff
changeset
|
3411 |
cmd = aliases[0] |
1453
6fbb13b7a59f
get command defaults from hgrc
TK Soh <teekaysoh@yahoo.com>
parents:
1447
diff
changeset
|
3412 |
defaults = ui.config("defaults", cmd) |
6fbb13b7a59f
get command defaults from hgrc
TK Soh <teekaysoh@yahoo.com>
parents:
1447
diff
changeset
|
3413 |
if defaults: |
1526
c230939283c3
fix a bug where command defaults suppress global options
TK Soh <teekaysoh@yahoo.com>
parents:
1525
diff
changeset
|
3414 |
args = defaults.split() + args |
1047
a0538ea1ac50
Moved special handling of --version and no hg command from parse to dispatch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1046
diff
changeset
|
3415 |
c = list(i[1]) |
209 | 3416 |
else: |
1047
a0538ea1ac50
Moved special handling of --version and no hg command from parse to dispatch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1046
diff
changeset
|
3417 |
cmd = None |
a0538ea1ac50
Moved special handling of --version and no hg command from parse to dispatch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1046
diff
changeset
|
3418 |
c = [] |
209 | 3419 |
|
592 | 3420 |
# combine global options into local |
596 | 3421 |
for o in globalopts: |
592 | 3422 |
c.append((o[0], o[1], options[o[1]], o[3])) |
214 | 3423 |
|
293 | 3424 |
try: |
596 | 3425 |
args = fancyopts.fancyopts(args, c, cmdoptions) |
293 | 3426 |
except fancyopts.getopt.GetoptError, inst: |
596 | 3427 |
raise ParseError(cmd, inst) |
209 | 3428 |
|
592 | 3429 |
# separate global options back out |
596 | 3430 |
for o in globalopts: |
592 | 3431 |
n = o[1] |
3432 |
options[n] = cmdoptions[n] |
|
3433 |
del cmdoptions[n] |
|
3434 |
||
1047
a0538ea1ac50
Moved special handling of --version and no hg command from parse to dispatch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1046
diff
changeset
|
3435 |
return (cmd, cmd and i[0] or None, args, options, cmdoptions) |
596 | 3436 |
|
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3437 |
external = {} |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3438 |
|
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3439 |
def findext(name): |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3440 |
'''return module with given extension name''' |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3441 |
try: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3442 |
return sys.modules[external[name]] |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3443 |
except KeyError: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3444 |
for k, v in external.iteritems(): |
2755
6c2c10cedf7a
Check for parent/mod as well as parent.mod in findext.
Brendan Cully <brendan@kublai.com>
parents:
2743
diff
changeset
|
3445 |
if k.endswith('.' + name) or k.endswith('/' + name) or v == name: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3446 |
return sys.modules[v] |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
3447 |
raise KeyError(name) |
2600
c4325f0a9b91
clean up trailing white space.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2598
diff
changeset
|
3448 |
|
596 | 3449 |
def dispatch(args): |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
3450 |
for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
2092
1d3c6e63d703
catch SIGBREAK on windows.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2085
diff
changeset
|
3451 |
num = getattr(signal, name, None) |
1d3c6e63d703
catch SIGBREAK on windows.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2085
diff
changeset
|
3452 |
if num: signal.signal(num, catchterm) |
596 | 3453 |
|
1483
a4ba63e04134
Fix traceback on bad system hgrc files
Soh Tk-r28629 <tksoh@freescale.com>
parents:
1475
diff
changeset
|
3454 |
try: |
2166
d0c02b4dce9a
do not check sys.argv from localrepo when running hooks.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2160
diff
changeset
|
3455 |
u = ui.ui(traceback='--traceback' in sys.argv[1:]) |
1483
a4ba63e04134
Fix traceback on bad system hgrc files
Soh Tk-r28629 <tksoh@freescale.com>
parents:
1475
diff
changeset
|
3456 |
except util.Abort, inst: |
a4ba63e04134
Fix traceback on bad system hgrc files
Soh Tk-r28629 <tksoh@freescale.com>
parents:
1475
diff
changeset
|
3457 |
sys.stderr.write(_("abort: %s\n") % inst) |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3458 |
return -1 |
1483
a4ba63e04134
Fix traceback on bad system hgrc files
Soh Tk-r28629 <tksoh@freescale.com>
parents:
1475
diff
changeset
|
3459 |
|
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3460 |
for ext_name, load_from_name in u.extensions(): |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3461 |
try: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3462 |
if load_from_name: |
2405
4593d09e534d
pick a non-conflicting module name when loading an extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2400
diff
changeset
|
3463 |
# the module will be loaded in sys.modules |
4593d09e534d
pick a non-conflicting module name when loading an extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2400
diff
changeset
|
3464 |
# choose an unique name so that it doesn't |
4593d09e534d
pick a non-conflicting module name when loading an extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2400
diff
changeset
|
3465 |
# conflicts with other modules |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3466 |
module_name = "hgext_%s" % ext_name.replace('.', '_') |
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3467 |
mod = imp.load_source(module_name, load_from_name) |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3468 |
else: |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3469 |
def importh(name): |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3470 |
mod = __import__(name) |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3471 |
components = name.split('.') |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3472 |
for comp in components[1:]: |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3473 |
mod = getattr(mod, comp) |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3474 |
return mod |
1889
468730910353
Try to import extensions from the hgext module first.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1887
diff
changeset
|
3475 |
try: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3476 |
mod = importh("hgext.%s" % ext_name) |
1889
468730910353
Try to import extensions from the hgext module first.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1887
diff
changeset
|
3477 |
except ImportError: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3478 |
mod = importh(ext_name) |
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3479 |
external[ext_name] = mod.__name__ |
2428
42b8a1ff46cf
honor signals during load of extensions.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2422
diff
changeset
|
3480 |
except (util.SignalInterrupt, KeyboardInterrupt): |
42b8a1ff46cf
honor signals during load of extensions.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2422
diff
changeset
|
3481 |
raise |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3482 |
except Exception, inst: |
2617
0b4bff2b0ce3
fix bug introduced in b13a98bd078e
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2601
diff
changeset
|
3483 |
u.warn(_("*** failed to import extension %s: %s\n") % (ext_name, inst)) |
2335
f0680b2d1d64
add ui.print_exc(), make all traceback printing central.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2331
diff
changeset
|
3484 |
if u.print_exc(): |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3485 |
return 1 |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3486 |
|
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3487 |
for name in external.itervalues(): |
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3488 |
mod = sys.modules[name] |
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3489 |
uisetup = getattr(mod, 'uisetup', None) |
2330
b30aa02c85e7
add 'uisetup' function to extension module protocol.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2309
diff
changeset
|
3490 |
if uisetup: |
b30aa02c85e7
add 'uisetup' function to extension module protocol.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2309
diff
changeset
|
3491 |
uisetup(u) |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3492 |
cmdtable = getattr(mod, 'cmdtable', {}) |
1295
abcdf14449ea
Make contract with extensions optional.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1285
diff
changeset
|
3493 |
for t in cmdtable: |
1071 | 3494 |
if t in table: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3495 |
u.warn(_("module %s overrides %s\n") % (name, t)) |
1295
abcdf14449ea
Make contract with extensions optional.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1285
diff
changeset
|
3496 |
table.update(cmdtable) |
1071 | 3497 |
|
596 | 3498 |
try: |
1453
6fbb13b7a59f
get command defaults from hgrc
TK Soh <teekaysoh@yahoo.com>
parents:
1447
diff
changeset
|
3499 |
cmd, func, args, options, cmdoptions = parse(u, args) |
1875
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3500 |
if options["time"]: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3501 |
def get_times(): |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3502 |
t = os.times() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3503 |
if t[4] == 0.0: # Windows leaves this as zero, so use time.clock() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3504 |
t = (t[0], t[1], t[2], t[3], time.clock()) |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3505 |
return t |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3506 |
s = get_times() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3507 |
def print_time(): |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3508 |
t = get_times() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3509 |
u.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3510 |
(t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3511 |
atexit.register(print_time) |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3512 |
|
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3513 |
u.updateopts(options["verbose"], options["debug"], options["quiet"], |
2293
3dc6f2501dbc
add --config global option. allows to set hgrc option on command line.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2287
diff
changeset
|
3514 |
not options["noninteractive"], options["traceback"], |
3dc6f2501dbc
add --config global option. allows to set hgrc option on command line.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2287
diff
changeset
|
3515 |
options["config"]) |
1875
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3516 |
|
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3517 |
# enter the debugger before command execution |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3518 |
if options['debugger']: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3519 |
pdb.set_trace() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3520 |
|
527 | 3521 |
try: |
1859
39c46510ed25
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1858
diff
changeset
|
3522 |
if options['cwd']: |
39c46510ed25
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1858
diff
changeset
|
3523 |
try: |
39c46510ed25
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1858
diff
changeset
|
3524 |
os.chdir(options['cwd']) |
39c46510ed25
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1858
diff
changeset
|
3525 |
except OSError, inst: |
39c46510ed25
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1858
diff
changeset
|
3526 |
raise util.Abort('%s: %s' % |
39c46510ed25
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1858
diff
changeset
|
3527 |
(options['cwd'], inst.strerror)) |
39c46510ed25
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1858
diff
changeset
|
3528 |
|
1894
4c53aaf2d153
Allow symbolic path names in global -R/--repository parameter.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1893
diff
changeset
|
3529 |
path = u.expandpath(options["repository"]) or "" |
1859
39c46510ed25
Moved --cwd handling in front of -R handling again. Shorter code for initial -R.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1858
diff
changeset
|
3530 |
repo = path and hg.repository(u, path=path) or None |
1857
848152a2e67f
Always try to open the repository if -R/--repository is specified.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1851
diff
changeset
|
3531 |
|
1048
7fbb440b2e63
Added options -h/--help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1047
diff
changeset
|
3532 |
if options['help']: |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3533 |
return help_(u, cmd, options['version']) |
1048
7fbb440b2e63
Added options -h/--help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1047
diff
changeset
|
3534 |
elif options['version']: |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3535 |
return show_version(u) |
1047
a0538ea1ac50
Moved special handling of --version and no hg command from parse to dispatch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1046
diff
changeset
|
3536 |
elif not cmd: |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3537 |
return help_(u, 'shortlist') |
1047
a0538ea1ac50
Moved special handling of --version and no hg command from parse to dispatch.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1046
diff
changeset
|
3538 |
|
527 | 3539 |
if cmd not in norepo.split(): |
1858
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
3540 |
try: |
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
3541 |
if not repo: |
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
3542 |
repo = hg.repository(u, path=path) |
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
3543 |
u = repo.ui |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3544 |
for name in external.itervalues(): |
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3545 |
mod = sys.modules[name] |
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3546 |
if hasattr(mod, 'reposetup'): |
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
3547 |
mod.reposetup(u, repo) |
1858
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
3548 |
except hg.RepoError: |
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
3549 |
if cmd not in optionalrepo.split(): |
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
3550 |
raise |
596 | 3551 |
d = lambda: func(u, repo, *args, **cmdoptions) |
527 | 3552 |
else: |
596 | 3553 |
d = lambda: func(u, *args, **cmdoptions) |
209 | 3554 |
|
2716
4af4e1870fa0
reupdate the options after loading the repo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2673
diff
changeset
|
3555 |
# reupdate the options, repo/.hg/hgrc may have changed them |
4af4e1870fa0
reupdate the options after loading the repo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2673
diff
changeset
|
3556 |
u.updateopts(options["verbose"], options["debug"], options["quiet"], |
4af4e1870fa0
reupdate the options after loading the repo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2673
diff
changeset
|
3557 |
not options["noninteractive"], options["traceback"], |
4af4e1870fa0
reupdate the options after loading the repo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2673
diff
changeset
|
3558 |
options["config"]) |
4af4e1870fa0
reupdate the options after loading the repo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2673
diff
changeset
|
3559 |
|
1837
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3560 |
try: |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3561 |
if options['profile']: |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3562 |
import hotshot, hotshot.stats |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3563 |
prof = hotshot.Profile("hg.prof") |
1832
7a58bf789965
generate profile even when exception raised.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1823
diff
changeset
|
3564 |
try: |
7a58bf789965
generate profile even when exception raised.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1823
diff
changeset
|
3565 |
try: |
1837
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3566 |
return prof.runcall(d) |
1832
7a58bf789965
generate profile even when exception raised.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1823
diff
changeset
|
3567 |
except: |
1837
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3568 |
try: |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3569 |
u.warn(_('exception raised - generating ' |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3570 |
'profile anyway\n')) |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3571 |
except: |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3572 |
pass |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3573 |
raise |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3574 |
finally: |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3575 |
prof.close() |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3576 |
stats = hotshot.stats.load("hg.prof") |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3577 |
stats.strip_dirs() |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3578 |
stats.sort_stats('time', 'calls') |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3579 |
stats.print_stats(40) |
2422
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3580 |
elif options['lsprof']: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3581 |
try: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3582 |
from mercurial import lsprof |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3583 |
except ImportError: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3584 |
raise util.Abort(_( |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3585 |
'lsprof not available - install from ' |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3586 |
'http://codespeak.net/svn/user/arigo/hack/misc/lsprof/')) |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3587 |
p = lsprof.Profiler() |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3588 |
p.enable(subcalls=True) |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3589 |
try: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3590 |
return d() |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3591 |
finally: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3592 |
p.disable() |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3593 |
stats = lsprof.Stats(p.getstats()) |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3594 |
stats.sort() |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
3595 |
stats.pprint(top=10, file=sys.stderr, climit=5) |
1837
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3596 |
else: |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3597 |
return d() |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3598 |
finally: |
6f67a4c93493
make ui flush output. this makes error happen if printing to /dev/full.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1835
diff
changeset
|
3599 |
u.flush() |
527 | 3600 |
except: |
1225 | 3601 |
# enter the debugger when we hit an exception |
3602 |
if options['debugger']: |
|
3603 |
pdb.post_mortem(sys.exc_info()[2]) |
|
2335
f0680b2d1d64
add ui.print_exc(), make all traceback printing central.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2331
diff
changeset
|
3604 |
u.print_exc() |
527 | 3605 |
raise |
1875
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3606 |
except ParseError, inst: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3607 |
if inst.args[0]: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3608 |
u.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3609 |
help_(u, inst.args[0]) |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3610 |
else: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3611 |
u.warn(_("hg: %s\n") % inst.args[1]) |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3612 |
help_(u, 'shortlist') |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3613 |
except AmbiguousCommand, inst: |
1920 | 3614 |
u.warn(_("hg: command '%s' is ambiguous:\n %s\n") % |
1875
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3615 |
(inst.args[0], " ".join(inst.args[1]))) |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3616 |
except UnknownCommand, inst: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3617 |
u.warn(_("hg: unknown command '%s'\n") % inst.args[0]) |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
3618 |
help_(u, 'shortlist') |
499 | 3619 |
except hg.RepoError, inst: |
2134
ef81e34ad674
write to stderr with a single write call.
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2127
diff
changeset
|
3620 |
u.warn(_("abort: %s!\n") % inst) |
2016
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3621 |
except lock.LockHeld, inst: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3622 |
if inst.errno == errno.ETIMEDOUT: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3623 |
reason = _('timed out waiting for lock held by %s') % inst.locker |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3624 |
else: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3625 |
reason = _('lock held by %s') % inst.locker |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3626 |
u.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason)) |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3627 |
except lock.LockUnavailable, inst: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3628 |
u.warn(_("abort: could not lock %s: %s\n") % |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
3629 |
(inst.desc or inst.filename, inst.strerror)) |
1214 | 3630 |
except revlog.RevlogError, inst: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3631 |
u.warn(_("abort: "), inst, "!\n") |
2153
635653cd73ab
move SignalInterrupt class into util module.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2140
diff
changeset
|
3632 |
except util.SignalInterrupt: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3633 |
u.warn(_("killed!\n")) |
209 | 3634 |
except KeyboardInterrupt: |
832
b65773f7db41
Handle broken pipe on pressing Ctrl-C with e.g. 'hg log|grep something'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
818
diff
changeset
|
3635 |
try: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3636 |
u.warn(_("interrupted!\n")) |
832
b65773f7db41
Handle broken pipe on pressing Ctrl-C with e.g. 'hg log|grep something'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
818
diff
changeset
|
3637 |
except IOError, inst: |
b65773f7db41
Handle broken pipe on pressing Ctrl-C with e.g. 'hg log|grep something'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
818
diff
changeset
|
3638 |
if inst.errno == errno.EPIPE: |
b65773f7db41
Handle broken pipe on pressing Ctrl-C with e.g. 'hg log|grep something'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
818
diff
changeset
|
3639 |
if u.debugflag: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3640 |
u.warn(_("\nbroken pipe\n")) |
832
b65773f7db41
Handle broken pipe on pressing Ctrl-C with e.g. 'hg log|grep something'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
818
diff
changeset
|
3641 |
else: |
b65773f7db41
Handle broken pipe on pressing Ctrl-C with e.g. 'hg log|grep something'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
818
diff
changeset
|
3642 |
raise |
250 | 3643 |
except IOError, inst: |
395 | 3644 |
if hasattr(inst, "code"): |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3645 |
u.warn(_("abort: %s\n") % inst) |
395 | 3646 |
elif hasattr(inst, "reason"): |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3647 |
u.warn(_("abort: error: %s\n") % inst.reason[1]) |
395 | 3648 |
elif hasattr(inst, "args") and inst[0] == errno.EPIPE: |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3649 |
if u.debugflag: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3650 |
u.warn(_("broken pipe\n")) |
1350 | 3651 |
elif getattr(inst, "strerror", None): |
1354
8cf364c65425
Made the abort message for IOError nicer when the filename is known.
Eric Hopper <hopper@omnifarious.org>
parents:
1350
diff
changeset
|
3652 |
if getattr(inst, "filename", None): |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3653 |
u.warn(_("abort: %s - %s\n") % (inst.strerror, inst.filename)) |
1354
8cf364c65425
Made the abort message for IOError nicer when the filename is known.
Eric Hopper <hopper@omnifarious.org>
parents:
1350
diff
changeset
|
3654 |
else: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3655 |
u.warn(_("abort: %s\n") % inst.strerror) |
250 | 3656 |
else: |
3657 |
raise |
|
549 | 3658 |
except OSError, inst: |
3659 |
if hasattr(inst, "filename"): |
|
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3660 |
u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
549 | 3661 |
else: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3662 |
u.warn(_("abort: %s\n") % inst.strerror) |
870
a82eae840447
Teach walk code about absolute paths.
Bryan O'Sullivan <bos@serpentine.com>
parents:
868
diff
changeset
|
3663 |
except util.Abort, inst: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3664 |
u.warn(_('abort: '), inst.args[0] % inst.args[1:], '\n') |
212
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3665 |
except TypeError, inst: |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3666 |
# was this an argument error? |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3667 |
tb = traceback.extract_tb(sys.exc_info()[2]) |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3668 |
if len(tb) > 2: # no |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3669 |
raise |
293 | 3670 |
u.debug(inst, "\n") |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3671 |
u.warn(_("%s: invalid arguments\n") % cmd) |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3672 |
help_(u, cmd) |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3673 |
except SystemExit, inst: |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3674 |
# Commands shouldn't sys.exit directly, but give a return code. |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3675 |
# Just in case catch this and and pass exit code to caller. |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3676 |
return inst.code |
1215
8b4435aae40a
Add reporting instructions to unknown exception backtraces
mpm@selenic.com
parents:
1214
diff
changeset
|
3677 |
except: |
1402
9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1400
diff
changeset
|
3678 |
u.warn(_("** unknown exception encountered, details follow\n")) |
2625
70d65ca6d893
mention the bts for bug reporting in traceback message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2617
diff
changeset
|
3679 |
u.warn(_("** report bug details to " |
70d65ca6d893
mention the bts for bug reporting in traceback message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2617
diff
changeset
|
3680 |
"http://www.selenic.com/mercurial/bts\n")) |
70d65ca6d893
mention the bts for bug reporting in traceback message
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2617
diff
changeset
|
3681 |
u.warn(_("** or mercurial@selenic.com\n")) |
1552
7509fa02437f
Added version information to "report bug" message for unknown exceptions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1551
diff
changeset
|
3682 |
u.warn(_("** Mercurial Distributed SCM (version %s)\n") |
7509fa02437f
Added version information to "report bug" message for unknown exceptions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1551
diff
changeset
|
3683 |
% version.get_version()) |
1215
8b4435aae40a
Add reporting instructions to unknown exception backtraces
mpm@selenic.com
parents:
1214
diff
changeset
|
3684 |
raise |
293 | 3685 |
|
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3686 |
return -1 |