author | Thomas Arendsen Hein <thomas@intevation.de> |
Tue, 01 Apr 2008 08:33:17 +0200 | |
changeset 6438 | a60b711c7ac4 |
parent 6405 | b8346ae5d64b |
parent 6423 | fb374b1b3911 |
child 6442 | fa5454a451c6 |
child 6467 | 65029a3aafc2 |
permissions | -rw-r--r-- |
249 | 1 |
# commands.py - command processing for mercurial |
2 |
# |
|
4635
63b9d2deed48
Updated copyright notices and add "and others" to "hg version"
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4614
diff
changeset
|
3 |
# Copyright 2005-2007 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 |
||
6211
f89fd07fc51d
Expand import * to allow Pyflakes to find problems
Joel Rosdahl <joel@rosdahl.net>
parents:
6210
diff
changeset
|
8 |
from node import hex, nullid, nullrev, short |
6405
b8346ae5d64b
commands: fix shadowed repo module
Patrick Mezard <pmezard@gmail.com>
parents:
6385
diff
changeset
|
9 |
from repo import RepoError, NoCapability |
3891 | 10 |
from i18n import _ |
5034
c0417a319e39
commands: move commit to cmdutil as wrapper for commit-like functions
Bryan O'Sullivan <bos@serpentine.com>
parents:
4967
diff
changeset
|
11 |
import os, re, sys, urllib |
6276
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
12 |
import hg, util, revlog, bundlerepo, extensions, copies |
3877
abaee83ce0a6
Replace demandload with new demandimport
Matt Mackall <mpm@selenic.com>
parents:
3876
diff
changeset
|
13 |
import difflib, patch, time, help, mdiff, tempfile |
6212 | 14 |
import version, socket |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
15 |
import archival, changegroup, cmdutil, hgweb.server, sshserver, hbisect |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
16 |
|
255 | 17 |
# Commands start here, listed alphabetically |
209 | 18 |
|
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
19 |
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
|
20 |
"""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
|
21 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
22 |
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
|
23 |
|
3829
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
24 |
The files will be added to the repository at the next commit. To |
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
25 |
undo an add before that, see hg revert. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
26 |
|
1568
1d7d0c07e8f3
make all commands be repo-wide by default
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1567
diff
changeset
|
27 |
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
|
28 |
""" |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
29 |
|
5688
883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents:
5660
diff
changeset
|
30 |
rejected = None |
883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents:
5660
diff
changeset
|
31 |
exacts = {} |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
32 |
names = [] |
5688
883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents:
5660
diff
changeset
|
33 |
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, |
883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents:
5660
diff
changeset
|
34 |
badmatch=util.always): |
942
7eb8cbcca7c4
Modify commands.walk to yield a 4-tuple.
Bryan O'Sullivan <bos@serpentine.com>
parents:
940
diff
changeset
|
35 |
if exact: |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
36 |
if ui.verbose: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
37 |
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
|
38 |
names.append(abs) |
5688
883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents:
5660
diff
changeset
|
39 |
exacts[abs] = 1 |
4906
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
40 |
elif abs not in repo.dirstate: |
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
|
41 |
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
|
42 |
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
|
43 |
if not opts.get('dry_run'): |
5688
883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents:
5660
diff
changeset
|
44 |
rejected = repo.add(names) |
883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents:
5660
diff
changeset
|
45 |
rejected = [p for p in rejected if p in exacts] |
883d887c6408
commands: add exits(1) if a specified file cannot be added (issue 891)
Patrick Mezard <pmezard@gmail.com>
parents:
5660
diff
changeset
|
46 |
return rejected and 1 or 0 |
213 | 47 |
|
766
b444a7e053f1
Get addremove to use new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
764
diff
changeset
|
48 |
def addremove(ui, repo, *pats, **opts): |
3181
3637d5d17cbc
Documentation fixes for addremove.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3172
diff
changeset
|
49 |
"""add all new files, delete all missing files |
2181
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
50 |
|
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
51 |
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
|
52 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
53 |
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
|
54 |
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
|
55 |
|
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
56 |
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
|
57 |
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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
""" |
4966
8d982aef0be1
addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents:
4950
diff
changeset
|
62 |
try: |
8d982aef0be1
addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents:
4950
diff
changeset
|
63 |
sim = float(opts.get('similarity') or 0) |
8d982aef0be1
addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents:
4950
diff
changeset
|
64 |
except ValueError: |
8d982aef0be1
addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents:
4950
diff
changeset
|
65 |
raise util.Abort(_('similarity must be a number')) |
2958
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
66 |
if sim < 0 or sim > 100: |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
67 |
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
|
68 |
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
|
69 |
|
733
1966c553f652
Convert annotate over to walk interface.
Bryan O'Sullivan <bos@serpentine.com>
parents:
732
diff
changeset
|
70 |
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
|
71 |
"""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
|
72 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
73 |
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
|
74 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
75 |
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
|
76 |
place. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
77 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
78 |
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
|
79 |
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
|
80 |
anyway, probably with undesirable results. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
81 |
""" |
6134
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
82 |
datefunc = ui.quiet and util.shortdate or util.datestr |
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
83 |
getdate = util.cachefunc(lambda x: datefunc(x[0].date())) |
1522 | 84 |
|
744 | 85 |
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
|
86 |
raise util.Abort(_('at least one file name or pattern required')) |
744 | 87 |
|
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
88 |
opmap = [('user', lambda x: ui.shortuser(x[0].user())), |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
89 |
('number', lambda x: str(x[0].rev())), |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
90 |
('changeset', lambda x: short(x[0].node())), |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
91 |
('date', getdate), |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
92 |
('follow', lambda x: x[0].path()), |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
93 |
] |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
94 |
|
3172
5c93dd0ae413
Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents:
3159
diff
changeset
|
95 |
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
|
96 |
and not opts['follow']): |
714
29fcd195e056
Some cleanups in commands.annotate().
Thomas Arendsen Hein <thomas@intevation.de>
parents:
712
diff
changeset
|
97 |
opts['number'] = 1 |
209 | 98 |
|
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
99 |
linenumber = opts.get('line_number') is not None |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
100 |
if (linenumber and (not opts['changeset']) and (not opts['number'])): |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
101 |
raise util.Abort(_('at least one of -n/-c is required for -l')) |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
102 |
|
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
103 |
funcmap = [func for op, func in opmap if opts.get(op)] |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
104 |
if linenumber: |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
105 |
lastfunc = funcmap[-1] |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
106 |
funcmap[-1] = lambda x: "%s:%s" % (lastfunc(x), x[1]) |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
107 |
|
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
108 |
ctx = repo.changectx(opts['rev']) |
1016 | 109 |
|
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
110 |
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
|
111 |
node=ctx.node()): |
2566
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
112 |
fctx = ctx.filectx(abs) |
d8560b458f76
Convert hg annotate to context api
Matt Mackall <mpm@selenic.com>
parents:
2565
diff
changeset
|
113 |
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
|
114 |
ui.write(_("%s: binary file\n") % ((pats and rel) or abs)) |
1016 | 115 |
continue |
116 |
||
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
117 |
lines = fctx.annotate(follow=opts.get('follow'), |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
118 |
linenumber=linenumber) |
209 | 119 |
pieces = [] |
120 |
||
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
121 |
for f in funcmap: |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
122 |
l = [f(n) for n, dummy in lines] |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
123 |
if l: |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
124 |
m = max(map(len, l)) |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
125 |
pieces.append(["%*s" % (m, x) for x in l]) |
209 | 126 |
|
771 | 127 |
if pieces: |
128 |
for p, l in zip(zip(*pieces), lines): |
|
129 |
ui.write("%s: %s" % (" ".join(p), l[1])) |
|
209 | 130 |
|
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
131 |
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
|
132 |
'''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
|
133 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
134 |
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
|
135 |
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
|
136 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
137 |
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
|
138 |
types are: |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
139 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
140 |
"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
|
141 |
"tar": tar archive, uncompressed |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
142 |
"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
|
143 |
"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
|
144 |
"uzip": zip archive, uncompressed |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
145 |
"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
|
146 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
147 |
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
|
148 |
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
|
149 |
|
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
150 |
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
|
151 |
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
|
152 |
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
|
153 |
''' |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
154 |
|
5061
a49f2a4d5ff7
archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents:
4966
diff
changeset
|
155 |
ctx = repo.changectx(opts['rev']) |
a49f2a4d5ff7
archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents:
4966
diff
changeset
|
156 |
if not ctx: |
a49f2a4d5ff7
archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents:
4966
diff
changeset
|
157 |
raise util.Abort(_('repository has no revisions')) |
a49f2a4d5ff7
archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents:
4966
diff
changeset
|
158 |
node = ctx.node() |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
159 |
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
|
160 |
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
|
161 |
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
|
162 |
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
|
163 |
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
|
164 |
prefix = opts['prefix'] |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
165 |
if dest == '-': |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
166 |
if kind == 'files': |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
167 |
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
|
168 |
dest = sys.stdout |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
169 |
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
|
170 |
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
|
171 |
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
|
172 |
matchfn, prefix) |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
173 |
|
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
174 |
def backout(ui, repo, node=None, rev=None, **opts): |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
175 |
'''reverse effect of earlier changeset |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
176 |
|
2254
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
177 |
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
|
178 |
changeset is a child of the backed out changeset. |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
179 |
|
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
180 |
If you back out a changeset other than the tip, a new head is |
6161
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
6146
diff
changeset
|
181 |
created. This head will be the new tip and you should merge this |
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
6146
diff
changeset
|
182 |
backout changeset with another head (current one by default). |
2254
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
183 |
|
827fcfe88b14
backout command: better help.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2245
diff
changeset
|
184 |
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
|
185 |
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
|
186 |
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
|
187 |
hand. The result of this merge is not committed, as for a normal |
6163
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
188 |
merge. |
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
189 |
|
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
190 |
See 'hg help dates' for a list of formats valid for -d/--date. |
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
191 |
''' |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
192 |
if rev and node: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
193 |
raise util.Abort(_("please specify just one revision")) |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
194 |
|
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
195 |
if not rev: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
196 |
rev = node |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
197 |
|
4726
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4718
diff
changeset
|
198 |
if not rev: |
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4718
diff
changeset
|
199 |
raise util.Abort(_("please specify a revision to backout")) |
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4718
diff
changeset
|
200 |
|
6139
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
201 |
date = opts.get('date') |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
202 |
if date: |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
203 |
opts['date'] = util.parsedate(date) |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
204 |
|
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
205 |
cmdutil.bail_if_changed(repo) |
5716
be367cbafe70
cmdutil: make bail_if_changed bail on uncommitted merge
Matt Mackall <mpm@selenic.com>
parents:
5688
diff
changeset
|
206 |
node = repo.lookup(rev) |
be367cbafe70
cmdutil: make bail_if_changed bail on uncommitted merge
Matt Mackall <mpm@selenic.com>
parents:
5688
diff
changeset
|
207 |
|
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
208 |
op1, op2 = repo.dirstate.parents() |
5568
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
5542
diff
changeset
|
209 |
a = repo.changelog.ancestor(op1, node) |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
5542
diff
changeset
|
210 |
if a != node: |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
5542
diff
changeset
|
211 |
raise util.Abort(_('cannot back out change on a different branch')) |
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
5542
diff
changeset
|
212 |
|
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
213 |
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
|
214 |
if p1 == nullid: |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
215 |
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
|
216 |
if p2 != nullid: |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
217 |
if not opts['parent']: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
218 |
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
|
219 |
'--parent')) |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
220 |
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
|
221 |
if p not in (p1, p2): |
3679
2956948b81f3
fix warnings generated by pygettext.py.
Marcos Chaves <marcos.nospam@gmail.com>
parents:
3673
diff
changeset
|
222 |
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
|
223 |
(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
|
224 |
parent = p |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
225 |
else: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
226 |
if opts['parent']: |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
227 |
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
|
228 |
parent = p1 |
5568
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
5542
diff
changeset
|
229 |
|
6423
fb374b1b3911
backout: reverse changeset belongs on current branch
Matt Mackall <mpm@selenic.com>
parents:
6385
diff
changeset
|
230 |
# the backout should appear on the same branch |
fb374b1b3911
backout: reverse changeset belongs on current branch
Matt Mackall <mpm@selenic.com>
parents:
6385
diff
changeset
|
231 |
branch = repo.dirstate.branch() |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
232 |
hg.clean(repo, node, show_stats=False) |
6423
fb374b1b3911
backout: reverse changeset belongs on current branch
Matt Mackall <mpm@selenic.com>
parents:
6385
diff
changeset
|
233 |
repo.dirstate.setbranch(branch) |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
234 |
revert_opts = opts.copy() |
3814
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
235 |
revert_opts['date'] = None |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
236 |
revert_opts['all'] = True |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
237 |
revert_opts['rev'] = hex(parent) |
6031
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
238 |
revert_opts['no_backup'] = None |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
239 |
revert(ui, repo, **revert_opts) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
240 |
commit_opts = opts.copy() |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
241 |
commit_opts['addremove'] = False |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
242 |
if not commit_opts['message'] and not commit_opts['logfile']: |
4718
934275cd4526
backout: report short hash in commit message
Matt Mackall <mpm@selenic.com>
parents:
4699
diff
changeset
|
243 |
commit_opts['message'] = _("Backed out changeset %s") % (short(node)) |
2268
6c9305fbebaf
fix coding style of backout editor change.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2267
diff
changeset
|
244 |
commit_opts['force_editor'] = True |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
245 |
commit(ui, repo, **commit_opts) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
246 |
def nice(node): |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
247 |
return '%d:%s' % (repo.changelog.rev(node), short(node)) |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
248 |
ui.status(_('changeset %s backs out changeset %s\n') % |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
249 |
(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
|
250 |
if op1 != node: |
6161
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
6146
diff
changeset
|
251 |
hg.clean(repo, op1, show_stats=False) |
2493
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
252 |
if opts['merge']: |
6161
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
6146
diff
changeset
|
253 |
ui.status(_('merging with changeset %s\n') % nice(repo.changelog.tip())) |
bc1ba9124799
Reverse the way backout is doing the merge
Gilles Moris <gilles.moris@free.fr>
parents:
6146
diff
changeset
|
254 |
hg.merge(repo, hex(repo.changelog.tip())) |
2493
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
255 |
else: |
9c660e691e90
print message after backout that tells that backout adds new head.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2482
diff
changeset
|
256 |
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
|
257 |
'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
|
258 |
ui.status(_('(use "backout --merge" ' |
0aa458261901
fix hg backup option recommendation for auto-merge
Christian Ebert <blacktrash@gmx.net>
parents:
2760
diff
changeset
|
259 |
'if you want to auto-merge)\n')) |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
260 |
|
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
261 |
def bisect(ui, repo, rev=None, extra=None, |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
262 |
reset=None, good=None, bad=None, skip=None, noupdate=None): |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
263 |
"""subdivision search of changesets |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
264 |
|
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
265 |
This command helps to find changesets which introduce problems. |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
266 |
To use, mark the earliest changeset you know exhibits the problem |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
267 |
as bad, then mark the latest changeset which is free from the |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
268 |
problem as good. Bisect will update your working directory to a |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
269 |
revision for testing. Once you have performed tests, mark the |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
270 |
working directory as bad or good and bisect will either update to |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
271 |
another candidate changeset or announce that it has found the bad |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
272 |
revision. |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
273 |
""" |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
274 |
# backward compatibility |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
275 |
if rev in "good bad reset init".split(): |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
276 |
ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
277 |
cmd, rev, extra = rev, extra, None |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
278 |
if cmd == "good": |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
279 |
good = True |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
280 |
elif cmd == "bad": |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
281 |
bad = True |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
282 |
else: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
283 |
reset = True |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
284 |
elif extra or good + bad + skip + reset > 1: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
285 |
raise util.Abort("Incompatible arguments") |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
286 |
|
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
287 |
if reset: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
288 |
p = repo.join("bisect.state") |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
289 |
if os.path.exists(p): |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
290 |
os.unlink(p) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
291 |
return |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
292 |
|
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
293 |
# load state |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
294 |
state = {'good': [], 'bad': [], 'skip': []} |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
295 |
if os.path.exists(repo.join("bisect.state")): |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
296 |
for l in repo.opener("bisect.state"): |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
297 |
kind, node = l[:-1].split() |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
298 |
node = repo.lookup(node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
299 |
if kind not in state: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
300 |
raise util.Abort(_("unknown bisect kind %s") % kind) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
301 |
state[kind].append(node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
302 |
|
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
303 |
# update state |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
304 |
node = repo.lookup(rev or '.') |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
305 |
if good: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
306 |
state['good'].append(node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
307 |
elif bad: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
308 |
state['bad'].append(node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
309 |
elif skip: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
310 |
state['skip'].append(node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
311 |
|
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
312 |
# save state |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
313 |
f = repo.opener("bisect.state", "w", atomictemp=True) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
314 |
wlock = repo.wlock() |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
315 |
try: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
316 |
for kind in state: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
317 |
for node in state[kind]: |
6217
fe8dbbe9520d
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
Joel Rosdahl <joel@rosdahl.net>
parents:
6212
diff
changeset
|
318 |
f.write("%s %s\n" % (kind, hex(node))) |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
319 |
f.rename() |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
320 |
finally: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
321 |
del wlock |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
322 |
|
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
323 |
if not state['good'] or not state['bad']: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
324 |
return |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
325 |
|
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
326 |
# actually bisect |
5776
35ec669cdd43
bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents:
5775
diff
changeset
|
327 |
node, changesets, good = hbisect.bisect(repo.changelog, state) |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
328 |
if changesets == 0: |
5776
35ec669cdd43
bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents:
5775
diff
changeset
|
329 |
ui.write(_("The first %s revision is:\n") % (good and "good" or "bad")) |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
330 |
displayer = cmdutil.show_changeset(ui, repo, {}) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
331 |
displayer.show(changenode=node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
332 |
elif node is not None: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
333 |
# compute the approximate number of remaining tests |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
334 |
tests, size = 0, 2 |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
335 |
while size <= changesets: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
336 |
tests, size = tests + 1, size * 2 |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
337 |
rev = repo.changelog.rev(node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
338 |
ui.write(_("Testing changeset %s:%s " |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
339 |
"(%s changesets remaining, ~%s tests)\n") |
6217
fe8dbbe9520d
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
Joel Rosdahl <joel@rosdahl.net>
parents:
6212
diff
changeset
|
340 |
% (rev, short(node), changesets, tests)) |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
341 |
if not noupdate: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
342 |
cmdutil.bail_if_changed(repo) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
343 |
return hg.clean(repo, node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
344 |
|
4202
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
345 |
def branch(ui, repo, label=None, **opts): |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
346 |
"""set or show the current branch name |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
347 |
|
4601
e69da61e467e
Notify the user that hg branch does not create a branch until commit
Brendan Cully <brendan@kublai.com>
parents:
4593
diff
changeset
|
348 |
With no argument, show the current branch name. With one argument, |
e69da61e467e
Notify the user that hg branch does not create a branch until commit
Brendan Cully <brendan@kublai.com>
parents:
4593
diff
changeset
|
349 |
set the working directory branch name (the branch does not exist in |
e69da61e467e
Notify the user that hg branch does not create a branch until commit
Brendan Cully <brendan@kublai.com>
parents:
4593
diff
changeset
|
350 |
the repository until the next commit). |
4202
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
351 |
|
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
352 |
Unless --force is specified, branch will not let you set a |
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
353 |
branch name that shadows an existing branch. |
5999
d1fe1a4eb2b7
Mention 'hg update' to switch branches in help for branch and branches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5998
diff
changeset
|
354 |
|
d1fe1a4eb2b7
Mention 'hg update' to switch branches in help for branch and branches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5998
diff
changeset
|
355 |
Use the command 'hg update' to switch to an existing branch. |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
356 |
""" |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
357 |
|
4179
7e1c8a565a4f
Move branch read/write to dirstate where it belongs
Matt Mackall <mpm@selenic.com>
parents:
4176
diff
changeset
|
358 |
if label: |
4202
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
359 |
if not opts.get('force') and label in repo.branchtags(): |
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
360 |
if label not in [p.branch() for p in repo.workingctx().parents()]: |
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
361 |
raise util.Abort(_('a branch of the same name already exists' |
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
362 |
' (use --force to override)')) |
4179
7e1c8a565a4f
Move branch read/write to dirstate where it belongs
Matt Mackall <mpm@selenic.com>
parents:
4176
diff
changeset
|
363 |
repo.dirstate.setbranch(util.fromlocal(label)) |
4601
e69da61e467e
Notify the user that hg branch does not create a branch until commit
Brendan Cully <brendan@kublai.com>
parents:
4593
diff
changeset
|
364 |
ui.status(_('marked working directory as branch %s\n') % label) |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
365 |
else: |
4179
7e1c8a565a4f
Move branch read/write to dirstate where it belongs
Matt Mackall <mpm@selenic.com>
parents:
4176
diff
changeset
|
366 |
ui.write("%s\n" % util.tolocal(repo.dirstate.branch())) |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
367 |
|
4675
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
368 |
def branches(ui, repo, active=False): |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
369 |
"""list repository named branches |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
370 |
|
4675
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
371 |
List the repository's named branches, indicating which ones are |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
372 |
inactive. If active is specified, only show active branches. |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
373 |
|
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
374 |
A branch is considered active if it contains unmerged heads. |
5999
d1fe1a4eb2b7
Mention 'hg update' to switch branches in help for branch and branches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5998
diff
changeset
|
375 |
|
d1fe1a4eb2b7
Mention 'hg update' to switch branches in help for branch and branches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5998
diff
changeset
|
376 |
Use the command 'hg update' to switch to an existing branch. |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
377 |
""" |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
378 |
b = repo.branchtags() |
4675
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
379 |
heads = dict.fromkeys(repo.heads(), 1) |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
380 |
l = [((n in heads), 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
|
381 |
l.sort() |
4675
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
382 |
l.reverse() |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
383 |
for ishead, r, n, t in l: |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
384 |
if active and not ishead: |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
385 |
# If we're only displaying active branches, abort the loop on |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
386 |
# encountering the first inactive head |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
387 |
break |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
388 |
else: |
4675
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
389 |
hexfunc = ui.debugflag and hex or short |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
390 |
if ui.quiet: |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
391 |
ui.write("%s\n" % t) |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
392 |
else: |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
393 |
spaces = " " * (30 - util.locallen(t)) |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
394 |
# The code only gets here if inactive branches are being |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
395 |
# displayed or the branch is active. |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
396 |
isinactive = ((not ishead) and " (inactive)") or '' |
6858a7477a5e
Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
4667
diff
changeset
|
397 |
ui.write("%s%s %s:%s%s\n" % (t, spaces, r, hexfunc(n), isinactive)) |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
398 |
|
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
399 |
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
|
400 |
"""create a changegroup file |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
401 |
|
3511
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
402 |
Generate a compressed changegroup file collecting changesets not |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
403 |
found in the other repository. |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
404 |
|
6171
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
405 |
If no destination repository is specified the destination is |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
406 |
assumed to have all the nodes specified by one or more --base |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
407 |
parameters. To create a bundle containing all changesets, use |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
408 |
--all (or --base null). |
3511
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
409 |
|
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
410 |
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
|
411 |
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
|
412 |
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
|
413 |
exporting an entire repository is undesirable. |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
414 |
|
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
415 |
Applying bundles preserves all changeset contents including |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
416 |
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
|
417 |
""" |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
418 |
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
|
419 |
if revs: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
420 |
revs = [repo.lookup(rev) for rev in revs] |
6171
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
421 |
if opts.get('all'): |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
422 |
base = ['null'] |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
423 |
else: |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
424 |
base = opts.get('base') |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
425 |
if base: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
426 |
if dest: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
427 |
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
|
428 |
"a destination")) |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
429 |
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
|
430 |
# 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
|
431 |
# 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
|
432 |
o = [] |
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
433 |
has = {nullid: None} |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
434 |
for n in base: |
3631 | 435 |
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
|
436 |
if revs: |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
437 |
visit = list(revs) |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
438 |
else: |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
439 |
visit = repo.changelog.heads() |
3631 | 440 |
seen = {} |
3318
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
441 |
while visit: |
a225055b3b59
bundle --base: use the right set for the base
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3284
diff
changeset
|
442 |
n = visit.pop(0) |
3631 | 443 |
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
|
444 |
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
|
445 |
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
|
446 |
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
|
447 |
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
|
448 |
if p not in seen: |
3631 | 449 |
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
|
450 |
visit.append(p) |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
451 |
else: |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
452 |
cmdutil.setremoteconfig(ui, opts) |
5248 | 453 |
dest, revs, checkout = hg.parseurl( |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
454 |
ui.expandpath(dest or 'default-push', dest or 'default'), revs) |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
455 |
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
|
456 |
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
|
457 |
|
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
458 |
if revs: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
459 |
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
|
460 |
else: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
461 |
cg = repo.changegroup(o, 'bundle') |
3704
9c1737a3e254
fix writebundle for bz2 bundles
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3680
diff
changeset
|
462 |
changegroup.writebundle(cg, fname, "HG10BZ") |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
463 |
|
1254
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
464 |
def cat(ui, repo, file1, *pats, **opts): |
3914
283ee8971570
doc string fix: hg cat and manifest default to current parent revision.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3900
diff
changeset
|
465 |
"""output the current or given revision of files |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
466 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
467 |
Print the specified files as they were at the given revision. |
3915
3c82ab166eea
doc fix: hg tags defaults to current parent revision, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3914
diff
changeset
|
468 |
If no revision is given, the parent of the working directory is used, |
3c82ab166eea
doc fix: hg tags defaults to current parent revision, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3914
diff
changeset
|
469 |
or tip 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
|
470 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
471 |
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
|
472 |
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
|
473 |
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
|
474 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
475 |
%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
|
476 |
%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
|
477 |
%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
|
478 |
""" |
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
479 |
ctx = repo.changectx(opts['rev']) |
4697
5b2d986de0f8
cat: return an error on failure
Matt Mackall <mpm@selenic.com>
parents:
4692
diff
changeset
|
480 |
err = 1 |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
481 |
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
|
482 |
ctx.node()): |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
483 |
fp = cmdutil.make_file(repo, opts['output'], ctx.node(), pathname=abs) |
6093
f5b00b6e426a
Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents:
6068
diff
changeset
|
484 |
data = ctx.filectx(abs).data() |
6094
3998c1b0828f
cat --decode: Drop short option, use opts.get() instead of opts[]
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6093
diff
changeset
|
485 |
if opts.get('decode'): |
6093
f5b00b6e426a
Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents:
6068
diff
changeset
|
486 |
data = repo.wwritedata(abs, data) |
f5b00b6e426a
Option --decode for hg cat to apply decode filters.
Jesse Glick <jesse.glick@sun.com>
parents:
6068
diff
changeset
|
487 |
fp.write(data) |
4697
5b2d986de0f8
cat: return an error on failure
Matt Mackall <mpm@selenic.com>
parents:
4692
diff
changeset
|
488 |
err = 0 |
5b2d986de0f8
cat: return an error on failure
Matt Mackall <mpm@selenic.com>
parents:
4692
diff
changeset
|
489 |
return err |
248 | 490 |
|
698
df78d8ccac4c
Use python function instead of external 'cp' command when cloning repos.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
697
diff
changeset
|
491 |
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
|
492 |
"""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
|
493 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
494 |
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
|
495 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
496 |
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
|
497 |
basename of the source. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
498 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
499 |
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
|
500 |
.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
|
501 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
502 |
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
|
503 |
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
|
504 |
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
|
505 |
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
|
506 |
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
|
507 |
avoid hardlinking. |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
508 |
|
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
509 |
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
|
510 |
hardlinks with |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
511 |
|
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
512 |
$ cp -al REPO REPOCLONE |
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
513 |
|
2df98f616645
Expand clone help with hardlink information
Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
parents:
2761
diff
changeset
|
514 |
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
|
515 |
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
|
516 |
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
|
517 |
(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
|
518 |
|
2764
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
519 |
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
|
520 |
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
|
521 |
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
|
522 |
|
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
523 |
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
|
524 |
|
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
525 |
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
|
526 |
.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
|
527 |
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
|
528 |
about ssh:// URLs. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
529 |
""" |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
530 |
cmdutil.setremoteconfig(ui, opts) |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
531 |
hg.clone(ui, source, dest, |
2597
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
532 |
pull=opts['pull'], |
2620
de82749d3a71
clone: change name of --stream to --uncompressed.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2618
diff
changeset
|
533 |
stream=opts['uncompressed'], |
2597
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
534 |
rev=opts['rev'], |
5ba8be56fa8f
clone: move code into hg module. make doc better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2590
diff
changeset
|
535 |
update=not opts['noupdate']) |
515 | 536 |
|
813
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
537 |
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
|
538 |
"""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
|
539 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
540 |
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
|
541 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
542 |
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
|
543 |
will be committed. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
544 |
|
6385
0d4e068e9e52
commit: when committing the results of a merge, it's all or nothing
Bryan O'Sullivan <bos@serpentine.com>
parents:
6375
diff
changeset
|
545 |
If you are committing the result of a merge, do not provide any |
0d4e068e9e52
commit: when committing the results of a merge, it's all or nothing
Bryan O'Sullivan <bos@serpentine.com>
parents:
6375
diff
changeset
|
546 |
file names or -I/-X filters. |
0d4e068e9e52
commit: when committing the results of a merge, it's all or nothing
Bryan O'Sullivan <bos@serpentine.com>
parents:
6375
diff
changeset
|
547 |
|
5660
3c80ecdc1bcd
Use VISUAL in addition to EDITOR when choosing the editor to use.
Osku Salerma <osku@iki.fi>
parents:
5658
diff
changeset
|
548 |
If no commit message is specified, the configured editor is started to |
3c80ecdc1bcd
Use VISUAL in addition to EDITOR when choosing the editor to use.
Osku Salerma <osku@iki.fi>
parents:
5658
diff
changeset
|
549 |
enter a message. |
6163
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
550 |
|
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
551 |
See 'hg help dates' for a list of formats valid for -d/--date. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
552 |
""" |
5034
c0417a319e39
commands: move commit to cmdutil as wrapper for commit-like functions
Bryan O'Sullivan <bos@serpentine.com>
parents:
4967
diff
changeset
|
553 |
def commitfunc(ui, repo, files, message, match, opts): |
c0417a319e39
commands: move commit to cmdutil as wrapper for commit-like functions
Bryan O'Sullivan <bos@serpentine.com>
parents:
4967
diff
changeset
|
554 |
return repo.commit(files, message, opts['user'], opts['date'], match, |
c0417a319e39
commands: move commit to cmdutil as wrapper for commit-like functions
Bryan O'Sullivan <bos@serpentine.com>
parents:
4967
diff
changeset
|
555 |
force_editor=opts.get('force_editor')) |
6336
4b0c9c674707
warn about new heads on commit (issue842)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6321
diff
changeset
|
556 |
|
6369
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
557 |
node = cmdutil.commit(ui, repo, commitfunc, pats, opts) |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
558 |
if not node: |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
559 |
return |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
560 |
cl = repo.changelog |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
561 |
rev = cl.rev(node) |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
562 |
parents = cl.parentrevs(rev) |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
563 |
if rev - 1 in parents: |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
564 |
# one of the parents was the old tip |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
565 |
return |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
566 |
if (parents == (nullrev, nullrev) or |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
567 |
len(cl.heads(cl.node(parents[0]))) > 1 and |
53912d30ac40
Avoid calling heads() twice on every hg commit.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6367
diff
changeset
|
568 |
(parents[1] == nullrev or len(cl.heads(cl.node(parents[1]))) > 1)): |
6336
4b0c9c674707
warn about new heads on commit (issue842)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6321
diff
changeset
|
569 |
ui.status(_('created new head\n')) |
245 | 570 |
|
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
571 |
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
|
572 |
"""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
|
573 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
574 |
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
|
575 |
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
|
576 |
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
|
577 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
578 |
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
|
579 |
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
|
580 |
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
|
581 |
|
3829
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
582 |
This command takes effect in the next commit. To undo a copy |
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
583 |
before that, see hg revert. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
584 |
""" |
4914 | 585 |
wlock = repo.wlock(False) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
586 |
try: |
5610
2493a478f395
copy: handle rename internally
Matt Mackall <mpm@selenic.com>
parents:
5589
diff
changeset
|
587 |
return cmdutil.copy(ui, repo, pats, opts) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
588 |
finally: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
589 |
del wlock |
363 | 590 |
|
6189
81cbb5dfdec0
Make hg debugancestor accept -R by making it an optionalrepo command.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6188
diff
changeset
|
591 |
def debugancestor(ui, repo, *args): |
1262 | 592 |
"""find the ancestor revision of two revisions in a given index""" |
6188
3b0c2b71e0d7
debugancestor: use *args instead of *opts, to not confuse with option dicts.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6182
diff
changeset
|
593 |
if len(args) == 3: |
3b0c2b71e0d7
debugancestor: use *args instead of *opts, to not confuse with option dicts.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6182
diff
changeset
|
594 |
index, rev1, rev2 = args |
6178
81afdd016867
debugancestor: make the index argument optional, defaulting to 00changelog.i
Bryan O'Sullivan <bos@serpentine.com>
parents:
6171
diff
changeset
|
595 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), index) |
6253
a7e3d0456d92
debugancestor: use repo.lookup when no revlog was specified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6243
diff
changeset
|
596 |
lookup = r.lookup |
6188
3b0c2b71e0d7
debugancestor: use *args instead of *opts, to not confuse with option dicts.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6182
diff
changeset
|
597 |
elif len(args) == 2: |
6189
81cbb5dfdec0
Make hg debugancestor accept -R by making it an optionalrepo command.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6188
diff
changeset
|
598 |
if not repo: |
81cbb5dfdec0
Make hg debugancestor accept -R by making it an optionalrepo command.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6188
diff
changeset
|
599 |
raise util.Abort(_("There is no Mercurial repository here " |
81cbb5dfdec0
Make hg debugancestor accept -R by making it an optionalrepo command.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6188
diff
changeset
|
600 |
"(.hg not found)")) |
6188
3b0c2b71e0d7
debugancestor: use *args instead of *opts, to not confuse with option dicts.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6182
diff
changeset
|
601 |
rev1, rev2 = args |
6178
81afdd016867
debugancestor: make the index argument optional, defaulting to 00changelog.i
Bryan O'Sullivan <bos@serpentine.com>
parents:
6171
diff
changeset
|
602 |
r = repo.changelog |
6253
a7e3d0456d92
debugancestor: use repo.lookup when no revlog was specified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6243
diff
changeset
|
603 |
lookup = repo.lookup |
6178
81afdd016867
debugancestor: make the index argument optional, defaulting to 00changelog.i
Bryan O'Sullivan <bos@serpentine.com>
parents:
6171
diff
changeset
|
604 |
else: |
81afdd016867
debugancestor: make the index argument optional, defaulting to 00changelog.i
Bryan O'Sullivan <bos@serpentine.com>
parents:
6171
diff
changeset
|
605 |
raise util.Abort(_('either two or three arguments required')) |
6253
a7e3d0456d92
debugancestor: use repo.lookup when no revlog was specified
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6243
diff
changeset
|
606 |
a = r.ancestor(lookup(rev1), lookup(rev2)) |
1262 | 607 |
ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
608 |
||
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
|
609 |
def debugcomplete(ui, cmd='', **opts): |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
610 |
"""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
|
611 |
|
5e7aff1b6ae1
add --options to debugcomplete and change bash_completion to use it
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2033
diff
changeset
|
612 |
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
|
613 |
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
|
614 |
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
|
615 |
if cmd: |
5178
18a9fbb5cd78
dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents:
5177
diff
changeset
|
616 |
aliases, entry = cmdutil.findcmd(ui, cmd, table) |
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
|
617 |
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
|
618 |
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
|
619 |
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
|
620 |
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
|
621 |
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
|
622 |
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
|
623 |
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
|
624 |
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
|
625 |
|
5178
18a9fbb5cd78
dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents:
5177
diff
changeset
|
626 |
clist = cmdutil.findpossible(ui, cmd, table).keys() |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
627 |
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
|
628 |
ui.write("%s\n" % "\n".join(clist)) |
1887
913397c27cd8
new command debugcomplete
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1875
diff
changeset
|
629 |
|
5741
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
630 |
def debugfsinfo(ui, path = "."): |
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
631 |
file('.debugfsinfo', 'w').write('') |
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
632 |
ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no')) |
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
633 |
ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no')) |
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
634 |
ui.write('case-sensitive: %s\n' % (util.checkfolding('.debugfsinfo') |
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
635 |
and 'yes' or 'no')) |
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
636 |
os.unlink('.debugfsinfo') |
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
637 |
|
3972
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
638 |
def debugrebuildstate(ui, repo, rev=""): |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
639 |
"""rebuild the dirstate as it would look like for the given revision""" |
3972
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
640 |
if rev == "": |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
641 |
rev = repo.changelog.tip() |
3972
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
642 |
ctx = repo.changectx(rev) |
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
643 |
files = ctx.manifest() |
1760
13f8e068d13c
fix typo in debugrebuildstate
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1755
diff
changeset
|
644 |
wlock = repo.wlock() |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
645 |
try: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
646 |
repo.dirstate.rebuild(rev, files) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
647 |
finally: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
648 |
del wlock |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
649 |
|
596 | 650 |
def debugcheckstate(ui, repo): |
651 |
"""validate the correctness of the current dirstate""" |
|
460 | 652 |
parent1, parent2 = repo.dirstate.parents() |
3972
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
653 |
m1 = repo.changectx(parent1).manifest() |
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
654 |
m2 = repo.changectx(parent2).manifest() |
460 | 655 |
errors = 0 |
4906
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
656 |
for f in repo.dirstate: |
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
657 |
state = repo.dirstate[f] |
460 | 658 |
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
|
659 |
ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
460 | 660 |
errors += 1 |
661 |
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
|
662 |
ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
460 | 663 |
errors += 1 |
664 |
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
|
665 |
ui.warn(_("%s in state %s, but not in either manifest\n") % |
582 | 666 |
(f, state)) |
460 | 667 |
errors += 1 |
668 |
for f in m1: |
|
4906
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
669 |
state = repo.dirstate[f] |
460 | 670 |
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
|
671 |
ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
460 | 672 |
errors += 1 |
673 |
if errors: |
|
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
674 |
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
|
675 |
raise util.Abort(error) |
460 | 676 |
|
3553
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
677 |
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
|
678 |
"""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
|
679 |
|
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
680 |
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
|
681 |
|
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
682 |
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
|
683 |
that config item. |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
684 |
|
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
685 |
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
|
686 |
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
|
687 |
|
3553
e1508621e9ef
add --untrusted to showconfig
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3521
diff
changeset
|
688 |
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
|
689 |
if values: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
690 |
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
|
691 |
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
|
692 |
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
|
693 |
sectname = section + '.' + name |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
694 |
if values: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
695 |
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
|
696 |
if v == section: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
697 |
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
|
698 |
elif v == sectname: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
699 |
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
|
700 |
else: |
1e80d47b8581
debugconfig: allow to print by section and exact item name
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2407
diff
changeset
|
701 |
ui.write('%s=%s\n' % (sectname, value)) |
1028
25e7ea0f2cff
Add commands.debugconfig.
Bryan O'Sullivan <bos@serpentine.com>
parents:
989
diff
changeset
|
702 |
|
1395
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
703 |
def debugsetparents(ui, repo, rev1, rev2=None): |
1470
fb9b84c91222
minor fix on command help docstrings
TK Soh <teekaysoh@yahoo.com>
parents:
1469
diff
changeset
|
704 |
"""manually set the parents of the current working directory |
1395
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
705 |
|
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
706 |
This is useful for writing repository conversion tools, but should |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
707 |
be used with care. |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
708 |
""" |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
709 |
|
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
710 |
if not rev2: |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
711 |
rev2 = hex(nullid) |
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
712 |
|
4247
89075f106414
debugsetparents: wlock the repo before updating the dirstate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4231
diff
changeset
|
713 |
wlock = repo.wlock() |
89075f106414
debugsetparents: wlock the repo before updating the dirstate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4231
diff
changeset
|
714 |
try: |
89075f106414
debugsetparents: wlock the repo before updating the dirstate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4231
diff
changeset
|
715 |
repo.dirstate.setparents(repo.lookup(rev1), repo.lookup(rev2)) |
89075f106414
debugsetparents: wlock the repo before updating the dirstate
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4231
diff
changeset
|
716 |
finally: |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
717 |
del wlock |
1395
c2eb204917f8
Add debugsetparents command
Matt Mackall <mpm@selenic.com>
parents:
1390
diff
changeset
|
718 |
|
6296
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
719 |
def debugstate(ui, repo, nodates=None): |
596 | 720 |
"""show the contents of the current dirstate""" |
5156
49554ba98951
debugstate: print symlinks as 'lnk', not '777'
Bryan O'Sullivan <bos@serpentine.com>
parents:
5155
diff
changeset
|
721 |
k = repo.dirstate._map.items() |
4906
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
722 |
k.sort() |
6296
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
723 |
timestr = "" |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
724 |
showdate = not nodates |
5156
49554ba98951
debugstate: print symlinks as 'lnk', not '777'
Bryan O'Sullivan <bos@serpentine.com>
parents:
5155
diff
changeset
|
725 |
for file_, ent in k: |
6296
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
726 |
if showdate: |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
727 |
if ent[3] == -1: |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
728 |
# Pad or slice to locale representation |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
729 |
locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(0))) |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
730 |
timestr = 'unset' |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
731 |
timestr = timestr[:locale_len] + ' '*(locale_len - len(timestr)) |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
732 |
else: |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
733 |
timestr = time.strftime("%Y-%m-%d %H:%M:%S ", time.localtime(ent[3])) |
5156
49554ba98951
debugstate: print symlinks as 'lnk', not '777'
Bryan O'Sullivan <bos@serpentine.com>
parents:
5155
diff
changeset
|
734 |
if ent[1] & 020000: |
49554ba98951
debugstate: print symlinks as 'lnk', not '777'
Bryan O'Sullivan <bos@serpentine.com>
parents:
5155
diff
changeset
|
735 |
mode = 'lnk' |
49554ba98951
debugstate: print symlinks as 'lnk', not '777'
Bryan O'Sullivan <bos@serpentine.com>
parents:
5155
diff
changeset
|
736 |
else: |
49554ba98951
debugstate: print symlinks as 'lnk', not '777'
Bryan O'Sullivan <bos@serpentine.com>
parents:
5155
diff
changeset
|
737 |
mode = '%3o' % (ent[1] & 0777) |
6296
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
738 |
ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) |
3159
e43fd1623fe1
fix users of dirstate.copies broken by b1f10d3223c1
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3146
diff
changeset
|
739 |
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
|
740 |
ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
460 | 741 |
|
1039
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
742 |
def debugdata(ui, file_, rev): |
4258
b11a2fb59cf5
revlog: simplify revlog version handling
Matt Mackall <mpm@selenic.com>
parents:
4257
diff
changeset
|
743 |
"""dump the contents of a data file revision""" |
b11a2fb59cf5
revlog: simplify revlog version handling
Matt Mackall <mpm@selenic.com>
parents:
4257
diff
changeset
|
744 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_[:-2] + ".i") |
1313
1cc7c0cbc30b
Fix traceback during invalid rev identifier for debugdata
Anupam Kapoor<anupam.kapoor@gmail.com>
parents:
1312
diff
changeset
|
745 |
try: |
1cc7c0cbc30b
Fix traceback during invalid rev identifier for debugdata
Anupam Kapoor<anupam.kapoor@gmail.com>
parents:
1312
diff
changeset
|
746 |
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
|
747 |
except KeyError: |
3072
bc3fe3b5b785
Never apply string formatting to generated errors with util.Abort.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3071
diff
changeset
|
748 |
raise util.Abort(_('invalid revision identifier %s') % rev) |
1039
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
749 |
|
3812 | 750 |
def debugdate(ui, date, range=None, **opts): |
3805 | 751 |
"""parse and display a date""" |
3812 | 752 |
if opts["extended"]: |
753 |
d = util.parsedate(date, util.extendeddateformats) |
|
754 |
else: |
|
755 |
d = util.parsedate(date) |
|
3805 | 756 |
ui.write("internal: %s %s\n" % d) |
757 |
ui.write("standard: %s\n" % util.datestr(d)) |
|
3812 | 758 |
if range: |
759 |
m = util.matchdate(range) |
|
760 |
ui.write("match: %s\n" % m(d[0])) |
|
3805 | 761 |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
762 |
def debugindex(ui, file_): |
596 | 763 |
"""dump the contents of an index file""" |
4258
b11a2fb59cf5
revlog: simplify revlog version handling
Matt Mackall <mpm@selenic.com>
parents:
4257
diff
changeset
|
764 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) |
582 | 765 |
ui.write(" rev offset length base linkrev" + |
989 | 766 |
" nodeid p1 p2\n") |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
767 |
for i in xrange(r.count()): |
2072 | 768 |
node = r.node(i) |
5311
599f3a690d8f
debugindex: more robust for damaged indexes
Matt Mackall <mpm@selenic.com>
parents:
5310
diff
changeset
|
769 |
try: |
599f3a690d8f
debugindex: more robust for damaged indexes
Matt Mackall <mpm@selenic.com>
parents:
5310
diff
changeset
|
770 |
pp = r.parents(node) |
599f3a690d8f
debugindex: more robust for damaged indexes
Matt Mackall <mpm@selenic.com>
parents:
5310
diff
changeset
|
771 |
except: |
599f3a690d8f
debugindex: more robust for damaged indexes
Matt Mackall <mpm@selenic.com>
parents:
5310
diff
changeset
|
772 |
pp = [nullid, nullid] |
989 | 773 |
ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( |
2072 | 774 |
i, r.start(i), r.length(i), r.base(i), r.linkrev(node), |
775 |
short(node), short(pp[0]), short(pp[1]))) |
|
248 | 776 |
|
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
777 |
def debugindexdot(ui, file_): |
596 | 778 |
"""dump an index DAG as a .dot file""" |
4258
b11a2fb59cf5
revlog: simplify revlog version handling
Matt Mackall <mpm@selenic.com>
parents:
4257
diff
changeset
|
779 |
r = revlog.revlog(util.opener(os.getcwd(), audit=False), file_) |
582 | 780 |
ui.write("digraph G {\n") |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
781 |
for i in xrange(r.count()): |
2287
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
782 |
node = r.node(i) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
783 |
pp = r.parents(node) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
784 |
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
|
785 |
if pp[1] != nullid: |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
786 |
ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
582 | 787 |
ui.write("}\n") |
248 | 788 |
|
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
789 |
def debuginstall(ui): |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
790 |
'''test Mercurial installation''' |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
791 |
|
3846
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
792 |
def writetemp(contents): |
4849
035489f60842
Use a prefix for debuginstall tempfiles.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4818
diff
changeset
|
793 |
(fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") |
3846
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
794 |
f = os.fdopen(fd, "wb") |
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
795 |
f.write(contents) |
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
796 |
f.close() |
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
797 |
return name |
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
798 |
|
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
799 |
problems = 0 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
800 |
|
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
801 |
# encoding |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
802 |
ui.status(_("Checking encoding (%s)...\n") % util._encoding) |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
803 |
try: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
804 |
util.fromlocal("test") |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
805 |
except util.Abort, inst: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
806 |
ui.write(" %s\n" % inst) |
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
807 |
ui.write(_(" (check that your locale is properly set)\n")) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
808 |
problems += 1 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
809 |
|
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
810 |
# compiled modules |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
811 |
ui.status(_("Checking extensions...\n")) |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
812 |
try: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
813 |
import bdiff, mpatch, base85 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
814 |
except Exception, inst: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
815 |
ui.write(" %s\n" % inst) |
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
816 |
ui.write(_(" One or more extensions could not be found")) |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
817 |
ui.write(_(" (check that you compiled the extensions)\n")) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
818 |
problems += 1 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
819 |
|
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
820 |
# templates |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
821 |
ui.status(_("Checking templates...\n")) |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
822 |
try: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
823 |
import templater |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
824 |
t = templater.templater(templater.templatepath("map-cmdline.default")) |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
825 |
except Exception, inst: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
826 |
ui.write(" %s\n" % inst) |
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
827 |
ui.write(_(" (templates seem to have been installed incorrectly)\n")) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
828 |
problems += 1 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
829 |
|
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
830 |
# patch |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
831 |
ui.status(_("Checking patch...\n")) |
5310
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
832 |
patchproblems = 0 |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
833 |
a = "1\n2\n3\n4\n" |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
834 |
b = "1\n2\n3\ninsert\n4\n" |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
835 |
fa = writetemp(a) |
5482
e5eedd74e70f
Use both the from and to name in mdiff.unidiff.
Dustin Sallings <dustin@spy.net>
parents:
5405
diff
changeset
|
836 |
d = mdiff.unidiff(a, None, b, None, os.path.basename(fa), |
e5eedd74e70f
Use both the from and to name in mdiff.unidiff.
Dustin Sallings <dustin@spy.net>
parents:
5405
diff
changeset
|
837 |
os.path.basename(fa)) |
5310
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
838 |
fd = writetemp(d) |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
839 |
|
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
840 |
files = {} |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
841 |
try: |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
842 |
patch.patch(fd, ui, cwd=os.path.dirname(fa), files=files) |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
843 |
except util.Abort, e: |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
844 |
ui.write(_(" patch call failed:\n")) |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
845 |
ui.write(" " + str(e) + "\n") |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
846 |
patchproblems += 1 |
3846
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
847 |
else: |
5310
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
848 |
if list(files) != [os.path.basename(fa)]: |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
849 |
ui.write(_(" unexpected patch output!\n")) |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
850 |
patchproblems += 1 |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
851 |
a = file(fa).read() |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
852 |
if a != b: |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
853 |
ui.write(_(" patch test failed!\n")) |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
854 |
patchproblems += 1 |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
855 |
|
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
856 |
if patchproblems: |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
857 |
if ui.config('ui', 'patch'): |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
858 |
ui.write(_(" (Current patch tool may be incompatible with patch," |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
859 |
" or misconfigured. Please check your .hgrc file)\n")) |
4516
96d8a56d4ef9
Removed trailing whitespace and tabs from python files
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4505
diff
changeset
|
860 |
else: |
5760
0145f9afb0e7
Removed tabs and trailing whitespace in python files
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5741
diff
changeset
|
861 |
ui.write(_(" Internal patcher failure, please report this error" |
5310
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
862 |
" to http://www.selenic.com/mercurial/bts\n")) |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
863 |
problems += patchproblems |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
864 |
|
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
865 |
os.unlink(fa) |
ba3dc7883968
debuginstall: stop looking for patch utility, just test it
Patrick Mezard <pmezard@gmail.com>
parents:
5300
diff
changeset
|
866 |
os.unlink(fd) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
867 |
|
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
868 |
# editor |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
869 |
ui.status(_("Checking commit editor...\n")) |
5660
3c80ecdc1bcd
Use VISUAL in addition to EDITOR when choosing the editor to use.
Osku Salerma <osku@iki.fi>
parents:
5658
diff
changeset
|
870 |
editor = ui.geteditor() |
4488
62019c4427e3
Introduce find_exe. Use instead of find_in_path for programs.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4438
diff
changeset
|
871 |
cmdpath = util.find_exe(editor) or util.find_exe(editor.split()[0]) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
872 |
if not cmdpath: |
3855
b9cdd6f2aa43
debuginstall: fix a copy/paste error
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3848
diff
changeset
|
873 |
if editor == 'vi': |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
874 |
ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
875 |
ui.write(_(" (specify a commit editor in your .hgrc file)\n")) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
876 |
else: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
877 |
ui.write(_(" Can't find editor '%s' in PATH\n") % editor) |
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
878 |
ui.write(_(" (specify a commit editor in your .hgrc file)\n")) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
879 |
problems += 1 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
880 |
|
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
881 |
# check username |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
882 |
ui.status(_("Checking username...\n")) |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
883 |
user = os.environ.get("HGUSER") |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
884 |
if user is None: |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
885 |
user = ui.config("ui", "username") |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
886 |
if user is None: |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
887 |
user = os.environ.get("EMAIL") |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
888 |
if not user: |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
889 |
ui.warn(" ") |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
890 |
ui.username() |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
891 |
ui.write(_(" (specify a username in your .hgrc file)\n")) |
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
892 |
|
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
893 |
if not problems: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
894 |
ui.status(_("No problems detected\n")) |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
895 |
else: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
896 |
ui.write(_("%s problems detected," |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
897 |
" please check your install!\n") % problems) |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
898 |
|
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
899 |
return problems |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
900 |
|
3652 | 901 |
def debugrename(ui, repo, file1, *pats, **opts): |
1194
c165cbf56bb1
Add doc string for debugrename.
bos@serpentine.internal.keyresearch.com
parents:
1193
diff
changeset
|
902 |
"""dump rename information""" |
3652 | 903 |
|
904 |
ctx = repo.changectx(opts.get('rev', 'tip')) |
|
905 |
for src, abs, rel, exact in cmdutil.walk(repo, (file1,) + pats, opts, |
|
906 |
ctx.node()): |
|
5811
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
907 |
fctx = ctx.filectx(abs) |
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
908 |
m = fctx.filelog().renamed(fctx.filenode()) |
3652 | 909 |
if m: |
910 |
ui.write(_("%s renamed from %s:%s\n") % (rel, m[0], hex(m[1]))) |
|
911 |
else: |
|
912 |
ui.write(_("%s not renamed\n") % rel) |
|
1116 | 913 |
|
820
89985a1b3427
Clean up walk and changes code to use normalised names properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
815
diff
changeset
|
914 |
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
|
915 |
"""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
|
916 |
items = list(cmdutil.walk(repo, pats, opts)) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
917 |
if not items: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
918 |
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
|
919 |
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
|
920 |
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
|
921 |
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
|
922 |
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
|
923 |
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
|
924 |
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
|
925 |
|
732
ba0b6d17a6de
Convert diff command over to using walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
731
diff
changeset
|
926 |
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
|
927 |
"""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
|
928 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
929 |
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
|
930 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
931 |
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
|
932 |
|
3822
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
933 |
NOTE: diff may generate unexpected results for merges, as it will |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
934 |
default to comparing against the working directory's first parent |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
935 |
changeset if no revisions are specified. |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
936 |
|
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
937 |
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
|
938 |
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
|
939 |
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
|
940 |
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
|
941 |
to its parent. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
942 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
943 |
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
|
944 |
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
|
945 |
probably with undesirable results. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
946 |
""" |
3707
67f44b825784
Removed unused ui parameter from revpair/revrange and fix its users.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3706
diff
changeset
|
947 |
node1, node2 = cmdutil.revpair(repo, opts['rev']) |
245 | 948 |
|
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
949 |
fns, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
1014 | 950 |
|
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
951 |
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
|
952 |
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
|
953 |
|
580 | 954 |
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
|
955 |
"""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
|
956 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
957 |
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
|
958 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
959 |
The information shown in the changeset header is: author, |
3822
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
960 |
changeset hash, parent(s) and commit comment. |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
961 |
|
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
962 |
NOTE: export may generate unexpected diff output for merge changesets, |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
963 |
as it will compare the merge changeset against its first parent only. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
964 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
965 |
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
|
966 |
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
|
967 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
968 |
%% literal "%" character |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
969 |
%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
|
970 |
%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
|
971 |
%R changeset revision number |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
972 |
%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
|
973 |
%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
|
974 |
%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
|
975 |
%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
|
976 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
977 |
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
|
978 |
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
|
979 |
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
|
980 |
|
bcdc030c59f8
add a --switch-parent option to export against the other parent
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1570
diff
changeset
|
981 |
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
|
982 |
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
|
983 |
""" |
610
4c02464cb9f0
check export options for changeset before running
shaleh@speakeasy.net
parents:
609
diff
changeset
|
984 |
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
|
985 |
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
|
986 |
revs = cmdutil.revrange(repo, changesets) |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
987 |
if len(revs) > 1: |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
988 |
ui.note(_('exporting patches:\n')) |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
989 |
else: |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
990 |
ui.note(_('exporting patch:\n')) |
3900
2b3175acb653
Don't use node length for calculating revision number length.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3885
diff
changeset
|
991 |
patch.export(repo, revs, template=opts['output'], |
2888
3848488244fc
Move ui.diffopts to patch.diffopts where it belongs
Matt Mackall <mpm@selenic.com>
parents:
2883
diff
changeset
|
992 |
switch_parent=opts['switch_parent'], |
3848488244fc
Move ui.diffopts to patch.diffopts where it belongs
Matt Mackall <mpm@selenic.com>
parents:
2883
diff
changeset
|
993 |
opts=patch.diffopts(ui, opts)) |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
994 |
|
1108
7a75d8fbbdaf
Remove some options from 'hg grep':
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1106
diff
changeset
|
995 |
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
|
996 |
"""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
|
997 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
998 |
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
|
999 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1000 |
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
|
1001 |
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
|
1002 |
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
|
1003 |
a match appears. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1004 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1005 |
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
|
1006 |
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
|
1007 |
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
|
1008 |
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
|
1009 |
use the --all flag. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1010 |
""" |
1057 | 1011 |
reflags = 0 |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1012 |
if opts['ignore_case']: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1013 |
reflags |= re.I |
4877
242026115e6a
hg grep: handle re.compile errors & update tests/test-grep
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4835
diff
changeset
|
1014 |
try: |
242026115e6a
hg grep: handle re.compile errors & update tests/test-grep
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4835
diff
changeset
|
1015 |
regexp = re.compile(pattern, reflags) |
242026115e6a
hg grep: handle re.compile errors & update tests/test-grep
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4835
diff
changeset
|
1016 |
except Exception, inst: |
6057
218d5b9aa466
Remove trailing ! from two error messages as this was confusing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6048
diff
changeset
|
1017 |
ui.warn(_("grep: invalid match pattern: %s\n") % inst) |
4877
242026115e6a
hg grep: handle re.compile errors & update tests/test-grep
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4835
diff
changeset
|
1018 |
return None |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1019 |
sep, eol = ':', '\n' |
1108
7a75d8fbbdaf
Remove some options from 'hg grep':
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1106
diff
changeset
|
1020 |
if opts['print0']: |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1021 |
sep = eol = '\0' |
1057 | 1022 |
|
1023 |
fcache = {} |
|
1024 |
def getfile(fn): |
|
1025 |
if fn not in fcache: |
|
1026 |
fcache[fn] = repo.file(fn) |
|
1027 |
return fcache[fn] |
|
1028 |
||
1029 |
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
|
1030 |
begin = 0 |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1031 |
linenum = 0 |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1032 |
while True: |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1033 |
match = regexp.search(body, begin) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1034 |
if not match: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1035 |
break |
1059
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
1036 |
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
|
1037 |
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
|
1038 |
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
|
1039 |
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
|
1040 |
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
|
1041 |
begin = lend + 1 |
1057 | 1042 |
|
1559
59b3639df0a9
Convert all classes to new-style classes by deriving them from object.
Eric Hopper <hopper@omnifarious.org>
parents:
1552
diff
changeset
|
1043 |
class linestate(object): |
1057 | 1044 |
def __init__(self, line, linenum, colstart, colend): |
1045 |
self.line = line |
|
1046 |
self.linenum = linenum |
|
1047 |
self.colstart = colstart |
|
1048 |
self.colend = colend |
|
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1049 |
|
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1050 |
def __eq__(self, other): |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1051 |
return self.line == other.line |
1057 | 1052 |
|
1053 |
matches = {} |
|
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1054 |
copies = {} |
1057 | 1055 |
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
|
1056 |
matches[rev].setdefault(fn, []) |
1057 | 1057 |
m = matches[rev][fn] |
1058 |
for lnum, cstart, cend, line in matchlines(body): |
|
1059 |
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
|
1060 |
m.append(s) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1061 |
|
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1062 |
def difflinestates(a, b): |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1063 |
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
|
1064 |
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
|
1065 |
if tag == 'insert': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
1066 |
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
|
1067 |
yield ('+', b[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1068 |
elif tag == 'delete': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
1069 |
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
|
1070 |
yield ('-', a[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1071 |
elif tag == 'replace': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
1072 |
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
|
1073 |
yield ('-', a[i]) |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
1074 |
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
|
1075 |
yield ('+', b[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1076 |
|
1057 | 1077 |
prev = {} |
1078 |
def display(fn, rev, states, prevstates): |
|
6134
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
1079 |
datefunc = ui.quiet and util.shortdate or util.datestr |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1080 |
found = False |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1081 |
filerevmatches = {} |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1082 |
r = prev.get(fn, -1) |
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1083 |
if opts['all']: |
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1084 |
iter = difflinestates(states, prevstates) |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1085 |
else: |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1086 |
iter = [('', l) for l in prevstates] |
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1087 |
for change, l in iter: |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
1088 |
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
|
1089 |
if opts['line_number']: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1090 |
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
|
1091 |
if opts['all']: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1092 |
cols.append(change) |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1093 |
if opts['user']: |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1094 |
cols.append(ui.shortuser(get(r)[1])) |
6133
779f2309d67a
Add hg grep -d/--date to list the commit date of matched revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6109
diff
changeset
|
1095 |
if opts.get('date'): |
6134
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
1096 |
cols.append(datefunc(get(r)[2])) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1097 |
if opts['files_with_matches']: |
3523 | 1098 |
c = (fn, r) |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1099 |
if c in filerevmatches: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1100 |
continue |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1101 |
filerevmatches[c] = 1 |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1102 |
else: |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1103 |
cols.append(l.line) |
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1104 |
ui.write(sep.join(cols), eol) |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1105 |
found = True |
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1106 |
return found |
1057 | 1107 |
|
1108 |
fstate = {} |
|
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
1109 |
skip = {} |
3673
eb0b4a2d70a9
white space and line break cleanups
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3672
diff
changeset
|
1110 |
get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1111 |
changeiter, matchfn = cmdutil.walkchangerevs(ui, repo, pats, get, opts) |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1112 |
found = False |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1113 |
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
|
1114 |
for st, rev, fns in changeiter: |
1057 | 1115 |
if st == 'window': |
1116 |
matches.clear() |
|
1117 |
elif st == 'add': |
|
6146
e3dd35d3603b
Speed up hg grep by avoiding useless manifest parsing
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6139
diff
changeset
|
1118 |
ctx = repo.changectx(rev) |
1057 | 1119 |
matches[rev] = {} |
1120 |
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
|
1121 |
if fn in skip: |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1122 |
continue |
1057 | 1123 |
try: |
6146
e3dd35d3603b
Speed up hg grep by avoiding useless manifest parsing
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6139
diff
changeset
|
1124 |
grepbody(fn, rev, getfile(fn).read(ctx.filenode(fn))) |
5105
64888ff907f4
Fix issue 685: trackback in grep -r after rename
Patrick Mezard <pmezard@gmail.com>
parents:
5083
diff
changeset
|
1125 |
fstate.setdefault(fn, []) |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1126 |
if follow: |
6146
e3dd35d3603b
Speed up hg grep by avoiding useless manifest parsing
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6139
diff
changeset
|
1127 |
copied = getfile(fn).renamed(ctx.filenode(fn)) |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1128 |
if copied: |
2931 | 1129 |
copies.setdefault(rev, {})[fn] = copied[0] |
6146
e3dd35d3603b
Speed up hg grep by avoiding useless manifest parsing
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6139
diff
changeset
|
1130 |
except revlog.LookupError: |
1057 | 1131 |
pass |
1132 |
elif st == 'iter': |
|
1133 |
states = matches[rev].items() |
|
1134 |
states.sort() |
|
1135 |
for fn, m in states: |
|
2931 | 1136 |
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
|
1137 |
if fn in skip: |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1138 |
if copy: |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1139 |
skip[copy] = True |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
1140 |
continue |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1141 |
if fn in prev or fstate[fn]: |
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1142 |
r = display(fn, rev, m, fstate[fn]) |
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1143 |
found = found or r |
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1144 |
if r and not opts['all']: |
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
1145 |
skip[fn] = True |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1146 |
if copy: |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1147 |
skip[copy] = True |
1057 | 1148 |
fstate[fn] = m |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1149 |
if copy: |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
1150 |
fstate[copy] = m |
1057 | 1151 |
prev[fn] = rev |
1152 |
||
3950
3d3007064a17
grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3933
diff
changeset
|
1153 |
fstate = fstate.items() |
3d3007064a17
grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3933
diff
changeset
|
1154 |
fstate.sort() |
3d3007064a17
grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3933
diff
changeset
|
1155 |
for fn, state in fstate: |
3d3007064a17
grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3933
diff
changeset
|
1156 |
if fn in skip: |
3d3007064a17
grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3933
diff
changeset
|
1157 |
continue |
3d3007064a17
grep: incrementing is always False during 'iter'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3933
diff
changeset
|
1158 |
if fn not in copies.get(prev[fn], {}): |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1159 |
found = display(fn, rev, {}, state) or found |
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
1160 |
return (not found and 1) or 0 |
1057 | 1161 |
|
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1162 |
def heads(ui, repo, *branchrevs, **opts): |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1163 |
"""show current repository heads or show branch heads |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1164 |
|
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1165 |
With no arguments, show all repository head changesets. |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1166 |
|
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1167 |
If branch or revisions names are given this will show the heads of |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1168 |
the specified branches or the branches those revisions are tagged |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1169 |
with. |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1170 |
|
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1171 |
Repository "heads" are changesets that don't have child |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1172 |
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
|
1173 |
are the usual targets for update and merge operations. |
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1174 |
|
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1175 |
Branch heads are changesets that have a given branch tag, but have |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1176 |
no child changesets with that tag. They are usually where |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1177 |
development on the given branch takes place. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1178 |
""" |
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
|
1179 |
if opts['rev']: |
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1180 |
start = repo.lookup(opts['rev']) |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1181 |
else: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1182 |
start = None |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1183 |
if not branchrevs: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1184 |
# Assume we're looking repo-wide heads if no revs were specified. |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1185 |
heads = repo.heads(start) |
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
|
1186 |
else: |
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1187 |
heads = [] |
4649
52259d5fb76d
Small fixes for 8e503fa54d2d (hg heads branch)
Brendan Cully <brendan@kublai.com>
parents:
4648
diff
changeset
|
1188 |
visitedset = util.set() |
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1189 |
for branchrev in branchrevs: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1190 |
branch = repo.changectx(branchrev).branch() |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1191 |
if branch in visitedset: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1192 |
continue |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1193 |
visitedset.add(branch) |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1194 |
bheads = repo.branchheads(branch, start) |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1195 |
if not bheads: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1196 |
if branch != branchrev: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1197 |
ui.warn(_("no changes on branch %s containing %s are " |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1198 |
"reachable from %s\n") |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1199 |
% (branch, branchrev, opts['rev'])) |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1200 |
else: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1201 |
ui.warn(_("no changes on branch %s are reachable from %s\n") |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1202 |
% (branch, opts['rev'])) |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1203 |
heads.extend(bheads) |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1204 |
if not heads: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
1205 |
return 1 |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
1206 |
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
|
1207 |
for n in heads: |
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
1208 |
displayer.show(changenode=n) |
221 | 1209 |
|
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1210 |
def help_(ui, name=None, with_version=False): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1211 |
"""show help for a command, extension, or list of commands |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1212 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1213 |
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
|
1214 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1215 |
Given a command name, print help for that command. |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1216 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1217 |
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
|
1218 |
commands it provides.""" |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1219 |
option_lists = [] |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1220 |
|
4315
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1221 |
def addglobalopts(aliases): |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1222 |
if ui.verbose: |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1223 |
option_lists.append((_("global options:"), globalopts)) |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1224 |
if name == 'shortlist': |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1225 |
option_lists.append((_('use "hg help" for the full list ' |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1226 |
'of commands'), ())) |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1227 |
else: |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1228 |
if name == 'shortlist': |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1229 |
msg = _('use "hg help" for the full list of commands ' |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1230 |
'or "hg -v" for details') |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1231 |
elif aliases: |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1232 |
msg = _('use "hg -v help%s" to show aliases and ' |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1233 |
'global options') % (name and " " + name or "") |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1234 |
else: |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1235 |
msg = _('use "hg -v help %s" to show global options') % name |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1236 |
option_lists.append((msg, ())) |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1237 |
|
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1238 |
def helpcmd(name): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1239 |
if with_version: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1240 |
version_(ui) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1241 |
ui.write('\n') |
5178
18a9fbb5cd78
dispatch: move command dispatching into its own module
Matt Mackall <mpm@selenic.com>
parents:
5177
diff
changeset
|
1242 |
aliases, i = cmdutil.findcmd(ui, name, table) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1243 |
# synopsis |
5783
28d9f8cd02f2
Move aliases section in help below synopsis (issue362)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5781
diff
changeset
|
1244 |
ui.write("%s\n" % i[2]) |
28d9f8cd02f2
Move aliases section in help below synopsis (issue362)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5781
diff
changeset
|
1245 |
|
28d9f8cd02f2
Move aliases section in help below synopsis (issue362)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5781
diff
changeset
|
1246 |
# aliases |
28d9f8cd02f2
Move aliases section in help below synopsis (issue362)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5781
diff
changeset
|
1247 |
if not ui.quiet and len(aliases) > 1: |
28d9f8cd02f2
Move aliases section in help below synopsis (issue362)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5781
diff
changeset
|
1248 |
ui.write(_("\naliases: %s\n") % ', '.join(aliases[1:])) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1249 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1250 |
# description |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1251 |
doc = i[0].__doc__ |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1252 |
if not doc: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1253 |
doc = _("(No help text available)") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1254 |
if ui.quiet: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1255 |
doc = doc.splitlines(0)[0] |
5783
28d9f8cd02f2
Move aliases section in help below synopsis (issue362)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5781
diff
changeset
|
1256 |
ui.write("\n%s\n" % doc.rstrip()) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1257 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1258 |
if not ui.quiet: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1259 |
# options |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1260 |
if i[1]: |
4315
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1261 |
option_lists.append((_("options:\n"), i[1])) |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1262 |
|
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1263 |
addglobalopts(False) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1264 |
|
4950
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1265 |
def helplist(header, select=None): |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1266 |
h = {} |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1267 |
cmds = {} |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1268 |
for c, e in table.items(): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1269 |
f = c.split("|", 1)[0] |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1270 |
if select and not select(f): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1271 |
continue |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1272 |
if name == "shortlist" and not f.startswith("^"): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1273 |
continue |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1274 |
f = f.lstrip("^") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1275 |
if not ui.debugflag and f.startswith("debug"): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1276 |
continue |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1277 |
doc = e[0].__doc__ |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1278 |
if not doc: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1279 |
doc = _("(No help text available)") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1280 |
h[f] = doc.splitlines(0)[0].rstrip() |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1281 |
cmds[f] = c.lstrip("^") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1282 |
|
4950
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1283 |
if not h: |
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1284 |
ui.status(_('no commands defined\n')) |
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1285 |
return |
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1286 |
|
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1287 |
ui.status(header) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1288 |
fns = h.keys() |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1289 |
fns.sort() |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1290 |
m = max(map(len, fns)) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1291 |
for f in fns: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1292 |
if ui.verbose: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1293 |
commands = cmds[f].replace("|",", ") |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1294 |
ui.write(" %s:\n %s\n"%(commands, h[f])) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1295 |
else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1296 |
ui.write(' %-*s %s\n' % (m, f, h[f])) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1297 |
|
4315
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1298 |
if not ui.quiet: |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1299 |
addglobalopts(True) |
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1300 |
|
3795
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1301 |
def helptopic(name): |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1302 |
v = None |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1303 |
for i in help.helptable: |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1304 |
l = i.split('|') |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1305 |
if name in l: |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1306 |
v = i |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1307 |
header = l[-1] |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1308 |
if not v: |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
1309 |
raise cmdutil.UnknownCommand(name) |
3795
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1310 |
|
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1311 |
# description |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1312 |
doc = help.helptable[v] |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1313 |
if not doc: |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1314 |
doc = _("(No help text available)") |
3796
58133ba5847d
Allow topics to be callables
Matt Mackall <mpm@selenic.com>
parents:
3795
diff
changeset
|
1315 |
if callable(doc): |
58133ba5847d
Allow topics to be callables
Matt Mackall <mpm@selenic.com>
parents:
3795
diff
changeset
|
1316 |
doc = doc() |
3795
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1317 |
|
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1318 |
ui.write("%s\n" % header) |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1319 |
ui.write("%s\n" % doc.rstrip()) |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1320 |
|
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1321 |
def helpext(name): |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1322 |
try: |
4544
930ed513c864
Create a separate module for managing extensions
Matt Mackall <mpm@selenic.com>
parents:
4543
diff
changeset
|
1323 |
mod = extensions.find(name) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1324 |
except KeyError: |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
1325 |
raise cmdutil.UnknownCommand(name) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1326 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1327 |
doc = (mod.__doc__ or _('No help text available')).splitlines(0) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1328 |
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
|
1329 |
for d in doc[1:]: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1330 |
ui.write(d, '\n') |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1331 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1332 |
ui.status('\n') |
4009
86098ec4b77a
fix hg help <ext> for extension that do not define any command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3915
diff
changeset
|
1333 |
|
86098ec4b77a
fix hg help <ext> for extension that do not define any command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3915
diff
changeset
|
1334 |
try: |
86098ec4b77a
fix hg help <ext> for extension that do not define any command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3915
diff
changeset
|
1335 |
ct = mod.cmdtable |
86098ec4b77a
fix hg help <ext> for extension that do not define any command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3915
diff
changeset
|
1336 |
except AttributeError: |
4950
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1337 |
ct = {} |
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1338 |
|
4009
86098ec4b77a
fix hg help <ext> for extension that do not define any command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3915
diff
changeset
|
1339 |
modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct]) |
4950
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1340 |
helplist(_('list of commands:\n\n'), modcmds.has_key) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1341 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1342 |
if name and name != 'shortlist': |
3795
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1343 |
i = None |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1344 |
for f in (helpcmd, helptopic, helpext): |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1345 |
try: |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1346 |
f(name) |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1347 |
i = None |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1348 |
break |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
1349 |
except cmdutil.UnknownCommand, inst: |
3795
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1350 |
i = inst |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1351 |
if i: |
17a11f4ff260
Add basic support for help topics and a dates topic
Matt Mackall <mpm@selenic.com>
parents:
3786
diff
changeset
|
1352 |
raise i |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1353 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1354 |
else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1355 |
# program name |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1356 |
if ui.verbose or with_version: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1357 |
version_(ui) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1358 |
else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1359 |
ui.status(_("Mercurial Distributed SCM\n")) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1360 |
ui.status('\n') |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1361 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1362 |
# list of commands |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1363 |
if name == "shortlist": |
4950
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1364 |
header = _('basic commands:\n\n') |
4315
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1365 |
else: |
4950
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1366 |
header = _('list of commands:\n\n') |
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1367 |
|
93b7e2fa7ee3
help: avoid traceback if an extension has only debug commands
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4942
diff
changeset
|
1368 |
helplist(header) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1369 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1370 |
# list all option lists |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1371 |
opt_output = [] |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1372 |
for title, options in option_lists: |
4315
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1373 |
opt_output.append(("\n%s" % title, None)) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1374 |
for shortopt, longopt, default, desc in options: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1375 |
if "DEPRECATED" in desc and not ui.verbose: continue |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1376 |
opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt, |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1377 |
longopt and " --%s" % longopt), |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1378 |
"%s%s" % (desc, |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1379 |
default |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1380 |
and _(" (default: %s)") % default |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1381 |
or ""))) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1382 |
|
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1383 |
if opt_output: |
4315
bc6f5a1d8b7b
Add a pointer to "hg -v help" to the bottom of hg help {,cmd} output
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4267
diff
changeset
|
1384 |
opts_len = max([len(line[0]) for line in opt_output if line[1]] or [0]) |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1385 |
for first, second in opt_output: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1386 |
if second: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1387 |
ui.write(" %-*s %s\n" % (opts_len, first, second)) |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1388 |
else: |
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
1389 |
ui.write("%s\n" % first) |
221 | 1390 |
|
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1391 |
def identify(ui, repo, source=None, |
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1392 |
rev=None, num=None, id=None, branch=None, tags=None): |
4665
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
1393 |
"""identify the working copy or specified revision |
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
1394 |
|
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1395 |
With no revision, print a summary of the current state of the repo. |
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1396 |
|
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1397 |
With a path, do a lookup in another repository. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1398 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1399 |
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
|
1400 |
hash identifiers, followed by a "+" if there are uncommitted changes |
4665
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
1401 |
in the working directory, a list of tags for this revision and a branch |
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
1402 |
name for non-default branches. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1403 |
""" |
4662
f9b8ea362b49
identify: show nullid for empty repo
Matt Mackall <mpm@selenic.com>
parents:
4659
diff
changeset
|
1404 |
|
5330
4528858e7202
make identify an optionalrepo command
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5329
diff
changeset
|
1405 |
if not repo and not source: |
4528858e7202
make identify an optionalrepo command
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5329
diff
changeset
|
1406 |
raise util.Abort(_("There is no Mercurial repository here " |
4528858e7202
make identify an optionalrepo command
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5329
diff
changeset
|
1407 |
"(.hg not found)")) |
4528858e7202
make identify an optionalrepo command
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5329
diff
changeset
|
1408 |
|
2966
fb493241d7f6
Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents:
2963
diff
changeset
|
1409 |
hexfunc = ui.debugflag and hex or short |
4666
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1410 |
default = not (num or id or branch or tags) |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1411 |
output = [] |
4664 | 1412 |
|
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1413 |
if source: |
5248 | 1414 |
source, revs, checkout = hg.parseurl(ui.expandpath(source), []) |
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1415 |
srepo = hg.repository(ui, source) |
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1416 |
if not rev and revs: |
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1417 |
rev = revs[0] |
4667
c7a81e3ae80f
identify: work with remote repos
Matt Mackall <mpm@selenic.com>
parents:
4666
diff
changeset
|
1418 |
if not rev: |
c7a81e3ae80f
identify: work with remote repos
Matt Mackall <mpm@selenic.com>
parents:
4666
diff
changeset
|
1419 |
rev = "tip" |
c7a81e3ae80f
identify: work with remote repos
Matt Mackall <mpm@selenic.com>
parents:
4666
diff
changeset
|
1420 |
if num or branch or tags: |
c7a81e3ae80f
identify: work with remote repos
Matt Mackall <mpm@selenic.com>
parents:
4666
diff
changeset
|
1421 |
raise util.Abort( |
c7a81e3ae80f
identify: work with remote repos
Matt Mackall <mpm@selenic.com>
parents:
4666
diff
changeset
|
1422 |
"can't query remote revision number, branch, or tags") |
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1423 |
output = [hexfunc(srepo.lookup(rev))] |
4667
c7a81e3ae80f
identify: work with remote repos
Matt Mackall <mpm@selenic.com>
parents:
4666
diff
changeset
|
1424 |
elif not rev: |
4665
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
1425 |
ctx = repo.workingctx() |
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
1426 |
parents = ctx.parents() |
4666
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1427 |
changed = False |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1428 |
if default or id or num: |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1429 |
changed = ctx.files() + ctx.deleted() |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1430 |
if default or id: |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1431 |
output = ["%s%s" % ('+'.join([hexfunc(p.node()) for p in parents]), |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1432 |
(changed) and "+" or "")] |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1433 |
if num: |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1434 |
output.append("%s%s" % ('+'.join([str(p.rev()) for p in parents]), |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1435 |
(changed) and "+" or "")) |
4665
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
1436 |
else: |
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
1437 |
ctx = repo.changectx(rev) |
4666
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1438 |
if default or id: |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1439 |
output = [hexfunc(ctx.node())] |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1440 |
if num: |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1441 |
output.append(str(ctx.rev())) |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1442 |
|
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
1443 |
if not source and default and not ui.quiet: |
4666
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1444 |
b = util.tolocal(ctx.branch()) |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1445 |
if b != 'default': |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1446 |
output.append("(%s)" % b) |
3415 | 1447 |
|
386
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1448 |
# multiple tags for a single parent separated by '/' |
4666
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1449 |
t = "/".join(ctx.tags()) |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1450 |
if t: |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1451 |
output.append(t) |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1452 |
|
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1453 |
if branch: |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1454 |
output.append(util.tolocal(ctx.branch())) |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1455 |
|
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1456 |
if tags: |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
1457 |
output.extend(ctx.tags()) |
339
a76fc9c4b67b
added hg identify|id (based on a patch from Andrew Thompson)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
338
diff
changeset
|
1458 |
|
386
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
1459 |
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
|
1460 |
|
437 | 1461 |
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
|
1462 |
"""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
|
1463 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1464 |
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
|
1465 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1466 |
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
|
1467 |
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
|
1468 |
|
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1469 |
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
|
1470 |
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
|
1471 |
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
|
1472 |
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
|
1473 |
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
|
1474 |
message. |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1475 |
|
4263 | 1476 |
If the imported patch was generated by hg export, user and description |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
1477 |
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
|
1478 |
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
|
1479 |
|
4263 | 1480 |
If --exact is specified, import will set the working directory |
1481 |
to the parent of each patch before applying it, and will abort |
|
1482 |
if the resulting changeset has a different ID than the one |
|
1483 |
recorded in the patch. This may happen due to character set |
|
1484 |
problems or other deficiencies in the text patch format. |
|
1485 |
||
2400
2e90024e1471
import: allow to import stdin with file name "-"
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2397
diff
changeset
|
1486 |
To read a patch from standard input, use patch name "-". |
6163
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
1487 |
See 'hg help dates' for a list of formats valid for -d/--date. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1488 |
""" |
437 | 1489 |
patches = (patch1,) + patches |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
1490 |
|
6139
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
1491 |
date = opts.get('date') |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
1492 |
if date: |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
1493 |
opts['date'] = util.parsedate(date) |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
1494 |
|
4263 | 1495 |
if opts.get('exact') or not opts['force']: |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
1496 |
cmdutil.bail_if_changed(repo) |
966
022bcc738389
hg import: abort with uncommitted changes, override with --force
mpm@selenic.com
parents:
965
diff
changeset
|
1497 |
|
437 | 1498 |
d = opts["base"] |
1499 |
strip = opts["strip"] |
|
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1500 |
wlock = lock = None |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1501 |
try: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1502 |
wlock = repo.wlock() |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1503 |
lock = repo.lock() |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1504 |
for p in patches: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1505 |
pf = os.path.join(d, p) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1506 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1507 |
if pf == '-': |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1508 |
ui.status(_("applying patch from stdin\n")) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1509 |
data = 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
|
1510 |
else: |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1511 |
ui.status(_("applying %s\n") % p) |
5205 | 1512 |
if os.path.exists(pf): |
1513 |
data = patch.extract(ui, file(pf, 'rb')) |
|
1514 |
else: |
|
1515 |
data = patch.extract(ui, urllib.urlopen(pf)) |
|
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1516 |
tmpname, message, user, date, branch, nodeid, p1, p2 = data |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1517 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1518 |
if tmpname is None: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1519 |
raise util.Abort(_('no diffs found')) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1520 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1521 |
try: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1522 |
cmdline_message = cmdutil.logmessage(opts) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1523 |
if cmdline_message: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1524 |
# pickup the cmdline msg |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1525 |
message = cmdline_message |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1526 |
elif message: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1527 |
# pickup the patch msg |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1528 |
message = message.strip() |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1529 |
else: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1530 |
# launch the editor |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1531 |
message = None |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1532 |
ui.debug(_('message:\n%s\n') % message) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1533 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1534 |
wp = repo.workingctx().parents() |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1535 |
if opts.get('exact'): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1536 |
if not nodeid or not p1: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1537 |
raise util.Abort(_('not a mercurial patch')) |
4264
bda63383d529
Make import opportunistically use merge information
Brendan Cully <brendan@kublai.com>
parents:
4263
diff
changeset
|
1538 |
p1 = repo.lookup(p1) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1539 |
p2 = repo.lookup(p2 or hex(nullid)) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1540 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1541 |
if p1 != wp[0].node(): |
4917
126f527b3ba3
Make repo locks recursive, eliminate all passing of lock/wlock
Matt Mackall <mpm@selenic.com>
parents:
4915
diff
changeset
|
1542 |
hg.clean(repo, p1) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1543 |
repo.dirstate.setparents(p1, p2) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1544 |
elif p2: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1545 |
try: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1546 |
p1 = repo.lookup(p1) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1547 |
p2 = repo.lookup(p2) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1548 |
if p1 == wp[0].node(): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1549 |
repo.dirstate.setparents(p1, p2) |
6217
fe8dbbe9520d
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
Joel Rosdahl <joel@rosdahl.net>
parents:
6212
diff
changeset
|
1550 |
except RepoError: |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1551 |
pass |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1552 |
if opts.get('exact') or opts.get('import_branch'): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1553 |
repo.dirstate.setbranch(branch or 'default') |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1554 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1555 |
files = {} |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1556 |
try: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1557 |
fuzz = patch.patch(tmpname, ui, strip=strip, cwd=repo.root, |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1558 |
files=files) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1559 |
finally: |
4917
126f527b3ba3
Make repo locks recursive, eliminate all passing of lock/wlock
Matt Mackall <mpm@selenic.com>
parents:
4915
diff
changeset
|
1560 |
files = patch.updatedir(ui, repo, files) |
5936
00dfc810dae4
Add --no-commit option to import command
Joel Rosdahl <joel@rosdahl.net>
parents:
5858
diff
changeset
|
1561 |
if not opts.get('no_commit'): |
5953
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5936
diff
changeset
|
1562 |
n = repo.commit(files, message, opts.get('user') or user, |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5936
diff
changeset
|
1563 |
opts.get('date') or date) |
5936
00dfc810dae4
Add --no-commit option to import command
Joel Rosdahl <joel@rosdahl.net>
parents:
5858
diff
changeset
|
1564 |
if opts.get('exact'): |
00dfc810dae4
Add --no-commit option to import command
Joel Rosdahl <joel@rosdahl.net>
parents:
5858
diff
changeset
|
1565 |
if hex(n) != nodeid: |
00dfc810dae4
Add --no-commit option to import command
Joel Rosdahl <joel@rosdahl.net>
parents:
5858
diff
changeset
|
1566 |
repo.rollback() |
00dfc810dae4
Add --no-commit option to import command
Joel Rosdahl <joel@rosdahl.net>
parents:
5858
diff
changeset
|
1567 |
raise util.Abort(_('patch is damaged' |
00dfc810dae4
Add --no-commit option to import command
Joel Rosdahl <joel@rosdahl.net>
parents:
5858
diff
changeset
|
1568 |
' or loses information')) |
6001 | 1569 |
# Force a dirstate write so that the next transaction |
1570 |
# backups an up-do-date file. |
|
1571 |
repo.dirstate.write() |
|
3465
2d35a8d2b32d
patch: return list of modified files even when an exception is raised
Brendan Cully <brendan@kublai.com>
parents:
3460
diff
changeset
|
1572 |
finally: |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1573 |
os.unlink(tmpname) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1574 |
finally: |
5053
47a8ea1eb2c3
del transaction before lock before wlock
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5034
diff
changeset
|
1575 |
del lock, wlock |
437 | 1576 |
|
1192
6e165de907c5
Add -p to incoming and outgoing commands to show patch
TK Soh <teekaysoh@yahoo.com>
parents:
1191
diff
changeset
|
1577 |
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
|
1578 |
"""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
|
1579 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1580 |
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
|
1581 |
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
|
1582 |
was requested. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1583 |
|
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1584 |
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
|
1585 |
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
|
1586 |
|
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1587 |
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
|
1588 |
""" |
6191
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1589 |
limit = cmdutil.loglimit(opts) |
5248 | 1590 |
source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev']) |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
1591 |
cmdutil.setremoteconfig(ui, opts) |
1965
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
1592 |
|
927
5a830d7bea52
Add hg incoming command for local repositories
mpm@selenic.com
parents:
924
diff
changeset
|
1593 |
other = hg.repository(ui, source) |
5525
dcbda0c4c3eb
Do not display passwords with pull/push/incoming/outgoing
Manuel Holtgrewe <purestorm@ggnore.net>
parents:
5482
diff
changeset
|
1594 |
ui.status(_('comparing with %s\n') % util.hidepassword(source)) |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
1595 |
if revs: |
5259
65dc707606ed
Push capability checking into protocol-level code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
5248
diff
changeset
|
1596 |
revs = [other.lookup(rev) for rev in revs] |
4451
671158f060cc
Make "hg incoming -r revision_number" work for remote repos (issue566)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4324
diff
changeset
|
1597 |
incoming = repo.findincoming(other, heads=revs, force=opts["force"]) |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1598 |
if not incoming: |
3933
7997c0e01bfc
hg in: if no incoming csets, remove existing bundle
Matt Mackall <mpm@selenic.com>
parents:
3931
diff
changeset
|
1599 |
try: |
7997c0e01bfc
hg in: if no incoming csets, remove existing bundle
Matt Mackall <mpm@selenic.com>
parents:
3931
diff
changeset
|
1600 |
os.unlink(opts["bundle"]) |
7997c0e01bfc
hg in: if no incoming csets, remove existing bundle
Matt Mackall <mpm@selenic.com>
parents:
3931
diff
changeset
|
1601 |
except: |
7997c0e01bfc
hg in: if no incoming csets, remove existing bundle
Matt Mackall <mpm@selenic.com>
parents:
3931
diff
changeset
|
1602 |
pass |
1993
fb6ca9801d04
show message if no changes found on incoming
TK Soh <teekaysoh@yahoo.com>
parents:
1981
diff
changeset
|
1603 |
ui.status(_("no changes found\n")) |
3931
f2cbcf1e98b2
incoming/outgoing: return failure if no changes found
Matt Mackall <mpm@selenic.com>
parents:
3930
diff
changeset
|
1604 |
return 1 |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1605 |
|
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1606 |
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
|
1607 |
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
|
1608 |
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
|
1609 |
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
|
1610 |
# create a bundle (uncompressed if other repo is not local) |
4451
671158f060cc
Make "hg incoming -r revision_number" work for remote repos (issue566)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4324
diff
changeset
|
1611 |
if revs is None: |
671158f060cc
Make "hg incoming -r revision_number" work for remote repos (issue566)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4324
diff
changeset
|
1612 |
cg = other.changegroup(incoming, "incoming") |
671158f060cc
Make "hg incoming -r revision_number" work for remote repos (issue566)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4324
diff
changeset
|
1613 |
else: |
671158f060cc
Make "hg incoming -r revision_number" work for remote repos (issue566)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4324
diff
changeset
|
1614 |
cg = other.changegroupsubset(incoming, revs, 'incoming') |
3706
0d810798acb1
Use 'bundletype' instead of 'type' to not shadow built-in function.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3704
diff
changeset
|
1615 |
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
|
1616 |
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
|
1617 |
# 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
|
1618 |
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
|
1619 |
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
|
1620 |
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
|
1621 |
# 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
|
1622 |
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
|
1623 |
|
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1624 |
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
|
1625 |
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
|
1626 |
o.reverse() |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
1627 |
displayer = cmdutil.show_changeset(ui, other, opts) |
6191
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1628 |
count = 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
|
1629 |
for n in o: |
6191
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1630 |
if count >= limit: |
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1631 |
break |
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
|
1632 |
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
|
1633 |
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
|
1634 |
continue |
6191
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1635 |
count += 1 |
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
|
1636 |
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
|
1637 |
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
|
1638 |
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
|
1639 |
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
|
1640 |
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
|
1641 |
os.unlink(cleanup) |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
1642 |
|
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
|
1643 |
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
|
1644 |
"""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
|
1645 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1646 |
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
|
1647 |
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
|
1648 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1649 |
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
|
1650 |
|
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
1651 |
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
|
1652 |
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
|
1653 |
about ssh:// URLs. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1654 |
""" |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
1655 |
cmdutil.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
|
1656 |
hg.repository(ui, dest, create=1) |
338 | 1657 |
|
627 | 1658 |
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
|
1659 |
"""locate files matching specific patterns |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1660 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1661 |
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
|
1662 |
given patterns. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1663 |
|
4195
e8ee8fdeddb1
change locate to use relglobs by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4174
diff
changeset
|
1664 |
This command searches the entire repository by default. To search |
4692
c135c6cddbec
Command in doc comment is now on a single line, fixed
paul sorenson <sf@metrak.com>
parents:
4686
diff
changeset
|
1665 |
just the current directory and its subdirectories, use |
c135c6cddbec
Command in doc comment is now on a single line, fixed
paul sorenson <sf@metrak.com>
parents:
4686
diff
changeset
|
1666 |
"--include .". |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1667 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1668 |
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
|
1669 |
names. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1670 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1671 |
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
|
1672 |
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
|
1673 |
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
|
1674 |
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
|
1675 |
""" |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1676 |
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
|
1677 |
rev = opts['rev'] |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1678 |
if rev: |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1679 |
node = repo.lookup(rev) |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1680 |
else: |
5e9168401a68
fix locate broken since 63799b01985c
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1619
diff
changeset
|
1681 |
node = None |
742 | 1682 |
|
4196
1c69c73d85d9
locate: exit(1) if we didn't print any file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4195
diff
changeset
|
1683 |
ret = 1 |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
1684 |
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node, |
4308
a5cde03cd019
locate: don't print "file not found" messages.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4252
diff
changeset
|
1685 |
badmatch=util.always, |
4195
e8ee8fdeddb1
change locate to use relglobs by default
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4174
diff
changeset
|
1686 |
default='relglob'): |
4308
a5cde03cd019
locate: don't print "file not found" messages.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4252
diff
changeset
|
1687 |
if src == 'b': |
a5cde03cd019
locate: don't print "file not found" messages.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4252
diff
changeset
|
1688 |
continue |
4906
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
1689 |
if not node and abs not in repo.dirstate: |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
1690 |
continue |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
1691 |
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
|
1692 |
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
|
1693 |
else: |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
1694 |
ui.write(((pats and rel) or abs), end) |
4196
1c69c73d85d9
locate: exit(1) if we didn't print any file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4195
diff
changeset
|
1695 |
ret = 0 |
1c69c73d85d9
locate: exit(1) if we didn't print any file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4195
diff
changeset
|
1696 |
|
1c69c73d85d9
locate: exit(1) if we didn't print any file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4195
diff
changeset
|
1697 |
return ret |
627 | 1698 |
|
1031
503aaf19a040
Rewrite log command. New version is faster and more featureful.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1030
diff
changeset
|
1699 |
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
|
1700 |
"""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
|
1701 |
|
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
1702 |
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
|
1703 |
project. |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
1704 |
|
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
1705 |
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
|
1706 |
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
|
1707 |
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
|
1708 |
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
|
1709 |
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
|
1710 |
|
2783
2e0cd25fe4ac
Make log --follow revision range start default to working dir parent.
Brendan Cully <brendan@kublai.com>
parents:
2782
diff
changeset
|
1711 |
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
|
1712 |
--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
|
1713 |
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
|
1714 |
|
6163
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
1715 |
See 'hg help dates' for a list of formats valid for -d/--date. |
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
1716 |
|
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1717 |
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
|
1718 |
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
|
1719 |
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
|
1720 |
files and full commit message is shown. |
3822
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
1721 |
|
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
1722 |
NOTE: log -p may generate unexpected diff output for merge |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
1723 |
changesets, as it will compare the merge changeset against its |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
1724 |
first parent only. Also, the files: list will only reflect files |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
1725 |
that are different from BOTH parents. |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
1726 |
|
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1727 |
""" |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1728 |
|
3673
eb0b4a2d70a9
white space and line break cleanups
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3672
diff
changeset
|
1729 |
get = util.cachefunc(lambda r: repo.changectx(r).changeset()) |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1730 |
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
|
1731 |
|
6190
a79d9408806f
Move finding/checking the log limit to cmdutil
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6189
diff
changeset
|
1732 |
limit = cmdutil.loglimit(opts) |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1733 |
count = 0 |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1734 |
|
3197 | 1735 |
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
|
1736 |
endrev = max(cmdutil.revrange(repo, opts['rev'])) + 1 |
3197 | 1737 |
else: |
1738 |
endrev = repo.changelog.count() |
|
1739 |
rcache = {} |
|
1740 |
ncache = {} |
|
5811
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1741 |
def getrenamed(fn, rev): |
3197 | 1742 |
'''looks up all renames for a file (up to endrev) the first |
1743 |
time the file is given. It indexes on the changerev and only |
|
1744 |
parses the manifest if linkrev != changerev. |
|
1745 |
Returns rename info for fn at changerev rev.''' |
|
1746 |
if fn not in rcache: |
|
1747 |
rcache[fn] = {} |
|
1748 |
ncache[fn] = {} |
|
1749 |
fl = repo.file(fn) |
|
1750 |
for i in xrange(fl.count()): |
|
1751 |
node = fl.node(i) |
|
1752 |
lr = fl.linkrev(node) |
|
1753 |
renamed = fl.renamed(node) |
|
1754 |
rcache[fn][lr] = renamed |
|
1755 |
if renamed: |
|
1756 |
ncache[fn][node] = renamed |
|
1757 |
if lr >= endrev: |
|
1758 |
break |
|
1759 |
if rev in rcache[fn]: |
|
1760 |
return rcache[fn][rev] |
|
5811
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1761 |
|
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1762 |
# If linkrev != rev (i.e. rev not found in rcache) fallback to |
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1763 |
# filectx logic. |
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1764 |
|
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1765 |
try: |
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1766 |
return repo.changectx(rev).filectx(fn).renamed() |
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1767 |
except revlog.LookupError: |
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1768 |
pass |
3197 | 1769 |
return None |
1770 |
||
3813 | 1771 |
df = False |
1772 |
if opts["date"]: |
|
1773 |
df = util.matchdate(opts["date"]) |
|
1774 |
||
6067
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
1775 |
only_branches = opts['only_branch'] |
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
1776 |
|
3837
7df171ea50cd
Fix log regression where log -p file showed diffs for other files
Matt Mackall <mpm@selenic.com>
parents:
3833
diff
changeset
|
1777 |
displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn) |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
1778 |
for st, rev, fns in changeiter: |
3645
b984dcb1df71
Refactor log ui buffering and patch display
Matt Mackall <mpm@selenic.com>
parents:
3643
diff
changeset
|
1779 |
if st == 'add': |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
1780 |
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
|
1781 |
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
|
1782 |
if p != nullrev] |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
1783 |
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
|
1784 |
continue |
1436
db6d7b4005ba
add --only-merges (-m) log
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1435
diff
changeset
|
1785 |
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
|
1786 |
continue |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
1787 |
|
6067
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
1788 |
if only_branches: |
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
1789 |
revbranch = get(rev)[5]['branch'] |
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
1790 |
if revbranch not in only_branches: |
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
1791 |
continue |
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
1792 |
|
3813 | 1793 |
if df: |
1794 |
changes = get(rev) |
|
1795 |
if not df(changes[2][0]): |
|
1796 |
continue |
|
1797 |
||
1373
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1798 |
if opts['keyword']: |
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1799 |
changes = get(rev) |
1373
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1800 |
miss = 0 |
1404
67e20e27d8df
log: make keyword search truly case-insensitive
TK Soh <teekaysoh@yahoo.com>
parents:
1402
diff
changeset
|
1801 |
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
|
1802 |
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
|
1803 |
k in changes[4].lower() or |
4322
38922a13101e
log: expand keyword search to full list of files
TK Soh <teekaysoh@yahoo.com>
parents:
4315
diff
changeset
|
1804 |
k in " ".join(changes[3]).lower()): |
1373
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1805 |
miss = 1 |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1806 |
break |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1807 |
if miss: |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1808 |
continue |
965d1db5c95d
hg log: add -k for keyword searching
Matt Mackall <mpm@selenic.com>
parents:
1366
diff
changeset
|
1809 |
|
3197 | 1810 |
copies = [] |
1811 |
if opts.get('copies') and rev: |
|
3650
731e739b8659
move walkchangerevs to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3649
diff
changeset
|
1812 |
for fn in get(rev)[3]: |
5811
180a3eee4b75
Fix copies reporting in log and convert.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5783
diff
changeset
|
1813 |
rename = getrenamed(fn, rev) |
3197 | 1814 |
if rename: |
1815 |
copies.append((fn, rename[0])) |
|
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
1816 |
displayer.show(rev, changenode, copies=copies) |
1057 | 1817 |
elif st == 'iter': |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
1818 |
if count == limit: break |
3645
b984dcb1df71
Refactor log ui buffering and patch display
Matt Mackall <mpm@selenic.com>
parents:
3643
diff
changeset
|
1819 |
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
|
1820 |
count += 1 |
255 | 1821 |
|
5155
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
1822 |
def manifest(ui, repo, node=None, rev=None): |
3914
283ee8971570
doc string fix: hg cat and manifest default to current parent revision.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3900
diff
changeset
|
1823 |
"""output the current or given revision of the project manifest |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1824 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1825 |
Print a list of version controlled files for the given revision. |
3915
3c82ab166eea
doc fix: hg tags defaults to current parent revision, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3914
diff
changeset
|
1826 |
If no revision is given, the parent of the working directory is used, |
3c82ab166eea
doc fix: hg tags defaults to current parent revision, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3914
diff
changeset
|
1827 |
or tip 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
|
1828 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1829 |
The manifest is the list of files being version controlled. If no revision |
3736 | 1830 |
is given then the first parent of the working directory is used. |
1831 |
||
5760
0145f9afb0e7
Removed tabs and trailing whitespace in python files
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5741
diff
changeset
|
1832 |
With -v flag, print file permissions, symlink and executable bits. With |
5405
8feb33c2d153
Display symlink or executable bit with manifest -v
Patrick Mezard <pmezard@gmail.com>
parents:
5336
diff
changeset
|
1833 |
--debug flag, print file revision hashes. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1834 |
""" |
3736 | 1835 |
|
5155
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
1836 |
if rev and node: |
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
1837 |
raise util.Abort(_("please specify just one revision")) |
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
1838 |
|
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
1839 |
if not node: |
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
1840 |
node = rev |
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
1841 |
|
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
1842 |
m = repo.changectx(node).manifest() |
255 | 1843 |
files = m.keys() |
1844 |
files.sort() |
|
1845 |
||
1846 |
for f in files: |
|
3736 | 1847 |
if ui.debugflag: |
1848 |
ui.write("%40s " % hex(m[f])) |
|
1849 |
if ui.verbose: |
|
5405
8feb33c2d153
Display symlink or executable bit with manifest -v
Patrick Mezard <pmezard@gmail.com>
parents:
5336
diff
changeset
|
1850 |
type = m.execf(f) and "*" or m.linkf(f) and "@" or " " |
8feb33c2d153
Display symlink or executable bit with manifest -v
Patrick Mezard <pmezard@gmail.com>
parents:
5336
diff
changeset
|
1851 |
perm = m.execf(f) and "755" or "644" |
8feb33c2d153
Display symlink or executable bit with manifest -v
Patrick Mezard <pmezard@gmail.com>
parents:
5336
diff
changeset
|
1852 |
ui.write("%3s %1s " % (perm, type)) |
3736 | 1853 |
ui.write("%s\n" % f) |
255 | 1854 |
|
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
1855 |
def merge(ui, repo, node=None, force=None, rev=None): |
4014
509342f95564
various doc fixes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4013
diff
changeset
|
1856 |
"""merge working directory with another revision |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1857 |
|
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1858 |
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
|
1859 |
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
|
1860 |
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
|
1861 |
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
|
1862 |
|
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1863 |
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
|
1864 |
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
|
1865 |
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
|
1866 |
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
|
1867 |
""" |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
1868 |
|
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
1869 |
if rev and node: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
1870 |
raise util.Abort(_("please specify just one revision")) |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
1871 |
if not node: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
1872 |
node = rev |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
1873 |
|
3876
1e0b94cfba0e
Remove deprecated old-style branch support
Matt Mackall <mpm@selenic.com>
parents:
3862
diff
changeset
|
1874 |
if not node: |
2915
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1875 |
heads = repo.heads() |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1876 |
if len(heads) > 2: |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1877 |
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
|
1878 |
'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
|
1879 |
len(heads)) |
5242
9cd6578750b9
improve error message for 'hg merge' when repo already at branchtip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5205
diff
changeset
|
1880 |
parent = repo.dirstate.parents()[0] |
2915
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1881 |
if len(heads) == 1: |
5242
9cd6578750b9
improve error message for 'hg merge' when repo already at branchtip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5205
diff
changeset
|
1882 |
msg = _('there is nothing to merge') |
9cd6578750b9
improve error message for 'hg merge' when repo already at branchtip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5205
diff
changeset
|
1883 |
if parent != repo.lookup(repo.workingctx().branch()): |
5542
253736bb0dc9
i18n: fix complaints from pygettext
Matt Mackall <mpm@selenic.com>
parents:
5525
diff
changeset
|
1884 |
msg = _('%s - use "hg update" instead') % msg |
5242
9cd6578750b9
improve error message for 'hg merge' when repo already at branchtip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5205
diff
changeset
|
1885 |
raise util.Abort(msg) |
9cd6578750b9
improve error message for 'hg merge' when repo already at branchtip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5205
diff
changeset
|
1886 |
|
2915
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1887 |
if parent not in heads: |
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
1888 |
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
|
1889 |
'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
|
1890 |
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
|
1891 |
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
|
1892 |
|
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
1893 |
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
|
1894 |
"""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
|
1895 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1896 |
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
|
1897 |
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
|
1898 |
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
|
1899 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
1900 |
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
|
1901 |
""" |
6191
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1902 |
limit = cmdutil.loglimit(opts) |
5248 | 1903 |
dest, revs, checkout = hg.parseurl( |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
1904 |
ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev']) |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
1905 |
cmdutil.setremoteconfig(ui, opts) |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
1906 |
if revs: |
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
1907 |
revs = [repo.lookup(rev) for rev in revs] |
1965
62aa1b90414f
add remotecmd/ssh option support to incoming/outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1959
diff
changeset
|
1908 |
|
920 | 1909 |
other = hg.repository(ui, dest) |
5525
dcbda0c4c3eb
Do not display passwords with pull/push/incoming/outgoing
Manuel Holtgrewe <purestorm@ggnore.net>
parents:
5482
diff
changeset
|
1910 |
ui.status(_('comparing with %s\n') % util.hidepassword(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
|
1911 |
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
|
1912 |
if not o: |
78ef83c9e9e1
show message if no changes found on outgoing
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1993
diff
changeset
|
1913 |
ui.status(_("no changes found\n")) |
3931
f2cbcf1e98b2
incoming/outgoing: return failure if no changes found
Matt Mackall <mpm@selenic.com>
parents:
3930
diff
changeset
|
1914 |
return 1 |
2521
9cceb439048b
add -r/--rev arguments to incoming and outgoing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2515
diff
changeset
|
1915 |
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
|
1916 |
if opts['newest_first']: |
65cbe22b03fa
allow 'hg out' / 'hg in' to show newest commit first
Michal Kvasnica <kvasnica@gmail.com>
parents:
1437
diff
changeset
|
1917 |
o.reverse() |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
1918 |
displayer = cmdutil.show_changeset(ui, repo, opts) |
6191
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1919 |
count = 0 |
920 | 1920 |
for n in o: |
6191
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1921 |
if count >= limit: |
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1922 |
break |
1435
22b44fd9a166
add --no-merges (-M) for log, outgoing, incoming
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1431
diff
changeset
|
1923 |
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
|
1924 |
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
|
1925 |
continue |
6191
01594b0c86e2
Add option -l/--limit to hg incoming and hg outgoing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6190
diff
changeset
|
1926 |
count += 1 |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
1927 |
displayer.show(changenode=n) |
920 | 1928 |
|
3658
d12c8668b102
remove legacy hg parents REV syntax
Matt Mackall <mpm@selenic.com>
parents:
3657
diff
changeset
|
1929 |
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
|
1930 |
"""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
|
1931 |
|
4586
1fcc076fcb17
Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
4451
diff
changeset
|
1932 |
Print the working directory's parent revisions. If a |
1fcc076fcb17
Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
4451
diff
changeset
|
1933 |
revision is given via --rev, the parent of that revision |
1fcc076fcb17
Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
4451
diff
changeset
|
1934 |
will be printed. If a file argument is given, revision in |
1fcc076fcb17
Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
4451
diff
changeset
|
1935 |
which the file was last changed (before the working directory |
1fcc076fcb17
Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
4451
diff
changeset
|
1936 |
revision or the argument to --rev if given) is printed. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1937 |
""" |
3658
d12c8668b102
remove legacy hg parents REV syntax
Matt Mackall <mpm@selenic.com>
parents:
3657
diff
changeset
|
1938 |
rev = opts.get('rev') |
5298
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1939 |
if rev: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1940 |
ctx = repo.changectx(rev) |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1941 |
else: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1942 |
ctx = repo.workingctx() |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1943 |
|
4586
1fcc076fcb17
Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
4451
diff
changeset
|
1944 |
if file_: |
4894
be5dc5e3ab2d
hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4877
diff
changeset
|
1945 |
files, match, anypats = cmdutil.matchpats(repo, (file_,), opts) |
be5dc5e3ab2d
hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4877
diff
changeset
|
1946 |
if anypats or len(files) != 1: |
be5dc5e3ab2d
hg parents: don't pass an OS-specific path to repo.filectx
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4877
diff
changeset
|
1947 |
raise util.Abort(_('can only specify an explicit file name')) |
5298
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1948 |
file_ = files[0] |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1949 |
filenodes = [] |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1950 |
for cp in ctx.parents(): |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1951 |
if not cp: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1952 |
continue |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1953 |
try: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1954 |
filenodes.append(cp.filenode(file_)) |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1955 |
except revlog.LookupError: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1956 |
pass |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1957 |
if not filenodes: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1958 |
raise util.Abort(_("'%s' not found in manifest!") % file_) |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1959 |
fl = repo.file(file_) |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1960 |
p = [repo.lookup(fl.linkrev(fn)) for fn in filenodes] |
255 | 1961 |
else: |
5298
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
1962 |
p = [cp.node() for cp in ctx.parents()] |
255 | 1963 |
|
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
1964 |
displayer = cmdutil.show_changeset(ui, repo, opts) |
255 | 1965 |
for n in p: |
1092 | 1966 |
if n != nullid: |
3649
e50891e461e4
Consolidate brinfo handling
Matt Mackall <mpm@selenic.com>
parents:
3645
diff
changeset
|
1967 |
displayer.show(changenode=n) |
255 | 1968 |
|
1858
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
1969 |
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
|
1970 |
"""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
|
1971 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1972 |
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
|
1973 |
definition of available names. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1974 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1975 |
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
|
1976 |
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
|
1977 |
""" |
779 | 1978 |
if search: |
1979 |
for name, path in ui.configitems("paths"): |
|
1980 |
if name == search: |
|
6234
a47462264906
Hide URL passwords in hg paths output.
Brendan Cully <brendan@kublai.com>
parents:
6220
diff
changeset
|
1981 |
ui.write("%s\n" % util.hidepassword(path)) |
779 | 1982 |
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
|
1983 |
ui.warn(_("not found!\n")) |
779 | 1984 |
return 1 |
1985 |
else: |
|
1986 |
for name, path in ui.configitems("paths"): |
|
6234
a47462264906
Hide URL passwords in hg paths output.
Brendan Cully <brendan@kublai.com>
parents:
6220
diff
changeset
|
1987 |
ui.write("%s = %s\n" % (name, util.hidepassword(path))) |
779 | 1988 |
|
5224
20817af258d8
pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5222
diff
changeset
|
1989 |
def postincoming(ui, repo, modheads, optupdate, checkout): |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1990 |
if modheads == 0: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1991 |
return |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1992 |
if optupdate: |
5224
20817af258d8
pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5222
diff
changeset
|
1993 |
if modheads <= 1 or checkout: |
20817af258d8
pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5222
diff
changeset
|
1994 |
return hg.update(repo, checkout) |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1995 |
else: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1996 |
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
|
1997 |
if modheads > 1: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
1998 |
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
|
1999 |
else: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2000 |
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
|
2001 |
|
404 | 2002 |
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
|
2003 |
"""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
|
2004 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2005 |
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
|
2006 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2007 |
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
|
2008 |
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
|
2009 |
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
|
2010 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2011 |
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
|
2012 |
|
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
2013 |
local/filesystem/path (or file://local/filesystem/path) |
2589
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2014 |
http://[user@]host[:port]/[path] |
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2015 |
https://[user@]host[:port]/[path] |
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2016 |
ssh://[user@]host[:port]/[path] |
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
2017 |
static-http://host[:port]/[path] |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
2018 |
|
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
2019 |
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
|
2020 |
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
|
2021 |
'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
|
2022 |
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
|
2023 |
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
|
2024 |
|
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2025 |
An optional identifier after # indicates a particular branch, tag, |
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2026 |
or changeset to pull. |
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2027 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2028 |
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
|
2029 |
- 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
|
2030 |
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
|
2031 |
- 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
|
2032 |
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
|
2033 |
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
|
2034 |
- 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
|
2035 |
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
|
2036 |
Host *.mylocalnetwork.example.com |
3471
be2bf7263276
Corrected SSH configuration example in pull help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3467
diff
changeset
|
2037 |
Compression no |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2038 |
Host * |
3471
be2bf7263276
Corrected SSH configuration example in pull help.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3467
diff
changeset
|
2039 |
Compression yes |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2040 |
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
|
2041 |
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
|
2042 |
""" |
5248 | 2043 |
source, revs, checkout = hg.parseurl(ui.expandpath(source), opts['rev']) |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
2044 |
cmdutil.setremoteconfig(ui, opts) |
963
84355e3e4493
Add -e and --remotecmd for clone and pull too
mpm@selenic.com
parents:
961
diff
changeset
|
2045 |
|
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
2046 |
other = hg.repository(ui, source) |
5525
dcbda0c4c3eb
Do not display passwords with pull/push/incoming/outgoing
Manuel Holtgrewe <purestorm@ggnore.net>
parents:
5482
diff
changeset
|
2047 |
ui.status(_('pulling from %s\n') % util.hidepassword(source)) |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2048 |
if revs: |
5259
65dc707606ed
Push capability checking into protocol-level code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
5248
diff
changeset
|
2049 |
try: |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2050 |
revs = [other.lookup(rev) for rev in revs] |
6405
b8346ae5d64b
commands: fix shadowed repo module
Patrick Mezard <pmezard@gmail.com>
parents:
6385
diff
changeset
|
2051 |
except NoCapability: |
5259
65dc707606ed
Push capability checking into protocol-level code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
5248
diff
changeset
|
2052 |
error = _("Other repository doesn't support revision lookup, " |
65dc707606ed
Push capability checking into protocol-level code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
5248
diff
changeset
|
2053 |
"so a rev cannot be specified.") |
3448
6ca49c5fe268
Stop erroring out pull -r and clone -r if repository isn't local.
Eric Hopper <hopper@omnifarious.org>
parents:
3421
diff
changeset
|
2054 |
raise util.Abort(error) |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2055 |
|
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
2056 |
modheads = repo.pull(other, heads=revs, force=opts['force']) |
5224
20817af258d8
pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5222
diff
changeset
|
2057 |
return postincoming(ui, repo, modheads, opts['update'], checkout) |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
2058 |
|
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
2059 |
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
|
2060 |
"""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
|
2061 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2062 |
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
|
2063 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2064 |
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
|
2065 |
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
|
2066 |
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
|
2067 |
from the current one. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2068 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2069 |
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
|
2070 |
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
|
2071 |
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
|
2072 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2073 |
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
|
2074 |
|
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
2075 |
local/filesystem/path (or file://local/filesystem/path) |
2589
dc63db82b530
disambiguate help about url syntax
"Aurelien Jacobs <aurel@gnuage.org>"
parents:
2580
diff
changeset
|
2076 |
ssh://[user@]host[:port]/[path] |
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
2077 |
http://[user@]host[:port]/[path] |
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
2078 |
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
|
2079 |
|
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2080 |
An optional identifier after # indicates a particular branch, tag, |
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2081 |
or changeset to push. |
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2082 |
|
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
2083 |
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
|
2084 |
about ssh:// URLs. |
2590
911b56853fdd
Additional information about URLs in pull/push/clone/init:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2589
diff
changeset
|
2085 |
|
3563
db946221a58a
Some clarifications for pull/push protocols:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3553
diff
changeset
|
2086 |
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
|
2087 |
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
|
2088 |
""" |
5248 | 2089 |
dest, revs, checkout = hg.parseurl( |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2090 |
ui.expandpath(dest or 'default-push', dest or 'default'), opts['rev']) |
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
2091 |
cmdutil.setremoteconfig(ui, opts) |
961 | 2092 |
|
640
b48b91d3fb4a
Switch push over to the new scheme
Matt Mackall <mpm@selenic.com>
parents:
639
diff
changeset
|
2093 |
other = hg.repository(ui, dest) |
5525
dcbda0c4c3eb
Do not display passwords with pull/push/incoming/outgoing
Manuel Holtgrewe <purestorm@ggnore.net>
parents:
5482
diff
changeset
|
2094 |
ui.status('pushing to %s\n' % util.hidepassword(dest)) |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2095 |
if revs: |
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
2096 |
revs = [repo.lookup(rev) for rev in revs] |
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
|
2097 |
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
|
2098 |
return r == 0 |
319 | 2099 |
|
3653 | 2100 |
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
|
2101 |
"""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
|
2102 |
|
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2103 |
(DEPRECATED) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2104 |
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
|
2105 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2106 |
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
|
2107 |
primarily useful for importing from other SCMs. |
1657
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2108 |
|
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2109 |
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
|
2110 |
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
|
2111 |
""" |
1657
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2112 |
|
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2113 |
ui.warn(_("(the rawcommit command is deprecated)\n")) |
dbb8bba48510
deprecate the rawcommit command
Matt Mackall <mpm@selenic.com>
parents:
1654
diff
changeset
|
2114 |
|
4549
0c61124ad877
dispatch: move dispatching code to cmdutil
Matt Mackall <mpm@selenic.com>
parents:
4548
diff
changeset
|
2115 |
message = cmdutil.logmessage(opts) |
3653 | 2116 |
|
2117 |
files, match, anypats = cmdutil.matchpats(repo, pats, opts) |
|
2118 |
if opts['files']: |
|
2119 |
files += open(opts['files']).read().splitlines() |
|
2120 |
||
2121 |
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
|
2122 |
|
1202
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
2123 |
try: |
3659
025f68f22ae2
move write_bundle to changegroup.py
Matt Mackall <mpm@selenic.com>
parents:
3658
diff
changeset
|
2124 |
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
|
2125 |
except ValueError, inst: |
71111d796e40
Commit date validation: more stringent checks, more useful error messages.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1194
diff
changeset
|
2126 |
raise util.Abort(str(inst)) |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
2127 |
|
245 | 2128 |
def recover(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2129 |
"""roll back an interrupted transaction |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2130 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2131 |
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
|
2132 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2133 |
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
|
2134 |
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
|
2135 |
""" |
1516
0b1b029b4de3
Automatically run "verify" whenever we run "recover"
Matt Mackall <mpm@selenic.com>
parents:
1514
diff
changeset
|
2136 |
if repo.recover(): |
2778 | 2137 |
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
|
2138 |
return 1 |
245 | 2139 |
|
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
2140 |
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
|
2141 |
"""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
|
2142 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2143 |
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
|
2144 |
|
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2145 |
This only removes files from the current branch, not from the entire |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2146 |
project history. -A can be used to remove only files that have already |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2147 |
been deleted, -f can be used to force deletion, and -Af can be used |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2148 |
to remove files from the next revision without deleting them. |
6352
34e4f4ef4936
removed trailing spaces
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6347
diff
changeset
|
2149 |
|
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2150 |
The following table details the behavior of remove for different file |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2151 |
states (columns) and option combinations (rows). The file states are |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2152 |
Added, Clean, Modified and Missing (as reported by hg status). The |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2153 |
actions are Warn, Remove (from branch) and Delete (from disk). |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2154 |
|
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2155 |
A C M ! |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2156 |
none W RD W R |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2157 |
-f R RD RD R |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2158 |
-A W W W R |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2159 |
-Af R R R R |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2160 |
|
3829
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
2161 |
This command schedules the files to be removed at the next commit. |
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
2162 |
To undo a remove before that, see hg revert. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2163 |
""" |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2164 |
|
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2165 |
after, force = opts.get('after'), opts.get('force') |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2166 |
if not pats and not after: |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
2167 |
raise util.Abort(_('no files specified')) |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2168 |
|
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
2169 |
files, matchfn, anypats = cmdutil.matchpats(repo, pats, opts) |
2875
3d6efcbbd1c9
remove localrepository.changes.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2874
diff
changeset
|
2170 |
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
|
2171 |
modified, added, removed, deleted, unknown = mardu |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2172 |
|
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2173 |
remove, forget = [], [] |
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
2174 |
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts): |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2175 |
|
1189
4cbcc54695b2
Make removal check more complete and informative.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1188
diff
changeset
|
2176 |
reason = None |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2177 |
if abs in removed or abs in unknown: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2178 |
continue |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2179 |
|
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2180 |
# last column |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2181 |
elif abs in deleted: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2182 |
remove.append(abs) |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2183 |
|
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2184 |
# rest of the third row |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2185 |
elif after and not force: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2186 |
reason = _('still exists (use -f to force removal)') |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2187 |
|
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2188 |
# rest of the first column |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2189 |
elif abs in added: |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2190 |
if not force: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2191 |
reason = _('has been marked for add (use -f to force removal)') |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2192 |
else: |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2193 |
forget.append(abs) |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2194 |
|
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2195 |
# rest of the third column |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2196 |
elif abs in modified: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2197 |
if not force: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2198 |
reason = _('is modified (use -f to force removal)') |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2199 |
else: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2200 |
remove.append(abs) |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2201 |
|
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2202 |
# rest of the second column |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2203 |
elif not reason: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2204 |
remove.append(abs) |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2205 |
|
1255
e825dfea3823
Get all commands that operate on files to honour --verbose and --quiet.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1254
diff
changeset
|
2206 |
if reason: |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2207 |
ui.warn(_('not removing %s: file %s\n') % (rel, reason)) |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2208 |
elif ui.verbose or not exact: |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2209 |
ui.status(_('removing %s\n') % rel) |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2210 |
|
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
2211 |
repo.forget(forget) |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
2212 |
repo.remove(remove, unlink=not after) |
245 | 2213 |
|
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
2214 |
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
|
2215 |
"""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
|
2216 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2217 |
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
|
2218 |
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
|
2219 |
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
|
2220 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2221 |
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
|
2222 |
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
|
2223 |
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
|
2224 |
|
3829
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
2225 |
This command takes effect in the next commit. To undo a rename |
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
2226 |
before that, see hg revert. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2227 |
""" |
4914 | 2228 |
wlock = repo.wlock(False) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2229 |
try: |
5610
2493a478f395
copy: handle rename internally
Matt Mackall <mpm@selenic.com>
parents:
5589
diff
changeset
|
2230 |
return cmdutil.copy(ui, repo, pats, opts, rename=True) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2231 |
finally: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2232 |
del wlock |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
2233 |
|
1472
3c909a747d7f
make revert use standard matcher
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1470
diff
changeset
|
2234 |
def revert(ui, repo, *pats, **opts): |
5574 | 2235 |
"""restore individual files or dirs to an earlier state |
2236 |
||
2237 |
(use update -r to check out earlier revisions, revert does not |
|
2238 |
change the working dir parents) |
|
2204
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
2239 |
|
2212
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2240 |
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
|
2241 |
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
|
2242 |
This restores the contents of the affected files to an unmodified |
3829
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
2243 |
state and unschedules adds, removes, copies, and renames. If the |
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
2244 |
working directory has two parents, you must explicitly specify the |
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
2245 |
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
|
2246 |
|
3016
2b255c3478dc
minor docstring fix for revert
TK Soh <teekaysoh@yahoo.com>
parents:
3014
diff
changeset
|
2247 |
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
|
2248 |
contents as of a specific revision. This can be helpful to "roll |
6163
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
2249 |
back" some or all of an earlier change. |
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
2250 |
See 'hg help dates' for a list of formats valid for -d/--date. |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2251 |
|
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
2252 |
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
|
2253 |
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
|
2254 |
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
|
2255 |
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
|
2256 |
afterwards. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2257 |
|
4804
7db38bfb307e
Fix issue589 wording problem
Patrick Mezard <pmezard@gmail.com>
parents:
4747
diff
changeset
|
2258 |
If a file has been deleted, it is restored. If the executable |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2259 |
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
|
2260 |
|
1472
3c909a747d7f
make revert use standard matcher
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1470
diff
changeset
|
2261 |
If names are given, all files matching the names are reverted. |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
2262 |
If no arguments are given, no files are reverted. |
5574 | 2263 |
|
2264 |
Modified files are saved with a .orig suffix before reverting. |
|
2265 |
To disable these backups, use --no-backup. |
|
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2266 |
""" |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
2267 |
|
3814
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
2268 |
if opts["date"]: |
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
2269 |
if opts["rev"]: |
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
2270 |
raise util.Abort(_("you can't specify a revision and a date")) |
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
2271 |
opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) |
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
2272 |
|
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
2273 |
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
|
2274 |
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
|
2275 |
'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
|
2276 |
|
2212
8164e3f31638
revert: require explicit revision when working dir has two parents.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2204
diff
changeset
|
2277 |
parent, p2 = repo.dirstate.parents() |
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2278 |
if not opts['rev'] and p2 != nullid: |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2279 |
raise util.Abort(_('uncommitted merge - please provide a ' |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2280 |
'specific revision')) |
3972
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
2281 |
ctx = repo.changectx(opts['rev']) |
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
2282 |
node = ctx.node() |
356e20d46b34
commands.py: use contexts in various places (debug*state, revert)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3951
diff
changeset
|
2283 |
mf = ctx.manifest() |
2407
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2284 |
if node == parent: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2285 |
pmf = mf |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2286 |
else: |
8fe3d60b7f19
revert: better fix for not printing 'reverting' message
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2406
diff
changeset
|
2287 |
pmf = None |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2288 |
|
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2289 |
# 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
|
2290 |
# 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
|
2291 |
# but not other. |
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2292 |
|
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2293 |
names = {} |
2042
a514c7509fa9
small changes to revert command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2037
diff
changeset
|
2294 |
|
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2295 |
wlock = repo.wlock() |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2296 |
try: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2297 |
# walk dirstate. |
6106
cb2f7652ad1b
revert: don't let repo.status walk the whole working dir
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6094
diff
changeset
|
2298 |
files = [] |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2299 |
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2300 |
badmatch=mf.has_key): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2301 |
names[abs] = (rel, exact) |
6106
cb2f7652ad1b
revert: don't let repo.status walk the whole working dir
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6094
diff
changeset
|
2302 |
if src != 'b': |
cb2f7652ad1b
revert: don't let repo.status walk the whole working dir
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6094
diff
changeset
|
2303 |
files.append(abs) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2304 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2305 |
# walk target manifest. |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2306 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2307 |
def badmatch(path): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2308 |
if path in names: |
4225
281f9f8f1bd4
Fix confusing message from hg revert (issue332)
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4213
diff
changeset
|
2309 |
return True |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2310 |
path_ = path + '/' |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2311 |
for f in names: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2312 |
if f.startswith(path_): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2313 |
return True |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2314 |
return False |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2315 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2316 |
for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, node=node, |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2317 |
badmatch=badmatch): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2318 |
if abs in names or src == 'b': |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2319 |
continue |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2320 |
names[abs] = (rel, exact) |
6031
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
2321 |
|
6106
cb2f7652ad1b
revert: don't let repo.status walk the whole working dir
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6094
diff
changeset
|
2322 |
changes = repo.status(files=files, match=names.has_key)[:4] |
6031
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
2323 |
modified, added, removed, deleted = map(dict.fromkeys, changes) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2324 |
|
5266 | 2325 |
# if f is a rename, also revert the source |
2326 |
cwd = repo.getcwd() |
|
2327 |
for f in added: |
|
2328 |
src = repo.dirstate.copied(f) |
|
2329 |
if src and src not in names and repo.dirstate[src] == 'r': |
|
2330 |
removed[src] = None |
|
2331 |
names[src] = (repo.pathto(src, cwd), True) |
|
2332 |
||
6109
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2333 |
def removeforget(abs): |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2334 |
if repo.dirstate[abs] == 'a': |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2335 |
return _('forgetting %s\n') |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2336 |
return _('removing %s\n') |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2337 |
|
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2338 |
revert = ([], _('reverting %s\n')) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2339 |
add = ([], _('adding %s\n')) |
6109
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2340 |
remove = ([], removeforget) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2341 |
undelete = ([], _('undeleting %s\n')) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2342 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2343 |
disptable = ( |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2344 |
# dispatch table: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2345 |
# file state |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2346 |
# action if in target manifest |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2347 |
# action if not in target manifest |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2348 |
# make backup if in target manifest |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2349 |
# make backup if not in target manifest |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2350 |
(modified, revert, remove, True, True), |
6109
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2351 |
(added, revert, remove, True, False), |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2352 |
(removed, undelete, None, False, False), |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2353 |
(deleted, revert, remove, False, False), |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2354 |
) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2355 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2356 |
entries = names.items() |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2357 |
entries.sort() |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2358 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2359 |
for abs, (rel, exact) in entries: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2360 |
mfentry = mf.get(abs) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2361 |
target = repo.wjoin(abs) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2362 |
def handle(xlist, dobackup): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2363 |
xlist[0].append(abs) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2364 |
if dobackup and not opts['no_backup'] and util.lexists(target): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2365 |
bakname = "%s.orig" % rel |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2366 |
ui.note(_('saving current version of %s as %s\n') % |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2367 |
(rel, bakname)) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2368 |
if not opts.get('dry_run'): |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2369 |
util.copyfile(target, bakname) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2370 |
if ui.verbose or not exact: |
6109
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2371 |
msg = xlist[1] |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2372 |
if not isinstance(msg, basestring): |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2373 |
msg = msg(abs) |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2374 |
ui.status(msg % rel) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2375 |
for table, hitlist, misslist, backuphit, backupmiss in disptable: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2376 |
if abs not in table: continue |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2377 |
# file has changed in dirstate |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2378 |
if mfentry: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2379 |
handle(hitlist, backuphit) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2380 |
elif misslist is not None: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2381 |
handle(misslist, backupmiss) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2382 |
break |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
2383 |
else: |
6031
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
2384 |
if abs not in repo.dirstate: |
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
2385 |
if mfentry: |
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
2386 |
handle(add, True) |
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
2387 |
elif exact: |
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
2388 |
ui.warn(_('file not managed: %s\n') % rel) |
7383384793fb
revert: don't assume ignored files will be returned in the unknown list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6030
diff
changeset
|
2389 |
continue |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2390 |
# file has not changed in dirstate |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2391 |
if node == parent: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2392 |
if exact: ui.warn(_('no changes needed to %s\n') % rel) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2393 |
continue |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2394 |
if pmf is None: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2395 |
# only need parent manifest in this unlikely case, |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2396 |
# so do not read by default |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2397 |
pmf = repo.changectx(parent).manifest() |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2398 |
if abs in pmf: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2399 |
if mfentry: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2400 |
# if version of file is same in parent and target |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2401 |
# manifests, do nothing |
6030
d0dbae32517c
revert: revert clean files when only a change of flags is needed
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5986
diff
changeset
|
2402 |
if (pmf[abs] != mfentry or |
d0dbae32517c
revert: revert clean files when only a change of flags is needed
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5986
diff
changeset
|
2403 |
pmf.flags(abs) != mf.flags(abs)): |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2404 |
handle(revert, False) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2405 |
else: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2406 |
handle(remove, False) |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2407 |
|
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2408 |
if not opts.get('dry_run'): |
6107
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2409 |
def checkout(f): |
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2410 |
fc = ctx[f] |
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2411 |
repo.wwrite(f, fc.data(), fc.fileflags()) |
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2412 |
|
6109
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2413 |
audit_path = util.path_auditor(repo.root) |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2414 |
for f in remove[0]: |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2415 |
if repo.dirstate[f] == 'a': |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2416 |
repo.dirstate.forget(f) |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2417 |
continue |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2418 |
audit_path(f) |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2419 |
try: |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2420 |
util.unlink(repo.wjoin(f)) |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2421 |
except OSError: |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2422 |
pass |
242595e612ed
revert: unify forget and remove lists
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6108
diff
changeset
|
2423 |
repo.dirstate.remove(f) |
6107
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2424 |
|
6299
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2425 |
normal = None |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2426 |
if node == parent: |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2427 |
# We're reverting to our parent. If possible, we'd like status |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2428 |
# to report the file as clean. We have to use normallookup for |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2429 |
# merges to avoid losing information about merged/dirty files. |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2430 |
if p2 != nullid: |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2431 |
normal = repo.dirstate.normallookup |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2432 |
else: |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2433 |
normal = repo.dirstate.normal |
6107
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2434 |
for f in revert[0]: |
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2435 |
checkout(f) |
6299
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2436 |
if normal: |
653ddd1d7cd7
revert: update state of files in the "checkout" list
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6296
diff
changeset
|
2437 |
normal(f) |
6107
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2438 |
|
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2439 |
for f in add[0]: |
6107
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2440 |
checkout(f) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2441 |
repo.dirstate.add(f) |
6107
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2442 |
|
6108
5086576a2152
revert: only call dirstate.normal when we know the file is clean
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6107
diff
changeset
|
2443 |
normal = repo.dirstate.normallookup |
5086576a2152
revert: only call dirstate.normal when we know the file is clean
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6107
diff
changeset
|
2444 |
if node == parent and p2 == nullid: |
5086576a2152
revert: only call dirstate.normal when we know the file is clean
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6107
diff
changeset
|
2445 |
normal = repo.dirstate.normal |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2446 |
for f in undelete[0]: |
6107
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2447 |
checkout(f) |
6108
5086576a2152
revert: only call dirstate.normal when we know the file is clean
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6107
diff
changeset
|
2448 |
normal(f) |
6107
41bb88cb913e
commands.revert: don't call hg.revert
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6106
diff
changeset
|
2449 |
|
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2450 |
finally: |
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
2451 |
del wlock |
588 | 2452 |
|
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2453 |
def rollback(ui, repo): |
5575
8788ff630c26
imported patch rollback-help
Matt Mackall <mpm@selenic.com>
parents:
5574
diff
changeset
|
2454 |
"""roll back the last transaction |
8788ff630c26
imported patch rollback-help
Matt Mackall <mpm@selenic.com>
parents:
5574
diff
changeset
|
2455 |
|
8788ff630c26
imported patch rollback-help
Matt Mackall <mpm@selenic.com>
parents:
5574
diff
changeset
|
2456 |
This command should be used with care. There is only one level of |
8788ff630c26
imported patch rollback-help
Matt Mackall <mpm@selenic.com>
parents:
5574
diff
changeset
|
2457 |
rollback, and there is no way to undo a rollback. It will also |
8788ff630c26
imported patch rollback-help
Matt Mackall <mpm@selenic.com>
parents:
5574
diff
changeset
|
2458 |
restore the dirstate at the time of the last transaction, losing |
8788ff630c26
imported patch rollback-help
Matt Mackall <mpm@selenic.com>
parents:
5574
diff
changeset
|
2459 |
any dirstate changes since that time. |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2460 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2461 |
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
|
2462 |
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
|
2463 |
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
|
2464 |
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
|
2465 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2466 |
commit |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2467 |
import |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2468 |
pull |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2469 |
push (with this repository as destination) |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2470 |
unbundle |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2471 |
|
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2472 |
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
|
2473 |
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
|
2474 |
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
|
2475 |
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
|
2476 |
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
|
2477 |
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
|
2478 |
""" |
2362
482d3fb47d80
Renamed localrepo.undo() to rollback() and talk about "rollback information".
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2356
diff
changeset
|
2479 |
repo.rollback() |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
2480 |
|
468 | 2481 |
def root(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2482 |
"""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
|
2483 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2484 |
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
|
2485 |
""" |
468 | 2486 |
ui.write(repo.root + "\n") |
2487 |
||
245 | 2488 |
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
|
2489 |
"""export the repository via HTTP |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2490 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2491 |
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
|
2492 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2493 |
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
|
2494 |
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
|
2495 |
""" |
624
876333a295ff
Add an sshrepository class and hg serve --stdio
Matt Mackall <mpm@selenic.com>
parents:
618
diff
changeset
|
2496 |
|
876333a295ff
Add an sshrepository class and hg serve --stdio
Matt Mackall <mpm@selenic.com>
parents:
618
diff
changeset
|
2497 |
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
|
2498 |
if repo is None: |
6217
fe8dbbe9520d
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
Joel Rosdahl <joel@rosdahl.net>
parents:
6212
diff
changeset
|
2499 |
raise RepoError(_("There is no Mercurial repository here" |
fe8dbbe9520d
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
Joel Rosdahl <joel@rosdahl.net>
parents:
6212
diff
changeset
|
2500 |
" (.hg not found)")) |
2396
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
2501 |
s = sshserver.sshserver(ui, repo) |
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
2502 |
s.serve_forever() |
2363
fa4c11751367
Give a response to unknown SSH commands
Matt Mackall <mpm@selenic.com>
parents:
2362
diff
changeset
|
2503 |
|
4078
ff08cebcd116
hg serve: call setconfig on the parentui
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4064
diff
changeset
|
2504 |
parentui = ui.parentui or ui |
5835
bd34f0ac3cb0
adding "prefix" option to "hg serve" (command line and [web] section)
Michele Cella <michele.cella@gmail.com>
parents:
5811
diff
changeset
|
2505 |
optlist = ("name templates style address port prefix ipv6" |
4860
f3802f9f1840
Add SSL support to hg serve, activated via --certificate option
Brendan Cully <brendan@kublai.com>
parents:
4857
diff
changeset
|
2506 |
" accesslog errorlog webdir_conf certificate") |
987 | 2507 |
for o in optlist.split(): |
2508 |
if opts[o]: |
|
4078
ff08cebcd116
hg serve: call setconfig on the parentui
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4064
diff
changeset
|
2509 |
parentui.setconfig("web", o, str(opts[o])) |
5083
f94dbc6c7eaf
Fix hgwebdir after 9858477ed74cce9dc8f4069f9453a1bda0e13ba1 broke it.
Eric Hopper <hopper@omnifarious.org>
parents:
5080
diff
changeset
|
2510 |
if (repo is not None) and (repo.ui != parentui): |
4835
9858477ed74c
serve: respect settings from .hg/hgrc
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4833
diff
changeset
|
2511 |
repo.ui.setconfig("web", o, str(opts[o])) |
987 | 2512 |
|
2127
8a85dbbadddf
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2125
diff
changeset
|
2513 |
if repo is None and not ui.config("web", "webdir_conf"): |
6217
fe8dbbe9520d
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
Joel Rosdahl <joel@rosdahl.net>
parents:
6212
diff
changeset
|
2514 |
raise RepoError(_("There is no Mercurial repository here" |
fe8dbbe9520d
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
Joel Rosdahl <joel@rosdahl.net>
parents:
6212
diff
changeset
|
2515 |
" (.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
|
2516 |
|
4380
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2517 |
class service: |
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2518 |
def init(self): |
4672
272c0a09b203
Handle CTRL+C in serve under Windows.
Marcos Chaves <marcos.nospam@gmail.com>
parents:
4659
diff
changeset
|
2519 |
util.set_signal_handler() |
6262
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
2520 |
self.httpd = hgweb.server.create_server(parentui, repo) |
4380
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2521 |
|
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2522 |
if not ui.verbose: return |
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2523 |
|
5970
f25070ecf334
hgweb: fixes to make hg serve prefix handling more robust
Michele Cella <michele.cella@gmail.com>
parents:
5953
diff
changeset
|
2524 |
if self.httpd.prefix: |
f25070ecf334
hgweb: fixes to make hg serve prefix handling more robust
Michele Cella <michele.cella@gmail.com>
parents:
5953
diff
changeset
|
2525 |
prefix = self.httpd.prefix.strip('/') + '/' |
f25070ecf334
hgweb: fixes to make hg serve prefix handling more robust
Michele Cella <michele.cella@gmail.com>
parents:
5953
diff
changeset
|
2526 |
else: |
f25070ecf334
hgweb: fixes to make hg serve prefix handling more robust
Michele Cella <michele.cella@gmail.com>
parents:
5953
diff
changeset
|
2527 |
prefix = '' |
f25070ecf334
hgweb: fixes to make hg serve prefix handling more robust
Michele Cella <michele.cella@gmail.com>
parents:
5953
diff
changeset
|
2528 |
|
6262
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
2529 |
port = ':%d' % self.httpd.port |
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
2530 |
if port == ':80': |
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
2531 |
port = '' |
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
2532 |
|
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
2533 |
ui.status(_('listening at http://%s%s/%s (%s:%d)\n') % |
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
2534 |
(self.httpd.fqaddr, port, prefix, self.httpd.addr, self.httpd.port)) |
4380
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2535 |
|
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2536 |
def run(self): |
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2537 |
self.httpd.serve_forever() |
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2538 |
|
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2539 |
service = service() |
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2540 |
|
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
2541 |
cmdutil.service(opts, initfn=service.init, runfn=service.run) |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
2542 |
|
731
91ca3afab8e8
Add name matching to status command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
729
diff
changeset
|
2543 |
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
|
2544 |
"""show changed files in the working directory |
213 | 2545 |
|
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2546 |
Show status of files in the repository. If names are given, only |
5998
5d91f6e6f841
Clarify help for hg status and make it consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5994
diff
changeset
|
2547 |
files that match are shown. Files that are clean or ignored or |
5d91f6e6f841
Clarify help for hg status and make it consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5994
diff
changeset
|
2548 |
source of a copy/move operation, are not listed unless -c (clean), |
5d91f6e6f841
Clarify help for hg status and make it consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5994
diff
changeset
|
2549 |
-i (ignored), -C (copies) or -A is given. Unless options described |
5d91f6e6f841
Clarify help for hg status and make it consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5994
diff
changeset
|
2550 |
with "show only ..." are given, the options -mardu are used. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2551 |
|
6201
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2552 |
Option -q/--quiet hides untracked (unknown and ignored) files |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2553 |
unless explicitly requested with -u/--unknown or -i/-ignored. |
6200
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6192
diff
changeset
|
2554 |
|
3822
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
2555 |
NOTE: status may appear to disagree with diff if permissions have |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
2556 |
changed or a merge has occurred. The standard diff format does not |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
2557 |
report permission changes and diff only reports changes relative |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
2558 |
to one merge parent. |
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
2559 |
|
3467
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
2560 |
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
|
2561 |
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
|
2562 |
|
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2563 |
The codes used to show the status of files are: |
746 | 2564 |
M = modified |
245 | 2565 |
A = added |
2566 |
R = removed |
|
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2567 |
C = clean |
1619
1ba0d7041ac4
Distinguish removed and deleted files. Tests are not fixed yet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1618
diff
changeset
|
2568 |
! = deleted, but still tracked |
842
8fb488773063
Rewritten change type selection for hg status.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
841
diff
changeset
|
2569 |
? = not tracked |
5998
5d91f6e6f841
Clarify help for hg status and make it consistent.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5994
diff
changeset
|
2570 |
I = ignored |
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
|
2571 |
= 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
|
2572 |
""" |
312 | 2573 |
|
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2574 |
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
|
2575 |
node1, node2 = cmdutil.revpair(repo, opts.get('rev')) |
3223
53e843840349
Whitespace/Tab cleanup
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3204
diff
changeset
|
2576 |
|
2882
cf98cd70d2c4
move walk and matchpats from commands to cmdutil.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2878
diff
changeset
|
2577 |
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
|
2578 |
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
|
2579 |
modified, added, removed, deleted, unknown, ignored, clean = [ |
4043
31047b6f7ec1
Copied files sources were not shown by status -C under Win32.
Patrick Mezard <pmezard@gmail.com>
parents:
4014
diff
changeset
|
2580 |
n for n in repo.status(node1=node1, node2=node2, files=files, |
6201
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2581 |
match=matchfn, |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2582 |
list_ignored=opts['ignored'] |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2583 |
or all and not ui.quiet, |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2584 |
list_clean=opts['clean'] or all, |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2585 |
list_unknown=opts['unknown'] |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2586 |
or not (ui.quiet or |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2587 |
opts['modified'] or |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2588 |
opts['added'] or |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2589 |
opts['removed'] or |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2590 |
opts['deleted'] or |
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
2591 |
opts['ignored']))] |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2592 |
|
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2593 |
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
|
2594 |
('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
|
2595 |
('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
|
2596 |
('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
|
2597 |
('unknown', '?', unknown), |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2598 |
('ignored', 'I', ignored)) |
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2599 |
|
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2600 |
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
|
2601 |
|
6276
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2602 |
copy = {} |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2603 |
showcopy = {} |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2604 |
if ((all or opts.get('copies')) and not opts.get('no_status')): |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2605 |
if opts.get('rev') == []: |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2606 |
# fast path, more correct with merge parents |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2607 |
showcopy = copy = repo.dirstate.copies().copy() |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2608 |
else: |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2609 |
ctxn = repo.changectx(nullid) |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2610 |
ctx1 = repo.changectx(node1) |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2611 |
ctx2 = repo.changectx(node2) |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2612 |
if node2 is None: |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2613 |
ctx2 = repo.workingctx() |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2614 |
copy, diverge = copies.copies(repo, ctx1, ctx2, ctxn) |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2615 |
for k, v in copy.items(): |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2616 |
copy[v] = k |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2617 |
|
1085
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2618 |
end = opts['print0'] and '\0' or '\n' |
1106
95a044b73bd5
Whitespace cleanup.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1105
diff
changeset
|
2619 |
|
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2620 |
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
|
2621 |
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
|
2622 |
or changetypes): |
6200
acc40572da5b
'hg status -q' output skips non-tracked files.
Zoran Bosnjak <zoran.bosnjak@via.si>
parents:
6192
diff
changeset
|
2623 |
|
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
|
2624 |
if opts['no_status']: |
1085
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2625 |
format = "%%s%s" % end |
6f94688b81b6
status: added option -p and -0 to assist xargs
TK Soh <teekaysoh@yahoo.com>
parents:
1081
diff
changeset
|
2626 |
else: |
1966
f8b0e73e320f
hg status cleanups: Don't translate long options, remove stray semicolon.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1965
diff
changeset
|
2627 |
format = "%s %%s%s" % (char, end) |
1106
95a044b73bd5
Whitespace cleanup.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1105
diff
changeset
|
2628 |
|
842
8fb488773063
Rewritten change type selection for hg status.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
841
diff
changeset
|
2629 |
for f in changes: |
4525
78b6add1f966
Add dirstate.pathto and localrepo.pathto.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4524
diff
changeset
|
2630 |
ui.write(format % repo.pathto(f, cwd)) |
6276
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2631 |
if f in copy and (f in added or f in showcopy): |
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
2632 |
ui.write(' %s%s' % (repo.pathto(copy[f], cwd), end)) |
213 | 2633 |
|
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2634 |
def tag(ui, repo, name1, *names, **opts): |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2635 |
"""add one or more tags for the current or given revision |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2636 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2637 |
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
|
2638 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2639 |
Tags are used to name particular revisions of the repository and are |
6220
1939e29151ca
Fixed typo in tag help, found by John Coomes
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6217
diff
changeset
|
2640 |
very useful to compare different revisions, to go back to significant |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2641 |
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
|
2642 |
|
3915
3c82ab166eea
doc fix: hg tags defaults to current parent revision, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3914
diff
changeset
|
2643 |
If no revision is given, the parent of the working directory is used, |
3c82ab166eea
doc fix: hg tags defaults to current parent revision, too.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3914
diff
changeset
|
2644 |
or tip 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
|
2645 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2646 |
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
|
2647 |
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
|
2648 |
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
|
2649 |
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
|
2650 |
shared among repositories). |
6163
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
2651 |
|
1f733c2f0165
Document log date ranges and mention 'hg help dates' for all commands (issue998)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6161
diff
changeset
|
2652 |
See 'hg help dates' for a list of formats valid for -d/--date. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2653 |
""" |
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2654 |
|
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2655 |
rev_ = None |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2656 |
names = (name1,) + names |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2657 |
if len(names) != len(dict.fromkeys(names)): |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2658 |
raise util.Abort(_('tag names must be unique')) |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2659 |
for n in names: |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2660 |
if n in ['tip', '.', 'null']: |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2661 |
raise util.Abort(_('the name \'%s\' is reserved') % n) |
4213 | 2662 |
if opts['rev'] and opts['remove']: |
2663 |
raise util.Abort(_("--rev and --remove are incompatible")) |
|
1596
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2664 |
if opts['rev']: |
41366b7d6709
fix 'hg tag <tagname> <revision>
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1589
diff
changeset
|
2665 |
rev_ = opts['rev'] |
4213 | 2666 |
message = opts['message'] |
2667 |
if opts['remove']: |
|
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2668 |
expectedtype = opts['local'] and 'local' or 'global' |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2669 |
for n in names: |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2670 |
if not repo.tagtype(n): |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2671 |
raise util.Abort(_('tag \'%s\' does not exist') % n) |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2672 |
if repo.tagtype(n) != expectedtype: |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2673 |
raise util.Abort(_('tag \'%s\' is not a %s tag') % |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2674 |
(n, expectedtype)) |
4213 | 2675 |
rev_ = nullid |
2676 |
if not message: |
|
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2677 |
message = _('Removed tag %s') % ', '.join(names) |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2678 |
elif not opts['force']: |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2679 |
for n in names: |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2680 |
if n in repo.tags(): |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2681 |
raise util.Abort(_('tag \'%s\' already exists ' |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2682 |
'(use -f to force)') % n) |
3132
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2683 |
if not rev_ and repo.dirstate.parents()[1] != nullid: |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2684 |
raise util.Abort(_('uncommitted merge - please provide a ' |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2685 |
'specific revision')) |
81da3c45aabd
Move defaultrev into changectx
Brendan Cully <brendan@kublai.com>
parents:
3095
diff
changeset
|
2686 |
r = repo.changectx(rev_).node() |
2967
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2687 |
|
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2688 |
if not message: |
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2689 |
message = (_('Added tag %s for changeset %s') % |
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2690 |
(', '.join(names), short(r))) |
2967
eef469259745
tag: shorten hash in default commit message
Matt Mackall <mpm@selenic.com>
parents:
2966
diff
changeset
|
2691 |
|
6243
437eef39458d
fix incorrect date when committing a tag
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6234
diff
changeset
|
2692 |
date = opts.get('date') |
437eef39458d
fix incorrect date when committing a tag
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6234
diff
changeset
|
2693 |
if date: |
437eef39458d
fix incorrect date when committing a tag
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6234
diff
changeset
|
2694 |
date = util.parsedate(date) |
437eef39458d
fix incorrect date when committing a tag
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6234
diff
changeset
|
2695 |
|
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
2696 |
repo.tag(names, r, message, opts['local'], opts['user'], date) |
401
af4848f83e68
From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
396
diff
changeset
|
2697 |
|
248 | 2698 |
def tags(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2699 |
"""list repository tags |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2700 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2701 |
List the repository tags. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2702 |
|
5658
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2703 |
This lists both regular and local tags. When the -v/--verbose switch |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2704 |
is used, a third column "local" is printed for local tags. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2705 |
""" |
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
2706 |
|
343 | 2707 |
l = repo.tagslist() |
2708 |
l.reverse() |
|
2966
fb493241d7f6
Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents:
2963
diff
changeset
|
2709 |
hexfunc = ui.debugflag and hex or short |
5658
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2710 |
tagtype = "" |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2711 |
|
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
2712 |
for t, n in l: |
5658
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2713 |
if ui.quiet: |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2714 |
ui.write("%s\n" % t) |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2715 |
continue |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2716 |
|
248 | 2717 |
try: |
4516
96d8a56d4ef9
Removed trailing whitespace and tabs from python files
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4505
diff
changeset
|
2718 |
hn = hexfunc(n) |
5658
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2719 |
r = "%5d:%s" % (repo.changelog.rev(n), hn) |
3930
01d98d68d697
Add revlog.LookupError exception, and use it instead of RevlogError.
Brendan Cully <brendan@kublai.com>
parents:
3920
diff
changeset
|
2720 |
except revlog.LookupError: |
01d98d68d697
Add revlog.LookupError exception, and use it instead of RevlogError.
Brendan Cully <brendan@kublai.com>
parents:
3920
diff
changeset
|
2721 |
r = " ?:%s" % hn |
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
|
2722 |
else: |
4143
26314500a5e1
Don't truncate tag and branch names after 30 chars (introduced 73860ffbe798)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4078
diff
changeset
|
2723 |
spaces = " " * (30 - util.locallen(t)) |
5658
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2724 |
if ui.verbose: |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2725 |
if repo.tagtype(t) == 'local': |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2726 |
tagtype = " local" |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2727 |
else: |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2728 |
tagtype = "" |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
2729 |
ui.write("%s%s %s%s\n" % (t, spaces, r, tagtype)) |
248 | 2730 |
|
1731
251729df9cc6
add -p option to tip. for issue 64.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1728
diff
changeset
|
2731 |
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
|
2732 |
"""show the tip revision |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2733 |
|
6364
b22b39059722
Make tip help more helpful
Patrick Mezard <pmezard@gmail.com>
parents:
6353
diff
changeset
|
2734 |
The tip revision (usually just called the tip) is the most |
b22b39059722
Make tip help more helpful
Patrick Mezard <pmezard@gmail.com>
parents:
6353
diff
changeset
|
2735 |
recently added changeset in the repository, the most recently |
b22b39059722
Make tip help more helpful
Patrick Mezard <pmezard@gmail.com>
parents:
6353
diff
changeset
|
2736 |
changed head. |
b22b39059722
Make tip help more helpful
Patrick Mezard <pmezard@gmail.com>
parents:
6353
diff
changeset
|
2737 |
|
6367
51984a2413f2
Remove unexpected "Alternately" word from tip help.
Patrick Mezard <pmezard@gmail.com>
parents:
6364
diff
changeset
|
2738 |
If you have just made a commit, that commit will be the tip. If |
51984a2413f2
Remove unexpected "Alternately" word from tip help.
Patrick Mezard <pmezard@gmail.com>
parents:
6364
diff
changeset
|
2739 |
you have just pulled changes from another repository, the tip of |
51984a2413f2
Remove unexpected "Alternately" word from tip help.
Patrick Mezard <pmezard@gmail.com>
parents:
6364
diff
changeset
|
2740 |
that repository becomes the current tip. The "tip" tag is special |
51984a2413f2
Remove unexpected "Alternately" word from tip help.
Patrick Mezard <pmezard@gmail.com>
parents:
6364
diff
changeset
|
2741 |
and cannot be renamed or assigned to a different changeset. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2742 |
""" |
3671
86d3f966201d
Use nullrev+count instead of count-1 in a newly introduced expression.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3663
diff
changeset
|
2743 |
cmdutil.show_changeset(ui, repo, opts).show(nullrev+repo.changelog.count()) |
245 | 2744 |
|
4699
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
2745 |
def unbundle(ui, repo, fname1, *fnames, **opts): |
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
2746 |
"""apply one or more changegroup files |
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
2747 |
|
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
2748 |
Apply one or more compressed changegroup files generated by the |
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
2749 |
bundle command. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2750 |
""" |
4699
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
2751 |
fnames = (fname1,) + fnames |
6180
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2752 |
|
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2753 |
lock = None |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2754 |
try: |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2755 |
lock = repo.lock() |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2756 |
for fname in fnames: |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2757 |
if os.path.exists(fname): |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2758 |
f = open(fname, "rb") |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2759 |
else: |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2760 |
f = urllib.urlopen(fname) |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2761 |
gen = changegroup.readbundle(f, fname) |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2762 |
modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2763 |
finally: |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
2764 |
del lock |
4699
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
2765 |
|
5224
20817af258d8
pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5222
diff
changeset
|
2766 |
return postincoming(ui, repo, modheads, opts['update'], None) |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2767 |
|
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2768 |
def update(ui, repo, node=None, rev=None, clean=False, date=None): |
4014
509342f95564
various doc fixes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4013
diff
changeset
|
2769 |
"""update working directory |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2770 |
|
4205
7ca05d29c1f0
Clarify update help text for update without an explicit revision
Brendan Cully <brendan@kublai.com>
parents:
4204
diff
changeset
|
2771 |
Update the working directory to the specified revision, or the |
7ca05d29c1f0
Clarify update help text for update without an explicit revision
Brendan Cully <brendan@kublai.com>
parents:
4204
diff
changeset
|
2772 |
tip of the current branch if none is specified. |
6375
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2773 |
|
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2774 |
If the requested revision is a descendant of the working |
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2775 |
directory, any outstanding changes in the working directory will |
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2776 |
be merged into the result. If it is not directly descended but is |
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2777 |
on the same named branch, update aborts with a suggestion to use |
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2778 |
merge or update -C instead. |
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2779 |
|
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2780 |
If the requested revision is on a different named branch and the |
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2781 |
working directory is clean, update quietly switches branches. |
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2782 |
|
cdc458b12f0f
update: better logic and messages for updates
Matt Mackall <mpm@selenic.com>
parents:
6369
diff
changeset
|
2783 |
See 'hg help dates' for a list of formats valid for --date. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2784 |
""" |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2785 |
if rev and node: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2786 |
raise util.Abort(_("please specify just one revision")) |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2787 |
|
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2788 |
if not rev: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2789 |
rev = node |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2790 |
|
3814
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
2791 |
if date: |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2792 |
if rev: |
3814
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
2793 |
raise util.Abort(_("you can't specify a revision and a date")) |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2794 |
rev = cmdutil.finddate(ui, repo, date) |
3814
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
2795 |
|
3521
ba94e80e5540
Remove update -m, deprecated for 0.9.1
Matt Mackall <mpm@selenic.com>
parents:
3520
diff
changeset
|
2796 |
if clean: |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2797 |
return hg.clean(repo, rev) |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
2798 |
else: |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2799 |
return hg.update(repo, rev) |
254 | 2800 |
|
247 | 2801 |
def verify(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2802 |
"""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
|
2803 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2804 |
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
|
2805 |
|
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2806 |
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
|
2807 |
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
|
2808 |
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
|
2809 |
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
|
2810 |
""" |
2778 | 2811 |
return hg.verify(repo) |
247 | 2812 |
|
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2813 |
def version_(ui): |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2814 |
"""output version and copyright information""" |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2815 |
ui.write(_("Mercurial Distributed SCM (version %s)\n") |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2816 |
% version.get_version()) |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2817 |
ui.status(_( |
5994
a445388aa554
update copyright notice in version output
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
5970
diff
changeset
|
2818 |
"\nCopyright (C) 2005-2008 Matt Mackall <mpm@selenic.com> and others\n" |
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2819 |
"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
|
2820 |
"There is NO\nwarranty; " |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2821 |
"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
|
2822 |
)) |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
2823 |
|
255 | 2824 |
# Command options and aliases are listed here, alphabetically |
2825 |
||
3187
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2826 |
globalopts = [ |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2827 |
('R', 'repository', '', |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2828 |
_('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
|
2829 |
('', '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
|
2830 |
('y', 'noninteractive', None, |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2831 |
_('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
|
2832 |
('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
|
2833 |
('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
|
2834 |
('', '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
|
2835 |
('', '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
|
2836 |
('', 'debugger', None, _('start debugger')), |
3774
a88e02081a88
Add global options for setting encoding and encodingmode
Matt Mackall <mpm@selenic.com>
parents:
3773
diff
changeset
|
2837 |
('', 'encoding', util._encoding, _('set the charset encoding')), |
a88e02081a88
Add global options for setting encoding and encodingmode
Matt Mackall <mpm@selenic.com>
parents:
3773
diff
changeset
|
2838 |
('', 'encodingmode', util._encodingmode, _('set the charset encoding mode')), |
3187
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2839 |
('', '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
|
2840 |
('', '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
|
2841 |
('', '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
|
2842 |
('', '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
|
2843 |
('', '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
|
2844 |
('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
|
2845 |
] |
fca5ddbaa12a
factor opts: move globalopts to a more logical place
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3181
diff
changeset
|
2846 |
|
3189
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2847 |
dryrunopts = [('n', 'dry-run', None, |
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2848 |
_('do not perform actions, just print output'))] |
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2849 |
|
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2850 |
remoteopts = [ |
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2851 |
('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
|
2852 |
('', '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
|
2853 |
] |
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
2854 |
|
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2855 |
walkopts = [ |
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2856 |
('I', 'include', [], _('include names matching the given patterns')), |
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2857 |
('X', 'exclude', [], _('exclude names matching the given patterns')), |
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2858 |
] |
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2859 |
|
3857
f6f16f871049
Uniformisation of commit help for -m and -l.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
3855
diff
changeset
|
2860 |
commitopts = [ |
f6f16f871049
Uniformisation of commit help for -m and -l.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
3855
diff
changeset
|
2861 |
('m', 'message', '', _('use <text> as commit message')), |
f6f16f871049
Uniformisation of commit help for -m and -l.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
3855
diff
changeset
|
2862 |
('l', 'logfile', '', _('read commit message from <file>')), |
f6f16f871049
Uniformisation of commit help for -m and -l.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
3855
diff
changeset
|
2863 |
] |
f6f16f871049
Uniformisation of commit help for -m and -l.
Mathieu Clabaut <mathieu.clabaut@gmail.com>
parents:
3855
diff
changeset
|
2864 |
|
5147
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
2865 |
commitopts2 = [ |
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
2866 |
('d', 'date', '', _('record datecode as commit date')), |
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
2867 |
('u', 'user', '', _('record user as committer')), |
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
2868 |
] |
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
2869 |
|
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2870 |
templateopts = [ |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2871 |
('', 'style', '', _('display using template map file')), |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2872 |
('', 'template', '', _('display with template')), |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2873 |
] |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2874 |
|
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2875 |
logopts = [ |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2876 |
('p', 'patch', None, _('show patch')), |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2877 |
('l', 'limit', '', _('limit number of changes displayed')), |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2878 |
('M', 'no-merges', None, _('do not show merges')), |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2879 |
] + templateopts |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
2880 |
|
209 | 2881 |
table = { |
3824
2631b506e93d
Fixed indentation, spacing and a typo (debugdata->debugdate) in commands.table.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3815
diff
changeset
|
2882 |
"^add": (add, walkopts + dryrunopts, _('hg add [OPTION]... [FILE]...')), |
2955
9d1c3529ebbc
addremove: do not deprecate.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
2883 |
"addremove": |
841
03cc2ba291d1
Realigned command table again.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
840
diff
changeset
|
2884 |
(addremove, |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2885 |
[('s', 'similarity', '', |
3189
a73a785ea8e1
factor opts: --dry-run option
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3188
diff
changeset
|
2886 |
_('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
|
2887 |
] + walkopts + dryrunopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2888 |
_('hg addremove [OPTION]... [FILE]...')), |
6182
07f2236c4dee
add a blame alias for annotate
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6180
diff
changeset
|
2889 |
"^annotate|blame": |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2890 |
(annotate, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2891 |
[('r', 'rev', '', _('annotate the specified revision')), |
3172
5c93dd0ae413
Refactor annotate copy support.
Brendan Cully <brendan@kublai.com>
parents:
3159
diff
changeset
|
2892 |
('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
|
2893 |
('a', 'text', None, _('treat all files as text')), |
6134
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
2894 |
('u', 'user', None, _('list the author (long with -v)')), |
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
2895 |
('d', 'date', None, _('list the date (short with -q)')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2896 |
('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
|
2897 |
('c', 'changeset', None, _('list the changeset')), |
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
2898 |
('l', 'line-number', None, |
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
2899 |
_('show line number at the first appearance')) |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2900 |
] + walkopts, |
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
2901 |
_('hg annotate [-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] 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
|
2902 |
"archive": |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2903 |
(archive, |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2904 |
[('', '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
|
2905 |
('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
|
2906 |
('r', 'rev', '', _('revision to distribute')), |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2907 |
('t', 'type', '', _('type of distribution to create')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2908 |
] + walkopts, |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
2909 |
_('hg archive [OPTION]... DEST')), |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2910 |
"backout": |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
2911 |
(backout, |
2159
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2912 |
[('', 'merge', None, |
5c34b98ad6b1
Small cleanups to backout command:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2158
diff
changeset
|
2913 |
_('merge with old dirstate parent after backout')), |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
2914 |
('', 'parent', '', _('parent to choose when backing out merge')), |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2915 |
('r', 'rev', '', _('revision to backout')), |
5147
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
2916 |
] + walkopts + commitopts + commitopts2, |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
2917 |
_('hg backout [OPTION]... [-r] REV')), |
5778
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2918 |
"bisect": |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2919 |
(bisect, |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2920 |
[('r', 'reset', False, _('reset bisect state')), |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2921 |
('g', 'good', False, _('mark changeset good')), |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2922 |
('b', 'bad', False, _('mark changeset bad')), |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2923 |
('s', 'skip', False, _('skip testing changeset')), |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2924 |
('U', 'noupdate', False, _('do not update to target'))], |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2925 |
_("hg bisect [-gbsr] [REV]")), |
4730
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2926 |
"branch": |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2927 |
(branch, |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2928 |
[('f', 'force', None, |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2929 |
_('set branch name even if it shadows an existing branch'))], |
5778
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
2930 |
_('hg branch [-f] [NAME]')), |
4730
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2931 |
"branches": |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2932 |
(branches, |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2933 |
[('a', 'active', False, |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2934 |
_('show only branches that have unmerged heads'))], |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
2935 |
_('hg branches [-a]')), |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2936 |
"bundle": |
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
2937 |
(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
|
2938 |
[('f', 'force', None, |
3191
545b6d718593
add remoteopts to bundle command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3190
diff
changeset
|
2939 |
_('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
|
2940 |
('r', 'rev', [], |
6304
d99b4e8652b3
Make clear that for a changegroup '-r' pulls "up to" a revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6299
diff
changeset
|
2941 |
_('a changeset up to which you would like to bundle')), |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
2942 |
('', 'base', [], |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
2943 |
_('a base changeset to specify instead of a destination')), |
6171
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
2944 |
('a', 'all', None, |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
2945 |
_('bundle all changesets in the repository')), |
3191
545b6d718593
add remoteopts to bundle command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3190
diff
changeset
|
2946 |
] + remoteopts, |
6171
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
2947 |
_('hg bundle [-f] [-a] [-r REV]... [--base REV]... FILE [DEST]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2948 |
"cat": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2949 |
(cat, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2950 |
[('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
|
2951 |
('r', 'rev', '', _('print the given revision')), |
6094
3998c1b0828f
cat --decode: Drop short option, use opts.get() instead of opts[]
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6093
diff
changeset
|
2952 |
('', 'decode', None, _('apply any matching decode filter')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
2953 |
] + 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
|
2954 |
_('hg cat [OPTION]... FILE...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2955 |
"^clone": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2956 |
(clone, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2957 |
[('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
|
2958 |
('r', 'rev', [], |
2764
71029a3247cb
clone: replace long help string of inaky with doc comment.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2763
diff
changeset
|
2959 |
_('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
|
2960 |
('', '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
|
2961 |
('', 'uncompressed', None, |
de82749d3a71
clone: change name of --stream to --uncompressed.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2618
diff
changeset
|
2962 |
_('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
|
2963 |
] + 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
|
2964 |
_('hg clone [OPTION]... SOURCE [DEST]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2965 |
"^commit|ci": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
2966 |
(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
|
2967 |
[('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
|
2968 |
_('mark new/missing files as added/removed before committing')), |
5147
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
2969 |
] + walkopts + commitopts + commitopts2, |
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
|
2970 |
_('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
|
2971 |
"copy|cp": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2972 |
(copy, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
2973 |
[('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
|
2974 |
('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
|
2975 |
_('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
|
2976 |
] + walkopts + dryrunopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
2977 |
_('hg copy [OPTION]... [SOURCE]... DEST')), |
6178
81afdd016867
debugancestor: make the index argument optional, defaulting to 00changelog.i
Bryan O'Sullivan <bos@serpentine.com>
parents:
6171
diff
changeset
|
2978 |
"debugancestor": (debugancestor, [], |
81afdd016867
debugancestor: make the index argument optional, defaulting to 00changelog.i
Bryan O'Sullivan <bos@serpentine.com>
parents:
6171
diff
changeset
|
2979 |
_('hg debugancestor [INDEX] REV1 REV2')), |
5781
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2980 |
"debugcheckstate": (debugcheckstate, [], _('hg debugcheckstate')), |
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
|
2981 |
"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
|
2982 |
(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
|
2983 |
[('o', 'options', None, _('show the command options'))], |
5781
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2984 |
_('hg debugcomplete [-o] CMD')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2985 |
"debugdate": |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2986 |
(debugdate, |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2987 |
[('e', 'extended', None, _('try extended date formats'))], |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2988 |
_('hg debugdate [-e] DATE [RANGE]')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2989 |
"debugdata": (debugdata, [], _('hg debugdata FILE REV')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2990 |
"debugfsinfo": (debugfsinfo, [], _('hg debugfsinfo [PATH]')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2991 |
"debugindex": (debugindex, [], _('hg debugindex FILE')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2992 |
"debugindexdot": (debugindexdot, [], _('hg debugindexdot FILE')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2993 |
"debuginstall": (debuginstall, [], _('hg debuginstall')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2994 |
"debugrawcommit|rawcommit": |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2995 |
(rawcommit, |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2996 |
[('p', 'parent', [], _('parent')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2997 |
('F', 'files', '', _('file list')) |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2998 |
] + commitopts + commitopts2, |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
2999 |
_('hg debugrawcommit [OPTION]... [FILE]...')), |
1755
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
3000 |
"debugrebuildstate": |
a8f7791e3680
add 'debugrebuildstate' to rebuild the dirstate from a given revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1754
diff
changeset
|
3001 |
(debugrebuildstate, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3002 |
[('r', 'rev', '', _('revision to rebuild to'))], |
5781
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3003 |
_('hg debugrebuildstate [-r REV] [REV]')), |
4730
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
3004 |
"debugrename": |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
3005 |
(debugrename, |
eadfaa9ec487
Updated command tables in commands.py and hgext extensions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4726
diff
changeset
|
3006 |
[('r', 'rev', '', _('revision to debug'))], |
5781
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3007 |
_('hg debugrename [-r REV] FILE')), |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3008 |
"debugsetparents": |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3009 |
(debugsetparents, |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3010 |
[], |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3011 |
_('hg debugsetparents REV1 [REV2]')), |
6296
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
3012 |
"debugstate": |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
3013 |
(debugstate, |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
3014 |
[('', 'nodates', None, _('do not display the saved mtime'))], |
a9e6b8875805
debugstate: add --nodates
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
6276
diff
changeset
|
3015 |
_('hg debugstate [OPTS]')), |
5781
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3016 |
"debugwalk": (debugwalk, walkopts, _('hg debugwalk [OPTION]... [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3017 |
"^diff": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3018 |
(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
|
3019 |
[('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
|
3020 |
('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
|
3021 |
('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
|
3022 |
_('show which function each change is in')), |
2907 | 3023 |
('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
|
3024 |
('', '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
|
3025 |
('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
|
3026 |
_('ignore white space when comparing lines')), |
2580
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
3027 |
('b', 'ignore-space-change', None, |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
3028 |
_('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
|
3029 |
('B', 'ignore-blank-lines', None, |
a20a1bb0c396
diff: add -b/-B options
Haakon Riiser <haakon.riiser@fys.uio.no>
parents:
2579
diff
changeset
|
3030 |
_('ignore changes whose lines are all blank')), |
6040
1d0bfa4c75c0
commands.py, patch.py: add -U option to hg diff command
jorendorff@mozilla.com
parents:
4967
diff
changeset
|
3031 |
('U', 'unified', 3, |
1d0bfa4c75c0
commands.py, patch.py: add -U option to hg diff command
jorendorff@mozilla.com
parents:
4967
diff
changeset
|
3032 |
_('number of lines of context to show')) |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
3033 |
] + walkopts, |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3034 |
_('hg diff [OPTION]... [-r REV1 [-r REV2]] [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3035 |
"^export": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3036 |
(export, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3037 |
[('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
|
3038 |
('a', 'text', None, _('treat all files as text')), |
3029 | 3039 |
('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
|
3040 |
('', '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
|
3041 |
('', 'switch-parent', None, _('diff against the second parent'))], |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3042 |
_('hg export [OPTION]... [-o OUTFILESPEC] REV...')), |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3043 |
"grep": |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3044 |
(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
|
3045 |
[('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
|
3046 |
('', 'all', None, _('print all revisions that match')), |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
3047 |
('f', 'follow', None, |
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
3048 |
_('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
|
3049 |
('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
|
3050 |
('l', 'files-with-matches', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3051 |
_('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
|
3052 |
('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
|
3053 |
('r', 'rev', [], _('search in given revision range')), |
6134
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
3054 |
('u', 'user', None, _('list the author (long with -v)')), |
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
3055 |
('d', 'date', None, _('list the date (short with -q)')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
3056 |
] + walkopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3057 |
_('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
|
3058 |
"heads": |
65763ff9fa53
Update online help of hg heads for new --branches option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
904
diff
changeset
|
3059 |
(heads, |
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3060 |
[('r', 'rev', '', _('show only heads which are descendants of rev')), |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3061 |
] + templateopts, |
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
3062 |
_('hg heads [-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
|
3063 |
"help": (help_, [], _('hg help [COMMAND]')), |
4665
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
3064 |
"identify|id": |
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
3065 |
(identify, |
4666
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
3066 |
[('r', 'rev', '', _('identify the specified rev')), |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
3067 |
('n', 'num', None, _('show local revision number')), |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
3068 |
('i', 'id', None, _('show global revision id')), |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
3069 |
('b', 'branch', None, _('show branch')), |
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
3070 |
('t', 'tags', None, _('show tags'))], |
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
3071 |
_('hg identify [-nibt] [-r REV] [SOURCE]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3072 |
"import|patch": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3073 |
(import_, |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3074 |
[('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
|
3075 |
_('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
|
3076 |
'meaning as the corresponding patch option')), |
3876
1e0b94cfba0e
Remove deprecated old-style branch support
Matt Mackall <mpm@selenic.com>
parents:
3862
diff
changeset
|
3077 |
('b', 'base', '', _('base path')), |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3078 |
('f', 'force', None, |
4263 | 3079 |
_('skip check for outstanding uncommitted changes')), |
5936
00dfc810dae4
Add --no-commit option to import command
Joel Rosdahl <joel@rosdahl.net>
parents:
5858
diff
changeset
|
3080 |
('', 'no-commit', None, _("don't commit, just update the working directory")), |
4263 | 3081 |
('', 'exact', None, |
4592
5243cece3d97
Add --import-branch option to hg import to pull in branch information without --exact
Eric Hopper <hopper@omnifarious.org>
parents:
4587
diff
changeset
|
3082 |
_('apply patch to the nodes from which it was generated')), |
5243cece3d97
Add --import-branch option to hg import to pull in branch information without --exact
Eric Hopper <hopper@omnifarious.org>
parents:
4587
diff
changeset
|
3083 |
('', 'import-branch', None, |
5953
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5936
diff
changeset
|
3084 |
_('Use any branch information in patch (implied by --exact)'))] + |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5936
diff
changeset
|
3085 |
commitopts + commitopts2, |
e7f1be4bf40a
Permitting the import command to accept a --user option.
Jesse Glick <jesse.glick@sun.com>
parents:
5936
diff
changeset
|
3086 |
_('hg import [OPTION]... PATCH...')), |
5778
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
3087 |
"incoming|in": |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
3088 |
(incoming, |
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3089 |
[('f', 'force', None, |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3090 |
_('run even when remote repository is unrelated')), |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
3091 |
('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
|
3092 |
('', 'bundle', '', _('file to store the bundles into')), |
6304
d99b4e8652b3
Make clear that for a changegroup '-r' pulls "up to" a revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6299
diff
changeset
|
3093 |
('r', 'rev', [], |
d99b4e8652b3
Make clear that for a changegroup '-r' pulls "up to" a revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6299
diff
changeset
|
3094 |
_('a specific revision up to which you would like to pull')), |
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3095 |
] + logopts + remoteopts, |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3096 |
_('hg incoming [-p] [-n] [-M] [-f] [-r REV]...' |
2544
0ab63318bc36
Added missing space in continued string.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2521
diff
changeset
|
3097 |
' [--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
|
3098 |
"^init": |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3099 |
(init, |
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3100 |
remoteopts, |
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3101 |
_('hg init [-e CMD] [--remotecmd CMD] [DEST]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3102 |
"locate": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3103 |
(locate, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3104 |
[('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
|
3105 |
('0', 'print0', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3106 |
_('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
|
3107 |
('f', 'fullpath', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3108 |
_('print complete paths from the filesystem root')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
3109 |
] + 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
|
3110 |
_('hg locate [OPTION]... [PATTERN]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3111 |
"^log|history": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3112 |
(log, |
3876
1e0b94cfba0e
Remove deprecated old-style branch support
Matt Mackall <mpm@selenic.com>
parents:
3862
diff
changeset
|
3113 |
[('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
|
3114 |
_('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
|
3115 |
('', '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
|
3116 |
_('only follow the first parent of merge changesets')), |
3813 | 3117 |
('d', 'date', '', _('show revs matching date spec')), |
3197 | 3118 |
('C', 'copies', None, _('show copied files')), |
4324
cd650cd61b06
help: log --keyword is case-insensitive
TK Soh <teekaysoh@yahoo.com>
parents:
4322
diff
changeset
|
3119 |
('k', 'keyword', [], _('do case-insensitive search for a keyword')), |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3120 |
('r', 'rev', [], _('show the specified revision or range')), |
3657 | 3121 |
('', '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
|
3122 |
('m', 'only-merges', None, _('show only merges')), |
6067
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
3123 |
('b', 'only-branch', [], |
57c1a7052982
Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents:
6048
diff
changeset
|
3124 |
_('show only changesets within the given named branch')), |
2901 | 3125 |
('P', 'prune', [], _('do not display revision or any of its ancestors')), |
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3126 |
] + logopts + walkopts, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3127 |
_('hg log [OPTION]... [FILE]')), |
5778
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
3128 |
"manifest": |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
3129 |
(manifest, |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
3130 |
[('r', 'rev', '', _('revision to display'))], |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
3131 |
_('hg manifest [-r REV]')), |
4014
509342f95564
various doc fixes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4013
diff
changeset
|
3132 |
"^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
|
3133 |
(merge, |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
3134 |
[('f', 'force', None, _('force a merge with outstanding changes')), |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
3135 |
('r', 'rev', '', _('revision to merge')), |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
3136 |
], |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
3137 |
_('hg merge [-f] [[-r] REV]')), |
5778
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
3138 |
"outgoing|out": |
9e97a7a0bb82
realign commands table
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5776
diff
changeset
|
3139 |
(outgoing, |
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3140 |
[('f', 'force', None, |
1959
d53a18f592be
add -f/--force to pull, incoming, outgoing, to work on unrelated repo.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1948
diff
changeset
|
3141 |
_('run even when remote repository is unrelated')), |
6304
d99b4e8652b3
Make clear that for a changegroup '-r' pulls "up to" a revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6299
diff
changeset
|
3142 |
('r', 'rev', [], |
d99b4e8652b3
Make clear that for a changegroup '-r' pulls "up to" a revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6299
diff
changeset
|
3143 |
_('a specific revision up to which you would like to push')), |
1907
7718885070b1
let commands that show changesets use templates.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1800
diff
changeset
|
3144 |
('n', 'newest-first', None, _('show newest record first')), |
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3145 |
] + logopts + remoteopts, |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3146 |
_('hg outgoing [-M] [-p] [-n] [-f] [-r REV]... [DEST]')), |
1724
5a36609f73a7
add a -b/--branch option to 'hg parents'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1720
diff
changeset
|
3147 |
"^parents": |
5a36609f73a7
add a -b/--branch option to 'hg parents'
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1720
diff
changeset
|
3148 |
(parents, |
3876
1e0b94cfba0e
Remove deprecated old-style branch support
Matt Mackall <mpm@selenic.com>
parents:
3862
diff
changeset
|
3149 |
[('r', 'rev', '', _('show parents from the specified rev')), |
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3150 |
] + templateopts, |
3504
f4ab58d4ccd4
Remove [-b] options from help syntax lines
Matt Mackall <mpm@selenic.com>
parents:
3503
diff
changeset
|
3151 |
_('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
|
3152 |
"paths": (paths, [], _('hg paths [NAME]')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3153 |
"^pull": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3154 |
(pull, |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3155 |
[('u', 'update', None, |
3198
a32f65549b9e
Documentation clarification for --update option to pull and unbundle
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3197
diff
changeset
|
3156 |
_('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
|
3157 |
('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
|
3158 |
_('run even when remote repository is unrelated')), |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3159 |
('r', 'rev', [], |
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3160 |
_('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
|
3161 |
] + remoteopts, |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3162 |
_('hg pull [-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')), |
818 | 3163 |
"^push": |
3164 |
(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
|
3165 |
[('f', 'force', None, _('force push')), |
6304
d99b4e8652b3
Make clear that for a changegroup '-r' pulls "up to" a revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6299
diff
changeset
|
3166 |
('r', 'rev', [], |
d99b4e8652b3
Make clear that for a changegroup '-r' pulls "up to" a revision
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
6299
diff
changeset
|
3167 |
_('a specific revision up to which you would like to push')), |
3190
37b53487c341
factor opts: remote repo access options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3189
diff
changeset
|
3168 |
] + remoteopts, |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3169 |
_('hg push [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3170 |
"recover": (recover, [], _('hg recover')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3171 |
"^remove|rm": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3172 |
(remove, |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
3173 |
[('A', 'after', None, _('record delete for missing files')), |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
3174 |
('f', 'force', None, |
6347 | 3175 |
_('remove (and delete) file even if added or modified')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
3176 |
] + walkopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3177 |
_('hg remove [OPTION]... FILE...')), |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3178 |
"rename|mv": |
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3179 |
(rename, |
1816
08f4398bdb1a
Updated help synopsises and reordered some options. Dropped [-n] from revert.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1812
diff
changeset
|
3180 |
[('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
|
3181 |
('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
|
3182 |
_('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
|
3183 |
] + walkopts + dryrunopts, |
1869
42c76ec7a8d4
Reordered options for remove, fixed synopsis for rename.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1867
diff
changeset
|
3184 |
_('hg rename [OPTION]... SOURCE... DEST')), |
5574 | 3185 |
"revert": |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3186 |
(revert, |
2983
3b7626b861f8
revert: add -a as alias for --all
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2982
diff
changeset
|
3187 |
[('a', 'all', None, _('revert all changes when no arguments given')), |
3814
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
3188 |
('d', 'date', '', _('tipmost revision matching date')), |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
3189 |
('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
|
3190 |
('', '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
|
3191 |
] + walkopts + dryrunopts, |
3885
6081b4c68baf
Corrected synopsis for many commands.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3862
diff
changeset
|
3192 |
_('hg revert [OPTION]... [-r REV] [NAME]...')), |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
3193 |
"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
|
3194 |
"root": (root, [], _('hg root')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3195 |
"^serve": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3196 |
(serve, |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3197 |
[('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
|
3198 |
('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
|
3199 |
('', '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
|
3200 |
('E', 'errorlog', '', _('name of error log file to write to')), |
6262
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
3201 |
('p', 'port', 0, _('port to listen on (default: 8000)')), |
de7256c82fad
hgweb: clarify which address and port can/cannot be bound at startup (bug 769)
Stephen Deasey <sdeasey@gmail.com>
parents:
6253
diff
changeset
|
3202 |
('a', 'address', '', _('address to listen on (default: all interfaces)')), |
5835
bd34f0ac3cb0
adding "prefix" option to "hg serve" (command line and [web] section)
Michele Cella <michele.cella@gmail.com>
parents:
5811
diff
changeset
|
3203 |
('', 'prefix', '', _('prefix path to serve from (default: server root)')), |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3204 |
('n', 'name', '', |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3205 |
_('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
|
3206 |
('', '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
|
3207 |
' (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
|
3208 |
('', '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
|
3209 |
('', '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
|
3210 |
('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
|
3211 |
('', 'style', '', _('template style to use')), |
4860
f3802f9f1840
Add SSL support to hg serve, activated via --certificate option
Brendan Cully <brendan@kublai.com>
parents:
4857
diff
changeset
|
3212 |
('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), |
f3802f9f1840
Add SSL support to hg serve, activated via --certificate option
Brendan Cully <brendan@kublai.com>
parents:
4857
diff
changeset
|
3213 |
('', 'certificate', '', _('SSL certificate file'))], |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3214 |
_('hg serve [OPTION]...')), |
5781
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3215 |
"showconfig|debugconfig": |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3216 |
(showconfig, |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3217 |
[('u', 'untrusted', None, _('show untrusted configuration options'))], |
45d034c79ece
Sort commands table again and add some missing 'hg' in synopsises.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5778
diff
changeset
|
3218 |
_('hg showconfig [-u] [NAME]...')), |
1507
cd8fadd8c689
Add explicit 'st' alias for status
Matt Mackall <mpm@selenic.com>
parents:
1506
diff
changeset
|
3219 |
"^status|st": |
840
141744605b51
hg status: added options to select files by status.
tksoh@users.sourceforge.net
parents:
839
diff
changeset
|
3220 |
(status, |
2661
5c10b7ed3411
status: add -c (clean) and -A (all files) options
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2639
diff
changeset
|
3221 |
[('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
|
3222 |
('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
|
3223 |
('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
|
3224 |
('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
|
3225 |
('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
|
3226 |
('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
|
3227 |
('u', 'unknown', None, _('show only unknown (not tracked) files')), |
4156
30857b5779f8
Fix help text for hg status -i
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4143
diff
changeset
|
3228 |
('i', 'ignored', None, _('show only 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
|
3229 |
('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
|
3230 |
('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
|
3231 |
('0', 'print0', None, |
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
3232 |
_('end filenames with NUL, for use with xargs')), |
3467
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
3233 |
('', 'rev', [], _('show difference from revision')), |
3188
725e3d3145d8
factor opts: walk options
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3187
diff
changeset
|
3234 |
] + walkopts, |
1615
83238c1db6de
Cleanup of indentation, spacing, newlines, strings and line length
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1607
diff
changeset
|
3235 |
_('hg status [OPTION]... [FILE]...')), |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3236 |
"tag": |
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3237 |
(tag, |
4267
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4247
diff
changeset
|
3238 |
[('f', 'force', None, _('replace existing tag')), |
8185a1ca8628
tags: require -f to replace an existing tag
Matt Mackall <mpm@selenic.com>
parents:
4247
diff
changeset
|
3239 |
('l', 'local', None, _('make the tag local')), |
4213 | 3240 |
('r', 'rev', '', _('revision to tag')), |
5147
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
3241 |
('', 'remove', None, _('remove a tag')), |
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
3242 |
# -l/--local is already there, commitopts cannot be used |
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
3243 |
('m', 'message', '', _('use <text> as commit message')), |
c80af96943aa
refactor options from cmdtable
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5125
diff
changeset
|
3244 |
] + commitopts2, |
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
3245 |
_('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
|
3246 |
"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
|
3247 |
"tip": |
8eaa8e06a364
Add option -b/--branch to hg tip (as done for hg parents).
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1761
diff
changeset
|
3248 |
(tip, |
6192
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3249 |
[('p', 'patch', None, _('show patch')), |
cd65a67aff31
Introduce templateopts and logopts to reduce duplicate option definitions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6191
diff
changeset
|
3250 |
] + templateopts, |
3504
f4ab58d4ccd4
Remove [-b] options from help syntax lines
Matt Mackall <mpm@selenic.com>
parents:
3503
diff
changeset
|
3251 |
_('hg tip [-p]')), |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
3252 |
"unbundle": |
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
3253 |
(unbundle, |
1601
a1b25fb2e764
Error handling for unbundle, fix option line wrapping
Matt Mackall <mpm@selenic.com>
parents:
1600
diff
changeset
|
3254 |
[('u', 'update', None, |
3198
a32f65549b9e
Documentation clarification for --update option to pull and unbundle
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3197
diff
changeset
|
3255 |
_('update to new tip if changesets were unbundled'))], |
4699
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
3256 |
_('hg unbundle [-u] FILE...')), |
593 | 3257 |
"^update|up|checkout|co": |
697
cb1be2327220
Multiple cleanups of things detected by pylint.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
696
diff
changeset
|
3258 |
(update, |
3876
1e0b94cfba0e
Remove deprecated old-style branch support
Matt Mackall <mpm@selenic.com>
parents:
3862
diff
changeset
|
3259 |
[('C', 'clean', None, _('overwrite locally modified files')), |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
3260 |
('d', 'date', '', _('tipmost revision matching date')), |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
3261 |
('r', 'rev', '', _('revision'))], |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
3262 |
_('hg update [-C] [-d DATE] [[-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
|
3263 |
"verify": (verify, [], _('hg verify')), |
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
3264 |
"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
|
3265 |
} |
209 | 3266 |
|
6189
81cbb5dfdec0
Make hg debugancestor accept -R by making it an optionalrepo command.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6188
diff
changeset
|
3267 |
norepo = ("clone init version help debugcomplete debugdata" |
5741
8ee0de123989
add debugfsinfo to check fs capabilities
Matt Mackall <mpm@selenic.com>
parents:
5716
diff
changeset
|
3268 |
" debugindex debugindexdot debugdate debuginstall debugfsinfo") |
6189
81cbb5dfdec0
Make hg debugancestor accept -R by making it an optionalrepo command.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6188
diff
changeset
|
3269 |
optionalrepo = ("identify paths serve showconfig debugancestor") |