Mercurial > hg
annotate mercurial/commands.py @ 3748:7b88bd88f040
Fix test-rename-dir-merge for different implementations of ls.
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 01 Dec 2006 15:40:23 +0100 |
parents | ad3d5b4367cb |
children | 1861fa38a6a7 |
rev | line source |
---|---|
249 | 1 # commands.py - command processing for mercurial |
2 # | |
2859 | 3 # Copyright 2005, 2006 Matt Mackall <mpm@selenic.com> |
249 | 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 _ |
3629
4cfb72bcb978
util: add copyfile function
Matt Mackall <mpm@selenic.com>
parents:
3628
diff
changeset
|
11 demandload(globals(), "os re sys signal imp urllib pdb shlex") |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
12 demandload(globals(), "fancyopts ui hg util lock revlog bundlerepo") |
3659
025f68f22ae2
move write_bundle to changegroup.py
Matt Mackall <mpm@selenic.com>
parents:
3658
diff
changeset
|
13 demandload(globals(), "difflib patch time") |
3660
8500a13ec44b
create a readbundle function
Matt Mackall <mpm@selenic.com>
parents:
3659
diff
changeset
|
14 demandload(globals(), "traceback errno version atexit") |
3627 | 15 demandload(globals(), "archival changegroup cmdutil hgweb.server sshserver") |
209 | 16 |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
17 class UnknownCommand(Exception): |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
18 """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
|
19 class AmbiguousCommand(Exception): |
ac4ca6bf2383
Improved error message for ambiguous command shortcuts.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1517
diff
changeset
|
20 """Exception raised if command shortcut matches more than one command.""" |
209 | 21 |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
22 def bail_if_changed(repo): |
2875
3d6efcbbd1c9
remove localrepository.changes.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2874
diff
changeset
|
23 modified, added, removed, deleted = repo.status()[:4] |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
24 if modified or added or removed or deleted: |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
25 raise util.Abort(_("outstanding uncommitted changes")) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
26 |
2799
bd8a9a94139f
commands.logmessage: simplify calling.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2789
diff
changeset
|
27 def logmessage(opts): |
2694
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
28 """ 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
|
29 message = opts['message'] |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
30 logfile = opts['logfile'] |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
31 |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
32 if message and logfile: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
33 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
|
34 'exclusive')) |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
35 if not message and logfile: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
36 try: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
37 if logfile == '-': |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
38 message = sys.stdin.read() |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
39 else: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
40 message = open(logfile).read() |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
41 except IOError, inst: |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
42 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
|
43 (logfile, inst.strerror)) |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
44 return message |
0fb28dbf0dc7
MQ: uniformise message and logfile option.
"Mathieu Clabaut <mathieu.clabaut@gmail.com>"
parents:
2673
diff
changeset
|
45 |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
46 def setremoteconfig(ui, opts): |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
47 "copy remote options to ui tree" |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
48 if opts.get('ssh'): |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
49 ui.setconfig("ui", "ssh", opts['ssh']) |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
50 if opts.get('remotecmd'): |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
51 ui.setconfig("ui", "remotecmd", opts['remotecmd']) |
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
52 |
255 | 53 # Commands start here, listed alphabetically |
209 | 54 |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
55 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
|
56 """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
|
57 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
58 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
|
59 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
60 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
|
61 |
1568
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
62 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
|
63 """ |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
64 |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
65 names = [] |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
66 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts): |
942
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
67 if exact: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
68 if ui.verbose: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
69 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
|
70 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
|
71 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
|
72 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
|
73 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
|
74 if not opts.get('dry_run'): |
2411
734df6333ca4
add: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2410
diff
changeset
|
75 repo.add(names) |
213 | 76 |
766
b444a7e053f1
Get addremove to use new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
764
diff
changeset
|
77 def addremove(ui, repo, *pats, **opts): |
3181
3637d5d17cbc
Documentation fixes for addremove.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3172
diff
changeset
|
78 """add all new files, delete all missing files |
2181
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
79 |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
80 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
|
81 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
82 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
|
83 with add, these changes take effect at the next commit. |
2958
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
84 |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
85 Use the -s option to detect renamed files. With a parameter > 0, |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
86 this compares every removed file with every added file and records |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
87 those similar enough as renames. This option takes a percentage |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
88 between 0 (disabled) and 100 (files must be identical) as its |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
89 parameter. Detecting renamed files this way can be expensive. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
90 """ |
2958
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
91 sim = float(opts.get('similarity') or 0) |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
92 if sim < 0 or sim > 100: |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
93 raise util.Abort(_('similarity must be between 0 and 100')) |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
94 return cmdutil.addremove(repo, pats, opts, similarity=sim/100.) |
219
8ff4532376a4
hg checkout: refuse to checkout if there are outstanding changes
mpm@selenic.com
parents:
214
diff
changeset
|
95 |
733
1966c553f652
Convert annotate over to walk interface.
Bryan O'Sullivan <bos@serpentine.com>
parents:
732
diff
changeset
|
96 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
|
97 """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
|
98 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
99 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
|
100 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
101 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
|
102 place. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
103 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
104 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
|
105 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
|
106 anyway, probably with undesirable results. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
107 """ |
3146
e69a0cbe268e
filectx.annotate: return filectx for each line instead of rev
Brendan Cully <brendan@kublai.com>
parents:
3132
diff
changeset
|
108 getdate = util.cachefunc(lambda x: util.datestr(x.date())) |
1522 | 109 |
744 | 110 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
|
111 raise util.Abort(_('at least one file name or pattern required')) |
744 | 112 |
3146
e69a0cbe268e
filectx.annotate: return filectx for each line instead of rev
Brendan Cully <brendan@kublai.com>
parents:
3132
diff
changeset
|
113 opmap = [['user', lambda x: ui.shortuser(x.user())], |
3403
372999405787
Back out d8eba1c3ce9b and a004164dbeef
Brendan Cully <brendan@kublai.com>
parents:
3402
diff
changeset
|
114 ['number', lambda x: str(x.rev())], |
3146
e69a0cbe268e
filectx.annotate: return filectx for each line instead of rev
Brendan Cully <brendan@kublai.com>
parents:
3132
diff
changeset
|
115 ['changeset', lambda x: short(x.node())], |
3172
5c93dd0ae413
Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents:
3159
diff
changeset
|
116 ['date', getdate], ['follow', lambda x: x.path()]] |
5c93dd0ae413
Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents:
3159
diff
changeset
|
117 if (not opts['user'] and not opts['changeset'] and not opts['date'] |
5c93dd0ae413
Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents:
3159
diff
changeset
|
118 and not opts['follow']): |
714
29fcd195e056
Some cleanups in commands.annotate().
Thomas Arendsen Hein <thomas@intevation.de>
parents:
712
diff
changeset
|
119 opts['number'] = 1 |
209 | 120 |
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
121 ctx = repo.changectx(opts['rev']) |
1016 | 122 |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
123 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, |
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
124 node=ctx.node()): |
2566
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
125 fctx = ctx.filectx(abs) |
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
126 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
|
127 ui.write(_("%s: binary file\n") % ((pats and rel) or abs)) |
1016 | 128 continue |
129 | |
3172
5c93dd0ae413
Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents:
3159
diff
changeset
|
130 lines = fctx.annotate(follow=opts.get('follow')) |
209 | 131 pieces = [] |
132 | |
133 for o, f in opmap: | |
714
29fcd195e056
Some cleanups in commands.annotate().
Thomas Arendsen Hein <thomas@intevation.de>
parents:
712
diff
changeset
|
134 if opts[o]: |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
135 l = [f(n) for n, dummy in lines] |
771 | 136 if l: |
137 m = max(map(len, l)) | |
138 pieces.append(["%*s" % (m, x) for x in l]) | |
209 | 139 |
771 | 140 if pieces: |
141 for p, l in zip(zip(*pieces), lines): | |
142 ui.write("%s: %s" % (" ".join(p), l[1])) | |
209 | 143 |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
144 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
|
145 '''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
|
146 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
147 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
|
148 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
|
149 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
150 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
|
151 types are: |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
152 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
153 "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
|
154 "tar": tar archive, uncompressed |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
155 "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
|
156 "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
|
157 "uzip": zip archive, uncompressed |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
158 "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
|
159 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
160 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
|
161 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
|
162 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
163 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
|
164 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
|
165 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
|
166 ''' |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
167 |
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
168 node = repo.changectx(opts['rev']).node() |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
169 dest = cmdutil.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
|
170 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
|
171 raise util.Abort(_('repository root cannot be destination')) |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
172 dummy, matchfn, dummy = cmdutil.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
|
173 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
|
174 prefix = opts['prefix'] |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
175 if dest == '-': |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
176 if kind == 'files': |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
177 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
|
178 dest = sys.stdout |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
179 if not prefix: prefix = os.path.basename(repo.root) + '-%h' |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
180 prefix = cmdutil.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
|
181 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
|
182 matchfn, prefix) |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
183 |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
184 def backout(ui, repo, rev, **opts): |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
185 '''reverse effect of earlier changeset |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
186 |
2254
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
187 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
|
188 changeset is a child of the backed out changeset. |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
189 |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
190 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
|
191 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
|
192 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
|
193 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
|
194 with another head. |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
195 |
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
196 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
|
197 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
|
198 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
|
199 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
|
200 merge.''' |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
201 |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
202 bail_if_changed(repo) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
203 op1, op2 = repo.dirstate.parents() |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
204 if op2 != nullid: |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
205 raise util.Abort(_('outstanding uncommitted merge')) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
206 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
|
207 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
|
208 if p1 == nullid: |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
209 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
|
210 if p2 != nullid: |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
211 if not opts['parent']: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
212 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
|
213 '--parent')) |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
214 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
|
215 if p not in (p1, p2): |
3679
2956948b81f3
fix warnings generated by pygettext.py.
Marcos Chaves <marcos.nospam@gmail.com>
parents:
3673
diff
changeset
|
216 raise util.Abort(_('%s is not a parent of %s') % |
3680
69cf255a55a1
Indentation cleanups for 2956948b81f3.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3679
diff
changeset
|
217 (short(p), short(node))) |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
218 parent = p |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
219 else: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
220 if opts['parent']: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
221 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
|
222 parent = p1 |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
223 hg.clean(repo, node, show_stats=False) |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
224 revert_opts = opts.copy() |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
225 revert_opts['all'] = True |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
226 revert_opts['rev'] = hex(parent) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
227 revert(ui, repo, **revert_opts) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
228 commit_opts = opts.copy() |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
229 commit_opts['addremove'] = False |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
230 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
|
231 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
|
232 commit_opts['force_editor'] = True |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
233 commit(ui, repo, **commit_opts) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
234 def nice(node): |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
235 return '%d:%s' % (repo.changelog.rev(node), short(node)) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
236 ui.status(_('changeset %s backs out changeset %s\n') % |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
237 (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
|
238 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
|
239 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
|
240 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
|
241 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
|
242 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
|
243 else: |
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
244 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
|
245 '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
|
246 ui.status(_('(use "backout --merge" ' |
0aa458261901
fix hg backup option recommendation for auto-merge
Christian Ebert <blacktrash@gmx.net>
parents:
2760
diff
changeset
|
247 'if you want to auto-merge)\n')) |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
248 |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
249 def branch(ui, repo, label=None): |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
250 """set or show the current branch name |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
251 |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
252 With <name>, set the current branch name. Otherwise, show the |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
253 current branch name. |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
254 """ |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
255 |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
256 if label is not None: |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
257 repo.opener("branch", "w").write(label) |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
258 else: |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
259 b = repo.workingctx().branch() |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
260 if b: |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
261 ui.write("%s\n" % b) |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
262 |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
263 def branches(ui, repo): |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
264 """list repository named branches |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
265 |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
266 List the repository's named branches. |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
267 """ |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
268 b = repo.branchtags() |
3673
eb0b4a2d70a9
white space and line break cleanups
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3672
diff
changeset
|
269 l = [(-repo.changelog.rev(n), n, t) for t, n in b.items()] |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
270 l.sort() |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
271 for r, n, t in l: |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
272 hexfunc = ui.debugflag and hex or short |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
273 if ui.quiet: |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
274 ui.write("%s\n" % t) |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
275 else: |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
276 ui.write("%-30s %s:%s\n" % (t, -r, hexfunc(n))) |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
277 |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
278 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
|
279 """create a changegroup file |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
280 |
3511
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
281 Generate a compressed changegroup file collecting changesets not |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
282 found in the other repository. |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
283 |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
284 If no destination repository is specified the destination is assumed |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
285 to have all the nodes specified by one or more --base parameters. |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
286 |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
287 The bundle file can then be transferred using conventional means and |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
288 applied to another repository with the unbundle or pull command. |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
289 This is useful when direct push and pull are not available or when |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
290 exporting an entire repository is undesirable. |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
291 |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
292 Applying bundles preserves all changeset contents including |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
293 permissions, copy/rename information, and revision history. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
294 """ |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
295 revs = opts.get('rev') or None |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
296 if revs: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
297 revs = [repo.lookup(rev) for rev in revs] |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
298 base = opts.get('base') |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
299 if base: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
300 if dest: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
301 raise util.Abort(_("--base is incompatible with specifiying " |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
302 "a destination")) |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
303 base = [repo.lookup(rev) for rev in base] |
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
304 # create the right base |
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
305 # XXX: nodesbetween / changegroup* should be "fixed" instead |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
306 o = [] |
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
307 has = {nullid: None} |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
308 for n in base: |
3631 | 309 has.update(repo.changelog.reachable(n)) |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
310 if revs: |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
311 visit = list(revs) |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
312 else: |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
313 visit = repo.changelog.heads() |
3631 | 314 seen = {} |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
315 while visit: |
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
316 n = visit.pop(0) |
3631 | 317 parents = [p for p in repo.changelog.parents(n) if p not in has] |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
318 if len(parents) == 0: |
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
319 o.insert(0, n) |
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
320 else: |
3512
630e0b216192
fix graph traversal in commands.bundle (it wasn't O(n))
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3511
diff
changeset
|
321 for p in parents: |
630e0b216192
fix graph traversal in commands.bundle (it wasn't O(n))
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3511
diff
changeset
|
322 if p not in seen: |
3631 | 323 seen[p] = 1 |
3512
630e0b216192
fix graph traversal in commands.bundle (it wasn't O(n))
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3511
diff
changeset
|
324 visit.append(p) |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
325 else: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
326 setremoteconfig(ui, opts) |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
327 dest = ui.expandpath(dest or 'default-push', dest or 'default') |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
328 other = hg.repository(ui, dest) |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
329 o = repo.findoutgoing(other, force=opts['force']) |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
330 |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
331 if revs: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
332 cg = repo.changegroupsubset(o, revs, 'bundle') |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
333 else: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
334 cg = repo.changegroup(o, 'bundle') |
3704
9c1737a3e254
fix writebundle for bz2 bundles
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3680
diff
changeset
|
335 changegroup.writebundle(cg, fname, "HG10BZ") |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
336 |
1254
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
337 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
|
338 """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
|
339 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
340 Print the specified files as they were at the given revision. |
3095
25857e00af8e
cat: default to working dir parent instead of tip
Brendan Cully <brendan@kublai.com>
parents:
3090
diff
changeset
|
341 If no revision is given then working dir parent is used, or tip |
25857e00af8e
cat: default to working dir parent instead of tip
Brendan Cully <brendan@kublai.com>
parents:
3090
diff
changeset
|
342 if no revision is checked out. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
343 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
344 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
|
345 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
|
346 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
|
347 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
348 %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
|
349 %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
|
350 %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
|
351 """ |
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
352 ctx = repo.changectx(opts['rev']) |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
353 for src, abs, rel, exact in cmdutil.walk(repo, (file1,) + pats, opts, |
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
354 ctx.node()): |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
355 fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs) |
2565
7f78ca2c7977
convert hg cat to new context api
Matt Mackall <mpm@selenic.com>
parents:
2562
diff
changeset
|
356 fp.write(ctx.filectx(abs).data()) |
248 | 357 |
698
df78d8ccac4c
Use python function instead of external 'cp' command when cloning repos.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
697
diff
changeset
|
358 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
|
359 """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
|
360 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
361 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
|
362 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
363 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
|
364 basename of the source. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
365 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
366 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
|
367 .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
|
368 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
369 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
|
370 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
|
371 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
|
372 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
|
373 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
|
374 avoid hardlinking. |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
375 |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
376 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
|
377 hardlinks with |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
378 |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
379 $ cp -al REPO REPOCLONE |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
380 |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
381 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
|
382 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
|
383 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
|
384 (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
|
385 |
2764
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
386 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
|
387 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
|
388 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
|
389 |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
390 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
|
391 |
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
392 It is possible to specify an ssh:// URL as the destination, but no |
3583
8ee579885d23
doc: clone doesn't create a working directory in remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3578
diff
changeset
|
393 .hg/hgrc and working directory will be created on the remote side. |
8ee579885d23
doc: clone doesn't create a working directory in remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3578
diff
changeset
|
394 Look at the help text for the pull command for important details |
8ee579885d23
doc: clone doesn't create a working directory in remote repos
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3578
diff
changeset
|
395 about ssh:// URLs. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
396 """ |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
397 setremoteconfig(ui, opts) |
2597
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
398 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
|
399 pull=opts['pull'], |
2620
de82749d3a71
clone: change name of --stream to --uncompressed.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2618
diff
changeset
|
400 stream=opts['uncompressed'], |
2597
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
401 rev=opts['rev'], |
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
402 update=not opts['noupdate']) |
515 | 403 |
813
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
404 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
|
405 """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
|
406 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
407 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
|
408 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
409 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
|
410 will be committed. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
411 |
1996
4c70b10f0418
Don't mention deprecated HGEDITOR variable in the help text of commit.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1995
diff
changeset
|
412 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
|
413 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
|
414 """ |
2799
bd8a9a94139f
commands.logmessage: simplify calling.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2789
diff
changeset
|
415 message = logmessage(opts) |
289 | 416 |
354 | 417 if opts['addremove']: |
2883
c2932ad5476a
move commands.addremove_lock to cmdutil.addremove
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2882
diff
changeset
|
418 cmdutil.addremove(repo, pats, opts) |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
419 fns, match, anypats = cmdutil.matchpats(repo, pats, opts) |
813
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
420 if pats: |
3663
b4903debbe3b
abort if explicitly committed files are not found or not tracked
Matt Mackall <mpm@selenic.com>
parents:
3662
diff
changeset
|
421 status = repo.status(files=fns, match=match) |
b4903debbe3b
abort if explicitly committed files are not found or not tracked
Matt Mackall <mpm@selenic.com>
parents:
3662
diff
changeset
|
422 modified, added, removed, deleted, unknown = status[:5] |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
423 files = modified + added + removed |
3663
b4903debbe3b
abort if explicitly committed files are not found or not tracked
Matt Mackall <mpm@selenic.com>
parents:
3662
diff
changeset
|
424 for f in fns: |
b4903debbe3b
abort if explicitly committed files are not found or not tracked
Matt Mackall <mpm@selenic.com>
parents:
3662
diff
changeset
|
425 if f not in modified + added + removed: |
b4903debbe3b
abort if explicitly committed files are not found or not tracked
Matt Mackall <mpm@selenic.com>
parents:
3662
diff
changeset
|
426 if f in unknown: |
b4903debbe3b
abort if explicitly committed files are not found or not tracked
Matt Mackall <mpm@selenic.com>
parents:
3662
diff
changeset
|
427 raise util.Abort(_("file %s not tracked!") % f) |
b4903debbe3b
abort if explicitly committed files are not found or not tracked
Matt Mackall <mpm@selenic.com>
parents:
3662
diff
changeset
|
428 else: |
b4903debbe3b
abort if explicitly committed files are not found or not tracked
Matt Mackall <mpm@selenic.com>
parents:
3662
diff
changeset
|
429 raise util.Abort(_("file %s not found!") % f) |
813
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
430 else: |
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
431 files = [] |
1202
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
432 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
|
433 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
|
434 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
|
435 except ValueError, inst: |
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
436 raise util.Abort(str(inst)) |
245 | 437 |
1822
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
438 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
|
439 # called with the repo lock held |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
440 # |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
441 # hgsep => pathname that uses "/" to separate directories |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
442 # ossep => pathname that uses os.sep to separate directories |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
443 cwd = repo.getcwd() |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
444 errors = 0 |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
445 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
|
446 targets = {} |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
447 |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
448 # abs: hgsep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
449 # rel: ossep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
450 # return: hgsep |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
451 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
|
452 reasons = {'?': _('is not managed'), |
1634
f49f602fae92
copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents:
1633
diff
changeset
|
453 'a': _('has been marked for add'), |
f49f602fae92
copy & rename can ignore removed source files
Robin Farine <robin.farine@terminus.org>
parents:
1633
diff
changeset
|
454 'r': _('has been marked for remove')} |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
455 state = repo.dirstate.state(abs) |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
456 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
|
457 if reason: |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
458 if state == 'a': |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
459 origsrc = repo.dirstate.copied(abs) |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
460 if origsrc is not None: |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
461 return origsrc |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
462 if exact: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
463 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
|
464 else: |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
465 return abs |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
466 |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
467 # origsrc: hgsep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
468 # abssrc: hgsep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
469 # relsrc: ossep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
470 # target: ossep |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
471 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
|
472 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
|
473 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
|
474 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
|
475 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
|
476 ui.warn(_('%s: not overwriting - %s collides with %s\n') % |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
477 (reltarget, util.localpath(abssrc), |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
478 util.localpath(prevsrc))) |
1514
faf46d810a85
avoid to copy more than one file to the same destination file
Robin Farine <robin.farine@terminus.org>
parents:
1513
diff
changeset
|
479 return |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
480 if (not opts['after'] and os.path.exists(reltarget) or |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
481 opts['after'] and repo.dirstate.state(abstarget) not in '?r'): |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
482 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
|
483 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
|
484 reltarget) |
5c3b93b244aa
copy & rename don't overwrite unless --force is specified
Robin Farine <robin.farine@terminus.org>
parents:
1512
diff
changeset
|
485 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
|
486 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
|
487 os.unlink(reltarget) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
488 if opts['after']: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
489 if not os.path.exists(reltarget): |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
490 return |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
491 else: |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
492 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
|
493 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
|
494 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
|
495 try: |
1822
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
496 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
|
497 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
|
498 repo.undelete([abstarget], wlock) |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
499 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
|
500 if not opts.get('dry_run'): |
3629
4cfb72bcb978
util: add copyfile function
Matt Mackall <mpm@selenic.com>
parents:
3628
diff
changeset
|
501 util.copyfile(relsrc, reltarget) |
1822
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
502 restore = False |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
503 finally: |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
504 if restore: |
64df4220b349
copy/rename to a removed destination file
Robin Farine <robin.farine@terminus.org>
parents:
1812
diff
changeset
|
505 repo.remove([abstarget], wlock) |
1249
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
506 except IOError, inst: |
a5355fa5e33a
Fix up copy command to behave more like regular "cp".
Bryan O'Sullivan <bos@serpentine.com>
parents:
1247
diff
changeset
|
507 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
|
508 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
|
509 else: |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
510 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
|
511 (relsrc, inst.strerror)) |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
512 errors += 1 |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
513 return |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
514 if ui.verbose or not exact: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
515 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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
521 # pat: ossep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
522 # dest ossep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
523 # srcs: list of (hgsep, hgsep, ossep, bool) |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
524 # return: function that takes hgsep and returns ossep |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
525 def targetpathfn(pat, dest, srcs): |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
526 if os.path.isdir(pat): |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
527 abspfx = util.canonpath(repo.root, cwd, pat) |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
528 abspfx = util.localpath(abspfx) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
529 if destdirexists: |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
530 striplen = len(os.path.split(abspfx)[0]) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
531 else: |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
532 striplen = len(abspfx) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
533 if striplen: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
534 striplen += len(os.sep) |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
535 res = lambda p: os.path.join(dest, util.localpath(p)[striplen:]) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
536 elif destdirexists: |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
537 res = lambda p: os.path.join(dest, |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
538 os.path.basename(util.localpath(p))) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
539 else: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
540 res = lambda p: dest |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
541 return res |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
542 |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
543 # pat: ossep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
544 # dest ossep |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
545 # srcs: list of (hgsep, hgsep, ossep, bool) |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
546 # return: function that takes hgsep and returns ossep |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
547 def targetpathafterfn(pat, dest, srcs): |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
548 if util.patkind(pat, None)[0]: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
549 # a mercurial pattern |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
550 res = lambda p: os.path.join(dest, |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
551 os.path.basename(util.localpath(p))) |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
552 else: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
553 abspfx = util.canonpath(repo.root, cwd, pat) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
554 if len(abspfx) < len(srcs[0][0]): |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
555 # A directory. Either the target path contains the last |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
556 # component of the source path or it does not. |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
557 def evalpath(striplen): |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
558 score = 0 |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
559 for s in srcs: |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
560 t = os.path.join(dest, util.localpath(s[0])[striplen:]) |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
561 if os.path.exists(t): |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
562 score += 1 |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
563 return score |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
564 |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
565 abspfx = util.localpath(abspfx) |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
566 striplen = len(abspfx) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
567 if striplen: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
568 striplen += len(os.sep) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
569 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
|
570 score = evalpath(striplen) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
571 striplen1 = len(os.path.split(abspfx)[0]) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
572 if striplen1: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
573 striplen1 += len(os.sep) |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
574 if evalpath(striplen1) > score: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
575 striplen = striplen1 |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
576 res = lambda p: os.path.join(dest, |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
577 util.localpath(p)[striplen:]) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
578 else: |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
579 # a file |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
580 if destdirexists: |
3670
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
581 res = lambda p: os.path.join(dest, |
d2d8d23944a9
commands.docopy: pay attention on whether paths use "/" or os.sep
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3645
diff
changeset
|
582 os.path.basename(util.localpath(p))) |
1633
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
583 else: |
94c179a92f4a
copy/rename '.' or '..' correctly
Robin Farine <robin.farine@terminus.org>
parents:
1626
diff
changeset
|
584 res = lambda p: dest |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
585 return res |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
586 |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
587 |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
588 pats = list(pats) |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
589 if not pats: |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
590 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
|
591 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
|
592 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
|
593 dest = pats.pop() |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
594 destdirexists = os.path.isdir(dest) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
595 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
|
596 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
|
597 'existing directory')) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
598 if opts['after']: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
599 tfn = targetpathafterfn |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
600 else: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
601 tfn = targetpathfn |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
602 copylist = [] |
1512
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
603 for pat in pats: |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
604 srcs = [] |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
605 for tag, abssrc, relsrc, exact in cmdutil.walk(repo, [pat], opts): |
1747
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
606 origsrc = okaytocopy(abssrc, relsrc, exact) |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
607 if origsrc: |
91c56c427171
transitive copy/rename
Robin Farine <robin.farine@terminus.org>
parents:
1743
diff
changeset
|
608 srcs.append((origsrc, abssrc, relsrc, exact)) |
1565
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
609 if not srcs: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
610 continue |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
611 copylist.append((tfn(pat, dest, srcs), srcs)) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
612 if not copylist: |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
613 raise util.Abort(_('no files to copy')) |
4bcbc126b80b
fix rename --after
Robin Farine <robin.farine@terminus.org>
parents:
1561
diff
changeset
|
614 |
2414
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
615 for targetpath, srcs in copylist: |
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
616 for origsrc, abssrc, relsrc, exact in srcs: |
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
617 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
|
618 |
53ad6ee6ede4
generalize copy/rename to handle more than one source directory
Robin Farine <robin.farine@terminus.org>
parents:
1507
diff
changeset
|
619 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
|
620 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
|
621 return errors, copied |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
622 |
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
623 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
|
624 """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
|
625 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
626 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
|
627 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
|
628 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
|
629 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
630 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
|
631 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
|
632 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
|
633 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
634 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
|
635 """ |
2016
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
636 wlock = repo.wlock(0) |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
637 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
|
638 return errs |
363 | 639 |
1262 | 640 def debugancestor(ui, index, rev1, rev2): |
641 """find the ancestor revision of two revisions in a given index""" | |
2072 | 642 r = revlog.revlog(util.opener(os.getcwd(), audit=False), index, "", 0) |
1262 | 643 a = r.ancestor(r.lookup(rev1), r.lookup(rev2)) |
644 ui.write("%d:%s\n" % (r.rev(a), hex(a))) | |
645 | |
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
|
646 def debugcomplete(ui, cmd='', **opts): |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
647 """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
|
648 |
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
649 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
|
650 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
|
651 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
|
652 if cmd: |
2988
63c3a1921a67
Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2983
diff
changeset
|
653 aliases, entry = findcmd(ui, 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
|
654 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
|
655 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
|
656 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
|
657 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
|
658 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
|
659 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
|
660 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
|
661 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
|
662 |
2988
63c3a1921a67
Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2983
diff
changeset
|
663 clist = findpossible(ui, cmd).keys() |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
664 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
|
665 ui.write("%s\n" % "\n".join(clist)) |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
666 |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
667 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
|
668 """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
|
669 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
|
670 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
|
671 else: |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
672 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
|
673 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
|
674 n = change[0] |
2840
046a8b03ea59
Change remaining users of manifest flags
Matt Mackall <mpm@selenic.com>
parents:
2836
diff
changeset
|
675 files = repo.manifest.read(n) |
1760
13f8e068d13c
fix typo in debugrebuildstate
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1755
diff
changeset
|
676 wlock = repo.wlock() |
2840
046a8b03ea59
Change remaining users of manifest flags
Matt Mackall <mpm@selenic.com>
parents:
2836
diff
changeset
|
677 repo.dirstate.rebuild(rev, files) |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
678 |
596 | 679 def debugcheckstate(ui, repo): |
680 """validate the correctness of the current dirstate""" | |
460 | 681 parent1, parent2 = repo.dirstate.parents() |
555 | 682 repo.dirstate.read() |
683 dc = repo.dirstate.map | |
460 | 684 keys = dc.keys() |
685 keys.sort() | |
686 m1n = repo.changelog.read(parent1)[0] | |
687 m2n = repo.changelog.read(parent2)[0] | |
688 m1 = repo.manifest.read(m1n) | |
689 m2 = repo.manifest.read(m2n) | |
690 errors = 0 | |
691 for f in dc: | |
692 state = repo.dirstate.state(f) | |
693 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
|
694 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
460 | 695 errors += 1 |
696 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
|
697 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
460 | 698 errors += 1 |
699 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
|
700 ui.warn(_("%s in state %s, but not in either manifest\n") % |
582 | 701 (f, state)) |
460 | 702 errors += 1 |
703 for f in m1: | |
704 state = repo.dirstate.state(f) | |
705 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
|
706 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
460 | 707 errors += 1 |
708 if errors: | |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
709 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
|
710 raise util.Abort(error) |
460 | 711 |
3553
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
712 def showconfig(ui, repo, *values, **opts): |
2410
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
713 """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
|
714 |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
715 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
|
716 |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
717 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
|
718 that config item. |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
719 |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
720 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
|
721 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
|
722 |
3553
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
723 untrusted = bool(opts.get('untrusted')) |
2410
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
724 if values: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
725 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
|
726 raise util.Abort(_('only one config item permitted')) |
3553
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
727 for section, name, value in ui.walkconfig(untrusted=untrusted): |
2410
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
728 sectname = section + '.' + name |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
729 if values: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
730 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
|
731 if v == section: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
732 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
|
733 elif v == sectname: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
734 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
|
735 else: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
736 ui.write('%s=%s\n' % (sectname, value)) |
1028
25e7ea0f2cff
Add commands.debugconfig.
Bryan O'Sullivan <bos@serpentine.com>
parents:
989
diff
changeset
|
737 |
1395
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
738 def debugsetparents(ui, repo, rev1, rev2=None): |
1470
fb9b84c91222
minor fix on command help docstrings
TK Soh <teekaysoh@yahoo.com>
parents:
1469
diff
changeset
|
739 """manually set the parents of the current working directory |
1395
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
740 |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
741 This is useful for writing repository conversion tools, but should |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
742 be used with care. |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
743 """ |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
744 |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
745 if not rev2: |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
746 rev2 = hex(nullid) |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
747 |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
748 repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2)) |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
749 |
596 | 750 def debugstate(ui, repo): |
751 """show the contents of the current dirstate""" | |
555 | 752 repo.dirstate.read() |
753 dc = repo.dirstate.map | |
460 | 754 keys = dc.keys() |
755 keys.sort() | |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
756 for file_ in keys: |
791
040655ea0cc4
Show all dirstate info for 'hg debugstate'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
770
diff
changeset
|
757 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
|
758 % (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
|
759 time.strftime("%x %X", |
040655ea0cc4
Show all dirstate info for 'hg debugstate'.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
770
diff
changeset
|
760 time.localtime(dc[file_][3])), file_)) |
3159
e43fd1623fe1
fix users of dirstate.copies broken by b1f10d3223c1
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3146
diff
changeset
|
761 for f in repo.dirstate.copies(): |
e43fd1623fe1
fix users of dirstate.copies broken by b1f10d3223c1
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3146
diff
changeset
|
762 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
460 | 763 |
1039
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
764 def debugdata(ui, file_, rev): |
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
765 """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
|
766 r = revlog.revlog(util.opener(os.getcwd(), audit=False), |
2072 | 767 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
|
768 try: |
1cc7c0cbc30b
Fix traceback during invalid rev identifier for debugdata
Anupam Kapoor<anupam.kapoor@gmail.com>
parents:
1312
diff
changeset
|
769 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
|
770 except KeyError: |
3072
bc3fe3b5b785
Never apply string formatting to generated errors with util.Abort.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3071
diff
changeset
|
771 raise util.Abort(_('invalid revision identifier %s') % rev) |
1039
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
772 |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
773 def debugindex(ui, file_): |
596 | 774 """dump the contents of an index file""" |
2072 | 775 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) |
582 | 776 ui.write(" rev offset length base linkrev" + |
989 | 777 " nodeid p1 p2\n") |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
778 for i in xrange(r.count()): |
2072 | 779 node = r.node(i) |
780 pp = r.parents(node) | |
989 | 781 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( |
2072 | 782 i, r.start(i), r.length(i), r.base(i), r.linkrev(node), |
783 short(node), short(pp[0]), short(pp[1]))) | |
248 | 784 |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
785 def debugindexdot(ui, file_): |
596 | 786 """dump an index DAG as a .dot file""" |
2072 | 787 r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_, "", 0) |
582 | 788 ui.write("digraph G {\n") |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
789 for i in xrange(r.count()): |
2287
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
790 node = r.node(i) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
791 pp = r.parents(node) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
792 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
|
793 if pp[1] != nullid: |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
794 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
582 | 795 ui.write("}\n") |
248 | 796 |
3652 | 797 def debugrename(ui, repo, file1, *pats, **opts): |
1194
c165cbf56bb1
Add doc string for debugrename.
bos@serpentine.internal.keyresearch.com
parents:
1193
diff
changeset
|
798 """dump rename information""" |
3652 | 799 |
800 ctx = repo.changectx(opts.get('rev', 'tip')) | |
801 for src, abs, rel, exact in cmdutil.walk(repo, (file1,) + pats, opts, | |
802 ctx.node()): | |
803 m = ctx.filectx(abs).renamed() | |
804 if m: | |
805 ui.write(_("%s renamed from %s:%s\n") % (rel, m[0], hex(m[1]))) | |
806 else: | |
807 ui.write(_("%s not renamed\n") % rel) | |
1116 | 808 |
820
89985a1b3427
Clean up walk and changes code to use normalised names properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
815
diff
changeset
|
809 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
|
810 """show how files match on given patterns""" |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
811 items = list(cmdutil.walk(repo, pats, opts)) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
812 if not items: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
813 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
|
814 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
|
815 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
|
816 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
|
817 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
|
818 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
|
819 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
|
820 |
732
ba0b6d17a6de
Convert diff command over to using walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
731
diff
changeset
|
821 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
|
822 """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
|
823 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
824 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
|
825 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
826 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
|
827 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
828 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
|
829 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
|
830 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
|
831 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
|
832 to its parent. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
833 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
834 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
|
835 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
|
836 probably with undesirable results. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
837 """ |
3707
67f44b825784
Removed unused ui parameter from revpair/revrange and fix its users.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3706
diff
changeset
|
838 node1, node2 = cmdutil.revpair(repo, opts['rev']) |
245 | 839 |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
840 fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
1014 | 841 |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
842 patch.diff(repo, node1, node2, fns, match=matchfn, |
2888
3848488244fc
Move ui.diffopts to patch.diffopts where it belongs
Matt Mackall <mpm@selenic.com>
parents:
2883
diff
changeset
|
843 opts=patch.diffopts(ui, opts)) |
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
|
844 |
580 | 845 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
|
846 """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
|
847 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
848 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
|
849 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
850 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
|
851 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
|
852 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
853 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
|
854 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
|
855 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
856 %% literal "%" character |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
857 %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
|
858 %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
|
859 %R changeset revision number |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
860 %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
|
861 %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
|
862 %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
|
863 %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
|
864 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
865 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
|
866 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
|
867 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
|
868 |
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
869 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
|
870 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
|
871 """ |
610
4c02464cb9f0
check export options for changeset before running
shaleh@speakeasy.net
parents:
609
diff
changeset
|
872 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
|
873 raise util.Abort(_("export requires at least one changeset")) |
3707
67f44b825784
Removed unused ui parameter from revpair/revrange and fix its users.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3706
diff
changeset
|
874 revs = cmdutil.revrange(repo, changesets) |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
875 if len(revs) > 1: |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
876 ui.note(_('exporting patches:\n')) |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
877 else: |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
878 ui.note(_('exporting patch:\n')) |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
879 patch.export(repo, map(repo.lookup, revs), template=opts['output'], |
2888
3848488244fc
Move ui.diffopts to patch.diffopts where it belongs
Matt Mackall <mpm@selenic.com>
parents:
2883
diff
changeset
|
880 switch_parent=opts['switch_parent'], |
3848488244fc
Move ui.diffopts to patch.diffopts where it belongs
Matt Mackall <mpm@selenic.com>
parents:
2883
diff
changeset
|
881 opts=patch.diffopts(ui, opts)) |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
882 |
1108
7a75d8fbbdaf
Remove some options from 'hg grep':
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1106
diff
changeset
|
883 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
|
884 """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
|
885 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
886 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
|
887 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
888 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
|
889 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
|
890 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
|
891 a match appears. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
892 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
893 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
|
894 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
|
895 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
|
896 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
|
897 use the --all flag. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
898 """ |
1057 | 899 reflags = 0 |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
900 if opts['ignore_case']: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
901 reflags |= re.I |
1057 | 902 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
|
903 sep, eol = ':', '\n' |
1108
7a75d8fbbdaf
Remove some options from 'hg grep':
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1106
diff
changeset
|
904 if opts['print0']: |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
905 sep = eol = '\0' |
1057 | 906 |
907 fcache = {} | |
908 def getfile(fn): | |
909 if fn not in fcache: | |
910 fcache[fn] = repo.file(fn) | |
911 return fcache[fn] | |
912 | |
913 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
|
914 begin = 0 |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
915 linenum = 0 |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
916 while True: |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
917 match = regexp.search(body, begin) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
918 if not match: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
919 break |
1059
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
920 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
|
921 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
|
922 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
|
923 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
|
924 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
|
925 begin = lend + 1 |
1057 | 926 |
1559
59b3639df0a9
Convert all classes to new-style classes by deriving them from object.
Eric Hopper <hopper@omnifarious.org>
parents:
1552
diff
changeset
|
927 class linestate(object): |
1057 | 928 def __init__(self, line, linenum, colstart, colend): |
929 self.line = line | |
930 self.linenum = linenum | |
931 self.colstart = colstart | |
932 self.colend = colend | |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
933 |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
934 def __eq__(self, other): |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
935 return self.line == other.line |
1057 | 936 |
937 matches = {} | |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
938 copies = {} |
1057 | 939 def grepbody(fn, rev, body): |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
940 matches[rev].setdefault(fn, []) |
1057 | 941 m = matches[rev][fn] |
942 for lnum, cstart, cend, line in matchlines(body): | |
943 s = linestate(line, lnum, cstart, cend) | |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
944 m.append(s) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
945 |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
946 def difflinestates(a, b): |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
947 sm = difflib.SequenceMatcher(None, a, b) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
948 for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
949 if tag == 'insert': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
950 for i in xrange(blo, bhi): |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
951 yield ('+', b[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
952 elif tag == 'delete': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
953 for i in xrange(alo, ahi): |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
954 yield ('-', a[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
955 elif tag == 'replace': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
956 for i in xrange(alo, ahi): |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
957 yield ('-', a[i]) |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
958 for i in xrange(blo, bhi): |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
959 yield ('+', b[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
960 |
1057 | 961 prev = {} |
962 def display(fn, rev, states, prevstates): | |
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
963 counts = {'-': 0, '+': 0} |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
964 filerevmatches = {} |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
965 if incrementing or not opts['all']: |
3523 | 966 a, b, r = prevstates, states, rev |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
967 else: |
3523 | 968 a, b, r = states, prevstates, prev.get(fn, -1) |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
969 for change, l in difflinestates(a, b): |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
970 cols = [fn, str(r)] |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
971 if opts['line_number']: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
972 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
|
973 if opts['all']: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
974 cols.append(change) |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
975 if opts['user']: |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
976 cols.append(ui.shortuser(get(r)[1])) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
977 if opts['files_with_matches']: |
3523 | 978 c = (fn, r) |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
979 if c in filerevmatches: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
980 continue |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
981 filerevmatches[c] = 1 |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
982 else: |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
983 cols.append(l.line) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
984 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
|
985 counts[change] += 1 |
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
986 return counts['+'], counts['-'] |
1057 | 987 |
988 fstate = {} | |
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
989 skip = {} |
3673
eb0b4a2d70a9
white space and line break cleanups
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3672
diff
changeset
|
990 get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
991 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
992 count = 0 |
1337
d4b25df77a9e
Fix up some bugs for log and grep with empty repo
mpm@selenic.com
parents:
1331
diff
changeset
|
993 incrementing = False |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
994 follow = opts.get('follow') |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
995 for st, rev, fns in changeiter: |
1057 | 996 if st == 'window': |
997 incrementing = rev | |
998 matches.clear() | |
999 elif st == 'add': | |
3530
cd2216599c99
minor hg grep simplification
Matt Mackall <mpm@selenic.com>
parents:
3527
diff
changeset
|
1000 mf = repo.changectx(rev).manifest() |
1057 | 1001 matches[rev] = {} |
1002 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
|
1003 if fn in skip: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1004 continue |
1057 | 1005 fstate.setdefault(fn, {}) |
1006 try: | |
1007 grepbody(fn, rev, getfile(fn).read(mf[fn])) | |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1008 if follow: |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1009 copied = getfile(fn).renamed(mf[fn]) |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1010 if copied: |
2931 | 1011 copies.setdefault(rev, {})[fn] = copied[0] |
1057 | 1012 except KeyError: |
1013 pass | |
1014 elif st == 'iter': | |
1015 states = matches[rev].items() | |
1016 states.sort() | |
1017 for fn, m in states: | |
2931 | 1018 copy = copies.get(rev, {}).get(fn) |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1019 if fn in skip: |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1020 if copy: |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1021 skip[copy] = True |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1022 continue |
1212 | 1023 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
|
1024 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
|
1025 count += pos + neg |
1212 | 1026 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
|
1027 skip[fn] = True |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1028 if copy: |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1029 skip[copy] = True |
1057 | 1030 fstate[fn] = m |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1031 if copy: |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1032 fstate[copy] = m |
1057 | 1033 prev[fn] = rev |
1034 | |
1035 if not incrementing: | |
1036 fstate = fstate.items() | |
1037 fstate.sort() | |
1038 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
|
1039 if fn in skip: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1040 continue |
2931 | 1041 if fn not in copies.get(prev[fn], {}): |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1042 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
|
1043 return (count == 0 and 1) or 0 |
1057 | 1044 |
898 | 1045 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
|
1046 """show current repository heads |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1047 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1048 Show all repository head changesets. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1049 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1050 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
|
1051 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
|
1052 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
|
1053 """ |
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
|
1054 if opts['rev']: |
1551
e793cbc8be00
Fixes to "hg heads -r FOO":
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1550
diff
changeset
|
1055 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
|
1056 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
|
1057 heads = repo.heads() |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
1058 displayer = cmdutil.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
|
1059 for n in heads: |
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
1060 displayer.show(changenode=n) |
221 | 1061 |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1062 def help_(ui, name=None, with_version=False): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1063 """show help for a command, extension, or list of commands |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1064 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1065 With no arguments, print a list of commands and short help. |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1066 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1067 Given a command name, print help for that command. |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1068 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1069 Given an extension name, print help for that extension, and the |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1070 commands it provides.""" |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1071 option_lists = [] |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1072 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1073 def helpcmd(name): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1074 if with_version: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1075 version_(ui) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1076 ui.write('\n') |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1077 aliases, i = findcmd(ui, name) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1078 # synopsis |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1079 ui.write("%s\n\n" % i[2]) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1080 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1081 # description |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1082 doc = i[0].__doc__ |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1083 if not doc: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1084 doc = _("(No help text available)") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1085 if ui.quiet: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1086 doc = doc.splitlines(0)[0] |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1087 ui.write("%s\n" % doc.rstrip()) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1088 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1089 if not ui.quiet: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1090 # aliases |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1091 if len(aliases) > 1: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1092 ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:])) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1093 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1094 # options |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1095 if i[1]: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1096 option_lists.append(("options", i[1])) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1097 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1098 def helplist(select=None): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1099 h = {} |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1100 cmds = {} |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1101 for c, e in table.items(): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1102 f = c.split("|", 1)[0] |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1103 if select and not select(f): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1104 continue |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1105 if name == "shortlist" and not f.startswith("^"): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1106 continue |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1107 f = f.lstrip("^") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1108 if not ui.debugflag and f.startswith("debug"): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1109 continue |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1110 doc = e[0].__doc__ |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1111 if not doc: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1112 doc = _("(No help text available)") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1113 h[f] = doc.splitlines(0)[0].rstrip() |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1114 cmds[f] = c.lstrip("^") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1115 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1116 fns = h.keys() |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1117 fns.sort() |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1118 m = max(map(len, fns)) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1119 for f in fns: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1120 if ui.verbose: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1121 commands = cmds[f].replace("|",", ") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1122 ui.write(" %s:\n %s\n"%(commands, h[f])) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1123 else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1124 ui.write(' %-*s %s\n' % (m, f, h[f])) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1125 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1126 def helpext(name): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1127 try: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1128 mod = findext(name) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1129 except KeyError: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1130 raise UnknownCommand(name) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1131 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1132 doc = (mod.__doc__ or _('No help text available')).splitlines(0) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1133 ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0])) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1134 for d in doc[1:]: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1135 ui.write(d, '\n') |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1136 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1137 ui.status('\n') |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1138 if ui.verbose: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1139 ui.status(_('list of commands:\n\n')) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1140 else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1141 ui.status(_('list of commands (use "hg help -v %s" ' |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1142 'to show aliases and global options):\n\n') % name) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1143 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1144 modcmds = dict.fromkeys([c.split('|', 1)[0] for c in mod.cmdtable]) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1145 helplist(modcmds.has_key) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1146 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1147 if name and name != 'shortlist': |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1148 try: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1149 helpcmd(name) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1150 except UnknownCommand: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1151 helpext(name) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1152 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1153 else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1154 # program name |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1155 if ui.verbose or with_version: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1156 version_(ui) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1157 else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1158 ui.status(_("Mercurial Distributed SCM\n")) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1159 ui.status('\n') |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1160 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1161 # list of commands |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1162 if name == "shortlist": |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1163 ui.status(_('basic commands (use "hg help" ' |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1164 'for the full list or option "-v" for details):\n\n')) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1165 elif ui.verbose: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1166 ui.status(_('list of commands:\n\n')) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1167 else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1168 ui.status(_('list of commands (use "hg help -v" ' |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1169 'to show aliases and global options):\n\n')) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1170 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1171 helplist() |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1172 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1173 # global options |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1174 if ui.verbose: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1175 option_lists.append(("global options", globalopts)) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1176 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1177 # list all option lists |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1178 opt_output = [] |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1179 for title, options in option_lists: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1180 opt_output.append(("\n%s:\n" % title, None)) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1181 for shortopt, longopt, default, desc in options: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1182 if "DEPRECATED" in desc and not ui.verbose: continue |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1183 opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt, |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1184 longopt and " --%s" % longopt), |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1185 "%s%s" % (desc, |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1186 default |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1187 and _(" (default: %s)") % default |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1188 or ""))) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1189 |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1190 if opt_output: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1191 opts_len = max([len(line[0]) for line in opt_output if line[1]]) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1192 for first, second in opt_output: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1193 if second: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1194 ui.write(" %-*s %s\n" % (opts_len, first, second)) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1195 else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1196 ui.write("%s\n" % first) |
221 | 1197 |
339
a76fc9c4b67b
added hg identify|id (based on a patch from Andrew Thompson)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
338
diff
changeset
|
1198 def identify(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1199 """print information about the working copy |
1470
fb9b84c91222
minor fix on command help docstrings
TK Soh <teekaysoh@yahoo.com>
parents:
1469
diff
changeset
|
1200 |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1201 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
|
1202 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1203 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
|
1204 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
|
1205 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
|
1206 """ |
1092 | 1207 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
|
1208 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
|
1209 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
|
1210 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
|
1211 |
2966
fb493241d7f6
Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents:
2963
diff
changeset
|
1212 hexfunc = ui.debugflag and hex or short |
2875
3d6efcbbd1c9
remove localrepository.changes.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2874
diff
changeset
|
1213 modified, added, removed, deleted = repo.status()[:4] |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
1214 output = ["%s%s" % |
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
1215 ('+'.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
|
1216 (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
|
1217 |
339
a76fc9c4b67b
added hg identify|id (based on a patch from Andrew Thompson)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
338
diff
changeset
|
1218 if not ui.quiet: |
3415 | 1219 |
1220 branch = repo.workingctx().branch() | |
1221 if branch: | |
1222 output.append("(%s)" % branch) | |
1223 | |
386
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1224 # multiple tags for a single parent separated by '/' |
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1225 parenttags = ['/'.join(tags) |
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1226 for tags in map(repo.nodetags, parents) if tags] |
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1227 # 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
|
1228 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
|
1229 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
|
1230 |
386
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1231 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
|
1232 |
437 | 1233 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
|
1234 """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
|
1235 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1236 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
|
1237 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1238 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
|
1239 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
|
1240 |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1241 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
|
1242 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
|
1243 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
|
1244 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
|
1245 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
|
1246 message. |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1247 |
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1248 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
|
1249 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
|
1250 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
|
1251 |
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1252 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
|
1253 """ |
437 | 1254 patches = (patch1,) + patches |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
1255 |
966
022bcc738389
hg import: abort with uncommitted changes, override with --force
mpm@selenic.com
parents:
965
diff
changeset
|
1256 if not opts['force']: |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
1257 bail_if_changed(repo) |
966
022bcc738389
hg import: abort with uncommitted changes, override with --force
mpm@selenic.com
parents:
965
diff
changeset
|
1258 |
437 | 1259 d = opts["base"] |
1260 strip = opts["strip"] | |
1261 | |
2854
7706fa503677
import: get lock and wlock one time
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2847
diff
changeset
|
1262 wlock = repo.wlock() |
7706fa503677
import: get lock and wlock one time
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2847
diff
changeset
|
1263 lock = repo.lock() |
7706fa503677
import: get lock and wlock one time
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2847
diff
changeset
|
1264 |
2861
0f08f2c042ec
Move patch-related code into its own module.
Brendan Cully <brendan@kublai.com>
parents:
2860
diff
changeset
|
1265 for p in patches: |
0f08f2c042ec
Move patch-related code into its own module.
Brendan Cully <brendan@kublai.com>
parents:
2860
diff
changeset
|
1266 pf = os.path.join(d, p) |
437 | 1267 |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1268 if pf == '-': |
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1269 ui.status(_("applying patch from stdin\n")) |
2866
2893e51407a4
commands.import: refactor patch parsing into patch.extract.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2865
diff
changeset
|
1270 tmpname, message, user, date = patch.extract(ui, sys.stdin) |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1271 else: |
2861
0f08f2c042ec
Move patch-related code into its own module.
Brendan Cully <brendan@kublai.com>
parents:
2860
diff
changeset
|
1272 ui.status(_("applying %s\n") % p) |
2866
2893e51407a4
commands.import: refactor patch parsing into patch.extract.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2865
diff
changeset
|
1273 tmpname, message, user, date = patch.extract(ui, file(pf)) |
2893e51407a4
commands.import: refactor patch parsing into patch.extract.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2865
diff
changeset
|
1274 |
2893e51407a4
commands.import: refactor patch parsing into patch.extract.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2865
diff
changeset
|
1275 if tmpname is None: |
2893e51407a4
commands.import: refactor patch parsing into patch.extract.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2865
diff
changeset
|
1276 raise util.Abort(_('no diffs found')) |
2893e51407a4
commands.import: refactor patch parsing into patch.extract.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2865
diff
changeset
|
1277 |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1278 try: |
2458
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1279 if opts['message']: |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1280 # pickup the cmdline msg |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1281 message = opts['message'] |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1282 elif message: |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1283 # pickup the patch msg |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1284 message = message.strip() |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1285 else: |
2458
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1286 # launch the editor |
9dd93deef3c9
change log message creation when using 'hg import'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2428
diff
changeset
|
1287 message = None |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1288 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
|
1289 |
3465
2d35a8d2b32d
patch: return list of modified files even when an exception is raised
Brendan Cully <brendan@kublai.com>
parents:
3460
diff
changeset
|
1290 files = {} |
2d35a8d2b32d
patch: return list of modified files even when an exception is raised
Brendan Cully <brendan@kublai.com>
parents:
3460
diff
changeset
|
1291 try: |
2d35a8d2b32d
patch: return list of modified files even when an exception is raised
Brendan Cully <brendan@kublai.com>
parents:
3460
diff
changeset
|
1292 fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root, |
2d35a8d2b32d
patch: return list of modified files even when an exception is raised
Brendan Cully <brendan@kublai.com>
parents:
3460
diff
changeset
|
1293 files=files) |
2d35a8d2b32d
patch: return list of modified files even when an exception is raised
Brendan Cully <brendan@kublai.com>
parents:
3460
diff
changeset
|
1294 finally: |
2d35a8d2b32d
patch: return list of modified files even when an exception is raised
Brendan Cully <brendan@kublai.com>
parents:
3460
diff
changeset
|
1295 files = patch.updatedir(ui, repo, files, wlock=wlock) |
2854
7706fa503677
import: get lock and wlock one time
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2847
diff
changeset
|
1296 repo.commit(files, message, user, date, wlock=wlock, lock=lock) |
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1297 finally: |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1298 os.unlink(tmpname) |
437 | 1299 |
1192
6e165de907c5
Add -p to incoming and outgoing commands to show patch
TK Soh <teekaysoh@yahoo.com>
parents:
1191
diff
changeset
|
1300 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
|
1301 """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
|
1302 |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1303 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
|
1304 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
|
1305 was requested. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1306 |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1307 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
|
1308 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
|
1309 |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1310 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
|
1311 """ |
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
|
1312 source = ui.expandpath(source) |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
1313 setremoteconfig(ui, opts) |
1965
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
1314 |
927
5a830d7bea52
Add hg incoming command for local repositories
mpm@selenic.com
parents:
924
diff
changeset
|
1315 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
|
1316 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
|
1317 if not incoming: |
1993
fb6ca9801d04
show message if no changes found on incoming
TK Soh <teekaysoh@yahoo.com>
parents:
1981
diff
changeset
|
1318 ui.status(_("no changes found\n")) |
931 | 1319 return |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1320 |
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1321 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
|
1322 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
|
1323 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
|
1324 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
|
1325 # 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
|
1326 cg = other.changegroup(incoming, "incoming") |
3706
0d810798acb1
Use 'bundletype' instead of 'type' to not shadow built-in function.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3704
diff
changeset
|
1327 bundletype = other.local() and "HG10BZ" or "HG10UN" |
0d810798acb1
Use 'bundletype' instead of 'type' to not shadow built-in function.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3704
diff
changeset
|
1328 fname = cleanup = changegroup.writebundle(cg, fname, bundletype) |
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
|
1329 # 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
|
1330 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
|
1331 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
|
1332 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
|
1333 # 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
|
1334 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
|
1335 |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1336 revs = None |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1337 if opts['rev']: |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1338 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
|
1339 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
|
1340 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
|
1341 o.reverse() |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
1342 displayer = cmdutil.show_changeset(ui, other, opts) |
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
|
1343 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
|
1344 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
|
1345 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
|
1346 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
|
1347 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
|
1348 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
|
1349 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
|
1350 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
|
1351 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
|
1352 os.unlink(cleanup) |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1353 |
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
|
1354 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
|
1355 """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
|
1356 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1357 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
|
1358 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
|
1359 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1360 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
|
1361 |
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1362 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
|
1363 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
|
1364 about ssh:// URLs. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1365 """ |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
1366 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
|
1367 hg.repository(ui, dest, create=1) |
338 | 1368 |
627 | 1369 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
|
1370 """locate files matching specific patterns |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1371 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1372 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
|
1373 given patterns. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1374 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1375 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
|
1376 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
|
1377 of the repository. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1378 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1379 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
|
1380 names. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1381 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1382 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
|
1383 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
|
1384 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
|
1385 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
|
1386 """ |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1387 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
|
1388 rev = opts['rev'] |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1389 if rev: |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1390 node = repo.lookup(rev) |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1391 else: |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1392 node = None |
742 | 1393 |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1394 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node, |
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1395 head='(?:.*/|)'): |
1622
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1396 if not node and repo.dirstate.state(abs) == '?': |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1397 continue |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
1398 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
|
1399 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
|
1400 else: |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
1401 ui.write(((pats and rel) or abs), end) |
627 | 1402 |
1031
503aaf19a040
Rewrite log command. New version is faster and more featureful.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1030
diff
changeset
|
1403 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
|
1404 """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
|
1405 |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
1406 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
|
1407 project. |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
1408 |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
1409 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
|
1410 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
|
1411 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
|
1412 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
|
1413 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
|
1414 |
2783
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
1415 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
|
1416 --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
|
1417 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
|
1418 |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1419 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
|
1420 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
|
1421 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
|
1422 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
|
1423 """ |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1424 |
3673
eb0b4a2d70a9
white space and line break cleanups
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3672
diff
changeset
|
1425 get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1426 changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
3518
467d923e4e3d
Fix excessive complaining from hg log -b
Matt Mackall <mpm@selenic.com>
parents:
3517
diff
changeset
|
1427 |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1428 if opts['limit']: |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1429 try: |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1430 limit = int(opts['limit']) |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1431 except ValueError: |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1432 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
|
1433 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
|
1434 else: |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1435 limit = sys.maxint |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1436 count = 0 |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1437 |
3197 | 1438 if opts['copies'] and opts['rev']: |
3707
67f44b825784
Removed unused ui parameter from revpair/revrange and fix its users.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3706
diff
changeset
|
1439 endrev = max(cmdutil.revrange(repo, opts['rev'])) + 1 |
3197 | 1440 else: |
1441 endrev = repo.changelog.count() | |
1442 rcache = {} | |
1443 ncache = {} | |
1444 dcache = [] | |
1445 def getrenamed(fn, rev, man): | |
1446 '''looks up all renames for a file (up to endrev) the first | |
1447 time the file is given. It indexes on the changerev and only | |
1448 parses the manifest if linkrev != changerev. | |
1449 Returns rename info for fn at changerev rev.''' | |
1450 if fn not in rcache: | |
1451 rcache[fn] = {} | |
1452 ncache[fn] = {} | |
1453 fl = repo.file(fn) | |
1454 for i in xrange(fl.count()): | |
1455 node = fl.node(i) | |
1456 lr = fl.linkrev(node) | |
1457 renamed = fl.renamed(node) | |
1458 rcache[fn][lr] = renamed | |
1459 if renamed: | |
1460 ncache[fn][node] = renamed | |
1461 if lr >= endrev: | |
1462 break | |
1463 if rev in rcache[fn]: | |
1464 return rcache[fn][rev] | |
3386
55476ce8e59c
Use manifest rev instead of changelog rev for linear manifest test
Brendan Cully <brendan@kublai.com>
parents:
3384
diff
changeset
|
1465 mr = repo.manifest.rev(man) |
3578
3b4e00cba57a
Define and use nullrev (revision of nullid) instead of -1.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3576
diff
changeset
|
1466 if repo.manifest.parentrevs(mr) != (mr - 1, nullrev): |
3384
5e6c19919741
log --copies: use manifest.find instead of delta when manifest parent is not rev-1
Brendan Cully <brendan@kublai.com>
parents:
3348
diff
changeset
|
1467 return ncache[fn].get(repo.manifest.find(man, fn)[0]) |
3197 | 1468 if not dcache or dcache[0] != man: |
1469 dcache[:] = [man, repo.manifest.readdelta(man)] | |
1470 if fn in dcache[1]: | |
1471 return ncache[fn].get(dcache[1][fn]) | |
1472 return None | |
1473 | |
3645
b984dcb1df71
Refactor log ui buffering and patch display
Matt Mackall <mpm@selenic.com>
parents:
3643
diff
changeset
|
1474 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1475 for st, rev, fns in changeiter: |
3645
b984dcb1df71
Refactor log ui buffering and patch display
Matt Mackall <mpm@selenic.com>
parents:
3643
diff
changeset
|
1476 if st == 'add': |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
1477 changenode = repo.changelog.node(rev) |
3578
3b4e00cba57a
Define and use nullrev (revision of nullid) instead of -1.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3576
diff
changeset
|
1478 parents = [p for p in repo.changelog.parentrevs(rev) |
3b4e00cba57a
Define and use nullrev (revision of nullid) instead of -1.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3576
diff
changeset
|
1479 if p != nullrev] |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
1480 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
|
1481 continue |
1436
db6d7b4005ba
add --only-merges (-m) log
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1435
diff
changeset
|
1482 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
|
1483 continue |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
1484 |
1373
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1485 if opts['keyword']: |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1486 changes = get(rev) |
1373
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1487 miss = 0 |
1404
67e20e27d8df
log: make keyword search truly case-insensitive
TK Soh <teekaysoh@yahoo.com>
parents:
1402
diff
changeset
|
1488 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
|
1489 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
|
1490 k in changes[4].lower() or |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1491 k in " ".join(changes[3][:20]).lower()): |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1492 miss = 1 |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1493 break |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1494 if miss: |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1495 continue |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1496 |
3197 | 1497 copies = [] |
1498 if opts.get('copies') and rev: | |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1499 mf = get(rev)[0] |
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1500 for fn in get(rev)[3]: |
3197 | 1501 rename = getrenamed(fn, rev, mf) |
1502 if rename: | |
1503 copies.append((fn, rename[0])) | |
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
1504 displayer.show(rev, changenode, copies=copies) |
1057 | 1505 elif st == 'iter': |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1506 if count == limit: break |
3645
b984dcb1df71
Refactor log ui buffering and patch display
Matt Mackall <mpm@selenic.com>
parents:
3643
diff
changeset
|
1507 if displayer.flush(rev): |
1765
b9fac31f34c9
hg log --limit shouldn't count unprinted revisions (found by TK Soh)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1764
diff
changeset
|
1508 count += 1 |
255 | 1509 |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
1510 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
|
1511 """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
|
1512 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1513 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
|
1514 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1515 The manifest is the list of files being version controlled. If no revision |
3736 | 1516 is given then the first parent of the working directory is used. |
1517 | |
1518 With -v flag, print file permissions. With --debug flag, print | |
1519 file revision hashes. | |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1520 """ |
3736 | 1521 |
1522 m = repo.changectx(rev).manifest() | |
255 | 1523 files = m.keys() |
1524 files.sort() | |
1525 | |
1526 for f in files: | |
3736 | 1527 if ui.debugflag: |
1528 ui.write("%40s " % hex(m[f])) | |
1529 if ui.verbose: | |
1530 ui.write("%3s " % (m.execf(f) and "755" or "644")) | |
1531 ui.write("%s\n" % f) | |
255 | 1532 |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
1533 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
|
1534 """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
|
1535 |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1536 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
|
1537 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
|
1538 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
|
1539 performed before any further updates are allowed. |
2915
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1540 |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1541 If no revision is specified, the working directory's parent is a |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1542 head revision, and the repository contains exactly one other head, |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1543 the other head is merged with by default. Otherwise, an explicit |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1544 revision to merge with must be provided. |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1545 """ |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
1546 |
3071
547d1a4aa105
hg merge: fix lookup of branch
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3068
diff
changeset
|
1547 if node or branch: |
2915
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1548 node = _lookup(repo, node, branch) |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1549 else: |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1550 heads = repo.heads() |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1551 if len(heads) > 2: |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1552 raise util.Abort(_('repo has %d heads - ' |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1553 'please merge with an explicit rev') % |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1554 len(heads)) |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1555 if len(heads) == 1: |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1556 raise util.Abort(_('there is nothing to merge - ' |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1557 'use "hg update" instead')) |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1558 parent = repo.dirstate.parents()[0] |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1559 if parent not in heads: |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1560 raise util.Abort(_('working dir not at a head rev - ' |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1561 'use "hg update" or merge with an explicit rev')) |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1562 node = parent == heads[0] and heads[-1] or heads[0] |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
1563 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
|
1564 |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
1565 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
|
1566 """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
|
1567 |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1568 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
|
1569 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
|
1570 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
|
1571 |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1572 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
|
1573 """ |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
1574 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
|
1575 setremoteconfig(ui, opts) |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1576 revs = None |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1577 if opts['rev']: |
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1578 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
|
1579 |
920 | 1580 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
|
1581 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
|
1582 if not o: |
78ef83c9e9e1
show message if no changes found on outgoing
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1993
diff
changeset
|
1583 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
|
1584 return |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1585 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
|
1586 if opts['newest_first']: |
65cbe22b03fa
allow 'hg out' / 'hg in' to show newest commit first
Michal Kvasnica <kvasnica@gmail.com>
parents:
1437
diff
changeset
|
1587 o.reverse() |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
1588 displayer = cmdutil.show_changeset(ui, repo, opts) |
920 | 1589 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
|
1590 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
|
1591 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
|
1592 continue |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
1593 displayer.show(changenode=n) |
920 | 1594 |
3658
d12c8668b102
remove legacy hg parents REV syntax
Matt Mackall <mpm@selenic.com>
parents:
3657
diff
changeset
|
1595 def parents(ui, repo, file_=None, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1596 """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
|
1597 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1598 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
|
1599 """ |
3658
d12c8668b102
remove legacy hg parents REV syntax
Matt Mackall <mpm@selenic.com>
parents:
3657
diff
changeset
|
1600 rev = opts.get('rev') |
706
5107a7b6b14a
Make "hg parents REV" work (again?)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
705
diff
changeset
|
1601 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
|
1602 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
|
1603 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
|
1604 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
|
1605 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
|
1606 p = [cp.node() for cp in ctx.parents()] |
255 | 1607 else: |
1608 p = repo.dirstate.parents() | |
1609 | |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
1610 displayer = cmdutil.show_changeset(ui, repo, opts) |
255 | 1611 for n in p: |
1092 | 1612 if n != nullid: |
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
1613 displayer.show(changenode=n) |
255 | 1614 |
1858
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
1615 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
|
1616 """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
|
1617 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1618 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
|
1619 definition of available names. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1620 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1621 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
|
1622 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
|
1623 """ |
779 | 1624 if search: |
1625 for name, path in ui.configitems("paths"): | |
1626 if name == search: | |
1627 ui.write("%s\n" % path) | |
1628 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
|
1629 ui.warn(_("not found!\n")) |
779 | 1630 return 1 |
1631 else: | |
1632 for name, path in ui.configitems("paths"): | |
1633 ui.write("%s = %s\n" % (name, path)) | |
1634 | |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1635 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
|
1636 if modheads == 0: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1637 return |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1638 if optupdate: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1639 if modheads == 1: |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
1640 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
|
1641 else: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1642 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
|
1643 if modheads > 1: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1644 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
|
1645 else: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1646 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
|
1647 |
404 | 1648 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
|
1649 """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
|
1650 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1651 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
|
1652 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1653 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
|
1654 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
|
1655 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
|
1656 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1657 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
|
1658 |
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1659 local/filesystem/path (or file://local/filesystem/path) |
2589
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
1660 http://[user@]host[:port]/[path] |
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
1661 https://[user@]host[:port]/[path] |
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
1662 ssh://[user@]host[:port]/[path] |
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1663 static-http://host[:port]/[path] |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1664 |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1665 Paths in the local filesystem can either point to Mercurial |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1666 repositories or to bundle files (as created by 'hg bundle' or |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1667 'hg incoming --bundle'). The static-http:// protocol, albeit slow, |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1668 allows access to a Mercurial repository where you simply use a web |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1669 server to publish the .hg directory as static content. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1670 |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1671 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
|
1672 - 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
|
1673 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
|
1674 - 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
|
1675 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
|
1676 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
|
1677 - Mercurial doesn't use its own compression via SSH; the right thing |
3471
be2bf7263276
Corrected SSH configuration example in pull help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3467
diff
changeset
|
1678 to do is to configure it in your ~/.ssh/config, e.g.: |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1679 Host *.mylocalnetwork.example.com |
3471
be2bf7263276
Corrected SSH configuration example in pull help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3467
diff
changeset
|
1680 Compression no |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1681 Host * |
3471
be2bf7263276
Corrected SSH configuration example in pull help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3467
diff
changeset
|
1682 Compression yes |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1683 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
|
1684 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
|
1685 """ |
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
|
1686 source = ui.expandpath(source) |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
1687 setremoteconfig(ui, opts) |
963
84355e3e4493
Add -e and --remotecmd for clone and pull too
mpm@selenic.com
parents:
961
diff
changeset
|
1688 |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
1689 other = hg.repository(ui, source) |
2473
30c267cb4c2f
change some repo messages in small ways.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2461
diff
changeset
|
1690 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
|
1691 revs = None |
3448
6ca49c5fe268
Stop erroring out pull -r and clone -r if repository isn't local.
Eric Hopper <hopper@omnifarious.org>
parents:
3421
diff
changeset
|
1692 if opts['rev']: |
6ca49c5fe268
Stop erroring out pull -r and clone -r if repository isn't local.
Eric Hopper <hopper@omnifarious.org>
parents:
3421
diff
changeset
|
1693 if 'lookup' in other.capabilities: |
6ca49c5fe268
Stop erroring out pull -r and clone -r if repository isn't local.
Eric Hopper <hopper@omnifarious.org>
parents:
3421
diff
changeset
|
1694 revs = [other.lookup(rev) for rev in opts['rev']] |
6ca49c5fe268
Stop erroring out pull -r and clone -r if repository isn't local.
Eric Hopper <hopper@omnifarious.org>
parents:
3421
diff
changeset
|
1695 else: |
6ca49c5fe268
Stop erroring out pull -r and clone -r if repository isn't local.
Eric Hopper <hopper@omnifarious.org>
parents:
3421
diff
changeset
|
1696 error = _("Other repository doesn't support revision lookup, so a rev cannot be specified.") |
6ca49c5fe268
Stop erroring out pull -r and clone -r if repository isn't local.
Eric Hopper <hopper@omnifarious.org>
parents:
3421
diff
changeset
|
1697 raise util.Abort(error) |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1698 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
|
1699 return postincoming(ui, repo, modheads, opts['update']) |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
1700 |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
1701 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
|
1702 """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
|
1703 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1704 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
|
1705 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1706 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
|
1707 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
|
1708 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
|
1709 from the current one. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1710 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1711 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
|
1712 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
|
1713 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
|
1714 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1715 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
|
1716 |
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1717 local/filesystem/path (or file://local/filesystem/path) |
2589
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
1718 ssh://[user@]host[:port]/[path] |
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1719 http://[user@]host[:port]/[path] |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1720 https://[user@]host[:port]/[path] |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1721 |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1722 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
|
1723 about ssh:// URLs. |
2590
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1724 |
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1725 Pushing to http:// and https:// URLs is only possible, if this |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
1726 feature is explicitly 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
|
1727 """ |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
1728 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
|
1729 setremoteconfig(ui, opts) |
961 | 1730 |
640
b48b91d3fb4a
Switch push over to the new scheme
Matt Mackall <mpm@selenic.com>
parents:
639
diff
changeset
|
1731 other = hg.repository(ui, dest) |
2473
30c267cb4c2f
change some repo messages in small ways.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2461
diff
changeset
|
1732 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
|
1733 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
|
1734 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
|
1735 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
|
1736 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
|
1737 return r == 0 |
319 | 1738 |
3653 | 1739 def rawcommit(ui, repo, *pats, **opts): |
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
|
1740 """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
|
1741 |
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
1742 (DEPRECATED) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1743 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
|
1744 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1745 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
|
1746 primarily useful for importing from other SCMs. |
1657
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
1747 |
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
1748 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
|
1749 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
|
1750 """ |
1657
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
1751 |
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
1752 ui.warn(_("(the rawcommit command is deprecated)\n")) |
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
1753 |
3653 | 1754 message = logmessage(opts) |
1755 | |
1756 files, match, anypats = cmdutil.matchpats(repo, pats, opts) | |
1757 if opts['files']: | |
1758 files += open(opts['files']).read().splitlines() | |
1759 | |
1760 parents = [repo.lookup(p) for p in opts['parent']] | |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
1761 |
1202
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
1762 try: |
3659
025f68f22ae2
move write_bundle to changegroup.py
Matt Mackall <mpm@selenic.com>
parents:
3658
diff
changeset
|
1763 repo.rawcommit(files, message, opts['user'], opts['date'], *parents) |
1202
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
1764 except ValueError, inst: |
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
1765 raise util.Abort(str(inst)) |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
1766 |
245 | 1767 def recover(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1768 """roll back an interrupted transaction |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1769 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1770 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
|
1771 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1772 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
|
1773 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
|
1774 """ |
1516
0b1b029b4de3
Automatically run "verify" whenever we run "recover"
Matt Mackall <mpm@selenic.com>
parents:
1514
diff
changeset
|
1775 if repo.recover(): |
2778 | 1776 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
|
1777 return 1 |
245 | 1778 |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
1779 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
|
1780 """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
|
1781 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1782 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
|
1783 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1784 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
|
1785 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
|
1786 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
|
1787 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
|
1788 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
|
1789 |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1790 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
|
1791 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
|
1792 """ |
1188
b3ceb2d470fc
Fix up remove command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1187
diff
changeset
|
1793 names = [] |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
1794 if not opts['after'] and not pats: |
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
1795 raise util.Abort(_('no files specified')) |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1796 files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1797 exact = dict.fromkeys(files) |
2875
3d6efcbbd1c9
remove localrepository.changes.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2874
diff
changeset
|
1798 mardu = map(dict.fromkeys, repo.status(files=files, match=matchfn))[:5] |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1799 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
|
1800 remove, forget = [], [] |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1801 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts): |
1189
4cbcc54695b2
Make removal check more complete and informative.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1188
diff
changeset
|
1802 reason = None |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1803 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
|
1804 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
|
1805 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
|
1806 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
|
1807 elif abs in added: |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1808 if opts['force']: |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1809 forget.append(abs) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1810 continue |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1811 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
|
1812 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
|
1813 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
|
1814 elif abs in removed: |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1815 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
|
1816 if reason: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1817 if exact: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1818 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
|
1819 else: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1820 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
|
1821 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
|
1822 remove.append(abs) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1823 repo.forget(forget) |
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
1824 repo.remove(remove, unlink=not opts['after']) |
245 | 1825 |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
1826 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
|
1827 """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
|
1828 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1829 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
|
1830 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
|
1831 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
|
1832 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1833 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
|
1834 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
|
1835 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
|
1836 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1837 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
|
1838 """ |
2016
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1839 wlock = repo.wlock(0) |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1840 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
|
1841 names = [] |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1842 for abs, rel, exact in copied: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1843 if ui.verbose or not exact: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1844 ui.status(_('removing %s\n') % rel) |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1845 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
|
1846 if not opts.get('dry_run'): |
2414
86e07466bcfc
remove: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2413
diff
changeset
|
1847 repo.remove(names, True, wlock) |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
1848 return errs |
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
1849 |
1472
3c909a747d7f
make revert use standard matcher
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1470
diff
changeset
|
1850 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
|
1851 """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
|
1852 |
2212
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
1853 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
|
1854 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
|
1855 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
|
1856 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
|
1857 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
|
1858 |
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
|
1859 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
|
1860 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
|
1861 |
3016
2b255c3478dc
minor docstring fix for revert
TK Soh <teekaysoh@yahoo.com>
parents:
3014
diff
changeset
|
1862 Using the -r option, revert the given files or directories to their |
2b255c3478dc
minor docstring fix for revert
TK Soh <teekaysoh@yahoo.com>
parents:
3014
diff
changeset
|
1863 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
|
1864 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
|
1865 |
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
1866 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
|
1867 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
|
1868 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
|
1869 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
|
1870 afterwards. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1871 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1872 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
|
1873 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
|
1874 |
1472
3c909a747d7f
make revert use standard matcher
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1470
diff
changeset
|
1875 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
|
1876 |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
1877 If no arguments are given, no files are reverted. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1878 """ |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
1879 |
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
1880 if not pats and not opts['all']: |
3020
ea2a9c13afc6
Add a hint for revert --all when aborting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3016
diff
changeset
|
1881 raise util.Abort(_('no files or directories specified; ' |
ea2a9c13afc6
Add a hint for revert --all when aborting
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3016
diff
changeset
|
1882 'use --all to revert the whole repo')) |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
1883 |
2212
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
1884 parent, p2 = repo.dirstate.parents() |
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
1885 if not opts['rev'] and p2 != nullid: |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
1886 raise util.Abort(_('uncommitted merge - please provide a ' |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
1887 'specific revision')) |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
1888 node = repo.changectx(opts['rev']).node() |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1889 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
|
1890 if node == parent: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1891 pmf = mf |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1892 else: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1893 pmf = None |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1894 |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1895 wlock = repo.wlock() |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1896 |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1897 # 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
|
1898 # 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
|
1899 # but not other. |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1900 |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1901 names = {} |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1902 target_only = {} |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1903 |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1904 # walk dirstate. |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1905 |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1906 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, |
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1907 badmatch=mf.has_key): |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1908 names[abs] = (rel, exact) |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1909 if src == 'b': |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1910 target_only[abs] = True |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1911 |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1912 # walk target manifest. |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1913 |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1914 for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node, |
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1915 badmatch=names.has_key): |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1916 if abs in names: continue |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1917 names[abs] = (rel, exact) |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1918 target_only[abs] = True |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1919 |
2875
3d6efcbbd1c9
remove localrepository.changes.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2874
diff
changeset
|
1920 changes = repo.status(match=names.has_key, wlock=wlock)[:5] |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1921 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
|
1922 |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1923 revert = ([], _('reverting %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1924 add = ([], _('adding %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1925 remove = ([], _('removing %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1926 forget = ([], _('forgetting %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1927 undelete = ([], _('undeleting %s\n')) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1928 update = {} |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1929 |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1930 disptable = ( |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1931 # dispatch table: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1932 # file state |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1933 # action if in target manifest |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1934 # 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
|
1935 # 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
|
1936 # 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
|
1937 (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
|
1938 (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
|
1939 (removed, undelete, None, False, False), |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1940 (deleted, revert, remove, False, False), |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1941 (unknown, add, None, True, False), |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1942 (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
|
1943 ) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1944 |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1945 entries = names.items() |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1946 entries.sort() |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1947 |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
1948 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
|
1949 mfentry = mf.get(abs) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1950 def handle(xlist, dobackup): |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1951 xlist[0].append(abs) |
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1952 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
|
1953 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
|
1954 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
|
1955 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
|
1956 (rel, bakname)) |
2415
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
1957 if not opts.get('dry_run'): |
3629
4cfb72bcb978
util: add copyfile function
Matt Mackall <mpm@selenic.com>
parents:
3628
diff
changeset
|
1958 util.copyfile(rel, bakname) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1959 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
|
1960 ui.status(xlist[1] % rel) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1961 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
|
1962 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
|
1963 # 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
|
1964 if mfentry: |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1965 handle(hitlist, backuphit) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1966 elif misslist is not None: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1967 handle(misslist, backupmiss) |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1968 else: |
3679
2956948b81f3
fix warnings generated by pygettext.py.
Marcos Chaves <marcos.nospam@gmail.com>
parents:
3673
diff
changeset
|
1969 if exact: ui.warn(_('file not managed: %s\n') % rel) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1970 break |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1971 else: |
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1972 # 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
|
1973 if node == parent: |
3679
2956948b81f3
fix warnings generated by pygettext.py.
Marcos Chaves <marcos.nospam@gmail.com>
parents:
3673
diff
changeset
|
1974 if exact: ui.warn(_('no changes needed to %s\n') % rel) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1975 continue |
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1976 if pmf is None: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1977 # 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
|
1978 # 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
|
1979 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
|
1980 if abs in pmf: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1981 if mfentry: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1982 # 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
|
1983 # manifests, do nothing |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1984 if pmf[abs] != mfentry: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1985 handle(revert, False) |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
1986 else: |
2272
e9a0ed9ed4d9
revert: fix corner case found by faheem mitha.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2268
diff
changeset
|
1987 handle(remove, False) |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
1988 |
2415
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
1989 if not opts.get('dry_run'): |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
1990 repo.dirstate.forget(forget[0]) |
2812
3aeab7bb5adc
Refactor update locking slightly
Matt Mackall <mpm@selenic.com>
parents:
2808
diff
changeset
|
1991 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
|
1992 repo.dirstate.update(add[0], 'a') |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
1993 repo.dirstate.update(undelete[0], 'n') |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
1994 repo.dirstate.update(remove[0], 'r') |
dec79ed61ee1
revert: add -n/--dry-run option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2414
diff
changeset
|
1995 return r |
588 | 1996 |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
1997 def rollback(ui, repo): |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
1998 """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
|
1999 |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2000 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
|
2001 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
|
2002 |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2003 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
|
2004 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
|
2005 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
|
2006 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
|
2007 |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2008 commit |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2009 import |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2010 pull |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2011 push (with this repository as destination) |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2012 unbundle |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2013 |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2014 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
|
2015 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
|
2016 |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2017 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
|
2018 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
|
2019 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
|
2020 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
|
2021 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
|
2022 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
|
2023 """ |
2362
482d3fb47d80
Renamed localrepo.undo() to rollback() and talk about "rollback information".
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2356
diff
changeset
|
2024 repo.rollback() |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2025 |
468 | 2026 def root(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2027 """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
|
2028 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2029 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
|
2030 """ |
468 | 2031 ui.write(repo.root + "\n") |
2032 | |
245 | 2033 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
|
2034 """export the repository via HTTP |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2035 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2036 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
|
2037 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2038 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
|
2039 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
|
2040 """ |
624
876333a295ff
Add an sshrepository class and hg serve --stdio
Matt Mackall <mpm@selenic.com>
parents:
618
diff
changeset
|
2041 |
876333a295ff
Add an sshrepository class and hg serve --stdio
Matt Mackall <mpm@selenic.com>
parents:
618
diff
changeset
|
2042 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
|
2043 if repo is None: |
3079
4c9fcb5e3b82
If local repository is missing, make error message clearer.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3072
diff
changeset
|
2044 raise hg.RepoError(_("There is no Mercurial repository here" |
4c9fcb5e3b82
If local repository is missing, make error message clearer.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3072
diff
changeset
|
2045 " (.hg not found)")) |
2396
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
2046 s = sshserver.sshserver(ui, repo) |
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
2047 s.serve_forever() |
2363
fa4c11751367
Give a response to unknown SSH commands
Matt Mackall <mpm@selenic.com>
parents:
2362
diff
changeset
|
2048 |
2125
3610d9468b1e
Use string literal concatenation for optlist and import -p option
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2124
diff
changeset
|
2049 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
|
2050 " accesslog errorlog webdir_conf") |
987 | 2051 for o in optlist.split(): |
2052 if opts[o]: | |
3344
d9b3d3d34749
ui.py: change the overlay from a dict to a SafeConfigParser.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3319
diff
changeset
|
2053 ui.setconfig("web", o, str(opts[o])) |
987 | 2054 |
2127
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
2055 if repo is None and not ui.config("web", "webdir_conf"): |
3079
4c9fcb5e3b82
If local repository is missing, make error message clearer.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3072
diff
changeset
|
2056 raise hg.RepoError(_("There is no Mercurial repository here" |
4c9fcb5e3b82
If local repository is missing, make error message clearer.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3072
diff
changeset
|
2057 " (.hg not found)")) |
2127
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
2058 |
1741
9777298fed84
stop read end of pipe from staying open forever in child process.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1740
diff
changeset
|
2059 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
|
2060 rfd, wfd = os.pipe() |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2061 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
|
2062 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
|
2063 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
|
2064 args[0], args) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2065 os.close(wfd) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2066 os.read(rfd, 1) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2067 os._exit(0) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2068 |
3628
dc3504af7722
hgweb: internalize some socket details
Matt Mackall <mpm@selenic.com>
parents:
3627
diff
changeset
|
2069 httpd = hgweb.server.create_server(ui, repo) |
987 | 2070 |
603
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2071 if ui.verbose: |
3628
dc3504af7722
hgweb: internalize some socket details
Matt Mackall <mpm@selenic.com>
parents:
3627
diff
changeset
|
2072 if httpd.port != 80: |
dc3504af7722
hgweb: internalize some socket details
Matt Mackall <mpm@selenic.com>
parents:
3627
diff
changeset
|
2073 ui.status(_('listening at http://%s:%d/\n') % |
dc3504af7722
hgweb: internalize some socket details
Matt Mackall <mpm@selenic.com>
parents:
3627
diff
changeset
|
2074 (httpd.addr, httpd.port)) |
603
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2075 else: |
3628
dc3504af7722
hgweb: internalize some socket details
Matt Mackall <mpm@selenic.com>
parents:
3627
diff
changeset
|
2076 ui.status(_('listening at http://%s/\n') % httpd.addr) |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2077 |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2078 if opts['pid_file']: |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2079 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
|
2080 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
|
2081 fp.close() |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2082 |
1741
9777298fed84
stop read end of pipe from staying open forever in child process.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1740
diff
changeset
|
2083 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
|
2084 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
|
2085 os.close(rfd) |
1740
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2086 os.write(wfd, 'y') |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2087 os.close(wfd) |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2088 sys.stdout.flush() |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2089 sys.stderr.flush() |
f95654385065
add --daemon option to serve command. for issue 45.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1736
diff
changeset
|
2090 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
|
2091 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
|
2092 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
|
2093 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
|
2094 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
|
2095 |
603
bc5d058e65e9
[PATCH] Get "hg serve" to print the URL being served
mpm@selenic.com
parents:
596
diff
changeset
|
2096 httpd.serve_forever() |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
2097 |
731
91ca3afab8e8
Add name matching to status command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
729
diff
changeset
|
2098 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
|
2099 """show changed files in the working directory |
213 | 2100 |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2101 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
|
2102 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
|
2103 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
|
2104 |
3467
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
2105 If one revision is given, it is used as the base revision. |
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
2106 If two revisions are given, the difference between them is shown. |
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
2107 |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2108 The codes used to show the status of files are: |
746 | 2109 M = modified |
245 | 2110 A = added |
2111 R = removed | |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2112 C = clean |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
2113 ! = deleted, but still tracked |
842
8fb488773063
Rewritten change type selection for hg status.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
841
diff
changeset
|
2114 ? = 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
|
2115 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
|
2116 = 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
|
2117 """ |
312 | 2118 |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2119 all = opts['all'] |
3707
67f44b825784
Removed unused ui parameter from revpair/revrange and fix its users.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3706
diff
changeset
|
2120 node1, node2 = cmdutil.revpair(repo, opts.get('rev')) |
3223
53e843840349
Whitespace/Tab cleanup
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3204
diff
changeset
|
2121 |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
2122 files, matchfn, anypats = cmdutil.matchpats(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
|
2123 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
|
2124 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
|
2125 [util.pathto(cwd, x) for x in n] |
3467
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
2126 for n in repo.status(node1=node1, node2=node2, files=files, |
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
2127 match=matchfn, |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2128 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
|
2129 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
|
2130 |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2131 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
|
2132 ('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
|
2133 ('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
|
2134 ('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
|
2135 ('unknown', '?', unknown), |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2136 ('ignored', 'I', ignored)) |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2137 |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2138 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
|
2139 |
1085
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2140 end = opts['print0'] and '\0' or '\n' |
1106
95a044b73bd5
Whitespace cleanup.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1105
diff
changeset
|
2141 |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2142 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
|
2143 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
|
2144 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
|
2145 if opts['no_status']: |
1085
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2146 format = "%%s%s" % end |
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2147 else: |
1966
f8b0e73e320f
hg status cleanups: Don't translate long options, remove stray semicolon.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1965
diff
changeset
|
2148 format = "%s %%s%s" % (char, end) |
1106
95a044b73bd5
Whitespace cleanup.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1105
diff
changeset
|
2149 |
842
8fb488773063
Rewritten change type selection for hg status.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
841
diff
changeset
|
2150 for f in changes: |
1085
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2151 ui.write(format % f) |
3250
7c114915fbdb
Make status -C work with merge+rename
Matt Mackall <mpm@selenic.com>
parents:
3223
diff
changeset
|
2152 if ((all or opts.get('copies')) and not opts.get('no_status')): |
3159
e43fd1623fe1
fix users of dirstate.copies broken by b1f10d3223c1
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3146
diff
changeset
|
2153 copied = repo.dirstate.copied(f) |
e43fd1623fe1
fix users of dirstate.copies broken by b1f10d3223c1
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3146
diff
changeset
|
2154 if copied: |
e43fd1623fe1
fix users of dirstate.copies broken by b1f10d3223c1
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3146
diff
changeset
|
2155 ui.write(' %s%s' % (copied, end)) |
213 | 2156 |
1596
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2157 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
|
2158 """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
|
2159 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2160 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
|
2161 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2162 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
|
2163 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
|
2164 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
|
2165 |
2647
46182568b4ce
change 'hg tag' to tag the parent rev instead of tip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2639
diff
changeset
|
2166 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
|
2167 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2168 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
|
2169 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
|
2170 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
|
2171 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
|
2172 shared among repositories). |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2173 """ |
2789
e3564699409c
Add '.' as a shortcut revision name for the working directory parent.
Brendan Cully <brendan@kublai.com>
parents:
2784
diff
changeset
|
2174 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
|
2175 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
|
2176 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
|
2177 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
|
2178 "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
|
2179 if opts['rev']: |
b7fc961507db
deprecate the use of 'hg tag NAME [REV]'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1648
diff
changeset
|
2180 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
|
2181 if opts['rev']: |
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2182 rev_ = opts['rev'] |
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2183 if not rev_ and repo.dirstate.parents()[1] != nullid: |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2184 raise util.Abort(_('uncommitted merge - please provide a ' |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2185 'specific revision')) |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2186 r = repo.changectx(rev_).node() |
2967
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2187 |
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2188 message = opts['message'] |
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2189 if not message: |
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2190 message = _('Added tag %s for changeset %s') % (name, short(r)) |
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2191 |
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2192 repo.tag(name, r, message, opts['local'], opts['user'], opts['date']) |
401
af4848f83e68
From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
396
diff
changeset
|
2193 |
248 | 2194 def tags(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2195 """list repository tags |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2196 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2197 List the repository tags. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2198 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2199 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
|
2200 """ |
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
2201 |
343 | 2202 l = repo.tagslist() |
2203 l.reverse() | |
2966
fb493241d7f6
Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents:
2963
diff
changeset
|
2204 hexfunc = ui.debugflag and hex or short |
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
2205 for t, n in l: |
248 | 2206 try: |
2966
fb493241d7f6
Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents:
2963
diff
changeset
|
2207 r = "%5d:%s" % (repo.changelog.rev(n), hexfunc(n)) |
248 | 2208 except KeyError: |
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
2209 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
|
2210 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
|
2211 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
|
2212 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
|
2213 ui.write("%-30s %s\n" % (t, r)) |
248 | 2214 |
1731
251729df9cc6
add -p option to tip. for issue 64.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1728
diff
changeset
|
2215 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
|
2216 """show the tip revision |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2217 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2218 Show the tip revision. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2219 """ |
3671
86d3f966201d
Use nullrev+count instead of count-1 in a newly introduced expression.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3663
diff
changeset
|
2220 cmdutil.show_changeset(ui, repo, opts).show(nullrev+repo.changelog.count()) |
245 | 2221 |
1600
728fd9584993
add --update support to 'hg unbundle'
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1596
diff
changeset
|
2222 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
|
2223 """apply a changegroup file |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2224 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2225 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
|
2226 command. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2227 """ |
3660
8500a13ec44b
create a readbundle function
Matt Mackall <mpm@selenic.com>
parents:
3659
diff
changeset
|
2228 gen = changegroup.readbundle(urllib.urlopen(fname)) |
8500a13ec44b
create a readbundle function
Matt Mackall <mpm@selenic.com>
parents:
3659
diff
changeset
|
2229 modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2230 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
|
2231 |
1581
db10b7114de0
abort when merging two heads and repository has local changes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1571
diff
changeset
|
2232 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
|
2233 branch=None): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2234 """update or merge working directory |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2235 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2236 Update the working directory to the specified revision. |
254 | 2237 |
2238 If there are no outstanding changes in the working directory and | |
2239 there is a linear relationship between the current version and the | |
2240 requested version, the result is the requested version. | |
2241 | |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2272
diff
changeset
|
2242 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
|
2243 merge command. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2244 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2245 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
|
2246 merging or discarding local changes. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2247 """ |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2248 node = _lookup(repo, node, branch) |
3521
ba94e80e5540
Remove update -m, deprecated for 0.9.1
Matt Mackall <mpm@selenic.com>
parents:
3520
diff
changeset
|
2249 if clean: |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2250 return hg.clean(repo, node) |
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2251 else: |
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2252 return hg.update(repo, node) |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2253 |
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2254 def _lookup(repo, node, branch=None): |
898 | 2255 if branch: |
3503
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2256 repo.ui.warn(_("the --branch option is deprecated, " |
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2257 "please use 'hg branch' instead\n")) |
898 | 2258 br = repo.branchlookup(branch=branch) |
2259 found = [] | |
2260 for x in br: | |
2261 if branch in br[x]: | |
2262 found.append(x) | |
2263 if len(found) > 1: | |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2264 repo.ui.warn(_("Found multiple heads for %s\n") % branch) |
898 | 2265 for x in found: |
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
2266 cmdutil.show_changeset(ui, repo, {}).show(changenode=x) |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2267 raise util.Abort("") |
898 | 2268 if len(found) == 1: |
2269 node = found[0] | |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
2270 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
|
2271 % (short(node), branch)) |
898 | 2272 else: |
3072
bc3fe3b5b785
Never apply string formatting to generated errors with util.Abort.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3071
diff
changeset
|
2273 raise util.Abort(_("branch %s not found") % branch) |
898 | 2274 else: |
2275 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
|
2276 return node |
254 | 2277 |
247 | 2278 def verify(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2279 """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
|
2280 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2281 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
|
2282 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2283 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
|
2284 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
|
2285 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
|
2286 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
|
2287 """ |
2778 | 2288 return hg.verify(repo) |
247 | 2289 |
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2290 def version_(ui): |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2291 """output version and copyright information""" |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2292 ui.write(_("Mercurial Distributed SCM (version %s)\n") |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2293 % version.get_version()) |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2294 ui.status(_( |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2295 "\nCopyright (C) 2005, 2006 Matt Mackall <mpm@selenic.com>\n" |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2296 "This is free software; see the source for copying conditions. " |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2297 "There is NO\nwarranty; " |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2298 "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2299 )) |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2300 |
255 | 2301 # Command options and aliases are listed here, alphabetically |
2302 | |
3187
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2303 globalopts = [ |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2304 ('R', 'repository', '', |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2305 _('repository root directory or symbolic path name')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2306 ('', 'cwd', '', _('change working directory')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2307 ('y', 'noninteractive', None, |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2308 _('do not prompt, assume \'yes\' for any required answers')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2309 ('q', 'quiet', None, _('suppress output')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2310 ('v', 'verbose', None, _('enable additional output')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2311 ('', 'config', [], _('set/override config option')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2312 ('', 'debug', None, _('enable debugging output')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2313 ('', 'debugger', None, _('start debugger')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2314 ('', 'lsprof', None, _('print improved command execution profile')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2315 ('', 'traceback', None, _('print traceback on exception')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2316 ('', 'time', None, _('time how long the command takes')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2317 ('', 'profile', None, _('print command execution profile')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2318 ('', 'version', None, _('output version information and exit')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2319 ('h', 'help', None, _('display help and exit')), |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2320 ] |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2321 |
3189
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2322 dryrunopts = [('n', 'dry-run', None, |
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2323 _('do not perform actions, just print output'))] |
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2324 |
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2325 remoteopts = [ |
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2326 ('e', 'ssh', '', _('specify ssh command to use')), |
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2327 ('', 'remotecmd', '', _('specify hg command to run on the remote side')), |
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2328 ] |
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2329 |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2330 walkopts = [ |
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2331 ('I', 'include', [], _('include names matching the given patterns')), |
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2332 ('X', 'exclude', [], _('exclude names matching the given patterns')), |
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2333 ] |
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2334 |
209 | 2335 table = { |
841
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
2336 "^add": |
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
2337 (add, |
3189
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2338 walkopts + dryrunopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2339 _('hg add [OPTION]... [FILE]...')), |
2955
9d1c3529ebbc
addremove: do not deprecate.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2340 "addremove": |
841
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
2341 (addremove, |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2342 [('s', 'similarity', '', |
3189
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2343 _('guess renamed files by similarity (0<=s<=100)')), |
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2344 ] + walkopts + dryrunopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2345 _('hg addremove [OPTION]... [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2346 "^annotate": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2347 (annotate, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2348 [('r', 'rev', '', _('annotate the specified revision')), |
3172
5c93dd0ae413
Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents:
3159
diff
changeset
|
2349 ('f', 'follow', None, _('follow file copies and renames')), |
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
|
2350 ('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
|
2351 ('u', 'user', None, _('list the author')), |
1522 | 2352 ('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
|
2353 ('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
|
2354 ('c', 'changeset', None, _('list the changeset')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2355 ] + walkopts, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2356 _('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
|
2357 "archive": |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2358 (archive, |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2359 [('', '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
|
2360 ('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
|
2361 ('r', 'rev', '', _('revision to distribute')), |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2362 ('t', 'type', '', _('type of distribution to create')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2363 ] + walkopts, |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2364 _('hg archive [OPTION]... DEST')), |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2365 "backout": |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2366 (backout, |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2367 [('', 'merge', None, |
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2368 _('merge with old dirstate parent after backout')), |
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2369 ('m', 'message', '', _('use <text> as commit message')), |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2370 ('l', 'logfile', '', _('read commit message from <file>')), |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2371 ('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
|
2372 ('', 'parent', '', _('parent to choose when backing out merge')), |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2373 ('u', 'user', '', _('record user as committer')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2374 ] + walkopts, |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2375 _('hg backout [OPTION]... REV')), |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
2376 "branch": (branch, [], _('hg branch [NAME]')), |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
2377 "branches": (branches, [], _('hg branches')), |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2378 "bundle": |
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2379 (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
|
2380 [('f', 'force', None, |
3191
545b6d718593
add remoteopts to bundle command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3190
diff
changeset
|
2381 _('run even when remote repository is unrelated')), |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
2382 ('r', 'rev', [], |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
2383 _('a changeset you would like to bundle')), |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
2384 ('', 'base', [], |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
2385 _('a base changeset to specify instead of a destination')), |
3191
545b6d718593
add remoteopts to bundle command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3190
diff
changeset
|
2386 ] + remoteopts, |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
2387 _('hg bundle [--base REV]... [--rev REV]... FILE [DEST]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2388 "cat": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2389 (cat, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2390 [('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
|
2391 ('r', 'rev', '', _('print the given revision')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2392 ] + walkopts, |
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
|
2393 _('hg cat [OPTION]... FILE...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2394 "^clone": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2395 (clone, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2396 [('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
|
2397 ('r', 'rev', [], |
2764
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
2398 _('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
|
2399 ('', '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
|
2400 ('', 'uncompressed', None, |
de82749d3a71
clone: change name of --stream to --uncompressed.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2618
diff
changeset
|
2401 _('use uncompressed transfer (fast over LAN)')), |
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2402 ] + remoteopts, |
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
|
2403 _('hg clone [OPTION]... SOURCE [DEST]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2404 "^commit|ci": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2405 (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
|
2406 [('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
|
2407 _('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
|
2408 ('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
|
2409 ('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
|
2410 ('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
|
2411 ('u', 'user', '', _('record user as commiter')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2412 ] + walkopts, |
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
|
2413 _('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
|
2414 "copy|cp": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2415 (copy, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2416 [('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
|
2417 ('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
|
2418 _('forcibly copy over an existing managed file')), |
3189
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2419 ] + walkopts + dryrunopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2420 _('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
|
2421 "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
|
2422 "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
|
2423 (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
|
2424 [('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
|
2425 _('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
|
2426 "debugrebuildstate": |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
2427 (debugrebuildstate, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2428 [('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
|
2429 _('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
|
2430 "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), |
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
|
2431 "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
|
2432 "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
|
2433 "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
|
2434 "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
|
2435 "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
|
2436 "debugrename": (debugrename, [], _('debugrename FILE [REV]')), |
841
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
2437 "debugwalk": |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2438 (debugwalk, walkopts, _('debugwalk [OPTION]... [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2439 "^diff": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2440 (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
|
2441 [('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
|
2442 ('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
|
2443 ('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
|
2444 _('show which function each change is in')), |
2907 | 2445 ('g', 'git', None, _('use git extended diff format')), |
3200
367a009c2acb
Remove single character equivalent of --nodates (was -D)
Stephen Darnell <stephen@darnell.plus.com>
parents:
3199
diff
changeset
|
2446 ('', 'nodates', None, _("don't include dates in diff headers")), |
1728
9b92b71d5dd7
add -w and -p options to diff. this is for issue 126.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1720
diff
changeset
|
2447 ('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
|
2448 _('ignore white space when comparing lines')), |
2580
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
2449 ('b', 'ignore-space-change', None, |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
2450 _('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
|
2451 ('B', 'ignore-blank-lines', None, |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
2452 _('ignore changes whose lines are all blank')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2453 ] + walkopts, |
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
|
2454 _('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
|
2455 "^export": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2456 (export, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2457 [('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
|
2458 ('a', 'text', None, _('treat all files as text')), |
3029 | 2459 ('g', 'git', None, _('use git extended diff format')), |
3200
367a009c2acb
Remove single character equivalent of --nodates (was -D)
Stephen Darnell <stephen@darnell.plus.com>
parents:
3199
diff
changeset
|
2460 ('', 'nodates', None, _("don't include dates in diff headers")), |
1571
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
2461 ('', '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
|
2462 _('hg export [-a] [-o OUTFILESPEC] REV...')), |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2463 "grep": |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2464 (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
|
2465 [('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
|
2466 ('', 'all', None, _('print all revisions that match')), |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
2467 ('f', 'follow', None, |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
2468 _('follow changeset history, or file history across copies and renames')), |
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
|
2469 ('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
|
2470 ('l', 'files-with-matches', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
2471 _('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
|
2472 ('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
|
2473 ('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
|
2474 ('u', 'user', None, _('print user who committed change')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2475 ] + walkopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2476 _('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
|
2477 "heads": |
65763ff9fa53
Update online help of hg heads for new --branches option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
904
diff
changeset
|
2478 (heads, |
3503
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2479 [('b', 'branches', None, _('show branches (DEPRECATED)')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
2480 ('', '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
|
2481 ('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
|
2482 ('', 'template', '', _('display with template'))], |
3510
e1421a77427e
Corrected synopsis of hg heads
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3504
diff
changeset
|
2483 _('hg heads [-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
|
2484 "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
|
2485 "identify|id": (identify, [], _('hg identify')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2486 "import|patch": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2487 (import_, |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
2488 [('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
|
2489 _('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
|
2490 '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
|
2491 ('m', 'message', '', _('use <text> as commit message')), |
3503
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2492 ('b', 'base', '', _('base path (DEPRECATED)')), |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
2493 ('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
|
2494 _('skip check for outstanding uncommitted changes'))], |
3517
b0dc459cd06c
Remove some more deprecated options from help syntax summaries
Matt Mackall <mpm@selenic.com>
parents:
3516
diff
changeset
|
2495 _('hg import [-p NUM] [-m MESSAGE] [-f] PATCH...')), |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
2496 "incoming|in": (incoming, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2497 [('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
|
2498 ('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
|
2499 _('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
|
2500 ('', '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
|
2501 ('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
|
2502 ('', '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
|
2503 ('p', 'patch', None, _('show patch')), |
2878
982c3237c63d
Make clear that hg pull -r REV pulls "up to" a revision.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
2875
diff
changeset
|
2504 ('r', 'rev', [], _('a specific revision up to which 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
|
2505 ('', 'template', '', _('display with template')), |
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2506 ] + remoteopts, |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
2507 _('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
|
2508 ' [--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
|
2509 "^init": |
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2510 (init, remoteopts, _('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
|
2511 "locate": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2512 (locate, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2513 [('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
|
2514 ('0', 'print0', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
2515 _('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
|
2516 ('f', 'fullpath', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
2517 _('print complete paths from the filesystem root')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2518 ] + walkopts, |
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
|
2519 _('hg locate [OPTION]... [PATTERN]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2520 "^log|history": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2521 (log, |
3503
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2522 [('b', 'branches', None, _('show branches (DEPRECATED)')), |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
2523 ('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
|
2524 _('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
|
2525 ('', '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
|
2526 _('only follow the first parent of merge changesets')), |
3197 | 2527 ('C', 'copies', None, _('show copied 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
|
2528 ('k', 'keyword', [], _('search for a keyword')), |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
2529 ('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
|
2530 ('r', 'rev', [], _('show the specified revision or range')), |
3657 | 2531 ('', 'removed', None, _('include revs where files were removed')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2532 ('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
|
2533 ('', '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
|
2534 ('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
|
2535 ('p', 'patch', None, _('show patch')), |
2901 | 2536 ('P', 'prune', [], _('do not display revision or any of its ancestors')), |
1920 | 2537 ('', 'template', '', _('display with template')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2538 ] + walkopts, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2539 _('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
|
2540 "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
|
2541 "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
|
2542 (merge, |
3503
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2543 [('b', 'branch', '', _('merge with head of a specific branch (DEPRECATED)')), |
2044
b343e7d454b4
Don't allow --style and --template for hg update and hg merge.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2043
diff
changeset
|
2544 ('f', 'force', None, _('force a merge with outstanding changes'))], |
3504
f4ab58d4ccd4
Remove [-b] options from help syntax lines
Matt Mackall <mpm@selenic.com>
parents:
3503
diff
changeset
|
2545 _('hg merge [-f] [REV]')), |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
2546 "outgoing|out": (outgoing, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2547 [('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
|
2548 ('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
|
2549 _('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
|
2550 ('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
|
2551 ('', '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
|
2552 ('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
|
2553 ('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
|
2554 ('', 'template', '', _('display with template')), |
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2555 ] + remoteopts, |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
2556 _('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
|
2557 "^parents": |
5a36609f73a7
add a -b/--branch option to 'hg parents'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1720
diff
changeset
|
2558 (parents, |
3503
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2559 [('b', 'branches', None, _('show branches (DEPRECATED)')), |
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
|
2560 ('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
|
2561 ('', '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
|
2562 ('', 'template', '', _('display with template'))], |
3504
f4ab58d4ccd4
Remove [-b] options from help syntax lines
Matt Mackall <mpm@selenic.com>
parents:
3503
diff
changeset
|
2563 _('hg parents [-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
|
2564 "paths": (paths, [], _('hg paths [NAME]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2565 "^pull": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2566 (pull, |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
2567 [('u', 'update', None, |
3198
a32f65549b9e
Documentation clarification for --update option to pull and unbundle
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3197
diff
changeset
|
2568 _('update to new tip if changesets were pulled')), |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
2569 ('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
|
2570 _('run even when remote repository is unrelated')), |
2878
982c3237c63d
Make clear that hg pull -r REV pulls "up to" a revision.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
2875
diff
changeset
|
2571 ('r', 'rev', [], _('a specific revision up to which you would like to pull')), |
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2572 ] + remoteopts, |
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
|
2573 _('hg pull [-u] [-r REV]... [-e FILE] [--remotecmd FILE] [SOURCE]')), |
818 | 2574 "^push": |
2575 (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
|
2576 [('f', 'force', None, _('force push')), |
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
|
2577 ('r', 'rev', [], _('a specific revision you would like to push')), |
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2578 ] + remoteopts, |
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
|
2579 _('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
|
2580 "debugrawcommit|rawcommit": |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2581 (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
|
2582 [('p', 'parent', [], _('parent')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2583 ('d', 'date', '', _('date code')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2584 ('u', 'user', '', _('user')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2585 ('F', 'files', '', _('file list')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2586 ('m', 'message', '', _('commit message')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2587 ('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
|
2588 _('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
|
2589 "recover": (recover, [], _('hg recover')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2590 "^remove|rm": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2591 (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
|
2592 [('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
|
2593 ('f', 'force', None, _('remove file even if modified')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2594 ] + walkopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2595 _('hg remove [OPTION]... FILE...')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2596 "rename|mv": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2597 (rename, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2598 [('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
|
2599 ('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
|
2600 _('forcibly copy over an existing managed file')), |
3189
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2601 ] + walkopts + dryrunopts, |
1869
42c76ec7a8d4
Reordered options for remove, fixed synopsis for rename.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1867
diff
changeset
|
2602 _('hg rename [OPTION]... SOURCE... DEST')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2603 "^revert": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2604 (revert, |
2983
3b7626b861f8
revert: add -a as alias for --all
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2982
diff
changeset
|
2605 [('a', 'all', None, _('revert all changes when no arguments given')), |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
2606 ('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
|
2607 ('', 'no-backup', None, _('do not save backup copies of files')), |
3189
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2608 ] + walkopts + dryrunopts, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2609 _('hg revert [-r REV] [NAME]...')), |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2610 "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
|
2611 "root": (root, [], _('hg root')), |
3553
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
2612 "showconfig|debugconfig": |
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
2613 (showconfig, |
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
2614 [('u', 'untrusted', None, _('show untrusted configuration options'))], |
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
2615 _('showconfig [-u] [NAME]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2616 "^serve": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2617 (serve, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2618 [('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
|
2619 ('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
|
2620 ('', '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
|
2621 ('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
|
2622 ('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
|
2623 ('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
|
2624 ('n', 'name', '', |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
2625 _('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
|
2626 ('', '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
|
2627 ' (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
|
2628 ('', '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
|
2629 ('', '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
|
2630 ('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
|
2631 ('', '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
|
2632 ('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
|
2633 _('hg serve [OPTION]...')), |
1507
cd8fadd8c689
Add explicit 'st' alias for status
Matt Mackall <mpm@selenic.com>
parents:
1506
diff
changeset
|
2634 "^status|st": |
840
141744605b51
hg status: added options to select files by status.
tksoh@users.sourceforge.net
parents:
839
diff
changeset
|
2635 (status, |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2636 [('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
|
2637 ('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
|
2638 ('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
|
2639 ('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
|
2640 ('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
|
2641 ('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
|
2642 ('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
|
2643 ('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
|
2644 ('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
|
2645 ('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
|
2646 ('0', 'print0', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
2647 _('end filenames with NUL, for use with xargs')), |
3467
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
2648 ('', 'rev', [], _('show difference from revision')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2649 ] + walkopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2650 _('hg status [OPTION]... [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2651 "tag": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2652 (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
|
2653 [('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
|
2654 ('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
|
2655 ('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
|
2656 ('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
|
2657 ('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
|
2658 _('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
|
2659 "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
|
2660 "tip": |
8eaa8e06a364
Add option -b/--branch to hg tip (as done for hg parents).
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1761
diff
changeset
|
2661 (tip, |
3503
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2662 [('b', 'branches', None, _('show branches (DEPRECATED)')), |
1913
74cf2b2f43d4
fix some things people wanted to be cleaner.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1910
diff
changeset
|
2663 ('', '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
|
2664 ('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
|
2665 ('', 'template', '', _('display with template'))], |
3504
f4ab58d4ccd4
Remove [-b] options from help syntax lines
Matt Mackall <mpm@selenic.com>
parents:
3503
diff
changeset
|
2666 _('hg tip [-p]')), |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2667 "unbundle": |
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2668 (unbundle, |
1601
a1b25fb2e764
Error handling for unbundle, fix option line wrapping
Matt Mackall <mpm@selenic.com>
parents:
1600
diff
changeset
|
2669 [('u', 'update', None, |
3198
a32f65549b9e
Documentation clarification for --update option to pull and unbundle
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3197
diff
changeset
|
2670 _('update to new tip if changesets were unbundled'))], |
1600
728fd9584993
add --update support to 'hg unbundle'
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1596
diff
changeset
|
2671 _('hg unbundle [-u] FILE')), |
593 | 2672 "^update|up|checkout|co": |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2673 (update, |
3503
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2674 [('b', 'branch', '', |
b28d3e0f9a8c
Deprecate old --branch/branches options
Matt Mackall <mpm@selenic.com>
parents:
3502
diff
changeset
|
2675 _('checkout the head of a specific branch (DEPRECATED)')), |
2283
e506c14382fd
deprecate 'update -m'. use 'merge' instead.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2272
diff
changeset
|
2676 ('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
|
2677 ('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
|
2678 ('f', 'force', None, _('force a merge with outstanding changes'))], |
3517
b0dc459cd06c
Remove some more deprecated options from help syntax summaries
Matt Mackall <mpm@selenic.com>
parents:
3516
diff
changeset
|
2679 _('hg update [-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
|
2680 "verify": (verify, [], _('hg verify')), |
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2681 "version": (version_, [], _('hg version')), |
1046
772507daaa17
Sort global options by topic: directories, ui, timing, other
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1044
diff
changeset
|
2682 } |
209 | 2683 |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2684 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
|
2685 " debugindex debugindexdot") |
3268
bb057b6ce3cf
Un-debugify debugconfig to showconfig. (issue 317)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3250
diff
changeset
|
2686 optionalrepo = ("paths serve showconfig") |
209 | 2687 |
2988
63c3a1921a67
Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2983
diff
changeset
|
2688 def findpossible(ui, cmd): |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2689 """ |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2690 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
|
2691 for each matching command. |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
2692 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
|
2693 """ |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2694 choice = {} |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2695 debugchoice = {} |
212
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
2696 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
|
2697 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
|
2698 found = None |
1506
11c8b81f95fe
if unambigious command name are passed, use them
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1505
diff
changeset
|
2699 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
|
2700 found = cmd |
2988
63c3a1921a67
Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2983
diff
changeset
|
2701 elif not ui.config("ui", "strict"): |
2049
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
2702 for a in aliases: |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
2703 if a.startswith(cmd): |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
2704 found = a |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
2705 break |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
2706 if found is not None: |
3317
399c04369a1b
fix bash completion of debug commands; add test for debugcomplete
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3284
diff
changeset
|
2707 if aliases[0].startswith("debug") or found.startswith("debug"): |
2049
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
2708 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
|
2709 else: |
f70952384ae7
Make completion for debugindex<tab><tab> show debugindexdot, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2045
diff
changeset
|
2710 choice[found] = (aliases, table[e]) |
1739
57de7e1a81d2
AmbiguousCommand is raised too soon.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
1736
diff
changeset
|
2711 |
1850
05f6c0d1bad8
Hide debug commands in ambiguous command list, unless no normal command matches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1849
diff
changeset
|
2712 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
|
2713 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
|
2714 |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2715 return choice |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2716 |
2988
63c3a1921a67
Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2983
diff
changeset
|
2717 def findcmd(ui, cmd): |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2718 """Return (aliases, command table entry) for command string.""" |
2988
63c3a1921a67
Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2983
diff
changeset
|
2719 choice = findpossible(ui, cmd) |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2720 |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2721 if choice.has_key(cmd): |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2722 return choice[cmd] |
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2723 |
1848
bb70ffebe77b
show choices on ambiguous commands
TK Soh <teekaysoh@yahoo.com>
parents:
1840
diff
changeset
|
2724 if len(choice) > 1: |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2725 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
|
2726 clist.sort() |
1848
bb70ffebe77b
show choices on ambiguous commands
TK Soh <teekaysoh@yahoo.com>
parents:
1840
diff
changeset
|
2727 raise AmbiguousCommand(cmd, clist) |
1739
57de7e1a81d2
AmbiguousCommand is raised too soon.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
1736
diff
changeset
|
2728 |
1517
b582dbc16165
Canonicalize command when using aliases or prefix matching.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1507
diff
changeset
|
2729 if choice: |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
2730 return choice.values()[0] |
212
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
2731 |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
2732 raise UnknownCommand(cmd) |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
2733 |
214 | 2734 def catchterm(*args): |
2153
635653cd73ab
move SignalInterrupt class into util module.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2140
diff
changeset
|
2735 raise util.SignalInterrupt |
214 | 2736 |
249 | 2737 def run(): |
2738 sys.exit(dispatch(sys.argv[1:])) | |
2739 | |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2740 class ParseError(Exception): |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2741 """Exception raised on errors in parsing the command line.""" |
592 | 2742 |
1453
6fbb13b7a59f
get command defaults from hgrc
TK Soh <teekaysoh@yahoo.com>
parents:
1447
diff
changeset
|
2743 def parse(ui, args): |
209 | 2744 options = {} |
596 | 2745 cmdoptions = {} |
209 | 2746 |
592 | 2747 try: |
596 | 2748 args = fancyopts.fancyopts(args, globalopts, options) |
592 | 2749 except fancyopts.getopt.GetoptError, inst: |
618
4051b78c53c7
Handle unrecognised options correctly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
617
diff
changeset
|
2750 raise ParseError(None, inst) |
209 | 2751 |
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
|
2752 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
|
2753 cmd, args = args[0], args[1:] |
2988
63c3a1921a67
Add ui.strict config item.
Bryan O'Sullivan <bos@serpentine.com>
parents:
2983
diff
changeset
|
2754 aliases, i = findcmd(ui, cmd) |
1567
b4956bbbadc9
make command defaults works for aliases
TK Soh <teekaysoh@yahoo.com>
parents:
1565
diff
changeset
|
2755 cmd = aliases[0] |
1453
6fbb13b7a59f
get command defaults from hgrc
TK Soh <teekaysoh@yahoo.com>
parents:
1447
diff
changeset
|
2756 defaults = ui.config("defaults", cmd) |
6fbb13b7a59f
get command defaults from hgrc
TK Soh <teekaysoh@yahoo.com>
parents:
1447
diff
changeset
|
2757 if defaults: |
3068
15526271eafb
allow shell-quoting in command defaults
TK Soh <teekaysoh@yahoo.com>
parents:
3029
diff
changeset
|
2758 args = shlex.split(defaults) + 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
|
2759 c = list(i[1]) |
209 | 2760 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
|
2761 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
|
2762 c = [] |
209 | 2763 |
592 | 2764 # combine global options into local |
596 | 2765 for o in globalopts: |
592 | 2766 c.append((o[0], o[1], options[o[1]], o[3])) |
214 | 2767 |
293 | 2768 try: |
596 | 2769 args = fancyopts.fancyopts(args, c, cmdoptions) |
293 | 2770 except fancyopts.getopt.GetoptError, inst: |
596 | 2771 raise ParseError(cmd, inst) |
209 | 2772 |
592 | 2773 # separate global options back out |
596 | 2774 for o in globalopts: |
592 | 2775 n = o[1] |
2776 options[n] = cmdoptions[n] | |
2777 del cmdoptions[n] | |
2778 | |
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
|
2779 return (cmd, cmd and i[0] or None, args, options, cmdoptions) |
596 | 2780 |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
2781 external = {} |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
2782 |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
2783 def findext(name): |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
2784 '''return module with given extension name''' |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
2785 try: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
2786 return sys.modules[external[name]] |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
2787 except KeyError: |
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
2788 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
|
2789 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
|
2790 return sys.modules[v] |
2553
5b426676f616
help: make "hg help EXTENSION" work
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2549
diff
changeset
|
2791 raise KeyError(name) |
2600
c4325f0a9b91
clean up trailing white space.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2598
diff
changeset
|
2792 |
2944
2efa9b8aed30
load extensions from every hgrc.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2943
diff
changeset
|
2793 def load_extensions(ui): |
2efa9b8aed30
load extensions from every hgrc.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2943
diff
changeset
|
2794 added = [] |
2efa9b8aed30
load extensions from every hgrc.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2943
diff
changeset
|
2795 for ext_name, load_from_name in ui.extensions(): |
2efa9b8aed30
load extensions from every hgrc.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2943
diff
changeset
|
2796 if ext_name in external: |
2efa9b8aed30
load extensions from every hgrc.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2943
diff
changeset
|
2797 continue |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
2798 try: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
2799 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
|
2800 # 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
|
2801 # 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
|
2802 # 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
|
2803 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
|
2804 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
|
2805 else: |
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
2806 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
|
2807 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
|
2808 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
|
2809 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
|
2810 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
|
2811 return mod |
1889
468730910353
Try to import extensions from the hgext module first.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1887
diff
changeset
|
2812 try: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
2813 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
|
2814 except ImportError: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
2815 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
|
2816 external[ext_name] = mod.__name__ |
2944
2efa9b8aed30
load extensions from every hgrc.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2943
diff
changeset
|
2817 added.append((mod, ext_name)) |
2428
42b8a1ff46cf
honor signals during load of extensions.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2422
diff
changeset
|
2818 except (util.SignalInterrupt, KeyboardInterrupt): |
42b8a1ff46cf
honor signals during load of extensions.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2422
diff
changeset
|
2819 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
|
2820 except Exception, inst: |
2943
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2821 ui.warn(_("*** failed to import extension %s: %s\n") % |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2822 (ext_name, inst)) |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2823 if ui.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
|
2824 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
|
2825 |
2944
2efa9b8aed30
load extensions from every hgrc.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2943
diff
changeset
|
2826 for mod, name in added: |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
2827 uisetup = getattr(mod, 'uisetup', None) |
2330
b30aa02c85e7
add 'uisetup' function to extension module protocol.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2309
diff
changeset
|
2828 if uisetup: |
2944
2efa9b8aed30
load extensions from every hgrc.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2943
diff
changeset
|
2829 uisetup(ui) |
2573
b13a98bd078e
fix problems with external module handling. found by benoit boissinot.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2571
diff
changeset
|
2830 cmdtable = getattr(mod, 'cmdtable', {}) |
1295
abcdf14449ea
Make contract with extensions optional.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1285
diff
changeset
|
2831 for t in cmdtable: |
1071 | 2832 if t in table: |
2943
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2833 ui.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
|
2834 table.update(cmdtable) |
3223
53e843840349
Whitespace/Tab cleanup
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3204
diff
changeset
|
2835 |
3346
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2836 def parseconfig(config): |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2837 """parse the --config options from the command line""" |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2838 parsed = [] |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2839 for cfg in config: |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2840 try: |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2841 name, value = cfg.split('=', 1) |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2842 section, name = name.split('.', 1) |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2843 if not section or not name: |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2844 raise IndexError |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2845 parsed.append((section, name, value)) |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2846 except (IndexError, ValueError): |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2847 raise util.Abort(_('malformed --config option: %s') % cfg) |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2848 return parsed |
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3345
diff
changeset
|
2849 |
2943
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2850 def dispatch(args): |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2851 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2852 num = getattr(signal, name, None) |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2853 if num: signal.signal(num, catchterm) |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2854 |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2855 try: |
3014
01454af644b8
load extensions only after the ui object has been completely initialized
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2991
diff
changeset
|
2856 u = ui.ui(traceback='--traceback' in sys.argv[1:]) |
2943
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2857 except util.Abort, inst: |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2858 sys.stderr.write(_("abort: %s\n") % inst) |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2859 return -1 |
8e59010158ce
refactor extension loading.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2854
diff
changeset
|
2860 |
3014
01454af644b8
load extensions only after the ui object has been completely initialized
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2991
diff
changeset
|
2861 load_extensions(u) |
01454af644b8
load extensions only after the ui object has been completely initialized
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2991
diff
changeset
|
2862 u.addreadhook(load_extensions) |
01454af644b8
load extensions only after the ui object has been completely initialized
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2991
diff
changeset
|
2863 |
596 | 2864 try: |
1453
6fbb13b7a59f
get command defaults from hgrc
TK Soh <teekaysoh@yahoo.com>
parents:
1447
diff
changeset
|
2865 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
|
2866 if options["time"]: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2867 def get_times(): |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2868 t = os.times() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2869 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
|
2870 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
|
2871 return t |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2872 s = get_times() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2873 def print_time(): |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2874 t = get_times() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2875 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
|
2876 (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
|
2877 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
|
2878 |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2879 # 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
|
2880 if options['debugger']: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2881 pdb.set_trace() |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2882 |
527 | 2883 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
|
2884 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
|
2885 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
|
2886 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
|
2887 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
|
2888 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
|
2889 (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
|
2890 |
3348
e4aa22eaa0e4
call ui.updateopts only after changing directories
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3346
diff
changeset
|
2891 u.updateopts(options["verbose"], options["debug"], options["quiet"], |
e4aa22eaa0e4
call ui.updateopts only after changing directories
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3346
diff
changeset
|
2892 not options["noninteractive"], options["traceback"], |
e4aa22eaa0e4
call ui.updateopts only after changing directories
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3346
diff
changeset
|
2893 parseconfig(options["config"])) |
e4aa22eaa0e4
call ui.updateopts only after changing directories
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3346
diff
changeset
|
2894 |
1894
4c53aaf2d153
Allow symbolic path names in global -R/--repository parameter.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1893
diff
changeset
|
2895 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
|
2896 repo = path and hg.repository(u, path=path) or None |
3278
23682d3e4111
disallow commands on non local repository
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3268
diff
changeset
|
2897 if repo and not repo.local(): |
23682d3e4111
disallow commands on non local repository
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3268
diff
changeset
|
2898 raise util.Abort(_("repository '%s' is not local") % path) |
1857
848152a2e67f
Always try to open the repository if -R/--repository is specified.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1851
diff
changeset
|
2899 |
1048
7fbb440b2e63
Added options -h/--help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1047
diff
changeset
|
2900 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
|
2901 return help_(u, cmd, options['version']) |
1048
7fbb440b2e63
Added options -h/--help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1047
diff
changeset
|
2902 elif options['version']: |
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2903 return 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
|
2904 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
|
2905 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
|
2906 |
527 | 2907 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
|
2908 try: |
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
2909 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
|
2910 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
|
2911 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
|
2912 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
|
2913 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
|
2914 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
|
2915 mod.reposetup(u, repo) |
2847
2ff57e3113a4
call reposetup functions of extension modules whenever repo created
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2812
diff
changeset
|
2916 hg.repo_setup_hooks.append(mod.reposetup) |
1858
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
2917 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
|
2918 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
|
2919 raise |
596 | 2920 d = lambda: func(u, repo, *args, **cmdoptions) |
527 | 2921 else: |
596 | 2922 d = lambda: func(u, *args, **cmdoptions) |
209 | 2923 |
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
|
2924 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
|
2925 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
|
2926 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
|
2927 prof = hotshot.Profile("hg.prof") |
1832
7a58bf789965
generate profile even when exception raised.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1823
diff
changeset
|
2928 try: |
7a58bf789965
generate profile even when exception raised.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1823
diff
changeset
|
2929 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
|
2930 return prof.runcall(d) |
1832
7a58bf789965
generate profile even when exception raised.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1823
diff
changeset
|
2931 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
|
2932 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
|
2933 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
|
2934 '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
|
2935 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
|
2936 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
|
2937 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
|
2938 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
|
2939 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
|
2940 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
|
2941 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
|
2942 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
|
2943 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
|
2944 elif options['lsprof']: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2945 try: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2946 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
|
2947 except ImportError: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2948 raise util.Abort(_( |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2949 '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
|
2950 '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
|
2951 p = lsprof.Profiler() |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2952 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
|
2953 try: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2954 return d() |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2955 finally: |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2956 p.disable() |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2957 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
|
2958 stats.sort() |
6aa75e77cafe
add --lsprof option. 3x faster than --profile, more useful output.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2417
diff
changeset
|
2959 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
|
2960 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
|
2961 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
|
2962 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
|
2963 u.flush() |
527 | 2964 except: |
1225 | 2965 # enter the debugger when we hit an exception |
2966 if options['debugger']: | |
2967 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
|
2968 u.print_exc() |
527 | 2969 raise |
1875
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2970 except ParseError, inst: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2971 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
|
2972 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
|
2973 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
|
2974 else: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2975 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
|
2976 help_(u, 'shortlist') |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2977 except AmbiguousCommand, inst: |
1920 | 2978 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
|
2979 (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
|
2980 except UnknownCommand, inst: |
2f4a0734c100
Catch other exceptions (e.g. util.Abort) in parse(), too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1869
diff
changeset
|
2981 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
|
2982 help_(u, 'shortlist') |
499 | 2983 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
|
2984 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
|
2985 except lock.LockHeld, inst: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2986 if inst.errno == errno.ETIMEDOUT: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2987 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
|
2988 else: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2989 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
|
2990 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
|
2991 except lock.LockUnavailable, inst: |
ff5c9a92f556
fix backtrace printed when cannot get lock.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2992 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
|
2993 (inst.desc or inst.filename, inst.strerror)) |
1214 | 2994 except revlog.RevlogError, inst: |
3072
bc3fe3b5b785
Never apply string formatting to generated errors with util.Abort.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3071
diff
changeset
|
2995 u.warn(_("abort: %s!\n") % inst) |
2153
635653cd73ab
move SignalInterrupt class into util module.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2140
diff
changeset
|
2996 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
|
2997 u.warn(_("killed!\n")) |
209 | 2998 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
|
2999 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
|
3000 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
|
3001 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
|
3002 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
|
3003 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
|
3004 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
|
3005 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
|
3006 raise |
250 | 3007 except IOError, inst: |
395 | 3008 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
|
3009 u.warn(_("abort: %s\n") % inst) |
395 | 3010 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
|
3011 u.warn(_("abort: error: %s\n") % inst.reason[1]) |
395 | 3012 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
|
3013 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
|
3014 u.warn(_("broken pipe\n")) |
1350 | 3015 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
|
3016 if getattr(inst, "filename", None): |
3080
e270cbd4aa20
Fixed OSError "No such file or directory: None" and make IOError consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3079
diff
changeset
|
3017 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
|
3018 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
|
3019 u.warn(_("abort: %s\n") % inst.strerror) |
250 | 3020 else: |
3021 raise | |
549 | 3022 except OSError, inst: |
3080
e270cbd4aa20
Fixed OSError "No such file or directory: None" and make IOError consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3079
diff
changeset
|
3023 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
|
3024 u.warn(_("abort: %s: %s\n") % (inst.strerror, inst.filename)) |
549 | 3025 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
|
3026 u.warn(_("abort: %s\n") % inst.strerror) |
3564
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3027 except util.UnexpectedOutput, inst: |
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3028 u.warn(_("abort: %s") % inst[0]) |
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3029 if not isinstance(inst[1], basestring): |
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3030 u.warn(" %r\n" % (inst[1],)) |
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3031 elif not inst[1]: |
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3032 u.warn(_(" empty string\n")) |
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3033 else: |
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3034 u.warn("\n%r%s\n" % |
eda9e7c9300d
New UnexpectedOutput exception to catch server errors in localrepo.stream_in
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3563
diff
changeset
|
3035 (inst[1][:400], len(inst[1]) > 400 and '...' or '')) |
870
a82eae840447
Teach walk code about absolute paths.
Bryan O'Sullivan <bos@serpentine.com>
parents:
868
diff
changeset
|
3036 except util.Abort, inst: |
3072
bc3fe3b5b785
Never apply string formatting to generated errors with util.Abort.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3071
diff
changeset
|
3037 u.warn(_("abort: %s\n") % inst) |
212
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3038 except TypeError, inst: |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3039 # was this an argument error? |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3040 tb = traceback.extract_tb(sys.exc_info()[2]) |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3041 if len(tb) > 2: # no |
48398a5353e3
commands: better argument processing, per-command help
mpm@selenic.com
parents:
211
diff
changeset
|
3042 raise |
293 | 3043 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
|
3044 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
|
3045 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
|
3046 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
|
3047 # 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
|
3048 # 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
|
3049 return inst.code |
1215
8b4435aae40a
Add reporting instructions to unknown exception backtraces
mpm@selenic.com
parents:
1214
diff
changeset
|
3050 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
|
3051 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
|
3052 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
|
3053 "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
|
3054 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
|
3055 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
|
3056 % version.get_version()) |
1215
8b4435aae40a
Add reporting instructions to unknown exception backtraces
mpm@selenic.com
parents:
1214
diff
changeset
|
3057 raise |
293 | 3058 |
2057
fef2d653beaf
Never exit directly from commands.dispatch(), but pass return code to caller.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2056
diff
changeset
|
3059 return -1 |