Mercurial > hg-stable
annotate mercurial/commands.py @ 22480:dff638170c48
annotate: port to generic templater enabled by hidden -T option
If the selected formatter is other than plainformatter, raw data are passed
to the formatter. In this case, it isn't necessary (and not possible) to
calculate column widths.
Field names are substituted to be the same as "log" command.
There are a few limitations:
- "binary file" message is not included in formatted output.
- no data structure for multiple files. all lines are packed to single list.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 17 Sep 2014 23:21:20 +0900 |
parents | 5d9e46d93c1d |
children | bde49bbfb30f |
rev | line source |
---|---|
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 # |
8225
46293a0c7e9f
updated license to be explicit about GPL version 2
Martin Geisler <mg@lazybytes.net>
parents:
8210
diff
changeset
|
5 # This software may be used and distributed according to the terms of the |
10263 | 6 # GNU General Public License version 2 or any later version. |
249 | 7 |
13723
e615765fdcc7
wireproto: add known([id]) function
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13720
diff
changeset
|
8 from node import hex, bin, nullid, nullrev, short |
8109
496ae1ea4698
switch lock releasing in the core from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
8088
diff
changeset
|
9 from lock import release |
18746
c0087d48ec3a
help: move the majority of the help command to the help module
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
18711
diff
changeset
|
10 from i18n import _ |
21957
2122b82b6987
debuginstall: handle quoted path for editor (issue4316)
Alexandre Garnier <zigarn@gmail.com>
parents:
21952
diff
changeset
|
11 import os, re, difflib, time, tempfile, errno, shlex |
20740
535283a7f5dd
debuginstall: add Python information to debuginstall output (issue4128)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20702
diff
changeset
|
12 import sys |
18746
c0087d48ec3a
help: move the majority of the help command to the help module
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
18711
diff
changeset
|
13 import hg, scmutil, util, revlog, copies, error, bookmarks |
17887
0e2846b2482c
url: use open and not url.open for local files (issue3624)
Siddharth Agarwal <sid0@fb.com>
parents:
17875
diff
changeset
|
14 import patch, help, encoding, templatekw, discovery |
14647
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
15 import archival, changegroup, cmdutil, hbisect |
19757
ff00839e8bb3
commands: import hgweb.server in a way that 2to3 can rewrite
Augie Fackler <raf@durin42.com>
parents:
19616
diff
changeset
|
16 import sshserver, hgweb, commandserver |
21848
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
17 import extensions |
19757
ff00839e8bb3
commands: import hgweb.server in a way that 2to3 can rewrite
Augie Fackler <raf@durin42.com>
parents:
19616
diff
changeset
|
18 from hgweb import server as hgweb_server |
15856
6bed6cc6d0d0
commands: partial backout of fbb68b382040
Martin Geisler <mg@aragost.com>
parents:
15855
diff
changeset
|
19 import merge as mergemod |
14511
30506b894359
filesets: introduce basic fileset expression parser
Matt Mackall <mpm@selenic.com>
parents:
14509
diff
changeset
|
20 import minirst, revset, fileset |
17182
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
21 import dagparser, context, simplemerge, graphmod |
20034
1e5b38a919dd
cleanup: move stdlib imports to their own import statement
Augie Fackler <raf@durin42.com>
parents:
20026
diff
changeset
|
22 import random |
1e5b38a919dd
cleanup: move stdlib imports to their own import statement
Augie Fackler <raf@durin42.com>
parents:
20026
diff
changeset
|
23 import setdiscovery, treediscovery, dagutil, pvec, localrepo |
21063
7ca4f2049d3b
bundle2: move `readbundle` into the `exchange` module
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21051
diff
changeset
|
24 import phases, obsolete, exchange |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
25 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
26 table = {} |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
27 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
28 command = cmdutil.command(table) |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
29 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
30 # Space delimited list of commands that don't require local repositories. |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
31 # This should be populated by passing norepo=True into the @command decorator. |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
32 norepo = '' |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
33 # Space delimited list of commands that optionally require local repositories. |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
34 # This should be populated by passing optionalrepo=True into the @command |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
35 # decorator. |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
36 optionalrepo = '' |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
37 # Space delimited list of commands that will examine arguments looking for |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
38 # a repository. This should be populated by passing inferrepo=True into the |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
39 # @command decorator. |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
40 inferrepo = '' |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
41 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
42 # common command options |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
43 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
44 globalopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
45 ('R', 'repository', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
46 _('repository root directory or name of overlay bundle file'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
47 _('REPO')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
48 ('', 'cwd', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
49 _('change working directory'), _('DIR')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
50 ('y', 'noninteractive', None, |
14849
d87814992728
commands: improve help for -y/--noninteractive
Martin Geisler <mg@aragost.com>
parents:
14755
diff
changeset
|
51 _('do not prompt, automatically pick the first choice for all prompts')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
52 ('q', 'quiet', None, _('suppress output')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
53 ('v', 'verbose', None, _('enable additional output')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
54 ('', 'config', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
55 _('set/override config option (use \'section.name=value\')'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
56 _('CONFIG')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
57 ('', 'debug', None, _('enable debugging output')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
58 ('', 'debugger', None, _('start debugger')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
59 ('', 'encoding', encoding.encoding, _('set the charset encoding'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
60 _('ENCODE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
61 ('', 'encodingmode', encoding.encodingmode, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
62 _('set the charset encoding mode'), _('MODE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
63 ('', 'traceback', None, _('always print a traceback on exception')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
64 ('', 'time', None, _('time how long the command takes')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
65 ('', 'profile', None, _('print command execution profile')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
66 ('', 'version', None, _('output version information and exit')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
67 ('h', 'help', None, _('display help and exit')), |
18267
5bb610f87d1d
clfilter: enforce hidden changeset globally
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18255
diff
changeset
|
68 ('', 'hidden', False, _('consider hidden changesets')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
69 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
70 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
71 dryrunopts = [('n', 'dry-run', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
72 _('do not perform actions, just print output'))] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
73 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
74 remoteopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
75 ('e', 'ssh', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
76 _('specify ssh command to use'), _('CMD')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
77 ('', 'remotecmd', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
78 _('specify hg command to run on the remote side'), _('CMD')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
79 ('', 'insecure', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
80 _('do not verify server certificate (ignoring web.cacerts config)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
81 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
82 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
83 walkopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
84 ('I', 'include', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
85 _('include names matching the given patterns'), _('PATTERN')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
86 ('X', 'exclude', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
87 _('exclude names matching the given patterns'), _('PATTERN')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
88 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
89 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
90 commitopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
91 ('m', 'message', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
92 _('use text as commit message'), _('TEXT')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
93 ('l', 'logfile', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
94 _('read commit message from file'), _('FILE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
95 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
96 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
97 commitopts2 = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
98 ('d', 'date', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
99 _('record the specified date as commit date'), _('DATE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
100 ('u', 'user', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
101 _('record the specified user as committer'), _('USER')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
102 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
103 |
22429
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
104 # hidden for now |
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
105 formatteropts = [ |
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
106 ('T', 'template', '', |
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
107 _('display with template (DEPRECATED)'), _('TEMPLATE')), |
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
108 ] |
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
109 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
110 templateopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
111 ('', 'style', '', |
20669
870d60294b04
templater: deprecate --style now that -T exists
Matt Mackall <mpm@selenic.com>
parents:
20665
diff
changeset
|
112 _('display using template map file (DEPRECATED)'), _('STYLE')), |
20665
945bc5497e6d
commands: add -T alternative to --template
Matt Mackall <mpm@selenic.com>
parents:
20664
diff
changeset
|
113 ('T', 'template', '', |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
114 _('display with template'), _('TEMPLATE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
115 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
116 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
117 logopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
118 ('p', 'patch', None, _('show patch')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
119 ('g', 'git', None, _('use git extended diff format')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
120 ('l', 'limit', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
121 _('limit number of changes displayed'), _('NUM')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
122 ('M', 'no-merges', None, _('do not show merges')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
123 ('', 'stat', None, _('output diffstat-style summary of changes')), |
17182
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
124 ('G', 'graph', None, _("show the revision DAG")), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
125 ] + templateopts |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
126 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
127 diffopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
128 ('a', 'text', None, _('treat all files as text')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
129 ('g', 'git', None, _('use git extended diff format')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
130 ('', 'nodates', None, _('omit dates from diff headers')) |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
131 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
132 |
15528
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
133 diffwsopts = [ |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
134 ('w', 'ignore-all-space', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
135 _('ignore white space when comparing lines')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
136 ('b', 'ignore-space-change', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
137 _('ignore changes in the amount of white space')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
138 ('B', 'ignore-blank-lines', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
139 _('ignore changes whose lines are all blank')), |
15528
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
140 ] |
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
141 |
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
142 diffopts2 = [ |
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
143 ('p', 'show-function', None, _('show which function each change is in')), |
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
144 ('', 'reverse', None, _('produce a diff that undoes the changes')), |
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
145 ] + diffwsopts + [ |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
146 ('U', 'unified', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
147 _('number of lines of context to show'), _('NUM')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
148 ('', 'stat', None, _('output diffstat-style summary of changes')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
149 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
150 |
14852
cac04f2f475b
commands: use mergetoolopts when a command supports --tool
Martin Geisler <mg@aragost.com>
parents:
14840
diff
changeset
|
151 mergetoolopts = [ |
cac04f2f475b
commands: use mergetoolopts when a command supports --tool
Martin Geisler <mg@aragost.com>
parents:
14840
diff
changeset
|
152 ('t', 'tool', '', _('specify merge tool')), |
cac04f2f475b
commands: use mergetoolopts when a command supports --tool
Martin Geisler <mg@aragost.com>
parents:
14840
diff
changeset
|
153 ] |
cac04f2f475b
commands: use mergetoolopts when a command supports --tool
Martin Geisler <mg@aragost.com>
parents:
14840
diff
changeset
|
154 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
155 similarityopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
156 ('s', 'similarity', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
157 _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY')) |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
158 ] |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
159 |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
160 subrepoopts = [ |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
161 ('S', 'subrepos', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
162 _('recurse into subrepositories')) |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
163 ] |
2731
ad4155e757da
Kill ui.setconfig_remoteopts
Matt Mackall <mpm@selenic.com>
parents:
2718
diff
changeset
|
164 |
255 | 165 # Commands start here, listed alphabetically |
209 | 166 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
167 @command('^add', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
168 walkopts + subrepoopts + dryrunopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
169 _('[OPTION]... [FILE]...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
170 inferrepo=True) |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
171 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
|
172 """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
|
173 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
174 Schedule files to be version controlled and added to the |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
175 repository. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
176 |
3829
531c116b2028
Add doc notes about revert and hg status vs diff
Matt Mackall <mpm@selenic.com>
parents:
3822
diff
changeset
|
177 The files will be added to the repository at the next commit. To |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
178 undo an add before that, see :hg:`forget`. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
179 |
7807
bd8f44638847
help: miscellaneous language fixes
timeless <timeless@gmail.com>
parents:
7765
diff
changeset
|
180 If no names are given, add all files to the repository. |
10446
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
181 |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
182 .. container:: verbose |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
183 |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
184 An example showing how new (unknown) files are added |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
185 automatically by :hg:`add`:: |
10446
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
186 |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
187 $ ls |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
188 foo.c |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
189 $ hg status |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
190 ? foo.c |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
191 $ hg add |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
192 adding foo.c |
a565a2445eb5
commands: add verbose example to help text for add
Martin Geisler <mg@lazybytes.net>
parents:
10445
diff
changeset
|
193 $ hg status |
10448
6e5a47398fc5
commands: correct example in add help text
Martin Geisler <mg@lazybytes.net>
parents:
10446
diff
changeset
|
194 A foo.c |
11507
35e2d453cf0d
commands: document return values of add and paths commands
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11488
diff
changeset
|
195 |
35e2d453cf0d
commands: document return values of add and paths commands
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11488
diff
changeset
|
196 Returns 0 if all files are successfully added. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
197 """ |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
198 |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
199 m = scmutil.match(repo[None], pats, opts) |
12270
166b9866580a
add: recurse into subrepositories with --subrepos/-S flag
Martin Geisler <mg@lazybytes.net>
parents:
12269
diff
changeset
|
200 rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'), |
15911
c654eac03452
add: fix subrepo recursion for explicit path handling
David M. Carr <david@carrclan.us>
parents:
15906
diff
changeset
|
201 opts.get('subrepos'), prefix="", explicitonly=False) |
12269
877236cdd437
add: move main part to cmdutil to make it easier to reuse
Martin Geisler <mg@lazybytes.net>
parents:
12266
diff
changeset
|
202 return rejected and 1 or 0 |
213 | 203 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
204 @command('addremove', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
205 similarityopts + walkopts + dryrunopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
206 _('[OPTION]... [FILE]...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
207 inferrepo=True) |
766
b444a7e053f1
Get addremove to use new walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
764
diff
changeset
|
208 def addremove(ui, repo, *pats, **opts): |
3181
3637d5d17cbc
Documentation fixes for addremove.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3172
diff
changeset
|
209 """add all new files, delete all missing files |
2181
690da72b0b16
deprecate addremove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2179
diff
changeset
|
210 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
211 Add all new files and remove all missing files from the |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
212 repository. |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
213 |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
214 New files are ignored if they match any of the patterns in |
13344
6367459decf7
doc: Add back quotes around filenames
Javi Merino <cibervicho@gmail.com>
parents:
13343
diff
changeset
|
215 ``.hgignore``. As with add, these changes take effect at the next |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
216 commit. |
2958
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
217 |
17266
4e35dea77e31
addremove: mention --similarity defaults to 100 (issue3430)
Patrick Mezard <patrick@mezard.eu>
parents:
17264
diff
changeset
|
218 Use the -s/--similarity option to detect renamed files. This |
9249
16f4cfc69e4f
commands: wrap docstrings at 70 characters
Martin Geisler <mg@lazybytes.net>
parents:
9219
diff
changeset
|
219 option takes a percentage between 0 (disabled) and 100 (files must |
17266
4e35dea77e31
addremove: mention --similarity defaults to 100 (issue3430)
Patrick Mezard <patrick@mezard.eu>
parents:
17264
diff
changeset
|
220 be identical) as its parameter. With a parameter greater than 0, |
4e35dea77e31
addremove: mention --similarity defaults to 100 (issue3430)
Patrick Mezard <patrick@mezard.eu>
parents:
17264
diff
changeset
|
221 this compares every removed file with every added file and records |
4e35dea77e31
addremove: mention --similarity defaults to 100 (issue3430)
Patrick Mezard <patrick@mezard.eu>
parents:
17264
diff
changeset
|
222 those similar enough as renames. Detecting renamed files this way |
11518
8d827f4a23f1
commands: mention "hg status -C" in addremove help
Arnab Bose <hirak99@gmail.com>
parents:
11515
diff
changeset
|
223 can be expensive. After using this option, :hg:`status -C` can be |
17266
4e35dea77e31
addremove: mention --similarity defaults to 100 (issue3430)
Patrick Mezard <patrick@mezard.eu>
parents:
17264
diff
changeset
|
224 used to check which files were identified as moved or renamed. If |
4e35dea77e31
addremove: mention --similarity defaults to 100 (issue3430)
Patrick Mezard <patrick@mezard.eu>
parents:
17264
diff
changeset
|
225 not specified, -s/--similarity defaults to 100 and only renames of |
4e35dea77e31
addremove: mention --similarity defaults to 100 (issue3430)
Patrick Mezard <patrick@mezard.eu>
parents:
17264
diff
changeset
|
226 identical files are detected. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
227 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
228 Returns 0 if all files are successfully added. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
229 """ |
4966
8d982aef0be1
addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents:
4950
diff
changeset
|
230 try: |
11551
4484a7b661f2
commands: addremove does similarity 100 by default
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
11525
diff
changeset
|
231 sim = float(opts.get('similarity') or 100) |
4966
8d982aef0be1
addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents:
4950
diff
changeset
|
232 except ValueError: |
8d982aef0be1
addremove: print meaningful error message if --similar not numeric
Bryan O'Sullivan <bos@serpentine.com>
parents:
4950
diff
changeset
|
233 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
|
234 if sim < 0 or sim > 100: |
ff3ea21a981a
addremove: add -s/--similarity option
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2956
diff
changeset
|
235 raise util.Abort(_('similarity must be between 0 and 100')) |
14321
003d63bb4fa5
scmutil: drop some aliases in cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14319
diff
changeset
|
236 return scmutil.addremove(repo, pats, opts, similarity=sim / 100.0) |
219
8ff4532376a4
hg checkout: refuse to checkout if there are outstanding changes
mpm@selenic.com
parents:
214
diff
changeset
|
237 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
238 @command('^annotate|blame', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
239 [('r', 'rev', '', _('annotate the specified revision'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
240 ('', 'follow', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
241 _('follow copies/renames and list the filename (DEPRECATED)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
242 ('', 'no-follow', None, _("don't follow copies and renames")), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
243 ('a', 'text', None, _('treat all files as text')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
244 ('u', 'user', None, _('list the author (long with -v)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
245 ('f', 'file', None, _('list the filename')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
246 ('d', 'date', None, _('list the date (short with -q)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
247 ('n', 'number', None, _('list the revision number (default)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
248 ('c', 'changeset', None, _('list the changeset')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
249 ('l', 'line-number', None, _('show line number at the first appearance')) |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
250 ] + diffwsopts + walkopts + formatteropts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
251 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
252 inferrepo=True) |
733
1966c553f652
Convert annotate over to walk interface.
Bryan O'Sullivan <bos@serpentine.com>
parents:
732
diff
changeset
|
253 def annotate(ui, repo, *pats, **opts): |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
254 """show changeset information by line for each file |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
255 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
256 List changes in files, showing the revision id responsible for |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
257 each line |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
258 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
259 This command is useful for discovering when a change was made and |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
260 by whom. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
261 |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
262 Without the -a/--text option, annotate will avoid processing files |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
263 it detects as binary. With -a, annotate will annotate the file |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
264 anyway, although the results will probably be neither useful |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
265 nor desirable. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
266 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
267 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
268 """ |
22266
711de9dcb1d3
annotate: abort early if no file is specified
Yuya Nishihara <yuya@tcha.org>
parents:
22248
diff
changeset
|
269 if not pats: |
711de9dcb1d3
annotate: abort early if no file is specified
Yuya Nishihara <yuya@tcha.org>
parents:
22248
diff
changeset
|
270 raise util.Abort(_('at least one filename or pattern is required')) |
711de9dcb1d3
annotate: abort early if no file is specified
Yuya Nishihara <yuya@tcha.org>
parents:
22248
diff
changeset
|
271 |
10579
f142fa3c0a8c
Make annotate --follow an alias for -f/--file to behave like in older versions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
10564
diff
changeset
|
272 if opts.get('follow'): |
f142fa3c0a8c
Make annotate --follow an alias for -f/--file to behave like in older versions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
10564
diff
changeset
|
273 # --follow is deprecated and now just an alias for -f/--file |
f142fa3c0a8c
Make annotate --follow an alias for -f/--file to behave like in older versions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
10564
diff
changeset
|
274 # to mimic the behavior of Mercurial before version 1.5 |
14216
e3da95f84bcd
annotate: use real Booleans instead of 0/1
Martin Geisler <mg@aragost.com>
parents:
14198
diff
changeset
|
275 opts['file'] = True |
10579
f142fa3c0a8c
Make annotate --follow an alias for -f/--file to behave like in older versions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
10564
diff
changeset
|
276 |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
277 fm = ui.formatter('annotate', opts) |
6134
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
278 datefunc = ui.quiet and util.shortdate or util.datestr |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
279 if fm or ui.debugflag: |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
280 hexfn = hex |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
281 else: |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
282 hexfn = short |
15631
e5fd140a4e69
annotate: show full changeset hash when invoked with --debug and -c
Ion Savin <comp_@gmx.net>
parents:
15623
diff
changeset
|
283 |
22479
5d9e46d93c1d
annotate: split functions to get data without applying text formatting
Yuya Nishihara <yuya@tcha.org>
parents:
22478
diff
changeset
|
284 opmap = [('user', ' ', lambda x: x[0].user(), ui.shortuser), |
5d9e46d93c1d
annotate: split functions to get data without applying text formatting
Yuya Nishihara <yuya@tcha.org>
parents:
22478
diff
changeset
|
285 ('number', ' ', lambda x: x[0].rev(), str), |
5d9e46d93c1d
annotate: split functions to get data without applying text formatting
Yuya Nishihara <yuya@tcha.org>
parents:
22478
diff
changeset
|
286 ('changeset', ' ', lambda x: hexfn(x[0].node()), str), |
5d9e46d93c1d
annotate: split functions to get data without applying text formatting
Yuya Nishihara <yuya@tcha.org>
parents:
22478
diff
changeset
|
287 ('date', ' ', lambda x: x[0].date(), util.cachefunc(datefunc)), |
5d9e46d93c1d
annotate: split functions to get data without applying text formatting
Yuya Nishihara <yuya@tcha.org>
parents:
22478
diff
changeset
|
288 ('file', ' ', lambda x: x[0].path(), str), |
5d9e46d93c1d
annotate: split functions to get data without applying text formatting
Yuya Nishihara <yuya@tcha.org>
parents:
22478
diff
changeset
|
289 ('line_number', ':', lambda x: x[1], str), |
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
290 ] |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
291 fieldnamemap = {'number': 'rev', 'changeset': 'node'} |
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
292 |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10270
diff
changeset
|
293 if (not opts.get('user') and not opts.get('changeset') |
10369
98a0421b9e52
commands: annotate follows by default, separate -f/--file option
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10365
diff
changeset
|
294 and not opts.get('date') and not opts.get('file')): |
14216
e3da95f84bcd
annotate: use real Booleans instead of 0/1
Martin Geisler <mg@aragost.com>
parents:
14198
diff
changeset
|
295 opts['number'] = True |
209 | 296 |
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
297 linenumber = opts.get('line_number') is not None |
10394
4612cded5176
fix coding style (reported by pylint)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10390
diff
changeset
|
298 if linenumber and (not opts.get('changeset')) and (not opts.get('number')): |
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
299 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
|
300 |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
301 if fm: |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
302 def makefunc(get, fmt): |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
303 return get |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
304 else: |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
305 def makefunc(get, fmt): |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
306 return lambda x: fmt(get(x)) |
22479
5d9e46d93c1d
annotate: split functions to get data without applying text formatting
Yuya Nishihara <yuya@tcha.org>
parents:
22478
diff
changeset
|
307 funcmap = [(makefunc(get, fmt), sep) for op, sep, get, fmt in opmap |
5d9e46d93c1d
annotate: split functions to get data without applying text formatting
Yuya Nishihara <yuya@tcha.org>
parents:
22478
diff
changeset
|
308 if opts.get(op)] |
14358
bf93e78f2638
annotate: fix alignment of columns in front of line numbers (issue2807)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14331
diff
changeset
|
309 funcmap[0] = (funcmap[0][0], '') # no separator in front of first column |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
310 fields = ' '.join(fieldnamemap.get(op, op) for op, sep, get, fmt in opmap |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
311 if opts.get(op)) |
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
312 |
13697
eaee75036725
annotate: catch nonexistent files using match.bad callback (issue1590)
Matt Mackall <mpm@selenic.com>
parents:
13694
diff
changeset
|
313 def bad(x, y): |
eaee75036725
annotate: catch nonexistent files using match.bad callback (issue1590)
Matt Mackall <mpm@selenic.com>
parents:
13694
diff
changeset
|
314 raise util.Abort("%s: %s" % (x, y)) |
eaee75036725
annotate: catch nonexistent files using match.bad callback (issue1590)
Matt Mackall <mpm@selenic.com>
parents:
13694
diff
changeset
|
315 |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
316 ctx = scmutil.revsingle(repo, opts.get('rev')) |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
317 m = scmutil.match(ctx, pats, opts) |
13697
eaee75036725
annotate: catch nonexistent files using match.bad callback (issue1590)
Matt Mackall <mpm@selenic.com>
parents:
13694
diff
changeset
|
318 m.bad = bad |
10369
98a0421b9e52
commands: annotate follows by default, separate -f/--file option
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10365
diff
changeset
|
319 follow = not opts.get('no_follow') |
15528
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
320 diffopts = patch.diffopts(ui, opts, section='annotate') |
6764 | 321 for abs in ctx.walk(m): |
322 fctx = ctx[abs] | |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
323 if not opts.get('text') and util.binary(fctx.data()): |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
324 fm.plain(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) |
1016 | 325 continue |
326 | |
15528
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
327 lines = fctx.annotate(follow=follow, linenumber=linenumber, |
a84698badf0b
annotate: support diff whitespace filtering flags (issue3030)
Patrick Mezard <pmezard@gmail.com>
parents:
15513
diff
changeset
|
328 diffopts=diffopts) |
22477
3c8ae79eacb0
annotate: build format string separately from annotation data
Yuya Nishihara <yuya@tcha.org>
parents:
22452
diff
changeset
|
329 formats = [] |
209 | 330 pieces = [] |
331 | |
14358
bf93e78f2638
annotate: fix alignment of columns in front of line numbers (issue2807)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14331
diff
changeset
|
332 for f, sep in funcmap: |
4857
2192001e4bb4
Add --line-number option to hg annotate (issue506)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4849
diff
changeset
|
333 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
|
334 if l: |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
335 if fm: |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
336 formats.append(['%s' for x in l]) |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
337 else: |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
338 sizes = [encoding.colwidth(x) for x in l] |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
339 ml = max(sizes) |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
340 formats.append([sep + ' ' * (ml - w) + '%s' for w in sizes]) |
22477
3c8ae79eacb0
annotate: build format string separately from annotation data
Yuya Nishihara <yuya@tcha.org>
parents:
22452
diff
changeset
|
341 pieces.append(l) |
3c8ae79eacb0
annotate: build format string separately from annotation data
Yuya Nishihara <yuya@tcha.org>
parents:
22452
diff
changeset
|
342 |
3c8ae79eacb0
annotate: build format string separately from annotation data
Yuya Nishihara <yuya@tcha.org>
parents:
22452
diff
changeset
|
343 for f, p, l in zip(zip(*formats), zip(*pieces), lines): |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
344 fm.startitem() |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
345 fm.write(fields, "".join(f), *p) |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
346 fm.write('line', ": %s", l[1]) |
22452
75e166b82c7a
annotate: remove redundant check for empty list of annotation data
Yuya Nishihara <yuya@tcha.org>
parents:
22433
diff
changeset
|
347 |
75e166b82c7a
annotate: remove redundant check for empty list of annotation data
Yuya Nishihara <yuya@tcha.org>
parents:
22433
diff
changeset
|
348 if lines and not lines[-1][1].endswith('\n'): |
22480
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
349 fm.plain('\n') |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
350 |
dff638170c48
annotate: port to generic templater enabled by hidden -T option
Yuya Nishihara <yuya@tcha.org>
parents:
22479
diff
changeset
|
351 fm.end() |
15829
2c480532f36e
annotate: append newline after non newline-terminated file listings
Ion Savin <ion.savin@tora.com>
parents:
15780
diff
changeset
|
352 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
353 @command('archive', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
354 [('', 'no-decode', None, _('do not pass files through decoders')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
355 ('p', 'prefix', '', _('directory prefix for files in archive'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
356 _('PREFIX')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
357 ('r', 'rev', '', _('revision to distribute'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
358 ('t', 'type', '', _('type of distribution to create'), _('TYPE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
359 ] + subrepoopts + walkopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
360 _('[OPTION]... DEST')) |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
361 def archive(ui, repo, dest, **opts): |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
362 '''create an unversioned archive of a repository revision |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
363 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
364 By default, the revision used is the parent of the working |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
365 directory; use -r/--rev to specify a different revision. |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
366 |
10650
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10649
diff
changeset
|
367 The archive type is automatically detected based on file |
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10649
diff
changeset
|
368 extension (or override using -t/--type). |
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10649
diff
changeset
|
369 |
15109
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
370 .. container:: verbose |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
371 |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
372 Examples: |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
373 |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
374 - create a zip file containing the 1.0 release:: |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
375 |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
376 hg archive -r 1.0 project-1.0.zip |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
377 |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
378 - create a tarball excluding .hg files:: |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
379 |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
380 hg archive project.tar.gz -X ".hg*" |
f7993be2c32f
archive: add help examples
Matt Mackall <mpm@selenic.com>
parents:
15105
diff
changeset
|
381 |
10650
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10649
diff
changeset
|
382 Valid types are: |
9892
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
383 |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
384 :``files``: a directory full of files (default) |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
385 :``tar``: tar archive, uncompressed |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
386 :``tbz2``: tar archive, compressed using bzip2 |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
387 :``tgz``: tar archive, compressed using gzip |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
388 :``uzip``: zip archive, uncompressed |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
389 :``zip``: zip archive, compressed using deflate |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
390 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
391 The exact name of the destination archive or directory is given |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
392 using a format string; see :hg:`help export` for details. |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
393 |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
394 Each member added to an archive file has a directory prefix |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
395 prepended. Use -p/--prefix to specify a format string for the |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
396 prefix. The default is the basename of the archive, with suffixes |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
397 removed. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
398 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
399 Returns 0 on success. |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
400 ''' |
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
401 |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
402 ctx = scmutil.revsingle(repo, opts.get('rev')) |
5061
a49f2a4d5ff7
archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents:
4966
diff
changeset
|
403 if not ctx: |
7528
eadcc075967e
archive: fix bogus error message with no working directory
Matt Mackall <mpm@selenic.com>
parents:
7527
diff
changeset
|
404 raise util.Abort(_('no working directory: please specify a revision')) |
5061
a49f2a4d5ff7
archive: abort on empty repository. Fixes #624.
Brendan Cully <brendan@kublai.com>
parents:
4966
diff
changeset
|
405 node = ctx.node() |
14290
86e70956da4f
cmdutil: make_filename -> makefilename
Matt Mackall <mpm@selenic.com>
parents:
14289
diff
changeset
|
406 dest = cmdutil.makefilename(repo, dest, node) |
15381
c519cd8f0169
backout dbdb777502dc (issue3077) (issue3071)
Matt Mackall <mpm@selenic.com>
parents:
15373
diff
changeset
|
407 if os.path.realpath(dest) == repo.root: |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
408 raise util.Abort(_('repository root cannot be destination')) |
10650
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10649
diff
changeset
|
409 |
11557
57bdc2239535
archival: move commands.archive.guess_type to archival.guesskind
Martin Geisler <mg@lazybytes.net>
parents:
11551
diff
changeset
|
410 kind = opts.get('type') or archival.guesskind(dest) or 'files' |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
411 prefix = opts.get('prefix') |
10650
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10649
diff
changeset
|
412 |
2476
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
413 if dest == '-': |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
414 if kind == 'files': |
0f7e4a39d9af
archive: make "hg archive -t XXX -" to write to stdout
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2473
diff
changeset
|
415 raise util.Abort(_('cannot archive plain files to stdout')) |
14742
271424fdbeec
archive: wrap the ui descriptor so it doesn't get closed
Idan Kamara <idankk86@gmail.com>
parents:
14740
diff
changeset
|
416 dest = cmdutil.makefileobj(repo, dest) |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10270
diff
changeset
|
417 if not prefix: |
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10270
diff
changeset
|
418 prefix = os.path.basename(repo.root) + '-%h' |
10650
9ea7238ad935
archive: autodetect archive type by extension (issue2058)
David Wolever <david@wolever.net>
parents:
10649
diff
changeset
|
419 |
14290
86e70956da4f
cmdutil: make_filename -> makefilename
Matt Mackall <mpm@selenic.com>
parents:
14289
diff
changeset
|
420 prefix = cmdutil.makefilename(repo, prefix, node) |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
421 matchfn = scmutil.match(ctx, [], opts) |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
422 archival.archive(repo, dest, node, kind, not opts.get('no_decode'), |
12323
f00953d9533c
subrepo: add support for 'hg archive'
Martin Geisler <mg@aragost.com>
parents:
12274
diff
changeset
|
423 matchfn, prefix, subrepos=opts.get('subrepos')) |
2112
2b03c6733efa
add "archive" command, like "cvs export" only better.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2092
diff
changeset
|
424 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
425 @command('backout', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
426 [('', 'merge', None, _('merge with old dirstate parent after backout')), |
15211
1209de02034e
backout: deprecate/hide support for backing out merges
Matt Mackall <mpm@selenic.com>
parents:
15210
diff
changeset
|
427 ('', 'parent', '', |
1209de02034e
backout: deprecate/hide support for backing out merges
Matt Mackall <mpm@selenic.com>
parents:
15210
diff
changeset
|
428 _('parent to choose when backing out merge (DEPRECATED)'), _('REV')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
429 ('r', 'rev', '', _('revision to backout'), _('REV')), |
21712
51035af2c0bf
backout: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21689
diff
changeset
|
430 ('e', 'edit', False, _('invoke editor on commit messages')), |
14852
cac04f2f475b
commands: use mergetoolopts when a command supports --tool
Martin Geisler <mg@aragost.com>
parents:
14840
diff
changeset
|
431 ] + mergetoolopts + walkopts + commitopts + commitopts2, |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
432 _('[OPTION]... [-r] REV')) |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
433 def backout(ui, repo, node=None, rev=None, **opts): |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
434 '''reverse effect of earlier changeset |
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
435 |
13340
02aa06a021a0
backout: make help more explicit about what backout does
Jonathan Nieder <jrnieder@gmail.com>
parents:
13328
diff
changeset
|
436 Prepare a new changeset with the effect of REV undone in the |
02aa06a021a0
backout: make help more explicit about what backout does
Jonathan Nieder <jrnieder@gmail.com>
parents:
13328
diff
changeset
|
437 current working directory. |
02aa06a021a0
backout: make help more explicit about what backout does
Jonathan Nieder <jrnieder@gmail.com>
parents:
13328
diff
changeset
|
438 |
13473
bbdd858e3229
backout: clarify which changesets are new in help text
Jonathan Nieder <jrnieder@gmail.com>
parents:
13472
diff
changeset
|
439 If REV is the parent of the working directory, then this new changeset |
13340
02aa06a021a0
backout: make help more explicit about what backout does
Jonathan Nieder <jrnieder@gmail.com>
parents:
13328
diff
changeset
|
440 is committed automatically. Otherwise, hg needs to merge the |
02aa06a021a0
backout: make help more explicit about what backout does
Jonathan Nieder <jrnieder@gmail.com>
parents:
13328
diff
changeset
|
441 changes and the merged result is left uncommitted. |
02aa06a021a0
backout: make help more explicit about what backout does
Jonathan Nieder <jrnieder@gmail.com>
parents:
13328
diff
changeset
|
442 |
15210
9d8115c5fbda
backout: add a note about not working on merges
Matt Mackall <mpm@selenic.com>
parents:
15209
diff
changeset
|
443 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
444 |
15210
9d8115c5fbda
backout: add a note about not working on merges
Matt Mackall <mpm@selenic.com>
parents:
15209
diff
changeset
|
445 backout cannot be used to fix either an unwanted or |
9d8115c5fbda
backout: add a note about not working on merges
Matt Mackall <mpm@selenic.com>
parents:
15209
diff
changeset
|
446 incorrect merge. |
9d8115c5fbda
backout: add a note about not working on merges
Matt Mackall <mpm@selenic.com>
parents:
15209
diff
changeset
|
447 |
15209
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
448 .. container:: verbose |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
449 |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
450 By default, the pending changeset will have one parent, |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
451 maintaining a linear history. With --merge, the pending |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
452 changeset will instead have two parents: the old parent of the |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
453 working directory and a new child of REV that simply undoes REV. |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
454 |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
455 Before version 1.7, the behavior without --merge was equivalent |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
456 to specifying --merge followed by :hg:`update --clean .` to |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
457 cancel the merge and leave the child of REV as a head to be |
10f85a735601
backout: mark some help verbose
Matt Mackall <mpm@selenic.com>
parents:
15203
diff
changeset
|
458 merged separately. |
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
|
459 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
460 See :hg:`help dates` for a list of formats valid for -d/--date. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
461 |
20872
3f83fc5cfe71
backout: correct commit status of no changes made (BC) (issue4190)
Yuya Nishihara <yuya@tcha.org>
parents:
20871
diff
changeset
|
462 Returns 0 on success, 1 if nothing to backout or there are unresolved |
3f83fc5cfe71
backout: correct commit status of no changes made (BC) (issue4190)
Yuya Nishihara <yuya@tcha.org>
parents:
20871
diff
changeset
|
463 files. |
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
|
464 ''' |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
465 if rev and node: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
466 raise util.Abort(_("please specify just one revision")) |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
467 |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
468 if not rev: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
469 rev = node |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
470 |
4726
f6e961c0155b
Fix and test 'hg backout' without or with too many revisions.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4718
diff
changeset
|
471 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
|
472 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
|
473 |
6139
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
474 date = opts.get('date') |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
475 if date: |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
476 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
|
477 |
19476
4fed15d4c5aa
commands: add checks for unfinished operations (issue3955)
Matt Mackall <mpm@selenic.com>
parents:
19475
diff
changeset
|
478 cmdutil.checkunfinished(repo) |
14289
d68ddccf276b
cmdutil: bail_if_changed to bailifchanged
Matt Mackall <mpm@selenic.com>
parents:
14286
diff
changeset
|
479 cmdutil.bailifchanged(repo) |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
480 node = scmutil.revsingle(repo, rev).node() |
5716
be367cbafe70
cmdutil: make bail_if_changed bail on uncommitted merge
Matt Mackall <mpm@selenic.com>
parents:
5688
diff
changeset
|
481 |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
482 op1, op2 = repo.dirstate.parents() |
22381
392ae5cb8d62
revlog: introduce isancestor method for efficiently determining node lineage
Mads Kiilerich <madski@unity3d.com>
parents:
22367
diff
changeset
|
483 if not repo.changelog.isancestor(node, op1): |
20791
8dd867bd67e1
backout: improve confusing 'cannot backout change on a different branch' abort
Mads Kiilerich <madski@unity3d.com>
parents:
20790
diff
changeset
|
484 raise util.Abort(_('cannot backout change that is not an ancestor')) |
5568
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
5542
diff
changeset
|
485 |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
486 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
|
487 if p1 == nullid: |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
488 raise util.Abort(_('cannot backout a change with no parents')) |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
489 if p2 != nullid: |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
490 if not opts.get('parent'): |
15211
1209de02034e
backout: deprecate/hide support for backing out merges
Matt Mackall <mpm@selenic.com>
parents:
15210
diff
changeset
|
491 raise util.Abort(_('cannot backout a merge changeset')) |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
492 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
|
493 if p not in (p1, p2): |
3679
2956948b81f3
fix warnings generated by pygettext.py.
Marcos Chaves <marcos.nospam@gmail.com>
parents:
3673
diff
changeset
|
494 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
|
495 (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
|
496 parent = p |
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
497 else: |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
498 if opts.get('parent'): |
2614
8ba1c31f6864
backout: allow backout of merge changeset with --parent option.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2613
diff
changeset
|
499 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
|
500 parent = p1 |
5568
de620356064f
backout: disallow across branches (issue655)
Matt Mackall <mpm@selenic.com>
parents:
5542
diff
changeset
|
501 |
6423
fb374b1b3911
backout: reverse changeset belongs on current branch
Matt Mackall <mpm@selenic.com>
parents:
6385
diff
changeset
|
502 # the backout should appear on the same branch |
16470
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
503 wlock = repo.wlock() |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
504 try: |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
505 branch = repo.dirstate.branch() |
18689
12721a20ed30
backout: call cmdutil.commit directly instead of commands.commit
Kevin Bullock <kbullock@ringworld.org>
parents:
18688
diff
changeset
|
506 bheads = repo.branchheads(branch) |
18685
fafdff7e9c43
backout: use cmdutil.revert directly instead of commands.revert
Kevin Bullock <kbullock@ringworld.org>
parents:
18658
diff
changeset
|
507 rctx = scmutil.revsingle(repo, hex(parent)) |
16470
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
508 if not opts.get('merge') and op1 != node: |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
509 try: |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
510 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
511 'backout') |
22405
6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
Durham Goode <durham@fb.com>
parents:
22390
diff
changeset
|
512 repo.dirstate.beginparentchange() |
20276
6545770bd379
backout: add a message after backout that need manual commit
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20275
diff
changeset
|
513 stats = mergemod.update(repo, parent, True, True, False, |
6545770bd379
backout: add a message after backout that need manual commit
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20275
diff
changeset
|
514 node, False) |
20275
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
515 repo.setparents(op1, op2) |
22405
6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
Durham Goode <durham@fb.com>
parents:
22390
diff
changeset
|
516 repo.dirstate.endparentchange() |
20275
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
517 hg._showstats(repo, stats) |
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
518 if stats[3]: |
20276
6545770bd379
backout: add a message after backout that need manual commit
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20275
diff
changeset
|
519 repo.ui.status(_("use 'hg resolve' to retry unresolved " |
6545770bd379
backout: add a message after backout that need manual commit
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20275
diff
changeset
|
520 "file merges\n")) |
6545770bd379
backout: add a message after backout that need manual commit
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20275
diff
changeset
|
521 else: |
6545770bd379
backout: add a message after backout that need manual commit
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20275
diff
changeset
|
522 msg = _("changeset %s backed out, " |
6545770bd379
backout: add a message after backout that need manual commit
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20275
diff
changeset
|
523 "don't forget to commit.\n") |
6545770bd379
backout: add a message after backout that need manual commit
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20275
diff
changeset
|
524 ui.status(msg % short(node)) |
20275
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
525 return stats[3] > 0 |
16470
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
526 finally: |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
527 ui.setconfig('ui', 'forcemerge', '', '') |
20275
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
528 else: |
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
529 hg.clean(repo, node, show_stats=False) |
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
530 repo.dirstate.setbranch(branch) |
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
531 cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) |
2123d27ff75d
backout: avoid update on simple case.
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20237
diff
changeset
|
532 |
16470
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
533 |
18689
12721a20ed30
backout: call cmdutil.commit directly instead of commands.commit
Kevin Bullock <kbullock@ringworld.org>
parents:
18688
diff
changeset
|
534 def commitfunc(ui, repo, message, match, opts): |
22007
a5bb0c4001ae
backout: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21986
diff
changeset
|
535 editform = 'backout' |
a5bb0c4001ae
backout: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21986
diff
changeset
|
536 e = cmdutil.getcommiteditor(editform=editform, **opts) |
21412
6f6ccb0bb6af
backout: avoid redundant message examination
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21404
diff
changeset
|
537 if not message: |
6f6ccb0bb6af
backout: avoid redundant message examination
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21404
diff
changeset
|
538 # we don't translate commit messages |
6f6ccb0bb6af
backout: avoid redundant message examination
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21404
diff
changeset
|
539 message = "Backed out changeset %s" % short(node) |
22007
a5bb0c4001ae
backout: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21986
diff
changeset
|
540 e = cmdutil.getcommiteditor(edit=True, editform=editform) |
18689
12721a20ed30
backout: call cmdutil.commit directly instead of commands.commit
Kevin Bullock <kbullock@ringworld.org>
parents:
18688
diff
changeset
|
541 return repo.commit(message, opts.get('user'), opts.get('date'), |
12721a20ed30
backout: call cmdutil.commit directly instead of commands.commit
Kevin Bullock <kbullock@ringworld.org>
parents:
18688
diff
changeset
|
542 match, editor=e) |
12721a20ed30
backout: call cmdutil.commit directly instead of commands.commit
Kevin Bullock <kbullock@ringworld.org>
parents:
18688
diff
changeset
|
543 newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) |
20872
3f83fc5cfe71
backout: correct commit status of no changes made (BC) (issue4190)
Yuya Nishihara <yuya@tcha.org>
parents:
20871
diff
changeset
|
544 if not newnode: |
3f83fc5cfe71
backout: correct commit status of no changes made (BC) (issue4190)
Yuya Nishihara <yuya@tcha.org>
parents:
20871
diff
changeset
|
545 ui.status(_("nothing changed\n")) |
3f83fc5cfe71
backout: correct commit status of no changes made (BC) (issue4190)
Yuya Nishihara <yuya@tcha.org>
parents:
20871
diff
changeset
|
546 return 1 |
18689
12721a20ed30
backout: call cmdutil.commit directly instead of commands.commit
Kevin Bullock <kbullock@ringworld.org>
parents:
18688
diff
changeset
|
547 cmdutil.commitstatus(repo, newnode, branch, bheads) |
18687
1d183b33f007
backout: remove unnecessary dict copy
Kevin Bullock <kbullock@ringworld.org>
parents:
18686
diff
changeset
|
548 |
16470
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
549 def nice(node): |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
550 return '%d:%s' % (repo.changelog.rev(node), short(node)) |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
551 ui.status(_('changeset %s backs out changeset %s\n') % |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
552 (nice(repo.changelog.tip()), nice(node))) |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
553 if opts.get('merge') and op1 != node: |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
554 hg.clean(repo, op1, show_stats=False) |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
555 ui.status(_('merging with changeset %s\n') |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
556 % nice(repo.changelog.tip())) |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
557 try: |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
558 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
559 'backout') |
16470
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
560 return hg.merge(repo, hex(repo.changelog.tip())) |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
561 finally: |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
562 ui.setconfig('ui', 'forcemerge', '', '') |
16470
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
563 finally: |
b2e1da5db6df
commands: add missing wlock to backout
Idan Kamara <idankk86@gmail.com>
parents:
16458
diff
changeset
|
564 wlock.release() |
12727
52971985be14
backout: provide linear backout as a default (without --merge option)
Gilles Moris <gilles.moris@free.fr>
parents:
12726
diff
changeset
|
565 return 0 |
2158
ec96c4518236
add backout command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2153
diff
changeset
|
566 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
567 @command('bisect', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
568 [('r', 'reset', False, _('reset bisect state')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
569 ('g', 'good', False, _('mark changeset good')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
570 ('b', 'bad', False, _('mark changeset bad')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
571 ('s', 'skip', False, _('skip testing changeset')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
572 ('e', 'extend', False, _('extend the bisect range')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
573 ('c', 'command', '', _('use command to check changeset state'), _('CMD')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
574 ('U', 'noupdate', False, _('do not update to target'))], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
575 _("[-gbsr] [-U] [-c CMD] [REV]")) |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
576 def bisect(ui, repo, rev=None, extra=None, command=None, |
13601
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
577 reset=None, good=None, bad=None, skip=None, extend=None, |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
578 noupdate=None): |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
579 """subdivision search of changesets |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
580 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
581 This command helps to find changesets which introduce problems. To |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
582 use, mark the earliest changeset you know exhibits the problem as |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
583 bad, then mark the latest changeset which is free from the problem |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
584 as good. Bisect will update your working directory to a revision |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
585 for testing (unless the -U/--noupdate option is specified). Once |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
586 you have performed tests, mark the working directory as good or |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
587 bad, and bisect will either update to another candidate changeset |
6928
1a4c66d741a2
bisect: expand help text to explain REV argument and --noupdate
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6858
diff
changeset
|
588 or announce that it has found the bad revision. |
7184
380fda3eed13
clean up trailing spaces
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7037
diff
changeset
|
589 |
6928
1a4c66d741a2
bisect: expand help text to explain REV argument and --noupdate
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6858
diff
changeset
|
590 As a shortcut, you can also use the revision argument to mark a |
1a4c66d741a2
bisect: expand help text to explain REV argument and --noupdate
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6858
diff
changeset
|
591 revision as good or bad without checking it out first. |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
592 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
593 If you supply a command, it will be used for automatic bisection. |
16648
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
594 The environment variable HG_NODE will contain the ID of the |
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
595 changeset being tested. The exit status of the command will be |
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
596 used to mark revisions as good or bad: status 0 means good, 125 |
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
597 means to skip the revision, 127 (command not found) will abort the |
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
598 bisection, and any other non-zero exit status means the revision |
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
599 is bad. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
600 |
15139
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
601 .. container:: verbose |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
602 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
603 Some examples: |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
604 |
20151
734ff413eb7e
help: fix backwards bisect help example
Santiago Pay=C3=A0 i Miralta <santiagopim@gmail.com>
parents:
20146
diff
changeset
|
605 - start a bisection with known bad revision 34, and good revision 12:: |
15139
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
606 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
607 hg bisect --bad 34 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
608 hg bisect --good 12 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
609 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
610 - advance the current bisection by marking current revision as good or |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
611 bad:: |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
612 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
613 hg bisect --good |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
614 hg bisect --bad |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
615 |
17424
e7cfe3587ea4
fix trivial spelling errors
Mads Kiilerich <mads@kiilerich.com>
parents:
17393
diff
changeset
|
616 - mark the current revision, or a known revision, to be skipped (e.g. if |
15139
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
617 that revision is not usable because of another issue):: |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
618 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
619 hg bisect --skip |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
620 hg bisect --skip 23 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
621 |
19958
25b02c6f73a6
doc: end line preceding command line example with double colon
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19941
diff
changeset
|
622 - skip all revisions that do not touch directories ``foo`` or ``bar``:: |
17969
6c67deb3d373
bisect: add example for limiting bisection to specified directories
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
17956
diff
changeset
|
623 |
19959
9ef92384415c
doc: use double quotation mark to quote arguments in examples for Windows users
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19958
diff
changeset
|
624 hg bisect --skip "!( file('path:foo') & file('path:bar') )" |
17969
6c67deb3d373
bisect: add example for limiting bisection to specified directories
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
17956
diff
changeset
|
625 |
15139
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
626 - forget the current bisection:: |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
627 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
628 hg bisect --reset |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
629 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
630 - use 'make && make tests' to automatically find the first broken |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
631 revision:: |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
632 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
633 hg bisect --reset |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
634 hg bisect --bad 34 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
635 hg bisect --good 12 |
19959
9ef92384415c
doc: use double quotation mark to quote arguments in examples for Windows users
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19958
diff
changeset
|
636 hg bisect --command "make && make tests" |
15139
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
637 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
638 - see all changesets whose states are already known in the current |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
639 bisection:: |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
640 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
641 hg log -r "bisect(pruned)" |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
642 |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
643 - see the changeset currently being bisected (especially useful |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
644 if running with -U/--noupdate):: |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
645 |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
646 hg log -r "bisect(current)" |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
647 |
15139
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
648 - see all changesets that took part in the current bisection:: |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
649 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
650 hg log -r "bisect(range)" |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
651 |
20146
aa192af94321
bisect: don't mention obsolete graphlog extension in help
Martin Geisler <martin@geisler.net>
parents:
20107
diff
changeset
|
652 - you can even get a nice graph:: |
15139
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
653 |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
654 hg log --graph -r "bisect(range)" |
0834e0bb445a
bisect: add some bisection examples, and some log revset.bisect() examples
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15129
diff
changeset
|
655 |
15147
395ca8cd2669
revset.bisect: add 'ignored' set to the bisect keyword
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15145
diff
changeset
|
656 See :hg:`help revsets` for more about the `bisect()` keyword. |
395ca8cd2669
revset.bisect: add 'ignored' set to the bisect keyword
"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
parents:
15145
diff
changeset
|
657 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
658 Returns 0 on success. |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
659 """ |
13601
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
660 def extendbisectrange(nodes, good): |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
661 # bisect is incomplete when it ends on a merge node and |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
662 # one of the parent was not checked. |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
663 parents = repo[nodes[0]].parents() |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
664 if len(parents) > 1: |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
665 side = good and state['bad'] or state['good'] |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
666 num = len(set(i.node() for i in parents) & set(side)) |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
667 if num == 1: |
14157 | 668 return parents[0].ancestor(parents[1]) |
13601
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
669 return None |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
670 |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
671 def print_result(nodes, good): |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
672 displayer = cmdutil.show_changeset(ui, repo, {}) |
6858
8f256bf98219
Add support for multiple possible bisect results (issue1228, issue1182)
Bernhard Leiner <bleiner@gmail.com>
parents:
6842
diff
changeset
|
673 if len(nodes) == 1: |
8f256bf98219
Add support for multiple possible bisect results (issue1228, issue1182)
Bernhard Leiner <bleiner@gmail.com>
parents:
6842
diff
changeset
|
674 # narrowed it down to a single revision |
8088
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
675 if good: |
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
676 ui.write(_("The first good revision is:\n")) |
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
677 else: |
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
678 ui.write(_("The first bad revision is:\n")) |
7369
87158be081b8
cmdutil: use change contexts for cset-printer and cset-templater
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7364
diff
changeset
|
679 displayer.show(repo[nodes[0]]) |
13601
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
680 extendnode = extendbisectrange(nodes, good) |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
681 if extendnode is not None: |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
682 ui.write(_('Not all ancestors of this changeset have been' |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
683 ' checked.\nUse bisect --extend to continue the ' |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
684 'bisection from\nthe common ancestor, %s.\n') |
14055
421d56a055fd
drop {short,hex}(ctx.node()) calls in favor of ctx methods
Alexander Solovyov <alexander@solovyov.net>
parents:
14048
diff
changeset
|
685 % extendnode) |
6858
8f256bf98219
Add support for multiple possible bisect results (issue1228, issue1182)
Bernhard Leiner <bleiner@gmail.com>
parents:
6842
diff
changeset
|
686 else: |
8f256bf98219
Add support for multiple possible bisect results (issue1228, issue1182)
Bernhard Leiner <bleiner@gmail.com>
parents:
6842
diff
changeset
|
687 # multiple possible revisions |
8088
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
688 if good: |
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
689 ui.write(_("Due to skipped revisions, the first " |
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
690 "good revision could be any of:\n")) |
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
691 else: |
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
692 ui.write(_("Due to skipped revisions, the first " |
bdeb380a10de
commands, i18n: avoid untranslated strings as message parameters
Wagner Bruna <wbruna@yahoo.com>
parents:
8042
diff
changeset
|
693 "bad revision could be any of:\n")) |
6858
8f256bf98219
Add support for multiple possible bisect results (issue1228, issue1182)
Bernhard Leiner <bleiner@gmail.com>
parents:
6842
diff
changeset
|
694 for n in nodes: |
7369
87158be081b8
cmdutil: use change contexts for cset-printer and cset-templater
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7364
diff
changeset
|
695 displayer.show(repo[n]) |
10152
56284451a22c
Added support for templatevar "footer" to cmdutil.py
Robert Bachmann <rbachm@gmail.com>
parents:
10111
diff
changeset
|
696 displayer.close() |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
697 |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
698 def check_state(state, interactive=True): |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
699 if not state['good'] or not state['bad']: |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
700 if (good or bad or skip or reset) and interactive: |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
701 return |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
702 if not state['good']: |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
703 raise util.Abort(_('cannot bisect (no known good revisions)')) |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
704 else: |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
705 raise util.Abort(_('cannot bisect (no known bad revisions)')) |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
706 return True |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
707 |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
708 # backward compatibility |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
709 if rev in "good bad reset init".split(): |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
710 ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
711 cmd, rev, extra = rev, extra, None |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
712 if cmd == "good": |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
713 good = True |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
714 elif cmd == "bad": |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
715 bad = True |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
716 else: |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
717 reset = True |
13601
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
718 elif extra or good + bad + skip + reset + extend + bool(command) > 1: |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
719 raise util.Abort(_('incompatible arguments')) |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
720 |
19476
4fed15d4c5aa
commands: add checks for unfinished operations (issue3955)
Matt Mackall <mpm@selenic.com>
parents:
19475
diff
changeset
|
721 cmdutil.checkunfinished(repo) |
4fed15d4c5aa
commands: add checks for unfinished operations (issue3955)
Matt Mackall <mpm@selenic.com>
parents:
19475
diff
changeset
|
722 |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
723 if reset: |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
724 p = repo.join("bisect.state") |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
725 if os.path.exists(p): |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
726 os.unlink(p) |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
727 return |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
728 |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
729 state = hbisect.load_state(repo) |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
730 |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
731 if command: |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
732 changesets = 1 |
20237
0d32dd60016c
bisect: --command without --noupdate should flag the parent rev it tested
Mads Kiilerich <madski@unity3d.com>
parents:
20235
diff
changeset
|
733 if noupdate: |
0d32dd60016c
bisect: --command without --noupdate should flag the parent rev it tested
Mads Kiilerich <madski@unity3d.com>
parents:
20235
diff
changeset
|
734 try: |
0d32dd60016c
bisect: --command without --noupdate should flag the parent rev it tested
Mads Kiilerich <madski@unity3d.com>
parents:
20235
diff
changeset
|
735 node = state['current'][0] |
0d32dd60016c
bisect: --command without --noupdate should flag the parent rev it tested
Mads Kiilerich <madski@unity3d.com>
parents:
20235
diff
changeset
|
736 except LookupError: |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
737 raise util.Abort(_('current bisect revision is unknown - ' |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
738 'start a new bisect to fix')) |
20237
0d32dd60016c
bisect: --command without --noupdate should flag the parent rev it tested
Mads Kiilerich <madski@unity3d.com>
parents:
20235
diff
changeset
|
739 else: |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
740 node, p2 = repo.dirstate.parents() |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
741 if p2 != nullid: |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
742 raise util.Abort(_('current bisect revision is a merge')) |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
743 try: |
7590
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
744 while changesets: |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
745 # update state |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
746 state['current'] = [node] |
16593
e462313ef1bd
bisect: save current state before running a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16591
diff
changeset
|
747 hbisect.save_state(repo, state) |
16648
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
748 status = util.system(command, |
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
749 environ={'HG_NODE': hex(node)}, |
1388cc711ea7
bisect: set HG_NODE when runing a command
Bryan O'Sullivan <bryano@fb.com>
parents:
16647
diff
changeset
|
750 out=ui.fout) |
7590
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
751 if status == 125: |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
752 transition = "skip" |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
753 elif status == 0: |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
754 transition = "good" |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
755 # status < 0 means process was killed |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
756 elif status == 127: |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
757 raise util.Abort(_("failed to execute %s") % command) |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
758 elif status < 0: |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
759 raise util.Abort(_("%s killed") % command) |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
760 else: |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
761 transition = "bad" |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
762 ctx = scmutil.revsingle(repo, rev, node) |
12925
6eab8f0df2ca
commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents:
12918
diff
changeset
|
763 rev = None # clear for future iterations |
8805
2726a6df11e9
bisect: improve --command output
Patrick Mezard <pmezard@gmail.com>
parents:
8802
diff
changeset
|
764 state[transition].append(ctx.node()) |
16936
ee7dd2307031
bisect: lowercase status message
Martin Geisler <mg@aragost.com>
parents:
16935
diff
changeset
|
765 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) |
7590
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
766 check_state(state, interactive=False) |
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
767 # bisect |
20052
79d3b6a45351
bisect: avoid confusing use of variables with same names in nested local scopes
Mads Kiilerich <madski@unity3d.com>
parents:
20035
diff
changeset
|
768 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state) |
7590
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
769 # update to next check |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
770 node = nodes[0] |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
771 if not noupdate: |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
772 cmdutil.bailifchanged(repo) |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
773 hg.clean(repo, node, show_stats=False) |
7590
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
774 finally: |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
775 state['current'] = [node] |
7590
e5703ec08e64
bisect: improve hg bisect -c (relative paths, error handling)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
7570
diff
changeset
|
776 hbisect.save_state(repo, state) |
20052
79d3b6a45351
bisect: avoid confusing use of variables with same names in nested local scopes
Mads Kiilerich <madski@unity3d.com>
parents:
20035
diff
changeset
|
777 print_result(nodes, bgood) |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
778 return |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
779 |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
780 # update state |
12177
80399b5b5f13
bisect: allow revsets in addition to single revs (issue2360)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
12173
diff
changeset
|
781 |
80399b5b5f13
bisect: allow revsets in addition to single revs (issue2360)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
12173
diff
changeset
|
782 if rev: |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
783 nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])] |
12177
80399b5b5f13
bisect: allow revsets in addition to single revs (issue2360)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
12173
diff
changeset
|
784 else: |
80399b5b5f13
bisect: allow revsets in addition to single revs (issue2360)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
12173
diff
changeset
|
785 nodes = [repo.lookup('.')] |
80399b5b5f13
bisect: allow revsets in addition to single revs (issue2360)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
12173
diff
changeset
|
786 |
9689
57cee011ffcb
bisect: no need to save the state if it wasn't changed
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
9687
diff
changeset
|
787 if good or bad or skip: |
57cee011ffcb
bisect: no need to save the state if it wasn't changed
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
9687
diff
changeset
|
788 if good: |
12177
80399b5b5f13
bisect: allow revsets in addition to single revs (issue2360)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
12173
diff
changeset
|
789 state['good'] += nodes |
9689
57cee011ffcb
bisect: no need to save the state if it wasn't changed
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
9687
diff
changeset
|
790 elif bad: |
12177
80399b5b5f13
bisect: allow revsets in addition to single revs (issue2360)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
12173
diff
changeset
|
791 state['bad'] += nodes |
9689
57cee011ffcb
bisect: no need to save the state if it wasn't changed
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
9687
diff
changeset
|
792 elif skip: |
12177
80399b5b5f13
bisect: allow revsets in addition to single revs (issue2360)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
12173
diff
changeset
|
793 state['skip'] += nodes |
9689
57cee011ffcb
bisect: no need to save the state if it wasn't changed
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
9687
diff
changeset
|
794 hbisect.save_state(repo, state) |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
795 |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
796 if not check_state(state): |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
797 return |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
798 |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
799 # actually bisect |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
800 nodes, changesets, good = hbisect.bisect(repo.changelog, state) |
13601
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
801 if extend: |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
802 if not changesets: |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
803 extendnode = extendbisectrange(nodes, good) |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
804 if extendnode is not None: |
20868
5db105f216c3
i18n: fix "% inside _()" problems
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20772
diff
changeset
|
805 ui.write(_("Extending search to changeset %d:%s\n") |
5db105f216c3
i18n: fix "% inside _()" problems
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20772
diff
changeset
|
806 % (extendnode.rev(), extendnode)) |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
807 state['current'] = [extendnode.node()] |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
808 hbisect.save_state(repo, state) |
13601
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
809 if noupdate: |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
810 return |
14289
d68ddccf276b
cmdutil: bail_if_changed to bailifchanged
Matt Mackall <mpm@selenic.com>
parents:
14286
diff
changeset
|
811 cmdutil.bailifchanged(repo) |
13601
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
812 return hg.clean(repo, extendnode.node()) |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
813 raise util.Abort(_("nothing to extend")) |
0388e3e36693
bisect: new command to extend the bisect range (issue2690)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
13591
diff
changeset
|
814 |
7227
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
815 if changesets == 0: |
e1afb50ec2aa
bisect: ability to check revision with command
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7213
diff
changeset
|
816 print_result(nodes, good) |
6858
8f256bf98219
Add support for multiple possible bisect results (issue1228, issue1182)
Bernhard Leiner <bleiner@gmail.com>
parents:
6842
diff
changeset
|
817 else: |
8f256bf98219
Add support for multiple possible bisect results (issue1228, issue1182)
Bernhard Leiner <bleiner@gmail.com>
parents:
6842
diff
changeset
|
818 assert len(nodes) == 1 # only a single node can be tested next |
8f256bf98219
Add support for multiple possible bisect results (issue1228, issue1182)
Bernhard Leiner <bleiner@gmail.com>
parents:
6842
diff
changeset
|
819 node = nodes[0] |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
820 # compute the approximate number of remaining tests |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
821 tests, size = 0, 2 |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
822 while size <= changesets: |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
823 tests, size = tests + 1, size * 2 |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
824 rev = repo.changelog.rev(node) |
9012
ada93c6bf554
bisect: fix format specifiers for integers
Cédric Duval <cedricduval@free.fr>
parents:
8995
diff
changeset
|
825 ui.write(_("Testing changeset %d:%s " |
ada93c6bf554
bisect: fix format specifiers for integers
Cédric Duval <cedricduval@free.fr>
parents:
8995
diff
changeset
|
826 "(%d changesets remaining, ~%d tests)\n") |
6217
fe8dbbe9520d
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
Joel Rosdahl <joel@rosdahl.net>
parents:
6212
diff
changeset
|
827 % (rev, short(node), changesets, tests)) |
16647
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
828 state['current'] = [node] |
14913fcb30c6
bisect: track the current changeset (issue3382)
Bryan O'Sullivan <bryano@fb.com>
parents:
16642
diff
changeset
|
829 hbisect.save_state(repo, state) |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
830 if not noupdate: |
14289
d68ddccf276b
cmdutil: bail_if_changed to bailifchanged
Matt Mackall <mpm@selenic.com>
parents:
14286
diff
changeset
|
831 cmdutil.bailifchanged(repo) |
5775
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
832 return hg.clean(repo, node) |
2dd202a6e15b
bisect: make bisect a built-in command
Matt Mackall <mpm@selenic.com>
parents:
5764
diff
changeset
|
833 |
18075
2c1fc483efa4
commands: 'hg bookmark NAME' should work even with ui.strict=True
Kevin Bullock <kbullock@ringworld.org>
parents:
18068
diff
changeset
|
834 @command('bookmarks|bookmark', |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
835 [('f', 'force', False, _('force')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
836 ('r', 'rev', '', _('revision'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
837 ('d', 'delete', False, _('delete a given bookmark')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
838 ('m', 'rename', '', _('rename a given bookmark'), _('NAME')), |
15959
db33555eafea
bookmarks: correct correction of -i
Matt Mackall <mpm@selenic.com>
parents:
15958
diff
changeset
|
839 ('i', 'inactive', False, _('mark a bookmark inactive'))], |
19147
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
840 _('hg bookmarks [OPTIONS]... [NAME]...')) |
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
841 def bookmark(ui, repo, *names, **opts): |
21762
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
842 '''create a new bookmark or list existing bookmarks |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
843 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
844 Bookmarks are labels on changesets to help track lines of development. |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
845 Bookmarks are unversioned and can be moved, renamed and deleted. |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
846 Deleting or moving a bookmark has no effect on the associated changesets. |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
847 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
848 Creating or updating to a bookmark causes it to be marked as 'active'. |
22314
6a8b8efb0641
bookmarks: refer to "the" active bookmark to clarify that there's only one
Kevin Bullock <kbullock@ringworld.org>
parents:
22302
diff
changeset
|
849 The active bookmark is indicated with a '*'. |
6a8b8efb0641
bookmarks: refer to "the" active bookmark to clarify that there's only one
Kevin Bullock <kbullock@ringworld.org>
parents:
22302
diff
changeset
|
850 When a commit is made, the active bookmark will advance to the new commit. |
21762
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
851 A plain :hg:`update` will also advance an active bookmark, if possible. |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
852 Updating away from a bookmark will cause it to be deactivated. |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
853 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
854 Bookmarks can be pushed and pulled between repositories (see |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
855 :hg:`help push` and :hg:`help pull`). If a shared bookmark has |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
856 diverged, a new 'divergent bookmark' of the form 'name@path' will |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
857 be created. Using :hg:'merge' will resolve the divergence. |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
858 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
859 A bookmark named '@' has the special property that :hg:`clone` will |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
860 check it out by default if it exists. |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
861 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
862 .. container:: verbose |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
863 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
864 Examples: |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
865 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
866 - create an active bookmark for a new line of development:: |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
867 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
868 hg book new-feature |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
869 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
870 - create an inactive bookmark as a place marker:: |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
871 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
872 hg book -i reviewed |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
873 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
874 - create an inactive bookmark on another changeset:: |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
875 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
876 hg book -r .^ tested |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
877 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
878 - move the '@' bookmark from another branch:: |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
879 |
0c6cdbb697d9
bookmarks: improve the bookmark help (issue4244)
Matt Mackall <mpm@selenic.com>
parents:
21721
diff
changeset
|
880 hg book -f @ |
13368
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
881 ''' |
19147
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
882 force = opts.get('force') |
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
883 rev = opts.get('rev') |
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
884 delete = opts.get('delete') |
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
885 rename = opts.get('rename') |
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
886 inactive = opts.get('inactive') |
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
887 |
17789
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
888 def checkformat(mark): |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
889 mark = mark.strip() |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
890 if not mark: |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
891 raise util.Abort(_("bookmark names cannot consist entirely of " |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
892 "whitespace")) |
17821
361ab1e2086f
scmutil: add bad character checking to checknewlabel
Kevin Bullock <kbullock@ringworld.org>
parents:
17818
diff
changeset
|
893 scmutil.checknewlabel(repo, mark, 'bookmark') |
17789
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
894 return mark |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
895 |
20233
410193f11422
commands.bookmarks: pass cur in explicitly to checkconflict
Siddharth Agarwal <sid0@fb.com>
parents:
20232
diff
changeset
|
896 def checkconflict(repo, mark, cur, force=False, target=None): |
17789
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
897 if mark in marks and not force: |
18773
56dd55da2f7d
bookmarks: allow moving a bookmark forward to a descendant
Kevin Bullock <kbullock@ringworld.org>
parents:
18746
diff
changeset
|
898 if target: |
18781
99b78269a2ec
bookmarks: allow (re-)activating a bookmark on the current changeset
Kevin Bullock <kbullock@ringworld.org>
parents:
18773
diff
changeset
|
899 if marks[mark] == target and target == cur: |
99b78269a2ec
bookmarks: allow (re-)activating a bookmark on the current changeset
Kevin Bullock <kbullock@ringworld.org>
parents:
18773
diff
changeset
|
900 # re-activating a bookmark |
99b78269a2ec
bookmarks: allow (re-)activating a bookmark on the current changeset
Kevin Bullock <kbullock@ringworld.org>
parents:
18773
diff
changeset
|
901 return |
18773
56dd55da2f7d
bookmarks: allow moving a bookmark forward to a descendant
Kevin Bullock <kbullock@ringworld.org>
parents:
18746
diff
changeset
|
902 anc = repo.changelog.ancestors([repo[target].rev()]) |
56dd55da2f7d
bookmarks: allow moving a bookmark forward to a descendant
Kevin Bullock <kbullock@ringworld.org>
parents:
18746
diff
changeset
|
903 bmctx = repo[marks[mark]] |
19109
26c51e87e807
bookmarks: resolve divergent bookmarks when fowarding bookmark to descendant
Sean Farley <sean.michael.farley@gmail.com>
parents:
19026
diff
changeset
|
904 divs = [repo[b].node() for b in marks |
26c51e87e807
bookmarks: resolve divergent bookmarks when fowarding bookmark to descendant
Sean Farley <sean.michael.farley@gmail.com>
parents:
19026
diff
changeset
|
905 if b.split('@', 1)[0] == mark.split('@', 1)[0]] |
19111
6439d78e14fb
bookmarks: resolve divergent bookmark when moving across a branch
Sean Farley <sean.michael.farley@gmail.com>
parents:
19109
diff
changeset
|
906 |
6439d78e14fb
bookmarks: resolve divergent bookmark when moving across a branch
Sean Farley <sean.michael.farley@gmail.com>
parents:
19109
diff
changeset
|
907 # allow resolving a single divergent bookmark even if moving |
6439d78e14fb
bookmarks: resolve divergent bookmark when moving across a branch
Sean Farley <sean.michael.farley@gmail.com>
parents:
19109
diff
changeset
|
908 # the bookmark across branches when a revision is specified |
6439d78e14fb
bookmarks: resolve divergent bookmark when moving across a branch
Sean Farley <sean.michael.farley@gmail.com>
parents:
19109
diff
changeset
|
909 # that contains a divergent bookmark |
6439d78e14fb
bookmarks: resolve divergent bookmark when moving across a branch
Sean Farley <sean.michael.farley@gmail.com>
parents:
19109
diff
changeset
|
910 if bmctx.rev() not in anc and target in divs: |
6439d78e14fb
bookmarks: resolve divergent bookmark when moving across a branch
Sean Farley <sean.michael.farley@gmail.com>
parents:
19109
diff
changeset
|
911 bookmarks.deletedivergent(repo, [target], mark) |
6439d78e14fb
bookmarks: resolve divergent bookmark when moving across a branch
Sean Farley <sean.michael.farley@gmail.com>
parents:
19109
diff
changeset
|
912 return |
6439d78e14fb
bookmarks: resolve divergent bookmark when moving across a branch
Sean Farley <sean.michael.farley@gmail.com>
parents:
19109
diff
changeset
|
913 |
19109
26c51e87e807
bookmarks: resolve divergent bookmarks when fowarding bookmark to descendant
Sean Farley <sean.michael.farley@gmail.com>
parents:
19026
diff
changeset
|
914 deletefrom = [b for b in divs |
26c51e87e807
bookmarks: resolve divergent bookmarks when fowarding bookmark to descendant
Sean Farley <sean.michael.farley@gmail.com>
parents:
19026
diff
changeset
|
915 if repo[b].rev() in anc or b == target] |
26c51e87e807
bookmarks: resolve divergent bookmarks when fowarding bookmark to descendant
Sean Farley <sean.michael.farley@gmail.com>
parents:
19026
diff
changeset
|
916 bookmarks.deletedivergent(repo, deletefrom, mark) |
20282
2cfb720592fe
commands: use bookmarks.validdest instead of duplicating logic
Sean Farley <sean.michael.farley@gmail.com>
parents:
20276
diff
changeset
|
917 if bookmarks.validdest(repo, bmctx, repo[target]): |
18773
56dd55da2f7d
bookmarks: allow moving a bookmark forward to a descendant
Kevin Bullock <kbullock@ringworld.org>
parents:
18746
diff
changeset
|
918 ui.status(_("moving bookmark '%s' forward from %s\n") % |
56dd55da2f7d
bookmarks: allow moving a bookmark forward to a descendant
Kevin Bullock <kbullock@ringworld.org>
parents:
18746
diff
changeset
|
919 (mark, short(bmctx.node()))) |
56dd55da2f7d
bookmarks: allow moving a bookmark forward to a descendant
Kevin Bullock <kbullock@ringworld.org>
parents:
18746
diff
changeset
|
920 return |
17789
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
921 raise util.Abort(_("bookmark '%s' already exists " |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
922 "(use -f to force)") % mark) |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
923 if ((mark in repo.branchmap() or mark == repo.dirstate.branch()) |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
924 and not force): |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
925 raise util.Abort( |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
926 _("a bookmark cannot have the name of an existing branch")) |
4cfd02c2df9a
bookmarks: check bookmark format during rename (issue3662)
David Soria Parra <dsp@php.net>
parents:
17788
diff
changeset
|
927 |
17790
0291e122fb05
bookmarks: abort when incompatible options are used (issue3663)
David Soria Parra <dsp@php.net>
parents:
17789
diff
changeset
|
928 if delete and rename: |
0291e122fb05
bookmarks: abort when incompatible options are used (issue3663)
David Soria Parra <dsp@php.net>
parents:
17789
diff
changeset
|
929 raise util.Abort(_("--delete and --rename are incompatible")) |
0291e122fb05
bookmarks: abort when incompatible options are used (issue3663)
David Soria Parra <dsp@php.net>
parents:
17789
diff
changeset
|
930 if delete and rev: |
0291e122fb05
bookmarks: abort when incompatible options are used (issue3663)
David Soria Parra <dsp@php.net>
parents:
17789
diff
changeset
|
931 raise util.Abort(_("--rev is incompatible with --delete")) |
0291e122fb05
bookmarks: abort when incompatible options are used (issue3663)
David Soria Parra <dsp@php.net>
parents:
17789
diff
changeset
|
932 if rename and rev: |
0291e122fb05
bookmarks: abort when incompatible options are used (issue3663)
David Soria Parra <dsp@php.net>
parents:
17789
diff
changeset
|
933 raise util.Abort(_("--rev is incompatible with --rename")) |
19147
5b1835485442
bookmarks: allow bookmark command to take multiple arguments
Kevin Bullock <kbullock@ringworld.org>
parents:
19112
diff
changeset
|
934 if not names and (delete or rev): |
17791
1e30c1bbd8c0
bookmarks: simplify code
Kevin Bullock <kbullock@ringworld.org>
parents:
17790
diff
changeset
|
935 raise util.Abort(_("bookmark name required")) |
17790
0291e122fb05
bookmarks: abort when incompatible options are used (issue3663)
David Soria Parra <dsp@php.net>
parents:
17789
diff
changeset
|
936 |
20232
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
937 if delete or rename or names or inactive: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
938 wlock = repo.wlock() |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
939 try: |
20234
8a133190da89
commands.bookmarks: move cur initialization to inside wlock
Siddharth Agarwal <sid0@fb.com>
parents:
20233
diff
changeset
|
940 cur = repo.changectx('.').node() |
20232
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
941 marks = repo._bookmarks |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
942 if delete: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
943 for mark in names: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
944 if mark not in marks: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
945 raise util.Abort(_("bookmark '%s' does not exist") % |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
946 mark) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
947 if mark == repo._bookmarkcurrent: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
948 bookmarks.unsetcurrent(repo) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
949 del marks[mark] |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
950 marks.write() |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
951 |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
952 elif rename: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
953 if not names: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
954 raise util.Abort(_("new bookmark name required")) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
955 elif len(names) > 1: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
956 raise util.Abort(_("only one new bookmark name allowed")) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
957 mark = checkformat(names[0]) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
958 if rename not in marks: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
959 raise util.Abort(_("bookmark '%s' does not exist") % rename) |
20233
410193f11422
commands.bookmarks: pass cur in explicitly to checkconflict
Siddharth Agarwal <sid0@fb.com>
parents:
20232
diff
changeset
|
960 checkconflict(repo, mark, cur, force) |
20232
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
961 marks[mark] = marks[rename] |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
962 if repo._bookmarkcurrent == rename and not inactive: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
963 bookmarks.setcurrent(repo, mark) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
964 del marks[rename] |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
965 marks.write() |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
966 |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
967 elif names: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
968 newact = None |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
969 for mark in names: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
970 mark = checkformat(mark) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
971 if newact is None: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
972 newact = mark |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
973 if inactive and mark == repo._bookmarkcurrent: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
974 bookmarks.unsetcurrent(repo) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
975 return |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
976 tgt = cur |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
977 if rev: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
978 tgt = scmutil.revsingle(repo, rev).node() |
20233
410193f11422
commands.bookmarks: pass cur in explicitly to checkconflict
Siddharth Agarwal <sid0@fb.com>
parents:
20232
diff
changeset
|
979 checkconflict(repo, mark, cur, force, tgt) |
20232
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
980 marks[mark] = tgt |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
981 if not inactive and cur == marks[newact] and not rev: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
982 bookmarks.setcurrent(repo, newact) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
983 elif cur != tgt and newact == repo._bookmarkcurrent: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
984 bookmarks.unsetcurrent(repo) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
985 marks.write() |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
986 |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
987 elif inactive: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
988 if len(marks) == 0: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
989 ui.status(_("no bookmarks set\n")) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
990 elif not repo._bookmarkcurrent: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
991 ui.status(_("no active bookmark\n")) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
992 else: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
993 bookmarks.unsetcurrent(repo) |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
994 finally: |
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
995 wlock.release() |
17822
c284085d17a8
bookmarks: further flatten code
Kevin Bullock <kbullock@ringworld.org>
parents:
17821
diff
changeset
|
996 else: # show bookmarks |
20235
a602d2aca8bf
commands.bookmarks: move hexfn to inside list block
Siddharth Agarwal <sid0@fb.com>
parents:
20234
diff
changeset
|
997 hexfn = ui.debugflag and hex or short |
20232
5fe4c1a9dc34
commands.bookmarks: hold wlock for write operations
Siddharth Agarwal <sid0@fb.com>
parents:
20231
diff
changeset
|
998 marks = repo._bookmarks |
20231
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
999 if len(marks) == 0: |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1000 ui.status(_("no bookmarks set\n")) |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1001 else: |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1002 for bmark, n in sorted(marks.iteritems()): |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1003 current = repo._bookmarkcurrent |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1004 if bmark == current: |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1005 prefix, label = '*', 'bookmarks.current' |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1006 else: |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1007 prefix, label = ' ', '' |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1008 |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1009 if ui.quiet: |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1010 ui.write("%s\n" % bmark, label=label) |
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1011 else: |
21571
17da326fd041
bookmarks: properly align multi-byte characters
Matt Mackall <mpm@selenic.com>
parents:
21200
diff
changeset
|
1012 pad = " " * (25 - encoding.colwidth(bmark)) |
17da326fd041
bookmarks: properly align multi-byte characters
Matt Mackall <mpm@selenic.com>
parents:
21200
diff
changeset
|
1013 ui.write(" %s %s%s %d:%s\n" % ( |
17da326fd041
bookmarks: properly align multi-byte characters
Matt Mackall <mpm@selenic.com>
parents:
21200
diff
changeset
|
1014 prefix, bmark, pad, repo.changelog.rev(n), hexfn(n)), |
20231
1053f5a7bbc6
commands.bookmarks: separate out 'no bookmarks set' status messages
Siddharth Agarwal <sid0@fb.com>
parents:
20227
diff
changeset
|
1015 label=label) |
13368
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
1016 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1017 @command('branch', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1018 [('f', 'force', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1019 _('set branch name even if it shadows an existing branch')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1020 ('C', 'clean', None, _('reset branch name to parent branch name'))], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1021 _('[-fC] [NAME]')) |
4202
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
1022 def branch(ui, repo, label=None, **opts): |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
1023 """set or show the current branch name |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
1024 |
15610
09b200396384
branch: move note about permanence to the top, add 'global'
Matt Mackall <mpm@selenic.com>
parents:
15511
diff
changeset
|
1025 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
1026 |
15610
09b200396384
branch: move note about permanence to the top, add 'global'
Matt Mackall <mpm@selenic.com>
parents:
15511
diff
changeset
|
1027 Branch names are permanent and global. Use :hg:`bookmark` to create a |
09b200396384
branch: move note about permanence to the top, add 'global'
Matt Mackall <mpm@selenic.com>
parents:
15511
diff
changeset
|
1028 light-weight bookmark instead. See :hg:`help glossary` for more |
09b200396384
branch: move note about permanence to the top, add 'global'
Matt Mackall <mpm@selenic.com>
parents:
15511
diff
changeset
|
1029 information about named branches and bookmarks. |
09b200396384
branch: move note about permanence to the top, add 'global'
Matt Mackall <mpm@selenic.com>
parents:
15511
diff
changeset
|
1030 |
4601
e69da61e467e
Notify the user that hg branch does not create a branch until commit
Brendan Cully <brendan@kublai.com>
parents:
4593
diff
changeset
|
1031 With no argument, show the current branch name. With one argument, |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
1032 set the working directory branch name (the branch will not exist |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
1033 in the repository until the next commit). Standard practice |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
1034 recommends that primary development take place on the 'default' |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
1035 branch. |
4202
b2873c587b1a
branch: require --force to shadow existing branches
Brendan Cully <brendan@kublai.com>
parents:
4200
diff
changeset
|
1036 |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
1037 Unless -f/--force is specified, branch will not let you set a |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
1038 branch name that already exists, even if it's inactive. |
5999
d1fe1a4eb2b7
Mention 'hg update' to switch branches in help for branch and branches.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
5998
diff
changeset
|
1039 |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
1040 Use -C/--clean to reset the working directory branch to that of |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
1041 the parent of the working directory, negating a previous branch |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
1042 change. |
7006
92d44ec32430
branch: added more support for named branches
Sune Foldager <cryo@cyanite.org>
parents:
7003
diff
changeset
|
1043 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
1044 Use the command :hg:`update` to switch to an existing branch. Use |
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
1045 :hg:`commit --close-branch` to mark this branch as closed. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1046 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1047 Returns 0 on success. |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
1048 """ |
19180
12dbdd348bb0
branch: strip whitespace before testing known branch name
Yuya Nishihara <yuya@tcha.org>
parents:
19112
diff
changeset
|
1049 if label: |
12dbdd348bb0
branch: strip whitespace before testing known branch name
Yuya Nishihara <yuya@tcha.org>
parents:
19112
diff
changeset
|
1050 label = label.strip() |
12dbdd348bb0
branch: strip whitespace before testing known branch name
Yuya Nishihara <yuya@tcha.org>
parents:
19112
diff
changeset
|
1051 |
16471
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1052 if not opts.get('clean') and not label: |
13047
6c375e07d673
branch: operate on branch names in local string space where possible
Matt Mackall <mpm@selenic.com>
parents:
13022
diff
changeset
|
1053 ui.write("%s\n" % repo.dirstate.branch()) |
16471
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1054 return |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1055 |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1056 wlock = repo.wlock() |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1057 try: |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1058 if opts.get('clean'): |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1059 label = repo[None].p1().branch() |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1060 repo.dirstate.setbranch(label) |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1061 ui.status(_('reset working directory to branch %s\n') % label) |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1062 elif label: |
16719
e7bf09acd410
localrepo: add branchtip() method for faster single-branch lookups
Brodie Rao <brodie@sf.io>
parents:
16715
diff
changeset
|
1063 if not opts.get('force') and label in repo.branchmap(): |
16471
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1064 if label not in [p.branch() for p in repo.parents()]: |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1065 raise util.Abort(_('a branch of the same name already' |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1066 ' exists'), |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1067 # i18n: "it" refers to an existing branch |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1068 hint=_("use 'hg update' to switch to it")) |
17990
8216eb592dcd
branch: add missing repo argument to checknewlabel
Tim Henigan <tim.henigan@gmail.com>
parents:
17986
diff
changeset
|
1069 scmutil.checknewlabel(repo, label, 'branch') |
16471
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1070 repo.dirstate.setbranch(label) |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1071 ui.status(_('marked working directory as branch %s\n') % label) |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1072 ui.status(_('(branches are permanent and global, ' |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1073 'did you want a bookmark?)\n')) |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1074 finally: |
85c7602e283a
commands: add missing wlock to branch
Idan Kamara <idankk86@gmail.com>
parents:
16470
diff
changeset
|
1075 wlock.release() |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
1076 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1077 @command('branches', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1078 [('a', 'active', False, _('show only branches that have unmerged heads')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1079 ('c', 'closed', False, _('show normal and closed branches'))], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1080 _('[-ac]')) |
8991
7e0b31dfc66f
branches: add --closed flag for consistency with heads
Matt Mackall <mpm@selenic.com>
parents:
8958
diff
changeset
|
1081 def branches(ui, repo, active=False, closed=False): |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
1082 """list repository named branches |
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
1083 |
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
|
1084 List the repository's named branches, indicating which ones are |
8991
7e0b31dfc66f
branches: add --closed flag for consistency with heads
Matt Mackall <mpm@selenic.com>
parents:
8958
diff
changeset
|
1085 inactive. If -c/--closed is specified, also list branches which have |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
1086 been marked closed (see :hg:`commit --close-branch`). |
8991
7e0b31dfc66f
branches: add --closed flag for consistency with heads
Matt Mackall <mpm@selenic.com>
parents:
8958
diff
changeset
|
1087 |
7e0b31dfc66f
branches: add --closed flag for consistency with heads
Matt Mackall <mpm@selenic.com>
parents:
8958
diff
changeset
|
1088 If -a/--active is specified, only show active branches. A branch |
7e0b31dfc66f
branches: add --closed flag for consistency with heads
Matt Mackall <mpm@selenic.com>
parents:
8958
diff
changeset
|
1089 is considered active if it contains repository 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
|
1090 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
1091 Use the command :hg:`update` to switch to an existing branch. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1092 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1093 Returns 0. |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
1094 """ |
8991
7e0b31dfc66f
branches: add --closed flag for consistency with heads
Matt Mackall <mpm@selenic.com>
parents:
8958
diff
changeset
|
1095 |
6631
a2b13cac0922
Active branches fix (issue1104)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6625
diff
changeset
|
1096 hexfunc = ui.debugflag and hex or short |
16721
3e6d59ae4dc2
branches: improve performance by removing redundant operations
Brodie Rao <brodie@sf.io>
parents:
16720
diff
changeset
|
1097 |
20182
04036798ebed
branches: avoid unnecessary changectx.branch() calls
Brodie Rao <brodie@sf.io>
parents:
20156
diff
changeset
|
1098 allheads = set(repo.heads()) |
16721
3e6d59ae4dc2
branches: improve performance by removing redundant operations
Brodie Rao <brodie@sf.io>
parents:
16720
diff
changeset
|
1099 branches = [] |
20192
38fad5e76ee8
branches: simplify with repo.branchmap().iterbranches()
Brodie Rao <brodie@sf.io>
parents:
20191
diff
changeset
|
1100 for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): |
38fad5e76ee8
branches: simplify with repo.branchmap().iterbranches()
Brodie Rao <brodie@sf.io>
parents:
20191
diff
changeset
|
1101 isactive = not isclosed and bool(set(heads) & allheads) |
38fad5e76ee8
branches: simplify with repo.branchmap().iterbranches()
Brodie Rao <brodie@sf.io>
parents:
20191
diff
changeset
|
1102 branches.append((tag, repo[tip], isactive, not isclosed)) |
20182
04036798ebed
branches: avoid unnecessary changectx.branch() calls
Brodie Rao <brodie@sf.io>
parents:
20156
diff
changeset
|
1103 branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]), |
16721
3e6d59ae4dc2
branches: improve performance by removing redundant operations
Brodie Rao <brodie@sf.io>
parents:
16720
diff
changeset
|
1104 reverse=True) |
3e6d59ae4dc2
branches: improve performance by removing redundant operations
Brodie Rao <brodie@sf.io>
parents:
16720
diff
changeset
|
1105 |
20182
04036798ebed
branches: avoid unnecessary changectx.branch() calls
Brodie Rao <brodie@sf.io>
parents:
20156
diff
changeset
|
1106 for tag, ctx, isactive, isopen in branches: |
6631
a2b13cac0922
Active branches fix (issue1104)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents:
6625
diff
changeset
|
1107 if (not active) or isactive: |
16612
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1108 if isactive: |
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1109 label = 'branches.active' |
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1110 notice = '' |
16721
3e6d59ae4dc2
branches: improve performance by removing redundant operations
Brodie Rao <brodie@sf.io>
parents:
16720
diff
changeset
|
1111 elif not isopen: |
16612
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1112 if not closed: |
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1113 continue |
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1114 label = 'branches.closed' |
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1115 notice = _(' (closed)') |
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1116 else: |
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1117 label = 'branches.inactive' |
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1118 notice = _(' (inactive)') |
20182
04036798ebed
branches: avoid unnecessary changectx.branch() calls
Brodie Rao <brodie@sf.io>
parents:
20156
diff
changeset
|
1119 if tag == repo.dirstate.branch(): |
16612
726dd0fc7cfe
branches: quiet option observes other parameters
Travis Herrick <tthetoad@gmail.com>
parents:
16603
diff
changeset
|
1120 label = 'branches.current' |
20182
04036798ebed
branches: avoid unnecessary changectx.branch() calls
Brodie Rao <brodie@sf.io>
parents:
20156
diff
changeset
|
1121 rev = str(ctx.rev()).rjust(31 - encoding.colwidth(tag)) |
16721
3e6d59ae4dc2
branches: improve performance by removing redundant operations
Brodie Rao <brodie@sf.io>
parents:
16720
diff
changeset
|
1122 rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())), |
17788
9912baaae7df
color: add additional changeset.phase label to log.changeset and log.parent
Sean Farley <sean.michael.farley@gmail.com>
parents:
17773
diff
changeset
|
1123 'log.changeset changeset.%s' % ctx.phasestr()) |
20182
04036798ebed
branches: avoid unnecessary changectx.branch() calls
Brodie Rao <brodie@sf.io>
parents:
20156
diff
changeset
|
1124 labeledtag = ui.label(tag, label) |
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
|
1125 if ui.quiet: |
20182
04036798ebed
branches: avoid unnecessary changectx.branch() calls
Brodie Rao <brodie@sf.io>
parents:
20156
diff
changeset
|
1126 ui.write("%s\n" % labeledtag) |
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
|
1127 else: |
20182
04036798ebed
branches: avoid unnecessary changectx.branch() calls
Brodie Rao <brodie@sf.io>
parents:
20156
diff
changeset
|
1128 ui.write("%s %s%s\n" % (labeledtag, rev, notice)) |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3472
diff
changeset
|
1129 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1130 @command('bundle', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1131 [('f', 'force', None, _('run even when the destination is unrelated')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1132 ('r', 'rev', [], _('a changeset intended to be added to the destination'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1133 _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1134 ('b', 'branch', [], _('a specific branch you would like to bundle'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1135 _('BRANCH')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1136 ('', 'base', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1137 _('a base changeset assumed to be available at the destination'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1138 _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1139 ('a', 'all', None, _('bundle all changesets in the repository')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1140 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1141 ] + remoteopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1142 _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')) |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
1143 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
|
1144 """create a changegroup file |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1145 |
3511
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
1146 Generate a compressed changegroup file collecting changesets not |
7807
bd8f44638847
help: miscellaneous language fixes
timeless <timeless@gmail.com>
parents:
7765
diff
changeset
|
1147 known to be in another repository. |
3511
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
1148 |
10376 | 1149 If you omit the destination repository, then hg assumes the |
1150 destination will have all the nodes you specify with --base | |
6448
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
1151 parameters. To create a bundle containing all changesets, use |
8903
d403cf4eb32d
help: describe bundle compression methods (issue1523)
Henrik Stuart <hg@hstuart.dk>
parents:
8902
diff
changeset
|
1152 -a/--all (or --base null). |
d403cf4eb32d
help: describe bundle compression methods (issue1523)
Henrik Stuart <hg@hstuart.dk>
parents:
8902
diff
changeset
|
1153 |
8958
8358cf63f612
commands: improve bundle compression methods description
Stefano Mioli <jstevie@gmail.com>
parents:
8955
diff
changeset
|
1154 You can change compression method with the -t/--type option. |
8358cf63f612
commands: improve bundle compression methods description
Stefano Mioli <jstevie@gmail.com>
parents:
8955
diff
changeset
|
1155 The available compression methods are: none, bzip2, and |
8903
d403cf4eb32d
help: describe bundle compression methods (issue1523)
Henrik Stuart <hg@hstuart.dk>
parents:
8902
diff
changeset
|
1156 gzip (by default, bundles are compressed using bzip2). |
3511
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
1157 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
1158 The bundle file can then be transferred using conventional means |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
1159 and applied to another repository with the unbundle or pull |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
1160 command. This is useful when direct push and pull are not |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
1161 available or when exporting an entire repository is undesirable. |
3511
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
1162 |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
1163 Applying bundles preserves all changeset contents including |
aa8f086cb141
Corrected help text for bundle.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3510
diff
changeset
|
1164 permissions, copy/rename information, and revision history. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1165 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1166 Returns 0 on success, 1 if no changes found. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1167 """ |
12925
6eab8f0df2ca
commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents:
12918
diff
changeset
|
1168 revs = None |
6eab8f0df2ca
commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents:
12918
diff
changeset
|
1169 if 'rev' in opts: |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
1170 revs = scmutil.revrange(repo, opts['rev']) |
12925
6eab8f0df2ca
commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents:
12918
diff
changeset
|
1171 |
16427
d54d4de56aa7
commands: move bundle type validation earlier
Bryan O'Sullivan <bryano@fb.com>
parents:
16389
diff
changeset
|
1172 bundletype = opts.get('type', 'bzip2').lower() |
d54d4de56aa7
commands: move bundle type validation earlier
Bryan O'Sullivan <bryano@fb.com>
parents:
16389
diff
changeset
|
1173 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} |
d54d4de56aa7
commands: move bundle type validation earlier
Bryan O'Sullivan <bryano@fb.com>
parents:
16389
diff
changeset
|
1174 bundletype = btypes.get(bundletype) |
d54d4de56aa7
commands: move bundle type validation earlier
Bryan O'Sullivan <bryano@fb.com>
parents:
16389
diff
changeset
|
1175 if bundletype not in changegroup.bundletypes: |
d54d4de56aa7
commands: move bundle type validation earlier
Bryan O'Sullivan <bryano@fb.com>
parents:
16389
diff
changeset
|
1176 raise util.Abort(_('unknown bundle type specified with --type')) |
d54d4de56aa7
commands: move bundle type validation earlier
Bryan O'Sullivan <bryano@fb.com>
parents:
16389
diff
changeset
|
1177 |
6171
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
1178 if opts.get('all'): |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
1179 base = ['null'] |
73b1de288801
Add --all option to bundle command
John Mulligan <phlogistonjohn@yahoo.com>
parents:
6163
diff
changeset
|
1180 else: |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
1181 base = scmutil.revrange(repo, opts.get('base')) |
19201
309c439cdbaa
bundle-ng: add bundlecaps argument to getbundle() command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
19184
diff
changeset
|
1182 # TODO: get desired bundlecaps from command line. |
309c439cdbaa
bundle-ng: add bundlecaps argument to getbundle() command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
19184
diff
changeset
|
1183 bundlecaps = None |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
1184 if base: |
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
1185 if dest: |
8669
6f0f69da003e
commands: typo in bundle abort message
Martin Geisler <mg@lazybytes.net>
parents:
8664
diff
changeset
|
1186 raise util.Abort(_("--base is incompatible with specifying " |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
1187 "a destination")) |
14073
72c84f24b420
discovery: drop findoutgoing and simplify findcommonincoming's api
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14064
diff
changeset
|
1188 common = [repo.lookup(rev) for rev in base] |
15837
cd956049fc14
discovery: introduce outgoing object for result of findcommonoutgoing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15836
diff
changeset
|
1189 heads = revs and map(repo.lookup, revs) or revs |
22390
e2806b8613ca
changegroup: rename bundle-related functions and classes
Sune Foldager <cryo@cyanite.org>
parents:
22383
diff
changeset
|
1190 cg = changegroup.getchangegroup(repo, 'bundle', heads=heads, |
e2806b8613ca
changegroup: rename bundle-related functions and classes
Sune Foldager <cryo@cyanite.org>
parents:
22383
diff
changeset
|
1191 common=common, bundlecaps=bundlecaps) |
15993
0b05e0bfdc1c
scmutil: unify some 'no changes found' messages
Matt Mackall <mpm@selenic.com>
parents:
15991
diff
changeset
|
1192 outgoing = None |
3284
d89e98840b08
add -r/--rev and --base option to bundle
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3278
diff
changeset
|
1193 else: |
10365
d757bc0c7865
interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
10364
diff
changeset
|
1194 dest = ui.expandpath(dest or 'default-push', dest or 'default') |
10379
a78bfaf988e1
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
Sune Foldager <cryo@cyanite.org>
parents:
10376
diff
changeset
|
1195 dest, branches = hg.parseurl(dest, opts.get('branch')) |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
1196 other = hg.peer(repo, opts, dest) |
18701
61c8327ced50
bundle: treat branches created newly on the local correctly (issue3828)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18657
diff
changeset
|
1197 revs, checkout = hg.addbranchrevs(repo, repo, branches, revs) |
14213
30273f0c776b
discovery: resurrect findoutgoing as findcommonoutgoing for extension hooks
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14198
diff
changeset
|
1198 heads = revs and map(repo.lookup, revs) or revs |
15837
cd956049fc14
discovery: introduce outgoing object for result of findcommonoutgoing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15836
diff
changeset
|
1199 outgoing = discovery.findcommonoutgoing(repo, other, |
cd956049fc14
discovery: introduce outgoing object for result of findcommonoutgoing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15836
diff
changeset
|
1200 onlyheads=heads, |
16736
025b3b763ba9
bundle: make bundles more portable (isue3441)
Sune Foldager <cryo@cyanite.org>
parents:
16637
diff
changeset
|
1201 force=opts.get('force'), |
025b3b763ba9
bundle: make bundles more portable (isue3441)
Sune Foldager <cryo@cyanite.org>
parents:
16637
diff
changeset
|
1202 portable=True) |
22390
e2806b8613ca
changegroup: rename bundle-related functions and classes
Sune Foldager <cryo@cyanite.org>
parents:
22383
diff
changeset
|
1203 cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing, |
e2806b8613ca
changegroup: rename bundle-related functions and classes
Sune Foldager <cryo@cyanite.org>
parents:
22383
diff
changeset
|
1204 bundlecaps) |
14073
72c84f24b420
discovery: drop findoutgoing and simplify findcommonincoming's api
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14064
diff
changeset
|
1205 if not cg: |
17248
6ffb35b2284c
discovery: add extinct changesets to outgoing.excluded
Patrick Mezard <patrick@mezard.eu>
parents:
17218
diff
changeset
|
1206 scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded) |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1207 return 1 |
10616
65b178f30eae
bundle: fix bundle generation for empty changegroup
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10596
diff
changeset
|
1208 |
6570
626cb86a6523
add compression type type parameter to bundle command
Benoit Allard <benoit@aeteurope.nl>
parents:
6518
diff
changeset
|
1209 changegroup.writebundle(cg, fname, bundletype) |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
1210 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1211 @command('cat', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1212 [('o', 'output', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1213 _('print output to file with formatted name'), _('FORMAT')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1214 ('r', 'rev', '', _('print the given revision'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1215 ('', 'decode', None, _('apply any matching decode filter')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1216 ] + walkopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
1217 _('[OPTION]... FILE...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
1218 inferrepo=True) |
1254
e6560042b7b8
Switch cat command to use walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1253
diff
changeset
|
1219 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
|
1220 """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
|
1221 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
1222 Print the specified files as they were at the given revision. If |
19400
61c93ef8302e
cat: remove incorrect reference to tip
Matt Mackall <mpm@selenic.com>
parents:
19394
diff
changeset
|
1223 no revision is given, the parent of the working directory is used. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1224 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1225 Output may be to a file, in which case the name of the file is |
21078
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
21064
diff
changeset
|
1226 given using a format string. The formatting rules as follows: |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
21064
diff
changeset
|
1227 |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
21064
diff
changeset
|
1228 :``%%``: literal "%" character |
9892
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
1229 :``%s``: basename of file being printed |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
1230 :``%d``: dirname of file being printed, or '.' if in repository root |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
1231 :``%p``: root-relative path name of file being printed |
21078
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
21064
diff
changeset
|
1232 :``%H``: changeset hash (40 hexadecimal digits) |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
21064
diff
changeset
|
1233 :``%R``: changeset revision number |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
21064
diff
changeset
|
1234 :``%h``: short-form changeset hash (12 hexadecimal digits) |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
21064
diff
changeset
|
1235 :``%r``: zero-padded changeset revision number |
50107a4b32e7
cat: explicitly document the supported formatter rules
Matt Harbison <matt_harbison@yahoo.com>
parents:
21064
diff
changeset
|
1236 :``%b``: basename of the exporting repository |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1237 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1238 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1239 """ |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
1240 ctx = scmutil.revsingle(repo, opts.get('rev')) |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
1241 m = scmutil.match(ctx, (file1,) + pats, opts) |
20293
2f6b3900be64
cat: increase perf when catting single files
Durham Goode <durham@fb.com>
parents:
20282
diff
changeset
|
1242 |
21041
a2cc3c08c3ac
cat: support cat with explicit paths in subrepos
Matt Harbison <matt_harbison@yahoo.com>
parents:
21040
diff
changeset
|
1243 return cmdutil.cat(ui, repo, ctx, m, '', **opts) |
248 | 1244 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1245 @command('^clone', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1246 [('U', 'noupdate', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1247 _('the clone will include an empty working copy (only a repository)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1248 ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1249 ('r', 'rev', [], _('include the specified changeset'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1250 ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1251 ('', 'pull', None, _('use pull protocol to copy metadata')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1252 ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1253 ] + remoteopts, |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1254 _('[OPTION]... SOURCE [DEST]'), |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1255 norepo=True) |
698
df78d8ccac4c
Use python function instead of external 'cp' command when cloning repos.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
697
diff
changeset
|
1256 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
|
1257 """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
|
1258 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1259 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
|
1260 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1261 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
|
1262 basename of the source. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1263 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1264 The location of the source is added to the new repository's |
13344
6367459decf7
doc: Add back quotes around filenames
Javi Merino <cibervicho@gmail.com>
parents:
13343
diff
changeset
|
1265 ``.hg/hgrc`` file, as the default to be used for future pulls. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1266 |
15177
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1267 Only local paths and ``ssh://`` URLs are supported as |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1268 destinations. For ``ssh://`` destinations, no working directory or |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1269 ``.hg/hgrc`` will be created on the remote side. |
7942
553cef16031f
mention default branch in branch and clone help
Matt Mackall <mpm@selenic.com>
parents:
7880
diff
changeset
|
1270 |
15174
9f1a08c00931
clone: improve help on -r/-b and tags
Matt Mackall <mpm@selenic.com>
parents:
15147
diff
changeset
|
1271 To pull only a subset of changesets, specify one or more revisions |
9f1a08c00931
clone: improve help on -r/-b and tags
Matt Mackall <mpm@selenic.com>
parents:
15147
diff
changeset
|
1272 identifiers with -r/--rev or branches with -b/--branch. The |
9f1a08c00931
clone: improve help on -r/-b and tags
Matt Mackall <mpm@selenic.com>
parents:
15147
diff
changeset
|
1273 resulting clone will contain only the specified changesets and |
9f1a08c00931
clone: improve help on -r/-b and tags
Matt Mackall <mpm@selenic.com>
parents:
15147
diff
changeset
|
1274 their ancestors. These options (or 'clone src#rev dest') imply |
9f1a08c00931
clone: improve help on -r/-b and tags
Matt Mackall <mpm@selenic.com>
parents:
15147
diff
changeset
|
1275 --pull, even for local source repositories. Note that specifying a |
9f1a08c00931
clone: improve help on -r/-b and tags
Matt Mackall <mpm@selenic.com>
parents:
15147
diff
changeset
|
1276 tag will include the tagged changeset but not the changeset |
9f1a08c00931
clone: improve help on -r/-b and tags
Matt Mackall <mpm@selenic.com>
parents:
15147
diff
changeset
|
1277 containing the tag. |
9714
2f1ab7f77ddc
clone: add option -u/--updaterev
Adrian Buehlmann <adrian@cadifra.com>
parents:
9698
diff
changeset
|
1278 |
18474
e031e10cdc06
help: document '@' bookmark in 'help bookmarks' and 'help clone'
Kevin Bullock <kbullock@ringworld.org>
parents:
18471
diff
changeset
|
1279 If the source repository has a bookmark called '@' set, that |
e031e10cdc06
help: document '@' bookmark in 'help bookmarks' and 'help clone'
Kevin Bullock <kbullock@ringworld.org>
parents:
18471
diff
changeset
|
1280 revision will be checked out in the new repository by default. |
e031e10cdc06
help: document '@' bookmark in 'help bookmarks' and 'help clone'
Kevin Bullock <kbullock@ringworld.org>
parents:
18471
diff
changeset
|
1281 |
15178
04e5449e25dc
clone: add a note about -u/-U
Matt Mackall <mpm@selenic.com>
parents:
15177
diff
changeset
|
1282 To check out a particular version, use -u/--update, or |
04e5449e25dc
clone: add a note about -u/-U
Matt Mackall <mpm@selenic.com>
parents:
15177
diff
changeset
|
1283 -U/--noupdate to create a clone with no working directory. |
04e5449e25dc
clone: add a note about -u/-U
Matt Mackall <mpm@selenic.com>
parents:
15177
diff
changeset
|
1284 |
15177
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1285 .. container:: verbose |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1286 |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1287 For efficiency, hardlinks are used for cloning whenever the |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1288 source and destination are on the same filesystem (note this |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1289 applies only to the repository data, not to the working |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1290 directory). Some filesystems, such as AFS, implement hardlinking |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1291 incorrectly, but do not report errors. In these cases, use the |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1292 --pull option to avoid hardlinking. |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1293 |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1294 In some cases, you can clone repositories and the working |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1295 directory using full hardlinks with :: |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1296 |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1297 $ cp -al REPO REPOCLONE |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1298 |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1299 This is the fastest way to clone, but it is not always safe. The |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1300 operation is not atomic (making sure REPO is not modified during |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1301 the operation is up to you) and you have to make sure your |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1302 editor breaks hardlinks (Emacs and most Linux Kernel tools do |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1303 so). Also, this is not compatible with certain extensions that |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1304 place their metadata under the .hg directory, such as mq. |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1305 |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1306 Mercurial will update the working directory to the first applicable |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1307 revision from this list: |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1308 |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1309 a) null if -U or the source repository has no changesets |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1310 b) if -u . and the source repository is local, the first parent of |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1311 the source repository's working directory |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1312 c) the changeset specified with -u (if a branch name, this means the |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1313 latest head of that branch) |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1314 d) the changeset specified with -r |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1315 e) the tipmost head specified with -b |
1c57d8b38d5a
clone: move portions of help into the verbose section
Matt Mackall <mpm@selenic.com>
parents:
15175
diff
changeset
|
1316 f) the tipmost head specified with the url#branch source syntax |
18476
1fb9890c55bd
help: update verbose 'clone' help to include '@' bookmark
Kevin Bullock <kbullock@ringworld.org>
parents:
18474
diff
changeset
|
1317 g) the revision marked with the '@' bookmark, if present |
1fb9890c55bd
help: update verbose 'clone' help to include '@' bookmark
Kevin Bullock <kbullock@ringworld.org>
parents:
18474
diff
changeset
|
1318 h) the tipmost head of the default branch |
1fb9890c55bd
help: update verbose 'clone' help to include '@' bookmark
Kevin Bullock <kbullock@ringworld.org>
parents:
18474
diff
changeset
|
1319 i) tip |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1320 |
15179 | 1321 Examples: |
1322 | |
1323 - clone a remote repository to a new directory named hg/:: | |
1324 | |
1325 hg clone http://selenic.com/hg | |
1326 | |
1327 - create a lightweight local clone:: | |
1328 | |
1329 hg clone project/ project-feature/ | |
1330 | |
1331 - clone from an absolute path on an ssh server (note double-slash):: | |
1332 | |
1333 hg clone ssh://user@server//home/projects/alpha/ | |
1334 | |
1335 - do a high-speed clone over a LAN while checking out a | |
1336 specified version:: | |
1337 | |
1338 hg clone --uncompressed http://server/repo -u 1.5 | |
1339 | |
1340 - create a repository without changesets after a particular revision:: | |
1341 | |
1342 hg clone -r 04e544 experimental/ good/ | |
1343 | |
1344 - clone (and track) a particular named branch:: | |
1345 | |
1346 hg clone http://selenic.com/hg#stable | |
1347 | |
15175
282db9102c43
clone: move url crossref to bottom
Matt Mackall <mpm@selenic.com>
parents:
15174
diff
changeset
|
1348 See :hg:`help urls` for details on specifying URLs. |
282db9102c43
clone: move url crossref to bottom
Matt Mackall <mpm@selenic.com>
parents:
15174
diff
changeset
|
1349 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1350 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1351 """ |
9714
2f1ab7f77ddc
clone: add option -u/--updaterev
Adrian Buehlmann <adrian@cadifra.com>
parents:
9698
diff
changeset
|
1352 if opts.get('noupdate') and opts.get('updaterev'): |
2f1ab7f77ddc
clone: add option -u/--updaterev
Adrian Buehlmann <adrian@cadifra.com>
parents:
9698
diff
changeset
|
1353 raise util.Abort(_("cannot specify both --noupdate and --updaterev")) |
2f1ab7f77ddc
clone: add option -u/--updaterev
Adrian Buehlmann <adrian@cadifra.com>
parents:
9698
diff
changeset
|
1354 |
14553
d976542986d2
hg: add opts argument to clone for internal remoteui
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14551
diff
changeset
|
1355 r = hg.clone(ui, opts, source, dest, |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1356 pull=opts.get('pull'), |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1357 stream=opts.get('uncompressed'), |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1358 rev=opts.get('rev'), |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1359 update=opts.get('updaterev') or not opts.get('noupdate'), |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1360 branch=opts.get('branch')) |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1361 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1362 return r is None |
515 | 1363 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1364 @command('^commit|ci', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1365 [('A', 'addremove', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1366 _('mark new/missing files as added/removed before committing')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1367 ('', 'close-branch', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1368 _('mark a branch as closed, hiding it from the branch list')), |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1369 ('', 'amend', None, _('amend the parent of the working dir')), |
19440
4a0d0616c47d
commit: enable --secret option
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19439
diff
changeset
|
1370 ('s', 'secret', None, _('use the secret phase for committing')), |
21952
3838b910fa6b
doc: unify help text for "--edit" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21951
diff
changeset
|
1371 ('e', 'edit', None, _('invoke editor on commit messages')), |
15321
e174353e8cda
subrepos: abort commit by default if a subrepo is dirty (BC)
Martin Geisler <mg@lazybytes.net>
parents:
15307
diff
changeset
|
1372 ] + walkopts + commitopts + commitopts2 + subrepoopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
1373 _('[OPTION]... [FILE]...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
1374 inferrepo=True) |
813
80fd2958235a
Adapt commit to use file matching code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
812
diff
changeset
|
1375 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
|
1376 """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
|
1377 |
7983
7b813bdbd5d0
Change double spaces to single spaces in help texts.
Martin Geisler <mg@daimi.au.dk>
parents:
7982
diff
changeset
|
1378 Commit changes to the given files into the repository. Unlike a |
13303
716ce1ea6fec
commit: use the term SCM instead of RCS
Adrian Buehlmann <adrian@cadifra.com>
parents:
13235
diff
changeset
|
1379 centralized SCM, this operation is a local operation. See |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
1380 :hg:`push` for a way to actively distribute your changes. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1381 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
1382 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
|
1383 will be committed. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1384 |
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
|
1385 If you are committing the result of a merge, do not provide any |
8761
0289f384e1e5
Generally replace "file name" with "filename" in help and comments.
timeless <timeless@gmail.com>
parents:
8760
diff
changeset
|
1386 filenames or -I/-X filters. |
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
|
1387 |
11877
8f40125a0ed8
commit: explicitly document the existence of "last-message.txt"
Greg Ward <greg-hg@gerg.ca>
parents:
11836
diff
changeset
|
1388 If no commit message is specified, Mercurial starts your |
8f40125a0ed8
commit: explicitly document the existence of "last-message.txt"
Greg Ward <greg-hg@gerg.ca>
parents:
11836
diff
changeset
|
1389 configured editor where you can enter a message. In case your |
8f40125a0ed8
commit: explicitly document the existence of "last-message.txt"
Greg Ward <greg-hg@gerg.ca>
parents:
11836
diff
changeset
|
1390 commit fails, you will find a backup of your message in |
8f40125a0ed8
commit: explicitly document the existence of "last-message.txt"
Greg Ward <greg-hg@gerg.ca>
parents:
11836
diff
changeset
|
1391 ``.hg/last-message.txt``. |
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
|
1392 |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1393 The --amend flag can be used to amend the parent of the |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1394 working directory with a new commit that contains the changes |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1395 in the parent in addition to those currently reported by :hg:`status`, |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1396 if there are any. The old commit is stored in a backup bundle in |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1397 ``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle` |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1398 on how to restore it). |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1399 |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1400 Message, user and date are taken from the amended commit unless |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1401 specified. When a message isn't specified on the command line, |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1402 the editor will open with the message of the amended commit. |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1403 |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1404 It is not possible to amend public changesets (see :hg:`help phases`) |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1405 or changesets that have children. |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1406 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
1407 See :hg:`help dates` for a list of formats valid for -d/--date. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1408 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1409 Returns 0 on success, 1 if nothing changed. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1410 """ |
15321
e174353e8cda
subrepos: abort commit by default if a subrepo is dirty (BC)
Martin Geisler <mg@lazybytes.net>
parents:
15307
diff
changeset
|
1411 if opts.get('subrepos'): |
19232
b592fd33233a
amend: complain more comprehensibly about subrepos
Matt Mackall <mpm@selenic.com>
parents:
19217
diff
changeset
|
1412 if opts.get('amend'): |
b592fd33233a
amend: complain more comprehensibly about subrepos
Matt Mackall <mpm@selenic.com>
parents:
19217
diff
changeset
|
1413 raise util.Abort(_('cannot amend with --subrepos')) |
17504 | 1414 # Let --subrepos on the command line override config setting. |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
1415 ui.setconfig('ui', 'commitsubrepos', True, 'commit') |
15321
e174353e8cda
subrepos: abort commit by default if a subrepo is dirty (BC)
Martin Geisler <mg@lazybytes.net>
parents:
15307
diff
changeset
|
1416 |
19496
607191a45f8c
checkunfinished: accommodate histedit quirk
Matt Mackall <mpm@selenic.com>
parents:
19493
diff
changeset
|
1417 cmdutil.checkunfinished(repo, commit=True) |
19253
e078ea9b4ce4
graft: refuse to commit an interrupted graft (issue3667)
Simon King <simon@simonking.org.uk>
parents:
19232
diff
changeset
|
1418 |
19305
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1419 branch = repo[None].branch() |
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1420 bheads = repo.branchheads(branch) |
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1421 |
7655
cce37dab7ad6
branch closing: mark closed branches with a 'close' extra
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
7643
diff
changeset
|
1422 extra = {} |
cce37dab7ad6
branch closing: mark closed branches with a 'close' extra
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
7643
diff
changeset
|
1423 if opts.get('close_branch'): |
cce37dab7ad6
branch closing: mark closed branches with a 'close' extra
John Mulligan <phlogistonjohn@asynchrono.us>
parents:
7643
diff
changeset
|
1424 extra['close'] = 1 |
6336
4b0c9c674707
warn about new heads on commit (issue842)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6321
diff
changeset
|
1425 |
19305
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1426 if not bheads: |
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1427 raise util.Abort(_('can only close branch heads')) |
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1428 elif opts.get('amend'): |
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1429 if repo.parents()[0].p1().branch() != branch and \ |
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1430 repo.parents()[0].p2().branch() != branch: |
b500a663a2c7
commit: amending with --close-branch (issue3445)
Iulian Stana <julian.stana@gmail.com>
parents:
19253
diff
changeset
|
1431 raise util.Abort(_('can only close branch heads')) |
11173
5b48d819d5f9
commit: note new branch heads rather than topological heads
Matt Mackall <mpm@selenic.com>
parents:
11169
diff
changeset
|
1432 |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1433 if opts.get('amend'): |
16505
db85c24dcdea
commit: use ui.configbool when checking 'commitsubrepos' setting on --amend
Adrian Buehlmann <adrian@cadifra.com>
parents:
16491
diff
changeset
|
1434 if ui.configbool('ui', 'commitsubrepos'): |
19232
b592fd33233a
amend: complain more comprehensibly about subrepos
Matt Mackall <mpm@selenic.com>
parents:
19217
diff
changeset
|
1435 raise util.Abort(_('cannot amend with ui.commitsubrepos enabled')) |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1436 |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1437 old = repo['.'] |
22417
ca854cd4a26a
commit: correctly check commit mutability during commit --amend
Augie Fackler <raf@durin42.com>
parents:
22405
diff
changeset
|
1438 if not old.mutable(): |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1439 raise util.Abort(_('cannot amend public changesets')) |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1440 if len(repo[None].parents()) > 1: |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1441 raise util.Abort(_('cannot amend while merging')) |
18163
c5bd753c5bc6
amend: allow amend of non-head when obsolete is enabled
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18143
diff
changeset
|
1442 if (not obsolete._enabled) and old.children(): |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1443 raise util.Abort(_('cannot amend changeset with children')) |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1444 |
20700
b0153cb8b64e
commit: create new amend changeset as secret correctly for "--secret" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20633
diff
changeset
|
1445 # commitfunc is used only for temporary amend commit by cmdutil.amend |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1446 def commitfunc(ui, repo, message, match, opts): |
20700
b0153cb8b64e
commit: create new amend changeset as secret correctly for "--secret" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20633
diff
changeset
|
1447 return repo.commit(message, |
b0153cb8b64e
commit: create new amend changeset as secret correctly for "--secret" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20633
diff
changeset
|
1448 opts.get('user') or old.user(), |
b0153cb8b64e
commit: create new amend changeset as secret correctly for "--secret" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20633
diff
changeset
|
1449 opts.get('date') or old.date(), |
b0153cb8b64e
commit: create new amend changeset as secret correctly for "--secret" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20633
diff
changeset
|
1450 match, |
b0153cb8b64e
commit: create new amend changeset as secret correctly for "--secret" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20633
diff
changeset
|
1451 extra=extra) |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1452 |
17264
ec7b9bec19c9
strip: move bookmarks to nearest ancestor rather than '.'
Augie Fackler <raf@durin42.com>
parents:
17260
diff
changeset
|
1453 current = repo._bookmarkcurrent |
ec7b9bec19c9
strip: move bookmarks to nearest ancestor rather than '.'
Augie Fackler <raf@durin42.com>
parents:
17260
diff
changeset
|
1454 marks = old.bookmarks() |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1455 node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1456 if node == old.node(): |
13899
a7cd0eee396b
commit: note when files are missing
Martin Geisler <mg@aragost.com>
parents:
13893
diff
changeset
|
1457 ui.status(_("nothing changed\n")) |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1458 return 1 |
17264
ec7b9bec19c9
strip: move bookmarks to nearest ancestor rather than '.'
Augie Fackler <raf@durin42.com>
parents:
17260
diff
changeset
|
1459 elif marks: |
ec7b9bec19c9
strip: move bookmarks to nearest ancestor rather than '.'
Augie Fackler <raf@durin42.com>
parents:
17260
diff
changeset
|
1460 ui.debug('moving bookmarks %r from %s to %s\n' % |
ec7b9bec19c9
strip: move bookmarks to nearest ancestor rather than '.'
Augie Fackler <raf@durin42.com>
parents:
17260
diff
changeset
|
1461 (marks, old.hex(), hex(node))) |
17922
7f5dab94e48c
bookmarks: introduce a bmstore to manage bookmark persistence
Augie Fackler <raf@durin42.com>
parents:
17912
diff
changeset
|
1462 newmarks = repo._bookmarks |
17264
ec7b9bec19c9
strip: move bookmarks to nearest ancestor rather than '.'
Augie Fackler <raf@durin42.com>
parents:
17260
diff
changeset
|
1463 for bm in marks: |
17922
7f5dab94e48c
bookmarks: introduce a bmstore to manage bookmark persistence
Augie Fackler <raf@durin42.com>
parents:
17912
diff
changeset
|
1464 newmarks[bm] = node |
17264
ec7b9bec19c9
strip: move bookmarks to nearest ancestor rather than '.'
Augie Fackler <raf@durin42.com>
parents:
17260
diff
changeset
|
1465 if bm == current: |
ec7b9bec19c9
strip: move bookmarks to nearest ancestor rather than '.'
Augie Fackler <raf@durin42.com>
parents:
17260
diff
changeset
|
1466 bookmarks.setcurrent(repo, bm) |
17922
7f5dab94e48c
bookmarks: introduce a bmstore to manage bookmark persistence
Augie Fackler <raf@durin42.com>
parents:
17912
diff
changeset
|
1467 newmarks.write() |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1468 else: |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1469 def commitfunc(ui, repo, message, match, opts): |
22039
0aa2cb965f4c
commit: update the --secret code to use backupconfig and restoreconfig
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22010
diff
changeset
|
1470 backup = ui.backupconfig('phases', 'new-commit') |
0aa2cb965f4c
commit: update the --secret code to use backupconfig and restoreconfig
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22010
diff
changeset
|
1471 baseui = repo.baseui |
0aa2cb965f4c
commit: update the --secret code to use backupconfig and restoreconfig
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22010
diff
changeset
|
1472 basebackup = baseui.backupconfig('phases', 'new-commit') |
19440
4a0d0616c47d
commit: enable --secret option
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19439
diff
changeset
|
1473 try: |
4a0d0616c47d
commit: enable --secret option
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19439
diff
changeset
|
1474 if opts.get('secret'): |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
1475 ui.setconfig('phases', 'new-commit', 'secret', 'commit') |
20772
03774a2b6991
commit: propagate --secret option to subrepos (issue4182)
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
20767
diff
changeset
|
1476 # Propagate to subrepos |
22039
0aa2cb965f4c
commit: update the --secret code to use backupconfig and restoreconfig
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22010
diff
changeset
|
1477 baseui.setconfig('phases', 'new-commit', 'secret', 'commit') |
19440
4a0d0616c47d
commit: enable --secret option
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19439
diff
changeset
|
1478 |
22248
75618a223e18
commit: change "editform" to distinguish merge commits from others
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22218
diff
changeset
|
1479 editform = cmdutil.mergeeditform(repo[None], 'commit.normal') |
22010
41e969cb9468
commit: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22009
diff
changeset
|
1480 editor = cmdutil.getcommiteditor(editform=editform, **opts) |
19440
4a0d0616c47d
commit: enable --secret option
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19439
diff
changeset
|
1481 return repo.commit(message, opts.get('user'), opts.get('date'), |
21414
37a302f0e297
commit: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21413
diff
changeset
|
1482 match, |
22010
41e969cb9468
commit: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22009
diff
changeset
|
1483 editor=editor, |
21414
37a302f0e297
commit: use "getcommiteditor()" instead of explicit editor choice
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21413
diff
changeset
|
1484 extra=extra) |
19440
4a0d0616c47d
commit: enable --secret option
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19439
diff
changeset
|
1485 finally: |
22039
0aa2cb965f4c
commit: update the --secret code to use backupconfig and restoreconfig
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22010
diff
changeset
|
1486 ui.restoreconfig(backup) |
0aa2cb965f4c
commit: update the --secret code to use backupconfig and restoreconfig
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22010
diff
changeset
|
1487 repo.baseui.restoreconfig(basebackup) |
19440
4a0d0616c47d
commit: enable --secret option
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
19439
diff
changeset
|
1488 |
16458
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1489 |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1490 node = cmdutil.commit(ui, repo, commitfunc, pats, opts) |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1491 |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1492 if not node: |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1493 stat = repo.status(match=scmutil.match(repo[None], pats, opts)) |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1494 if stat[3]: |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1495 ui.status(_("nothing changed (%d missing files, see " |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1496 "'hg status')\n") % len(stat[3])) |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1497 else: |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1498 ui.status(_("nothing changed\n")) |
55982f62651f
commit: add option to amend the working dir parent
Idan Kamara <idankk86@gmail.com>
parents:
16427
diff
changeset
|
1499 return 1 |
11173
5b48d819d5f9
commit: note new branch heads rather than topological heads
Matt Mackall <mpm@selenic.com>
parents:
11169
diff
changeset
|
1500 |
18688
79107fad06aa
commit: factor out status printing into a helper function
Kevin Bullock <kbullock@ringworld.org>
parents:
18687
diff
changeset
|
1501 cmdutil.commitstatus(repo, node, branch, bheads, opts) |
6935
03916abdfb64
Have verbose and debug flag print the changeset rev and hash when committing.
Gilles Moris <gilles.moris@free.fr>
parents:
6934
diff
changeset
|
1502 |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1503 @command('config|showconfig|debugconfig', |
20572
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1504 [('u', 'untrusted', None, _('show untrusted configuration options')), |
20782
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1505 ('e', 'edit', None, _('edit user config')), |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1506 ('l', 'local', None, _('edit repository config')), |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1507 ('g', 'global', None, _('edit global config'))], |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
1508 _('[-u] [NAME]...'), |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
1509 optionalrepo=True) |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1510 def config(ui, repo, *values, **opts): |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1511 """show combined config settings from all hgrc files |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1512 |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1513 With no arguments, print names and values of all config items. |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1514 |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1515 With one argument of the form section.name, print just the value |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1516 of that config item. |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1517 |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1518 With multiple arguments, print names and values of all config |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1519 items with matching section names. |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1520 |
20783
43054dc84abd
config: mention edit options and config topic in help
Matt Mackall <mpm@selenic.com>
parents:
20782
diff
changeset
|
1521 With --edit, start an editor on the user-level config file. With |
43054dc84abd
config: mention edit options and config topic in help
Matt Mackall <mpm@selenic.com>
parents:
20782
diff
changeset
|
1522 --global, edit the system-wide config file. With --local, edit the |
43054dc84abd
config: mention edit options and config topic in help
Matt Mackall <mpm@selenic.com>
parents:
20782
diff
changeset
|
1523 repository-level config file. |
43054dc84abd
config: mention edit options and config topic in help
Matt Mackall <mpm@selenic.com>
parents:
20782
diff
changeset
|
1524 |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1525 With --debug, the source (filename and line number) is printed |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1526 for each config item. |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1527 |
20783
43054dc84abd
config: mention edit options and config topic in help
Matt Mackall <mpm@selenic.com>
parents:
20782
diff
changeset
|
1528 See :hg:`help config` for more information about config files. |
43054dc84abd
config: mention edit options and config topic in help
Matt Mackall <mpm@selenic.com>
parents:
20782
diff
changeset
|
1529 |
22316
816be4ca4ae2
config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents:
22314
diff
changeset
|
1530 Returns 0 on success, 1 if NAME does not exist. |
20783
43054dc84abd
config: mention edit options and config topic in help
Matt Mackall <mpm@selenic.com>
parents:
20782
diff
changeset
|
1531 |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1532 """ |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1533 |
20782
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1534 if opts.get('edit') or opts.get('local') or opts.get('global'): |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1535 if opts.get('local') and opts.get('global'): |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1536 raise util.Abort(_("can't use --local and --global together")) |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1537 |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1538 if opts.get('local'): |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1539 if not repo: |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1540 raise util.Abort(_("can't use --local outside a repository")) |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1541 paths = [repo.join('hgrc')] |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1542 elif opts.get('global'): |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1543 paths = scmutil.systemrcpath() |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1544 else: |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1545 paths = scmutil.userrcpath() |
13fcb9ca9ccc
config: add --global and --local flags
Matt Mackall <mpm@selenic.com>
parents:
20773
diff
changeset
|
1546 |
20572
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1547 for f in paths: |
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1548 if os.path.exists(f): |
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1549 break |
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1550 else: |
22419
fdfc9faca273
ui: move samplehgrcs from config
Matt Mackall <mpm@selenic.com>
parents:
22417
diff
changeset
|
1551 from ui import samplehgrcs |
22383
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1552 |
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1553 if opts.get('global'): |
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1554 samplehgrc = samplehgrcs['global'] |
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1555 elif opts.get('local'): |
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1556 samplehgrc = samplehgrcs['local'] |
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1557 else: |
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1558 samplehgrc = samplehgrcs['user'] |
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1559 |
20572
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1560 f = paths[0] |
20573
02d0d3aa42e3
config: add example config file when -e called with no config
Matt Mackall <mpm@selenic.com>
parents:
20572
diff
changeset
|
1561 fp = open(f, "w") |
22383
f58b41f6708b
config: give more fine-tuned sample hgrcs to this command
Jordi Gutiérrez Hermoso <jordigh@octave.org>
parents:
22381
diff
changeset
|
1562 fp.write(samplehgrc) |
20573
02d0d3aa42e3
config: add example config file when -e called with no config
Matt Mackall <mpm@selenic.com>
parents:
20572
diff
changeset
|
1563 fp.close() |
02d0d3aa42e3
config: add example config file when -e called with no config
Matt Mackall <mpm@selenic.com>
parents:
20572
diff
changeset
|
1564 |
20572
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1565 editor = ui.geteditor() |
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1566 util.system("%s \"%s\"" % (editor, f), |
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1567 onerr=util.Abort, errprefix=_("edit failed"), |
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1568 out=ui.fout) |
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1569 return |
c724cb0141ee
config: add initial implementation of --edit
Matt Mackall <mpm@selenic.com>
parents:
20570
diff
changeset
|
1570 |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1571 for f in scmutil.rcpath(): |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1572 ui.debug('read config from: %s\n' % f) |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1573 untrusted = bool(opts.get('untrusted')) |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1574 if values: |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1575 sections = [v for v in values if '.' not in v] |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1576 items = [v for v in values if '.' in v] |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1577 if len(items) > 1 or items and sections: |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1578 raise util.Abort(_('only one config item permitted')) |
22316
816be4ca4ae2
config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents:
22314
diff
changeset
|
1579 matched = False |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1580 for section, name, value in ui.walkconfig(untrusted=untrusted): |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1581 value = str(value).replace('\n', '\\n') |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1582 sectname = section + '.' + name |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1583 if values: |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1584 for v in values: |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1585 if v == section: |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1586 ui.debug('%s: ' % |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1587 ui.configsource(section, name, untrusted)) |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1588 ui.write('%s=%s\n' % (sectname, value)) |
22316
816be4ca4ae2
config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents:
22314
diff
changeset
|
1589 matched = True |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1590 elif v == sectname: |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1591 ui.debug('%s: ' % |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1592 ui.configsource(section, name, untrusted)) |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1593 ui.write(value, '\n') |
22316
816be4ca4ae2
config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents:
22314
diff
changeset
|
1594 matched = True |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1595 else: |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1596 ui.debug('%s: ' % |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1597 ui.configsource(section, name, untrusted)) |
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1598 ui.write('%s=%s\n' % (sectname, value)) |
22316
816be4ca4ae2
config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents:
22314
diff
changeset
|
1599 matched = True |
816be4ca4ae2
config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents:
22314
diff
changeset
|
1600 if matched: |
816be4ca4ae2
config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents:
22314
diff
changeset
|
1601 return 0 |
816be4ca4ae2
config: exit non zero on non-existent config option (issue4247)
Aaron Kushner <akushner@fb.com>
parents:
22314
diff
changeset
|
1602 return 1 |
20570
c21e1e3ab915
config: move showconfig code and add config as primary alias
Matt Mackall <mpm@selenic.com>
parents:
20558
diff
changeset
|
1603 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1604 @command('copy|cp', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1605 [('A', 'after', None, _('record a copy that has already occurred')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1606 ('f', 'force', None, _('forcibly copy over an existing managed file')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1607 ] + walkopts + dryrunopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1608 _('[OPTION]... [SOURCE]... DEST')) |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
1609 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
|
1610 """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
|
1611 |
6448
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
1612 Mark dest as having copies of source files. If dest is a |
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
1613 directory, copies are put in that directory. If dest is a file, |
7807
bd8f44638847
help: miscellaneous language fixes
timeless <timeless@gmail.com>
parents:
7765
diff
changeset
|
1614 the source must be a single file. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1615 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1616 By default, this command copies the contents of files as they |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
1617 exist in the working directory. If invoked with -A/--after, the |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1618 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
|
1619 |
7807
bd8f44638847
help: miscellaneous language fixes
timeless <timeless@gmail.com>
parents:
7765
diff
changeset
|
1620 This command takes effect with the next commit. To undo a copy |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
1621 before that, see :hg:`revert`. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1622 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
1623 Returns 0 on success, 1 if errors are encountered. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
1624 """ |
4914 | 1625 wlock = repo.wlock(False) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1626 try: |
5610
2493a478f395
copy: handle rename internally
Matt Mackall <mpm@selenic.com>
parents:
5589
diff
changeset
|
1627 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
|
1628 finally: |
8109
496ae1ea4698
switch lock releasing in the core from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
8088
diff
changeset
|
1629 wlock.release() |
363 | 1630 |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
1631 @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) |
6189
81cbb5dfdec0
Make hg debugancestor accept -R by making it an optionalrepo command.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6188
diff
changeset
|
1632 def debugancestor(ui, repo, *args): |
1262 | 1633 """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
|
1634 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
|
1635 index, rev1, rev2 = args |
13970
d13913355390
move opener from util to scmutil
Adrian Buehlmann <adrian@cadifra.com>
parents:
13965
diff
changeset
|
1636 r = revlog.revlog(scmutil.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
|
1637 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
|
1638 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
|
1639 if not repo: |
12067
a4fbbe0fbc38
Lowercase error messages
Martin Geisler <mg@lazybytes.net>
parents:
11881
diff
changeset
|
1640 raise util.Abort(_("there is no Mercurial repository here " |
6189
81cbb5dfdec0
Make hg debugancestor accept -R by making it an optionalrepo command.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6188
diff
changeset
|
1641 "(.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
|
1642 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
|
1643 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
|
1644 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
|
1645 else: |
81afdd016867
debugancestor: make the index argument optional, defaulting to 00changelog.i
Bryan O'Sullivan <bos@serpentine.com>
parents:
6171
diff
changeset
|
1646 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
|
1647 a = r.ancestor(lookup(rev1), lookup(rev2)) |
1262 | 1648 ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
1649 | |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1650 @command('debugbuilddag', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1651 [('m', 'mergeable-file', None, _('add single file mergeable changes')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1652 ('o', 'overwritten-file', None, _('add single file all revs overwrite')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1653 ('n', 'new-file', None, _('add new file at each rev'))], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1654 _('[OPTION]... [TEXT]')) |
14283
035489c9ea53
debugbuilddag: read DAG from stdin if not given on cmdline
Martin Geisler <mg@aragost.com>
parents:
14279
diff
changeset
|
1655 def debugbuilddag(ui, repo, text=None, |
11337
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1656 mergeable_file=False, |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1657 overwritten_file=False, |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1658 new_file=False): |
14283
035489c9ea53
debugbuilddag: read DAG from stdin if not given on cmdline
Martin Geisler <mg@aragost.com>
parents:
14279
diff
changeset
|
1659 """builds a repo with a given DAG from scratch in the current empty repo |
035489c9ea53
debugbuilddag: read DAG from stdin if not given on cmdline
Martin Geisler <mg@aragost.com>
parents:
14279
diff
changeset
|
1660 |
035489c9ea53
debugbuilddag: read DAG from stdin if not given on cmdline
Martin Geisler <mg@aragost.com>
parents:
14279
diff
changeset
|
1661 The description of the DAG is read from stdin if not given on the |
035489c9ea53
debugbuilddag: read DAG from stdin if not given on cmdline
Martin Geisler <mg@aragost.com>
parents:
14279
diff
changeset
|
1662 command line. |
11337
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1663 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1664 Elements: |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1665 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1666 - "+n" is a linear run of n nodes based on the current default parent |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1667 - "." is a single node based on the current default parent |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1668 - "$" resets the default parent to null (implied at the start); |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1669 otherwise the default parent is always the last node created |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1670 - "<p" sets the default parent to the backref p |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1671 - "*p" is a fork at parent p, which is a backref |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1672 - "*p1/p2" is a merge of parents p1 and p2, which are backrefs |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1673 - "/p2" is a merge of the preceding node and p2 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1674 - ":tag" defines a local tag for the preceding node |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1675 - "@branch" sets the named branch for subsequent nodes |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1676 - "#...\\n" is a comment up to the end of the line |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1677 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1678 Whitespace between the above elements is ignored. |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1679 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1680 A backref is either |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1681 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1682 - a number n, which references the node curr-n, where curr is the current |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1683 node, or |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1684 - the name of a local tag you placed earlier using ":tag", or |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1685 - empty to denote the default parent. |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1686 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1687 All string valued-elements are either strictly alphanumeric, or must |
11881
2da0cf99b642
debugbuilddag: escape backslash properly in help string
Martin Geisler <mg@lazybytes.net>
parents:
11877
diff
changeset
|
1688 be enclosed in double quotes ("..."), with "\\" as escape character. |
11337
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1689 """ |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1690 |
14283
035489c9ea53
debugbuilddag: read DAG from stdin if not given on cmdline
Martin Geisler <mg@aragost.com>
parents:
14279
diff
changeset
|
1691 if text is None: |
035489c9ea53
debugbuilddag: read DAG from stdin if not given on cmdline
Martin Geisler <mg@aragost.com>
parents:
14279
diff
changeset
|
1692 ui.status(_("reading DAG from stdin\n")) |
14639
e59a7b8f521a
commands: use ui descriptors when reading/writing from stdin/out
Idan Kamara <idankk86@gmail.com>
parents:
14635
diff
changeset
|
1693 text = ui.fin.read() |
14283
035489c9ea53
debugbuilddag: read DAG from stdin if not given on cmdline
Martin Geisler <mg@aragost.com>
parents:
14279
diff
changeset
|
1694 |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1695 cl = repo.changelog |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1696 if len(cl) > 0: |
11342
aecabad8dd7a
commands: get rid of generic exception in debugbuilddag
Martin Geisler <mg@aragost.com>
parents:
11338
diff
changeset
|
1697 raise util.Abort(_('repository is not empty')) |
11337
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1698 |
14279
b039b667515d
debugbuilddag: output progress information
Martin Geisler <mg@aragost.com>
parents:
14271
diff
changeset
|
1699 # determine number of revs in DAG |
b039b667515d
debugbuilddag: output progress information
Martin Geisler <mg@aragost.com>
parents:
14271
diff
changeset
|
1700 total = 0 |
b039b667515d
debugbuilddag: output progress information
Martin Geisler <mg@aragost.com>
parents:
14271
diff
changeset
|
1701 for type, data in dagparser.parsedag(text): |
b039b667515d
debugbuilddag: output progress information
Martin Geisler <mg@aragost.com>
parents:
14271
diff
changeset
|
1702 if type == 'n': |
b039b667515d
debugbuilddag: output progress information
Martin Geisler <mg@aragost.com>
parents:
14271
diff
changeset
|
1703 total += 1 |
11337
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1704 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1705 if mergeable_file: |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1706 linesperrev = 2 |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1707 # make a file with k lines per rev |
14279
b039b667515d
debugbuilddag: output progress information
Martin Geisler <mg@aragost.com>
parents:
14271
diff
changeset
|
1708 initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)] |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1709 initialmergedlines.append("") |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1710 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1711 tags = [] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1712 |
15875
7eca9db689d6
debugbuilddag: lock repo before starting transaction
Mads Kiilerich <mads@kiilerich.com>
parents:
15862
diff
changeset
|
1713 lock = tr = None |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1714 try: |
15875
7eca9db689d6
debugbuilddag: lock repo before starting transaction
Mads Kiilerich <mads@kiilerich.com>
parents:
15862
diff
changeset
|
1715 lock = repo.lock() |
7eca9db689d6
debugbuilddag: lock repo before starting transaction
Mads Kiilerich <mads@kiilerich.com>
parents:
15862
diff
changeset
|
1716 tr = repo.transaction("builddag") |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1717 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1718 at = -1 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1719 atbranch = 'default' |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1720 nodeids = [] |
16219
28c5648771d1
debugbuilddag: fix starting a dag on a non-default branch
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
16191
diff
changeset
|
1721 id = 0 |
28c5648771d1
debugbuilddag: fix starting a dag on a non-default branch
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
16191
diff
changeset
|
1722 ui.progress(_('building'), id, unit=_('revisions'), total=total) |
11337
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1723 for type, data in dagparser.parsedag(text): |
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1724 if type == 'n': |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
1725 ui.note(('node %s\n' % str(data))) |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1726 id, ps = data |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1727 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1728 files = [] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1729 fctxs = {} |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1730 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1731 p2 = None |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1732 if mergeable_file: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1733 fn = "mf" |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1734 p1 = repo[ps[0]] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1735 if len(ps) > 1: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1736 p2 = repo[ps[1]] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1737 pa = p1.ancestor(p2) |
18181
c7d258cd77e5
commands: fix implicit tuple that is invalid syntax in Python3
Augie Fackler <raf@durin42.com>
parents:
18163
diff
changeset
|
1738 base, local, other = [x[fn].data() for x in (pa, p1, |
c7d258cd77e5
commands: fix implicit tuple that is invalid syntax in Python3
Augie Fackler <raf@durin42.com>
parents:
18163
diff
changeset
|
1739 p2)] |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1740 m3 = simplemerge.Merge3Text(base, local, other) |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1741 ml = [l.strip() for l in m3.merge_lines()] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1742 ml.append("") |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1743 elif at > 0: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1744 ml = p1[fn].data().split("\n") |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1745 else: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1746 ml = initialmergedlines |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1747 ml[id * linesperrev] += " r%i" % id |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1748 mergedtext = "\n".join(ml) |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1749 files.append(fn) |
21689
503bb3af70fe
memfilectx: call super.__init__ instead of duplicating code
Sean Farley <sean.michael.farley@gmail.com>
parents:
21585
diff
changeset
|
1750 fctxs[fn] = context.memfilectx(repo, fn, mergedtext) |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1751 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1752 if overwritten_file: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1753 fn = "of" |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1754 files.append(fn) |
21689
503bb3af70fe
memfilectx: call super.__init__ instead of duplicating code
Sean Farley <sean.michael.farley@gmail.com>
parents:
21585
diff
changeset
|
1755 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1756 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1757 if new_file: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1758 fn = "nf%i" % id |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1759 files.append(fn) |
21689
503bb3af70fe
memfilectx: call super.__init__ instead of duplicating code
Sean Farley <sean.michael.farley@gmail.com>
parents:
21585
diff
changeset
|
1760 fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1761 if len(ps) > 1: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1762 if not p2: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1763 p2 = repo[ps[1]] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1764 for fn in p2: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1765 if fn.startswith("nf"): |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1766 files.append(fn) |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1767 fctxs[fn] = p2[fn] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1768 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1769 def fctxfn(repo, cx, path): |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1770 return fctxs.get(path) |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1771 |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1772 if len(ps) == 0 or ps[0] < 0: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1773 pars = [None, None] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1774 elif len(ps) == 1: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1775 pars = [nodeids[ps[0]], None] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1776 else: |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1777 pars = [nodeids[p] for p in ps] |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1778 cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1779 date=(id, 0), |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1780 user="debugbuilddag", |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1781 extra={'branch': atbranch}) |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1782 nodeid = repo.commitctx(cx) |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1783 nodeids.append(nodeid) |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1784 at = id |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1785 elif type == 'l': |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1786 id, name = data |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
1787 ui.note(('tag %s\n' % name)) |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1788 tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) |
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1789 elif type == 'a': |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
1790 ui.note(('branch %s\n' % data)) |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1791 atbranch = data |
14279
b039b667515d
debugbuilddag: output progress information
Martin Geisler <mg@aragost.com>
parents:
14271
diff
changeset
|
1792 ui.progress(_('building'), id, unit=_('revisions'), total=total) |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1793 tr.close() |
15875
7eca9db689d6
debugbuilddag: lock repo before starting transaction
Mads Kiilerich <mads@kiilerich.com>
parents:
15862
diff
changeset
|
1794 |
7eca9db689d6
debugbuilddag: lock repo before starting transaction
Mads Kiilerich <mads@kiilerich.com>
parents:
15862
diff
changeset
|
1795 if tags: |
7eca9db689d6
debugbuilddag: lock repo before starting transaction
Mads Kiilerich <mads@kiilerich.com>
parents:
15862
diff
changeset
|
1796 repo.opener.write("localtags", "".join(tags)) |
14163
38184a72d793
debugbuilddag: use memctx for speed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14157
diff
changeset
|
1797 finally: |
14279
b039b667515d
debugbuilddag: output progress information
Martin Geisler <mg@aragost.com>
parents:
14271
diff
changeset
|
1798 ui.progress(_('building'), None) |
15875
7eca9db689d6
debugbuilddag: lock repo before starting transaction
Mads Kiilerich <mads@kiilerich.com>
parents:
15862
diff
changeset
|
1799 release(tr, lock) |
11337
0f3c8a47960e
debugbuilddag: build a changelog dag from a concise description
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11336
diff
changeset
|
1800 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1801 @command('debugbundle', |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1802 [('a', 'all', None, _('show all details'))], |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1803 _('FILE'), |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1804 norepo=True) |
13724
fe57046e9448
commands: add debugbundle command
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13723
diff
changeset
|
1805 def debugbundle(ui, bundlepath, all=None, **opts): |
fe57046e9448
commands: add debugbundle command
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13723
diff
changeset
|
1806 """lists the contents of a bundle""" |
17887
0e2846b2482c
url: use open and not url.open for local files (issue3624)
Siddharth Agarwal <sid0@fb.com>
parents:
17875
diff
changeset
|
1807 f = hg.openpath(ui, bundlepath) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1808 try: |
21064
4d9d490d7bbe
bundle2: add a ui argument to readbundle
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21063
diff
changeset
|
1809 gen = exchange.readbundle(ui, f, bundlepath) |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1810 if all: |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
1811 ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n")) |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1812 |
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1813 def showchunks(named): |
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1814 ui.write("\n%s\n" % named) |
14141
bd1cbfe5db5c
bundler: make parsechunk return the base revision of the delta
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14098
diff
changeset
|
1815 chain = None |
14494
1ffeeb91c55d
check-code: flag 0/1 used as constant Boolean expression
Martin Geisler <mg@lazybytes.net>
parents:
14485
diff
changeset
|
1816 while True: |
14144
3c3c53d8343a
unbundler: separate delta and header parsing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14141
diff
changeset
|
1817 chunkdata = gen.deltachunk(chain) |
13724
fe57046e9448
commands: add debugbundle command
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13723
diff
changeset
|
1818 if not chunkdata: |
fe57046e9448
commands: add debugbundle command
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13723
diff
changeset
|
1819 break |
fe57046e9448
commands: add debugbundle command
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13723
diff
changeset
|
1820 node = chunkdata['node'] |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1821 p1 = chunkdata['p1'] |
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1822 p2 = chunkdata['p2'] |
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1823 cs = chunkdata['cs'] |
14141
bd1cbfe5db5c
bundler: make parsechunk return the base revision of the delta
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14098
diff
changeset
|
1824 deltabase = chunkdata['deltabase'] |
bd1cbfe5db5c
bundler: make parsechunk return the base revision of the delta
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14098
diff
changeset
|
1825 delta = chunkdata['delta'] |
bd1cbfe5db5c
bundler: make parsechunk return the base revision of the delta
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14098
diff
changeset
|
1826 ui.write("%s %s %s %s %s %s\n" % |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1827 (hex(node), hex(p1), hex(p2), |
14141
bd1cbfe5db5c
bundler: make parsechunk return the base revision of the delta
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14098
diff
changeset
|
1828 hex(cs), hex(deltabase), len(delta))) |
bd1cbfe5db5c
bundler: make parsechunk return the base revision of the delta
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14098
diff
changeset
|
1829 chain = node |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1830 |
14144
3c3c53d8343a
unbundler: separate delta and header parsing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14141
diff
changeset
|
1831 chunkdata = gen.changelogheader() |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1832 showchunks("changelog") |
14144
3c3c53d8343a
unbundler: separate delta and header parsing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14141
diff
changeset
|
1833 chunkdata = gen.manifestheader() |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1834 showchunks("manifest") |
14494
1ffeeb91c55d
check-code: flag 0/1 used as constant Boolean expression
Martin Geisler <mg@lazybytes.net>
parents:
14485
diff
changeset
|
1835 while True: |
14144
3c3c53d8343a
unbundler: separate delta and header parsing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14141
diff
changeset
|
1836 chunkdata = gen.filelogheader() |
3c3c53d8343a
unbundler: separate delta and header parsing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14141
diff
changeset
|
1837 if not chunkdata: |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1838 break |
14144
3c3c53d8343a
unbundler: separate delta and header parsing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14141
diff
changeset
|
1839 fname = chunkdata['filename'] |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1840 showchunks(fname) |
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1841 else: |
14144
3c3c53d8343a
unbundler: separate delta and header parsing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14141
diff
changeset
|
1842 chunkdata = gen.changelogheader() |
14141
bd1cbfe5db5c
bundler: make parsechunk return the base revision of the delta
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14098
diff
changeset
|
1843 chain = None |
14494
1ffeeb91c55d
check-code: flag 0/1 used as constant Boolean expression
Martin Geisler <mg@lazybytes.net>
parents:
14485
diff
changeset
|
1844 while True: |
14144
3c3c53d8343a
unbundler: separate delta and header parsing
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14141
diff
changeset
|
1845 chunkdata = gen.deltachunk(chain) |
13747
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1846 if not chunkdata: |
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1847 break |
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1848 node = chunkdata['node'] |
cede00420e1e
code indentation fixes
Patrick Mezard <pmezard@gmail.com>
parents:
13741
diff
changeset
|
1849 ui.write("%s\n" % hex(node)) |
14141
bd1cbfe5db5c
bundler: make parsechunk return the base revision of the delta
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
14098
diff
changeset
|
1850 chain = node |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
1851 finally: |
13724
fe57046e9448
commands: add debugbundle command
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13723
diff
changeset
|
1852 f.close() |
fe57046e9448
commands: add debugbundle command
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13723
diff
changeset
|
1853 |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1854 @command('debugcheckstate', [], '') |
596 | 1855 def debugcheckstate(ui, repo): |
1856 """validate the correctness of the current dirstate""" | |
460 | 1857 parent1, parent2 = repo.dirstate.parents() |
6747
f6c00b17387c
use repo[changeid] to get a changectx
Matt Mackall <mpm@selenic.com>
parents:
6746
diff
changeset
|
1858 m1 = repo[parent1].manifest() |
f6c00b17387c
use repo[changeid] to get a changectx
Matt Mackall <mpm@selenic.com>
parents:
6746
diff
changeset
|
1859 m2 = repo[parent2].manifest() |
460 | 1860 errors = 0 |
4906
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
1861 for f in repo.dirstate: |
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
1862 state = repo.dirstate[f] |
460 | 1863 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
|
1864 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
460 | 1865 errors += 1 |
1866 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
|
1867 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
460 | 1868 errors += 1 |
1869 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
|
1870 ui.warn(_("%s in state %s, but not in either manifest\n") % |
582 | 1871 (f, state)) |
460 | 1872 errors += 1 |
1873 for f in m1: | |
4906
30847b8af7ca
dirstate: add __contains__ and make __getitem__ more useful
Matt Mackall <mpm@selenic.com>
parents:
4904
diff
changeset
|
1874 state = repo.dirstate[f] |
460 | 1875 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
|
1876 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
460 | 1877 errors += 1 |
1878 if errors: | |
1602
fb4149eebdd4
strictly adher to 80 chars per line
Muli Ben-Yehuda <mulix@mulix.org>
parents:
1601
diff
changeset
|
1879 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
|
1880 raise util.Abort(error) |
460 | 1881 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1882 @command('debugcommands', [], _('[COMMAND]'), norepo=True) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1883 def debugcommands(ui, cmd='', *args): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1884 """list all available commands and options""" |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1885 for cmd, vals in sorted(table.iteritems()): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1886 cmd = cmd.split('|')[0].strip('^') |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1887 opts = ', '.join([i[1] for i in vals[1]]) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1888 ui.write('%s: %s\n' % (cmd, opts)) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1889 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1890 @command('debugcomplete', |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1891 [('o', 'options', None, _('show the command options'))], |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1892 _('[-o] CMD'), |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1893 norepo=True) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1894 def debugcomplete(ui, cmd='', **opts): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1895 """returns the completion list associated with the given command""" |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1896 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1897 if opts.get('options'): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1898 options = [] |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1899 otables = [globalopts] |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1900 if cmd: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1901 aliases, entry = cmdutil.findcmd(cmd, table, False) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1902 otables.append(entry[1]) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1903 for t in otables: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1904 for o in t: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1905 if "(DEPRECATED)" in o[3]: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1906 continue |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1907 if o[0]: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1908 options.append('-%s' % o[0]) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1909 options.append('--%s' % o[1]) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1910 ui.write("%s\n" % "\n".join(options)) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1911 return |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1912 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1913 cmdlist = cmdutil.findpossible(cmd, table) |
11276
f28b58e35768
revset: add a debugrevspec command
Matt Mackall <mpm@selenic.com>
parents:
11273
diff
changeset
|
1914 if ui.verbose: |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1915 cmdlist = [' '.join(c[0]) for c in cmdlist.values()] |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
1916 ui.write("%s\n" % "\n".join(sorted(cmdlist))) |
8812
859f841937d0
subrepo: introduce basic state parsing
Matt Mackall <mpm@selenic.com>
parents:
8810
diff
changeset
|
1917 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1918 @command('debugdag', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1919 [('t', 'tags', None, _('use tags as labels')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1920 ('b', 'branches', None, _('annotate with branch names')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1921 ('', 'dots', None, _('use dots for runs')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1922 ('s', 'spaces', None, _('separate elements by spaces'))], |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
1923 _('[OPTION]... [FILE [REV]...]'), |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
1924 optionalrepo=True) |
11336
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1925 def debugdag(ui, repo, file_=None, *revs, **opts): |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1926 """format the changelog or an index DAG as a concise textual description |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1927 |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1928 If you pass a revlog index, the revlog's DAG is emitted. If you list |
17500 | 1929 revision numbers, they get labeled in the output as rN. |
11336
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1930 |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1931 Otherwise, the changelog DAG of the current repo is emitted. |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1932 """ |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1933 spaces = opts.get('spaces') |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1934 dots = opts.get('dots') |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1935 if file_: |
13970
d13913355390
move opener from util to scmutil
Adrian Buehlmann <adrian@cadifra.com>
parents:
13965
diff
changeset
|
1936 rlog = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) |
11336
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1937 revs = set((int(r) for r in revs)) |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1938 def events(): |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1939 for r in rlog: |
22310
aabf367306d5
debugdag: stop wrongly sorting parents
Henrik Stuart <hg@hstuart.dk>
parents:
22305
diff
changeset
|
1940 yield 'n', (r, list(p for p in rlog.parentrevs(r) |
aabf367306d5
debugdag: stop wrongly sorting parents
Henrik Stuart <hg@hstuart.dk>
parents:
22305
diff
changeset
|
1941 if p != -1)) |
11336
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1942 if r in revs: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1943 yield 'l', (r, "r%i" % r) |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1944 elif repo: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1945 cl = repo.changelog |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1946 tags = opts.get('tags') |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1947 branches = opts.get('branches') |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1948 if tags: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1949 labels = {} |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1950 for l, n in repo.tags().items(): |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1951 labels.setdefault(cl.rev(n), []).append(l) |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1952 def events(): |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1953 b = "default" |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1954 for r in cl: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1955 if branches: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1956 newb = cl.read(cl.node(r))[5]['branch'] |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1957 if newb != b: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1958 yield 'a', newb |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1959 b = newb |
22310
aabf367306d5
debugdag: stop wrongly sorting parents
Henrik Stuart <hg@hstuart.dk>
parents:
22305
diff
changeset
|
1960 yield 'n', (r, list(p for p in cl.parentrevs(r) |
aabf367306d5
debugdag: stop wrongly sorting parents
Henrik Stuart <hg@hstuart.dk>
parents:
22305
diff
changeset
|
1961 if p != -1)) |
11336
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1962 if tags: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1963 ls = labels.get(r) |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1964 if ls: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1965 for l in ls: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1966 yield 'l', (r, l) |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1967 else: |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1968 raise util.Abort(_('need repo for changelog dag')) |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1969 |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1970 for line in dagparser.dagtextlines(events(), |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1971 addspaces=spaces, |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1972 wraplabels=True, |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1973 wrapannotations=True, |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1974 wrapnonlinear=dots, |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1975 usedots=dots, |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1976 maxlinewidth=70): |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1977 ui.write(line) |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1978 ui.write("\n") |
3dfbe26cfded
debugdag and debugindexdag: emit changelog/revlog DAGs as concise text
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
11331
diff
changeset
|
1979 |
14323
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1980 @command('debugdata', |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1981 [('c', 'changelog', False, _('open changelog')), |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1982 ('m', 'manifest', False, _('open manifest'))], |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1983 _('-c|-m|FILE REV')) |
19872
681f7b9213a4
check-code: check for spaces around = for named parameters
Mads Kiilerich <madski@unity3d.com>
parents:
19801
diff
changeset
|
1984 def debugdata(ui, repo, file_, rev=None, **opts): |
4258
b11a2fb59cf5
revlog: simplify revlog version handling
Matt Mackall <mpm@selenic.com>
parents:
4257
diff
changeset
|
1985 """dump the contents of a data file revision""" |
14323
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1986 if opts.get('changelog') or opts.get('manifest'): |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1987 file_, rev = None, file_ |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1988 elif rev is None: |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1989 raise error.CommandError('debugdata', _('invalid arguments')) |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
1990 r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) |
1313
1cc7c0cbc30b
Fix traceback during invalid rev identifier for debugdata
Anupam Kapoor<anupam.kapoor@gmail.com>
parents:
1312
diff
changeset
|
1991 try: |
1cc7c0cbc30b
Fix traceback during invalid rev identifier for debugdata
Anupam Kapoor<anupam.kapoor@gmail.com>
parents:
1312
diff
changeset
|
1992 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
|
1993 except KeyError: |
3072
bc3fe3b5b785
Never apply string formatting to generated errors with util.Abort.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
3071
diff
changeset
|
1994 raise util.Abort(_('invalid revision identifier %s') % rev) |
1039
4296754ba7b4
Add debugdata for dumping revlog revision data
mpm@selenic.com
parents:
1037
diff
changeset
|
1995 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1996 @command('debugdate', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
1997 [('e', 'extended', None, _('try extended date formats'))], |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
1998 _('[-e] DATE [RANGE]'), |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
1999 norepo=True, optionalrepo=True) |
3812 | 2000 def debugdate(ui, date, range=None, **opts): |
3805 | 2001 """parse and display a date""" |
3812 | 2002 if opts["extended"]: |
2003 d = util.parsedate(date, util.extendeddateformats) | |
2004 else: | |
2005 d = util.parsedate(date) | |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2006 ui.write(("internal: %s %s\n") % d) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2007 ui.write(("standard: %s\n") % util.datestr(d)) |
3812 | 2008 if range: |
2009 m = util.matchdate(range) | |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2010 ui.write(("match: %s\n") % m(d[0])) |
3805 | 2011 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2012 @command('debugdiscovery', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2013 [('', 'old', None, _('use old-style discovery')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2014 ('', 'nonheads', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2015 _('use old-style discovery with non-heads included')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2016 ] + remoteopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2017 _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]')) |
14164
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2018 def debugdiscovery(ui, repo, remoteurl="default", **opts): |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2019 """runs the changeset discovery protocol in isolation""" |
16683 | 2020 remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), |
2021 opts.get('branch')) | |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
2022 remote = hg.peer(repo, opts, remoteurl) |
14164
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2023 ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2024 |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2025 # make sure tests are repeatable |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2026 random.seed(12323) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2027 |
17191
5884812686f7
peer: introduce peer methods to prepare for peer classes
Sune Foldager <cryo@cyanite.org>
parents:
17190
diff
changeset
|
2028 def doit(localheads, remoteheads, remote=remote): |
14164
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2029 if opts.get('old'): |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2030 if localheads: |
16683 | 2031 raise util.Abort('cannot use localheads with old style ' |
2032 'discovery') | |
17192
1ac628cd7113
peer: introduce real peer classes
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
17191
diff
changeset
|
2033 if not util.safehasattr(remote, 'branches'): |
1ac628cd7113
peer: introduce real peer classes
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
17191
diff
changeset
|
2034 # enable in-client legacy support |
1ac628cd7113
peer: introduce real peer classes
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
17191
diff
changeset
|
2035 remote = localrepo.locallegacypeer(remote.local()) |
14164
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2036 common, _in, hds = treediscovery.findcommonincoming(repo, remote, |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2037 force=True) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2038 common = set(common) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2039 if not opts.get('nonheads'): |
18254
2dfe519d435d
debugdiscovery: report heads in sorted order
Mads Kiilerich <mads at kiilerich.com>
parents:
18210
diff
changeset
|
2040 ui.write(("unpruned common: %s\n") % |
2dfe519d435d
debugdiscovery: report heads in sorted order
Mads Kiilerich <mads at kiilerich.com>
parents:
18210
diff
changeset
|
2041 " ".join(sorted(short(n) for n in common))) |
14164
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2042 dag = dagutil.revlogdag(repo.changelog) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2043 all = dag.ancestorset(dag.internalizeall(common)) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2044 common = dag.externalizeall(dag.headsetofconnecteds(all)) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2045 else: |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2046 common, any, hds = setdiscovery.findcommonheads(ui, repo, remote) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2047 common = set(common) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2048 rheads = set(hds) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2049 lheads = set(repo.heads()) |
18254
2dfe519d435d
debugdiscovery: report heads in sorted order
Mads Kiilerich <mads at kiilerich.com>
parents:
18210
diff
changeset
|
2050 ui.write(("common heads: %s\n") % |
2dfe519d435d
debugdiscovery: report heads in sorted order
Mads Kiilerich <mads at kiilerich.com>
parents:
18210
diff
changeset
|
2051 " ".join(sorted(short(n) for n in common))) |
14164
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2052 if lheads <= common: |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2053 ui.write(("local is subset\n")) |
14164
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2054 elif rheads <= common: |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2055 ui.write(("remote is subset\n")) |
14164
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2056 |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2057 serverlogs = opts.get('serverlog') |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2058 if serverlogs: |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2059 for filename in serverlogs: |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2060 logfile = open(filename, 'r') |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2061 try: |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2062 line = logfile.readline() |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2063 while line: |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2064 parts = line.strip().split(';') |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2065 op = parts[1] |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2066 if op == 'cg': |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2067 pass |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2068 elif op == 'cgss': |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2069 doit(parts[2].split(' '), parts[3].split(' ')) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2070 elif op == 'unb': |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2071 doit(parts[3].split(' '), parts[2].split(' ')) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2072 line = logfile.readline() |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2073 finally: |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2074 logfile.close() |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2075 |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2076 else: |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2077 remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2078 opts.get('remote_head')) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2079 localrevs = opts.get('local_head') |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2080 doit(localrevs, remoterevs) |
cb98fed52495
discovery: add new set-based discovery
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14163
diff
changeset
|
2081 |
17370
3fe199579323
debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents:
17343
diff
changeset
|
2082 @command('debugfileset', |
3fe199579323
debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents:
17343
diff
changeset
|
2083 [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], |
3fe199579323
debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents:
17343
diff
changeset
|
2084 _('[-r REV] FILESPEC')) |
3fe199579323
debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents:
17343
diff
changeset
|
2085 def debugfileset(ui, repo, expr, **opts): |
14511
30506b894359
filesets: introduce basic fileset expression parser
Matt Mackall <mpm@selenic.com>
parents:
14509
diff
changeset
|
2086 '''parse and apply a fileset specification''' |
17370
3fe199579323
debugfileset: implement --rev, more tests
Patrick Mezard <patrick@mezard.eu>
parents:
17343
diff
changeset
|
2087 ctx = scmutil.revsingle(repo, opts.get('rev'), None) |
14511
30506b894359
filesets: introduce basic fileset expression parser
Matt Mackall <mpm@selenic.com>
parents:
14509
diff
changeset
|
2088 if ui.verbose: |
30506b894359
filesets: introduce basic fileset expression parser
Matt Mackall <mpm@selenic.com>
parents:
14509
diff
changeset
|
2089 tree = fileset.parse(expr)[0] |
30506b894359
filesets: introduce basic fileset expression parser
Matt Mackall <mpm@selenic.com>
parents:
14509
diff
changeset
|
2090 ui.note(tree, "\n") |
14673 | 2091 |
20404
466707047c8d
commands: use ctx.getfileset instead of fileset.getfileset
Augie Fackler <raf@durin42.com>
parents:
20389
diff
changeset
|
2092 for f in ctx.getfileset(expr): |
14551
68d814a3cefd
fileset: basic pattern and boolean support
Matt Mackall <mpm@selenic.com>
parents:
14548
diff
changeset
|
2093 ui.write("%s\n" % f) |
14511
30506b894359
filesets: introduce basic fileset expression parser
Matt Mackall <mpm@selenic.com>
parents:
14509
diff
changeset
|
2094 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
2095 @command('debugfsinfo', [], _('[PATH]'), norepo=True) |
19872
681f7b9213a4
check-code: check for spaces around = for named parameters
Mads Kiilerich <madski@unity3d.com>
parents:
19801
diff
changeset
|
2096 def debugfsinfo(ui, path="."): |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2097 """show information detected about current filesystem""" |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2098 util.writefile('.debugfsinfo', '') |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2099 ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2100 ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) |
19616
f959b60e3025
debugfs: add hardlink support reporting
Matt Mackall <mpm@selenic.com>
parents:
19523
diff
changeset
|
2101 ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2102 ui.write(('case-sensitive: %s\n') % (util.checkcase('.debugfsinfo') |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2103 and 'yes' or 'no')) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2104 os.unlink('.debugfsinfo') |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2105 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2106 @command('debuggetbundle', |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2107 [('H', 'head', [], _('id of head node'), _('ID')), |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2108 ('C', 'common', [], _('id of common node'), _('ID')), |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2109 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
2110 _('REPO FILE [-H|-C ID]...'), |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
2111 norepo=True) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2112 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2113 """retrieves a bundle from a repo |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2114 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2115 Every ID must be a full-length hex node id string. Saves the bundle to the |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2116 given file. |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2117 """ |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
2118 repo = hg.peer(ui, opts, repopath) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2119 if not repo.capable('getbundle'): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2120 raise util.Abort("getbundle() not supported by target repository") |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2121 args = {} |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2122 if common: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2123 args['common'] = [bin(s) for s in common] |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2124 if head: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2125 args['heads'] = [bin(s) for s in head] |
19201
309c439cdbaa
bundle-ng: add bundlecaps argument to getbundle() command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
19184
diff
changeset
|
2126 # TODO: get desired bundlecaps from command line. |
309c439cdbaa
bundle-ng: add bundlecaps argument to getbundle() command
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
19184
diff
changeset
|
2127 args['bundlecaps'] = None |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2128 bundle = repo.getbundle('debug', **args) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2129 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2130 bundletype = opts.get('type', 'bzip2').lower() |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2131 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2132 bundletype = btypes.get(bundletype) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2133 if bundletype not in changegroup.bundletypes: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2134 raise util.Abort(_('unknown bundle type specified with --type')) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2135 changegroup.writebundle(bundle, bundlepath, bundletype) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2136 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2137 @command('debugignore', [], '') |
13396
3e66eec9a814
add debugignore which yields the combined ignore patten of the .hgignore files
jfh <jason@jasonfharris.com>
parents:
13388
diff
changeset
|
2138 def debugignore(ui, repo, *values, **opts): |
3e66eec9a814
add debugignore which yields the combined ignore patten of the .hgignore files
jfh <jason@jasonfharris.com>
parents:
13388
diff
changeset
|
2139 """display the combined ignore pattern""" |
3e66eec9a814
add debugignore which yields the combined ignore patten of the .hgignore files
jfh <jason@jasonfharris.com>
parents:
13388
diff
changeset
|
2140 ignore = repo.dirstate._ignore |
14949
a4435770cf57
debugignore: use getattr instead of hasattr
Augie Fackler <durin42@gmail.com>
parents:
14943
diff
changeset
|
2141 includepat = getattr(ignore, 'includepat', None) |
a4435770cf57
debugignore: use getattr instead of hasattr
Augie Fackler <durin42@gmail.com>
parents:
14943
diff
changeset
|
2142 if includepat is not None: |
a4435770cf57
debugignore: use getattr instead of hasattr
Augie Fackler <durin42@gmail.com>
parents:
14943
diff
changeset
|
2143 ui.write("%s\n" % includepat) |
13406
5e57c199848d
debugignore: catch the case when ignore.includepat doesn't exist
jfh <jason@jasonfharris.com>
parents:
13400
diff
changeset
|
2144 else: |
5e57c199848d
debugignore: catch the case when ignore.includepat doesn't exist
jfh <jason@jasonfharris.com>
parents:
13400
diff
changeset
|
2145 raise util.Abort(_("no ignore patterns found")) |
13396
3e66eec9a814
add debugignore which yields the combined ignore patten of the .hgignore files
jfh <jason@jasonfharris.com>
parents:
13388
diff
changeset
|
2146 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2147 @command('debugindex', |
14323
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
2148 [('c', 'changelog', False, _('open changelog')), |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
2149 ('m', 'manifest', False, _('open manifest')), |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
2150 ('f', 'format', 0, _('revlog format'), _('FORMAT'))], |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
2151 _('[-f FORMAT] -c|-m|FILE'), |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
2152 optionalrepo=True) |
19872
681f7b9213a4
check-code: check for spaces around = for named parameters
Mads Kiilerich <madski@unity3d.com>
parents:
19801
diff
changeset
|
2153 def debugindex(ui, repo, file_=None, **opts): |
596 | 2154 """dump the contents of an index file""" |
14323
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
2155 r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) |
12893
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2156 format = opts.get('format', 0) |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2157 if format not in (0, 1): |
13470
64ce09e93aff
commands: mark strings for translation
Martin Geisler <mg@aragost.com>
parents:
13454
diff
changeset
|
2158 raise util.Abort(_("unknown format %d") % format) |
12893
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2159 |
14254
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2160 generaldelta = r.version & revlog.REVLOGGENERALDELTA |
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2161 if generaldelta: |
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2162 basehdr = ' delta' |
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2163 else: |
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2164 basehdr = ' base' |
12893
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2165 |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2166 if format == 0: |
14254
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2167 ui.write(" rev offset length " + basehdr + " linkrev" |
12893
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2168 " nodeid p1 p2\n") |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2169 elif format == 1: |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2170 ui.write(" rev flag offset length" |
16683 | 2171 " size " + basehdr + " link p1 p2" |
2172 " nodeid\n") | |
12893
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2173 |
6750
fb42030d79d6
add __len__ and __iter__ methods to repo and revlog
Matt Mackall <mpm@selenic.com>
parents:
6749
diff
changeset
|
2174 for i in r: |
2072 | 2175 node = r.node(i) |
14254
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2176 if generaldelta: |
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2177 base = r.deltaparent(i) |
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2178 else: |
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2179 base = r.chainbase(i) |
12893
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2180 if format == 0: |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2181 try: |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2182 pp = r.parents(node) |
16689
f366d4c2ff34
cleanup: replace naked excepts with except Exception: ...
Brodie Rao <brodie@sf.io>
parents:
16683
diff
changeset
|
2183 except Exception: |
12893
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2184 pp = [nullid, nullid] |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2185 ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( |
14254
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2186 i, r.start(i), r.length(i), base, r.linkrev(i), |
12893
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2187 short(node), short(pp[0]), short(pp[1]))) |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2188 elif format == 1: |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2189 pr = r.parentrevs(i) |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2190 ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ( |
15ca4bfecfe3
debugindex: add --format flag to allow debugging parentdelta
Matt Mackall <mpm@selenic.com>
parents:
12863
diff
changeset
|
2191 i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), |
14254
d6a762d93b77
debugindex: change output for generaldelta revlogs
Sune Foldager <cryo@cyanite.org>
parents:
14252
diff
changeset
|
2192 base, r.linkrev(i), pr[0], pr[1], short(node))) |
248 | 2193 |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
2194 @command('debugindexdot', [], _('FILE'), optionalrepo=True) |
12132
8a0e5b0c0ba9
debugindex(dot): try to access filelogs through repo, if possible
Sune Foldager <sune.foldager@edlund.dk>
parents:
12131
diff
changeset
|
2195 def debugindexdot(ui, repo, file_): |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
2196 """dump an index DAG as a graphviz dot file""" |
12132
8a0e5b0c0ba9
debugindex(dot): try to access filelogs through repo, if possible
Sune Foldager <sune.foldager@edlund.dk>
parents:
12131
diff
changeset
|
2197 r = None |
8a0e5b0c0ba9
debugindex(dot): try to access filelogs through repo, if possible
Sune Foldager <sune.foldager@edlund.dk>
parents:
12131
diff
changeset
|
2198 if repo: |
8a0e5b0c0ba9
debugindex(dot): try to access filelogs through repo, if possible
Sune Foldager <sune.foldager@edlund.dk>
parents:
12131
diff
changeset
|
2199 filelog = repo.file(file_) |
8a0e5b0c0ba9
debugindex(dot): try to access filelogs through repo, if possible
Sune Foldager <sune.foldager@edlund.dk>
parents:
12131
diff
changeset
|
2200 if len(filelog): |
8a0e5b0c0ba9
debugindex(dot): try to access filelogs through repo, if possible
Sune Foldager <sune.foldager@edlund.dk>
parents:
12131
diff
changeset
|
2201 r = filelog |
8a0e5b0c0ba9
debugindex(dot): try to access filelogs through repo, if possible
Sune Foldager <sune.foldager@edlund.dk>
parents:
12131
diff
changeset
|
2202 if not r: |
13970
d13913355390
move opener from util to scmutil
Adrian Buehlmann <adrian@cadifra.com>
parents:
13965
diff
changeset
|
2203 r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2204 ui.write(("digraph G {\n")) |
6750
fb42030d79d6
add __len__ and __iter__ methods to repo and revlog
Matt Mackall <mpm@selenic.com>
parents:
6749
diff
changeset
|
2205 for i in r: |
2287
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
2206 node = r.node(i) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
2207 pp = r.parents(node) |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
2208 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
|
2209 if pp[1] != nullid: |
3f18d1eea370
Update debugindexdot to work with RevlogNG.
Samuel Masham <samuel.masham@gmail.com>
parents:
2283
diff
changeset
|
2210 ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
582 | 2211 ui.write("}\n") |
248 | 2212 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
2213 @command('debuginstall', [], '', norepo=True) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2214 def debuginstall(ui): |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
2215 '''test Mercurial installation |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
2216 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
2217 Returns 0 on success. |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
2218 ''' |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2219 |
3846
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
2220 def writetemp(contents): |
4849
035489f60842
Use a prefix for debuginstall tempfiles.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
4818
diff
changeset
|
2221 (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
|
2222 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
|
2223 f.write(contents) |
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
2224 f.close() |
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
2225 return name |
18855084b922
Make debuginstall actually attempt to use external patch and merge
Matt Mackall <mpm@selenic.com>
parents:
3844
diff
changeset
|
2226 |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2227 problems = 0 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2228 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2229 # encoding |
16934
0c9c41e53f1a
debuginstall: lowercase status messages
Martin Geisler <mg@aragost.com>
parents:
16881
diff
changeset
|
2230 ui.status(_("checking encoding (%s)...\n") % encoding.encoding) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2231 try: |
7948
de377b1a9a84
move encoding bits from util to encoding
Matt Mackall <mpm@selenic.com>
parents:
7942
diff
changeset
|
2232 encoding.fromlocal("test") |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2233 except util.Abort, inst: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2234 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
|
2235 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
|
2236 problems += 1 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2237 |
20740
535283a7f5dd
debuginstall: add Python information to debuginstall output (issue4128)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20702
diff
changeset
|
2238 # Python |
20741
f1dfef0a9352
debuginstall: change showing to checking for consistency and future checking
Matt Mackall <mpm@selenic.com>
parents:
20740
diff
changeset
|
2239 ui.status(_("checking Python executable (%s)\n") % sys.executable) |
f1dfef0a9352
debuginstall: change showing to checking for consistency and future checking
Matt Mackall <mpm@selenic.com>
parents:
20740
diff
changeset
|
2240 ui.status(_("checking Python version (%s)\n") |
20740
535283a7f5dd
debuginstall: add Python information to debuginstall output (issue4128)
Chris Jerdonek <chris.jerdonek@gmail.com>
parents:
20702
diff
changeset
|
2241 % ("%s.%s.%s" % sys.version_info[:3])) |
17392
bdd248666dbc
debuginstall: show directory for Python lib
Adrian Buehlmann <adrian@cadifra.com>
parents:
17386
diff
changeset
|
2242 ui.status(_("checking Python lib (%s)...\n") |
bdd248666dbc
debuginstall: show directory for Python lib
Adrian Buehlmann <adrian@cadifra.com>
parents:
17386
diff
changeset
|
2243 % os.path.dirname(os.__file__)) |
bdd248666dbc
debuginstall: show directory for Python lib
Adrian Buehlmann <adrian@cadifra.com>
parents:
17386
diff
changeset
|
2244 |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2245 # compiled modules |
16934
0c9c41e53f1a
debuginstall: lowercase status messages
Martin Geisler <mg@aragost.com>
parents:
16881
diff
changeset
|
2246 ui.status(_("checking installed modules (%s)...\n") |
12004
1fe4702fe2df
debuginstall: report installpath
Matt Mackall <mpm@selenic.com>
parents:
11969
diff
changeset
|
2247 % os.path.dirname(__file__)) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2248 try: |
12004
1fe4702fe2df
debuginstall: report installpath
Matt Mackall <mpm@selenic.com>
parents:
11969
diff
changeset
|
2249 import bdiff, mpatch, base85, osutil |
15223
fc035e5370ca
pyflakes: clean up some import noise
Matt Mackall <mpm@selenic.com>
parents:
15221
diff
changeset
|
2250 dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2251 except Exception, inst: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2252 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
|
2253 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
|
2254 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
|
2255 problems += 1 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2256 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2257 # templates |
15200
797bf1dc1ff8
debuginstall: report the template path
Matt Mackall <mpm@selenic.com>
parents:
15198
diff
changeset
|
2258 import templater |
797bf1dc1ff8
debuginstall: report the template path
Matt Mackall <mpm@selenic.com>
parents:
15198
diff
changeset
|
2259 p = templater.templatepath() |
16934
0c9c41e53f1a
debuginstall: lowercase status messages
Martin Geisler <mg@aragost.com>
parents:
16881
diff
changeset
|
2260 ui.status(_("checking templates (%s)...\n") % ' '.join(p)) |
20389
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2261 if p: |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2262 m = templater.templatepath("map-cmdline.default") |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2263 if m: |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2264 # template found, check if it is working |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2265 try: |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2266 templater.templater(m) |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2267 except Exception, inst: |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2268 ui.write(" %s\n" % inst) |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2269 p = None |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2270 else: |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2271 ui.write(_(" template 'default' not found\n")) |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2272 p = None |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2273 else: |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2274 ui.write(_(" no template directories found\n")) |
9a86b5b8e0d8
commands: hg debuginstall checks missing templates (issue4151)
Simon Heimberg <simohe@besonet.ch>
parents:
20364
diff
changeset
|
2275 if not p: |
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
2276 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
|
2277 problems += 1 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2278 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2279 # editor |
16934
0c9c41e53f1a
debuginstall: lowercase status messages
Martin Geisler <mg@aragost.com>
parents:
16881
diff
changeset
|
2280 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
|
2281 editor = ui.geteditor() |
21957
2122b82b6987
debuginstall: handle quoted path for editor (issue4316)
Alexandre Garnier <zigarn@gmail.com>
parents:
21952
diff
changeset
|
2282 cmdpath = util.findexe(shlex.split(editor)[0]) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2283 if not cmdpath: |
3855
b9cdd6f2aa43
debuginstall: fix a copy/paste error
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3848
diff
changeset
|
2284 if editor == 'vi': |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2285 ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
12083
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
2286 ui.write(_(" (specify a commit editor in your configuration" |
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
2287 " file)\n")) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2288 else: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2289 ui.write(_(" Can't find editor '%s' in PATH\n") % editor) |
12083
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
2290 ui.write(_(" (specify a commit editor in your configuration" |
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
2291 " file)\n")) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2292 problems += 1 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2293 |
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
2294 # check username |
16934
0c9c41e53f1a
debuginstall: lowercase status messages
Martin Geisler <mg@aragost.com>
parents:
16881
diff
changeset
|
2295 ui.status(_("checking username...\n")) |
9734
36c388a1aa51
commands: call ui.username carefully in debuginstall
Martin Geisler <mg@lazybytes.net>
parents:
9725
diff
changeset
|
2296 try: |
12063
516b000fbb7e
cleanup: remove unused variables
Brodie Rao <brodie@bitheap.org>
parents:
12033
diff
changeset
|
2297 ui.username() |
9734
36c388a1aa51
commands: call ui.username carefully in debuginstall
Martin Geisler <mg@lazybytes.net>
parents:
9725
diff
changeset
|
2298 except util.Abort, e: |
36c388a1aa51
commands: call ui.username carefully in debuginstall
Martin Geisler <mg@lazybytes.net>
parents:
9725
diff
changeset
|
2299 ui.write(" %s\n" % e) |
12083
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
2300 ui.write(_(" (specify a username in your configuration file)\n")) |
9734
36c388a1aa51
commands: call ui.username carefully in debuginstall
Martin Geisler <mg@lazybytes.net>
parents:
9725
diff
changeset
|
2301 problems += 1 |
3848
8cbf060f637e
Add some remedies and a username check to debuginstall
Matt Mackall <mpm@selenic.com>
parents:
3846
diff
changeset
|
2302 |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2303 if not problems: |
16934
0c9c41e53f1a
debuginstall: lowercase status messages
Martin Geisler <mg@aragost.com>
parents:
16881
diff
changeset
|
2304 ui.status(_("no problems detected\n")) |
3844
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2305 else: |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2306 ui.write(_("%s problems detected," |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2307 " please check your install!\n") % problems) |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2308 |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2309 return problems |
3ba82c3f4bc3
Add debuginstall command to do basic install tests
Matt Mackall <mpm@selenic.com>
parents:
3840
diff
changeset
|
2310 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
2311 @command('debugknown', [], _('REPO ID...'), norepo=True) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2312 def debugknown(ui, repopath, *ids, **opts): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2313 """test whether node ids are known to a repo |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2314 |
16683 | 2315 Every ID must be a full-length hex node id string. Returns a list of 0s |
2316 and 1s indicating unknown/known. | |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2317 """ |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
2318 repo = hg.peer(ui, opts, repopath) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2319 if not repo.capable('known'): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2320 raise util.Abort("known() not supported by target repository") |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2321 flags = repo.known([bin(s) for s in ids]) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2322 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2323 |
18790
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2324 @command('debuglabelcomplete', [], _('LABEL...')) |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2325 def debuglabelcomplete(ui, repo, *args): |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2326 '''complete "labels" - tags, open branch names, bookmark names''' |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2327 |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2328 labels = set() |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2329 labels.update(t[0] for t in repo.tagslist()) |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2330 labels.update(repo._bookmarks.keys()) |
20191
cbe2bcc927cd
debuglabelcomplete: simplify with repo.branchmap().iterbranches()
Brodie Rao <brodie@sf.io>
parents:
20184
diff
changeset
|
2331 labels.update(tag for (tag, heads, tip, closed) |
cbe2bcc927cd
debuglabelcomplete: simplify with repo.branchmap().iterbranches()
Brodie Rao <brodie@sf.io>
parents:
20184
diff
changeset
|
2332 in repo.branchmap().iterbranches() if not closed) |
18790
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2333 completions = set() |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2334 if not args: |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2335 args = [''] |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2336 for a in args: |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2337 completions.update(l for l in labels if l.startswith(a)) |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2338 ui.write('\n'.join(sorted(completions))) |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2339 ui.write('\n') |
1e28a7f58f33
completion: add a debuglabelcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18783
diff
changeset
|
2340 |
17830
1cb51d65453d
debugobsolete: add --flags option
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
17822
diff
changeset
|
2341 @command('debugobsolete', |
1cb51d65453d
debugobsolete: add --flags option
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
17822
diff
changeset
|
2342 [('', 'flags', 0, _('markers flag')), |
22272
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2343 ('', 'record-parents', False, |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2344 _('record parent information for the precursor')), |
22274
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2345 ('r', 'rev', [], _('display markers relevant to REV')), |
17830
1cb51d65453d
debugobsolete: add --flags option
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
17822
diff
changeset
|
2346 ] + commitopts2, |
17074
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2347 _('[OBSOLETED [REPLACEMENT] [REPL... ]')) |
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2348 def debugobsolete(ui, repo, precursor=None, *successors, **opts): |
18657
d4a79e075303
debugobsolete: improve command help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18479
diff
changeset
|
2349 """create arbitrary obsolete marker |
d4a79e075303
debugobsolete: improve command help
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18479
diff
changeset
|
2350 |
18854
afab180307be
commands: fix typo in debugobsolete docstring
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
18701
diff
changeset
|
2351 With no arguments, displays the list of obsolescence markers.""" |
21789
15baed3f24ee
branchmap: don't use ui.warn for debug message
Matt Mackall <mpm@selenic.com>
parents:
21778
diff
changeset
|
2352 |
17292
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2353 def parsenodeid(s): |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2354 try: |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2355 # We do not use revsingle/revrange functions here to accept |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2356 # arbitrary node identifiers, possibly not present in the |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2357 # local repository. |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2358 n = bin(s) |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2359 if len(n) != len(nullid): |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2360 raise TypeError() |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2361 return n |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2362 except TypeError: |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2363 raise util.Abort('changeset references must be full hexadecimal ' |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2364 'node identifiers') |
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2365 |
17074
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2366 if precursor is not None: |
22274
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2367 if opts['rev']: |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2368 raise util.Abort('cannot select revision when creating marker') |
17074
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2369 metadata = {} |
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2370 metadata['user'] = opts['user'] or ui.username() |
17292
8da6fe276a23
debugobsolete: do not traceback on invalid node identifiers
Patrick Mezard <patrick@mezard.eu>
parents:
17266
diff
changeset
|
2371 succs = tuple(parsenodeid(succ) for succ in successors) |
17074
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2372 l = repo.lock() |
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2373 try: |
17126
8fa8717b47b6
obsolete: write obsolete marker inside a transaction
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
17123
diff
changeset
|
2374 tr = repo.transaction('debugobsolete') |
8fa8717b47b6
obsolete: write obsolete marker inside a transaction
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
17123
diff
changeset
|
2375 try: |
22176
328efb5ca0b4
debugobsolete: catch ValueError that may be raised by obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22103
diff
changeset
|
2376 try: |
22218
b629397ca15f
debugobsolete: use the new date argument on obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22216
diff
changeset
|
2377 date = opts.get('date') |
b629397ca15f
debugobsolete: use the new date argument on obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22216
diff
changeset
|
2378 if date: |
b629397ca15f
debugobsolete: use the new date argument on obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22216
diff
changeset
|
2379 date = util.parsedate(date) |
b629397ca15f
debugobsolete: use the new date argument on obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22216
diff
changeset
|
2380 else: |
b629397ca15f
debugobsolete: use the new date argument on obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22216
diff
changeset
|
2381 date = None |
22272
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2382 prec = parsenodeid(precursor) |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2383 parents = None |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2384 if opts['record_parents']: |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2385 if prec not in repo.unfiltered(): |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2386 raise util.Abort('cannot used --record-parents on ' |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2387 'unknown changesets') |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2388 parents = repo.unfiltered()[prec].parents() |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2389 parents = tuple(p.node() for p in parents) |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2390 repo.obsstore.create(tr, prec, succs, opts['flags'], |
406181ee335f
debugobsolete: add a way to record parent information
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22266
diff
changeset
|
2391 parents=parents, date=date, |
22218
b629397ca15f
debugobsolete: use the new date argument on obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22216
diff
changeset
|
2392 metadata=metadata) |
22176
328efb5ca0b4
debugobsolete: catch ValueError that may be raised by obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22103
diff
changeset
|
2393 tr.close() |
328efb5ca0b4
debugobsolete: catch ValueError that may be raised by obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22103
diff
changeset
|
2394 except ValueError, exc: |
328efb5ca0b4
debugobsolete: catch ValueError that may be raised by obsstore.create
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22103
diff
changeset
|
2395 raise util.Abort(_('bad obsmarker input: %s') % exc) |
17126
8fa8717b47b6
obsolete: write obsolete marker inside a transaction
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
17123
diff
changeset
|
2396 finally: |
8fa8717b47b6
obsolete: write obsolete marker inside a transaction
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
17123
diff
changeset
|
2397 tr.release() |
17074
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2398 finally: |
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2399 l.release() |
178a2e85d426
debugobsolete: list all obsolete marker if no argument are specified
Pierre-Yves.David@ens-lyon.org
parents:
17071
diff
changeset
|
2400 else: |
22274
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2401 if opts['rev']: |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2402 revs = scmutil.revrange(repo, opts['rev']) |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2403 nodes = [repo[r].node() for r in revs] |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2404 markers = list(obsolete.getmarkers(repo, nodes=nodes)) |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2405 markers.sort(key=lambda x: x._data) |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2406 else: |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2407 markers = obsolete.getmarkers(repo) |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2408 |
10e87c67f1c7
debugobsolete: add a --rev argument
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22273
diff
changeset
|
2409 for m in markers: |
20470
78f4c2b7052f
debugobsolete: extract marker display in a dedicated function
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
20404
diff
changeset
|
2410 cmdutil.showmarker(ui, m) |
17071
11f26e2669aa
command: creation of obsolete marker
Pierre-Yves.David@ens-lyon.org
parents:
17059
diff
changeset
|
2411 |
18792
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2412 @command('debugpathcomplete', |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2413 [('f', 'full', None, _('complete an entire path')), |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2414 ('n', 'normal', None, _('show only normal files')), |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2415 ('a', 'added', None, _('show only added files')), |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2416 ('r', 'removed', None, _('show only removed files'))], |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2417 _('FILESPEC...')) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2418 def debugpathcomplete(ui, repo, *specs, **opts): |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2419 '''complete part or all of a tracked path |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2420 |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2421 This command supports shells that offer path name completion. It |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2422 currently completes only files already known to the dirstate. |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2423 |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2424 Completion extends only to the next path segment unless |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2425 --full is specified, in which case entire paths are used.''' |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2426 |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2427 def complete(path, acceptable): |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2428 dirstate = repo.dirstate |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2429 spec = os.path.normpath(os.path.join(os.getcwd(), path)) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2430 rootdir = repo.root + os.sep |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2431 if spec != repo.root and not spec.startswith(rootdir): |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2432 return [], [] |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2433 if os.path.isdir(spec): |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2434 spec += '/' |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2435 spec = spec[len(rootdir):] |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2436 fixpaths = os.sep != '/' |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2437 if fixpaths: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2438 spec = spec.replace(os.sep, '/') |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2439 speclen = len(spec) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2440 fullpaths = opts['full'] |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2441 files, dirs = set(), set() |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2442 adddir, addfile = dirs.add, files.add |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2443 for f, st in dirstate.iteritems(): |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2444 if f.startswith(spec) and st[0] in acceptable: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2445 if fixpaths: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2446 f = f.replace('/', os.sep) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2447 if fullpaths: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2448 addfile(f) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2449 continue |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2450 s = f.find(os.sep, speclen) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2451 if s >= 0: |
20136
1df77035c814
pathcomplete: remove ambiguous entries for sole completion on a directory
Sean Farley <sean.michael.farley@gmail.com>
parents:
20108
diff
changeset
|
2452 adddir(f[:s]) |
18792
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2453 else: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2454 addfile(f) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2455 return files, dirs |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2456 |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2457 acceptable = '' |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2458 if opts['normal']: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2459 acceptable += 'nm' |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2460 if opts['added']: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2461 acceptable += 'a' |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2462 if opts['removed']: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2463 acceptable += 'r' |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2464 cwd = repo.getcwd() |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2465 if not specs: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2466 specs = ['.'] |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2467 |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2468 files, dirs = set(), set() |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2469 for spec in specs: |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2470 f, d = complete(spec, acceptable or 'nmar') |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2471 files.update(f) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2472 dirs.update(d) |
18796
fa6d5c62f3bd
pathcomplete: complete directories more conservatively
Bryan O'Sullivan <bryano@fb.com>
parents:
18792
diff
changeset
|
2473 files.update(dirs) |
18792
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2474 ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2475 ui.write('\n') |
10669e24eb6c
completion: add a debugpathcomplete command
Bryan O'Sullivan <bryano@fb.com>
parents:
18790
diff
changeset
|
2476 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
2477 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True) |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
2478 def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2479 '''access the pushkey key/value protocol |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2480 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2481 With two args, list the keys in the given namespace. |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2482 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2483 With five args, set a key to new if it currently is set to old. |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2484 Reports success or failure. |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2485 ''' |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2486 |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
2487 target = hg.peer(ui, {}, repopath) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2488 if keyinfo: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2489 key, old, new = keyinfo |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2490 r = target.pushkey(namespace, key, old, new) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2491 ui.status(str(r) + '\n') |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2492 return not r |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2493 else: |
18255
7ca534f31a83
debugpushkey: list keys sorted
Mads Kiilerich <mads at kiilerich.com>
parents:
18254
diff
changeset
|
2494 for k, v in sorted(target.listkeys(namespace).iteritems()): |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2495 ui.write("%s\t%s\n" % (k.encode('string-escape'), |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2496 v.encode('string-escape'))) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2497 |
16249 | 2498 @command('debugpvec', [], _('A B')) |
2499 def debugpvec(ui, repo, a, b=None): | |
2500 ca = scmutil.revsingle(repo, a) | |
2501 cb = scmutil.revsingle(repo, b) | |
2502 pa = pvec.ctxpvec(ca) | |
2503 pb = pvec.ctxpvec(cb) | |
2504 if pa == pb: | |
2505 rel = "=" | |
2506 elif pa > pb: | |
2507 rel = ">" | |
2508 elif pa < pb: | |
2509 rel = "<" | |
2510 elif pa | pb: | |
2511 rel = "|" | |
2512 ui.write(_("a: %s\n") % pa) | |
2513 ui.write(_("b: %s\n") % pb) | |
2514 ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth)) | |
2515 ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") % | |
2516 (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec), | |
2517 pa.distance(pb), rel)) | |
2518 | |
18963
c31b8dc9de67
debugrebuildstate: rename to debugrebuilddirstate
Mads Kiilerich <madski@unity3d.com>
parents:
18962
diff
changeset
|
2519 @command('debugrebuilddirstate|debugrebuildstate', |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2520 [('r', 'rev', '', _('revision to rebuild to'), _('REV'))], |
18961
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2521 _('[-r REV]')) |
18963
c31b8dc9de67
debugrebuildstate: rename to debugrebuilddirstate
Mads Kiilerich <madski@unity3d.com>
parents:
18962
diff
changeset
|
2522 def debugrebuilddirstate(ui, repo, rev): |
18961
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2523 """rebuild the dirstate as it would look like for the given revision |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2524 |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2525 If no revision is specified the first current parent will be used. |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2526 |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2527 The dirstate will be set to the files of the given revision. |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2528 The actual working directory content or existing dirstate |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2529 information such as adds or removes is not considered. |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2530 |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2531 One use of this command is to make the next :hg:`status` invocation |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2532 check the actual file content. |
cd1ac2e54847
debugrebuildstate: clarify that rev can't be specified without -r
Mads Kiilerich <madski@unity3d.com>
parents:
18956
diff
changeset
|
2533 """ |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
2534 ctx = scmutil.revsingle(repo, rev) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2535 wlock = repo.wlock() |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2536 try: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2537 repo.dirstate.rebuild(ctx.node(), ctx.manifest()) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2538 finally: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2539 wlock.release() |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2540 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2541 @command('debugrename', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2542 [('r', 'rev', '', _('revision to debug'), _('REV'))], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2543 _('[-r REV] FILE')) |
3652 | 2544 def debugrename(ui, repo, file1, *pats, **opts): |
1194
c165cbf56bb1
Add doc string for debugrename.
bos@serpentine.internal.keyresearch.com
parents:
1193
diff
changeset
|
2545 """dump rename information""" |
3652 | 2546 |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
2547 ctx = scmutil.revsingle(repo, opts.get('rev')) |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
2548 m = scmutil.match(ctx, (file1,) + pats, opts) |
6764 | 2549 for abs in ctx.walk(m): |
2550 fctx = ctx[abs] | |
6579
0159b7a36184
walk: pass match object to cmdutil.walk
Matt Mackall <mpm@selenic.com>
parents:
6578
diff
changeset
|
2551 o = fctx.filelog().renamed(fctx.filenode()) |
6584
29c77e5dfb3c
walk: remove rel and exact returns
Matt Mackall <mpm@selenic.com>
parents:
6583
diff
changeset
|
2552 rel = m.rel(abs) |
6579
0159b7a36184
walk: pass match object to cmdutil.walk
Matt Mackall <mpm@selenic.com>
parents:
6578
diff
changeset
|
2553 if o: |
0159b7a36184
walk: pass match object to cmdutil.walk
Matt Mackall <mpm@selenic.com>
parents:
6578
diff
changeset
|
2554 ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) |
3652 | 2555 else: |
2556 ui.write(_("%s not renamed\n") % rel) | |
1116 | 2557 |
14323
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
2558 @command('debugrevlog', |
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
2559 [('c', 'changelog', False, _('open changelog')), |
14326
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2560 ('m', 'manifest', False, _('open manifest')), |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2561 ('d', 'dump', False, _('dump index data'))], |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
2562 _('-c|-m|FILE'), |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
2563 optionalrepo=True) |
19872
681f7b9213a4
check-code: check for spaces around = for named parameters
Mads Kiilerich <madski@unity3d.com>
parents:
19801
diff
changeset
|
2564 def debugrevlog(ui, repo, file_=None, **opts): |
14304 | 2565 """show data and statistics about a revlog""" |
14323
a79fea6b3e77
debugindex etc.: add --changelog and --manifest options
Sune Foldager <cryo@cyanite.org>
parents:
14322
diff
changeset
|
2566 r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) |
14326
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2567 |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2568 if opts.get("dump"): |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2569 numrevs = len(r) |
21032
67b6f1144e90
debugrevlog: format columns (more) nicely when dumping index data
Mads Kiilerich <madski@unity3d.com>
parents:
21021
diff
changeset
|
2570 ui.write("# rev p1rev p2rev start end deltastart base p1 p2" |
22311
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2571 " rawsize totalsize compression heads chainlen\n") |
14326
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2572 ts = 0 |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2573 heads = set() |
22311
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2574 rindex = r.index |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2575 |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2576 def chainbaseandlen(rev): |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2577 clen = 0 |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2578 base = rindex[rev][3] |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2579 while base != rev: |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2580 clen += 1 |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2581 rev = base |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2582 base = rindex[rev][3] |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2583 return base, clen |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2584 |
14326
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2585 for rev in xrange(numrevs): |
14371 | 2586 dbase = r.deltaparent(rev) |
2587 if dbase == -1: | |
2588 dbase = rev | |
22311
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2589 cbase, clen = chainbaseandlen(rev) |
14326
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2590 p1, p2 = r.parentrevs(rev) |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2591 rs = r.rawsize(rev) |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2592 ts = ts + rs |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2593 heads -= set(r.parentrevs(rev)) |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2594 heads.add(rev) |
22311
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2595 ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d " |
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2596 "%11d %5d %8d\n" % |
14326
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2597 (rev, p1, p2, r.start(rev), r.end(rev), |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2598 r.start(dbase), r.start(cbase), |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2599 r.start(p1), r.start(p2), |
22311
5038dee5bdd6
debugrevlog: add chainlen column to --dump output
Sune Foldager <cryo@cyanite.org>
parents:
22310
diff
changeset
|
2600 rs, ts, ts / r.end(rev), len(heads), clen)) |
14326
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2601 return 0 |
6078a99af433
debugrevlog: add --dump flag to dump graphable per-revision statistics
Matt Mackall <mpm@selenic.com>
parents:
14323
diff
changeset
|
2602 |
14304 | 2603 v = r.version |
2604 format = v & 0xFFFF | |
2605 flags = [] | |
2606 gdelta = False | |
2607 if v & revlog.REVLOGNGINLINEDATA: | |
2608 flags.append('inline') | |
2609 if v & revlog.REVLOGGENERALDELTA: | |
2610 gdelta = True | |
2611 flags.append('generaldelta') | |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2612 if not flags: |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2613 flags = ['(none)'] |
14304 | 2614 |
2615 nummerges = 0 | |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2616 numfull = 0 |
14304 | 2617 numprev = 0 |
2618 nump1 = 0 | |
2619 nump2 = 0 | |
2620 numother = 0 | |
2621 nump1prev = 0 | |
2622 nump2prev = 0 | |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2623 chainlengths = [] |
14304 | 2624 |
2625 datasize = [None, 0, 0L] | |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2626 fullsize = [None, 0, 0L] |
14304 | 2627 deltasize = [None, 0, 0L] |
2628 | |
2629 def addsize(size, l): | |
2630 if l[0] is None or size < l[0]: | |
2631 l[0] = size | |
2632 if size > l[1]: | |
2633 l[1] = size | |
2634 l[2] += size | |
2635 | |
2636 numrevs = len(r) | |
2637 for rev in xrange(numrevs): | |
2638 p1, p2 = r.parentrevs(rev) | |
2639 delta = r.deltaparent(rev) | |
2640 if format > 0: | |
2641 addsize(r.rawsize(rev), datasize) | |
2642 if p2 != nullrev: | |
2643 nummerges += 1 | |
2644 size = r.length(rev) | |
2645 if delta == nullrev: | |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2646 chainlengths.append(0) |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2647 numfull += 1 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2648 addsize(size, fullsize) |
14304 | 2649 else: |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2650 chainlengths.append(chainlengths[delta] + 1) |
14304 | 2651 addsize(size, deltasize) |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2652 if delta == rev - 1: |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2653 numprev += 1 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2654 if delta == p1: |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2655 nump1prev += 1 |
14304 | 2656 elif delta == p2: |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2657 nump2prev += 1 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2658 elif delta == p1: |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2659 nump1 += 1 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2660 elif delta == p2: |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2661 nump2 += 1 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2662 elif delta != nullrev: |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2663 numother += 1 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2664 |
17188
76e55914c303
debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
17182
diff
changeset
|
2665 # Adjust size min value for empty cases |
76e55914c303
debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
17182
diff
changeset
|
2666 for size in (datasize, fullsize, deltasize): |
76e55914c303
debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
17182
diff
changeset
|
2667 if size[0] is None: |
76e55914c303
debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
17182
diff
changeset
|
2668 size[0] = 0 |
76e55914c303
debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
17182
diff
changeset
|
2669 |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2670 numdeltas = numrevs - numfull |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2671 numoprev = numprev - nump1prev - nump2prev |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2672 totalrawsize = datasize[2] |
14304 | 2673 datasize[2] /= numrevs |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2674 fulltotal = fullsize[2] |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2675 fullsize[2] /= numfull |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2676 deltatotal = deltasize[2] |
17188
76e55914c303
debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
17182
diff
changeset
|
2677 if numrevs - numfull > 0: |
76e55914c303
debugrevlog: handle numrevs == numfull case (issue3537)
Patrick Mezard <patrick@mezard.eu>
parents:
17182
diff
changeset
|
2678 deltasize[2] /= numrevs - numfull |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2679 totalsize = fulltotal + deltatotal |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2680 avgchainlen = sum(chainlengths) / numrevs |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2681 compratio = totalrawsize / totalsize |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2682 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2683 basedfmtstr = '%%%dd\n' |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2684 basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n' |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2685 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2686 def dfmtstr(max): |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2687 return basedfmtstr % len(str(max)) |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2688 def pcfmtstr(max, padding=0): |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2689 return basepcfmtstr % (len(str(max)), ' ' * padding) |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2690 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2691 def pcfmt(value, total): |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2692 return (value, 100 * float(value) / total) |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2693 |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2694 ui.write(('format : %d\n') % format) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2695 ui.write(('flags : %s\n') % ', '.join(flags)) |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2696 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2697 ui.write('\n') |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2698 fmt = pcfmtstr(totalsize) |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2699 fmt2 = dfmtstr(totalsize) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2700 ui.write(('revisions : ') + fmt2 % numrevs) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2701 ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2702 ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2703 ui.write(('revisions : ') + fmt2 % numrevs) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2704 ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2705 ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2706 ui.write(('revision size : ') + fmt2 % totalsize) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2707 ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2708 ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2709 |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2710 ui.write('\n') |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2711 fmt = dfmtstr(max(avgchainlen, compratio)) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2712 ui.write(('avg chain length : ') + fmt % avgchainlen) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2713 ui.write(('compression ratio : ') + fmt % compratio) |
14304 | 2714 |
2715 if format > 0: | |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2716 ui.write('\n') |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2717 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') |
14304 | 2718 % tuple(datasize)) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2719 ui.write(('full revision size (min/max/avg) : %d / %d / %d\n') |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2720 % tuple(fullsize)) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2721 ui.write(('delta size (min/max/avg) : %d / %d / %d\n') |
14304 | 2722 % tuple(deltasize)) |
2723 | |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2724 if numdeltas > 0: |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2725 ui.write('\n') |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2726 fmt = pcfmtstr(numdeltas) |
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2727 fmt2 = pcfmtstr(numdeltas, 4) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2728 ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas)) |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2729 if numprev > 0: |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2730 ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev, |
16683 | 2731 numprev)) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2732 ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev, |
16683 | 2733 numprev)) |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2734 ui.write((' other : ') + fmt2 % pcfmt(numoprev, |
16683 | 2735 numprev)) |
14305
32a548776b65
debugrevlog: many improvements
Sune Foldager <cryo@cyanite.org>
parents:
14304
diff
changeset
|
2736 if gdelta: |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2737 ui.write(('deltas against p1 : ') |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2738 + fmt % pcfmt(nump1, numdeltas)) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2739 ui.write(('deltas against p2 : ') |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2740 + fmt % pcfmt(nump2, numdeltas)) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2741 ui.write(('deltas against other : ') + fmt % pcfmt(numother, |
16683 | 2742 numdeltas)) |
14304 | 2743 |
20497
19b1c62cee1c
commands.debugrevspec: add an option to print the optimized expression tree
Siddharth Agarwal <sid0@fb.com>
parents:
20470
diff
changeset
|
2744 @command('debugrevspec', |
19b1c62cee1c
commands.debugrevspec: add an option to print the optimized expression tree
Siddharth Agarwal <sid0@fb.com>
parents:
20470
diff
changeset
|
2745 [('', 'optimize', None, _('print parsed tree after optimizing'))], |
19b1c62cee1c
commands.debugrevspec: add an option to print the optimized expression tree
Siddharth Agarwal <sid0@fb.com>
parents:
20470
diff
changeset
|
2746 ('REVSPEC')) |
19b1c62cee1c
commands.debugrevspec: add an option to print the optimized expression tree
Siddharth Agarwal <sid0@fb.com>
parents:
20470
diff
changeset
|
2747 def debugrevspec(ui, repo, expr, **opts): |
16104
5535e66b3016
debugrevspec: mention --verbose to print the parsed tree
Patrick Mezard <patrick@mezard.eu>
parents:
16097
diff
changeset
|
2748 """parse and apply a revision specification |
5535e66b3016
debugrevspec: mention --verbose to print the parsed tree
Patrick Mezard <patrick@mezard.eu>
parents:
16097
diff
changeset
|
2749 |
5535e66b3016
debugrevspec: mention --verbose to print the parsed tree
Patrick Mezard <patrick@mezard.eu>
parents:
16097
diff
changeset
|
2750 Use --verbose to print the parsed tree before and after aliases |
5535e66b3016
debugrevspec: mention --verbose to print the parsed tree
Patrick Mezard <patrick@mezard.eu>
parents:
16097
diff
changeset
|
2751 expansion. |
5535e66b3016
debugrevspec: mention --verbose to print the parsed tree
Patrick Mezard <patrick@mezard.eu>
parents:
16097
diff
changeset
|
2752 """ |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2753 if ui.verbose: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2754 tree = revset.parse(expr)[0] |
16218
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
16192
diff
changeset
|
2755 ui.note(revset.prettyformat(tree), "\n") |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2756 newtree = revset.findaliases(ui, tree) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2757 if newtree != tree: |
16218
81a1a00f5738
debugrevspec: pretty print output
Patrick Mezard <patrick@mezard.eu>
parents:
16192
diff
changeset
|
2758 ui.note(revset.prettyformat(newtree), "\n") |
20497
19b1c62cee1c
commands.debugrevspec: add an option to print the optimized expression tree
Siddharth Agarwal <sid0@fb.com>
parents:
20470
diff
changeset
|
2759 if opts["optimize"]: |
19b1c62cee1c
commands.debugrevspec: add an option to print the optimized expression tree
Siddharth Agarwal <sid0@fb.com>
parents:
20470
diff
changeset
|
2760 weight, optimizedtree = revset.optimize(newtree, True) |
19b1c62cee1c
commands.debugrevspec: add an option to print the optimized expression tree
Siddharth Agarwal <sid0@fb.com>
parents:
20470
diff
changeset
|
2761 ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n") |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2762 func = revset.match(ui, expr) |
20526
9ad6dae67845
revset: changed revsets to use spanset
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
20500
diff
changeset
|
2763 for c in func(repo, revset.spanset(repo)): |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2764 ui.write("%s\n" % c) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2765 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2766 @command('debugsetparents', [], _('REV1 [REV2]')) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2767 def debugsetparents(ui, repo, rev1, rev2=None): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2768 """manually set the parents of the current working directory |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2769 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2770 This is useful for writing repository conversion tools, but should |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2771 be used with care. |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2772 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2773 Returns 0 on success. |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2774 """ |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2775 |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
2776 r1 = scmutil.revsingle(repo, rev1).node() |
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
2777 r2 = scmutil.revsingle(repo, rev2, 'null').node() |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2778 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2779 wlock = repo.wlock() |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2780 try: |
22405
6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
Durham Goode <durham@fb.com>
parents:
22390
diff
changeset
|
2781 repo.dirstate.beginparentchange() |
16551
ebf6d38c9063
localrepo: add setparents() to adjust dirstate copies (issue3407)
Patrick Mezard <patrick@mezard.eu>
parents:
16505
diff
changeset
|
2782 repo.setparents(r1, r2) |
22405
6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
Durham Goode <durham@fb.com>
parents:
22390
diff
changeset
|
2783 repo.dirstate.endparentchange() |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2784 finally: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2785 wlock.release() |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2786 |
18962
c0b2cb62067f
debugstate: rename to debugdirstate
Mads Kiilerich <madski@unity3d.com>
parents:
18961
diff
changeset
|
2787 @command('debugdirstate|debugstate', |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2788 [('', 'nodates', None, _('do not display the saved mtime')), |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2789 ('', 'datesort', None, _('sort by saved mtime'))], |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2790 _('[OPTION]...')) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2791 def debugstate(ui, repo, nodates=None, datesort=None): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2792 """show the contents of the current dirstate""" |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2793 timestr = "" |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2794 showdate = not nodates |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2795 if datesort: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2796 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2797 else: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2798 keyfunc = None # sort by filename |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2799 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2800 if showdate: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2801 if ent[3] == -1: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2802 # Pad or slice to locale representation |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2803 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2804 time.localtime(0))) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2805 timestr = 'unset' |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2806 timestr = (timestr[:locale_len] + |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2807 ' ' * (locale_len - len(timestr))) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2808 else: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2809 timestr = time.strftime("%Y-%m-%d %H:%M:%S ", |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2810 time.localtime(ent[3])) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2811 if ent[1] & 020000: |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2812 mode = 'lnk' |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2813 else: |
15440
9ab2b3b730ee
windows: use umask 022 in debugstate output
Mads Kiilerich <mads@kiilerich.com>
parents:
15424
diff
changeset
|
2814 mode = '%3o' % (ent[1] & 0777 & ~util.umask) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2815 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2816 for f in repo.dirstate.copies(): |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2817 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2818 |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2819 @command('debugsub', |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2820 [('r', 'rev', '', |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2821 _('revision to check'), _('REV'))], |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2822 _('[-r REV] [REV]')) |
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2823 def debugsub(ui, repo, rev=None): |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
2824 ctx = scmutil.revsingle(repo, rev, None) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2825 for k, v in sorted(ctx.substate.items()): |
17956
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2826 ui.write(('path %s\n') % k) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2827 ui.write((' source %s\n') % v[0]) |
a08775ec89f2
i18n: wrap false positives for translation detection
Matt Mackall <mpm@selenic.com>
parents:
17950
diff
changeset
|
2828 ui.write((' revision %s\n') % v[1]) |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2829 |
18068
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2830 @command('debugsuccessorssets', |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2831 [], |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2832 _('[REV]')) |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2833 def debugsuccessorssets(ui, repo, *revs): |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2834 """show set of successors for revision |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2835 |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2836 A successors set of changeset A is a consistent group of revisions that |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2837 succeed A. It contains non-obsolete changesets only. |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2838 |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2839 In most cases a changeset A has a single successors set containing a single |
18458
9354a8c1bded
debugsuccessorssets: fix typos in docstring
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
18386
diff
changeset
|
2840 successor (changeset A replaced by A'). |
18068
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2841 |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2842 A changeset that is made obsolete with no successors are called "pruned". |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2843 Such changesets have no successors sets at all. |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2844 |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2845 A changeset that has been "split" will have a successors set containing |
18458
9354a8c1bded
debugsuccessorssets: fix typos in docstring
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
18386
diff
changeset
|
2846 more than one successor. |
18068
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2847 |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2848 A changeset that has been rewritten in multiple different ways is called |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2849 "divergent". Such changesets have multiple successor sets (each of which |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2850 may also be split, i.e. have multiple successors). |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2851 |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2852 Results are displayed as follows:: |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2853 |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2854 <rev1> |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2855 <successors-1A> |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2856 <rev2> |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2857 <successors-2A> |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2858 <successors-2B1> <successors-2B2> <successors-2B3> |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2859 |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2860 Here rev2 has two possible (i.e. divergent) successors sets. The first |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2861 holds one element, whereas the second holds three (i.e. the changeset has |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2862 been split). |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2863 """ |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2864 # passed to successorssets caching computation from one call to another |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2865 cache = {} |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2866 ctx2str = str |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2867 node2str = short |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2868 if ui.debug(): |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2869 def ctx2str(ctx): |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2870 return ctx.hex() |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2871 node2str = hex |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2872 for rev in scmutil.revrange(repo, revs): |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2873 ctx = repo[rev] |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2874 ui.write('%s\n'% ctx2str(ctx)) |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2875 for succsset in obsolete.successorssets(repo, ctx.node(), cache): |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2876 if succsset: |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2877 ui.write(' ') |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2878 ui.write(node2str(succsset[0])) |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2879 for node in succsset[1:]: |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2880 ui.write(' ') |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2881 ui.write(node2str(node)) |
4bec77e62c00
obsolete: compute successors set
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18053
diff
changeset
|
2882 ui.write('\n') |
14302
b0f97b2589cc
order commands alphabetically
Sune Foldager <cryo@cyanite.org>
parents:
14297
diff
changeset
|
2883 |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
2884 @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'), inferrepo=True) |
820
89985a1b3427
Clean up walk and changes code to use normalised names properly.
Bryan O'Sullivan <bos@serpentine.com>
parents:
815
diff
changeset
|
2885 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
|
2886 """show how files match on given patterns""" |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
2887 m = scmutil.match(repo[None], pats, opts) |
6585 | 2888 items = list(repo.walk(m)) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2889 if not items: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
2890 return |
16953
634ad0b24ba2
debugwalk: observe ui.slash config option
Adrian Buehlmann <adrian@cadifra.com>
parents:
16949
diff
changeset
|
2891 f = lambda fn: fn |
634ad0b24ba2
debugwalk: observe ui.slash config option
Adrian Buehlmann <adrian@cadifra.com>
parents:
16949
diff
changeset
|
2892 if ui.configbool('ui', 'slash') and os.sep != '/': |
634ad0b24ba2
debugwalk: observe ui.slash config option
Adrian Buehlmann <adrian@cadifra.com>
parents:
16949
diff
changeset
|
2893 f = lambda fn: util.normpath(fn) |
6586
d3463007d368
walk: return a single value
Matt Mackall <mpm@selenic.com>
parents:
6585
diff
changeset
|
2894 fmt = 'f %%-%ds %%-%ds %%s' % ( |
d3463007d368
walk: return a single value
Matt Mackall <mpm@selenic.com>
parents:
6585
diff
changeset
|
2895 max([len(abs) for abs in items]), |
d3463007d368
walk: return a single value
Matt Mackall <mpm@selenic.com>
parents:
6585
diff
changeset
|
2896 max([len(m.rel(abs)) for abs in items])) |
d3463007d368
walk: return a single value
Matt Mackall <mpm@selenic.com>
parents:
6585
diff
changeset
|
2897 for abs in items: |
16953
634ad0b24ba2
debugwalk: observe ui.slash config option
Adrian Buehlmann <adrian@cadifra.com>
parents:
16949
diff
changeset
|
2898 line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') |
1309
332f225b835c
Make debugwalk strip trailing spaces and remove these from test-walk.out
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1285
diff
changeset
|
2899 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
|
2900 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2901 @command('debugwireargs', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2902 [('', 'three', '', 'three'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2903 ('', 'four', '', 'four'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2904 ('', 'five', '', 'five'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2905 ] + remoteopts, |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
2906 _('REPO [OPTIONS]... [ONE [TWO]]'), |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
2907 norepo=True) |
13720
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2908 def debugwireargs(ui, repopath, *vals, **opts): |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
2909 repo = hg.peer(ui, opts, repopath) |
13720
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2910 for opt in remoteopts: |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2911 del opts[opt[1]] |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2912 args = {} |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2913 for k, v in opts.iteritems(): |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2914 if v: |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2915 args[k] = v |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2916 # run twice to check that we don't mess up the stream for the next command |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2917 res1 = repo.debugwireargs(*vals, **args) |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2918 res2 = repo.debugwireargs(*vals, **args) |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2919 ui.write("%s\n" % res1) |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2920 if res1 != res2: |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2921 ui.warn("%s\n" % res2) |
9c4e04fe267e
debug: add debugwireargs to test argument passing over the wire
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13697
diff
changeset
|
2922 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2923 @command('^diff', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2924 [('r', 'rev', [], _('revision'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2925 ('c', 'change', '', _('change made by revision'), _('REV')) |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
2926 ] + diffopts + diffopts2 + walkopts + subrepoopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
2927 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
2928 inferrepo=True) |
732
ba0b6d17a6de
Convert diff command over to using walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
731
diff
changeset
|
2929 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
|
2930 """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
|
2931 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2932 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
|
2933 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2934 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
|
2935 |
12389 | 2936 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
2937 |
12389 | 2938 diff may generate unexpected results for merges, as it will |
2939 default to comparing against the working directory's first | |
2940 parent changeset if no revisions are specified. | |
3822
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
2941 |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2942 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
|
2943 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
|
2944 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
|
2945 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
|
2946 to its parent. |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2947 |
10527
9c0ba837dc65
commands: correct diff -c explanation
timeless <timeless@mozdev.org>
parents:
10520
diff
changeset
|
2948 Alternatively you can specify -c/--change with a revision to see |
9c0ba837dc65
commands: correct diff -c explanation
timeless <timeless@mozdev.org>
parents:
10520
diff
changeset
|
2949 the changes in that changeset relative to its first parent. |
10520 | 2950 |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
2951 Without the -a/--text option, diff will avoid generating diffs of |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
2952 files it detects as binary. With -a, diff will generate a diff |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
2953 anyway, probably with undesirable results. |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
2954 |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
2955 Use the -g/--git option to generate diffs in the git extended diff |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
2956 format. For more information, read :hg:`help diffs`. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
2957 |
15110 | 2958 .. container:: verbose |
2959 | |
2960 Examples: | |
2961 | |
2962 - compare a file in the current working directory to its parent:: | |
2963 | |
2964 hg diff foo.c | |
2965 | |
2966 - compare two historical versions of a directory, with rename info:: | |
2967 | |
2968 hg diff --git -r 1.0:1.2 lib/ | |
2969 | |
2970 - get change stats relative to the last change on some date:: | |
2971 | |
2972 hg diff --stat -r "date('may 2')" | |
2973 | |
2974 - diff all newly-added files that contain a keyword:: | |
2975 | |
2976 hg diff "set:added() and grep(GNU)" | |
2977 | |
2978 - compare a revision and its parents:: | |
2979 | |
2980 hg diff -c 9353 # compare against first parent | |
2981 hg diff -r 9353^:9353 # same using revset syntax | |
2982 hg diff -r 9353^2:9353 # compare against the second parent | |
2983 | |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
2984 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
2985 """ |
7628
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2986 |
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2987 revs = opts.get('rev') |
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2988 change = opts.get('change') |
9640
9e76232fbfbe
diff: add --stat for diffstat output
Brodie Rao <me+hg@dackz.net>
parents:
9636
diff
changeset
|
2989 stat = opts.get('stat') |
9857
24bc6e414610
diff: change --inverse to --reverse
Martin Geisler <mg@lazybytes.net>
parents:
9839
diff
changeset
|
2990 reverse = opts.get('reverse') |
7628
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2991 |
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2992 if revs and change: |
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2993 msg = _('cannot specify --rev and --change at the same time') |
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2994 raise util.Abort(msg) |
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2995 elif change: |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
2996 node2 = scmutil.revsingle(repo, change, None).node() |
13878
a8d13ee0ce68
misc: replace .parents()[0] with p1()
Matt Mackall <mpm@selenic.com>
parents:
13855
diff
changeset
|
2997 node1 = repo[node2].p1().node() |
7628
9c6ae2e09e11
diff: add --change option to display single changeset diff (issue1420)
Stepan Koltsov <yozh@mx1.ru>
parents:
7622
diff
changeset
|
2998 else: |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
2999 node1, node2 = scmutil.revpair(repo, revs) |
245 | 3000 |
9857
24bc6e414610
diff: change --inverse to --reverse
Martin Geisler <mg@lazybytes.net>
parents:
9839
diff
changeset
|
3001 if reverse: |
9725
3f522d2fa633
diff: add --inverse option
Yannick Gingras <ygingras@ygingras.net>
parents:
9718
diff
changeset
|
3002 node1, node2 = node2, node1 |
3f522d2fa633
diff: add --inverse option
Yannick Gingras <ygingras@ygingras.net>
parents:
9718
diff
changeset
|
3003 |
9642
7d17794f08a9
diffstat: with --git, mark binary files with Bin
Brodie Rao <me+hg@dackz.net>
parents:
9640
diff
changeset
|
3004 diffopts = patch.diffopts(ui, opts) |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
3005 m = scmutil.match(repo[node2], pats, opts) |
12167
d2c5b0927c28
diff: recurse into subrepositories with --subrepos/-S flag
Martin Geisler <mg@lazybytes.net>
parents:
12166
diff
changeset
|
3006 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, |
d2c5b0927c28
diff: recurse into subrepositories with --subrepos/-S flag
Martin Geisler <mg@lazybytes.net>
parents:
12166
diff
changeset
|
3007 listsubrepos=opts.get('subrepos')) |
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
|
3008 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3009 @command('^export', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3010 [('o', 'output', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3011 _('print output to file with formatted name'), _('FORMAT')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3012 ('', 'switch-parent', None, _('diff against the second parent')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3013 ('r', 'rev', [], _('revisions to export'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3014 ] + diffopts, |
18956
1a9ad84583ee
export: export working directory parent by default
Mads Kiilerich <mads@kiilerich.com>
parents:
18955
diff
changeset
|
3015 _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...')) |
580 | 3016 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
|
3017 """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
|
3018 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3019 Print the changeset header and diffs for one or more revisions. |
18956
1a9ad84583ee
export: export working directory parent by default
Mads Kiilerich <mads@kiilerich.com>
parents:
18955
diff
changeset
|
3020 If no revision is given, the parent of the working directory is used. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3021 |
10334
3d75c691b77d
commands: fix the list of changeset header information in 'hg help export'
Steve Losh <steve@stevelosh.com>
parents:
10331
diff
changeset
|
3022 The information shown in the changeset header is: author, date, |
10335
6ae4f390ec61
commands: fix more changeset header information in 'hg help export'
Steve Losh <steve@stevelosh.com>
parents:
10334
diff
changeset
|
3023 branch name (if non-default), changeset hash, parent(s) and commit |
6ae4f390ec61
commands: fix more changeset header information in 'hg help export'
Steve Losh <steve@stevelosh.com>
parents:
10334
diff
changeset
|
3024 comment. |
3822
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
3025 |
12390
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
3026 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
3027 |
12390
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
3028 export may generate unexpected diff output for merge |
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
3029 changesets, as it will compare the merge changeset against its |
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
3030 first parent only. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3031 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3032 Output may be to a file, in which case the name of the file is |
9892
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
3033 given using a format string. The formatting rules are as follows: |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
3034 |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
3035 :``%%``: literal "%" character |
11718
3e979f47a4c9
help: fix bytes/digit confusion for hashes
Matt Mackall <mpm@selenic.com>
parents:
11697
diff
changeset
|
3036 :``%H``: changeset hash (40 hexadecimal digits) |
9892
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
3037 :``%N``: number of patches being generated |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
3038 :``%R``: changeset revision number |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
3039 :``%b``: basename of the exporting repository |
11718
3e979f47a4c9
help: fix bytes/digit confusion for hashes
Matt Mackall <mpm@selenic.com>
parents:
11697
diff
changeset
|
3040 :``%h``: short-form changeset hash (12 hexadecimal digits) |
14986
70e11de6964d
export: add %m to file format string (first line of the commit message)
Andrzej Bieniek <andyhelp@gmail.com>
parents:
14954
diff
changeset
|
3041 :``%m``: first line of the commit message (only alphanumeric characters) |
9892
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
3042 :``%n``: zero-padded sequence number, starting at 1 |
4322e39bd525
commands: use field lists instead of literal blocks in docstrings
Martin Geisler <mg@lazybytes.net>
parents:
9891
diff
changeset
|
3043 :``%r``: zero-padded changeset revision number |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3044 |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
3045 Without the -a/--text option, export will avoid generating diffs |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
3046 of files it detects as binary. With -a, export will generate a |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
3047 diff anyway, probably with undesirable results. |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
3048 |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
3049 Use the -g/--git option to generate diffs in the git extended diff |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
3050 format. See :hg:`help diffs` for more information. |
7307
56380212d630
help: commands supporting --git point to the gitdiffs topic (issue1352)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7303
diff
changeset
|
3051 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3052 With the --switch-parent option, the diff will be against the |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3053 second parent. It can be useful to review a merge. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3054 |
15111 | 3055 .. container:: verbose |
3056 | |
3057 Examples: | |
3058 | |
3059 - use export and import to transplant a bugfix to the current | |
3060 branch:: | |
3061 | |
3062 hg export -r 9353 | hg import - | |
3063 | |
3064 - export all the changesets between two revisions to a file with | |
3065 rename information:: | |
3066 | |
3067 hg export --git -r 123:150 > changes.txt | |
3068 | |
3069 - split outgoing changes into a series of patches with | |
3070 descriptive names:: | |
3071 | |
3072 hg export -r "outgoing()" -o "%n-%m.patch" | |
3073 | |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3074 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3075 """ |
10015
b5f352f33520
commands.export: accept -r option as revision specification
Alexander Solovyov <piranha@piranha.org.ua>
parents:
10014
diff
changeset
|
3076 changesets += tuple(opts.get('rev', [])) |
18956
1a9ad84583ee
export: export working directory parent by default
Mads Kiilerich <mads@kiilerich.com>
parents:
18955
diff
changeset
|
3077 if not changesets: |
1a9ad84583ee
export: export working directory parent by default
Mads Kiilerich <mads@kiilerich.com>
parents:
18955
diff
changeset
|
3078 changesets = ['.'] |
16357
8ca7187d479f
export: catch exporting empty revsets (issue3353)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
16231
diff
changeset
|
3079 revs = scmutil.revrange(repo, changesets) |
8ca7187d479f
export: catch exporting empty revsets (issue3353)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
16231
diff
changeset
|
3080 if not revs: |
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
|
3081 raise util.Abort(_("export requires at least one changeset")) |
2874
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
3082 if len(revs) > 1: |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
3083 ui.note(_('exporting patches:\n')) |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
3084 else: |
4ec58b157265
refactor text diff/patch code.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2871
diff
changeset
|
3085 ui.note(_('exporting patch:\n')) |
10611
e764f24a45ee
patch/diff: move patch.export() to cmdutil.export()
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10596
diff
changeset
|
3086 cmdutil.export(repo, revs, template=opts.get('output'), |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
3087 switch_parent=opts.get('switch_parent'), |
2888
3848488244fc
Move ui.diffopts to patch.diffopts where it belongs
Matt Mackall <mpm@selenic.com>
parents:
2883
diff
changeset
|
3088 opts=patch.diffopts(ui, opts)) |
246
96cde50a746f
Migrate rawcommit, import, export, history, and merge
mpm@selenic.com
parents:
245
diff
changeset
|
3089 |
22423
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3090 @command('files', |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3091 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3092 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
22429
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
3093 ] + walkopts + formatteropts, |
22423
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3094 _('[OPTION]... [PATTERN]...')) |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3095 def files(ui, repo, *pats, **opts): |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3096 """list tracked files |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3097 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3098 Print files under Mercurial control in the working directory or |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3099 specified revision whose names match the given patterns (excluding |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3100 removed files). |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3101 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3102 If no patterns are given to match, this command prints the names |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3103 of all files under Mercurial control in the working copy. |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3104 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3105 .. container:: verbose |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3106 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3107 Examples: |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3108 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3109 - list all files under the current directory:: |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3110 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3111 hg files . |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3112 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3113 - shows sizes and flags for current revision:: |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3114 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3115 hg files -vr . |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3116 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3117 - list all files named README:: |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3118 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3119 hg files -I "**/README" |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3120 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3121 - list all binary files:: |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3122 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3123 hg files "set:binary()" |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3124 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3125 - find files containing a regular expression: |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3126 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3127 hg files "set:grep('bob')" |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3128 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3129 - search tracked file contents with xargs and grep:: |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3130 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3131 hg files -0 | xargs -0 grep foo |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3132 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3133 See :hg:'help pattern' and :hg:'help revsets' for more information |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3134 on specifying file patterns. |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3135 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3136 Returns 0 if a match is found, 1 otherwise. |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3137 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3138 """ |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3139 ctx = scmutil.revsingle(repo, opts.get('rev'), None) |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3140 rev = ctx.rev() |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3141 ret = 1 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3142 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3143 end = '\n' |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3144 if opts.get('print0'): |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3145 end = '\0' |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3146 fm = ui.formatter('status', opts) |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3147 fmt = '%s' + end |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3148 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3149 m = scmutil.match(ctx, pats, opts) |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3150 for f in ctx.walk(m): |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3151 if rev is None and repo.dirstate[f] in 'R?!': |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3152 continue |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3153 fm.startitem() |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3154 if ui.verbose: |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3155 fc = ctx[f] |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3156 fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3157 fm.data(abspath=f) |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3158 fm.write('path', fmt, m.rel(f)) |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3159 ret = 0 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3160 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3161 fm.end() |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3162 |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3163 return ret |
edf07a804ac4
files: add new command unifying locate and manifest functionality
Matt Mackall <mpm@selenic.com>
parents:
22419
diff
changeset
|
3164 |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
3165 @command('^forget', walkopts, _('[OPTION]... FILE...'), inferrepo=True) |
8902
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3166 def forget(ui, repo, *pats, **opts): |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3167 """forget the specified files on the next commit |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3168 |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3169 Mark the specified files so they will no longer be tracked |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3170 after the next commit. |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3171 |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3172 This only removes files from the current branch, not from the |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3173 entire project history, and it does not delete them from the |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3174 working directory. |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3175 |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
3176 To undo a forget before the next commit, see :hg:`add`. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3177 |
15118 | 3178 .. container:: verbose |
3179 | |
3180 Examples: | |
3181 | |
3182 - forget newly-added binary files:: | |
3183 | |
3184 hg forget "set:added() and binary()" | |
3185 | |
3186 - forget files that would be excluded by .hgignore:: | |
3187 | |
3188 hg forget "set:hgignore()" | |
3189 | |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3190 Returns 0 on success. |
8902
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3191 """ |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3192 |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3193 if not pats: |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3194 raise util.Abort(_('no files specified')) |
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3195 |
15912
2bd54ffaa27e
forget: fix subrepo recursion for explicit path handling
David M. Carr <david@carrclan.us>
parents:
15911
diff
changeset
|
3196 m = scmutil.match(repo[None], pats, opts) |
2bd54ffaa27e
forget: fix subrepo recursion for explicit path handling
David M. Carr <david@carrclan.us>
parents:
15911
diff
changeset
|
3197 rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0] |
2bd54ffaa27e
forget: fix subrepo recursion for explicit path handling
David M. Carr <david@carrclan.us>
parents:
15911
diff
changeset
|
3198 return rejected and 1 or 0 |
8902
b9a8b616521d
Add a forget command for easily untracking files.
Steve Losh <steve@stevelosh.com>
parents:
8879
diff
changeset
|
3199 |
15240
bfb93963bb39
graft: add user, date, and tool options
Matt Mackall <mpm@selenic.com>
parents:
15239
diff
changeset
|
3200 @command( |
bfb93963bb39
graft: add user, date, and tool options
Matt Mackall <mpm@selenic.com>
parents:
15239
diff
changeset
|
3201 'graft', |
16992
55e7f352b1d3
graft: allow -r to specify revisions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
16991
diff
changeset
|
3202 [('r', 'rev', [], _('revisions to graft'), _('REV')), |
55e7f352b1d3
graft: allow -r to specify revisions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
16991
diff
changeset
|
3203 ('c', 'continue', False, _('resume interrupted graft')), |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3204 ('e', 'edit', False, _('invoke editor on commit messages')), |
16660
2a71cc53f244
graft: implement --log (issue3438)
Levi Bard <levi@unity3d.com>
parents:
16659
diff
changeset
|
3205 ('', 'log', None, _('append graft info to log message')), |
21979
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3206 ('f', 'force', False, _('force graft')), |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3207 ('D', 'currentdate', False, |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3208 _('record the current date as commit date')), |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3209 ('U', 'currentuser', False, |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3210 _('record the current user as committer'), _('DATE'))] |
16389
79fecd735d26
graft: add --dry-run support (issue3362)
Matt Mackall <mpm@selenic.com>
parents:
16373
diff
changeset
|
3211 + commitopts2 + mergetoolopts + dryrunopts, |
16992
55e7f352b1d3
graft: allow -r to specify revisions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
16991
diff
changeset
|
3212 _('[OPTION]... [-r] REV...')) |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3213 def graft(ui, repo, *revs, **opts): |
15238
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3214 '''copy changes from other branches onto the current branch |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3215 |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3216 This command uses Mercurial's merge logic to copy individual |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3217 changes from other branches without merging branches in the |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3218 history graph. This is sometimes known as 'backporting' or |
15242
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3219 'cherry-picking'. By default, graft will copy user, date, and |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3220 description from the source changesets. |
15238
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3221 |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3222 Changesets that are ancestors of the current revision, that have |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3223 already been grafted, or that are merges will be skipped. |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3224 |
16660
2a71cc53f244
graft: implement --log (issue3438)
Levi Bard <levi@unity3d.com>
parents:
16659
diff
changeset
|
3225 If --log is specified, log messages will have a comment appended |
2a71cc53f244
graft: implement --log (issue3438)
Levi Bard <levi@unity3d.com>
parents:
16659
diff
changeset
|
3226 of the form:: |
2a71cc53f244
graft: implement --log (issue3438)
Levi Bard <levi@unity3d.com>
parents:
16659
diff
changeset
|
3227 |
2a71cc53f244
graft: implement --log (issue3438)
Levi Bard <levi@unity3d.com>
parents:
16659
diff
changeset
|
3228 (grafted from CHANGESETHASH) |
2a71cc53f244
graft: implement --log (issue3438)
Levi Bard <levi@unity3d.com>
parents:
16659
diff
changeset
|
3229 |
21979
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3230 If --force is specified, revisions will be grafted even if they |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3231 are already ancestors of or have been grafted to the destination. |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3232 This is useful when the revisions have since been backed out. |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3233 |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3234 If a graft merge results in conflicts, the graft process is |
15701
32a6e00e4cfe
graft: use consistent language in help
Kevin Bullock <kbullock@ringworld.org>
parents:
15633
diff
changeset
|
3235 interrupted so that the current merge can be manually resolved. |
32a6e00e4cfe
graft: use consistent language in help
Kevin Bullock <kbullock@ringworld.org>
parents:
15633
diff
changeset
|
3236 Once all conflicts are addressed, the graft process can be |
32a6e00e4cfe
graft: use consistent language in help
Kevin Bullock <kbullock@ringworld.org>
parents:
15633
diff
changeset
|
3237 continued with the -c/--continue option. |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3238 |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3239 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
3240 |
21980
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3241 The -c/--continue option does not reapply earlier options, except |
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3242 for --force. |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3243 |
15242
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3244 .. container:: verbose |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3245 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3246 Examples: |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3247 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3248 - copy a single change to the stable branch and edit its description:: |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3249 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3250 hg update stable |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3251 hg graft --edit 9393 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3252 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3253 - graft a range of changesets with one exception, updating dates:: |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3254 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3255 hg graft -D "2085::2093 and not 2091" |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3256 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3257 - continue a graft after resolving conflicts:: |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3258 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3259 hg graft -c |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3260 |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3261 - show the source of a grafted changeset:: |
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3262 |
19401
49acaa2b9701
log: remove tip from example
Matt Mackall <mpm@selenic.com>
parents:
19400
diff
changeset
|
3263 hg log --debug -r . |
15242
dac2edce4e4a
graft: add examples and information about copied metadata
Matt Mackall <mpm@selenic.com>
parents:
15241
diff
changeset
|
3264 |
21949
ad56fc55cbc3
graft: add a reference to revsets to the help text (issue3362)
Alexander Becher <Alexander.Becher@RuD-Steuerungstechnik.De>
parents:
21947
diff
changeset
|
3265 See :hg:`help revisions` and :hg:`help revsets` for more about |
ad56fc55cbc3
graft: add a reference to revsets to the help text (issue3362)
Alexander Becher <Alexander.Becher@RuD-Steuerungstechnik.De>
parents:
21947
diff
changeset
|
3266 specifying revisions. |
ad56fc55cbc3
graft: add a reference to revsets to the help text (issue3362)
Alexander Becher <Alexander.Becher@RuD-Steuerungstechnik.De>
parents:
21947
diff
changeset
|
3267 |
15238
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3268 Returns 0 on successful completion. |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3269 ''' |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3270 |
16992
55e7f352b1d3
graft: allow -r to specify revisions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
16991
diff
changeset
|
3271 revs = list(revs) |
55e7f352b1d3
graft: allow -r to specify revisions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
16991
diff
changeset
|
3272 revs.extend(opts['rev']) |
55e7f352b1d3
graft: allow -r to specify revisions
Thomas Arendsen Hein <thomas@intevation.de>
parents:
16991
diff
changeset
|
3273 |
15240
bfb93963bb39
graft: add user, date, and tool options
Matt Mackall <mpm@selenic.com>
parents:
15239
diff
changeset
|
3274 if not opts.get('user') and opts.get('currentuser'): |
bfb93963bb39
graft: add user, date, and tool options
Matt Mackall <mpm@selenic.com>
parents:
15239
diff
changeset
|
3275 opts['user'] = ui.username() |
bfb93963bb39
graft: add user, date, and tool options
Matt Mackall <mpm@selenic.com>
parents:
15239
diff
changeset
|
3276 if not opts.get('date') and opts.get('currentdate'): |
bfb93963bb39
graft: add user, date, and tool options
Matt Mackall <mpm@selenic.com>
parents:
15239
diff
changeset
|
3277 opts['date'] = "%d %d" % util.makedate() |
bfb93963bb39
graft: add user, date, and tool options
Matt Mackall <mpm@selenic.com>
parents:
15239
diff
changeset
|
3278 |
22008
b02ab548ab5c
graft: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22007
diff
changeset
|
3279 editor = cmdutil.getcommiteditor(editform='graft', **opts) |
15239 | 3280 |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3281 cont = False |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3282 if opts['continue']: |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3283 cont = True |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3284 if revs: |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3285 raise util.Abort(_("can't specify --continue and revisions")) |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3286 # read in unfinished revisions |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3287 try: |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3288 nodes = repo.opener.read('graftstate').splitlines() |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3289 revs = [repo[node].rev() for node in nodes] |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3290 except IOError, inst: |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3291 if inst.errno != errno.ENOENT: |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3292 raise |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3293 raise util.Abort(_("no graft state found, can't continue")) |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3294 else: |
19476
4fed15d4c5aa
commands: add checks for unfinished operations (issue3955)
Matt Mackall <mpm@selenic.com>
parents:
19475
diff
changeset
|
3295 cmdutil.checkunfinished(repo) |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3296 cmdutil.bailifchanged(repo) |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3297 if not revs: |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3298 raise util.Abort(_('no revisions specified')) |
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3299 revs = scmutil.revrange(repo, revs) |
15238
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3300 |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3301 # check for merges |
15404
c1eb8398fe82
localrepo: convert various repo.set() users to repo.revs()
Matt Mackall <mpm@selenic.com>
parents:
15381
diff
changeset
|
3302 for rev in repo.revs('%ld and merge()', revs): |
c1eb8398fe82
localrepo: convert various repo.set() users to repo.revs()
Matt Mackall <mpm@selenic.com>
parents:
15381
diff
changeset
|
3303 ui.warn(_('skipping ungraftable merge revision %s\n') % rev) |
c1eb8398fe82
localrepo: convert various repo.set() users to repo.revs()
Matt Mackall <mpm@selenic.com>
parents:
15381
diff
changeset
|
3304 revs.remove(rev) |
15238
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3305 if not revs: |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3306 return -1 |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3307 |
21980
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3308 # Don't check in the --continue case, in effect retaining --force across |
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3309 # --continues. That's because without --force, any revisions we decided to |
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3310 # skip would have been filtered out here, so they wouldn't have made their |
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3311 # way to the graftstate. With --force, any revisions we would have otherwise |
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3312 # skipped would not have been filtered out, and if they hadn't been applied |
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3313 # already, they'd have been in the graftstate. |
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3314 if not (cont or opts.get('force')): |
f4e5753745e9
graft: make --force apply across continues (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21979
diff
changeset
|
3315 # check for ancestors of dest branch |
21979
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3316 crev = repo['.'].rev() |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3317 ancestors = repo.changelog.ancestors([crev], inclusive=True) |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3318 # Cannot use x.remove(y) on smart set, this has to be a list. |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3319 # XXX make this lazy in the future |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3320 revs = list(revs) |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3321 # don't mutate while iterating, create a copy |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3322 for rev in list(revs): |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3323 if rev in ancestors: |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3324 ui.warn(_('skipping ancestor revision %s\n') % rev) |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3325 # XXX remove on list is slow |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3326 revs.remove(rev) |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3327 if not revs: |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3328 return -1 |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3329 |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3330 # analyze revs for earlier grafts |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3331 ids = {} |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3332 for ctx in repo.set("%ld", revs): |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3333 ids[ctx.hex()] = ctx.rev() |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3334 n = ctx.extra().get('source') |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3335 if n: |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3336 ids[n] = ctx.rev() |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3337 |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3338 # check ancestors for earlier grafts |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3339 ui.debug('scanning for duplicate grafts\n') |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3340 |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3341 for rev in repo.changelog.findmissingrevs(revs, [crev]): |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3342 ctx = repo[rev] |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3343 n = ctx.extra().get('source') |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3344 if n in ids: |
22305 | 3345 try: |
3346 r = repo[n].rev() | |
3347 except error.RepoLookupError: | |
3348 r = None | |
21979
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3349 if r in revs: |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3350 ui.warn(_('skipping revision %s (already grafted to %s)\n') |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3351 % (r, rev)) |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3352 revs.remove(r) |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3353 elif ids[n] in revs: |
22305 | 3354 if r is None: |
3355 ui.warn(_('skipping already grafted revision %s ' | |
3356 '(%s also has unknown origin %s)\n') | |
3357 % (ids[n], rev, n)) | |
3358 else: | |
3359 ui.warn(_('skipping already grafted revision %s ' | |
3360 '(%s also has origin %d)\n') | |
3361 % (ids[n], rev, r)) | |
21979
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3362 revs.remove(ids[n]) |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3363 elif ctx.hex() in ids: |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3364 r = ids[ctx.hex()] |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3365 ui.warn(_('skipping already grafted revision %s ' |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3366 '(was grafted from %d)\n') % (r, rev)) |
15360
73628b32d0c0
graft: fix duplicate filter logic
Matt Mackall <mpm@selenic.com>
parents:
15359
diff
changeset
|
3367 revs.remove(r) |
21979
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3368 if not revs: |
c2863cfe8a8a
graft: allow regrafting ancestors with --force (issue3220)
Siddharth Agarwal <sid0@fb.com>
parents:
21959
diff
changeset
|
3369 return -1 |
15238
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3370 |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3371 wlock = repo.wlock() |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3372 try: |
18039
2c2564280900
graft: explicit current node tracking
David Schleimer <dschleimer@fb.com>
parents:
18038
diff
changeset
|
3373 current = repo['.'] |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3374 for pos, ctx in enumerate(repo.set("%ld", revs)): |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3375 |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3376 ui.status(_('grafting revision %s\n') % ctx.rev()) |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3377 if opts.get('dry_run'): |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3378 continue |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3379 |
18038
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3380 source = ctx.extra().get('source') |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3381 if not source: |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3382 source = ctx.hex() |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3383 extra = {'source': source} |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3384 user = ctx.user() |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3385 if opts.get('user'): |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3386 user = opts['user'] |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3387 date = ctx.date() |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3388 if opts.get('date'): |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3389 date = opts['date'] |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3390 message = ctx.description() |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3391 if opts.get('log'): |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3392 message += '\n(grafted from %s)' % ctx.hex() |
f8aee8033ab2
graft: move commit info building
David Schleimer <dschleimer@fb.com>
parents:
17990
diff
changeset
|
3393 |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3394 # we don't merge the first commit when continuing |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3395 if not cont: |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3396 # perform the graft merge with p1(rev) as 'ancestor' |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3397 try: |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3398 # ui.forcemerge is an internal variable, do not document |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
3399 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
3400 'graft') |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3401 stats = mergemod.update(repo, ctx.node(), True, True, False, |
21525
559f01f19cf6
graft: customize graft conflict markers (BC)
Durham Goode <durham@fb.com>
parents:
21503
diff
changeset
|
3402 ctx.p1().node(), |
559f01f19cf6
graft: customize graft conflict markers (BC)
Durham Goode <durham@fb.com>
parents:
21503
diff
changeset
|
3403 labels=['local', 'graft']) |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3404 finally: |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
3405 repo.ui.setconfig('ui', 'forcemerge', '', 'graft') |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3406 # report any conflicts |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3407 if stats and stats[3] > 0: |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3408 # write out state for --continue |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3409 nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3410 repo.opener.write('graftstate', ''.join(nodelines)) |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3411 raise util.Abort( |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3412 _("unresolved conflicts, can't continue"), |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3413 hint=_('use hg resolve and hg graft --continue')) |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3414 else: |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3415 cont = False |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3416 |
17045
52ea9ce5b641
graft: don't drop the second parent on unsuccessful merge (issue3498)
Yuya Nishihara <yuya@tcha.org>
parents:
16877
diff
changeset
|
3417 # drop the second merge parent |
22405
6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
Durham Goode <durham@fb.com>
parents:
22390
diff
changeset
|
3418 repo.dirstate.beginparentchange() |
17045
52ea9ce5b641
graft: don't drop the second parent on unsuccessful merge (issue3498)
Yuya Nishihara <yuya@tcha.org>
parents:
16877
diff
changeset
|
3419 repo.setparents(current.node(), nullid) |
52ea9ce5b641
graft: don't drop the second parent on unsuccessful merge (issue3498)
Yuya Nishihara <yuya@tcha.org>
parents:
16877
diff
changeset
|
3420 repo.dirstate.write() |
52ea9ce5b641
graft: don't drop the second parent on unsuccessful merge (issue3498)
Yuya Nishihara <yuya@tcha.org>
parents:
16877
diff
changeset
|
3421 # fix up dirstate for copies and renames |
52ea9ce5b641
graft: don't drop the second parent on unsuccessful merge (issue3498)
Yuya Nishihara <yuya@tcha.org>
parents:
16877
diff
changeset
|
3422 cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) |
22405
6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
Durham Goode <durham@fb.com>
parents:
22390
diff
changeset
|
3423 repo.dirstate.endparentchange() |
17045
52ea9ce5b641
graft: don't drop the second parent on unsuccessful merge (issue3498)
Yuya Nishihara <yuya@tcha.org>
parents:
16877
diff
changeset
|
3424 |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3425 # commit |
16660
2a71cc53f244
graft: implement --log (issue3438)
Levi Bard <levi@unity3d.com>
parents:
16659
diff
changeset
|
3426 node = repo.commit(text=message, user=user, |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3427 date=date, extra=extra, editor=editor) |
16600
b54f3c502e63
graft: remark on empty graft
Matt Mackall <mpm@selenic.com>
parents:
16591
diff
changeset
|
3428 if node is None: |
b54f3c502e63
graft: remark on empty graft
Matt Mackall <mpm@selenic.com>
parents:
16591
diff
changeset
|
3429 ui.status(_('graft for revision %s is empty\n') % ctx.rev()) |
18039
2c2564280900
graft: explicit current node tracking
David Schleimer <dschleimer@fb.com>
parents:
18038
diff
changeset
|
3430 else: |
2c2564280900
graft: explicit current node tracking
David Schleimer <dschleimer@fb.com>
parents:
18038
diff
changeset
|
3431 current = repo[node] |
16473
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3432 finally: |
7adc521259d4
commands: add missing wlock to graft
Idan Kamara <idankk86@gmail.com>
parents:
16471
diff
changeset
|
3433 wlock.release() |
15238
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3434 |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3435 # remove state when we complete successfully |
18386
03442135dff4
refactoring: use unlinkpath with ignoremissing
Mads Kiilerich <madski@unity3d.com>
parents:
18366
diff
changeset
|
3436 if not opts.get('dry_run'): |
03442135dff4
refactoring: use unlinkpath with ignoremissing
Mads Kiilerich <madski@unity3d.com>
parents:
18366
diff
changeset
|
3437 util.unlinkpath(repo.join('graftstate'), ignoremissing=True) |
15241
e4d135632f6d
graft: add --continue support
Matt Mackall <mpm@selenic.com>
parents:
15240
diff
changeset
|
3438 |
15238
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3439 return 0 |
2d710c12ffc0
graft: add initial implementation
Matt Mackall <mpm@selenic.com>
parents:
15232
diff
changeset
|
3440 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3441 @command('grep', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3442 [('0', 'print0', None, _('end fields with NUL')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3443 ('', 'all', None, _('print all revisions that match')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3444 ('a', 'text', None, _('treat all files as text')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3445 ('f', 'follow', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3446 _('follow changeset history,' |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3447 ' or file history across copies and renames')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3448 ('i', 'ignore-case', None, _('ignore case when matching')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3449 ('l', 'files-with-matches', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3450 _('print only filenames and revisions that match')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3451 ('n', 'line-number', None, _('print matching line numbers')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3452 ('r', 'rev', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3453 _('only search files changed within revision range'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3454 ('u', 'user', None, _('list the author (long with -v)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3455 ('d', 'date', None, _('list the date (short with -q)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3456 ] + walkopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
3457 _('[OPTION]... PATTERN [FILE]...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
3458 inferrepo=True) |
1108
7a75d8fbbdaf
Remove some options from 'hg grep':
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1106
diff
changeset
|
3459 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
|
3460 """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
|
3461 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3462 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
|
3463 |
6448
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
3464 This command behaves differently than Unix grep. It only accepts |
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
3465 Python/Perl regexps. It searches repository history, not the |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3466 working directory. It always prints the revision number in which a |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3467 match appears. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3468 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3469 By default, grep only prints output for the first revision of a |
6448
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
3470 file in which it finds a match. To get it to print every revision |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3471 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
|
3472 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
|
3473 use the --all flag. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3474 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3475 Returns 0 if a match is found, 1 otherwise. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3476 """ |
15765
1ef46bcd76f8
grep: make multiline mode the default (BC)
Matt Mackall <mpm@selenic.com>
parents:
15744
diff
changeset
|
3477 reflags = re.M |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
3478 if opts.get('ignore_case'): |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3479 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
|
3480 try: |
21911
760f4055e656
commands: use util.re.compile instead of util.compilere
Siddharth Agarwal <sid0@fb.com>
parents:
21848
diff
changeset
|
3481 regexp = util.re.compile(pattern, reflags) |
12385
9a93f4fb141b
grep: only catch re.error when compiling regular expressions
Brodie Rao <brodie@bitheap.org>
parents:
12382
diff
changeset
|
3482 except re.error, inst: |
6057
218d5b9aa466
Remove trailing ! from two error messages as this was confusing.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6048
diff
changeset
|
3483 ui.warn(_("grep: invalid match pattern: %s\n") % inst) |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3484 return 1 |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
3485 sep, eol = ':', '\n' |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
3486 if opts.get('print0'): |
1146
9061f79c6c6f
grep: extend functionality, add man page entry, add unit test.
bos@serpentine.internal.keyresearch.com
parents:
1145
diff
changeset
|
3487 sep = eol = '\0' |
1057 | 3488 |
9097
431462bd8478
fix memory usage of revlog caches by limiting cache size [issue1639]
Matt Mackall <mpm@selenic.com>
parents:
8995
diff
changeset
|
3489 getfile = util.lrucachefunc(repo.file) |
1057 | 3490 |
3491 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
|
3492 begin = 0 |
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
3493 linenum = 0 |
17949
407209261f63
grep: remove useless while condition
Kevin Bullock <kbullock@ringworld.org>
parents:
17931
diff
changeset
|
3494 while begin < len(body): |
1059
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
3495 match = regexp.search(body, begin) |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3496 if not match: |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3497 break |
1059
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
3498 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
|
3499 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
|
3500 lstart = body.rfind('\n', begin, mstart) + 1 or begin |
15293
0e34699d6988
grep: correct handling of matching lines without line ending (issue3050)
Mads Kiilerich <mads@kiilerich.com>
parents:
15278
diff
changeset
|
3501 begin = body.find('\n', mend) + 1 or len(body) + 1 |
7230
261a9f47b44b
grep: avoid infinite loop when trailing newline is missing
Matt Mackall <mpm@selenic.com>
parents:
7228
diff
changeset
|
3502 lend = begin - 1 |
1059
4eab07ef66e2
grep: speed up matching, and only return one match per line.
bos@serpentine.internal.keyresearch.com
parents:
1058
diff
changeset
|
3503 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend] |
1057 | 3504 |
1559
59b3639df0a9
Convert all classes to new-style classes by deriving them from object.
Eric Hopper <hopper@omnifarious.org>
parents:
1552
diff
changeset
|
3505 class linestate(object): |
1057 | 3506 def __init__(self, line, linenum, colstart, colend): |
3507 self.line = line | |
3508 self.linenum = linenum | |
3509 self.colstart = colstart | |
3510 self.colend = colend | |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
3511 |
6469
fb502719c75c
python 2.6 compatibility: add __hash__ to classes that have __eq__
Paul Moore <p.f.moore@gmail.com>
parents:
6468
diff
changeset
|
3512 def __hash__(self): |
fb502719c75c
python 2.6 compatibility: add __hash__ to classes that have __eq__
Paul Moore <p.f.moore@gmail.com>
parents:
6468
diff
changeset
|
3513 return hash((self.linenum, self.line)) |
fb502719c75c
python 2.6 compatibility: add __hash__ to classes that have __eq__
Paul Moore <p.f.moore@gmail.com>
parents:
6468
diff
changeset
|
3514 |
1065
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3515 def __eq__(self, other): |
6e94c0365d98
Cleanups to commands.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1062
diff
changeset
|
3516 return self.line == other.line |
1057 | 3517 |
21011
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3518 def __iter__(self): |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3519 yield (self.line[:self.colstart], '') |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3520 yield (self.line[self.colstart:self.colend], 'grep.match') |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3521 rest = self.line[self.colend:] |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3522 while rest != '': |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3523 match = regexp.search(rest) |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3524 if not match: |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3525 yield (rest, '') |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3526 break |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3527 mstart, mend = match.span() |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3528 yield (rest[:mstart], '') |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3529 yield (rest[mstart:mend], 'grep.match') |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3530 rest = rest[mend:] |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3531 |
1057 | 3532 matches = {} |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
3533 copies = {} |
1057 | 3534 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
|
3535 matches[rev].setdefault(fn, []) |
1057 | 3536 m = matches[rev][fn] |
3537 for lnum, cstart, cend, line in matchlines(body): | |
3538 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
|
3539 m.append(s) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
3540 |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
3541 def difflinestates(a, b): |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
3542 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
|
3543 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
|
3544 if tag == 'insert': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
3545 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
|
3546 yield ('+', b[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
3547 elif tag == 'delete': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
3548 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
|
3549 yield ('-', a[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
3550 elif tag == 'replace': |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
3551 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
|
3552 yield ('-', a[i]) |
3472
df7202f6887c
use xrange instead of range
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3471
diff
changeset
|
3553 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
|
3554 yield ('+', b[i]) |
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
3555 |
9655
6d7d3f849062
walkchangerevs: internalize ctx caching
Matt Mackall <mpm@selenic.com>
parents:
9654
diff
changeset
|
3556 def display(fn, ctx, pstates, states): |
6d7d3f849062
walkchangerevs: internalize ctx caching
Matt Mackall <mpm@selenic.com>
parents:
9654
diff
changeset
|
3557 rev = ctx.rev() |
6134
7b937b26adf7
Make annotae/grep print short dates with -q/--quiet.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6133
diff
changeset
|
3558 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
|
3559 found = False |
20836
a8b4541bb961
grep: reuse the first "util.binary()" result for efficiency
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20834
diff
changeset
|
3560 @util.cachefunc |
13920
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
13911
diff
changeset
|
3561 def binary(): |
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
13911
diff
changeset
|
3562 flog = getfile(fn) |
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
13911
diff
changeset
|
3563 return util.binary(flog.read(ctx.filenode(fn))) |
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
13911
diff
changeset
|
3564 |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
3565 if opts.get('all'): |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8834
diff
changeset
|
3566 iter = difflinestates(pstates, states) |
2869
81f351c5264d
grep: display correct user/revision for --all in reverse.
Brendan Cully <brendan@kublai.com>
parents:
2854
diff
changeset
|
3567 else: |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8834
diff
changeset
|
3568 iter = [('', l) for l in states] |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
3569 for change, l in iter: |
17806
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3570 cols = [(fn, 'grep.filename'), (str(rev), 'grep.rev')] |
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3571 |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
3572 if opts.get('line_number'): |
17806
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3573 cols.append((str(l.linenum), 'grep.linenumber')) |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
3574 if opts.get('all'): |
17806
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3575 cols.append((change, 'grep.change')) |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
3576 if opts.get('user'): |
17806
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3577 cols.append((ui.shortuser(ctx.user()), 'grep.user')) |
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
|
3578 if opts.get('date'): |
17806
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3579 cols.append((datefunc(ctx.date()), 'grep.date')) |
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3580 for col, label in cols[:-1]: |
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3581 ui.write(col, label=label) |
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3582 ui.write(sep, label='grep.sep') |
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3583 ui.write(cols[-1][0], label=cols[-1][1]) |
21011
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3584 if not opts.get('files_with_matches'): |
17806
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3585 ui.write(sep, label='grep.sep') |
13920
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
13911
diff
changeset
|
3586 if not opts.get('text') and binary(): |
17806
dc7010ed0101
grep: colorize all fields
Idan Kamara <idankk86@gmail.com>
parents:
17791
diff
changeset
|
3587 ui.write(" Binary file matches") |
13920
332e400764e5
grep: don't print data from binary files for matches (issue2614)
Md. O. Shayan <mdoshayan@gmail.com>
parents:
13911
diff
changeset
|
3588 else: |
21011
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3589 for s, label in l: |
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3590 ui.write(s, label=label) |
10816
635d601e8f21
grep: make use of output labeling
Brodie Rao <brodie@bitheap.org>
parents:
10654
diff
changeset
|
3591 ui.write(eol) |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
3592 found = True |
21011
2db41f95c4a2
grep: highlight all matched words
Takumi IINO <trot.thunder@gmail.com>
parents:
20986
diff
changeset
|
3593 if opts.get('files_with_matches'): |
20838
fe849868fc5a
grep: exit loop immediately, if matching is found in the file for "hg grep -l"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
20837
diff
changeset
|
3594 break |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
3595 return found |
1057 | 3596 |
1145
bd917e1a26dd
grep: change default to printing first matching rev.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1116
diff
changeset
|
3597 skip = {} |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8834
diff
changeset
|
3598 revfiles = {} |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
3599 matchfn = scmutil.match(repo[None], pats, opts) |
3951
cb66641cdee3
grep: remove count handling, simplify, fix issue337
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
3950
diff
changeset
|
3600 found = False |
2870
8eaaf1321bfe
grep: add --follow support.
Brendan Cully <brendan@kublai.com>
parents:
2869
diff
changeset
|
3601 follow = opts.get('follow') |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3602 |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3603 def prep(ctx, fns): |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3604 rev = ctx.rev() |
13878
a8d13ee0ce68
misc: replace .parents()[0] with p1()
Matt Mackall <mpm@selenic.com>
parents:
13855
diff
changeset
|
3605 pctx = ctx.p1() |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3606 parent = pctx.rev() |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3607 matches.setdefault(rev, {}) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3608 matches.setdefault(parent, {}) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3609 files = revfiles.setdefault(rev, []) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3610 for fn in fns: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3611 flog = getfile(fn) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3612 try: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3613 fnode = ctx.filenode(fn) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3614 except error.LookupError: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3615 continue |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3616 |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3617 copied = flog.renamed(fnode) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3618 copy = follow and copied and copied[0] |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3619 if copy: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3620 copies.setdefault(rev, {})[fn] = copy |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3621 if fn in skip: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3622 if copy: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3623 skip[copy] = True |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3624 continue |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3625 files.append(fn) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3626 |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3627 if fn not in matches[rev]: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3628 grepbody(fn, rev, flog.read(fnode)) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3629 |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3630 pfn = copy or fn |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3631 if pfn not in matches[parent]: |
1057 | 3632 try: |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3633 fnode = pctx.filenode(pfn) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3634 grepbody(pfn, parent, flog.read(fnode)) |
7633 | 3635 except error.LookupError: |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3636 pass |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3637 |
9665
1de5ebfa5585
walkchangerevs: drop ui arg
Matt Mackall <mpm@selenic.com>
parents:
9663
diff
changeset
|
3638 for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep): |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3639 rev = ctx.rev() |
13878
a8d13ee0ce68
misc: replace .parents()[0] with p1()
Matt Mackall <mpm@selenic.com>
parents:
13855
diff
changeset
|
3640 parent = ctx.p1().rev() |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3641 for fn in sorted(revfiles.get(rev, [])): |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3642 states = matches[rev][fn] |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3643 copy = copies.get(rev, {}).get(fn) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3644 if fn in skip: |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8834
diff
changeset
|
3645 if copy: |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3646 skip[copy] = True |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3647 continue |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3648 pstates = matches.get(parent, {}).get(copy or fn, []) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3649 if pstates or states: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3650 r = display(fn, ctx, pstates, states) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3651 found = found or r |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3652 if r and not opts.get('all'): |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3653 skip[fn] = True |
8849
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8834
diff
changeset
|
3654 if copy: |
80cc4b1a62d0
compare grep result between target and its parent
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
8834
diff
changeset
|
3655 skip[copy] = True |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3656 del matches[rev] |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
3657 del revfiles[rev] |
1057 | 3658 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3659 return not found |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3660 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3661 @command('heads', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3662 [('r', 'rev', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3663 _('show only heads which are descendants of STARTREV'), _('STARTREV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3664 ('t', 'topo', False, _('show topological heads only')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3665 ('a', 'active', False, _('show active branchheads only (DEPRECATED)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3666 ('c', 'closed', False, _('show normal and closed branch heads')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3667 ] + templateopts, |
16869
00e1e40d709c
help: drop -a from heads syntax summary (issue3483)
Matt Mackall <mpm@selenic.com>
parents:
16850
diff
changeset
|
3668 _('[-ct] [-r STARTREV] [REV]...')) |
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
3669 def heads(ui, repo, *branchrevs, **opts): |
19469
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3670 """show branch heads |
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3671 |
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3672 With no arguments, show all open branch heads in the repository. |
19493
ca76e77dd663
heads: fix children/descendants in doc (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19482
diff
changeset
|
3673 Branch heads are changesets that have no descendants on the |
19469
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3674 same branch. They are where development generally takes place and |
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3675 are the usual targets for update and merge operations. |
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3676 |
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3677 If one or more REVs are given, only open branch heads on the |
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3678 branches associated with the specified changesets are shown. This |
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3679 means that you can use :hg:`heads .` to see the heads on the |
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3680 currently checked-out branch. |
9502
8d7d68dd91fd
commands: tweak help for 'heads'.
Greg Ward <greg-hg@gerg.ca>
parents:
9189
diff
changeset
|
3681 |
8d7d68dd91fd
commands: tweak help for 'heads'.
Greg Ward <greg-hg@gerg.ca>
parents:
9189
diff
changeset
|
3682 If -c/--closed is specified, also show branch heads marked closed |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
3683 (see :hg:`commit --close-branch`). |
9502
8d7d68dd91fd
commands: tweak help for 'heads'.
Greg Ward <greg-hg@gerg.ca>
parents:
9189
diff
changeset
|
3684 |
8d7d68dd91fd
commands: tweak help for 'heads'.
Greg Ward <greg-hg@gerg.ca>
parents:
9189
diff
changeset
|
3685 If STARTREV is specified, only those heads that are descendants of |
8d7d68dd91fd
commands: tweak help for 'heads'.
Greg Ward <greg-hg@gerg.ca>
parents:
9189
diff
changeset
|
3686 STARTREV will be displayed. |
10350
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3687 |
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3688 If -t/--topo is specified, named branch mechanics will be ignored and only |
19469
bf6bc4681383
heads: modernize documentation (issue3992)
Matt Mackall <mpm@selenic.com>
parents:
19440
diff
changeset
|
3689 topological heads (changesets with no children) will be shown. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3690 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3691 Returns 0 if matching heads are found, 1 if not. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3692 """ |
10328
0798a3d5f812
commands: simplify heads a little bit before I start hacking it up
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10326
diff
changeset
|
3693 |
12925
6eab8f0df2ca
commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents:
12918
diff
changeset
|
3694 start = None |
6eab8f0df2ca
commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents:
12918
diff
changeset
|
3695 if 'rev' in opts: |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
3696 start = scmutil.revsingle(repo, opts['rev'], None).node() |
10328
0798a3d5f812
commands: simplify heads a little bit before I start hacking it up
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10326
diff
changeset
|
3697 |
10350
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3698 if opts.get('topo'): |
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3699 heads = [repo[h] for h in 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
|
3700 else: |
10348
0fc5222c0951
commands: externalize branchheads so we can do it for all branches at once
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10347
diff
changeset
|
3701 heads = [] |
14466
bd34a027f3ed
commands: use repo.branchheads in heads command
Martin Geisler <mg@aragost.com>
parents:
14465
diff
changeset
|
3702 for branch in repo.branchmap(): |
bd34a027f3ed
commands: use repo.branchheads in heads command
Martin Geisler <mg@aragost.com>
parents:
14465
diff
changeset
|
3703 heads += repo.branchheads(branch, start, opts.get('closed')) |
bd34a027f3ed
commands: use repo.branchheads in heads command
Martin Geisler <mg@aragost.com>
parents:
14465
diff
changeset
|
3704 heads = [repo[h] for h in heads] |
10350
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3705 |
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3706 if branchrevs: |
13047
6c375e07d673
branch: operate on branch names in local string space where possible
Matt Mackall <mpm@selenic.com>
parents:
13022
diff
changeset
|
3707 branches = set(repo[br].branch() for br in branchrevs) |
10350
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3708 heads = [h for h in heads if h.branch() in branches] |
10328
0798a3d5f812
commands: simplify heads a little bit before I start hacking it up
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10326
diff
changeset
|
3709 |
10349
20356e69710c
commands: actually implement --closed for topological heads
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10348
diff
changeset
|
3710 if opts.get('active') and branchrevs: |
20356e69710c
commands: actually implement --closed for topological heads
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10348
diff
changeset
|
3711 dagheads = repo.heads(start) |
10350
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3712 heads = [h for h in heads if h.node() in dagheads] |
10349
20356e69710c
commands: actually implement --closed for topological heads
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10348
diff
changeset
|
3713 |
20356e69710c
commands: actually implement --closed for topological heads
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10348
diff
changeset
|
3714 if branchrevs: |
10350
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3715 haveheads = set(h.branch() for h in heads) |
10346
e2db50cae6e6
commands: don't do too much work for error messages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10345
diff
changeset
|
3716 if branches - haveheads: |
13047
6c375e07d673
branch: operate on branch names in local string space where possible
Matt Mackall <mpm@selenic.com>
parents:
13022
diff
changeset
|
3717 headless = ', '.join(b for b in branches - haveheads) |
10346
e2db50cae6e6
commands: don't do too much work for error messages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10345
diff
changeset
|
3718 msg = _('no open branch heads found on branches %s') |
e2db50cae6e6
commands: don't do too much work for error messages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10345
diff
changeset
|
3719 if opts.get('rev'): |
16231
ce292f1379ba
i18n: fix all remaining uses of % inside _()
Matt Mackall <mpm@selenic.com>
parents:
16230
diff
changeset
|
3720 msg += _(' (started at %s)') % opts['rev'] |
10346
e2db50cae6e6
commands: don't do too much work for error messages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10345
diff
changeset
|
3721 ui.warn((msg + '\n') % headless) |
e2db50cae6e6
commands: don't do too much work for error messages
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10345
diff
changeset
|
3722 |
4648
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
3723 if not heads: |
8e503fa54d2d
Add option to heads to show only heads for current branch.
Eric Hopper <hopper@omnifarious.org>
parents:
4646
diff
changeset
|
3724 return 1 |
10328
0798a3d5f812
commands: simplify heads a little bit before I start hacking it up
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10326
diff
changeset
|
3725 |
10350
fd511e9eeea6
commands: do all branch heads by default, demote topological to -t/--topo
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10349
diff
changeset
|
3726 heads = sorted(heads, key=lambda x: -x.rev()) |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
3727 displayer = cmdutil.show_changeset(ui, repo, opts) |
10331
ec5240a22f4a
commands: always order heads recent to oldest
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10330
diff
changeset
|
3728 for ctx in heads: |
ec5240a22f4a
commands: always order heads recent to oldest
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
10330
diff
changeset
|
3729 displayer.show(ctx) |
10152
56284451a22c
Added support for templatevar "footer" to cmdutil.py
Robert Bachmann <rbachm@gmail.com>
parents:
10111
diff
changeset
|
3730 displayer.close() |
221 | 3731 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3732 @command('help', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3733 [('e', 'extension', None, _('show only help for extensions')), |
16711
497deec204d1
help: add --keyword (-k) for searching help
Augie Fackler <raf@durin42.com>
parents:
16708
diff
changeset
|
3734 ('c', 'command', None, _('show only help for commands')), |
497deec204d1
help: add --keyword (-k) for searching help
Augie Fackler <raf@durin42.com>
parents:
16708
diff
changeset
|
3735 ('k', 'keyword', '', _('show topics matching keyword')), |
497deec204d1
help: add --keyword (-k) for searching help
Augie Fackler <raf@durin42.com>
parents:
16708
diff
changeset
|
3736 ], |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
3737 _('[-ec] [TOPIC]'), |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
3738 norepo=True) |
18746
c0087d48ec3a
help: move the majority of the help command to the help module
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
18711
diff
changeset
|
3739 def help_(ui, name=None, **opts): |
7210 | 3740 """show help for a given topic or a help overview |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
3741 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
3742 With no arguments, print a list of commands with short help messages. |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
3743 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3744 Given a topic, extension, or command name, print help for that |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3745 topic. |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3746 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3747 Returns 0 if successful. |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3748 """ |
15023
157a294444b2
help: move option text display into a helper function
Matt Mackall <mpm@selenic.com>
parents:
15022
diff
changeset
|
3749 |
13608
63ab6b0ccedc
help: limit documentation width to at most 80 characters
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
13601
diff
changeset
|
3750 textwidth = min(ui.termwidth(), 80) - 2 |
3655
da361aa7a118
alphabetize help_ in commands
Matt Mackall <mpm@selenic.com>
parents:
3654
diff
changeset
|
3751 |
16854
d71ada5a6a33
help: format all output using RST
Olav Reinert <seroton10@gmail.com>
parents:
16853
diff
changeset
|
3752 keep = ui.verbose and ['verbose'] or [] |
18746
c0087d48ec3a
help: move the majority of the help command to the help module
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
18711
diff
changeset
|
3753 text = help.help_(ui, name, **opts) |
c0087d48ec3a
help: move the majority of the help command to the help module
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
18711
diff
changeset
|
3754 |
17837
b623e323c561
help: indicate help omitting if help document is not fully displayed
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17830
diff
changeset
|
3755 formatted, pruned = minirst.format(text, textwidth, keep=keep) |
b623e323c561
help: indicate help omitting if help document is not fully displayed
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17830
diff
changeset
|
3756 if 'verbose' in pruned: |
b623e323c561
help: indicate help omitting if help document is not fully displayed
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17830
diff
changeset
|
3757 keep.append('omitted') |
b623e323c561
help: indicate help omitting if help document is not fully displayed
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17830
diff
changeset
|
3758 else: |
b623e323c561
help: indicate help omitting if help document is not fully displayed
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17830
diff
changeset
|
3759 keep.append('notomitted') |
b623e323c561
help: indicate help omitting if help document is not fully displayed
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17830
diff
changeset
|
3760 formatted, pruned = minirst.format(text, textwidth, keep=keep) |
16854
d71ada5a6a33
help: format all output using RST
Olav Reinert <seroton10@gmail.com>
parents:
16853
diff
changeset
|
3761 ui.write(formatted) |
6653
a78d8edaeedd
help: list special help topics with -v
Johannes Stezenbach <js@sig21.net>
parents:
6652
diff
changeset
|
3762 |
221 | 3763 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3764 @command('identify|id', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3765 [('r', 'rev', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3766 _('identify the specified revision'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3767 ('n', 'num', None, _('show local revision number')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3768 ('i', 'id', None, _('show global revision id')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3769 ('b', 'branch', None, _('show branch')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3770 ('t', 'tags', None, _('show tags')), |
15580
5a7733563c2e
id: add command line options for handling ssh and https urls
Mads Kiilerich <mads@kiilerich.com>
parents:
15578
diff
changeset
|
3771 ('B', 'bookmarks', None, _('show bookmarks')), |
5a7733563c2e
id: add command line options for handling ssh and https urls
Mads Kiilerich <mads@kiilerich.com>
parents:
15578
diff
changeset
|
3772 ] + remoteopts, |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
3773 _('[-nibtB] [-r REV] [SOURCE]'), |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
3774 optionalrepo=True) |
13477
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13473
diff
changeset
|
3775 def identify(ui, repo, source=None, rev=None, |
15580
5a7733563c2e
id: add command line options for handling ssh and https urls
Mads Kiilerich <mads@kiilerich.com>
parents:
15578
diff
changeset
|
3776 num=None, id=None, branch=None, tags=None, bookmarks=None, **opts): |
4665
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
3777 """identify the working copy or specified revision |
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
3778 |
13963
3c753f9a2fbc
identify: further clarification of help
Kevin Bullock <kbullock@ringworld.org>
parents:
13952
diff
changeset
|
3779 Print a summary identifying the repository state at REV using one or |
3c753f9a2fbc
identify: further clarification of help
Kevin Bullock <kbullock@ringworld.org>
parents:
13952
diff
changeset
|
3780 two parent hash identifiers, followed by a "+" if the working |
3c753f9a2fbc
identify: further clarification of help
Kevin Bullock <kbullock@ringworld.org>
parents:
13952
diff
changeset
|
3781 directory has uncommitted changes, the branch name (if not default), |
3c753f9a2fbc
identify: further clarification of help
Kevin Bullock <kbullock@ringworld.org>
parents:
13952
diff
changeset
|
3782 a list of tags, and a list of bookmarks. |
13952
1416b9118540
identify/help: say what the command does first, mention bookmarks
Idan Kamara <idankk86@gmail.com>
parents:
13693
diff
changeset
|
3783 |
1416b9118540
identify/help: say what the command does first, mention bookmarks
Idan Kamara <idankk86@gmail.com>
parents:
13693
diff
changeset
|
3784 When REV is not given, print a summary of the current state of the |
8027
9c7ca86fc658
expand "repo" to "repository" in help texts
Martin Geisler <mg@lazybytes.net>
parents:
8026
diff
changeset
|
3785 repository. |
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
3786 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
3787 Specifying a path to a repository root or Mercurial bundle will |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
3788 cause lookup to operate on that repository/bundle. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3789 |
15112
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3790 .. container:: verbose |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3791 |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3792 Examples: |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3793 |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3794 - generate a build identifier for the working directory:: |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3795 |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3796 hg id --id > build-id.dat |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3797 |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3798 - find the revision corresponding to a tag:: |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3799 |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3800 hg id -n -r 1.3 |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3801 |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3802 - check the most recent revision of a remote repository:: |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3803 |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3804 hg id -r tip http://selenic.com/hg/ |
24f5489452af
id: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15111
diff
changeset
|
3805 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3806 Returns 0 if successful. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3807 """ |
4662
f9b8ea362b49
identify: show nullid for empty repo
Matt Mackall <mpm@selenic.com>
parents:
4659
diff
changeset
|
3808 |
5330
4528858e7202
make identify an optionalrepo command
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5329
diff
changeset
|
3809 if not repo and not source: |
12067
a4fbbe0fbc38
Lowercase error messages
Martin Geisler <mg@lazybytes.net>
parents:
11881
diff
changeset
|
3810 raise util.Abort(_("there is no Mercurial repository here " |
5330
4528858e7202
make identify an optionalrepo command
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5329
diff
changeset
|
3811 "(.hg not found)")) |
4528858e7202
make identify an optionalrepo command
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5329
diff
changeset
|
3812 |
2966
fb493241d7f6
Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents:
2963
diff
changeset
|
3813 hexfunc = ui.debugflag and hex or short |
13477
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13473
diff
changeset
|
3814 default = not (num or id or branch or tags or bookmarks) |
4666
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
3815 output = [] |
7757
af6a63438a8a
identify: have consistent output for local repositories
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
7743
diff
changeset
|
3816 revs = [] |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3817 |
4671
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
3818 if source: |
10365
d757bc0c7865
interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
10364
diff
changeset
|
3819 source, branches = hg.parseurl(ui.expandpath(source)) |
17875
92ba3cd55be6
subrepo: more isolation, only use ui for hg.peer when there is no repo
Simon Heimberg <simohe@besonet.ch>
parents:
17849
diff
changeset
|
3820 peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo |
17191
5884812686f7
peer: introduce peer methods to prepare for peer classes
Sune Foldager <cryo@cyanite.org>
parents:
17190
diff
changeset
|
3821 repo = peer.local() |
5884812686f7
peer: introduce peer methods to prepare for peer classes
Sune Foldager <cryo@cyanite.org>
parents:
17190
diff
changeset
|
3822 revs, checkout = hg.addbranchrevs(repo, peer, branches, None) |
5884812686f7
peer: introduce peer methods to prepare for peer classes
Sune Foldager <cryo@cyanite.org>
parents:
17190
diff
changeset
|
3823 |
5884812686f7
peer: introduce peer methods to prepare for peer classes
Sune Foldager <cryo@cyanite.org>
parents:
17190
diff
changeset
|
3824 if not repo: |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3825 if num or branch or tags: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3826 raise util.Abort( |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3827 _("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
|
3828 if not rev and revs: |
150afe6becf6
identify: take a path to a remote repo
Matt Mackall <mpm@selenic.com>
parents:
4667
diff
changeset
|
3829 rev = revs[0] |
4667
c7a81e3ae80f
identify: work with remote repos
Matt Mackall <mpm@selenic.com>
parents:
4666
diff
changeset
|
3830 if not rev: |
c7a81e3ae80f
identify: work with remote repos
Matt Mackall <mpm@selenic.com>
parents:
4666
diff
changeset
|
3831 rev = "tip" |
13644
7e6c2f58ad56
identify: list bookmarks for remote repositories
Nils Adermann <naderman@naderman.de>
parents:
13639
diff
changeset
|
3832 |
17191
5884812686f7
peer: introduce peer methods to prepare for peer classes
Sune Foldager <cryo@cyanite.org>
parents:
17190
diff
changeset
|
3833 remoterev = peer.lookup(rev) |
4666
48c94bffdb28
identify: add support for output flags
Matt Mackall <mpm@selenic.com>
parents:
4665
diff
changeset
|
3834 if default or id: |
13644
7e6c2f58ad56
identify: list bookmarks for remote repositories
Nils Adermann <naderman@naderman.de>
parents:
13639
diff
changeset
|
3835 output = [hexfunc(remoterev)] |
7e6c2f58ad56
identify: list bookmarks for remote repositories
Nils Adermann <naderman@naderman.de>
parents:
13639
diff
changeset
|
3836 |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3837 def getbms(): |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3838 bms = [] |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3839 |
17191
5884812686f7
peer: introduce peer methods to prepare for peer classes
Sune Foldager <cryo@cyanite.org>
parents:
17190
diff
changeset
|
3840 if 'bookmarks' in peer.listkeys('namespaces'): |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3841 hexremoterev = hex(remoterev) |
17191
5884812686f7
peer: introduce peer methods to prepare for peer classes
Sune Foldager <cryo@cyanite.org>
parents:
17190
diff
changeset
|
3842 bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems() |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3843 if bmr == hexremoterev] |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3844 |
18366
fdf2f5730bd4
identity: report bookmarks sorted
Mads Kiilerich <mads@kiilerich.com>
parents:
18267
diff
changeset
|
3845 return sorted(bms) |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3846 |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3847 if bookmarks: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3848 output.extend(getbms()) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3849 elif default and not ui.quiet: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3850 # multiple bookmarks for a single parent separated by '/' |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3851 bm = '/'.join(getbms()) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3852 if bm: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3853 output.append(bm) |
4665
091c9e54d306
identify: accept a revision argument
Matt Mackall <mpm@selenic.com>
parents:
4664
diff
changeset
|
3854 else: |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3855 if not rev: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3856 ctx = repo[None] |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3857 parents = ctx.parents() |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3858 changed = "" |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3859 if default or id or num: |
17255
3e856d8abe9c
identity: show trailing '+' for dirty subrepos (issue2839)
Patrick Mezard <patrick@mezard.eu>
parents:
17248
diff
changeset
|
3860 if (util.any(repo.status()) |
3e856d8abe9c
identity: show trailing '+' for dirty subrepos (issue2839)
Patrick Mezard <patrick@mezard.eu>
parents:
17248
diff
changeset
|
3861 or util.any(ctx.sub(s).dirty() for s in ctx.substate)): |
3e856d8abe9c
identity: show trailing '+' for dirty subrepos (issue2839)
Patrick Mezard <patrick@mezard.eu>
parents:
17248
diff
changeset
|
3862 changed = '+' |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3863 if default or id: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3864 output = ["%s%s" % |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3865 ('+'.join([hexfunc(p.node()) for p in parents]), changed)] |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3866 if num: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3867 output.append("%s%s" % |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3868 ('+'.join([str(p.rev()) for p in parents]), changed)) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3869 else: |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
3870 ctx = scmutil.revsingle(repo, rev) |
13953
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3871 if default or id: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3872 output = [hexfunc(ctx.node())] |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3873 if num: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3874 output.append(str(ctx.rev())) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3875 |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3876 if default and not ui.quiet: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3877 b = ctx.branch() |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3878 if b != 'default': |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3879 output.append("(%s)" % b) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3880 |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3881 # multiple tags for a single parent separated by '/' |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3882 t = '/'.join(ctx.tags()) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3883 if t: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3884 output.append(t) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3885 |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3886 # multiple bookmarks for a single parent separated by '/' |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3887 bm = '/'.join(ctx.bookmarks()) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3888 if bm: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3889 output.append(bm) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3890 else: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3891 if branch: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3892 output.append(ctx.branch()) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3893 |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3894 if tags: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3895 output.extend(ctx.tags()) |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3896 |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3897 if bookmarks: |
ae10a5e8e558
identify: restructure code to make it more readable
Idan Kamara <idankk86@gmail.com>
parents:
13950
diff
changeset
|
3898 output.extend(ctx.bookmarks()) |
13477
0fb2ff949790
id: add bookmarks to id
Kevin Bullock <kbullock@ringworld.org>
parents:
13473
diff
changeset
|
3899 |
386
494c8e3f47f3
Improvements for hg identify:
Thomas Arendsen Hein <thomas@intevation.de>
parents:
371
diff
changeset
|
3900 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
|
3901 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3902 @command('import|patch', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3903 [('p', 'strip', 1, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3904 _('directory strip option for patch. This has the same ' |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3905 'meaning as the corresponding patch option'), _('NUM')), |
14532
2498128821a9
import: deprecate --base
Patrick Mezard <pmezard@gmail.com>
parents:
14529
diff
changeset
|
3906 ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')), |
15221 | 3907 ('e', 'edit', False, _('invoke editor on commit messages')), |
19409
ea4342d0e6fe
rollback: mark as deprecated
Matt Mackall <mpm@selenic.com>
parents:
19403
diff
changeset
|
3908 ('f', 'force', None, |
ea4342d0e6fe
rollback: mark as deprecated
Matt Mackall <mpm@selenic.com>
parents:
19403
diff
changeset
|
3909 _('skip check for outstanding uncommitted changes (DEPRECATED)')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3910 ('', 'no-commit', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3911 _("don't commit, just update the working directory")), |
14611
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
3912 ('', 'bypass', None, |
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
3913 _("apply patch without touching the working directory")), |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3914 ('', 'partial', None, |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3915 _('commit even if some hunks fail')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3916 ('', 'exact', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3917 _('apply patch to the nodes from which it was generated')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3918 ('', 'import-branch', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3919 _('use any branch information in patch (implied by --exact)'))] + |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3920 commitopts + commitopts2 + similarityopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
3921 _('[OPTION]... PATCH...')) |
15327
67e92d29ecb5
import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents:
15321
diff
changeset
|
3922 def import_(ui, repo, patch1=None, *patches, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3923 """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
|
3924 |
9649 | 3925 Import a list of patches and commit them individually (unless |
3926 --no-commit is specified). | |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3927 |
19409
ea4342d0e6fe
rollback: mark as deprecated
Matt Mackall <mpm@selenic.com>
parents:
19403
diff
changeset
|
3928 Because import first applies changes to the working directory, |
ea4342d0e6fe
rollback: mark as deprecated
Matt Mackall <mpm@selenic.com>
parents:
19403
diff
changeset
|
3929 import will abort if there are outstanding changes. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3930 |
6448
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
3931 You can import a patch straight from a mail message. Even patches |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
3932 as attachments work (to use the body part, it must have type |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
3933 text/plain or text/x-patch). From and Subject headers of email |
6448
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
3934 message are used as default committer and commit message. All |
2515
a6700c222314
import: make help clearer. suggested by asak.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2513
diff
changeset
|
3935 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
|
3936 message. |
2504
158d3d2ae070
import: parse email messages
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2494
diff
changeset
|
3937 |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
3938 If the imported patch was generated by :hg:`export`, user and |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3939 description from patch override values from message headers and |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
3940 body. Values given on command line with -m/--message and -u/--user |
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
3941 override these. |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3942 |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3943 If --exact is specified, import will set the working directory to |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3944 the parent of each patch before applying it, and will abort if the |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3945 resulting changeset has a different ID than the one recorded in |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3946 the patch. This may happen due to character set problems or other |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
3947 deficiencies in the text patch format. |
4263 | 3948 |
14611
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
3949 Use --bypass to apply and commit patches directly to the |
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
3950 repository, not touching the working directory. Without --exact, |
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
3951 patches will be applied on top of the working directory parent |
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
3952 revision. |
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
3953 |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
3954 With -s/--similarity, hg will attempt to discover renames and |
15779
01831f55e972
commands: add link to addremove in commit help text
Martin Geisler <mg@lazybytes.net>
parents:
15765
diff
changeset
|
3955 copies in the patch in the same way as :hg:`addremove`. |
7402
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7372
diff
changeset
|
3956 |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3957 Use --partial to ensure a changeset will be created from the patch |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3958 even if some hunks fail to apply. Hunks that fail to apply will be |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3959 written to a <target-file>.rej file. Conflicts can then be resolved |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3960 by hand before :hg:`commit --amend` is run to update the created |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3961 changeset. This flag exists to let people import patches that |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3962 partially apply without losing the associated metadata (author, |
21929
5bd11162c0a4
commands: fix typo in import documentation
Wagner Bruna <wbruna@yahoo.com>
parents:
21911
diff
changeset
|
3963 date, description, ...). Note that when none of the hunk applies |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3964 cleanly, :hg:`import --partial` will create an empty changeset, |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3965 importing only the patch metadata. |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3966 |
8931
4c99eafb101e
commands: add note about import retrieving patches from URLs
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8927
diff
changeset
|
3967 To read a patch from standard input, use "-" as the patch name. If |
4c99eafb101e
commands: add note about import retrieving patches from URLs
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8927
diff
changeset
|
3968 a URL is specified, the patch will be downloaded from it. |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
3969 See :hg:`help dates` for a list of formats valid for -d/--date. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
3970 |
15113 | 3971 .. container:: verbose |
3972 | |
3973 Examples: | |
3974 | |
3975 - import a traditional patch from a website and detect renames:: | |
3976 | |
3977 hg import -s 80 http://example.com/bugfix.patch | |
3978 | |
3979 - import a changeset from an hgweb server:: | |
3980 | |
3981 hg import http://www.selenic.com/hg/rev/5ca8c111e9aa | |
3982 | |
3983 - import all the patches in an Unix-style mbox:: | |
3984 | |
3985 hg import incoming-patches.mbox | |
3986 | |
3987 - attempt to exactly restore an exported changeset (not always | |
3988 possible):: | |
3989 | |
3990 hg import --exact proposed-fix.patch | |
3991 | |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
3992 Returns 0 on success, 1 on partial success (see --partial). |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
3993 """ |
15327
67e92d29ecb5
import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents:
15321
diff
changeset
|
3994 |
67e92d29ecb5
import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents:
15321
diff
changeset
|
3995 if not patch1: |
67e92d29ecb5
import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents:
15321
diff
changeset
|
3996 raise util.Abort(_('need at least one patch to import')) |
67e92d29ecb5
import: abort usefully if no patch name given
Kevin Bullock <kbullock@ringworld.org>
parents:
15321
diff
changeset
|
3997 |
437 | 3998 patches = (patch1,) + patches |
500
ebc4714a7632
[PATCH] Clean up destination directory if a clone fails.
mpm@selenic.com
parents:
499
diff
changeset
|
3999 |
6139
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
4000 date = opts.get('date') |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
4001 if date: |
989467e8e3a9
Fix bad behaviour when specifying an invalid date (issue700)
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6134
diff
changeset
|
4002 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
|
4003 |
14611
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
4004 update = not opts.get('bypass') |
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
4005 if not update and opts.get('no_commit'): |
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
4006 raise util.Abort(_('cannot use --no-commit with --bypass')) |
7402
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7372
diff
changeset
|
4007 try: |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7372
diff
changeset
|
4008 sim = float(opts.get('similarity') or 0) |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7372
diff
changeset
|
4009 except ValueError: |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7372
diff
changeset
|
4010 raise util.Abort(_('similarity must be a number')) |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7372
diff
changeset
|
4011 if sim < 0 or sim > 100: |
bffdab64dfbb
import: add similarity option (issue295)
Brendan Cully <brendan@kublai.com>
parents:
7372
diff
changeset
|
4012 raise util.Abort(_('similarity must be between 0 and 100')) |
14611
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
4013 if sim and not update: |
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
4014 raise util.Abort(_('cannot use --similarity with --bypass')) |
22277
e116abad3afa
import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22274
diff
changeset
|
4015 if opts.get('exact') and opts.get('edit'): |
e116abad3afa
import: disallow meaningless combination of "--exact" and "--edit"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22274
diff
changeset
|
4016 raise util.Abort(_('cannot use --exact with --edit')) |
14611
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
4017 |
19476
4fed15d4c5aa
commands: add checks for unfinished operations (issue3955)
Matt Mackall <mpm@selenic.com>
parents:
19475
diff
changeset
|
4018 if update: |
4fed15d4c5aa
commands: add checks for unfinished operations (issue3955)
Matt Mackall <mpm@selenic.com>
parents:
19475
diff
changeset
|
4019 cmdutil.checkunfinished(repo) |
14611
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
4020 if (opts.get('exact') or not opts.get('force')) and update: |
14289
d68ddccf276b
cmdutil: bail_if_changed to bailifchanged
Matt Mackall <mpm@selenic.com>
parents:
14286
diff
changeset
|
4021 cmdutil.bailifchanged(repo) |
966
022bcc738389
hg import: abort with uncommitted changes, override with --force
mpm@selenic.com
parents:
965
diff
changeset
|
4022 |
15195
5b2a3bb06cef
import: rename some local variables
Greg Ward <greg@gerg.ca>
parents:
15194
diff
changeset
|
4023 base = opts["base"] |
15198
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15197
diff
changeset
|
4024 wlock = lock = tr = None |
12913
0e0a52bd58f9
import: --no-commit should update .hg/last-message.txt
Steve Borho <steve@borho.org>
parents:
12893
diff
changeset
|
4025 msgs = [] |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4026 ret = 0 |
10384
832f35386067
import: import each patch in a file or stream as a separate change
Brendan Cully <brendan@kublai.com>
parents:
10379
diff
changeset
|
4027 |
10405
2d30d66a89ad
whitespace cleanup
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
10394
diff
changeset
|
4028 |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
4029 try: |
15278
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4030 try: |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4031 wlock = repo.wlock() |
22405
6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
Durham Goode <durham@fb.com>
parents:
22390
diff
changeset
|
4032 repo.dirstate.beginparentchange() |
16274
5d75eb8568d1
encoding: tune fast-path of tolocal a bit
Matt Mackall <mpm@selenic.com>
parents:
16249
diff
changeset
|
4033 if not opts.get('no_commit'): |
5d75eb8568d1
encoding: tune fast-path of tolocal a bit
Matt Mackall <mpm@selenic.com>
parents:
16249
diff
changeset
|
4034 lock = repo.lock() |
5d75eb8568d1
encoding: tune fast-path of tolocal a bit
Matt Mackall <mpm@selenic.com>
parents:
16249
diff
changeset
|
4035 tr = repo.transaction('import') |
15278
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4036 parents = repo.parents() |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4037 for patchurl in patches: |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4038 if patchurl == '-': |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4039 ui.status(_('applying patch from stdin\n')) |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4040 patchfile = ui.fin |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4041 patchurl = 'stdin' # for error message |
14611
adbf5e7df96d
import: add --bypass option
Patrick Mezard <pmezard@gmail.com>
parents:
14610
diff
changeset
|
4042 else: |
15278
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4043 patchurl = os.path.join(base, patchurl) |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4044 ui.status(_('applying %s\n') % patchurl) |
17887
0e2846b2482c
url: use open and not url.open for local files (issue3624)
Siddharth Agarwal <sid0@fb.com>
parents:
17875
diff
changeset
|
4045 patchfile = hg.openpath(ui, patchurl) |
15278
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4046 |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4047 haspatch = False |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4048 for hunk in patch.split(patchfile): |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4049 (msg, node, rej) = cmdutil.tryimportone(ui, repo, hunk, |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4050 parents, opts, |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4051 msgs, hg.clean) |
15278
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4052 if msg: |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4053 haspatch = True |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4054 ui.note(msg + '\n') |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4055 if update or opts.get('exact'): |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4056 parents = repo.parents() |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4057 else: |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4058 parents = [repo[node]] |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4059 if rej: |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4060 ui.write_err(_("patch applied partially\n")) |
21959
dccbf52ffe9f
commands: make the warning message for "patch --partial" translatable
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21957
diff
changeset
|
4061 ui.write_err(_("(fix the .rej files and run " |
dccbf52ffe9f
commands: make the warning message for "patch --partial" translatable
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21957
diff
changeset
|
4062 "`hg commit --amend`)\n")) |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4063 ret = 1 |
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4064 break |
15278
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4065 |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4066 if not haspatch: |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4067 raise util.Abort(_('%s: no diffs found') % patchurl) |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4068 |
16274
5d75eb8568d1
encoding: tune fast-path of tolocal a bit
Matt Mackall <mpm@selenic.com>
parents:
16249
diff
changeset
|
4069 if tr: |
5d75eb8568d1
encoding: tune fast-path of tolocal a bit
Matt Mackall <mpm@selenic.com>
parents:
16249
diff
changeset
|
4070 tr.close() |
15278
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4071 if msgs: |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4072 repo.savecommitmessage('\n* * *\n'.join(msgs)) |
22405
6f63c47cbb86
dirstate: wrap setparent calls with begin/endparentchange (issue4353)
Durham Goode <durham@fb.com>
parents:
22390
diff
changeset
|
4073 repo.dirstate.endparentchange() |
21553
bee0e1cffdd3
import: add --partial flag to create a changeset despite failed hunks
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21552
diff
changeset
|
4074 return ret |
16705
c2d9ef43ff6c
check-code: ignore naked excepts with a "re-raise" comment
Brodie Rao <brodie@sf.io>
parents:
16690
diff
changeset
|
4075 except: # re-raises |
15278
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4076 # wlock.release() indirectly calls dirstate.write(): since |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4077 # we're crashing, we do not want to change the working dir |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4078 # parent after all, so make sure it writes nothing |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4079 repo.dirstate.invalidate() |
2ed335669e18
commands: use separate try/except and try/finally as needed for python2.4
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15265
diff
changeset
|
4080 raise |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
4081 finally: |
15198
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15197
diff
changeset
|
4082 if tr: |
62dc0e7ab092
import: wrap a transaction around the whole command
Greg Ward <greg@gerg.ca>
parents:
15197
diff
changeset
|
4083 tr.release() |
8109
496ae1ea4698
switch lock releasing in the core from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
8088
diff
changeset
|
4084 release(lock, wlock) |
437 | 4085 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4086 @command('incoming|in', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4087 [('f', 'force', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4088 _('run even if remote repository is unrelated')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4089 ('n', 'newest-first', None, _('show newest record first')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4090 ('', 'bundle', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4091 _('file to store the bundles into'), _('FILE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4092 ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4093 ('B', 'bookmarks', False, _("compare bookmarks")), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4094 ('b', 'branch', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4095 _('a specific branch you would like to pull'), _('BRANCH')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4096 ] + logopts + remoteopts + subrepoopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4097 _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]')) |
1192
6e165de907c5
Add -p to incoming and outgoing commands to show patch
TK Soh <teekaysoh@yahoo.com>
parents:
1191
diff
changeset
|
4098 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
|
4099 """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
|
4100 |
1979
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
4101 Show new changesets found in the specified path/URL or the default |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4102 pull location. These are the changesets that would have been pulled |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4103 if a pull at the time you issued this command. |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4104 |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4105 For remote repository, using --bundle avoids downloading the |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4106 changesets 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
|
4107 |
d545fa1426b9
More detailed documentation about ssh:// URLs; fixes issue170.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1974
diff
changeset
|
4108 See pull for valid source format details. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4109 |
20834
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4110 .. container:: verbose |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4111 |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4112 Examples: |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4113 |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4114 - show incoming changes with patches and full description:: |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4115 |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4116 hg incoming -vp |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4117 |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4118 - show incoming changes excluding merges, store a bundle:: |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4119 |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4120 hg in -vpM --bundle incoming.hg |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4121 hg pull incoming.hg |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4122 |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4123 - briefly list changes inside a bundle:: |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4124 |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4125 hg in changes.hg -T "{desc|firstline}\\n" |
8c210b169c69
help: add examples to incoming
Matt Mackall <mpm@selenic.com>
parents:
20791
diff
changeset
|
4126 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4127 Returns 0 if there are incoming changes, 1 otherwise. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4128 """ |
17182
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4129 if opts.get('graph'): |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4130 cmdutil.checkunsupportedgraphflags([], opts) |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4131 def display(other, chlist, displayer): |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4132 revdag = cmdutil.graphrevs(other, chlist, opts) |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4133 showparents = [ctx.node() for ctx in repo[None].parents()] |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4134 cmdutil.displaygraph(ui, revdag, displayer, showparents, |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4135 graphmod.asciiedges) |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4136 |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4137 hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True) |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4138 return 0 |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4139 |
12274
c02e1ed3d407
incoming: recurse into subrepositories with --subrepos/-S flag
Martin Geisler <mg@lazybytes.net>
parents:
12273
diff
changeset
|
4140 if opts.get('bundle') and opts.get('subrepos'): |
c02e1ed3d407
incoming: recurse into subrepositories with --subrepos/-S flag
Martin Geisler <mg@lazybytes.net>
parents:
12273
diff
changeset
|
4141 raise util.Abort(_('cannot combine --bundle and --subrepos')) |
c02e1ed3d407
incoming: recurse into subrepositories with --subrepos/-S flag
Martin Geisler <mg@lazybytes.net>
parents:
12273
diff
changeset
|
4142 |
13366
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4143 if opts.get('bookmarks'): |
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4144 source, branches = hg.parseurl(ui.expandpath(source), |
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4145 opts.get('branch')) |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
4146 other = hg.peer(repo, opts, source) |
13453
c1b808020819
bookmarks: issue a warning if remote doesn't support comparing bookmarks
David Soria Parra <dsp@php.net>
parents:
13448
diff
changeset
|
4147 if 'bookmarks' not in other.listkeys('namespaces'): |
c1b808020819
bookmarks: issue a warning if remote doesn't support comparing bookmarks
David Soria Parra <dsp@php.net>
parents:
13448
diff
changeset
|
4148 ui.warn(_("remote doesn't support bookmarks\n")) |
c1b808020819
bookmarks: issue a warning if remote doesn't support comparing bookmarks
David Soria Parra <dsp@php.net>
parents:
13448
diff
changeset
|
4149 return 0 |
14076
924c82157d46
url: move URL parsing functions into util to improve startup time
Brodie Rao <brodie@bitheap.org>
parents:
14073
diff
changeset
|
4150 ui.status(_('comparing with %s\n') % util.hidepassword(source)) |
13366
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4151 return bookmarks.diff(ui, repo, other) |
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4152 |
14360
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4153 repo._subtoppath = ui.expandpath(source) |
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4154 try: |
14362
8c740a850ad7
commands: replace 'x = f(); return x' with 'return f()'
Martin Geisler <mg@lazybytes.net>
parents:
14361
diff
changeset
|
4155 return hg.incoming(ui, repo, source, opts) |
14360
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4156 finally: |
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4157 del repo._subtoppath |
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4158 |
1944
fdf40c9b3306
incoming: add support for remote repo using bundlerepo
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1943
diff
changeset
|
4159 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
4160 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'), |
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
4161 norepo=True) |
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
|
4162 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
|
4163 """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
|
4164 |
6448
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
4165 Initialize a new repository in the given directory. If the given |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4166 directory does not exist, it will be created. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4167 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4168 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
|
4169 |
9970
36760956f6d3
commands: mark "ssh://" as inline literals in help texts
Martin Geisler <mg@lazybytes.net>
parents:
9952
diff
changeset
|
4170 It is possible to specify an ``ssh://`` URL as the destination. |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
4171 See :hg:`help urls` for more information. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4172 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4173 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4174 """ |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
4175 hg.peer(ui, opts, ui.expandpath(dest), create=True) |
338 | 4176 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4177 @command('locate', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4178 [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4179 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4180 ('f', 'fullpath', None, _('print complete paths from the filesystem root')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4181 ] + walkopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4182 _('[OPTION]... [PATTERN]...')) |
627 | 4183 def locate(ui, repo, *pats, **opts): |
22431
eaeee6f95fc0
locate: deprecate in favor of files
Matt Mackall <mpm@selenic.com>
parents:
22429
diff
changeset
|
4184 """locate files matching specific patterns (DEPRECATED) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4185 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4186 Print files under Mercurial control in the working directory whose |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4187 names match the given patterns. |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4188 |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4189 By default, this command searches all directories in the working |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4190 directory. To search just the current directory and its |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4191 subdirectories, use "--include .". |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4192 |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4193 If no patterns are given to match, this command prints the names |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4194 of all files under Mercurial control in the working directory. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4195 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4196 If you want to feed the output of this command into the "xargs" |
8032
4726a522a182
commands: use double quotes consistently in help texts
Martin Geisler <mg@lazybytes.net>
parents:
8031
diff
changeset
|
4197 command, use the -0 option to both this command and "xargs". This |
4726a522a182
commands: use double quotes consistently in help texts
Martin Geisler <mg@lazybytes.net>
parents:
8031
diff
changeset
|
4198 will avoid the problem of "xargs" treating single filenames that |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4199 contain whitespace as multiple filenames. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4200 |
22433
ae1932dce9c1
locate: add pointer to files command in help
Matt Mackall <mpm@selenic.com>
parents:
22431
diff
changeset
|
4201 See :hg:`help files` for a more versatile command. |
ae1932dce9c1
locate: add pointer to files command in help
Matt Mackall <mpm@selenic.com>
parents:
22431
diff
changeset
|
4202 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4203 Returns 0 if a match is found, 1 otherwise. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4204 """ |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
4205 end = opts.get('print0') and '\0' or '\n' |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
4206 rev = scmutil.revsingle(repo, opts.get('rev'), None).node() |
742 | 4207 |
4196
1c69c73d85d9
locate: exit(1) if we didn't print any file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4195
diff
changeset
|
4208 ret = 1 |
21986
48166e46f111
locate: use ctx.matches instead of ctx.walk
Siddharth Agarwal <sid0@fb.com>
parents:
21980
diff
changeset
|
4209 ctx = repo[rev] |
48166e46f111
locate: use ctx.matches instead of ctx.walk
Siddharth Agarwal <sid0@fb.com>
parents:
21980
diff
changeset
|
4210 m = scmutil.match(ctx, pats, opts, default='relglob') |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10270
diff
changeset
|
4211 m.bad = lambda x, y: False |
21986
48166e46f111
locate: use ctx.matches instead of ctx.walk
Siddharth Agarwal <sid0@fb.com>
parents:
21980
diff
changeset
|
4212 |
48166e46f111
locate: use ctx.matches instead of ctx.walk
Siddharth Agarwal <sid0@fb.com>
parents:
21980
diff
changeset
|
4213 for abs in ctx.matches(m): |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
4214 if opts.get('fullpath'): |
7570
e05aa73ce2b7
use repo.wjoin(f) instead of os.path.join(repo.root, f)
Martin Geisler <mg@daimi.au.dk>
parents:
7540
diff
changeset
|
4215 ui.write(repo.wjoin(abs), end) |
724
1c0c413cccdd
Get add and locate to use new repo and dirstate walk code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
723
diff
changeset
|
4216 else: |
6584
29c77e5dfb3c
walk: remove rel and exact returns
Matt Mackall <mpm@selenic.com>
parents:
6583
diff
changeset
|
4217 ui.write(((pats and m.rel(abs)) 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
|
4218 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
|
4219 |
1c69c73d85d9
locate: exit(1) if we didn't print any file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4195
diff
changeset
|
4220 return ret |
627 | 4221 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4222 @command('^log|history', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4223 [('f', 'follow', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4224 _('follow changeset history, or file history across copies and renames')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4225 ('', 'follow-first', None, |
15405
e4a17bb8472f
log: hide some low-utility options
Matt Mackall <mpm@selenic.com>
parents:
15404
diff
changeset
|
4226 _('only follow the first parent of merge changesets (DEPRECATED)')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4227 ('d', 'date', '', _('show revisions matching date spec'), _('DATE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4228 ('C', 'copies', None, _('show copied files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4229 ('k', 'keyword', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4230 _('do case-insensitive search for a given text'), _('TEXT')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4231 ('r', 'rev', [], _('show the specified revision or range'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4232 ('', 'removed', None, _('include revisions where files were removed')), |
15405
e4a17bb8472f
log: hide some low-utility options
Matt Mackall <mpm@selenic.com>
parents:
15404
diff
changeset
|
4233 ('m', 'only-merges', None, _('show only merges (DEPRECATED)')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4234 ('u', 'user', [], _('revisions committed by user'), _('USER')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4235 ('', 'only-branch', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4236 _('show only changesets within the given named branch (DEPRECATED)'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4237 _('BRANCH')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4238 ('b', 'branch', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4239 _('show changesets within the given named branch'), _('BRANCH')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4240 ('P', 'prune', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4241 _('do not display revision or any of its ancestors'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4242 ] + logopts + walkopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
4243 _('[OPTION]... [FILE]'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
4244 inferrepo=True) |
1031
503aaf19a040
Rewrite log command. New version is faster and more featureful.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1030
diff
changeset
|
4245 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
|
4246 """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
|
4247 |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
4248 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
|
4249 project. |
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
4250 |
15104
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4251 If no revision range is specified, the default is ``tip:0`` unless |
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4252 --follow is set, in which case the working directory parent is |
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4253 used as the starting revision. |
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4254 |
2741
ae5ce3454ef5
log: add -f/--follow option, to follow rename/copy
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2739
diff
changeset
|
4255 File history is shown without following rename or copy history of |
8761
0289f384e1e5
Generally replace "file name" with "filename" in help and comments.
timeless <timeless@gmail.com>
parents:
8760
diff
changeset
|
4256 files. Use -f/--follow with a filename to follow history across |
0289f384e1e5
Generally replace "file name" with "filename" in help and comments.
timeless <timeless@gmail.com>
parents:
8760
diff
changeset
|
4257 renames and copies. --follow without a filename will only show |
15104
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4258 ancestors or descendants of the starting revision. |
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
|
4259 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4260 By default this command prints revision number and changeset id, |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4261 tags, non-trivial parents, user, date and time, and a summary for |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4262 each commit. When the -v/--verbose switch is used, the list of |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4263 changed files and full commit message are shown. |
3822
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
4264 |
20544
8982a5397687
log: describe graph symbols in the help
Mads Kiilerich <madski@unity3d.com>
parents:
20526
diff
changeset
|
4265 With --graph the revisions are shown as an ASCII art DAG with the most |
8982a5397687
log: describe graph symbols in the help
Mads Kiilerich <madski@unity3d.com>
parents:
20526
diff
changeset
|
4266 recent changeset at the top. |
8982a5397687
log: describe graph symbols in the help
Mads Kiilerich <madski@unity3d.com>
parents:
20526
diff
changeset
|
4267 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete, |
8982a5397687
log: describe graph symbols in the help
Mads Kiilerich <madski@unity3d.com>
parents:
20526
diff
changeset
|
4268 and '+' represents a fork where the changeset from the lines below is a |
21174
7991df9d2f20
commands: fix typo in --graph description
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
21127
diff
changeset
|
4269 parent of the 'o' merge on the same line. |
20544
8982a5397687
log: describe graph symbols in the help
Mads Kiilerich <madski@unity3d.com>
parents:
20526
diff
changeset
|
4270 |
12390
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
4271 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
4272 |
12390
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
4273 log -p/--patch may generate unexpected diff output for merge |
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
4274 changesets, as it will only compare the merge changeset against |
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
4275 its first parent. Also, only files different from BOTH parents |
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
4276 will appear in files:. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4277 |
15105
6e91fba485fa
log: add a usage note about --removed
Matt Mackall <mpm@selenic.com>
parents:
15104
diff
changeset
|
4278 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
4279 |
15105
6e91fba485fa
log: add a usage note about --removed
Matt Mackall <mpm@selenic.com>
parents:
15104
diff
changeset
|
4280 for performance reasons, log FILE may omit duplicate changes |
6e91fba485fa
log: add a usage note about --removed
Matt Mackall <mpm@selenic.com>
parents:
15104
diff
changeset
|
4281 made on branches and will not show deletions. To see all |
6e91fba485fa
log: add a usage note about --removed
Matt Mackall <mpm@selenic.com>
parents:
15104
diff
changeset
|
4282 changes including duplicates and deletions, use the --removed |
6e91fba485fa
log: add a usage note about --removed
Matt Mackall <mpm@selenic.com>
parents:
15104
diff
changeset
|
4283 switch. |
6e91fba485fa
log: add a usage note about --removed
Matt Mackall <mpm@selenic.com>
parents:
15104
diff
changeset
|
4284 |
15103
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4285 .. container:: verbose |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4286 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4287 Some examples: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4288 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4289 - changesets with full descriptions and file lists:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4290 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4291 hg log -v |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4292 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4293 - changesets ancestral to the working directory:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4294 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4295 hg log -f |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4296 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4297 - last 10 commits on the current branch:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4298 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4299 hg log -l 10 -b . |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4300 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4301 - changesets showing all modifications of a file, including removals:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4302 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4303 hg log --removed file.c |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4304 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4305 - all changesets that touch a directory, with diffs, excluding merges:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4306 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4307 hg log -Mp lib/ |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4308 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4309 - all revision numbers that match a keyword:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4310 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4311 hg log -k bug --template "{rev}\\n" |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4312 |
21944
0483ff40e326
templates: re-add template listing support
Matt Mackall <mpm@selenic.com>
parents:
21940
diff
changeset
|
4313 - list available log templates:: |
0483ff40e326
templates: re-add template listing support
Matt Mackall <mpm@selenic.com>
parents:
21940
diff
changeset
|
4314 |
0483ff40e326
templates: re-add template listing support
Matt Mackall <mpm@selenic.com>
parents:
21940
diff
changeset
|
4315 hg log -T list |
0483ff40e326
templates: re-add template listing support
Matt Mackall <mpm@selenic.com>
parents:
21940
diff
changeset
|
4316 |
15103
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4317 - check if a given changeset is included is a tagged release:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4318 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4319 hg log -r "a21ccf and ancestor(1.9)" |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4320 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4321 - find all changesets by some user in a date range:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4322 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4323 hg log -k alice -d "may 2008 to jul 2008" |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4324 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4325 - summary of all changesets after the last tag:: |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4326 |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4327 hg log -r "last(tagged())::" --template "{desc|firstline}\\n" |
5ca8c111e9aa
log: add some usage examples to verbose help
Matt Mackall <mpm@selenic.com>
parents:
15081
diff
changeset
|
4328 |
15104
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4329 See :hg:`help dates` for a list of formats valid for -d/--date. |
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4330 |
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4331 See :hg:`help revisions` and :hg:`help revsets` for more about |
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4332 specifying revisions. |
a20f5088013a
log: rearrange the help text a bit
Matt Mackall <mpm@selenic.com>
parents:
15103
diff
changeset
|
4333 |
16568
770190bff625
help: add reference to template help (issue3413)
A. S. Budden <abudden@gmail.com>
parents:
16551
diff
changeset
|
4334 See :hg:`help templates` for more about pre-packaged styles and |
770190bff625
help: add reference to template help (issue3413)
A. S. Budden <abudden@gmail.com>
parents:
16551
diff
changeset
|
4335 specifying custom templates. |
770190bff625
help: add reference to template help (issue3413)
A. S. Budden <abudden@gmail.com>
parents:
16551
diff
changeset
|
4336 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4337 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4338 """ |
17181
6f71167292f2
log: support --graph without graphlog extension
Patrick Mezard <patrick@mezard.eu>
parents:
17168
diff
changeset
|
4339 if opts.get('graph'): |
6f71167292f2
log: support --graph without graphlog extension
Patrick Mezard <patrick@mezard.eu>
parents:
17168
diff
changeset
|
4340 return cmdutil.graphlog(ui, repo, *pats, **opts) |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
4341 |
21127
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4342 revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts) |
6190
a79d9408806f
Move finding/checking the log limit to cmdutil
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6189
diff
changeset
|
4343 limit = cmdutil.loglimit(opts) |
1756
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
4344 count = 0 |
f29857aaa053
add -l,--limit to log command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1747
diff
changeset
|
4345 |
21127
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4346 getrenamed = None |
16175
280e834c9d15
log: restore cache used by --copies
Patrick Mezard <patrick@mezard.eu>
parents:
16163
diff
changeset
|
4347 if opts.get('copies'): |
21127
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4348 endrev = None |
16175
280e834c9d15
log: restore cache used by --copies
Patrick Mezard <patrick@mezard.eu>
parents:
16163
diff
changeset
|
4349 if opts.get('rev'): |
21127
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4350 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 |
16175
280e834c9d15
log: restore cache used by --copies
Patrick Mezard <patrick@mezard.eu>
parents:
16163
diff
changeset
|
4351 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) |
3197 | 4352 |
21127
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4353 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) |
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4354 for rev in revs: |
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4355 if count == limit: |
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4356 break |
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4357 ctx = repo[rev] |
10060
f780b1098efc
templatekw: change {file_copies} behaviour, add {file_copies_switch}
Patrick Mezard <pmezard@gmail.com>
parents:
10021
diff
changeset
|
4358 copies = None |
16175
280e834c9d15
log: restore cache used by --copies
Patrick Mezard <patrick@mezard.eu>
parents:
16163
diff
changeset
|
4359 if getrenamed is not None and rev: |
10060
f780b1098efc
templatekw: change {file_copies} behaviour, add {file_copies_switch}
Patrick Mezard <pmezard@gmail.com>
parents:
10021
diff
changeset
|
4360 copies = [] |
9662
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
4361 for fn in ctx.files(): |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
4362 rename = getrenamed(fn, rev) |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
4363 if rename: |
f3d60543924f
walkchangerevs: move 'add' to callback
Matt Mackall <mpm@selenic.com>
parents:
9656
diff
changeset
|
4364 copies.append((fn, rename[0])) |
21127
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4365 revmatchfn = filematcher and filematcher(ctx.rev()) or None |
11488
f786fc4b8764
log: follow filenames through renames (issue647)
Mads Kiilerich <mads@kiilerich.com>
parents:
11459
diff
changeset
|
4366 displayer.show(ctx, copies=copies, matchfn=revmatchfn) |
21127
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4367 if displayer.flush(rev): |
18711
6b786dc88612
commands: exit from the log loop at the right time
Bryan O'Sullivan <bryano@fb.com>
parents:
18703
diff
changeset
|
4368 count += 1 |
21127
69402eb72115
log: changed implementation to use graphlog code
Lucas Moscovicz <lmoscovicz@fb.com>
parents:
21105
diff
changeset
|
4369 |
10152
56284451a22c
Added support for templatevar "footer" to cmdutil.py
Robert Bachmann <rbachm@gmail.com>
parents:
10111
diff
changeset
|
4370 displayer.close() |
255 | 4371 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4372 @command('manifest', |
14399
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4373 [('r', 'rev', '', _('revision to display'), _('REV')), |
22429
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
4374 ('', 'all', False, _("list files from all revisions"))] |
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
4375 + formatteropts, |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4376 _('[-r REV]')) |
14399
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4377 def manifest(ui, repo, node=None, rev=None, **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
|
4378 """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
|
4379 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4380 Print a list of version controlled files for the given revision. |
8041
87c5a4af0b5a
Fix manifest default rev doc when no rev is checked out (issue1603)
Patrick Mezard <pmezard@gmail.com>
parents:
7850
diff
changeset
|
4381 If no revision is given, the first parent of the working directory |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4382 is used, or the null revision if no revision is checked out. |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4383 |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4384 With -v, print file permissions, symlink and executable bits. |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4385 With --debug, print file revision hashes. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4386 |
14399
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4387 If option --all is specified, the list of all files from all revisions |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4388 is printed. This includes deleted and renamed files. |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4389 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4390 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4391 """ |
17911
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4392 |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4393 fm = ui.formatter('manifest', opts) |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4394 |
14399
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4395 if opts.get('all'): |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4396 if rev or node: |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4397 raise util.Abort(_("can't specify a revision with --all")) |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4398 |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4399 res = [] |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4400 prefix = "data/" |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4401 suffix = ".i" |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4402 plen = len(prefix) |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4403 slen = len(suffix) |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4404 lock = repo.lock() |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4405 try: |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4406 for fn, b, size in repo.store.datafiles(): |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4407 if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix: |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4408 res.append(fn[plen:-slen]) |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4409 finally: |
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4410 lock.release() |
17376
3738d6254bd3
manifest: remove redundant sorted() call for --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
17370
diff
changeset
|
4411 for f in res: |
17911
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4412 fm.startitem() |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4413 fm.write("path", '%s\n', f) |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4414 fm.end() |
14399
71938479eff9
add new option --all to manifest command
Adrian Buehlmann <adrian@cadifra.com>
parents:
14382
diff
changeset
|
4415 return |
3736 | 4416 |
5155
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
4417 if rev and node: |
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
4418 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
|
4419 |
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
4420 if not node: |
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
4421 node = rev |
13d23d66a6cd
manifest: accept -r for rev specification
Bryan O'Sullivan <bos@serpentine.com>
parents:
5148
diff
changeset
|
4422 |
17911
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4423 char = {'l': '@', 'x': '*', '': ''} |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4424 mode = {'l': '644', 'x': '755', '': '644'} |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
4425 ctx = scmutil.revsingle(repo, node) |
17911
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4426 mf = ctx.manifest() |
6749
51b0e799352f
manifest: remove execf/linkf methods
Matt Mackall <mpm@selenic.com>
parents:
6748
diff
changeset
|
4427 for f in ctx: |
17911
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4428 fm.startitem() |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4429 fl = ctx[f].flags() |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4430 fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f])) |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4431 fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl]) |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4432 fm.write('path', '%s\n', f) |
8a8d1a2fd19d
manifest: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17910
diff
changeset
|
4433 fm.end() |
255 | 4434 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4435 @command('^merge', |
19439
f4148c36f0aa
merge: deprecate the --force option
Florence Laguzet <florence.laguzet@gmail.com>
parents:
19434
diff
changeset
|
4436 [('f', 'force', None, |
f4148c36f0aa
merge: deprecate the --force option
Florence Laguzet <florence.laguzet@gmail.com>
parents:
19434
diff
changeset
|
4437 _('force a merge including outstanding changes (DEPRECATED)')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4438 ('r', 'rev', '', _('revision to merge'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4439 ('P', 'preview', None, |
14852
cac04f2f475b
commands: use mergetoolopts when a command supports --tool
Martin Geisler <mg@aragost.com>
parents:
14840
diff
changeset
|
4440 _('review revisions to merge (no merge is performed)')) |
cac04f2f475b
commands: use mergetoolopts when a command supports --tool
Martin Geisler <mg@aragost.com>
parents:
14840
diff
changeset
|
4441 ] + mergetoolopts, |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4442 _('[-P] [-f] [[-r] REV]')) |
8387
50b6af595e0c
merge: add -S/--show option to review revisions without merging
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8366
diff
changeset
|
4443 def merge(ui, repo, node=None, **opts): |
4014
509342f95564
various doc fixes
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4013
diff
changeset
|
4444 """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
|
4445 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4446 The current working directory is updated with all changes made in |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4447 the requested revision since the last common predecessor revision. |
7977
1cd3775e097c
commands: better merge help text
Martin Geisler <mg@daimi.au.dk>
parents:
7976
diff
changeset
|
4448 |
1cd3775e097c
commands: better merge help text
Martin Geisler <mg@daimi.au.dk>
parents:
7976
diff
changeset
|
4449 Files that changed between either parent are marked as changed for |
1cd3775e097c
commands: better merge help text
Martin Geisler <mg@daimi.au.dk>
parents:
7976
diff
changeset
|
4450 the next commit and a commit must be performed before any further |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4451 updates to the repository are allowed. The next commit will have |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4452 two parents. |
2915
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
4453 |
12750
05bd2658bbb3
merge: add --tool argument to merge and resolve
Steve Borho <steve@borho.org>
parents:
12727
diff
changeset
|
4454 ``--tool`` can be used to specify the merge tool used for file |
05bd2658bbb3
merge: add --tool argument to merge and resolve
Steve Borho <steve@borho.org>
parents:
12727
diff
changeset
|
4455 merges. It overrides the HGMERGE environment variable and your |
13891
1bd9f3a6a0d0
merge: added info that hg help merge-tools shows the options for --tool
Arne Babenhauserheide <bab@draketo.de>
parents:
13878
diff
changeset
|
4456 configuration files. See :hg:`help merge-tools` for options. |
12750
05bd2658bbb3
merge: add --tool argument to merge and resolve
Steve Borho <steve@borho.org>
parents:
12727
diff
changeset
|
4457 |
2915
013921c753bd
merge with other head by default, not tip.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2911
diff
changeset
|
4458 If no revision is specified, the working directory's parent is a |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4459 head revision, and the current branch contains exactly one other |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4460 head, the other head is merged with by default. Otherwise, an |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4461 explicit revision with which to merge with must be provided. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4462 |
12750
05bd2658bbb3
merge: add --tool argument to merge and resolve
Steve Borho <steve@borho.org>
parents:
12727
diff
changeset
|
4463 :hg:`resolve` must be used to resolve unresolved files. |
05bd2658bbb3
merge: add --tool argument to merge and resolve
Steve Borho <steve@borho.org>
parents:
12727
diff
changeset
|
4464 |
11452
eac141407b85
merge: document how to 'undo' a merge
Matt Mackall <mpm@selenic.com>
parents:
11442
diff
changeset
|
4465 To undo an uncommitted merge, use :hg:`update --clean .` which |
eac141407b85
merge: document how to 'undo' a merge
Matt Mackall <mpm@selenic.com>
parents:
11442
diff
changeset
|
4466 will check out a clean copy of the original merge parent, losing |
eac141407b85
merge: document how to 'undo' a merge
Matt Mackall <mpm@selenic.com>
parents:
11442
diff
changeset
|
4467 all changes. |
eac141407b85
merge: document how to 'undo' a merge
Matt Mackall <mpm@selenic.com>
parents:
11442
diff
changeset
|
4468 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4469 Returns 0 on success, 1 if there are unresolved files. |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
4470 """ |
2806
0bf22c109cc3
Factor doupdate into _lookup + hg.update
Matt Mackall <mpm@selenic.com>
parents:
2803
diff
changeset
|
4471 |
8387
50b6af595e0c
merge: add -S/--show option to review revisions without merging
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8366
diff
changeset
|
4472 if opts.get('rev') and node: |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
4473 raise util.Abort(_("please specify just one revision")) |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
4474 if not node: |
8387
50b6af595e0c
merge: add -S/--show option to review revisions without merging
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8366
diff
changeset
|
4475 node = opts.get('rev') |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
4476 |
16708
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4477 if node: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4478 node = scmutil.revsingle(repo, node).node() |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4479 |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4480 if not node and repo._bookmarkcurrent: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4481 bmheads = repo.bookmarkheads(repo._bookmarkcurrent) |
18122
730b769fb634
bookmarks: fix head selection for merge with two bookmarked heads
Mads Kiilerich <mads@kiilerich.com>
parents:
17984
diff
changeset
|
4482 curhead = repo[repo._bookmarkcurrent].node() |
16708
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4483 if len(bmheads) == 2: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4484 if curhead == bmheads[0]: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4485 node = bmheads[1] |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4486 else: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4487 node = bmheads[0] |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4488 elif len(bmheads) > 2: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4489 raise util.Abort(_("multiple matching bookmarks to merge - " |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4490 "please merge with an explicit rev or bookmark"), |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4491 hint=_("run 'hg heads' to see all heads")) |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4492 elif len(bmheads) <= 1: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4493 raise util.Abort(_("no matching bookmark to merge - " |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4494 "please merge with an explicit rev or bookmark"), |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4495 hint=_("run 'hg heads' to see all heads")) |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4496 |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4497 if not node and not repo._bookmarkcurrent: |
13047
6c375e07d673
branch: operate on branch names in local string space where possible
Matt Mackall <mpm@selenic.com>
parents:
13022
diff
changeset
|
4498 branch = repo[None].branch() |
6844
a38dff85d31f
merge: use correct branch name for counting heads
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6843
diff
changeset
|
4499 bheads = repo.branchheads(branch) |
16708
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4500 nbhs = [bh for bh in bheads if not repo[bh].bookmarks()] |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4501 |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4502 if len(nbhs) > 2: |
14198
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4503 raise util.Abort(_("branch '%s' has %d heads - " |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4504 "please merge with an explicit rev") |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4505 % (branch, len(bheads)), |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4506 hint=_("run 'hg heads .' to see heads")) |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6686
diff
changeset
|
4507 |
13878
a8d13ee0ce68
misc: replace .parents()[0] with p1()
Matt Mackall <mpm@selenic.com>
parents:
13855
diff
changeset
|
4508 parent = repo.dirstate.p1() |
17386
45b5eb2941d0
merge: handle case when heads are all bookmarks
John Li <jli@circularly.org>
parents:
17370
diff
changeset
|
4509 if len(nbhs) <= 1: |
16708
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4510 if len(bheads) > 1: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4511 raise util.Abort(_("heads are bookmarked - " |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4512 "please merge with an explicit rev"), |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4513 hint=_("run 'hg heads' to see all heads")) |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6686
diff
changeset
|
4514 if len(repo.heads()) > 1: |
14198
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4515 raise util.Abort(_("branch '%s' has one head - " |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4516 "please merge with an explicit rev") |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4517 % branch, |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4518 hint=_("run 'hg heads' to see all heads")) |
15619
6c8573dd1b6b
merge: make 'nothing to merge' aborts consistent
Kevin Bullock <kbullock@ringworld.org>
parents:
15618
diff
changeset
|
4519 msg, hint = _('nothing to merge'), None |
15618
0aca2695a110
merge: remove excess creation of changectx
Kevin Bullock <kbullock@ringworld.org>
parents:
15614
diff
changeset
|
4520 if parent != repo.lookup(branch): |
15619
6c8573dd1b6b
merge: make 'nothing to merge' aborts consistent
Kevin Bullock <kbullock@ringworld.org>
parents:
15618
diff
changeset
|
4521 hint = _("use 'hg update' instead") |
6c8573dd1b6b
merge: make 'nothing to merge' aborts consistent
Kevin Bullock <kbullock@ringworld.org>
parents:
15618
diff
changeset
|
4522 raise util.Abort(msg, hint=hint) |
5242
9cd6578750b9
improve error message for 'hg merge' when repo already at branchtip
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5205
diff
changeset
|
4523 |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6686
diff
changeset
|
4524 if parent not in bheads: |
14198
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4525 raise util.Abort(_('working directory not at a head revision'), |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4526 hint=_("use 'hg update' or merge with an " |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14197
diff
changeset
|
4527 "explicit revision")) |
16708
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4528 if parent == nbhs[0]: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4529 node = nbhs[-1] |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4530 else: |
4a02cf4fbb2e
merge: respect bookmarks during merge
David Soria Parra <dsp@php.net>
parents:
16705
diff
changeset
|
4531 node = nbhs[0] |
8387
50b6af595e0c
merge: add -S/--show option to review revisions without merging
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8366
diff
changeset
|
4532 |
8834
6d36fc70754e
merge: rename -S/--show option to -P/--preview
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8815
diff
changeset
|
4533 if opts.get('preview'): |
10505
b3311e26f94f
merge: fix --preview to show all nodes that will be merged (issue2043).
Greg Ward <greg-hg@gerg.ca>
parents:
10479
diff
changeset
|
4534 # find nodes that are ancestors of p2 but not of p1 |
b3311e26f94f
merge: fix --preview to show all nodes that will be merged (issue2043).
Greg Ward <greg-hg@gerg.ca>
parents:
10479
diff
changeset
|
4535 p1 = repo.lookup('.') |
b3311e26f94f
merge: fix --preview to show all nodes that will be merged (issue2043).
Greg Ward <greg-hg@gerg.ca>
parents:
10479
diff
changeset
|
4536 p2 = repo.lookup(node) |
b3311e26f94f
merge: fix --preview to show all nodes that will be merged (issue2043).
Greg Ward <greg-hg@gerg.ca>
parents:
10479
diff
changeset
|
4537 nodes = repo.changelog.findmissing(common=[p1], heads=[p2]) |
b3311e26f94f
merge: fix --preview to show all nodes that will be merged (issue2043).
Greg Ward <greg-hg@gerg.ca>
parents:
10479
diff
changeset
|
4538 |
8387
50b6af595e0c
merge: add -S/--show option to review revisions without merging
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8366
diff
changeset
|
4539 displayer = cmdutil.show_changeset(ui, repo, opts) |
10505
b3311e26f94f
merge: fix --preview to show all nodes that will be merged (issue2043).
Greg Ward <greg-hg@gerg.ca>
parents:
10479
diff
changeset
|
4540 for node in nodes: |
b3311e26f94f
merge: fix --preview to show all nodes that will be merged (issue2043).
Greg Ward <greg-hg@gerg.ca>
parents:
10479
diff
changeset
|
4541 displayer.show(repo[node]) |
10152
56284451a22c
Added support for templatevar "footer" to cmdutil.py
Robert Bachmann <rbachm@gmail.com>
parents:
10111
diff
changeset
|
4542 displayer.close() |
8387
50b6af595e0c
merge: add -S/--show option to review revisions without merging
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8366
diff
changeset
|
4543 return 0 |
50b6af595e0c
merge: add -S/--show option to review revisions without merging
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
8366
diff
changeset
|
4544 |
12788
de793925862e
merge: implement --tool arguments using new ui.forcemerge configurable
Steve Borho <steve@borho.org>
parents:
12765
diff
changeset
|
4545 try: |
de793925862e
merge: implement --tool arguments using new ui.forcemerge configurable
Steve Borho <steve@borho.org>
parents:
12765
diff
changeset
|
4546 # ui.forcemerge is an internal variable, do not document |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
4547 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge') |
12788
de793925862e
merge: implement --tool arguments using new ui.forcemerge configurable
Steve Borho <steve@borho.org>
parents:
12765
diff
changeset
|
4548 return hg.merge(repo, node, force=opts.get('force')) |
de793925862e
merge: implement --tool arguments using new ui.forcemerge configurable
Steve Borho <steve@borho.org>
parents:
12765
diff
changeset
|
4549 finally: |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
4550 ui.setconfig('ui', 'forcemerge', '', 'merge') |
2029
d436b21b20dc
rewrite revert command. fix issues 93, 123, 147.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2022
diff
changeset
|
4551 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4552 @command('outgoing|out', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4553 [('f', 'force', None, _('run even when the destination is unrelated')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4554 ('r', 'rev', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4555 _('a changeset intended to be included in the destination'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4556 ('n', 'newest-first', None, _('show newest record first')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4557 ('B', 'bookmarks', False, _('compare bookmarks')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4558 ('b', 'branch', [], _('a specific branch you would like to push'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4559 _('BRANCH')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4560 ] + logopts + remoteopts + subrepoopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4561 _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')) |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
4562 def outgoing(ui, repo, dest=None, **opts): |
10376 | 4563 """show changesets not found in the destination |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4564 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4565 Show changesets not found in the specified destination repository |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4566 or the default push location. These are the changesets that would |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4567 be pushed 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
|
4568 |
10376 | 4569 See pull for details of valid destination formats. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4570 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4571 Returns 0 if there are outgoing changes, 1 otherwise. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4572 """ |
17182
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4573 if opts.get('graph'): |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4574 cmdutil.checkunsupportedgraphflags([], opts) |
21050
025ec0f08cb6
hg: make "_outgoing()" return peer object for remote repository
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21049
diff
changeset
|
4575 o, other = hg._outgoing(ui, repo, dest, opts) |
21049
f117a0ba5289
hg: make "_outgoing()" return empty list instead of "None"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21047
diff
changeset
|
4576 if not o: |
21051
1004d3cd65fd
outgoing: introduce "outgoinghooks" to avoid redundant outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21050
diff
changeset
|
4577 cmdutil.outgoinghooks(ui, repo, other, opts, o) |
17182
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4578 return |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4579 |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4580 revdag = cmdutil.graphrevs(repo, o, opts) |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4581 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4582 showparents = [ctx.node() for ctx in repo[None].parents()] |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4583 cmdutil.displaygraph(ui, revdag, displayer, showparents, |
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4584 graphmod.asciiedges) |
21051
1004d3cd65fd
outgoing: introduce "outgoinghooks" to avoid redundant outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21050
diff
changeset
|
4585 cmdutil.outgoinghooks(ui, repo, other, opts, o) |
17182
cdf1532d89c6
incoming/outgoing: handle --graph in core
Patrick Mezard <patrick@mezard.eu>
parents:
17181
diff
changeset
|
4586 return 0 |
13366
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4587 |
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4588 if opts.get('bookmarks'): |
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4589 dest = ui.expandpath(dest or 'default-push', dest or 'default') |
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4590 dest, branches = hg.parseurl(dest, opts.get('branch')) |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
4591 other = hg.peer(repo, opts, dest) |
13453
c1b808020819
bookmarks: issue a warning if remote doesn't support comparing bookmarks
David Soria Parra <dsp@php.net>
parents:
13448
diff
changeset
|
4592 if 'bookmarks' not in other.listkeys('namespaces'): |
c1b808020819
bookmarks: issue a warning if remote doesn't support comparing bookmarks
David Soria Parra <dsp@php.net>
parents:
13448
diff
changeset
|
4593 ui.warn(_("remote doesn't support bookmarks\n")) |
c1b808020819
bookmarks: issue a warning if remote doesn't support comparing bookmarks
David Soria Parra <dsp@php.net>
parents:
13448
diff
changeset
|
4594 return 0 |
14076
924c82157d46
url: move URL parsing functions into util to improve startup time
Brodie Rao <brodie@bitheap.org>
parents:
14073
diff
changeset
|
4595 ui.status(_('comparing with %s\n') % util.hidepassword(dest)) |
13366
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4596 return bookmarks.diff(ui, other, repo) |
c756e9166417
bookmarks: merge incoming/outgoing into core
Matt Mackall <mpm@selenic.com>
parents:
13344
diff
changeset
|
4597 |
14360
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4598 repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default') |
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4599 try: |
14362
8c740a850ad7
commands: replace 'x = f(); return x' with 'return f()'
Martin Geisler <mg@lazybytes.net>
parents:
14361
diff
changeset
|
4600 return hg.outgoing(ui, repo, dest, opts) |
14360
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4601 finally: |
ab687820c4cc
subrepo: respect non-default path for incoming/outgoing
Martin Geisler <mg@aragost.com>
parents:
14014
diff
changeset
|
4602 del repo._subtoppath |
920 | 4603 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4604 @command('parents', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4605 [('r', 'rev', '', _('show parents of the specified revision'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4606 ] + templateopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
4607 _('[-r REV] [FILE]'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
4608 inferrepo=True) |
3658
d12c8668b102
remove legacy hg parents REV syntax
Matt Mackall <mpm@selenic.com>
parents:
3657
diff
changeset
|
4609 def parents(ui, repo, file_=None, **opts): |
8026
683d8ebcf434
expand "dir" to "directory" in help texts
Martin Geisler <mg@lazybytes.net>
parents:
8021
diff
changeset
|
4610 """show the parents of the working directory or revision |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4611 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4612 Print the working directory's parent revisions. If a revision is |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
4613 given via -r/--rev, the parent of that revision will be printed. |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4614 If a file argument is given, the revision in which the file was |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4615 last changed (before the working directory revision or the |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4616 argument to --rev if given) is printed. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4617 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4618 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4619 """ |
12925
6eab8f0df2ca
commands: add revset support to most commands
Matt Mackall <mpm@selenic.com>
parents:
12918
diff
changeset
|
4620 |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
4621 ctx = scmutil.revsingle(repo, opts.get('rev'), None) |
5298
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4622 |
4586
1fcc076fcb17
Make parents with a file but not a revision use working directory revision.
Brendan Cully <brendan@kublai.com>
parents:
4451
diff
changeset
|
4623 if file_: |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
4624 m = scmutil.match(ctx, (file_,), opts) |
6582
5acbdd3941c4
walk: remove remaining users of cmdutils.matchpats
Matt Mackall <mpm@selenic.com>
parents:
6579
diff
changeset
|
4625 if m.anypats() or len(m.files()) != 1: |
8761
0289f384e1e5
Generally replace "file name" with "filename" in help and comments.
timeless <timeless@gmail.com>
parents:
8760
diff
changeset
|
4626 raise util.Abort(_('can only specify an explicit filename')) |
6582
5acbdd3941c4
walk: remove remaining users of cmdutils.matchpats
Matt Mackall <mpm@selenic.com>
parents:
6579
diff
changeset
|
4627 file_ = m.files()[0] |
5298
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4628 filenodes = [] |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4629 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
|
4630 if not cp: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4631 continue |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4632 try: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4633 filenodes.append(cp.filenode(file_)) |
7633 | 4634 except error.LookupError: |
5298
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4635 pass |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4636 if not filenodes: |
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4637 raise util.Abort(_("'%s' not found in manifest!") % file_) |
19333
0cfb62e043e8
parents: change parents command to use filectx
Durham Goode <durham@fb.com>
parents:
19306
diff
changeset
|
4638 p = [] |
0cfb62e043e8
parents: change parents command to use filectx
Durham Goode <durham@fb.com>
parents:
19306
diff
changeset
|
4639 for fn in filenodes: |
0cfb62e043e8
parents: change parents command to use filectx
Durham Goode <durham@fb.com>
parents:
19306
diff
changeset
|
4640 fctx = repo.filectx(file_, fileid=fn) |
0cfb62e043e8
parents: change parents command to use filectx
Durham Goode <durham@fb.com>
parents:
19306
diff
changeset
|
4641 p.append(fctx.node()) |
255 | 4642 else: |
5298
cba2a689117d
parents: make it match the doc when called on a file
Patrick Mezard <pmezard@gmail.com>
parents:
5230
diff
changeset
|
4643 p = [cp.node() for cp in ctx.parents()] |
255 | 4644 |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
3631
diff
changeset
|
4645 displayer = cmdutil.show_changeset(ui, repo, opts) |
255 | 4646 for n in p: |
1092 | 4647 if n != nullid: |
7743
ec9b726a9428
commands: fix paths command docstring indention
Martin Geisler <mg@daimi.au.dk>
parents:
7739
diff
changeset
|
4648 displayer.show(repo[n]) |
10152
56284451a22c
Added support for templatevar "footer" to cmdutil.py
Robert Bachmann <rbachm@gmail.com>
parents:
10111
diff
changeset
|
4649 displayer.close() |
255 | 4650 |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
4651 @command('paths', [], _('[NAME]'), optionalrepo=True) |
1858
9fab6e903bae
Make hg paths and hg debugconfig work with -R/--repository option.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1857
diff
changeset
|
4652 def paths(ui, repo, search=None): |
7691
bcdc2fe3fd07
Clarified 'hg paths' command help
Bill Barry <after.fallout@gmail.com>
parents:
7684
diff
changeset
|
4653 """show aliases for remote repositories |
bcdc2fe3fd07
Clarified 'hg paths' command help
Bill Barry <after.fallout@gmail.com>
parents:
7684
diff
changeset
|
4654 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4655 Show definition of symbolic path name NAME. If no name is given, |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4656 show definition of all available names. |
7743
ec9b726a9428
commands: fix paths command docstring indention
Martin Geisler <mg@daimi.au.dk>
parents:
7739
diff
changeset
|
4657 |
14331
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4658 Option -q/--quiet suppresses all output when searching for NAME |
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4659 and shows only the path names when listing all definitions. |
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4660 |
12083
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
4661 Path names are defined in the [paths] section of your |
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
4662 configuration file and in ``/etc/mercurial/hgrc``. If run inside a |
11009
4d3288197717
commands: better markup in "hg help paths"
Martin Geisler <mg@lazybytes.net>
parents:
11008
diff
changeset
|
4663 repository, ``.hg/hgrc`` is used, too. |
7693
e040f9d6b2f3
consolidated url help into urls help topic and added information about path aliases
Bill Barry <after.fallout@gmail.com>
parents:
7691
diff
changeset
|
4664 |
11007
a0102da324ab
commands: revised documentation of 'default' and 'default-push'
Faheem Mitha <faheem@email.unc.edu>
parents:
10948
diff
changeset
|
4665 The path names ``default`` and ``default-push`` have a special |
a0102da324ab
commands: revised documentation of 'default' and 'default-push'
Faheem Mitha <faheem@email.unc.edu>
parents:
10948
diff
changeset
|
4666 meaning. When performing a push or pull operation, they are used |
a0102da324ab
commands: revised documentation of 'default' and 'default-push'
Faheem Mitha <faheem@email.unc.edu>
parents:
10948
diff
changeset
|
4667 as fallbacks if no location is specified on the command-line. |
a0102da324ab
commands: revised documentation of 'default' and 'default-push'
Faheem Mitha <faheem@email.unc.edu>
parents:
10948
diff
changeset
|
4668 When ``default-push`` is set, it will be used for push and |
a0102da324ab
commands: revised documentation of 'default' and 'default-push'
Faheem Mitha <faheem@email.unc.edu>
parents:
10948
diff
changeset
|
4669 ``default`` will be used for pull; otherwise ``default`` is used |
a0102da324ab
commands: revised documentation of 'default' and 'default-push'
Faheem Mitha <faheem@email.unc.edu>
parents:
10948
diff
changeset
|
4670 as the fallback for both. When cloning a repository, the clone |
a0102da324ab
commands: revised documentation of 'default' and 'default-push'
Faheem Mitha <faheem@email.unc.edu>
parents:
10948
diff
changeset
|
4671 source is written as ``default`` in ``.hg/hgrc``. Note that |
11009
4d3288197717
commands: better markup in "hg help paths"
Martin Geisler <mg@lazybytes.net>
parents:
11008
diff
changeset
|
4672 ``default`` and ``default-push`` apply to all inbound (e.g. |
4d3288197717
commands: better markup in "hg help paths"
Martin Geisler <mg@lazybytes.net>
parents:
11008
diff
changeset
|
4673 :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email` and |
4d3288197717
commands: better markup in "hg help paths"
Martin Geisler <mg@lazybytes.net>
parents:
11008
diff
changeset
|
4674 :hg:`bundle`) operations. |
10933
e3396b218e10
Document 'default' and 'default-push' in paths docstring
Faheem Mitha <faheem@email.unc.edu>
parents:
10645
diff
changeset
|
4675 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
4676 See :hg:`help urls` for more information. |
11507
35e2d453cf0d
commands: document return values of add and paths commands
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11488
diff
changeset
|
4677 |
35e2d453cf0d
commands: document return values of add and paths commands
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11488
diff
changeset
|
4678 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4679 """ |
779 | 4680 if search: |
4681 for name, path in ui.configitems("paths"): | |
4682 if name == search: | |
14331
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4683 ui.status("%s\n" % util.hidepassword(path)) |
779 | 4684 return |
14331
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4685 if not ui.quiet: |
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4686 ui.warn(_("not found!\n")) |
779 | 4687 return 1 |
4688 else: | |
4689 for name, path in ui.configitems("paths"): | |
14331
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4690 if ui.quiet: |
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4691 ui.write("%s\n" % name) |
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4692 else: |
3b9a896af09c
paths: Add support for -q/--quiet
Thomas Arendsen Hein <thomas@intevation.de>
parents:
14326
diff
changeset
|
4693 ui.write("%s = %s\n" % (name, util.hidepassword(path))) |
779 | 4694 |
17981
e689b0d91546
command: remove phase from the list of basic command
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
17949
diff
changeset
|
4695 @command('phase', |
15849
513ca86b88ef
phase: lowercase option help, rephrase slightly
Martin Geisler <mg@aragost.com>
parents:
15837
diff
changeset
|
4696 [('p', 'public', False, _('set changeset phase to public')), |
513ca86b88ef
phase: lowercase option help, rephrase slightly
Martin Geisler <mg@aragost.com>
parents:
15837
diff
changeset
|
4697 ('d', 'draft', False, _('set changeset phase to draft')), |
513ca86b88ef
phase: lowercase option help, rephrase slightly
Martin Geisler <mg@aragost.com>
parents:
15837
diff
changeset
|
4698 ('s', 'secret', False, _('set changeset phase to secret')), |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4699 ('f', 'force', False, _('allow to move boundary backward')), |
15855
09757185ce97
phase: add metavar to -r help text
Martin Geisler <mg@aragost.com>
parents:
15854
diff
changeset
|
4700 ('r', 'rev', [], _('target revision'), _('REV')), |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4701 ], |
15854
2260e6ed09c3
phase: the REV argument can be repeated
Martin Geisler <mg@aragost.com>
parents:
15853
diff
changeset
|
4702 _('[-p|-d|-s] [-f] [-r] REV...')) |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4703 def phase(ui, repo, *revs, **opts): |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4704 """set or show the current phase name |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4705 |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4706 With no argument, show the phase name of specified revisions. |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4707 |
15851
05ccad068313
phase: use standard syntax for command line flags
Martin Geisler <mg@aragost.com>
parents:
15850
diff
changeset
|
4708 With one of -p/--public, -d/--draft or -s/--secret, change the |
15850
920433707a01
phase: fix RST markup (use ``...`` for literal text)
Martin Geisler <mg@aragost.com>
parents:
15849
diff
changeset
|
4709 phase value of the specified revisions. |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4710 |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4711 Unless -f/--force is specified, :hg:`phase` won't move changeset from a |
15850
920433707a01
phase: fix RST markup (use ``...`` for literal text)
Martin Geisler <mg@aragost.com>
parents:
15849
diff
changeset
|
4712 lower phase to an higher phase. Phases are ordered as follows:: |
15832 | 4713 |
4714 public < draft < secret | |
15906
aad565319fa3
phase: report phase movement
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15877
diff
changeset
|
4715 |
20633
2d183dd54384
phase: say "Returns 0" instead of "Return 0" like other command help
Yuya Nishihara <yuya@tcha.org>
parents:
20594
diff
changeset
|
4716 Returns 0 on success, 1 if no phases were changed or some could not |
16097
8dc573a9c5e5
phase: when phase cannot be reduced, hint at --force and return 1 (BC)
Patrick Mezard <patrick@mezard.eu>
parents:
16095
diff
changeset
|
4717 be changed. |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4718 """ |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4719 # search for a unique phase argument |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4720 targetphase = None |
15853
fbb68b382040
commands: no need to rename merge and phases on import
Martin Geisler <mg@aragost.com>
parents:
15852
diff
changeset
|
4721 for idx, name in enumerate(phases.phasenames): |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4722 if opts[name]: |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4723 if targetphase is not None: |
15833
3cf2bb3a9fcc
phase: mark messages for i18n
Matt Mackall <mpm@selenic.com>
parents:
15832
diff
changeset
|
4724 raise util.Abort(_('only one phase can be specified')) |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4725 targetphase = idx |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4726 |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4727 # look for specified revision |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4728 revs = list(revs) |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4729 revs.extend(opts['rev']) |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4730 if not revs: |
15958
0d2ac0299020
commands: drop exclamation mark in abort message
Idan Kamara <idankk86@gmail.com>
parents:
15957
diff
changeset
|
4731 raise util.Abort(_('no revisions specified')) |
15831
0ecaf1e72609
phase: drop reference to working directory phase
Matt Mackall <mpm@selenic.com>
parents:
15830
diff
changeset
|
4732 |
16024
7c967c4a6144
phase: accept old style revision specification
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
16023
diff
changeset
|
4733 revs = scmutil.revrange(repo, revs) |
7c967c4a6144
phase: accept old style revision specification
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
16023
diff
changeset
|
4734 |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4735 lock = None |
15906
aad565319fa3
phase: report phase movement
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15877
diff
changeset
|
4736 ret = 0 |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4737 if targetphase is None: |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4738 # display |
16024
7c967c4a6144
phase: accept old style revision specification
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
16023
diff
changeset
|
4739 for r in revs: |
7c967c4a6144
phase: accept old style revision specification
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
16023
diff
changeset
|
4740 ctx = repo[r] |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4741 ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr())) |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4742 else: |
22050
56ccd95b49c6
phase: wrap `hg phases` phase movement in a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22039
diff
changeset
|
4743 tr = None |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4744 lock = repo.lock() |
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4745 try: |
22050
56ccd95b49c6
phase: wrap `hg phases` phase movement in a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22039
diff
changeset
|
4746 tr = repo.transaction("phase") |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4747 # set phase |
16659
58edd786e96f
phase: make if abort on nullid for the good reason
Patrick Mezard <patrick@mezard.eu>
parents:
16657
diff
changeset
|
4748 if not revs: |
17299
e51d4aedace9
check-code: indent 4 spaces in py files
Mads Kiilerich <mads@kiilerich.com>
parents:
17292
diff
changeset
|
4749 raise util.Abort(_('empty revision set')) |
16659
58edd786e96f
phase: make if abort on nullid for the good reason
Patrick Mezard <patrick@mezard.eu>
parents:
16657
diff
changeset
|
4750 nodes = [repo[r].node() for r in revs] |
16657
b6081c2c4647
phases: introduce phasecache
Patrick Mezard <patrick@mezard.eu>
parents:
16648
diff
changeset
|
4751 olddata = repo._phasecache.getphaserevs(repo)[:] |
22069
616a455b02ca
phase: add a transaction argument to advanceboundary
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22050
diff
changeset
|
4752 phases.advanceboundary(repo, tr, targetphase, nodes) |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4753 if opts['force']: |
22070
c1ca47204590
phase: add a transaction argument to retractboundary
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22069
diff
changeset
|
4754 phases.retractboundary(repo, tr, targetphase, nodes) |
22050
56ccd95b49c6
phase: wrap `hg phases` phase movement in a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22039
diff
changeset
|
4755 tr.close() |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4756 finally: |
22050
56ccd95b49c6
phase: wrap `hg phases` phase movement in a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22039
diff
changeset
|
4757 if tr is not None: |
56ccd95b49c6
phase: wrap `hg phases` phase movement in a transaction
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
22039
diff
changeset
|
4758 tr.release() |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4759 lock.release() |
18210
f730ed2e093d
phases: prepare phase command for filtering
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18209
diff
changeset
|
4760 # moving revision from public to draft may hide them |
f730ed2e093d
phases: prepare phase command for filtering
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18209
diff
changeset
|
4761 # We have to check result on an unfiltered repository |
f730ed2e093d
phases: prepare phase command for filtering
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18209
diff
changeset
|
4762 unfi = repo.unfiltered() |
f730ed2e093d
phases: prepare phase command for filtering
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18209
diff
changeset
|
4763 newdata = repo._phasecache.getphaserevs(unfi) |
16715
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4764 changes = sum(o != newdata[i] for i, o in enumerate(olddata)) |
18210
f730ed2e093d
phases: prepare phase command for filtering
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18209
diff
changeset
|
4765 cl = unfi.changelog |
16715
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4766 rejected = [n for n in nodes |
18209
6a91cbb67907
phases: avoid changectx creation while checking command result
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
18181
diff
changeset
|
4767 if newdata[cl.rev(n)] < targetphase] |
16715
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4768 if rejected: |
20093
1dee888b22f7
phase: better error message when --force is needed
Martin Geisler <martin@geisler.net>
parents:
19997
diff
changeset
|
4769 ui.warn(_('cannot move %i changesets to a higher ' |
16715
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4770 'phase, use --force\n') % len(rejected)) |
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4771 ret = 1 |
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4772 if changes: |
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4773 msg = _('phase changed for %i changesets\n') % changes |
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4774 if ret: |
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4775 ui.status(msg) |
15906
aad565319fa3
phase: report phase movement
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15877
diff
changeset
|
4776 else: |
16715
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4777 ui.note(msg) |
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4778 else: |
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4779 ui.warn(_('no phases changed\n')) |
1e24da6fcd67
phase: remove useless test, olddata is never None
Patrick Mezard <patrick@mezard.eu>
parents:
16713
diff
changeset
|
4780 ret = 1 |
15968
bf87b6b95ce5
phase: alway return a value
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15959
diff
changeset
|
4781 return ret |
15830
8ed112ed774a
phases: add a phases command to display and manipulate phases
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15829
diff
changeset
|
4782 |
5224
20817af258d8
pull -u: if "url#rev" was given, update to rev
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5222
diff
changeset
|
4783 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
|
4784 if modheads == 0: |
16107
a3dcc59054ca
pull: backout change to return code
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
4785 return |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
4786 if optupdate: |
19523
f37b5a17e6a0
bookmarks: pull --update updates to active bookmark if it moved (issue4007)
Kevin Bullock <kbullock@ringworld.org>
parents:
19496
diff
changeset
|
4787 checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout) |
14485
610873cf064a
Make pull -u behave like pull && update
Brendan Cully <brendan@kublai.com>
parents:
14466
diff
changeset
|
4788 try: |
16019
eb85d5f89fef
bookmarks: move current bookmark on update -u and bare pull -u (issue3222)
Matt Mackall <mpm@selenic.com>
parents:
16010
diff
changeset
|
4789 ret = hg.update(repo, checkout) |
14485
610873cf064a
Make pull -u behave like pull && update
Brendan Cully <brendan@kublai.com>
parents:
14466
diff
changeset
|
4790 except util.Abort, inst: |
16230
d4d35fd0889d
update: don't translate the abort message twice
Javi Merino <cibervicho@gmail.com>
parents:
16219
diff
changeset
|
4791 ui.warn(_("not updating: %s\n") % str(inst)) |
19797
a9abdb168425
pull: for pull --update with failed update, print hint if any
Siddharth Agarwal <sid0@fb.com>
parents:
19757
diff
changeset
|
4792 if inst.hint: |
a9abdb168425
pull: for pull --update with failed update, print hint if any
Siddharth Agarwal <sid0@fb.com>
parents:
19757
diff
changeset
|
4793 ui.warn(_("(%s)\n") % inst.hint) |
14485
610873cf064a
Make pull -u behave like pull && update
Brendan Cully <brendan@kublai.com>
parents:
14466
diff
changeset
|
4794 return 0 |
16019
eb85d5f89fef
bookmarks: move current bookmark on update -u and bare pull -u (issue3222)
Matt Mackall <mpm@selenic.com>
parents:
16010
diff
changeset
|
4795 if not ret and not checkout: |
eb85d5f89fef
bookmarks: move current bookmark on update -u and bare pull -u (issue3222)
Matt Mackall <mpm@selenic.com>
parents:
16010
diff
changeset
|
4796 if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): |
eb85d5f89fef
bookmarks: move current bookmark on update -u and bare pull -u (issue3222)
Matt Mackall <mpm@selenic.com>
parents:
16010
diff
changeset
|
4797 ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) |
eb85d5f89fef
bookmarks: move current bookmark on update -u and bare pull -u (issue3222)
Matt Mackall <mpm@selenic.com>
parents:
16010
diff
changeset
|
4798 return ret |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
4799 if modheads > 1: |
13804
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
4800 currentbranchheads = len(repo.branchheads()) |
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
4801 if currentbranchheads == modheads: |
13803
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13767
diff
changeset
|
4802 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) |
13804
7dc2bd4c0dc8
pull: new output message when there are multiple branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13803
diff
changeset
|
4803 elif currentbranchheads > 1: |
16683 | 4804 ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to " |
4805 "merge)\n")) | |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
4806 else: |
13803
e380964d53f8
pull: don't suggest running hg merge when new heads are on different branches
Kevin Berridge <kevin.w.berridge@gmail.com>
parents:
13767
diff
changeset
|
4807 ui.status(_("(run 'hg heads' to see heads)\n")) |
2019
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
4808 else: |
ced2d3620f95
add merge command. means same thing as "update -m".
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1996
diff
changeset
|
4809 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
|
4810 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4811 @command('^pull', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4812 [('u', 'update', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4813 _('update to new branch head if changesets were pulled')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4814 ('f', 'force', None, _('run even when remote repository is unrelated')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4815 ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4816 ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4817 ('b', 'branch', [], _('a specific branch you would like to pull'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4818 _('BRANCH')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4819 ] + remoteopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4820 _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')) |
404 | 4821 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
|
4822 """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
|
4823 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4824 Pull changes from a remote repository to a local one. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4825 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4826 This finds all changes from the repository at the specified path |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4827 or URL and adds them to a local repository (the current one unless |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4828 -R is specified). By default, this does not update the copy of the |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4829 project in the working directory. |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
4830 |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
4831 Use :hg:`incoming` if you want to see what would have been added |
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
4832 by a pull at the time you issued this command. If you then decide |
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
4833 to add those changes to the repository, you should use :hg:`pull |
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
4834 -r X` where ``X`` is the last changeset listed by :hg:`incoming`. |
7980
3d8252430e17
commands: make pull help point to the incoming command
Martin Geisler <mg@daimi.au.dk>
parents:
7979
diff
changeset
|
4835 |
7693
e040f9d6b2f3
consolidated url help into urls help topic and added information about path aliases
Bill Barry <after.fallout@gmail.com>
parents:
7691
diff
changeset
|
4836 If SOURCE is omitted, the 'default' path will be used. |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
4837 See :hg:`help urls` for more information. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4838 |
16107
a3dcc59054ca
pull: backout change to return code
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
4839 Returns 0 on success, 1 if an update had unresolved files. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4840 """ |
10379
a78bfaf988e1
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
Sune Foldager <cryo@cyanite.org>
parents:
10376
diff
changeset
|
4841 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) |
14556
517e1d88bf7e
hg: change various repository() users to use peer() where appropriate
Matt Mackall <mpm@selenic.com>
parents:
14553
diff
changeset
|
4842 other = hg.peer(repo, opts, source) |
20576
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4843 try: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4844 ui.status(_('pulling from %s\n') % util.hidepassword(source)) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4845 revs, checkout = hg.addbranchrevs(repo, other, branches, |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4846 opts.get('rev')) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4847 |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4848 remotebookmarks = other.listkeys('bookmarks') |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4849 |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4850 if opts.get('bookmark'): |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4851 if not revs: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4852 revs = [] |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4853 for b in opts['bookmark']: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4854 if b not in remotebookmarks: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4855 raise util.Abort(_('remote bookmark %s not found!') % b) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4856 revs.append(remotebookmarks[b]) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4857 |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4858 if revs: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4859 try: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4860 revs = [other.lookup(rev) for rev in revs] |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4861 except error.CapabilityError: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4862 err = _("other repository doesn't support revision lookup, " |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4863 "so a rev cannot be specified.") |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4864 raise util.Abort(err) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4865 |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4866 modheads = repo.pull(other, heads=revs, force=opts.get('force')) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4867 bookmarks.updatefromremote(ui, repo, remotebookmarks, source) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4868 if checkout: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4869 checkout = str(repo.changelog.rev(other.lookup(checkout))) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4870 repo._subtoppath = source |
5259
65dc707606ed
Push capability checking into protocol-level code.
Bryan O'Sullivan <bos@serpentine.com>
parents:
5248
diff
changeset
|
4871 try: |
20576
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4872 ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4873 |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4874 finally: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4875 del repo._subtoppath |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4876 |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4877 # update specified bookmarks |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4878 if opts.get('bookmark'): |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4879 marks = repo._bookmarks |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4880 for b in opts['bookmark']: |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4881 # explicit pull overrides local bookmark if any |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4882 ui.status(_("importing bookmark %s\n") % b) |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4883 marks[b] = repo[remotebookmarks[b]].node() |
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4884 marks.write() |
12852
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4885 finally: |
20576
7f865a94691e
pull: close peer repo on completion (issue2491) (issue2797)
Piotr Klecha <pklecha@forcom.com.pl>
parents:
20293
diff
changeset
|
4886 other.close() |
13368
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4887 return ret |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4888 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4889 @command('^push', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4890 [('f', 'force', None, _('force push')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4891 ('r', 'rev', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4892 _('a changeset intended to be included in the destination'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4893 _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4894 ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4895 ('b', 'branch', [], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4896 _('a specific branch you would like to push'), _('BRANCH')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4897 ('', 'new-branch', False, _('allow pushing a new branch')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4898 ] + remoteopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4899 _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')) |
2494
73ac95671788
push, outgoing, bundle: fall back to "default" if "default-push" not defined
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2493
diff
changeset
|
4900 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
|
4901 """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
|
4902 |
11217
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4903 Push changesets from the local repository to the specified |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4904 destination. |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4905 |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4906 This operation is symmetrical to pull: it is identical to a pull |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4907 in the destination repository from the current one. |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4908 |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4909 By default, push will not allow creation of new heads at the |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4910 destination, since multiple heads would make it unclear which head |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4911 to use. In this situation, it is recommended to pull and merge |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4912 before pushing. |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4913 |
11219
39a7f69a0a9a
commands: document --new-branch flag for push
Martin Geisler <mg@aragost.com>
parents:
11218
diff
changeset
|
4914 Use --new-branch if you want to allow push to create a new named |
39a7f69a0a9a
commands: document --new-branch flag for push
Martin Geisler <mg@aragost.com>
parents:
11218
diff
changeset
|
4915 branch that is not present at the destination. This allows you to |
39a7f69a0a9a
commands: document --new-branch flag for push
Martin Geisler <mg@aragost.com>
parents:
11218
diff
changeset
|
4916 only create a new branch without forcing other changes. |
39a7f69a0a9a
commands: document --new-branch flag for push
Martin Geisler <mg@aragost.com>
parents:
11218
diff
changeset
|
4917 |
19935
4f53de036af8
push: add more detailed explanation about "--force" to online help document
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19919
diff
changeset
|
4918 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
4919 |
19941
2bf99bc5077a
help: minor tweak to push help
Matt Mackall <mpm@selenic.com>
parents:
19935
diff
changeset
|
4920 Extra care should be taken with the -f/--force option, |
19935
4f53de036af8
push: add more detailed explanation about "--force" to online help document
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19919
diff
changeset
|
4921 which will push all new heads on all branches, an action which will |
4f53de036af8
push: add more detailed explanation about "--force" to online help document
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19919
diff
changeset
|
4922 almost always cause confusion for collaborators. |
11217
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4923 |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4924 If -r/--rev is used, the specified revision and all its ancestors |
1b8aa9ffa7dc
commands: updates to push docstring.
Faheem Mitha <faheem@email.unc.edu>
parents:
11103
diff
changeset
|
4925 will be pushed to the remote repository. |
7693
e040f9d6b2f3
consolidated url help into urls help topic and added information about path aliases
Bill Barry <after.fallout@gmail.com>
parents:
7691
diff
changeset
|
4926 |
17190
d99d0b559084
bookmarks: document behavior of -B/--bookmark in help
Augie Fackler <raf@durin42.com>
parents:
17188
diff
changeset
|
4927 If -B/--bookmark is used, the specified bookmarked revision, its |
d99d0b559084
bookmarks: document behavior of -B/--bookmark in help
Augie Fackler <raf@durin42.com>
parents:
17188
diff
changeset
|
4928 ancestors, and the bookmark will be pushed to the remote |
d99d0b559084
bookmarks: document behavior of -B/--bookmark in help
Augie Fackler <raf@durin42.com>
parents:
17188
diff
changeset
|
4929 repository. |
d99d0b559084
bookmarks: document behavior of -B/--bookmark in help
Augie Fackler <raf@durin42.com>
parents:
17188
diff
changeset
|
4930 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
4931 Please see :hg:`help urls` for important details about ``ssh://`` |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4932 URLs. If DESTINATION is omitted, a default path will be used. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4933 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4934 Returns 0 if push was successful, 1 if nothing to push. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4935 """ |
13368
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4936 |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4937 if opts.get('bookmark'): |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
4938 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push') |
13368
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4939 for b in opts['bookmark']: |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4940 # translate -B options to -r so changesets get pushed |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4941 if b in repo._bookmarks: |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4942 opts.setdefault('rev', []).append(b) |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4943 else: |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4944 # if we try to push a deleted bookmark, translate it to null |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4945 # this lets simultaneous -r, -b options continue working |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4946 opts.setdefault('rev', []).append("null") |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4947 |
10365
d757bc0c7865
interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
10364
diff
changeset
|
4948 dest = ui.expandpath(dest or 'default-push', dest or 'default') |
10379
a78bfaf988e1
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
Sune Foldager <cryo@cyanite.org>
parents:
10376
diff
changeset
|
4949 dest, branches = hg.parseurl(dest, opts.get('branch')) |
14076
924c82157d46
url: move URL parsing functions into util to improve startup time
Brodie Rao <brodie@bitheap.org>
parents:
14073
diff
changeset
|
4950 ui.status(_('pushing to %s\n') % util.hidepassword(dest)) |
10365
d757bc0c7865
interpret repo#name url syntax as branch instead of revision
Sune Foldager <cryo@cyanite.org>
parents:
10364
diff
changeset
|
4951 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) |
20558
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4952 try: |
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4953 other = hg.peer(repo, opts, dest) |
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4954 except error.RepoError: |
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4955 if dest == "default-push": |
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4956 raise util.Abort(_("default repository not configured!"), |
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4957 hint=_('see the "path" section in "hg help config"')) |
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4958 else: |
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4959 raise |
c4f45ce85351
push: provide a hint when no paths in configured (issue3692)
anuraggoel <anurag.dsps@gmail.com>
parents:
20544
diff
changeset
|
4960 |
4478
b2b55acbacdd
Add support for url#id syntax
Matt Mackall <mpm@selenic.com>
parents:
4474
diff
changeset
|
4961 if revs: |
17168
e058f4eec69c
push: accept revset argument for --rev
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
17149
diff
changeset
|
4962 revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] |
8815
e87b0fc4750b
subrepo: basic push support
Matt Mackall <mpm@selenic.com>
parents:
8812
diff
changeset
|
4963 |
12852
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4964 repo._subtoppath = dest |
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4965 try: |
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4966 # push subrepos depth-first for coherent ordering |
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4967 c = repo[''] |
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4968 subs = c.substate # only repos that are committed |
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4969 for s in sorted(subs): |
21034
693b4cb4330f
subrepo: return non-zero exit code when a subrepo push doesn't succeed
Matt Mackall <mpm@selenic.com>
parents:
21032
diff
changeset
|
4970 result = c.sub(s).push(opts) |
693b4cb4330f
subrepo: return non-zero exit code when a subrepo push doesn't succeed
Matt Mackall <mpm@selenic.com>
parents:
21032
diff
changeset
|
4971 if result == 0: |
693b4cb4330f
subrepo: return non-zero exit code when a subrepo push doesn't succeed
Matt Mackall <mpm@selenic.com>
parents:
21032
diff
changeset
|
4972 return not result |
12852
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4973 finally: |
5dbff89cf107
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
Mads Kiilerich <mads@kiilerich.com>
parents:
12831
diff
changeset
|
4974 del repo._subtoppath |
13368
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4975 result = repo.push(other, opts.get('force'), revs=revs, |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4976 newbranch=opts.get('new_branch')) |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4977 |
16023
90f8b8dd0326
push: return 1 if no changes found (issue3228)
Matt Mackall <mpm@selenic.com>
parents:
16022
diff
changeset
|
4978 result = not result |
13368
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4979 |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4980 if opts.get('bookmark'): |
20026
84905561ad41
bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19997
diff
changeset
|
4981 bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark']) |
84905561ad41
bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19997
diff
changeset
|
4982 if bresult == 2: |
84905561ad41
bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19997
diff
changeset
|
4983 return 2 |
84905561ad41
bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19997
diff
changeset
|
4984 if not result and bresult: |
84905561ad41
bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19997
diff
changeset
|
4985 result = 2 |
13368
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4986 |
d4ab9486e514
bookmarks: move push/pull command features to core
Matt Mackall <mpm@selenic.com>
parents:
13367
diff
changeset
|
4987 return result |
319 | 4988 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
4989 @command('recover', []) |
245 | 4990 def recover(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4991 """roll back an interrupted transaction |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4992 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
4993 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
|
4994 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4995 This command tries to fix the repository status after an |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4996 interrupted operation. It should only be necessary when Mercurial |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
4997 suggests it. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4998 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
4999 Returns 0 if successful, 1 if nothing to recover or verify fails. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5000 """ |
1516
0b1b029b4de3
Automatically run "verify" whenever we run "recover"
Matt Mackall <mpm@selenic.com>
parents:
1514
diff
changeset
|
5001 if repo.recover(): |
2778 | 5002 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
|
5003 return 1 |
245 | 5004 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5005 @command('^remove|rm', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5006 [('A', 'after', None, _('record delete for missing files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5007 ('f', 'force', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5008 _('remove (and delete) file even if added or modified')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5009 ] + walkopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
5010 _('[OPTION]... FILE...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
5011 inferrepo=True) |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
5012 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
|
5013 """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
|
5014 |
15114 | 5015 Schedule the indicated files for removal from the current branch. |
5016 | |
5017 This command schedules the files to be removed at the next commit. | |
5018 To undo a remove before that, see :hg:`revert`. To undo added | |
5019 files, see :hg:`forget`. | |
5020 | |
5021 .. container:: verbose | |
5022 | |
5023 -A/--after can be used to remove only files that have already | |
5024 been deleted, -f/--force can be used to force deletion, and -Af | |
5025 can be used to remove files from the next revision without | |
5026 deleting them from the working directory. | |
5027 | |
5028 The following table details the behavior of remove for different | |
5029 file states (columns) and option combinations (rows). The file | |
5030 states are Added [A], Clean [C], Modified [M] and Missing [!] | |
5031 (as reported by :hg:`status`). The actions are Warn, Remove | |
5032 (from branch) and Delete (from disk): | |
15037
df47381b41d6
minirst: add simple table support
Matt Mackall <mpm@selenic.com>
parents:
15023
diff
changeset
|
5033 |
19960
95304251c376
doc: put text into header of 1st column in table to generate page correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19959
diff
changeset
|
5034 ========= == == == == |
95304251c376
doc: put text into header of 1st column in table to generate page correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19959
diff
changeset
|
5035 opt/state A C M ! |
95304251c376
doc: put text into header of 1st column in table to generate page correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19959
diff
changeset
|
5036 ========= == == == == |
95304251c376
doc: put text into header of 1st column in table to generate page correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19959
diff
changeset
|
5037 none W RD W R |
95304251c376
doc: put text into header of 1st column in table to generate page correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19959
diff
changeset
|
5038 -f R RD RD R |
95304251c376
doc: put text into header of 1st column in table to generate page correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19959
diff
changeset
|
5039 -A W W W R |
95304251c376
doc: put text into header of 1st column in table to generate page correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19959
diff
changeset
|
5040 -Af R R R R |
95304251c376
doc: put text into header of 1st column in table to generate page correctly
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
19959
diff
changeset
|
5041 ========= == == == == |
2309
b2f37c7026ca
remove: rewrite to be ~400x faster, bit more friendly
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2301
diff
changeset
|
5042 |
15114 | 5043 Note that remove never deletes files in Added [A] state from the |
5044 working directory, not even if option --force is specified. | |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5045 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5046 Returns 0 on success, 1 if any warnings encountered. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5047 """ |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
5048 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5049 ret = 0 |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
5050 after, force = opts.get('after'), opts.get('force') |
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
5051 if not pats and not after: |
2179
520dd3d28e9b
add --after option to remove command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2175
diff
changeset
|
5052 raise util.Abort(_('no files specified')) |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
5053 |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
5054 m = scmutil.match(repo[None], pats, opts) |
6761
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5055 s = repo.status(match=m, clean=True) |
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5056 modified, added, deleted, clean = s[0], s[1], s[3], s[6] |
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5057 |
17848
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5058 # warn about failure to delete explicit files/dirs |
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5059 wctx = repo[None] |
8533
6062c6362b2e
remove: warn if unversionned files are specified (issue1454)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8464
diff
changeset
|
5060 for f in m.files(): |
17848
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5061 if f in repo.dirstate or f in wctx.dirs(): |
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5062 continue |
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5063 if os.path.exists(m.rel(f)): |
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5064 if os.path.isdir(m.rel(f)): |
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5065 ui.warn(_('not removing %s: no tracked files\n') % m.rel(f)) |
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5066 else: |
14604
b1a534335548
forget, remove: don't note on nonexistent file twice
Idan Kamara <idankk86@gmail.com>
parents:
14564
diff
changeset
|
5067 ui.warn(_('not removing %s: file is untracked\n') % m.rel(f)) |
17848
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5068 # missing files will generate a warning elsewhere |
66f0c78350ab
remove: don't return error on directories with tracked files
Matt Mackall <mpm@selenic.com>
parents:
17837
diff
changeset
|
5069 ret = 1 |
8533
6062c6362b2e
remove: warn if unversionned files are specified (issue1454)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
8464
diff
changeset
|
5070 |
6761
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5071 if force: |
14450
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5072 list = modified + deleted + clean + added |
6761
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5073 elif after: |
14450
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5074 list = deleted |
12129
07ac2a560fce
remove: properly set return code when warnings are issued
Brodie Rao <brodie@bitheap.org>
parents:
12128
diff
changeset
|
5075 for f in modified + added + clean: |
18053
0c2f0048125d
rm: drop misleading 'use -f' hint for the rm --after 'not removing' warning
Mads Kiilerich <madski@unity3d.com>
parents:
18039
diff
changeset
|
5076 ui.warn(_('not removing %s: file still exists\n') % m.rel(f)) |
12129
07ac2a560fce
remove: properly set return code when warnings are issued
Brodie Rao <brodie@bitheap.org>
parents:
12128
diff
changeset
|
5077 ret = 1 |
6761
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5078 else: |
14450
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5079 list = deleted + clean |
12129
07ac2a560fce
remove: properly set return code when warnings are issued
Brodie Rao <brodie@bitheap.org>
parents:
12128
diff
changeset
|
5080 for f in modified: |
07ac2a560fce
remove: properly set return code when warnings are issued
Brodie Rao <brodie@bitheap.org>
parents:
12128
diff
changeset
|
5081 ui.warn(_('not removing %s: file is modified (use -f' |
07ac2a560fce
remove: properly set return code when warnings are issued
Brodie Rao <brodie@bitheap.org>
parents:
12128
diff
changeset
|
5082 ' to force removal)\n') % m.rel(f)) |
07ac2a560fce
remove: properly set return code when warnings are issued
Brodie Rao <brodie@bitheap.org>
parents:
12128
diff
changeset
|
5083 ret = 1 |
07ac2a560fce
remove: properly set return code when warnings are issued
Brodie Rao <brodie@bitheap.org>
parents:
12128
diff
changeset
|
5084 for f in added: |
15115
c84b3f42d5ae
remove: suggest forget to undo adds
Matt Mackall <mpm@selenic.com>
parents:
15114
diff
changeset
|
5085 ui.warn(_('not removing %s: file has been marked for add' |
c84b3f42d5ae
remove: suggest forget to undo adds
Matt Mackall <mpm@selenic.com>
parents:
15114
diff
changeset
|
5086 ' (use forget to undo)\n') % m.rel(f)) |
12129
07ac2a560fce
remove: properly set return code when warnings are issued
Brodie Rao <brodie@bitheap.org>
parents:
12128
diff
changeset
|
5087 ret = 1 |
6761
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5088 |
14450
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5089 for f in sorted(list): |
6761
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5090 if ui.verbose or not m.exact(f): |
cb981fc955fb
remove: work directly off status
Matt Mackall <mpm@selenic.com>
parents:
6760
diff
changeset
|
5091 ui.status(_('removing %s\n') % m.rel(f)) |
6346
8e3b651382f5
improved semantics for remove (issue438)
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6336
diff
changeset
|
5092 |
14450
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5093 wlock = repo.wlock() |
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5094 try: |
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5095 if not after: |
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5096 for f in list: |
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5097 if f in added: |
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5098 continue # we never unlink added files on remove |
18143
242d2f4ec01c
util: fold ENOENT check into unlinkpath, controlled by new ignoremissing flag
Mads Kiilerich <madski@unity3d.com>
parents:
18133
diff
changeset
|
5099 util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
14450
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5100 repo[None].forget(list) |
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5101 finally: |
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5102 wlock.release() |
d1a1578c5f78
commands.remove: don't use workingctx.remove(list, unlink=True)
Adrian Buehlmann <adrian@cadifra.com>
parents:
14435
diff
changeset
|
5103 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5104 return ret |
245 | 5105 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5106 @command('rename|move|mv', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5107 [('A', 'after', None, _('record a rename that has already occurred')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5108 ('f', 'force', None, _('forcibly copy over an existing managed file')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5109 ] + walkopts + dryrunopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5110 _('[OPTION]... SOURCE... DEST')) |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
5111 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
|
5112 """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
|
5113 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
5114 Mark dest as copies of sources; mark sources for deletion. If dest |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
5115 is a directory, copies are put in that directory. If dest is a |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
5116 file, there can only be one source. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5117 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5118 By default, this command copies the contents of files as they |
8033
aeb4a5c7a28e
commands: consistently write switches as -a/--abc
Martin Geisler <mg@lazybytes.net>
parents:
8032
diff
changeset
|
5119 exist in the working directory. If invoked with -A/--after, the |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5120 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
|
5121 |
7807
bd8f44638847
help: miscellaneous language fixes
timeless <timeless@gmail.com>
parents:
7765
diff
changeset
|
5122 This command takes effect at the next commit. To undo a rename |
11193
687c7d395f20
Use our custom hg reStructuredText role some more
Martin Geisler <mg@aragost.com>
parents:
11185
diff
changeset
|
5123 before that, see :hg:`revert`. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5124 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5125 Returns 0 on success, 1 if errors are encountered. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5126 """ |
4914 | 5127 wlock = repo.wlock(False) |
4915
97b734fb9c6f
Use try/finally pattern to cleanup locks and transactions
Matt Mackall <mpm@selenic.com>
parents:
4914
diff
changeset
|
5128 try: |
5610
2493a478f395
copy: handle rename internally
Matt Mackall <mpm@selenic.com>
parents:
5589
diff
changeset
|
5129 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
|
5130 finally: |
8109
496ae1ea4698
switch lock releasing in the core from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
8088
diff
changeset
|
5131 wlock.release() |
1253
a45e717c61a8
Add rename/mv command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
1250
diff
changeset
|
5132 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5133 @command('resolve', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5134 [('a', 'all', None, _('select all unresolved files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5135 ('l', 'list', None, _('list state of files needing merge')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5136 ('m', 'mark', None, _('mark files as resolved')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5137 ('u', 'unmark', None, _('mark files as unresolved')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5138 ('n', 'no-status', None, _('hide status prefix'))] |
14852
cac04f2f475b
commands: use mergetoolopts when a command supports --tool
Martin Geisler <mg@aragost.com>
parents:
14840
diff
changeset
|
5139 + mergetoolopts + walkopts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
5140 _('[OPTION]... [FILE]...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
5141 inferrepo=True) |
6518 | 5142 def resolve(ui, repo, *pats, **opts): |
11836
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5143 """redo merges or set/view the merge status of files |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5144 |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5145 Merges with unresolved conflicts are often the result of |
12083
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
5146 non-interactive merging using the ``internal:merge`` configuration |
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
5147 setting, or a command-line merge tool like ``diff3``. The resolve |
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
5148 command is used to manage the files involved in a merge, after |
ebfc46929f3e
help: refer to user configuration file more consistently
Brodie Rao <brodie@bitheap.org>
parents:
12067
diff
changeset
|
5149 :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the |
16009
f1208827df7c
resolve: mention merge-tools topic in help
Augie Fackler <durin42@gmail.com>
parents:
15993
diff
changeset
|
5150 working directory must have two parents). See :hg:`help |
f1208827df7c
resolve: mention merge-tools topic in help
Augie Fackler <durin42@gmail.com>
parents:
15993
diff
changeset
|
5151 merge-tools` for information on configuring merge tools. |
11836
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5152 |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5153 The resolve command can be used in the following ways: |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5154 |
12809
e5922564ab01
help: improve merge-tools topic, describe --tool and clarify details
Mads Kiilerich <mads@kiilerich.com>
parents:
12803
diff
changeset
|
5155 - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified |
12750
05bd2658bbb3
merge: add --tool argument to merge and resolve
Steve Borho <steve@borho.org>
parents:
12727
diff
changeset
|
5156 files, discarding any previous merge attempts. Re-merging is not |
11836
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5157 performed for files already marked as resolved. Use ``--all/-a`` |
15042
5e7f03cfeeb9
commands: fix grammar in resolve help text
Pang Yan Han <pangyanhan@gmail.com>
parents:
14903
diff
changeset
|
5158 to select all unresolved files. ``--tool`` can be used to specify |
12750
05bd2658bbb3
merge: add --tool argument to merge and resolve
Steve Borho <steve@borho.org>
parents:
12727
diff
changeset
|
5159 the merge tool used for the given files. It overrides the HGMERGE |
15232
5d9a5b919863
resolve: update documentation to mention the .orig backup
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15223
diff
changeset
|
5160 environment variable and your configuration files. Previous file |
5d9a5b919863
resolve: update documentation to mention the .orig backup
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
15223
diff
changeset
|
5161 contents are saved with a ``.orig`` suffix. |
11836
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5162 |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5163 - :hg:`resolve -m [FILE]`: mark a file as having been resolved |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5164 (e.g. after having manually fixed-up the files). The default is |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5165 to mark all unresolved files. |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5166 |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5167 - :hg:`resolve -u [FILE]...`: mark a file as unresolved. The |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5168 default is to mark all resolved files. |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5169 |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5170 - :hg:`resolve -l`: list files which had or still have conflicts. |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5171 In the printed list, ``U`` = unresolved and ``R`` = resolved. |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5172 |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5173 Note that Mercurial will not let you commit files with unresolved |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5174 merge conflicts. You must use :hg:`resolve -m ...` before you can |
53fdc0989047
resolve: updated help documentation for improved clarity
Mark Edgington <edgimar@gmail.com>
parents:
11777
diff
changeset
|
5175 commit after a conflicting merge. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5176 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5177 Returns 0 on success, 1 if any files fail a resolve attempt. |
6518 | 5178 """ |
5179 | |
9646
5b001f534452
commands: adding --no-status to resolve to match status
timeless <timeless@gmail.com>
parents:
9645
diff
changeset
|
5180 all, mark, unmark, show, nostatus = \ |
5b001f534452
commands: adding --no-status to resolve to match status
timeless <timeless@gmail.com>
parents:
9645
diff
changeset
|
5181 [opts.get(o) for o in 'all mark unmark list no_status'.split()] |
7527
5a14a8f3b909
resolve: require -a switch to resolve all files
Matt Mackall <mpm@selenic.com>
parents:
7449
diff
changeset
|
5182 |
5a14a8f3b909
resolve: require -a switch to resolve all files
Matt Mackall <mpm@selenic.com>
parents:
7449
diff
changeset
|
5183 if (show and (mark or unmark)) or (mark and unmark): |
6518 | 5184 raise util.Abort(_("too many options specified")) |
7527
5a14a8f3b909
resolve: require -a switch to resolve all files
Matt Mackall <mpm@selenic.com>
parents:
7449
diff
changeset
|
5185 if pats and all: |
5a14a8f3b909
resolve: require -a switch to resolve all files
Matt Mackall <mpm@selenic.com>
parents:
7449
diff
changeset
|
5186 raise util.Abort(_("can't specify --all and patterns")) |
5a14a8f3b909
resolve: require -a switch to resolve all files
Matt Mackall <mpm@selenic.com>
parents:
7449
diff
changeset
|
5187 if not (all or pats or show or mark or unmark): |
21940
9209c02f1f25
resolve: report no argument warning using a hint
Nathan Goldbaum <ngoldbau@ucsc.edu>
parents:
21937
diff
changeset
|
5188 raise util.Abort(_('no files or directories specified'), |
9209c02f1f25
resolve: report no argument warning using a hint
Nathan Goldbaum <ngoldbau@ucsc.edu>
parents:
21937
diff
changeset
|
5189 hint=('use --all to remerge all files')) |
6518 | 5190 |
21709
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5191 wlock = repo.wlock() |
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5192 try: |
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5193 ms = mergemod.mergestate(repo) |
21720 | 5194 |
5195 if not ms.active() and not show: | |
5196 raise util.Abort( | |
5197 _('resolve command not applicable when not merging')) | |
5198 | |
21709
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5199 m = scmutil.match(repo[None], pats, opts) |
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5200 ret = 0 |
21720 | 5201 didwork = False |
21709
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5202 |
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5203 for f in ms: |
21720 | 5204 if not m(f): |
5205 continue | |
5206 | |
5207 didwork = True | |
5208 | |
5209 if show: | |
5210 if nostatus: | |
5211 ui.write("%s\n" % f) | |
9646
5b001f534452
commands: adding --no-status to resolve to match status
timeless <timeless@gmail.com>
parents:
9645
diff
changeset
|
5212 else: |
21720 | 5213 ui.write("%s %s\n" % (ms[f].upper(), f), |
5214 label='resolve.' + | |
5215 {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) | |
5216 elif mark: | |
5217 ms.mark(f, "r") | |
5218 elif unmark: | |
5219 ms.mark(f, "u") | |
6518 | 5220 else: |
21720 | 5221 wctx = repo[None] |
5222 | |
5223 # backup pre-resolve (merge uses .orig for its own purposes) | |
5224 a = repo.wjoin(f) | |
5225 util.copyfile(a, a + ".resolve") | |
5226 | |
5227 try: | |
5228 # resolve file | |
5229 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
5230 'resolve') | |
5231 if ms.resolve(f, wctx): | |
5232 ret = 1 | |
5233 finally: | |
5234 ui.setconfig('ui', 'forcemerge', '', 'resolve') | |
5235 ms.commit() | |
5236 | |
5237 # replace filemerge's .orig file with our resolve file | |
5238 util.rename(a + ".resolve", a + ".orig") | |
21709
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5239 |
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5240 ms.commit() |
21720 | 5241 |
5242 if not didwork and pats: | |
21721
6539c4e9c874
resolve: fix grammar of no matching files message
Matt Mackall <mpm@selenic.com>
parents:
21720
diff
changeset
|
5243 ui.warn(_("arguments do not match paths that need resolving\n")) |
21720 | 5244 |
21709
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5245 finally: |
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5246 wlock.release() |
14560418856d
resolve: keep wlock while resolving
Mads Kiilerich <madski at unity3d.com>
parents:
21571
diff
changeset
|
5247 |
21266
19d6fec60b81
resolve: print message when no unresolved files remain (issue4214)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21265
diff
changeset
|
5248 # Nudge users into finishing an unfinished operation. We don't print |
19d6fec60b81
resolve: print message when no unresolved files remain (issue4214)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21265
diff
changeset
|
5249 # this with the list/show operation because we want list/show to remain |
19d6fec60b81
resolve: print message when no unresolved files remain (issue4214)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21265
diff
changeset
|
5250 # machine readable. |
19d6fec60b81
resolve: print message when no unresolved files remain (issue4214)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21265
diff
changeset
|
5251 if not list(ms.unresolved()) and not show: |
21947
b081decd9062
resolve: add parenthesis around "no more unresolved files" message
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21944
diff
changeset
|
5252 ui.status(_('(no more unresolved files)\n')) |
21266
19d6fec60b81
resolve: print message when no unresolved files remain (issue4214)
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21265
diff
changeset
|
5253 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5254 return ret |
7847 | 5255 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5256 @command('revert', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5257 [('a', 'all', None, _('revert all changes when no arguments given')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5258 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5259 ('r', 'rev', '', _('revert to the specified revision'), _('REV')), |
15009
caa5283390f8
revert: introduce short option -C for --no-backup
Adrian Buehlmann <adrian@cadifra.com>
parents:
14986
diff
changeset
|
5260 ('C', 'no-backup', None, _('do not save backup copies of files')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5261 ] + walkopts + dryrunopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5262 _('[OPTION]... [-r REV] [NAME]...')) |
1472
3c909a747d7f
make revert use standard matcher
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1470
diff
changeset
|
5263 def revert(ui, repo, *pats, **opts): |
14540
944d9088da96
revert: rewrite help summary
Matt Mackall <mpm@selenic.com>
parents:
14532
diff
changeset
|
5264 """restore files to their checkout state |
5574 | 5265 |
12390
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
5266 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
5267 |
14541
07ee46a2ece3
revert: simplify usage note
Matt Mackall <mpm@selenic.com>
parents:
14540
diff
changeset
|
5268 To check out earlier revisions, you should use :hg:`update REV`. |
19217
2b4344f23b44
help: fix role/option confusion in RST
Matt Mackall <mpm@selenic.com>
parents:
19197
diff
changeset
|
5269 To cancel an uncommitted merge (and lose your changes), |
2b4344f23b44
help: fix role/option confusion in RST
Matt Mackall <mpm@selenic.com>
parents:
19197
diff
changeset
|
5270 use :hg:`update --clean .`. |
2204
eb5fa83ffcfa
fix doc comments for revert command. people found them confusing.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2189
diff
changeset
|
5271 |
14544
586f33cc3cb9
revert: rearrange the date help
Matt Mackall <mpm@selenic.com>
parents:
14543
diff
changeset
|
5272 With no revision specified, revert the specified files or directories |
14903
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5273 to the contents they had in the parent of the working directory. |
14544
586f33cc3cb9
revert: rearrange the date help
Matt Mackall <mpm@selenic.com>
parents:
14543
diff
changeset
|
5274 This restores the contents of files to an unmodified |
14903
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5275 state and unschedules adds, removes, copies, and renames. If the |
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5276 working directory has two parents, you must explicitly specify a |
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5277 revision. |
1811
6cb548cffdf5
resync commands.py docstrings with hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1804
diff
changeset
|
5278 |
14544
586f33cc3cb9
revert: rearrange the date help
Matt Mackall <mpm@selenic.com>
parents:
14543
diff
changeset
|
5279 Using the -r/--rev or -d/--date options, revert the given files or |
14557
f966979f61ce
revert: is reverting file states, not just file contents
Adrian Buehlmann <adrian@cadifra.com>
parents:
14556
diff
changeset
|
5280 directories to their states as of a specific revision. Because |
14546
99a7cd924636
revert: replace mention of 'roll back' with pointer to 'backout'
Matt Mackall <mpm@selenic.com>
parents:
14545
diff
changeset
|
5281 revert does not change the working directory parents, this will |
99a7cd924636
revert: replace mention of 'roll back' with pointer to 'backout'
Matt Mackall <mpm@selenic.com>
parents:
14545
diff
changeset
|
5282 cause these files to appear modified. This can be helpful to "back |
14547
a6cc0f2d0365
revert: actually add pointer to backout
Matt Mackall <mpm@selenic.com>
parents:
14546
diff
changeset
|
5283 out" some or all of an earlier change. See :hg:`backout` for a |
a6cc0f2d0365
revert: actually add pointer to backout
Matt Mackall <mpm@selenic.com>
parents:
14546
diff
changeset
|
5284 related method. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5285 |
5574 | 5286 Modified files are saved with a .orig suffix before reverting. |
5287 To disable these backups, use --no-backup. | |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5288 |
14544
586f33cc3cb9
revert: rearrange the date help
Matt Mackall <mpm@selenic.com>
parents:
14543
diff
changeset
|
5289 See :hg:`help dates` for a list of formats valid for -d/--date. |
586f33cc3cb9
revert: rearrange the date help
Matt Mackall <mpm@selenic.com>
parents:
14543
diff
changeset
|
5290 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5291 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5292 """ |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
5293 |
11941 | 5294 if opts.get("date"): |
5295 if opts.get("rev"): | |
3814
120be84f33de
Add --date support to update and revert
Matt Mackall <mpm@selenic.com>
parents:
3813
diff
changeset
|
5296 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
|
5297 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
|
5298 |
13022
3fd4e4e81382
revert: improve merge advice and favor its error over all
timeless <timeless@gmail.com>
parents:
12968
diff
changeset
|
5299 parent, p2 = repo.dirstate.parents() |
14903
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5300 if not opts.get('rev') and p2 != nullid: |
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5301 # revert after merge is a trap for new users (issue2915) |
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5302 raise util.Abort(_('uncommitted merge with no revision specified'), |
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5303 hint=_('use "hg update" or see "hg help revert"')) |
a934b9249574
revert: restore check for uncommitted merge (issue2915) (BC)
Matt Mackall <mpm@selenic.com>
parents:
14849
diff
changeset
|
5304 |
14726
e0039716f3ea
revert: mention update in hint of abort when reverting to non-parent
Adrian Buehlmann <adrian@cadifra.com>
parents:
14725
diff
changeset
|
5305 ctx = scmutil.revsingle(repo, opts.get('rev')) |
13022
3fd4e4e81382
revert: improve merge advice and favor its error over all
timeless <timeless@gmail.com>
parents:
12968
diff
changeset
|
5306 |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
5307 if not pats and not opts.get('all'): |
14721
4fcde634f5e0
revert: be more helpful on uncommitted merges
Adrian Buehlmann <adrian@cadifra.com>
parents:
14713
diff
changeset
|
5308 msg = _("no files or directories specified") |
4fcde634f5e0
revert: be more helpful on uncommitted merges
Adrian Buehlmann <adrian@cadifra.com>
parents:
14713
diff
changeset
|
5309 if p2 != nullid: |
4fcde634f5e0
revert: be more helpful on uncommitted merges
Adrian Buehlmann <adrian@cadifra.com>
parents:
14713
diff
changeset
|
5310 hint = _("uncommitted merge, use --all to discard all changes," |
4fcde634f5e0
revert: be more helpful on uncommitted merges
Adrian Buehlmann <adrian@cadifra.com>
parents:
14713
diff
changeset
|
5311 " or 'hg update -C .' to abort the merge") |
14755
6ba51c81ff75
revert: improve hints on abort when reverting to parent without --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
14742
diff
changeset
|
5312 raise util.Abort(msg, hint=hint) |
6ba51c81ff75
revert: improve hints on abort when reverting to parent without --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
14742
diff
changeset
|
5313 dirty = util.any(repo.status()) |
16304
a740fa28d718
revert: move bulk of revert command from commands to cmdutil
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
16274
diff
changeset
|
5314 node = ctx.node() |
14755
6ba51c81ff75
revert: improve hints on abort when reverting to parent without --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
14742
diff
changeset
|
5315 if node != parent: |
6ba51c81ff75
revert: improve hints on abort when reverting to parent without --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
14742
diff
changeset
|
5316 if dirty: |
14726
e0039716f3ea
revert: mention update in hint of abort when reverting to non-parent
Adrian Buehlmann <adrian@cadifra.com>
parents:
14725
diff
changeset
|
5317 hint = _("uncommitted changes, use --all to discard all" |
e0039716f3ea
revert: mention update in hint of abort when reverting to non-parent
Adrian Buehlmann <adrian@cadifra.com>
parents:
14725
diff
changeset
|
5318 " changes, or 'hg update %s' to update") % ctx.rev() |
e0039716f3ea
revert: mention update in hint of abort when reverting to non-parent
Adrian Buehlmann <adrian@cadifra.com>
parents:
14725
diff
changeset
|
5319 else: |
e0039716f3ea
revert: mention update in hint of abort when reverting to non-parent
Adrian Buehlmann <adrian@cadifra.com>
parents:
14725
diff
changeset
|
5320 hint = _("use --all to revert all files," |
e0039716f3ea
revert: mention update in hint of abort when reverting to non-parent
Adrian Buehlmann <adrian@cadifra.com>
parents:
14725
diff
changeset
|
5321 " or 'hg update %s' to update") % ctx.rev() |
14755
6ba51c81ff75
revert: improve hints on abort when reverting to parent without --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
14742
diff
changeset
|
5322 elif dirty: |
6ba51c81ff75
revert: improve hints on abort when reverting to parent without --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
14742
diff
changeset
|
5323 hint = _("uncommitted changes, use --all to discard all changes") |
6ba51c81ff75
revert: improve hints on abort when reverting to parent without --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
14742
diff
changeset
|
5324 else: |
6ba51c81ff75
revert: improve hints on abort when reverting to parent without --all
Adrian Buehlmann <adrian@cadifra.com>
parents:
14742
diff
changeset
|
5325 hint = _("use --all to revert all files") |
14721
4fcde634f5e0
revert: be more helpful on uncommitted merges
Adrian Buehlmann <adrian@cadifra.com>
parents:
14713
diff
changeset
|
5326 raise util.Abort(msg, hint=hint) |
2982
890e285c52a1
revert: require --all to revert all files.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2963
diff
changeset
|
5327 |
16304
a740fa28d718
revert: move bulk of revert command from commands to cmdutil
Angel Ezquerra <angel.ezquerra@gmail.com>
parents:
16274
diff
changeset
|
5328 return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) |
588 | 5329 |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15179
diff
changeset
|
5330 @command('rollback', dryrunopts + |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15179
diff
changeset
|
5331 [('f', 'force', False, _('ignore safety measures'))]) |
10882
f0bfe42c7b1f
rollback: add dry-run argument, emit transaction description
Steve Borho <steve@borho.org>
parents:
10835
diff
changeset
|
5332 def rollback(ui, repo, **opts): |
19409
ea4342d0e6fe
rollback: mark as deprecated
Matt Mackall <mpm@selenic.com>
parents:
19403
diff
changeset
|
5333 """roll back the last transaction (DANGEROUS) (DEPRECATED) |
5575
8788ff630c26
imported patch rollback-help
Matt Mackall <mpm@selenic.com>
parents:
5574
diff
changeset
|
5334 |
19421
b2b08be5f556
rollback: add reference to "hg commit --amend"
Martin Geisler <martin@geisler.net>
parents:
19409
diff
changeset
|
5335 Please use :hg:`commit --amend` instead of rollback to correct |
b2b08be5f556
rollback: add reference to "hg commit --amend"
Martin Geisler <martin@geisler.net>
parents:
19409
diff
changeset
|
5336 mistakes in the last commit. |
b2b08be5f556
rollback: add reference to "hg commit --amend"
Martin Geisler <martin@geisler.net>
parents:
19409
diff
changeset
|
5337 |
5575
8788ff630c26
imported patch rollback-help
Matt Mackall <mpm@selenic.com>
parents:
5574
diff
changeset
|
5338 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
|
5339 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
|
5340 restore the dirstate at the time of the last transaction, losing |
8856
f8d00346a62d
rollback: minor clarification (issue828)
Matt Mackall <mpm@selenic.com>
parents:
8855
diff
changeset
|
5341 any dirstate changes since that time. This command does not alter |
f8d00346a62d
rollback: minor clarification (issue828)
Matt Mackall <mpm@selenic.com>
parents:
8855
diff
changeset
|
5342 the working directory. |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
5343 |
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
5344 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
|
5345 that create new changesets or propagate existing changesets into a |
17141
b558c9fa39c1
rollback: split off command example paragraph in help
Adrian Buehlmann <adrian@cadifra.com>
parents:
17045
diff
changeset
|
5346 repository. |
b558c9fa39c1
rollback: split off command example paragraph in help
Adrian Buehlmann <adrian@cadifra.com>
parents:
17045
diff
changeset
|
5347 |
17142
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5348 .. container:: verbose |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5349 |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5350 For example, the following commands are transactional, and their |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5351 effects can be rolled back: |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5352 |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5353 - commit |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5354 - import |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5355 - pull |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5356 - push (with this repository as the destination) |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5357 - unbundle |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5358 |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5359 To avoid permanent data loss, rollback will refuse to rollback a |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5360 commit transaction if it isn't checked out. Use --force to |
3e66d00b3026
rollback: move examples and --force note in help into verbose section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17141
diff
changeset
|
5361 override this protection. |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15179
diff
changeset
|
5362 |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
5363 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
|
5364 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
|
5365 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
|
5366 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
|
5367 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
|
5368 may fail if a rollback is performed. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5369 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5370 Returns 0 on success, 1 if no rollback data is available. |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
5371 """ |
15183
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15179
diff
changeset
|
5372 return repo.rollback(dryrun=opts.get('dry_run'), |
59e8bc22506e
rollback: avoid unsafe rollback when not at tip (issue2998)
Greg Ward <greg@gerg.ca>
parents:
15179
diff
changeset
|
5373 force=opts.get('force')) |
2227
4f072bb06e89
deprecate undo command, replace with rollback command.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2212
diff
changeset
|
5374 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5375 @command('root', []) |
468 | 5376 def root(ui, repo): |
8026
683d8ebcf434
expand "dir" to "directory" in help texts
Martin Geisler <mg@lazybytes.net>
parents:
8021
diff
changeset
|
5377 """print the root (top) of the current working directory |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5378 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5379 Print the root directory of the current repository. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5380 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5381 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5382 """ |
468 | 5383 ui.write(repo.root + "\n") |
5384 | |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5385 @command('^serve', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5386 [('A', 'accesslog', '', _('name of access log file to write to'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5387 _('FILE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5388 ('d', 'daemon', None, _('run server in background')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5389 ('', 'daemon-pipefds', '', _('used internally by daemon mode'), _('NUM')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5390 ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5391 # use string type, then we can check if something was passed |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5392 ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5393 ('a', 'address', '', _('address to listen on (default: all interfaces)'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5394 _('ADDR')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5395 ('', 'prefix', '', _('prefix path to serve from (default: server root)'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5396 _('PREFIX')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5397 ('n', 'name', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5398 _('name to show in web pages (default: working directory)'), _('NAME')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5399 ('', 'web-conf', '', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5400 _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5401 ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5402 _('FILE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5403 ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5404 ('', 'stdio', None, _('for remote clients')), |
14647
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
5405 ('', 'cmdserver', '', _('for remote clients'), _('MODE')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5406 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5407 ('', 'style', '', _('template style to use'), _('STYLE')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5408 ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5409 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))], |
21775
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
5410 _('[OPTION]...'), |
5403245edb3a
commands: define optionalrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21768
diff
changeset
|
5411 optionalrepo=True) |
245 | 5412 def serve(ui, repo, **opts): |
10889
e25c450c351e
commands: improve some command summaries
Matt Mackall <mpm@selenic.com>
parents:
10882
diff
changeset
|
5413 """start stand-alone webserver |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5414 |
11102
275198bc904a
commands: explain that "hg serve" is mostly for ad-hoc sharing
Martin Geisler <mg@lazybytes.net>
parents:
11089
diff
changeset
|
5415 Start a local HTTP repository browser and pull server. You can use |
13065
de4a18cbfc98
serve: fix doc typo
Adrian Buehlmann <adrian@cadifra.com>
parents:
12965
diff
changeset
|
5416 this for ad-hoc sharing and browsing of repositories. It is |
11102
275198bc904a
commands: explain that "hg serve" is mostly for ad-hoc sharing
Martin Geisler <mg@lazybytes.net>
parents:
11089
diff
changeset
|
5417 recommended to use a real web server to serve a repository for |
275198bc904a
commands: explain that "hg serve" is mostly for ad-hoc sharing
Martin Geisler <mg@lazybytes.net>
parents:
11089
diff
changeset
|
5418 longer periods of time. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5419 |
11103
d29bd98ebff6
commands: explain that "hg serve" does not do authentication
Martin Geisler <mg@lazybytes.net>
parents:
11102
diff
changeset
|
5420 Please note that the server does not implement access control. |
d29bd98ebff6
commands: explain that "hg serve" does not do authentication
Martin Geisler <mg@lazybytes.net>
parents:
11102
diff
changeset
|
5421 This means that, by default, anybody can read from the server and |
d29bd98ebff6
commands: explain that "hg serve" does not do authentication
Martin Geisler <mg@lazybytes.net>
parents:
11102
diff
changeset
|
5422 nobody can write to it by default. Set the ``web.allow_push`` |
d29bd98ebff6
commands: explain that "hg serve" does not do authentication
Martin Geisler <mg@lazybytes.net>
parents:
11102
diff
changeset
|
5423 option to ``*`` to allow everybody to push to the server. You |
d29bd98ebff6
commands: explain that "hg serve" does not do authentication
Martin Geisler <mg@lazybytes.net>
parents:
11102
diff
changeset
|
5424 should use a real web server if you need to authenticate users. |
d29bd98ebff6
commands: explain that "hg serve" does not do authentication
Martin Geisler <mg@lazybytes.net>
parents:
11102
diff
changeset
|
5425 |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5426 By default, the server logs accesses to stdout and errors to |
8277
b9403042968a
write options in "-r/--rev" style in help texts
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
5427 stderr. Use the -A/--accesslog and -E/--errorlog options to log to |
b9403042968a
write options in "-r/--rev" style in help texts
Martin Geisler <mg@lazybytes.net>
parents:
8225
diff
changeset
|
5428 files. |
10629
d3f27d15c9cb
serve: allow --port=0 to specify "server chooses the port number"
Bryan O'Sullivan <bos@serpentine.com>
parents:
10617
diff
changeset
|
5429 |
d3f27d15c9cb
serve: allow --port=0 to specify "server chooses the port number"
Bryan O'Sullivan <bos@serpentine.com>
parents:
10617
diff
changeset
|
5430 To have the server choose a free port number to listen on, specify |
d3f27d15c9cb
serve: allow --port=0 to specify "server chooses the port number"
Bryan O'Sullivan <bos@serpentine.com>
parents:
10617
diff
changeset
|
5431 a port number of 0; in this case, the server will print the port |
d3f27d15c9cb
serve: allow --port=0 to specify "server chooses the port number"
Bryan O'Sullivan <bos@serpentine.com>
parents:
10617
diff
changeset
|
5432 number it uses. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5433 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5434 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5435 """ |
624
876333a295ff
Add an sshrepository class and hg serve --stdio
Matt Mackall <mpm@selenic.com>
parents:
618
diff
changeset
|
5436 |
14647
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
5437 if opts["stdio"] and opts["cmdserver"]: |
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
5438 raise util.Abort(_("cannot use --stdio with --cmdserver")) |
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
5439 |
21818
448714b79d9a
serve: inline checkrepo() that is used only when --stdio is specified
Yuya Nishihara <yuya@tcha.org>
parents:
21817
diff
changeset
|
5440 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
|
5441 if repo is None: |
16935
f635c476fa3f
serve: lowercase "no repo here" message
Martin Geisler <mg@aragost.com>
parents:
16934
diff
changeset
|
5442 raise error.RepoError(_("there is no Mercurial repository here" |
21819
816754e75f2f
serve: tidy up indent level of repository not found message
Yuya Nishihara <yuya@tcha.org>
parents:
21818
diff
changeset
|
5443 " (.hg not found)")) |
2396
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
5444 s = sshserver.sshserver(ui, repo) |
8d44649df03b
refactor ssh server.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
2392
diff
changeset
|
5445 s.serve_forever() |
2363
fa4c11751367
Give a response to unknown SSH commands
Matt Mackall <mpm@selenic.com>
parents:
2362
diff
changeset
|
5446 |
14647
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
5447 if opts["cmdserver"]: |
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
5448 s = commandserver.server(ui, repo, opts["cmdserver"]) |
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
5449 return s.serve() |
2e9f379de0ac
serve: add --cmdserver option to communicate with hg over a pipe
Idan Kamara <idankk86@gmail.com>
parents:
14645
diff
changeset
|
5450 |
10635
27027bee318e
serve: fix port config
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10632
diff
changeset
|
5451 # this way we can check if something was given in the command-line |
27027bee318e
serve: fix port config
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10632
diff
changeset
|
5452 if opts.get('port'): |
12076
49463314c24f
mail/hgweb: support service names for ports (issue2350)
Brodie Rao <brodie@bitheap.org>
parents:
12070
diff
changeset
|
5453 opts['port'] = util.getport(opts.get('port')) |
10635
27027bee318e
serve: fix port config
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10632
diff
changeset
|
5454 |
8190
9b8ac5fb7760
ui: kill most users of parentui name and arg, replace with .copy()
Matt Mackall <mpm@selenic.com>
parents:
8189
diff
changeset
|
5455 baseui = repo and repo.baseui 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
|
5456 optlist = ("name templates style address port prefix ipv6" |
10644
63948e7d37f7
server: initialize wsgi app in command, then wrap server around it
Dirkjan Ochtman <djc.ochtman@kentyde.com>
parents:
10635
diff
changeset
|
5457 " accesslog errorlog certificate encoding") |
987 | 5458 for o in optlist.split(): |
10630
9947e6b008bb
serve: fix options recording, trailing whitespace
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10629
diff
changeset
|
5459 val = opts.get(o, '') |
10631
5247260cee6a
make expression shorter, now the line fits into 80 chars
Thomas Arendsen Hein <thomas@intevation.de>
parents:
10630
diff
changeset
|
5460 if val in (None, ''): # should check against default options instead |
10630
9947e6b008bb
serve: fix options recording, trailing whitespace
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10629
diff
changeset
|
5461 continue |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
5462 baseui.setconfig("web", o, val, 'serve') |
10630
9947e6b008bb
serve: fix options recording, trailing whitespace
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
10629
diff
changeset
|
5463 if repo and repo.ui != baseui: |
20790
49f2d5644f04
config: set a 'source' in most cases where config don't come from file but code
Mads Kiilerich <madski@unity3d.com>
parents:
20783
diff
changeset
|
5464 repo.ui.setconfig("web", o, val, 'serve') |
987 | 5465 |
11003
aca9a7cf2c9a
serve: webdir_conf -> webconf
Matt Mackall <mpm@selenic.com>
parents:
10993
diff
changeset
|
5466 o = opts.get('web_conf') or opts.get('webdir_conf') |
11004
7bb10d3dbcd6
hgweb: unify hgweb calls in serve
Matt Mackall <mpm@selenic.com>
parents:
11003
diff
changeset
|
5467 if not o: |
7bb10d3dbcd6
hgweb: unify hgweb calls in serve
Matt Mackall <mpm@selenic.com>
parents:
11003
diff
changeset
|
5468 if not repo: |
16935
f635c476fa3f
serve: lowercase "no repo here" message
Martin Geisler <mg@aragost.com>
parents:
16934
diff
changeset
|
5469 raise error.RepoError(_("there is no Mercurial repository" |
11004
7bb10d3dbcd6
hgweb: unify hgweb calls in serve
Matt Mackall <mpm@selenic.com>
parents:
11003
diff
changeset
|
5470 " here (.hg not found)")) |
18828
b718999f2e0b
serve: pass on the repo instad of recreating it in hgweb
Simon Heimberg <simohe@besonet.ch>
parents:
18827
diff
changeset
|
5471 o = repo |
11004
7bb10d3dbcd6
hgweb: unify hgweb calls in serve
Matt Mackall <mpm@selenic.com>
parents:
11003
diff
changeset
|
5472 |
18827
6793ae6e36dc
serve: pass the prepared baseui to hgweb
Simon Heimberg <simohe@besonet.ch>
parents:
18799
diff
changeset
|
5473 app = hgweb.hgweb(o, baseui=baseui) |
19919
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5474 service = httpservice(ui, app, opts) |
4380
e89f9afc462b
Refactor commands.serve to allow other commands to run as services.
Bryan O'Sullivan <bos@serpentine.com>
parents:
4376
diff
changeset
|
5475 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
|
5476 |
19919
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5477 class httpservice(object): |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5478 def __init__(self, ui, app, opts): |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5479 self.ui = ui |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5480 self.app = app |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5481 self.opts = opts |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5482 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5483 def init(self): |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5484 util.setsignalhandler() |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5485 self.httpd = hgweb_server.create_server(self.ui, self.app) |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5486 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5487 if self.opts['port'] and not self.ui.verbose: |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5488 return |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5489 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5490 if self.httpd.prefix: |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5491 prefix = self.httpd.prefix.strip('/') + '/' |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5492 else: |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5493 prefix = '' |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5494 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5495 port = ':%d' % self.httpd.port |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5496 if port == ':80': |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5497 port = '' |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5498 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5499 bindaddr = self.httpd.addr |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5500 if bindaddr == '0.0.0.0': |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5501 bindaddr = '*' |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5502 elif ':' in bindaddr: # IPv6 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5503 bindaddr = '[%s]' % bindaddr |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5504 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5505 fqaddr = self.httpd.fqaddr |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5506 if ':' in fqaddr: |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5507 fqaddr = '[%s]' % fqaddr |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5508 if self.opts['port']: |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5509 write = self.ui.status |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5510 else: |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5511 write = self.ui.write |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5512 write(_('listening at http://%s%s/%s (bound to %s:%d)\n') % |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5513 (fqaddr, port, prefix, bindaddr, self.httpd.port)) |
21817
6b0275e5f276
serve: make sure to print "listening at" message immediately
Yuya Nishihara <yuya@tcha.org>
parents:
21789
diff
changeset
|
5514 self.ui.flush() # avoid buffering of status message |
19919
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5515 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5516 def run(self): |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5517 self.httpd.serve_forever() |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5518 |
e48c70451afc
commands: refactor 'serve', extract the http service class
Mads Kiilerich <madski@unity3d.com>
parents:
19893
diff
changeset
|
5519 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5520 @command('^status|st', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5521 [('A', 'all', None, _('show status of all files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5522 ('m', 'modified', None, _('show only modified files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5523 ('a', 'added', None, _('show only added files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5524 ('r', 'removed', None, _('show only removed files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5525 ('d', 'deleted', None, _('show only deleted (but tracked) files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5526 ('c', 'clean', None, _('show only files without changes')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5527 ('u', 'unknown', None, _('show only unknown (not tracked) files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5528 ('i', 'ignored', None, _('show only ignored files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5529 ('n', 'no-status', None, _('hide status prefix')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5530 ('C', 'copies', None, _('show source of copied files')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5531 ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5532 ('', 'rev', [], _('show difference from revision'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5533 ('', 'change', '', _('list the changed files of a revision'), _('REV')), |
22429
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
5534 ] + walkopts + subrepoopts + formatteropts, |
21778
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
5535 _('[OPTION]... [FILE]...'), |
f6a6d07b66b3
commands: define inferrepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21775
diff
changeset
|
5536 inferrepo=True) |
731
91ca3afab8e8
Add name matching to status command.
Bryan O'Sullivan <bos@serpentine.com>
parents:
729
diff
changeset
|
5537 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
|
5538 """show changed files in the working directory |
213 | 5539 |
6448
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
5540 Show status of files in the repository. If names are given, only |
cd3d49ffc6f6
Consistently 1 space after full stops in command doc strings
Christian Ebert <blacktrash@gmx.net>
parents:
6442
diff
changeset
|
5541 files that match are shown. Files that are clean or ignored or |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
5542 the source of a copy/move operation, are not listed unless |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
5543 -c/--clean, -i/--ignored, -C/--copies or -A/--all are given. |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
5544 Unless options described with "show only ..." are given, the |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
5545 options -mardu are used. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5546 |
6201
305d4450036a
Extend/correct acc40572da5b regarding -qA and ignored files.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
6200
diff
changeset
|
5547 Option -q/--quiet hides untracked (unknown and ignored) files |
8009
76e4c08a48ad
commands: fix typo on flag description
Wagner Bruna <wbruna@yahoo.com>
parents:
8008
diff
changeset
|
5548 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
|
5549 |
12390
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
5550 .. note:: |
19997
de16c673455b
documentation: add an extra newline after note directive
Simon Heimberg <simohe@besonet.ch>
parents:
19960
diff
changeset
|
5551 |
12390
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
5552 status may appear to disagree with diff if permissions have |
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
5553 changed or a merge has occurred. The standard diff format does |
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
5554 not report permission changes and diff only reports changes |
aff4afdcfd2b
Use more note admonitions in help texts
Christian Ebert <blacktrash@gmx.net>
parents:
12389
diff
changeset
|
5555 relative to one merge parent. |
3822
28134d82db9b
Add notes about diff/merge asymmetry to export, diff, and log
Matt Mackall <mpm@selenic.com>
parents:
3815
diff
changeset
|
5556 |
3467
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
5557 If one revision is given, it is used as the base revision. |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
5558 If two revisions are given, the differences between them are |
10014
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5559 shown. The --change option can also be used as a shortcut to list |
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5560 the changed files of a revision from its first parent. |
3467
2b3b703b3a2b
Add --rev option to status
Brendan Cully <brendan@kublai.com>
parents:
3465
diff
changeset
|
5561 |
9157
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5562 The codes used to show the status of files are:: |
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5563 |
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5564 M = modified |
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5565 A = added |
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5566 R = removed |
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5567 C = clean |
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5568 ! = missing (deleted by non-hg command, but still tracked) |
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5569 ? = not tracked |
9261667e9b82
commands: use minirst parser when displaying help
Martin Geisler <mg@lazybytes.net>
parents:
9142
diff
changeset
|
5570 I = ignored |
20660
19e9478c1a22
status: improve explanation of ' ' status
Matt Mackall <mpm@selenic.com>
parents:
20650
diff
changeset
|
5571 = origin of the previous file (with --copies) |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5572 |
15119
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5573 .. container:: verbose |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5574 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5575 Examples: |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5576 |
15633
dc5d1394ecd1
status: add missing ":" to help text
Martin Geisler <mg@lazybytes.net>
parents:
15615
diff
changeset
|
5577 - show changes in the working directory relative to a |
dc5d1394ecd1
status: add missing ":" to help text
Martin Geisler <mg@lazybytes.net>
parents:
15615
diff
changeset
|
5578 changeset:: |
15119
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5579 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5580 hg status --rev 9353 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5581 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5582 - show all changes including copies in an existing changeset:: |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5583 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5584 hg status --copies --change 9353 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5585 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5586 - get a NUL separated list of added files, suitable for xargs:: |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5587 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5588 hg status -an0 |
ac46a9cdf6e6
status: add some help examples
Matt Mackall <mpm@selenic.com>
parents:
15118
diff
changeset
|
5589 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5590 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5591 """ |
312 | 5592 |
10014
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5593 revs = opts.get('rev') |
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5594 change = opts.get('change') |
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5595 |
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5596 if revs and change: |
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5597 msg = _('cannot specify --rev and --change at the same time') |
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5598 raise util.Abort(msg) |
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5599 elif change: |
15578
db0e277bdd37
status: support revsets with --change
Patrick Mezard <pmezard@gmail.com>
parents:
15528
diff
changeset
|
5600 node2 = scmutil.revsingle(repo, change, None).node() |
13878
a8d13ee0ce68
misc: replace .parents()[0] with p1()
Matt Mackall <mpm@selenic.com>
parents:
13855
diff
changeset
|
5601 node1 = repo[node2].p1().node() |
10014
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5602 else: |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
5603 node1, node2 = scmutil.revpair(repo, revs) |
10014
54cd28258ea7
status: add the --change option to display files changed in a revision
Gilles Moris <gilles.moris@free.fr>
parents:
9983
diff
changeset
|
5604 |
1625
e1bcf7fa983f
correct the relative path when walking from a subdir
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1622
diff
changeset
|
5605 cwd = (pats and repo.getcwd()) or '' |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
5606 end = opts.get('print0') and '\0' or '\n' |
6276
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
5607 copy = {} |
6605
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5608 states = 'modified added removed deleted unknown ignored clean'.split() |
7684
ee3364d3d859
status: make options optional (issue1481)
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7656
diff
changeset
|
5609 show = [k for k in states if opts.get(k)] |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
5610 if opts.get('all'): |
6605
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5611 show += ui.quiet and (states[:4] + ['clean']) or states |
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5612 if not show: |
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5613 show = ui.quiet and states[:4] or states[:5] |
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5614 |
14671
35c2cc322ba8
scmutil: switch match users to supplying contexts
Matt Mackall <mpm@selenic.com>
parents:
14647
diff
changeset
|
5615 stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts), |
12166
441a74b8def1
status: recurse into subrepositories with --subrepos/-S flag
Martin Geisler <mg@lazybytes.net>
parents:
12132
diff
changeset
|
5616 'ignored' in show, 'clean' in show, 'unknown' in show, |
441a74b8def1
status: recurse into subrepositories with --subrepos/-S flag
Martin Geisler <mg@lazybytes.net>
parents:
12132
diff
changeset
|
5617 opts.get('subrepos')) |
6605
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5618 changestates = zip(states, 'MAR!?IC', stat) |
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5619 |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
5620 if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'): |
15775
91eb4512edd0
copies: rewrite copy detection for non-merge users
Matt Mackall <mpm@selenic.com>
parents:
15774
diff
changeset
|
5621 copy = copies.pathcopies(repo[node1], repo[node2]) |
6276
c93ca83a3354
status: find copies and renames beyond the working directory
Matt Mackall <mpm@selenic.com>
parents:
6262
diff
changeset
|
5622 |
16136
68007f0557de
formatter: convert status command
Matt Mackall <mpm@selenic.com>
parents:
16109
diff
changeset
|
5623 fm = ui.formatter('status', opts) |
17910
c8709ff57ff2
status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents:
17892
diff
changeset
|
5624 fmt = '%s' + end |
c8709ff57ff2
status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents:
17892
diff
changeset
|
5625 showchar = not opts.get('no_status') |
16136
68007f0557de
formatter: convert status command
Matt Mackall <mpm@selenic.com>
parents:
16109
diff
changeset
|
5626 |
6605
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5627 for state, char, files in changestates: |
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5628 if state in show: |
16136
68007f0557de
formatter: convert status command
Matt Mackall <mpm@selenic.com>
parents:
16109
diff
changeset
|
5629 label = 'status.' + state |
6605
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5630 for f in files: |
16136
68007f0557de
formatter: convert status command
Matt Mackall <mpm@selenic.com>
parents:
16109
diff
changeset
|
5631 fm.startitem() |
17910
c8709ff57ff2
status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents:
17892
diff
changeset
|
5632 fm.condwrite(showchar, 'status', '%s ', char, label=label) |
c8709ff57ff2
status: use condwrite to avoid zero-width format string hack
Matt Mackall <mpm@selenic.com>
parents:
17892
diff
changeset
|
5633 fm.write('path', fmt, repo.pathto(f, cwd), label=label) |
6605
bf2bf986ff87
status: refactor status command
Matt Mackall <mpm@selenic.com>
parents:
6603
diff
changeset
|
5634 if f in copy: |
16136
68007f0557de
formatter: convert status command
Matt Mackall <mpm@selenic.com>
parents:
16109
diff
changeset
|
5635 fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd), |
10817
2096496b40ec
status: make use of output labeling
Brodie Rao <brodie@bitheap.org>
parents:
10816
diff
changeset
|
5636 label='status.copied') |
16136
68007f0557de
formatter: convert status command
Matt Mackall <mpm@selenic.com>
parents:
16109
diff
changeset
|
5637 fm.end() |
213 | 5638 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5639 @command('^summary|sum', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5640 [('', 'remote', None, _('check for push and pull'))], '[--remote]') |
9620 | 5641 def summary(ui, repo, **opts): |
9603 | 5642 """summarize working directory state |
5643 | |
5644 This generates a brief summary of the working directory state, | |
5645 including parents, branch, commit status, and available updates. | |
9620 | 5646 |
5647 With the --remote option, this will check the default paths for | |
5648 incoming and outgoing changes. This can be time-consuming. | |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5649 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5650 Returns 0 on success. |
9603 | 5651 """ |
5652 | |
5653 ctx = repo[None] | |
5654 parents = ctx.parents() | |
5655 pnode = parents[0].node() | |
14906
7c3c8f37e84f
summary: show bookmarks separate from tags and note active mark (issue2892)
Augie Fackler <durin42@gmail.com>
parents:
14874
diff
changeset
|
5656 marks = [] |
9603 | 5657 |
5658 for p in parents: | |
10832
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5659 # label with log.changeset (instead of log.parent) since this |
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5660 # shows a working directory parent *changeset*: |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5661 # i18n: column positioning for "hg summary" |
10832
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5662 ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), |
17788
9912baaae7df
color: add additional changeset.phase label to log.changeset and log.parent
Sean Farley <sean.michael.farley@gmail.com>
parents:
17773
diff
changeset
|
5663 label='log.changeset changeset.%s' % p.phasestr()) |
10833
d7b601f1e02c
commands: retrieve tags from context object
Martin Geisler <mg@lazybytes.net>
parents:
10832
diff
changeset
|
5664 ui.write(' '.join(p.tags()), label='log.tag') |
13454
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5665 if p.bookmarks(): |
14906
7c3c8f37e84f
summary: show bookmarks separate from tags and note active mark (issue2892)
Augie Fackler <durin42@gmail.com>
parents:
14874
diff
changeset
|
5666 marks.extend(p.bookmarks()) |
9618
d75a309a24b1
summary: add empty repository and no revision checked out hints
Matt Mackall <mpm@selenic.com>
parents:
9617
diff
changeset
|
5667 if p.rev() == -1: |
d75a309a24b1
summary: add empty repository and no revision checked out hints
Matt Mackall <mpm@selenic.com>
parents:
9617
diff
changeset
|
5668 if not len(repo): |
10834
4ab459a6c25c
commands: small refactoring in summary
Martin Geisler <mg@lazybytes.net>
parents:
10833
diff
changeset
|
5669 ui.write(_(' (empty repository)')) |
9618
d75a309a24b1
summary: add empty repository and no revision checked out hints
Matt Mackall <mpm@selenic.com>
parents:
9617
diff
changeset
|
5670 else: |
10834
4ab459a6c25c
commands: small refactoring in summary
Martin Geisler <mg@lazybytes.net>
parents:
10833
diff
changeset
|
5671 ui.write(_(' (no revision checked out)')) |
10832
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5672 ui.write('\n') |
9618
d75a309a24b1
summary: add empty repository and no revision checked out hints
Matt Mackall <mpm@selenic.com>
parents:
9617
diff
changeset
|
5673 if p.description(): |
10832
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5674 ui.status(' ' + p.description().splitlines()[0].strip() + '\n', |
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5675 label='log.summary') |
9603 | 5676 |
5677 branch = ctx.branch() | |
5678 bheads = repo.branchheads(branch) | |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5679 # i18n: column positioning for "hg summary" |
9873
541218fbad2a
summary: note non-default branches with -q
Matt Mackall <mpm@selenic.com>
parents:
9857
diff
changeset
|
5680 m = _('branch: %s\n') % branch |
541218fbad2a
summary: note non-default branches with -q
Matt Mackall <mpm@selenic.com>
parents:
9857
diff
changeset
|
5681 if branch != 'default': |
10832
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5682 ui.write(m, label='log.branch') |
9873
541218fbad2a
summary: note non-default branches with -q
Matt Mackall <mpm@selenic.com>
parents:
9857
diff
changeset
|
5683 else: |
10832
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5684 ui.status(m, label='log.branch') |
9603 | 5685 |
14906
7c3c8f37e84f
summary: show bookmarks separate from tags and note active mark (issue2892)
Augie Fackler <durin42@gmail.com>
parents:
14874
diff
changeset
|
5686 if marks: |
7c3c8f37e84f
summary: show bookmarks separate from tags and note active mark (issue2892)
Augie Fackler <durin42@gmail.com>
parents:
14874
diff
changeset
|
5687 current = repo._bookmarkcurrent |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5688 # i18n: column positioning for "hg summary" |
14907
84af56cc673b
summary: allow color to highlight active bookmark
Augie Fackler <durin42@gmail.com>
parents:
14906
diff
changeset
|
5689 ui.write(_('bookmarks:'), label='log.bookmark') |
14906
7c3c8f37e84f
summary: show bookmarks separate from tags and note active mark (issue2892)
Augie Fackler <durin42@gmail.com>
parents:
14874
diff
changeset
|
5690 if current is not None: |
18622
f9eebf5629fa
summary: show active bookmark even if not at current changeset
Kevin Bullock <kbullock@ringworld.org>
parents:
18621
diff
changeset
|
5691 if current in marks: |
14907
84af56cc673b
summary: allow color to highlight active bookmark
Augie Fackler <durin42@gmail.com>
parents:
14906
diff
changeset
|
5692 ui.write(' *' + current, label='bookmarks.current') |
18622
f9eebf5629fa
summary: show active bookmark even if not at current changeset
Kevin Bullock <kbullock@ringworld.org>
parents:
18621
diff
changeset
|
5693 marks.remove(current) |
f9eebf5629fa
summary: show active bookmark even if not at current changeset
Kevin Bullock <kbullock@ringworld.org>
parents:
18621
diff
changeset
|
5694 else: |
18623
0027a5cec9d0
summary: add missing space for updated active bookmark display
Matt Mackall <mpm@selenic.com>
parents:
18622
diff
changeset
|
5695 ui.write(' [%s]' % current, label='bookmarks.current') |
14907
84af56cc673b
summary: allow color to highlight active bookmark
Augie Fackler <durin42@gmail.com>
parents:
14906
diff
changeset
|
5696 for m in marks: |
17299
e51d4aedace9
check-code: indent 4 spaces in py files
Mads Kiilerich <mads@kiilerich.com>
parents:
17292
diff
changeset
|
5697 ui.write(' ' + m, label='log.bookmark') |
14907
84af56cc673b
summary: allow color to highlight active bookmark
Augie Fackler <durin42@gmail.com>
parents:
14906
diff
changeset
|
5698 ui.write('\n', label='log.bookmark') |
14906
7c3c8f37e84f
summary: show bookmarks separate from tags and note active mark (issue2892)
Augie Fackler <durin42@gmail.com>
parents:
14874
diff
changeset
|
5699 |
10390
f163775e36e0
summary: various fixes, add a test
Matt Mackall <mpm@selenic.com>
parents:
10389
diff
changeset
|
5700 st = list(repo.status(unknown=True))[:6] |
11088
c4347e48b0d0
summary: add subrepo status
Matt Mackall <mpm@selenic.com>
parents:
11078
diff
changeset
|
5701 |
11331
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5702 c = repo.dirstate.copies() |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5703 copied, renamed = [], [] |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5704 for d, s in c.iteritems(): |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5705 if s in st[2]: |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5706 st[2].remove(s) |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5707 renamed.append(d) |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5708 else: |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5709 copied.append(d) |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5710 if d in st[1]: |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5711 st[1].remove(d) |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5712 st.insert(3, renamed) |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5713 st.insert(4, copied) |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5714 |
15856
6bed6cc6d0d0
commands: partial backout of fbb68b382040
Martin Geisler <mg@aragost.com>
parents:
15855
diff
changeset
|
5715 ms = mergemod.mergestate(repo) |
10390
f163775e36e0
summary: various fixes, add a test
Matt Mackall <mpm@selenic.com>
parents:
10389
diff
changeset
|
5716 st.append([f for f in ms if ms[f] == 'u']) |
11088
c4347e48b0d0
summary: add subrepo status
Matt Mackall <mpm@selenic.com>
parents:
11078
diff
changeset
|
5717 |
c4347e48b0d0
summary: add subrepo status
Matt Mackall <mpm@selenic.com>
parents:
11078
diff
changeset
|
5718 subs = [s for s in ctx.substate if ctx.sub(s).dirty()] |
c4347e48b0d0
summary: add subrepo status
Matt Mackall <mpm@selenic.com>
parents:
11078
diff
changeset
|
5719 st.append(subs) |
c4347e48b0d0
summary: add subrepo status
Matt Mackall <mpm@selenic.com>
parents:
11078
diff
changeset
|
5720 |
10832
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5721 labels = [ui.label(_('%d modified'), 'status.modified'), |
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5722 ui.label(_('%d added'), 'status.added'), |
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5723 ui.label(_('%d removed'), 'status.removed'), |
11331
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5724 ui.label(_('%d renamed'), 'status.copied'), |
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5725 ui.label(_('%d copied'), 'status.copied'), |
10832
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5726 ui.label(_('%d deleted'), 'status.deleted'), |
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5727 ui.label(_('%d unknown'), 'status.unknown'), |
420bc8124904
summary: make use of output labeling
Eric Eisner <ede@mit.edu>
parents:
10830
diff
changeset
|
5728 ui.label(_('%d ignored'), 'status.ignored'), |
11088
c4347e48b0d0
summary: add subrepo status
Matt Mackall <mpm@selenic.com>
parents:
11078
diff
changeset
|
5729 ui.label(_('%d unresolved'), 'resolve.unresolved'), |
c4347e48b0d0
summary: add subrepo status
Matt Mackall <mpm@selenic.com>
parents:
11078
diff
changeset
|
5730 ui.label(_('%d subrepos'), 'status.modified')] |
9603 | 5731 t = [] |
10282
08a0f04b56bd
many, many trivial check-code fixups
Matt Mackall <mpm@selenic.com>
parents:
10270
diff
changeset
|
5732 for s, l in zip(st, labels): |
9607
8e0e0d854b60
commands: do not split a translated string
Martin Geisler <mg@lazybytes.net>
parents:
9603
diff
changeset
|
5733 if s: |
8e0e0d854b60
commands: do not split a translated string
Martin Geisler <mg@lazybytes.net>
parents:
9603
diff
changeset
|
5734 t.append(l % len(s)) |
9603 | 5735 |
5736 t = ', '.join(t) | |
10269
acf001ee5ef8
summary: L10N messages hide clean-ness of workdir from 'hg summary'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
10263
diff
changeset
|
5737 cleanworkdir = False |
9603 | 5738 |
19482
499fc471296b
update: add tracking of interrupted updates (issue3113)
Matt Mackall <mpm@selenic.com>
parents:
19476
diff
changeset
|
5739 if repo.vfs.exists('updatestate'): |
499fc471296b
update: add tracking of interrupted updates (issue3113)
Matt Mackall <mpm@selenic.com>
parents:
19476
diff
changeset
|
5740 t += _(' (interrupted update)') |
499fc471296b
update: add tracking of interrupted updates (issue3113)
Matt Mackall <mpm@selenic.com>
parents:
19476
diff
changeset
|
5741 elif len(parents) > 1: |
11310
ac873ecfc3c2
Backed out changeset: e1dde7363601
Steve Borho <steve@borho.org>
parents:
11302
diff
changeset
|
5742 t += _(' (merge)') |
9603 | 5743 elif branch != parents[0].branch(): |
11310
ac873ecfc3c2
Backed out changeset: e1dde7363601
Steve Borho <steve@borho.org>
parents:
11302
diff
changeset
|
5744 t += _(' (new branch)') |
16720
e825a89de5d7
context: add changectx.closesbranch() method
Brodie Rao <brodie@sf.io>
parents:
16719
diff
changeset
|
5745 elif (parents[0].closesbranch() and |
11165
e8915e19205a
summary: show if commit will be from a closed head
Gilles Moris <gilles.moris@free.fr>
parents:
11164
diff
changeset
|
5746 pnode in repo.branchheads(branch, closed=True)): |
11310
ac873ecfc3c2
Backed out changeset: e1dde7363601
Steve Borho <steve@borho.org>
parents:
11302
diff
changeset
|
5747 t += _(' (head closed)') |
11331
997ab9af81df
summary: report copies and renames
Matt Mackall <mpm@selenic.com>
parents:
11321
diff
changeset
|
5748 elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]): |
11310
ac873ecfc3c2
Backed out changeset: e1dde7363601
Steve Borho <steve@borho.org>
parents:
11302
diff
changeset
|
5749 t += _(' (clean)') |
10269
acf001ee5ef8
summary: L10N messages hide clean-ness of workdir from 'hg summary'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
10263
diff
changeset
|
5750 cleanworkdir = True |
9603 | 5751 elif pnode not in bheads: |
11310
ac873ecfc3c2
Backed out changeset: e1dde7363601
Steve Borho <steve@borho.org>
parents:
11302
diff
changeset
|
5752 t += _(' (new branch head)') |
9603 | 5753 |
10269
acf001ee5ef8
summary: L10N messages hide clean-ness of workdir from 'hg summary'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
10263
diff
changeset
|
5754 if cleanworkdir: |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5755 # i18n: column positioning for "hg summary" |
11310
ac873ecfc3c2
Backed out changeset: e1dde7363601
Steve Borho <steve@borho.org>
parents:
11302
diff
changeset
|
5756 ui.status(_('commit: %s\n') % t.strip()) |
9605 | 5757 else: |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5758 # i18n: column positioning for "hg summary" |
11310
ac873ecfc3c2
Backed out changeset: e1dde7363601
Steve Borho <steve@borho.org>
parents:
11302
diff
changeset
|
5759 ui.write(_('commit: %s\n') % t.strip()) |
9603 | 5760 |
5761 # all ancestors of branch heads - all ancestors of parent = new csets | |
22201
269688a398c4
cleanup: fix some list comprehension redefinitions of existing vars
Mads Kiilerich <madski@unity3d.com>
parents:
22119
diff
changeset
|
5762 new = len(repo.changelog.findmissing([pctx.node() for pctx in parents], |
19394
4da845cd854f
summary: use missing ancestors algorithm to find new commits
Siddharth Agarwal <sid0@fb.com>
parents:
19379
diff
changeset
|
5763 bheads)) |
9603 | 5764 |
5765 if new == 0: | |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5766 # i18n: column positioning for "hg summary" |
9605 | 5767 ui.status(_('update: (current)\n')) |
9603 | 5768 elif pnode not in bheads: |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5769 # i18n: column positioning for "hg summary" |
9603 | 5770 ui.write(_('update: %d new changesets (update)\n') % new) |
5771 else: | |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5772 # i18n: column positioning for "hg summary" |
9603 | 5773 ui.write(_('update: %d new changesets, %d branch heads (merge)\n') % |
5774 (new, len(bheads))) | |
5775 | |
19211
3bfd7f1e7485
summary: augment output with info from extensions
Bryan O'Sullivan <bryano@fb.com>
parents:
19209
diff
changeset
|
5776 cmdutil.summaryhooks(ui, repo) |
3bfd7f1e7485
summary: augment output with info from extensions
Bryan O'Sullivan <bryano@fb.com>
parents:
19209
diff
changeset
|
5777 |
9620 | 5778 if opts.get('remote'): |
21045
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5779 needsincoming, needsoutgoing = True, True |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5780 else: |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5781 needsincoming, needsoutgoing = False, False |
21047
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5782 for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None): |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5783 if i: |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5784 needsincoming = True |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5785 if o: |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5786 needsoutgoing = True |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5787 if not needsincoming and not needsoutgoing: |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5788 return |
21045
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5789 |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5790 def getincoming(): |
10389
6dc25b01e170
fix remaining hg.parseurl uses
Sune Foldager <cryo@cyanite.org>
parents:
10384
diff
changeset
|
5791 source, branches = hg.parseurl(ui.expandpath('default')) |
18997
4cf09a1bf5b2
summary: clear "commonincoming" also if branches are different
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18996
diff
changeset
|
5792 sbranch = branches[0] |
21047
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5793 try: |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5794 other = hg.peer(repo, {}, source) |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5795 except error.RepoError: |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5796 if opts.get('remote'): |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5797 raise |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5798 return source, sbranch, None, None, None |
19379
83d0df2ddf3f
summary: remove passing of rev because summary does not have this
Simon Heimberg <simohe@besonet.ch>
parents:
19333
diff
changeset
|
5799 revs, checkout = hg.addbranchrevs(repo, other, branches, None) |
18996
160d8416e286
summary: make "incoming" information sensitive to branch in URL (issue3830)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18994
diff
changeset
|
5800 if revs: |
160d8416e286
summary: make "incoming" information sensitive to branch in URL (issue3830)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18994
diff
changeset
|
5801 revs = [other.lookup(rev) for rev in revs] |
14076
924c82157d46
url: move URL parsing functions into util to improve startup time
Brodie Rao <brodie@bitheap.org>
parents:
14073
diff
changeset
|
5802 ui.debug('comparing with %s\n' % util.hidepassword(source)) |
9620 | 5803 repo.ui.pushbuffer() |
18996
160d8416e286
summary: make "incoming" information sensitive to branch in URL (issue3830)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18994
diff
changeset
|
5804 commoninc = discovery.findcommonincoming(repo, other, heads=revs) |
9620 | 5805 repo.ui.popbuffer() |
21045
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5806 return source, sbranch, other, commoninc, commoninc[1] |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5807 |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5808 if needsincoming: |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5809 source, sbranch, sother, commoninc, incoming = getincoming() |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5810 else: |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5811 source = sbranch = sother = commoninc = incoming = None |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5812 |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5813 def getoutgoing(): |
10389
6dc25b01e170
fix remaining hg.parseurl uses
Sune Foldager <cryo@cyanite.org>
parents:
10384
diff
changeset
|
5814 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) |
18997
4cf09a1bf5b2
summary: clear "commonincoming" also if branches are different
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18996
diff
changeset
|
5815 dbranch = branches[0] |
10389
6dc25b01e170
fix remaining hg.parseurl uses
Sune Foldager <cryo@cyanite.org>
parents:
10384
diff
changeset
|
5816 revs, checkout = hg.addbranchrevs(repo, repo, branches, None) |
14214
c5db85676c38
summary: run discovery only once for in/out against same repo
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
14213
diff
changeset
|
5817 if source != dest: |
21047
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5818 try: |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5819 dother = hg.peer(repo, {}, dest) |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5820 except error.RepoError: |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5821 if opts.get('remote'): |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5822 raise |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5823 return dest, dbranch, None, None |
18997
4cf09a1bf5b2
summary: clear "commonincoming" also if branches are different
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18996
diff
changeset
|
5824 ui.debug('comparing with %s\n' % util.hidepassword(dest)) |
21047
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5825 elif sother is None: |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5826 # there is no explicit destination peer, but source one is invalid |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5827 return dest, dbranch, None, None |
21045
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5828 else: |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5829 dother = sother |
18997
4cf09a1bf5b2
summary: clear "commonincoming" also if branches are different
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18996
diff
changeset
|
5830 if (source != dest or (sbranch is not None and sbranch != dbranch)): |
21045
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5831 common = None |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5832 else: |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5833 common = commoninc |
18994
32843795e9b3
summary: make "outgoing" information sensitive to branch in URL (issue3829)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18963
diff
changeset
|
5834 if revs: |
32843795e9b3
summary: make "outgoing" information sensitive to branch in URL (issue3829)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
18963
diff
changeset
|
5835 revs = [repo.lookup(rev) for rev in revs] |
9620 | 5836 repo.ui.pushbuffer() |
21045
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5837 outgoing = discovery.findcommonoutgoing(repo, dother, onlyheads=revs, |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5838 commoninc=common) |
9620 | 5839 repo.ui.popbuffer() |
21045
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5840 return dest, dbranch, dother, outgoing |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5841 |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5842 if needsoutgoing: |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5843 dest, dbranch, dother, outgoing = getoutgoing() |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5844 else: |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5845 dest = dbranch = dother = outgoing = None |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5846 |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5847 if opts.get('remote'): |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5848 t = [] |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5849 if incoming: |
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5850 t.append(_('1 or more incoming')) |
15837
cd956049fc14
discovery: introduce outgoing object for result of findcommonoutgoing
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15836
diff
changeset
|
5851 o = outgoing.missing |
9620 | 5852 if o: |
5853 t.append(_('%d outgoing') % len(o)) | |
21045
7f875ed19475
summary: separate checking incoming/outgoing and showing remote summary
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21041
diff
changeset
|
5854 other = dother or sother |
13454
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5855 if 'bookmarks' in other.listkeys('namespaces'): |
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5856 lmarks = repo.listkeys('bookmarks') |
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5857 rmarks = other.listkeys('bookmarks') |
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5858 diff = set(rmarks) - set(lmarks) |
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5859 if len(diff) > 0: |
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5860 t.append(_('%d incoming bookmarks') % len(diff)) |
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5861 diff = set(lmarks) - set(rmarks) |
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5862 if len(diff) > 0: |
afc84a879ac8
summary: add bookmarks to summary
David Soria Parra <dsp@php.net>
parents:
13453
diff
changeset
|
5863 t.append(_('%d outgoing bookmarks') % len(diff)) |
9620 | 5864 |
5865 if t: | |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5866 # i18n: column positioning for "hg summary" |
9620 | 5867 ui.write(_('remote: %s\n') % (', '.join(t))) |
5868 else: | |
17892
ba0a1701c81a
i18n: add "i18n" comment to column positioning messages of "hg summary"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17887
diff
changeset
|
5869 # i18n: column positioning for "hg summary" |
9620 | 5870 ui.status(_('remote: (synced)\n')) |
5871 | |
21047
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5872 cmdutil.summaryremotehooks(ui, repo, opts, |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5873 ((source, sbranch, sother, commoninc), |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5874 (dest, dbranch, dother, outgoing))) |
f0003f989e72
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21045
diff
changeset
|
5875 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5876 @command('tag', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5877 [('f', 'force', None, _('force tag')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5878 ('l', 'local', None, _('make the tag local')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5879 ('r', 'rev', '', _('revision to tag'), _('REV')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5880 ('', 'remove', None, _('remove a tag')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5881 # -l/--local is already there, commitopts cannot be used |
21952
3838b910fa6b
doc: unify help text for "--edit" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21951
diff
changeset
|
5882 ('e', 'edit', None, _('invoke editor on commit messages')), |
21951
59af0b21ec31
doc: unify help text for "--message" option
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21949
diff
changeset
|
5883 ('m', 'message', '', _('use text as commit message'), _('TEXT')), |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5884 ] + commitopts2, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
5885 _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')) |
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
5886 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
|
5887 """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
|
5888 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5889 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
|
5890 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5891 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
|
5892 very useful to compare different revisions, to go back to significant |
13135
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5893 earlier versions or to mark branch points as releases, etc. Changing |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5894 an existing tag is normally disallowed; use -f/--force to override. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5895 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
5896 If no revision is given, the parent of the working directory is |
19402
c7a7bae3cfa3
tag: remove incorrect reference to tip
Matt Mackall <mpm@selenic.com>
parents:
19401
diff
changeset
|
5897 used. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5898 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5899 To facilitate version control, distribution, and merging of tags, |
13135
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5900 they are stored as a file named ".hgtags" which is managed similarly |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5901 to other project files and can be hand-edited if necessary. This |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5902 also means that tagging creates a new commit. The file |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5903 ".hg/localtags" is used for local tags (not shared among |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5904 repositories). |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5905 |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5906 Tag commits are usually made at the head of a branch. If the parent |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5907 of the working directory is not a branch head, :hg:`tag` aborts; use |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5908 -f/--force to force the tag commit to be based on a non-head |
1c1ca9d393f4
tag: abort if not at a branch head (issue2552)
Kevin Bullock <kbullock@ringworld.org>
parents:
13134
diff
changeset
|
5909 changeset. |
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
|
5910 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
5911 See :hg:`help dates` for a list of formats valid for -d/--date. |
11063
eb23c876c111
tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11061
diff
changeset
|
5912 |
eb23c876c111
tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11061
diff
changeset
|
5913 Since tag names have priority over branch names during revision |
eb23c876c111
tag: warn users about tag/branch possible name conflicts
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
11061
diff
changeset
|
5914 lookup, using an existing branch name as a tag name is discouraged. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5915 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5916 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5917 """ |
15877
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5918 wlock = lock = None |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5919 try: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5920 wlock = repo.wlock() |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5921 lock = repo.lock() |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5922 rev_ = "." |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5923 names = [t.strip() for t in (name1,) + names] |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5924 if len(names) != len(set(names)): |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5925 raise util.Abort(_('tag names must be unique')) |
6321
55ba3bc5b8fd
tag: allow multiple tags to be added or removed
John Coomes <john.coomes@sun.com>
parents:
6304
diff
changeset
|
5926 for n in names: |
17821
361ab1e2086f
scmutil: add bad character checking to checknewlabel
Kevin Bullock <kbullock@ringworld.org>
parents:
17818
diff
changeset
|
5927 scmutil.checknewlabel(repo, n, 'tag') |
15877
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5928 if not n: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5929 raise util.Abort(_('tag names cannot consist entirely of ' |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5930 'whitespace')) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5931 if opts.get('rev') and opts.get('remove'): |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5932 raise util.Abort(_("--rev and --remove are incompatible")) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5933 if opts.get('rev'): |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5934 rev_ = opts['rev'] |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5935 message = opts.get('message') |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5936 if opts.get('remove'): |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5937 expectedtype = opts.get('local') and 'local' or 'global' |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5938 for n in names: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5939 if not repo.tagtype(n): |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5940 raise util.Abort(_("tag '%s' does not exist") % n) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5941 if repo.tagtype(n) != expectedtype: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5942 if expectedtype == 'global': |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5943 raise util.Abort(_("tag '%s' is not a global tag") % n) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5944 else: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5945 raise util.Abort(_("tag '%s' is not a local tag") % n) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5946 rev_ = nullid |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5947 if not message: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5948 # we don't translate commit messages |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5949 message = 'Removed tag %s' % ', '.join(names) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5950 elif not opts.get('force'): |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5951 for n in names: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5952 if n in repo.tags(): |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5953 raise util.Abort(_("tag '%s' already exists " |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5954 "(use -f to force)") % n) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5955 if not opts.get('local'): |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5956 p1, p2 = repo.dirstate.parents() |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5957 if p2 != nullid: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5958 raise util.Abort(_('uncommitted merge')) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5959 bheads = repo.branchheads() |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5960 if not opts.get('force') and bheads and p1 not in bheads: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5961 raise util.Abort(_('not at a branch head (use -f to force)')) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5962 r = scmutil.revsingle(repo, rev_).node() |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5963 |
4213 | 5964 if not message: |
9183
d0225fa2f6c4
do not translate commit messages
Martin Geisler <mg@lazybytes.net>
parents:
9128
diff
changeset
|
5965 # we don't translate commit messages |
15877
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5966 message = ('Added tag %s for changeset %s' % |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5967 (', '.join(names), short(r))) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5968 |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5969 date = opts.get('date') |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5970 if date: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5971 date = util.parsedate(date) |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5972 |
22009
0bbe8ef901d1
tag: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22008
diff
changeset
|
5973 if opts.get('remove'): |
0bbe8ef901d1
tag: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22008
diff
changeset
|
5974 editform = 'tag.remove' |
0bbe8ef901d1
tag: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22008
diff
changeset
|
5975 else: |
0bbe8ef901d1
tag: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22008
diff
changeset
|
5976 editform = 'tag.add' |
0bbe8ef901d1
tag: pass 'editform' argument to 'cmdutil.getcommiteditor'
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
22008
diff
changeset
|
5977 editor = cmdutil.getcommiteditor(editform=editform, **opts) |
15877
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5978 |
17260
e432fb4b4221
tag: don't allow tagging the null revision (issue1915)
Brad Hall <bhall@fb.com>
parents:
17255
diff
changeset
|
5979 # don't allow tagging the null rev |
e432fb4b4221
tag: don't allow tagging the null revision (issue1915)
Brad Hall <bhall@fb.com>
parents:
17255
diff
changeset
|
5980 if (not opts.get('remove') and |
e432fb4b4221
tag: don't allow tagging the null revision (issue1915)
Brad Hall <bhall@fb.com>
parents:
17255
diff
changeset
|
5981 scmutil.revsingle(repo, rev_).rev() == nullrev): |
18906
ef7068173a22
tag: clarify cryptic error message when tagging null revision
Mads Kiilerich <madski@unity3d.com>
parents:
18892
diff
changeset
|
5982 raise util.Abort(_("cannot tag null revision")) |
17260
e432fb4b4221
tag: don't allow tagging the null revision (issue1915)
Brad Hall <bhall@fb.com>
parents:
17255
diff
changeset
|
5983 |
21237
0054a77f49df
localrepo: add "editor" argument to "tag()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21200
diff
changeset
|
5984 repo.tag(names, r, message, opts.get('local'), opts.get('user'), date, |
0054a77f49df
localrepo: add "editor" argument to "tag()"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
21200
diff
changeset
|
5985 editor=editor) |
15877
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5986 finally: |
afd459933d5f
tag: lock before tagging
Mads Kiilerich <mads@kiilerich.com>
parents:
15875
diff
changeset
|
5987 release(lock, wlock) |
401
af4848f83e68
From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>
mpm@selenic.com
parents:
396
diff
changeset
|
5988 |
22429
7a7eed5176a4
commands: add hidden -T option for files/manifest/status/tags
Matt Mackall <mpm@selenic.com>
parents:
22423
diff
changeset
|
5989 @command('tags', formatteropts, '') |
17912
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
5990 def tags(ui, repo, **opts): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5991 """list repository tags |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5992 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
5993 This lists both regular and local tags. When the -v/--verbose |
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
5994 switch is used, a third column "local" is printed for local tags. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5995 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
5996 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
5997 """ |
477
520540fd6b64
Handle errors in .hgtags or hgrc [tags] section more gracefully.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
470
diff
changeset
|
5998 |
17912
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
5999 fm = ui.formatter('tags', opts) |
2966
fb493241d7f6
Only show long hashes with --debug, not --verbose
Matt Mackall <mpm@selenic.com>
parents:
2963
diff
changeset
|
6000 hexfunc = ui.debugflag and hex or short |
5658
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
6001 tagtype = "" |
ae3089cefaab
Add --verbose support to tags command.
Osku Salerma <osku@iki.fi>
parents:
5657
diff
changeset
|
6002 |
8210
344751cd8cb8
replace various uses of list.reverse()
Matt Mackall <mpm@selenic.com>
parents:
8209
diff
changeset
|
6003 for t, n in reversed(repo.tagslist()): |
13893
1aea86673dee
tags: no need to check for valid nodes
Idan Kamara <idankk86@gmail.com>
parents:
13891
diff
changeset
|
6004 hn = hexfunc(n) |
17912
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6005 label = 'tags.normal' |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6006 tagtype = '' |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6007 if repo.tagtype(t) == 'local': |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6008 label = 'tags.local' |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6009 tagtype = 'local' |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6010 |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6011 fm.startitem() |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6012 fm.write('tag', '%s', t, label=label) |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6013 fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s' |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6014 fm.condwrite(not ui.quiet, 'rev id', fmt, |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6015 repo.changelog.rev(n), hn, label=label) |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6016 fm.condwrite(ui.verbose and tagtype, 'type', ' %s', |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6017 tagtype, label=label) |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6018 fm.plain('\n') |
7a3de6c23f6d
tags: add formatter support
Matt Mackall <mpm@selenic.com>
parents:
17911
diff
changeset
|
6019 fm.end() |
248 | 6020 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6021 @command('tip', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6022 [('p', 'patch', None, _('show patch')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6023 ('g', 'git', None, _('use git extended diff format')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6024 ] + templateopts, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6025 _('[-p] [-g]')) |
1731
251729df9cc6
add -p option to tip. for issue 64.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1728
diff
changeset
|
6026 def tip(ui, repo, **opts): |
19403
9013f2930a4a
tip: deprecate the tip command
Matt Mackall <mpm@selenic.com>
parents:
19402
diff
changeset
|
6027 """show the tip revision (DEPRECATED) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6028 |
8779
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
6029 The tip revision (usually just called the tip) is the changeset |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
6030 most recently added to the repository (and therefore the most |
708938509732
Improve English for help text of many core hg commands.
timeless <timeless@gmail.com>
parents:
8778
diff
changeset
|
6031 recently changed head). |
6364
b22b39059722
Make tip help more helpful
Patrick Mezard <pmezard@gmail.com>
parents:
6353
diff
changeset
|
6032 |
6367
51984a2413f2
Remove unexpected "Alternately" word from tip help.
Patrick Mezard <pmezard@gmail.com>
parents:
6364
diff
changeset
|
6033 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
|
6034 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
|
6035 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
|
6036 and cannot be renamed or assigned to a different changeset. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
6037 |
19403
9013f2930a4a
tip: deprecate the tip command
Matt Mackall <mpm@selenic.com>
parents:
19402
diff
changeset
|
6038 This command is deprecated, please use :hg:`heads` instead. |
9013f2930a4a
tip: deprecate the tip command
Matt Mackall <mpm@selenic.com>
parents:
19402
diff
changeset
|
6039 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
6040 Returns 0 on success. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6041 """ |
10152
56284451a22c
Added support for templatevar "footer" to cmdutil.py
Robert Bachmann <rbachm@gmail.com>
parents:
10111
diff
changeset
|
6042 displayer = cmdutil.show_changeset(ui, repo, opts) |
18464
a2e9fe93d9ea
changectx: fix the handling of `tip`
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
18458
diff
changeset
|
6043 displayer.show(repo['tip']) |
10152
56284451a22c
Added support for templatevar "footer" to cmdutil.py
Robert Bachmann <rbachm@gmail.com>
parents:
10111
diff
changeset
|
6044 displayer.close() |
245 | 6045 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6046 @command('unbundle', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6047 [('u', 'update', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6048 _('update to new branch head if changesets were unbundled'))], |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6049 _('[-u] FILE...')) |
4699
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
6050 def unbundle(ui, repo, fname1, *fnames, **opts): |
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
6051 """apply one or more changegroup files |
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
6052 |
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
6053 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
|
6054 bundle command. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
6055 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
6056 Returns 0 on success, 1 if an update has unresolved files. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6057 """ |
4699
a6b62584d0b2
unbundle: accept multiple file arguments
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
4697
diff
changeset
|
6058 fnames = (fname1,) + fnames |
6180
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
6059 |
8109
496ae1ea4698
switch lock releasing in the core from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
8088
diff
changeset
|
6060 lock = repo.lock() |
6180
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
6061 try: |
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
6062 for fname in fnames: |
17887
0e2846b2482c
url: use open and not url.open for local files (issue3624)
Siddharth Agarwal <sid0@fb.com>
parents:
17875
diff
changeset
|
6063 f = hg.openpath(ui, fname) |
21064
4d9d490d7bbe
bundle2: add a ui argument to readbundle
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
21063
diff
changeset
|
6064 gen = exchange.readbundle(ui, f, fname) |
20933
d3775db748a0
localrepo: move the addchangegroup method in changegroup module
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20930
diff
changeset
|
6065 modheads = changegroup.addchangegroup(repo, gen, 'unbundle', |
d3775db748a0
localrepo: move the addchangegroup method in changegroup module
Pierre-Yves David <pierre-yves.david@fb.com>
parents:
20930
diff
changeset
|
6066 'bundle:' + fname) |
6180
d98ef03893e6
commands: lock() the repo while unbundling (issue1004)
Patrick Mezard <pmezard@gmail.com>
parents:
6178
diff
changeset
|
6067 finally: |
8109
496ae1ea4698
switch lock releasing in the core from gc to explicit
Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de>
parents:
8088
diff
changeset
|
6068 lock.release() |
22091
f72b71ba756b
unbundle: don't advance bookmarks (issue4322) (BC)
Matt Mackall <mpm@selenic.com>
parents:
21959
diff
changeset
|
6069 |
7131
23bd7383891c
commands: optional options where possible
Alexander Solovyov <piranha@piranha.org.ua>
parents:
7126
diff
changeset
|
6070 return postincoming(ui, repo, modheads, opts.get('update'), None) |
1218
cde6818e082a
Add preliminary support for the bundle and unbundle commands
mpm@selenic.com
parents:
1215
diff
changeset
|
6071 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6072 @command('^update|up|checkout|co', |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6073 [('C', 'clean', None, _('discard uncommitted changes (no backup)')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6074 ('c', 'check', None, |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6075 _('update across branches if no uncommitted changes')), |
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6076 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), |
21552
61151f429a5f
update: introduce --tool for controlling the merge tool
Mads Kiilerich <madski@unity3d.com>
parents:
21541
diff
changeset
|
6077 ('r', 'rev', '', _('revision'), _('REV')) |
61151f429a5f
update: introduce --tool for controlling the merge tool
Mads Kiilerich <madski@unity3d.com>
parents:
21541
diff
changeset
|
6078 ] + mergetoolopts, |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6079 _('[-c] [-C] [-d DATE] [[-r] REV]')) |
21552
61151f429a5f
update: introduce --tool for controlling the merge tool
Mads Kiilerich <madski@unity3d.com>
parents:
21541
diff
changeset
|
6080 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False, |
61151f429a5f
update: introduce --tool for controlling the merge tool
Mads Kiilerich <madski@unity3d.com>
parents:
21541
diff
changeset
|
6081 tool=None): |
10889
e25c450c351e
commands: improve some command summaries
Matt Mackall <mpm@selenic.com>
parents:
10882
diff
changeset
|
6082 """update working directory (or switch revisions) |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6083 |
8004
d5b1b846f277
commands: word-wrap help texts at 70 characters
Martin Geisler <mg@daimi.au.dk>
parents:
7983
diff
changeset
|
6084 Update the repository's working directory to the specified |
12688
8c034a825cfe
help: improve description of update --check
Kevin Bullock <kbullock@ringworld.org>
parents:
12618
diff
changeset
|
6085 changeset. If no changeset is specified, update to the tip of the |
15957
12a1c9e92d66
update: note ways to avoid moving bookmark
Kevin Bullock <kbullock@ringworld.org>
parents:
15950
diff
changeset
|
6086 current named branch and move the current bookmark (see :hg:`help |
12a1c9e92d66
update: note ways to avoid moving bookmark
Kevin Bullock <kbullock@ringworld.org>
parents:
15950
diff
changeset
|
6087 bookmarks`). |
12688
8c034a825cfe
help: improve description of update --check
Kevin Bullock <kbullock@ringworld.org>
parents:
12618
diff
changeset
|
6088 |
17343
e560ecb755fe
update: fix typo in help text
Adrian Buehlmann <adrian@cadifra.com>
parents:
17322
diff
changeset
|
6089 Update sets the working directory's parent revision to the specified |
17143
c9e6c6ae4ea1
update: move help text about parent revision higher up
Adrian Buehlmann <adrian@cadifra.com>
parents:
17142
diff
changeset
|
6090 changeset (see :hg:`help parents`). |
c9e6c6ae4ea1
update: move help text about parent revision higher up
Adrian Buehlmann <adrian@cadifra.com>
parents:
17142
diff
changeset
|
6091 |
16877
6e578e77cbe6
update: fix help regarding update to ancestor
Kevin Bullock <kbullock@ringworld.org>
parents:
16869
diff
changeset
|
6092 If the changeset is not a descendant or ancestor of the working |
6e578e77cbe6
update: fix help regarding update to ancestor
Kevin Bullock <kbullock@ringworld.org>
parents:
16869
diff
changeset
|
6093 directory's parent, the update is aborted. With the -c/--check |
6e578e77cbe6
update: fix help regarding update to ancestor
Kevin Bullock <kbullock@ringworld.org>
parents:
16869
diff
changeset
|
6094 option, the working directory is checked for uncommitted changes; if |
6e578e77cbe6
update: fix help regarding update to ancestor
Kevin Bullock <kbullock@ringworld.org>
parents:
16869
diff
changeset
|
6095 none are found, the working directory is updated to the specified |
9718
fe1b19bfe75b
help: describe new cross-branch behavior in update help text, plus cleanups
Stuart W Marks <smarks@smarks.org>
parents:
9714
diff
changeset
|
6096 changeset. |
fe1b19bfe75b
help: describe new cross-branch behavior in update help text, plus cleanups
Stuart W Marks <smarks@smarks.org>
parents:
9714
diff
changeset
|
6097 |
17218
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6098 .. container:: verbose |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6099 |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6100 The following rules apply when the working directory contains |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6101 uncommitted changes: |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6102 |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6103 1. If neither -c/--check nor -C/--clean is specified, and if |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6104 the requested changeset is an ancestor or descendant of |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6105 the working directory's parent, the uncommitted changes |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6106 are merged into the requested changeset and the merged |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6107 result is left uncommitted. If the requested changeset is |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6108 not an ancestor or descendant (that is, it is on another |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6109 branch), the update is aborted and the uncommitted changes |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6110 are preserved. |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6111 |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6112 2. With the -c/--check option, the update is aborted and the |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6113 uncommitted changes are preserved. |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6114 |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6115 3. With the -C/--clean option, uncommitted changes are discarded and |
b8661d7c940f
update: put rules for uncommitted changes into verbose help section
Adrian Buehlmann <adrian@cadifra.com>
parents:
17192
diff
changeset
|
6116 the working directory is updated to the requested changeset. |
9718
fe1b19bfe75b
help: describe new cross-branch behavior in update help text, plus cleanups
Stuart W Marks <smarks@smarks.org>
parents:
9714
diff
changeset
|
6117 |
17144
71e36b3d2cc4
update: mention how update can be used to cancel an uncommitted merge
Adrian Buehlmann <adrian@cadifra.com>
parents:
17143
diff
changeset
|
6118 To cancel an uncommitted merge (and lose your changes), use |
71e36b3d2cc4
update: mention how update can be used to cancel an uncommitted merge
Adrian Buehlmann <adrian@cadifra.com>
parents:
17143
diff
changeset
|
6119 :hg:`update --clean .`. |
71e36b3d2cc4
update: mention how update can be used to cancel an uncommitted merge
Adrian Buehlmann <adrian@cadifra.com>
parents:
17143
diff
changeset
|
6120 |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
6121 Use null as the changeset to remove the working directory (like |
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
6122 :hg:`clone -U`). |
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
6123 |
14729
94eea58da2a3
update: do not use the term 'update' when mentioning reverting one file
Adrian Buehlmann <adrian@cadifra.com>
parents:
14726
diff
changeset
|
6124 If you want to revert just one file to an older revision, use |
94eea58da2a3
update: do not use the term 'update' when mentioning reverting one file
Adrian Buehlmann <adrian@cadifra.com>
parents:
14726
diff
changeset
|
6125 :hg:`revert [-r REV] NAME`. |
10973
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
6126 |
49a07f441496
Use hg role in help strings
Martin Geisler <mg@aragost.com>
parents:
10963
diff
changeset
|
6127 See :hg:`help dates` for a list of formats valid for -d/--date. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
6128 |
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
6129 Returns 0 on success, 1 if there are unresolved files. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6130 """ |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
6131 if rev and node: |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
6132 raise util.Abort(_("please specify just one revision")) |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
6133 |
13568
0b79cf616e65
commands.update() now works properly with a revision of 0
Mark Drago <markdrago@gmail.com>
parents:
13477
diff
changeset
|
6134 if rev is None or rev == '': |
4450
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
6135 rev = node |
8fa54b9c6c5a
accept -r REV in more places
Daniel Holth <dholth@fastmail.fm>
parents:
4445
diff
changeset
|
6136 |
19475
e24531a23ae4
update: clear any clearable unfinished operations (issue3955)
Matt Mackall <mpm@selenic.com>
parents:
19469
diff
changeset
|
6137 cmdutil.clearunfinished(repo) |
e24531a23ae4
update: clear any clearable unfinished operations (issue3955)
Matt Mackall <mpm@selenic.com>
parents:
19469
diff
changeset
|
6138 |
15935
6c97eb445341
bookmarks: automatically advance bookmark on naked update (BC) (issue2894)
Matt Mackall <mpm@selenic.com>
parents:
15912
diff
changeset
|
6139 # with no argument, we also move the current bookmark, if any |
19523
f37b5a17e6a0
bookmarks: pull --update updates to active bookmark if it moved (issue4007)
Kevin Bullock <kbullock@ringworld.org>
parents:
19496
diff
changeset
|
6140 rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) |
15935
6c97eb445341
bookmarks: automatically advance bookmark on naked update (BC) (issue2894)
Matt Mackall <mpm@selenic.com>
parents:
15912
diff
changeset
|
6141 |
13415
25b5694b9337
update: preserve possible bookmark name to set current bookmark correctly
David Soria Parra <dsp@php.net>
parents:
13407
diff
changeset
|
6142 # if we defined a bookmark, we have to remember the original bookmark name |
25b5694b9337
update: preserve possible bookmark name to set current bookmark correctly
David Soria Parra <dsp@php.net>
parents:
13407
diff
changeset
|
6143 brev = rev |
14319
b33f3e35efb0
scmutil: move revsingle/pair/range from cmdutil
Matt Mackall <mpm@selenic.com>
parents:
14318
diff
changeset
|
6144 rev = scmutil.revsingle(repo, rev, rev).rev() |
12726
61c0df2b089a
update: use revsingle to enable use of revsets as update targets (issue1993)
Augie Fackler <durin42@gmail.com>
parents:
12705
diff
changeset
|
6145 |
9450
e78967d3dd6f
commands: forbid 'hg update --check --clean'
Stuart W Marks <smarks@smarks.org>
parents:
9429
diff
changeset
|
6146 if check and clean: |
9451
3e673c988c85
commands: expand -c and -C in update error message
Martin Geisler <mg@lazybytes.net>
parents:
9450
diff
changeset
|
6147 raise util.Abort(_("cannot specify both -c/--check and -C/--clean")) |
9450
e78967d3dd6f
commands: forbid 'hg update --check --clean'
Stuart W Marks <smarks@smarks.org>
parents:
9429
diff
changeset
|
6148 |
16092
914bc95e227b
update: use normal update path with --check (issue2450)
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
6149 if date: |
914bc95e227b
update: use normal update path with --check (issue2450)
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
6150 if rev is not None: |
914bc95e227b
update: use normal update path with --check (issue2450)
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
6151 raise util.Abort(_("you can't specify a revision and a date")) |
914bc95e227b
update: use normal update path with --check (issue2450)
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
6152 rev = cmdutil.finddate(ui, repo, date) |
914bc95e227b
update: use normal update path with --check (issue2450)
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
6153 |
9450
e78967d3dd6f
commands: forbid 'hg update --check --clean'
Stuart W Marks <smarks@smarks.org>
parents:
9429
diff
changeset
|
6154 if check: |
8855 | 6155 c = repo[None] |
17849
6da47b655d97
update: check for missing files with --check (issue3595)
Matt Mackall <mpm@selenic.com>
parents:
17848
diff
changeset
|
6156 if c.dirty(merge=False, branch=False, missing=True): |
19801
41abe2e3e3b7
update: standardize error message for dirty update --check
Siddharth Agarwal <sid0@fb.com>
parents:
19797
diff
changeset
|
6157 raise util.Abort(_("uncommitted changes")) |
16490
c8ee34917045
update: fix "not rev" vs "rev is None"
Patrick Mezard <patrick@mezard.eu>
parents:
16473
diff
changeset
|
6158 if rev is None: |
16092
914bc95e227b
update: use normal update path with --check (issue2450)
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
6159 rev = repo[repo[None].branch()].rev() |
16095
3eab42088be4
update: just merge unknown file collisions
Matt Mackall <mpm@selenic.com>
parents:
16092
diff
changeset
|
6160 mergemod._checkunknown(repo, repo[None], repo[rev]) |
16092
914bc95e227b
update: use normal update path with --check (issue2450)
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
6161 |
21552
61151f429a5f
update: introduce --tool for controlling the merge tool
Mads Kiilerich <madski@unity3d.com>
parents:
21541
diff
changeset
|
6162 repo.ui.setconfig('ui', 'forcemerge', tool, 'update') |
61151f429a5f
update: introduce --tool for controlling the merge tool
Mads Kiilerich <madski@unity3d.com>
parents:
21541
diff
changeset
|
6163 |
16092
914bc95e227b
update: use normal update path with --check (issue2450)
Matt Mackall <mpm@selenic.com>
parents:
16039
diff
changeset
|
6164 if clean: |
13367
cef73cd9c268
bookmarks: merge current tracking on update into core
Matt Mackall <mpm@selenic.com>
parents:
13366
diff
changeset
|
6165 ret = hg.clean(repo, rev) |
2808
30f59f4a327e
Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents:
2806
diff
changeset
|
6166 else: |
13367
cef73cd9c268
bookmarks: merge current tracking on update into core
Matt Mackall <mpm@selenic.com>
parents:
13366
diff
changeset
|
6167 ret = hg.update(repo, rev) |
cef73cd9c268
bookmarks: merge current tracking on update into core
Matt Mackall <mpm@selenic.com>
parents:
13366
diff
changeset
|
6168 |
15935
6c97eb445341
bookmarks: automatically advance bookmark on naked update (BC) (issue2894)
Matt Mackall <mpm@selenic.com>
parents:
15912
diff
changeset
|
6169 if not ret and movemarkfrom: |
16010
c7811ca6fb94
update: note updated bookmark
Kevin Bullock <kbullock@ringworld.org>
parents:
16009
diff
changeset
|
6170 if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): |
c7811ca6fb94
update: note updated bookmark
Kevin Bullock <kbullock@ringworld.org>
parents:
16009
diff
changeset
|
6171 ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) |
15935
6c97eb445341
bookmarks: automatically advance bookmark on naked update (BC) (issue2894)
Matt Mackall <mpm@selenic.com>
parents:
15912
diff
changeset
|
6172 elif brev in repo._bookmarks: |
13415
25b5694b9337
update: preserve possible bookmark name to set current bookmark correctly
David Soria Parra <dsp@php.net>
parents:
13407
diff
changeset
|
6173 bookmarks.setcurrent(repo, brev) |
21503
10f15e34d86c
update: show message when a bookmark is activated by update
Stephen Lee <sphen.lee@gmail.com>
parents:
21418
diff
changeset
|
6174 ui.status(_("(activating bookmark %s)\n") % brev) |
16191
7c75924a6926
update: delete bookmarks.current when explicitly updating to a rev (issue3276)
Idan Kamara <idankk86@gmail.com>
parents:
16189
diff
changeset
|
6175 elif brev: |
21404
ca275f7ec576
update: when deactivating a bookmark, print a message
Siddharth Agarwal <sid0@fb.com>
parents:
21267
diff
changeset
|
6176 if repo._bookmarkcurrent: |
ca275f7ec576
update: when deactivating a bookmark, print a message
Siddharth Agarwal <sid0@fb.com>
parents:
21267
diff
changeset
|
6177 ui.status(_("(leaving bookmark %s)\n") % |
ca275f7ec576
update: when deactivating a bookmark, print a message
Siddharth Agarwal <sid0@fb.com>
parents:
21267
diff
changeset
|
6178 repo._bookmarkcurrent) |
16191
7c75924a6926
update: delete bookmarks.current when explicitly updating to a rev (issue3276)
Idan Kamara <idankk86@gmail.com>
parents:
16189
diff
changeset
|
6179 bookmarks.unsetcurrent(repo) |
13367
cef73cd9c268
bookmarks: merge current tracking on update into core
Matt Mackall <mpm@selenic.com>
parents:
13366
diff
changeset
|
6180 |
cef73cd9c268
bookmarks: merge current tracking on update into core
Matt Mackall <mpm@selenic.com>
parents:
13366
diff
changeset
|
6181 return ret |
254 | 6182 |
14297
2daa5179e73f
commands: use a decorator to build table incrementally
Adrian Buehlmann <adrian@cadifra.com>
parents:
14291
diff
changeset
|
6183 @command('verify', []) |
247 | 6184 def verify(ui, repo): |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6185 """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
|
6186 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6187 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
|
6188 |
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6189 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
|
6190 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
|
6191 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
|
6192 integrity of their crosslinks and indices. |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
6193 |
17717
009db477c9fb
help: add information about recovery from corruption to help of "verify"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17686
diff
changeset
|
6194 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption |
009db477c9fb
help: add information about recovery from corruption to help of "verify"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17686
diff
changeset
|
6195 for more information about recovery from corruption of the |
009db477c9fb
help: add information about recovery from corruption to help of "verify"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17686
diff
changeset
|
6196 repository. |
009db477c9fb
help: add information about recovery from corruption to help of "verify"
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
17686
diff
changeset
|
6197 |
11177
6a64813276ed
commands: initial audit of exit codes
Matt Mackall <mpm@selenic.com>
parents:
11173
diff
changeset
|
6198 Returns 0 on success, 1 if errors are encountered. |
1437
ea51d296085f
import docstring from doc/hg.1.txt
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
1436
diff
changeset
|
6199 """ |
2778 | 6200 return hg.verify(repo) |
247 | 6201 |
21768
16aeb28caaa6
commands: define norepo in command decorator
Gregory Szorc <gregory.szorc@gmail.com>
parents:
21767
diff
changeset
|
6202 @command('version', [], norepo=True) |
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
6203 def version_(ui): |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
6204 """output version and copyright information""" |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
6205 ui.write(_("Mercurial Distributed SCM (version %s)\n") |
7632 | 6206 % util.version()) |
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
6207 ui.status(_( |
12829
01145ee78c53
version: replace email address with url to reduce private mail
Matt Mackall <mpm@selenic.com>
parents:
12821
diff
changeset
|
6208 "(see http://mercurial.selenic.com for more information)\n" |
20227
9c963a43ecfb
doc: bump copyright year
Kevin Bullock <kbullock@ringworld.org>
parents:
20192
diff
changeset
|
6209 "\nCopyright (C) 2005-2014 Matt Mackall and others\n" |
3651
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
6210 "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
|
6211 "There is NO\nwarranty; " |
6389205291c6
move show_version to version_
Matt Mackall <mpm@selenic.com>
parents:
3650
diff
changeset
|
6212 "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
|
6213 )) |
21848
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6214 |
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6215 ui.note(_("\nEnabled extensions:\n\n")) |
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6216 if ui.verbose: |
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6217 # format names and versions into columns |
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6218 names = [] |
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6219 vers = [] |
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6220 for name, module in extensions.extensions(): |
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6221 names.append(name) |
ecdbbb6e5d06
version: show enabled extensions (issue4209)
anatoly techtonik <techtonik@gmail.com>
parents:
21819
diff
changeset
|
6222 vers.append(extensions.moduleversion(module)) |
21937
54ff2789d75e
version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents:
21929
diff
changeset
|
6223 if names: |
54ff2789d75e
version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents:
21929
diff
changeset
|
6224 maxnamelen = max(len(n) for n in names) |
54ff2789d75e
version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents:
21929
diff
changeset
|
6225 for i, name in enumerate(names): |
54ff2789d75e
version: don't traceback if no extensions to list (issue4312)
Matt Mackall <mpm@selenic.com>
parents:
21929
diff
changeset
|
6226 ui.write(" %-*s %s\n" % (maxnamelen, name, vers[i])) |