Show More
@@ -1,5973 +1,5987 b'' | |||||
1 | # commands.py - command processing for mercurial |
|
1 | # commands.py - command processing for mercurial | |
2 | # |
|
2 | # | |
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> |
|
3 | # Copyright 2005-2007 Matt Mackall <mpm@selenic.com> | |
4 | # |
|
4 | # | |
5 | # This software may be used and distributed according to the terms of the |
|
5 | # This software may be used and distributed according to the terms of the | |
6 | # GNU General Public License version 2 or any later version. |
|
6 | # GNU General Public License version 2 or any later version. | |
7 |
|
7 | |||
8 | from node import hex, bin, nullid, nullrev, short |
|
8 | from node import hex, bin, nullid, nullrev, short | |
9 | from lock import release |
|
9 | from lock import release | |
10 | from i18n import _ |
|
10 | from i18n import _ | |
11 | import os, re, difflib, time, tempfile, errno |
|
11 | import os, re, difflib, time, tempfile, errno | |
12 | import sys |
|
12 | import sys | |
13 | import hg, scmutil, util, revlog, copies, error, bookmarks |
|
13 | import hg, scmutil, util, revlog, copies, error, bookmarks | |
14 | import patch, help, encoding, templatekw, discovery |
|
14 | import patch, help, encoding, templatekw, discovery | |
15 | import archival, changegroup, cmdutil, hbisect |
|
15 | import archival, changegroup, cmdutil, hbisect | |
16 | import sshserver, hgweb, commandserver |
|
16 | import sshserver, hgweb, commandserver | |
17 | from hgweb import server as hgweb_server |
|
17 | from hgweb import server as hgweb_server | |
18 | import merge as mergemod |
|
18 | import merge as mergemod | |
19 | import minirst, revset, fileset |
|
19 | import minirst, revset, fileset | |
20 | import dagparser, context, simplemerge, graphmod |
|
20 | import dagparser, context, simplemerge, graphmod | |
21 | import random |
|
21 | import random | |
22 | import setdiscovery, treediscovery, dagutil, pvec, localrepo |
|
22 | import setdiscovery, treediscovery, dagutil, pvec, localrepo | |
23 | import phases, obsolete, exchange |
|
23 | import phases, obsolete, exchange | |
24 |
|
24 | |||
25 | table = {} |
|
25 | table = {} | |
26 |
|
26 | |||
27 | command = cmdutil.command(table) |
|
27 | command = cmdutil.command(table) | |
28 |
|
28 | |||
29 | # common command options |
|
29 | # common command options | |
30 |
|
30 | |||
31 | globalopts = [ |
|
31 | globalopts = [ | |
32 | ('R', 'repository', '', |
|
32 | ('R', 'repository', '', | |
33 | _('repository root directory or name of overlay bundle file'), |
|
33 | _('repository root directory or name of overlay bundle file'), | |
34 | _('REPO')), |
|
34 | _('REPO')), | |
35 | ('', 'cwd', '', |
|
35 | ('', 'cwd', '', | |
36 | _('change working directory'), _('DIR')), |
|
36 | _('change working directory'), _('DIR')), | |
37 | ('y', 'noninteractive', None, |
|
37 | ('y', 'noninteractive', None, | |
38 | _('do not prompt, automatically pick the first choice for all prompts')), |
|
38 | _('do not prompt, automatically pick the first choice for all prompts')), | |
39 | ('q', 'quiet', None, _('suppress output')), |
|
39 | ('q', 'quiet', None, _('suppress output')), | |
40 | ('v', 'verbose', None, _('enable additional output')), |
|
40 | ('v', 'verbose', None, _('enable additional output')), | |
41 | ('', 'config', [], |
|
41 | ('', 'config', [], | |
42 | _('set/override config option (use \'section.name=value\')'), |
|
42 | _('set/override config option (use \'section.name=value\')'), | |
43 | _('CONFIG')), |
|
43 | _('CONFIG')), | |
44 | ('', 'debug', None, _('enable debugging output')), |
|
44 | ('', 'debug', None, _('enable debugging output')), | |
45 | ('', 'debugger', None, _('start debugger')), |
|
45 | ('', 'debugger', None, _('start debugger')), | |
46 | ('', 'encoding', encoding.encoding, _('set the charset encoding'), |
|
46 | ('', 'encoding', encoding.encoding, _('set the charset encoding'), | |
47 | _('ENCODE')), |
|
47 | _('ENCODE')), | |
48 | ('', 'encodingmode', encoding.encodingmode, |
|
48 | ('', 'encodingmode', encoding.encodingmode, | |
49 | _('set the charset encoding mode'), _('MODE')), |
|
49 | _('set the charset encoding mode'), _('MODE')), | |
50 | ('', 'traceback', None, _('always print a traceback on exception')), |
|
50 | ('', 'traceback', None, _('always print a traceback on exception')), | |
51 | ('', 'time', None, _('time how long the command takes')), |
|
51 | ('', 'time', None, _('time how long the command takes')), | |
52 | ('', 'profile', None, _('print command execution profile')), |
|
52 | ('', 'profile', None, _('print command execution profile')), | |
53 | ('', 'version', None, _('output version information and exit')), |
|
53 | ('', 'version', None, _('output version information and exit')), | |
54 | ('h', 'help', None, _('display help and exit')), |
|
54 | ('h', 'help', None, _('display help and exit')), | |
55 | ('', 'hidden', False, _('consider hidden changesets')), |
|
55 | ('', 'hidden', False, _('consider hidden changesets')), | |
56 | ] |
|
56 | ] | |
57 |
|
57 | |||
58 | dryrunopts = [('n', 'dry-run', None, |
|
58 | dryrunopts = [('n', 'dry-run', None, | |
59 | _('do not perform actions, just print output'))] |
|
59 | _('do not perform actions, just print output'))] | |
60 |
|
60 | |||
61 | remoteopts = [ |
|
61 | remoteopts = [ | |
62 | ('e', 'ssh', '', |
|
62 | ('e', 'ssh', '', | |
63 | _('specify ssh command to use'), _('CMD')), |
|
63 | _('specify ssh command to use'), _('CMD')), | |
64 | ('', 'remotecmd', '', |
|
64 | ('', 'remotecmd', '', | |
65 | _('specify hg command to run on the remote side'), _('CMD')), |
|
65 | _('specify hg command to run on the remote side'), _('CMD')), | |
66 | ('', 'insecure', None, |
|
66 | ('', 'insecure', None, | |
67 | _('do not verify server certificate (ignoring web.cacerts config)')), |
|
67 | _('do not verify server certificate (ignoring web.cacerts config)')), | |
68 | ] |
|
68 | ] | |
69 |
|
69 | |||
70 | walkopts = [ |
|
70 | walkopts = [ | |
71 | ('I', 'include', [], |
|
71 | ('I', 'include', [], | |
72 | _('include names matching the given patterns'), _('PATTERN')), |
|
72 | _('include names matching the given patterns'), _('PATTERN')), | |
73 | ('X', 'exclude', [], |
|
73 | ('X', 'exclude', [], | |
74 | _('exclude names matching the given patterns'), _('PATTERN')), |
|
74 | _('exclude names matching the given patterns'), _('PATTERN')), | |
75 | ] |
|
75 | ] | |
76 |
|
76 | |||
77 | commitopts = [ |
|
77 | commitopts = [ | |
78 | ('m', 'message', '', |
|
78 | ('m', 'message', '', | |
79 | _('use text as commit message'), _('TEXT')), |
|
79 | _('use text as commit message'), _('TEXT')), | |
80 | ('l', 'logfile', '', |
|
80 | ('l', 'logfile', '', | |
81 | _('read commit message from file'), _('FILE')), |
|
81 | _('read commit message from file'), _('FILE')), | |
82 | ] |
|
82 | ] | |
83 |
|
83 | |||
84 | commitopts2 = [ |
|
84 | commitopts2 = [ | |
85 | ('d', 'date', '', |
|
85 | ('d', 'date', '', | |
86 | _('record the specified date as commit date'), _('DATE')), |
|
86 | _('record the specified date as commit date'), _('DATE')), | |
87 | ('u', 'user', '', |
|
87 | ('u', 'user', '', | |
88 | _('record the specified user as committer'), _('USER')), |
|
88 | _('record the specified user as committer'), _('USER')), | |
89 | ] |
|
89 | ] | |
90 |
|
90 | |||
91 | templateopts = [ |
|
91 | templateopts = [ | |
92 | ('', 'style', '', |
|
92 | ('', 'style', '', | |
93 | _('display using template map file (DEPRECATED)'), _('STYLE')), |
|
93 | _('display using template map file (DEPRECATED)'), _('STYLE')), | |
94 | ('T', 'template', '', |
|
94 | ('T', 'template', '', | |
95 | _('display with template'), _('TEMPLATE')), |
|
95 | _('display with template'), _('TEMPLATE')), | |
96 | ] |
|
96 | ] | |
97 |
|
97 | |||
98 | logopts = [ |
|
98 | logopts = [ | |
99 | ('p', 'patch', None, _('show patch')), |
|
99 | ('p', 'patch', None, _('show patch')), | |
100 | ('g', 'git', None, _('use git extended diff format')), |
|
100 | ('g', 'git', None, _('use git extended diff format')), | |
101 | ('l', 'limit', '', |
|
101 | ('l', 'limit', '', | |
102 | _('limit number of changes displayed'), _('NUM')), |
|
102 | _('limit number of changes displayed'), _('NUM')), | |
103 | ('M', 'no-merges', None, _('do not show merges')), |
|
103 | ('M', 'no-merges', None, _('do not show merges')), | |
104 | ('', 'stat', None, _('output diffstat-style summary of changes')), |
|
104 | ('', 'stat', None, _('output diffstat-style summary of changes')), | |
105 | ('G', 'graph', None, _("show the revision DAG")), |
|
105 | ('G', 'graph', None, _("show the revision DAG")), | |
106 | ] + templateopts |
|
106 | ] + templateopts | |
107 |
|
107 | |||
108 | diffopts = [ |
|
108 | diffopts = [ | |
109 | ('a', 'text', None, _('treat all files as text')), |
|
109 | ('a', 'text', None, _('treat all files as text')), | |
110 | ('g', 'git', None, _('use git extended diff format')), |
|
110 | ('g', 'git', None, _('use git extended diff format')), | |
111 | ('', 'nodates', None, _('omit dates from diff headers')) |
|
111 | ('', 'nodates', None, _('omit dates from diff headers')) | |
112 | ] |
|
112 | ] | |
113 |
|
113 | |||
114 | diffwsopts = [ |
|
114 | diffwsopts = [ | |
115 | ('w', 'ignore-all-space', None, |
|
115 | ('w', 'ignore-all-space', None, | |
116 | _('ignore white space when comparing lines')), |
|
116 | _('ignore white space when comparing lines')), | |
117 | ('b', 'ignore-space-change', None, |
|
117 | ('b', 'ignore-space-change', None, | |
118 | _('ignore changes in the amount of white space')), |
|
118 | _('ignore changes in the amount of white space')), | |
119 | ('B', 'ignore-blank-lines', None, |
|
119 | ('B', 'ignore-blank-lines', None, | |
120 | _('ignore changes whose lines are all blank')), |
|
120 | _('ignore changes whose lines are all blank')), | |
121 | ] |
|
121 | ] | |
122 |
|
122 | |||
123 | diffopts2 = [ |
|
123 | diffopts2 = [ | |
124 | ('p', 'show-function', None, _('show which function each change is in')), |
|
124 | ('p', 'show-function', None, _('show which function each change is in')), | |
125 | ('', 'reverse', None, _('produce a diff that undoes the changes')), |
|
125 | ('', 'reverse', None, _('produce a diff that undoes the changes')), | |
126 | ] + diffwsopts + [ |
|
126 | ] + diffwsopts + [ | |
127 | ('U', 'unified', '', |
|
127 | ('U', 'unified', '', | |
128 | _('number of lines of context to show'), _('NUM')), |
|
128 | _('number of lines of context to show'), _('NUM')), | |
129 | ('', 'stat', None, _('output diffstat-style summary of changes')), |
|
129 | ('', 'stat', None, _('output diffstat-style summary of changes')), | |
130 | ] |
|
130 | ] | |
131 |
|
131 | |||
132 | mergetoolopts = [ |
|
132 | mergetoolopts = [ | |
133 | ('t', 'tool', '', _('specify merge tool')), |
|
133 | ('t', 'tool', '', _('specify merge tool')), | |
134 | ] |
|
134 | ] | |
135 |
|
135 | |||
136 | similarityopts = [ |
|
136 | similarityopts = [ | |
137 | ('s', 'similarity', '', |
|
137 | ('s', 'similarity', '', | |
138 | _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY')) |
|
138 | _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY')) | |
139 | ] |
|
139 | ] | |
140 |
|
140 | |||
141 | subrepoopts = [ |
|
141 | subrepoopts = [ | |
142 | ('S', 'subrepos', None, |
|
142 | ('S', 'subrepos', None, | |
143 | _('recurse into subrepositories')) |
|
143 | _('recurse into subrepositories')) | |
144 | ] |
|
144 | ] | |
145 |
|
145 | |||
146 | # Commands start here, listed alphabetically |
|
146 | # Commands start here, listed alphabetically | |
147 |
|
147 | |||
148 | @command('^add', |
|
148 | @command('^add', | |
149 | walkopts + subrepoopts + dryrunopts, |
|
149 | walkopts + subrepoopts + dryrunopts, | |
150 | _('[OPTION]... [FILE]...')) |
|
150 | _('[OPTION]... [FILE]...')) | |
151 | def add(ui, repo, *pats, **opts): |
|
151 | def add(ui, repo, *pats, **opts): | |
152 | """add the specified files on the next commit |
|
152 | """add the specified files on the next commit | |
153 |
|
153 | |||
154 | Schedule files to be version controlled and added to the |
|
154 | Schedule files to be version controlled and added to the | |
155 | repository. |
|
155 | repository. | |
156 |
|
156 | |||
157 | The files will be added to the repository at the next commit. To |
|
157 | The files will be added to the repository at the next commit. To | |
158 | undo an add before that, see :hg:`forget`. |
|
158 | undo an add before that, see :hg:`forget`. | |
159 |
|
159 | |||
160 | If no names are given, add all files to the repository. |
|
160 | If no names are given, add all files to the repository. | |
161 |
|
161 | |||
162 | .. container:: verbose |
|
162 | .. container:: verbose | |
163 |
|
163 | |||
164 | An example showing how new (unknown) files are added |
|
164 | An example showing how new (unknown) files are added | |
165 | automatically by :hg:`add`:: |
|
165 | automatically by :hg:`add`:: | |
166 |
|
166 | |||
167 | $ ls |
|
167 | $ ls | |
168 | foo.c |
|
168 | foo.c | |
169 | $ hg status |
|
169 | $ hg status | |
170 | ? foo.c |
|
170 | ? foo.c | |
171 | $ hg add |
|
171 | $ hg add | |
172 | adding foo.c |
|
172 | adding foo.c | |
173 | $ hg status |
|
173 | $ hg status | |
174 | A foo.c |
|
174 | A foo.c | |
175 |
|
175 | |||
176 | Returns 0 if all files are successfully added. |
|
176 | Returns 0 if all files are successfully added. | |
177 | """ |
|
177 | """ | |
178 |
|
178 | |||
179 | m = scmutil.match(repo[None], pats, opts) |
|
179 | m = scmutil.match(repo[None], pats, opts) | |
180 | rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'), |
|
180 | rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'), | |
181 | opts.get('subrepos'), prefix="", explicitonly=False) |
|
181 | opts.get('subrepos'), prefix="", explicitonly=False) | |
182 | return rejected and 1 or 0 |
|
182 | return rejected and 1 or 0 | |
183 |
|
183 | |||
184 | @command('addremove', |
|
184 | @command('addremove', | |
185 | similarityopts + walkopts + dryrunopts, |
|
185 | similarityopts + walkopts + dryrunopts, | |
186 | _('[OPTION]... [FILE]...')) |
|
186 | _('[OPTION]... [FILE]...')) | |
187 | def addremove(ui, repo, *pats, **opts): |
|
187 | def addremove(ui, repo, *pats, **opts): | |
188 | """add all new files, delete all missing files |
|
188 | """add all new files, delete all missing files | |
189 |
|
189 | |||
190 | Add all new files and remove all missing files from the |
|
190 | Add all new files and remove all missing files from the | |
191 | repository. |
|
191 | repository. | |
192 |
|
192 | |||
193 | New files are ignored if they match any of the patterns in |
|
193 | New files are ignored if they match any of the patterns in | |
194 | ``.hgignore``. As with add, these changes take effect at the next |
|
194 | ``.hgignore``. As with add, these changes take effect at the next | |
195 | commit. |
|
195 | commit. | |
196 |
|
196 | |||
197 | Use the -s/--similarity option to detect renamed files. This |
|
197 | Use the -s/--similarity option to detect renamed files. This | |
198 | option takes a percentage between 0 (disabled) and 100 (files must |
|
198 | option takes a percentage between 0 (disabled) and 100 (files must | |
199 | be identical) as its parameter. With a parameter greater than 0, |
|
199 | be identical) as its parameter. With a parameter greater than 0, | |
200 | this compares every removed file with every added file and records |
|
200 | this compares every removed file with every added file and records | |
201 | those similar enough as renames. Detecting renamed files this way |
|
201 | those similar enough as renames. Detecting renamed files this way | |
202 | can be expensive. After using this option, :hg:`status -C` can be |
|
202 | can be expensive. After using this option, :hg:`status -C` can be | |
203 | used to check which files were identified as moved or renamed. If |
|
203 | used to check which files were identified as moved or renamed. If | |
204 | not specified, -s/--similarity defaults to 100 and only renames of |
|
204 | not specified, -s/--similarity defaults to 100 and only renames of | |
205 | identical files are detected. |
|
205 | identical files are detected. | |
206 |
|
206 | |||
207 | Returns 0 if all files are successfully added. |
|
207 | Returns 0 if all files are successfully added. | |
208 | """ |
|
208 | """ | |
209 | try: |
|
209 | try: | |
210 | sim = float(opts.get('similarity') or 100) |
|
210 | sim = float(opts.get('similarity') or 100) | |
211 | except ValueError: |
|
211 | except ValueError: | |
212 | raise util.Abort(_('similarity must be a number')) |
|
212 | raise util.Abort(_('similarity must be a number')) | |
213 | if sim < 0 or sim > 100: |
|
213 | if sim < 0 or sim > 100: | |
214 | raise util.Abort(_('similarity must be between 0 and 100')) |
|
214 | raise util.Abort(_('similarity must be between 0 and 100')) | |
215 | return scmutil.addremove(repo, pats, opts, similarity=sim / 100.0) |
|
215 | return scmutil.addremove(repo, pats, opts, similarity=sim / 100.0) | |
216 |
|
216 | |||
217 | @command('^annotate|blame', |
|
217 | @command('^annotate|blame', | |
218 | [('r', 'rev', '', _('annotate the specified revision'), _('REV')), |
|
218 | [('r', 'rev', '', _('annotate the specified revision'), _('REV')), | |
219 | ('', 'follow', None, |
|
219 | ('', 'follow', None, | |
220 | _('follow copies/renames and list the filename (DEPRECATED)')), |
|
220 | _('follow copies/renames and list the filename (DEPRECATED)')), | |
221 | ('', 'no-follow', None, _("don't follow copies and renames")), |
|
221 | ('', 'no-follow', None, _("don't follow copies and renames")), | |
222 | ('a', 'text', None, _('treat all files as text')), |
|
222 | ('a', 'text', None, _('treat all files as text')), | |
223 | ('u', 'user', None, _('list the author (long with -v)')), |
|
223 | ('u', 'user', None, _('list the author (long with -v)')), | |
224 | ('f', 'file', None, _('list the filename')), |
|
224 | ('f', 'file', None, _('list the filename')), | |
225 | ('d', 'date', None, _('list the date (short with -q)')), |
|
225 | ('d', 'date', None, _('list the date (short with -q)')), | |
226 | ('n', 'number', None, _('list the revision number (default)')), |
|
226 | ('n', 'number', None, _('list the revision number (default)')), | |
227 | ('c', 'changeset', None, _('list the changeset')), |
|
227 | ('c', 'changeset', None, _('list the changeset')), | |
228 | ('l', 'line-number', None, _('show line number at the first appearance')) |
|
228 | ('l', 'line-number', None, _('show line number at the first appearance')) | |
229 | ] + diffwsopts + walkopts, |
|
229 | ] + diffwsopts + walkopts, | |
230 | _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')) |
|
230 | _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...')) | |
231 | def annotate(ui, repo, *pats, **opts): |
|
231 | def annotate(ui, repo, *pats, **opts): | |
232 | """show changeset information by line for each file |
|
232 | """show changeset information by line for each file | |
233 |
|
233 | |||
234 | List changes in files, showing the revision id responsible for |
|
234 | List changes in files, showing the revision id responsible for | |
235 | each line |
|
235 | each line | |
236 |
|
236 | |||
237 | This command is useful for discovering when a change was made and |
|
237 | This command is useful for discovering when a change was made and | |
238 | by whom. |
|
238 | by whom. | |
239 |
|
239 | |||
240 | Without the -a/--text option, annotate will avoid processing files |
|
240 | Without the -a/--text option, annotate will avoid processing files | |
241 | it detects as binary. With -a, annotate will annotate the file |
|
241 | it detects as binary. With -a, annotate will annotate the file | |
242 | anyway, although the results will probably be neither useful |
|
242 | anyway, although the results will probably be neither useful | |
243 | nor desirable. |
|
243 | nor desirable. | |
244 |
|
244 | |||
245 | Returns 0 on success. |
|
245 | Returns 0 on success. | |
246 | """ |
|
246 | """ | |
247 | if opts.get('follow'): |
|
247 | if opts.get('follow'): | |
248 | # --follow is deprecated and now just an alias for -f/--file |
|
248 | # --follow is deprecated and now just an alias for -f/--file | |
249 | # to mimic the behavior of Mercurial before version 1.5 |
|
249 | # to mimic the behavior of Mercurial before version 1.5 | |
250 | opts['file'] = True |
|
250 | opts['file'] = True | |
251 |
|
251 | |||
252 | datefunc = ui.quiet and util.shortdate or util.datestr |
|
252 | datefunc = ui.quiet and util.shortdate or util.datestr | |
253 | getdate = util.cachefunc(lambda x: datefunc(x[0].date())) |
|
253 | getdate = util.cachefunc(lambda x: datefunc(x[0].date())) | |
254 |
|
254 | |||
255 | if not pats: |
|
255 | if not pats: | |
256 | raise util.Abort(_('at least one filename or pattern is required')) |
|
256 | raise util.Abort(_('at least one filename or pattern is required')) | |
257 |
|
257 | |||
258 | hexfn = ui.debugflag and hex or short |
|
258 | hexfn = ui.debugflag and hex or short | |
259 |
|
259 | |||
260 | opmap = [('user', ' ', lambda x: ui.shortuser(x[0].user())), |
|
260 | opmap = [('user', ' ', lambda x: ui.shortuser(x[0].user())), | |
261 | ('number', ' ', lambda x: str(x[0].rev())), |
|
261 | ('number', ' ', lambda x: str(x[0].rev())), | |
262 | ('changeset', ' ', lambda x: hexfn(x[0].node())), |
|
262 | ('changeset', ' ', lambda x: hexfn(x[0].node())), | |
263 | ('date', ' ', getdate), |
|
263 | ('date', ' ', getdate), | |
264 | ('file', ' ', lambda x: x[0].path()), |
|
264 | ('file', ' ', lambda x: x[0].path()), | |
265 | ('line_number', ':', lambda x: str(x[1])), |
|
265 | ('line_number', ':', lambda x: str(x[1])), | |
266 | ] |
|
266 | ] | |
267 |
|
267 | |||
268 | if (not opts.get('user') and not opts.get('changeset') |
|
268 | if (not opts.get('user') and not opts.get('changeset') | |
269 | and not opts.get('date') and not opts.get('file')): |
|
269 | and not opts.get('date') and not opts.get('file')): | |
270 | opts['number'] = True |
|
270 | opts['number'] = True | |
271 |
|
271 | |||
272 | linenumber = opts.get('line_number') is not None |
|
272 | linenumber = opts.get('line_number') is not None | |
273 | if linenumber and (not opts.get('changeset')) and (not opts.get('number')): |
|
273 | if linenumber and (not opts.get('changeset')) and (not opts.get('number')): | |
274 | raise util.Abort(_('at least one of -n/-c is required for -l')) |
|
274 | raise util.Abort(_('at least one of -n/-c is required for -l')) | |
275 |
|
275 | |||
276 | funcmap = [(func, sep) for op, sep, func in opmap if opts.get(op)] |
|
276 | funcmap = [(func, sep) for op, sep, func in opmap if opts.get(op)] | |
277 | funcmap[0] = (funcmap[0][0], '') # no separator in front of first column |
|
277 | funcmap[0] = (funcmap[0][0], '') # no separator in front of first column | |
278 |
|
278 | |||
279 | def bad(x, y): |
|
279 | def bad(x, y): | |
280 | raise util.Abort("%s: %s" % (x, y)) |
|
280 | raise util.Abort("%s: %s" % (x, y)) | |
281 |
|
281 | |||
282 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
282 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
283 | m = scmutil.match(ctx, pats, opts) |
|
283 | m = scmutil.match(ctx, pats, opts) | |
284 | m.bad = bad |
|
284 | m.bad = bad | |
285 | follow = not opts.get('no_follow') |
|
285 | follow = not opts.get('no_follow') | |
286 | diffopts = patch.diffopts(ui, opts, section='annotate') |
|
286 | diffopts = patch.diffopts(ui, opts, section='annotate') | |
287 | for abs in ctx.walk(m): |
|
287 | for abs in ctx.walk(m): | |
288 | fctx = ctx[abs] |
|
288 | fctx = ctx[abs] | |
289 | if not opts.get('text') and util.binary(fctx.data()): |
|
289 | if not opts.get('text') and util.binary(fctx.data()): | |
290 | ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) |
|
290 | ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) | |
291 | continue |
|
291 | continue | |
292 |
|
292 | |||
293 | lines = fctx.annotate(follow=follow, linenumber=linenumber, |
|
293 | lines = fctx.annotate(follow=follow, linenumber=linenumber, | |
294 | diffopts=diffopts) |
|
294 | diffopts=diffopts) | |
295 | pieces = [] |
|
295 | pieces = [] | |
296 |
|
296 | |||
297 | for f, sep in funcmap: |
|
297 | for f, sep in funcmap: | |
298 | l = [f(n) for n, dummy in lines] |
|
298 | l = [f(n) for n, dummy in lines] | |
299 | if l: |
|
299 | if l: | |
300 | sized = [(x, encoding.colwidth(x)) for x in l] |
|
300 | sized = [(x, encoding.colwidth(x)) for x in l] | |
301 | ml = max([w for x, w in sized]) |
|
301 | ml = max([w for x, w in sized]) | |
302 | pieces.append(["%s%s%s" % (sep, ' ' * (ml - w), x) |
|
302 | pieces.append(["%s%s%s" % (sep, ' ' * (ml - w), x) | |
303 | for x, w in sized]) |
|
303 | for x, w in sized]) | |
304 |
|
304 | |||
305 | if pieces: |
|
305 | if pieces: | |
306 | for p, l in zip(zip(*pieces), lines): |
|
306 | for p, l in zip(zip(*pieces), lines): | |
307 | ui.write("%s: %s" % ("".join(p), l[1])) |
|
307 | ui.write("%s: %s" % ("".join(p), l[1])) | |
308 |
|
308 | |||
309 | if lines and not lines[-1][1].endswith('\n'): |
|
309 | if lines and not lines[-1][1].endswith('\n'): | |
310 | ui.write('\n') |
|
310 | ui.write('\n') | |
311 |
|
311 | |||
312 | @command('archive', |
|
312 | @command('archive', | |
313 | [('', 'no-decode', None, _('do not pass files through decoders')), |
|
313 | [('', 'no-decode', None, _('do not pass files through decoders')), | |
314 | ('p', 'prefix', '', _('directory prefix for files in archive'), |
|
314 | ('p', 'prefix', '', _('directory prefix for files in archive'), | |
315 | _('PREFIX')), |
|
315 | _('PREFIX')), | |
316 | ('r', 'rev', '', _('revision to distribute'), _('REV')), |
|
316 | ('r', 'rev', '', _('revision to distribute'), _('REV')), | |
317 | ('t', 'type', '', _('type of distribution to create'), _('TYPE')), |
|
317 | ('t', 'type', '', _('type of distribution to create'), _('TYPE')), | |
318 | ] + subrepoopts + walkopts, |
|
318 | ] + subrepoopts + walkopts, | |
319 | _('[OPTION]... DEST')) |
|
319 | _('[OPTION]... DEST')) | |
320 | def archive(ui, repo, dest, **opts): |
|
320 | def archive(ui, repo, dest, **opts): | |
321 | '''create an unversioned archive of a repository revision |
|
321 | '''create an unversioned archive of a repository revision | |
322 |
|
322 | |||
323 | By default, the revision used is the parent of the working |
|
323 | By default, the revision used is the parent of the working | |
324 | directory; use -r/--rev to specify a different revision. |
|
324 | directory; use -r/--rev to specify a different revision. | |
325 |
|
325 | |||
326 | The archive type is automatically detected based on file |
|
326 | The archive type is automatically detected based on file | |
327 | extension (or override using -t/--type). |
|
327 | extension (or override using -t/--type). | |
328 |
|
328 | |||
329 | .. container:: verbose |
|
329 | .. container:: verbose | |
330 |
|
330 | |||
331 | Examples: |
|
331 | Examples: | |
332 |
|
332 | |||
333 | - create a zip file containing the 1.0 release:: |
|
333 | - create a zip file containing the 1.0 release:: | |
334 |
|
334 | |||
335 | hg archive -r 1.0 project-1.0.zip |
|
335 | hg archive -r 1.0 project-1.0.zip | |
336 |
|
336 | |||
337 | - create a tarball excluding .hg files:: |
|
337 | - create a tarball excluding .hg files:: | |
338 |
|
338 | |||
339 | hg archive project.tar.gz -X ".hg*" |
|
339 | hg archive project.tar.gz -X ".hg*" | |
340 |
|
340 | |||
341 | Valid types are: |
|
341 | Valid types are: | |
342 |
|
342 | |||
343 | :``files``: a directory full of files (default) |
|
343 | :``files``: a directory full of files (default) | |
344 | :``tar``: tar archive, uncompressed |
|
344 | :``tar``: tar archive, uncompressed | |
345 | :``tbz2``: tar archive, compressed using bzip2 |
|
345 | :``tbz2``: tar archive, compressed using bzip2 | |
346 | :``tgz``: tar archive, compressed using gzip |
|
346 | :``tgz``: tar archive, compressed using gzip | |
347 | :``uzip``: zip archive, uncompressed |
|
347 | :``uzip``: zip archive, uncompressed | |
348 | :``zip``: zip archive, compressed using deflate |
|
348 | :``zip``: zip archive, compressed using deflate | |
349 |
|
349 | |||
350 | The exact name of the destination archive or directory is given |
|
350 | The exact name of the destination archive or directory is given | |
351 | using a format string; see :hg:`help export` for details. |
|
351 | using a format string; see :hg:`help export` for details. | |
352 |
|
352 | |||
353 | Each member added to an archive file has a directory prefix |
|
353 | Each member added to an archive file has a directory prefix | |
354 | prepended. Use -p/--prefix to specify a format string for the |
|
354 | prepended. Use -p/--prefix to specify a format string for the | |
355 | prefix. The default is the basename of the archive, with suffixes |
|
355 | prefix. The default is the basename of the archive, with suffixes | |
356 | removed. |
|
356 | removed. | |
357 |
|
357 | |||
358 | Returns 0 on success. |
|
358 | Returns 0 on success. | |
359 | ''' |
|
359 | ''' | |
360 |
|
360 | |||
361 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
361 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
362 | if not ctx: |
|
362 | if not ctx: | |
363 | raise util.Abort(_('no working directory: please specify a revision')) |
|
363 | raise util.Abort(_('no working directory: please specify a revision')) | |
364 | node = ctx.node() |
|
364 | node = ctx.node() | |
365 | dest = cmdutil.makefilename(repo, dest, node) |
|
365 | dest = cmdutil.makefilename(repo, dest, node) | |
366 | if os.path.realpath(dest) == repo.root: |
|
366 | if os.path.realpath(dest) == repo.root: | |
367 | raise util.Abort(_('repository root cannot be destination')) |
|
367 | raise util.Abort(_('repository root cannot be destination')) | |
368 |
|
368 | |||
369 | kind = opts.get('type') or archival.guesskind(dest) or 'files' |
|
369 | kind = opts.get('type') or archival.guesskind(dest) or 'files' | |
370 | prefix = opts.get('prefix') |
|
370 | prefix = opts.get('prefix') | |
371 |
|
371 | |||
372 | if dest == '-': |
|
372 | if dest == '-': | |
373 | if kind == 'files': |
|
373 | if kind == 'files': | |
374 | raise util.Abort(_('cannot archive plain files to stdout')) |
|
374 | raise util.Abort(_('cannot archive plain files to stdout')) | |
375 | dest = cmdutil.makefileobj(repo, dest) |
|
375 | dest = cmdutil.makefileobj(repo, dest) | |
376 | if not prefix: |
|
376 | if not prefix: | |
377 | prefix = os.path.basename(repo.root) + '-%h' |
|
377 | prefix = os.path.basename(repo.root) + '-%h' | |
378 |
|
378 | |||
379 | prefix = cmdutil.makefilename(repo, prefix, node) |
|
379 | prefix = cmdutil.makefilename(repo, prefix, node) | |
380 | matchfn = scmutil.match(ctx, [], opts) |
|
380 | matchfn = scmutil.match(ctx, [], opts) | |
381 | archival.archive(repo, dest, node, kind, not opts.get('no_decode'), |
|
381 | archival.archive(repo, dest, node, kind, not opts.get('no_decode'), | |
382 | matchfn, prefix, subrepos=opts.get('subrepos')) |
|
382 | matchfn, prefix, subrepos=opts.get('subrepos')) | |
383 |
|
383 | |||
384 | @command('backout', |
|
384 | @command('backout', | |
385 | [('', 'merge', None, _('merge with old dirstate parent after backout')), |
|
385 | [('', 'merge', None, _('merge with old dirstate parent after backout')), | |
386 | ('', 'parent', '', |
|
386 | ('', 'parent', '', | |
387 | _('parent to choose when backing out merge (DEPRECATED)'), _('REV')), |
|
387 | _('parent to choose when backing out merge (DEPRECATED)'), _('REV')), | |
388 | ('r', 'rev', '', _('revision to backout'), _('REV')), |
|
388 | ('r', 'rev', '', _('revision to backout'), _('REV')), | |
389 | ('e', 'edit', False, _('invoke editor on commit messages')), |
|
389 | ('e', 'edit', False, _('invoke editor on commit messages')), | |
390 | ] + mergetoolopts + walkopts + commitopts + commitopts2, |
|
390 | ] + mergetoolopts + walkopts + commitopts + commitopts2, | |
391 | _('[OPTION]... [-r] REV')) |
|
391 | _('[OPTION]... [-r] REV')) | |
392 | def backout(ui, repo, node=None, rev=None, **opts): |
|
392 | def backout(ui, repo, node=None, rev=None, **opts): | |
393 | '''reverse effect of earlier changeset |
|
393 | '''reverse effect of earlier changeset | |
394 |
|
394 | |||
395 | Prepare a new changeset with the effect of REV undone in the |
|
395 | Prepare a new changeset with the effect of REV undone in the | |
396 | current working directory. |
|
396 | current working directory. | |
397 |
|
397 | |||
398 | If REV is the parent of the working directory, then this new changeset |
|
398 | If REV is the parent of the working directory, then this new changeset | |
399 | is committed automatically. Otherwise, hg needs to merge the |
|
399 | is committed automatically. Otherwise, hg needs to merge the | |
400 | changes and the merged result is left uncommitted. |
|
400 | changes and the merged result is left uncommitted. | |
401 |
|
401 | |||
402 | .. note:: |
|
402 | .. note:: | |
403 |
|
403 | |||
404 | backout cannot be used to fix either an unwanted or |
|
404 | backout cannot be used to fix either an unwanted or | |
405 | incorrect merge. |
|
405 | incorrect merge. | |
406 |
|
406 | |||
407 | .. container:: verbose |
|
407 | .. container:: verbose | |
408 |
|
408 | |||
409 | By default, the pending changeset will have one parent, |
|
409 | By default, the pending changeset will have one parent, | |
410 | maintaining a linear history. With --merge, the pending |
|
410 | maintaining a linear history. With --merge, the pending | |
411 | changeset will instead have two parents: the old parent of the |
|
411 | changeset will instead have two parents: the old parent of the | |
412 | working directory and a new child of REV that simply undoes REV. |
|
412 | working directory and a new child of REV that simply undoes REV. | |
413 |
|
413 | |||
414 | Before version 1.7, the behavior without --merge was equivalent |
|
414 | Before version 1.7, the behavior without --merge was equivalent | |
415 | to specifying --merge followed by :hg:`update --clean .` to |
|
415 | to specifying --merge followed by :hg:`update --clean .` to | |
416 | cancel the merge and leave the child of REV as a head to be |
|
416 | cancel the merge and leave the child of REV as a head to be | |
417 | merged separately. |
|
417 | merged separately. | |
418 |
|
418 | |||
419 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
419 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
420 |
|
420 | |||
421 | Returns 0 on success, 1 if nothing to backout or there are unresolved |
|
421 | Returns 0 on success, 1 if nothing to backout or there are unresolved | |
422 | files. |
|
422 | files. | |
423 | ''' |
|
423 | ''' | |
424 | if rev and node: |
|
424 | if rev and node: | |
425 | raise util.Abort(_("please specify just one revision")) |
|
425 | raise util.Abort(_("please specify just one revision")) | |
426 |
|
426 | |||
427 | if not rev: |
|
427 | if not rev: | |
428 | rev = node |
|
428 | rev = node | |
429 |
|
429 | |||
430 | if not rev: |
|
430 | if not rev: | |
431 | raise util.Abort(_("please specify a revision to backout")) |
|
431 | raise util.Abort(_("please specify a revision to backout")) | |
432 |
|
432 | |||
433 | date = opts.get('date') |
|
433 | date = opts.get('date') | |
434 | if date: |
|
434 | if date: | |
435 | opts['date'] = util.parsedate(date) |
|
435 | opts['date'] = util.parsedate(date) | |
436 |
|
436 | |||
437 | cmdutil.checkunfinished(repo) |
|
437 | cmdutil.checkunfinished(repo) | |
438 | cmdutil.bailifchanged(repo) |
|
438 | cmdutil.bailifchanged(repo) | |
439 | node = scmutil.revsingle(repo, rev).node() |
|
439 | node = scmutil.revsingle(repo, rev).node() | |
440 |
|
440 | |||
441 | op1, op2 = repo.dirstate.parents() |
|
441 | op1, op2 = repo.dirstate.parents() | |
442 | if node not in repo.changelog.commonancestorsheads(op1, node): |
|
442 | if node not in repo.changelog.commonancestorsheads(op1, node): | |
443 | raise util.Abort(_('cannot backout change that is not an ancestor')) |
|
443 | raise util.Abort(_('cannot backout change that is not an ancestor')) | |
444 |
|
444 | |||
445 | p1, p2 = repo.changelog.parents(node) |
|
445 | p1, p2 = repo.changelog.parents(node) | |
446 | if p1 == nullid: |
|
446 | if p1 == nullid: | |
447 | raise util.Abort(_('cannot backout a change with no parents')) |
|
447 | raise util.Abort(_('cannot backout a change with no parents')) | |
448 | if p2 != nullid: |
|
448 | if p2 != nullid: | |
449 | if not opts.get('parent'): |
|
449 | if not opts.get('parent'): | |
450 | raise util.Abort(_('cannot backout a merge changeset')) |
|
450 | raise util.Abort(_('cannot backout a merge changeset')) | |
451 | p = repo.lookup(opts['parent']) |
|
451 | p = repo.lookup(opts['parent']) | |
452 | if p not in (p1, p2): |
|
452 | if p not in (p1, p2): | |
453 | raise util.Abort(_('%s is not a parent of %s') % |
|
453 | raise util.Abort(_('%s is not a parent of %s') % | |
454 | (short(p), short(node))) |
|
454 | (short(p), short(node))) | |
455 | parent = p |
|
455 | parent = p | |
456 | else: |
|
456 | else: | |
457 | if opts.get('parent'): |
|
457 | if opts.get('parent'): | |
458 | raise util.Abort(_('cannot use --parent on non-merge changeset')) |
|
458 | raise util.Abort(_('cannot use --parent on non-merge changeset')) | |
459 | parent = p1 |
|
459 | parent = p1 | |
460 |
|
460 | |||
461 | # the backout should appear on the same branch |
|
461 | # the backout should appear on the same branch | |
462 | wlock = repo.wlock() |
|
462 | wlock = repo.wlock() | |
463 | try: |
|
463 | try: | |
464 | branch = repo.dirstate.branch() |
|
464 | branch = repo.dirstate.branch() | |
465 | bheads = repo.branchheads(branch) |
|
465 | bheads = repo.branchheads(branch) | |
466 | rctx = scmutil.revsingle(repo, hex(parent)) |
|
466 | rctx = scmutil.revsingle(repo, hex(parent)) | |
467 | if not opts.get('merge') and op1 != node: |
|
467 | if not opts.get('merge') and op1 != node: | |
468 | try: |
|
468 | try: | |
469 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
469 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
470 | 'backout') |
|
470 | 'backout') | |
471 | stats = mergemod.update(repo, parent, True, True, False, |
|
471 | stats = mergemod.update(repo, parent, True, True, False, | |
472 | node, False) |
|
472 | node, False) | |
473 | repo.setparents(op1, op2) |
|
473 | repo.setparents(op1, op2) | |
474 | hg._showstats(repo, stats) |
|
474 | hg._showstats(repo, stats) | |
475 | if stats[3]: |
|
475 | if stats[3]: | |
476 | repo.ui.status(_("use 'hg resolve' to retry unresolved " |
|
476 | repo.ui.status(_("use 'hg resolve' to retry unresolved " | |
477 | "file merges\n")) |
|
477 | "file merges\n")) | |
478 | else: |
|
478 | else: | |
479 | msg = _("changeset %s backed out, " |
|
479 | msg = _("changeset %s backed out, " | |
480 | "don't forget to commit.\n") |
|
480 | "don't forget to commit.\n") | |
481 | ui.status(msg % short(node)) |
|
481 | ui.status(msg % short(node)) | |
482 | return stats[3] > 0 |
|
482 | return stats[3] > 0 | |
483 | finally: |
|
483 | finally: | |
484 | ui.setconfig('ui', 'forcemerge', '', '') |
|
484 | ui.setconfig('ui', 'forcemerge', '', '') | |
485 | else: |
|
485 | else: | |
486 | hg.clean(repo, node, show_stats=False) |
|
486 | hg.clean(repo, node, show_stats=False) | |
487 | repo.dirstate.setbranch(branch) |
|
487 | repo.dirstate.setbranch(branch) | |
488 | cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) |
|
488 | cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) | |
489 |
|
489 | |||
490 |
|
490 | |||
491 | def commitfunc(ui, repo, message, match, opts): |
|
491 | def commitfunc(ui, repo, message, match, opts): | |
492 | e = cmdutil.getcommiteditor(**opts) |
|
492 | e = cmdutil.getcommiteditor(**opts) | |
493 | if not message: |
|
493 | if not message: | |
494 | # we don't translate commit messages |
|
494 | # we don't translate commit messages | |
495 | message = "Backed out changeset %s" % short(node) |
|
495 | message = "Backed out changeset %s" % short(node) | |
496 | e = cmdutil.getcommiteditor(edit=True) |
|
496 | e = cmdutil.getcommiteditor(edit=True) | |
497 | return repo.commit(message, opts.get('user'), opts.get('date'), |
|
497 | return repo.commit(message, opts.get('user'), opts.get('date'), | |
498 | match, editor=e) |
|
498 | match, editor=e) | |
499 | newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) |
|
499 | newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) | |
500 | if not newnode: |
|
500 | if not newnode: | |
501 | ui.status(_("nothing changed\n")) |
|
501 | ui.status(_("nothing changed\n")) | |
502 | return 1 |
|
502 | return 1 | |
503 | cmdutil.commitstatus(repo, newnode, branch, bheads) |
|
503 | cmdutil.commitstatus(repo, newnode, branch, bheads) | |
504 |
|
504 | |||
505 | def nice(node): |
|
505 | def nice(node): | |
506 | return '%d:%s' % (repo.changelog.rev(node), short(node)) |
|
506 | return '%d:%s' % (repo.changelog.rev(node), short(node)) | |
507 | ui.status(_('changeset %s backs out changeset %s\n') % |
|
507 | ui.status(_('changeset %s backs out changeset %s\n') % | |
508 | (nice(repo.changelog.tip()), nice(node))) |
|
508 | (nice(repo.changelog.tip()), nice(node))) | |
509 | if opts.get('merge') and op1 != node: |
|
509 | if opts.get('merge') and op1 != node: | |
510 | hg.clean(repo, op1, show_stats=False) |
|
510 | hg.clean(repo, op1, show_stats=False) | |
511 | ui.status(_('merging with changeset %s\n') |
|
511 | ui.status(_('merging with changeset %s\n') | |
512 | % nice(repo.changelog.tip())) |
|
512 | % nice(repo.changelog.tip())) | |
513 | try: |
|
513 | try: | |
514 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
514 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
515 | 'backout') |
|
515 | 'backout') | |
516 | return hg.merge(repo, hex(repo.changelog.tip())) |
|
516 | return hg.merge(repo, hex(repo.changelog.tip())) | |
517 | finally: |
|
517 | finally: | |
518 | ui.setconfig('ui', 'forcemerge', '', '') |
|
518 | ui.setconfig('ui', 'forcemerge', '', '') | |
519 | finally: |
|
519 | finally: | |
520 | wlock.release() |
|
520 | wlock.release() | |
521 | return 0 |
|
521 | return 0 | |
522 |
|
522 | |||
523 | @command('bisect', |
|
523 | @command('bisect', | |
524 | [('r', 'reset', False, _('reset bisect state')), |
|
524 | [('r', 'reset', False, _('reset bisect state')), | |
525 | ('g', 'good', False, _('mark changeset good')), |
|
525 | ('g', 'good', False, _('mark changeset good')), | |
526 | ('b', 'bad', False, _('mark changeset bad')), |
|
526 | ('b', 'bad', False, _('mark changeset bad')), | |
527 | ('s', 'skip', False, _('skip testing changeset')), |
|
527 | ('s', 'skip', False, _('skip testing changeset')), | |
528 | ('e', 'extend', False, _('extend the bisect range')), |
|
528 | ('e', 'extend', False, _('extend the bisect range')), | |
529 | ('c', 'command', '', _('use command to check changeset state'), _('CMD')), |
|
529 | ('c', 'command', '', _('use command to check changeset state'), _('CMD')), | |
530 | ('U', 'noupdate', False, _('do not update to target'))], |
|
530 | ('U', 'noupdate', False, _('do not update to target'))], | |
531 | _("[-gbsr] [-U] [-c CMD] [REV]")) |
|
531 | _("[-gbsr] [-U] [-c CMD] [REV]")) | |
532 | def bisect(ui, repo, rev=None, extra=None, command=None, |
|
532 | def bisect(ui, repo, rev=None, extra=None, command=None, | |
533 | reset=None, good=None, bad=None, skip=None, extend=None, |
|
533 | reset=None, good=None, bad=None, skip=None, extend=None, | |
534 | noupdate=None): |
|
534 | noupdate=None): | |
535 | """subdivision search of changesets |
|
535 | """subdivision search of changesets | |
536 |
|
536 | |||
537 | This command helps to find changesets which introduce problems. To |
|
537 | This command helps to find changesets which introduce problems. To | |
538 | use, mark the earliest changeset you know exhibits the problem as |
|
538 | use, mark the earliest changeset you know exhibits the problem as | |
539 | bad, then mark the latest changeset which is free from the problem |
|
539 | bad, then mark the latest changeset which is free from the problem | |
540 | as good. Bisect will update your working directory to a revision |
|
540 | as good. Bisect will update your working directory to a revision | |
541 | for testing (unless the -U/--noupdate option is specified). Once |
|
541 | for testing (unless the -U/--noupdate option is specified). Once | |
542 | you have performed tests, mark the working directory as good or |
|
542 | you have performed tests, mark the working directory as good or | |
543 | bad, and bisect will either update to another candidate changeset |
|
543 | bad, and bisect will either update to another candidate changeset | |
544 | or announce that it has found the bad revision. |
|
544 | or announce that it has found the bad revision. | |
545 |
|
545 | |||
546 | As a shortcut, you can also use the revision argument to mark a |
|
546 | As a shortcut, you can also use the revision argument to mark a | |
547 | revision as good or bad without checking it out first. |
|
547 | revision as good or bad without checking it out first. | |
548 |
|
548 | |||
549 | If you supply a command, it will be used for automatic bisection. |
|
549 | If you supply a command, it will be used for automatic bisection. | |
550 | The environment variable HG_NODE will contain the ID of the |
|
550 | The environment variable HG_NODE will contain the ID of the | |
551 | changeset being tested. The exit status of the command will be |
|
551 | changeset being tested. The exit status of the command will be | |
552 | used to mark revisions as good or bad: status 0 means good, 125 |
|
552 | used to mark revisions as good or bad: status 0 means good, 125 | |
553 | means to skip the revision, 127 (command not found) will abort the |
|
553 | means to skip the revision, 127 (command not found) will abort the | |
554 | bisection, and any other non-zero exit status means the revision |
|
554 | bisection, and any other non-zero exit status means the revision | |
555 | is bad. |
|
555 | is bad. | |
556 |
|
556 | |||
557 | .. container:: verbose |
|
557 | .. container:: verbose | |
558 |
|
558 | |||
559 | Some examples: |
|
559 | Some examples: | |
560 |
|
560 | |||
561 | - start a bisection with known bad revision 34, and good revision 12:: |
|
561 | - start a bisection with known bad revision 34, and good revision 12:: | |
562 |
|
562 | |||
563 | hg bisect --bad 34 |
|
563 | hg bisect --bad 34 | |
564 | hg bisect --good 12 |
|
564 | hg bisect --good 12 | |
565 |
|
565 | |||
566 | - advance the current bisection by marking current revision as good or |
|
566 | - advance the current bisection by marking current revision as good or | |
567 | bad:: |
|
567 | bad:: | |
568 |
|
568 | |||
569 | hg bisect --good |
|
569 | hg bisect --good | |
570 | hg bisect --bad |
|
570 | hg bisect --bad | |
571 |
|
571 | |||
572 | - mark the current revision, or a known revision, to be skipped (e.g. if |
|
572 | - mark the current revision, or a known revision, to be skipped (e.g. if | |
573 | that revision is not usable because of another issue):: |
|
573 | that revision is not usable because of another issue):: | |
574 |
|
574 | |||
575 | hg bisect --skip |
|
575 | hg bisect --skip | |
576 | hg bisect --skip 23 |
|
576 | hg bisect --skip 23 | |
577 |
|
577 | |||
578 | - skip all revisions that do not touch directories ``foo`` or ``bar``:: |
|
578 | - skip all revisions that do not touch directories ``foo`` or ``bar``:: | |
579 |
|
579 | |||
580 | hg bisect --skip "!( file('path:foo') & file('path:bar') )" |
|
580 | hg bisect --skip "!( file('path:foo') & file('path:bar') )" | |
581 |
|
581 | |||
582 | - forget the current bisection:: |
|
582 | - forget the current bisection:: | |
583 |
|
583 | |||
584 | hg bisect --reset |
|
584 | hg bisect --reset | |
585 |
|
585 | |||
586 | - use 'make && make tests' to automatically find the first broken |
|
586 | - use 'make && make tests' to automatically find the first broken | |
587 | revision:: |
|
587 | revision:: | |
588 |
|
588 | |||
589 | hg bisect --reset |
|
589 | hg bisect --reset | |
590 | hg bisect --bad 34 |
|
590 | hg bisect --bad 34 | |
591 | hg bisect --good 12 |
|
591 | hg bisect --good 12 | |
592 | hg bisect --command "make && make tests" |
|
592 | hg bisect --command "make && make tests" | |
593 |
|
593 | |||
594 | - see all changesets whose states are already known in the current |
|
594 | - see all changesets whose states are already known in the current | |
595 | bisection:: |
|
595 | bisection:: | |
596 |
|
596 | |||
597 | hg log -r "bisect(pruned)" |
|
597 | hg log -r "bisect(pruned)" | |
598 |
|
598 | |||
599 | - see the changeset currently being bisected (especially useful |
|
599 | - see the changeset currently being bisected (especially useful | |
600 | if running with -U/--noupdate):: |
|
600 | if running with -U/--noupdate):: | |
601 |
|
601 | |||
602 | hg log -r "bisect(current)" |
|
602 | hg log -r "bisect(current)" | |
603 |
|
603 | |||
604 | - see all changesets that took part in the current bisection:: |
|
604 | - see all changesets that took part in the current bisection:: | |
605 |
|
605 | |||
606 | hg log -r "bisect(range)" |
|
606 | hg log -r "bisect(range)" | |
607 |
|
607 | |||
608 | - you can even get a nice graph:: |
|
608 | - you can even get a nice graph:: | |
609 |
|
609 | |||
610 | hg log --graph -r "bisect(range)" |
|
610 | hg log --graph -r "bisect(range)" | |
611 |
|
611 | |||
612 | See :hg:`help revsets` for more about the `bisect()` keyword. |
|
612 | See :hg:`help revsets` for more about the `bisect()` keyword. | |
613 |
|
613 | |||
614 | Returns 0 on success. |
|
614 | Returns 0 on success. | |
615 | """ |
|
615 | """ | |
616 | def extendbisectrange(nodes, good): |
|
616 | def extendbisectrange(nodes, good): | |
617 | # bisect is incomplete when it ends on a merge node and |
|
617 | # bisect is incomplete when it ends on a merge node and | |
618 | # one of the parent was not checked. |
|
618 | # one of the parent was not checked. | |
619 | parents = repo[nodes[0]].parents() |
|
619 | parents = repo[nodes[0]].parents() | |
620 | if len(parents) > 1: |
|
620 | if len(parents) > 1: | |
621 | side = good and state['bad'] or state['good'] |
|
621 | side = good and state['bad'] or state['good'] | |
622 | num = len(set(i.node() for i in parents) & set(side)) |
|
622 | num = len(set(i.node() for i in parents) & set(side)) | |
623 | if num == 1: |
|
623 | if num == 1: | |
624 | return parents[0].ancestor(parents[1]) |
|
624 | return parents[0].ancestor(parents[1]) | |
625 | return None |
|
625 | return None | |
626 |
|
626 | |||
627 | def print_result(nodes, good): |
|
627 | def print_result(nodes, good): | |
628 | displayer = cmdutil.show_changeset(ui, repo, {}) |
|
628 | displayer = cmdutil.show_changeset(ui, repo, {}) | |
629 | if len(nodes) == 1: |
|
629 | if len(nodes) == 1: | |
630 | # narrowed it down to a single revision |
|
630 | # narrowed it down to a single revision | |
631 | if good: |
|
631 | if good: | |
632 | ui.write(_("The first good revision is:\n")) |
|
632 | ui.write(_("The first good revision is:\n")) | |
633 | else: |
|
633 | else: | |
634 | ui.write(_("The first bad revision is:\n")) |
|
634 | ui.write(_("The first bad revision is:\n")) | |
635 | displayer.show(repo[nodes[0]]) |
|
635 | displayer.show(repo[nodes[0]]) | |
636 | extendnode = extendbisectrange(nodes, good) |
|
636 | extendnode = extendbisectrange(nodes, good) | |
637 | if extendnode is not None: |
|
637 | if extendnode is not None: | |
638 | ui.write(_('Not all ancestors of this changeset have been' |
|
638 | ui.write(_('Not all ancestors of this changeset have been' | |
639 | ' checked.\nUse bisect --extend to continue the ' |
|
639 | ' checked.\nUse bisect --extend to continue the ' | |
640 | 'bisection from\nthe common ancestor, %s.\n') |
|
640 | 'bisection from\nthe common ancestor, %s.\n') | |
641 | % extendnode) |
|
641 | % extendnode) | |
642 | else: |
|
642 | else: | |
643 | # multiple possible revisions |
|
643 | # multiple possible revisions | |
644 | if good: |
|
644 | if good: | |
645 | ui.write(_("Due to skipped revisions, the first " |
|
645 | ui.write(_("Due to skipped revisions, the first " | |
646 | "good revision could be any of:\n")) |
|
646 | "good revision could be any of:\n")) | |
647 | else: |
|
647 | else: | |
648 | ui.write(_("Due to skipped revisions, the first " |
|
648 | ui.write(_("Due to skipped revisions, the first " | |
649 | "bad revision could be any of:\n")) |
|
649 | "bad revision could be any of:\n")) | |
650 | for n in nodes: |
|
650 | for n in nodes: | |
651 | displayer.show(repo[n]) |
|
651 | displayer.show(repo[n]) | |
652 | displayer.close() |
|
652 | displayer.close() | |
653 |
|
653 | |||
654 | def check_state(state, interactive=True): |
|
654 | def check_state(state, interactive=True): | |
655 | if not state['good'] or not state['bad']: |
|
655 | if not state['good'] or not state['bad']: | |
656 | if (good or bad or skip or reset) and interactive: |
|
656 | if (good or bad or skip or reset) and interactive: | |
657 | return |
|
657 | return | |
658 | if not state['good']: |
|
658 | if not state['good']: | |
659 | raise util.Abort(_('cannot bisect (no known good revisions)')) |
|
659 | raise util.Abort(_('cannot bisect (no known good revisions)')) | |
660 | else: |
|
660 | else: | |
661 | raise util.Abort(_('cannot bisect (no known bad revisions)')) |
|
661 | raise util.Abort(_('cannot bisect (no known bad revisions)')) | |
662 | return True |
|
662 | return True | |
663 |
|
663 | |||
664 | # backward compatibility |
|
664 | # backward compatibility | |
665 | if rev in "good bad reset init".split(): |
|
665 | if rev in "good bad reset init".split(): | |
666 | ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) |
|
666 | ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) | |
667 | cmd, rev, extra = rev, extra, None |
|
667 | cmd, rev, extra = rev, extra, None | |
668 | if cmd == "good": |
|
668 | if cmd == "good": | |
669 | good = True |
|
669 | good = True | |
670 | elif cmd == "bad": |
|
670 | elif cmd == "bad": | |
671 | bad = True |
|
671 | bad = True | |
672 | else: |
|
672 | else: | |
673 | reset = True |
|
673 | reset = True | |
674 | elif extra or good + bad + skip + reset + extend + bool(command) > 1: |
|
674 | elif extra or good + bad + skip + reset + extend + bool(command) > 1: | |
675 | raise util.Abort(_('incompatible arguments')) |
|
675 | raise util.Abort(_('incompatible arguments')) | |
676 |
|
676 | |||
677 | cmdutil.checkunfinished(repo) |
|
677 | cmdutil.checkunfinished(repo) | |
678 |
|
678 | |||
679 | if reset: |
|
679 | if reset: | |
680 | p = repo.join("bisect.state") |
|
680 | p = repo.join("bisect.state") | |
681 | if os.path.exists(p): |
|
681 | if os.path.exists(p): | |
682 | os.unlink(p) |
|
682 | os.unlink(p) | |
683 | return |
|
683 | return | |
684 |
|
684 | |||
685 | state = hbisect.load_state(repo) |
|
685 | state = hbisect.load_state(repo) | |
686 |
|
686 | |||
687 | if command: |
|
687 | if command: | |
688 | changesets = 1 |
|
688 | changesets = 1 | |
689 | if noupdate: |
|
689 | if noupdate: | |
690 | try: |
|
690 | try: | |
691 | node = state['current'][0] |
|
691 | node = state['current'][0] | |
692 | except LookupError: |
|
692 | except LookupError: | |
693 | raise util.Abort(_('current bisect revision is unknown - ' |
|
693 | raise util.Abort(_('current bisect revision is unknown - ' | |
694 | 'start a new bisect to fix')) |
|
694 | 'start a new bisect to fix')) | |
695 | else: |
|
695 | else: | |
696 | node, p2 = repo.dirstate.parents() |
|
696 | node, p2 = repo.dirstate.parents() | |
697 | if p2 != nullid: |
|
697 | if p2 != nullid: | |
698 | raise util.Abort(_('current bisect revision is a merge')) |
|
698 | raise util.Abort(_('current bisect revision is a merge')) | |
699 | try: |
|
699 | try: | |
700 | while changesets: |
|
700 | while changesets: | |
701 | # update state |
|
701 | # update state | |
702 | state['current'] = [node] |
|
702 | state['current'] = [node] | |
703 | hbisect.save_state(repo, state) |
|
703 | hbisect.save_state(repo, state) | |
704 | status = util.system(command, |
|
704 | status = util.system(command, | |
705 | environ={'HG_NODE': hex(node)}, |
|
705 | environ={'HG_NODE': hex(node)}, | |
706 | out=ui.fout) |
|
706 | out=ui.fout) | |
707 | if status == 125: |
|
707 | if status == 125: | |
708 | transition = "skip" |
|
708 | transition = "skip" | |
709 | elif status == 0: |
|
709 | elif status == 0: | |
710 | transition = "good" |
|
710 | transition = "good" | |
711 | # status < 0 means process was killed |
|
711 | # status < 0 means process was killed | |
712 | elif status == 127: |
|
712 | elif status == 127: | |
713 | raise util.Abort(_("failed to execute %s") % command) |
|
713 | raise util.Abort(_("failed to execute %s") % command) | |
714 | elif status < 0: |
|
714 | elif status < 0: | |
715 | raise util.Abort(_("%s killed") % command) |
|
715 | raise util.Abort(_("%s killed") % command) | |
716 | else: |
|
716 | else: | |
717 | transition = "bad" |
|
717 | transition = "bad" | |
718 | ctx = scmutil.revsingle(repo, rev, node) |
|
718 | ctx = scmutil.revsingle(repo, rev, node) | |
719 | rev = None # clear for future iterations |
|
719 | rev = None # clear for future iterations | |
720 | state[transition].append(ctx.node()) |
|
720 | state[transition].append(ctx.node()) | |
721 | ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) |
|
721 | ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) | |
722 | check_state(state, interactive=False) |
|
722 | check_state(state, interactive=False) | |
723 | # bisect |
|
723 | # bisect | |
724 | nodes, changesets, bgood = hbisect.bisect(repo.changelog, state) |
|
724 | nodes, changesets, bgood = hbisect.bisect(repo.changelog, state) | |
725 | # update to next check |
|
725 | # update to next check | |
726 | node = nodes[0] |
|
726 | node = nodes[0] | |
727 | if not noupdate: |
|
727 | if not noupdate: | |
728 | cmdutil.bailifchanged(repo) |
|
728 | cmdutil.bailifchanged(repo) | |
729 | hg.clean(repo, node, show_stats=False) |
|
729 | hg.clean(repo, node, show_stats=False) | |
730 | finally: |
|
730 | finally: | |
731 | state['current'] = [node] |
|
731 | state['current'] = [node] | |
732 | hbisect.save_state(repo, state) |
|
732 | hbisect.save_state(repo, state) | |
733 | print_result(nodes, bgood) |
|
733 | print_result(nodes, bgood) | |
734 | return |
|
734 | return | |
735 |
|
735 | |||
736 | # update state |
|
736 | # update state | |
737 |
|
737 | |||
738 | if rev: |
|
738 | if rev: | |
739 | nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])] |
|
739 | nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])] | |
740 | else: |
|
740 | else: | |
741 | nodes = [repo.lookup('.')] |
|
741 | nodes = [repo.lookup('.')] | |
742 |
|
742 | |||
743 | if good or bad or skip: |
|
743 | if good or bad or skip: | |
744 | if good: |
|
744 | if good: | |
745 | state['good'] += nodes |
|
745 | state['good'] += nodes | |
746 | elif bad: |
|
746 | elif bad: | |
747 | state['bad'] += nodes |
|
747 | state['bad'] += nodes | |
748 | elif skip: |
|
748 | elif skip: | |
749 | state['skip'] += nodes |
|
749 | state['skip'] += nodes | |
750 | hbisect.save_state(repo, state) |
|
750 | hbisect.save_state(repo, state) | |
751 |
|
751 | |||
752 | if not check_state(state): |
|
752 | if not check_state(state): | |
753 | return |
|
753 | return | |
754 |
|
754 | |||
755 | # actually bisect |
|
755 | # actually bisect | |
756 | nodes, changesets, good = hbisect.bisect(repo.changelog, state) |
|
756 | nodes, changesets, good = hbisect.bisect(repo.changelog, state) | |
757 | if extend: |
|
757 | if extend: | |
758 | if not changesets: |
|
758 | if not changesets: | |
759 | extendnode = extendbisectrange(nodes, good) |
|
759 | extendnode = extendbisectrange(nodes, good) | |
760 | if extendnode is not None: |
|
760 | if extendnode is not None: | |
761 | ui.write(_("Extending search to changeset %d:%s\n") |
|
761 | ui.write(_("Extending search to changeset %d:%s\n") | |
762 | % (extendnode.rev(), extendnode)) |
|
762 | % (extendnode.rev(), extendnode)) | |
763 | state['current'] = [extendnode.node()] |
|
763 | state['current'] = [extendnode.node()] | |
764 | hbisect.save_state(repo, state) |
|
764 | hbisect.save_state(repo, state) | |
765 | if noupdate: |
|
765 | if noupdate: | |
766 | return |
|
766 | return | |
767 | cmdutil.bailifchanged(repo) |
|
767 | cmdutil.bailifchanged(repo) | |
768 | return hg.clean(repo, extendnode.node()) |
|
768 | return hg.clean(repo, extendnode.node()) | |
769 | raise util.Abort(_("nothing to extend")) |
|
769 | raise util.Abort(_("nothing to extend")) | |
770 |
|
770 | |||
771 | if changesets == 0: |
|
771 | if changesets == 0: | |
772 | print_result(nodes, good) |
|
772 | print_result(nodes, good) | |
773 | else: |
|
773 | else: | |
774 | assert len(nodes) == 1 # only a single node can be tested next |
|
774 | assert len(nodes) == 1 # only a single node can be tested next | |
775 | node = nodes[0] |
|
775 | node = nodes[0] | |
776 | # compute the approximate number of remaining tests |
|
776 | # compute the approximate number of remaining tests | |
777 | tests, size = 0, 2 |
|
777 | tests, size = 0, 2 | |
778 | while size <= changesets: |
|
778 | while size <= changesets: | |
779 | tests, size = tests + 1, size * 2 |
|
779 | tests, size = tests + 1, size * 2 | |
780 | rev = repo.changelog.rev(node) |
|
780 | rev = repo.changelog.rev(node) | |
781 | ui.write(_("Testing changeset %d:%s " |
|
781 | ui.write(_("Testing changeset %d:%s " | |
782 | "(%d changesets remaining, ~%d tests)\n") |
|
782 | "(%d changesets remaining, ~%d tests)\n") | |
783 | % (rev, short(node), changesets, tests)) |
|
783 | % (rev, short(node), changesets, tests)) | |
784 | state['current'] = [node] |
|
784 | state['current'] = [node] | |
785 | hbisect.save_state(repo, state) |
|
785 | hbisect.save_state(repo, state) | |
786 | if not noupdate: |
|
786 | if not noupdate: | |
787 | cmdutil.bailifchanged(repo) |
|
787 | cmdutil.bailifchanged(repo) | |
788 | return hg.clean(repo, node) |
|
788 | return hg.clean(repo, node) | |
789 |
|
789 | |||
790 | @command('bookmarks|bookmark', |
|
790 | @command('bookmarks|bookmark', | |
791 | [('f', 'force', False, _('force')), |
|
791 | [('f', 'force', False, _('force')), | |
792 | ('r', 'rev', '', _('revision'), _('REV')), |
|
792 | ('r', 'rev', '', _('revision'), _('REV')), | |
793 | ('d', 'delete', False, _('delete a given bookmark')), |
|
793 | ('d', 'delete', False, _('delete a given bookmark')), | |
794 | ('m', 'rename', '', _('rename a given bookmark'), _('NAME')), |
|
794 | ('m', 'rename', '', _('rename a given bookmark'), _('NAME')), | |
795 | ('i', 'inactive', False, _('mark a bookmark inactive'))], |
|
795 | ('i', 'inactive', False, _('mark a bookmark inactive'))], | |
796 | _('hg bookmarks [OPTIONS]... [NAME]...')) |
|
796 | _('hg bookmarks [OPTIONS]... [NAME]...')) | |
797 | def bookmark(ui, repo, *names, **opts): |
|
797 | def bookmark(ui, repo, *names, **opts): | |
798 | '''track a line of development with movable markers |
|
798 | '''create a new bookmark or list existing bookmarks | |
799 |
|
799 | |||
800 | Bookmarks are pointers to certain commits that move when committing. |
|
800 | Bookmarks are labels on changesets to help track lines of development. | |
801 |
Bookmarks are |
|
801 | Bookmarks are unversioned and can be moved, renamed and deleted. | |
802 | possible to use :hg:`merge NAME` to merge from a given bookmark, and |
|
802 | Deleting or moving a bookmark has no effect on the associated changesets. | |
803 | :hg:`update NAME` to update to a given bookmark. |
|
803 | ||
804 |
|
804 | Creating or updating to a bookmark causes it to be marked as 'active'. | ||
805 | You can use :hg:`bookmark NAME` to set a bookmark on the working |
|
805 | Active bookmarks are indicated with a '*'. | |
806 | directory's parent revision with the given name. If you specify |
|
806 | When a commit is made, an active bookmark will advance to the new commit. | |
807 | a revision using -r REV (where REV may be an existing bookmark), |
|
807 | A plain :hg:`update` will also advance an active bookmark, if possible. | |
808 | the bookmark is assigned to that revision. |
|
808 | Updating away from a bookmark will cause it to be deactivated. | |
809 |
|
809 | |||
810 |
Bookmarks can be pushed and pulled between repositories (see |
|
810 | Bookmarks can be pushed and pulled between repositories (see | |
811 | push` and :hg:`help pull`). This requires both the local and remote |
|
811 | :hg:`help push` and :hg:`help pull`). If a shared bookmark has | |
812 | repositories to support bookmarks. For versions prior to 1.8, this means |
|
812 | diverged, a new 'divergent bookmark' of the form 'name@path' will | |
813 | the bookmarks extension must be enabled. |
|
813 | be created. Using :hg:'merge' will resolve the divergence. | |
814 |
|
814 | |||
815 | If you set a bookmark called '@', new clones of the repository will |
|
815 | A bookmark named '@' has the special property that :hg:`clone` will | |
816 | have that revision checked out (and the bookmark made active) by |
|
816 | check it out by default if it exists. | |
817 | default. |
|
817 | ||
818 |
|
818 | .. container:: verbose | ||
819 | With -i/--inactive, the new bookmark will not be made the active |
|
819 | ||
820 | bookmark. If -r/--rev is given, the new bookmark will not be made |
|
820 | Examples: | |
821 | active even if -i/--inactive is not given. If no NAME is given, the |
|
821 | ||
822 | current active bookmark will be marked inactive. |
|
822 | - create an active bookmark for a new line of development:: | |
|
823 | ||||
|
824 | hg book new-feature | |||
|
825 | ||||
|
826 | - create an inactive bookmark as a place marker:: | |||
|
827 | ||||
|
828 | hg book -i reviewed | |||
|
829 | ||||
|
830 | - create an inactive bookmark on another changeset:: | |||
|
831 | ||||
|
832 | hg book -r .^ tested | |||
|
833 | ||||
|
834 | - move the '@' bookmark from another branch:: | |||
|
835 | ||||
|
836 | hg book -f @ | |||
823 | ''' |
|
837 | ''' | |
824 | force = opts.get('force') |
|
838 | force = opts.get('force') | |
825 | rev = opts.get('rev') |
|
839 | rev = opts.get('rev') | |
826 | delete = opts.get('delete') |
|
840 | delete = opts.get('delete') | |
827 | rename = opts.get('rename') |
|
841 | rename = opts.get('rename') | |
828 | inactive = opts.get('inactive') |
|
842 | inactive = opts.get('inactive') | |
829 |
|
843 | |||
830 | def checkformat(mark): |
|
844 | def checkformat(mark): | |
831 | mark = mark.strip() |
|
845 | mark = mark.strip() | |
832 | if not mark: |
|
846 | if not mark: | |
833 | raise util.Abort(_("bookmark names cannot consist entirely of " |
|
847 | raise util.Abort(_("bookmark names cannot consist entirely of " | |
834 | "whitespace")) |
|
848 | "whitespace")) | |
835 | scmutil.checknewlabel(repo, mark, 'bookmark') |
|
849 | scmutil.checknewlabel(repo, mark, 'bookmark') | |
836 | return mark |
|
850 | return mark | |
837 |
|
851 | |||
838 | def checkconflict(repo, mark, cur, force=False, target=None): |
|
852 | def checkconflict(repo, mark, cur, force=False, target=None): | |
839 | if mark in marks and not force: |
|
853 | if mark in marks and not force: | |
840 | if target: |
|
854 | if target: | |
841 | if marks[mark] == target and target == cur: |
|
855 | if marks[mark] == target and target == cur: | |
842 | # re-activating a bookmark |
|
856 | # re-activating a bookmark | |
843 | return |
|
857 | return | |
844 | anc = repo.changelog.ancestors([repo[target].rev()]) |
|
858 | anc = repo.changelog.ancestors([repo[target].rev()]) | |
845 | bmctx = repo[marks[mark]] |
|
859 | bmctx = repo[marks[mark]] | |
846 | divs = [repo[b].node() for b in marks |
|
860 | divs = [repo[b].node() for b in marks | |
847 | if b.split('@', 1)[0] == mark.split('@', 1)[0]] |
|
861 | if b.split('@', 1)[0] == mark.split('@', 1)[0]] | |
848 |
|
862 | |||
849 | # allow resolving a single divergent bookmark even if moving |
|
863 | # allow resolving a single divergent bookmark even if moving | |
850 | # the bookmark across branches when a revision is specified |
|
864 | # the bookmark across branches when a revision is specified | |
851 | # that contains a divergent bookmark |
|
865 | # that contains a divergent bookmark | |
852 | if bmctx.rev() not in anc and target in divs: |
|
866 | if bmctx.rev() not in anc and target in divs: | |
853 | bookmarks.deletedivergent(repo, [target], mark) |
|
867 | bookmarks.deletedivergent(repo, [target], mark) | |
854 | return |
|
868 | return | |
855 |
|
869 | |||
856 | deletefrom = [b for b in divs |
|
870 | deletefrom = [b for b in divs | |
857 | if repo[b].rev() in anc or b == target] |
|
871 | if repo[b].rev() in anc or b == target] | |
858 | bookmarks.deletedivergent(repo, deletefrom, mark) |
|
872 | bookmarks.deletedivergent(repo, deletefrom, mark) | |
859 | if bookmarks.validdest(repo, bmctx, repo[target]): |
|
873 | if bookmarks.validdest(repo, bmctx, repo[target]): | |
860 | ui.status(_("moving bookmark '%s' forward from %s\n") % |
|
874 | ui.status(_("moving bookmark '%s' forward from %s\n") % | |
861 | (mark, short(bmctx.node()))) |
|
875 | (mark, short(bmctx.node()))) | |
862 | return |
|
876 | return | |
863 | raise util.Abort(_("bookmark '%s' already exists " |
|
877 | raise util.Abort(_("bookmark '%s' already exists " | |
864 | "(use -f to force)") % mark) |
|
878 | "(use -f to force)") % mark) | |
865 | if ((mark in repo.branchmap() or mark == repo.dirstate.branch()) |
|
879 | if ((mark in repo.branchmap() or mark == repo.dirstate.branch()) | |
866 | and not force): |
|
880 | and not force): | |
867 | raise util.Abort( |
|
881 | raise util.Abort( | |
868 | _("a bookmark cannot have the name of an existing branch")) |
|
882 | _("a bookmark cannot have the name of an existing branch")) | |
869 |
|
883 | |||
870 | if delete and rename: |
|
884 | if delete and rename: | |
871 | raise util.Abort(_("--delete and --rename are incompatible")) |
|
885 | raise util.Abort(_("--delete and --rename are incompatible")) | |
872 | if delete and rev: |
|
886 | if delete and rev: | |
873 | raise util.Abort(_("--rev is incompatible with --delete")) |
|
887 | raise util.Abort(_("--rev is incompatible with --delete")) | |
874 | if rename and rev: |
|
888 | if rename and rev: | |
875 | raise util.Abort(_("--rev is incompatible with --rename")) |
|
889 | raise util.Abort(_("--rev is incompatible with --rename")) | |
876 | if not names and (delete or rev): |
|
890 | if not names and (delete or rev): | |
877 | raise util.Abort(_("bookmark name required")) |
|
891 | raise util.Abort(_("bookmark name required")) | |
878 |
|
892 | |||
879 | if delete or rename or names or inactive: |
|
893 | if delete or rename or names or inactive: | |
880 | wlock = repo.wlock() |
|
894 | wlock = repo.wlock() | |
881 | try: |
|
895 | try: | |
882 | cur = repo.changectx('.').node() |
|
896 | cur = repo.changectx('.').node() | |
883 | marks = repo._bookmarks |
|
897 | marks = repo._bookmarks | |
884 | if delete: |
|
898 | if delete: | |
885 | for mark in names: |
|
899 | for mark in names: | |
886 | if mark not in marks: |
|
900 | if mark not in marks: | |
887 | raise util.Abort(_("bookmark '%s' does not exist") % |
|
901 | raise util.Abort(_("bookmark '%s' does not exist") % | |
888 | mark) |
|
902 | mark) | |
889 | if mark == repo._bookmarkcurrent: |
|
903 | if mark == repo._bookmarkcurrent: | |
890 | bookmarks.unsetcurrent(repo) |
|
904 | bookmarks.unsetcurrent(repo) | |
891 | del marks[mark] |
|
905 | del marks[mark] | |
892 | marks.write() |
|
906 | marks.write() | |
893 |
|
907 | |||
894 | elif rename: |
|
908 | elif rename: | |
895 | if not names: |
|
909 | if not names: | |
896 | raise util.Abort(_("new bookmark name required")) |
|
910 | raise util.Abort(_("new bookmark name required")) | |
897 | elif len(names) > 1: |
|
911 | elif len(names) > 1: | |
898 | raise util.Abort(_("only one new bookmark name allowed")) |
|
912 | raise util.Abort(_("only one new bookmark name allowed")) | |
899 | mark = checkformat(names[0]) |
|
913 | mark = checkformat(names[0]) | |
900 | if rename not in marks: |
|
914 | if rename not in marks: | |
901 | raise util.Abort(_("bookmark '%s' does not exist") % rename) |
|
915 | raise util.Abort(_("bookmark '%s' does not exist") % rename) | |
902 | checkconflict(repo, mark, cur, force) |
|
916 | checkconflict(repo, mark, cur, force) | |
903 | marks[mark] = marks[rename] |
|
917 | marks[mark] = marks[rename] | |
904 | if repo._bookmarkcurrent == rename and not inactive: |
|
918 | if repo._bookmarkcurrent == rename and not inactive: | |
905 | bookmarks.setcurrent(repo, mark) |
|
919 | bookmarks.setcurrent(repo, mark) | |
906 | del marks[rename] |
|
920 | del marks[rename] | |
907 | marks.write() |
|
921 | marks.write() | |
908 |
|
922 | |||
909 | elif names: |
|
923 | elif names: | |
910 | newact = None |
|
924 | newact = None | |
911 | for mark in names: |
|
925 | for mark in names: | |
912 | mark = checkformat(mark) |
|
926 | mark = checkformat(mark) | |
913 | if newact is None: |
|
927 | if newact is None: | |
914 | newact = mark |
|
928 | newact = mark | |
915 | if inactive and mark == repo._bookmarkcurrent: |
|
929 | if inactive and mark == repo._bookmarkcurrent: | |
916 | bookmarks.unsetcurrent(repo) |
|
930 | bookmarks.unsetcurrent(repo) | |
917 | return |
|
931 | return | |
918 | tgt = cur |
|
932 | tgt = cur | |
919 | if rev: |
|
933 | if rev: | |
920 | tgt = scmutil.revsingle(repo, rev).node() |
|
934 | tgt = scmutil.revsingle(repo, rev).node() | |
921 | checkconflict(repo, mark, cur, force, tgt) |
|
935 | checkconflict(repo, mark, cur, force, tgt) | |
922 | marks[mark] = tgt |
|
936 | marks[mark] = tgt | |
923 | if not inactive and cur == marks[newact] and not rev: |
|
937 | if not inactive and cur == marks[newact] and not rev: | |
924 | bookmarks.setcurrent(repo, newact) |
|
938 | bookmarks.setcurrent(repo, newact) | |
925 | elif cur != tgt and newact == repo._bookmarkcurrent: |
|
939 | elif cur != tgt and newact == repo._bookmarkcurrent: | |
926 | bookmarks.unsetcurrent(repo) |
|
940 | bookmarks.unsetcurrent(repo) | |
927 | marks.write() |
|
941 | marks.write() | |
928 |
|
942 | |||
929 | elif inactive: |
|
943 | elif inactive: | |
930 | if len(marks) == 0: |
|
944 | if len(marks) == 0: | |
931 | ui.status(_("no bookmarks set\n")) |
|
945 | ui.status(_("no bookmarks set\n")) | |
932 | elif not repo._bookmarkcurrent: |
|
946 | elif not repo._bookmarkcurrent: | |
933 | ui.status(_("no active bookmark\n")) |
|
947 | ui.status(_("no active bookmark\n")) | |
934 | else: |
|
948 | else: | |
935 | bookmarks.unsetcurrent(repo) |
|
949 | bookmarks.unsetcurrent(repo) | |
936 | finally: |
|
950 | finally: | |
937 | wlock.release() |
|
951 | wlock.release() | |
938 | else: # show bookmarks |
|
952 | else: # show bookmarks | |
939 | hexfn = ui.debugflag and hex or short |
|
953 | hexfn = ui.debugflag and hex or short | |
940 | marks = repo._bookmarks |
|
954 | marks = repo._bookmarks | |
941 | if len(marks) == 0: |
|
955 | if len(marks) == 0: | |
942 | ui.status(_("no bookmarks set\n")) |
|
956 | ui.status(_("no bookmarks set\n")) | |
943 | else: |
|
957 | else: | |
944 | for bmark, n in sorted(marks.iteritems()): |
|
958 | for bmark, n in sorted(marks.iteritems()): | |
945 | current = repo._bookmarkcurrent |
|
959 | current = repo._bookmarkcurrent | |
946 | if bmark == current: |
|
960 | if bmark == current: | |
947 | prefix, label = '*', 'bookmarks.current' |
|
961 | prefix, label = '*', 'bookmarks.current' | |
948 | else: |
|
962 | else: | |
949 | prefix, label = ' ', '' |
|
963 | prefix, label = ' ', '' | |
950 |
|
964 | |||
951 | if ui.quiet: |
|
965 | if ui.quiet: | |
952 | ui.write("%s\n" % bmark, label=label) |
|
966 | ui.write("%s\n" % bmark, label=label) | |
953 | else: |
|
967 | else: | |
954 | pad = " " * (25 - encoding.colwidth(bmark)) |
|
968 | pad = " " * (25 - encoding.colwidth(bmark)) | |
955 | ui.write(" %s %s%s %d:%s\n" % ( |
|
969 | ui.write(" %s %s%s %d:%s\n" % ( | |
956 | prefix, bmark, pad, repo.changelog.rev(n), hexfn(n)), |
|
970 | prefix, bmark, pad, repo.changelog.rev(n), hexfn(n)), | |
957 | label=label) |
|
971 | label=label) | |
958 |
|
972 | |||
959 | @command('branch', |
|
973 | @command('branch', | |
960 | [('f', 'force', None, |
|
974 | [('f', 'force', None, | |
961 | _('set branch name even if it shadows an existing branch')), |
|
975 | _('set branch name even if it shadows an existing branch')), | |
962 | ('C', 'clean', None, _('reset branch name to parent branch name'))], |
|
976 | ('C', 'clean', None, _('reset branch name to parent branch name'))], | |
963 | _('[-fC] [NAME]')) |
|
977 | _('[-fC] [NAME]')) | |
964 | def branch(ui, repo, label=None, **opts): |
|
978 | def branch(ui, repo, label=None, **opts): | |
965 | """set or show the current branch name |
|
979 | """set or show the current branch name | |
966 |
|
980 | |||
967 | .. note:: |
|
981 | .. note:: | |
968 |
|
982 | |||
969 | Branch names are permanent and global. Use :hg:`bookmark` to create a |
|
983 | Branch names are permanent and global. Use :hg:`bookmark` to create a | |
970 | light-weight bookmark instead. See :hg:`help glossary` for more |
|
984 | light-weight bookmark instead. See :hg:`help glossary` for more | |
971 | information about named branches and bookmarks. |
|
985 | information about named branches and bookmarks. | |
972 |
|
986 | |||
973 | With no argument, show the current branch name. With one argument, |
|
987 | With no argument, show the current branch name. With one argument, | |
974 | set the working directory branch name (the branch will not exist |
|
988 | set the working directory branch name (the branch will not exist | |
975 | in the repository until the next commit). Standard practice |
|
989 | in the repository until the next commit). Standard practice | |
976 | recommends that primary development take place on the 'default' |
|
990 | recommends that primary development take place on the 'default' | |
977 | branch. |
|
991 | branch. | |
978 |
|
992 | |||
979 | Unless -f/--force is specified, branch will not let you set a |
|
993 | Unless -f/--force is specified, branch will not let you set a | |
980 | branch name that already exists, even if it's inactive. |
|
994 | branch name that already exists, even if it's inactive. | |
981 |
|
995 | |||
982 | Use -C/--clean to reset the working directory branch to that of |
|
996 | Use -C/--clean to reset the working directory branch to that of | |
983 | the parent of the working directory, negating a previous branch |
|
997 | the parent of the working directory, negating a previous branch | |
984 | change. |
|
998 | change. | |
985 |
|
999 | |||
986 | Use the command :hg:`update` to switch to an existing branch. Use |
|
1000 | Use the command :hg:`update` to switch to an existing branch. Use | |
987 | :hg:`commit --close-branch` to mark this branch as closed. |
|
1001 | :hg:`commit --close-branch` to mark this branch as closed. | |
988 |
|
1002 | |||
989 | Returns 0 on success. |
|
1003 | Returns 0 on success. | |
990 | """ |
|
1004 | """ | |
991 | if label: |
|
1005 | if label: | |
992 | label = label.strip() |
|
1006 | label = label.strip() | |
993 |
|
1007 | |||
994 | if not opts.get('clean') and not label: |
|
1008 | if not opts.get('clean') and not label: | |
995 | ui.write("%s\n" % repo.dirstate.branch()) |
|
1009 | ui.write("%s\n" % repo.dirstate.branch()) | |
996 | return |
|
1010 | return | |
997 |
|
1011 | |||
998 | wlock = repo.wlock() |
|
1012 | wlock = repo.wlock() | |
999 | try: |
|
1013 | try: | |
1000 | if opts.get('clean'): |
|
1014 | if opts.get('clean'): | |
1001 | label = repo[None].p1().branch() |
|
1015 | label = repo[None].p1().branch() | |
1002 | repo.dirstate.setbranch(label) |
|
1016 | repo.dirstate.setbranch(label) | |
1003 | ui.status(_('reset working directory to branch %s\n') % label) |
|
1017 | ui.status(_('reset working directory to branch %s\n') % label) | |
1004 | elif label: |
|
1018 | elif label: | |
1005 | if not opts.get('force') and label in repo.branchmap(): |
|
1019 | if not opts.get('force') and label in repo.branchmap(): | |
1006 | if label not in [p.branch() for p in repo.parents()]: |
|
1020 | if label not in [p.branch() for p in repo.parents()]: | |
1007 | raise util.Abort(_('a branch of the same name already' |
|
1021 | raise util.Abort(_('a branch of the same name already' | |
1008 | ' exists'), |
|
1022 | ' exists'), | |
1009 | # i18n: "it" refers to an existing branch |
|
1023 | # i18n: "it" refers to an existing branch | |
1010 | hint=_("use 'hg update' to switch to it")) |
|
1024 | hint=_("use 'hg update' to switch to it")) | |
1011 | scmutil.checknewlabel(repo, label, 'branch') |
|
1025 | scmutil.checknewlabel(repo, label, 'branch') | |
1012 | repo.dirstate.setbranch(label) |
|
1026 | repo.dirstate.setbranch(label) | |
1013 | ui.status(_('marked working directory as branch %s\n') % label) |
|
1027 | ui.status(_('marked working directory as branch %s\n') % label) | |
1014 | ui.status(_('(branches are permanent and global, ' |
|
1028 | ui.status(_('(branches are permanent and global, ' | |
1015 | 'did you want a bookmark?)\n')) |
|
1029 | 'did you want a bookmark?)\n')) | |
1016 | finally: |
|
1030 | finally: | |
1017 | wlock.release() |
|
1031 | wlock.release() | |
1018 |
|
1032 | |||
1019 | @command('branches', |
|
1033 | @command('branches', | |
1020 | [('a', 'active', False, _('show only branches that have unmerged heads')), |
|
1034 | [('a', 'active', False, _('show only branches that have unmerged heads')), | |
1021 | ('c', 'closed', False, _('show normal and closed branches'))], |
|
1035 | ('c', 'closed', False, _('show normal and closed branches'))], | |
1022 | _('[-ac]')) |
|
1036 | _('[-ac]')) | |
1023 | def branches(ui, repo, active=False, closed=False): |
|
1037 | def branches(ui, repo, active=False, closed=False): | |
1024 | """list repository named branches |
|
1038 | """list repository named branches | |
1025 |
|
1039 | |||
1026 | List the repository's named branches, indicating which ones are |
|
1040 | List the repository's named branches, indicating which ones are | |
1027 | inactive. If -c/--closed is specified, also list branches which have |
|
1041 | inactive. If -c/--closed is specified, also list branches which have | |
1028 | been marked closed (see :hg:`commit --close-branch`). |
|
1042 | been marked closed (see :hg:`commit --close-branch`). | |
1029 |
|
1043 | |||
1030 | If -a/--active is specified, only show active branches. A branch |
|
1044 | If -a/--active is specified, only show active branches. A branch | |
1031 | is considered active if it contains repository heads. |
|
1045 | is considered active if it contains repository heads. | |
1032 |
|
1046 | |||
1033 | Use the command :hg:`update` to switch to an existing branch. |
|
1047 | Use the command :hg:`update` to switch to an existing branch. | |
1034 |
|
1048 | |||
1035 | Returns 0. |
|
1049 | Returns 0. | |
1036 | """ |
|
1050 | """ | |
1037 |
|
1051 | |||
1038 | hexfunc = ui.debugflag and hex or short |
|
1052 | hexfunc = ui.debugflag and hex or short | |
1039 |
|
1053 | |||
1040 | allheads = set(repo.heads()) |
|
1054 | allheads = set(repo.heads()) | |
1041 | branches = [] |
|
1055 | branches = [] | |
1042 | for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): |
|
1056 | for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): | |
1043 | isactive = not isclosed and bool(set(heads) & allheads) |
|
1057 | isactive = not isclosed and bool(set(heads) & allheads) | |
1044 | branches.append((tag, repo[tip], isactive, not isclosed)) |
|
1058 | branches.append((tag, repo[tip], isactive, not isclosed)) | |
1045 | branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]), |
|
1059 | branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]), | |
1046 | reverse=True) |
|
1060 | reverse=True) | |
1047 |
|
1061 | |||
1048 | for tag, ctx, isactive, isopen in branches: |
|
1062 | for tag, ctx, isactive, isopen in branches: | |
1049 | if (not active) or isactive: |
|
1063 | if (not active) or isactive: | |
1050 | if isactive: |
|
1064 | if isactive: | |
1051 | label = 'branches.active' |
|
1065 | label = 'branches.active' | |
1052 | notice = '' |
|
1066 | notice = '' | |
1053 | elif not isopen: |
|
1067 | elif not isopen: | |
1054 | if not closed: |
|
1068 | if not closed: | |
1055 | continue |
|
1069 | continue | |
1056 | label = 'branches.closed' |
|
1070 | label = 'branches.closed' | |
1057 | notice = _(' (closed)') |
|
1071 | notice = _(' (closed)') | |
1058 | else: |
|
1072 | else: | |
1059 | label = 'branches.inactive' |
|
1073 | label = 'branches.inactive' | |
1060 | notice = _(' (inactive)') |
|
1074 | notice = _(' (inactive)') | |
1061 | if tag == repo.dirstate.branch(): |
|
1075 | if tag == repo.dirstate.branch(): | |
1062 | label = 'branches.current' |
|
1076 | label = 'branches.current' | |
1063 | rev = str(ctx.rev()).rjust(31 - encoding.colwidth(tag)) |
|
1077 | rev = str(ctx.rev()).rjust(31 - encoding.colwidth(tag)) | |
1064 | rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())), |
|
1078 | rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())), | |
1065 | 'log.changeset changeset.%s' % ctx.phasestr()) |
|
1079 | 'log.changeset changeset.%s' % ctx.phasestr()) | |
1066 | labeledtag = ui.label(tag, label) |
|
1080 | labeledtag = ui.label(tag, label) | |
1067 | if ui.quiet: |
|
1081 | if ui.quiet: | |
1068 | ui.write("%s\n" % labeledtag) |
|
1082 | ui.write("%s\n" % labeledtag) | |
1069 | else: |
|
1083 | else: | |
1070 | ui.write("%s %s%s\n" % (labeledtag, rev, notice)) |
|
1084 | ui.write("%s %s%s\n" % (labeledtag, rev, notice)) | |
1071 |
|
1085 | |||
1072 | @command('bundle', |
|
1086 | @command('bundle', | |
1073 | [('f', 'force', None, _('run even when the destination is unrelated')), |
|
1087 | [('f', 'force', None, _('run even when the destination is unrelated')), | |
1074 | ('r', 'rev', [], _('a changeset intended to be added to the destination'), |
|
1088 | ('r', 'rev', [], _('a changeset intended to be added to the destination'), | |
1075 | _('REV')), |
|
1089 | _('REV')), | |
1076 | ('b', 'branch', [], _('a specific branch you would like to bundle'), |
|
1090 | ('b', 'branch', [], _('a specific branch you would like to bundle'), | |
1077 | _('BRANCH')), |
|
1091 | _('BRANCH')), | |
1078 | ('', 'base', [], |
|
1092 | ('', 'base', [], | |
1079 | _('a base changeset assumed to be available at the destination'), |
|
1093 | _('a base changeset assumed to be available at the destination'), | |
1080 | _('REV')), |
|
1094 | _('REV')), | |
1081 | ('a', 'all', None, _('bundle all changesets in the repository')), |
|
1095 | ('a', 'all', None, _('bundle all changesets in the repository')), | |
1082 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')), |
|
1096 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')), | |
1083 | ] + remoteopts, |
|
1097 | ] + remoteopts, | |
1084 | _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')) |
|
1098 | _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')) | |
1085 | def bundle(ui, repo, fname, dest=None, **opts): |
|
1099 | def bundle(ui, repo, fname, dest=None, **opts): | |
1086 | """create a changegroup file |
|
1100 | """create a changegroup file | |
1087 |
|
1101 | |||
1088 | Generate a compressed changegroup file collecting changesets not |
|
1102 | Generate a compressed changegroup file collecting changesets not | |
1089 | known to be in another repository. |
|
1103 | known to be in another repository. | |
1090 |
|
1104 | |||
1091 | If you omit the destination repository, then hg assumes the |
|
1105 | If you omit the destination repository, then hg assumes the | |
1092 | destination will have all the nodes you specify with --base |
|
1106 | destination will have all the nodes you specify with --base | |
1093 | parameters. To create a bundle containing all changesets, use |
|
1107 | parameters. To create a bundle containing all changesets, use | |
1094 | -a/--all (or --base null). |
|
1108 | -a/--all (or --base null). | |
1095 |
|
1109 | |||
1096 | You can change compression method with the -t/--type option. |
|
1110 | You can change compression method with the -t/--type option. | |
1097 | The available compression methods are: none, bzip2, and |
|
1111 | The available compression methods are: none, bzip2, and | |
1098 | gzip (by default, bundles are compressed using bzip2). |
|
1112 | gzip (by default, bundles are compressed using bzip2). | |
1099 |
|
1113 | |||
1100 | The bundle file can then be transferred using conventional means |
|
1114 | The bundle file can then be transferred using conventional means | |
1101 | and applied to another repository with the unbundle or pull |
|
1115 | and applied to another repository with the unbundle or pull | |
1102 | command. This is useful when direct push and pull are not |
|
1116 | command. This is useful when direct push and pull are not | |
1103 | available or when exporting an entire repository is undesirable. |
|
1117 | available or when exporting an entire repository is undesirable. | |
1104 |
|
1118 | |||
1105 | Applying bundles preserves all changeset contents including |
|
1119 | Applying bundles preserves all changeset contents including | |
1106 | permissions, copy/rename information, and revision history. |
|
1120 | permissions, copy/rename information, and revision history. | |
1107 |
|
1121 | |||
1108 | Returns 0 on success, 1 if no changes found. |
|
1122 | Returns 0 on success, 1 if no changes found. | |
1109 | """ |
|
1123 | """ | |
1110 | revs = None |
|
1124 | revs = None | |
1111 | if 'rev' in opts: |
|
1125 | if 'rev' in opts: | |
1112 | revs = scmutil.revrange(repo, opts['rev']) |
|
1126 | revs = scmutil.revrange(repo, opts['rev']) | |
1113 |
|
1127 | |||
1114 | bundletype = opts.get('type', 'bzip2').lower() |
|
1128 | bundletype = opts.get('type', 'bzip2').lower() | |
1115 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} |
|
1129 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} | |
1116 | bundletype = btypes.get(bundletype) |
|
1130 | bundletype = btypes.get(bundletype) | |
1117 | if bundletype not in changegroup.bundletypes: |
|
1131 | if bundletype not in changegroup.bundletypes: | |
1118 | raise util.Abort(_('unknown bundle type specified with --type')) |
|
1132 | raise util.Abort(_('unknown bundle type specified with --type')) | |
1119 |
|
1133 | |||
1120 | if opts.get('all'): |
|
1134 | if opts.get('all'): | |
1121 | base = ['null'] |
|
1135 | base = ['null'] | |
1122 | else: |
|
1136 | else: | |
1123 | base = scmutil.revrange(repo, opts.get('base')) |
|
1137 | base = scmutil.revrange(repo, opts.get('base')) | |
1124 | # TODO: get desired bundlecaps from command line. |
|
1138 | # TODO: get desired bundlecaps from command line. | |
1125 | bundlecaps = None |
|
1139 | bundlecaps = None | |
1126 | if base: |
|
1140 | if base: | |
1127 | if dest: |
|
1141 | if dest: | |
1128 | raise util.Abort(_("--base is incompatible with specifying " |
|
1142 | raise util.Abort(_("--base is incompatible with specifying " | |
1129 | "a destination")) |
|
1143 | "a destination")) | |
1130 | common = [repo.lookup(rev) for rev in base] |
|
1144 | common = [repo.lookup(rev) for rev in base] | |
1131 | heads = revs and map(repo.lookup, revs) or revs |
|
1145 | heads = revs and map(repo.lookup, revs) or revs | |
1132 | cg = changegroup.getbundle(repo, 'bundle', heads=heads, common=common, |
|
1146 | cg = changegroup.getbundle(repo, 'bundle', heads=heads, common=common, | |
1133 | bundlecaps=bundlecaps) |
|
1147 | bundlecaps=bundlecaps) | |
1134 | outgoing = None |
|
1148 | outgoing = None | |
1135 | else: |
|
1149 | else: | |
1136 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
1150 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
1137 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
1151 | dest, branches = hg.parseurl(dest, opts.get('branch')) | |
1138 | other = hg.peer(repo, opts, dest) |
|
1152 | other = hg.peer(repo, opts, dest) | |
1139 | revs, checkout = hg.addbranchrevs(repo, repo, branches, revs) |
|
1153 | revs, checkout = hg.addbranchrevs(repo, repo, branches, revs) | |
1140 | heads = revs and map(repo.lookup, revs) or revs |
|
1154 | heads = revs and map(repo.lookup, revs) or revs | |
1141 | outgoing = discovery.findcommonoutgoing(repo, other, |
|
1155 | outgoing = discovery.findcommonoutgoing(repo, other, | |
1142 | onlyheads=heads, |
|
1156 | onlyheads=heads, | |
1143 | force=opts.get('force'), |
|
1157 | force=opts.get('force'), | |
1144 | portable=True) |
|
1158 | portable=True) | |
1145 | cg = changegroup.getlocalbundle(repo, 'bundle', outgoing, bundlecaps) |
|
1159 | cg = changegroup.getlocalbundle(repo, 'bundle', outgoing, bundlecaps) | |
1146 | if not cg: |
|
1160 | if not cg: | |
1147 | scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded) |
|
1161 | scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded) | |
1148 | return 1 |
|
1162 | return 1 | |
1149 |
|
1163 | |||
1150 | changegroup.writebundle(cg, fname, bundletype) |
|
1164 | changegroup.writebundle(cg, fname, bundletype) | |
1151 |
|
1165 | |||
1152 | @command('cat', |
|
1166 | @command('cat', | |
1153 | [('o', 'output', '', |
|
1167 | [('o', 'output', '', | |
1154 | _('print output to file with formatted name'), _('FORMAT')), |
|
1168 | _('print output to file with formatted name'), _('FORMAT')), | |
1155 | ('r', 'rev', '', _('print the given revision'), _('REV')), |
|
1169 | ('r', 'rev', '', _('print the given revision'), _('REV')), | |
1156 | ('', 'decode', None, _('apply any matching decode filter')), |
|
1170 | ('', 'decode', None, _('apply any matching decode filter')), | |
1157 | ] + walkopts, |
|
1171 | ] + walkopts, | |
1158 | _('[OPTION]... FILE...')) |
|
1172 | _('[OPTION]... FILE...')) | |
1159 | def cat(ui, repo, file1, *pats, **opts): |
|
1173 | def cat(ui, repo, file1, *pats, **opts): | |
1160 | """output the current or given revision of files |
|
1174 | """output the current or given revision of files | |
1161 |
|
1175 | |||
1162 | Print the specified files as they were at the given revision. If |
|
1176 | Print the specified files as they were at the given revision. If | |
1163 | no revision is given, the parent of the working directory is used. |
|
1177 | no revision is given, the parent of the working directory is used. | |
1164 |
|
1178 | |||
1165 | Output may be to a file, in which case the name of the file is |
|
1179 | Output may be to a file, in which case the name of the file is | |
1166 | given using a format string. The formatting rules as follows: |
|
1180 | given using a format string. The formatting rules as follows: | |
1167 |
|
1181 | |||
1168 | :``%%``: literal "%" character |
|
1182 | :``%%``: literal "%" character | |
1169 | :``%s``: basename of file being printed |
|
1183 | :``%s``: basename of file being printed | |
1170 | :``%d``: dirname of file being printed, or '.' if in repository root |
|
1184 | :``%d``: dirname of file being printed, or '.' if in repository root | |
1171 | :``%p``: root-relative path name of file being printed |
|
1185 | :``%p``: root-relative path name of file being printed | |
1172 | :``%H``: changeset hash (40 hexadecimal digits) |
|
1186 | :``%H``: changeset hash (40 hexadecimal digits) | |
1173 | :``%R``: changeset revision number |
|
1187 | :``%R``: changeset revision number | |
1174 | :``%h``: short-form changeset hash (12 hexadecimal digits) |
|
1188 | :``%h``: short-form changeset hash (12 hexadecimal digits) | |
1175 | :``%r``: zero-padded changeset revision number |
|
1189 | :``%r``: zero-padded changeset revision number | |
1176 | :``%b``: basename of the exporting repository |
|
1190 | :``%b``: basename of the exporting repository | |
1177 |
|
1191 | |||
1178 | Returns 0 on success. |
|
1192 | Returns 0 on success. | |
1179 | """ |
|
1193 | """ | |
1180 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1194 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
1181 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
1195 | m = scmutil.match(ctx, (file1,) + pats, opts) | |
1182 |
|
1196 | |||
1183 | return cmdutil.cat(ui, repo, ctx, m, '', **opts) |
|
1197 | return cmdutil.cat(ui, repo, ctx, m, '', **opts) | |
1184 |
|
1198 | |||
1185 | @command('^clone', |
|
1199 | @command('^clone', | |
1186 | [('U', 'noupdate', None, |
|
1200 | [('U', 'noupdate', None, | |
1187 | _('the clone will include an empty working copy (only a repository)')), |
|
1201 | _('the clone will include an empty working copy (only a repository)')), | |
1188 | ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')), |
|
1202 | ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')), | |
1189 | ('r', 'rev', [], _('include the specified changeset'), _('REV')), |
|
1203 | ('r', 'rev', [], _('include the specified changeset'), _('REV')), | |
1190 | ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')), |
|
1204 | ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')), | |
1191 | ('', 'pull', None, _('use pull protocol to copy metadata')), |
|
1205 | ('', 'pull', None, _('use pull protocol to copy metadata')), | |
1192 | ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')), |
|
1206 | ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')), | |
1193 | ] + remoteopts, |
|
1207 | ] + remoteopts, | |
1194 | _('[OPTION]... SOURCE [DEST]')) |
|
1208 | _('[OPTION]... SOURCE [DEST]')) | |
1195 | def clone(ui, source, dest=None, **opts): |
|
1209 | def clone(ui, source, dest=None, **opts): | |
1196 | """make a copy of an existing repository |
|
1210 | """make a copy of an existing repository | |
1197 |
|
1211 | |||
1198 | Create a copy of an existing repository in a new directory. |
|
1212 | Create a copy of an existing repository in a new directory. | |
1199 |
|
1213 | |||
1200 | If no destination directory name is specified, it defaults to the |
|
1214 | If no destination directory name is specified, it defaults to the | |
1201 | basename of the source. |
|
1215 | basename of the source. | |
1202 |
|
1216 | |||
1203 | The location of the source is added to the new repository's |
|
1217 | The location of the source is added to the new repository's | |
1204 | ``.hg/hgrc`` file, as the default to be used for future pulls. |
|
1218 | ``.hg/hgrc`` file, as the default to be used for future pulls. | |
1205 |
|
1219 | |||
1206 | Only local paths and ``ssh://`` URLs are supported as |
|
1220 | Only local paths and ``ssh://`` URLs are supported as | |
1207 | destinations. For ``ssh://`` destinations, no working directory or |
|
1221 | destinations. For ``ssh://`` destinations, no working directory or | |
1208 | ``.hg/hgrc`` will be created on the remote side. |
|
1222 | ``.hg/hgrc`` will be created on the remote side. | |
1209 |
|
1223 | |||
1210 | To pull only a subset of changesets, specify one or more revisions |
|
1224 | To pull only a subset of changesets, specify one or more revisions | |
1211 | identifiers with -r/--rev or branches with -b/--branch. The |
|
1225 | identifiers with -r/--rev or branches with -b/--branch. The | |
1212 | resulting clone will contain only the specified changesets and |
|
1226 | resulting clone will contain only the specified changesets and | |
1213 | their ancestors. These options (or 'clone src#rev dest') imply |
|
1227 | their ancestors. These options (or 'clone src#rev dest') imply | |
1214 | --pull, even for local source repositories. Note that specifying a |
|
1228 | --pull, even for local source repositories. Note that specifying a | |
1215 | tag will include the tagged changeset but not the changeset |
|
1229 | tag will include the tagged changeset but not the changeset | |
1216 | containing the tag. |
|
1230 | containing the tag. | |
1217 |
|
1231 | |||
1218 | If the source repository has a bookmark called '@' set, that |
|
1232 | If the source repository has a bookmark called '@' set, that | |
1219 | revision will be checked out in the new repository by default. |
|
1233 | revision will be checked out in the new repository by default. | |
1220 |
|
1234 | |||
1221 | To check out a particular version, use -u/--update, or |
|
1235 | To check out a particular version, use -u/--update, or | |
1222 | -U/--noupdate to create a clone with no working directory. |
|
1236 | -U/--noupdate to create a clone with no working directory. | |
1223 |
|
1237 | |||
1224 | .. container:: verbose |
|
1238 | .. container:: verbose | |
1225 |
|
1239 | |||
1226 | For efficiency, hardlinks are used for cloning whenever the |
|
1240 | For efficiency, hardlinks are used for cloning whenever the | |
1227 | source and destination are on the same filesystem (note this |
|
1241 | source and destination are on the same filesystem (note this | |
1228 | applies only to the repository data, not to the working |
|
1242 | applies only to the repository data, not to the working | |
1229 | directory). Some filesystems, such as AFS, implement hardlinking |
|
1243 | directory). Some filesystems, such as AFS, implement hardlinking | |
1230 | incorrectly, but do not report errors. In these cases, use the |
|
1244 | incorrectly, but do not report errors. In these cases, use the | |
1231 | --pull option to avoid hardlinking. |
|
1245 | --pull option to avoid hardlinking. | |
1232 |
|
1246 | |||
1233 | In some cases, you can clone repositories and the working |
|
1247 | In some cases, you can clone repositories and the working | |
1234 | directory using full hardlinks with :: |
|
1248 | directory using full hardlinks with :: | |
1235 |
|
1249 | |||
1236 | $ cp -al REPO REPOCLONE |
|
1250 | $ cp -al REPO REPOCLONE | |
1237 |
|
1251 | |||
1238 | This is the fastest way to clone, but it is not always safe. The |
|
1252 | This is the fastest way to clone, but it is not always safe. The | |
1239 | operation is not atomic (making sure REPO is not modified during |
|
1253 | operation is not atomic (making sure REPO is not modified during | |
1240 | the operation is up to you) and you have to make sure your |
|
1254 | the operation is up to you) and you have to make sure your | |
1241 | editor breaks hardlinks (Emacs and most Linux Kernel tools do |
|
1255 | editor breaks hardlinks (Emacs and most Linux Kernel tools do | |
1242 | so). Also, this is not compatible with certain extensions that |
|
1256 | so). Also, this is not compatible with certain extensions that | |
1243 | place their metadata under the .hg directory, such as mq. |
|
1257 | place their metadata under the .hg directory, such as mq. | |
1244 |
|
1258 | |||
1245 | Mercurial will update the working directory to the first applicable |
|
1259 | Mercurial will update the working directory to the first applicable | |
1246 | revision from this list: |
|
1260 | revision from this list: | |
1247 |
|
1261 | |||
1248 | a) null if -U or the source repository has no changesets |
|
1262 | a) null if -U or the source repository has no changesets | |
1249 | b) if -u . and the source repository is local, the first parent of |
|
1263 | b) if -u . and the source repository is local, the first parent of | |
1250 | the source repository's working directory |
|
1264 | the source repository's working directory | |
1251 | c) the changeset specified with -u (if a branch name, this means the |
|
1265 | c) the changeset specified with -u (if a branch name, this means the | |
1252 | latest head of that branch) |
|
1266 | latest head of that branch) | |
1253 | d) the changeset specified with -r |
|
1267 | d) the changeset specified with -r | |
1254 | e) the tipmost head specified with -b |
|
1268 | e) the tipmost head specified with -b | |
1255 | f) the tipmost head specified with the url#branch source syntax |
|
1269 | f) the tipmost head specified with the url#branch source syntax | |
1256 | g) the revision marked with the '@' bookmark, if present |
|
1270 | g) the revision marked with the '@' bookmark, if present | |
1257 | h) the tipmost head of the default branch |
|
1271 | h) the tipmost head of the default branch | |
1258 | i) tip |
|
1272 | i) tip | |
1259 |
|
1273 | |||
1260 | Examples: |
|
1274 | Examples: | |
1261 |
|
1275 | |||
1262 | - clone a remote repository to a new directory named hg/:: |
|
1276 | - clone a remote repository to a new directory named hg/:: | |
1263 |
|
1277 | |||
1264 | hg clone http://selenic.com/hg |
|
1278 | hg clone http://selenic.com/hg | |
1265 |
|
1279 | |||
1266 | - create a lightweight local clone:: |
|
1280 | - create a lightweight local clone:: | |
1267 |
|
1281 | |||
1268 | hg clone project/ project-feature/ |
|
1282 | hg clone project/ project-feature/ | |
1269 |
|
1283 | |||
1270 | - clone from an absolute path on an ssh server (note double-slash):: |
|
1284 | - clone from an absolute path on an ssh server (note double-slash):: | |
1271 |
|
1285 | |||
1272 | hg clone ssh://user@server//home/projects/alpha/ |
|
1286 | hg clone ssh://user@server//home/projects/alpha/ | |
1273 |
|
1287 | |||
1274 | - do a high-speed clone over a LAN while checking out a |
|
1288 | - do a high-speed clone over a LAN while checking out a | |
1275 | specified version:: |
|
1289 | specified version:: | |
1276 |
|
1290 | |||
1277 | hg clone --uncompressed http://server/repo -u 1.5 |
|
1291 | hg clone --uncompressed http://server/repo -u 1.5 | |
1278 |
|
1292 | |||
1279 | - create a repository without changesets after a particular revision:: |
|
1293 | - create a repository without changesets after a particular revision:: | |
1280 |
|
1294 | |||
1281 | hg clone -r 04e544 experimental/ good/ |
|
1295 | hg clone -r 04e544 experimental/ good/ | |
1282 |
|
1296 | |||
1283 | - clone (and track) a particular named branch:: |
|
1297 | - clone (and track) a particular named branch:: | |
1284 |
|
1298 | |||
1285 | hg clone http://selenic.com/hg#stable |
|
1299 | hg clone http://selenic.com/hg#stable | |
1286 |
|
1300 | |||
1287 | See :hg:`help urls` for details on specifying URLs. |
|
1301 | See :hg:`help urls` for details on specifying URLs. | |
1288 |
|
1302 | |||
1289 | Returns 0 on success. |
|
1303 | Returns 0 on success. | |
1290 | """ |
|
1304 | """ | |
1291 | if opts.get('noupdate') and opts.get('updaterev'): |
|
1305 | if opts.get('noupdate') and opts.get('updaterev'): | |
1292 | raise util.Abort(_("cannot specify both --noupdate and --updaterev")) |
|
1306 | raise util.Abort(_("cannot specify both --noupdate and --updaterev")) | |
1293 |
|
1307 | |||
1294 | r = hg.clone(ui, opts, source, dest, |
|
1308 | r = hg.clone(ui, opts, source, dest, | |
1295 | pull=opts.get('pull'), |
|
1309 | pull=opts.get('pull'), | |
1296 | stream=opts.get('uncompressed'), |
|
1310 | stream=opts.get('uncompressed'), | |
1297 | rev=opts.get('rev'), |
|
1311 | rev=opts.get('rev'), | |
1298 | update=opts.get('updaterev') or not opts.get('noupdate'), |
|
1312 | update=opts.get('updaterev') or not opts.get('noupdate'), | |
1299 | branch=opts.get('branch')) |
|
1313 | branch=opts.get('branch')) | |
1300 |
|
1314 | |||
1301 | return r is None |
|
1315 | return r is None | |
1302 |
|
1316 | |||
1303 | @command('^commit|ci', |
|
1317 | @command('^commit|ci', | |
1304 | [('A', 'addremove', None, |
|
1318 | [('A', 'addremove', None, | |
1305 | _('mark new/missing files as added/removed before committing')), |
|
1319 | _('mark new/missing files as added/removed before committing')), | |
1306 | ('', 'close-branch', None, |
|
1320 | ('', 'close-branch', None, | |
1307 | _('mark a branch as closed, hiding it from the branch list')), |
|
1321 | _('mark a branch as closed, hiding it from the branch list')), | |
1308 | ('', 'amend', None, _('amend the parent of the working dir')), |
|
1322 | ('', 'amend', None, _('amend the parent of the working dir')), | |
1309 | ('s', 'secret', None, _('use the secret phase for committing')), |
|
1323 | ('s', 'secret', None, _('use the secret phase for committing')), | |
1310 | ('e', 'edit', None, |
|
1324 | ('e', 'edit', None, | |
1311 | _('further edit commit message already specified')), |
|
1325 | _('further edit commit message already specified')), | |
1312 | ] + walkopts + commitopts + commitopts2 + subrepoopts, |
|
1326 | ] + walkopts + commitopts + commitopts2 + subrepoopts, | |
1313 | _('[OPTION]... [FILE]...')) |
|
1327 | _('[OPTION]... [FILE]...')) | |
1314 | def commit(ui, repo, *pats, **opts): |
|
1328 | def commit(ui, repo, *pats, **opts): | |
1315 | """commit the specified files or all outstanding changes |
|
1329 | """commit the specified files or all outstanding changes | |
1316 |
|
1330 | |||
1317 | Commit changes to the given files into the repository. Unlike a |
|
1331 | Commit changes to the given files into the repository. Unlike a | |
1318 | centralized SCM, this operation is a local operation. See |
|
1332 | centralized SCM, this operation is a local operation. See | |
1319 | :hg:`push` for a way to actively distribute your changes. |
|
1333 | :hg:`push` for a way to actively distribute your changes. | |
1320 |
|
1334 | |||
1321 | If a list of files is omitted, all changes reported by :hg:`status` |
|
1335 | If a list of files is omitted, all changes reported by :hg:`status` | |
1322 | will be committed. |
|
1336 | will be committed. | |
1323 |
|
1337 | |||
1324 | If you are committing the result of a merge, do not provide any |
|
1338 | If you are committing the result of a merge, do not provide any | |
1325 | filenames or -I/-X filters. |
|
1339 | filenames or -I/-X filters. | |
1326 |
|
1340 | |||
1327 | If no commit message is specified, Mercurial starts your |
|
1341 | If no commit message is specified, Mercurial starts your | |
1328 | configured editor where you can enter a message. In case your |
|
1342 | configured editor where you can enter a message. In case your | |
1329 | commit fails, you will find a backup of your message in |
|
1343 | commit fails, you will find a backup of your message in | |
1330 | ``.hg/last-message.txt``. |
|
1344 | ``.hg/last-message.txt``. | |
1331 |
|
1345 | |||
1332 | The --amend flag can be used to amend the parent of the |
|
1346 | The --amend flag can be used to amend the parent of the | |
1333 | working directory with a new commit that contains the changes |
|
1347 | working directory with a new commit that contains the changes | |
1334 | in the parent in addition to those currently reported by :hg:`status`, |
|
1348 | in the parent in addition to those currently reported by :hg:`status`, | |
1335 | if there are any. The old commit is stored in a backup bundle in |
|
1349 | if there are any. The old commit is stored in a backup bundle in | |
1336 | ``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle` |
|
1350 | ``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle` | |
1337 | on how to restore it). |
|
1351 | on how to restore it). | |
1338 |
|
1352 | |||
1339 | Message, user and date are taken from the amended commit unless |
|
1353 | Message, user and date are taken from the amended commit unless | |
1340 | specified. When a message isn't specified on the command line, |
|
1354 | specified. When a message isn't specified on the command line, | |
1341 | the editor will open with the message of the amended commit. |
|
1355 | the editor will open with the message of the amended commit. | |
1342 |
|
1356 | |||
1343 | It is not possible to amend public changesets (see :hg:`help phases`) |
|
1357 | It is not possible to amend public changesets (see :hg:`help phases`) | |
1344 | or changesets that have children. |
|
1358 | or changesets that have children. | |
1345 |
|
1359 | |||
1346 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
1360 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
1347 |
|
1361 | |||
1348 | Returns 0 on success, 1 if nothing changed. |
|
1362 | Returns 0 on success, 1 if nothing changed. | |
1349 | """ |
|
1363 | """ | |
1350 | if opts.get('subrepos'): |
|
1364 | if opts.get('subrepos'): | |
1351 | if opts.get('amend'): |
|
1365 | if opts.get('amend'): | |
1352 | raise util.Abort(_('cannot amend with --subrepos')) |
|
1366 | raise util.Abort(_('cannot amend with --subrepos')) | |
1353 | # Let --subrepos on the command line override config setting. |
|
1367 | # Let --subrepos on the command line override config setting. | |
1354 | ui.setconfig('ui', 'commitsubrepos', True, 'commit') |
|
1368 | ui.setconfig('ui', 'commitsubrepos', True, 'commit') | |
1355 |
|
1369 | |||
1356 | # Save this for restoring it later |
|
1370 | # Save this for restoring it later | |
1357 | oldcommitphase = ui.config('phases', 'new-commit') |
|
1371 | oldcommitphase = ui.config('phases', 'new-commit') | |
1358 |
|
1372 | |||
1359 | cmdutil.checkunfinished(repo, commit=True) |
|
1373 | cmdutil.checkunfinished(repo, commit=True) | |
1360 |
|
1374 | |||
1361 | branch = repo[None].branch() |
|
1375 | branch = repo[None].branch() | |
1362 | bheads = repo.branchheads(branch) |
|
1376 | bheads = repo.branchheads(branch) | |
1363 |
|
1377 | |||
1364 | extra = {} |
|
1378 | extra = {} | |
1365 | if opts.get('close_branch'): |
|
1379 | if opts.get('close_branch'): | |
1366 | extra['close'] = 1 |
|
1380 | extra['close'] = 1 | |
1367 |
|
1381 | |||
1368 | if not bheads: |
|
1382 | if not bheads: | |
1369 | raise util.Abort(_('can only close branch heads')) |
|
1383 | raise util.Abort(_('can only close branch heads')) | |
1370 | elif opts.get('amend'): |
|
1384 | elif opts.get('amend'): | |
1371 | if repo.parents()[0].p1().branch() != branch and \ |
|
1385 | if repo.parents()[0].p1().branch() != branch and \ | |
1372 | repo.parents()[0].p2().branch() != branch: |
|
1386 | repo.parents()[0].p2().branch() != branch: | |
1373 | raise util.Abort(_('can only close branch heads')) |
|
1387 | raise util.Abort(_('can only close branch heads')) | |
1374 |
|
1388 | |||
1375 | if opts.get('amend'): |
|
1389 | if opts.get('amend'): | |
1376 | if ui.configbool('ui', 'commitsubrepos'): |
|
1390 | if ui.configbool('ui', 'commitsubrepos'): | |
1377 | raise util.Abort(_('cannot amend with ui.commitsubrepos enabled')) |
|
1391 | raise util.Abort(_('cannot amend with ui.commitsubrepos enabled')) | |
1378 |
|
1392 | |||
1379 | old = repo['.'] |
|
1393 | old = repo['.'] | |
1380 | if old.phase() == phases.public: |
|
1394 | if old.phase() == phases.public: | |
1381 | raise util.Abort(_('cannot amend public changesets')) |
|
1395 | raise util.Abort(_('cannot amend public changesets')) | |
1382 | if len(repo[None].parents()) > 1: |
|
1396 | if len(repo[None].parents()) > 1: | |
1383 | raise util.Abort(_('cannot amend while merging')) |
|
1397 | raise util.Abort(_('cannot amend while merging')) | |
1384 | if (not obsolete._enabled) and old.children(): |
|
1398 | if (not obsolete._enabled) and old.children(): | |
1385 | raise util.Abort(_('cannot amend changeset with children')) |
|
1399 | raise util.Abort(_('cannot amend changeset with children')) | |
1386 |
|
1400 | |||
1387 | # commitfunc is used only for temporary amend commit by cmdutil.amend |
|
1401 | # commitfunc is used only for temporary amend commit by cmdutil.amend | |
1388 | def commitfunc(ui, repo, message, match, opts): |
|
1402 | def commitfunc(ui, repo, message, match, opts): | |
1389 | return repo.commit(message, |
|
1403 | return repo.commit(message, | |
1390 | opts.get('user') or old.user(), |
|
1404 | opts.get('user') or old.user(), | |
1391 | opts.get('date') or old.date(), |
|
1405 | opts.get('date') or old.date(), | |
1392 | match, |
|
1406 | match, | |
1393 | extra=extra) |
|
1407 | extra=extra) | |
1394 |
|
1408 | |||
1395 | current = repo._bookmarkcurrent |
|
1409 | current = repo._bookmarkcurrent | |
1396 | marks = old.bookmarks() |
|
1410 | marks = old.bookmarks() | |
1397 | node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) |
|
1411 | node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) | |
1398 | if node == old.node(): |
|
1412 | if node == old.node(): | |
1399 | ui.status(_("nothing changed\n")) |
|
1413 | ui.status(_("nothing changed\n")) | |
1400 | return 1 |
|
1414 | return 1 | |
1401 | elif marks: |
|
1415 | elif marks: | |
1402 | ui.debug('moving bookmarks %r from %s to %s\n' % |
|
1416 | ui.debug('moving bookmarks %r from %s to %s\n' % | |
1403 | (marks, old.hex(), hex(node))) |
|
1417 | (marks, old.hex(), hex(node))) | |
1404 | newmarks = repo._bookmarks |
|
1418 | newmarks = repo._bookmarks | |
1405 | for bm in marks: |
|
1419 | for bm in marks: | |
1406 | newmarks[bm] = node |
|
1420 | newmarks[bm] = node | |
1407 | if bm == current: |
|
1421 | if bm == current: | |
1408 | bookmarks.setcurrent(repo, bm) |
|
1422 | bookmarks.setcurrent(repo, bm) | |
1409 | newmarks.write() |
|
1423 | newmarks.write() | |
1410 | else: |
|
1424 | else: | |
1411 | def commitfunc(ui, repo, message, match, opts): |
|
1425 | def commitfunc(ui, repo, message, match, opts): | |
1412 | try: |
|
1426 | try: | |
1413 | if opts.get('secret'): |
|
1427 | if opts.get('secret'): | |
1414 | ui.setconfig('phases', 'new-commit', 'secret', 'commit') |
|
1428 | ui.setconfig('phases', 'new-commit', 'secret', 'commit') | |
1415 | # Propagate to subrepos |
|
1429 | # Propagate to subrepos | |
1416 | repo.baseui.setconfig('phases', 'new-commit', 'secret', |
|
1430 | repo.baseui.setconfig('phases', 'new-commit', 'secret', | |
1417 | 'commit') |
|
1431 | 'commit') | |
1418 |
|
1432 | |||
1419 | return repo.commit(message, opts.get('user'), opts.get('date'), |
|
1433 | return repo.commit(message, opts.get('user'), opts.get('date'), | |
1420 | match, |
|
1434 | match, | |
1421 | editor=cmdutil.getcommiteditor(**opts), |
|
1435 | editor=cmdutil.getcommiteditor(**opts), | |
1422 | extra=extra) |
|
1436 | extra=extra) | |
1423 | finally: |
|
1437 | finally: | |
1424 | ui.setconfig('phases', 'new-commit', oldcommitphase, 'commit') |
|
1438 | ui.setconfig('phases', 'new-commit', oldcommitphase, 'commit') | |
1425 | repo.baseui.setconfig('phases', 'new-commit', oldcommitphase, |
|
1439 | repo.baseui.setconfig('phases', 'new-commit', oldcommitphase, | |
1426 | 'commit') |
|
1440 | 'commit') | |
1427 |
|
1441 | |||
1428 |
|
1442 | |||
1429 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) |
|
1443 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | |
1430 |
|
1444 | |||
1431 | if not node: |
|
1445 | if not node: | |
1432 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) |
|
1446 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) | |
1433 | if stat[3]: |
|
1447 | if stat[3]: | |
1434 | ui.status(_("nothing changed (%d missing files, see " |
|
1448 | ui.status(_("nothing changed (%d missing files, see " | |
1435 | "'hg status')\n") % len(stat[3])) |
|
1449 | "'hg status')\n") % len(stat[3])) | |
1436 | else: |
|
1450 | else: | |
1437 | ui.status(_("nothing changed\n")) |
|
1451 | ui.status(_("nothing changed\n")) | |
1438 | return 1 |
|
1452 | return 1 | |
1439 |
|
1453 | |||
1440 | cmdutil.commitstatus(repo, node, branch, bheads, opts) |
|
1454 | cmdutil.commitstatus(repo, node, branch, bheads, opts) | |
1441 |
|
1455 | |||
1442 | @command('config|showconfig|debugconfig', |
|
1456 | @command('config|showconfig|debugconfig', | |
1443 | [('u', 'untrusted', None, _('show untrusted configuration options')), |
|
1457 | [('u', 'untrusted', None, _('show untrusted configuration options')), | |
1444 | ('e', 'edit', None, _('edit user config')), |
|
1458 | ('e', 'edit', None, _('edit user config')), | |
1445 | ('l', 'local', None, _('edit repository config')), |
|
1459 | ('l', 'local', None, _('edit repository config')), | |
1446 | ('g', 'global', None, _('edit global config'))], |
|
1460 | ('g', 'global', None, _('edit global config'))], | |
1447 | _('[-u] [NAME]...')) |
|
1461 | _('[-u] [NAME]...')) | |
1448 | def config(ui, repo, *values, **opts): |
|
1462 | def config(ui, repo, *values, **opts): | |
1449 | """show combined config settings from all hgrc files |
|
1463 | """show combined config settings from all hgrc files | |
1450 |
|
1464 | |||
1451 | With no arguments, print names and values of all config items. |
|
1465 | With no arguments, print names and values of all config items. | |
1452 |
|
1466 | |||
1453 | With one argument of the form section.name, print just the value |
|
1467 | With one argument of the form section.name, print just the value | |
1454 | of that config item. |
|
1468 | of that config item. | |
1455 |
|
1469 | |||
1456 | With multiple arguments, print names and values of all config |
|
1470 | With multiple arguments, print names and values of all config | |
1457 | items with matching section names. |
|
1471 | items with matching section names. | |
1458 |
|
1472 | |||
1459 | With --edit, start an editor on the user-level config file. With |
|
1473 | With --edit, start an editor on the user-level config file. With | |
1460 | --global, edit the system-wide config file. With --local, edit the |
|
1474 | --global, edit the system-wide config file. With --local, edit the | |
1461 | repository-level config file. |
|
1475 | repository-level config file. | |
1462 |
|
1476 | |||
1463 | With --debug, the source (filename and line number) is printed |
|
1477 | With --debug, the source (filename and line number) is printed | |
1464 | for each config item. |
|
1478 | for each config item. | |
1465 |
|
1479 | |||
1466 | See :hg:`help config` for more information about config files. |
|
1480 | See :hg:`help config` for more information about config files. | |
1467 |
|
1481 | |||
1468 | Returns 0 on success. |
|
1482 | Returns 0 on success. | |
1469 |
|
1483 | |||
1470 | """ |
|
1484 | """ | |
1471 |
|
1485 | |||
1472 | if opts.get('edit') or opts.get('local') or opts.get('global'): |
|
1486 | if opts.get('edit') or opts.get('local') or opts.get('global'): | |
1473 | if opts.get('local') and opts.get('global'): |
|
1487 | if opts.get('local') and opts.get('global'): | |
1474 | raise util.Abort(_("can't use --local and --global together")) |
|
1488 | raise util.Abort(_("can't use --local and --global together")) | |
1475 |
|
1489 | |||
1476 | if opts.get('local'): |
|
1490 | if opts.get('local'): | |
1477 | if not repo: |
|
1491 | if not repo: | |
1478 | raise util.Abort(_("can't use --local outside a repository")) |
|
1492 | raise util.Abort(_("can't use --local outside a repository")) | |
1479 | paths = [repo.join('hgrc')] |
|
1493 | paths = [repo.join('hgrc')] | |
1480 | elif opts.get('global'): |
|
1494 | elif opts.get('global'): | |
1481 | paths = scmutil.systemrcpath() |
|
1495 | paths = scmutil.systemrcpath() | |
1482 | else: |
|
1496 | else: | |
1483 | paths = scmutil.userrcpath() |
|
1497 | paths = scmutil.userrcpath() | |
1484 |
|
1498 | |||
1485 | for f in paths: |
|
1499 | for f in paths: | |
1486 | if os.path.exists(f): |
|
1500 | if os.path.exists(f): | |
1487 | break |
|
1501 | break | |
1488 | else: |
|
1502 | else: | |
1489 | f = paths[0] |
|
1503 | f = paths[0] | |
1490 | fp = open(f, "w") |
|
1504 | fp = open(f, "w") | |
1491 | fp.write( |
|
1505 | fp.write( | |
1492 | '# example config (see "hg help config" for more info)\n' |
|
1506 | '# example config (see "hg help config" for more info)\n' | |
1493 | '\n' |
|
1507 | '\n' | |
1494 | '[ui]\n' |
|
1508 | '[ui]\n' | |
1495 | '# name and email, e.g.\n' |
|
1509 | '# name and email, e.g.\n' | |
1496 | '# username = Jane Doe <jdoe@example.com>\n' |
|
1510 | '# username = Jane Doe <jdoe@example.com>\n' | |
1497 | 'username =\n' |
|
1511 | 'username =\n' | |
1498 | '\n' |
|
1512 | '\n' | |
1499 | '[extensions]\n' |
|
1513 | '[extensions]\n' | |
1500 | '# uncomment these lines to enable some popular extensions\n' |
|
1514 | '# uncomment these lines to enable some popular extensions\n' | |
1501 | '# (see "hg help extensions" for more info)\n' |
|
1515 | '# (see "hg help extensions" for more info)\n' | |
1502 | '# pager =\n' |
|
1516 | '# pager =\n' | |
1503 | '# progress =\n' |
|
1517 | '# progress =\n' | |
1504 | '# color =\n') |
|
1518 | '# color =\n') | |
1505 | fp.close() |
|
1519 | fp.close() | |
1506 |
|
1520 | |||
1507 | editor = ui.geteditor() |
|
1521 | editor = ui.geteditor() | |
1508 | util.system("%s \"%s\"" % (editor, f), |
|
1522 | util.system("%s \"%s\"" % (editor, f), | |
1509 | onerr=util.Abort, errprefix=_("edit failed"), |
|
1523 | onerr=util.Abort, errprefix=_("edit failed"), | |
1510 | out=ui.fout) |
|
1524 | out=ui.fout) | |
1511 | return |
|
1525 | return | |
1512 |
|
1526 | |||
1513 | for f in scmutil.rcpath(): |
|
1527 | for f in scmutil.rcpath(): | |
1514 | ui.debug('read config from: %s\n' % f) |
|
1528 | ui.debug('read config from: %s\n' % f) | |
1515 | untrusted = bool(opts.get('untrusted')) |
|
1529 | untrusted = bool(opts.get('untrusted')) | |
1516 | if values: |
|
1530 | if values: | |
1517 | sections = [v for v in values if '.' not in v] |
|
1531 | sections = [v for v in values if '.' not in v] | |
1518 | items = [v for v in values if '.' in v] |
|
1532 | items = [v for v in values if '.' in v] | |
1519 | if len(items) > 1 or items and sections: |
|
1533 | if len(items) > 1 or items and sections: | |
1520 | raise util.Abort(_('only one config item permitted')) |
|
1534 | raise util.Abort(_('only one config item permitted')) | |
1521 | for section, name, value in ui.walkconfig(untrusted=untrusted): |
|
1535 | for section, name, value in ui.walkconfig(untrusted=untrusted): | |
1522 | value = str(value).replace('\n', '\\n') |
|
1536 | value = str(value).replace('\n', '\\n') | |
1523 | sectname = section + '.' + name |
|
1537 | sectname = section + '.' + name | |
1524 | if values: |
|
1538 | if values: | |
1525 | for v in values: |
|
1539 | for v in values: | |
1526 | if v == section: |
|
1540 | if v == section: | |
1527 | ui.debug('%s: ' % |
|
1541 | ui.debug('%s: ' % | |
1528 | ui.configsource(section, name, untrusted)) |
|
1542 | ui.configsource(section, name, untrusted)) | |
1529 | ui.write('%s=%s\n' % (sectname, value)) |
|
1543 | ui.write('%s=%s\n' % (sectname, value)) | |
1530 | elif v == sectname: |
|
1544 | elif v == sectname: | |
1531 | ui.debug('%s: ' % |
|
1545 | ui.debug('%s: ' % | |
1532 | ui.configsource(section, name, untrusted)) |
|
1546 | ui.configsource(section, name, untrusted)) | |
1533 | ui.write(value, '\n') |
|
1547 | ui.write(value, '\n') | |
1534 | else: |
|
1548 | else: | |
1535 | ui.debug('%s: ' % |
|
1549 | ui.debug('%s: ' % | |
1536 | ui.configsource(section, name, untrusted)) |
|
1550 | ui.configsource(section, name, untrusted)) | |
1537 | ui.write('%s=%s\n' % (sectname, value)) |
|
1551 | ui.write('%s=%s\n' % (sectname, value)) | |
1538 |
|
1552 | |||
1539 | @command('copy|cp', |
|
1553 | @command('copy|cp', | |
1540 | [('A', 'after', None, _('record a copy that has already occurred')), |
|
1554 | [('A', 'after', None, _('record a copy that has already occurred')), | |
1541 | ('f', 'force', None, _('forcibly copy over an existing managed file')), |
|
1555 | ('f', 'force', None, _('forcibly copy over an existing managed file')), | |
1542 | ] + walkopts + dryrunopts, |
|
1556 | ] + walkopts + dryrunopts, | |
1543 | _('[OPTION]... [SOURCE]... DEST')) |
|
1557 | _('[OPTION]... [SOURCE]... DEST')) | |
1544 | def copy(ui, repo, *pats, **opts): |
|
1558 | def copy(ui, repo, *pats, **opts): | |
1545 | """mark files as copied for the next commit |
|
1559 | """mark files as copied for the next commit | |
1546 |
|
1560 | |||
1547 | Mark dest as having copies of source files. If dest is a |
|
1561 | Mark dest as having copies of source files. If dest is a | |
1548 | directory, copies are put in that directory. If dest is a file, |
|
1562 | directory, copies are put in that directory. If dest is a file, | |
1549 | the source must be a single file. |
|
1563 | the source must be a single file. | |
1550 |
|
1564 | |||
1551 | By default, this command copies the contents of files as they |
|
1565 | By default, this command copies the contents of files as they | |
1552 | exist in the working directory. If invoked with -A/--after, the |
|
1566 | exist in the working directory. If invoked with -A/--after, the | |
1553 | operation is recorded, but no copying is performed. |
|
1567 | operation is recorded, but no copying is performed. | |
1554 |
|
1568 | |||
1555 | This command takes effect with the next commit. To undo a copy |
|
1569 | This command takes effect with the next commit. To undo a copy | |
1556 | before that, see :hg:`revert`. |
|
1570 | before that, see :hg:`revert`. | |
1557 |
|
1571 | |||
1558 | Returns 0 on success, 1 if errors are encountered. |
|
1572 | Returns 0 on success, 1 if errors are encountered. | |
1559 | """ |
|
1573 | """ | |
1560 | wlock = repo.wlock(False) |
|
1574 | wlock = repo.wlock(False) | |
1561 | try: |
|
1575 | try: | |
1562 | return cmdutil.copy(ui, repo, pats, opts) |
|
1576 | return cmdutil.copy(ui, repo, pats, opts) | |
1563 | finally: |
|
1577 | finally: | |
1564 | wlock.release() |
|
1578 | wlock.release() | |
1565 |
|
1579 | |||
1566 | @command('debugancestor', [], _('[INDEX] REV1 REV2')) |
|
1580 | @command('debugancestor', [], _('[INDEX] REV1 REV2')) | |
1567 | def debugancestor(ui, repo, *args): |
|
1581 | def debugancestor(ui, repo, *args): | |
1568 | """find the ancestor revision of two revisions in a given index""" |
|
1582 | """find the ancestor revision of two revisions in a given index""" | |
1569 | if len(args) == 3: |
|
1583 | if len(args) == 3: | |
1570 | index, rev1, rev2 = args |
|
1584 | index, rev1, rev2 = args | |
1571 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), index) |
|
1585 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), index) | |
1572 | lookup = r.lookup |
|
1586 | lookup = r.lookup | |
1573 | elif len(args) == 2: |
|
1587 | elif len(args) == 2: | |
1574 | if not repo: |
|
1588 | if not repo: | |
1575 | raise util.Abort(_("there is no Mercurial repository here " |
|
1589 | raise util.Abort(_("there is no Mercurial repository here " | |
1576 | "(.hg not found)")) |
|
1590 | "(.hg not found)")) | |
1577 | rev1, rev2 = args |
|
1591 | rev1, rev2 = args | |
1578 | r = repo.changelog |
|
1592 | r = repo.changelog | |
1579 | lookup = repo.lookup |
|
1593 | lookup = repo.lookup | |
1580 | else: |
|
1594 | else: | |
1581 | raise util.Abort(_('either two or three arguments required')) |
|
1595 | raise util.Abort(_('either two or three arguments required')) | |
1582 | a = r.ancestor(lookup(rev1), lookup(rev2)) |
|
1596 | a = r.ancestor(lookup(rev1), lookup(rev2)) | |
1583 | ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
|
1597 | ui.write("%d:%s\n" % (r.rev(a), hex(a))) | |
1584 |
|
1598 | |||
1585 | @command('debugbuilddag', |
|
1599 | @command('debugbuilddag', | |
1586 | [('m', 'mergeable-file', None, _('add single file mergeable changes')), |
|
1600 | [('m', 'mergeable-file', None, _('add single file mergeable changes')), | |
1587 | ('o', 'overwritten-file', None, _('add single file all revs overwrite')), |
|
1601 | ('o', 'overwritten-file', None, _('add single file all revs overwrite')), | |
1588 | ('n', 'new-file', None, _('add new file at each rev'))], |
|
1602 | ('n', 'new-file', None, _('add new file at each rev'))], | |
1589 | _('[OPTION]... [TEXT]')) |
|
1603 | _('[OPTION]... [TEXT]')) | |
1590 | def debugbuilddag(ui, repo, text=None, |
|
1604 | def debugbuilddag(ui, repo, text=None, | |
1591 | mergeable_file=False, |
|
1605 | mergeable_file=False, | |
1592 | overwritten_file=False, |
|
1606 | overwritten_file=False, | |
1593 | new_file=False): |
|
1607 | new_file=False): | |
1594 | """builds a repo with a given DAG from scratch in the current empty repo |
|
1608 | """builds a repo with a given DAG from scratch in the current empty repo | |
1595 |
|
1609 | |||
1596 | The description of the DAG is read from stdin if not given on the |
|
1610 | The description of the DAG is read from stdin if not given on the | |
1597 | command line. |
|
1611 | command line. | |
1598 |
|
1612 | |||
1599 | Elements: |
|
1613 | Elements: | |
1600 |
|
1614 | |||
1601 | - "+n" is a linear run of n nodes based on the current default parent |
|
1615 | - "+n" is a linear run of n nodes based on the current default parent | |
1602 | - "." is a single node based on the current default parent |
|
1616 | - "." is a single node based on the current default parent | |
1603 | - "$" resets the default parent to null (implied at the start); |
|
1617 | - "$" resets the default parent to null (implied at the start); | |
1604 | otherwise the default parent is always the last node created |
|
1618 | otherwise the default parent is always the last node created | |
1605 | - "<p" sets the default parent to the backref p |
|
1619 | - "<p" sets the default parent to the backref p | |
1606 | - "*p" is a fork at parent p, which is a backref |
|
1620 | - "*p" is a fork at parent p, which is a backref | |
1607 | - "*p1/p2" is a merge of parents p1 and p2, which are backrefs |
|
1621 | - "*p1/p2" is a merge of parents p1 and p2, which are backrefs | |
1608 | - "/p2" is a merge of the preceding node and p2 |
|
1622 | - "/p2" is a merge of the preceding node and p2 | |
1609 | - ":tag" defines a local tag for the preceding node |
|
1623 | - ":tag" defines a local tag for the preceding node | |
1610 | - "@branch" sets the named branch for subsequent nodes |
|
1624 | - "@branch" sets the named branch for subsequent nodes | |
1611 | - "#...\\n" is a comment up to the end of the line |
|
1625 | - "#...\\n" is a comment up to the end of the line | |
1612 |
|
1626 | |||
1613 | Whitespace between the above elements is ignored. |
|
1627 | Whitespace between the above elements is ignored. | |
1614 |
|
1628 | |||
1615 | A backref is either |
|
1629 | A backref is either | |
1616 |
|
1630 | |||
1617 | - a number n, which references the node curr-n, where curr is the current |
|
1631 | - a number n, which references the node curr-n, where curr is the current | |
1618 | node, or |
|
1632 | node, or | |
1619 | - the name of a local tag you placed earlier using ":tag", or |
|
1633 | - the name of a local tag you placed earlier using ":tag", or | |
1620 | - empty to denote the default parent. |
|
1634 | - empty to denote the default parent. | |
1621 |
|
1635 | |||
1622 | All string valued-elements are either strictly alphanumeric, or must |
|
1636 | All string valued-elements are either strictly alphanumeric, or must | |
1623 | be enclosed in double quotes ("..."), with "\\" as escape character. |
|
1637 | be enclosed in double quotes ("..."), with "\\" as escape character. | |
1624 | """ |
|
1638 | """ | |
1625 |
|
1639 | |||
1626 | if text is None: |
|
1640 | if text is None: | |
1627 | ui.status(_("reading DAG from stdin\n")) |
|
1641 | ui.status(_("reading DAG from stdin\n")) | |
1628 | text = ui.fin.read() |
|
1642 | text = ui.fin.read() | |
1629 |
|
1643 | |||
1630 | cl = repo.changelog |
|
1644 | cl = repo.changelog | |
1631 | if len(cl) > 0: |
|
1645 | if len(cl) > 0: | |
1632 | raise util.Abort(_('repository is not empty')) |
|
1646 | raise util.Abort(_('repository is not empty')) | |
1633 |
|
1647 | |||
1634 | # determine number of revs in DAG |
|
1648 | # determine number of revs in DAG | |
1635 | total = 0 |
|
1649 | total = 0 | |
1636 | for type, data in dagparser.parsedag(text): |
|
1650 | for type, data in dagparser.parsedag(text): | |
1637 | if type == 'n': |
|
1651 | if type == 'n': | |
1638 | total += 1 |
|
1652 | total += 1 | |
1639 |
|
1653 | |||
1640 | if mergeable_file: |
|
1654 | if mergeable_file: | |
1641 | linesperrev = 2 |
|
1655 | linesperrev = 2 | |
1642 | # make a file with k lines per rev |
|
1656 | # make a file with k lines per rev | |
1643 | initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)] |
|
1657 | initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)] | |
1644 | initialmergedlines.append("") |
|
1658 | initialmergedlines.append("") | |
1645 |
|
1659 | |||
1646 | tags = [] |
|
1660 | tags = [] | |
1647 |
|
1661 | |||
1648 | lock = tr = None |
|
1662 | lock = tr = None | |
1649 | try: |
|
1663 | try: | |
1650 | lock = repo.lock() |
|
1664 | lock = repo.lock() | |
1651 | tr = repo.transaction("builddag") |
|
1665 | tr = repo.transaction("builddag") | |
1652 |
|
1666 | |||
1653 | at = -1 |
|
1667 | at = -1 | |
1654 | atbranch = 'default' |
|
1668 | atbranch = 'default' | |
1655 | nodeids = [] |
|
1669 | nodeids = [] | |
1656 | id = 0 |
|
1670 | id = 0 | |
1657 | ui.progress(_('building'), id, unit=_('revisions'), total=total) |
|
1671 | ui.progress(_('building'), id, unit=_('revisions'), total=total) | |
1658 | for type, data in dagparser.parsedag(text): |
|
1672 | for type, data in dagparser.parsedag(text): | |
1659 | if type == 'n': |
|
1673 | if type == 'n': | |
1660 | ui.note(('node %s\n' % str(data))) |
|
1674 | ui.note(('node %s\n' % str(data))) | |
1661 | id, ps = data |
|
1675 | id, ps = data | |
1662 |
|
1676 | |||
1663 | files = [] |
|
1677 | files = [] | |
1664 | fctxs = {} |
|
1678 | fctxs = {} | |
1665 |
|
1679 | |||
1666 | p2 = None |
|
1680 | p2 = None | |
1667 | if mergeable_file: |
|
1681 | if mergeable_file: | |
1668 | fn = "mf" |
|
1682 | fn = "mf" | |
1669 | p1 = repo[ps[0]] |
|
1683 | p1 = repo[ps[0]] | |
1670 | if len(ps) > 1: |
|
1684 | if len(ps) > 1: | |
1671 | p2 = repo[ps[1]] |
|
1685 | p2 = repo[ps[1]] | |
1672 | pa = p1.ancestor(p2) |
|
1686 | pa = p1.ancestor(p2) | |
1673 | base, local, other = [x[fn].data() for x in (pa, p1, |
|
1687 | base, local, other = [x[fn].data() for x in (pa, p1, | |
1674 | p2)] |
|
1688 | p2)] | |
1675 | m3 = simplemerge.Merge3Text(base, local, other) |
|
1689 | m3 = simplemerge.Merge3Text(base, local, other) | |
1676 | ml = [l.strip() for l in m3.merge_lines()] |
|
1690 | ml = [l.strip() for l in m3.merge_lines()] | |
1677 | ml.append("") |
|
1691 | ml.append("") | |
1678 | elif at > 0: |
|
1692 | elif at > 0: | |
1679 | ml = p1[fn].data().split("\n") |
|
1693 | ml = p1[fn].data().split("\n") | |
1680 | else: |
|
1694 | else: | |
1681 | ml = initialmergedlines |
|
1695 | ml = initialmergedlines | |
1682 | ml[id * linesperrev] += " r%i" % id |
|
1696 | ml[id * linesperrev] += " r%i" % id | |
1683 | mergedtext = "\n".join(ml) |
|
1697 | mergedtext = "\n".join(ml) | |
1684 | files.append(fn) |
|
1698 | files.append(fn) | |
1685 | fctxs[fn] = context.memfilectx(repo, fn, mergedtext) |
|
1699 | fctxs[fn] = context.memfilectx(repo, fn, mergedtext) | |
1686 |
|
1700 | |||
1687 | if overwritten_file: |
|
1701 | if overwritten_file: | |
1688 | fn = "of" |
|
1702 | fn = "of" | |
1689 | files.append(fn) |
|
1703 | files.append(fn) | |
1690 | fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) |
|
1704 | fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) | |
1691 |
|
1705 | |||
1692 | if new_file: |
|
1706 | if new_file: | |
1693 | fn = "nf%i" % id |
|
1707 | fn = "nf%i" % id | |
1694 | files.append(fn) |
|
1708 | files.append(fn) | |
1695 | fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) |
|
1709 | fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) | |
1696 | if len(ps) > 1: |
|
1710 | if len(ps) > 1: | |
1697 | if not p2: |
|
1711 | if not p2: | |
1698 | p2 = repo[ps[1]] |
|
1712 | p2 = repo[ps[1]] | |
1699 | for fn in p2: |
|
1713 | for fn in p2: | |
1700 | if fn.startswith("nf"): |
|
1714 | if fn.startswith("nf"): | |
1701 | files.append(fn) |
|
1715 | files.append(fn) | |
1702 | fctxs[fn] = p2[fn] |
|
1716 | fctxs[fn] = p2[fn] | |
1703 |
|
1717 | |||
1704 | def fctxfn(repo, cx, path): |
|
1718 | def fctxfn(repo, cx, path): | |
1705 | return fctxs.get(path) |
|
1719 | return fctxs.get(path) | |
1706 |
|
1720 | |||
1707 | if len(ps) == 0 or ps[0] < 0: |
|
1721 | if len(ps) == 0 or ps[0] < 0: | |
1708 | pars = [None, None] |
|
1722 | pars = [None, None] | |
1709 | elif len(ps) == 1: |
|
1723 | elif len(ps) == 1: | |
1710 | pars = [nodeids[ps[0]], None] |
|
1724 | pars = [nodeids[ps[0]], None] | |
1711 | else: |
|
1725 | else: | |
1712 | pars = [nodeids[p] for p in ps] |
|
1726 | pars = [nodeids[p] for p in ps] | |
1713 | cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, |
|
1727 | cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, | |
1714 | date=(id, 0), |
|
1728 | date=(id, 0), | |
1715 | user="debugbuilddag", |
|
1729 | user="debugbuilddag", | |
1716 | extra={'branch': atbranch}) |
|
1730 | extra={'branch': atbranch}) | |
1717 | nodeid = repo.commitctx(cx) |
|
1731 | nodeid = repo.commitctx(cx) | |
1718 | nodeids.append(nodeid) |
|
1732 | nodeids.append(nodeid) | |
1719 | at = id |
|
1733 | at = id | |
1720 | elif type == 'l': |
|
1734 | elif type == 'l': | |
1721 | id, name = data |
|
1735 | id, name = data | |
1722 | ui.note(('tag %s\n' % name)) |
|
1736 | ui.note(('tag %s\n' % name)) | |
1723 | tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) |
|
1737 | tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) | |
1724 | elif type == 'a': |
|
1738 | elif type == 'a': | |
1725 | ui.note(('branch %s\n' % data)) |
|
1739 | ui.note(('branch %s\n' % data)) | |
1726 | atbranch = data |
|
1740 | atbranch = data | |
1727 | ui.progress(_('building'), id, unit=_('revisions'), total=total) |
|
1741 | ui.progress(_('building'), id, unit=_('revisions'), total=total) | |
1728 | tr.close() |
|
1742 | tr.close() | |
1729 |
|
1743 | |||
1730 | if tags: |
|
1744 | if tags: | |
1731 | repo.opener.write("localtags", "".join(tags)) |
|
1745 | repo.opener.write("localtags", "".join(tags)) | |
1732 | finally: |
|
1746 | finally: | |
1733 | ui.progress(_('building'), None) |
|
1747 | ui.progress(_('building'), None) | |
1734 | release(tr, lock) |
|
1748 | release(tr, lock) | |
1735 |
|
1749 | |||
1736 | @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE')) |
|
1750 | @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE')) | |
1737 | def debugbundle(ui, bundlepath, all=None, **opts): |
|
1751 | def debugbundle(ui, bundlepath, all=None, **opts): | |
1738 | """lists the contents of a bundle""" |
|
1752 | """lists the contents of a bundle""" | |
1739 | f = hg.openpath(ui, bundlepath) |
|
1753 | f = hg.openpath(ui, bundlepath) | |
1740 | try: |
|
1754 | try: | |
1741 | gen = exchange.readbundle(ui, f, bundlepath) |
|
1755 | gen = exchange.readbundle(ui, f, bundlepath) | |
1742 | if all: |
|
1756 | if all: | |
1743 | ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n")) |
|
1757 | ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n")) | |
1744 |
|
1758 | |||
1745 | def showchunks(named): |
|
1759 | def showchunks(named): | |
1746 | ui.write("\n%s\n" % named) |
|
1760 | ui.write("\n%s\n" % named) | |
1747 | chain = None |
|
1761 | chain = None | |
1748 | while True: |
|
1762 | while True: | |
1749 | chunkdata = gen.deltachunk(chain) |
|
1763 | chunkdata = gen.deltachunk(chain) | |
1750 | if not chunkdata: |
|
1764 | if not chunkdata: | |
1751 | break |
|
1765 | break | |
1752 | node = chunkdata['node'] |
|
1766 | node = chunkdata['node'] | |
1753 | p1 = chunkdata['p1'] |
|
1767 | p1 = chunkdata['p1'] | |
1754 | p2 = chunkdata['p2'] |
|
1768 | p2 = chunkdata['p2'] | |
1755 | cs = chunkdata['cs'] |
|
1769 | cs = chunkdata['cs'] | |
1756 | deltabase = chunkdata['deltabase'] |
|
1770 | deltabase = chunkdata['deltabase'] | |
1757 | delta = chunkdata['delta'] |
|
1771 | delta = chunkdata['delta'] | |
1758 | ui.write("%s %s %s %s %s %s\n" % |
|
1772 | ui.write("%s %s %s %s %s %s\n" % | |
1759 | (hex(node), hex(p1), hex(p2), |
|
1773 | (hex(node), hex(p1), hex(p2), | |
1760 | hex(cs), hex(deltabase), len(delta))) |
|
1774 | hex(cs), hex(deltabase), len(delta))) | |
1761 | chain = node |
|
1775 | chain = node | |
1762 |
|
1776 | |||
1763 | chunkdata = gen.changelogheader() |
|
1777 | chunkdata = gen.changelogheader() | |
1764 | showchunks("changelog") |
|
1778 | showchunks("changelog") | |
1765 | chunkdata = gen.manifestheader() |
|
1779 | chunkdata = gen.manifestheader() | |
1766 | showchunks("manifest") |
|
1780 | showchunks("manifest") | |
1767 | while True: |
|
1781 | while True: | |
1768 | chunkdata = gen.filelogheader() |
|
1782 | chunkdata = gen.filelogheader() | |
1769 | if not chunkdata: |
|
1783 | if not chunkdata: | |
1770 | break |
|
1784 | break | |
1771 | fname = chunkdata['filename'] |
|
1785 | fname = chunkdata['filename'] | |
1772 | showchunks(fname) |
|
1786 | showchunks(fname) | |
1773 | else: |
|
1787 | else: | |
1774 | chunkdata = gen.changelogheader() |
|
1788 | chunkdata = gen.changelogheader() | |
1775 | chain = None |
|
1789 | chain = None | |
1776 | while True: |
|
1790 | while True: | |
1777 | chunkdata = gen.deltachunk(chain) |
|
1791 | chunkdata = gen.deltachunk(chain) | |
1778 | if not chunkdata: |
|
1792 | if not chunkdata: | |
1779 | break |
|
1793 | break | |
1780 | node = chunkdata['node'] |
|
1794 | node = chunkdata['node'] | |
1781 | ui.write("%s\n" % hex(node)) |
|
1795 | ui.write("%s\n" % hex(node)) | |
1782 | chain = node |
|
1796 | chain = node | |
1783 | finally: |
|
1797 | finally: | |
1784 | f.close() |
|
1798 | f.close() | |
1785 |
|
1799 | |||
1786 | @command('debugcheckstate', [], '') |
|
1800 | @command('debugcheckstate', [], '') | |
1787 | def debugcheckstate(ui, repo): |
|
1801 | def debugcheckstate(ui, repo): | |
1788 | """validate the correctness of the current dirstate""" |
|
1802 | """validate the correctness of the current dirstate""" | |
1789 | parent1, parent2 = repo.dirstate.parents() |
|
1803 | parent1, parent2 = repo.dirstate.parents() | |
1790 | m1 = repo[parent1].manifest() |
|
1804 | m1 = repo[parent1].manifest() | |
1791 | m2 = repo[parent2].manifest() |
|
1805 | m2 = repo[parent2].manifest() | |
1792 | errors = 0 |
|
1806 | errors = 0 | |
1793 | for f in repo.dirstate: |
|
1807 | for f in repo.dirstate: | |
1794 | state = repo.dirstate[f] |
|
1808 | state = repo.dirstate[f] | |
1795 | if state in "nr" and f not in m1: |
|
1809 | if state in "nr" and f not in m1: | |
1796 | ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
|
1810 | ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) | |
1797 | errors += 1 |
|
1811 | errors += 1 | |
1798 | if state in "a" and f in m1: |
|
1812 | if state in "a" and f in m1: | |
1799 | ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
|
1813 | ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) | |
1800 | errors += 1 |
|
1814 | errors += 1 | |
1801 | if state in "m" and f not in m1 and f not in m2: |
|
1815 | if state in "m" and f not in m1 and f not in m2: | |
1802 | ui.warn(_("%s in state %s, but not in either manifest\n") % |
|
1816 | ui.warn(_("%s in state %s, but not in either manifest\n") % | |
1803 | (f, state)) |
|
1817 | (f, state)) | |
1804 | errors += 1 |
|
1818 | errors += 1 | |
1805 | for f in m1: |
|
1819 | for f in m1: | |
1806 | state = repo.dirstate[f] |
|
1820 | state = repo.dirstate[f] | |
1807 | if state not in "nrm": |
|
1821 | if state not in "nrm": | |
1808 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
|
1822 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) | |
1809 | errors += 1 |
|
1823 | errors += 1 | |
1810 | if errors: |
|
1824 | if errors: | |
1811 | error = _(".hg/dirstate inconsistent with current parent's manifest") |
|
1825 | error = _(".hg/dirstate inconsistent with current parent's manifest") | |
1812 | raise util.Abort(error) |
|
1826 | raise util.Abort(error) | |
1813 |
|
1827 | |||
1814 | @command('debugcommands', [], _('[COMMAND]')) |
|
1828 | @command('debugcommands', [], _('[COMMAND]')) | |
1815 | def debugcommands(ui, cmd='', *args): |
|
1829 | def debugcommands(ui, cmd='', *args): | |
1816 | """list all available commands and options""" |
|
1830 | """list all available commands and options""" | |
1817 | for cmd, vals in sorted(table.iteritems()): |
|
1831 | for cmd, vals in sorted(table.iteritems()): | |
1818 | cmd = cmd.split('|')[0].strip('^') |
|
1832 | cmd = cmd.split('|')[0].strip('^') | |
1819 | opts = ', '.join([i[1] for i in vals[1]]) |
|
1833 | opts = ', '.join([i[1] for i in vals[1]]) | |
1820 | ui.write('%s: %s\n' % (cmd, opts)) |
|
1834 | ui.write('%s: %s\n' % (cmd, opts)) | |
1821 |
|
1835 | |||
1822 | @command('debugcomplete', |
|
1836 | @command('debugcomplete', | |
1823 | [('o', 'options', None, _('show the command options'))], |
|
1837 | [('o', 'options', None, _('show the command options'))], | |
1824 | _('[-o] CMD')) |
|
1838 | _('[-o] CMD')) | |
1825 | def debugcomplete(ui, cmd='', **opts): |
|
1839 | def debugcomplete(ui, cmd='', **opts): | |
1826 | """returns the completion list associated with the given command""" |
|
1840 | """returns the completion list associated with the given command""" | |
1827 |
|
1841 | |||
1828 | if opts.get('options'): |
|
1842 | if opts.get('options'): | |
1829 | options = [] |
|
1843 | options = [] | |
1830 | otables = [globalopts] |
|
1844 | otables = [globalopts] | |
1831 | if cmd: |
|
1845 | if cmd: | |
1832 | aliases, entry = cmdutil.findcmd(cmd, table, False) |
|
1846 | aliases, entry = cmdutil.findcmd(cmd, table, False) | |
1833 | otables.append(entry[1]) |
|
1847 | otables.append(entry[1]) | |
1834 | for t in otables: |
|
1848 | for t in otables: | |
1835 | for o in t: |
|
1849 | for o in t: | |
1836 | if "(DEPRECATED)" in o[3]: |
|
1850 | if "(DEPRECATED)" in o[3]: | |
1837 | continue |
|
1851 | continue | |
1838 | if o[0]: |
|
1852 | if o[0]: | |
1839 | options.append('-%s' % o[0]) |
|
1853 | options.append('-%s' % o[0]) | |
1840 | options.append('--%s' % o[1]) |
|
1854 | options.append('--%s' % o[1]) | |
1841 | ui.write("%s\n" % "\n".join(options)) |
|
1855 | ui.write("%s\n" % "\n".join(options)) | |
1842 | return |
|
1856 | return | |
1843 |
|
1857 | |||
1844 | cmdlist = cmdutil.findpossible(cmd, table) |
|
1858 | cmdlist = cmdutil.findpossible(cmd, table) | |
1845 | if ui.verbose: |
|
1859 | if ui.verbose: | |
1846 | cmdlist = [' '.join(c[0]) for c in cmdlist.values()] |
|
1860 | cmdlist = [' '.join(c[0]) for c in cmdlist.values()] | |
1847 | ui.write("%s\n" % "\n".join(sorted(cmdlist))) |
|
1861 | ui.write("%s\n" % "\n".join(sorted(cmdlist))) | |
1848 |
|
1862 | |||
1849 | @command('debugdag', |
|
1863 | @command('debugdag', | |
1850 | [('t', 'tags', None, _('use tags as labels')), |
|
1864 | [('t', 'tags', None, _('use tags as labels')), | |
1851 | ('b', 'branches', None, _('annotate with branch names')), |
|
1865 | ('b', 'branches', None, _('annotate with branch names')), | |
1852 | ('', 'dots', None, _('use dots for runs')), |
|
1866 | ('', 'dots', None, _('use dots for runs')), | |
1853 | ('s', 'spaces', None, _('separate elements by spaces'))], |
|
1867 | ('s', 'spaces', None, _('separate elements by spaces'))], | |
1854 | _('[OPTION]... [FILE [REV]...]')) |
|
1868 | _('[OPTION]... [FILE [REV]...]')) | |
1855 | def debugdag(ui, repo, file_=None, *revs, **opts): |
|
1869 | def debugdag(ui, repo, file_=None, *revs, **opts): | |
1856 | """format the changelog or an index DAG as a concise textual description |
|
1870 | """format the changelog or an index DAG as a concise textual description | |
1857 |
|
1871 | |||
1858 | If you pass a revlog index, the revlog's DAG is emitted. If you list |
|
1872 | If you pass a revlog index, the revlog's DAG is emitted. If you list | |
1859 | revision numbers, they get labeled in the output as rN. |
|
1873 | revision numbers, they get labeled in the output as rN. | |
1860 |
|
1874 | |||
1861 | Otherwise, the changelog DAG of the current repo is emitted. |
|
1875 | Otherwise, the changelog DAG of the current repo is emitted. | |
1862 | """ |
|
1876 | """ | |
1863 | spaces = opts.get('spaces') |
|
1877 | spaces = opts.get('spaces') | |
1864 | dots = opts.get('dots') |
|
1878 | dots = opts.get('dots') | |
1865 | if file_: |
|
1879 | if file_: | |
1866 | rlog = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) |
|
1880 | rlog = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) | |
1867 | revs = set((int(r) for r in revs)) |
|
1881 | revs = set((int(r) for r in revs)) | |
1868 | def events(): |
|
1882 | def events(): | |
1869 | for r in rlog: |
|
1883 | for r in rlog: | |
1870 | yield 'n', (r, list(set(p for p in rlog.parentrevs(r) |
|
1884 | yield 'n', (r, list(set(p for p in rlog.parentrevs(r) | |
1871 | if p != -1))) |
|
1885 | if p != -1))) | |
1872 | if r in revs: |
|
1886 | if r in revs: | |
1873 | yield 'l', (r, "r%i" % r) |
|
1887 | yield 'l', (r, "r%i" % r) | |
1874 | elif repo: |
|
1888 | elif repo: | |
1875 | cl = repo.changelog |
|
1889 | cl = repo.changelog | |
1876 | tags = opts.get('tags') |
|
1890 | tags = opts.get('tags') | |
1877 | branches = opts.get('branches') |
|
1891 | branches = opts.get('branches') | |
1878 | if tags: |
|
1892 | if tags: | |
1879 | labels = {} |
|
1893 | labels = {} | |
1880 | for l, n in repo.tags().items(): |
|
1894 | for l, n in repo.tags().items(): | |
1881 | labels.setdefault(cl.rev(n), []).append(l) |
|
1895 | labels.setdefault(cl.rev(n), []).append(l) | |
1882 | def events(): |
|
1896 | def events(): | |
1883 | b = "default" |
|
1897 | b = "default" | |
1884 | for r in cl: |
|
1898 | for r in cl: | |
1885 | if branches: |
|
1899 | if branches: | |
1886 | newb = cl.read(cl.node(r))[5]['branch'] |
|
1900 | newb = cl.read(cl.node(r))[5]['branch'] | |
1887 | if newb != b: |
|
1901 | if newb != b: | |
1888 | yield 'a', newb |
|
1902 | yield 'a', newb | |
1889 | b = newb |
|
1903 | b = newb | |
1890 | yield 'n', (r, list(set(p for p in cl.parentrevs(r) |
|
1904 | yield 'n', (r, list(set(p for p in cl.parentrevs(r) | |
1891 | if p != -1))) |
|
1905 | if p != -1))) | |
1892 | if tags: |
|
1906 | if tags: | |
1893 | ls = labels.get(r) |
|
1907 | ls = labels.get(r) | |
1894 | if ls: |
|
1908 | if ls: | |
1895 | for l in ls: |
|
1909 | for l in ls: | |
1896 | yield 'l', (r, l) |
|
1910 | yield 'l', (r, l) | |
1897 | else: |
|
1911 | else: | |
1898 | raise util.Abort(_('need repo for changelog dag')) |
|
1912 | raise util.Abort(_('need repo for changelog dag')) | |
1899 |
|
1913 | |||
1900 | for line in dagparser.dagtextlines(events(), |
|
1914 | for line in dagparser.dagtextlines(events(), | |
1901 | addspaces=spaces, |
|
1915 | addspaces=spaces, | |
1902 | wraplabels=True, |
|
1916 | wraplabels=True, | |
1903 | wrapannotations=True, |
|
1917 | wrapannotations=True, | |
1904 | wrapnonlinear=dots, |
|
1918 | wrapnonlinear=dots, | |
1905 | usedots=dots, |
|
1919 | usedots=dots, | |
1906 | maxlinewidth=70): |
|
1920 | maxlinewidth=70): | |
1907 | ui.write(line) |
|
1921 | ui.write(line) | |
1908 | ui.write("\n") |
|
1922 | ui.write("\n") | |
1909 |
|
1923 | |||
1910 | @command('debugdata', |
|
1924 | @command('debugdata', | |
1911 | [('c', 'changelog', False, _('open changelog')), |
|
1925 | [('c', 'changelog', False, _('open changelog')), | |
1912 | ('m', 'manifest', False, _('open manifest'))], |
|
1926 | ('m', 'manifest', False, _('open manifest'))], | |
1913 | _('-c|-m|FILE REV')) |
|
1927 | _('-c|-m|FILE REV')) | |
1914 | def debugdata(ui, repo, file_, rev=None, **opts): |
|
1928 | def debugdata(ui, repo, file_, rev=None, **opts): | |
1915 | """dump the contents of a data file revision""" |
|
1929 | """dump the contents of a data file revision""" | |
1916 | if opts.get('changelog') or opts.get('manifest'): |
|
1930 | if opts.get('changelog') or opts.get('manifest'): | |
1917 | file_, rev = None, file_ |
|
1931 | file_, rev = None, file_ | |
1918 | elif rev is None: |
|
1932 | elif rev is None: | |
1919 | raise error.CommandError('debugdata', _('invalid arguments')) |
|
1933 | raise error.CommandError('debugdata', _('invalid arguments')) | |
1920 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) |
|
1934 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) | |
1921 | try: |
|
1935 | try: | |
1922 | ui.write(r.revision(r.lookup(rev))) |
|
1936 | ui.write(r.revision(r.lookup(rev))) | |
1923 | except KeyError: |
|
1937 | except KeyError: | |
1924 | raise util.Abort(_('invalid revision identifier %s') % rev) |
|
1938 | raise util.Abort(_('invalid revision identifier %s') % rev) | |
1925 |
|
1939 | |||
1926 | @command('debugdate', |
|
1940 | @command('debugdate', | |
1927 | [('e', 'extended', None, _('try extended date formats'))], |
|
1941 | [('e', 'extended', None, _('try extended date formats'))], | |
1928 | _('[-e] DATE [RANGE]')) |
|
1942 | _('[-e] DATE [RANGE]')) | |
1929 | def debugdate(ui, date, range=None, **opts): |
|
1943 | def debugdate(ui, date, range=None, **opts): | |
1930 | """parse and display a date""" |
|
1944 | """parse and display a date""" | |
1931 | if opts["extended"]: |
|
1945 | if opts["extended"]: | |
1932 | d = util.parsedate(date, util.extendeddateformats) |
|
1946 | d = util.parsedate(date, util.extendeddateformats) | |
1933 | else: |
|
1947 | else: | |
1934 | d = util.parsedate(date) |
|
1948 | d = util.parsedate(date) | |
1935 | ui.write(("internal: %s %s\n") % d) |
|
1949 | ui.write(("internal: %s %s\n") % d) | |
1936 | ui.write(("standard: %s\n") % util.datestr(d)) |
|
1950 | ui.write(("standard: %s\n") % util.datestr(d)) | |
1937 | if range: |
|
1951 | if range: | |
1938 | m = util.matchdate(range) |
|
1952 | m = util.matchdate(range) | |
1939 | ui.write(("match: %s\n") % m(d[0])) |
|
1953 | ui.write(("match: %s\n") % m(d[0])) | |
1940 |
|
1954 | |||
1941 | @command('debugdiscovery', |
|
1955 | @command('debugdiscovery', | |
1942 | [('', 'old', None, _('use old-style discovery')), |
|
1956 | [('', 'old', None, _('use old-style discovery')), | |
1943 | ('', 'nonheads', None, |
|
1957 | ('', 'nonheads', None, | |
1944 | _('use old-style discovery with non-heads included')), |
|
1958 | _('use old-style discovery with non-heads included')), | |
1945 | ] + remoteopts, |
|
1959 | ] + remoteopts, | |
1946 | _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]')) |
|
1960 | _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]')) | |
1947 | def debugdiscovery(ui, repo, remoteurl="default", **opts): |
|
1961 | def debugdiscovery(ui, repo, remoteurl="default", **opts): | |
1948 | """runs the changeset discovery protocol in isolation""" |
|
1962 | """runs the changeset discovery protocol in isolation""" | |
1949 | remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), |
|
1963 | remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), | |
1950 | opts.get('branch')) |
|
1964 | opts.get('branch')) | |
1951 | remote = hg.peer(repo, opts, remoteurl) |
|
1965 | remote = hg.peer(repo, opts, remoteurl) | |
1952 | ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) |
|
1966 | ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) | |
1953 |
|
1967 | |||
1954 | # make sure tests are repeatable |
|
1968 | # make sure tests are repeatable | |
1955 | random.seed(12323) |
|
1969 | random.seed(12323) | |
1956 |
|
1970 | |||
1957 | def doit(localheads, remoteheads, remote=remote): |
|
1971 | def doit(localheads, remoteheads, remote=remote): | |
1958 | if opts.get('old'): |
|
1972 | if opts.get('old'): | |
1959 | if localheads: |
|
1973 | if localheads: | |
1960 | raise util.Abort('cannot use localheads with old style ' |
|
1974 | raise util.Abort('cannot use localheads with old style ' | |
1961 | 'discovery') |
|
1975 | 'discovery') | |
1962 | if not util.safehasattr(remote, 'branches'): |
|
1976 | if not util.safehasattr(remote, 'branches'): | |
1963 | # enable in-client legacy support |
|
1977 | # enable in-client legacy support | |
1964 | remote = localrepo.locallegacypeer(remote.local()) |
|
1978 | remote = localrepo.locallegacypeer(remote.local()) | |
1965 | common, _in, hds = treediscovery.findcommonincoming(repo, remote, |
|
1979 | common, _in, hds = treediscovery.findcommonincoming(repo, remote, | |
1966 | force=True) |
|
1980 | force=True) | |
1967 | common = set(common) |
|
1981 | common = set(common) | |
1968 | if not opts.get('nonheads'): |
|
1982 | if not opts.get('nonheads'): | |
1969 | ui.write(("unpruned common: %s\n") % |
|
1983 | ui.write(("unpruned common: %s\n") % | |
1970 | " ".join(sorted(short(n) for n in common))) |
|
1984 | " ".join(sorted(short(n) for n in common))) | |
1971 | dag = dagutil.revlogdag(repo.changelog) |
|
1985 | dag = dagutil.revlogdag(repo.changelog) | |
1972 | all = dag.ancestorset(dag.internalizeall(common)) |
|
1986 | all = dag.ancestorset(dag.internalizeall(common)) | |
1973 | common = dag.externalizeall(dag.headsetofconnecteds(all)) |
|
1987 | common = dag.externalizeall(dag.headsetofconnecteds(all)) | |
1974 | else: |
|
1988 | else: | |
1975 | common, any, hds = setdiscovery.findcommonheads(ui, repo, remote) |
|
1989 | common, any, hds = setdiscovery.findcommonheads(ui, repo, remote) | |
1976 | common = set(common) |
|
1990 | common = set(common) | |
1977 | rheads = set(hds) |
|
1991 | rheads = set(hds) | |
1978 | lheads = set(repo.heads()) |
|
1992 | lheads = set(repo.heads()) | |
1979 | ui.write(("common heads: %s\n") % |
|
1993 | ui.write(("common heads: %s\n") % | |
1980 | " ".join(sorted(short(n) for n in common))) |
|
1994 | " ".join(sorted(short(n) for n in common))) | |
1981 | if lheads <= common: |
|
1995 | if lheads <= common: | |
1982 | ui.write(("local is subset\n")) |
|
1996 | ui.write(("local is subset\n")) | |
1983 | elif rheads <= common: |
|
1997 | elif rheads <= common: | |
1984 | ui.write(("remote is subset\n")) |
|
1998 | ui.write(("remote is subset\n")) | |
1985 |
|
1999 | |||
1986 | serverlogs = opts.get('serverlog') |
|
2000 | serverlogs = opts.get('serverlog') | |
1987 | if serverlogs: |
|
2001 | if serverlogs: | |
1988 | for filename in serverlogs: |
|
2002 | for filename in serverlogs: | |
1989 | logfile = open(filename, 'r') |
|
2003 | logfile = open(filename, 'r') | |
1990 | try: |
|
2004 | try: | |
1991 | line = logfile.readline() |
|
2005 | line = logfile.readline() | |
1992 | while line: |
|
2006 | while line: | |
1993 | parts = line.strip().split(';') |
|
2007 | parts = line.strip().split(';') | |
1994 | op = parts[1] |
|
2008 | op = parts[1] | |
1995 | if op == 'cg': |
|
2009 | if op == 'cg': | |
1996 | pass |
|
2010 | pass | |
1997 | elif op == 'cgss': |
|
2011 | elif op == 'cgss': | |
1998 | doit(parts[2].split(' '), parts[3].split(' ')) |
|
2012 | doit(parts[2].split(' '), parts[3].split(' ')) | |
1999 | elif op == 'unb': |
|
2013 | elif op == 'unb': | |
2000 | doit(parts[3].split(' '), parts[2].split(' ')) |
|
2014 | doit(parts[3].split(' '), parts[2].split(' ')) | |
2001 | line = logfile.readline() |
|
2015 | line = logfile.readline() | |
2002 | finally: |
|
2016 | finally: | |
2003 | logfile.close() |
|
2017 | logfile.close() | |
2004 |
|
2018 | |||
2005 | else: |
|
2019 | else: | |
2006 | remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, |
|
2020 | remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, | |
2007 | opts.get('remote_head')) |
|
2021 | opts.get('remote_head')) | |
2008 | localrevs = opts.get('local_head') |
|
2022 | localrevs = opts.get('local_head') | |
2009 | doit(localrevs, remoterevs) |
|
2023 | doit(localrevs, remoterevs) | |
2010 |
|
2024 | |||
2011 | @command('debugfileset', |
|
2025 | @command('debugfileset', | |
2012 | [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], |
|
2026 | [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], | |
2013 | _('[-r REV] FILESPEC')) |
|
2027 | _('[-r REV] FILESPEC')) | |
2014 | def debugfileset(ui, repo, expr, **opts): |
|
2028 | def debugfileset(ui, repo, expr, **opts): | |
2015 | '''parse and apply a fileset specification''' |
|
2029 | '''parse and apply a fileset specification''' | |
2016 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) |
|
2030 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) | |
2017 | if ui.verbose: |
|
2031 | if ui.verbose: | |
2018 | tree = fileset.parse(expr)[0] |
|
2032 | tree = fileset.parse(expr)[0] | |
2019 | ui.note(tree, "\n") |
|
2033 | ui.note(tree, "\n") | |
2020 |
|
2034 | |||
2021 | for f in ctx.getfileset(expr): |
|
2035 | for f in ctx.getfileset(expr): | |
2022 | ui.write("%s\n" % f) |
|
2036 | ui.write("%s\n" % f) | |
2023 |
|
2037 | |||
2024 | @command('debugfsinfo', [], _('[PATH]')) |
|
2038 | @command('debugfsinfo', [], _('[PATH]')) | |
2025 | def debugfsinfo(ui, path="."): |
|
2039 | def debugfsinfo(ui, path="."): | |
2026 | """show information detected about current filesystem""" |
|
2040 | """show information detected about current filesystem""" | |
2027 | util.writefile('.debugfsinfo', '') |
|
2041 | util.writefile('.debugfsinfo', '') | |
2028 | ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) |
|
2042 | ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) | |
2029 | ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) |
|
2043 | ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) | |
2030 | ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) |
|
2044 | ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) | |
2031 | ui.write(('case-sensitive: %s\n') % (util.checkcase('.debugfsinfo') |
|
2045 | ui.write(('case-sensitive: %s\n') % (util.checkcase('.debugfsinfo') | |
2032 | and 'yes' or 'no')) |
|
2046 | and 'yes' or 'no')) | |
2033 | os.unlink('.debugfsinfo') |
|
2047 | os.unlink('.debugfsinfo') | |
2034 |
|
2048 | |||
2035 | @command('debuggetbundle', |
|
2049 | @command('debuggetbundle', | |
2036 | [('H', 'head', [], _('id of head node'), _('ID')), |
|
2050 | [('H', 'head', [], _('id of head node'), _('ID')), | |
2037 | ('C', 'common', [], _('id of common node'), _('ID')), |
|
2051 | ('C', 'common', [], _('id of common node'), _('ID')), | |
2038 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], |
|
2052 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], | |
2039 | _('REPO FILE [-H|-C ID]...')) |
|
2053 | _('REPO FILE [-H|-C ID]...')) | |
2040 | def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): |
|
2054 | def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): | |
2041 | """retrieves a bundle from a repo |
|
2055 | """retrieves a bundle from a repo | |
2042 |
|
2056 | |||
2043 | Every ID must be a full-length hex node id string. Saves the bundle to the |
|
2057 | Every ID must be a full-length hex node id string. Saves the bundle to the | |
2044 | given file. |
|
2058 | given file. | |
2045 | """ |
|
2059 | """ | |
2046 | repo = hg.peer(ui, opts, repopath) |
|
2060 | repo = hg.peer(ui, opts, repopath) | |
2047 | if not repo.capable('getbundle'): |
|
2061 | if not repo.capable('getbundle'): | |
2048 | raise util.Abort("getbundle() not supported by target repository") |
|
2062 | raise util.Abort("getbundle() not supported by target repository") | |
2049 | args = {} |
|
2063 | args = {} | |
2050 | if common: |
|
2064 | if common: | |
2051 | args['common'] = [bin(s) for s in common] |
|
2065 | args['common'] = [bin(s) for s in common] | |
2052 | if head: |
|
2066 | if head: | |
2053 | args['heads'] = [bin(s) for s in head] |
|
2067 | args['heads'] = [bin(s) for s in head] | |
2054 | # TODO: get desired bundlecaps from command line. |
|
2068 | # TODO: get desired bundlecaps from command line. | |
2055 | args['bundlecaps'] = None |
|
2069 | args['bundlecaps'] = None | |
2056 | bundle = repo.getbundle('debug', **args) |
|
2070 | bundle = repo.getbundle('debug', **args) | |
2057 |
|
2071 | |||
2058 | bundletype = opts.get('type', 'bzip2').lower() |
|
2072 | bundletype = opts.get('type', 'bzip2').lower() | |
2059 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} |
|
2073 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} | |
2060 | bundletype = btypes.get(bundletype) |
|
2074 | bundletype = btypes.get(bundletype) | |
2061 | if bundletype not in changegroup.bundletypes: |
|
2075 | if bundletype not in changegroup.bundletypes: | |
2062 | raise util.Abort(_('unknown bundle type specified with --type')) |
|
2076 | raise util.Abort(_('unknown bundle type specified with --type')) | |
2063 | changegroup.writebundle(bundle, bundlepath, bundletype) |
|
2077 | changegroup.writebundle(bundle, bundlepath, bundletype) | |
2064 |
|
2078 | |||
2065 | @command('debugignore', [], '') |
|
2079 | @command('debugignore', [], '') | |
2066 | def debugignore(ui, repo, *values, **opts): |
|
2080 | def debugignore(ui, repo, *values, **opts): | |
2067 | """display the combined ignore pattern""" |
|
2081 | """display the combined ignore pattern""" | |
2068 | ignore = repo.dirstate._ignore |
|
2082 | ignore = repo.dirstate._ignore | |
2069 | includepat = getattr(ignore, 'includepat', None) |
|
2083 | includepat = getattr(ignore, 'includepat', None) | |
2070 | if includepat is not None: |
|
2084 | if includepat is not None: | |
2071 | ui.write("%s\n" % includepat) |
|
2085 | ui.write("%s\n" % includepat) | |
2072 | else: |
|
2086 | else: | |
2073 | raise util.Abort(_("no ignore patterns found")) |
|
2087 | raise util.Abort(_("no ignore patterns found")) | |
2074 |
|
2088 | |||
2075 | @command('debugindex', |
|
2089 | @command('debugindex', | |
2076 | [('c', 'changelog', False, _('open changelog')), |
|
2090 | [('c', 'changelog', False, _('open changelog')), | |
2077 | ('m', 'manifest', False, _('open manifest')), |
|
2091 | ('m', 'manifest', False, _('open manifest')), | |
2078 | ('f', 'format', 0, _('revlog format'), _('FORMAT'))], |
|
2092 | ('f', 'format', 0, _('revlog format'), _('FORMAT'))], | |
2079 | _('[-f FORMAT] -c|-m|FILE')) |
|
2093 | _('[-f FORMAT] -c|-m|FILE')) | |
2080 | def debugindex(ui, repo, file_=None, **opts): |
|
2094 | def debugindex(ui, repo, file_=None, **opts): | |
2081 | """dump the contents of an index file""" |
|
2095 | """dump the contents of an index file""" | |
2082 | r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) |
|
2096 | r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) | |
2083 | format = opts.get('format', 0) |
|
2097 | format = opts.get('format', 0) | |
2084 | if format not in (0, 1): |
|
2098 | if format not in (0, 1): | |
2085 | raise util.Abort(_("unknown format %d") % format) |
|
2099 | raise util.Abort(_("unknown format %d") % format) | |
2086 |
|
2100 | |||
2087 | generaldelta = r.version & revlog.REVLOGGENERALDELTA |
|
2101 | generaldelta = r.version & revlog.REVLOGGENERALDELTA | |
2088 | if generaldelta: |
|
2102 | if generaldelta: | |
2089 | basehdr = ' delta' |
|
2103 | basehdr = ' delta' | |
2090 | else: |
|
2104 | else: | |
2091 | basehdr = ' base' |
|
2105 | basehdr = ' base' | |
2092 |
|
2106 | |||
2093 | if format == 0: |
|
2107 | if format == 0: | |
2094 | ui.write(" rev offset length " + basehdr + " linkrev" |
|
2108 | ui.write(" rev offset length " + basehdr + " linkrev" | |
2095 | " nodeid p1 p2\n") |
|
2109 | " nodeid p1 p2\n") | |
2096 | elif format == 1: |
|
2110 | elif format == 1: | |
2097 | ui.write(" rev flag offset length" |
|
2111 | ui.write(" rev flag offset length" | |
2098 | " size " + basehdr + " link p1 p2" |
|
2112 | " size " + basehdr + " link p1 p2" | |
2099 | " nodeid\n") |
|
2113 | " nodeid\n") | |
2100 |
|
2114 | |||
2101 | for i in r: |
|
2115 | for i in r: | |
2102 | node = r.node(i) |
|
2116 | node = r.node(i) | |
2103 | if generaldelta: |
|
2117 | if generaldelta: | |
2104 | base = r.deltaparent(i) |
|
2118 | base = r.deltaparent(i) | |
2105 | else: |
|
2119 | else: | |
2106 | base = r.chainbase(i) |
|
2120 | base = r.chainbase(i) | |
2107 | if format == 0: |
|
2121 | if format == 0: | |
2108 | try: |
|
2122 | try: | |
2109 | pp = r.parents(node) |
|
2123 | pp = r.parents(node) | |
2110 | except Exception: |
|
2124 | except Exception: | |
2111 | pp = [nullid, nullid] |
|
2125 | pp = [nullid, nullid] | |
2112 | ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( |
|
2126 | ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( | |
2113 | i, r.start(i), r.length(i), base, r.linkrev(i), |
|
2127 | i, r.start(i), r.length(i), base, r.linkrev(i), | |
2114 | short(node), short(pp[0]), short(pp[1]))) |
|
2128 | short(node), short(pp[0]), short(pp[1]))) | |
2115 | elif format == 1: |
|
2129 | elif format == 1: | |
2116 | pr = r.parentrevs(i) |
|
2130 | pr = r.parentrevs(i) | |
2117 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ( |
|
2131 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ( | |
2118 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), |
|
2132 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), | |
2119 | base, r.linkrev(i), pr[0], pr[1], short(node))) |
|
2133 | base, r.linkrev(i), pr[0], pr[1], short(node))) | |
2120 |
|
2134 | |||
2121 | @command('debugindexdot', [], _('FILE')) |
|
2135 | @command('debugindexdot', [], _('FILE')) | |
2122 | def debugindexdot(ui, repo, file_): |
|
2136 | def debugindexdot(ui, repo, file_): | |
2123 | """dump an index DAG as a graphviz dot file""" |
|
2137 | """dump an index DAG as a graphviz dot file""" | |
2124 | r = None |
|
2138 | r = None | |
2125 | if repo: |
|
2139 | if repo: | |
2126 | filelog = repo.file(file_) |
|
2140 | filelog = repo.file(file_) | |
2127 | if len(filelog): |
|
2141 | if len(filelog): | |
2128 | r = filelog |
|
2142 | r = filelog | |
2129 | if not r: |
|
2143 | if not r: | |
2130 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) |
|
2144 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) | |
2131 | ui.write(("digraph G {\n")) |
|
2145 | ui.write(("digraph G {\n")) | |
2132 | for i in r: |
|
2146 | for i in r: | |
2133 | node = r.node(i) |
|
2147 | node = r.node(i) | |
2134 | pp = r.parents(node) |
|
2148 | pp = r.parents(node) | |
2135 | ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
|
2149 | ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) | |
2136 | if pp[1] != nullid: |
|
2150 | if pp[1] != nullid: | |
2137 | ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
|
2151 | ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) | |
2138 | ui.write("}\n") |
|
2152 | ui.write("}\n") | |
2139 |
|
2153 | |||
2140 | @command('debuginstall', [], '') |
|
2154 | @command('debuginstall', [], '') | |
2141 | def debuginstall(ui): |
|
2155 | def debuginstall(ui): | |
2142 | '''test Mercurial installation |
|
2156 | '''test Mercurial installation | |
2143 |
|
2157 | |||
2144 | Returns 0 on success. |
|
2158 | Returns 0 on success. | |
2145 | ''' |
|
2159 | ''' | |
2146 |
|
2160 | |||
2147 | def writetemp(contents): |
|
2161 | def writetemp(contents): | |
2148 | (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") |
|
2162 | (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") | |
2149 | f = os.fdopen(fd, "wb") |
|
2163 | f = os.fdopen(fd, "wb") | |
2150 | f.write(contents) |
|
2164 | f.write(contents) | |
2151 | f.close() |
|
2165 | f.close() | |
2152 | return name |
|
2166 | return name | |
2153 |
|
2167 | |||
2154 | problems = 0 |
|
2168 | problems = 0 | |
2155 |
|
2169 | |||
2156 | # encoding |
|
2170 | # encoding | |
2157 | ui.status(_("checking encoding (%s)...\n") % encoding.encoding) |
|
2171 | ui.status(_("checking encoding (%s)...\n") % encoding.encoding) | |
2158 | try: |
|
2172 | try: | |
2159 | encoding.fromlocal("test") |
|
2173 | encoding.fromlocal("test") | |
2160 | except util.Abort, inst: |
|
2174 | except util.Abort, inst: | |
2161 | ui.write(" %s\n" % inst) |
|
2175 | ui.write(" %s\n" % inst) | |
2162 | ui.write(_(" (check that your locale is properly set)\n")) |
|
2176 | ui.write(_(" (check that your locale is properly set)\n")) | |
2163 | problems += 1 |
|
2177 | problems += 1 | |
2164 |
|
2178 | |||
2165 | # Python |
|
2179 | # Python | |
2166 | ui.status(_("checking Python executable (%s)\n") % sys.executable) |
|
2180 | ui.status(_("checking Python executable (%s)\n") % sys.executable) | |
2167 | ui.status(_("checking Python version (%s)\n") |
|
2181 | ui.status(_("checking Python version (%s)\n") | |
2168 | % ("%s.%s.%s" % sys.version_info[:3])) |
|
2182 | % ("%s.%s.%s" % sys.version_info[:3])) | |
2169 | ui.status(_("checking Python lib (%s)...\n") |
|
2183 | ui.status(_("checking Python lib (%s)...\n") | |
2170 | % os.path.dirname(os.__file__)) |
|
2184 | % os.path.dirname(os.__file__)) | |
2171 |
|
2185 | |||
2172 | # compiled modules |
|
2186 | # compiled modules | |
2173 | ui.status(_("checking installed modules (%s)...\n") |
|
2187 | ui.status(_("checking installed modules (%s)...\n") | |
2174 | % os.path.dirname(__file__)) |
|
2188 | % os.path.dirname(__file__)) | |
2175 | try: |
|
2189 | try: | |
2176 | import bdiff, mpatch, base85, osutil |
|
2190 | import bdiff, mpatch, base85, osutil | |
2177 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes |
|
2191 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes | |
2178 | except Exception, inst: |
|
2192 | except Exception, inst: | |
2179 | ui.write(" %s\n" % inst) |
|
2193 | ui.write(" %s\n" % inst) | |
2180 | ui.write(_(" One or more extensions could not be found")) |
|
2194 | ui.write(_(" One or more extensions could not be found")) | |
2181 | ui.write(_(" (check that you compiled the extensions)\n")) |
|
2195 | ui.write(_(" (check that you compiled the extensions)\n")) | |
2182 | problems += 1 |
|
2196 | problems += 1 | |
2183 |
|
2197 | |||
2184 | # templates |
|
2198 | # templates | |
2185 | import templater |
|
2199 | import templater | |
2186 | p = templater.templatepath() |
|
2200 | p = templater.templatepath() | |
2187 | ui.status(_("checking templates (%s)...\n") % ' '.join(p)) |
|
2201 | ui.status(_("checking templates (%s)...\n") % ' '.join(p)) | |
2188 | if p: |
|
2202 | if p: | |
2189 | m = templater.templatepath("map-cmdline.default") |
|
2203 | m = templater.templatepath("map-cmdline.default") | |
2190 | if m: |
|
2204 | if m: | |
2191 | # template found, check if it is working |
|
2205 | # template found, check if it is working | |
2192 | try: |
|
2206 | try: | |
2193 | templater.templater(m) |
|
2207 | templater.templater(m) | |
2194 | except Exception, inst: |
|
2208 | except Exception, inst: | |
2195 | ui.write(" %s\n" % inst) |
|
2209 | ui.write(" %s\n" % inst) | |
2196 | p = None |
|
2210 | p = None | |
2197 | else: |
|
2211 | else: | |
2198 | ui.write(_(" template 'default' not found\n")) |
|
2212 | ui.write(_(" template 'default' not found\n")) | |
2199 | p = None |
|
2213 | p = None | |
2200 | else: |
|
2214 | else: | |
2201 | ui.write(_(" no template directories found\n")) |
|
2215 | ui.write(_(" no template directories found\n")) | |
2202 | if not p: |
|
2216 | if not p: | |
2203 | ui.write(_(" (templates seem to have been installed incorrectly)\n")) |
|
2217 | ui.write(_(" (templates seem to have been installed incorrectly)\n")) | |
2204 | problems += 1 |
|
2218 | problems += 1 | |
2205 |
|
2219 | |||
2206 | # editor |
|
2220 | # editor | |
2207 | ui.status(_("checking commit editor...\n")) |
|
2221 | ui.status(_("checking commit editor...\n")) | |
2208 | editor = ui.geteditor() |
|
2222 | editor = ui.geteditor() | |
2209 | cmdpath = util.findexe(editor) or util.findexe(editor.split()[0]) |
|
2223 | cmdpath = util.findexe(editor) or util.findexe(editor.split()[0]) | |
2210 | if not cmdpath: |
|
2224 | if not cmdpath: | |
2211 | if editor == 'vi': |
|
2225 | if editor == 'vi': | |
2212 | ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
|
2226 | ui.write(_(" No commit editor set and can't find vi in PATH\n")) | |
2213 | ui.write(_(" (specify a commit editor in your configuration" |
|
2227 | ui.write(_(" (specify a commit editor in your configuration" | |
2214 | " file)\n")) |
|
2228 | " file)\n")) | |
2215 | else: |
|
2229 | else: | |
2216 | ui.write(_(" Can't find editor '%s' in PATH\n") % editor) |
|
2230 | ui.write(_(" Can't find editor '%s' in PATH\n") % editor) | |
2217 | ui.write(_(" (specify a commit editor in your configuration" |
|
2231 | ui.write(_(" (specify a commit editor in your configuration" | |
2218 | " file)\n")) |
|
2232 | " file)\n")) | |
2219 | problems += 1 |
|
2233 | problems += 1 | |
2220 |
|
2234 | |||
2221 | # check username |
|
2235 | # check username | |
2222 | ui.status(_("checking username...\n")) |
|
2236 | ui.status(_("checking username...\n")) | |
2223 | try: |
|
2237 | try: | |
2224 | ui.username() |
|
2238 | ui.username() | |
2225 | except util.Abort, e: |
|
2239 | except util.Abort, e: | |
2226 | ui.write(" %s\n" % e) |
|
2240 | ui.write(" %s\n" % e) | |
2227 | ui.write(_(" (specify a username in your configuration file)\n")) |
|
2241 | ui.write(_(" (specify a username in your configuration file)\n")) | |
2228 | problems += 1 |
|
2242 | problems += 1 | |
2229 |
|
2243 | |||
2230 | if not problems: |
|
2244 | if not problems: | |
2231 | ui.status(_("no problems detected\n")) |
|
2245 | ui.status(_("no problems detected\n")) | |
2232 | else: |
|
2246 | else: | |
2233 | ui.write(_("%s problems detected," |
|
2247 | ui.write(_("%s problems detected," | |
2234 | " please check your install!\n") % problems) |
|
2248 | " please check your install!\n") % problems) | |
2235 |
|
2249 | |||
2236 | return problems |
|
2250 | return problems | |
2237 |
|
2251 | |||
2238 | @command('debugknown', [], _('REPO ID...')) |
|
2252 | @command('debugknown', [], _('REPO ID...')) | |
2239 | def debugknown(ui, repopath, *ids, **opts): |
|
2253 | def debugknown(ui, repopath, *ids, **opts): | |
2240 | """test whether node ids are known to a repo |
|
2254 | """test whether node ids are known to a repo | |
2241 |
|
2255 | |||
2242 | Every ID must be a full-length hex node id string. Returns a list of 0s |
|
2256 | Every ID must be a full-length hex node id string. Returns a list of 0s | |
2243 | and 1s indicating unknown/known. |
|
2257 | and 1s indicating unknown/known. | |
2244 | """ |
|
2258 | """ | |
2245 | repo = hg.peer(ui, opts, repopath) |
|
2259 | repo = hg.peer(ui, opts, repopath) | |
2246 | if not repo.capable('known'): |
|
2260 | if not repo.capable('known'): | |
2247 | raise util.Abort("known() not supported by target repository") |
|
2261 | raise util.Abort("known() not supported by target repository") | |
2248 | flags = repo.known([bin(s) for s in ids]) |
|
2262 | flags = repo.known([bin(s) for s in ids]) | |
2249 | ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) |
|
2263 | ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) | |
2250 |
|
2264 | |||
2251 | @command('debuglabelcomplete', [], _('LABEL...')) |
|
2265 | @command('debuglabelcomplete', [], _('LABEL...')) | |
2252 | def debuglabelcomplete(ui, repo, *args): |
|
2266 | def debuglabelcomplete(ui, repo, *args): | |
2253 | '''complete "labels" - tags, open branch names, bookmark names''' |
|
2267 | '''complete "labels" - tags, open branch names, bookmark names''' | |
2254 |
|
2268 | |||
2255 | labels = set() |
|
2269 | labels = set() | |
2256 | labels.update(t[0] for t in repo.tagslist()) |
|
2270 | labels.update(t[0] for t in repo.tagslist()) | |
2257 | labels.update(repo._bookmarks.keys()) |
|
2271 | labels.update(repo._bookmarks.keys()) | |
2258 | labels.update(tag for (tag, heads, tip, closed) |
|
2272 | labels.update(tag for (tag, heads, tip, closed) | |
2259 | in repo.branchmap().iterbranches() if not closed) |
|
2273 | in repo.branchmap().iterbranches() if not closed) | |
2260 | completions = set() |
|
2274 | completions = set() | |
2261 | if not args: |
|
2275 | if not args: | |
2262 | args = [''] |
|
2276 | args = [''] | |
2263 | for a in args: |
|
2277 | for a in args: | |
2264 | completions.update(l for l in labels if l.startswith(a)) |
|
2278 | completions.update(l for l in labels if l.startswith(a)) | |
2265 | ui.write('\n'.join(sorted(completions))) |
|
2279 | ui.write('\n'.join(sorted(completions))) | |
2266 | ui.write('\n') |
|
2280 | ui.write('\n') | |
2267 |
|
2281 | |||
2268 | @command('debugobsolete', |
|
2282 | @command('debugobsolete', | |
2269 | [('', 'flags', 0, _('markers flag')), |
|
2283 | [('', 'flags', 0, _('markers flag')), | |
2270 | ] + commitopts2, |
|
2284 | ] + commitopts2, | |
2271 | _('[OBSOLETED [REPLACEMENT] [REPL... ]')) |
|
2285 | _('[OBSOLETED [REPLACEMENT] [REPL... ]')) | |
2272 | def debugobsolete(ui, repo, precursor=None, *successors, **opts): |
|
2286 | def debugobsolete(ui, repo, precursor=None, *successors, **opts): | |
2273 | """create arbitrary obsolete marker |
|
2287 | """create arbitrary obsolete marker | |
2274 |
|
2288 | |||
2275 | With no arguments, displays the list of obsolescence markers.""" |
|
2289 | With no arguments, displays the list of obsolescence markers.""" | |
2276 | def parsenodeid(s): |
|
2290 | def parsenodeid(s): | |
2277 | try: |
|
2291 | try: | |
2278 | # We do not use revsingle/revrange functions here to accept |
|
2292 | # We do not use revsingle/revrange functions here to accept | |
2279 | # arbitrary node identifiers, possibly not present in the |
|
2293 | # arbitrary node identifiers, possibly not present in the | |
2280 | # local repository. |
|
2294 | # local repository. | |
2281 | n = bin(s) |
|
2295 | n = bin(s) | |
2282 | if len(n) != len(nullid): |
|
2296 | if len(n) != len(nullid): | |
2283 | raise TypeError() |
|
2297 | raise TypeError() | |
2284 | return n |
|
2298 | return n | |
2285 | except TypeError: |
|
2299 | except TypeError: | |
2286 | raise util.Abort('changeset references must be full hexadecimal ' |
|
2300 | raise util.Abort('changeset references must be full hexadecimal ' | |
2287 | 'node identifiers') |
|
2301 | 'node identifiers') | |
2288 |
|
2302 | |||
2289 | if precursor is not None: |
|
2303 | if precursor is not None: | |
2290 | metadata = {} |
|
2304 | metadata = {} | |
2291 | if 'date' in opts: |
|
2305 | if 'date' in opts: | |
2292 | metadata['date'] = opts['date'] |
|
2306 | metadata['date'] = opts['date'] | |
2293 | metadata['user'] = opts['user'] or ui.username() |
|
2307 | metadata['user'] = opts['user'] or ui.username() | |
2294 | succs = tuple(parsenodeid(succ) for succ in successors) |
|
2308 | succs = tuple(parsenodeid(succ) for succ in successors) | |
2295 | l = repo.lock() |
|
2309 | l = repo.lock() | |
2296 | try: |
|
2310 | try: | |
2297 | tr = repo.transaction('debugobsolete') |
|
2311 | tr = repo.transaction('debugobsolete') | |
2298 | try: |
|
2312 | try: | |
2299 | repo.obsstore.create(tr, parsenodeid(precursor), succs, |
|
2313 | repo.obsstore.create(tr, parsenodeid(precursor), succs, | |
2300 | opts['flags'], metadata) |
|
2314 | opts['flags'], metadata) | |
2301 | tr.close() |
|
2315 | tr.close() | |
2302 | finally: |
|
2316 | finally: | |
2303 | tr.release() |
|
2317 | tr.release() | |
2304 | finally: |
|
2318 | finally: | |
2305 | l.release() |
|
2319 | l.release() | |
2306 | else: |
|
2320 | else: | |
2307 | for m in obsolete.allmarkers(repo): |
|
2321 | for m in obsolete.allmarkers(repo): | |
2308 | cmdutil.showmarker(ui, m) |
|
2322 | cmdutil.showmarker(ui, m) | |
2309 |
|
2323 | |||
2310 | @command('debugpathcomplete', |
|
2324 | @command('debugpathcomplete', | |
2311 | [('f', 'full', None, _('complete an entire path')), |
|
2325 | [('f', 'full', None, _('complete an entire path')), | |
2312 | ('n', 'normal', None, _('show only normal files')), |
|
2326 | ('n', 'normal', None, _('show only normal files')), | |
2313 | ('a', 'added', None, _('show only added files')), |
|
2327 | ('a', 'added', None, _('show only added files')), | |
2314 | ('r', 'removed', None, _('show only removed files'))], |
|
2328 | ('r', 'removed', None, _('show only removed files'))], | |
2315 | _('FILESPEC...')) |
|
2329 | _('FILESPEC...')) | |
2316 | def debugpathcomplete(ui, repo, *specs, **opts): |
|
2330 | def debugpathcomplete(ui, repo, *specs, **opts): | |
2317 | '''complete part or all of a tracked path |
|
2331 | '''complete part or all of a tracked path | |
2318 |
|
2332 | |||
2319 | This command supports shells that offer path name completion. It |
|
2333 | This command supports shells that offer path name completion. It | |
2320 | currently completes only files already known to the dirstate. |
|
2334 | currently completes only files already known to the dirstate. | |
2321 |
|
2335 | |||
2322 | Completion extends only to the next path segment unless |
|
2336 | Completion extends only to the next path segment unless | |
2323 | --full is specified, in which case entire paths are used.''' |
|
2337 | --full is specified, in which case entire paths are used.''' | |
2324 |
|
2338 | |||
2325 | def complete(path, acceptable): |
|
2339 | def complete(path, acceptable): | |
2326 | dirstate = repo.dirstate |
|
2340 | dirstate = repo.dirstate | |
2327 | spec = os.path.normpath(os.path.join(os.getcwd(), path)) |
|
2341 | spec = os.path.normpath(os.path.join(os.getcwd(), path)) | |
2328 | rootdir = repo.root + os.sep |
|
2342 | rootdir = repo.root + os.sep | |
2329 | if spec != repo.root and not spec.startswith(rootdir): |
|
2343 | if spec != repo.root and not spec.startswith(rootdir): | |
2330 | return [], [] |
|
2344 | return [], [] | |
2331 | if os.path.isdir(spec): |
|
2345 | if os.path.isdir(spec): | |
2332 | spec += '/' |
|
2346 | spec += '/' | |
2333 | spec = spec[len(rootdir):] |
|
2347 | spec = spec[len(rootdir):] | |
2334 | fixpaths = os.sep != '/' |
|
2348 | fixpaths = os.sep != '/' | |
2335 | if fixpaths: |
|
2349 | if fixpaths: | |
2336 | spec = spec.replace(os.sep, '/') |
|
2350 | spec = spec.replace(os.sep, '/') | |
2337 | speclen = len(spec) |
|
2351 | speclen = len(spec) | |
2338 | fullpaths = opts['full'] |
|
2352 | fullpaths = opts['full'] | |
2339 | files, dirs = set(), set() |
|
2353 | files, dirs = set(), set() | |
2340 | adddir, addfile = dirs.add, files.add |
|
2354 | adddir, addfile = dirs.add, files.add | |
2341 | for f, st in dirstate.iteritems(): |
|
2355 | for f, st in dirstate.iteritems(): | |
2342 | if f.startswith(spec) and st[0] in acceptable: |
|
2356 | if f.startswith(spec) and st[0] in acceptable: | |
2343 | if fixpaths: |
|
2357 | if fixpaths: | |
2344 | f = f.replace('/', os.sep) |
|
2358 | f = f.replace('/', os.sep) | |
2345 | if fullpaths: |
|
2359 | if fullpaths: | |
2346 | addfile(f) |
|
2360 | addfile(f) | |
2347 | continue |
|
2361 | continue | |
2348 | s = f.find(os.sep, speclen) |
|
2362 | s = f.find(os.sep, speclen) | |
2349 | if s >= 0: |
|
2363 | if s >= 0: | |
2350 | adddir(f[:s]) |
|
2364 | adddir(f[:s]) | |
2351 | else: |
|
2365 | else: | |
2352 | addfile(f) |
|
2366 | addfile(f) | |
2353 | return files, dirs |
|
2367 | return files, dirs | |
2354 |
|
2368 | |||
2355 | acceptable = '' |
|
2369 | acceptable = '' | |
2356 | if opts['normal']: |
|
2370 | if opts['normal']: | |
2357 | acceptable += 'nm' |
|
2371 | acceptable += 'nm' | |
2358 | if opts['added']: |
|
2372 | if opts['added']: | |
2359 | acceptable += 'a' |
|
2373 | acceptable += 'a' | |
2360 | if opts['removed']: |
|
2374 | if opts['removed']: | |
2361 | acceptable += 'r' |
|
2375 | acceptable += 'r' | |
2362 | cwd = repo.getcwd() |
|
2376 | cwd = repo.getcwd() | |
2363 | if not specs: |
|
2377 | if not specs: | |
2364 | specs = ['.'] |
|
2378 | specs = ['.'] | |
2365 |
|
2379 | |||
2366 | files, dirs = set(), set() |
|
2380 | files, dirs = set(), set() | |
2367 | for spec in specs: |
|
2381 | for spec in specs: | |
2368 | f, d = complete(spec, acceptable or 'nmar') |
|
2382 | f, d = complete(spec, acceptable or 'nmar') | |
2369 | files.update(f) |
|
2383 | files.update(f) | |
2370 | dirs.update(d) |
|
2384 | dirs.update(d) | |
2371 | files.update(dirs) |
|
2385 | files.update(dirs) | |
2372 | ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) |
|
2386 | ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) | |
2373 | ui.write('\n') |
|
2387 | ui.write('\n') | |
2374 |
|
2388 | |||
2375 | @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]')) |
|
2389 | @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]')) | |
2376 | def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): |
|
2390 | def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): | |
2377 | '''access the pushkey key/value protocol |
|
2391 | '''access the pushkey key/value protocol | |
2378 |
|
2392 | |||
2379 | With two args, list the keys in the given namespace. |
|
2393 | With two args, list the keys in the given namespace. | |
2380 |
|
2394 | |||
2381 | With five args, set a key to new if it currently is set to old. |
|
2395 | With five args, set a key to new if it currently is set to old. | |
2382 | Reports success or failure. |
|
2396 | Reports success or failure. | |
2383 | ''' |
|
2397 | ''' | |
2384 |
|
2398 | |||
2385 | target = hg.peer(ui, {}, repopath) |
|
2399 | target = hg.peer(ui, {}, repopath) | |
2386 | if keyinfo: |
|
2400 | if keyinfo: | |
2387 | key, old, new = keyinfo |
|
2401 | key, old, new = keyinfo | |
2388 | r = target.pushkey(namespace, key, old, new) |
|
2402 | r = target.pushkey(namespace, key, old, new) | |
2389 | ui.status(str(r) + '\n') |
|
2403 | ui.status(str(r) + '\n') | |
2390 | return not r |
|
2404 | return not r | |
2391 | else: |
|
2405 | else: | |
2392 | for k, v in sorted(target.listkeys(namespace).iteritems()): |
|
2406 | for k, v in sorted(target.listkeys(namespace).iteritems()): | |
2393 | ui.write("%s\t%s\n" % (k.encode('string-escape'), |
|
2407 | ui.write("%s\t%s\n" % (k.encode('string-escape'), | |
2394 | v.encode('string-escape'))) |
|
2408 | v.encode('string-escape'))) | |
2395 |
|
2409 | |||
2396 | @command('debugpvec', [], _('A B')) |
|
2410 | @command('debugpvec', [], _('A B')) | |
2397 | def debugpvec(ui, repo, a, b=None): |
|
2411 | def debugpvec(ui, repo, a, b=None): | |
2398 | ca = scmutil.revsingle(repo, a) |
|
2412 | ca = scmutil.revsingle(repo, a) | |
2399 | cb = scmutil.revsingle(repo, b) |
|
2413 | cb = scmutil.revsingle(repo, b) | |
2400 | pa = pvec.ctxpvec(ca) |
|
2414 | pa = pvec.ctxpvec(ca) | |
2401 | pb = pvec.ctxpvec(cb) |
|
2415 | pb = pvec.ctxpvec(cb) | |
2402 | if pa == pb: |
|
2416 | if pa == pb: | |
2403 | rel = "=" |
|
2417 | rel = "=" | |
2404 | elif pa > pb: |
|
2418 | elif pa > pb: | |
2405 | rel = ">" |
|
2419 | rel = ">" | |
2406 | elif pa < pb: |
|
2420 | elif pa < pb: | |
2407 | rel = "<" |
|
2421 | rel = "<" | |
2408 | elif pa | pb: |
|
2422 | elif pa | pb: | |
2409 | rel = "|" |
|
2423 | rel = "|" | |
2410 | ui.write(_("a: %s\n") % pa) |
|
2424 | ui.write(_("a: %s\n") % pa) | |
2411 | ui.write(_("b: %s\n") % pb) |
|
2425 | ui.write(_("b: %s\n") % pb) | |
2412 | ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth)) |
|
2426 | ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth)) | |
2413 | ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") % |
|
2427 | ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") % | |
2414 | (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec), |
|
2428 | (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec), | |
2415 | pa.distance(pb), rel)) |
|
2429 | pa.distance(pb), rel)) | |
2416 |
|
2430 | |||
2417 | @command('debugrebuilddirstate|debugrebuildstate', |
|
2431 | @command('debugrebuilddirstate|debugrebuildstate', | |
2418 | [('r', 'rev', '', _('revision to rebuild to'), _('REV'))], |
|
2432 | [('r', 'rev', '', _('revision to rebuild to'), _('REV'))], | |
2419 | _('[-r REV]')) |
|
2433 | _('[-r REV]')) | |
2420 | def debugrebuilddirstate(ui, repo, rev): |
|
2434 | def debugrebuilddirstate(ui, repo, rev): | |
2421 | """rebuild the dirstate as it would look like for the given revision |
|
2435 | """rebuild the dirstate as it would look like for the given revision | |
2422 |
|
2436 | |||
2423 | If no revision is specified the first current parent will be used. |
|
2437 | If no revision is specified the first current parent will be used. | |
2424 |
|
2438 | |||
2425 | The dirstate will be set to the files of the given revision. |
|
2439 | The dirstate will be set to the files of the given revision. | |
2426 | The actual working directory content or existing dirstate |
|
2440 | The actual working directory content or existing dirstate | |
2427 | information such as adds or removes is not considered. |
|
2441 | information such as adds or removes is not considered. | |
2428 |
|
2442 | |||
2429 | One use of this command is to make the next :hg:`status` invocation |
|
2443 | One use of this command is to make the next :hg:`status` invocation | |
2430 | check the actual file content. |
|
2444 | check the actual file content. | |
2431 | """ |
|
2445 | """ | |
2432 | ctx = scmutil.revsingle(repo, rev) |
|
2446 | ctx = scmutil.revsingle(repo, rev) | |
2433 | wlock = repo.wlock() |
|
2447 | wlock = repo.wlock() | |
2434 | try: |
|
2448 | try: | |
2435 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) |
|
2449 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) | |
2436 | finally: |
|
2450 | finally: | |
2437 | wlock.release() |
|
2451 | wlock.release() | |
2438 |
|
2452 | |||
2439 | @command('debugrename', |
|
2453 | @command('debugrename', | |
2440 | [('r', 'rev', '', _('revision to debug'), _('REV'))], |
|
2454 | [('r', 'rev', '', _('revision to debug'), _('REV'))], | |
2441 | _('[-r REV] FILE')) |
|
2455 | _('[-r REV] FILE')) | |
2442 | def debugrename(ui, repo, file1, *pats, **opts): |
|
2456 | def debugrename(ui, repo, file1, *pats, **opts): | |
2443 | """dump rename information""" |
|
2457 | """dump rename information""" | |
2444 |
|
2458 | |||
2445 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
2459 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
2446 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
2460 | m = scmutil.match(ctx, (file1,) + pats, opts) | |
2447 | for abs in ctx.walk(m): |
|
2461 | for abs in ctx.walk(m): | |
2448 | fctx = ctx[abs] |
|
2462 | fctx = ctx[abs] | |
2449 | o = fctx.filelog().renamed(fctx.filenode()) |
|
2463 | o = fctx.filelog().renamed(fctx.filenode()) | |
2450 | rel = m.rel(abs) |
|
2464 | rel = m.rel(abs) | |
2451 | if o: |
|
2465 | if o: | |
2452 | ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) |
|
2466 | ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) | |
2453 | else: |
|
2467 | else: | |
2454 | ui.write(_("%s not renamed\n") % rel) |
|
2468 | ui.write(_("%s not renamed\n") % rel) | |
2455 |
|
2469 | |||
2456 | @command('debugrevlog', |
|
2470 | @command('debugrevlog', | |
2457 | [('c', 'changelog', False, _('open changelog')), |
|
2471 | [('c', 'changelog', False, _('open changelog')), | |
2458 | ('m', 'manifest', False, _('open manifest')), |
|
2472 | ('m', 'manifest', False, _('open manifest')), | |
2459 | ('d', 'dump', False, _('dump index data'))], |
|
2473 | ('d', 'dump', False, _('dump index data'))], | |
2460 | _('-c|-m|FILE')) |
|
2474 | _('-c|-m|FILE')) | |
2461 | def debugrevlog(ui, repo, file_=None, **opts): |
|
2475 | def debugrevlog(ui, repo, file_=None, **opts): | |
2462 | """show data and statistics about a revlog""" |
|
2476 | """show data and statistics about a revlog""" | |
2463 | r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) |
|
2477 | r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) | |
2464 |
|
2478 | |||
2465 | if opts.get("dump"): |
|
2479 | if opts.get("dump"): | |
2466 | numrevs = len(r) |
|
2480 | numrevs = len(r) | |
2467 | ui.write("# rev p1rev p2rev start end deltastart base p1 p2" |
|
2481 | ui.write("# rev p1rev p2rev start end deltastart base p1 p2" | |
2468 | " rawsize totalsize compression heads\n") |
|
2482 | " rawsize totalsize compression heads\n") | |
2469 | ts = 0 |
|
2483 | ts = 0 | |
2470 | heads = set() |
|
2484 | heads = set() | |
2471 | for rev in xrange(numrevs): |
|
2485 | for rev in xrange(numrevs): | |
2472 | dbase = r.deltaparent(rev) |
|
2486 | dbase = r.deltaparent(rev) | |
2473 | if dbase == -1: |
|
2487 | if dbase == -1: | |
2474 | dbase = rev |
|
2488 | dbase = rev | |
2475 | cbase = r.chainbase(rev) |
|
2489 | cbase = r.chainbase(rev) | |
2476 | p1, p2 = r.parentrevs(rev) |
|
2490 | p1, p2 = r.parentrevs(rev) | |
2477 | rs = r.rawsize(rev) |
|
2491 | rs = r.rawsize(rev) | |
2478 | ts = ts + rs |
|
2492 | ts = ts + rs | |
2479 | heads -= set(r.parentrevs(rev)) |
|
2493 | heads -= set(r.parentrevs(rev)) | |
2480 | heads.add(rev) |
|
2494 | heads.add(rev) | |
2481 | ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d %11d %5d\n" % |
|
2495 | ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d %11d %5d\n" % | |
2482 | (rev, p1, p2, r.start(rev), r.end(rev), |
|
2496 | (rev, p1, p2, r.start(rev), r.end(rev), | |
2483 | r.start(dbase), r.start(cbase), |
|
2497 | r.start(dbase), r.start(cbase), | |
2484 | r.start(p1), r.start(p2), |
|
2498 | r.start(p1), r.start(p2), | |
2485 | rs, ts, ts / r.end(rev), len(heads))) |
|
2499 | rs, ts, ts / r.end(rev), len(heads))) | |
2486 | return 0 |
|
2500 | return 0 | |
2487 |
|
2501 | |||
2488 | v = r.version |
|
2502 | v = r.version | |
2489 | format = v & 0xFFFF |
|
2503 | format = v & 0xFFFF | |
2490 | flags = [] |
|
2504 | flags = [] | |
2491 | gdelta = False |
|
2505 | gdelta = False | |
2492 | if v & revlog.REVLOGNGINLINEDATA: |
|
2506 | if v & revlog.REVLOGNGINLINEDATA: | |
2493 | flags.append('inline') |
|
2507 | flags.append('inline') | |
2494 | if v & revlog.REVLOGGENERALDELTA: |
|
2508 | if v & revlog.REVLOGGENERALDELTA: | |
2495 | gdelta = True |
|
2509 | gdelta = True | |
2496 | flags.append('generaldelta') |
|
2510 | flags.append('generaldelta') | |
2497 | if not flags: |
|
2511 | if not flags: | |
2498 | flags = ['(none)'] |
|
2512 | flags = ['(none)'] | |
2499 |
|
2513 | |||
2500 | nummerges = 0 |
|
2514 | nummerges = 0 | |
2501 | numfull = 0 |
|
2515 | numfull = 0 | |
2502 | numprev = 0 |
|
2516 | numprev = 0 | |
2503 | nump1 = 0 |
|
2517 | nump1 = 0 | |
2504 | nump2 = 0 |
|
2518 | nump2 = 0 | |
2505 | numother = 0 |
|
2519 | numother = 0 | |
2506 | nump1prev = 0 |
|
2520 | nump1prev = 0 | |
2507 | nump2prev = 0 |
|
2521 | nump2prev = 0 | |
2508 | chainlengths = [] |
|
2522 | chainlengths = [] | |
2509 |
|
2523 | |||
2510 | datasize = [None, 0, 0L] |
|
2524 | datasize = [None, 0, 0L] | |
2511 | fullsize = [None, 0, 0L] |
|
2525 | fullsize = [None, 0, 0L] | |
2512 | deltasize = [None, 0, 0L] |
|
2526 | deltasize = [None, 0, 0L] | |
2513 |
|
2527 | |||
2514 | def addsize(size, l): |
|
2528 | def addsize(size, l): | |
2515 | if l[0] is None or size < l[0]: |
|
2529 | if l[0] is None or size < l[0]: | |
2516 | l[0] = size |
|
2530 | l[0] = size | |
2517 | if size > l[1]: |
|
2531 | if size > l[1]: | |
2518 | l[1] = size |
|
2532 | l[1] = size | |
2519 | l[2] += size |
|
2533 | l[2] += size | |
2520 |
|
2534 | |||
2521 | numrevs = len(r) |
|
2535 | numrevs = len(r) | |
2522 | for rev in xrange(numrevs): |
|
2536 | for rev in xrange(numrevs): | |
2523 | p1, p2 = r.parentrevs(rev) |
|
2537 | p1, p2 = r.parentrevs(rev) | |
2524 | delta = r.deltaparent(rev) |
|
2538 | delta = r.deltaparent(rev) | |
2525 | if format > 0: |
|
2539 | if format > 0: | |
2526 | addsize(r.rawsize(rev), datasize) |
|
2540 | addsize(r.rawsize(rev), datasize) | |
2527 | if p2 != nullrev: |
|
2541 | if p2 != nullrev: | |
2528 | nummerges += 1 |
|
2542 | nummerges += 1 | |
2529 | size = r.length(rev) |
|
2543 | size = r.length(rev) | |
2530 | if delta == nullrev: |
|
2544 | if delta == nullrev: | |
2531 | chainlengths.append(0) |
|
2545 | chainlengths.append(0) | |
2532 | numfull += 1 |
|
2546 | numfull += 1 | |
2533 | addsize(size, fullsize) |
|
2547 | addsize(size, fullsize) | |
2534 | else: |
|
2548 | else: | |
2535 | chainlengths.append(chainlengths[delta] + 1) |
|
2549 | chainlengths.append(chainlengths[delta] + 1) | |
2536 | addsize(size, deltasize) |
|
2550 | addsize(size, deltasize) | |
2537 | if delta == rev - 1: |
|
2551 | if delta == rev - 1: | |
2538 | numprev += 1 |
|
2552 | numprev += 1 | |
2539 | if delta == p1: |
|
2553 | if delta == p1: | |
2540 | nump1prev += 1 |
|
2554 | nump1prev += 1 | |
2541 | elif delta == p2: |
|
2555 | elif delta == p2: | |
2542 | nump2prev += 1 |
|
2556 | nump2prev += 1 | |
2543 | elif delta == p1: |
|
2557 | elif delta == p1: | |
2544 | nump1 += 1 |
|
2558 | nump1 += 1 | |
2545 | elif delta == p2: |
|
2559 | elif delta == p2: | |
2546 | nump2 += 1 |
|
2560 | nump2 += 1 | |
2547 | elif delta != nullrev: |
|
2561 | elif delta != nullrev: | |
2548 | numother += 1 |
|
2562 | numother += 1 | |
2549 |
|
2563 | |||
2550 | # Adjust size min value for empty cases |
|
2564 | # Adjust size min value for empty cases | |
2551 | for size in (datasize, fullsize, deltasize): |
|
2565 | for size in (datasize, fullsize, deltasize): | |
2552 | if size[0] is None: |
|
2566 | if size[0] is None: | |
2553 | size[0] = 0 |
|
2567 | size[0] = 0 | |
2554 |
|
2568 | |||
2555 | numdeltas = numrevs - numfull |
|
2569 | numdeltas = numrevs - numfull | |
2556 | numoprev = numprev - nump1prev - nump2prev |
|
2570 | numoprev = numprev - nump1prev - nump2prev | |
2557 | totalrawsize = datasize[2] |
|
2571 | totalrawsize = datasize[2] | |
2558 | datasize[2] /= numrevs |
|
2572 | datasize[2] /= numrevs | |
2559 | fulltotal = fullsize[2] |
|
2573 | fulltotal = fullsize[2] | |
2560 | fullsize[2] /= numfull |
|
2574 | fullsize[2] /= numfull | |
2561 | deltatotal = deltasize[2] |
|
2575 | deltatotal = deltasize[2] | |
2562 | if numrevs - numfull > 0: |
|
2576 | if numrevs - numfull > 0: | |
2563 | deltasize[2] /= numrevs - numfull |
|
2577 | deltasize[2] /= numrevs - numfull | |
2564 | totalsize = fulltotal + deltatotal |
|
2578 | totalsize = fulltotal + deltatotal | |
2565 | avgchainlen = sum(chainlengths) / numrevs |
|
2579 | avgchainlen = sum(chainlengths) / numrevs | |
2566 | compratio = totalrawsize / totalsize |
|
2580 | compratio = totalrawsize / totalsize | |
2567 |
|
2581 | |||
2568 | basedfmtstr = '%%%dd\n' |
|
2582 | basedfmtstr = '%%%dd\n' | |
2569 | basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n' |
|
2583 | basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n' | |
2570 |
|
2584 | |||
2571 | def dfmtstr(max): |
|
2585 | def dfmtstr(max): | |
2572 | return basedfmtstr % len(str(max)) |
|
2586 | return basedfmtstr % len(str(max)) | |
2573 | def pcfmtstr(max, padding=0): |
|
2587 | def pcfmtstr(max, padding=0): | |
2574 | return basepcfmtstr % (len(str(max)), ' ' * padding) |
|
2588 | return basepcfmtstr % (len(str(max)), ' ' * padding) | |
2575 |
|
2589 | |||
2576 | def pcfmt(value, total): |
|
2590 | def pcfmt(value, total): | |
2577 | return (value, 100 * float(value) / total) |
|
2591 | return (value, 100 * float(value) / total) | |
2578 |
|
2592 | |||
2579 | ui.write(('format : %d\n') % format) |
|
2593 | ui.write(('format : %d\n') % format) | |
2580 | ui.write(('flags : %s\n') % ', '.join(flags)) |
|
2594 | ui.write(('flags : %s\n') % ', '.join(flags)) | |
2581 |
|
2595 | |||
2582 | ui.write('\n') |
|
2596 | ui.write('\n') | |
2583 | fmt = pcfmtstr(totalsize) |
|
2597 | fmt = pcfmtstr(totalsize) | |
2584 | fmt2 = dfmtstr(totalsize) |
|
2598 | fmt2 = dfmtstr(totalsize) | |
2585 | ui.write(('revisions : ') + fmt2 % numrevs) |
|
2599 | ui.write(('revisions : ') + fmt2 % numrevs) | |
2586 | ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) |
|
2600 | ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) | |
2587 | ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) |
|
2601 | ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) | |
2588 | ui.write(('revisions : ') + fmt2 % numrevs) |
|
2602 | ui.write(('revisions : ') + fmt2 % numrevs) | |
2589 | ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) |
|
2603 | ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) | |
2590 | ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) |
|
2604 | ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) | |
2591 | ui.write(('revision size : ') + fmt2 % totalsize) |
|
2605 | ui.write(('revision size : ') + fmt2 % totalsize) | |
2592 | ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) |
|
2606 | ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) | |
2593 | ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) |
|
2607 | ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) | |
2594 |
|
2608 | |||
2595 | ui.write('\n') |
|
2609 | ui.write('\n') | |
2596 | fmt = dfmtstr(max(avgchainlen, compratio)) |
|
2610 | fmt = dfmtstr(max(avgchainlen, compratio)) | |
2597 | ui.write(('avg chain length : ') + fmt % avgchainlen) |
|
2611 | ui.write(('avg chain length : ') + fmt % avgchainlen) | |
2598 | ui.write(('compression ratio : ') + fmt % compratio) |
|
2612 | ui.write(('compression ratio : ') + fmt % compratio) | |
2599 |
|
2613 | |||
2600 | if format > 0: |
|
2614 | if format > 0: | |
2601 | ui.write('\n') |
|
2615 | ui.write('\n') | |
2602 | ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') |
|
2616 | ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') | |
2603 | % tuple(datasize)) |
|
2617 | % tuple(datasize)) | |
2604 | ui.write(('full revision size (min/max/avg) : %d / %d / %d\n') |
|
2618 | ui.write(('full revision size (min/max/avg) : %d / %d / %d\n') | |
2605 | % tuple(fullsize)) |
|
2619 | % tuple(fullsize)) | |
2606 | ui.write(('delta size (min/max/avg) : %d / %d / %d\n') |
|
2620 | ui.write(('delta size (min/max/avg) : %d / %d / %d\n') | |
2607 | % tuple(deltasize)) |
|
2621 | % tuple(deltasize)) | |
2608 |
|
2622 | |||
2609 | if numdeltas > 0: |
|
2623 | if numdeltas > 0: | |
2610 | ui.write('\n') |
|
2624 | ui.write('\n') | |
2611 | fmt = pcfmtstr(numdeltas) |
|
2625 | fmt = pcfmtstr(numdeltas) | |
2612 | fmt2 = pcfmtstr(numdeltas, 4) |
|
2626 | fmt2 = pcfmtstr(numdeltas, 4) | |
2613 | ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas)) |
|
2627 | ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas)) | |
2614 | if numprev > 0: |
|
2628 | if numprev > 0: | |
2615 | ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev, |
|
2629 | ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev, | |
2616 | numprev)) |
|
2630 | numprev)) | |
2617 | ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev, |
|
2631 | ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev, | |
2618 | numprev)) |
|
2632 | numprev)) | |
2619 | ui.write((' other : ') + fmt2 % pcfmt(numoprev, |
|
2633 | ui.write((' other : ') + fmt2 % pcfmt(numoprev, | |
2620 | numprev)) |
|
2634 | numprev)) | |
2621 | if gdelta: |
|
2635 | if gdelta: | |
2622 | ui.write(('deltas against p1 : ') |
|
2636 | ui.write(('deltas against p1 : ') | |
2623 | + fmt % pcfmt(nump1, numdeltas)) |
|
2637 | + fmt % pcfmt(nump1, numdeltas)) | |
2624 | ui.write(('deltas against p2 : ') |
|
2638 | ui.write(('deltas against p2 : ') | |
2625 | + fmt % pcfmt(nump2, numdeltas)) |
|
2639 | + fmt % pcfmt(nump2, numdeltas)) | |
2626 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, |
|
2640 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, | |
2627 | numdeltas)) |
|
2641 | numdeltas)) | |
2628 |
|
2642 | |||
2629 | @command('debugrevspec', |
|
2643 | @command('debugrevspec', | |
2630 | [('', 'optimize', None, _('print parsed tree after optimizing'))], |
|
2644 | [('', 'optimize', None, _('print parsed tree after optimizing'))], | |
2631 | ('REVSPEC')) |
|
2645 | ('REVSPEC')) | |
2632 | def debugrevspec(ui, repo, expr, **opts): |
|
2646 | def debugrevspec(ui, repo, expr, **opts): | |
2633 | """parse and apply a revision specification |
|
2647 | """parse and apply a revision specification | |
2634 |
|
2648 | |||
2635 | Use --verbose to print the parsed tree before and after aliases |
|
2649 | Use --verbose to print the parsed tree before and after aliases | |
2636 | expansion. |
|
2650 | expansion. | |
2637 | """ |
|
2651 | """ | |
2638 | if ui.verbose: |
|
2652 | if ui.verbose: | |
2639 | tree = revset.parse(expr)[0] |
|
2653 | tree = revset.parse(expr)[0] | |
2640 | ui.note(revset.prettyformat(tree), "\n") |
|
2654 | ui.note(revset.prettyformat(tree), "\n") | |
2641 | newtree = revset.findaliases(ui, tree) |
|
2655 | newtree = revset.findaliases(ui, tree) | |
2642 | if newtree != tree: |
|
2656 | if newtree != tree: | |
2643 | ui.note(revset.prettyformat(newtree), "\n") |
|
2657 | ui.note(revset.prettyformat(newtree), "\n") | |
2644 | if opts["optimize"]: |
|
2658 | if opts["optimize"]: | |
2645 | weight, optimizedtree = revset.optimize(newtree, True) |
|
2659 | weight, optimizedtree = revset.optimize(newtree, True) | |
2646 | ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n") |
|
2660 | ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n") | |
2647 | func = revset.match(ui, expr) |
|
2661 | func = revset.match(ui, expr) | |
2648 | for c in func(repo, revset.spanset(repo)): |
|
2662 | for c in func(repo, revset.spanset(repo)): | |
2649 | ui.write("%s\n" % c) |
|
2663 | ui.write("%s\n" % c) | |
2650 |
|
2664 | |||
2651 | @command('debugsetparents', [], _('REV1 [REV2]')) |
|
2665 | @command('debugsetparents', [], _('REV1 [REV2]')) | |
2652 | def debugsetparents(ui, repo, rev1, rev2=None): |
|
2666 | def debugsetparents(ui, repo, rev1, rev2=None): | |
2653 | """manually set the parents of the current working directory |
|
2667 | """manually set the parents of the current working directory | |
2654 |
|
2668 | |||
2655 | This is useful for writing repository conversion tools, but should |
|
2669 | This is useful for writing repository conversion tools, but should | |
2656 | be used with care. |
|
2670 | be used with care. | |
2657 |
|
2671 | |||
2658 | Returns 0 on success. |
|
2672 | Returns 0 on success. | |
2659 | """ |
|
2673 | """ | |
2660 |
|
2674 | |||
2661 | r1 = scmutil.revsingle(repo, rev1).node() |
|
2675 | r1 = scmutil.revsingle(repo, rev1).node() | |
2662 | r2 = scmutil.revsingle(repo, rev2, 'null').node() |
|
2676 | r2 = scmutil.revsingle(repo, rev2, 'null').node() | |
2663 |
|
2677 | |||
2664 | wlock = repo.wlock() |
|
2678 | wlock = repo.wlock() | |
2665 | try: |
|
2679 | try: | |
2666 | repo.setparents(r1, r2) |
|
2680 | repo.setparents(r1, r2) | |
2667 | finally: |
|
2681 | finally: | |
2668 | wlock.release() |
|
2682 | wlock.release() | |
2669 |
|
2683 | |||
2670 | @command('debugdirstate|debugstate', |
|
2684 | @command('debugdirstate|debugstate', | |
2671 | [('', 'nodates', None, _('do not display the saved mtime')), |
|
2685 | [('', 'nodates', None, _('do not display the saved mtime')), | |
2672 | ('', 'datesort', None, _('sort by saved mtime'))], |
|
2686 | ('', 'datesort', None, _('sort by saved mtime'))], | |
2673 | _('[OPTION]...')) |
|
2687 | _('[OPTION]...')) | |
2674 | def debugstate(ui, repo, nodates=None, datesort=None): |
|
2688 | def debugstate(ui, repo, nodates=None, datesort=None): | |
2675 | """show the contents of the current dirstate""" |
|
2689 | """show the contents of the current dirstate""" | |
2676 | timestr = "" |
|
2690 | timestr = "" | |
2677 | showdate = not nodates |
|
2691 | showdate = not nodates | |
2678 | if datesort: |
|
2692 | if datesort: | |
2679 | keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename |
|
2693 | keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename | |
2680 | else: |
|
2694 | else: | |
2681 | keyfunc = None # sort by filename |
|
2695 | keyfunc = None # sort by filename | |
2682 | for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): |
|
2696 | for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): | |
2683 | if showdate: |
|
2697 | if showdate: | |
2684 | if ent[3] == -1: |
|
2698 | if ent[3] == -1: | |
2685 | # Pad or slice to locale representation |
|
2699 | # Pad or slice to locale representation | |
2686 | locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", |
|
2700 | locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", | |
2687 | time.localtime(0))) |
|
2701 | time.localtime(0))) | |
2688 | timestr = 'unset' |
|
2702 | timestr = 'unset' | |
2689 | timestr = (timestr[:locale_len] + |
|
2703 | timestr = (timestr[:locale_len] + | |
2690 | ' ' * (locale_len - len(timestr))) |
|
2704 | ' ' * (locale_len - len(timestr))) | |
2691 | else: |
|
2705 | else: | |
2692 | timestr = time.strftime("%Y-%m-%d %H:%M:%S ", |
|
2706 | timestr = time.strftime("%Y-%m-%d %H:%M:%S ", | |
2693 | time.localtime(ent[3])) |
|
2707 | time.localtime(ent[3])) | |
2694 | if ent[1] & 020000: |
|
2708 | if ent[1] & 020000: | |
2695 | mode = 'lnk' |
|
2709 | mode = 'lnk' | |
2696 | else: |
|
2710 | else: | |
2697 | mode = '%3o' % (ent[1] & 0777 & ~util.umask) |
|
2711 | mode = '%3o' % (ent[1] & 0777 & ~util.umask) | |
2698 | ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) |
|
2712 | ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) | |
2699 | for f in repo.dirstate.copies(): |
|
2713 | for f in repo.dirstate.copies(): | |
2700 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
|
2714 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) | |
2701 |
|
2715 | |||
2702 | @command('debugsub', |
|
2716 | @command('debugsub', | |
2703 | [('r', 'rev', '', |
|
2717 | [('r', 'rev', '', | |
2704 | _('revision to check'), _('REV'))], |
|
2718 | _('revision to check'), _('REV'))], | |
2705 | _('[-r REV] [REV]')) |
|
2719 | _('[-r REV] [REV]')) | |
2706 | def debugsub(ui, repo, rev=None): |
|
2720 | def debugsub(ui, repo, rev=None): | |
2707 | ctx = scmutil.revsingle(repo, rev, None) |
|
2721 | ctx = scmutil.revsingle(repo, rev, None) | |
2708 | for k, v in sorted(ctx.substate.items()): |
|
2722 | for k, v in sorted(ctx.substate.items()): | |
2709 | ui.write(('path %s\n') % k) |
|
2723 | ui.write(('path %s\n') % k) | |
2710 | ui.write((' source %s\n') % v[0]) |
|
2724 | ui.write((' source %s\n') % v[0]) | |
2711 | ui.write((' revision %s\n') % v[1]) |
|
2725 | ui.write((' revision %s\n') % v[1]) | |
2712 |
|
2726 | |||
2713 | @command('debugsuccessorssets', |
|
2727 | @command('debugsuccessorssets', | |
2714 | [], |
|
2728 | [], | |
2715 | _('[REV]')) |
|
2729 | _('[REV]')) | |
2716 | def debugsuccessorssets(ui, repo, *revs): |
|
2730 | def debugsuccessorssets(ui, repo, *revs): | |
2717 | """show set of successors for revision |
|
2731 | """show set of successors for revision | |
2718 |
|
2732 | |||
2719 | A successors set of changeset A is a consistent group of revisions that |
|
2733 | A successors set of changeset A is a consistent group of revisions that | |
2720 | succeed A. It contains non-obsolete changesets only. |
|
2734 | succeed A. It contains non-obsolete changesets only. | |
2721 |
|
2735 | |||
2722 | In most cases a changeset A has a single successors set containing a single |
|
2736 | In most cases a changeset A has a single successors set containing a single | |
2723 | successor (changeset A replaced by A'). |
|
2737 | successor (changeset A replaced by A'). | |
2724 |
|
2738 | |||
2725 | A changeset that is made obsolete with no successors are called "pruned". |
|
2739 | A changeset that is made obsolete with no successors are called "pruned". | |
2726 | Such changesets have no successors sets at all. |
|
2740 | Such changesets have no successors sets at all. | |
2727 |
|
2741 | |||
2728 | A changeset that has been "split" will have a successors set containing |
|
2742 | A changeset that has been "split" will have a successors set containing | |
2729 | more than one successor. |
|
2743 | more than one successor. | |
2730 |
|
2744 | |||
2731 | A changeset that has been rewritten in multiple different ways is called |
|
2745 | A changeset that has been rewritten in multiple different ways is called | |
2732 | "divergent". Such changesets have multiple successor sets (each of which |
|
2746 | "divergent". Such changesets have multiple successor sets (each of which | |
2733 | may also be split, i.e. have multiple successors). |
|
2747 | may also be split, i.e. have multiple successors). | |
2734 |
|
2748 | |||
2735 | Results are displayed as follows:: |
|
2749 | Results are displayed as follows:: | |
2736 |
|
2750 | |||
2737 | <rev1> |
|
2751 | <rev1> | |
2738 | <successors-1A> |
|
2752 | <successors-1A> | |
2739 | <rev2> |
|
2753 | <rev2> | |
2740 | <successors-2A> |
|
2754 | <successors-2A> | |
2741 | <successors-2B1> <successors-2B2> <successors-2B3> |
|
2755 | <successors-2B1> <successors-2B2> <successors-2B3> | |
2742 |
|
2756 | |||
2743 | Here rev2 has two possible (i.e. divergent) successors sets. The first |
|
2757 | Here rev2 has two possible (i.e. divergent) successors sets. The first | |
2744 | holds one element, whereas the second holds three (i.e. the changeset has |
|
2758 | holds one element, whereas the second holds three (i.e. the changeset has | |
2745 | been split). |
|
2759 | been split). | |
2746 | """ |
|
2760 | """ | |
2747 | # passed to successorssets caching computation from one call to another |
|
2761 | # passed to successorssets caching computation from one call to another | |
2748 | cache = {} |
|
2762 | cache = {} | |
2749 | ctx2str = str |
|
2763 | ctx2str = str | |
2750 | node2str = short |
|
2764 | node2str = short | |
2751 | if ui.debug(): |
|
2765 | if ui.debug(): | |
2752 | def ctx2str(ctx): |
|
2766 | def ctx2str(ctx): | |
2753 | return ctx.hex() |
|
2767 | return ctx.hex() | |
2754 | node2str = hex |
|
2768 | node2str = hex | |
2755 | for rev in scmutil.revrange(repo, revs): |
|
2769 | for rev in scmutil.revrange(repo, revs): | |
2756 | ctx = repo[rev] |
|
2770 | ctx = repo[rev] | |
2757 | ui.write('%s\n'% ctx2str(ctx)) |
|
2771 | ui.write('%s\n'% ctx2str(ctx)) | |
2758 | for succsset in obsolete.successorssets(repo, ctx.node(), cache): |
|
2772 | for succsset in obsolete.successorssets(repo, ctx.node(), cache): | |
2759 | if succsset: |
|
2773 | if succsset: | |
2760 | ui.write(' ') |
|
2774 | ui.write(' ') | |
2761 | ui.write(node2str(succsset[0])) |
|
2775 | ui.write(node2str(succsset[0])) | |
2762 | for node in succsset[1:]: |
|
2776 | for node in succsset[1:]: | |
2763 | ui.write(' ') |
|
2777 | ui.write(' ') | |
2764 | ui.write(node2str(node)) |
|
2778 | ui.write(node2str(node)) | |
2765 | ui.write('\n') |
|
2779 | ui.write('\n') | |
2766 |
|
2780 | |||
2767 | @command('debugwalk', walkopts, _('[OPTION]... [FILE]...')) |
|
2781 | @command('debugwalk', walkopts, _('[OPTION]... [FILE]...')) | |
2768 | def debugwalk(ui, repo, *pats, **opts): |
|
2782 | def debugwalk(ui, repo, *pats, **opts): | |
2769 | """show how files match on given patterns""" |
|
2783 | """show how files match on given patterns""" | |
2770 | m = scmutil.match(repo[None], pats, opts) |
|
2784 | m = scmutil.match(repo[None], pats, opts) | |
2771 | items = list(repo.walk(m)) |
|
2785 | items = list(repo.walk(m)) | |
2772 | if not items: |
|
2786 | if not items: | |
2773 | return |
|
2787 | return | |
2774 | f = lambda fn: fn |
|
2788 | f = lambda fn: fn | |
2775 | if ui.configbool('ui', 'slash') and os.sep != '/': |
|
2789 | if ui.configbool('ui', 'slash') and os.sep != '/': | |
2776 | f = lambda fn: util.normpath(fn) |
|
2790 | f = lambda fn: util.normpath(fn) | |
2777 | fmt = 'f %%-%ds %%-%ds %%s' % ( |
|
2791 | fmt = 'f %%-%ds %%-%ds %%s' % ( | |
2778 | max([len(abs) for abs in items]), |
|
2792 | max([len(abs) for abs in items]), | |
2779 | max([len(m.rel(abs)) for abs in items])) |
|
2793 | max([len(m.rel(abs)) for abs in items])) | |
2780 | for abs in items: |
|
2794 | for abs in items: | |
2781 | line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') |
|
2795 | line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') | |
2782 | ui.write("%s\n" % line.rstrip()) |
|
2796 | ui.write("%s\n" % line.rstrip()) | |
2783 |
|
2797 | |||
2784 | @command('debugwireargs', |
|
2798 | @command('debugwireargs', | |
2785 | [('', 'three', '', 'three'), |
|
2799 | [('', 'three', '', 'three'), | |
2786 | ('', 'four', '', 'four'), |
|
2800 | ('', 'four', '', 'four'), | |
2787 | ('', 'five', '', 'five'), |
|
2801 | ('', 'five', '', 'five'), | |
2788 | ] + remoteopts, |
|
2802 | ] + remoteopts, | |
2789 | _('REPO [OPTIONS]... [ONE [TWO]]')) |
|
2803 | _('REPO [OPTIONS]... [ONE [TWO]]')) | |
2790 | def debugwireargs(ui, repopath, *vals, **opts): |
|
2804 | def debugwireargs(ui, repopath, *vals, **opts): | |
2791 | repo = hg.peer(ui, opts, repopath) |
|
2805 | repo = hg.peer(ui, opts, repopath) | |
2792 | for opt in remoteopts: |
|
2806 | for opt in remoteopts: | |
2793 | del opts[opt[1]] |
|
2807 | del opts[opt[1]] | |
2794 | args = {} |
|
2808 | args = {} | |
2795 | for k, v in opts.iteritems(): |
|
2809 | for k, v in opts.iteritems(): | |
2796 | if v: |
|
2810 | if v: | |
2797 | args[k] = v |
|
2811 | args[k] = v | |
2798 | # run twice to check that we don't mess up the stream for the next command |
|
2812 | # run twice to check that we don't mess up the stream for the next command | |
2799 | res1 = repo.debugwireargs(*vals, **args) |
|
2813 | res1 = repo.debugwireargs(*vals, **args) | |
2800 | res2 = repo.debugwireargs(*vals, **args) |
|
2814 | res2 = repo.debugwireargs(*vals, **args) | |
2801 | ui.write("%s\n" % res1) |
|
2815 | ui.write("%s\n" % res1) | |
2802 | if res1 != res2: |
|
2816 | if res1 != res2: | |
2803 | ui.warn("%s\n" % res2) |
|
2817 | ui.warn("%s\n" % res2) | |
2804 |
|
2818 | |||
2805 | @command('^diff', |
|
2819 | @command('^diff', | |
2806 | [('r', 'rev', [], _('revision'), _('REV')), |
|
2820 | [('r', 'rev', [], _('revision'), _('REV')), | |
2807 | ('c', 'change', '', _('change made by revision'), _('REV')) |
|
2821 | ('c', 'change', '', _('change made by revision'), _('REV')) | |
2808 | ] + diffopts + diffopts2 + walkopts + subrepoopts, |
|
2822 | ] + diffopts + diffopts2 + walkopts + subrepoopts, | |
2809 | _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...')) |
|
2823 | _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...')) | |
2810 | def diff(ui, repo, *pats, **opts): |
|
2824 | def diff(ui, repo, *pats, **opts): | |
2811 | """diff repository (or selected files) |
|
2825 | """diff repository (or selected files) | |
2812 |
|
2826 | |||
2813 | Show differences between revisions for the specified files. |
|
2827 | Show differences between revisions for the specified files. | |
2814 |
|
2828 | |||
2815 | Differences between files are shown using the unified diff format. |
|
2829 | Differences between files are shown using the unified diff format. | |
2816 |
|
2830 | |||
2817 | .. note:: |
|
2831 | .. note:: | |
2818 |
|
2832 | |||
2819 | diff may generate unexpected results for merges, as it will |
|
2833 | diff may generate unexpected results for merges, as it will | |
2820 | default to comparing against the working directory's first |
|
2834 | default to comparing against the working directory's first | |
2821 | parent changeset if no revisions are specified. |
|
2835 | parent changeset if no revisions are specified. | |
2822 |
|
2836 | |||
2823 | When two revision arguments are given, then changes are shown |
|
2837 | When two revision arguments are given, then changes are shown | |
2824 | between those revisions. If only one revision is specified then |
|
2838 | between those revisions. If only one revision is specified then | |
2825 | that revision is compared to the working directory, and, when no |
|
2839 | that revision is compared to the working directory, and, when no | |
2826 | revisions are specified, the working directory files are compared |
|
2840 | revisions are specified, the working directory files are compared | |
2827 | to its parent. |
|
2841 | to its parent. | |
2828 |
|
2842 | |||
2829 | Alternatively you can specify -c/--change with a revision to see |
|
2843 | Alternatively you can specify -c/--change with a revision to see | |
2830 | the changes in that changeset relative to its first parent. |
|
2844 | the changes in that changeset relative to its first parent. | |
2831 |
|
2845 | |||
2832 | Without the -a/--text option, diff will avoid generating diffs of |
|
2846 | Without the -a/--text option, diff will avoid generating diffs of | |
2833 | files it detects as binary. With -a, diff will generate a diff |
|
2847 | files it detects as binary. With -a, diff will generate a diff | |
2834 | anyway, probably with undesirable results. |
|
2848 | anyway, probably with undesirable results. | |
2835 |
|
2849 | |||
2836 | Use the -g/--git option to generate diffs in the git extended diff |
|
2850 | Use the -g/--git option to generate diffs in the git extended diff | |
2837 | format. For more information, read :hg:`help diffs`. |
|
2851 | format. For more information, read :hg:`help diffs`. | |
2838 |
|
2852 | |||
2839 | .. container:: verbose |
|
2853 | .. container:: verbose | |
2840 |
|
2854 | |||
2841 | Examples: |
|
2855 | Examples: | |
2842 |
|
2856 | |||
2843 | - compare a file in the current working directory to its parent:: |
|
2857 | - compare a file in the current working directory to its parent:: | |
2844 |
|
2858 | |||
2845 | hg diff foo.c |
|
2859 | hg diff foo.c | |
2846 |
|
2860 | |||
2847 | - compare two historical versions of a directory, with rename info:: |
|
2861 | - compare two historical versions of a directory, with rename info:: | |
2848 |
|
2862 | |||
2849 | hg diff --git -r 1.0:1.2 lib/ |
|
2863 | hg diff --git -r 1.0:1.2 lib/ | |
2850 |
|
2864 | |||
2851 | - get change stats relative to the last change on some date:: |
|
2865 | - get change stats relative to the last change on some date:: | |
2852 |
|
2866 | |||
2853 | hg diff --stat -r "date('may 2')" |
|
2867 | hg diff --stat -r "date('may 2')" | |
2854 |
|
2868 | |||
2855 | - diff all newly-added files that contain a keyword:: |
|
2869 | - diff all newly-added files that contain a keyword:: | |
2856 |
|
2870 | |||
2857 | hg diff "set:added() and grep(GNU)" |
|
2871 | hg diff "set:added() and grep(GNU)" | |
2858 |
|
2872 | |||
2859 | - compare a revision and its parents:: |
|
2873 | - compare a revision and its parents:: | |
2860 |
|
2874 | |||
2861 | hg diff -c 9353 # compare against first parent |
|
2875 | hg diff -c 9353 # compare against first parent | |
2862 | hg diff -r 9353^:9353 # same using revset syntax |
|
2876 | hg diff -r 9353^:9353 # same using revset syntax | |
2863 | hg diff -r 9353^2:9353 # compare against the second parent |
|
2877 | hg diff -r 9353^2:9353 # compare against the second parent | |
2864 |
|
2878 | |||
2865 | Returns 0 on success. |
|
2879 | Returns 0 on success. | |
2866 | """ |
|
2880 | """ | |
2867 |
|
2881 | |||
2868 | revs = opts.get('rev') |
|
2882 | revs = opts.get('rev') | |
2869 | change = opts.get('change') |
|
2883 | change = opts.get('change') | |
2870 | stat = opts.get('stat') |
|
2884 | stat = opts.get('stat') | |
2871 | reverse = opts.get('reverse') |
|
2885 | reverse = opts.get('reverse') | |
2872 |
|
2886 | |||
2873 | if revs and change: |
|
2887 | if revs and change: | |
2874 | msg = _('cannot specify --rev and --change at the same time') |
|
2888 | msg = _('cannot specify --rev and --change at the same time') | |
2875 | raise util.Abort(msg) |
|
2889 | raise util.Abort(msg) | |
2876 | elif change: |
|
2890 | elif change: | |
2877 | node2 = scmutil.revsingle(repo, change, None).node() |
|
2891 | node2 = scmutil.revsingle(repo, change, None).node() | |
2878 | node1 = repo[node2].p1().node() |
|
2892 | node1 = repo[node2].p1().node() | |
2879 | else: |
|
2893 | else: | |
2880 | node1, node2 = scmutil.revpair(repo, revs) |
|
2894 | node1, node2 = scmutil.revpair(repo, revs) | |
2881 |
|
2895 | |||
2882 | if reverse: |
|
2896 | if reverse: | |
2883 | node1, node2 = node2, node1 |
|
2897 | node1, node2 = node2, node1 | |
2884 |
|
2898 | |||
2885 | diffopts = patch.diffopts(ui, opts) |
|
2899 | diffopts = patch.diffopts(ui, opts) | |
2886 | m = scmutil.match(repo[node2], pats, opts) |
|
2900 | m = scmutil.match(repo[node2], pats, opts) | |
2887 | cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, |
|
2901 | cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, | |
2888 | listsubrepos=opts.get('subrepos')) |
|
2902 | listsubrepos=opts.get('subrepos')) | |
2889 |
|
2903 | |||
2890 | @command('^export', |
|
2904 | @command('^export', | |
2891 | [('o', 'output', '', |
|
2905 | [('o', 'output', '', | |
2892 | _('print output to file with formatted name'), _('FORMAT')), |
|
2906 | _('print output to file with formatted name'), _('FORMAT')), | |
2893 | ('', 'switch-parent', None, _('diff against the second parent')), |
|
2907 | ('', 'switch-parent', None, _('diff against the second parent')), | |
2894 | ('r', 'rev', [], _('revisions to export'), _('REV')), |
|
2908 | ('r', 'rev', [], _('revisions to export'), _('REV')), | |
2895 | ] + diffopts, |
|
2909 | ] + diffopts, | |
2896 | _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...')) |
|
2910 | _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...')) | |
2897 | def export(ui, repo, *changesets, **opts): |
|
2911 | def export(ui, repo, *changesets, **opts): | |
2898 | """dump the header and diffs for one or more changesets |
|
2912 | """dump the header and diffs for one or more changesets | |
2899 |
|
2913 | |||
2900 | Print the changeset header and diffs for one or more revisions. |
|
2914 | Print the changeset header and diffs for one or more revisions. | |
2901 | If no revision is given, the parent of the working directory is used. |
|
2915 | If no revision is given, the parent of the working directory is used. | |
2902 |
|
2916 | |||
2903 | The information shown in the changeset header is: author, date, |
|
2917 | The information shown in the changeset header is: author, date, | |
2904 | branch name (if non-default), changeset hash, parent(s) and commit |
|
2918 | branch name (if non-default), changeset hash, parent(s) and commit | |
2905 | comment. |
|
2919 | comment. | |
2906 |
|
2920 | |||
2907 | .. note:: |
|
2921 | .. note:: | |
2908 |
|
2922 | |||
2909 | export may generate unexpected diff output for merge |
|
2923 | export may generate unexpected diff output for merge | |
2910 | changesets, as it will compare the merge changeset against its |
|
2924 | changesets, as it will compare the merge changeset against its | |
2911 | first parent only. |
|
2925 | first parent only. | |
2912 |
|
2926 | |||
2913 | Output may be to a file, in which case the name of the file is |
|
2927 | Output may be to a file, in which case the name of the file is | |
2914 | given using a format string. The formatting rules are as follows: |
|
2928 | given using a format string. The formatting rules are as follows: | |
2915 |
|
2929 | |||
2916 | :``%%``: literal "%" character |
|
2930 | :``%%``: literal "%" character | |
2917 | :``%H``: changeset hash (40 hexadecimal digits) |
|
2931 | :``%H``: changeset hash (40 hexadecimal digits) | |
2918 | :``%N``: number of patches being generated |
|
2932 | :``%N``: number of patches being generated | |
2919 | :``%R``: changeset revision number |
|
2933 | :``%R``: changeset revision number | |
2920 | :``%b``: basename of the exporting repository |
|
2934 | :``%b``: basename of the exporting repository | |
2921 | :``%h``: short-form changeset hash (12 hexadecimal digits) |
|
2935 | :``%h``: short-form changeset hash (12 hexadecimal digits) | |
2922 | :``%m``: first line of the commit message (only alphanumeric characters) |
|
2936 | :``%m``: first line of the commit message (only alphanumeric characters) | |
2923 | :``%n``: zero-padded sequence number, starting at 1 |
|
2937 | :``%n``: zero-padded sequence number, starting at 1 | |
2924 | :``%r``: zero-padded changeset revision number |
|
2938 | :``%r``: zero-padded changeset revision number | |
2925 |
|
2939 | |||
2926 | Without the -a/--text option, export will avoid generating diffs |
|
2940 | Without the -a/--text option, export will avoid generating diffs | |
2927 | of files it detects as binary. With -a, export will generate a |
|
2941 | of files it detects as binary. With -a, export will generate a | |
2928 | diff anyway, probably with undesirable results. |
|
2942 | diff anyway, probably with undesirable results. | |
2929 |
|
2943 | |||
2930 | Use the -g/--git option to generate diffs in the git extended diff |
|
2944 | Use the -g/--git option to generate diffs in the git extended diff | |
2931 | format. See :hg:`help diffs` for more information. |
|
2945 | format. See :hg:`help diffs` for more information. | |
2932 |
|
2946 | |||
2933 | With the --switch-parent option, the diff will be against the |
|
2947 | With the --switch-parent option, the diff will be against the | |
2934 | second parent. It can be useful to review a merge. |
|
2948 | second parent. It can be useful to review a merge. | |
2935 |
|
2949 | |||
2936 | .. container:: verbose |
|
2950 | .. container:: verbose | |
2937 |
|
2951 | |||
2938 | Examples: |
|
2952 | Examples: | |
2939 |
|
2953 | |||
2940 | - use export and import to transplant a bugfix to the current |
|
2954 | - use export and import to transplant a bugfix to the current | |
2941 | branch:: |
|
2955 | branch:: | |
2942 |
|
2956 | |||
2943 | hg export -r 9353 | hg import - |
|
2957 | hg export -r 9353 | hg import - | |
2944 |
|
2958 | |||
2945 | - export all the changesets between two revisions to a file with |
|
2959 | - export all the changesets between two revisions to a file with | |
2946 | rename information:: |
|
2960 | rename information:: | |
2947 |
|
2961 | |||
2948 | hg export --git -r 123:150 > changes.txt |
|
2962 | hg export --git -r 123:150 > changes.txt | |
2949 |
|
2963 | |||
2950 | - split outgoing changes into a series of patches with |
|
2964 | - split outgoing changes into a series of patches with | |
2951 | descriptive names:: |
|
2965 | descriptive names:: | |
2952 |
|
2966 | |||
2953 | hg export -r "outgoing()" -o "%n-%m.patch" |
|
2967 | hg export -r "outgoing()" -o "%n-%m.patch" | |
2954 |
|
2968 | |||
2955 | Returns 0 on success. |
|
2969 | Returns 0 on success. | |
2956 | """ |
|
2970 | """ | |
2957 | changesets += tuple(opts.get('rev', [])) |
|
2971 | changesets += tuple(opts.get('rev', [])) | |
2958 | if not changesets: |
|
2972 | if not changesets: | |
2959 | changesets = ['.'] |
|
2973 | changesets = ['.'] | |
2960 | revs = scmutil.revrange(repo, changesets) |
|
2974 | revs = scmutil.revrange(repo, changesets) | |
2961 | if not revs: |
|
2975 | if not revs: | |
2962 | raise util.Abort(_("export requires at least one changeset")) |
|
2976 | raise util.Abort(_("export requires at least one changeset")) | |
2963 | if len(revs) > 1: |
|
2977 | if len(revs) > 1: | |
2964 | ui.note(_('exporting patches:\n')) |
|
2978 | ui.note(_('exporting patches:\n')) | |
2965 | else: |
|
2979 | else: | |
2966 | ui.note(_('exporting patch:\n')) |
|
2980 | ui.note(_('exporting patch:\n')) | |
2967 | cmdutil.export(repo, revs, template=opts.get('output'), |
|
2981 | cmdutil.export(repo, revs, template=opts.get('output'), | |
2968 | switch_parent=opts.get('switch_parent'), |
|
2982 | switch_parent=opts.get('switch_parent'), | |
2969 | opts=patch.diffopts(ui, opts)) |
|
2983 | opts=patch.diffopts(ui, opts)) | |
2970 |
|
2984 | |||
2971 | @command('^forget', walkopts, _('[OPTION]... FILE...')) |
|
2985 | @command('^forget', walkopts, _('[OPTION]... FILE...')) | |
2972 | def forget(ui, repo, *pats, **opts): |
|
2986 | def forget(ui, repo, *pats, **opts): | |
2973 | """forget the specified files on the next commit |
|
2987 | """forget the specified files on the next commit | |
2974 |
|
2988 | |||
2975 | Mark the specified files so they will no longer be tracked |
|
2989 | Mark the specified files so they will no longer be tracked | |
2976 | after the next commit. |
|
2990 | after the next commit. | |
2977 |
|
2991 | |||
2978 | This only removes files from the current branch, not from the |
|
2992 | This only removes files from the current branch, not from the | |
2979 | entire project history, and it does not delete them from the |
|
2993 | entire project history, and it does not delete them from the | |
2980 | working directory. |
|
2994 | working directory. | |
2981 |
|
2995 | |||
2982 | To undo a forget before the next commit, see :hg:`add`. |
|
2996 | To undo a forget before the next commit, see :hg:`add`. | |
2983 |
|
2997 | |||
2984 | .. container:: verbose |
|
2998 | .. container:: verbose | |
2985 |
|
2999 | |||
2986 | Examples: |
|
3000 | Examples: | |
2987 |
|
3001 | |||
2988 | - forget newly-added binary files:: |
|
3002 | - forget newly-added binary files:: | |
2989 |
|
3003 | |||
2990 | hg forget "set:added() and binary()" |
|
3004 | hg forget "set:added() and binary()" | |
2991 |
|
3005 | |||
2992 | - forget files that would be excluded by .hgignore:: |
|
3006 | - forget files that would be excluded by .hgignore:: | |
2993 |
|
3007 | |||
2994 | hg forget "set:hgignore()" |
|
3008 | hg forget "set:hgignore()" | |
2995 |
|
3009 | |||
2996 | Returns 0 on success. |
|
3010 | Returns 0 on success. | |
2997 | """ |
|
3011 | """ | |
2998 |
|
3012 | |||
2999 | if not pats: |
|
3013 | if not pats: | |
3000 | raise util.Abort(_('no files specified')) |
|
3014 | raise util.Abort(_('no files specified')) | |
3001 |
|
3015 | |||
3002 | m = scmutil.match(repo[None], pats, opts) |
|
3016 | m = scmutil.match(repo[None], pats, opts) | |
3003 | rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0] |
|
3017 | rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0] | |
3004 | return rejected and 1 or 0 |
|
3018 | return rejected and 1 or 0 | |
3005 |
|
3019 | |||
3006 | @command( |
|
3020 | @command( | |
3007 | 'graft', |
|
3021 | 'graft', | |
3008 | [('r', 'rev', [], _('revisions to graft'), _('REV')), |
|
3022 | [('r', 'rev', [], _('revisions to graft'), _('REV')), | |
3009 | ('c', 'continue', False, _('resume interrupted graft')), |
|
3023 | ('c', 'continue', False, _('resume interrupted graft')), | |
3010 | ('e', 'edit', False, _('invoke editor on commit messages')), |
|
3024 | ('e', 'edit', False, _('invoke editor on commit messages')), | |
3011 | ('', 'log', None, _('append graft info to log message')), |
|
3025 | ('', 'log', None, _('append graft info to log message')), | |
3012 | ('D', 'currentdate', False, |
|
3026 | ('D', 'currentdate', False, | |
3013 | _('record the current date as commit date')), |
|
3027 | _('record the current date as commit date')), | |
3014 | ('U', 'currentuser', False, |
|
3028 | ('U', 'currentuser', False, | |
3015 | _('record the current user as committer'), _('DATE'))] |
|
3029 | _('record the current user as committer'), _('DATE'))] | |
3016 | + commitopts2 + mergetoolopts + dryrunopts, |
|
3030 | + commitopts2 + mergetoolopts + dryrunopts, | |
3017 | _('[OPTION]... [-r] REV...')) |
|
3031 | _('[OPTION]... [-r] REV...')) | |
3018 | def graft(ui, repo, *revs, **opts): |
|
3032 | def graft(ui, repo, *revs, **opts): | |
3019 | '''copy changes from other branches onto the current branch |
|
3033 | '''copy changes from other branches onto the current branch | |
3020 |
|
3034 | |||
3021 | This command uses Mercurial's merge logic to copy individual |
|
3035 | This command uses Mercurial's merge logic to copy individual | |
3022 | changes from other branches without merging branches in the |
|
3036 | changes from other branches without merging branches in the | |
3023 | history graph. This is sometimes known as 'backporting' or |
|
3037 | history graph. This is sometimes known as 'backporting' or | |
3024 | 'cherry-picking'. By default, graft will copy user, date, and |
|
3038 | 'cherry-picking'. By default, graft will copy user, date, and | |
3025 | description from the source changesets. |
|
3039 | description from the source changesets. | |
3026 |
|
3040 | |||
3027 | Changesets that are ancestors of the current revision, that have |
|
3041 | Changesets that are ancestors of the current revision, that have | |
3028 | already been grafted, or that are merges will be skipped. |
|
3042 | already been grafted, or that are merges will be skipped. | |
3029 |
|
3043 | |||
3030 | If --log is specified, log messages will have a comment appended |
|
3044 | If --log is specified, log messages will have a comment appended | |
3031 | of the form:: |
|
3045 | of the form:: | |
3032 |
|
3046 | |||
3033 | (grafted from CHANGESETHASH) |
|
3047 | (grafted from CHANGESETHASH) | |
3034 |
|
3048 | |||
3035 | If a graft merge results in conflicts, the graft process is |
|
3049 | If a graft merge results in conflicts, the graft process is | |
3036 | interrupted so that the current merge can be manually resolved. |
|
3050 | interrupted so that the current merge can be manually resolved. | |
3037 | Once all conflicts are addressed, the graft process can be |
|
3051 | Once all conflicts are addressed, the graft process can be | |
3038 | continued with the -c/--continue option. |
|
3052 | continued with the -c/--continue option. | |
3039 |
|
3053 | |||
3040 | .. note:: |
|
3054 | .. note:: | |
3041 |
|
3055 | |||
3042 | The -c/--continue option does not reapply earlier options. |
|
3056 | The -c/--continue option does not reapply earlier options. | |
3043 |
|
3057 | |||
3044 | .. container:: verbose |
|
3058 | .. container:: verbose | |
3045 |
|
3059 | |||
3046 | Examples: |
|
3060 | Examples: | |
3047 |
|
3061 | |||
3048 | - copy a single change to the stable branch and edit its description:: |
|
3062 | - copy a single change to the stable branch and edit its description:: | |
3049 |
|
3063 | |||
3050 | hg update stable |
|
3064 | hg update stable | |
3051 | hg graft --edit 9393 |
|
3065 | hg graft --edit 9393 | |
3052 |
|
3066 | |||
3053 | - graft a range of changesets with one exception, updating dates:: |
|
3067 | - graft a range of changesets with one exception, updating dates:: | |
3054 |
|
3068 | |||
3055 | hg graft -D "2085::2093 and not 2091" |
|
3069 | hg graft -D "2085::2093 and not 2091" | |
3056 |
|
3070 | |||
3057 | - continue a graft after resolving conflicts:: |
|
3071 | - continue a graft after resolving conflicts:: | |
3058 |
|
3072 | |||
3059 | hg graft -c |
|
3073 | hg graft -c | |
3060 |
|
3074 | |||
3061 | - show the source of a grafted changeset:: |
|
3075 | - show the source of a grafted changeset:: | |
3062 |
|
3076 | |||
3063 | hg log --debug -r . |
|
3077 | hg log --debug -r . | |
3064 |
|
3078 | |||
3065 | Returns 0 on successful completion. |
|
3079 | Returns 0 on successful completion. | |
3066 | ''' |
|
3080 | ''' | |
3067 |
|
3081 | |||
3068 | revs = list(revs) |
|
3082 | revs = list(revs) | |
3069 | revs.extend(opts['rev']) |
|
3083 | revs.extend(opts['rev']) | |
3070 |
|
3084 | |||
3071 | if not opts.get('user') and opts.get('currentuser'): |
|
3085 | if not opts.get('user') and opts.get('currentuser'): | |
3072 | opts['user'] = ui.username() |
|
3086 | opts['user'] = ui.username() | |
3073 | if not opts.get('date') and opts.get('currentdate'): |
|
3087 | if not opts.get('date') and opts.get('currentdate'): | |
3074 | opts['date'] = "%d %d" % util.makedate() |
|
3088 | opts['date'] = "%d %d" % util.makedate() | |
3075 |
|
3089 | |||
3076 | editor = cmdutil.getcommiteditor(**opts) |
|
3090 | editor = cmdutil.getcommiteditor(**opts) | |
3077 |
|
3091 | |||
3078 | cont = False |
|
3092 | cont = False | |
3079 | if opts['continue']: |
|
3093 | if opts['continue']: | |
3080 | cont = True |
|
3094 | cont = True | |
3081 | if revs: |
|
3095 | if revs: | |
3082 | raise util.Abort(_("can't specify --continue and revisions")) |
|
3096 | raise util.Abort(_("can't specify --continue and revisions")) | |
3083 | # read in unfinished revisions |
|
3097 | # read in unfinished revisions | |
3084 | try: |
|
3098 | try: | |
3085 | nodes = repo.opener.read('graftstate').splitlines() |
|
3099 | nodes = repo.opener.read('graftstate').splitlines() | |
3086 | revs = [repo[node].rev() for node in nodes] |
|
3100 | revs = [repo[node].rev() for node in nodes] | |
3087 | except IOError, inst: |
|
3101 | except IOError, inst: | |
3088 | if inst.errno != errno.ENOENT: |
|
3102 | if inst.errno != errno.ENOENT: | |
3089 | raise |
|
3103 | raise | |
3090 | raise util.Abort(_("no graft state found, can't continue")) |
|
3104 | raise util.Abort(_("no graft state found, can't continue")) | |
3091 | else: |
|
3105 | else: | |
3092 | cmdutil.checkunfinished(repo) |
|
3106 | cmdutil.checkunfinished(repo) | |
3093 | cmdutil.bailifchanged(repo) |
|
3107 | cmdutil.bailifchanged(repo) | |
3094 | if not revs: |
|
3108 | if not revs: | |
3095 | raise util.Abort(_('no revisions specified')) |
|
3109 | raise util.Abort(_('no revisions specified')) | |
3096 | revs = scmutil.revrange(repo, revs) |
|
3110 | revs = scmutil.revrange(repo, revs) | |
3097 |
|
3111 | |||
3098 | # check for merges |
|
3112 | # check for merges | |
3099 | for rev in repo.revs('%ld and merge()', revs): |
|
3113 | for rev in repo.revs('%ld and merge()', revs): | |
3100 | ui.warn(_('skipping ungraftable merge revision %s\n') % rev) |
|
3114 | ui.warn(_('skipping ungraftable merge revision %s\n') % rev) | |
3101 | revs.remove(rev) |
|
3115 | revs.remove(rev) | |
3102 | if not revs: |
|
3116 | if not revs: | |
3103 | return -1 |
|
3117 | return -1 | |
3104 |
|
3118 | |||
3105 | # check for ancestors of dest branch |
|
3119 | # check for ancestors of dest branch | |
3106 | crev = repo['.'].rev() |
|
3120 | crev = repo['.'].rev() | |
3107 | ancestors = repo.changelog.ancestors([crev], inclusive=True) |
|
3121 | ancestors = repo.changelog.ancestors([crev], inclusive=True) | |
3108 | # Cannot use x.remove(y) on smart set, this has to be a list. |
|
3122 | # Cannot use x.remove(y) on smart set, this has to be a list. | |
3109 | # XXX make this lazy in the future |
|
3123 | # XXX make this lazy in the future | |
3110 | revs = list(revs) |
|
3124 | revs = list(revs) | |
3111 | # don't mutate while iterating, create a copy |
|
3125 | # don't mutate while iterating, create a copy | |
3112 | for rev in list(revs): |
|
3126 | for rev in list(revs): | |
3113 | if rev in ancestors: |
|
3127 | if rev in ancestors: | |
3114 | ui.warn(_('skipping ancestor revision %s\n') % rev) |
|
3128 | ui.warn(_('skipping ancestor revision %s\n') % rev) | |
3115 | # XXX remove on list is slow |
|
3129 | # XXX remove on list is slow | |
3116 | revs.remove(rev) |
|
3130 | revs.remove(rev) | |
3117 | if not revs: |
|
3131 | if not revs: | |
3118 | return -1 |
|
3132 | return -1 | |
3119 |
|
3133 | |||
3120 | # analyze revs for earlier grafts |
|
3134 | # analyze revs for earlier grafts | |
3121 | ids = {} |
|
3135 | ids = {} | |
3122 | for ctx in repo.set("%ld", revs): |
|
3136 | for ctx in repo.set("%ld", revs): | |
3123 | ids[ctx.hex()] = ctx.rev() |
|
3137 | ids[ctx.hex()] = ctx.rev() | |
3124 | n = ctx.extra().get('source') |
|
3138 | n = ctx.extra().get('source') | |
3125 | if n: |
|
3139 | if n: | |
3126 | ids[n] = ctx.rev() |
|
3140 | ids[n] = ctx.rev() | |
3127 |
|
3141 | |||
3128 | # check ancestors for earlier grafts |
|
3142 | # check ancestors for earlier grafts | |
3129 | ui.debug('scanning for duplicate grafts\n') |
|
3143 | ui.debug('scanning for duplicate grafts\n') | |
3130 |
|
3144 | |||
3131 | for rev in repo.changelog.findmissingrevs(revs, [crev]): |
|
3145 | for rev in repo.changelog.findmissingrevs(revs, [crev]): | |
3132 | ctx = repo[rev] |
|
3146 | ctx = repo[rev] | |
3133 | n = ctx.extra().get('source') |
|
3147 | n = ctx.extra().get('source') | |
3134 | if n in ids: |
|
3148 | if n in ids: | |
3135 | r = repo[n].rev() |
|
3149 | r = repo[n].rev() | |
3136 | if r in revs: |
|
3150 | if r in revs: | |
3137 | ui.warn(_('skipping revision %s (already grafted to %s)\n') |
|
3151 | ui.warn(_('skipping revision %s (already grafted to %s)\n') | |
3138 | % (r, rev)) |
|
3152 | % (r, rev)) | |
3139 | revs.remove(r) |
|
3153 | revs.remove(r) | |
3140 | elif ids[n] in revs: |
|
3154 | elif ids[n] in revs: | |
3141 | ui.warn(_('skipping already grafted revision %s ' |
|
3155 | ui.warn(_('skipping already grafted revision %s ' | |
3142 | '(%s also has origin %d)\n') % (ids[n], rev, r)) |
|
3156 | '(%s also has origin %d)\n') % (ids[n], rev, r)) | |
3143 | revs.remove(ids[n]) |
|
3157 | revs.remove(ids[n]) | |
3144 | elif ctx.hex() in ids: |
|
3158 | elif ctx.hex() in ids: | |
3145 | r = ids[ctx.hex()] |
|
3159 | r = ids[ctx.hex()] | |
3146 | ui.warn(_('skipping already grafted revision %s ' |
|
3160 | ui.warn(_('skipping already grafted revision %s ' | |
3147 | '(was grafted from %d)\n') % (r, rev)) |
|
3161 | '(was grafted from %d)\n') % (r, rev)) | |
3148 | revs.remove(r) |
|
3162 | revs.remove(r) | |
3149 | if not revs: |
|
3163 | if not revs: | |
3150 | return -1 |
|
3164 | return -1 | |
3151 |
|
3165 | |||
3152 | wlock = repo.wlock() |
|
3166 | wlock = repo.wlock() | |
3153 | try: |
|
3167 | try: | |
3154 | current = repo['.'] |
|
3168 | current = repo['.'] | |
3155 | for pos, ctx in enumerate(repo.set("%ld", revs)): |
|
3169 | for pos, ctx in enumerate(repo.set("%ld", revs)): | |
3156 |
|
3170 | |||
3157 | ui.status(_('grafting revision %s\n') % ctx.rev()) |
|
3171 | ui.status(_('grafting revision %s\n') % ctx.rev()) | |
3158 | if opts.get('dry_run'): |
|
3172 | if opts.get('dry_run'): | |
3159 | continue |
|
3173 | continue | |
3160 |
|
3174 | |||
3161 | source = ctx.extra().get('source') |
|
3175 | source = ctx.extra().get('source') | |
3162 | if not source: |
|
3176 | if not source: | |
3163 | source = ctx.hex() |
|
3177 | source = ctx.hex() | |
3164 | extra = {'source': source} |
|
3178 | extra = {'source': source} | |
3165 | user = ctx.user() |
|
3179 | user = ctx.user() | |
3166 | if opts.get('user'): |
|
3180 | if opts.get('user'): | |
3167 | user = opts['user'] |
|
3181 | user = opts['user'] | |
3168 | date = ctx.date() |
|
3182 | date = ctx.date() | |
3169 | if opts.get('date'): |
|
3183 | if opts.get('date'): | |
3170 | date = opts['date'] |
|
3184 | date = opts['date'] | |
3171 | message = ctx.description() |
|
3185 | message = ctx.description() | |
3172 | if opts.get('log'): |
|
3186 | if opts.get('log'): | |
3173 | message += '\n(grafted from %s)' % ctx.hex() |
|
3187 | message += '\n(grafted from %s)' % ctx.hex() | |
3174 |
|
3188 | |||
3175 | # we don't merge the first commit when continuing |
|
3189 | # we don't merge the first commit when continuing | |
3176 | if not cont: |
|
3190 | if not cont: | |
3177 | # perform the graft merge with p1(rev) as 'ancestor' |
|
3191 | # perform the graft merge with p1(rev) as 'ancestor' | |
3178 | try: |
|
3192 | try: | |
3179 | # ui.forcemerge is an internal variable, do not document |
|
3193 | # ui.forcemerge is an internal variable, do not document | |
3180 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
3194 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
3181 | 'graft') |
|
3195 | 'graft') | |
3182 | stats = mergemod.update(repo, ctx.node(), True, True, False, |
|
3196 | stats = mergemod.update(repo, ctx.node(), True, True, False, | |
3183 | ctx.p1().node(), |
|
3197 | ctx.p1().node(), | |
3184 | labels=['local', 'graft']) |
|
3198 | labels=['local', 'graft']) | |
3185 | finally: |
|
3199 | finally: | |
3186 | repo.ui.setconfig('ui', 'forcemerge', '', 'graft') |
|
3200 | repo.ui.setconfig('ui', 'forcemerge', '', 'graft') | |
3187 | # report any conflicts |
|
3201 | # report any conflicts | |
3188 | if stats and stats[3] > 0: |
|
3202 | if stats and stats[3] > 0: | |
3189 | # write out state for --continue |
|
3203 | # write out state for --continue | |
3190 | nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] |
|
3204 | nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] | |
3191 | repo.opener.write('graftstate', ''.join(nodelines)) |
|
3205 | repo.opener.write('graftstate', ''.join(nodelines)) | |
3192 | raise util.Abort( |
|
3206 | raise util.Abort( | |
3193 | _("unresolved conflicts, can't continue"), |
|
3207 | _("unresolved conflicts, can't continue"), | |
3194 | hint=_('use hg resolve and hg graft --continue')) |
|
3208 | hint=_('use hg resolve and hg graft --continue')) | |
3195 | else: |
|
3209 | else: | |
3196 | cont = False |
|
3210 | cont = False | |
3197 |
|
3211 | |||
3198 | # drop the second merge parent |
|
3212 | # drop the second merge parent | |
3199 | repo.setparents(current.node(), nullid) |
|
3213 | repo.setparents(current.node(), nullid) | |
3200 | repo.dirstate.write() |
|
3214 | repo.dirstate.write() | |
3201 | # fix up dirstate for copies and renames |
|
3215 | # fix up dirstate for copies and renames | |
3202 | cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) |
|
3216 | cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) | |
3203 |
|
3217 | |||
3204 | # commit |
|
3218 | # commit | |
3205 | node = repo.commit(text=message, user=user, |
|
3219 | node = repo.commit(text=message, user=user, | |
3206 | date=date, extra=extra, editor=editor) |
|
3220 | date=date, extra=extra, editor=editor) | |
3207 | if node is None: |
|
3221 | if node is None: | |
3208 | ui.status(_('graft for revision %s is empty\n') % ctx.rev()) |
|
3222 | ui.status(_('graft for revision %s is empty\n') % ctx.rev()) | |
3209 | else: |
|
3223 | else: | |
3210 | current = repo[node] |
|
3224 | current = repo[node] | |
3211 | finally: |
|
3225 | finally: | |
3212 | wlock.release() |
|
3226 | wlock.release() | |
3213 |
|
3227 | |||
3214 | # remove state when we complete successfully |
|
3228 | # remove state when we complete successfully | |
3215 | if not opts.get('dry_run'): |
|
3229 | if not opts.get('dry_run'): | |
3216 | util.unlinkpath(repo.join('graftstate'), ignoremissing=True) |
|
3230 | util.unlinkpath(repo.join('graftstate'), ignoremissing=True) | |
3217 |
|
3231 | |||
3218 | return 0 |
|
3232 | return 0 | |
3219 |
|
3233 | |||
3220 | @command('grep', |
|
3234 | @command('grep', | |
3221 | [('0', 'print0', None, _('end fields with NUL')), |
|
3235 | [('0', 'print0', None, _('end fields with NUL')), | |
3222 | ('', 'all', None, _('print all revisions that match')), |
|
3236 | ('', 'all', None, _('print all revisions that match')), | |
3223 | ('a', 'text', None, _('treat all files as text')), |
|
3237 | ('a', 'text', None, _('treat all files as text')), | |
3224 | ('f', 'follow', None, |
|
3238 | ('f', 'follow', None, | |
3225 | _('follow changeset history,' |
|
3239 | _('follow changeset history,' | |
3226 | ' or file history across copies and renames')), |
|
3240 | ' or file history across copies and renames')), | |
3227 | ('i', 'ignore-case', None, _('ignore case when matching')), |
|
3241 | ('i', 'ignore-case', None, _('ignore case when matching')), | |
3228 | ('l', 'files-with-matches', None, |
|
3242 | ('l', 'files-with-matches', None, | |
3229 | _('print only filenames and revisions that match')), |
|
3243 | _('print only filenames and revisions that match')), | |
3230 | ('n', 'line-number', None, _('print matching line numbers')), |
|
3244 | ('n', 'line-number', None, _('print matching line numbers')), | |
3231 | ('r', 'rev', [], |
|
3245 | ('r', 'rev', [], | |
3232 | _('only search files changed within revision range'), _('REV')), |
|
3246 | _('only search files changed within revision range'), _('REV')), | |
3233 | ('u', 'user', None, _('list the author (long with -v)')), |
|
3247 | ('u', 'user', None, _('list the author (long with -v)')), | |
3234 | ('d', 'date', None, _('list the date (short with -q)')), |
|
3248 | ('d', 'date', None, _('list the date (short with -q)')), | |
3235 | ] + walkopts, |
|
3249 | ] + walkopts, | |
3236 | _('[OPTION]... PATTERN [FILE]...')) |
|
3250 | _('[OPTION]... PATTERN [FILE]...')) | |
3237 | def grep(ui, repo, pattern, *pats, **opts): |
|
3251 | def grep(ui, repo, pattern, *pats, **opts): | |
3238 | """search for a pattern in specified files and revisions |
|
3252 | """search for a pattern in specified files and revisions | |
3239 |
|
3253 | |||
3240 | Search revisions of files for a regular expression. |
|
3254 | Search revisions of files for a regular expression. | |
3241 |
|
3255 | |||
3242 | This command behaves differently than Unix grep. It only accepts |
|
3256 | This command behaves differently than Unix grep. It only accepts | |
3243 | Python/Perl regexps. It searches repository history, not the |
|
3257 | Python/Perl regexps. It searches repository history, not the | |
3244 | working directory. It always prints the revision number in which a |
|
3258 | working directory. It always prints the revision number in which a | |
3245 | match appears. |
|
3259 | match appears. | |
3246 |
|
3260 | |||
3247 | By default, grep only prints output for the first revision of a |
|
3261 | By default, grep only prints output for the first revision of a | |
3248 | file in which it finds a match. To get it to print every revision |
|
3262 | file in which it finds a match. To get it to print every revision | |
3249 | that contains a change in match status ("-" for a match that |
|
3263 | that contains a change in match status ("-" for a match that | |
3250 | becomes a non-match, or "+" for a non-match that becomes a match), |
|
3264 | becomes a non-match, or "+" for a non-match that becomes a match), | |
3251 | use the --all flag. |
|
3265 | use the --all flag. | |
3252 |
|
3266 | |||
3253 | Returns 0 if a match is found, 1 otherwise. |
|
3267 | Returns 0 if a match is found, 1 otherwise. | |
3254 | """ |
|
3268 | """ | |
3255 | reflags = re.M |
|
3269 | reflags = re.M | |
3256 | if opts.get('ignore_case'): |
|
3270 | if opts.get('ignore_case'): | |
3257 | reflags |= re.I |
|
3271 | reflags |= re.I | |
3258 | try: |
|
3272 | try: | |
3259 | regexp = util.compilere(pattern, reflags) |
|
3273 | regexp = util.compilere(pattern, reflags) | |
3260 | except re.error, inst: |
|
3274 | except re.error, inst: | |
3261 | ui.warn(_("grep: invalid match pattern: %s\n") % inst) |
|
3275 | ui.warn(_("grep: invalid match pattern: %s\n") % inst) | |
3262 | return 1 |
|
3276 | return 1 | |
3263 | sep, eol = ':', '\n' |
|
3277 | sep, eol = ':', '\n' | |
3264 | if opts.get('print0'): |
|
3278 | if opts.get('print0'): | |
3265 | sep = eol = '\0' |
|
3279 | sep = eol = '\0' | |
3266 |
|
3280 | |||
3267 | getfile = util.lrucachefunc(repo.file) |
|
3281 | getfile = util.lrucachefunc(repo.file) | |
3268 |
|
3282 | |||
3269 | def matchlines(body): |
|
3283 | def matchlines(body): | |
3270 | begin = 0 |
|
3284 | begin = 0 | |
3271 | linenum = 0 |
|
3285 | linenum = 0 | |
3272 | while begin < len(body): |
|
3286 | while begin < len(body): | |
3273 | match = regexp.search(body, begin) |
|
3287 | match = regexp.search(body, begin) | |
3274 | if not match: |
|
3288 | if not match: | |
3275 | break |
|
3289 | break | |
3276 | mstart, mend = match.span() |
|
3290 | mstart, mend = match.span() | |
3277 | linenum += body.count('\n', begin, mstart) + 1 |
|
3291 | linenum += body.count('\n', begin, mstart) + 1 | |
3278 | lstart = body.rfind('\n', begin, mstart) + 1 or begin |
|
3292 | lstart = body.rfind('\n', begin, mstart) + 1 or begin | |
3279 | begin = body.find('\n', mend) + 1 or len(body) + 1 |
|
3293 | begin = body.find('\n', mend) + 1 or len(body) + 1 | |
3280 | lend = begin - 1 |
|
3294 | lend = begin - 1 | |
3281 | yield linenum, mstart - lstart, mend - lstart, body[lstart:lend] |
|
3295 | yield linenum, mstart - lstart, mend - lstart, body[lstart:lend] | |
3282 |
|
3296 | |||
3283 | class linestate(object): |
|
3297 | class linestate(object): | |
3284 | def __init__(self, line, linenum, colstart, colend): |
|
3298 | def __init__(self, line, linenum, colstart, colend): | |
3285 | self.line = line |
|
3299 | self.line = line | |
3286 | self.linenum = linenum |
|
3300 | self.linenum = linenum | |
3287 | self.colstart = colstart |
|
3301 | self.colstart = colstart | |
3288 | self.colend = colend |
|
3302 | self.colend = colend | |
3289 |
|
3303 | |||
3290 | def __hash__(self): |
|
3304 | def __hash__(self): | |
3291 | return hash((self.linenum, self.line)) |
|
3305 | return hash((self.linenum, self.line)) | |
3292 |
|
3306 | |||
3293 | def __eq__(self, other): |
|
3307 | def __eq__(self, other): | |
3294 | return self.line == other.line |
|
3308 | return self.line == other.line | |
3295 |
|
3309 | |||
3296 | def __iter__(self): |
|
3310 | def __iter__(self): | |
3297 | yield (self.line[:self.colstart], '') |
|
3311 | yield (self.line[:self.colstart], '') | |
3298 | yield (self.line[self.colstart:self.colend], 'grep.match') |
|
3312 | yield (self.line[self.colstart:self.colend], 'grep.match') | |
3299 | rest = self.line[self.colend:] |
|
3313 | rest = self.line[self.colend:] | |
3300 | while rest != '': |
|
3314 | while rest != '': | |
3301 | match = regexp.search(rest) |
|
3315 | match = regexp.search(rest) | |
3302 | if not match: |
|
3316 | if not match: | |
3303 | yield (rest, '') |
|
3317 | yield (rest, '') | |
3304 | break |
|
3318 | break | |
3305 | mstart, mend = match.span() |
|
3319 | mstart, mend = match.span() | |
3306 | yield (rest[:mstart], '') |
|
3320 | yield (rest[:mstart], '') | |
3307 | yield (rest[mstart:mend], 'grep.match') |
|
3321 | yield (rest[mstart:mend], 'grep.match') | |
3308 | rest = rest[mend:] |
|
3322 | rest = rest[mend:] | |
3309 |
|
3323 | |||
3310 | matches = {} |
|
3324 | matches = {} | |
3311 | copies = {} |
|
3325 | copies = {} | |
3312 | def grepbody(fn, rev, body): |
|
3326 | def grepbody(fn, rev, body): | |
3313 | matches[rev].setdefault(fn, []) |
|
3327 | matches[rev].setdefault(fn, []) | |
3314 | m = matches[rev][fn] |
|
3328 | m = matches[rev][fn] | |
3315 | for lnum, cstart, cend, line in matchlines(body): |
|
3329 | for lnum, cstart, cend, line in matchlines(body): | |
3316 | s = linestate(line, lnum, cstart, cend) |
|
3330 | s = linestate(line, lnum, cstart, cend) | |
3317 | m.append(s) |
|
3331 | m.append(s) | |
3318 |
|
3332 | |||
3319 | def difflinestates(a, b): |
|
3333 | def difflinestates(a, b): | |
3320 | sm = difflib.SequenceMatcher(None, a, b) |
|
3334 | sm = difflib.SequenceMatcher(None, a, b) | |
3321 | for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
|
3335 | for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | |
3322 | if tag == 'insert': |
|
3336 | if tag == 'insert': | |
3323 | for i in xrange(blo, bhi): |
|
3337 | for i in xrange(blo, bhi): | |
3324 | yield ('+', b[i]) |
|
3338 | yield ('+', b[i]) | |
3325 | elif tag == 'delete': |
|
3339 | elif tag == 'delete': | |
3326 | for i in xrange(alo, ahi): |
|
3340 | for i in xrange(alo, ahi): | |
3327 | yield ('-', a[i]) |
|
3341 | yield ('-', a[i]) | |
3328 | elif tag == 'replace': |
|
3342 | elif tag == 'replace': | |
3329 | for i in xrange(alo, ahi): |
|
3343 | for i in xrange(alo, ahi): | |
3330 | yield ('-', a[i]) |
|
3344 | yield ('-', a[i]) | |
3331 | for i in xrange(blo, bhi): |
|
3345 | for i in xrange(blo, bhi): | |
3332 | yield ('+', b[i]) |
|
3346 | yield ('+', b[i]) | |
3333 |
|
3347 | |||
3334 | def display(fn, ctx, pstates, states): |
|
3348 | def display(fn, ctx, pstates, states): | |
3335 | rev = ctx.rev() |
|
3349 | rev = ctx.rev() | |
3336 | datefunc = ui.quiet and util.shortdate or util.datestr |
|
3350 | datefunc = ui.quiet and util.shortdate or util.datestr | |
3337 | found = False |
|
3351 | found = False | |
3338 | @util.cachefunc |
|
3352 | @util.cachefunc | |
3339 | def binary(): |
|
3353 | def binary(): | |
3340 | flog = getfile(fn) |
|
3354 | flog = getfile(fn) | |
3341 | return util.binary(flog.read(ctx.filenode(fn))) |
|
3355 | return util.binary(flog.read(ctx.filenode(fn))) | |
3342 |
|
3356 | |||
3343 | if opts.get('all'): |
|
3357 | if opts.get('all'): | |
3344 | iter = difflinestates(pstates, states) |
|
3358 | iter = difflinestates(pstates, states) | |
3345 | else: |
|
3359 | else: | |
3346 | iter = [('', l) for l in states] |
|
3360 | iter = [('', l) for l in states] | |
3347 | for change, l in iter: |
|
3361 | for change, l in iter: | |
3348 | cols = [(fn, 'grep.filename'), (str(rev), 'grep.rev')] |
|
3362 | cols = [(fn, 'grep.filename'), (str(rev), 'grep.rev')] | |
3349 |
|
3363 | |||
3350 | if opts.get('line_number'): |
|
3364 | if opts.get('line_number'): | |
3351 | cols.append((str(l.linenum), 'grep.linenumber')) |
|
3365 | cols.append((str(l.linenum), 'grep.linenumber')) | |
3352 | if opts.get('all'): |
|
3366 | if opts.get('all'): | |
3353 | cols.append((change, 'grep.change')) |
|
3367 | cols.append((change, 'grep.change')) | |
3354 | if opts.get('user'): |
|
3368 | if opts.get('user'): | |
3355 | cols.append((ui.shortuser(ctx.user()), 'grep.user')) |
|
3369 | cols.append((ui.shortuser(ctx.user()), 'grep.user')) | |
3356 | if opts.get('date'): |
|
3370 | if opts.get('date'): | |
3357 | cols.append((datefunc(ctx.date()), 'grep.date')) |
|
3371 | cols.append((datefunc(ctx.date()), 'grep.date')) | |
3358 | for col, label in cols[:-1]: |
|
3372 | for col, label in cols[:-1]: | |
3359 | ui.write(col, label=label) |
|
3373 | ui.write(col, label=label) | |
3360 | ui.write(sep, label='grep.sep') |
|
3374 | ui.write(sep, label='grep.sep') | |
3361 | ui.write(cols[-1][0], label=cols[-1][1]) |
|
3375 | ui.write(cols[-1][0], label=cols[-1][1]) | |
3362 | if not opts.get('files_with_matches'): |
|
3376 | if not opts.get('files_with_matches'): | |
3363 | ui.write(sep, label='grep.sep') |
|
3377 | ui.write(sep, label='grep.sep') | |
3364 | if not opts.get('text') and binary(): |
|
3378 | if not opts.get('text') and binary(): | |
3365 | ui.write(" Binary file matches") |
|
3379 | ui.write(" Binary file matches") | |
3366 | else: |
|
3380 | else: | |
3367 | for s, label in l: |
|
3381 | for s, label in l: | |
3368 | ui.write(s, label=label) |
|
3382 | ui.write(s, label=label) | |
3369 | ui.write(eol) |
|
3383 | ui.write(eol) | |
3370 | found = True |
|
3384 | found = True | |
3371 | if opts.get('files_with_matches'): |
|
3385 | if opts.get('files_with_matches'): | |
3372 | break |
|
3386 | break | |
3373 | return found |
|
3387 | return found | |
3374 |
|
3388 | |||
3375 | skip = {} |
|
3389 | skip = {} | |
3376 | revfiles = {} |
|
3390 | revfiles = {} | |
3377 | matchfn = scmutil.match(repo[None], pats, opts) |
|
3391 | matchfn = scmutil.match(repo[None], pats, opts) | |
3378 | found = False |
|
3392 | found = False | |
3379 | follow = opts.get('follow') |
|
3393 | follow = opts.get('follow') | |
3380 |
|
3394 | |||
3381 | def prep(ctx, fns): |
|
3395 | def prep(ctx, fns): | |
3382 | rev = ctx.rev() |
|
3396 | rev = ctx.rev() | |
3383 | pctx = ctx.p1() |
|
3397 | pctx = ctx.p1() | |
3384 | parent = pctx.rev() |
|
3398 | parent = pctx.rev() | |
3385 | matches.setdefault(rev, {}) |
|
3399 | matches.setdefault(rev, {}) | |
3386 | matches.setdefault(parent, {}) |
|
3400 | matches.setdefault(parent, {}) | |
3387 | files = revfiles.setdefault(rev, []) |
|
3401 | files = revfiles.setdefault(rev, []) | |
3388 | for fn in fns: |
|
3402 | for fn in fns: | |
3389 | flog = getfile(fn) |
|
3403 | flog = getfile(fn) | |
3390 | try: |
|
3404 | try: | |
3391 | fnode = ctx.filenode(fn) |
|
3405 | fnode = ctx.filenode(fn) | |
3392 | except error.LookupError: |
|
3406 | except error.LookupError: | |
3393 | continue |
|
3407 | continue | |
3394 |
|
3408 | |||
3395 | copied = flog.renamed(fnode) |
|
3409 | copied = flog.renamed(fnode) | |
3396 | copy = follow and copied and copied[0] |
|
3410 | copy = follow and copied and copied[0] | |
3397 | if copy: |
|
3411 | if copy: | |
3398 | copies.setdefault(rev, {})[fn] = copy |
|
3412 | copies.setdefault(rev, {})[fn] = copy | |
3399 | if fn in skip: |
|
3413 | if fn in skip: | |
3400 | if copy: |
|
3414 | if copy: | |
3401 | skip[copy] = True |
|
3415 | skip[copy] = True | |
3402 | continue |
|
3416 | continue | |
3403 | files.append(fn) |
|
3417 | files.append(fn) | |
3404 |
|
3418 | |||
3405 | if fn not in matches[rev]: |
|
3419 | if fn not in matches[rev]: | |
3406 | grepbody(fn, rev, flog.read(fnode)) |
|
3420 | grepbody(fn, rev, flog.read(fnode)) | |
3407 |
|
3421 | |||
3408 | pfn = copy or fn |
|
3422 | pfn = copy or fn | |
3409 | if pfn not in matches[parent]: |
|
3423 | if pfn not in matches[parent]: | |
3410 | try: |
|
3424 | try: | |
3411 | fnode = pctx.filenode(pfn) |
|
3425 | fnode = pctx.filenode(pfn) | |
3412 | grepbody(pfn, parent, flog.read(fnode)) |
|
3426 | grepbody(pfn, parent, flog.read(fnode)) | |
3413 | except error.LookupError: |
|
3427 | except error.LookupError: | |
3414 | pass |
|
3428 | pass | |
3415 |
|
3429 | |||
3416 | for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep): |
|
3430 | for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep): | |
3417 | rev = ctx.rev() |
|
3431 | rev = ctx.rev() | |
3418 | parent = ctx.p1().rev() |
|
3432 | parent = ctx.p1().rev() | |
3419 | for fn in sorted(revfiles.get(rev, [])): |
|
3433 | for fn in sorted(revfiles.get(rev, [])): | |
3420 | states = matches[rev][fn] |
|
3434 | states = matches[rev][fn] | |
3421 | copy = copies.get(rev, {}).get(fn) |
|
3435 | copy = copies.get(rev, {}).get(fn) | |
3422 | if fn in skip: |
|
3436 | if fn in skip: | |
3423 | if copy: |
|
3437 | if copy: | |
3424 | skip[copy] = True |
|
3438 | skip[copy] = True | |
3425 | continue |
|
3439 | continue | |
3426 | pstates = matches.get(parent, {}).get(copy or fn, []) |
|
3440 | pstates = matches.get(parent, {}).get(copy or fn, []) | |
3427 | if pstates or states: |
|
3441 | if pstates or states: | |
3428 | r = display(fn, ctx, pstates, states) |
|
3442 | r = display(fn, ctx, pstates, states) | |
3429 | found = found or r |
|
3443 | found = found or r | |
3430 | if r and not opts.get('all'): |
|
3444 | if r and not opts.get('all'): | |
3431 | skip[fn] = True |
|
3445 | skip[fn] = True | |
3432 | if copy: |
|
3446 | if copy: | |
3433 | skip[copy] = True |
|
3447 | skip[copy] = True | |
3434 | del matches[rev] |
|
3448 | del matches[rev] | |
3435 | del revfiles[rev] |
|
3449 | del revfiles[rev] | |
3436 |
|
3450 | |||
3437 | return not found |
|
3451 | return not found | |
3438 |
|
3452 | |||
3439 | @command('heads', |
|
3453 | @command('heads', | |
3440 | [('r', 'rev', '', |
|
3454 | [('r', 'rev', '', | |
3441 | _('show only heads which are descendants of STARTREV'), _('STARTREV')), |
|
3455 | _('show only heads which are descendants of STARTREV'), _('STARTREV')), | |
3442 | ('t', 'topo', False, _('show topological heads only')), |
|
3456 | ('t', 'topo', False, _('show topological heads only')), | |
3443 | ('a', 'active', False, _('show active branchheads only (DEPRECATED)')), |
|
3457 | ('a', 'active', False, _('show active branchheads only (DEPRECATED)')), | |
3444 | ('c', 'closed', False, _('show normal and closed branch heads')), |
|
3458 | ('c', 'closed', False, _('show normal and closed branch heads')), | |
3445 | ] + templateopts, |
|
3459 | ] + templateopts, | |
3446 | _('[-ct] [-r STARTREV] [REV]...')) |
|
3460 | _('[-ct] [-r STARTREV] [REV]...')) | |
3447 | def heads(ui, repo, *branchrevs, **opts): |
|
3461 | def heads(ui, repo, *branchrevs, **opts): | |
3448 | """show branch heads |
|
3462 | """show branch heads | |
3449 |
|
3463 | |||
3450 | With no arguments, show all open branch heads in the repository. |
|
3464 | With no arguments, show all open branch heads in the repository. | |
3451 | Branch heads are changesets that have no descendants on the |
|
3465 | Branch heads are changesets that have no descendants on the | |
3452 | same branch. They are where development generally takes place and |
|
3466 | same branch. They are where development generally takes place and | |
3453 | are the usual targets for update and merge operations. |
|
3467 | are the usual targets for update and merge operations. | |
3454 |
|
3468 | |||
3455 | If one or more REVs are given, only open branch heads on the |
|
3469 | If one or more REVs are given, only open branch heads on the | |
3456 | branches associated with the specified changesets are shown. This |
|
3470 | branches associated with the specified changesets are shown. This | |
3457 | means that you can use :hg:`heads .` to see the heads on the |
|
3471 | means that you can use :hg:`heads .` to see the heads on the | |
3458 | currently checked-out branch. |
|
3472 | currently checked-out branch. | |
3459 |
|
3473 | |||
3460 | If -c/--closed is specified, also show branch heads marked closed |
|
3474 | If -c/--closed is specified, also show branch heads marked closed | |
3461 | (see :hg:`commit --close-branch`). |
|
3475 | (see :hg:`commit --close-branch`). | |
3462 |
|
3476 | |||
3463 | If STARTREV is specified, only those heads that are descendants of |
|
3477 | If STARTREV is specified, only those heads that are descendants of | |
3464 | STARTREV will be displayed. |
|
3478 | STARTREV will be displayed. | |
3465 |
|
3479 | |||
3466 | If -t/--topo is specified, named branch mechanics will be ignored and only |
|
3480 | If -t/--topo is specified, named branch mechanics will be ignored and only | |
3467 | topological heads (changesets with no children) will be shown. |
|
3481 | topological heads (changesets with no children) will be shown. | |
3468 |
|
3482 | |||
3469 | Returns 0 if matching heads are found, 1 if not. |
|
3483 | Returns 0 if matching heads are found, 1 if not. | |
3470 | """ |
|
3484 | """ | |
3471 |
|
3485 | |||
3472 | start = None |
|
3486 | start = None | |
3473 | if 'rev' in opts: |
|
3487 | if 'rev' in opts: | |
3474 | start = scmutil.revsingle(repo, opts['rev'], None).node() |
|
3488 | start = scmutil.revsingle(repo, opts['rev'], None).node() | |
3475 |
|
3489 | |||
3476 | if opts.get('topo'): |
|
3490 | if opts.get('topo'): | |
3477 | heads = [repo[h] for h in repo.heads(start)] |
|
3491 | heads = [repo[h] for h in repo.heads(start)] | |
3478 | else: |
|
3492 | else: | |
3479 | heads = [] |
|
3493 | heads = [] | |
3480 | for branch in repo.branchmap(): |
|
3494 | for branch in repo.branchmap(): | |
3481 | heads += repo.branchheads(branch, start, opts.get('closed')) |
|
3495 | heads += repo.branchheads(branch, start, opts.get('closed')) | |
3482 | heads = [repo[h] for h in heads] |
|
3496 | heads = [repo[h] for h in heads] | |
3483 |
|
3497 | |||
3484 | if branchrevs: |
|
3498 | if branchrevs: | |
3485 | branches = set(repo[br].branch() for br in branchrevs) |
|
3499 | branches = set(repo[br].branch() for br in branchrevs) | |
3486 | heads = [h for h in heads if h.branch() in branches] |
|
3500 | heads = [h for h in heads if h.branch() in branches] | |
3487 |
|
3501 | |||
3488 | if opts.get('active') and branchrevs: |
|
3502 | if opts.get('active') and branchrevs: | |
3489 | dagheads = repo.heads(start) |
|
3503 | dagheads = repo.heads(start) | |
3490 | heads = [h for h in heads if h.node() in dagheads] |
|
3504 | heads = [h for h in heads if h.node() in dagheads] | |
3491 |
|
3505 | |||
3492 | if branchrevs: |
|
3506 | if branchrevs: | |
3493 | haveheads = set(h.branch() for h in heads) |
|
3507 | haveheads = set(h.branch() for h in heads) | |
3494 | if branches - haveheads: |
|
3508 | if branches - haveheads: | |
3495 | headless = ', '.join(b for b in branches - haveheads) |
|
3509 | headless = ', '.join(b for b in branches - haveheads) | |
3496 | msg = _('no open branch heads found on branches %s') |
|
3510 | msg = _('no open branch heads found on branches %s') | |
3497 | if opts.get('rev'): |
|
3511 | if opts.get('rev'): | |
3498 | msg += _(' (started at %s)') % opts['rev'] |
|
3512 | msg += _(' (started at %s)') % opts['rev'] | |
3499 | ui.warn((msg + '\n') % headless) |
|
3513 | ui.warn((msg + '\n') % headless) | |
3500 |
|
3514 | |||
3501 | if not heads: |
|
3515 | if not heads: | |
3502 | return 1 |
|
3516 | return 1 | |
3503 |
|
3517 | |||
3504 | heads = sorted(heads, key=lambda x: -x.rev()) |
|
3518 | heads = sorted(heads, key=lambda x: -x.rev()) | |
3505 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
3519 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
3506 | for ctx in heads: |
|
3520 | for ctx in heads: | |
3507 | displayer.show(ctx) |
|
3521 | displayer.show(ctx) | |
3508 | displayer.close() |
|
3522 | displayer.close() | |
3509 |
|
3523 | |||
3510 | @command('help', |
|
3524 | @command('help', | |
3511 | [('e', 'extension', None, _('show only help for extensions')), |
|
3525 | [('e', 'extension', None, _('show only help for extensions')), | |
3512 | ('c', 'command', None, _('show only help for commands')), |
|
3526 | ('c', 'command', None, _('show only help for commands')), | |
3513 | ('k', 'keyword', '', _('show topics matching keyword')), |
|
3527 | ('k', 'keyword', '', _('show topics matching keyword')), | |
3514 | ], |
|
3528 | ], | |
3515 | _('[-ec] [TOPIC]')) |
|
3529 | _('[-ec] [TOPIC]')) | |
3516 | def help_(ui, name=None, **opts): |
|
3530 | def help_(ui, name=None, **opts): | |
3517 | """show help for a given topic or a help overview |
|
3531 | """show help for a given topic or a help overview | |
3518 |
|
3532 | |||
3519 | With no arguments, print a list of commands with short help messages. |
|
3533 | With no arguments, print a list of commands with short help messages. | |
3520 |
|
3534 | |||
3521 | Given a topic, extension, or command name, print help for that |
|
3535 | Given a topic, extension, or command name, print help for that | |
3522 | topic. |
|
3536 | topic. | |
3523 |
|
3537 | |||
3524 | Returns 0 if successful. |
|
3538 | Returns 0 if successful. | |
3525 | """ |
|
3539 | """ | |
3526 |
|
3540 | |||
3527 | textwidth = min(ui.termwidth(), 80) - 2 |
|
3541 | textwidth = min(ui.termwidth(), 80) - 2 | |
3528 |
|
3542 | |||
3529 | keep = ui.verbose and ['verbose'] or [] |
|
3543 | keep = ui.verbose and ['verbose'] or [] | |
3530 | text = help.help_(ui, name, **opts) |
|
3544 | text = help.help_(ui, name, **opts) | |
3531 |
|
3545 | |||
3532 | formatted, pruned = minirst.format(text, textwidth, keep=keep) |
|
3546 | formatted, pruned = minirst.format(text, textwidth, keep=keep) | |
3533 | if 'verbose' in pruned: |
|
3547 | if 'verbose' in pruned: | |
3534 | keep.append('omitted') |
|
3548 | keep.append('omitted') | |
3535 | else: |
|
3549 | else: | |
3536 | keep.append('notomitted') |
|
3550 | keep.append('notomitted') | |
3537 | formatted, pruned = minirst.format(text, textwidth, keep=keep) |
|
3551 | formatted, pruned = minirst.format(text, textwidth, keep=keep) | |
3538 | ui.write(formatted) |
|
3552 | ui.write(formatted) | |
3539 |
|
3553 | |||
3540 |
|
3554 | |||
3541 | @command('identify|id', |
|
3555 | @command('identify|id', | |
3542 | [('r', 'rev', '', |
|
3556 | [('r', 'rev', '', | |
3543 | _('identify the specified revision'), _('REV')), |
|
3557 | _('identify the specified revision'), _('REV')), | |
3544 | ('n', 'num', None, _('show local revision number')), |
|
3558 | ('n', 'num', None, _('show local revision number')), | |
3545 | ('i', 'id', None, _('show global revision id')), |
|
3559 | ('i', 'id', None, _('show global revision id')), | |
3546 | ('b', 'branch', None, _('show branch')), |
|
3560 | ('b', 'branch', None, _('show branch')), | |
3547 | ('t', 'tags', None, _('show tags')), |
|
3561 | ('t', 'tags', None, _('show tags')), | |
3548 | ('B', 'bookmarks', None, _('show bookmarks')), |
|
3562 | ('B', 'bookmarks', None, _('show bookmarks')), | |
3549 | ] + remoteopts, |
|
3563 | ] + remoteopts, | |
3550 | _('[-nibtB] [-r REV] [SOURCE]')) |
|
3564 | _('[-nibtB] [-r REV] [SOURCE]')) | |
3551 | def identify(ui, repo, source=None, rev=None, |
|
3565 | def identify(ui, repo, source=None, rev=None, | |
3552 | num=None, id=None, branch=None, tags=None, bookmarks=None, **opts): |
|
3566 | num=None, id=None, branch=None, tags=None, bookmarks=None, **opts): | |
3553 | """identify the working copy or specified revision |
|
3567 | """identify the working copy or specified revision | |
3554 |
|
3568 | |||
3555 | Print a summary identifying the repository state at REV using one or |
|
3569 | Print a summary identifying the repository state at REV using one or | |
3556 | two parent hash identifiers, followed by a "+" if the working |
|
3570 | two parent hash identifiers, followed by a "+" if the working | |
3557 | directory has uncommitted changes, the branch name (if not default), |
|
3571 | directory has uncommitted changes, the branch name (if not default), | |
3558 | a list of tags, and a list of bookmarks. |
|
3572 | a list of tags, and a list of bookmarks. | |
3559 |
|
3573 | |||
3560 | When REV is not given, print a summary of the current state of the |
|
3574 | When REV is not given, print a summary of the current state of the | |
3561 | repository. |
|
3575 | repository. | |
3562 |
|
3576 | |||
3563 | Specifying a path to a repository root or Mercurial bundle will |
|
3577 | Specifying a path to a repository root or Mercurial bundle will | |
3564 | cause lookup to operate on that repository/bundle. |
|
3578 | cause lookup to operate on that repository/bundle. | |
3565 |
|
3579 | |||
3566 | .. container:: verbose |
|
3580 | .. container:: verbose | |
3567 |
|
3581 | |||
3568 | Examples: |
|
3582 | Examples: | |
3569 |
|
3583 | |||
3570 | - generate a build identifier for the working directory:: |
|
3584 | - generate a build identifier for the working directory:: | |
3571 |
|
3585 | |||
3572 | hg id --id > build-id.dat |
|
3586 | hg id --id > build-id.dat | |
3573 |
|
3587 | |||
3574 | - find the revision corresponding to a tag:: |
|
3588 | - find the revision corresponding to a tag:: | |
3575 |
|
3589 | |||
3576 | hg id -n -r 1.3 |
|
3590 | hg id -n -r 1.3 | |
3577 |
|
3591 | |||
3578 | - check the most recent revision of a remote repository:: |
|
3592 | - check the most recent revision of a remote repository:: | |
3579 |
|
3593 | |||
3580 | hg id -r tip http://selenic.com/hg/ |
|
3594 | hg id -r tip http://selenic.com/hg/ | |
3581 |
|
3595 | |||
3582 | Returns 0 if successful. |
|
3596 | Returns 0 if successful. | |
3583 | """ |
|
3597 | """ | |
3584 |
|
3598 | |||
3585 | if not repo and not source: |
|
3599 | if not repo and not source: | |
3586 | raise util.Abort(_("there is no Mercurial repository here " |
|
3600 | raise util.Abort(_("there is no Mercurial repository here " | |
3587 | "(.hg not found)")) |
|
3601 | "(.hg not found)")) | |
3588 |
|
3602 | |||
3589 | hexfunc = ui.debugflag and hex or short |
|
3603 | hexfunc = ui.debugflag and hex or short | |
3590 | default = not (num or id or branch or tags or bookmarks) |
|
3604 | default = not (num or id or branch or tags or bookmarks) | |
3591 | output = [] |
|
3605 | output = [] | |
3592 | revs = [] |
|
3606 | revs = [] | |
3593 |
|
3607 | |||
3594 | if source: |
|
3608 | if source: | |
3595 | source, branches = hg.parseurl(ui.expandpath(source)) |
|
3609 | source, branches = hg.parseurl(ui.expandpath(source)) | |
3596 | peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo |
|
3610 | peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo | |
3597 | repo = peer.local() |
|
3611 | repo = peer.local() | |
3598 | revs, checkout = hg.addbranchrevs(repo, peer, branches, None) |
|
3612 | revs, checkout = hg.addbranchrevs(repo, peer, branches, None) | |
3599 |
|
3613 | |||
3600 | if not repo: |
|
3614 | if not repo: | |
3601 | if num or branch or tags: |
|
3615 | if num or branch or tags: | |
3602 | raise util.Abort( |
|
3616 | raise util.Abort( | |
3603 | _("can't query remote revision number, branch, or tags")) |
|
3617 | _("can't query remote revision number, branch, or tags")) | |
3604 | if not rev and revs: |
|
3618 | if not rev and revs: | |
3605 | rev = revs[0] |
|
3619 | rev = revs[0] | |
3606 | if not rev: |
|
3620 | if not rev: | |
3607 | rev = "tip" |
|
3621 | rev = "tip" | |
3608 |
|
3622 | |||
3609 | remoterev = peer.lookup(rev) |
|
3623 | remoterev = peer.lookup(rev) | |
3610 | if default or id: |
|
3624 | if default or id: | |
3611 | output = [hexfunc(remoterev)] |
|
3625 | output = [hexfunc(remoterev)] | |
3612 |
|
3626 | |||
3613 | def getbms(): |
|
3627 | def getbms(): | |
3614 | bms = [] |
|
3628 | bms = [] | |
3615 |
|
3629 | |||
3616 | if 'bookmarks' in peer.listkeys('namespaces'): |
|
3630 | if 'bookmarks' in peer.listkeys('namespaces'): | |
3617 | hexremoterev = hex(remoterev) |
|
3631 | hexremoterev = hex(remoterev) | |
3618 | bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems() |
|
3632 | bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems() | |
3619 | if bmr == hexremoterev] |
|
3633 | if bmr == hexremoterev] | |
3620 |
|
3634 | |||
3621 | return sorted(bms) |
|
3635 | return sorted(bms) | |
3622 |
|
3636 | |||
3623 | if bookmarks: |
|
3637 | if bookmarks: | |
3624 | output.extend(getbms()) |
|
3638 | output.extend(getbms()) | |
3625 | elif default and not ui.quiet: |
|
3639 | elif default and not ui.quiet: | |
3626 | # multiple bookmarks for a single parent separated by '/' |
|
3640 | # multiple bookmarks for a single parent separated by '/' | |
3627 | bm = '/'.join(getbms()) |
|
3641 | bm = '/'.join(getbms()) | |
3628 | if bm: |
|
3642 | if bm: | |
3629 | output.append(bm) |
|
3643 | output.append(bm) | |
3630 | else: |
|
3644 | else: | |
3631 | if not rev: |
|
3645 | if not rev: | |
3632 | ctx = repo[None] |
|
3646 | ctx = repo[None] | |
3633 | parents = ctx.parents() |
|
3647 | parents = ctx.parents() | |
3634 | changed = "" |
|
3648 | changed = "" | |
3635 | if default or id or num: |
|
3649 | if default or id or num: | |
3636 | if (util.any(repo.status()) |
|
3650 | if (util.any(repo.status()) | |
3637 | or util.any(ctx.sub(s).dirty() for s in ctx.substate)): |
|
3651 | or util.any(ctx.sub(s).dirty() for s in ctx.substate)): | |
3638 | changed = '+' |
|
3652 | changed = '+' | |
3639 | if default or id: |
|
3653 | if default or id: | |
3640 | output = ["%s%s" % |
|
3654 | output = ["%s%s" % | |
3641 | ('+'.join([hexfunc(p.node()) for p in parents]), changed)] |
|
3655 | ('+'.join([hexfunc(p.node()) for p in parents]), changed)] | |
3642 | if num: |
|
3656 | if num: | |
3643 | output.append("%s%s" % |
|
3657 | output.append("%s%s" % | |
3644 | ('+'.join([str(p.rev()) for p in parents]), changed)) |
|
3658 | ('+'.join([str(p.rev()) for p in parents]), changed)) | |
3645 | else: |
|
3659 | else: | |
3646 | ctx = scmutil.revsingle(repo, rev) |
|
3660 | ctx = scmutil.revsingle(repo, rev) | |
3647 | if default or id: |
|
3661 | if default or id: | |
3648 | output = [hexfunc(ctx.node())] |
|
3662 | output = [hexfunc(ctx.node())] | |
3649 | if num: |
|
3663 | if num: | |
3650 | output.append(str(ctx.rev())) |
|
3664 | output.append(str(ctx.rev())) | |
3651 |
|
3665 | |||
3652 | if default and not ui.quiet: |
|
3666 | if default and not ui.quiet: | |
3653 | b = ctx.branch() |
|
3667 | b = ctx.branch() | |
3654 | if b != 'default': |
|
3668 | if b != 'default': | |
3655 | output.append("(%s)" % b) |
|
3669 | output.append("(%s)" % b) | |
3656 |
|
3670 | |||
3657 | # multiple tags for a single parent separated by '/' |
|
3671 | # multiple tags for a single parent separated by '/' | |
3658 | t = '/'.join(ctx.tags()) |
|
3672 | t = '/'.join(ctx.tags()) | |
3659 | if t: |
|
3673 | if t: | |
3660 | output.append(t) |
|
3674 | output.append(t) | |
3661 |
|
3675 | |||
3662 | # multiple bookmarks for a single parent separated by '/' |
|
3676 | # multiple bookmarks for a single parent separated by '/' | |
3663 | bm = '/'.join(ctx.bookmarks()) |
|
3677 | bm = '/'.join(ctx.bookmarks()) | |
3664 | if bm: |
|
3678 | if bm: | |
3665 | output.append(bm) |
|
3679 | output.append(bm) | |
3666 | else: |
|
3680 | else: | |
3667 | if branch: |
|
3681 | if branch: | |
3668 | output.append(ctx.branch()) |
|
3682 | output.append(ctx.branch()) | |
3669 |
|
3683 | |||
3670 | if tags: |
|
3684 | if tags: | |
3671 | output.extend(ctx.tags()) |
|
3685 | output.extend(ctx.tags()) | |
3672 |
|
3686 | |||
3673 | if bookmarks: |
|
3687 | if bookmarks: | |
3674 | output.extend(ctx.bookmarks()) |
|
3688 | output.extend(ctx.bookmarks()) | |
3675 |
|
3689 | |||
3676 | ui.write("%s\n" % ' '.join(output)) |
|
3690 | ui.write("%s\n" % ' '.join(output)) | |
3677 |
|
3691 | |||
3678 | @command('import|patch', |
|
3692 | @command('import|patch', | |
3679 | [('p', 'strip', 1, |
|
3693 | [('p', 'strip', 1, | |
3680 | _('directory strip option for patch. This has the same ' |
|
3694 | _('directory strip option for patch. This has the same ' | |
3681 | 'meaning as the corresponding patch option'), _('NUM')), |
|
3695 | 'meaning as the corresponding patch option'), _('NUM')), | |
3682 | ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')), |
|
3696 | ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')), | |
3683 | ('e', 'edit', False, _('invoke editor on commit messages')), |
|
3697 | ('e', 'edit', False, _('invoke editor on commit messages')), | |
3684 | ('f', 'force', None, |
|
3698 | ('f', 'force', None, | |
3685 | _('skip check for outstanding uncommitted changes (DEPRECATED)')), |
|
3699 | _('skip check for outstanding uncommitted changes (DEPRECATED)')), | |
3686 | ('', 'no-commit', None, |
|
3700 | ('', 'no-commit', None, | |
3687 | _("don't commit, just update the working directory")), |
|
3701 | _("don't commit, just update the working directory")), | |
3688 | ('', 'bypass', None, |
|
3702 | ('', 'bypass', None, | |
3689 | _("apply patch without touching the working directory")), |
|
3703 | _("apply patch without touching the working directory")), | |
3690 | ('', 'partial', None, |
|
3704 | ('', 'partial', None, | |
3691 | _('commit even if some hunks fail')), |
|
3705 | _('commit even if some hunks fail')), | |
3692 | ('', 'exact', None, |
|
3706 | ('', 'exact', None, | |
3693 | _('apply patch to the nodes from which it was generated')), |
|
3707 | _('apply patch to the nodes from which it was generated')), | |
3694 | ('', 'import-branch', None, |
|
3708 | ('', 'import-branch', None, | |
3695 | _('use any branch information in patch (implied by --exact)'))] + |
|
3709 | _('use any branch information in patch (implied by --exact)'))] + | |
3696 | commitopts + commitopts2 + similarityopts, |
|
3710 | commitopts + commitopts2 + similarityopts, | |
3697 | _('[OPTION]... PATCH...')) |
|
3711 | _('[OPTION]... PATCH...')) | |
3698 | def import_(ui, repo, patch1=None, *patches, **opts): |
|
3712 | def import_(ui, repo, patch1=None, *patches, **opts): | |
3699 | """import an ordered set of patches |
|
3713 | """import an ordered set of patches | |
3700 |
|
3714 | |||
3701 | Import a list of patches and commit them individually (unless |
|
3715 | Import a list of patches and commit them individually (unless | |
3702 | --no-commit is specified). |
|
3716 | --no-commit is specified). | |
3703 |
|
3717 | |||
3704 | Because import first applies changes to the working directory, |
|
3718 | Because import first applies changes to the working directory, | |
3705 | import will abort if there are outstanding changes. |
|
3719 | import will abort if there are outstanding changes. | |
3706 |
|
3720 | |||
3707 | You can import a patch straight from a mail message. Even patches |
|
3721 | You can import a patch straight from a mail message. Even patches | |
3708 | as attachments work (to use the body part, it must have type |
|
3722 | as attachments work (to use the body part, it must have type | |
3709 | text/plain or text/x-patch). From and Subject headers of email |
|
3723 | text/plain or text/x-patch). From and Subject headers of email | |
3710 | message are used as default committer and commit message. All |
|
3724 | message are used as default committer and commit message. All | |
3711 | text/plain body parts before first diff are added to commit |
|
3725 | text/plain body parts before first diff are added to commit | |
3712 | message. |
|
3726 | message. | |
3713 |
|
3727 | |||
3714 | If the imported patch was generated by :hg:`export`, user and |
|
3728 | If the imported patch was generated by :hg:`export`, user and | |
3715 | description from patch override values from message headers and |
|
3729 | description from patch override values from message headers and | |
3716 | body. Values given on command line with -m/--message and -u/--user |
|
3730 | body. Values given on command line with -m/--message and -u/--user | |
3717 | override these. |
|
3731 | override these. | |
3718 |
|
3732 | |||
3719 | If --exact is specified, import will set the working directory to |
|
3733 | If --exact is specified, import will set the working directory to | |
3720 | the parent of each patch before applying it, and will abort if the |
|
3734 | the parent of each patch before applying it, and will abort if the | |
3721 | resulting changeset has a different ID than the one recorded in |
|
3735 | resulting changeset has a different ID than the one recorded in | |
3722 | the patch. This may happen due to character set problems or other |
|
3736 | the patch. This may happen due to character set problems or other | |
3723 | deficiencies in the text patch format. |
|
3737 | deficiencies in the text patch format. | |
3724 |
|
3738 | |||
3725 | Use --bypass to apply and commit patches directly to the |
|
3739 | Use --bypass to apply and commit patches directly to the | |
3726 | repository, not touching the working directory. Without --exact, |
|
3740 | repository, not touching the working directory. Without --exact, | |
3727 | patches will be applied on top of the working directory parent |
|
3741 | patches will be applied on top of the working directory parent | |
3728 | revision. |
|
3742 | revision. | |
3729 |
|
3743 | |||
3730 | With -s/--similarity, hg will attempt to discover renames and |
|
3744 | With -s/--similarity, hg will attempt to discover renames and | |
3731 | copies in the patch in the same way as :hg:`addremove`. |
|
3745 | copies in the patch in the same way as :hg:`addremove`. | |
3732 |
|
3746 | |||
3733 | Use --partial to ensure a changeset will be created from the patch |
|
3747 | Use --partial to ensure a changeset will be created from the patch | |
3734 | even if some hunks fail to apply. Hunks that fail to apply will be |
|
3748 | even if some hunks fail to apply. Hunks that fail to apply will be | |
3735 | written to a <target-file>.rej file. Conflicts can then be resolved |
|
3749 | written to a <target-file>.rej file. Conflicts can then be resolved | |
3736 | by hand before :hg:`commit --amend` is run to update the created |
|
3750 | by hand before :hg:`commit --amend` is run to update the created | |
3737 | changeset. This flag exists to let people import patches that |
|
3751 | changeset. This flag exists to let people import patches that | |
3738 | partially apply without losing the associated metadata (author, |
|
3752 | partially apply without losing the associated metadata (author, | |
3739 | date, description, ...), Note that when none of the hunk applies |
|
3753 | date, description, ...), Note that when none of the hunk applies | |
3740 | cleanly, :hg:`import --partial` will create an empty changeset, |
|
3754 | cleanly, :hg:`import --partial` will create an empty changeset, | |
3741 | importing only the patch metadata. |
|
3755 | importing only the patch metadata. | |
3742 |
|
3756 | |||
3743 | To read a patch from standard input, use "-" as the patch name. If |
|
3757 | To read a patch from standard input, use "-" as the patch name. If | |
3744 | a URL is specified, the patch will be downloaded from it. |
|
3758 | a URL is specified, the patch will be downloaded from it. | |
3745 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
3759 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
3746 |
|
3760 | |||
3747 | .. container:: verbose |
|
3761 | .. container:: verbose | |
3748 |
|
3762 | |||
3749 | Examples: |
|
3763 | Examples: | |
3750 |
|
3764 | |||
3751 | - import a traditional patch from a website and detect renames:: |
|
3765 | - import a traditional patch from a website and detect renames:: | |
3752 |
|
3766 | |||
3753 | hg import -s 80 http://example.com/bugfix.patch |
|
3767 | hg import -s 80 http://example.com/bugfix.patch | |
3754 |
|
3768 | |||
3755 | - import a changeset from an hgweb server:: |
|
3769 | - import a changeset from an hgweb server:: | |
3756 |
|
3770 | |||
3757 | hg import http://www.selenic.com/hg/rev/5ca8c111e9aa |
|
3771 | hg import http://www.selenic.com/hg/rev/5ca8c111e9aa | |
3758 |
|
3772 | |||
3759 | - import all the patches in an Unix-style mbox:: |
|
3773 | - import all the patches in an Unix-style mbox:: | |
3760 |
|
3774 | |||
3761 | hg import incoming-patches.mbox |
|
3775 | hg import incoming-patches.mbox | |
3762 |
|
3776 | |||
3763 | - attempt to exactly restore an exported changeset (not always |
|
3777 | - attempt to exactly restore an exported changeset (not always | |
3764 | possible):: |
|
3778 | possible):: | |
3765 |
|
3779 | |||
3766 | hg import --exact proposed-fix.patch |
|
3780 | hg import --exact proposed-fix.patch | |
3767 |
|
3781 | |||
3768 | Returns 0 on success, 1 on partial success (see --partial). |
|
3782 | Returns 0 on success, 1 on partial success (see --partial). | |
3769 | """ |
|
3783 | """ | |
3770 |
|
3784 | |||
3771 | if not patch1: |
|
3785 | if not patch1: | |
3772 | raise util.Abort(_('need at least one patch to import')) |
|
3786 | raise util.Abort(_('need at least one patch to import')) | |
3773 |
|
3787 | |||
3774 | patches = (patch1,) + patches |
|
3788 | patches = (patch1,) + patches | |
3775 |
|
3789 | |||
3776 | date = opts.get('date') |
|
3790 | date = opts.get('date') | |
3777 | if date: |
|
3791 | if date: | |
3778 | opts['date'] = util.parsedate(date) |
|
3792 | opts['date'] = util.parsedate(date) | |
3779 |
|
3793 | |||
3780 | update = not opts.get('bypass') |
|
3794 | update = not opts.get('bypass') | |
3781 | if not update and opts.get('no_commit'): |
|
3795 | if not update and opts.get('no_commit'): | |
3782 | raise util.Abort(_('cannot use --no-commit with --bypass')) |
|
3796 | raise util.Abort(_('cannot use --no-commit with --bypass')) | |
3783 | try: |
|
3797 | try: | |
3784 | sim = float(opts.get('similarity') or 0) |
|
3798 | sim = float(opts.get('similarity') or 0) | |
3785 | except ValueError: |
|
3799 | except ValueError: | |
3786 | raise util.Abort(_('similarity must be a number')) |
|
3800 | raise util.Abort(_('similarity must be a number')) | |
3787 | if sim < 0 or sim > 100: |
|
3801 | if sim < 0 or sim > 100: | |
3788 | raise util.Abort(_('similarity must be between 0 and 100')) |
|
3802 | raise util.Abort(_('similarity must be between 0 and 100')) | |
3789 | if sim and not update: |
|
3803 | if sim and not update: | |
3790 | raise util.Abort(_('cannot use --similarity with --bypass')) |
|
3804 | raise util.Abort(_('cannot use --similarity with --bypass')) | |
3791 |
|
3805 | |||
3792 | if update: |
|
3806 | if update: | |
3793 | cmdutil.checkunfinished(repo) |
|
3807 | cmdutil.checkunfinished(repo) | |
3794 | if (opts.get('exact') or not opts.get('force')) and update: |
|
3808 | if (opts.get('exact') or not opts.get('force')) and update: | |
3795 | cmdutil.bailifchanged(repo) |
|
3809 | cmdutil.bailifchanged(repo) | |
3796 |
|
3810 | |||
3797 | base = opts["base"] |
|
3811 | base = opts["base"] | |
3798 | wlock = lock = tr = None |
|
3812 | wlock = lock = tr = None | |
3799 | msgs = [] |
|
3813 | msgs = [] | |
3800 | ret = 0 |
|
3814 | ret = 0 | |
3801 |
|
3815 | |||
3802 |
|
3816 | |||
3803 | try: |
|
3817 | try: | |
3804 | try: |
|
3818 | try: | |
3805 | wlock = repo.wlock() |
|
3819 | wlock = repo.wlock() | |
3806 | if not opts.get('no_commit'): |
|
3820 | if not opts.get('no_commit'): | |
3807 | lock = repo.lock() |
|
3821 | lock = repo.lock() | |
3808 | tr = repo.transaction('import') |
|
3822 | tr = repo.transaction('import') | |
3809 | parents = repo.parents() |
|
3823 | parents = repo.parents() | |
3810 | for patchurl in patches: |
|
3824 | for patchurl in patches: | |
3811 | if patchurl == '-': |
|
3825 | if patchurl == '-': | |
3812 | ui.status(_('applying patch from stdin\n')) |
|
3826 | ui.status(_('applying patch from stdin\n')) | |
3813 | patchfile = ui.fin |
|
3827 | patchfile = ui.fin | |
3814 | patchurl = 'stdin' # for error message |
|
3828 | patchurl = 'stdin' # for error message | |
3815 | else: |
|
3829 | else: | |
3816 | patchurl = os.path.join(base, patchurl) |
|
3830 | patchurl = os.path.join(base, patchurl) | |
3817 | ui.status(_('applying %s\n') % patchurl) |
|
3831 | ui.status(_('applying %s\n') % patchurl) | |
3818 | patchfile = hg.openpath(ui, patchurl) |
|
3832 | patchfile = hg.openpath(ui, patchurl) | |
3819 |
|
3833 | |||
3820 | haspatch = False |
|
3834 | haspatch = False | |
3821 | for hunk in patch.split(patchfile): |
|
3835 | for hunk in patch.split(patchfile): | |
3822 | (msg, node, rej) = cmdutil.tryimportone(ui, repo, hunk, |
|
3836 | (msg, node, rej) = cmdutil.tryimportone(ui, repo, hunk, | |
3823 | parents, opts, |
|
3837 | parents, opts, | |
3824 | msgs, hg.clean) |
|
3838 | msgs, hg.clean) | |
3825 | if msg: |
|
3839 | if msg: | |
3826 | haspatch = True |
|
3840 | haspatch = True | |
3827 | ui.note(msg + '\n') |
|
3841 | ui.note(msg + '\n') | |
3828 | if update or opts.get('exact'): |
|
3842 | if update or opts.get('exact'): | |
3829 | parents = repo.parents() |
|
3843 | parents = repo.parents() | |
3830 | else: |
|
3844 | else: | |
3831 | parents = [repo[node]] |
|
3845 | parents = [repo[node]] | |
3832 | if rej: |
|
3846 | if rej: | |
3833 | ui.write_err(_("patch applied partially\n")) |
|
3847 | ui.write_err(_("patch applied partially\n")) | |
3834 | ui.write_err(("(fix the .rej files and run " |
|
3848 | ui.write_err(("(fix the .rej files and run " | |
3835 | "`hg commit --amend`)\n")) |
|
3849 | "`hg commit --amend`)\n")) | |
3836 | ret = 1 |
|
3850 | ret = 1 | |
3837 | break |
|
3851 | break | |
3838 |
|
3852 | |||
3839 | if not haspatch: |
|
3853 | if not haspatch: | |
3840 | raise util.Abort(_('%s: no diffs found') % patchurl) |
|
3854 | raise util.Abort(_('%s: no diffs found') % patchurl) | |
3841 |
|
3855 | |||
3842 | if tr: |
|
3856 | if tr: | |
3843 | tr.close() |
|
3857 | tr.close() | |
3844 | if msgs: |
|
3858 | if msgs: | |
3845 | repo.savecommitmessage('\n* * *\n'.join(msgs)) |
|
3859 | repo.savecommitmessage('\n* * *\n'.join(msgs)) | |
3846 | return ret |
|
3860 | return ret | |
3847 | except: # re-raises |
|
3861 | except: # re-raises | |
3848 | # wlock.release() indirectly calls dirstate.write(): since |
|
3862 | # wlock.release() indirectly calls dirstate.write(): since | |
3849 | # we're crashing, we do not want to change the working dir |
|
3863 | # we're crashing, we do not want to change the working dir | |
3850 | # parent after all, so make sure it writes nothing |
|
3864 | # parent after all, so make sure it writes nothing | |
3851 | repo.dirstate.invalidate() |
|
3865 | repo.dirstate.invalidate() | |
3852 | raise |
|
3866 | raise | |
3853 | finally: |
|
3867 | finally: | |
3854 | if tr: |
|
3868 | if tr: | |
3855 | tr.release() |
|
3869 | tr.release() | |
3856 | release(lock, wlock) |
|
3870 | release(lock, wlock) | |
3857 |
|
3871 | |||
3858 | @command('incoming|in', |
|
3872 | @command('incoming|in', | |
3859 | [('f', 'force', None, |
|
3873 | [('f', 'force', None, | |
3860 | _('run even if remote repository is unrelated')), |
|
3874 | _('run even if remote repository is unrelated')), | |
3861 | ('n', 'newest-first', None, _('show newest record first')), |
|
3875 | ('n', 'newest-first', None, _('show newest record first')), | |
3862 | ('', 'bundle', '', |
|
3876 | ('', 'bundle', '', | |
3863 | _('file to store the bundles into'), _('FILE')), |
|
3877 | _('file to store the bundles into'), _('FILE')), | |
3864 | ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), |
|
3878 | ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), | |
3865 | ('B', 'bookmarks', False, _("compare bookmarks")), |
|
3879 | ('B', 'bookmarks', False, _("compare bookmarks")), | |
3866 | ('b', 'branch', [], |
|
3880 | ('b', 'branch', [], | |
3867 | _('a specific branch you would like to pull'), _('BRANCH')), |
|
3881 | _('a specific branch you would like to pull'), _('BRANCH')), | |
3868 | ] + logopts + remoteopts + subrepoopts, |
|
3882 | ] + logopts + remoteopts + subrepoopts, | |
3869 | _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]')) |
|
3883 | _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]')) | |
3870 | def incoming(ui, repo, source="default", **opts): |
|
3884 | def incoming(ui, repo, source="default", **opts): | |
3871 | """show new changesets found in source |
|
3885 | """show new changesets found in source | |
3872 |
|
3886 | |||
3873 | Show new changesets found in the specified path/URL or the default |
|
3887 | Show new changesets found in the specified path/URL or the default | |
3874 | pull location. These are the changesets that would have been pulled |
|
3888 | pull location. These are the changesets that would have been pulled | |
3875 | if a pull at the time you issued this command. |
|
3889 | if a pull at the time you issued this command. | |
3876 |
|
3890 | |||
3877 | For remote repository, using --bundle avoids downloading the |
|
3891 | For remote repository, using --bundle avoids downloading the | |
3878 | changesets twice if the incoming is followed by a pull. |
|
3892 | changesets twice if the incoming is followed by a pull. | |
3879 |
|
3893 | |||
3880 | See pull for valid source format details. |
|
3894 | See pull for valid source format details. | |
3881 |
|
3895 | |||
3882 | .. container:: verbose |
|
3896 | .. container:: verbose | |
3883 |
|
3897 | |||
3884 | Examples: |
|
3898 | Examples: | |
3885 |
|
3899 | |||
3886 | - show incoming changes with patches and full description:: |
|
3900 | - show incoming changes with patches and full description:: | |
3887 |
|
3901 | |||
3888 | hg incoming -vp |
|
3902 | hg incoming -vp | |
3889 |
|
3903 | |||
3890 | - show incoming changes excluding merges, store a bundle:: |
|
3904 | - show incoming changes excluding merges, store a bundle:: | |
3891 |
|
3905 | |||
3892 | hg in -vpM --bundle incoming.hg |
|
3906 | hg in -vpM --bundle incoming.hg | |
3893 | hg pull incoming.hg |
|
3907 | hg pull incoming.hg | |
3894 |
|
3908 | |||
3895 | - briefly list changes inside a bundle:: |
|
3909 | - briefly list changes inside a bundle:: | |
3896 |
|
3910 | |||
3897 | hg in changes.hg -T "{desc|firstline}\\n" |
|
3911 | hg in changes.hg -T "{desc|firstline}\\n" | |
3898 |
|
3912 | |||
3899 | Returns 0 if there are incoming changes, 1 otherwise. |
|
3913 | Returns 0 if there are incoming changes, 1 otherwise. | |
3900 | """ |
|
3914 | """ | |
3901 | if opts.get('graph'): |
|
3915 | if opts.get('graph'): | |
3902 | cmdutil.checkunsupportedgraphflags([], opts) |
|
3916 | cmdutil.checkunsupportedgraphflags([], opts) | |
3903 | def display(other, chlist, displayer): |
|
3917 | def display(other, chlist, displayer): | |
3904 | revdag = cmdutil.graphrevs(other, chlist, opts) |
|
3918 | revdag = cmdutil.graphrevs(other, chlist, opts) | |
3905 | showparents = [ctx.node() for ctx in repo[None].parents()] |
|
3919 | showparents = [ctx.node() for ctx in repo[None].parents()] | |
3906 | cmdutil.displaygraph(ui, revdag, displayer, showparents, |
|
3920 | cmdutil.displaygraph(ui, revdag, displayer, showparents, | |
3907 | graphmod.asciiedges) |
|
3921 | graphmod.asciiedges) | |
3908 |
|
3922 | |||
3909 | hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True) |
|
3923 | hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True) | |
3910 | return 0 |
|
3924 | return 0 | |
3911 |
|
3925 | |||
3912 | if opts.get('bundle') and opts.get('subrepos'): |
|
3926 | if opts.get('bundle') and opts.get('subrepos'): | |
3913 | raise util.Abort(_('cannot combine --bundle and --subrepos')) |
|
3927 | raise util.Abort(_('cannot combine --bundle and --subrepos')) | |
3914 |
|
3928 | |||
3915 | if opts.get('bookmarks'): |
|
3929 | if opts.get('bookmarks'): | |
3916 | source, branches = hg.parseurl(ui.expandpath(source), |
|
3930 | source, branches = hg.parseurl(ui.expandpath(source), | |
3917 | opts.get('branch')) |
|
3931 | opts.get('branch')) | |
3918 | other = hg.peer(repo, opts, source) |
|
3932 | other = hg.peer(repo, opts, source) | |
3919 | if 'bookmarks' not in other.listkeys('namespaces'): |
|
3933 | if 'bookmarks' not in other.listkeys('namespaces'): | |
3920 | ui.warn(_("remote doesn't support bookmarks\n")) |
|
3934 | ui.warn(_("remote doesn't support bookmarks\n")) | |
3921 | return 0 |
|
3935 | return 0 | |
3922 | ui.status(_('comparing with %s\n') % util.hidepassword(source)) |
|
3936 | ui.status(_('comparing with %s\n') % util.hidepassword(source)) | |
3923 | return bookmarks.diff(ui, repo, other) |
|
3937 | return bookmarks.diff(ui, repo, other) | |
3924 |
|
3938 | |||
3925 | repo._subtoppath = ui.expandpath(source) |
|
3939 | repo._subtoppath = ui.expandpath(source) | |
3926 | try: |
|
3940 | try: | |
3927 | return hg.incoming(ui, repo, source, opts) |
|
3941 | return hg.incoming(ui, repo, source, opts) | |
3928 | finally: |
|
3942 | finally: | |
3929 | del repo._subtoppath |
|
3943 | del repo._subtoppath | |
3930 |
|
3944 | |||
3931 |
|
3945 | |||
3932 | @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]')) |
|
3946 | @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]')) | |
3933 | def init(ui, dest=".", **opts): |
|
3947 | def init(ui, dest=".", **opts): | |
3934 | """create a new repository in the given directory |
|
3948 | """create a new repository in the given directory | |
3935 |
|
3949 | |||
3936 | Initialize a new repository in the given directory. If the given |
|
3950 | Initialize a new repository in the given directory. If the given | |
3937 | directory does not exist, it will be created. |
|
3951 | directory does not exist, it will be created. | |
3938 |
|
3952 | |||
3939 | If no directory is given, the current directory is used. |
|
3953 | If no directory is given, the current directory is used. | |
3940 |
|
3954 | |||
3941 | It is possible to specify an ``ssh://`` URL as the destination. |
|
3955 | It is possible to specify an ``ssh://`` URL as the destination. | |
3942 | See :hg:`help urls` for more information. |
|
3956 | See :hg:`help urls` for more information. | |
3943 |
|
3957 | |||
3944 | Returns 0 on success. |
|
3958 | Returns 0 on success. | |
3945 | """ |
|
3959 | """ | |
3946 | hg.peer(ui, opts, ui.expandpath(dest), create=True) |
|
3960 | hg.peer(ui, opts, ui.expandpath(dest), create=True) | |
3947 |
|
3961 | |||
3948 | @command('locate', |
|
3962 | @command('locate', | |
3949 | [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), |
|
3963 | [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), | |
3950 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
|
3964 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), | |
3951 | ('f', 'fullpath', None, _('print complete paths from the filesystem root')), |
|
3965 | ('f', 'fullpath', None, _('print complete paths from the filesystem root')), | |
3952 | ] + walkopts, |
|
3966 | ] + walkopts, | |
3953 | _('[OPTION]... [PATTERN]...')) |
|
3967 | _('[OPTION]... [PATTERN]...')) | |
3954 | def locate(ui, repo, *pats, **opts): |
|
3968 | def locate(ui, repo, *pats, **opts): | |
3955 | """locate files matching specific patterns |
|
3969 | """locate files matching specific patterns | |
3956 |
|
3970 | |||
3957 | Print files under Mercurial control in the working directory whose |
|
3971 | Print files under Mercurial control in the working directory whose | |
3958 | names match the given patterns. |
|
3972 | names match the given patterns. | |
3959 |
|
3973 | |||
3960 | By default, this command searches all directories in the working |
|
3974 | By default, this command searches all directories in the working | |
3961 | directory. To search just the current directory and its |
|
3975 | directory. To search just the current directory and its | |
3962 | subdirectories, use "--include .". |
|
3976 | subdirectories, use "--include .". | |
3963 |
|
3977 | |||
3964 | If no patterns are given to match, this command prints the names |
|
3978 | If no patterns are given to match, this command prints the names | |
3965 | of all files under Mercurial control in the working directory. |
|
3979 | of all files under Mercurial control in the working directory. | |
3966 |
|
3980 | |||
3967 | If you want to feed the output of this command into the "xargs" |
|
3981 | If you want to feed the output of this command into the "xargs" | |
3968 | command, use the -0 option to both this command and "xargs". This |
|
3982 | command, use the -0 option to both this command and "xargs". This | |
3969 | will avoid the problem of "xargs" treating single filenames that |
|
3983 | will avoid the problem of "xargs" treating single filenames that | |
3970 | contain whitespace as multiple filenames. |
|
3984 | contain whitespace as multiple filenames. | |
3971 |
|
3985 | |||
3972 | Returns 0 if a match is found, 1 otherwise. |
|
3986 | Returns 0 if a match is found, 1 otherwise. | |
3973 | """ |
|
3987 | """ | |
3974 | end = opts.get('print0') and '\0' or '\n' |
|
3988 | end = opts.get('print0') and '\0' or '\n' | |
3975 | rev = scmutil.revsingle(repo, opts.get('rev'), None).node() |
|
3989 | rev = scmutil.revsingle(repo, opts.get('rev'), None).node() | |
3976 |
|
3990 | |||
3977 | ret = 1 |
|
3991 | ret = 1 | |
3978 | m = scmutil.match(repo[rev], pats, opts, default='relglob') |
|
3992 | m = scmutil.match(repo[rev], pats, opts, default='relglob') | |
3979 | m.bad = lambda x, y: False |
|
3993 | m.bad = lambda x, y: False | |
3980 | for abs in repo[rev].walk(m): |
|
3994 | for abs in repo[rev].walk(m): | |
3981 | if not rev and abs not in repo.dirstate: |
|
3995 | if not rev and abs not in repo.dirstate: | |
3982 | continue |
|
3996 | continue | |
3983 | if opts.get('fullpath'): |
|
3997 | if opts.get('fullpath'): | |
3984 | ui.write(repo.wjoin(abs), end) |
|
3998 | ui.write(repo.wjoin(abs), end) | |
3985 | else: |
|
3999 | else: | |
3986 | ui.write(((pats and m.rel(abs)) or abs), end) |
|
4000 | ui.write(((pats and m.rel(abs)) or abs), end) | |
3987 | ret = 0 |
|
4001 | ret = 0 | |
3988 |
|
4002 | |||
3989 | return ret |
|
4003 | return ret | |
3990 |
|
4004 | |||
3991 | @command('^log|history', |
|
4005 | @command('^log|history', | |
3992 | [('f', 'follow', None, |
|
4006 | [('f', 'follow', None, | |
3993 | _('follow changeset history, or file history across copies and renames')), |
|
4007 | _('follow changeset history, or file history across copies and renames')), | |
3994 | ('', 'follow-first', None, |
|
4008 | ('', 'follow-first', None, | |
3995 | _('only follow the first parent of merge changesets (DEPRECATED)')), |
|
4009 | _('only follow the first parent of merge changesets (DEPRECATED)')), | |
3996 | ('d', 'date', '', _('show revisions matching date spec'), _('DATE')), |
|
4010 | ('d', 'date', '', _('show revisions matching date spec'), _('DATE')), | |
3997 | ('C', 'copies', None, _('show copied files')), |
|
4011 | ('C', 'copies', None, _('show copied files')), | |
3998 | ('k', 'keyword', [], |
|
4012 | ('k', 'keyword', [], | |
3999 | _('do case-insensitive search for a given text'), _('TEXT')), |
|
4013 | _('do case-insensitive search for a given text'), _('TEXT')), | |
4000 | ('r', 'rev', [], _('show the specified revision or range'), _('REV')), |
|
4014 | ('r', 'rev', [], _('show the specified revision or range'), _('REV')), | |
4001 | ('', 'removed', None, _('include revisions where files were removed')), |
|
4015 | ('', 'removed', None, _('include revisions where files were removed')), | |
4002 | ('m', 'only-merges', None, _('show only merges (DEPRECATED)')), |
|
4016 | ('m', 'only-merges', None, _('show only merges (DEPRECATED)')), | |
4003 | ('u', 'user', [], _('revisions committed by user'), _('USER')), |
|
4017 | ('u', 'user', [], _('revisions committed by user'), _('USER')), | |
4004 | ('', 'only-branch', [], |
|
4018 | ('', 'only-branch', [], | |
4005 | _('show only changesets within the given named branch (DEPRECATED)'), |
|
4019 | _('show only changesets within the given named branch (DEPRECATED)'), | |
4006 | _('BRANCH')), |
|
4020 | _('BRANCH')), | |
4007 | ('b', 'branch', [], |
|
4021 | ('b', 'branch', [], | |
4008 | _('show changesets within the given named branch'), _('BRANCH')), |
|
4022 | _('show changesets within the given named branch'), _('BRANCH')), | |
4009 | ('P', 'prune', [], |
|
4023 | ('P', 'prune', [], | |
4010 | _('do not display revision or any of its ancestors'), _('REV')), |
|
4024 | _('do not display revision or any of its ancestors'), _('REV')), | |
4011 | ] + logopts + walkopts, |
|
4025 | ] + logopts + walkopts, | |
4012 | _('[OPTION]... [FILE]')) |
|
4026 | _('[OPTION]... [FILE]')) | |
4013 | def log(ui, repo, *pats, **opts): |
|
4027 | def log(ui, repo, *pats, **opts): | |
4014 | """show revision history of entire repository or files |
|
4028 | """show revision history of entire repository or files | |
4015 |
|
4029 | |||
4016 | Print the revision history of the specified files or the entire |
|
4030 | Print the revision history of the specified files or the entire | |
4017 | project. |
|
4031 | project. | |
4018 |
|
4032 | |||
4019 | If no revision range is specified, the default is ``tip:0`` unless |
|
4033 | If no revision range is specified, the default is ``tip:0`` unless | |
4020 | --follow is set, in which case the working directory parent is |
|
4034 | --follow is set, in which case the working directory parent is | |
4021 | used as the starting revision. |
|
4035 | used as the starting revision. | |
4022 |
|
4036 | |||
4023 | File history is shown without following rename or copy history of |
|
4037 | File history is shown without following rename or copy history of | |
4024 | files. Use -f/--follow with a filename to follow history across |
|
4038 | files. Use -f/--follow with a filename to follow history across | |
4025 | renames and copies. --follow without a filename will only show |
|
4039 | renames and copies. --follow without a filename will only show | |
4026 | ancestors or descendants of the starting revision. |
|
4040 | ancestors or descendants of the starting revision. | |
4027 |
|
4041 | |||
4028 | By default this command prints revision number and changeset id, |
|
4042 | By default this command prints revision number and changeset id, | |
4029 | tags, non-trivial parents, user, date and time, and a summary for |
|
4043 | tags, non-trivial parents, user, date and time, and a summary for | |
4030 | each commit. When the -v/--verbose switch is used, the list of |
|
4044 | each commit. When the -v/--verbose switch is used, the list of | |
4031 | changed files and full commit message are shown. |
|
4045 | changed files and full commit message are shown. | |
4032 |
|
4046 | |||
4033 | With --graph the revisions are shown as an ASCII art DAG with the most |
|
4047 | With --graph the revisions are shown as an ASCII art DAG with the most | |
4034 | recent changeset at the top. |
|
4048 | recent changeset at the top. | |
4035 | 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete, |
|
4049 | 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete, | |
4036 | and '+' represents a fork where the changeset from the lines below is a |
|
4050 | and '+' represents a fork where the changeset from the lines below is a | |
4037 | parent of the 'o' merge on the same line. |
|
4051 | parent of the 'o' merge on the same line. | |
4038 |
|
4052 | |||
4039 | .. note:: |
|
4053 | .. note:: | |
4040 |
|
4054 | |||
4041 | log -p/--patch may generate unexpected diff output for merge |
|
4055 | log -p/--patch may generate unexpected diff output for merge | |
4042 | changesets, as it will only compare the merge changeset against |
|
4056 | changesets, as it will only compare the merge changeset against | |
4043 | its first parent. Also, only files different from BOTH parents |
|
4057 | its first parent. Also, only files different from BOTH parents | |
4044 | will appear in files:. |
|
4058 | will appear in files:. | |
4045 |
|
4059 | |||
4046 | .. note:: |
|
4060 | .. note:: | |
4047 |
|
4061 | |||
4048 | for performance reasons, log FILE may omit duplicate changes |
|
4062 | for performance reasons, log FILE may omit duplicate changes | |
4049 | made on branches and will not show deletions. To see all |
|
4063 | made on branches and will not show deletions. To see all | |
4050 | changes including duplicates and deletions, use the --removed |
|
4064 | changes including duplicates and deletions, use the --removed | |
4051 | switch. |
|
4065 | switch. | |
4052 |
|
4066 | |||
4053 | .. container:: verbose |
|
4067 | .. container:: verbose | |
4054 |
|
4068 | |||
4055 | Some examples: |
|
4069 | Some examples: | |
4056 |
|
4070 | |||
4057 | - changesets with full descriptions and file lists:: |
|
4071 | - changesets with full descriptions and file lists:: | |
4058 |
|
4072 | |||
4059 | hg log -v |
|
4073 | hg log -v | |
4060 |
|
4074 | |||
4061 | - changesets ancestral to the working directory:: |
|
4075 | - changesets ancestral to the working directory:: | |
4062 |
|
4076 | |||
4063 | hg log -f |
|
4077 | hg log -f | |
4064 |
|
4078 | |||
4065 | - last 10 commits on the current branch:: |
|
4079 | - last 10 commits on the current branch:: | |
4066 |
|
4080 | |||
4067 | hg log -l 10 -b . |
|
4081 | hg log -l 10 -b . | |
4068 |
|
4082 | |||
4069 | - changesets showing all modifications of a file, including removals:: |
|
4083 | - changesets showing all modifications of a file, including removals:: | |
4070 |
|
4084 | |||
4071 | hg log --removed file.c |
|
4085 | hg log --removed file.c | |
4072 |
|
4086 | |||
4073 | - all changesets that touch a directory, with diffs, excluding merges:: |
|
4087 | - all changesets that touch a directory, with diffs, excluding merges:: | |
4074 |
|
4088 | |||
4075 | hg log -Mp lib/ |
|
4089 | hg log -Mp lib/ | |
4076 |
|
4090 | |||
4077 | - all revision numbers that match a keyword:: |
|
4091 | - all revision numbers that match a keyword:: | |
4078 |
|
4092 | |||
4079 | hg log -k bug --template "{rev}\\n" |
|
4093 | hg log -k bug --template "{rev}\\n" | |
4080 |
|
4094 | |||
4081 | - check if a given changeset is included is a tagged release:: |
|
4095 | - check if a given changeset is included is a tagged release:: | |
4082 |
|
4096 | |||
4083 | hg log -r "a21ccf and ancestor(1.9)" |
|
4097 | hg log -r "a21ccf and ancestor(1.9)" | |
4084 |
|
4098 | |||
4085 | - find all changesets by some user in a date range:: |
|
4099 | - find all changesets by some user in a date range:: | |
4086 |
|
4100 | |||
4087 | hg log -k alice -d "may 2008 to jul 2008" |
|
4101 | hg log -k alice -d "may 2008 to jul 2008" | |
4088 |
|
4102 | |||
4089 | - summary of all changesets after the last tag:: |
|
4103 | - summary of all changesets after the last tag:: | |
4090 |
|
4104 | |||
4091 | hg log -r "last(tagged())::" --template "{desc|firstline}\\n" |
|
4105 | hg log -r "last(tagged())::" --template "{desc|firstline}\\n" | |
4092 |
|
4106 | |||
4093 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
4107 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
4094 |
|
4108 | |||
4095 | See :hg:`help revisions` and :hg:`help revsets` for more about |
|
4109 | See :hg:`help revisions` and :hg:`help revsets` for more about | |
4096 | specifying revisions. |
|
4110 | specifying revisions. | |
4097 |
|
4111 | |||
4098 | See :hg:`help templates` for more about pre-packaged styles and |
|
4112 | See :hg:`help templates` for more about pre-packaged styles and | |
4099 | specifying custom templates. |
|
4113 | specifying custom templates. | |
4100 |
|
4114 | |||
4101 | Returns 0 on success. |
|
4115 | Returns 0 on success. | |
4102 | """ |
|
4116 | """ | |
4103 | if opts.get('graph'): |
|
4117 | if opts.get('graph'): | |
4104 | return cmdutil.graphlog(ui, repo, *pats, **opts) |
|
4118 | return cmdutil.graphlog(ui, repo, *pats, **opts) | |
4105 |
|
4119 | |||
4106 | revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts) |
|
4120 | revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts) | |
4107 | limit = cmdutil.loglimit(opts) |
|
4121 | limit = cmdutil.loglimit(opts) | |
4108 | count = 0 |
|
4122 | count = 0 | |
4109 |
|
4123 | |||
4110 | getrenamed = None |
|
4124 | getrenamed = None | |
4111 | if opts.get('copies'): |
|
4125 | if opts.get('copies'): | |
4112 | endrev = None |
|
4126 | endrev = None | |
4113 | if opts.get('rev'): |
|
4127 | if opts.get('rev'): | |
4114 | endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 |
|
4128 | endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 | |
4115 | getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) |
|
4129 | getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) | |
4116 |
|
4130 | |||
4117 | displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) |
|
4131 | displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) | |
4118 | for rev in revs: |
|
4132 | for rev in revs: | |
4119 | if count == limit: |
|
4133 | if count == limit: | |
4120 | break |
|
4134 | break | |
4121 | ctx = repo[rev] |
|
4135 | ctx = repo[rev] | |
4122 | copies = None |
|
4136 | copies = None | |
4123 | if getrenamed is not None and rev: |
|
4137 | if getrenamed is not None and rev: | |
4124 | copies = [] |
|
4138 | copies = [] | |
4125 | for fn in ctx.files(): |
|
4139 | for fn in ctx.files(): | |
4126 | rename = getrenamed(fn, rev) |
|
4140 | rename = getrenamed(fn, rev) | |
4127 | if rename: |
|
4141 | if rename: | |
4128 | copies.append((fn, rename[0])) |
|
4142 | copies.append((fn, rename[0])) | |
4129 | revmatchfn = filematcher and filematcher(ctx.rev()) or None |
|
4143 | revmatchfn = filematcher and filematcher(ctx.rev()) or None | |
4130 | displayer.show(ctx, copies=copies, matchfn=revmatchfn) |
|
4144 | displayer.show(ctx, copies=copies, matchfn=revmatchfn) | |
4131 | if displayer.flush(rev): |
|
4145 | if displayer.flush(rev): | |
4132 | count += 1 |
|
4146 | count += 1 | |
4133 |
|
4147 | |||
4134 | displayer.close() |
|
4148 | displayer.close() | |
4135 |
|
4149 | |||
4136 | @command('manifest', |
|
4150 | @command('manifest', | |
4137 | [('r', 'rev', '', _('revision to display'), _('REV')), |
|
4151 | [('r', 'rev', '', _('revision to display'), _('REV')), | |
4138 | ('', 'all', False, _("list files from all revisions"))], |
|
4152 | ('', 'all', False, _("list files from all revisions"))], | |
4139 | _('[-r REV]')) |
|
4153 | _('[-r REV]')) | |
4140 | def manifest(ui, repo, node=None, rev=None, **opts): |
|
4154 | def manifest(ui, repo, node=None, rev=None, **opts): | |
4141 | """output the current or given revision of the project manifest |
|
4155 | """output the current or given revision of the project manifest | |
4142 |
|
4156 | |||
4143 | Print a list of version controlled files for the given revision. |
|
4157 | Print a list of version controlled files for the given revision. | |
4144 | If no revision is given, the first parent of the working directory |
|
4158 | If no revision is given, the first parent of the working directory | |
4145 | is used, or the null revision if no revision is checked out. |
|
4159 | is used, or the null revision if no revision is checked out. | |
4146 |
|
4160 | |||
4147 | With -v, print file permissions, symlink and executable bits. |
|
4161 | With -v, print file permissions, symlink and executable bits. | |
4148 | With --debug, print file revision hashes. |
|
4162 | With --debug, print file revision hashes. | |
4149 |
|
4163 | |||
4150 | If option --all is specified, the list of all files from all revisions |
|
4164 | If option --all is specified, the list of all files from all revisions | |
4151 | is printed. This includes deleted and renamed files. |
|
4165 | is printed. This includes deleted and renamed files. | |
4152 |
|
4166 | |||
4153 | Returns 0 on success. |
|
4167 | Returns 0 on success. | |
4154 | """ |
|
4168 | """ | |
4155 |
|
4169 | |||
4156 | fm = ui.formatter('manifest', opts) |
|
4170 | fm = ui.formatter('manifest', opts) | |
4157 |
|
4171 | |||
4158 | if opts.get('all'): |
|
4172 | if opts.get('all'): | |
4159 | if rev or node: |
|
4173 | if rev or node: | |
4160 | raise util.Abort(_("can't specify a revision with --all")) |
|
4174 | raise util.Abort(_("can't specify a revision with --all")) | |
4161 |
|
4175 | |||
4162 | res = [] |
|
4176 | res = [] | |
4163 | prefix = "data/" |
|
4177 | prefix = "data/" | |
4164 | suffix = ".i" |
|
4178 | suffix = ".i" | |
4165 | plen = len(prefix) |
|
4179 | plen = len(prefix) | |
4166 | slen = len(suffix) |
|
4180 | slen = len(suffix) | |
4167 | lock = repo.lock() |
|
4181 | lock = repo.lock() | |
4168 | try: |
|
4182 | try: | |
4169 | for fn, b, size in repo.store.datafiles(): |
|
4183 | for fn, b, size in repo.store.datafiles(): | |
4170 | if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix: |
|
4184 | if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix: | |
4171 | res.append(fn[plen:-slen]) |
|
4185 | res.append(fn[plen:-slen]) | |
4172 | finally: |
|
4186 | finally: | |
4173 | lock.release() |
|
4187 | lock.release() | |
4174 | for f in res: |
|
4188 | for f in res: | |
4175 | fm.startitem() |
|
4189 | fm.startitem() | |
4176 | fm.write("path", '%s\n', f) |
|
4190 | fm.write("path", '%s\n', f) | |
4177 | fm.end() |
|
4191 | fm.end() | |
4178 | return |
|
4192 | return | |
4179 |
|
4193 | |||
4180 | if rev and node: |
|
4194 | if rev and node: | |
4181 | raise util.Abort(_("please specify just one revision")) |
|
4195 | raise util.Abort(_("please specify just one revision")) | |
4182 |
|
4196 | |||
4183 | if not node: |
|
4197 | if not node: | |
4184 | node = rev |
|
4198 | node = rev | |
4185 |
|
4199 | |||
4186 | char = {'l': '@', 'x': '*', '': ''} |
|
4200 | char = {'l': '@', 'x': '*', '': ''} | |
4187 | mode = {'l': '644', 'x': '755', '': '644'} |
|
4201 | mode = {'l': '644', 'x': '755', '': '644'} | |
4188 | ctx = scmutil.revsingle(repo, node) |
|
4202 | ctx = scmutil.revsingle(repo, node) | |
4189 | mf = ctx.manifest() |
|
4203 | mf = ctx.manifest() | |
4190 | for f in ctx: |
|
4204 | for f in ctx: | |
4191 | fm.startitem() |
|
4205 | fm.startitem() | |
4192 | fl = ctx[f].flags() |
|
4206 | fl = ctx[f].flags() | |
4193 | fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f])) |
|
4207 | fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f])) | |
4194 | fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl]) |
|
4208 | fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl]) | |
4195 | fm.write('path', '%s\n', f) |
|
4209 | fm.write('path', '%s\n', f) | |
4196 | fm.end() |
|
4210 | fm.end() | |
4197 |
|
4211 | |||
4198 | @command('^merge', |
|
4212 | @command('^merge', | |
4199 | [('f', 'force', None, |
|
4213 | [('f', 'force', None, | |
4200 | _('force a merge including outstanding changes (DEPRECATED)')), |
|
4214 | _('force a merge including outstanding changes (DEPRECATED)')), | |
4201 | ('r', 'rev', '', _('revision to merge'), _('REV')), |
|
4215 | ('r', 'rev', '', _('revision to merge'), _('REV')), | |
4202 | ('P', 'preview', None, |
|
4216 | ('P', 'preview', None, | |
4203 | _('review revisions to merge (no merge is performed)')) |
|
4217 | _('review revisions to merge (no merge is performed)')) | |
4204 | ] + mergetoolopts, |
|
4218 | ] + mergetoolopts, | |
4205 | _('[-P] [-f] [[-r] REV]')) |
|
4219 | _('[-P] [-f] [[-r] REV]')) | |
4206 | def merge(ui, repo, node=None, **opts): |
|
4220 | def merge(ui, repo, node=None, **opts): | |
4207 | """merge working directory with another revision |
|
4221 | """merge working directory with another revision | |
4208 |
|
4222 | |||
4209 | The current working directory is updated with all changes made in |
|
4223 | The current working directory is updated with all changes made in | |
4210 | the requested revision since the last common predecessor revision. |
|
4224 | the requested revision since the last common predecessor revision. | |
4211 |
|
4225 | |||
4212 | Files that changed between either parent are marked as changed for |
|
4226 | Files that changed between either parent are marked as changed for | |
4213 | the next commit and a commit must be performed before any further |
|
4227 | the next commit and a commit must be performed before any further | |
4214 | updates to the repository are allowed. The next commit will have |
|
4228 | updates to the repository are allowed. The next commit will have | |
4215 | two parents. |
|
4229 | two parents. | |
4216 |
|
4230 | |||
4217 | ``--tool`` can be used to specify the merge tool used for file |
|
4231 | ``--tool`` can be used to specify the merge tool used for file | |
4218 | merges. It overrides the HGMERGE environment variable and your |
|
4232 | merges. It overrides the HGMERGE environment variable and your | |
4219 | configuration files. See :hg:`help merge-tools` for options. |
|
4233 | configuration files. See :hg:`help merge-tools` for options. | |
4220 |
|
4234 | |||
4221 | If no revision is specified, the working directory's parent is a |
|
4235 | If no revision is specified, the working directory's parent is a | |
4222 | head revision, and the current branch contains exactly one other |
|
4236 | head revision, and the current branch contains exactly one other | |
4223 | head, the other head is merged with by default. Otherwise, an |
|
4237 | head, the other head is merged with by default. Otherwise, an | |
4224 | explicit revision with which to merge with must be provided. |
|
4238 | explicit revision with which to merge with must be provided. | |
4225 |
|
4239 | |||
4226 | :hg:`resolve` must be used to resolve unresolved files. |
|
4240 | :hg:`resolve` must be used to resolve unresolved files. | |
4227 |
|
4241 | |||
4228 | To undo an uncommitted merge, use :hg:`update --clean .` which |
|
4242 | To undo an uncommitted merge, use :hg:`update --clean .` which | |
4229 | will check out a clean copy of the original merge parent, losing |
|
4243 | will check out a clean copy of the original merge parent, losing | |
4230 | all changes. |
|
4244 | all changes. | |
4231 |
|
4245 | |||
4232 | Returns 0 on success, 1 if there are unresolved files. |
|
4246 | Returns 0 on success, 1 if there are unresolved files. | |
4233 | """ |
|
4247 | """ | |
4234 |
|
4248 | |||
4235 | if opts.get('rev') and node: |
|
4249 | if opts.get('rev') and node: | |
4236 | raise util.Abort(_("please specify just one revision")) |
|
4250 | raise util.Abort(_("please specify just one revision")) | |
4237 | if not node: |
|
4251 | if not node: | |
4238 | node = opts.get('rev') |
|
4252 | node = opts.get('rev') | |
4239 |
|
4253 | |||
4240 | if node: |
|
4254 | if node: | |
4241 | node = scmutil.revsingle(repo, node).node() |
|
4255 | node = scmutil.revsingle(repo, node).node() | |
4242 |
|
4256 | |||
4243 | if not node and repo._bookmarkcurrent: |
|
4257 | if not node and repo._bookmarkcurrent: | |
4244 | bmheads = repo.bookmarkheads(repo._bookmarkcurrent) |
|
4258 | bmheads = repo.bookmarkheads(repo._bookmarkcurrent) | |
4245 | curhead = repo[repo._bookmarkcurrent].node() |
|
4259 | curhead = repo[repo._bookmarkcurrent].node() | |
4246 | if len(bmheads) == 2: |
|
4260 | if len(bmheads) == 2: | |
4247 | if curhead == bmheads[0]: |
|
4261 | if curhead == bmheads[0]: | |
4248 | node = bmheads[1] |
|
4262 | node = bmheads[1] | |
4249 | else: |
|
4263 | else: | |
4250 | node = bmheads[0] |
|
4264 | node = bmheads[0] | |
4251 | elif len(bmheads) > 2: |
|
4265 | elif len(bmheads) > 2: | |
4252 | raise util.Abort(_("multiple matching bookmarks to merge - " |
|
4266 | raise util.Abort(_("multiple matching bookmarks to merge - " | |
4253 | "please merge with an explicit rev or bookmark"), |
|
4267 | "please merge with an explicit rev or bookmark"), | |
4254 | hint=_("run 'hg heads' to see all heads")) |
|
4268 | hint=_("run 'hg heads' to see all heads")) | |
4255 | elif len(bmheads) <= 1: |
|
4269 | elif len(bmheads) <= 1: | |
4256 | raise util.Abort(_("no matching bookmark to merge - " |
|
4270 | raise util.Abort(_("no matching bookmark to merge - " | |
4257 | "please merge with an explicit rev or bookmark"), |
|
4271 | "please merge with an explicit rev or bookmark"), | |
4258 | hint=_("run 'hg heads' to see all heads")) |
|
4272 | hint=_("run 'hg heads' to see all heads")) | |
4259 |
|
4273 | |||
4260 | if not node and not repo._bookmarkcurrent: |
|
4274 | if not node and not repo._bookmarkcurrent: | |
4261 | branch = repo[None].branch() |
|
4275 | branch = repo[None].branch() | |
4262 | bheads = repo.branchheads(branch) |
|
4276 | bheads = repo.branchheads(branch) | |
4263 | nbhs = [bh for bh in bheads if not repo[bh].bookmarks()] |
|
4277 | nbhs = [bh for bh in bheads if not repo[bh].bookmarks()] | |
4264 |
|
4278 | |||
4265 | if len(nbhs) > 2: |
|
4279 | if len(nbhs) > 2: | |
4266 | raise util.Abort(_("branch '%s' has %d heads - " |
|
4280 | raise util.Abort(_("branch '%s' has %d heads - " | |
4267 | "please merge with an explicit rev") |
|
4281 | "please merge with an explicit rev") | |
4268 | % (branch, len(bheads)), |
|
4282 | % (branch, len(bheads)), | |
4269 | hint=_("run 'hg heads .' to see heads")) |
|
4283 | hint=_("run 'hg heads .' to see heads")) | |
4270 |
|
4284 | |||
4271 | parent = repo.dirstate.p1() |
|
4285 | parent = repo.dirstate.p1() | |
4272 | if len(nbhs) <= 1: |
|
4286 | if len(nbhs) <= 1: | |
4273 | if len(bheads) > 1: |
|
4287 | if len(bheads) > 1: | |
4274 | raise util.Abort(_("heads are bookmarked - " |
|
4288 | raise util.Abort(_("heads are bookmarked - " | |
4275 | "please merge with an explicit rev"), |
|
4289 | "please merge with an explicit rev"), | |
4276 | hint=_("run 'hg heads' to see all heads")) |
|
4290 | hint=_("run 'hg heads' to see all heads")) | |
4277 | if len(repo.heads()) > 1: |
|
4291 | if len(repo.heads()) > 1: | |
4278 | raise util.Abort(_("branch '%s' has one head - " |
|
4292 | raise util.Abort(_("branch '%s' has one head - " | |
4279 | "please merge with an explicit rev") |
|
4293 | "please merge with an explicit rev") | |
4280 | % branch, |
|
4294 | % branch, | |
4281 | hint=_("run 'hg heads' to see all heads")) |
|
4295 | hint=_("run 'hg heads' to see all heads")) | |
4282 | msg, hint = _('nothing to merge'), None |
|
4296 | msg, hint = _('nothing to merge'), None | |
4283 | if parent != repo.lookup(branch): |
|
4297 | if parent != repo.lookup(branch): | |
4284 | hint = _("use 'hg update' instead") |
|
4298 | hint = _("use 'hg update' instead") | |
4285 | raise util.Abort(msg, hint=hint) |
|
4299 | raise util.Abort(msg, hint=hint) | |
4286 |
|
4300 | |||
4287 | if parent not in bheads: |
|
4301 | if parent not in bheads: | |
4288 | raise util.Abort(_('working directory not at a head revision'), |
|
4302 | raise util.Abort(_('working directory not at a head revision'), | |
4289 | hint=_("use 'hg update' or merge with an " |
|
4303 | hint=_("use 'hg update' or merge with an " | |
4290 | "explicit revision")) |
|
4304 | "explicit revision")) | |
4291 | if parent == nbhs[0]: |
|
4305 | if parent == nbhs[0]: | |
4292 | node = nbhs[-1] |
|
4306 | node = nbhs[-1] | |
4293 | else: |
|
4307 | else: | |
4294 | node = nbhs[0] |
|
4308 | node = nbhs[0] | |
4295 |
|
4309 | |||
4296 | if opts.get('preview'): |
|
4310 | if opts.get('preview'): | |
4297 | # find nodes that are ancestors of p2 but not of p1 |
|
4311 | # find nodes that are ancestors of p2 but not of p1 | |
4298 | p1 = repo.lookup('.') |
|
4312 | p1 = repo.lookup('.') | |
4299 | p2 = repo.lookup(node) |
|
4313 | p2 = repo.lookup(node) | |
4300 | nodes = repo.changelog.findmissing(common=[p1], heads=[p2]) |
|
4314 | nodes = repo.changelog.findmissing(common=[p1], heads=[p2]) | |
4301 |
|
4315 | |||
4302 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
4316 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
4303 | for node in nodes: |
|
4317 | for node in nodes: | |
4304 | displayer.show(repo[node]) |
|
4318 | displayer.show(repo[node]) | |
4305 | displayer.close() |
|
4319 | displayer.close() | |
4306 | return 0 |
|
4320 | return 0 | |
4307 |
|
4321 | |||
4308 | try: |
|
4322 | try: | |
4309 | # ui.forcemerge is an internal variable, do not document |
|
4323 | # ui.forcemerge is an internal variable, do not document | |
4310 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge') |
|
4324 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge') | |
4311 | return hg.merge(repo, node, force=opts.get('force')) |
|
4325 | return hg.merge(repo, node, force=opts.get('force')) | |
4312 | finally: |
|
4326 | finally: | |
4313 | ui.setconfig('ui', 'forcemerge', '', 'merge') |
|
4327 | ui.setconfig('ui', 'forcemerge', '', 'merge') | |
4314 |
|
4328 | |||
4315 | @command('outgoing|out', |
|
4329 | @command('outgoing|out', | |
4316 | [('f', 'force', None, _('run even when the destination is unrelated')), |
|
4330 | [('f', 'force', None, _('run even when the destination is unrelated')), | |
4317 | ('r', 'rev', [], |
|
4331 | ('r', 'rev', [], | |
4318 | _('a changeset intended to be included in the destination'), _('REV')), |
|
4332 | _('a changeset intended to be included in the destination'), _('REV')), | |
4319 | ('n', 'newest-first', None, _('show newest record first')), |
|
4333 | ('n', 'newest-first', None, _('show newest record first')), | |
4320 | ('B', 'bookmarks', False, _('compare bookmarks')), |
|
4334 | ('B', 'bookmarks', False, _('compare bookmarks')), | |
4321 | ('b', 'branch', [], _('a specific branch you would like to push'), |
|
4335 | ('b', 'branch', [], _('a specific branch you would like to push'), | |
4322 | _('BRANCH')), |
|
4336 | _('BRANCH')), | |
4323 | ] + logopts + remoteopts + subrepoopts, |
|
4337 | ] + logopts + remoteopts + subrepoopts, | |
4324 | _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')) |
|
4338 | _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')) | |
4325 | def outgoing(ui, repo, dest=None, **opts): |
|
4339 | def outgoing(ui, repo, dest=None, **opts): | |
4326 | """show changesets not found in the destination |
|
4340 | """show changesets not found in the destination | |
4327 |
|
4341 | |||
4328 | Show changesets not found in the specified destination repository |
|
4342 | Show changesets not found in the specified destination repository | |
4329 | or the default push location. These are the changesets that would |
|
4343 | or the default push location. These are the changesets that would | |
4330 | be pushed if a push was requested. |
|
4344 | be pushed if a push was requested. | |
4331 |
|
4345 | |||
4332 | See pull for details of valid destination formats. |
|
4346 | See pull for details of valid destination formats. | |
4333 |
|
4347 | |||
4334 | Returns 0 if there are outgoing changes, 1 otherwise. |
|
4348 | Returns 0 if there are outgoing changes, 1 otherwise. | |
4335 | """ |
|
4349 | """ | |
4336 | if opts.get('graph'): |
|
4350 | if opts.get('graph'): | |
4337 | cmdutil.checkunsupportedgraphflags([], opts) |
|
4351 | cmdutil.checkunsupportedgraphflags([], opts) | |
4338 | o, other = hg._outgoing(ui, repo, dest, opts) |
|
4352 | o, other = hg._outgoing(ui, repo, dest, opts) | |
4339 | if not o: |
|
4353 | if not o: | |
4340 | cmdutil.outgoinghooks(ui, repo, other, opts, o) |
|
4354 | cmdutil.outgoinghooks(ui, repo, other, opts, o) | |
4341 | return |
|
4355 | return | |
4342 |
|
4356 | |||
4343 | revdag = cmdutil.graphrevs(repo, o, opts) |
|
4357 | revdag = cmdutil.graphrevs(repo, o, opts) | |
4344 | displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) |
|
4358 | displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) | |
4345 | showparents = [ctx.node() for ctx in repo[None].parents()] |
|
4359 | showparents = [ctx.node() for ctx in repo[None].parents()] | |
4346 | cmdutil.displaygraph(ui, revdag, displayer, showparents, |
|
4360 | cmdutil.displaygraph(ui, revdag, displayer, showparents, | |
4347 | graphmod.asciiedges) |
|
4361 | graphmod.asciiedges) | |
4348 | cmdutil.outgoinghooks(ui, repo, other, opts, o) |
|
4362 | cmdutil.outgoinghooks(ui, repo, other, opts, o) | |
4349 | return 0 |
|
4363 | return 0 | |
4350 |
|
4364 | |||
4351 | if opts.get('bookmarks'): |
|
4365 | if opts.get('bookmarks'): | |
4352 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
4366 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
4353 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
4367 | dest, branches = hg.parseurl(dest, opts.get('branch')) | |
4354 | other = hg.peer(repo, opts, dest) |
|
4368 | other = hg.peer(repo, opts, dest) | |
4355 | if 'bookmarks' not in other.listkeys('namespaces'): |
|
4369 | if 'bookmarks' not in other.listkeys('namespaces'): | |
4356 | ui.warn(_("remote doesn't support bookmarks\n")) |
|
4370 | ui.warn(_("remote doesn't support bookmarks\n")) | |
4357 | return 0 |
|
4371 | return 0 | |
4358 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) |
|
4372 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) | |
4359 | return bookmarks.diff(ui, other, repo) |
|
4373 | return bookmarks.diff(ui, other, repo) | |
4360 |
|
4374 | |||
4361 | repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default') |
|
4375 | repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default') | |
4362 | try: |
|
4376 | try: | |
4363 | return hg.outgoing(ui, repo, dest, opts) |
|
4377 | return hg.outgoing(ui, repo, dest, opts) | |
4364 | finally: |
|
4378 | finally: | |
4365 | del repo._subtoppath |
|
4379 | del repo._subtoppath | |
4366 |
|
4380 | |||
4367 | @command('parents', |
|
4381 | @command('parents', | |
4368 | [('r', 'rev', '', _('show parents of the specified revision'), _('REV')), |
|
4382 | [('r', 'rev', '', _('show parents of the specified revision'), _('REV')), | |
4369 | ] + templateopts, |
|
4383 | ] + templateopts, | |
4370 | _('[-r REV] [FILE]')) |
|
4384 | _('[-r REV] [FILE]')) | |
4371 | def parents(ui, repo, file_=None, **opts): |
|
4385 | def parents(ui, repo, file_=None, **opts): | |
4372 | """show the parents of the working directory or revision |
|
4386 | """show the parents of the working directory or revision | |
4373 |
|
4387 | |||
4374 | Print the working directory's parent revisions. If a revision is |
|
4388 | Print the working directory's parent revisions. If a revision is | |
4375 | given via -r/--rev, the parent of that revision will be printed. |
|
4389 | given via -r/--rev, the parent of that revision will be printed. | |
4376 | If a file argument is given, the revision in which the file was |
|
4390 | If a file argument is given, the revision in which the file was | |
4377 | last changed (before the working directory revision or the |
|
4391 | last changed (before the working directory revision or the | |
4378 | argument to --rev if given) is printed. |
|
4392 | argument to --rev if given) is printed. | |
4379 |
|
4393 | |||
4380 | Returns 0 on success. |
|
4394 | Returns 0 on success. | |
4381 | """ |
|
4395 | """ | |
4382 |
|
4396 | |||
4383 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) |
|
4397 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) | |
4384 |
|
4398 | |||
4385 | if file_: |
|
4399 | if file_: | |
4386 | m = scmutil.match(ctx, (file_,), opts) |
|
4400 | m = scmutil.match(ctx, (file_,), opts) | |
4387 | if m.anypats() or len(m.files()) != 1: |
|
4401 | if m.anypats() or len(m.files()) != 1: | |
4388 | raise util.Abort(_('can only specify an explicit filename')) |
|
4402 | raise util.Abort(_('can only specify an explicit filename')) | |
4389 | file_ = m.files()[0] |
|
4403 | file_ = m.files()[0] | |
4390 | filenodes = [] |
|
4404 | filenodes = [] | |
4391 | for cp in ctx.parents(): |
|
4405 | for cp in ctx.parents(): | |
4392 | if not cp: |
|
4406 | if not cp: | |
4393 | continue |
|
4407 | continue | |
4394 | try: |
|
4408 | try: | |
4395 | filenodes.append(cp.filenode(file_)) |
|
4409 | filenodes.append(cp.filenode(file_)) | |
4396 | except error.LookupError: |
|
4410 | except error.LookupError: | |
4397 | pass |
|
4411 | pass | |
4398 | if not filenodes: |
|
4412 | if not filenodes: | |
4399 | raise util.Abort(_("'%s' not found in manifest!") % file_) |
|
4413 | raise util.Abort(_("'%s' not found in manifest!") % file_) | |
4400 | p = [] |
|
4414 | p = [] | |
4401 | for fn in filenodes: |
|
4415 | for fn in filenodes: | |
4402 | fctx = repo.filectx(file_, fileid=fn) |
|
4416 | fctx = repo.filectx(file_, fileid=fn) | |
4403 | p.append(fctx.node()) |
|
4417 | p.append(fctx.node()) | |
4404 | else: |
|
4418 | else: | |
4405 | p = [cp.node() for cp in ctx.parents()] |
|
4419 | p = [cp.node() for cp in ctx.parents()] | |
4406 |
|
4420 | |||
4407 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
4421 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
4408 | for n in p: |
|
4422 | for n in p: | |
4409 | if n != nullid: |
|
4423 | if n != nullid: | |
4410 | displayer.show(repo[n]) |
|
4424 | displayer.show(repo[n]) | |
4411 | displayer.close() |
|
4425 | displayer.close() | |
4412 |
|
4426 | |||
4413 | @command('paths', [], _('[NAME]')) |
|
4427 | @command('paths', [], _('[NAME]')) | |
4414 | def paths(ui, repo, search=None): |
|
4428 | def paths(ui, repo, search=None): | |
4415 | """show aliases for remote repositories |
|
4429 | """show aliases for remote repositories | |
4416 |
|
4430 | |||
4417 | Show definition of symbolic path name NAME. If no name is given, |
|
4431 | Show definition of symbolic path name NAME. If no name is given, | |
4418 | show definition of all available names. |
|
4432 | show definition of all available names. | |
4419 |
|
4433 | |||
4420 | Option -q/--quiet suppresses all output when searching for NAME |
|
4434 | Option -q/--quiet suppresses all output when searching for NAME | |
4421 | and shows only the path names when listing all definitions. |
|
4435 | and shows only the path names when listing all definitions. | |
4422 |
|
4436 | |||
4423 | Path names are defined in the [paths] section of your |
|
4437 | Path names are defined in the [paths] section of your | |
4424 | configuration file and in ``/etc/mercurial/hgrc``. If run inside a |
|
4438 | configuration file and in ``/etc/mercurial/hgrc``. If run inside a | |
4425 | repository, ``.hg/hgrc`` is used, too. |
|
4439 | repository, ``.hg/hgrc`` is used, too. | |
4426 |
|
4440 | |||
4427 | The path names ``default`` and ``default-push`` have a special |
|
4441 | The path names ``default`` and ``default-push`` have a special | |
4428 | meaning. When performing a push or pull operation, they are used |
|
4442 | meaning. When performing a push or pull operation, they are used | |
4429 | as fallbacks if no location is specified on the command-line. |
|
4443 | as fallbacks if no location is specified on the command-line. | |
4430 | When ``default-push`` is set, it will be used for push and |
|
4444 | When ``default-push`` is set, it will be used for push and | |
4431 | ``default`` will be used for pull; otherwise ``default`` is used |
|
4445 | ``default`` will be used for pull; otherwise ``default`` is used | |
4432 | as the fallback for both. When cloning a repository, the clone |
|
4446 | as the fallback for both. When cloning a repository, the clone | |
4433 | source is written as ``default`` in ``.hg/hgrc``. Note that |
|
4447 | source is written as ``default`` in ``.hg/hgrc``. Note that | |
4434 | ``default`` and ``default-push`` apply to all inbound (e.g. |
|
4448 | ``default`` and ``default-push`` apply to all inbound (e.g. | |
4435 | :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email` and |
|
4449 | :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email` and | |
4436 | :hg:`bundle`) operations. |
|
4450 | :hg:`bundle`) operations. | |
4437 |
|
4451 | |||
4438 | See :hg:`help urls` for more information. |
|
4452 | See :hg:`help urls` for more information. | |
4439 |
|
4453 | |||
4440 | Returns 0 on success. |
|
4454 | Returns 0 on success. | |
4441 | """ |
|
4455 | """ | |
4442 | if search: |
|
4456 | if search: | |
4443 | for name, path in ui.configitems("paths"): |
|
4457 | for name, path in ui.configitems("paths"): | |
4444 | if name == search: |
|
4458 | if name == search: | |
4445 | ui.status("%s\n" % util.hidepassword(path)) |
|
4459 | ui.status("%s\n" % util.hidepassword(path)) | |
4446 | return |
|
4460 | return | |
4447 | if not ui.quiet: |
|
4461 | if not ui.quiet: | |
4448 | ui.warn(_("not found!\n")) |
|
4462 | ui.warn(_("not found!\n")) | |
4449 | return 1 |
|
4463 | return 1 | |
4450 | else: |
|
4464 | else: | |
4451 | for name, path in ui.configitems("paths"): |
|
4465 | for name, path in ui.configitems("paths"): | |
4452 | if ui.quiet: |
|
4466 | if ui.quiet: | |
4453 | ui.write("%s\n" % name) |
|
4467 | ui.write("%s\n" % name) | |
4454 | else: |
|
4468 | else: | |
4455 | ui.write("%s = %s\n" % (name, util.hidepassword(path))) |
|
4469 | ui.write("%s = %s\n" % (name, util.hidepassword(path))) | |
4456 |
|
4470 | |||
4457 | @command('phase', |
|
4471 | @command('phase', | |
4458 | [('p', 'public', False, _('set changeset phase to public')), |
|
4472 | [('p', 'public', False, _('set changeset phase to public')), | |
4459 | ('d', 'draft', False, _('set changeset phase to draft')), |
|
4473 | ('d', 'draft', False, _('set changeset phase to draft')), | |
4460 | ('s', 'secret', False, _('set changeset phase to secret')), |
|
4474 | ('s', 'secret', False, _('set changeset phase to secret')), | |
4461 | ('f', 'force', False, _('allow to move boundary backward')), |
|
4475 | ('f', 'force', False, _('allow to move boundary backward')), | |
4462 | ('r', 'rev', [], _('target revision'), _('REV')), |
|
4476 | ('r', 'rev', [], _('target revision'), _('REV')), | |
4463 | ], |
|
4477 | ], | |
4464 | _('[-p|-d|-s] [-f] [-r] REV...')) |
|
4478 | _('[-p|-d|-s] [-f] [-r] REV...')) | |
4465 | def phase(ui, repo, *revs, **opts): |
|
4479 | def phase(ui, repo, *revs, **opts): | |
4466 | """set or show the current phase name |
|
4480 | """set or show the current phase name | |
4467 |
|
4481 | |||
4468 | With no argument, show the phase name of specified revisions. |
|
4482 | With no argument, show the phase name of specified revisions. | |
4469 |
|
4483 | |||
4470 | With one of -p/--public, -d/--draft or -s/--secret, change the |
|
4484 | With one of -p/--public, -d/--draft or -s/--secret, change the | |
4471 | phase value of the specified revisions. |
|
4485 | phase value of the specified revisions. | |
4472 |
|
4486 | |||
4473 | Unless -f/--force is specified, :hg:`phase` won't move changeset from a |
|
4487 | Unless -f/--force is specified, :hg:`phase` won't move changeset from a | |
4474 | lower phase to an higher phase. Phases are ordered as follows:: |
|
4488 | lower phase to an higher phase. Phases are ordered as follows:: | |
4475 |
|
4489 | |||
4476 | public < draft < secret |
|
4490 | public < draft < secret | |
4477 |
|
4491 | |||
4478 | Returns 0 on success, 1 if no phases were changed or some could not |
|
4492 | Returns 0 on success, 1 if no phases were changed or some could not | |
4479 | be changed. |
|
4493 | be changed. | |
4480 | """ |
|
4494 | """ | |
4481 | # search for a unique phase argument |
|
4495 | # search for a unique phase argument | |
4482 | targetphase = None |
|
4496 | targetphase = None | |
4483 | for idx, name in enumerate(phases.phasenames): |
|
4497 | for idx, name in enumerate(phases.phasenames): | |
4484 | if opts[name]: |
|
4498 | if opts[name]: | |
4485 | if targetphase is not None: |
|
4499 | if targetphase is not None: | |
4486 | raise util.Abort(_('only one phase can be specified')) |
|
4500 | raise util.Abort(_('only one phase can be specified')) | |
4487 | targetphase = idx |
|
4501 | targetphase = idx | |
4488 |
|
4502 | |||
4489 | # look for specified revision |
|
4503 | # look for specified revision | |
4490 | revs = list(revs) |
|
4504 | revs = list(revs) | |
4491 | revs.extend(opts['rev']) |
|
4505 | revs.extend(opts['rev']) | |
4492 | if not revs: |
|
4506 | if not revs: | |
4493 | raise util.Abort(_('no revisions specified')) |
|
4507 | raise util.Abort(_('no revisions specified')) | |
4494 |
|
4508 | |||
4495 | revs = scmutil.revrange(repo, revs) |
|
4509 | revs = scmutil.revrange(repo, revs) | |
4496 |
|
4510 | |||
4497 | lock = None |
|
4511 | lock = None | |
4498 | ret = 0 |
|
4512 | ret = 0 | |
4499 | if targetphase is None: |
|
4513 | if targetphase is None: | |
4500 | # display |
|
4514 | # display | |
4501 | for r in revs: |
|
4515 | for r in revs: | |
4502 | ctx = repo[r] |
|
4516 | ctx = repo[r] | |
4503 | ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr())) |
|
4517 | ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr())) | |
4504 | else: |
|
4518 | else: | |
4505 | lock = repo.lock() |
|
4519 | lock = repo.lock() | |
4506 | try: |
|
4520 | try: | |
4507 | # set phase |
|
4521 | # set phase | |
4508 | if not revs: |
|
4522 | if not revs: | |
4509 | raise util.Abort(_('empty revision set')) |
|
4523 | raise util.Abort(_('empty revision set')) | |
4510 | nodes = [repo[r].node() for r in revs] |
|
4524 | nodes = [repo[r].node() for r in revs] | |
4511 | olddata = repo._phasecache.getphaserevs(repo)[:] |
|
4525 | olddata = repo._phasecache.getphaserevs(repo)[:] | |
4512 | phases.advanceboundary(repo, targetphase, nodes) |
|
4526 | phases.advanceboundary(repo, targetphase, nodes) | |
4513 | if opts['force']: |
|
4527 | if opts['force']: | |
4514 | phases.retractboundary(repo, targetphase, nodes) |
|
4528 | phases.retractboundary(repo, targetphase, nodes) | |
4515 | finally: |
|
4529 | finally: | |
4516 | lock.release() |
|
4530 | lock.release() | |
4517 | # moving revision from public to draft may hide them |
|
4531 | # moving revision from public to draft may hide them | |
4518 | # We have to check result on an unfiltered repository |
|
4532 | # We have to check result on an unfiltered repository | |
4519 | unfi = repo.unfiltered() |
|
4533 | unfi = repo.unfiltered() | |
4520 | newdata = repo._phasecache.getphaserevs(unfi) |
|
4534 | newdata = repo._phasecache.getphaserevs(unfi) | |
4521 | changes = sum(o != newdata[i] for i, o in enumerate(olddata)) |
|
4535 | changes = sum(o != newdata[i] for i, o in enumerate(olddata)) | |
4522 | cl = unfi.changelog |
|
4536 | cl = unfi.changelog | |
4523 | rejected = [n for n in nodes |
|
4537 | rejected = [n for n in nodes | |
4524 | if newdata[cl.rev(n)] < targetphase] |
|
4538 | if newdata[cl.rev(n)] < targetphase] | |
4525 | if rejected: |
|
4539 | if rejected: | |
4526 | ui.warn(_('cannot move %i changesets to a higher ' |
|
4540 | ui.warn(_('cannot move %i changesets to a higher ' | |
4527 | 'phase, use --force\n') % len(rejected)) |
|
4541 | 'phase, use --force\n') % len(rejected)) | |
4528 | ret = 1 |
|
4542 | ret = 1 | |
4529 | if changes: |
|
4543 | if changes: | |
4530 | msg = _('phase changed for %i changesets\n') % changes |
|
4544 | msg = _('phase changed for %i changesets\n') % changes | |
4531 | if ret: |
|
4545 | if ret: | |
4532 | ui.status(msg) |
|
4546 | ui.status(msg) | |
4533 | else: |
|
4547 | else: | |
4534 | ui.note(msg) |
|
4548 | ui.note(msg) | |
4535 | else: |
|
4549 | else: | |
4536 | ui.warn(_('no phases changed\n')) |
|
4550 | ui.warn(_('no phases changed\n')) | |
4537 | ret = 1 |
|
4551 | ret = 1 | |
4538 | return ret |
|
4552 | return ret | |
4539 |
|
4553 | |||
4540 | def postincoming(ui, repo, modheads, optupdate, checkout): |
|
4554 | def postincoming(ui, repo, modheads, optupdate, checkout): | |
4541 | if modheads == 0: |
|
4555 | if modheads == 0: | |
4542 | return |
|
4556 | return | |
4543 | if optupdate: |
|
4557 | if optupdate: | |
4544 | checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout) |
|
4558 | checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout) | |
4545 | try: |
|
4559 | try: | |
4546 | ret = hg.update(repo, checkout) |
|
4560 | ret = hg.update(repo, checkout) | |
4547 | except util.Abort, inst: |
|
4561 | except util.Abort, inst: | |
4548 | ui.warn(_("not updating: %s\n") % str(inst)) |
|
4562 | ui.warn(_("not updating: %s\n") % str(inst)) | |
4549 | if inst.hint: |
|
4563 | if inst.hint: | |
4550 | ui.warn(_("(%s)\n") % inst.hint) |
|
4564 | ui.warn(_("(%s)\n") % inst.hint) | |
4551 | return 0 |
|
4565 | return 0 | |
4552 | if not ret and not checkout: |
|
4566 | if not ret and not checkout: | |
4553 | if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): |
|
4567 | if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): | |
4554 | ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) |
|
4568 | ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) | |
4555 | return ret |
|
4569 | return ret | |
4556 | if modheads > 1: |
|
4570 | if modheads > 1: | |
4557 | currentbranchheads = len(repo.branchheads()) |
|
4571 | currentbranchheads = len(repo.branchheads()) | |
4558 | if currentbranchheads == modheads: |
|
4572 | if currentbranchheads == modheads: | |
4559 | ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) |
|
4573 | ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) | |
4560 | elif currentbranchheads > 1: |
|
4574 | elif currentbranchheads > 1: | |
4561 | ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to " |
|
4575 | ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to " | |
4562 | "merge)\n")) |
|
4576 | "merge)\n")) | |
4563 | else: |
|
4577 | else: | |
4564 | ui.status(_("(run 'hg heads' to see heads)\n")) |
|
4578 | ui.status(_("(run 'hg heads' to see heads)\n")) | |
4565 | else: |
|
4579 | else: | |
4566 | ui.status(_("(run 'hg update' to get a working copy)\n")) |
|
4580 | ui.status(_("(run 'hg update' to get a working copy)\n")) | |
4567 |
|
4581 | |||
4568 | @command('^pull', |
|
4582 | @command('^pull', | |
4569 | [('u', 'update', None, |
|
4583 | [('u', 'update', None, | |
4570 | _('update to new branch head if changesets were pulled')), |
|
4584 | _('update to new branch head if changesets were pulled')), | |
4571 | ('f', 'force', None, _('run even when remote repository is unrelated')), |
|
4585 | ('f', 'force', None, _('run even when remote repository is unrelated')), | |
4572 | ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), |
|
4586 | ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), | |
4573 | ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')), |
|
4587 | ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')), | |
4574 | ('b', 'branch', [], _('a specific branch you would like to pull'), |
|
4588 | ('b', 'branch', [], _('a specific branch you would like to pull'), | |
4575 | _('BRANCH')), |
|
4589 | _('BRANCH')), | |
4576 | ] + remoteopts, |
|
4590 | ] + remoteopts, | |
4577 | _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')) |
|
4591 | _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')) | |
4578 | def pull(ui, repo, source="default", **opts): |
|
4592 | def pull(ui, repo, source="default", **opts): | |
4579 | """pull changes from the specified source |
|
4593 | """pull changes from the specified source | |
4580 |
|
4594 | |||
4581 | Pull changes from a remote repository to a local one. |
|
4595 | Pull changes from a remote repository to a local one. | |
4582 |
|
4596 | |||
4583 | This finds all changes from the repository at the specified path |
|
4597 | This finds all changes from the repository at the specified path | |
4584 | or URL and adds them to a local repository (the current one unless |
|
4598 | or URL and adds them to a local repository (the current one unless | |
4585 | -R is specified). By default, this does not update the copy of the |
|
4599 | -R is specified). By default, this does not update the copy of the | |
4586 | project in the working directory. |
|
4600 | project in the working directory. | |
4587 |
|
4601 | |||
4588 | Use :hg:`incoming` if you want to see what would have been added |
|
4602 | Use :hg:`incoming` if you want to see what would have been added | |
4589 | by a pull at the time you issued this command. If you then decide |
|
4603 | by a pull at the time you issued this command. If you then decide | |
4590 | to add those changes to the repository, you should use :hg:`pull |
|
4604 | to add those changes to the repository, you should use :hg:`pull | |
4591 | -r X` where ``X`` is the last changeset listed by :hg:`incoming`. |
|
4605 | -r X` where ``X`` is the last changeset listed by :hg:`incoming`. | |
4592 |
|
4606 | |||
4593 | If SOURCE is omitted, the 'default' path will be used. |
|
4607 | If SOURCE is omitted, the 'default' path will be used. | |
4594 | See :hg:`help urls` for more information. |
|
4608 | See :hg:`help urls` for more information. | |
4595 |
|
4609 | |||
4596 | Returns 0 on success, 1 if an update had unresolved files. |
|
4610 | Returns 0 on success, 1 if an update had unresolved files. | |
4597 | """ |
|
4611 | """ | |
4598 | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) |
|
4612 | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) | |
4599 | other = hg.peer(repo, opts, source) |
|
4613 | other = hg.peer(repo, opts, source) | |
4600 | try: |
|
4614 | try: | |
4601 | ui.status(_('pulling from %s\n') % util.hidepassword(source)) |
|
4615 | ui.status(_('pulling from %s\n') % util.hidepassword(source)) | |
4602 | revs, checkout = hg.addbranchrevs(repo, other, branches, |
|
4616 | revs, checkout = hg.addbranchrevs(repo, other, branches, | |
4603 | opts.get('rev')) |
|
4617 | opts.get('rev')) | |
4604 |
|
4618 | |||
4605 | remotebookmarks = other.listkeys('bookmarks') |
|
4619 | remotebookmarks = other.listkeys('bookmarks') | |
4606 |
|
4620 | |||
4607 | if opts.get('bookmark'): |
|
4621 | if opts.get('bookmark'): | |
4608 | if not revs: |
|
4622 | if not revs: | |
4609 | revs = [] |
|
4623 | revs = [] | |
4610 | for b in opts['bookmark']: |
|
4624 | for b in opts['bookmark']: | |
4611 | if b not in remotebookmarks: |
|
4625 | if b not in remotebookmarks: | |
4612 | raise util.Abort(_('remote bookmark %s not found!') % b) |
|
4626 | raise util.Abort(_('remote bookmark %s not found!') % b) | |
4613 | revs.append(remotebookmarks[b]) |
|
4627 | revs.append(remotebookmarks[b]) | |
4614 |
|
4628 | |||
4615 | if revs: |
|
4629 | if revs: | |
4616 | try: |
|
4630 | try: | |
4617 | revs = [other.lookup(rev) for rev in revs] |
|
4631 | revs = [other.lookup(rev) for rev in revs] | |
4618 | except error.CapabilityError: |
|
4632 | except error.CapabilityError: | |
4619 | err = _("other repository doesn't support revision lookup, " |
|
4633 | err = _("other repository doesn't support revision lookup, " | |
4620 | "so a rev cannot be specified.") |
|
4634 | "so a rev cannot be specified.") | |
4621 | raise util.Abort(err) |
|
4635 | raise util.Abort(err) | |
4622 |
|
4636 | |||
4623 | modheads = repo.pull(other, heads=revs, force=opts.get('force')) |
|
4637 | modheads = repo.pull(other, heads=revs, force=opts.get('force')) | |
4624 | bookmarks.updatefromremote(ui, repo, remotebookmarks, source) |
|
4638 | bookmarks.updatefromremote(ui, repo, remotebookmarks, source) | |
4625 | if checkout: |
|
4639 | if checkout: | |
4626 | checkout = str(repo.changelog.rev(other.lookup(checkout))) |
|
4640 | checkout = str(repo.changelog.rev(other.lookup(checkout))) | |
4627 | repo._subtoppath = source |
|
4641 | repo._subtoppath = source | |
4628 | try: |
|
4642 | try: | |
4629 | ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) |
|
4643 | ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) | |
4630 |
|
4644 | |||
4631 | finally: |
|
4645 | finally: | |
4632 | del repo._subtoppath |
|
4646 | del repo._subtoppath | |
4633 |
|
4647 | |||
4634 | # update specified bookmarks |
|
4648 | # update specified bookmarks | |
4635 | if opts.get('bookmark'): |
|
4649 | if opts.get('bookmark'): | |
4636 | marks = repo._bookmarks |
|
4650 | marks = repo._bookmarks | |
4637 | for b in opts['bookmark']: |
|
4651 | for b in opts['bookmark']: | |
4638 | # explicit pull overrides local bookmark if any |
|
4652 | # explicit pull overrides local bookmark if any | |
4639 | ui.status(_("importing bookmark %s\n") % b) |
|
4653 | ui.status(_("importing bookmark %s\n") % b) | |
4640 | marks[b] = repo[remotebookmarks[b]].node() |
|
4654 | marks[b] = repo[remotebookmarks[b]].node() | |
4641 | marks.write() |
|
4655 | marks.write() | |
4642 | finally: |
|
4656 | finally: | |
4643 | other.close() |
|
4657 | other.close() | |
4644 | return ret |
|
4658 | return ret | |
4645 |
|
4659 | |||
4646 | @command('^push', |
|
4660 | @command('^push', | |
4647 | [('f', 'force', None, _('force push')), |
|
4661 | [('f', 'force', None, _('force push')), | |
4648 | ('r', 'rev', [], |
|
4662 | ('r', 'rev', [], | |
4649 | _('a changeset intended to be included in the destination'), |
|
4663 | _('a changeset intended to be included in the destination'), | |
4650 | _('REV')), |
|
4664 | _('REV')), | |
4651 | ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')), |
|
4665 | ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')), | |
4652 | ('b', 'branch', [], |
|
4666 | ('b', 'branch', [], | |
4653 | _('a specific branch you would like to push'), _('BRANCH')), |
|
4667 | _('a specific branch you would like to push'), _('BRANCH')), | |
4654 | ('', 'new-branch', False, _('allow pushing a new branch')), |
|
4668 | ('', 'new-branch', False, _('allow pushing a new branch')), | |
4655 | ] + remoteopts, |
|
4669 | ] + remoteopts, | |
4656 | _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')) |
|
4670 | _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')) | |
4657 | def push(ui, repo, dest=None, **opts): |
|
4671 | def push(ui, repo, dest=None, **opts): | |
4658 | """push changes to the specified destination |
|
4672 | """push changes to the specified destination | |
4659 |
|
4673 | |||
4660 | Push changesets from the local repository to the specified |
|
4674 | Push changesets from the local repository to the specified | |
4661 | destination. |
|
4675 | destination. | |
4662 |
|
4676 | |||
4663 | This operation is symmetrical to pull: it is identical to a pull |
|
4677 | This operation is symmetrical to pull: it is identical to a pull | |
4664 | in the destination repository from the current one. |
|
4678 | in the destination repository from the current one. | |
4665 |
|
4679 | |||
4666 | By default, push will not allow creation of new heads at the |
|
4680 | By default, push will not allow creation of new heads at the | |
4667 | destination, since multiple heads would make it unclear which head |
|
4681 | destination, since multiple heads would make it unclear which head | |
4668 | to use. In this situation, it is recommended to pull and merge |
|
4682 | to use. In this situation, it is recommended to pull and merge | |
4669 | before pushing. |
|
4683 | before pushing. | |
4670 |
|
4684 | |||
4671 | Use --new-branch if you want to allow push to create a new named |
|
4685 | Use --new-branch if you want to allow push to create a new named | |
4672 | branch that is not present at the destination. This allows you to |
|
4686 | branch that is not present at the destination. This allows you to | |
4673 | only create a new branch without forcing other changes. |
|
4687 | only create a new branch without forcing other changes. | |
4674 |
|
4688 | |||
4675 | .. note:: |
|
4689 | .. note:: | |
4676 |
|
4690 | |||
4677 | Extra care should be taken with the -f/--force option, |
|
4691 | Extra care should be taken with the -f/--force option, | |
4678 | which will push all new heads on all branches, an action which will |
|
4692 | which will push all new heads on all branches, an action which will | |
4679 | almost always cause confusion for collaborators. |
|
4693 | almost always cause confusion for collaborators. | |
4680 |
|
4694 | |||
4681 | If -r/--rev is used, the specified revision and all its ancestors |
|
4695 | If -r/--rev is used, the specified revision and all its ancestors | |
4682 | will be pushed to the remote repository. |
|
4696 | will be pushed to the remote repository. | |
4683 |
|
4697 | |||
4684 | If -B/--bookmark is used, the specified bookmarked revision, its |
|
4698 | If -B/--bookmark is used, the specified bookmarked revision, its | |
4685 | ancestors, and the bookmark will be pushed to the remote |
|
4699 | ancestors, and the bookmark will be pushed to the remote | |
4686 | repository. |
|
4700 | repository. | |
4687 |
|
4701 | |||
4688 | Please see :hg:`help urls` for important details about ``ssh://`` |
|
4702 | Please see :hg:`help urls` for important details about ``ssh://`` | |
4689 | URLs. If DESTINATION is omitted, a default path will be used. |
|
4703 | URLs. If DESTINATION is omitted, a default path will be used. | |
4690 |
|
4704 | |||
4691 | Returns 0 if push was successful, 1 if nothing to push. |
|
4705 | Returns 0 if push was successful, 1 if nothing to push. | |
4692 | """ |
|
4706 | """ | |
4693 |
|
4707 | |||
4694 | if opts.get('bookmark'): |
|
4708 | if opts.get('bookmark'): | |
4695 | ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push') |
|
4709 | ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push') | |
4696 | for b in opts['bookmark']: |
|
4710 | for b in opts['bookmark']: | |
4697 | # translate -B options to -r so changesets get pushed |
|
4711 | # translate -B options to -r so changesets get pushed | |
4698 | if b in repo._bookmarks: |
|
4712 | if b in repo._bookmarks: | |
4699 | opts.setdefault('rev', []).append(b) |
|
4713 | opts.setdefault('rev', []).append(b) | |
4700 | else: |
|
4714 | else: | |
4701 | # if we try to push a deleted bookmark, translate it to null |
|
4715 | # if we try to push a deleted bookmark, translate it to null | |
4702 | # this lets simultaneous -r, -b options continue working |
|
4716 | # this lets simultaneous -r, -b options continue working | |
4703 | opts.setdefault('rev', []).append("null") |
|
4717 | opts.setdefault('rev', []).append("null") | |
4704 |
|
4718 | |||
4705 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
4719 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
4706 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
4720 | dest, branches = hg.parseurl(dest, opts.get('branch')) | |
4707 | ui.status(_('pushing to %s\n') % util.hidepassword(dest)) |
|
4721 | ui.status(_('pushing to %s\n') % util.hidepassword(dest)) | |
4708 | revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) |
|
4722 | revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) | |
4709 | try: |
|
4723 | try: | |
4710 | other = hg.peer(repo, opts, dest) |
|
4724 | other = hg.peer(repo, opts, dest) | |
4711 | except error.RepoError: |
|
4725 | except error.RepoError: | |
4712 | if dest == "default-push": |
|
4726 | if dest == "default-push": | |
4713 | raise util.Abort(_("default repository not configured!"), |
|
4727 | raise util.Abort(_("default repository not configured!"), | |
4714 | hint=_('see the "path" section in "hg help config"')) |
|
4728 | hint=_('see the "path" section in "hg help config"')) | |
4715 | else: |
|
4729 | else: | |
4716 | raise |
|
4730 | raise | |
4717 |
|
4731 | |||
4718 | if revs: |
|
4732 | if revs: | |
4719 | revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] |
|
4733 | revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] | |
4720 |
|
4734 | |||
4721 | repo._subtoppath = dest |
|
4735 | repo._subtoppath = dest | |
4722 | try: |
|
4736 | try: | |
4723 | # push subrepos depth-first for coherent ordering |
|
4737 | # push subrepos depth-first for coherent ordering | |
4724 | c = repo[''] |
|
4738 | c = repo[''] | |
4725 | subs = c.substate # only repos that are committed |
|
4739 | subs = c.substate # only repos that are committed | |
4726 | for s in sorted(subs): |
|
4740 | for s in sorted(subs): | |
4727 | result = c.sub(s).push(opts) |
|
4741 | result = c.sub(s).push(opts) | |
4728 | if result == 0: |
|
4742 | if result == 0: | |
4729 | return not result |
|
4743 | return not result | |
4730 | finally: |
|
4744 | finally: | |
4731 | del repo._subtoppath |
|
4745 | del repo._subtoppath | |
4732 | result = repo.push(other, opts.get('force'), revs=revs, |
|
4746 | result = repo.push(other, opts.get('force'), revs=revs, | |
4733 | newbranch=opts.get('new_branch')) |
|
4747 | newbranch=opts.get('new_branch')) | |
4734 |
|
4748 | |||
4735 | result = not result |
|
4749 | result = not result | |
4736 |
|
4750 | |||
4737 | if opts.get('bookmark'): |
|
4751 | if opts.get('bookmark'): | |
4738 | bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark']) |
|
4752 | bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark']) | |
4739 | if bresult == 2: |
|
4753 | if bresult == 2: | |
4740 | return 2 |
|
4754 | return 2 | |
4741 | if not result and bresult: |
|
4755 | if not result and bresult: | |
4742 | result = 2 |
|
4756 | result = 2 | |
4743 |
|
4757 | |||
4744 | return result |
|
4758 | return result | |
4745 |
|
4759 | |||
4746 | @command('recover', []) |
|
4760 | @command('recover', []) | |
4747 | def recover(ui, repo): |
|
4761 | def recover(ui, repo): | |
4748 | """roll back an interrupted transaction |
|
4762 | """roll back an interrupted transaction | |
4749 |
|
4763 | |||
4750 | Recover from an interrupted commit or pull. |
|
4764 | Recover from an interrupted commit or pull. | |
4751 |
|
4765 | |||
4752 | This command tries to fix the repository status after an |
|
4766 | This command tries to fix the repository status after an | |
4753 | interrupted operation. It should only be necessary when Mercurial |
|
4767 | interrupted operation. It should only be necessary when Mercurial | |
4754 | suggests it. |
|
4768 | suggests it. | |
4755 |
|
4769 | |||
4756 | Returns 0 if successful, 1 if nothing to recover or verify fails. |
|
4770 | Returns 0 if successful, 1 if nothing to recover or verify fails. | |
4757 | """ |
|
4771 | """ | |
4758 | if repo.recover(): |
|
4772 | if repo.recover(): | |
4759 | return hg.verify(repo) |
|
4773 | return hg.verify(repo) | |
4760 | return 1 |
|
4774 | return 1 | |
4761 |
|
4775 | |||
4762 | @command('^remove|rm', |
|
4776 | @command('^remove|rm', | |
4763 | [('A', 'after', None, _('record delete for missing files')), |
|
4777 | [('A', 'after', None, _('record delete for missing files')), | |
4764 | ('f', 'force', None, |
|
4778 | ('f', 'force', None, | |
4765 | _('remove (and delete) file even if added or modified')), |
|
4779 | _('remove (and delete) file even if added or modified')), | |
4766 | ] + walkopts, |
|
4780 | ] + walkopts, | |
4767 | _('[OPTION]... FILE...')) |
|
4781 | _('[OPTION]... FILE...')) | |
4768 | def remove(ui, repo, *pats, **opts): |
|
4782 | def remove(ui, repo, *pats, **opts): | |
4769 | """remove the specified files on the next commit |
|
4783 | """remove the specified files on the next commit | |
4770 |
|
4784 | |||
4771 | Schedule the indicated files for removal from the current branch. |
|
4785 | Schedule the indicated files for removal from the current branch. | |
4772 |
|
4786 | |||
4773 | This command schedules the files to be removed at the next commit. |
|
4787 | This command schedules the files to be removed at the next commit. | |
4774 | To undo a remove before that, see :hg:`revert`. To undo added |
|
4788 | To undo a remove before that, see :hg:`revert`. To undo added | |
4775 | files, see :hg:`forget`. |
|
4789 | files, see :hg:`forget`. | |
4776 |
|
4790 | |||
4777 | .. container:: verbose |
|
4791 | .. container:: verbose | |
4778 |
|
4792 | |||
4779 | -A/--after can be used to remove only files that have already |
|
4793 | -A/--after can be used to remove only files that have already | |
4780 | been deleted, -f/--force can be used to force deletion, and -Af |
|
4794 | been deleted, -f/--force can be used to force deletion, and -Af | |
4781 | can be used to remove files from the next revision without |
|
4795 | can be used to remove files from the next revision without | |
4782 | deleting them from the working directory. |
|
4796 | deleting them from the working directory. | |
4783 |
|
4797 | |||
4784 | The following table details the behavior of remove for different |
|
4798 | The following table details the behavior of remove for different | |
4785 | file states (columns) and option combinations (rows). The file |
|
4799 | file states (columns) and option combinations (rows). The file | |
4786 | states are Added [A], Clean [C], Modified [M] and Missing [!] |
|
4800 | states are Added [A], Clean [C], Modified [M] and Missing [!] | |
4787 | (as reported by :hg:`status`). The actions are Warn, Remove |
|
4801 | (as reported by :hg:`status`). The actions are Warn, Remove | |
4788 | (from branch) and Delete (from disk): |
|
4802 | (from branch) and Delete (from disk): | |
4789 |
|
4803 | |||
4790 | ========= == == == == |
|
4804 | ========= == == == == | |
4791 | opt/state A C M ! |
|
4805 | opt/state A C M ! | |
4792 | ========= == == == == |
|
4806 | ========= == == == == | |
4793 | none W RD W R |
|
4807 | none W RD W R | |
4794 | -f R RD RD R |
|
4808 | -f R RD RD R | |
4795 | -A W W W R |
|
4809 | -A W W W R | |
4796 | -Af R R R R |
|
4810 | -Af R R R R | |
4797 | ========= == == == == |
|
4811 | ========= == == == == | |
4798 |
|
4812 | |||
4799 | Note that remove never deletes files in Added [A] state from the |
|
4813 | Note that remove never deletes files in Added [A] state from the | |
4800 | working directory, not even if option --force is specified. |
|
4814 | working directory, not even if option --force is specified. | |
4801 |
|
4815 | |||
4802 | Returns 0 on success, 1 if any warnings encountered. |
|
4816 | Returns 0 on success, 1 if any warnings encountered. | |
4803 | """ |
|
4817 | """ | |
4804 |
|
4818 | |||
4805 | ret = 0 |
|
4819 | ret = 0 | |
4806 | after, force = opts.get('after'), opts.get('force') |
|
4820 | after, force = opts.get('after'), opts.get('force') | |
4807 | if not pats and not after: |
|
4821 | if not pats and not after: | |
4808 | raise util.Abort(_('no files specified')) |
|
4822 | raise util.Abort(_('no files specified')) | |
4809 |
|
4823 | |||
4810 | m = scmutil.match(repo[None], pats, opts) |
|
4824 | m = scmutil.match(repo[None], pats, opts) | |
4811 | s = repo.status(match=m, clean=True) |
|
4825 | s = repo.status(match=m, clean=True) | |
4812 | modified, added, deleted, clean = s[0], s[1], s[3], s[6] |
|
4826 | modified, added, deleted, clean = s[0], s[1], s[3], s[6] | |
4813 |
|
4827 | |||
4814 | # warn about failure to delete explicit files/dirs |
|
4828 | # warn about failure to delete explicit files/dirs | |
4815 | wctx = repo[None] |
|
4829 | wctx = repo[None] | |
4816 | for f in m.files(): |
|
4830 | for f in m.files(): | |
4817 | if f in repo.dirstate or f in wctx.dirs(): |
|
4831 | if f in repo.dirstate or f in wctx.dirs(): | |
4818 | continue |
|
4832 | continue | |
4819 | if os.path.exists(m.rel(f)): |
|
4833 | if os.path.exists(m.rel(f)): | |
4820 | if os.path.isdir(m.rel(f)): |
|
4834 | if os.path.isdir(m.rel(f)): | |
4821 | ui.warn(_('not removing %s: no tracked files\n') % m.rel(f)) |
|
4835 | ui.warn(_('not removing %s: no tracked files\n') % m.rel(f)) | |
4822 | else: |
|
4836 | else: | |
4823 | ui.warn(_('not removing %s: file is untracked\n') % m.rel(f)) |
|
4837 | ui.warn(_('not removing %s: file is untracked\n') % m.rel(f)) | |
4824 | # missing files will generate a warning elsewhere |
|
4838 | # missing files will generate a warning elsewhere | |
4825 | ret = 1 |
|
4839 | ret = 1 | |
4826 |
|
4840 | |||
4827 | if force: |
|
4841 | if force: | |
4828 | list = modified + deleted + clean + added |
|
4842 | list = modified + deleted + clean + added | |
4829 | elif after: |
|
4843 | elif after: | |
4830 | list = deleted |
|
4844 | list = deleted | |
4831 | for f in modified + added + clean: |
|
4845 | for f in modified + added + clean: | |
4832 | ui.warn(_('not removing %s: file still exists\n') % m.rel(f)) |
|
4846 | ui.warn(_('not removing %s: file still exists\n') % m.rel(f)) | |
4833 | ret = 1 |
|
4847 | ret = 1 | |
4834 | else: |
|
4848 | else: | |
4835 | list = deleted + clean |
|
4849 | list = deleted + clean | |
4836 | for f in modified: |
|
4850 | for f in modified: | |
4837 | ui.warn(_('not removing %s: file is modified (use -f' |
|
4851 | ui.warn(_('not removing %s: file is modified (use -f' | |
4838 | ' to force removal)\n') % m.rel(f)) |
|
4852 | ' to force removal)\n') % m.rel(f)) | |
4839 | ret = 1 |
|
4853 | ret = 1 | |
4840 | for f in added: |
|
4854 | for f in added: | |
4841 | ui.warn(_('not removing %s: file has been marked for add' |
|
4855 | ui.warn(_('not removing %s: file has been marked for add' | |
4842 | ' (use forget to undo)\n') % m.rel(f)) |
|
4856 | ' (use forget to undo)\n') % m.rel(f)) | |
4843 | ret = 1 |
|
4857 | ret = 1 | |
4844 |
|
4858 | |||
4845 | for f in sorted(list): |
|
4859 | for f in sorted(list): | |
4846 | if ui.verbose or not m.exact(f): |
|
4860 | if ui.verbose or not m.exact(f): | |
4847 | ui.status(_('removing %s\n') % m.rel(f)) |
|
4861 | ui.status(_('removing %s\n') % m.rel(f)) | |
4848 |
|
4862 | |||
4849 | wlock = repo.wlock() |
|
4863 | wlock = repo.wlock() | |
4850 | try: |
|
4864 | try: | |
4851 | if not after: |
|
4865 | if not after: | |
4852 | for f in list: |
|
4866 | for f in list: | |
4853 | if f in added: |
|
4867 | if f in added: | |
4854 | continue # we never unlink added files on remove |
|
4868 | continue # we never unlink added files on remove | |
4855 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
4869 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) | |
4856 | repo[None].forget(list) |
|
4870 | repo[None].forget(list) | |
4857 | finally: |
|
4871 | finally: | |
4858 | wlock.release() |
|
4872 | wlock.release() | |
4859 |
|
4873 | |||
4860 | return ret |
|
4874 | return ret | |
4861 |
|
4875 | |||
4862 | @command('rename|move|mv', |
|
4876 | @command('rename|move|mv', | |
4863 | [('A', 'after', None, _('record a rename that has already occurred')), |
|
4877 | [('A', 'after', None, _('record a rename that has already occurred')), | |
4864 | ('f', 'force', None, _('forcibly copy over an existing managed file')), |
|
4878 | ('f', 'force', None, _('forcibly copy over an existing managed file')), | |
4865 | ] + walkopts + dryrunopts, |
|
4879 | ] + walkopts + dryrunopts, | |
4866 | _('[OPTION]... SOURCE... DEST')) |
|
4880 | _('[OPTION]... SOURCE... DEST')) | |
4867 | def rename(ui, repo, *pats, **opts): |
|
4881 | def rename(ui, repo, *pats, **opts): | |
4868 | """rename files; equivalent of copy + remove |
|
4882 | """rename files; equivalent of copy + remove | |
4869 |
|
4883 | |||
4870 | Mark dest as copies of sources; mark sources for deletion. If dest |
|
4884 | Mark dest as copies of sources; mark sources for deletion. If dest | |
4871 | is a directory, copies are put in that directory. If dest is a |
|
4885 | is a directory, copies are put in that directory. If dest is a | |
4872 | file, there can only be one source. |
|
4886 | file, there can only be one source. | |
4873 |
|
4887 | |||
4874 | By default, this command copies the contents of files as they |
|
4888 | By default, this command copies the contents of files as they | |
4875 | exist in the working directory. If invoked with -A/--after, the |
|
4889 | exist in the working directory. If invoked with -A/--after, the | |
4876 | operation is recorded, but no copying is performed. |
|
4890 | operation is recorded, but no copying is performed. | |
4877 |
|
4891 | |||
4878 | This command takes effect at the next commit. To undo a rename |
|
4892 | This command takes effect at the next commit. To undo a rename | |
4879 | before that, see :hg:`revert`. |
|
4893 | before that, see :hg:`revert`. | |
4880 |
|
4894 | |||
4881 | Returns 0 on success, 1 if errors are encountered. |
|
4895 | Returns 0 on success, 1 if errors are encountered. | |
4882 | """ |
|
4896 | """ | |
4883 | wlock = repo.wlock(False) |
|
4897 | wlock = repo.wlock(False) | |
4884 | try: |
|
4898 | try: | |
4885 | return cmdutil.copy(ui, repo, pats, opts, rename=True) |
|
4899 | return cmdutil.copy(ui, repo, pats, opts, rename=True) | |
4886 | finally: |
|
4900 | finally: | |
4887 | wlock.release() |
|
4901 | wlock.release() | |
4888 |
|
4902 | |||
4889 | @command('resolve', |
|
4903 | @command('resolve', | |
4890 | [('a', 'all', None, _('select all unresolved files')), |
|
4904 | [('a', 'all', None, _('select all unresolved files')), | |
4891 | ('l', 'list', None, _('list state of files needing merge')), |
|
4905 | ('l', 'list', None, _('list state of files needing merge')), | |
4892 | ('m', 'mark', None, _('mark files as resolved')), |
|
4906 | ('m', 'mark', None, _('mark files as resolved')), | |
4893 | ('u', 'unmark', None, _('mark files as unresolved')), |
|
4907 | ('u', 'unmark', None, _('mark files as unresolved')), | |
4894 | ('n', 'no-status', None, _('hide status prefix'))] |
|
4908 | ('n', 'no-status', None, _('hide status prefix'))] | |
4895 | + mergetoolopts + walkopts, |
|
4909 | + mergetoolopts + walkopts, | |
4896 | _('[OPTION]... [FILE]...')) |
|
4910 | _('[OPTION]... [FILE]...')) | |
4897 | def resolve(ui, repo, *pats, **opts): |
|
4911 | def resolve(ui, repo, *pats, **opts): | |
4898 | """redo merges or set/view the merge status of files |
|
4912 | """redo merges or set/view the merge status of files | |
4899 |
|
4913 | |||
4900 | Merges with unresolved conflicts are often the result of |
|
4914 | Merges with unresolved conflicts are often the result of | |
4901 | non-interactive merging using the ``internal:merge`` configuration |
|
4915 | non-interactive merging using the ``internal:merge`` configuration | |
4902 | setting, or a command-line merge tool like ``diff3``. The resolve |
|
4916 | setting, or a command-line merge tool like ``diff3``. The resolve | |
4903 | command is used to manage the files involved in a merge, after |
|
4917 | command is used to manage the files involved in a merge, after | |
4904 | :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the |
|
4918 | :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the | |
4905 | working directory must have two parents). See :hg:`help |
|
4919 | working directory must have two parents). See :hg:`help | |
4906 | merge-tools` for information on configuring merge tools. |
|
4920 | merge-tools` for information on configuring merge tools. | |
4907 |
|
4921 | |||
4908 | The resolve command can be used in the following ways: |
|
4922 | The resolve command can be used in the following ways: | |
4909 |
|
4923 | |||
4910 | - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified |
|
4924 | - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified | |
4911 | files, discarding any previous merge attempts. Re-merging is not |
|
4925 | files, discarding any previous merge attempts. Re-merging is not | |
4912 | performed for files already marked as resolved. Use ``--all/-a`` |
|
4926 | performed for files already marked as resolved. Use ``--all/-a`` | |
4913 | to select all unresolved files. ``--tool`` can be used to specify |
|
4927 | to select all unresolved files. ``--tool`` can be used to specify | |
4914 | the merge tool used for the given files. It overrides the HGMERGE |
|
4928 | the merge tool used for the given files. It overrides the HGMERGE | |
4915 | environment variable and your configuration files. Previous file |
|
4929 | environment variable and your configuration files. Previous file | |
4916 | contents are saved with a ``.orig`` suffix. |
|
4930 | contents are saved with a ``.orig`` suffix. | |
4917 |
|
4931 | |||
4918 | - :hg:`resolve -m [FILE]`: mark a file as having been resolved |
|
4932 | - :hg:`resolve -m [FILE]`: mark a file as having been resolved | |
4919 | (e.g. after having manually fixed-up the files). The default is |
|
4933 | (e.g. after having manually fixed-up the files). The default is | |
4920 | to mark all unresolved files. |
|
4934 | to mark all unresolved files. | |
4921 |
|
4935 | |||
4922 | - :hg:`resolve -u [FILE]...`: mark a file as unresolved. The |
|
4936 | - :hg:`resolve -u [FILE]...`: mark a file as unresolved. The | |
4923 | default is to mark all resolved files. |
|
4937 | default is to mark all resolved files. | |
4924 |
|
4938 | |||
4925 | - :hg:`resolve -l`: list files which had or still have conflicts. |
|
4939 | - :hg:`resolve -l`: list files which had or still have conflicts. | |
4926 | In the printed list, ``U`` = unresolved and ``R`` = resolved. |
|
4940 | In the printed list, ``U`` = unresolved and ``R`` = resolved. | |
4927 |
|
4941 | |||
4928 | Note that Mercurial will not let you commit files with unresolved |
|
4942 | Note that Mercurial will not let you commit files with unresolved | |
4929 | merge conflicts. You must use :hg:`resolve -m ...` before you can |
|
4943 | merge conflicts. You must use :hg:`resolve -m ...` before you can | |
4930 | commit after a conflicting merge. |
|
4944 | commit after a conflicting merge. | |
4931 |
|
4945 | |||
4932 | Returns 0 on success, 1 if any files fail a resolve attempt. |
|
4946 | Returns 0 on success, 1 if any files fail a resolve attempt. | |
4933 | """ |
|
4947 | """ | |
4934 |
|
4948 | |||
4935 | all, mark, unmark, show, nostatus = \ |
|
4949 | all, mark, unmark, show, nostatus = \ | |
4936 | [opts.get(o) for o in 'all mark unmark list no_status'.split()] |
|
4950 | [opts.get(o) for o in 'all mark unmark list no_status'.split()] | |
4937 |
|
4951 | |||
4938 | if (show and (mark or unmark)) or (mark and unmark): |
|
4952 | if (show and (mark or unmark)) or (mark and unmark): | |
4939 | raise util.Abort(_("too many options specified")) |
|
4953 | raise util.Abort(_("too many options specified")) | |
4940 | if pats and all: |
|
4954 | if pats and all: | |
4941 | raise util.Abort(_("can't specify --all and patterns")) |
|
4955 | raise util.Abort(_("can't specify --all and patterns")) | |
4942 | if not (all or pats or show or mark or unmark): |
|
4956 | if not (all or pats or show or mark or unmark): | |
4943 | raise util.Abort(_('no files or directories specified; ' |
|
4957 | raise util.Abort(_('no files or directories specified; ' | |
4944 | 'use --all to remerge all files')) |
|
4958 | 'use --all to remerge all files')) | |
4945 |
|
4959 | |||
4946 | wlock = repo.wlock() |
|
4960 | wlock = repo.wlock() | |
4947 | try: |
|
4961 | try: | |
4948 | ms = mergemod.mergestate(repo) |
|
4962 | ms = mergemod.mergestate(repo) | |
4949 |
|
4963 | |||
4950 | if not ms.active() and not show: |
|
4964 | if not ms.active() and not show: | |
4951 | raise util.Abort( |
|
4965 | raise util.Abort( | |
4952 | _('resolve command not applicable when not merging')) |
|
4966 | _('resolve command not applicable when not merging')) | |
4953 |
|
4967 | |||
4954 | m = scmutil.match(repo[None], pats, opts) |
|
4968 | m = scmutil.match(repo[None], pats, opts) | |
4955 | ret = 0 |
|
4969 | ret = 0 | |
4956 | didwork = False |
|
4970 | didwork = False | |
4957 |
|
4971 | |||
4958 | for f in ms: |
|
4972 | for f in ms: | |
4959 | if not m(f): |
|
4973 | if not m(f): | |
4960 | continue |
|
4974 | continue | |
4961 |
|
4975 | |||
4962 | didwork = True |
|
4976 | didwork = True | |
4963 |
|
4977 | |||
4964 | if show: |
|
4978 | if show: | |
4965 | if nostatus: |
|
4979 | if nostatus: | |
4966 | ui.write("%s\n" % f) |
|
4980 | ui.write("%s\n" % f) | |
4967 | else: |
|
4981 | else: | |
4968 | ui.write("%s %s\n" % (ms[f].upper(), f), |
|
4982 | ui.write("%s %s\n" % (ms[f].upper(), f), | |
4969 | label='resolve.' + |
|
4983 | label='resolve.' + | |
4970 | {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) |
|
4984 | {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) | |
4971 | elif mark: |
|
4985 | elif mark: | |
4972 | ms.mark(f, "r") |
|
4986 | ms.mark(f, "r") | |
4973 | elif unmark: |
|
4987 | elif unmark: | |
4974 | ms.mark(f, "u") |
|
4988 | ms.mark(f, "u") | |
4975 | else: |
|
4989 | else: | |
4976 | wctx = repo[None] |
|
4990 | wctx = repo[None] | |
4977 |
|
4991 | |||
4978 | # backup pre-resolve (merge uses .orig for its own purposes) |
|
4992 | # backup pre-resolve (merge uses .orig for its own purposes) | |
4979 | a = repo.wjoin(f) |
|
4993 | a = repo.wjoin(f) | |
4980 | util.copyfile(a, a + ".resolve") |
|
4994 | util.copyfile(a, a + ".resolve") | |
4981 |
|
4995 | |||
4982 | try: |
|
4996 | try: | |
4983 | # resolve file |
|
4997 | # resolve file | |
4984 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
4998 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
4985 | 'resolve') |
|
4999 | 'resolve') | |
4986 | if ms.resolve(f, wctx): |
|
5000 | if ms.resolve(f, wctx): | |
4987 | ret = 1 |
|
5001 | ret = 1 | |
4988 | finally: |
|
5002 | finally: | |
4989 | ui.setconfig('ui', 'forcemerge', '', 'resolve') |
|
5003 | ui.setconfig('ui', 'forcemerge', '', 'resolve') | |
4990 | ms.commit() |
|
5004 | ms.commit() | |
4991 |
|
5005 | |||
4992 | # replace filemerge's .orig file with our resolve file |
|
5006 | # replace filemerge's .orig file with our resolve file | |
4993 | util.rename(a + ".resolve", a + ".orig") |
|
5007 | util.rename(a + ".resolve", a + ".orig") | |
4994 |
|
5008 | |||
4995 | ms.commit() |
|
5009 | ms.commit() | |
4996 |
|
5010 | |||
4997 | if not didwork and pats: |
|
5011 | if not didwork and pats: | |
4998 | ui.warn(_("arguments do not match paths that need resolving\n")) |
|
5012 | ui.warn(_("arguments do not match paths that need resolving\n")) | |
4999 |
|
5013 | |||
5000 | finally: |
|
5014 | finally: | |
5001 | wlock.release() |
|
5015 | wlock.release() | |
5002 |
|
5016 | |||
5003 | # Nudge users into finishing an unfinished operation. We don't print |
|
5017 | # Nudge users into finishing an unfinished operation. We don't print | |
5004 | # this with the list/show operation because we want list/show to remain |
|
5018 | # this with the list/show operation because we want list/show to remain | |
5005 | # machine readable. |
|
5019 | # machine readable. | |
5006 | if not list(ms.unresolved()) and not show: |
|
5020 | if not list(ms.unresolved()) and not show: | |
5007 | ui.status(_('no more unresolved files\n')) |
|
5021 | ui.status(_('no more unresolved files\n')) | |
5008 |
|
5022 | |||
5009 | return ret |
|
5023 | return ret | |
5010 |
|
5024 | |||
5011 | @command('revert', |
|
5025 | @command('revert', | |
5012 | [('a', 'all', None, _('revert all changes when no arguments given')), |
|
5026 | [('a', 'all', None, _('revert all changes when no arguments given')), | |
5013 | ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), |
|
5027 | ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), | |
5014 | ('r', 'rev', '', _('revert to the specified revision'), _('REV')), |
|
5028 | ('r', 'rev', '', _('revert to the specified revision'), _('REV')), | |
5015 | ('C', 'no-backup', None, _('do not save backup copies of files')), |
|
5029 | ('C', 'no-backup', None, _('do not save backup copies of files')), | |
5016 | ] + walkopts + dryrunopts, |
|
5030 | ] + walkopts + dryrunopts, | |
5017 | _('[OPTION]... [-r REV] [NAME]...')) |
|
5031 | _('[OPTION]... [-r REV] [NAME]...')) | |
5018 | def revert(ui, repo, *pats, **opts): |
|
5032 | def revert(ui, repo, *pats, **opts): | |
5019 | """restore files to their checkout state |
|
5033 | """restore files to their checkout state | |
5020 |
|
5034 | |||
5021 | .. note:: |
|
5035 | .. note:: | |
5022 |
|
5036 | |||
5023 | To check out earlier revisions, you should use :hg:`update REV`. |
|
5037 | To check out earlier revisions, you should use :hg:`update REV`. | |
5024 | To cancel an uncommitted merge (and lose your changes), |
|
5038 | To cancel an uncommitted merge (and lose your changes), | |
5025 | use :hg:`update --clean .`. |
|
5039 | use :hg:`update --clean .`. | |
5026 |
|
5040 | |||
5027 | With no revision specified, revert the specified files or directories |
|
5041 | With no revision specified, revert the specified files or directories | |
5028 | to the contents they had in the parent of the working directory. |
|
5042 | to the contents they had in the parent of the working directory. | |
5029 | This restores the contents of files to an unmodified |
|
5043 | This restores the contents of files to an unmodified | |
5030 | state and unschedules adds, removes, copies, and renames. If the |
|
5044 | state and unschedules adds, removes, copies, and renames. If the | |
5031 | working directory has two parents, you must explicitly specify a |
|
5045 | working directory has two parents, you must explicitly specify a | |
5032 | revision. |
|
5046 | revision. | |
5033 |
|
5047 | |||
5034 | Using the -r/--rev or -d/--date options, revert the given files or |
|
5048 | Using the -r/--rev or -d/--date options, revert the given files or | |
5035 | directories to their states as of a specific revision. Because |
|
5049 | directories to their states as of a specific revision. Because | |
5036 | revert does not change the working directory parents, this will |
|
5050 | revert does not change the working directory parents, this will | |
5037 | cause these files to appear modified. This can be helpful to "back |
|
5051 | cause these files to appear modified. This can be helpful to "back | |
5038 | out" some or all of an earlier change. See :hg:`backout` for a |
|
5052 | out" some or all of an earlier change. See :hg:`backout` for a | |
5039 | related method. |
|
5053 | related method. | |
5040 |
|
5054 | |||
5041 | Modified files are saved with a .orig suffix before reverting. |
|
5055 | Modified files are saved with a .orig suffix before reverting. | |
5042 | To disable these backups, use --no-backup. |
|
5056 | To disable these backups, use --no-backup. | |
5043 |
|
5057 | |||
5044 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
5058 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
5045 |
|
5059 | |||
5046 | Returns 0 on success. |
|
5060 | Returns 0 on success. | |
5047 | """ |
|
5061 | """ | |
5048 |
|
5062 | |||
5049 | if opts.get("date"): |
|
5063 | if opts.get("date"): | |
5050 | if opts.get("rev"): |
|
5064 | if opts.get("rev"): | |
5051 | raise util.Abort(_("you can't specify a revision and a date")) |
|
5065 | raise util.Abort(_("you can't specify a revision and a date")) | |
5052 | opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) |
|
5066 | opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) | |
5053 |
|
5067 | |||
5054 | parent, p2 = repo.dirstate.parents() |
|
5068 | parent, p2 = repo.dirstate.parents() | |
5055 | if not opts.get('rev') and p2 != nullid: |
|
5069 | if not opts.get('rev') and p2 != nullid: | |
5056 | # revert after merge is a trap for new users (issue2915) |
|
5070 | # revert after merge is a trap for new users (issue2915) | |
5057 | raise util.Abort(_('uncommitted merge with no revision specified'), |
|
5071 | raise util.Abort(_('uncommitted merge with no revision specified'), | |
5058 | hint=_('use "hg update" or see "hg help revert"')) |
|
5072 | hint=_('use "hg update" or see "hg help revert"')) | |
5059 |
|
5073 | |||
5060 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
5074 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
5061 |
|
5075 | |||
5062 | if not pats and not opts.get('all'): |
|
5076 | if not pats and not opts.get('all'): | |
5063 | msg = _("no files or directories specified") |
|
5077 | msg = _("no files or directories specified") | |
5064 | if p2 != nullid: |
|
5078 | if p2 != nullid: | |
5065 | hint = _("uncommitted merge, use --all to discard all changes," |
|
5079 | hint = _("uncommitted merge, use --all to discard all changes," | |
5066 | " or 'hg update -C .' to abort the merge") |
|
5080 | " or 'hg update -C .' to abort the merge") | |
5067 | raise util.Abort(msg, hint=hint) |
|
5081 | raise util.Abort(msg, hint=hint) | |
5068 | dirty = util.any(repo.status()) |
|
5082 | dirty = util.any(repo.status()) | |
5069 | node = ctx.node() |
|
5083 | node = ctx.node() | |
5070 | if node != parent: |
|
5084 | if node != parent: | |
5071 | if dirty: |
|
5085 | if dirty: | |
5072 | hint = _("uncommitted changes, use --all to discard all" |
|
5086 | hint = _("uncommitted changes, use --all to discard all" | |
5073 | " changes, or 'hg update %s' to update") % ctx.rev() |
|
5087 | " changes, or 'hg update %s' to update") % ctx.rev() | |
5074 | else: |
|
5088 | else: | |
5075 | hint = _("use --all to revert all files," |
|
5089 | hint = _("use --all to revert all files," | |
5076 | " or 'hg update %s' to update") % ctx.rev() |
|
5090 | " or 'hg update %s' to update") % ctx.rev() | |
5077 | elif dirty: |
|
5091 | elif dirty: | |
5078 | hint = _("uncommitted changes, use --all to discard all changes") |
|
5092 | hint = _("uncommitted changes, use --all to discard all changes") | |
5079 | else: |
|
5093 | else: | |
5080 | hint = _("use --all to revert all files") |
|
5094 | hint = _("use --all to revert all files") | |
5081 | raise util.Abort(msg, hint=hint) |
|
5095 | raise util.Abort(msg, hint=hint) | |
5082 |
|
5096 | |||
5083 | return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) |
|
5097 | return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) | |
5084 |
|
5098 | |||
5085 | @command('rollback', dryrunopts + |
|
5099 | @command('rollback', dryrunopts + | |
5086 | [('f', 'force', False, _('ignore safety measures'))]) |
|
5100 | [('f', 'force', False, _('ignore safety measures'))]) | |
5087 | def rollback(ui, repo, **opts): |
|
5101 | def rollback(ui, repo, **opts): | |
5088 | """roll back the last transaction (DANGEROUS) (DEPRECATED) |
|
5102 | """roll back the last transaction (DANGEROUS) (DEPRECATED) | |
5089 |
|
5103 | |||
5090 | Please use :hg:`commit --amend` instead of rollback to correct |
|
5104 | Please use :hg:`commit --amend` instead of rollback to correct | |
5091 | mistakes in the last commit. |
|
5105 | mistakes in the last commit. | |
5092 |
|
5106 | |||
5093 | This command should be used with care. There is only one level of |
|
5107 | This command should be used with care. There is only one level of | |
5094 | rollback, and there is no way to undo a rollback. It will also |
|
5108 | rollback, and there is no way to undo a rollback. It will also | |
5095 | restore the dirstate at the time of the last transaction, losing |
|
5109 | restore the dirstate at the time of the last transaction, losing | |
5096 | any dirstate changes since that time. This command does not alter |
|
5110 | any dirstate changes since that time. This command does not alter | |
5097 | the working directory. |
|
5111 | the working directory. | |
5098 |
|
5112 | |||
5099 | Transactions are used to encapsulate the effects of all commands |
|
5113 | Transactions are used to encapsulate the effects of all commands | |
5100 | that create new changesets or propagate existing changesets into a |
|
5114 | that create new changesets or propagate existing changesets into a | |
5101 | repository. |
|
5115 | repository. | |
5102 |
|
5116 | |||
5103 | .. container:: verbose |
|
5117 | .. container:: verbose | |
5104 |
|
5118 | |||
5105 | For example, the following commands are transactional, and their |
|
5119 | For example, the following commands are transactional, and their | |
5106 | effects can be rolled back: |
|
5120 | effects can be rolled back: | |
5107 |
|
5121 | |||
5108 | - commit |
|
5122 | - commit | |
5109 | - import |
|
5123 | - import | |
5110 | - pull |
|
5124 | - pull | |
5111 | - push (with this repository as the destination) |
|
5125 | - push (with this repository as the destination) | |
5112 | - unbundle |
|
5126 | - unbundle | |
5113 |
|
5127 | |||
5114 | To avoid permanent data loss, rollback will refuse to rollback a |
|
5128 | To avoid permanent data loss, rollback will refuse to rollback a | |
5115 | commit transaction if it isn't checked out. Use --force to |
|
5129 | commit transaction if it isn't checked out. Use --force to | |
5116 | override this protection. |
|
5130 | override this protection. | |
5117 |
|
5131 | |||
5118 | This command is not intended for use on public repositories. Once |
|
5132 | This command is not intended for use on public repositories. Once | |
5119 | changes are visible for pull by other users, rolling a transaction |
|
5133 | changes are visible for pull by other users, rolling a transaction | |
5120 | back locally is ineffective (someone else may already have pulled |
|
5134 | back locally is ineffective (someone else may already have pulled | |
5121 | the changes). Furthermore, a race is possible with readers of the |
|
5135 | the changes). Furthermore, a race is possible with readers of the | |
5122 | repository; for example an in-progress pull from the repository |
|
5136 | repository; for example an in-progress pull from the repository | |
5123 | may fail if a rollback is performed. |
|
5137 | may fail if a rollback is performed. | |
5124 |
|
5138 | |||
5125 | Returns 0 on success, 1 if no rollback data is available. |
|
5139 | Returns 0 on success, 1 if no rollback data is available. | |
5126 | """ |
|
5140 | """ | |
5127 | return repo.rollback(dryrun=opts.get('dry_run'), |
|
5141 | return repo.rollback(dryrun=opts.get('dry_run'), | |
5128 | force=opts.get('force')) |
|
5142 | force=opts.get('force')) | |
5129 |
|
5143 | |||
5130 | @command('root', []) |
|
5144 | @command('root', []) | |
5131 | def root(ui, repo): |
|
5145 | def root(ui, repo): | |
5132 | """print the root (top) of the current working directory |
|
5146 | """print the root (top) of the current working directory | |
5133 |
|
5147 | |||
5134 | Print the root directory of the current repository. |
|
5148 | Print the root directory of the current repository. | |
5135 |
|
5149 | |||
5136 | Returns 0 on success. |
|
5150 | Returns 0 on success. | |
5137 | """ |
|
5151 | """ | |
5138 | ui.write(repo.root + "\n") |
|
5152 | ui.write(repo.root + "\n") | |
5139 |
|
5153 | |||
5140 | @command('^serve', |
|
5154 | @command('^serve', | |
5141 | [('A', 'accesslog', '', _('name of access log file to write to'), |
|
5155 | [('A', 'accesslog', '', _('name of access log file to write to'), | |
5142 | _('FILE')), |
|
5156 | _('FILE')), | |
5143 | ('d', 'daemon', None, _('run server in background')), |
|
5157 | ('d', 'daemon', None, _('run server in background')), | |
5144 | ('', 'daemon-pipefds', '', _('used internally by daemon mode'), _('NUM')), |
|
5158 | ('', 'daemon-pipefds', '', _('used internally by daemon mode'), _('NUM')), | |
5145 | ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')), |
|
5159 | ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')), | |
5146 | # use string type, then we can check if something was passed |
|
5160 | # use string type, then we can check if something was passed | |
5147 | ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')), |
|
5161 | ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')), | |
5148 | ('a', 'address', '', _('address to listen on (default: all interfaces)'), |
|
5162 | ('a', 'address', '', _('address to listen on (default: all interfaces)'), | |
5149 | _('ADDR')), |
|
5163 | _('ADDR')), | |
5150 | ('', 'prefix', '', _('prefix path to serve from (default: server root)'), |
|
5164 | ('', 'prefix', '', _('prefix path to serve from (default: server root)'), | |
5151 | _('PREFIX')), |
|
5165 | _('PREFIX')), | |
5152 | ('n', 'name', '', |
|
5166 | ('n', 'name', '', | |
5153 | _('name to show in web pages (default: working directory)'), _('NAME')), |
|
5167 | _('name to show in web pages (default: working directory)'), _('NAME')), | |
5154 | ('', 'web-conf', '', |
|
5168 | ('', 'web-conf', '', | |
5155 | _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')), |
|
5169 | _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')), | |
5156 | ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'), |
|
5170 | ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'), | |
5157 | _('FILE')), |
|
5171 | _('FILE')), | |
5158 | ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')), |
|
5172 | ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')), | |
5159 | ('', 'stdio', None, _('for remote clients')), |
|
5173 | ('', 'stdio', None, _('for remote clients')), | |
5160 | ('', 'cmdserver', '', _('for remote clients'), _('MODE')), |
|
5174 | ('', 'cmdserver', '', _('for remote clients'), _('MODE')), | |
5161 | ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), |
|
5175 | ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), | |
5162 | ('', 'style', '', _('template style to use'), _('STYLE')), |
|
5176 | ('', 'style', '', _('template style to use'), _('STYLE')), | |
5163 | ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), |
|
5177 | ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), | |
5164 | ('', 'certificate', '', _('SSL certificate file'), _('FILE'))], |
|
5178 | ('', 'certificate', '', _('SSL certificate file'), _('FILE'))], | |
5165 | _('[OPTION]...')) |
|
5179 | _('[OPTION]...')) | |
5166 | def serve(ui, repo, **opts): |
|
5180 | def serve(ui, repo, **opts): | |
5167 | """start stand-alone webserver |
|
5181 | """start stand-alone webserver | |
5168 |
|
5182 | |||
5169 | Start a local HTTP repository browser and pull server. You can use |
|
5183 | Start a local HTTP repository browser and pull server. You can use | |
5170 | this for ad-hoc sharing and browsing of repositories. It is |
|
5184 | this for ad-hoc sharing and browsing of repositories. It is | |
5171 | recommended to use a real web server to serve a repository for |
|
5185 | recommended to use a real web server to serve a repository for | |
5172 | longer periods of time. |
|
5186 | longer periods of time. | |
5173 |
|
5187 | |||
5174 | Please note that the server does not implement access control. |
|
5188 | Please note that the server does not implement access control. | |
5175 | This means that, by default, anybody can read from the server and |
|
5189 | This means that, by default, anybody can read from the server and | |
5176 | nobody can write to it by default. Set the ``web.allow_push`` |
|
5190 | nobody can write to it by default. Set the ``web.allow_push`` | |
5177 | option to ``*`` to allow everybody to push to the server. You |
|
5191 | option to ``*`` to allow everybody to push to the server. You | |
5178 | should use a real web server if you need to authenticate users. |
|
5192 | should use a real web server if you need to authenticate users. | |
5179 |
|
5193 | |||
5180 | By default, the server logs accesses to stdout and errors to |
|
5194 | By default, the server logs accesses to stdout and errors to | |
5181 | stderr. Use the -A/--accesslog and -E/--errorlog options to log to |
|
5195 | stderr. Use the -A/--accesslog and -E/--errorlog options to log to | |
5182 | files. |
|
5196 | files. | |
5183 |
|
5197 | |||
5184 | To have the server choose a free port number to listen on, specify |
|
5198 | To have the server choose a free port number to listen on, specify | |
5185 | a port number of 0; in this case, the server will print the port |
|
5199 | a port number of 0; in this case, the server will print the port | |
5186 | number it uses. |
|
5200 | number it uses. | |
5187 |
|
5201 | |||
5188 | Returns 0 on success. |
|
5202 | Returns 0 on success. | |
5189 | """ |
|
5203 | """ | |
5190 |
|
5204 | |||
5191 | if opts["stdio"] and opts["cmdserver"]: |
|
5205 | if opts["stdio"] and opts["cmdserver"]: | |
5192 | raise util.Abort(_("cannot use --stdio with --cmdserver")) |
|
5206 | raise util.Abort(_("cannot use --stdio with --cmdserver")) | |
5193 |
|
5207 | |||
5194 | def checkrepo(): |
|
5208 | def checkrepo(): | |
5195 | if repo is None: |
|
5209 | if repo is None: | |
5196 | raise error.RepoError(_("there is no Mercurial repository here" |
|
5210 | raise error.RepoError(_("there is no Mercurial repository here" | |
5197 | " (.hg not found)")) |
|
5211 | " (.hg not found)")) | |
5198 |
|
5212 | |||
5199 | if opts["stdio"]: |
|
5213 | if opts["stdio"]: | |
5200 | checkrepo() |
|
5214 | checkrepo() | |
5201 | s = sshserver.sshserver(ui, repo) |
|
5215 | s = sshserver.sshserver(ui, repo) | |
5202 | s.serve_forever() |
|
5216 | s.serve_forever() | |
5203 |
|
5217 | |||
5204 | if opts["cmdserver"]: |
|
5218 | if opts["cmdserver"]: | |
5205 | s = commandserver.server(ui, repo, opts["cmdserver"]) |
|
5219 | s = commandserver.server(ui, repo, opts["cmdserver"]) | |
5206 | return s.serve() |
|
5220 | return s.serve() | |
5207 |
|
5221 | |||
5208 | # this way we can check if something was given in the command-line |
|
5222 | # this way we can check if something was given in the command-line | |
5209 | if opts.get('port'): |
|
5223 | if opts.get('port'): | |
5210 | opts['port'] = util.getport(opts.get('port')) |
|
5224 | opts['port'] = util.getport(opts.get('port')) | |
5211 |
|
5225 | |||
5212 | baseui = repo and repo.baseui or ui |
|
5226 | baseui = repo and repo.baseui or ui | |
5213 | optlist = ("name templates style address port prefix ipv6" |
|
5227 | optlist = ("name templates style address port prefix ipv6" | |
5214 | " accesslog errorlog certificate encoding") |
|
5228 | " accesslog errorlog certificate encoding") | |
5215 | for o in optlist.split(): |
|
5229 | for o in optlist.split(): | |
5216 | val = opts.get(o, '') |
|
5230 | val = opts.get(o, '') | |
5217 | if val in (None, ''): # should check against default options instead |
|
5231 | if val in (None, ''): # should check against default options instead | |
5218 | continue |
|
5232 | continue | |
5219 | baseui.setconfig("web", o, val, 'serve') |
|
5233 | baseui.setconfig("web", o, val, 'serve') | |
5220 | if repo and repo.ui != baseui: |
|
5234 | if repo and repo.ui != baseui: | |
5221 | repo.ui.setconfig("web", o, val, 'serve') |
|
5235 | repo.ui.setconfig("web", o, val, 'serve') | |
5222 |
|
5236 | |||
5223 | o = opts.get('web_conf') or opts.get('webdir_conf') |
|
5237 | o = opts.get('web_conf') or opts.get('webdir_conf') | |
5224 | if not o: |
|
5238 | if not o: | |
5225 | if not repo: |
|
5239 | if not repo: | |
5226 | raise error.RepoError(_("there is no Mercurial repository" |
|
5240 | raise error.RepoError(_("there is no Mercurial repository" | |
5227 | " here (.hg not found)")) |
|
5241 | " here (.hg not found)")) | |
5228 | o = repo |
|
5242 | o = repo | |
5229 |
|
5243 | |||
5230 | app = hgweb.hgweb(o, baseui=baseui) |
|
5244 | app = hgweb.hgweb(o, baseui=baseui) | |
5231 | service = httpservice(ui, app, opts) |
|
5245 | service = httpservice(ui, app, opts) | |
5232 | cmdutil.service(opts, initfn=service.init, runfn=service.run) |
|
5246 | cmdutil.service(opts, initfn=service.init, runfn=service.run) | |
5233 |
|
5247 | |||
5234 | class httpservice(object): |
|
5248 | class httpservice(object): | |
5235 | def __init__(self, ui, app, opts): |
|
5249 | def __init__(self, ui, app, opts): | |
5236 | self.ui = ui |
|
5250 | self.ui = ui | |
5237 | self.app = app |
|
5251 | self.app = app | |
5238 | self.opts = opts |
|
5252 | self.opts = opts | |
5239 |
|
5253 | |||
5240 | def init(self): |
|
5254 | def init(self): | |
5241 | util.setsignalhandler() |
|
5255 | util.setsignalhandler() | |
5242 | self.httpd = hgweb_server.create_server(self.ui, self.app) |
|
5256 | self.httpd = hgweb_server.create_server(self.ui, self.app) | |
5243 |
|
5257 | |||
5244 | if self.opts['port'] and not self.ui.verbose: |
|
5258 | if self.opts['port'] and not self.ui.verbose: | |
5245 | return |
|
5259 | return | |
5246 |
|
5260 | |||
5247 | if self.httpd.prefix: |
|
5261 | if self.httpd.prefix: | |
5248 | prefix = self.httpd.prefix.strip('/') + '/' |
|
5262 | prefix = self.httpd.prefix.strip('/') + '/' | |
5249 | else: |
|
5263 | else: | |
5250 | prefix = '' |
|
5264 | prefix = '' | |
5251 |
|
5265 | |||
5252 | port = ':%d' % self.httpd.port |
|
5266 | port = ':%d' % self.httpd.port | |
5253 | if port == ':80': |
|
5267 | if port == ':80': | |
5254 | port = '' |
|
5268 | port = '' | |
5255 |
|
5269 | |||
5256 | bindaddr = self.httpd.addr |
|
5270 | bindaddr = self.httpd.addr | |
5257 | if bindaddr == '0.0.0.0': |
|
5271 | if bindaddr == '0.0.0.0': | |
5258 | bindaddr = '*' |
|
5272 | bindaddr = '*' | |
5259 | elif ':' in bindaddr: # IPv6 |
|
5273 | elif ':' in bindaddr: # IPv6 | |
5260 | bindaddr = '[%s]' % bindaddr |
|
5274 | bindaddr = '[%s]' % bindaddr | |
5261 |
|
5275 | |||
5262 | fqaddr = self.httpd.fqaddr |
|
5276 | fqaddr = self.httpd.fqaddr | |
5263 | if ':' in fqaddr: |
|
5277 | if ':' in fqaddr: | |
5264 | fqaddr = '[%s]' % fqaddr |
|
5278 | fqaddr = '[%s]' % fqaddr | |
5265 | if self.opts['port']: |
|
5279 | if self.opts['port']: | |
5266 | write = self.ui.status |
|
5280 | write = self.ui.status | |
5267 | else: |
|
5281 | else: | |
5268 | write = self.ui.write |
|
5282 | write = self.ui.write | |
5269 | write(_('listening at http://%s%s/%s (bound to %s:%d)\n') % |
|
5283 | write(_('listening at http://%s%s/%s (bound to %s:%d)\n') % | |
5270 | (fqaddr, port, prefix, bindaddr, self.httpd.port)) |
|
5284 | (fqaddr, port, prefix, bindaddr, self.httpd.port)) | |
5271 |
|
5285 | |||
5272 | def run(self): |
|
5286 | def run(self): | |
5273 | self.httpd.serve_forever() |
|
5287 | self.httpd.serve_forever() | |
5274 |
|
5288 | |||
5275 |
|
5289 | |||
5276 | @command('^status|st', |
|
5290 | @command('^status|st', | |
5277 | [('A', 'all', None, _('show status of all files')), |
|
5291 | [('A', 'all', None, _('show status of all files')), | |
5278 | ('m', 'modified', None, _('show only modified files')), |
|
5292 | ('m', 'modified', None, _('show only modified files')), | |
5279 | ('a', 'added', None, _('show only added files')), |
|
5293 | ('a', 'added', None, _('show only added files')), | |
5280 | ('r', 'removed', None, _('show only removed files')), |
|
5294 | ('r', 'removed', None, _('show only removed files')), | |
5281 | ('d', 'deleted', None, _('show only deleted (but tracked) files')), |
|
5295 | ('d', 'deleted', None, _('show only deleted (but tracked) files')), | |
5282 | ('c', 'clean', None, _('show only files without changes')), |
|
5296 | ('c', 'clean', None, _('show only files without changes')), | |
5283 | ('u', 'unknown', None, _('show only unknown (not tracked) files')), |
|
5297 | ('u', 'unknown', None, _('show only unknown (not tracked) files')), | |
5284 | ('i', 'ignored', None, _('show only ignored files')), |
|
5298 | ('i', 'ignored', None, _('show only ignored files')), | |
5285 | ('n', 'no-status', None, _('hide status prefix')), |
|
5299 | ('n', 'no-status', None, _('hide status prefix')), | |
5286 | ('C', 'copies', None, _('show source of copied files')), |
|
5300 | ('C', 'copies', None, _('show source of copied files')), | |
5287 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
|
5301 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), | |
5288 | ('', 'rev', [], _('show difference from revision'), _('REV')), |
|
5302 | ('', 'rev', [], _('show difference from revision'), _('REV')), | |
5289 | ('', 'change', '', _('list the changed files of a revision'), _('REV')), |
|
5303 | ('', 'change', '', _('list the changed files of a revision'), _('REV')), | |
5290 | ] + walkopts + subrepoopts, |
|
5304 | ] + walkopts + subrepoopts, | |
5291 | _('[OPTION]... [FILE]...')) |
|
5305 | _('[OPTION]... [FILE]...')) | |
5292 | def status(ui, repo, *pats, **opts): |
|
5306 | def status(ui, repo, *pats, **opts): | |
5293 | """show changed files in the working directory |
|
5307 | """show changed files in the working directory | |
5294 |
|
5308 | |||
5295 | Show status of files in the repository. If names are given, only |
|
5309 | Show status of files in the repository. If names are given, only | |
5296 | files that match are shown. Files that are clean or ignored or |
|
5310 | files that match are shown. Files that are clean or ignored or | |
5297 | the source of a copy/move operation, are not listed unless |
|
5311 | the source of a copy/move operation, are not listed unless | |
5298 | -c/--clean, -i/--ignored, -C/--copies or -A/--all are given. |
|
5312 | -c/--clean, -i/--ignored, -C/--copies or -A/--all are given. | |
5299 | Unless options described with "show only ..." are given, the |
|
5313 | Unless options described with "show only ..." are given, the | |
5300 | options -mardu are used. |
|
5314 | options -mardu are used. | |
5301 |
|
5315 | |||
5302 | Option -q/--quiet hides untracked (unknown and ignored) files |
|
5316 | Option -q/--quiet hides untracked (unknown and ignored) files | |
5303 | unless explicitly requested with -u/--unknown or -i/--ignored. |
|
5317 | unless explicitly requested with -u/--unknown or -i/--ignored. | |
5304 |
|
5318 | |||
5305 | .. note:: |
|
5319 | .. note:: | |
5306 |
|
5320 | |||
5307 | status may appear to disagree with diff if permissions have |
|
5321 | status may appear to disagree with diff if permissions have | |
5308 | changed or a merge has occurred. The standard diff format does |
|
5322 | changed or a merge has occurred. The standard diff format does | |
5309 | not report permission changes and diff only reports changes |
|
5323 | not report permission changes and diff only reports changes | |
5310 | relative to one merge parent. |
|
5324 | relative to one merge parent. | |
5311 |
|
5325 | |||
5312 | If one revision is given, it is used as the base revision. |
|
5326 | If one revision is given, it is used as the base revision. | |
5313 | If two revisions are given, the differences between them are |
|
5327 | If two revisions are given, the differences between them are | |
5314 | shown. The --change option can also be used as a shortcut to list |
|
5328 | shown. The --change option can also be used as a shortcut to list | |
5315 | the changed files of a revision from its first parent. |
|
5329 | the changed files of a revision from its first parent. | |
5316 |
|
5330 | |||
5317 | The codes used to show the status of files are:: |
|
5331 | The codes used to show the status of files are:: | |
5318 |
|
5332 | |||
5319 | M = modified |
|
5333 | M = modified | |
5320 | A = added |
|
5334 | A = added | |
5321 | R = removed |
|
5335 | R = removed | |
5322 | C = clean |
|
5336 | C = clean | |
5323 | ! = missing (deleted by non-hg command, but still tracked) |
|
5337 | ! = missing (deleted by non-hg command, but still tracked) | |
5324 | ? = not tracked |
|
5338 | ? = not tracked | |
5325 | I = ignored |
|
5339 | I = ignored | |
5326 | = origin of the previous file (with --copies) |
|
5340 | = origin of the previous file (with --copies) | |
5327 |
|
5341 | |||
5328 | .. container:: verbose |
|
5342 | .. container:: verbose | |
5329 |
|
5343 | |||
5330 | Examples: |
|
5344 | Examples: | |
5331 |
|
5345 | |||
5332 | - show changes in the working directory relative to a |
|
5346 | - show changes in the working directory relative to a | |
5333 | changeset:: |
|
5347 | changeset:: | |
5334 |
|
5348 | |||
5335 | hg status --rev 9353 |
|
5349 | hg status --rev 9353 | |
5336 |
|
5350 | |||
5337 | - show all changes including copies in an existing changeset:: |
|
5351 | - show all changes including copies in an existing changeset:: | |
5338 |
|
5352 | |||
5339 | hg status --copies --change 9353 |
|
5353 | hg status --copies --change 9353 | |
5340 |
|
5354 | |||
5341 | - get a NUL separated list of added files, suitable for xargs:: |
|
5355 | - get a NUL separated list of added files, suitable for xargs:: | |
5342 |
|
5356 | |||
5343 | hg status -an0 |
|
5357 | hg status -an0 | |
5344 |
|
5358 | |||
5345 | Returns 0 on success. |
|
5359 | Returns 0 on success. | |
5346 | """ |
|
5360 | """ | |
5347 |
|
5361 | |||
5348 | revs = opts.get('rev') |
|
5362 | revs = opts.get('rev') | |
5349 | change = opts.get('change') |
|
5363 | change = opts.get('change') | |
5350 |
|
5364 | |||
5351 | if revs and change: |
|
5365 | if revs and change: | |
5352 | msg = _('cannot specify --rev and --change at the same time') |
|
5366 | msg = _('cannot specify --rev and --change at the same time') | |
5353 | raise util.Abort(msg) |
|
5367 | raise util.Abort(msg) | |
5354 | elif change: |
|
5368 | elif change: | |
5355 | node2 = scmutil.revsingle(repo, change, None).node() |
|
5369 | node2 = scmutil.revsingle(repo, change, None).node() | |
5356 | node1 = repo[node2].p1().node() |
|
5370 | node1 = repo[node2].p1().node() | |
5357 | else: |
|
5371 | else: | |
5358 | node1, node2 = scmutil.revpair(repo, revs) |
|
5372 | node1, node2 = scmutil.revpair(repo, revs) | |
5359 |
|
5373 | |||
5360 | cwd = (pats and repo.getcwd()) or '' |
|
5374 | cwd = (pats and repo.getcwd()) or '' | |
5361 | end = opts.get('print0') and '\0' or '\n' |
|
5375 | end = opts.get('print0') and '\0' or '\n' | |
5362 | copy = {} |
|
5376 | copy = {} | |
5363 | states = 'modified added removed deleted unknown ignored clean'.split() |
|
5377 | states = 'modified added removed deleted unknown ignored clean'.split() | |
5364 | show = [k for k in states if opts.get(k)] |
|
5378 | show = [k for k in states if opts.get(k)] | |
5365 | if opts.get('all'): |
|
5379 | if opts.get('all'): | |
5366 | show += ui.quiet and (states[:4] + ['clean']) or states |
|
5380 | show += ui.quiet and (states[:4] + ['clean']) or states | |
5367 | if not show: |
|
5381 | if not show: | |
5368 | show = ui.quiet and states[:4] or states[:5] |
|
5382 | show = ui.quiet and states[:4] or states[:5] | |
5369 |
|
5383 | |||
5370 | stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts), |
|
5384 | stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts), | |
5371 | 'ignored' in show, 'clean' in show, 'unknown' in show, |
|
5385 | 'ignored' in show, 'clean' in show, 'unknown' in show, | |
5372 | opts.get('subrepos')) |
|
5386 | opts.get('subrepos')) | |
5373 | changestates = zip(states, 'MAR!?IC', stat) |
|
5387 | changestates = zip(states, 'MAR!?IC', stat) | |
5374 |
|
5388 | |||
5375 | if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'): |
|
5389 | if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'): | |
5376 | copy = copies.pathcopies(repo[node1], repo[node2]) |
|
5390 | copy = copies.pathcopies(repo[node1], repo[node2]) | |
5377 |
|
5391 | |||
5378 | fm = ui.formatter('status', opts) |
|
5392 | fm = ui.formatter('status', opts) | |
5379 | fmt = '%s' + end |
|
5393 | fmt = '%s' + end | |
5380 | showchar = not opts.get('no_status') |
|
5394 | showchar = not opts.get('no_status') | |
5381 |
|
5395 | |||
5382 | for state, char, files in changestates: |
|
5396 | for state, char, files in changestates: | |
5383 | if state in show: |
|
5397 | if state in show: | |
5384 | label = 'status.' + state |
|
5398 | label = 'status.' + state | |
5385 | for f in files: |
|
5399 | for f in files: | |
5386 | fm.startitem() |
|
5400 | fm.startitem() | |
5387 | fm.condwrite(showchar, 'status', '%s ', char, label=label) |
|
5401 | fm.condwrite(showchar, 'status', '%s ', char, label=label) | |
5388 | fm.write('path', fmt, repo.pathto(f, cwd), label=label) |
|
5402 | fm.write('path', fmt, repo.pathto(f, cwd), label=label) | |
5389 | if f in copy: |
|
5403 | if f in copy: | |
5390 | fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd), |
|
5404 | fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd), | |
5391 | label='status.copied') |
|
5405 | label='status.copied') | |
5392 | fm.end() |
|
5406 | fm.end() | |
5393 |
|
5407 | |||
5394 | @command('^summary|sum', |
|
5408 | @command('^summary|sum', | |
5395 | [('', 'remote', None, _('check for push and pull'))], '[--remote]') |
|
5409 | [('', 'remote', None, _('check for push and pull'))], '[--remote]') | |
5396 | def summary(ui, repo, **opts): |
|
5410 | def summary(ui, repo, **opts): | |
5397 | """summarize working directory state |
|
5411 | """summarize working directory state | |
5398 |
|
5412 | |||
5399 | This generates a brief summary of the working directory state, |
|
5413 | This generates a brief summary of the working directory state, | |
5400 | including parents, branch, commit status, and available updates. |
|
5414 | including parents, branch, commit status, and available updates. | |
5401 |
|
5415 | |||
5402 | With the --remote option, this will check the default paths for |
|
5416 | With the --remote option, this will check the default paths for | |
5403 | incoming and outgoing changes. This can be time-consuming. |
|
5417 | incoming and outgoing changes. This can be time-consuming. | |
5404 |
|
5418 | |||
5405 | Returns 0 on success. |
|
5419 | Returns 0 on success. | |
5406 | """ |
|
5420 | """ | |
5407 |
|
5421 | |||
5408 | ctx = repo[None] |
|
5422 | ctx = repo[None] | |
5409 | parents = ctx.parents() |
|
5423 | parents = ctx.parents() | |
5410 | pnode = parents[0].node() |
|
5424 | pnode = parents[0].node() | |
5411 | marks = [] |
|
5425 | marks = [] | |
5412 |
|
5426 | |||
5413 | for p in parents: |
|
5427 | for p in parents: | |
5414 | # label with log.changeset (instead of log.parent) since this |
|
5428 | # label with log.changeset (instead of log.parent) since this | |
5415 | # shows a working directory parent *changeset*: |
|
5429 | # shows a working directory parent *changeset*: | |
5416 | # i18n: column positioning for "hg summary" |
|
5430 | # i18n: column positioning for "hg summary" | |
5417 | ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), |
|
5431 | ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), | |
5418 | label='log.changeset changeset.%s' % p.phasestr()) |
|
5432 | label='log.changeset changeset.%s' % p.phasestr()) | |
5419 | ui.write(' '.join(p.tags()), label='log.tag') |
|
5433 | ui.write(' '.join(p.tags()), label='log.tag') | |
5420 | if p.bookmarks(): |
|
5434 | if p.bookmarks(): | |
5421 | marks.extend(p.bookmarks()) |
|
5435 | marks.extend(p.bookmarks()) | |
5422 | if p.rev() == -1: |
|
5436 | if p.rev() == -1: | |
5423 | if not len(repo): |
|
5437 | if not len(repo): | |
5424 | ui.write(_(' (empty repository)')) |
|
5438 | ui.write(_(' (empty repository)')) | |
5425 | else: |
|
5439 | else: | |
5426 | ui.write(_(' (no revision checked out)')) |
|
5440 | ui.write(_(' (no revision checked out)')) | |
5427 | ui.write('\n') |
|
5441 | ui.write('\n') | |
5428 | if p.description(): |
|
5442 | if p.description(): | |
5429 | ui.status(' ' + p.description().splitlines()[0].strip() + '\n', |
|
5443 | ui.status(' ' + p.description().splitlines()[0].strip() + '\n', | |
5430 | label='log.summary') |
|
5444 | label='log.summary') | |
5431 |
|
5445 | |||
5432 | branch = ctx.branch() |
|
5446 | branch = ctx.branch() | |
5433 | bheads = repo.branchheads(branch) |
|
5447 | bheads = repo.branchheads(branch) | |
5434 | # i18n: column positioning for "hg summary" |
|
5448 | # i18n: column positioning for "hg summary" | |
5435 | m = _('branch: %s\n') % branch |
|
5449 | m = _('branch: %s\n') % branch | |
5436 | if branch != 'default': |
|
5450 | if branch != 'default': | |
5437 | ui.write(m, label='log.branch') |
|
5451 | ui.write(m, label='log.branch') | |
5438 | else: |
|
5452 | else: | |
5439 | ui.status(m, label='log.branch') |
|
5453 | ui.status(m, label='log.branch') | |
5440 |
|
5454 | |||
5441 | if marks: |
|
5455 | if marks: | |
5442 | current = repo._bookmarkcurrent |
|
5456 | current = repo._bookmarkcurrent | |
5443 | # i18n: column positioning for "hg summary" |
|
5457 | # i18n: column positioning for "hg summary" | |
5444 | ui.write(_('bookmarks:'), label='log.bookmark') |
|
5458 | ui.write(_('bookmarks:'), label='log.bookmark') | |
5445 | if current is not None: |
|
5459 | if current is not None: | |
5446 | if current in marks: |
|
5460 | if current in marks: | |
5447 | ui.write(' *' + current, label='bookmarks.current') |
|
5461 | ui.write(' *' + current, label='bookmarks.current') | |
5448 | marks.remove(current) |
|
5462 | marks.remove(current) | |
5449 | else: |
|
5463 | else: | |
5450 | ui.write(' [%s]' % current, label='bookmarks.current') |
|
5464 | ui.write(' [%s]' % current, label='bookmarks.current') | |
5451 | for m in marks: |
|
5465 | for m in marks: | |
5452 | ui.write(' ' + m, label='log.bookmark') |
|
5466 | ui.write(' ' + m, label='log.bookmark') | |
5453 | ui.write('\n', label='log.bookmark') |
|
5467 | ui.write('\n', label='log.bookmark') | |
5454 |
|
5468 | |||
5455 | st = list(repo.status(unknown=True))[:6] |
|
5469 | st = list(repo.status(unknown=True))[:6] | |
5456 |
|
5470 | |||
5457 | c = repo.dirstate.copies() |
|
5471 | c = repo.dirstate.copies() | |
5458 | copied, renamed = [], [] |
|
5472 | copied, renamed = [], [] | |
5459 | for d, s in c.iteritems(): |
|
5473 | for d, s in c.iteritems(): | |
5460 | if s in st[2]: |
|
5474 | if s in st[2]: | |
5461 | st[2].remove(s) |
|
5475 | st[2].remove(s) | |
5462 | renamed.append(d) |
|
5476 | renamed.append(d) | |
5463 | else: |
|
5477 | else: | |
5464 | copied.append(d) |
|
5478 | copied.append(d) | |
5465 | if d in st[1]: |
|
5479 | if d in st[1]: | |
5466 | st[1].remove(d) |
|
5480 | st[1].remove(d) | |
5467 | st.insert(3, renamed) |
|
5481 | st.insert(3, renamed) | |
5468 | st.insert(4, copied) |
|
5482 | st.insert(4, copied) | |
5469 |
|
5483 | |||
5470 | ms = mergemod.mergestate(repo) |
|
5484 | ms = mergemod.mergestate(repo) | |
5471 | st.append([f for f in ms if ms[f] == 'u']) |
|
5485 | st.append([f for f in ms if ms[f] == 'u']) | |
5472 |
|
5486 | |||
5473 | subs = [s for s in ctx.substate if ctx.sub(s).dirty()] |
|
5487 | subs = [s for s in ctx.substate if ctx.sub(s).dirty()] | |
5474 | st.append(subs) |
|
5488 | st.append(subs) | |
5475 |
|
5489 | |||
5476 | labels = [ui.label(_('%d modified'), 'status.modified'), |
|
5490 | labels = [ui.label(_('%d modified'), 'status.modified'), | |
5477 | ui.label(_('%d added'), 'status.added'), |
|
5491 | ui.label(_('%d added'), 'status.added'), | |
5478 | ui.label(_('%d removed'), 'status.removed'), |
|
5492 | ui.label(_('%d removed'), 'status.removed'), | |
5479 | ui.label(_('%d renamed'), 'status.copied'), |
|
5493 | ui.label(_('%d renamed'), 'status.copied'), | |
5480 | ui.label(_('%d copied'), 'status.copied'), |
|
5494 | ui.label(_('%d copied'), 'status.copied'), | |
5481 | ui.label(_('%d deleted'), 'status.deleted'), |
|
5495 | ui.label(_('%d deleted'), 'status.deleted'), | |
5482 | ui.label(_('%d unknown'), 'status.unknown'), |
|
5496 | ui.label(_('%d unknown'), 'status.unknown'), | |
5483 | ui.label(_('%d ignored'), 'status.ignored'), |
|
5497 | ui.label(_('%d ignored'), 'status.ignored'), | |
5484 | ui.label(_('%d unresolved'), 'resolve.unresolved'), |
|
5498 | ui.label(_('%d unresolved'), 'resolve.unresolved'), | |
5485 | ui.label(_('%d subrepos'), 'status.modified')] |
|
5499 | ui.label(_('%d subrepos'), 'status.modified')] | |
5486 | t = [] |
|
5500 | t = [] | |
5487 | for s, l in zip(st, labels): |
|
5501 | for s, l in zip(st, labels): | |
5488 | if s: |
|
5502 | if s: | |
5489 | t.append(l % len(s)) |
|
5503 | t.append(l % len(s)) | |
5490 |
|
5504 | |||
5491 | t = ', '.join(t) |
|
5505 | t = ', '.join(t) | |
5492 | cleanworkdir = False |
|
5506 | cleanworkdir = False | |
5493 |
|
5507 | |||
5494 | if repo.vfs.exists('updatestate'): |
|
5508 | if repo.vfs.exists('updatestate'): | |
5495 | t += _(' (interrupted update)') |
|
5509 | t += _(' (interrupted update)') | |
5496 | elif len(parents) > 1: |
|
5510 | elif len(parents) > 1: | |
5497 | t += _(' (merge)') |
|
5511 | t += _(' (merge)') | |
5498 | elif branch != parents[0].branch(): |
|
5512 | elif branch != parents[0].branch(): | |
5499 | t += _(' (new branch)') |
|
5513 | t += _(' (new branch)') | |
5500 | elif (parents[0].closesbranch() and |
|
5514 | elif (parents[0].closesbranch() and | |
5501 | pnode in repo.branchheads(branch, closed=True)): |
|
5515 | pnode in repo.branchheads(branch, closed=True)): | |
5502 | t += _(' (head closed)') |
|
5516 | t += _(' (head closed)') | |
5503 | elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]): |
|
5517 | elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]): | |
5504 | t += _(' (clean)') |
|
5518 | t += _(' (clean)') | |
5505 | cleanworkdir = True |
|
5519 | cleanworkdir = True | |
5506 | elif pnode not in bheads: |
|
5520 | elif pnode not in bheads: | |
5507 | t += _(' (new branch head)') |
|
5521 | t += _(' (new branch head)') | |
5508 |
|
5522 | |||
5509 | if cleanworkdir: |
|
5523 | if cleanworkdir: | |
5510 | # i18n: column positioning for "hg summary" |
|
5524 | # i18n: column positioning for "hg summary" | |
5511 | ui.status(_('commit: %s\n') % t.strip()) |
|
5525 | ui.status(_('commit: %s\n') % t.strip()) | |
5512 | else: |
|
5526 | else: | |
5513 | # i18n: column positioning for "hg summary" |
|
5527 | # i18n: column positioning for "hg summary" | |
5514 | ui.write(_('commit: %s\n') % t.strip()) |
|
5528 | ui.write(_('commit: %s\n') % t.strip()) | |
5515 |
|
5529 | |||
5516 | # all ancestors of branch heads - all ancestors of parent = new csets |
|
5530 | # all ancestors of branch heads - all ancestors of parent = new csets | |
5517 | new = len(repo.changelog.findmissing([ctx.node() for ctx in parents], |
|
5531 | new = len(repo.changelog.findmissing([ctx.node() for ctx in parents], | |
5518 | bheads)) |
|
5532 | bheads)) | |
5519 |
|
5533 | |||
5520 | if new == 0: |
|
5534 | if new == 0: | |
5521 | # i18n: column positioning for "hg summary" |
|
5535 | # i18n: column positioning for "hg summary" | |
5522 | ui.status(_('update: (current)\n')) |
|
5536 | ui.status(_('update: (current)\n')) | |
5523 | elif pnode not in bheads: |
|
5537 | elif pnode not in bheads: | |
5524 | # i18n: column positioning for "hg summary" |
|
5538 | # i18n: column positioning for "hg summary" | |
5525 | ui.write(_('update: %d new changesets (update)\n') % new) |
|
5539 | ui.write(_('update: %d new changesets (update)\n') % new) | |
5526 | else: |
|
5540 | else: | |
5527 | # i18n: column positioning for "hg summary" |
|
5541 | # i18n: column positioning for "hg summary" | |
5528 | ui.write(_('update: %d new changesets, %d branch heads (merge)\n') % |
|
5542 | ui.write(_('update: %d new changesets, %d branch heads (merge)\n') % | |
5529 | (new, len(bheads))) |
|
5543 | (new, len(bheads))) | |
5530 |
|
5544 | |||
5531 | cmdutil.summaryhooks(ui, repo) |
|
5545 | cmdutil.summaryhooks(ui, repo) | |
5532 |
|
5546 | |||
5533 | if opts.get('remote'): |
|
5547 | if opts.get('remote'): | |
5534 | needsincoming, needsoutgoing = True, True |
|
5548 | needsincoming, needsoutgoing = True, True | |
5535 | else: |
|
5549 | else: | |
5536 | needsincoming, needsoutgoing = False, False |
|
5550 | needsincoming, needsoutgoing = False, False | |
5537 | for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None): |
|
5551 | for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None): | |
5538 | if i: |
|
5552 | if i: | |
5539 | needsincoming = True |
|
5553 | needsincoming = True | |
5540 | if o: |
|
5554 | if o: | |
5541 | needsoutgoing = True |
|
5555 | needsoutgoing = True | |
5542 | if not needsincoming and not needsoutgoing: |
|
5556 | if not needsincoming and not needsoutgoing: | |
5543 | return |
|
5557 | return | |
5544 |
|
5558 | |||
5545 | def getincoming(): |
|
5559 | def getincoming(): | |
5546 | source, branches = hg.parseurl(ui.expandpath('default')) |
|
5560 | source, branches = hg.parseurl(ui.expandpath('default')) | |
5547 | sbranch = branches[0] |
|
5561 | sbranch = branches[0] | |
5548 | try: |
|
5562 | try: | |
5549 | other = hg.peer(repo, {}, source) |
|
5563 | other = hg.peer(repo, {}, source) | |
5550 | except error.RepoError: |
|
5564 | except error.RepoError: | |
5551 | if opts.get('remote'): |
|
5565 | if opts.get('remote'): | |
5552 | raise |
|
5566 | raise | |
5553 | return source, sbranch, None, None, None |
|
5567 | return source, sbranch, None, None, None | |
5554 | revs, checkout = hg.addbranchrevs(repo, other, branches, None) |
|
5568 | revs, checkout = hg.addbranchrevs(repo, other, branches, None) | |
5555 | if revs: |
|
5569 | if revs: | |
5556 | revs = [other.lookup(rev) for rev in revs] |
|
5570 | revs = [other.lookup(rev) for rev in revs] | |
5557 | ui.debug('comparing with %s\n' % util.hidepassword(source)) |
|
5571 | ui.debug('comparing with %s\n' % util.hidepassword(source)) | |
5558 | repo.ui.pushbuffer() |
|
5572 | repo.ui.pushbuffer() | |
5559 | commoninc = discovery.findcommonincoming(repo, other, heads=revs) |
|
5573 | commoninc = discovery.findcommonincoming(repo, other, heads=revs) | |
5560 | repo.ui.popbuffer() |
|
5574 | repo.ui.popbuffer() | |
5561 | return source, sbranch, other, commoninc, commoninc[1] |
|
5575 | return source, sbranch, other, commoninc, commoninc[1] | |
5562 |
|
5576 | |||
5563 | if needsincoming: |
|
5577 | if needsincoming: | |
5564 | source, sbranch, sother, commoninc, incoming = getincoming() |
|
5578 | source, sbranch, sother, commoninc, incoming = getincoming() | |
5565 | else: |
|
5579 | else: | |
5566 | source = sbranch = sother = commoninc = incoming = None |
|
5580 | source = sbranch = sother = commoninc = incoming = None | |
5567 |
|
5581 | |||
5568 | def getoutgoing(): |
|
5582 | def getoutgoing(): | |
5569 | dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) |
|
5583 | dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) | |
5570 | dbranch = branches[0] |
|
5584 | dbranch = branches[0] | |
5571 | revs, checkout = hg.addbranchrevs(repo, repo, branches, None) |
|
5585 | revs, checkout = hg.addbranchrevs(repo, repo, branches, None) | |
5572 | if source != dest: |
|
5586 | if source != dest: | |
5573 | try: |
|
5587 | try: | |
5574 | dother = hg.peer(repo, {}, dest) |
|
5588 | dother = hg.peer(repo, {}, dest) | |
5575 | except error.RepoError: |
|
5589 | except error.RepoError: | |
5576 | if opts.get('remote'): |
|
5590 | if opts.get('remote'): | |
5577 | raise |
|
5591 | raise | |
5578 | return dest, dbranch, None, None |
|
5592 | return dest, dbranch, None, None | |
5579 | ui.debug('comparing with %s\n' % util.hidepassword(dest)) |
|
5593 | ui.debug('comparing with %s\n' % util.hidepassword(dest)) | |
5580 | elif sother is None: |
|
5594 | elif sother is None: | |
5581 | # there is no explicit destination peer, but source one is invalid |
|
5595 | # there is no explicit destination peer, but source one is invalid | |
5582 | return dest, dbranch, None, None |
|
5596 | return dest, dbranch, None, None | |
5583 | else: |
|
5597 | else: | |
5584 | dother = sother |
|
5598 | dother = sother | |
5585 | if (source != dest or (sbranch is not None and sbranch != dbranch)): |
|
5599 | if (source != dest or (sbranch is not None and sbranch != dbranch)): | |
5586 | common = None |
|
5600 | common = None | |
5587 | else: |
|
5601 | else: | |
5588 | common = commoninc |
|
5602 | common = commoninc | |
5589 | if revs: |
|
5603 | if revs: | |
5590 | revs = [repo.lookup(rev) for rev in revs] |
|
5604 | revs = [repo.lookup(rev) for rev in revs] | |
5591 | repo.ui.pushbuffer() |
|
5605 | repo.ui.pushbuffer() | |
5592 | outgoing = discovery.findcommonoutgoing(repo, dother, onlyheads=revs, |
|
5606 | outgoing = discovery.findcommonoutgoing(repo, dother, onlyheads=revs, | |
5593 | commoninc=common) |
|
5607 | commoninc=common) | |
5594 | repo.ui.popbuffer() |
|
5608 | repo.ui.popbuffer() | |
5595 | return dest, dbranch, dother, outgoing |
|
5609 | return dest, dbranch, dother, outgoing | |
5596 |
|
5610 | |||
5597 | if needsoutgoing: |
|
5611 | if needsoutgoing: | |
5598 | dest, dbranch, dother, outgoing = getoutgoing() |
|
5612 | dest, dbranch, dother, outgoing = getoutgoing() | |
5599 | else: |
|
5613 | else: | |
5600 | dest = dbranch = dother = outgoing = None |
|
5614 | dest = dbranch = dother = outgoing = None | |
5601 |
|
5615 | |||
5602 | if opts.get('remote'): |
|
5616 | if opts.get('remote'): | |
5603 | t = [] |
|
5617 | t = [] | |
5604 | if incoming: |
|
5618 | if incoming: | |
5605 | t.append(_('1 or more incoming')) |
|
5619 | t.append(_('1 or more incoming')) | |
5606 | o = outgoing.missing |
|
5620 | o = outgoing.missing | |
5607 | if o: |
|
5621 | if o: | |
5608 | t.append(_('%d outgoing') % len(o)) |
|
5622 | t.append(_('%d outgoing') % len(o)) | |
5609 | other = dother or sother |
|
5623 | other = dother or sother | |
5610 | if 'bookmarks' in other.listkeys('namespaces'): |
|
5624 | if 'bookmarks' in other.listkeys('namespaces'): | |
5611 | lmarks = repo.listkeys('bookmarks') |
|
5625 | lmarks = repo.listkeys('bookmarks') | |
5612 | rmarks = other.listkeys('bookmarks') |
|
5626 | rmarks = other.listkeys('bookmarks') | |
5613 | diff = set(rmarks) - set(lmarks) |
|
5627 | diff = set(rmarks) - set(lmarks) | |
5614 | if len(diff) > 0: |
|
5628 | if len(diff) > 0: | |
5615 | t.append(_('%d incoming bookmarks') % len(diff)) |
|
5629 | t.append(_('%d incoming bookmarks') % len(diff)) | |
5616 | diff = set(lmarks) - set(rmarks) |
|
5630 | diff = set(lmarks) - set(rmarks) | |
5617 | if len(diff) > 0: |
|
5631 | if len(diff) > 0: | |
5618 | t.append(_('%d outgoing bookmarks') % len(diff)) |
|
5632 | t.append(_('%d outgoing bookmarks') % len(diff)) | |
5619 |
|
5633 | |||
5620 | if t: |
|
5634 | if t: | |
5621 | # i18n: column positioning for "hg summary" |
|
5635 | # i18n: column positioning for "hg summary" | |
5622 | ui.write(_('remote: %s\n') % (', '.join(t))) |
|
5636 | ui.write(_('remote: %s\n') % (', '.join(t))) | |
5623 | else: |
|
5637 | else: | |
5624 | # i18n: column positioning for "hg summary" |
|
5638 | # i18n: column positioning for "hg summary" | |
5625 | ui.status(_('remote: (synced)\n')) |
|
5639 | ui.status(_('remote: (synced)\n')) | |
5626 |
|
5640 | |||
5627 | cmdutil.summaryremotehooks(ui, repo, opts, |
|
5641 | cmdutil.summaryremotehooks(ui, repo, opts, | |
5628 | ((source, sbranch, sother, commoninc), |
|
5642 | ((source, sbranch, sother, commoninc), | |
5629 | (dest, dbranch, dother, outgoing))) |
|
5643 | (dest, dbranch, dother, outgoing))) | |
5630 |
|
5644 | |||
5631 | @command('tag', |
|
5645 | @command('tag', | |
5632 | [('f', 'force', None, _('force tag')), |
|
5646 | [('f', 'force', None, _('force tag')), | |
5633 | ('l', 'local', None, _('make the tag local')), |
|
5647 | ('l', 'local', None, _('make the tag local')), | |
5634 | ('r', 'rev', '', _('revision to tag'), _('REV')), |
|
5648 | ('r', 'rev', '', _('revision to tag'), _('REV')), | |
5635 | ('', 'remove', None, _('remove a tag')), |
|
5649 | ('', 'remove', None, _('remove a tag')), | |
5636 | # -l/--local is already there, commitopts cannot be used |
|
5650 | # -l/--local is already there, commitopts cannot be used | |
5637 | ('e', 'edit', None, _('edit commit message')), |
|
5651 | ('e', 'edit', None, _('edit commit message')), | |
5638 | ('m', 'message', '', _('use <text> as commit message'), _('TEXT')), |
|
5652 | ('m', 'message', '', _('use <text> as commit message'), _('TEXT')), | |
5639 | ] + commitopts2, |
|
5653 | ] + commitopts2, | |
5640 | _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')) |
|
5654 | _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')) | |
5641 | def tag(ui, repo, name1, *names, **opts): |
|
5655 | def tag(ui, repo, name1, *names, **opts): | |
5642 | """add one or more tags for the current or given revision |
|
5656 | """add one or more tags for the current or given revision | |
5643 |
|
5657 | |||
5644 | Name a particular revision using <name>. |
|
5658 | Name a particular revision using <name>. | |
5645 |
|
5659 | |||
5646 | Tags are used to name particular revisions of the repository and are |
|
5660 | Tags are used to name particular revisions of the repository and are | |
5647 | very useful to compare different revisions, to go back to significant |
|
5661 | very useful to compare different revisions, to go back to significant | |
5648 | earlier versions or to mark branch points as releases, etc. Changing |
|
5662 | earlier versions or to mark branch points as releases, etc. Changing | |
5649 | an existing tag is normally disallowed; use -f/--force to override. |
|
5663 | an existing tag is normally disallowed; use -f/--force to override. | |
5650 |
|
5664 | |||
5651 | If no revision is given, the parent of the working directory is |
|
5665 | If no revision is given, the parent of the working directory is | |
5652 | used. |
|
5666 | used. | |
5653 |
|
5667 | |||
5654 | To facilitate version control, distribution, and merging of tags, |
|
5668 | To facilitate version control, distribution, and merging of tags, | |
5655 | they are stored as a file named ".hgtags" which is managed similarly |
|
5669 | they are stored as a file named ".hgtags" which is managed similarly | |
5656 | to other project files and can be hand-edited if necessary. This |
|
5670 | to other project files and can be hand-edited if necessary. This | |
5657 | also means that tagging creates a new commit. The file |
|
5671 | also means that tagging creates a new commit. The file | |
5658 | ".hg/localtags" is used for local tags (not shared among |
|
5672 | ".hg/localtags" is used for local tags (not shared among | |
5659 | repositories). |
|
5673 | repositories). | |
5660 |
|
5674 | |||
5661 | Tag commits are usually made at the head of a branch. If the parent |
|
5675 | Tag commits are usually made at the head of a branch. If the parent | |
5662 | of the working directory is not a branch head, :hg:`tag` aborts; use |
|
5676 | of the working directory is not a branch head, :hg:`tag` aborts; use | |
5663 | -f/--force to force the tag commit to be based on a non-head |
|
5677 | -f/--force to force the tag commit to be based on a non-head | |
5664 | changeset. |
|
5678 | changeset. | |
5665 |
|
5679 | |||
5666 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
5680 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
5667 |
|
5681 | |||
5668 | Since tag names have priority over branch names during revision |
|
5682 | Since tag names have priority over branch names during revision | |
5669 | lookup, using an existing branch name as a tag name is discouraged. |
|
5683 | lookup, using an existing branch name as a tag name is discouraged. | |
5670 |
|
5684 | |||
5671 | Returns 0 on success. |
|
5685 | Returns 0 on success. | |
5672 | """ |
|
5686 | """ | |
5673 | wlock = lock = None |
|
5687 | wlock = lock = None | |
5674 | try: |
|
5688 | try: | |
5675 | wlock = repo.wlock() |
|
5689 | wlock = repo.wlock() | |
5676 | lock = repo.lock() |
|
5690 | lock = repo.lock() | |
5677 | rev_ = "." |
|
5691 | rev_ = "." | |
5678 | names = [t.strip() for t in (name1,) + names] |
|
5692 | names = [t.strip() for t in (name1,) + names] | |
5679 | if len(names) != len(set(names)): |
|
5693 | if len(names) != len(set(names)): | |
5680 | raise util.Abort(_('tag names must be unique')) |
|
5694 | raise util.Abort(_('tag names must be unique')) | |
5681 | for n in names: |
|
5695 | for n in names: | |
5682 | scmutil.checknewlabel(repo, n, 'tag') |
|
5696 | scmutil.checknewlabel(repo, n, 'tag') | |
5683 | if not n: |
|
5697 | if not n: | |
5684 | raise util.Abort(_('tag names cannot consist entirely of ' |
|
5698 | raise util.Abort(_('tag names cannot consist entirely of ' | |
5685 | 'whitespace')) |
|
5699 | 'whitespace')) | |
5686 | if opts.get('rev') and opts.get('remove'): |
|
5700 | if opts.get('rev') and opts.get('remove'): | |
5687 | raise util.Abort(_("--rev and --remove are incompatible")) |
|
5701 | raise util.Abort(_("--rev and --remove are incompatible")) | |
5688 | if opts.get('rev'): |
|
5702 | if opts.get('rev'): | |
5689 | rev_ = opts['rev'] |
|
5703 | rev_ = opts['rev'] | |
5690 | message = opts.get('message') |
|
5704 | message = opts.get('message') | |
5691 | if opts.get('remove'): |
|
5705 | if opts.get('remove'): | |
5692 | expectedtype = opts.get('local') and 'local' or 'global' |
|
5706 | expectedtype = opts.get('local') and 'local' or 'global' | |
5693 | for n in names: |
|
5707 | for n in names: | |
5694 | if not repo.tagtype(n): |
|
5708 | if not repo.tagtype(n): | |
5695 | raise util.Abort(_("tag '%s' does not exist") % n) |
|
5709 | raise util.Abort(_("tag '%s' does not exist") % n) | |
5696 | if repo.tagtype(n) != expectedtype: |
|
5710 | if repo.tagtype(n) != expectedtype: | |
5697 | if expectedtype == 'global': |
|
5711 | if expectedtype == 'global': | |
5698 | raise util.Abort(_("tag '%s' is not a global tag") % n) |
|
5712 | raise util.Abort(_("tag '%s' is not a global tag") % n) | |
5699 | else: |
|
5713 | else: | |
5700 | raise util.Abort(_("tag '%s' is not a local tag") % n) |
|
5714 | raise util.Abort(_("tag '%s' is not a local tag") % n) | |
5701 | rev_ = nullid |
|
5715 | rev_ = nullid | |
5702 | if not message: |
|
5716 | if not message: | |
5703 | # we don't translate commit messages |
|
5717 | # we don't translate commit messages | |
5704 | message = 'Removed tag %s' % ', '.join(names) |
|
5718 | message = 'Removed tag %s' % ', '.join(names) | |
5705 | elif not opts.get('force'): |
|
5719 | elif not opts.get('force'): | |
5706 | for n in names: |
|
5720 | for n in names: | |
5707 | if n in repo.tags(): |
|
5721 | if n in repo.tags(): | |
5708 | raise util.Abort(_("tag '%s' already exists " |
|
5722 | raise util.Abort(_("tag '%s' already exists " | |
5709 | "(use -f to force)") % n) |
|
5723 | "(use -f to force)") % n) | |
5710 | if not opts.get('local'): |
|
5724 | if not opts.get('local'): | |
5711 | p1, p2 = repo.dirstate.parents() |
|
5725 | p1, p2 = repo.dirstate.parents() | |
5712 | if p2 != nullid: |
|
5726 | if p2 != nullid: | |
5713 | raise util.Abort(_('uncommitted merge')) |
|
5727 | raise util.Abort(_('uncommitted merge')) | |
5714 | bheads = repo.branchheads() |
|
5728 | bheads = repo.branchheads() | |
5715 | if not opts.get('force') and bheads and p1 not in bheads: |
|
5729 | if not opts.get('force') and bheads and p1 not in bheads: | |
5716 | raise util.Abort(_('not at a branch head (use -f to force)')) |
|
5730 | raise util.Abort(_('not at a branch head (use -f to force)')) | |
5717 | r = scmutil.revsingle(repo, rev_).node() |
|
5731 | r = scmutil.revsingle(repo, rev_).node() | |
5718 |
|
5732 | |||
5719 | if not message: |
|
5733 | if not message: | |
5720 | # we don't translate commit messages |
|
5734 | # we don't translate commit messages | |
5721 | message = ('Added tag %s for changeset %s' % |
|
5735 | message = ('Added tag %s for changeset %s' % | |
5722 | (', '.join(names), short(r))) |
|
5736 | (', '.join(names), short(r))) | |
5723 |
|
5737 | |||
5724 | date = opts.get('date') |
|
5738 | date = opts.get('date') | |
5725 | if date: |
|
5739 | if date: | |
5726 | date = util.parsedate(date) |
|
5740 | date = util.parsedate(date) | |
5727 |
|
5741 | |||
5728 | editor = cmdutil.getcommiteditor(**opts) |
|
5742 | editor = cmdutil.getcommiteditor(**opts) | |
5729 |
|
5743 | |||
5730 | # don't allow tagging the null rev |
|
5744 | # don't allow tagging the null rev | |
5731 | if (not opts.get('remove') and |
|
5745 | if (not opts.get('remove') and | |
5732 | scmutil.revsingle(repo, rev_).rev() == nullrev): |
|
5746 | scmutil.revsingle(repo, rev_).rev() == nullrev): | |
5733 | raise util.Abort(_("cannot tag null revision")) |
|
5747 | raise util.Abort(_("cannot tag null revision")) | |
5734 |
|
5748 | |||
5735 | repo.tag(names, r, message, opts.get('local'), opts.get('user'), date, |
|
5749 | repo.tag(names, r, message, opts.get('local'), opts.get('user'), date, | |
5736 | editor=editor) |
|
5750 | editor=editor) | |
5737 | finally: |
|
5751 | finally: | |
5738 | release(lock, wlock) |
|
5752 | release(lock, wlock) | |
5739 |
|
5753 | |||
5740 | @command('tags', [], '') |
|
5754 | @command('tags', [], '') | |
5741 | def tags(ui, repo, **opts): |
|
5755 | def tags(ui, repo, **opts): | |
5742 | """list repository tags |
|
5756 | """list repository tags | |
5743 |
|
5757 | |||
5744 | This lists both regular and local tags. When the -v/--verbose |
|
5758 | This lists both regular and local tags. When the -v/--verbose | |
5745 | switch is used, a third column "local" is printed for local tags. |
|
5759 | switch is used, a third column "local" is printed for local tags. | |
5746 |
|
5760 | |||
5747 | Returns 0 on success. |
|
5761 | Returns 0 on success. | |
5748 | """ |
|
5762 | """ | |
5749 |
|
5763 | |||
5750 | fm = ui.formatter('tags', opts) |
|
5764 | fm = ui.formatter('tags', opts) | |
5751 | hexfunc = ui.debugflag and hex or short |
|
5765 | hexfunc = ui.debugflag and hex or short | |
5752 | tagtype = "" |
|
5766 | tagtype = "" | |
5753 |
|
5767 | |||
5754 | for t, n in reversed(repo.tagslist()): |
|
5768 | for t, n in reversed(repo.tagslist()): | |
5755 | hn = hexfunc(n) |
|
5769 | hn = hexfunc(n) | |
5756 | label = 'tags.normal' |
|
5770 | label = 'tags.normal' | |
5757 | tagtype = '' |
|
5771 | tagtype = '' | |
5758 | if repo.tagtype(t) == 'local': |
|
5772 | if repo.tagtype(t) == 'local': | |
5759 | label = 'tags.local' |
|
5773 | label = 'tags.local' | |
5760 | tagtype = 'local' |
|
5774 | tagtype = 'local' | |
5761 |
|
5775 | |||
5762 | fm.startitem() |
|
5776 | fm.startitem() | |
5763 | fm.write('tag', '%s', t, label=label) |
|
5777 | fm.write('tag', '%s', t, label=label) | |
5764 | fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s' |
|
5778 | fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s' | |
5765 | fm.condwrite(not ui.quiet, 'rev id', fmt, |
|
5779 | fm.condwrite(not ui.quiet, 'rev id', fmt, | |
5766 | repo.changelog.rev(n), hn, label=label) |
|
5780 | repo.changelog.rev(n), hn, label=label) | |
5767 | fm.condwrite(ui.verbose and tagtype, 'type', ' %s', |
|
5781 | fm.condwrite(ui.verbose and tagtype, 'type', ' %s', | |
5768 | tagtype, label=label) |
|
5782 | tagtype, label=label) | |
5769 | fm.plain('\n') |
|
5783 | fm.plain('\n') | |
5770 | fm.end() |
|
5784 | fm.end() | |
5771 |
|
5785 | |||
5772 | @command('tip', |
|
5786 | @command('tip', | |
5773 | [('p', 'patch', None, _('show patch')), |
|
5787 | [('p', 'patch', None, _('show patch')), | |
5774 | ('g', 'git', None, _('use git extended diff format')), |
|
5788 | ('g', 'git', None, _('use git extended diff format')), | |
5775 | ] + templateopts, |
|
5789 | ] + templateopts, | |
5776 | _('[-p] [-g]')) |
|
5790 | _('[-p] [-g]')) | |
5777 | def tip(ui, repo, **opts): |
|
5791 | def tip(ui, repo, **opts): | |
5778 | """show the tip revision (DEPRECATED) |
|
5792 | """show the tip revision (DEPRECATED) | |
5779 |
|
5793 | |||
5780 | The tip revision (usually just called the tip) is the changeset |
|
5794 | The tip revision (usually just called the tip) is the changeset | |
5781 | most recently added to the repository (and therefore the most |
|
5795 | most recently added to the repository (and therefore the most | |
5782 | recently changed head). |
|
5796 | recently changed head). | |
5783 |
|
5797 | |||
5784 | If you have just made a commit, that commit will be the tip. If |
|
5798 | If you have just made a commit, that commit will be the tip. If | |
5785 | you have just pulled changes from another repository, the tip of |
|
5799 | you have just pulled changes from another repository, the tip of | |
5786 | that repository becomes the current tip. The "tip" tag is special |
|
5800 | that repository becomes the current tip. The "tip" tag is special | |
5787 | and cannot be renamed or assigned to a different changeset. |
|
5801 | and cannot be renamed or assigned to a different changeset. | |
5788 |
|
5802 | |||
5789 | This command is deprecated, please use :hg:`heads` instead. |
|
5803 | This command is deprecated, please use :hg:`heads` instead. | |
5790 |
|
5804 | |||
5791 | Returns 0 on success. |
|
5805 | Returns 0 on success. | |
5792 | """ |
|
5806 | """ | |
5793 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
5807 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
5794 | displayer.show(repo['tip']) |
|
5808 | displayer.show(repo['tip']) | |
5795 | displayer.close() |
|
5809 | displayer.close() | |
5796 |
|
5810 | |||
5797 | @command('unbundle', |
|
5811 | @command('unbundle', | |
5798 | [('u', 'update', None, |
|
5812 | [('u', 'update', None, | |
5799 | _('update to new branch head if changesets were unbundled'))], |
|
5813 | _('update to new branch head if changesets were unbundled'))], | |
5800 | _('[-u] FILE...')) |
|
5814 | _('[-u] FILE...')) | |
5801 | def unbundle(ui, repo, fname1, *fnames, **opts): |
|
5815 | def unbundle(ui, repo, fname1, *fnames, **opts): | |
5802 | """apply one or more changegroup files |
|
5816 | """apply one or more changegroup files | |
5803 |
|
5817 | |||
5804 | Apply one or more compressed changegroup files generated by the |
|
5818 | Apply one or more compressed changegroup files generated by the | |
5805 | bundle command. |
|
5819 | bundle command. | |
5806 |
|
5820 | |||
5807 | Returns 0 on success, 1 if an update has unresolved files. |
|
5821 | Returns 0 on success, 1 if an update has unresolved files. | |
5808 | """ |
|
5822 | """ | |
5809 | fnames = (fname1,) + fnames |
|
5823 | fnames = (fname1,) + fnames | |
5810 |
|
5824 | |||
5811 | lock = repo.lock() |
|
5825 | lock = repo.lock() | |
5812 | wc = repo['.'] |
|
5826 | wc = repo['.'] | |
5813 | try: |
|
5827 | try: | |
5814 | for fname in fnames: |
|
5828 | for fname in fnames: | |
5815 | f = hg.openpath(ui, fname) |
|
5829 | f = hg.openpath(ui, fname) | |
5816 | gen = exchange.readbundle(ui, f, fname) |
|
5830 | gen = exchange.readbundle(ui, f, fname) | |
5817 | modheads = changegroup.addchangegroup(repo, gen, 'unbundle', |
|
5831 | modheads = changegroup.addchangegroup(repo, gen, 'unbundle', | |
5818 | 'bundle:' + fname) |
|
5832 | 'bundle:' + fname) | |
5819 | finally: |
|
5833 | finally: | |
5820 | lock.release() |
|
5834 | lock.release() | |
5821 | bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch()) |
|
5835 | bookmarks.updatecurrentbookmark(repo, wc.node(), wc.branch()) | |
5822 | return postincoming(ui, repo, modheads, opts.get('update'), None) |
|
5836 | return postincoming(ui, repo, modheads, opts.get('update'), None) | |
5823 |
|
5837 | |||
5824 | @command('^update|up|checkout|co', |
|
5838 | @command('^update|up|checkout|co', | |
5825 | [('C', 'clean', None, _('discard uncommitted changes (no backup)')), |
|
5839 | [('C', 'clean', None, _('discard uncommitted changes (no backup)')), | |
5826 | ('c', 'check', None, |
|
5840 | ('c', 'check', None, | |
5827 | _('update across branches if no uncommitted changes')), |
|
5841 | _('update across branches if no uncommitted changes')), | |
5828 | ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), |
|
5842 | ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), | |
5829 | ('r', 'rev', '', _('revision'), _('REV')) |
|
5843 | ('r', 'rev', '', _('revision'), _('REV')) | |
5830 | ] + mergetoolopts, |
|
5844 | ] + mergetoolopts, | |
5831 | _('[-c] [-C] [-d DATE] [[-r] REV]')) |
|
5845 | _('[-c] [-C] [-d DATE] [[-r] REV]')) | |
5832 | def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False, |
|
5846 | def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False, | |
5833 | tool=None): |
|
5847 | tool=None): | |
5834 | """update working directory (or switch revisions) |
|
5848 | """update working directory (or switch revisions) | |
5835 |
|
5849 | |||
5836 | Update the repository's working directory to the specified |
|
5850 | Update the repository's working directory to the specified | |
5837 | changeset. If no changeset is specified, update to the tip of the |
|
5851 | changeset. If no changeset is specified, update to the tip of the | |
5838 | current named branch and move the current bookmark (see :hg:`help |
|
5852 | current named branch and move the current bookmark (see :hg:`help | |
5839 | bookmarks`). |
|
5853 | bookmarks`). | |
5840 |
|
5854 | |||
5841 | Update sets the working directory's parent revision to the specified |
|
5855 | Update sets the working directory's parent revision to the specified | |
5842 | changeset (see :hg:`help parents`). |
|
5856 | changeset (see :hg:`help parents`). | |
5843 |
|
5857 | |||
5844 | If the changeset is not a descendant or ancestor of the working |
|
5858 | If the changeset is not a descendant or ancestor of the working | |
5845 | directory's parent, the update is aborted. With the -c/--check |
|
5859 | directory's parent, the update is aborted. With the -c/--check | |
5846 | option, the working directory is checked for uncommitted changes; if |
|
5860 | option, the working directory is checked for uncommitted changes; if | |
5847 | none are found, the working directory is updated to the specified |
|
5861 | none are found, the working directory is updated to the specified | |
5848 | changeset. |
|
5862 | changeset. | |
5849 |
|
5863 | |||
5850 | .. container:: verbose |
|
5864 | .. container:: verbose | |
5851 |
|
5865 | |||
5852 | The following rules apply when the working directory contains |
|
5866 | The following rules apply when the working directory contains | |
5853 | uncommitted changes: |
|
5867 | uncommitted changes: | |
5854 |
|
5868 | |||
5855 | 1. If neither -c/--check nor -C/--clean is specified, and if |
|
5869 | 1. If neither -c/--check nor -C/--clean is specified, and if | |
5856 | the requested changeset is an ancestor or descendant of |
|
5870 | the requested changeset is an ancestor or descendant of | |
5857 | the working directory's parent, the uncommitted changes |
|
5871 | the working directory's parent, the uncommitted changes | |
5858 | are merged into the requested changeset and the merged |
|
5872 | are merged into the requested changeset and the merged | |
5859 | result is left uncommitted. If the requested changeset is |
|
5873 | result is left uncommitted. If the requested changeset is | |
5860 | not an ancestor or descendant (that is, it is on another |
|
5874 | not an ancestor or descendant (that is, it is on another | |
5861 | branch), the update is aborted and the uncommitted changes |
|
5875 | branch), the update is aborted and the uncommitted changes | |
5862 | are preserved. |
|
5876 | are preserved. | |
5863 |
|
5877 | |||
5864 | 2. With the -c/--check option, the update is aborted and the |
|
5878 | 2. With the -c/--check option, the update is aborted and the | |
5865 | uncommitted changes are preserved. |
|
5879 | uncommitted changes are preserved. | |
5866 |
|
5880 | |||
5867 | 3. With the -C/--clean option, uncommitted changes are discarded and |
|
5881 | 3. With the -C/--clean option, uncommitted changes are discarded and | |
5868 | the working directory is updated to the requested changeset. |
|
5882 | the working directory is updated to the requested changeset. | |
5869 |
|
5883 | |||
5870 | To cancel an uncommitted merge (and lose your changes), use |
|
5884 | To cancel an uncommitted merge (and lose your changes), use | |
5871 | :hg:`update --clean .`. |
|
5885 | :hg:`update --clean .`. | |
5872 |
|
5886 | |||
5873 | Use null as the changeset to remove the working directory (like |
|
5887 | Use null as the changeset to remove the working directory (like | |
5874 | :hg:`clone -U`). |
|
5888 | :hg:`clone -U`). | |
5875 |
|
5889 | |||
5876 | If you want to revert just one file to an older revision, use |
|
5890 | If you want to revert just one file to an older revision, use | |
5877 | :hg:`revert [-r REV] NAME`. |
|
5891 | :hg:`revert [-r REV] NAME`. | |
5878 |
|
5892 | |||
5879 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
5893 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
5880 |
|
5894 | |||
5881 | Returns 0 on success, 1 if there are unresolved files. |
|
5895 | Returns 0 on success, 1 if there are unresolved files. | |
5882 | """ |
|
5896 | """ | |
5883 | if rev and node: |
|
5897 | if rev and node: | |
5884 | raise util.Abort(_("please specify just one revision")) |
|
5898 | raise util.Abort(_("please specify just one revision")) | |
5885 |
|
5899 | |||
5886 | if rev is None or rev == '': |
|
5900 | if rev is None or rev == '': | |
5887 | rev = node |
|
5901 | rev = node | |
5888 |
|
5902 | |||
5889 | cmdutil.clearunfinished(repo) |
|
5903 | cmdutil.clearunfinished(repo) | |
5890 |
|
5904 | |||
5891 | # with no argument, we also move the current bookmark, if any |
|
5905 | # with no argument, we also move the current bookmark, if any | |
5892 | rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) |
|
5906 | rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) | |
5893 |
|
5907 | |||
5894 | # if we defined a bookmark, we have to remember the original bookmark name |
|
5908 | # if we defined a bookmark, we have to remember the original bookmark name | |
5895 | brev = rev |
|
5909 | brev = rev | |
5896 | rev = scmutil.revsingle(repo, rev, rev).rev() |
|
5910 | rev = scmutil.revsingle(repo, rev, rev).rev() | |
5897 |
|
5911 | |||
5898 | if check and clean: |
|
5912 | if check and clean: | |
5899 | raise util.Abort(_("cannot specify both -c/--check and -C/--clean")) |
|
5913 | raise util.Abort(_("cannot specify both -c/--check and -C/--clean")) | |
5900 |
|
5914 | |||
5901 | if date: |
|
5915 | if date: | |
5902 | if rev is not None: |
|
5916 | if rev is not None: | |
5903 | raise util.Abort(_("you can't specify a revision and a date")) |
|
5917 | raise util.Abort(_("you can't specify a revision and a date")) | |
5904 | rev = cmdutil.finddate(ui, repo, date) |
|
5918 | rev = cmdutil.finddate(ui, repo, date) | |
5905 |
|
5919 | |||
5906 | if check: |
|
5920 | if check: | |
5907 | c = repo[None] |
|
5921 | c = repo[None] | |
5908 | if c.dirty(merge=False, branch=False, missing=True): |
|
5922 | if c.dirty(merge=False, branch=False, missing=True): | |
5909 | raise util.Abort(_("uncommitted changes")) |
|
5923 | raise util.Abort(_("uncommitted changes")) | |
5910 | if rev is None: |
|
5924 | if rev is None: | |
5911 | rev = repo[repo[None].branch()].rev() |
|
5925 | rev = repo[repo[None].branch()].rev() | |
5912 | mergemod._checkunknown(repo, repo[None], repo[rev]) |
|
5926 | mergemod._checkunknown(repo, repo[None], repo[rev]) | |
5913 |
|
5927 | |||
5914 | repo.ui.setconfig('ui', 'forcemerge', tool, 'update') |
|
5928 | repo.ui.setconfig('ui', 'forcemerge', tool, 'update') | |
5915 |
|
5929 | |||
5916 | if clean: |
|
5930 | if clean: | |
5917 | ret = hg.clean(repo, rev) |
|
5931 | ret = hg.clean(repo, rev) | |
5918 | else: |
|
5932 | else: | |
5919 | ret = hg.update(repo, rev) |
|
5933 | ret = hg.update(repo, rev) | |
5920 |
|
5934 | |||
5921 | if not ret and movemarkfrom: |
|
5935 | if not ret and movemarkfrom: | |
5922 | if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): |
|
5936 | if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): | |
5923 | ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) |
|
5937 | ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) | |
5924 | elif brev in repo._bookmarks: |
|
5938 | elif brev in repo._bookmarks: | |
5925 | bookmarks.setcurrent(repo, brev) |
|
5939 | bookmarks.setcurrent(repo, brev) | |
5926 | ui.status(_("(activating bookmark %s)\n") % brev) |
|
5940 | ui.status(_("(activating bookmark %s)\n") % brev) | |
5927 | elif brev: |
|
5941 | elif brev: | |
5928 | if repo._bookmarkcurrent: |
|
5942 | if repo._bookmarkcurrent: | |
5929 | ui.status(_("(leaving bookmark %s)\n") % |
|
5943 | ui.status(_("(leaving bookmark %s)\n") % | |
5930 | repo._bookmarkcurrent) |
|
5944 | repo._bookmarkcurrent) | |
5931 | bookmarks.unsetcurrent(repo) |
|
5945 | bookmarks.unsetcurrent(repo) | |
5932 |
|
5946 | |||
5933 | return ret |
|
5947 | return ret | |
5934 |
|
5948 | |||
5935 | @command('verify', []) |
|
5949 | @command('verify', []) | |
5936 | def verify(ui, repo): |
|
5950 | def verify(ui, repo): | |
5937 | """verify the integrity of the repository |
|
5951 | """verify the integrity of the repository | |
5938 |
|
5952 | |||
5939 | Verify the integrity of the current repository. |
|
5953 | Verify the integrity of the current repository. | |
5940 |
|
5954 | |||
5941 | This will perform an extensive check of the repository's |
|
5955 | This will perform an extensive check of the repository's | |
5942 | integrity, validating the hashes and checksums of each entry in |
|
5956 | integrity, validating the hashes and checksums of each entry in | |
5943 | the changelog, manifest, and tracked files, as well as the |
|
5957 | the changelog, manifest, and tracked files, as well as the | |
5944 | integrity of their crosslinks and indices. |
|
5958 | integrity of their crosslinks and indices. | |
5945 |
|
5959 | |||
5946 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption |
|
5960 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption | |
5947 | for more information about recovery from corruption of the |
|
5961 | for more information about recovery from corruption of the | |
5948 | repository. |
|
5962 | repository. | |
5949 |
|
5963 | |||
5950 | Returns 0 on success, 1 if errors are encountered. |
|
5964 | Returns 0 on success, 1 if errors are encountered. | |
5951 | """ |
|
5965 | """ | |
5952 | return hg.verify(repo) |
|
5966 | return hg.verify(repo) | |
5953 |
|
5967 | |||
5954 | @command('version', []) |
|
5968 | @command('version', []) | |
5955 | def version_(ui): |
|
5969 | def version_(ui): | |
5956 | """output version and copyright information""" |
|
5970 | """output version and copyright information""" | |
5957 | ui.write(_("Mercurial Distributed SCM (version %s)\n") |
|
5971 | ui.write(_("Mercurial Distributed SCM (version %s)\n") | |
5958 | % util.version()) |
|
5972 | % util.version()) | |
5959 | ui.status(_( |
|
5973 | ui.status(_( | |
5960 | "(see http://mercurial.selenic.com for more information)\n" |
|
5974 | "(see http://mercurial.selenic.com for more information)\n" | |
5961 | "\nCopyright (C) 2005-2014 Matt Mackall and others\n" |
|
5975 | "\nCopyright (C) 2005-2014 Matt Mackall and others\n" | |
5962 | "This is free software; see the source for copying conditions. " |
|
5976 | "This is free software; see the source for copying conditions. " | |
5963 | "There is NO\nwarranty; " |
|
5977 | "There is NO\nwarranty; " | |
5964 | "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" |
|
5978 | "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" | |
5965 | )) |
|
5979 | )) | |
5966 |
|
5980 | |||
5967 | norepo = ("clone init version help debugcommands debugcomplete" |
|
5981 | norepo = ("clone init version help debugcommands debugcomplete" | |
5968 | " debugdate debuginstall debugfsinfo debugpushkey debugwireargs" |
|
5982 | " debugdate debuginstall debugfsinfo debugpushkey debugwireargs" | |
5969 | " debugknown debuggetbundle debugbundle") |
|
5983 | " debugknown debuggetbundle debugbundle") | |
5970 | optionalrepo = ("identify paths serve config showconfig debugancestor debugdag" |
|
5984 | optionalrepo = ("identify paths serve config showconfig debugancestor debugdag" | |
5971 | " debugdata debugindex debugindexdot debugrevlog") |
|
5985 | " debugdata debugindex debugindexdot debugrevlog") | |
5972 | inferrepo = ("add addremove annotate cat commit diff grep forget log parents" |
|
5986 | inferrepo = ("add addremove annotate cat commit diff grep forget log parents" | |
5973 | " remove resolve status debugwalk") |
|
5987 | " remove resolve status debugwalk") |
@@ -1,445 +1,445 b'' | |||||
1 | $ hg init a |
|
1 | $ hg init a | |
2 | $ cd a |
|
2 | $ cd a | |
3 | $ echo a > a |
|
3 | $ echo a > a | |
4 | $ hg ci -A -d'1 0' -m a |
|
4 | $ hg ci -A -d'1 0' -m a | |
5 | adding a |
|
5 | adding a | |
6 |
|
6 | |||
7 | $ cd .. |
|
7 | $ cd .. | |
8 |
|
8 | |||
9 | $ hg init b |
|
9 | $ hg init b | |
10 | $ cd b |
|
10 | $ cd b | |
11 | $ echo b > b |
|
11 | $ echo b > b | |
12 | $ hg ci -A -d'1 0' -m b |
|
12 | $ hg ci -A -d'1 0' -m b | |
13 | adding b |
|
13 | adding b | |
14 |
|
14 | |||
15 | $ cd .. |
|
15 | $ cd .. | |
16 |
|
16 | |||
17 | $ hg clone a c |
|
17 | $ hg clone a c | |
18 | updating to branch default |
|
18 | updating to branch default | |
19 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
19 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
20 | $ cd c |
|
20 | $ cd c | |
21 | $ cat >> .hg/hgrc <<EOF |
|
21 | $ cat >> .hg/hgrc <<EOF | |
22 | > [paths] |
|
22 | > [paths] | |
23 | > relative = ../a |
|
23 | > relative = ../a | |
24 | > EOF |
|
24 | > EOF | |
25 | $ hg pull -f ../b |
|
25 | $ hg pull -f ../b | |
26 | pulling from ../b |
|
26 | pulling from ../b | |
27 | searching for changes |
|
27 | searching for changes | |
28 | warning: repository is unrelated |
|
28 | warning: repository is unrelated | |
29 | requesting all changes |
|
29 | requesting all changes | |
30 | adding changesets |
|
30 | adding changesets | |
31 | adding manifests |
|
31 | adding manifests | |
32 | adding file changes |
|
32 | adding file changes | |
33 | added 1 changesets with 1 changes to 1 files (+1 heads) |
|
33 | added 1 changesets with 1 changes to 1 files (+1 heads) | |
34 | (run 'hg heads' to see heads, 'hg merge' to merge) |
|
34 | (run 'hg heads' to see heads, 'hg merge' to merge) | |
35 | $ hg merge |
|
35 | $ hg merge | |
36 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
36 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
37 | (branch merge, don't forget to commit) |
|
37 | (branch merge, don't forget to commit) | |
38 |
|
38 | |||
39 | $ cd .. |
|
39 | $ cd .. | |
40 |
|
40 | |||
41 | Testing -R/--repository: |
|
41 | Testing -R/--repository: | |
42 |
|
42 | |||
43 | $ hg -R a tip |
|
43 | $ hg -R a tip | |
44 | changeset: 0:8580ff50825a |
|
44 | changeset: 0:8580ff50825a | |
45 | tag: tip |
|
45 | tag: tip | |
46 | user: test |
|
46 | user: test | |
47 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
47 | date: Thu Jan 01 00:00:01 1970 +0000 | |
48 | summary: a |
|
48 | summary: a | |
49 |
|
49 | |||
50 | $ hg --repository b tip |
|
50 | $ hg --repository b tip | |
51 | changeset: 0:b6c483daf290 |
|
51 | changeset: 0:b6c483daf290 | |
52 | tag: tip |
|
52 | tag: tip | |
53 | user: test |
|
53 | user: test | |
54 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
54 | date: Thu Jan 01 00:00:01 1970 +0000 | |
55 | summary: b |
|
55 | summary: b | |
56 |
|
56 | |||
57 |
|
57 | |||
58 | -R with a URL: |
|
58 | -R with a URL: | |
59 |
|
59 | |||
60 | $ hg -R file:a identify |
|
60 | $ hg -R file:a identify | |
61 | 8580ff50825a tip |
|
61 | 8580ff50825a tip | |
62 | $ hg -R file://localhost/`pwd`/a/ identify |
|
62 | $ hg -R file://localhost/`pwd`/a/ identify | |
63 | 8580ff50825a tip |
|
63 | 8580ff50825a tip | |
64 |
|
64 | |||
65 | -R with path aliases: |
|
65 | -R with path aliases: | |
66 |
|
66 | |||
67 | $ cd c |
|
67 | $ cd c | |
68 | $ hg -R default identify |
|
68 | $ hg -R default identify | |
69 | 8580ff50825a tip |
|
69 | 8580ff50825a tip | |
70 | $ hg -R relative identify |
|
70 | $ hg -R relative identify | |
71 | 8580ff50825a tip |
|
71 | 8580ff50825a tip | |
72 | $ echo '[paths]' >> $HGRCPATH |
|
72 | $ echo '[paths]' >> $HGRCPATH | |
73 | $ echo 'relativetohome = a' >> $HGRCPATH |
|
73 | $ echo 'relativetohome = a' >> $HGRCPATH | |
74 | $ HOME=`pwd`/../ hg -R relativetohome identify |
|
74 | $ HOME=`pwd`/../ hg -R relativetohome identify | |
75 | 8580ff50825a tip |
|
75 | 8580ff50825a tip | |
76 | $ cd .. |
|
76 | $ cd .. | |
77 |
|
77 | |||
78 | #if no-outer-repo |
|
78 | #if no-outer-repo | |
79 |
|
79 | |||
80 | Implicit -R: |
|
80 | Implicit -R: | |
81 |
|
81 | |||
82 | $ hg ann a/a |
|
82 | $ hg ann a/a | |
83 | 0: a |
|
83 | 0: a | |
84 | $ hg ann a/a a/a |
|
84 | $ hg ann a/a a/a | |
85 | 0: a |
|
85 | 0: a | |
86 | $ hg ann a/a b/b |
|
86 | $ hg ann a/a b/b | |
87 | abort: no repository found in '$TESTTMP' (.hg not found)! |
|
87 | abort: no repository found in '$TESTTMP' (.hg not found)! | |
88 | [255] |
|
88 | [255] | |
89 | $ hg -R b ann a/a |
|
89 | $ hg -R b ann a/a | |
90 | abort: a/a not under root '$TESTTMP/b' (glob) |
|
90 | abort: a/a not under root '$TESTTMP/b' (glob) | |
91 | [255] |
|
91 | [255] | |
92 | $ hg log |
|
92 | $ hg log | |
93 | abort: no repository found in '$TESTTMP' (.hg not found)! |
|
93 | abort: no repository found in '$TESTTMP' (.hg not found)! | |
94 | [255] |
|
94 | [255] | |
95 |
|
95 | |||
96 | #endif |
|
96 | #endif | |
97 |
|
97 | |||
98 | Abbreviation of long option: |
|
98 | Abbreviation of long option: | |
99 |
|
99 | |||
100 | $ hg --repo c tip |
|
100 | $ hg --repo c tip | |
101 | changeset: 1:b6c483daf290 |
|
101 | changeset: 1:b6c483daf290 | |
102 | tag: tip |
|
102 | tag: tip | |
103 | parent: -1:000000000000 |
|
103 | parent: -1:000000000000 | |
104 | user: test |
|
104 | user: test | |
105 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
105 | date: Thu Jan 01 00:00:01 1970 +0000 | |
106 | summary: b |
|
106 | summary: b | |
107 |
|
107 | |||
108 |
|
108 | |||
109 | earlygetopt with duplicate options (36d23de02da1): |
|
109 | earlygetopt with duplicate options (36d23de02da1): | |
110 |
|
110 | |||
111 | $ hg --cwd a --cwd b --cwd c tip |
|
111 | $ hg --cwd a --cwd b --cwd c tip | |
112 | changeset: 1:b6c483daf290 |
|
112 | changeset: 1:b6c483daf290 | |
113 | tag: tip |
|
113 | tag: tip | |
114 | parent: -1:000000000000 |
|
114 | parent: -1:000000000000 | |
115 | user: test |
|
115 | user: test | |
116 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
116 | date: Thu Jan 01 00:00:01 1970 +0000 | |
117 | summary: b |
|
117 | summary: b | |
118 |
|
118 | |||
119 | $ hg --repo c --repository b -R a tip |
|
119 | $ hg --repo c --repository b -R a tip | |
120 | changeset: 0:8580ff50825a |
|
120 | changeset: 0:8580ff50825a | |
121 | tag: tip |
|
121 | tag: tip | |
122 | user: test |
|
122 | user: test | |
123 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
123 | date: Thu Jan 01 00:00:01 1970 +0000 | |
124 | summary: a |
|
124 | summary: a | |
125 |
|
125 | |||
126 |
|
126 | |||
127 | earlygetopt short option without following space: |
|
127 | earlygetopt short option without following space: | |
128 |
|
128 | |||
129 | $ hg -q -Rb tip |
|
129 | $ hg -q -Rb tip | |
130 | 0:b6c483daf290 |
|
130 | 0:b6c483daf290 | |
131 |
|
131 | |||
132 | earlygetopt with illegal abbreviations: |
|
132 | earlygetopt with illegal abbreviations: | |
133 |
|
133 | |||
134 | $ hg --confi "foo.bar=baz" |
|
134 | $ hg --confi "foo.bar=baz" | |
135 | abort: option --config may not be abbreviated! |
|
135 | abort: option --config may not be abbreviated! | |
136 | [255] |
|
136 | [255] | |
137 | $ hg --cw a tip |
|
137 | $ hg --cw a tip | |
138 | abort: option --cwd may not be abbreviated! |
|
138 | abort: option --cwd may not be abbreviated! | |
139 | [255] |
|
139 | [255] | |
140 | $ hg --rep a tip |
|
140 | $ hg --rep a tip | |
141 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo! |
|
141 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo! | |
142 | [255] |
|
142 | [255] | |
143 | $ hg --repositor a tip |
|
143 | $ hg --repositor a tip | |
144 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo! |
|
144 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo! | |
145 | [255] |
|
145 | [255] | |
146 | $ hg -qR a tip |
|
146 | $ hg -qR a tip | |
147 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo! |
|
147 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo! | |
148 | [255] |
|
148 | [255] | |
149 | $ hg -qRa tip |
|
149 | $ hg -qRa tip | |
150 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo! |
|
150 | abort: option -R has to be separated from other options (e.g. not -qR) and --repository may only be abbreviated as --repo! | |
151 | [255] |
|
151 | [255] | |
152 |
|
152 | |||
153 | Testing --cwd: |
|
153 | Testing --cwd: | |
154 |
|
154 | |||
155 | $ hg --cwd a parents |
|
155 | $ hg --cwd a parents | |
156 | changeset: 0:8580ff50825a |
|
156 | changeset: 0:8580ff50825a | |
157 | tag: tip |
|
157 | tag: tip | |
158 | user: test |
|
158 | user: test | |
159 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
159 | date: Thu Jan 01 00:00:01 1970 +0000 | |
160 | summary: a |
|
160 | summary: a | |
161 |
|
161 | |||
162 |
|
162 | |||
163 | Testing -y/--noninteractive - just be sure it is parsed: |
|
163 | Testing -y/--noninteractive - just be sure it is parsed: | |
164 |
|
164 | |||
165 | $ hg --cwd a tip -q --noninteractive |
|
165 | $ hg --cwd a tip -q --noninteractive | |
166 | 0:8580ff50825a |
|
166 | 0:8580ff50825a | |
167 | $ hg --cwd a tip -q -y |
|
167 | $ hg --cwd a tip -q -y | |
168 | 0:8580ff50825a |
|
168 | 0:8580ff50825a | |
169 |
|
169 | |||
170 | Testing -q/--quiet: |
|
170 | Testing -q/--quiet: | |
171 |
|
171 | |||
172 | $ hg -R a -q tip |
|
172 | $ hg -R a -q tip | |
173 | 0:8580ff50825a |
|
173 | 0:8580ff50825a | |
174 | $ hg -R b -q tip |
|
174 | $ hg -R b -q tip | |
175 | 0:b6c483daf290 |
|
175 | 0:b6c483daf290 | |
176 | $ hg -R c --quiet parents |
|
176 | $ hg -R c --quiet parents | |
177 | 0:8580ff50825a |
|
177 | 0:8580ff50825a | |
178 | 1:b6c483daf290 |
|
178 | 1:b6c483daf290 | |
179 |
|
179 | |||
180 | Testing -v/--verbose: |
|
180 | Testing -v/--verbose: | |
181 |
|
181 | |||
182 | $ hg --cwd c head -v |
|
182 | $ hg --cwd c head -v | |
183 | changeset: 1:b6c483daf290 |
|
183 | changeset: 1:b6c483daf290 | |
184 | tag: tip |
|
184 | tag: tip | |
185 | parent: -1:000000000000 |
|
185 | parent: -1:000000000000 | |
186 | user: test |
|
186 | user: test | |
187 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
187 | date: Thu Jan 01 00:00:01 1970 +0000 | |
188 | files: b |
|
188 | files: b | |
189 | description: |
|
189 | description: | |
190 | b |
|
190 | b | |
191 |
|
191 | |||
192 |
|
192 | |||
193 | changeset: 0:8580ff50825a |
|
193 | changeset: 0:8580ff50825a | |
194 | user: test |
|
194 | user: test | |
195 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
195 | date: Thu Jan 01 00:00:01 1970 +0000 | |
196 | files: a |
|
196 | files: a | |
197 | description: |
|
197 | description: | |
198 | a |
|
198 | a | |
199 |
|
199 | |||
200 |
|
200 | |||
201 | $ hg --cwd b tip --verbose |
|
201 | $ hg --cwd b tip --verbose | |
202 | changeset: 0:b6c483daf290 |
|
202 | changeset: 0:b6c483daf290 | |
203 | tag: tip |
|
203 | tag: tip | |
204 | user: test |
|
204 | user: test | |
205 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
205 | date: Thu Jan 01 00:00:01 1970 +0000 | |
206 | files: b |
|
206 | files: b | |
207 | description: |
|
207 | description: | |
208 | b |
|
208 | b | |
209 |
|
209 | |||
210 |
|
210 | |||
211 |
|
211 | |||
212 | Testing --config: |
|
212 | Testing --config: | |
213 |
|
213 | |||
214 | $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo |
|
214 | $ hg --cwd c --config paths.quuxfoo=bar paths | grep quuxfoo > /dev/null && echo quuxfoo | |
215 | quuxfoo |
|
215 | quuxfoo | |
216 | $ hg --cwd c --config '' tip -q |
|
216 | $ hg --cwd c --config '' tip -q | |
217 | abort: malformed --config option: '' (use --config section.name=value) |
|
217 | abort: malformed --config option: '' (use --config section.name=value) | |
218 | [255] |
|
218 | [255] | |
219 | $ hg --cwd c --config a.b tip -q |
|
219 | $ hg --cwd c --config a.b tip -q | |
220 | abort: malformed --config option: 'a.b' (use --config section.name=value) |
|
220 | abort: malformed --config option: 'a.b' (use --config section.name=value) | |
221 | [255] |
|
221 | [255] | |
222 | $ hg --cwd c --config a tip -q |
|
222 | $ hg --cwd c --config a tip -q | |
223 | abort: malformed --config option: 'a' (use --config section.name=value) |
|
223 | abort: malformed --config option: 'a' (use --config section.name=value) | |
224 | [255] |
|
224 | [255] | |
225 | $ hg --cwd c --config a.= tip -q |
|
225 | $ hg --cwd c --config a.= tip -q | |
226 | abort: malformed --config option: 'a.=' (use --config section.name=value) |
|
226 | abort: malformed --config option: 'a.=' (use --config section.name=value) | |
227 | [255] |
|
227 | [255] | |
228 | $ hg --cwd c --config .b= tip -q |
|
228 | $ hg --cwd c --config .b= tip -q | |
229 | abort: malformed --config option: '.b=' (use --config section.name=value) |
|
229 | abort: malformed --config option: '.b=' (use --config section.name=value) | |
230 | [255] |
|
230 | [255] | |
231 |
|
231 | |||
232 | Testing --debug: |
|
232 | Testing --debug: | |
233 |
|
233 | |||
234 | $ hg --cwd c log --debug |
|
234 | $ hg --cwd c log --debug | |
235 | changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a |
|
235 | changeset: 1:b6c483daf2907ce5825c0bb50f5716226281cc1a | |
236 | tag: tip |
|
236 | tag: tip | |
237 | parent: -1:0000000000000000000000000000000000000000 |
|
237 | parent: -1:0000000000000000000000000000000000000000 | |
238 | parent: -1:0000000000000000000000000000000000000000 |
|
238 | parent: -1:0000000000000000000000000000000000000000 | |
239 | manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49 |
|
239 | manifest: 1:23226e7a252cacdc2d99e4fbdc3653441056de49 | |
240 | user: test |
|
240 | user: test | |
241 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
241 | date: Thu Jan 01 00:00:01 1970 +0000 | |
242 | files+: b |
|
242 | files+: b | |
243 | extra: branch=default |
|
243 | extra: branch=default | |
244 | description: |
|
244 | description: | |
245 | b |
|
245 | b | |
246 |
|
246 | |||
247 |
|
247 | |||
248 | changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab |
|
248 | changeset: 0:8580ff50825a50c8f716709acdf8de0deddcd6ab | |
249 | parent: -1:0000000000000000000000000000000000000000 |
|
249 | parent: -1:0000000000000000000000000000000000000000 | |
250 | parent: -1:0000000000000000000000000000000000000000 |
|
250 | parent: -1:0000000000000000000000000000000000000000 | |
251 | manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 |
|
251 | manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 | |
252 | user: test |
|
252 | user: test | |
253 | date: Thu Jan 01 00:00:01 1970 +0000 |
|
253 | date: Thu Jan 01 00:00:01 1970 +0000 | |
254 | files+: a |
|
254 | files+: a | |
255 | extra: branch=default |
|
255 | extra: branch=default | |
256 | description: |
|
256 | description: | |
257 | a |
|
257 | a | |
258 |
|
258 | |||
259 |
|
259 | |||
260 |
|
260 | |||
261 | Testing --traceback: |
|
261 | Testing --traceback: | |
262 |
|
262 | |||
263 | $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback' |
|
263 | $ hg --cwd c --config x --traceback id 2>&1 | grep -i 'traceback' | |
264 | Traceback (most recent call last): |
|
264 | Traceback (most recent call last): | |
265 |
|
265 | |||
266 | Testing --time: |
|
266 | Testing --time: | |
267 |
|
267 | |||
268 | $ hg --cwd a --time id |
|
268 | $ hg --cwd a --time id | |
269 | 8580ff50825a tip |
|
269 | 8580ff50825a tip | |
270 | time: real * (glob) |
|
270 | time: real * (glob) | |
271 |
|
271 | |||
272 | Testing --version: |
|
272 | Testing --version: | |
273 |
|
273 | |||
274 | $ hg --version -q |
|
274 | $ hg --version -q | |
275 | Mercurial Distributed SCM * (glob) |
|
275 | Mercurial Distributed SCM * (glob) | |
276 |
|
276 | |||
277 | hide outer repo |
|
277 | hide outer repo | |
278 | $ hg init |
|
278 | $ hg init | |
279 |
|
279 | |||
280 | Testing -h/--help: |
|
280 | Testing -h/--help: | |
281 |
|
281 | |||
282 | $ hg -h |
|
282 | $ hg -h | |
283 | Mercurial Distributed SCM |
|
283 | Mercurial Distributed SCM | |
284 |
|
284 | |||
285 | list of commands: |
|
285 | list of commands: | |
286 |
|
286 | |||
287 | add add the specified files on the next commit |
|
287 | add add the specified files on the next commit | |
288 | addremove add all new files, delete all missing files |
|
288 | addremove add all new files, delete all missing files | |
289 | annotate show changeset information by line for each file |
|
289 | annotate show changeset information by line for each file | |
290 | archive create an unversioned archive of a repository revision |
|
290 | archive create an unversioned archive of a repository revision | |
291 | backout reverse effect of earlier changeset |
|
291 | backout reverse effect of earlier changeset | |
292 | bisect subdivision search of changesets |
|
292 | bisect subdivision search of changesets | |
293 | bookmarks track a line of development with movable markers |
|
293 | bookmarks create a new bookmark or list existing bookmarks | |
294 | branch set or show the current branch name |
|
294 | branch set or show the current branch name | |
295 | branches list repository named branches |
|
295 | branches list repository named branches | |
296 | bundle create a changegroup file |
|
296 | bundle create a changegroup file | |
297 | cat output the current or given revision of files |
|
297 | cat output the current or given revision of files | |
298 | clone make a copy of an existing repository |
|
298 | clone make a copy of an existing repository | |
299 | commit commit the specified files or all outstanding changes |
|
299 | commit commit the specified files or all outstanding changes | |
300 | config show combined config settings from all hgrc files |
|
300 | config show combined config settings from all hgrc files | |
301 | copy mark files as copied for the next commit |
|
301 | copy mark files as copied for the next commit | |
302 | diff diff repository (or selected files) |
|
302 | diff diff repository (or selected files) | |
303 | export dump the header and diffs for one or more changesets |
|
303 | export dump the header and diffs for one or more changesets | |
304 | forget forget the specified files on the next commit |
|
304 | forget forget the specified files on the next commit | |
305 | graft copy changes from other branches onto the current branch |
|
305 | graft copy changes from other branches onto the current branch | |
306 | grep search for a pattern in specified files and revisions |
|
306 | grep search for a pattern in specified files and revisions | |
307 | heads show branch heads |
|
307 | heads show branch heads | |
308 | help show help for a given topic or a help overview |
|
308 | help show help for a given topic or a help overview | |
309 | identify identify the working copy or specified revision |
|
309 | identify identify the working copy or specified revision | |
310 | import import an ordered set of patches |
|
310 | import import an ordered set of patches | |
311 | incoming show new changesets found in source |
|
311 | incoming show new changesets found in source | |
312 | init create a new repository in the given directory |
|
312 | init create a new repository in the given directory | |
313 | locate locate files matching specific patterns |
|
313 | locate locate files matching specific patterns | |
314 | log show revision history of entire repository or files |
|
314 | log show revision history of entire repository or files | |
315 | manifest output the current or given revision of the project manifest |
|
315 | manifest output the current or given revision of the project manifest | |
316 | merge merge working directory with another revision |
|
316 | merge merge working directory with another revision | |
317 | outgoing show changesets not found in the destination |
|
317 | outgoing show changesets not found in the destination | |
318 | parents show the parents of the working directory or revision |
|
318 | parents show the parents of the working directory or revision | |
319 | paths show aliases for remote repositories |
|
319 | paths show aliases for remote repositories | |
320 | phase set or show the current phase name |
|
320 | phase set or show the current phase name | |
321 | pull pull changes from the specified source |
|
321 | pull pull changes from the specified source | |
322 | push push changes to the specified destination |
|
322 | push push changes to the specified destination | |
323 | recover roll back an interrupted transaction |
|
323 | recover roll back an interrupted transaction | |
324 | remove remove the specified files on the next commit |
|
324 | remove remove the specified files on the next commit | |
325 | rename rename files; equivalent of copy + remove |
|
325 | rename rename files; equivalent of copy + remove | |
326 | resolve redo merges or set/view the merge status of files |
|
326 | resolve redo merges or set/view the merge status of files | |
327 | revert restore files to their checkout state |
|
327 | revert restore files to their checkout state | |
328 | root print the root (top) of the current working directory |
|
328 | root print the root (top) of the current working directory | |
329 | serve start stand-alone webserver |
|
329 | serve start stand-alone webserver | |
330 | status show changed files in the working directory |
|
330 | status show changed files in the working directory | |
331 | summary summarize working directory state |
|
331 | summary summarize working directory state | |
332 | tag add one or more tags for the current or given revision |
|
332 | tag add one or more tags for the current or given revision | |
333 | tags list repository tags |
|
333 | tags list repository tags | |
334 | unbundle apply one or more changegroup files |
|
334 | unbundle apply one or more changegroup files | |
335 | update update working directory (or switch revisions) |
|
335 | update update working directory (or switch revisions) | |
336 | verify verify the integrity of the repository |
|
336 | verify verify the integrity of the repository | |
337 | version output version and copyright information |
|
337 | version output version and copyright information | |
338 |
|
338 | |||
339 | additional help topics: |
|
339 | additional help topics: | |
340 |
|
340 | |||
341 | config Configuration Files |
|
341 | config Configuration Files | |
342 | dates Date Formats |
|
342 | dates Date Formats | |
343 | diffs Diff Formats |
|
343 | diffs Diff Formats | |
344 | environment Environment Variables |
|
344 | environment Environment Variables | |
345 | extensions Using Additional Features |
|
345 | extensions Using Additional Features | |
346 | filesets Specifying File Sets |
|
346 | filesets Specifying File Sets | |
347 | glossary Glossary |
|
347 | glossary Glossary | |
348 | hgignore Syntax for Mercurial Ignore Files |
|
348 | hgignore Syntax for Mercurial Ignore Files | |
349 | hgweb Configuring hgweb |
|
349 | hgweb Configuring hgweb | |
350 | merge-tools Merge Tools |
|
350 | merge-tools Merge Tools | |
351 | multirevs Specifying Multiple Revisions |
|
351 | multirevs Specifying Multiple Revisions | |
352 | patterns File Name Patterns |
|
352 | patterns File Name Patterns | |
353 | phases Working with Phases |
|
353 | phases Working with Phases | |
354 | revisions Specifying Single Revisions |
|
354 | revisions Specifying Single Revisions | |
355 | revsets Specifying Revision Sets |
|
355 | revsets Specifying Revision Sets | |
356 | subrepos Subrepositories |
|
356 | subrepos Subrepositories | |
357 | templating Template Usage |
|
357 | templating Template Usage | |
358 | urls URL Paths |
|
358 | urls URL Paths | |
359 |
|
359 | |||
360 | use "hg -v help" to show builtin aliases and global options |
|
360 | use "hg -v help" to show builtin aliases and global options | |
361 |
|
361 | |||
362 |
|
362 | |||
363 |
|
363 | |||
364 | $ hg --help |
|
364 | $ hg --help | |
365 | Mercurial Distributed SCM |
|
365 | Mercurial Distributed SCM | |
366 |
|
366 | |||
367 | list of commands: |
|
367 | list of commands: | |
368 |
|
368 | |||
369 | add add the specified files on the next commit |
|
369 | add add the specified files on the next commit | |
370 | addremove add all new files, delete all missing files |
|
370 | addremove add all new files, delete all missing files | |
371 | annotate show changeset information by line for each file |
|
371 | annotate show changeset information by line for each file | |
372 | archive create an unversioned archive of a repository revision |
|
372 | archive create an unversioned archive of a repository revision | |
373 | backout reverse effect of earlier changeset |
|
373 | backout reverse effect of earlier changeset | |
374 | bisect subdivision search of changesets |
|
374 | bisect subdivision search of changesets | |
375 | bookmarks track a line of development with movable markers |
|
375 | bookmarks create a new bookmark or list existing bookmarks | |
376 | branch set or show the current branch name |
|
376 | branch set or show the current branch name | |
377 | branches list repository named branches |
|
377 | branches list repository named branches | |
378 | bundle create a changegroup file |
|
378 | bundle create a changegroup file | |
379 | cat output the current or given revision of files |
|
379 | cat output the current or given revision of files | |
380 | clone make a copy of an existing repository |
|
380 | clone make a copy of an existing repository | |
381 | commit commit the specified files or all outstanding changes |
|
381 | commit commit the specified files or all outstanding changes | |
382 | config show combined config settings from all hgrc files |
|
382 | config show combined config settings from all hgrc files | |
383 | copy mark files as copied for the next commit |
|
383 | copy mark files as copied for the next commit | |
384 | diff diff repository (or selected files) |
|
384 | diff diff repository (or selected files) | |
385 | export dump the header and diffs for one or more changesets |
|
385 | export dump the header and diffs for one or more changesets | |
386 | forget forget the specified files on the next commit |
|
386 | forget forget the specified files on the next commit | |
387 | graft copy changes from other branches onto the current branch |
|
387 | graft copy changes from other branches onto the current branch | |
388 | grep search for a pattern in specified files and revisions |
|
388 | grep search for a pattern in specified files and revisions | |
389 | heads show branch heads |
|
389 | heads show branch heads | |
390 | help show help for a given topic or a help overview |
|
390 | help show help for a given topic or a help overview | |
391 | identify identify the working copy or specified revision |
|
391 | identify identify the working copy or specified revision | |
392 | import import an ordered set of patches |
|
392 | import import an ordered set of patches | |
393 | incoming show new changesets found in source |
|
393 | incoming show new changesets found in source | |
394 | init create a new repository in the given directory |
|
394 | init create a new repository in the given directory | |
395 | locate locate files matching specific patterns |
|
395 | locate locate files matching specific patterns | |
396 | log show revision history of entire repository or files |
|
396 | log show revision history of entire repository or files | |
397 | manifest output the current or given revision of the project manifest |
|
397 | manifest output the current or given revision of the project manifest | |
398 | merge merge working directory with another revision |
|
398 | merge merge working directory with another revision | |
399 | outgoing show changesets not found in the destination |
|
399 | outgoing show changesets not found in the destination | |
400 | parents show the parents of the working directory or revision |
|
400 | parents show the parents of the working directory or revision | |
401 | paths show aliases for remote repositories |
|
401 | paths show aliases for remote repositories | |
402 | phase set or show the current phase name |
|
402 | phase set or show the current phase name | |
403 | pull pull changes from the specified source |
|
403 | pull pull changes from the specified source | |
404 | push push changes to the specified destination |
|
404 | push push changes to the specified destination | |
405 | recover roll back an interrupted transaction |
|
405 | recover roll back an interrupted transaction | |
406 | remove remove the specified files on the next commit |
|
406 | remove remove the specified files on the next commit | |
407 | rename rename files; equivalent of copy + remove |
|
407 | rename rename files; equivalent of copy + remove | |
408 | resolve redo merges or set/view the merge status of files |
|
408 | resolve redo merges or set/view the merge status of files | |
409 | revert restore files to their checkout state |
|
409 | revert restore files to their checkout state | |
410 | root print the root (top) of the current working directory |
|
410 | root print the root (top) of the current working directory | |
411 | serve start stand-alone webserver |
|
411 | serve start stand-alone webserver | |
412 | status show changed files in the working directory |
|
412 | status show changed files in the working directory | |
413 | summary summarize working directory state |
|
413 | summary summarize working directory state | |
414 | tag add one or more tags for the current or given revision |
|
414 | tag add one or more tags for the current or given revision | |
415 | tags list repository tags |
|
415 | tags list repository tags | |
416 | unbundle apply one or more changegroup files |
|
416 | unbundle apply one or more changegroup files | |
417 | update update working directory (or switch revisions) |
|
417 | update update working directory (or switch revisions) | |
418 | verify verify the integrity of the repository |
|
418 | verify verify the integrity of the repository | |
419 | version output version and copyright information |
|
419 | version output version and copyright information | |
420 |
|
420 | |||
421 | additional help topics: |
|
421 | additional help topics: | |
422 |
|
422 | |||
423 | config Configuration Files |
|
423 | config Configuration Files | |
424 | dates Date Formats |
|
424 | dates Date Formats | |
425 | diffs Diff Formats |
|
425 | diffs Diff Formats | |
426 | environment Environment Variables |
|
426 | environment Environment Variables | |
427 | extensions Using Additional Features |
|
427 | extensions Using Additional Features | |
428 | filesets Specifying File Sets |
|
428 | filesets Specifying File Sets | |
429 | glossary Glossary |
|
429 | glossary Glossary | |
430 | hgignore Syntax for Mercurial Ignore Files |
|
430 | hgignore Syntax for Mercurial Ignore Files | |
431 | hgweb Configuring hgweb |
|
431 | hgweb Configuring hgweb | |
432 | merge-tools Merge Tools |
|
432 | merge-tools Merge Tools | |
433 | multirevs Specifying Multiple Revisions |
|
433 | multirevs Specifying Multiple Revisions | |
434 | patterns File Name Patterns |
|
434 | patterns File Name Patterns | |
435 | phases Working with Phases |
|
435 | phases Working with Phases | |
436 | revisions Specifying Single Revisions |
|
436 | revisions Specifying Single Revisions | |
437 | revsets Specifying Revision Sets |
|
437 | revsets Specifying Revision Sets | |
438 | subrepos Subrepositories |
|
438 | subrepos Subrepositories | |
439 | templating Template Usage |
|
439 | templating Template Usage | |
440 | urls URL Paths |
|
440 | urls URL Paths | |
441 |
|
441 | |||
442 | use "hg -v help" to show builtin aliases and global options |
|
442 | use "hg -v help" to show builtin aliases and global options | |
443 |
|
443 | |||
444 | Not tested: --debugger |
|
444 | Not tested: --debugger | |
445 |
|
445 |
@@ -1,2087 +1,2087 b'' | |||||
1 | Short help: |
|
1 | Short help: | |
2 |
|
2 | |||
3 | $ hg |
|
3 | $ hg | |
4 | Mercurial Distributed SCM |
|
4 | Mercurial Distributed SCM | |
5 |
|
5 | |||
6 | basic commands: |
|
6 | basic commands: | |
7 |
|
7 | |||
8 | add add the specified files on the next commit |
|
8 | add add the specified files on the next commit | |
9 | annotate show changeset information by line for each file |
|
9 | annotate show changeset information by line for each file | |
10 | clone make a copy of an existing repository |
|
10 | clone make a copy of an existing repository | |
11 | commit commit the specified files or all outstanding changes |
|
11 | commit commit the specified files or all outstanding changes | |
12 | diff diff repository (or selected files) |
|
12 | diff diff repository (or selected files) | |
13 | export dump the header and diffs for one or more changesets |
|
13 | export dump the header and diffs for one or more changesets | |
14 | forget forget the specified files on the next commit |
|
14 | forget forget the specified files on the next commit | |
15 | init create a new repository in the given directory |
|
15 | init create a new repository in the given directory | |
16 | log show revision history of entire repository or files |
|
16 | log show revision history of entire repository or files | |
17 | merge merge working directory with another revision |
|
17 | merge merge working directory with another revision | |
18 | pull pull changes from the specified source |
|
18 | pull pull changes from the specified source | |
19 | push push changes to the specified destination |
|
19 | push push changes to the specified destination | |
20 | remove remove the specified files on the next commit |
|
20 | remove remove the specified files on the next commit | |
21 | serve start stand-alone webserver |
|
21 | serve start stand-alone webserver | |
22 | status show changed files in the working directory |
|
22 | status show changed files in the working directory | |
23 | summary summarize working directory state |
|
23 | summary summarize working directory state | |
24 | update update working directory (or switch revisions) |
|
24 | update update working directory (or switch revisions) | |
25 |
|
25 | |||
26 | use "hg help" for the full list of commands or "hg -v" for details |
|
26 | use "hg help" for the full list of commands or "hg -v" for details | |
27 |
|
27 | |||
28 | $ hg -q |
|
28 | $ hg -q | |
29 | add add the specified files on the next commit |
|
29 | add add the specified files on the next commit | |
30 | annotate show changeset information by line for each file |
|
30 | annotate show changeset information by line for each file | |
31 | clone make a copy of an existing repository |
|
31 | clone make a copy of an existing repository | |
32 | commit commit the specified files or all outstanding changes |
|
32 | commit commit the specified files or all outstanding changes | |
33 | diff diff repository (or selected files) |
|
33 | diff diff repository (or selected files) | |
34 | export dump the header and diffs for one or more changesets |
|
34 | export dump the header and diffs for one or more changesets | |
35 | forget forget the specified files on the next commit |
|
35 | forget forget the specified files on the next commit | |
36 | init create a new repository in the given directory |
|
36 | init create a new repository in the given directory | |
37 | log show revision history of entire repository or files |
|
37 | log show revision history of entire repository or files | |
38 | merge merge working directory with another revision |
|
38 | merge merge working directory with another revision | |
39 | pull pull changes from the specified source |
|
39 | pull pull changes from the specified source | |
40 | push push changes to the specified destination |
|
40 | push push changes to the specified destination | |
41 | remove remove the specified files on the next commit |
|
41 | remove remove the specified files on the next commit | |
42 | serve start stand-alone webserver |
|
42 | serve start stand-alone webserver | |
43 | status show changed files in the working directory |
|
43 | status show changed files in the working directory | |
44 | summary summarize working directory state |
|
44 | summary summarize working directory state | |
45 | update update working directory (or switch revisions) |
|
45 | update update working directory (or switch revisions) | |
46 |
|
46 | |||
47 | $ hg help |
|
47 | $ hg help | |
48 | Mercurial Distributed SCM |
|
48 | Mercurial Distributed SCM | |
49 |
|
49 | |||
50 | list of commands: |
|
50 | list of commands: | |
51 |
|
51 | |||
52 | add add the specified files on the next commit |
|
52 | add add the specified files on the next commit | |
53 | addremove add all new files, delete all missing files |
|
53 | addremove add all new files, delete all missing files | |
54 | annotate show changeset information by line for each file |
|
54 | annotate show changeset information by line for each file | |
55 | archive create an unversioned archive of a repository revision |
|
55 | archive create an unversioned archive of a repository revision | |
56 | backout reverse effect of earlier changeset |
|
56 | backout reverse effect of earlier changeset | |
57 | bisect subdivision search of changesets |
|
57 | bisect subdivision search of changesets | |
58 | bookmarks track a line of development with movable markers |
|
58 | bookmarks create a new bookmark or list existing bookmarks | |
59 | branch set or show the current branch name |
|
59 | branch set or show the current branch name | |
60 | branches list repository named branches |
|
60 | branches list repository named branches | |
61 | bundle create a changegroup file |
|
61 | bundle create a changegroup file | |
62 | cat output the current or given revision of files |
|
62 | cat output the current or given revision of files | |
63 | clone make a copy of an existing repository |
|
63 | clone make a copy of an existing repository | |
64 | commit commit the specified files or all outstanding changes |
|
64 | commit commit the specified files or all outstanding changes | |
65 | config show combined config settings from all hgrc files |
|
65 | config show combined config settings from all hgrc files | |
66 | copy mark files as copied for the next commit |
|
66 | copy mark files as copied for the next commit | |
67 | diff diff repository (or selected files) |
|
67 | diff diff repository (or selected files) | |
68 | export dump the header and diffs for one or more changesets |
|
68 | export dump the header and diffs for one or more changesets | |
69 | forget forget the specified files on the next commit |
|
69 | forget forget the specified files on the next commit | |
70 | graft copy changes from other branches onto the current branch |
|
70 | graft copy changes from other branches onto the current branch | |
71 | grep search for a pattern in specified files and revisions |
|
71 | grep search for a pattern in specified files and revisions | |
72 | heads show branch heads |
|
72 | heads show branch heads | |
73 | help show help for a given topic or a help overview |
|
73 | help show help for a given topic or a help overview | |
74 | identify identify the working copy or specified revision |
|
74 | identify identify the working copy or specified revision | |
75 | import import an ordered set of patches |
|
75 | import import an ordered set of patches | |
76 | incoming show new changesets found in source |
|
76 | incoming show new changesets found in source | |
77 | init create a new repository in the given directory |
|
77 | init create a new repository in the given directory | |
78 | locate locate files matching specific patterns |
|
78 | locate locate files matching specific patterns | |
79 | log show revision history of entire repository or files |
|
79 | log show revision history of entire repository or files | |
80 | manifest output the current or given revision of the project manifest |
|
80 | manifest output the current or given revision of the project manifest | |
81 | merge merge working directory with another revision |
|
81 | merge merge working directory with another revision | |
82 | outgoing show changesets not found in the destination |
|
82 | outgoing show changesets not found in the destination | |
83 | parents show the parents of the working directory or revision |
|
83 | parents show the parents of the working directory or revision | |
84 | paths show aliases for remote repositories |
|
84 | paths show aliases for remote repositories | |
85 | phase set or show the current phase name |
|
85 | phase set or show the current phase name | |
86 | pull pull changes from the specified source |
|
86 | pull pull changes from the specified source | |
87 | push push changes to the specified destination |
|
87 | push push changes to the specified destination | |
88 | recover roll back an interrupted transaction |
|
88 | recover roll back an interrupted transaction | |
89 | remove remove the specified files on the next commit |
|
89 | remove remove the specified files on the next commit | |
90 | rename rename files; equivalent of copy + remove |
|
90 | rename rename files; equivalent of copy + remove | |
91 | resolve redo merges or set/view the merge status of files |
|
91 | resolve redo merges or set/view the merge status of files | |
92 | revert restore files to their checkout state |
|
92 | revert restore files to their checkout state | |
93 | root print the root (top) of the current working directory |
|
93 | root print the root (top) of the current working directory | |
94 | serve start stand-alone webserver |
|
94 | serve start stand-alone webserver | |
95 | status show changed files in the working directory |
|
95 | status show changed files in the working directory | |
96 | summary summarize working directory state |
|
96 | summary summarize working directory state | |
97 | tag add one or more tags for the current or given revision |
|
97 | tag add one or more tags for the current or given revision | |
98 | tags list repository tags |
|
98 | tags list repository tags | |
99 | unbundle apply one or more changegroup files |
|
99 | unbundle apply one or more changegroup files | |
100 | update update working directory (or switch revisions) |
|
100 | update update working directory (or switch revisions) | |
101 | verify verify the integrity of the repository |
|
101 | verify verify the integrity of the repository | |
102 | version output version and copyright information |
|
102 | version output version and copyright information | |
103 |
|
103 | |||
104 | additional help topics: |
|
104 | additional help topics: | |
105 |
|
105 | |||
106 | config Configuration Files |
|
106 | config Configuration Files | |
107 | dates Date Formats |
|
107 | dates Date Formats | |
108 | diffs Diff Formats |
|
108 | diffs Diff Formats | |
109 | environment Environment Variables |
|
109 | environment Environment Variables | |
110 | extensions Using Additional Features |
|
110 | extensions Using Additional Features | |
111 | filesets Specifying File Sets |
|
111 | filesets Specifying File Sets | |
112 | glossary Glossary |
|
112 | glossary Glossary | |
113 | hgignore Syntax for Mercurial Ignore Files |
|
113 | hgignore Syntax for Mercurial Ignore Files | |
114 | hgweb Configuring hgweb |
|
114 | hgweb Configuring hgweb | |
115 | merge-tools Merge Tools |
|
115 | merge-tools Merge Tools | |
116 | multirevs Specifying Multiple Revisions |
|
116 | multirevs Specifying Multiple Revisions | |
117 | patterns File Name Patterns |
|
117 | patterns File Name Patterns | |
118 | phases Working with Phases |
|
118 | phases Working with Phases | |
119 | revisions Specifying Single Revisions |
|
119 | revisions Specifying Single Revisions | |
120 | revsets Specifying Revision Sets |
|
120 | revsets Specifying Revision Sets | |
121 | subrepos Subrepositories |
|
121 | subrepos Subrepositories | |
122 | templating Template Usage |
|
122 | templating Template Usage | |
123 | urls URL Paths |
|
123 | urls URL Paths | |
124 |
|
124 | |||
125 | use "hg -v help" to show builtin aliases and global options |
|
125 | use "hg -v help" to show builtin aliases and global options | |
126 |
|
126 | |||
127 | $ hg -q help |
|
127 | $ hg -q help | |
128 | add add the specified files on the next commit |
|
128 | add add the specified files on the next commit | |
129 | addremove add all new files, delete all missing files |
|
129 | addremove add all new files, delete all missing files | |
130 | annotate show changeset information by line for each file |
|
130 | annotate show changeset information by line for each file | |
131 | archive create an unversioned archive of a repository revision |
|
131 | archive create an unversioned archive of a repository revision | |
132 | backout reverse effect of earlier changeset |
|
132 | backout reverse effect of earlier changeset | |
133 | bisect subdivision search of changesets |
|
133 | bisect subdivision search of changesets | |
134 | bookmarks track a line of development with movable markers |
|
134 | bookmarks create a new bookmark or list existing bookmarks | |
135 | branch set or show the current branch name |
|
135 | branch set or show the current branch name | |
136 | branches list repository named branches |
|
136 | branches list repository named branches | |
137 | bundle create a changegroup file |
|
137 | bundle create a changegroup file | |
138 | cat output the current or given revision of files |
|
138 | cat output the current or given revision of files | |
139 | clone make a copy of an existing repository |
|
139 | clone make a copy of an existing repository | |
140 | commit commit the specified files or all outstanding changes |
|
140 | commit commit the specified files or all outstanding changes | |
141 | config show combined config settings from all hgrc files |
|
141 | config show combined config settings from all hgrc files | |
142 | copy mark files as copied for the next commit |
|
142 | copy mark files as copied for the next commit | |
143 | diff diff repository (or selected files) |
|
143 | diff diff repository (or selected files) | |
144 | export dump the header and diffs for one or more changesets |
|
144 | export dump the header and diffs for one or more changesets | |
145 | forget forget the specified files on the next commit |
|
145 | forget forget the specified files on the next commit | |
146 | graft copy changes from other branches onto the current branch |
|
146 | graft copy changes from other branches onto the current branch | |
147 | grep search for a pattern in specified files and revisions |
|
147 | grep search for a pattern in specified files and revisions | |
148 | heads show branch heads |
|
148 | heads show branch heads | |
149 | help show help for a given topic or a help overview |
|
149 | help show help for a given topic or a help overview | |
150 | identify identify the working copy or specified revision |
|
150 | identify identify the working copy or specified revision | |
151 | import import an ordered set of patches |
|
151 | import import an ordered set of patches | |
152 | incoming show new changesets found in source |
|
152 | incoming show new changesets found in source | |
153 | init create a new repository in the given directory |
|
153 | init create a new repository in the given directory | |
154 | locate locate files matching specific patterns |
|
154 | locate locate files matching specific patterns | |
155 | log show revision history of entire repository or files |
|
155 | log show revision history of entire repository or files | |
156 | manifest output the current or given revision of the project manifest |
|
156 | manifest output the current or given revision of the project manifest | |
157 | merge merge working directory with another revision |
|
157 | merge merge working directory with another revision | |
158 | outgoing show changesets not found in the destination |
|
158 | outgoing show changesets not found in the destination | |
159 | parents show the parents of the working directory or revision |
|
159 | parents show the parents of the working directory or revision | |
160 | paths show aliases for remote repositories |
|
160 | paths show aliases for remote repositories | |
161 | phase set or show the current phase name |
|
161 | phase set or show the current phase name | |
162 | pull pull changes from the specified source |
|
162 | pull pull changes from the specified source | |
163 | push push changes to the specified destination |
|
163 | push push changes to the specified destination | |
164 | recover roll back an interrupted transaction |
|
164 | recover roll back an interrupted transaction | |
165 | remove remove the specified files on the next commit |
|
165 | remove remove the specified files on the next commit | |
166 | rename rename files; equivalent of copy + remove |
|
166 | rename rename files; equivalent of copy + remove | |
167 | resolve redo merges or set/view the merge status of files |
|
167 | resolve redo merges or set/view the merge status of files | |
168 | revert restore files to their checkout state |
|
168 | revert restore files to their checkout state | |
169 | root print the root (top) of the current working directory |
|
169 | root print the root (top) of the current working directory | |
170 | serve start stand-alone webserver |
|
170 | serve start stand-alone webserver | |
171 | status show changed files in the working directory |
|
171 | status show changed files in the working directory | |
172 | summary summarize working directory state |
|
172 | summary summarize working directory state | |
173 | tag add one or more tags for the current or given revision |
|
173 | tag add one or more tags for the current or given revision | |
174 | tags list repository tags |
|
174 | tags list repository tags | |
175 | unbundle apply one or more changegroup files |
|
175 | unbundle apply one or more changegroup files | |
176 | update update working directory (or switch revisions) |
|
176 | update update working directory (or switch revisions) | |
177 | verify verify the integrity of the repository |
|
177 | verify verify the integrity of the repository | |
178 | version output version and copyright information |
|
178 | version output version and copyright information | |
179 |
|
179 | |||
180 | additional help topics: |
|
180 | additional help topics: | |
181 |
|
181 | |||
182 | config Configuration Files |
|
182 | config Configuration Files | |
183 | dates Date Formats |
|
183 | dates Date Formats | |
184 | diffs Diff Formats |
|
184 | diffs Diff Formats | |
185 | environment Environment Variables |
|
185 | environment Environment Variables | |
186 | extensions Using Additional Features |
|
186 | extensions Using Additional Features | |
187 | filesets Specifying File Sets |
|
187 | filesets Specifying File Sets | |
188 | glossary Glossary |
|
188 | glossary Glossary | |
189 | hgignore Syntax for Mercurial Ignore Files |
|
189 | hgignore Syntax for Mercurial Ignore Files | |
190 | hgweb Configuring hgweb |
|
190 | hgweb Configuring hgweb | |
191 | merge-tools Merge Tools |
|
191 | merge-tools Merge Tools | |
192 | multirevs Specifying Multiple Revisions |
|
192 | multirevs Specifying Multiple Revisions | |
193 | patterns File Name Patterns |
|
193 | patterns File Name Patterns | |
194 | phases Working with Phases |
|
194 | phases Working with Phases | |
195 | revisions Specifying Single Revisions |
|
195 | revisions Specifying Single Revisions | |
196 | revsets Specifying Revision Sets |
|
196 | revsets Specifying Revision Sets | |
197 | subrepos Subrepositories |
|
197 | subrepos Subrepositories | |
198 | templating Template Usage |
|
198 | templating Template Usage | |
199 | urls URL Paths |
|
199 | urls URL Paths | |
200 |
|
200 | |||
201 | Test extension help: |
|
201 | Test extension help: | |
202 | $ hg help extensions --config extensions.rebase= --config extensions.children= |
|
202 | $ hg help extensions --config extensions.rebase= --config extensions.children= | |
203 | Using Additional Features |
|
203 | Using Additional Features | |
204 | """"""""""""""""""""""""" |
|
204 | """"""""""""""""""""""""" | |
205 |
|
205 | |||
206 | Mercurial has the ability to add new features through the use of |
|
206 | Mercurial has the ability to add new features through the use of | |
207 | extensions. Extensions may add new commands, add options to existing |
|
207 | extensions. Extensions may add new commands, add options to existing | |
208 | commands, change the default behavior of commands, or implement hooks. |
|
208 | commands, change the default behavior of commands, or implement hooks. | |
209 |
|
209 | |||
210 | To enable the "foo" extension, either shipped with Mercurial or in the |
|
210 | To enable the "foo" extension, either shipped with Mercurial or in the | |
211 | Python search path, create an entry for it in your configuration file, |
|
211 | Python search path, create an entry for it in your configuration file, | |
212 | like this: |
|
212 | like this: | |
213 |
|
213 | |||
214 | [extensions] |
|
214 | [extensions] | |
215 | foo = |
|
215 | foo = | |
216 |
|
216 | |||
217 | You may also specify the full path to an extension: |
|
217 | You may also specify the full path to an extension: | |
218 |
|
218 | |||
219 | [extensions] |
|
219 | [extensions] | |
220 | myfeature = ~/.hgext/myfeature.py |
|
220 | myfeature = ~/.hgext/myfeature.py | |
221 |
|
221 | |||
222 | See "hg help config" for more information on configuration files. |
|
222 | See "hg help config" for more information on configuration files. | |
223 |
|
223 | |||
224 | Extensions are not loaded by default for a variety of reasons: they can |
|
224 | Extensions are not loaded by default for a variety of reasons: they can | |
225 | increase startup overhead; they may be meant for advanced usage only; they |
|
225 | increase startup overhead; they may be meant for advanced usage only; they | |
226 | may provide potentially dangerous abilities (such as letting you destroy |
|
226 | may provide potentially dangerous abilities (such as letting you destroy | |
227 | or modify history); they might not be ready for prime time; or they may |
|
227 | or modify history); they might not be ready for prime time; or they may | |
228 | alter some usual behaviors of stock Mercurial. It is thus up to the user |
|
228 | alter some usual behaviors of stock Mercurial. It is thus up to the user | |
229 | to activate extensions as needed. |
|
229 | to activate extensions as needed. | |
230 |
|
230 | |||
231 | To explicitly disable an extension enabled in a configuration file of |
|
231 | To explicitly disable an extension enabled in a configuration file of | |
232 | broader scope, prepend its path with !: |
|
232 | broader scope, prepend its path with !: | |
233 |
|
233 | |||
234 | [extensions] |
|
234 | [extensions] | |
235 | # disabling extension bar residing in /path/to/extension/bar.py |
|
235 | # disabling extension bar residing in /path/to/extension/bar.py | |
236 | bar = !/path/to/extension/bar.py |
|
236 | bar = !/path/to/extension/bar.py | |
237 | # ditto, but no path was supplied for extension baz |
|
237 | # ditto, but no path was supplied for extension baz | |
238 | baz = ! |
|
238 | baz = ! | |
239 |
|
239 | |||
240 | enabled extensions: |
|
240 | enabled extensions: | |
241 |
|
241 | |||
242 | children command to display child changesets (DEPRECATED) |
|
242 | children command to display child changesets (DEPRECATED) | |
243 | rebase command to move sets of revisions to a different ancestor |
|
243 | rebase command to move sets of revisions to a different ancestor | |
244 |
|
244 | |||
245 | disabled extensions: |
|
245 | disabled extensions: | |
246 |
|
246 | |||
247 | acl hooks for controlling repository access |
|
247 | acl hooks for controlling repository access | |
248 | blackbox log repository events to a blackbox for debugging |
|
248 | blackbox log repository events to a blackbox for debugging | |
249 | bugzilla hooks for integrating with the Bugzilla bug tracker |
|
249 | bugzilla hooks for integrating with the Bugzilla bug tracker | |
250 | churn command to display statistics about repository history |
|
250 | churn command to display statistics about repository history | |
251 | color colorize output from some commands |
|
251 | color colorize output from some commands | |
252 | convert import revisions from foreign VCS repositories into |
|
252 | convert import revisions from foreign VCS repositories into | |
253 | Mercurial |
|
253 | Mercurial | |
254 | eol automatically manage newlines in repository files |
|
254 | eol automatically manage newlines in repository files | |
255 | extdiff command to allow external programs to compare revisions |
|
255 | extdiff command to allow external programs to compare revisions | |
256 | factotum http authentication with factotum |
|
256 | factotum http authentication with factotum | |
257 | gpg commands to sign and verify changesets |
|
257 | gpg commands to sign and verify changesets | |
258 | hgcia hooks for integrating with the CIA.vc notification service |
|
258 | hgcia hooks for integrating with the CIA.vc notification service | |
259 | hgk browse the repository in a graphical way |
|
259 | hgk browse the repository in a graphical way | |
260 | highlight syntax highlighting for hgweb (requires Pygments) |
|
260 | highlight syntax highlighting for hgweb (requires Pygments) | |
261 | histedit interactive history editing |
|
261 | histedit interactive history editing | |
262 | keyword expand keywords in tracked files |
|
262 | keyword expand keywords in tracked files | |
263 | largefiles track large binary files |
|
263 | largefiles track large binary files | |
264 | mq manage a stack of patches |
|
264 | mq manage a stack of patches | |
265 | notify hooks for sending email push notifications |
|
265 | notify hooks for sending email push notifications | |
266 | pager browse command output with an external pager |
|
266 | pager browse command output with an external pager | |
267 | patchbomb command to send changesets as (a series of) patch emails |
|
267 | patchbomb command to send changesets as (a series of) patch emails | |
268 | progress show progress bars for some actions |
|
268 | progress show progress bars for some actions | |
269 | purge command to delete untracked files from the working |
|
269 | purge command to delete untracked files from the working | |
270 | directory |
|
270 | directory | |
271 | record commands to interactively select changes for |
|
271 | record commands to interactively select changes for | |
272 | commit/qrefresh |
|
272 | commit/qrefresh | |
273 | relink recreates hardlinks between repository clones |
|
273 | relink recreates hardlinks between repository clones | |
274 | schemes extend schemes with shortcuts to repository swarms |
|
274 | schemes extend schemes with shortcuts to repository swarms | |
275 | share share a common history between several working directories |
|
275 | share share a common history between several working directories | |
276 | shelve save and restore changes to the working directory |
|
276 | shelve save and restore changes to the working directory | |
277 | strip strip changesets and their descendents from history |
|
277 | strip strip changesets and their descendents from history | |
278 | transplant command to transplant changesets from another branch |
|
278 | transplant command to transplant changesets from another branch | |
279 | win32mbcs allow the use of MBCS paths with problematic encodings |
|
279 | win32mbcs allow the use of MBCS paths with problematic encodings | |
280 | zeroconf discover and advertise repositories on the local network |
|
280 | zeroconf discover and advertise repositories on the local network | |
281 | Test short command list with verbose option |
|
281 | Test short command list with verbose option | |
282 |
|
282 | |||
283 | $ hg -v help shortlist |
|
283 | $ hg -v help shortlist | |
284 | Mercurial Distributed SCM |
|
284 | Mercurial Distributed SCM | |
285 |
|
285 | |||
286 | basic commands: |
|
286 | basic commands: | |
287 |
|
287 | |||
288 | add add the specified files on the next commit |
|
288 | add add the specified files on the next commit | |
289 | annotate, blame |
|
289 | annotate, blame | |
290 | show changeset information by line for each file |
|
290 | show changeset information by line for each file | |
291 | clone make a copy of an existing repository |
|
291 | clone make a copy of an existing repository | |
292 | commit, ci commit the specified files or all outstanding changes |
|
292 | commit, ci commit the specified files or all outstanding changes | |
293 | diff diff repository (or selected files) |
|
293 | diff diff repository (or selected files) | |
294 | export dump the header and diffs for one or more changesets |
|
294 | export dump the header and diffs for one or more changesets | |
295 | forget forget the specified files on the next commit |
|
295 | forget forget the specified files on the next commit | |
296 | init create a new repository in the given directory |
|
296 | init create a new repository in the given directory | |
297 | log, history show revision history of entire repository or files |
|
297 | log, history show revision history of entire repository or files | |
298 | merge merge working directory with another revision |
|
298 | merge merge working directory with another revision | |
299 | pull pull changes from the specified source |
|
299 | pull pull changes from the specified source | |
300 | push push changes to the specified destination |
|
300 | push push changes to the specified destination | |
301 | remove, rm remove the specified files on the next commit |
|
301 | remove, rm remove the specified files on the next commit | |
302 | serve start stand-alone webserver |
|
302 | serve start stand-alone webserver | |
303 | status, st show changed files in the working directory |
|
303 | status, st show changed files in the working directory | |
304 | summary, sum summarize working directory state |
|
304 | summary, sum summarize working directory state | |
305 | update, up, checkout, co |
|
305 | update, up, checkout, co | |
306 | update working directory (or switch revisions) |
|
306 | update working directory (or switch revisions) | |
307 |
|
307 | |||
308 | global options: |
|
308 | global options: | |
309 |
|
309 | |||
310 | -R --repository REPO repository root directory or name of overlay bundle |
|
310 | -R --repository REPO repository root directory or name of overlay bundle | |
311 | file |
|
311 | file | |
312 | --cwd DIR change working directory |
|
312 | --cwd DIR change working directory | |
313 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
313 | -y --noninteractive do not prompt, automatically pick the first choice for | |
314 | all prompts |
|
314 | all prompts | |
315 | -q --quiet suppress output |
|
315 | -q --quiet suppress output | |
316 | -v --verbose enable additional output |
|
316 | -v --verbose enable additional output | |
317 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
317 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
318 | --debug enable debugging output |
|
318 | --debug enable debugging output | |
319 | --debugger start debugger |
|
319 | --debugger start debugger | |
320 | --encoding ENCODE set the charset encoding (default: ascii) |
|
320 | --encoding ENCODE set the charset encoding (default: ascii) | |
321 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
321 | --encodingmode MODE set the charset encoding mode (default: strict) | |
322 | --traceback always print a traceback on exception |
|
322 | --traceback always print a traceback on exception | |
323 | --time time how long the command takes |
|
323 | --time time how long the command takes | |
324 | --profile print command execution profile |
|
324 | --profile print command execution profile | |
325 | --version output version information and exit |
|
325 | --version output version information and exit | |
326 | -h --help display help and exit |
|
326 | -h --help display help and exit | |
327 | --hidden consider hidden changesets |
|
327 | --hidden consider hidden changesets | |
328 |
|
328 | |||
329 | [+] marked option can be specified multiple times |
|
329 | [+] marked option can be specified multiple times | |
330 |
|
330 | |||
331 | use "hg help" for the full list of commands |
|
331 | use "hg help" for the full list of commands | |
332 |
|
332 | |||
333 | $ hg add -h |
|
333 | $ hg add -h | |
334 | hg add [OPTION]... [FILE]... |
|
334 | hg add [OPTION]... [FILE]... | |
335 |
|
335 | |||
336 | add the specified files on the next commit |
|
336 | add the specified files on the next commit | |
337 |
|
337 | |||
338 | Schedule files to be version controlled and added to the repository. |
|
338 | Schedule files to be version controlled and added to the repository. | |
339 |
|
339 | |||
340 | The files will be added to the repository at the next commit. To undo an |
|
340 | The files will be added to the repository at the next commit. To undo an | |
341 | add before that, see "hg forget". |
|
341 | add before that, see "hg forget". | |
342 |
|
342 | |||
343 | If no names are given, add all files to the repository. |
|
343 | If no names are given, add all files to the repository. | |
344 |
|
344 | |||
345 | Returns 0 if all files are successfully added. |
|
345 | Returns 0 if all files are successfully added. | |
346 |
|
346 | |||
347 | options: |
|
347 | options: | |
348 |
|
348 | |||
349 | -I --include PATTERN [+] include names matching the given patterns |
|
349 | -I --include PATTERN [+] include names matching the given patterns | |
350 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
350 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
351 | -S --subrepos recurse into subrepositories |
|
351 | -S --subrepos recurse into subrepositories | |
352 | -n --dry-run do not perform actions, just print output |
|
352 | -n --dry-run do not perform actions, just print output | |
353 |
|
353 | |||
354 | [+] marked option can be specified multiple times |
|
354 | [+] marked option can be specified multiple times | |
355 |
|
355 | |||
356 | use "hg -v help add" to show more complete help and the global options |
|
356 | use "hg -v help add" to show more complete help and the global options | |
357 |
|
357 | |||
358 | Verbose help for add |
|
358 | Verbose help for add | |
359 |
|
359 | |||
360 | $ hg add -hv |
|
360 | $ hg add -hv | |
361 | hg add [OPTION]... [FILE]... |
|
361 | hg add [OPTION]... [FILE]... | |
362 |
|
362 | |||
363 | add the specified files on the next commit |
|
363 | add the specified files on the next commit | |
364 |
|
364 | |||
365 | Schedule files to be version controlled and added to the repository. |
|
365 | Schedule files to be version controlled and added to the repository. | |
366 |
|
366 | |||
367 | The files will be added to the repository at the next commit. To undo an |
|
367 | The files will be added to the repository at the next commit. To undo an | |
368 | add before that, see "hg forget". |
|
368 | add before that, see "hg forget". | |
369 |
|
369 | |||
370 | If no names are given, add all files to the repository. |
|
370 | If no names are given, add all files to the repository. | |
371 |
|
371 | |||
372 | An example showing how new (unknown) files are added automatically by "hg |
|
372 | An example showing how new (unknown) files are added automatically by "hg | |
373 | add": |
|
373 | add": | |
374 |
|
374 | |||
375 | $ ls |
|
375 | $ ls | |
376 | foo.c |
|
376 | foo.c | |
377 | $ hg status |
|
377 | $ hg status | |
378 | ? foo.c |
|
378 | ? foo.c | |
379 | $ hg add |
|
379 | $ hg add | |
380 | adding foo.c |
|
380 | adding foo.c | |
381 | $ hg status |
|
381 | $ hg status | |
382 | A foo.c |
|
382 | A foo.c | |
383 |
|
383 | |||
384 | Returns 0 if all files are successfully added. |
|
384 | Returns 0 if all files are successfully added. | |
385 |
|
385 | |||
386 | options: |
|
386 | options: | |
387 |
|
387 | |||
388 | -I --include PATTERN [+] include names matching the given patterns |
|
388 | -I --include PATTERN [+] include names matching the given patterns | |
389 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
389 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
390 | -S --subrepos recurse into subrepositories |
|
390 | -S --subrepos recurse into subrepositories | |
391 | -n --dry-run do not perform actions, just print output |
|
391 | -n --dry-run do not perform actions, just print output | |
392 |
|
392 | |||
393 | [+] marked option can be specified multiple times |
|
393 | [+] marked option can be specified multiple times | |
394 |
|
394 | |||
395 | global options: |
|
395 | global options: | |
396 |
|
396 | |||
397 | -R --repository REPO repository root directory or name of overlay bundle |
|
397 | -R --repository REPO repository root directory or name of overlay bundle | |
398 | file |
|
398 | file | |
399 | --cwd DIR change working directory |
|
399 | --cwd DIR change working directory | |
400 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
400 | -y --noninteractive do not prompt, automatically pick the first choice for | |
401 | all prompts |
|
401 | all prompts | |
402 | -q --quiet suppress output |
|
402 | -q --quiet suppress output | |
403 | -v --verbose enable additional output |
|
403 | -v --verbose enable additional output | |
404 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
404 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
405 | --debug enable debugging output |
|
405 | --debug enable debugging output | |
406 | --debugger start debugger |
|
406 | --debugger start debugger | |
407 | --encoding ENCODE set the charset encoding (default: ascii) |
|
407 | --encoding ENCODE set the charset encoding (default: ascii) | |
408 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
408 | --encodingmode MODE set the charset encoding mode (default: strict) | |
409 | --traceback always print a traceback on exception |
|
409 | --traceback always print a traceback on exception | |
410 | --time time how long the command takes |
|
410 | --time time how long the command takes | |
411 | --profile print command execution profile |
|
411 | --profile print command execution profile | |
412 | --version output version information and exit |
|
412 | --version output version information and exit | |
413 | -h --help display help and exit |
|
413 | -h --help display help and exit | |
414 | --hidden consider hidden changesets |
|
414 | --hidden consider hidden changesets | |
415 |
|
415 | |||
416 | [+] marked option can be specified multiple times |
|
416 | [+] marked option can be specified multiple times | |
417 |
|
417 | |||
418 | Test help option with version option |
|
418 | Test help option with version option | |
419 |
|
419 | |||
420 | $ hg add -h --version |
|
420 | $ hg add -h --version | |
421 | Mercurial Distributed SCM (version *) (glob) |
|
421 | Mercurial Distributed SCM (version *) (glob) | |
422 | (see http://mercurial.selenic.com for more information) |
|
422 | (see http://mercurial.selenic.com for more information) | |
423 |
|
423 | |||
424 | Copyright (C) 2005-2014 Matt Mackall and others |
|
424 | Copyright (C) 2005-2014 Matt Mackall and others | |
425 | This is free software; see the source for copying conditions. There is NO |
|
425 | This is free software; see the source for copying conditions. There is NO | |
426 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
426 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
427 |
|
427 | |||
428 | $ hg add --skjdfks |
|
428 | $ hg add --skjdfks | |
429 | hg add: option --skjdfks not recognized |
|
429 | hg add: option --skjdfks not recognized | |
430 | hg add [OPTION]... [FILE]... |
|
430 | hg add [OPTION]... [FILE]... | |
431 |
|
431 | |||
432 | add the specified files on the next commit |
|
432 | add the specified files on the next commit | |
433 |
|
433 | |||
434 | options: |
|
434 | options: | |
435 |
|
435 | |||
436 | -I --include PATTERN [+] include names matching the given patterns |
|
436 | -I --include PATTERN [+] include names matching the given patterns | |
437 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
437 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
438 | -S --subrepos recurse into subrepositories |
|
438 | -S --subrepos recurse into subrepositories | |
439 | -n --dry-run do not perform actions, just print output |
|
439 | -n --dry-run do not perform actions, just print output | |
440 |
|
440 | |||
441 | [+] marked option can be specified multiple times |
|
441 | [+] marked option can be specified multiple times | |
442 |
|
442 | |||
443 | use "hg help add" to show the full help text |
|
443 | use "hg help add" to show the full help text | |
444 | [255] |
|
444 | [255] | |
445 |
|
445 | |||
446 | Test ambiguous command help |
|
446 | Test ambiguous command help | |
447 |
|
447 | |||
448 | $ hg help ad |
|
448 | $ hg help ad | |
449 | list of commands: |
|
449 | list of commands: | |
450 |
|
450 | |||
451 | add add the specified files on the next commit |
|
451 | add add the specified files on the next commit | |
452 | addremove add all new files, delete all missing files |
|
452 | addremove add all new files, delete all missing files | |
453 |
|
453 | |||
454 | use "hg -v help ad" to show builtin aliases and global options |
|
454 | use "hg -v help ad" to show builtin aliases and global options | |
455 |
|
455 | |||
456 | Test command without options |
|
456 | Test command without options | |
457 |
|
457 | |||
458 | $ hg help verify |
|
458 | $ hg help verify | |
459 | hg verify |
|
459 | hg verify | |
460 |
|
460 | |||
461 | verify the integrity of the repository |
|
461 | verify the integrity of the repository | |
462 |
|
462 | |||
463 | Verify the integrity of the current repository. |
|
463 | Verify the integrity of the current repository. | |
464 |
|
464 | |||
465 | This will perform an extensive check of the repository's integrity, |
|
465 | This will perform an extensive check of the repository's integrity, | |
466 | validating the hashes and checksums of each entry in the changelog, |
|
466 | validating the hashes and checksums of each entry in the changelog, | |
467 | manifest, and tracked files, as well as the integrity of their crosslinks |
|
467 | manifest, and tracked files, as well as the integrity of their crosslinks | |
468 | and indices. |
|
468 | and indices. | |
469 |
|
469 | |||
470 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more |
|
470 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more | |
471 | information about recovery from corruption of the repository. |
|
471 | information about recovery from corruption of the repository. | |
472 |
|
472 | |||
473 | Returns 0 on success, 1 if errors are encountered. |
|
473 | Returns 0 on success, 1 if errors are encountered. | |
474 |
|
474 | |||
475 | use "hg -v help verify" to show the global options |
|
475 | use "hg -v help verify" to show the global options | |
476 |
|
476 | |||
477 | $ hg help diff |
|
477 | $ hg help diff | |
478 | hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]... |
|
478 | hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]... | |
479 |
|
479 | |||
480 | diff repository (or selected files) |
|
480 | diff repository (or selected files) | |
481 |
|
481 | |||
482 | Show differences between revisions for the specified files. |
|
482 | Show differences between revisions for the specified files. | |
483 |
|
483 | |||
484 | Differences between files are shown using the unified diff format. |
|
484 | Differences between files are shown using the unified diff format. | |
485 |
|
485 | |||
486 | Note: |
|
486 | Note: | |
487 | diff may generate unexpected results for merges, as it will default to |
|
487 | diff may generate unexpected results for merges, as it will default to | |
488 | comparing against the working directory's first parent changeset if no |
|
488 | comparing against the working directory's first parent changeset if no | |
489 | revisions are specified. |
|
489 | revisions are specified. | |
490 |
|
490 | |||
491 | When two revision arguments are given, then changes are shown between |
|
491 | When two revision arguments are given, then changes are shown between | |
492 | those revisions. If only one revision is specified then that revision is |
|
492 | those revisions. If only one revision is specified then that revision is | |
493 | compared to the working directory, and, when no revisions are specified, |
|
493 | compared to the working directory, and, when no revisions are specified, | |
494 | the working directory files are compared to its parent. |
|
494 | the working directory files are compared to its parent. | |
495 |
|
495 | |||
496 | Alternatively you can specify -c/--change with a revision to see the |
|
496 | Alternatively you can specify -c/--change with a revision to see the | |
497 | changes in that changeset relative to its first parent. |
|
497 | changes in that changeset relative to its first parent. | |
498 |
|
498 | |||
499 | Without the -a/--text option, diff will avoid generating diffs of files it |
|
499 | Without the -a/--text option, diff will avoid generating diffs of files it | |
500 | detects as binary. With -a, diff will generate a diff anyway, probably |
|
500 | detects as binary. With -a, diff will generate a diff anyway, probably | |
501 | with undesirable results. |
|
501 | with undesirable results. | |
502 |
|
502 | |||
503 | Use the -g/--git option to generate diffs in the git extended diff format. |
|
503 | Use the -g/--git option to generate diffs in the git extended diff format. | |
504 | For more information, read "hg help diffs". |
|
504 | For more information, read "hg help diffs". | |
505 |
|
505 | |||
506 | Returns 0 on success. |
|
506 | Returns 0 on success. | |
507 |
|
507 | |||
508 | options: |
|
508 | options: | |
509 |
|
509 | |||
510 | -r --rev REV [+] revision |
|
510 | -r --rev REV [+] revision | |
511 | -c --change REV change made by revision |
|
511 | -c --change REV change made by revision | |
512 | -a --text treat all files as text |
|
512 | -a --text treat all files as text | |
513 | -g --git use git extended diff format |
|
513 | -g --git use git extended diff format | |
514 | --nodates omit dates from diff headers |
|
514 | --nodates omit dates from diff headers | |
515 | -p --show-function show which function each change is in |
|
515 | -p --show-function show which function each change is in | |
516 | --reverse produce a diff that undoes the changes |
|
516 | --reverse produce a diff that undoes the changes | |
517 | -w --ignore-all-space ignore white space when comparing lines |
|
517 | -w --ignore-all-space ignore white space when comparing lines | |
518 | -b --ignore-space-change ignore changes in the amount of white space |
|
518 | -b --ignore-space-change ignore changes in the amount of white space | |
519 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
519 | -B --ignore-blank-lines ignore changes whose lines are all blank | |
520 | -U --unified NUM number of lines of context to show |
|
520 | -U --unified NUM number of lines of context to show | |
521 | --stat output diffstat-style summary of changes |
|
521 | --stat output diffstat-style summary of changes | |
522 | -I --include PATTERN [+] include names matching the given patterns |
|
522 | -I --include PATTERN [+] include names matching the given patterns | |
523 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
523 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
524 | -S --subrepos recurse into subrepositories |
|
524 | -S --subrepos recurse into subrepositories | |
525 |
|
525 | |||
526 | [+] marked option can be specified multiple times |
|
526 | [+] marked option can be specified multiple times | |
527 |
|
527 | |||
528 | use "hg -v help diff" to show more complete help and the global options |
|
528 | use "hg -v help diff" to show more complete help and the global options | |
529 |
|
529 | |||
530 | $ hg help status |
|
530 | $ hg help status | |
531 | hg status [OPTION]... [FILE]... |
|
531 | hg status [OPTION]... [FILE]... | |
532 |
|
532 | |||
533 | aliases: st |
|
533 | aliases: st | |
534 |
|
534 | |||
535 | show changed files in the working directory |
|
535 | show changed files in the working directory | |
536 |
|
536 | |||
537 | Show status of files in the repository. If names are given, only files |
|
537 | Show status of files in the repository. If names are given, only files | |
538 | that match are shown. Files that are clean or ignored or the source of a |
|
538 | that match are shown. Files that are clean or ignored or the source of a | |
539 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
|
539 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, | |
540 | -C/--copies or -A/--all are given. Unless options described with "show |
|
540 | -C/--copies or -A/--all are given. Unless options described with "show | |
541 | only ..." are given, the options -mardu are used. |
|
541 | only ..." are given, the options -mardu are used. | |
542 |
|
542 | |||
543 | Option -q/--quiet hides untracked (unknown and ignored) files unless |
|
543 | Option -q/--quiet hides untracked (unknown and ignored) files unless | |
544 | explicitly requested with -u/--unknown or -i/--ignored. |
|
544 | explicitly requested with -u/--unknown or -i/--ignored. | |
545 |
|
545 | |||
546 | Note: |
|
546 | Note: | |
547 | status may appear to disagree with diff if permissions have changed or |
|
547 | status may appear to disagree with diff if permissions have changed or | |
548 | a merge has occurred. The standard diff format does not report |
|
548 | a merge has occurred. The standard diff format does not report | |
549 | permission changes and diff only reports changes relative to one merge |
|
549 | permission changes and diff only reports changes relative to one merge | |
550 | parent. |
|
550 | parent. | |
551 |
|
551 | |||
552 | If one revision is given, it is used as the base revision. If two |
|
552 | If one revision is given, it is used as the base revision. If two | |
553 | revisions are given, the differences between them are shown. The --change |
|
553 | revisions are given, the differences between them are shown. The --change | |
554 | option can also be used as a shortcut to list the changed files of a |
|
554 | option can also be used as a shortcut to list the changed files of a | |
555 | revision from its first parent. |
|
555 | revision from its first parent. | |
556 |
|
556 | |||
557 | The codes used to show the status of files are: |
|
557 | The codes used to show the status of files are: | |
558 |
|
558 | |||
559 | M = modified |
|
559 | M = modified | |
560 | A = added |
|
560 | A = added | |
561 | R = removed |
|
561 | R = removed | |
562 | C = clean |
|
562 | C = clean | |
563 | ! = missing (deleted by non-hg command, but still tracked) |
|
563 | ! = missing (deleted by non-hg command, but still tracked) | |
564 | ? = not tracked |
|
564 | ? = not tracked | |
565 | I = ignored |
|
565 | I = ignored | |
566 | = origin of the previous file (with --copies) |
|
566 | = origin of the previous file (with --copies) | |
567 |
|
567 | |||
568 | Returns 0 on success. |
|
568 | Returns 0 on success. | |
569 |
|
569 | |||
570 | options: |
|
570 | options: | |
571 |
|
571 | |||
572 | -A --all show status of all files |
|
572 | -A --all show status of all files | |
573 | -m --modified show only modified files |
|
573 | -m --modified show only modified files | |
574 | -a --added show only added files |
|
574 | -a --added show only added files | |
575 | -r --removed show only removed files |
|
575 | -r --removed show only removed files | |
576 | -d --deleted show only deleted (but tracked) files |
|
576 | -d --deleted show only deleted (but tracked) files | |
577 | -c --clean show only files without changes |
|
577 | -c --clean show only files without changes | |
578 | -u --unknown show only unknown (not tracked) files |
|
578 | -u --unknown show only unknown (not tracked) files | |
579 | -i --ignored show only ignored files |
|
579 | -i --ignored show only ignored files | |
580 | -n --no-status hide status prefix |
|
580 | -n --no-status hide status prefix | |
581 | -C --copies show source of copied files |
|
581 | -C --copies show source of copied files | |
582 | -0 --print0 end filenames with NUL, for use with xargs |
|
582 | -0 --print0 end filenames with NUL, for use with xargs | |
583 | --rev REV [+] show difference from revision |
|
583 | --rev REV [+] show difference from revision | |
584 | --change REV list the changed files of a revision |
|
584 | --change REV list the changed files of a revision | |
585 | -I --include PATTERN [+] include names matching the given patterns |
|
585 | -I --include PATTERN [+] include names matching the given patterns | |
586 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
586 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
587 | -S --subrepos recurse into subrepositories |
|
587 | -S --subrepos recurse into subrepositories | |
588 |
|
588 | |||
589 | [+] marked option can be specified multiple times |
|
589 | [+] marked option can be specified multiple times | |
590 |
|
590 | |||
591 | use "hg -v help status" to show more complete help and the global options |
|
591 | use "hg -v help status" to show more complete help and the global options | |
592 |
|
592 | |||
593 | $ hg -q help status |
|
593 | $ hg -q help status | |
594 | hg status [OPTION]... [FILE]... |
|
594 | hg status [OPTION]... [FILE]... | |
595 |
|
595 | |||
596 | show changed files in the working directory |
|
596 | show changed files in the working directory | |
597 |
|
597 | |||
598 | $ hg help foo |
|
598 | $ hg help foo | |
599 | abort: no such help topic: foo |
|
599 | abort: no such help topic: foo | |
600 | (try "hg help --keyword foo") |
|
600 | (try "hg help --keyword foo") | |
601 | [255] |
|
601 | [255] | |
602 |
|
602 | |||
603 | $ hg skjdfks |
|
603 | $ hg skjdfks | |
604 | hg: unknown command 'skjdfks' |
|
604 | hg: unknown command 'skjdfks' | |
605 | Mercurial Distributed SCM |
|
605 | Mercurial Distributed SCM | |
606 |
|
606 | |||
607 | basic commands: |
|
607 | basic commands: | |
608 |
|
608 | |||
609 | add add the specified files on the next commit |
|
609 | add add the specified files on the next commit | |
610 | annotate show changeset information by line for each file |
|
610 | annotate show changeset information by line for each file | |
611 | clone make a copy of an existing repository |
|
611 | clone make a copy of an existing repository | |
612 | commit commit the specified files or all outstanding changes |
|
612 | commit commit the specified files or all outstanding changes | |
613 | diff diff repository (or selected files) |
|
613 | diff diff repository (or selected files) | |
614 | export dump the header and diffs for one or more changesets |
|
614 | export dump the header and diffs for one or more changesets | |
615 | forget forget the specified files on the next commit |
|
615 | forget forget the specified files on the next commit | |
616 | init create a new repository in the given directory |
|
616 | init create a new repository in the given directory | |
617 | log show revision history of entire repository or files |
|
617 | log show revision history of entire repository or files | |
618 | merge merge working directory with another revision |
|
618 | merge merge working directory with another revision | |
619 | pull pull changes from the specified source |
|
619 | pull pull changes from the specified source | |
620 | push push changes to the specified destination |
|
620 | push push changes to the specified destination | |
621 | remove remove the specified files on the next commit |
|
621 | remove remove the specified files on the next commit | |
622 | serve start stand-alone webserver |
|
622 | serve start stand-alone webserver | |
623 | status show changed files in the working directory |
|
623 | status show changed files in the working directory | |
624 | summary summarize working directory state |
|
624 | summary summarize working directory state | |
625 | update update working directory (or switch revisions) |
|
625 | update update working directory (or switch revisions) | |
626 |
|
626 | |||
627 | use "hg help" for the full list of commands or "hg -v" for details |
|
627 | use "hg help" for the full list of commands or "hg -v" for details | |
628 | [255] |
|
628 | [255] | |
629 |
|
629 | |||
630 |
|
630 | |||
631 | $ cat > helpext.py <<EOF |
|
631 | $ cat > helpext.py <<EOF | |
632 | > import os |
|
632 | > import os | |
633 | > from mercurial import cmdutil, commands |
|
633 | > from mercurial import cmdutil, commands | |
634 | > |
|
634 | > | |
635 | > cmdtable = {} |
|
635 | > cmdtable = {} | |
636 | > command = cmdutil.command(cmdtable) |
|
636 | > command = cmdutil.command(cmdtable) | |
637 | > |
|
637 | > | |
638 | > @command('nohelp', |
|
638 | > @command('nohelp', | |
639 | > [('', 'longdesc', 3, 'x'*90), |
|
639 | > [('', 'longdesc', 3, 'x'*90), | |
640 | > ('n', '', None, 'normal desc'), |
|
640 | > ('n', '', None, 'normal desc'), | |
641 | > ('', 'newline', '', 'line1\nline2')], |
|
641 | > ('', 'newline', '', 'line1\nline2')], | |
642 | > 'hg nohelp') |
|
642 | > 'hg nohelp') | |
643 | > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')]) |
|
643 | > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')]) | |
644 | > def nohelp(ui, *args, **kwargs): |
|
644 | > def nohelp(ui, *args, **kwargs): | |
645 | > pass |
|
645 | > pass | |
646 | > |
|
646 | > | |
647 | > commands.norepo += ' nohelp' |
|
647 | > commands.norepo += ' nohelp' | |
648 | > EOF |
|
648 | > EOF | |
649 | $ echo '[extensions]' >> $HGRCPATH |
|
649 | $ echo '[extensions]' >> $HGRCPATH | |
650 | $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH |
|
650 | $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH | |
651 |
|
651 | |||
652 | Test command with no help text |
|
652 | Test command with no help text | |
653 |
|
653 | |||
654 | $ hg help nohelp |
|
654 | $ hg help nohelp | |
655 | hg nohelp |
|
655 | hg nohelp | |
656 |
|
656 | |||
657 | (no help text available) |
|
657 | (no help text available) | |
658 |
|
658 | |||
659 | options: |
|
659 | options: | |
660 |
|
660 | |||
661 | --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
661 | --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
662 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3) |
|
662 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3) | |
663 | -n -- normal desc |
|
663 | -n -- normal desc | |
664 | --newline VALUE line1 line2 |
|
664 | --newline VALUE line1 line2 | |
665 |
|
665 | |||
666 | use "hg -v help nohelp" to show the global options |
|
666 | use "hg -v help nohelp" to show the global options | |
667 |
|
667 | |||
668 | $ hg help -k nohelp |
|
668 | $ hg help -k nohelp | |
669 | Commands: |
|
669 | Commands: | |
670 |
|
670 | |||
671 | nohelp hg nohelp |
|
671 | nohelp hg nohelp | |
672 |
|
672 | |||
673 | Extension Commands: |
|
673 | Extension Commands: | |
674 |
|
674 | |||
675 | nohelp (no help text available) |
|
675 | nohelp (no help text available) | |
676 |
|
676 | |||
677 | Test that default list of commands omits extension commands |
|
677 | Test that default list of commands omits extension commands | |
678 |
|
678 | |||
679 | $ hg help |
|
679 | $ hg help | |
680 | Mercurial Distributed SCM |
|
680 | Mercurial Distributed SCM | |
681 |
|
681 | |||
682 | list of commands: |
|
682 | list of commands: | |
683 |
|
683 | |||
684 | add add the specified files on the next commit |
|
684 | add add the specified files on the next commit | |
685 | addremove add all new files, delete all missing files |
|
685 | addremove add all new files, delete all missing files | |
686 | annotate show changeset information by line for each file |
|
686 | annotate show changeset information by line for each file | |
687 | archive create an unversioned archive of a repository revision |
|
687 | archive create an unversioned archive of a repository revision | |
688 | backout reverse effect of earlier changeset |
|
688 | backout reverse effect of earlier changeset | |
689 | bisect subdivision search of changesets |
|
689 | bisect subdivision search of changesets | |
690 | bookmarks track a line of development with movable markers |
|
690 | bookmarks create a new bookmark or list existing bookmarks | |
691 | branch set or show the current branch name |
|
691 | branch set or show the current branch name | |
692 | branches list repository named branches |
|
692 | branches list repository named branches | |
693 | bundle create a changegroup file |
|
693 | bundle create a changegroup file | |
694 | cat output the current or given revision of files |
|
694 | cat output the current or given revision of files | |
695 | clone make a copy of an existing repository |
|
695 | clone make a copy of an existing repository | |
696 | commit commit the specified files or all outstanding changes |
|
696 | commit commit the specified files or all outstanding changes | |
697 | config show combined config settings from all hgrc files |
|
697 | config show combined config settings from all hgrc files | |
698 | copy mark files as copied for the next commit |
|
698 | copy mark files as copied for the next commit | |
699 | diff diff repository (or selected files) |
|
699 | diff diff repository (or selected files) | |
700 | export dump the header and diffs for one or more changesets |
|
700 | export dump the header and diffs for one or more changesets | |
701 | forget forget the specified files on the next commit |
|
701 | forget forget the specified files on the next commit | |
702 | graft copy changes from other branches onto the current branch |
|
702 | graft copy changes from other branches onto the current branch | |
703 | grep search for a pattern in specified files and revisions |
|
703 | grep search for a pattern in specified files and revisions | |
704 | heads show branch heads |
|
704 | heads show branch heads | |
705 | help show help for a given topic or a help overview |
|
705 | help show help for a given topic or a help overview | |
706 | identify identify the working copy or specified revision |
|
706 | identify identify the working copy or specified revision | |
707 | import import an ordered set of patches |
|
707 | import import an ordered set of patches | |
708 | incoming show new changesets found in source |
|
708 | incoming show new changesets found in source | |
709 | init create a new repository in the given directory |
|
709 | init create a new repository in the given directory | |
710 | locate locate files matching specific patterns |
|
710 | locate locate files matching specific patterns | |
711 | log show revision history of entire repository or files |
|
711 | log show revision history of entire repository or files | |
712 | manifest output the current or given revision of the project manifest |
|
712 | manifest output the current or given revision of the project manifest | |
713 | merge merge working directory with another revision |
|
713 | merge merge working directory with another revision | |
714 | outgoing show changesets not found in the destination |
|
714 | outgoing show changesets not found in the destination | |
715 | parents show the parents of the working directory or revision |
|
715 | parents show the parents of the working directory or revision | |
716 | paths show aliases for remote repositories |
|
716 | paths show aliases for remote repositories | |
717 | phase set or show the current phase name |
|
717 | phase set or show the current phase name | |
718 | pull pull changes from the specified source |
|
718 | pull pull changes from the specified source | |
719 | push push changes to the specified destination |
|
719 | push push changes to the specified destination | |
720 | recover roll back an interrupted transaction |
|
720 | recover roll back an interrupted transaction | |
721 | remove remove the specified files on the next commit |
|
721 | remove remove the specified files on the next commit | |
722 | rename rename files; equivalent of copy + remove |
|
722 | rename rename files; equivalent of copy + remove | |
723 | resolve redo merges or set/view the merge status of files |
|
723 | resolve redo merges or set/view the merge status of files | |
724 | revert restore files to their checkout state |
|
724 | revert restore files to their checkout state | |
725 | root print the root (top) of the current working directory |
|
725 | root print the root (top) of the current working directory | |
726 | serve start stand-alone webserver |
|
726 | serve start stand-alone webserver | |
727 | status show changed files in the working directory |
|
727 | status show changed files in the working directory | |
728 | summary summarize working directory state |
|
728 | summary summarize working directory state | |
729 | tag add one or more tags for the current or given revision |
|
729 | tag add one or more tags for the current or given revision | |
730 | tags list repository tags |
|
730 | tags list repository tags | |
731 | unbundle apply one or more changegroup files |
|
731 | unbundle apply one or more changegroup files | |
732 | update update working directory (or switch revisions) |
|
732 | update update working directory (or switch revisions) | |
733 | verify verify the integrity of the repository |
|
733 | verify verify the integrity of the repository | |
734 | version output version and copyright information |
|
734 | version output version and copyright information | |
735 |
|
735 | |||
736 | enabled extensions: |
|
736 | enabled extensions: | |
737 |
|
737 | |||
738 | helpext (no help text available) |
|
738 | helpext (no help text available) | |
739 |
|
739 | |||
740 | additional help topics: |
|
740 | additional help topics: | |
741 |
|
741 | |||
742 | config Configuration Files |
|
742 | config Configuration Files | |
743 | dates Date Formats |
|
743 | dates Date Formats | |
744 | diffs Diff Formats |
|
744 | diffs Diff Formats | |
745 | environment Environment Variables |
|
745 | environment Environment Variables | |
746 | extensions Using Additional Features |
|
746 | extensions Using Additional Features | |
747 | filesets Specifying File Sets |
|
747 | filesets Specifying File Sets | |
748 | glossary Glossary |
|
748 | glossary Glossary | |
749 | hgignore Syntax for Mercurial Ignore Files |
|
749 | hgignore Syntax for Mercurial Ignore Files | |
750 | hgweb Configuring hgweb |
|
750 | hgweb Configuring hgweb | |
751 | merge-tools Merge Tools |
|
751 | merge-tools Merge Tools | |
752 | multirevs Specifying Multiple Revisions |
|
752 | multirevs Specifying Multiple Revisions | |
753 | patterns File Name Patterns |
|
753 | patterns File Name Patterns | |
754 | phases Working with Phases |
|
754 | phases Working with Phases | |
755 | revisions Specifying Single Revisions |
|
755 | revisions Specifying Single Revisions | |
756 | revsets Specifying Revision Sets |
|
756 | revsets Specifying Revision Sets | |
757 | subrepos Subrepositories |
|
757 | subrepos Subrepositories | |
758 | templating Template Usage |
|
758 | templating Template Usage | |
759 | urls URL Paths |
|
759 | urls URL Paths | |
760 |
|
760 | |||
761 | use "hg -v help" to show builtin aliases and global options |
|
761 | use "hg -v help" to show builtin aliases and global options | |
762 |
|
762 | |||
763 |
|
763 | |||
764 | Test list of internal help commands |
|
764 | Test list of internal help commands | |
765 |
|
765 | |||
766 | $ hg help debug |
|
766 | $ hg help debug | |
767 | debug commands (internal and unsupported): |
|
767 | debug commands (internal and unsupported): | |
768 |
|
768 | |||
769 | debugancestor |
|
769 | debugancestor | |
770 | find the ancestor revision of two revisions in a given index |
|
770 | find the ancestor revision of two revisions in a given index | |
771 | debugbuilddag |
|
771 | debugbuilddag | |
772 | builds a repo with a given DAG from scratch in the current |
|
772 | builds a repo with a given DAG from scratch in the current | |
773 | empty repo |
|
773 | empty repo | |
774 | debugbundle lists the contents of a bundle |
|
774 | debugbundle lists the contents of a bundle | |
775 | debugcheckstate |
|
775 | debugcheckstate | |
776 | validate the correctness of the current dirstate |
|
776 | validate the correctness of the current dirstate | |
777 | debugcommands |
|
777 | debugcommands | |
778 | list all available commands and options |
|
778 | list all available commands and options | |
779 | debugcomplete |
|
779 | debugcomplete | |
780 | returns the completion list associated with the given command |
|
780 | returns the completion list associated with the given command | |
781 | debugdag format the changelog or an index DAG as a concise textual |
|
781 | debugdag format the changelog or an index DAG as a concise textual | |
782 | description |
|
782 | description | |
783 | debugdata dump the contents of a data file revision |
|
783 | debugdata dump the contents of a data file revision | |
784 | debugdate parse and display a date |
|
784 | debugdate parse and display a date | |
785 | debugdirstate |
|
785 | debugdirstate | |
786 | show the contents of the current dirstate |
|
786 | show the contents of the current dirstate | |
787 | debugdiscovery |
|
787 | debugdiscovery | |
788 | runs the changeset discovery protocol in isolation |
|
788 | runs the changeset discovery protocol in isolation | |
789 | debugfileset parse and apply a fileset specification |
|
789 | debugfileset parse and apply a fileset specification | |
790 | debugfsinfo show information detected about current filesystem |
|
790 | debugfsinfo show information detected about current filesystem | |
791 | debuggetbundle |
|
791 | debuggetbundle | |
792 | retrieves a bundle from a repo |
|
792 | retrieves a bundle from a repo | |
793 | debugignore display the combined ignore pattern |
|
793 | debugignore display the combined ignore pattern | |
794 | debugindex dump the contents of an index file |
|
794 | debugindex dump the contents of an index file | |
795 | debugindexdot |
|
795 | debugindexdot | |
796 | dump an index DAG as a graphviz dot file |
|
796 | dump an index DAG as a graphviz dot file | |
797 | debuginstall test Mercurial installation |
|
797 | debuginstall test Mercurial installation | |
798 | debugknown test whether node ids are known to a repo |
|
798 | debugknown test whether node ids are known to a repo | |
799 | debuglabelcomplete |
|
799 | debuglabelcomplete | |
800 | complete "labels" - tags, open branch names, bookmark names |
|
800 | complete "labels" - tags, open branch names, bookmark names | |
801 | debugobsolete |
|
801 | debugobsolete | |
802 | create arbitrary obsolete marker |
|
802 | create arbitrary obsolete marker | |
803 | debugoptDEP (no help text available) |
|
803 | debugoptDEP (no help text available) | |
804 | debugpathcomplete |
|
804 | debugpathcomplete | |
805 | complete part or all of a tracked path |
|
805 | complete part or all of a tracked path | |
806 | debugpushkey access the pushkey key/value protocol |
|
806 | debugpushkey access the pushkey key/value protocol | |
807 | debugpvec (no help text available) |
|
807 | debugpvec (no help text available) | |
808 | debugrebuilddirstate |
|
808 | debugrebuilddirstate | |
809 | rebuild the dirstate as it would look like for the given |
|
809 | rebuild the dirstate as it would look like for the given | |
810 | revision |
|
810 | revision | |
811 | debugrename dump rename information |
|
811 | debugrename dump rename information | |
812 | debugrevlog show data and statistics about a revlog |
|
812 | debugrevlog show data and statistics about a revlog | |
813 | debugrevspec parse and apply a revision specification |
|
813 | debugrevspec parse and apply a revision specification | |
814 | debugsetparents |
|
814 | debugsetparents | |
815 | manually set the parents of the current working directory |
|
815 | manually set the parents of the current working directory | |
816 | debugsub (no help text available) |
|
816 | debugsub (no help text available) | |
817 | debugsuccessorssets |
|
817 | debugsuccessorssets | |
818 | show set of successors for revision |
|
818 | show set of successors for revision | |
819 | debugwalk show how files match on given patterns |
|
819 | debugwalk show how files match on given patterns | |
820 | debugwireargs |
|
820 | debugwireargs | |
821 | (no help text available) |
|
821 | (no help text available) | |
822 |
|
822 | |||
823 | use "hg -v help debug" to show builtin aliases and global options |
|
823 | use "hg -v help debug" to show builtin aliases and global options | |
824 |
|
824 | |||
825 |
|
825 | |||
826 | Test list of commands with command with no help text |
|
826 | Test list of commands with command with no help text | |
827 |
|
827 | |||
828 | $ hg help helpext |
|
828 | $ hg help helpext | |
829 | helpext extension - no help text available |
|
829 | helpext extension - no help text available | |
830 |
|
830 | |||
831 | list of commands: |
|
831 | list of commands: | |
832 |
|
832 | |||
833 | nohelp (no help text available) |
|
833 | nohelp (no help text available) | |
834 |
|
834 | |||
835 | use "hg -v help helpext" to show builtin aliases and global options |
|
835 | use "hg -v help helpext" to show builtin aliases and global options | |
836 |
|
836 | |||
837 |
|
837 | |||
838 | test deprecated option is hidden in command help |
|
838 | test deprecated option is hidden in command help | |
839 | $ hg help debugoptDEP |
|
839 | $ hg help debugoptDEP | |
840 | hg debugoptDEP |
|
840 | hg debugoptDEP | |
841 |
|
841 | |||
842 | (no help text available) |
|
842 | (no help text available) | |
843 |
|
843 | |||
844 | options: |
|
844 | options: | |
845 |
|
845 | |||
846 | use "hg -v help debugoptDEP" to show the global options |
|
846 | use "hg -v help debugoptDEP" to show the global options | |
847 |
|
847 | |||
848 | test deprecated option is shown with -v |
|
848 | test deprecated option is shown with -v | |
849 | $ hg help -v debugoptDEP | grep dopt |
|
849 | $ hg help -v debugoptDEP | grep dopt | |
850 | --dopt option is DEPRECATED |
|
850 | --dopt option is DEPRECATED | |
851 |
|
851 | |||
852 | #if gettext |
|
852 | #if gettext | |
853 | test deprecated option is hidden with translation with untranslated description |
|
853 | test deprecated option is hidden with translation with untranslated description | |
854 | (use many globy for not failing on changed transaction) |
|
854 | (use many globy for not failing on changed transaction) | |
855 | $ LANGUAGE=sv hg help debugoptDEP |
|
855 | $ LANGUAGE=sv hg help debugoptDEP | |
856 | hg debugoptDEP |
|
856 | hg debugoptDEP | |
857 |
|
857 | |||
858 | (*) (glob) |
|
858 | (*) (glob) | |
859 |
|
859 | |||
860 | flaggor: |
|
860 | flaggor: | |
861 |
|
861 | |||
862 | *"hg -v help debugoptDEP"* (glob) |
|
862 | *"hg -v help debugoptDEP"* (glob) | |
863 | #endif |
|
863 | #endif | |
864 |
|
864 | |||
865 | Test a help topic |
|
865 | Test a help topic | |
866 |
|
866 | |||
867 | $ hg help revs |
|
867 | $ hg help revs | |
868 | Specifying Single Revisions |
|
868 | Specifying Single Revisions | |
869 | """"""""""""""""""""""""""" |
|
869 | """"""""""""""""""""""""""" | |
870 |
|
870 | |||
871 | Mercurial supports several ways to specify individual revisions. |
|
871 | Mercurial supports several ways to specify individual revisions. | |
872 |
|
872 | |||
873 | A plain integer is treated as a revision number. Negative integers are |
|
873 | A plain integer is treated as a revision number. Negative integers are | |
874 | treated as sequential offsets from the tip, with -1 denoting the tip, -2 |
|
874 | treated as sequential offsets from the tip, with -1 denoting the tip, -2 | |
875 | denoting the revision prior to the tip, and so forth. |
|
875 | denoting the revision prior to the tip, and so forth. | |
876 |
|
876 | |||
877 | A 40-digit hexadecimal string is treated as a unique revision identifier. |
|
877 | A 40-digit hexadecimal string is treated as a unique revision identifier. | |
878 |
|
878 | |||
879 | A hexadecimal string less than 40 characters long is treated as a unique |
|
879 | A hexadecimal string less than 40 characters long is treated as a unique | |
880 | revision identifier and is referred to as a short-form identifier. A |
|
880 | revision identifier and is referred to as a short-form identifier. A | |
881 | short-form identifier is only valid if it is the prefix of exactly one |
|
881 | short-form identifier is only valid if it is the prefix of exactly one | |
882 | full-length identifier. |
|
882 | full-length identifier. | |
883 |
|
883 | |||
884 | Any other string is treated as a bookmark, tag, or branch name. A bookmark |
|
884 | Any other string is treated as a bookmark, tag, or branch name. A bookmark | |
885 | is a movable pointer to a revision. A tag is a permanent name associated |
|
885 | is a movable pointer to a revision. A tag is a permanent name associated | |
886 | with a revision. A branch name denotes the tipmost open branch head of |
|
886 | with a revision. A branch name denotes the tipmost open branch head of | |
887 | that branch - or if they are all closed, the tipmost closed head of the |
|
887 | that branch - or if they are all closed, the tipmost closed head of the | |
888 | branch. Bookmark, tag, and branch names must not contain the ":" |
|
888 | branch. Bookmark, tag, and branch names must not contain the ":" | |
889 | character. |
|
889 | character. | |
890 |
|
890 | |||
891 | The reserved name "tip" always identifies the most recent revision. |
|
891 | The reserved name "tip" always identifies the most recent revision. | |
892 |
|
892 | |||
893 | The reserved name "null" indicates the null revision. This is the revision |
|
893 | The reserved name "null" indicates the null revision. This is the revision | |
894 | of an empty repository, and the parent of revision 0. |
|
894 | of an empty repository, and the parent of revision 0. | |
895 |
|
895 | |||
896 | The reserved name "." indicates the working directory parent. If no |
|
896 | The reserved name "." indicates the working directory parent. If no | |
897 | working directory is checked out, it is equivalent to null. If an |
|
897 | working directory is checked out, it is equivalent to null. If an | |
898 | uncommitted merge is in progress, "." is the revision of the first parent. |
|
898 | uncommitted merge is in progress, "." is the revision of the first parent. | |
899 |
|
899 | |||
900 | Test templating help |
|
900 | Test templating help | |
901 |
|
901 | |||
902 | $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' |
|
902 | $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' | |
903 | desc String. The text of the changeset description. |
|
903 | desc String. The text of the changeset description. | |
904 | diffstat String. Statistics of changes with the following format: |
|
904 | diffstat String. Statistics of changes with the following format: | |
905 | firstline Any text. Returns the first line of text. |
|
905 | firstline Any text. Returns the first line of text. | |
906 | nonempty Any text. Returns '(none)' if the string is empty. |
|
906 | nonempty Any text. Returns '(none)' if the string is empty. | |
907 |
|
907 | |||
908 | Test help hooks |
|
908 | Test help hooks | |
909 |
|
909 | |||
910 | $ cat > helphook1.py <<EOF |
|
910 | $ cat > helphook1.py <<EOF | |
911 | > from mercurial import help |
|
911 | > from mercurial import help | |
912 | > |
|
912 | > | |
913 | > def rewrite(topic, doc): |
|
913 | > def rewrite(topic, doc): | |
914 | > return doc + '\nhelphook1\n' |
|
914 | > return doc + '\nhelphook1\n' | |
915 | > |
|
915 | > | |
916 | > def extsetup(ui): |
|
916 | > def extsetup(ui): | |
917 | > help.addtopichook('revsets', rewrite) |
|
917 | > help.addtopichook('revsets', rewrite) | |
918 | > EOF |
|
918 | > EOF | |
919 | $ cat > helphook2.py <<EOF |
|
919 | $ cat > helphook2.py <<EOF | |
920 | > from mercurial import help |
|
920 | > from mercurial import help | |
921 | > |
|
921 | > | |
922 | > def rewrite(topic, doc): |
|
922 | > def rewrite(topic, doc): | |
923 | > return doc + '\nhelphook2\n' |
|
923 | > return doc + '\nhelphook2\n' | |
924 | > |
|
924 | > | |
925 | > def extsetup(ui): |
|
925 | > def extsetup(ui): | |
926 | > help.addtopichook('revsets', rewrite) |
|
926 | > help.addtopichook('revsets', rewrite) | |
927 | > EOF |
|
927 | > EOF | |
928 | $ echo '[extensions]' >> $HGRCPATH |
|
928 | $ echo '[extensions]' >> $HGRCPATH | |
929 | $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH |
|
929 | $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH | |
930 | $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH |
|
930 | $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH | |
931 | $ hg help revsets | grep helphook |
|
931 | $ hg help revsets | grep helphook | |
932 | helphook1 |
|
932 | helphook1 | |
933 | helphook2 |
|
933 | helphook2 | |
934 |
|
934 | |||
935 | Test keyword search help |
|
935 | Test keyword search help | |
936 |
|
936 | |||
937 | $ cat > prefixedname.py <<EOF |
|
937 | $ cat > prefixedname.py <<EOF | |
938 | > '''matched against word "clone" |
|
938 | > '''matched against word "clone" | |
939 | > ''' |
|
939 | > ''' | |
940 | > EOF |
|
940 | > EOF | |
941 | $ echo '[extensions]' >> $HGRCPATH |
|
941 | $ echo '[extensions]' >> $HGRCPATH | |
942 | $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH |
|
942 | $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH | |
943 | $ hg help -k clone |
|
943 | $ hg help -k clone | |
944 | Topics: |
|
944 | Topics: | |
945 |
|
945 | |||
946 | config Configuration Files |
|
946 | config Configuration Files | |
947 | extensions Using Additional Features |
|
947 | extensions Using Additional Features | |
948 | glossary Glossary |
|
948 | glossary Glossary | |
949 | phases Working with Phases |
|
949 | phases Working with Phases | |
950 | subrepos Subrepositories |
|
950 | subrepos Subrepositories | |
951 | urls URL Paths |
|
951 | urls URL Paths | |
952 |
|
952 | |||
953 | Commands: |
|
953 | Commands: | |
954 |
|
954 | |||
955 | bookmarks track a line of development with movable markers |
|
955 | bookmarks create a new bookmark or list existing bookmarks | |
956 | clone make a copy of an existing repository |
|
956 | clone make a copy of an existing repository | |
957 | paths show aliases for remote repositories |
|
957 | paths show aliases for remote repositories | |
958 | update update working directory (or switch revisions) |
|
958 | update update working directory (or switch revisions) | |
959 |
|
959 | |||
960 | Extensions: |
|
960 | Extensions: | |
961 |
|
961 | |||
962 | prefixedname matched against word "clone" |
|
962 | prefixedname matched against word "clone" | |
963 | relink recreates hardlinks between repository clones |
|
963 | relink recreates hardlinks between repository clones | |
964 |
|
964 | |||
965 | Extension Commands: |
|
965 | Extension Commands: | |
966 |
|
966 | |||
967 | qclone clone main and patch repository at same time |
|
967 | qclone clone main and patch repository at same time | |
968 |
|
968 | |||
969 | Test unfound topic |
|
969 | Test unfound topic | |
970 |
|
970 | |||
971 | $ hg help nonexistingtopicthatwillneverexisteverever |
|
971 | $ hg help nonexistingtopicthatwillneverexisteverever | |
972 | abort: no such help topic: nonexistingtopicthatwillneverexisteverever |
|
972 | abort: no such help topic: nonexistingtopicthatwillneverexisteverever | |
973 | (try "hg help --keyword nonexistingtopicthatwillneverexisteverever") |
|
973 | (try "hg help --keyword nonexistingtopicthatwillneverexisteverever") | |
974 | [255] |
|
974 | [255] | |
975 |
|
975 | |||
976 | Test unfound keyword |
|
976 | Test unfound keyword | |
977 |
|
977 | |||
978 | $ hg help --keyword nonexistingwordthatwillneverexisteverever |
|
978 | $ hg help --keyword nonexistingwordthatwillneverexisteverever | |
979 | abort: no matches |
|
979 | abort: no matches | |
980 | (try "hg help" for a list of topics) |
|
980 | (try "hg help" for a list of topics) | |
981 | [255] |
|
981 | [255] | |
982 |
|
982 | |||
983 | Test omit indicating for help |
|
983 | Test omit indicating for help | |
984 |
|
984 | |||
985 | $ cat > addverboseitems.py <<EOF |
|
985 | $ cat > addverboseitems.py <<EOF | |
986 | > '''extension to test omit indicating. |
|
986 | > '''extension to test omit indicating. | |
987 | > |
|
987 | > | |
988 | > This paragraph is never omitted (for extension) |
|
988 | > This paragraph is never omitted (for extension) | |
989 | > |
|
989 | > | |
990 | > .. container:: verbose |
|
990 | > .. container:: verbose | |
991 | > |
|
991 | > | |
992 | > This paragraph is omitted, |
|
992 | > This paragraph is omitted, | |
993 | > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension) |
|
993 | > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension) | |
994 | > |
|
994 | > | |
995 | > This paragraph is never omitted, too (for extension) |
|
995 | > This paragraph is never omitted, too (for extension) | |
996 | > ''' |
|
996 | > ''' | |
997 | > |
|
997 | > | |
998 | > from mercurial import help, commands |
|
998 | > from mercurial import help, commands | |
999 | > testtopic = """This paragraph is never omitted (for topic). |
|
999 | > testtopic = """This paragraph is never omitted (for topic). | |
1000 | > |
|
1000 | > | |
1001 | > .. container:: verbose |
|
1001 | > .. container:: verbose | |
1002 | > |
|
1002 | > | |
1003 | > This paragraph is omitted, |
|
1003 | > This paragraph is omitted, | |
1004 | > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic) |
|
1004 | > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic) | |
1005 | > |
|
1005 | > | |
1006 | > This paragraph is never omitted, too (for topic) |
|
1006 | > This paragraph is never omitted, too (for topic) | |
1007 | > """ |
|
1007 | > """ | |
1008 | > def extsetup(ui): |
|
1008 | > def extsetup(ui): | |
1009 | > help.helptable.append((["topic-containing-verbose"], |
|
1009 | > help.helptable.append((["topic-containing-verbose"], | |
1010 | > "This is the topic to test omit indicating.", |
|
1010 | > "This is the topic to test omit indicating.", | |
1011 | > lambda : testtopic)) |
|
1011 | > lambda : testtopic)) | |
1012 | > EOF |
|
1012 | > EOF | |
1013 | $ echo '[extensions]' >> $HGRCPATH |
|
1013 | $ echo '[extensions]' >> $HGRCPATH | |
1014 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH |
|
1014 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH | |
1015 | $ hg help addverboseitems |
|
1015 | $ hg help addverboseitems | |
1016 | addverboseitems extension - extension to test omit indicating. |
|
1016 | addverboseitems extension - extension to test omit indicating. | |
1017 |
|
1017 | |||
1018 | This paragraph is never omitted (for extension) |
|
1018 | This paragraph is never omitted (for extension) | |
1019 |
|
1019 | |||
1020 | This paragraph is never omitted, too (for extension) |
|
1020 | This paragraph is never omitted, too (for extension) | |
1021 |
|
1021 | |||
1022 | use "hg help -v addverboseitems" to show more complete help |
|
1022 | use "hg help -v addverboseitems" to show more complete help | |
1023 |
|
1023 | |||
1024 | no commands defined |
|
1024 | no commands defined | |
1025 | $ hg help -v addverboseitems |
|
1025 | $ hg help -v addverboseitems | |
1026 | addverboseitems extension - extension to test omit indicating. |
|
1026 | addverboseitems extension - extension to test omit indicating. | |
1027 |
|
1027 | |||
1028 | This paragraph is never omitted (for extension) |
|
1028 | This paragraph is never omitted (for extension) | |
1029 |
|
1029 | |||
1030 | This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension) |
|
1030 | This paragraph is omitted, if "hg help" is invoked witout "-v" (for extension) | |
1031 |
|
1031 | |||
1032 | This paragraph is never omitted, too (for extension) |
|
1032 | This paragraph is never omitted, too (for extension) | |
1033 |
|
1033 | |||
1034 | no commands defined |
|
1034 | no commands defined | |
1035 | $ hg help topic-containing-verbose |
|
1035 | $ hg help topic-containing-verbose | |
1036 | This is the topic to test omit indicating. |
|
1036 | This is the topic to test omit indicating. | |
1037 | """""""""""""""""""""""""""""""""""""""""" |
|
1037 | """""""""""""""""""""""""""""""""""""""""" | |
1038 |
|
1038 | |||
1039 | This paragraph is never omitted (for topic). |
|
1039 | This paragraph is never omitted (for topic). | |
1040 |
|
1040 | |||
1041 | This paragraph is never omitted, too (for topic) |
|
1041 | This paragraph is never omitted, too (for topic) | |
1042 |
|
1042 | |||
1043 | use "hg help -v topic-containing-verbose" to show more complete help |
|
1043 | use "hg help -v topic-containing-verbose" to show more complete help | |
1044 | $ hg help -v topic-containing-verbose |
|
1044 | $ hg help -v topic-containing-verbose | |
1045 | This is the topic to test omit indicating. |
|
1045 | This is the topic to test omit indicating. | |
1046 | """""""""""""""""""""""""""""""""""""""""" |
|
1046 | """""""""""""""""""""""""""""""""""""""""" | |
1047 |
|
1047 | |||
1048 | This paragraph is never omitted (for topic). |
|
1048 | This paragraph is never omitted (for topic). | |
1049 |
|
1049 | |||
1050 | This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic) |
|
1050 | This paragraph is omitted, if "hg help" is invoked witout "-v" (for topic) | |
1051 |
|
1051 | |||
1052 | This paragraph is never omitted, too (for topic) |
|
1052 | This paragraph is never omitted, too (for topic) | |
1053 |
|
1053 | |||
1054 | Test usage of section marks in help documents |
|
1054 | Test usage of section marks in help documents | |
1055 |
|
1055 | |||
1056 | $ cd "$TESTDIR"/../doc |
|
1056 | $ cd "$TESTDIR"/../doc | |
1057 | $ python check-seclevel.py |
|
1057 | $ python check-seclevel.py | |
1058 | $ cd $TESTTMP |
|
1058 | $ cd $TESTTMP | |
1059 |
|
1059 | |||
1060 | #if serve |
|
1060 | #if serve | |
1061 |
|
1061 | |||
1062 | Test the help pages in hgweb. |
|
1062 | Test the help pages in hgweb. | |
1063 |
|
1063 | |||
1064 | Dish up an empty repo; serve it cold. |
|
1064 | Dish up an empty repo; serve it cold. | |
1065 |
|
1065 | |||
1066 | $ hg init "$TESTTMP/test" |
|
1066 | $ hg init "$TESTTMP/test" | |
1067 | $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid |
|
1067 | $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid | |
1068 | $ cat hg.pid >> $DAEMON_PIDS |
|
1068 | $ cat hg.pid >> $DAEMON_PIDS | |
1069 |
|
1069 | |||
1070 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help" |
|
1070 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help" | |
1071 | 200 Script output follows |
|
1071 | 200 Script output follows | |
1072 |
|
1072 | |||
1073 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1073 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
1074 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1074 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
1075 | <head> |
|
1075 | <head> | |
1076 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1076 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
1077 | <meta name="robots" content="index, nofollow" /> |
|
1077 | <meta name="robots" content="index, nofollow" /> | |
1078 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1078 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
1079 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1079 | <script type="text/javascript" src="/static/mercurial.js"></script> | |
1080 |
|
1080 | |||
1081 | <title>Help: Index</title> |
|
1081 | <title>Help: Index</title> | |
1082 | </head> |
|
1082 | </head> | |
1083 | <body> |
|
1083 | <body> | |
1084 |
|
1084 | |||
1085 | <div class="container"> |
|
1085 | <div class="container"> | |
1086 | <div class="menu"> |
|
1086 | <div class="menu"> | |
1087 | <div class="logo"> |
|
1087 | <div class="logo"> | |
1088 | <a href="http://mercurial.selenic.com/"> |
|
1088 | <a href="http://mercurial.selenic.com/"> | |
1089 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1089 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
1090 | </div> |
|
1090 | </div> | |
1091 | <ul> |
|
1091 | <ul> | |
1092 | <li><a href="/shortlog">log</a></li> |
|
1092 | <li><a href="/shortlog">log</a></li> | |
1093 | <li><a href="/graph">graph</a></li> |
|
1093 | <li><a href="/graph">graph</a></li> | |
1094 | <li><a href="/tags">tags</a></li> |
|
1094 | <li><a href="/tags">tags</a></li> | |
1095 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1095 | <li><a href="/bookmarks">bookmarks</a></li> | |
1096 | <li><a href="/branches">branches</a></li> |
|
1096 | <li><a href="/branches">branches</a></li> | |
1097 | </ul> |
|
1097 | </ul> | |
1098 | <ul> |
|
1098 | <ul> | |
1099 | <li class="active">help</li> |
|
1099 | <li class="active">help</li> | |
1100 | </ul> |
|
1100 | </ul> | |
1101 | </div> |
|
1101 | </div> | |
1102 |
|
1102 | |||
1103 | <div class="main"> |
|
1103 | <div class="main"> | |
1104 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1104 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> | |
1105 | <form class="search" action="/log"> |
|
1105 | <form class="search" action="/log"> | |
1106 |
|
1106 | |||
1107 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1107 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
1108 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
1108 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision | |
1109 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
1109 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> | |
1110 | </form> |
|
1110 | </form> | |
1111 | <table class="bigtable"> |
|
1111 | <table class="bigtable"> | |
1112 | <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr> |
|
1112 | <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr> | |
1113 |
|
1113 | |||
1114 | <tr><td> |
|
1114 | <tr><td> | |
1115 | <a href="/help/config"> |
|
1115 | <a href="/help/config"> | |
1116 | config |
|
1116 | config | |
1117 | </a> |
|
1117 | </a> | |
1118 | </td><td> |
|
1118 | </td><td> | |
1119 | Configuration Files |
|
1119 | Configuration Files | |
1120 | </td></tr> |
|
1120 | </td></tr> | |
1121 | <tr><td> |
|
1121 | <tr><td> | |
1122 | <a href="/help/dates"> |
|
1122 | <a href="/help/dates"> | |
1123 | dates |
|
1123 | dates | |
1124 | </a> |
|
1124 | </a> | |
1125 | </td><td> |
|
1125 | </td><td> | |
1126 | Date Formats |
|
1126 | Date Formats | |
1127 | </td></tr> |
|
1127 | </td></tr> | |
1128 | <tr><td> |
|
1128 | <tr><td> | |
1129 | <a href="/help/diffs"> |
|
1129 | <a href="/help/diffs"> | |
1130 | diffs |
|
1130 | diffs | |
1131 | </a> |
|
1131 | </a> | |
1132 | </td><td> |
|
1132 | </td><td> | |
1133 | Diff Formats |
|
1133 | Diff Formats | |
1134 | </td></tr> |
|
1134 | </td></tr> | |
1135 | <tr><td> |
|
1135 | <tr><td> | |
1136 | <a href="/help/environment"> |
|
1136 | <a href="/help/environment"> | |
1137 | environment |
|
1137 | environment | |
1138 | </a> |
|
1138 | </a> | |
1139 | </td><td> |
|
1139 | </td><td> | |
1140 | Environment Variables |
|
1140 | Environment Variables | |
1141 | </td></tr> |
|
1141 | </td></tr> | |
1142 | <tr><td> |
|
1142 | <tr><td> | |
1143 | <a href="/help/extensions"> |
|
1143 | <a href="/help/extensions"> | |
1144 | extensions |
|
1144 | extensions | |
1145 | </a> |
|
1145 | </a> | |
1146 | </td><td> |
|
1146 | </td><td> | |
1147 | Using Additional Features |
|
1147 | Using Additional Features | |
1148 | </td></tr> |
|
1148 | </td></tr> | |
1149 | <tr><td> |
|
1149 | <tr><td> | |
1150 | <a href="/help/filesets"> |
|
1150 | <a href="/help/filesets"> | |
1151 | filesets |
|
1151 | filesets | |
1152 | </a> |
|
1152 | </a> | |
1153 | </td><td> |
|
1153 | </td><td> | |
1154 | Specifying File Sets |
|
1154 | Specifying File Sets | |
1155 | </td></tr> |
|
1155 | </td></tr> | |
1156 | <tr><td> |
|
1156 | <tr><td> | |
1157 | <a href="/help/glossary"> |
|
1157 | <a href="/help/glossary"> | |
1158 | glossary |
|
1158 | glossary | |
1159 | </a> |
|
1159 | </a> | |
1160 | </td><td> |
|
1160 | </td><td> | |
1161 | Glossary |
|
1161 | Glossary | |
1162 | </td></tr> |
|
1162 | </td></tr> | |
1163 | <tr><td> |
|
1163 | <tr><td> | |
1164 | <a href="/help/hgignore"> |
|
1164 | <a href="/help/hgignore"> | |
1165 | hgignore |
|
1165 | hgignore | |
1166 | </a> |
|
1166 | </a> | |
1167 | </td><td> |
|
1167 | </td><td> | |
1168 | Syntax for Mercurial Ignore Files |
|
1168 | Syntax for Mercurial Ignore Files | |
1169 | </td></tr> |
|
1169 | </td></tr> | |
1170 | <tr><td> |
|
1170 | <tr><td> | |
1171 | <a href="/help/hgweb"> |
|
1171 | <a href="/help/hgweb"> | |
1172 | hgweb |
|
1172 | hgweb | |
1173 | </a> |
|
1173 | </a> | |
1174 | </td><td> |
|
1174 | </td><td> | |
1175 | Configuring hgweb |
|
1175 | Configuring hgweb | |
1176 | </td></tr> |
|
1176 | </td></tr> | |
1177 | <tr><td> |
|
1177 | <tr><td> | |
1178 | <a href="/help/merge-tools"> |
|
1178 | <a href="/help/merge-tools"> | |
1179 | merge-tools |
|
1179 | merge-tools | |
1180 | </a> |
|
1180 | </a> | |
1181 | </td><td> |
|
1181 | </td><td> | |
1182 | Merge Tools |
|
1182 | Merge Tools | |
1183 | </td></tr> |
|
1183 | </td></tr> | |
1184 | <tr><td> |
|
1184 | <tr><td> | |
1185 | <a href="/help/multirevs"> |
|
1185 | <a href="/help/multirevs"> | |
1186 | multirevs |
|
1186 | multirevs | |
1187 | </a> |
|
1187 | </a> | |
1188 | </td><td> |
|
1188 | </td><td> | |
1189 | Specifying Multiple Revisions |
|
1189 | Specifying Multiple Revisions | |
1190 | </td></tr> |
|
1190 | </td></tr> | |
1191 | <tr><td> |
|
1191 | <tr><td> | |
1192 | <a href="/help/patterns"> |
|
1192 | <a href="/help/patterns"> | |
1193 | patterns |
|
1193 | patterns | |
1194 | </a> |
|
1194 | </a> | |
1195 | </td><td> |
|
1195 | </td><td> | |
1196 | File Name Patterns |
|
1196 | File Name Patterns | |
1197 | </td></tr> |
|
1197 | </td></tr> | |
1198 | <tr><td> |
|
1198 | <tr><td> | |
1199 | <a href="/help/phases"> |
|
1199 | <a href="/help/phases"> | |
1200 | phases |
|
1200 | phases | |
1201 | </a> |
|
1201 | </a> | |
1202 | </td><td> |
|
1202 | </td><td> | |
1203 | Working with Phases |
|
1203 | Working with Phases | |
1204 | </td></tr> |
|
1204 | </td></tr> | |
1205 | <tr><td> |
|
1205 | <tr><td> | |
1206 | <a href="/help/revisions"> |
|
1206 | <a href="/help/revisions"> | |
1207 | revisions |
|
1207 | revisions | |
1208 | </a> |
|
1208 | </a> | |
1209 | </td><td> |
|
1209 | </td><td> | |
1210 | Specifying Single Revisions |
|
1210 | Specifying Single Revisions | |
1211 | </td></tr> |
|
1211 | </td></tr> | |
1212 | <tr><td> |
|
1212 | <tr><td> | |
1213 | <a href="/help/revsets"> |
|
1213 | <a href="/help/revsets"> | |
1214 | revsets |
|
1214 | revsets | |
1215 | </a> |
|
1215 | </a> | |
1216 | </td><td> |
|
1216 | </td><td> | |
1217 | Specifying Revision Sets |
|
1217 | Specifying Revision Sets | |
1218 | </td></tr> |
|
1218 | </td></tr> | |
1219 | <tr><td> |
|
1219 | <tr><td> | |
1220 | <a href="/help/subrepos"> |
|
1220 | <a href="/help/subrepos"> | |
1221 | subrepos |
|
1221 | subrepos | |
1222 | </a> |
|
1222 | </a> | |
1223 | </td><td> |
|
1223 | </td><td> | |
1224 | Subrepositories |
|
1224 | Subrepositories | |
1225 | </td></tr> |
|
1225 | </td></tr> | |
1226 | <tr><td> |
|
1226 | <tr><td> | |
1227 | <a href="/help/templating"> |
|
1227 | <a href="/help/templating"> | |
1228 | templating |
|
1228 | templating | |
1229 | </a> |
|
1229 | </a> | |
1230 | </td><td> |
|
1230 | </td><td> | |
1231 | Template Usage |
|
1231 | Template Usage | |
1232 | </td></tr> |
|
1232 | </td></tr> | |
1233 | <tr><td> |
|
1233 | <tr><td> | |
1234 | <a href="/help/urls"> |
|
1234 | <a href="/help/urls"> | |
1235 | urls |
|
1235 | urls | |
1236 | </a> |
|
1236 | </a> | |
1237 | </td><td> |
|
1237 | </td><td> | |
1238 | URL Paths |
|
1238 | URL Paths | |
1239 | </td></tr> |
|
1239 | </td></tr> | |
1240 | <tr><td> |
|
1240 | <tr><td> | |
1241 | <a href="/help/topic-containing-verbose"> |
|
1241 | <a href="/help/topic-containing-verbose"> | |
1242 | topic-containing-verbose |
|
1242 | topic-containing-verbose | |
1243 | </a> |
|
1243 | </a> | |
1244 | </td><td> |
|
1244 | </td><td> | |
1245 | This is the topic to test omit indicating. |
|
1245 | This is the topic to test omit indicating. | |
1246 | </td></tr> |
|
1246 | </td></tr> | |
1247 |
|
1247 | |||
1248 | <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr> |
|
1248 | <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr> | |
1249 |
|
1249 | |||
1250 | <tr><td> |
|
1250 | <tr><td> | |
1251 | <a href="/help/add"> |
|
1251 | <a href="/help/add"> | |
1252 | add |
|
1252 | add | |
1253 | </a> |
|
1253 | </a> | |
1254 | </td><td> |
|
1254 | </td><td> | |
1255 | add the specified files on the next commit |
|
1255 | add the specified files on the next commit | |
1256 | </td></tr> |
|
1256 | </td></tr> | |
1257 | <tr><td> |
|
1257 | <tr><td> | |
1258 | <a href="/help/annotate"> |
|
1258 | <a href="/help/annotate"> | |
1259 | annotate |
|
1259 | annotate | |
1260 | </a> |
|
1260 | </a> | |
1261 | </td><td> |
|
1261 | </td><td> | |
1262 | show changeset information by line for each file |
|
1262 | show changeset information by line for each file | |
1263 | </td></tr> |
|
1263 | </td></tr> | |
1264 | <tr><td> |
|
1264 | <tr><td> | |
1265 | <a href="/help/clone"> |
|
1265 | <a href="/help/clone"> | |
1266 | clone |
|
1266 | clone | |
1267 | </a> |
|
1267 | </a> | |
1268 | </td><td> |
|
1268 | </td><td> | |
1269 | make a copy of an existing repository |
|
1269 | make a copy of an existing repository | |
1270 | </td></tr> |
|
1270 | </td></tr> | |
1271 | <tr><td> |
|
1271 | <tr><td> | |
1272 | <a href="/help/commit"> |
|
1272 | <a href="/help/commit"> | |
1273 | commit |
|
1273 | commit | |
1274 | </a> |
|
1274 | </a> | |
1275 | </td><td> |
|
1275 | </td><td> | |
1276 | commit the specified files or all outstanding changes |
|
1276 | commit the specified files or all outstanding changes | |
1277 | </td></tr> |
|
1277 | </td></tr> | |
1278 | <tr><td> |
|
1278 | <tr><td> | |
1279 | <a href="/help/diff"> |
|
1279 | <a href="/help/diff"> | |
1280 | diff |
|
1280 | diff | |
1281 | </a> |
|
1281 | </a> | |
1282 | </td><td> |
|
1282 | </td><td> | |
1283 | diff repository (or selected files) |
|
1283 | diff repository (or selected files) | |
1284 | </td></tr> |
|
1284 | </td></tr> | |
1285 | <tr><td> |
|
1285 | <tr><td> | |
1286 | <a href="/help/export"> |
|
1286 | <a href="/help/export"> | |
1287 | export |
|
1287 | export | |
1288 | </a> |
|
1288 | </a> | |
1289 | </td><td> |
|
1289 | </td><td> | |
1290 | dump the header and diffs for one or more changesets |
|
1290 | dump the header and diffs for one or more changesets | |
1291 | </td></tr> |
|
1291 | </td></tr> | |
1292 | <tr><td> |
|
1292 | <tr><td> | |
1293 | <a href="/help/forget"> |
|
1293 | <a href="/help/forget"> | |
1294 | forget |
|
1294 | forget | |
1295 | </a> |
|
1295 | </a> | |
1296 | </td><td> |
|
1296 | </td><td> | |
1297 | forget the specified files on the next commit |
|
1297 | forget the specified files on the next commit | |
1298 | </td></tr> |
|
1298 | </td></tr> | |
1299 | <tr><td> |
|
1299 | <tr><td> | |
1300 | <a href="/help/init"> |
|
1300 | <a href="/help/init"> | |
1301 | init |
|
1301 | init | |
1302 | </a> |
|
1302 | </a> | |
1303 | </td><td> |
|
1303 | </td><td> | |
1304 | create a new repository in the given directory |
|
1304 | create a new repository in the given directory | |
1305 | </td></tr> |
|
1305 | </td></tr> | |
1306 | <tr><td> |
|
1306 | <tr><td> | |
1307 | <a href="/help/log"> |
|
1307 | <a href="/help/log"> | |
1308 | log |
|
1308 | log | |
1309 | </a> |
|
1309 | </a> | |
1310 | </td><td> |
|
1310 | </td><td> | |
1311 | show revision history of entire repository or files |
|
1311 | show revision history of entire repository or files | |
1312 | </td></tr> |
|
1312 | </td></tr> | |
1313 | <tr><td> |
|
1313 | <tr><td> | |
1314 | <a href="/help/merge"> |
|
1314 | <a href="/help/merge"> | |
1315 | merge |
|
1315 | merge | |
1316 | </a> |
|
1316 | </a> | |
1317 | </td><td> |
|
1317 | </td><td> | |
1318 | merge working directory with another revision |
|
1318 | merge working directory with another revision | |
1319 | </td></tr> |
|
1319 | </td></tr> | |
1320 | <tr><td> |
|
1320 | <tr><td> | |
1321 | <a href="/help/pull"> |
|
1321 | <a href="/help/pull"> | |
1322 | pull |
|
1322 | pull | |
1323 | </a> |
|
1323 | </a> | |
1324 | </td><td> |
|
1324 | </td><td> | |
1325 | pull changes from the specified source |
|
1325 | pull changes from the specified source | |
1326 | </td></tr> |
|
1326 | </td></tr> | |
1327 | <tr><td> |
|
1327 | <tr><td> | |
1328 | <a href="/help/push"> |
|
1328 | <a href="/help/push"> | |
1329 | push |
|
1329 | push | |
1330 | </a> |
|
1330 | </a> | |
1331 | </td><td> |
|
1331 | </td><td> | |
1332 | push changes to the specified destination |
|
1332 | push changes to the specified destination | |
1333 | </td></tr> |
|
1333 | </td></tr> | |
1334 | <tr><td> |
|
1334 | <tr><td> | |
1335 | <a href="/help/remove"> |
|
1335 | <a href="/help/remove"> | |
1336 | remove |
|
1336 | remove | |
1337 | </a> |
|
1337 | </a> | |
1338 | </td><td> |
|
1338 | </td><td> | |
1339 | remove the specified files on the next commit |
|
1339 | remove the specified files on the next commit | |
1340 | </td></tr> |
|
1340 | </td></tr> | |
1341 | <tr><td> |
|
1341 | <tr><td> | |
1342 | <a href="/help/serve"> |
|
1342 | <a href="/help/serve"> | |
1343 | serve |
|
1343 | serve | |
1344 | </a> |
|
1344 | </a> | |
1345 | </td><td> |
|
1345 | </td><td> | |
1346 | start stand-alone webserver |
|
1346 | start stand-alone webserver | |
1347 | </td></tr> |
|
1347 | </td></tr> | |
1348 | <tr><td> |
|
1348 | <tr><td> | |
1349 | <a href="/help/status"> |
|
1349 | <a href="/help/status"> | |
1350 | status |
|
1350 | status | |
1351 | </a> |
|
1351 | </a> | |
1352 | </td><td> |
|
1352 | </td><td> | |
1353 | show changed files in the working directory |
|
1353 | show changed files in the working directory | |
1354 | </td></tr> |
|
1354 | </td></tr> | |
1355 | <tr><td> |
|
1355 | <tr><td> | |
1356 | <a href="/help/summary"> |
|
1356 | <a href="/help/summary"> | |
1357 | summary |
|
1357 | summary | |
1358 | </a> |
|
1358 | </a> | |
1359 | </td><td> |
|
1359 | </td><td> | |
1360 | summarize working directory state |
|
1360 | summarize working directory state | |
1361 | </td></tr> |
|
1361 | </td></tr> | |
1362 | <tr><td> |
|
1362 | <tr><td> | |
1363 | <a href="/help/update"> |
|
1363 | <a href="/help/update"> | |
1364 | update |
|
1364 | update | |
1365 | </a> |
|
1365 | </a> | |
1366 | </td><td> |
|
1366 | </td><td> | |
1367 | update working directory (or switch revisions) |
|
1367 | update working directory (or switch revisions) | |
1368 | </td></tr> |
|
1368 | </td></tr> | |
1369 |
|
1369 | |||
1370 | <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr> |
|
1370 | <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr> | |
1371 |
|
1371 | |||
1372 | <tr><td> |
|
1372 | <tr><td> | |
1373 | <a href="/help/addremove"> |
|
1373 | <a href="/help/addremove"> | |
1374 | addremove |
|
1374 | addremove | |
1375 | </a> |
|
1375 | </a> | |
1376 | </td><td> |
|
1376 | </td><td> | |
1377 | add all new files, delete all missing files |
|
1377 | add all new files, delete all missing files | |
1378 | </td></tr> |
|
1378 | </td></tr> | |
1379 | <tr><td> |
|
1379 | <tr><td> | |
1380 | <a href="/help/archive"> |
|
1380 | <a href="/help/archive"> | |
1381 | archive |
|
1381 | archive | |
1382 | </a> |
|
1382 | </a> | |
1383 | </td><td> |
|
1383 | </td><td> | |
1384 | create an unversioned archive of a repository revision |
|
1384 | create an unversioned archive of a repository revision | |
1385 | </td></tr> |
|
1385 | </td></tr> | |
1386 | <tr><td> |
|
1386 | <tr><td> | |
1387 | <a href="/help/backout"> |
|
1387 | <a href="/help/backout"> | |
1388 | backout |
|
1388 | backout | |
1389 | </a> |
|
1389 | </a> | |
1390 | </td><td> |
|
1390 | </td><td> | |
1391 | reverse effect of earlier changeset |
|
1391 | reverse effect of earlier changeset | |
1392 | </td></tr> |
|
1392 | </td></tr> | |
1393 | <tr><td> |
|
1393 | <tr><td> | |
1394 | <a href="/help/bisect"> |
|
1394 | <a href="/help/bisect"> | |
1395 | bisect |
|
1395 | bisect | |
1396 | </a> |
|
1396 | </a> | |
1397 | </td><td> |
|
1397 | </td><td> | |
1398 | subdivision search of changesets |
|
1398 | subdivision search of changesets | |
1399 | </td></tr> |
|
1399 | </td></tr> | |
1400 | <tr><td> |
|
1400 | <tr><td> | |
1401 | <a href="/help/bookmarks"> |
|
1401 | <a href="/help/bookmarks"> | |
1402 | bookmarks |
|
1402 | bookmarks | |
1403 | </a> |
|
1403 | </a> | |
1404 | </td><td> |
|
1404 | </td><td> | |
1405 | track a line of development with movable markers |
|
1405 | create a new bookmark or list existing bookmarks | |
1406 | </td></tr> |
|
1406 | </td></tr> | |
1407 | <tr><td> |
|
1407 | <tr><td> | |
1408 | <a href="/help/branch"> |
|
1408 | <a href="/help/branch"> | |
1409 | branch |
|
1409 | branch | |
1410 | </a> |
|
1410 | </a> | |
1411 | </td><td> |
|
1411 | </td><td> | |
1412 | set or show the current branch name |
|
1412 | set or show the current branch name | |
1413 | </td></tr> |
|
1413 | </td></tr> | |
1414 | <tr><td> |
|
1414 | <tr><td> | |
1415 | <a href="/help/branches"> |
|
1415 | <a href="/help/branches"> | |
1416 | branches |
|
1416 | branches | |
1417 | </a> |
|
1417 | </a> | |
1418 | </td><td> |
|
1418 | </td><td> | |
1419 | list repository named branches |
|
1419 | list repository named branches | |
1420 | </td></tr> |
|
1420 | </td></tr> | |
1421 | <tr><td> |
|
1421 | <tr><td> | |
1422 | <a href="/help/bundle"> |
|
1422 | <a href="/help/bundle"> | |
1423 | bundle |
|
1423 | bundle | |
1424 | </a> |
|
1424 | </a> | |
1425 | </td><td> |
|
1425 | </td><td> | |
1426 | create a changegroup file |
|
1426 | create a changegroup file | |
1427 | </td></tr> |
|
1427 | </td></tr> | |
1428 | <tr><td> |
|
1428 | <tr><td> | |
1429 | <a href="/help/cat"> |
|
1429 | <a href="/help/cat"> | |
1430 | cat |
|
1430 | cat | |
1431 | </a> |
|
1431 | </a> | |
1432 | </td><td> |
|
1432 | </td><td> | |
1433 | output the current or given revision of files |
|
1433 | output the current or given revision of files | |
1434 | </td></tr> |
|
1434 | </td></tr> | |
1435 | <tr><td> |
|
1435 | <tr><td> | |
1436 | <a href="/help/config"> |
|
1436 | <a href="/help/config"> | |
1437 | config |
|
1437 | config | |
1438 | </a> |
|
1438 | </a> | |
1439 | </td><td> |
|
1439 | </td><td> | |
1440 | show combined config settings from all hgrc files |
|
1440 | show combined config settings from all hgrc files | |
1441 | </td></tr> |
|
1441 | </td></tr> | |
1442 | <tr><td> |
|
1442 | <tr><td> | |
1443 | <a href="/help/copy"> |
|
1443 | <a href="/help/copy"> | |
1444 | copy |
|
1444 | copy | |
1445 | </a> |
|
1445 | </a> | |
1446 | </td><td> |
|
1446 | </td><td> | |
1447 | mark files as copied for the next commit |
|
1447 | mark files as copied for the next commit | |
1448 | </td></tr> |
|
1448 | </td></tr> | |
1449 | <tr><td> |
|
1449 | <tr><td> | |
1450 | <a href="/help/graft"> |
|
1450 | <a href="/help/graft"> | |
1451 | graft |
|
1451 | graft | |
1452 | </a> |
|
1452 | </a> | |
1453 | </td><td> |
|
1453 | </td><td> | |
1454 | copy changes from other branches onto the current branch |
|
1454 | copy changes from other branches onto the current branch | |
1455 | </td></tr> |
|
1455 | </td></tr> | |
1456 | <tr><td> |
|
1456 | <tr><td> | |
1457 | <a href="/help/grep"> |
|
1457 | <a href="/help/grep"> | |
1458 | grep |
|
1458 | grep | |
1459 | </a> |
|
1459 | </a> | |
1460 | </td><td> |
|
1460 | </td><td> | |
1461 | search for a pattern in specified files and revisions |
|
1461 | search for a pattern in specified files and revisions | |
1462 | </td></tr> |
|
1462 | </td></tr> | |
1463 | <tr><td> |
|
1463 | <tr><td> | |
1464 | <a href="/help/heads"> |
|
1464 | <a href="/help/heads"> | |
1465 | heads |
|
1465 | heads | |
1466 | </a> |
|
1466 | </a> | |
1467 | </td><td> |
|
1467 | </td><td> | |
1468 | show branch heads |
|
1468 | show branch heads | |
1469 | </td></tr> |
|
1469 | </td></tr> | |
1470 | <tr><td> |
|
1470 | <tr><td> | |
1471 | <a href="/help/help"> |
|
1471 | <a href="/help/help"> | |
1472 | help |
|
1472 | help | |
1473 | </a> |
|
1473 | </a> | |
1474 | </td><td> |
|
1474 | </td><td> | |
1475 | show help for a given topic or a help overview |
|
1475 | show help for a given topic or a help overview | |
1476 | </td></tr> |
|
1476 | </td></tr> | |
1477 | <tr><td> |
|
1477 | <tr><td> | |
1478 | <a href="/help/identify"> |
|
1478 | <a href="/help/identify"> | |
1479 | identify |
|
1479 | identify | |
1480 | </a> |
|
1480 | </a> | |
1481 | </td><td> |
|
1481 | </td><td> | |
1482 | identify the working copy or specified revision |
|
1482 | identify the working copy or specified revision | |
1483 | </td></tr> |
|
1483 | </td></tr> | |
1484 | <tr><td> |
|
1484 | <tr><td> | |
1485 | <a href="/help/import"> |
|
1485 | <a href="/help/import"> | |
1486 | import |
|
1486 | import | |
1487 | </a> |
|
1487 | </a> | |
1488 | </td><td> |
|
1488 | </td><td> | |
1489 | import an ordered set of patches |
|
1489 | import an ordered set of patches | |
1490 | </td></tr> |
|
1490 | </td></tr> | |
1491 | <tr><td> |
|
1491 | <tr><td> | |
1492 | <a href="/help/incoming"> |
|
1492 | <a href="/help/incoming"> | |
1493 | incoming |
|
1493 | incoming | |
1494 | </a> |
|
1494 | </a> | |
1495 | </td><td> |
|
1495 | </td><td> | |
1496 | show new changesets found in source |
|
1496 | show new changesets found in source | |
1497 | </td></tr> |
|
1497 | </td></tr> | |
1498 | <tr><td> |
|
1498 | <tr><td> | |
1499 | <a href="/help/locate"> |
|
1499 | <a href="/help/locate"> | |
1500 | locate |
|
1500 | locate | |
1501 | </a> |
|
1501 | </a> | |
1502 | </td><td> |
|
1502 | </td><td> | |
1503 | locate files matching specific patterns |
|
1503 | locate files matching specific patterns | |
1504 | </td></tr> |
|
1504 | </td></tr> | |
1505 | <tr><td> |
|
1505 | <tr><td> | |
1506 | <a href="/help/manifest"> |
|
1506 | <a href="/help/manifest"> | |
1507 | manifest |
|
1507 | manifest | |
1508 | </a> |
|
1508 | </a> | |
1509 | </td><td> |
|
1509 | </td><td> | |
1510 | output the current or given revision of the project manifest |
|
1510 | output the current or given revision of the project manifest | |
1511 | </td></tr> |
|
1511 | </td></tr> | |
1512 | <tr><td> |
|
1512 | <tr><td> | |
1513 | <a href="/help/nohelp"> |
|
1513 | <a href="/help/nohelp"> | |
1514 | nohelp |
|
1514 | nohelp | |
1515 | </a> |
|
1515 | </a> | |
1516 | </td><td> |
|
1516 | </td><td> | |
1517 | (no help text available) |
|
1517 | (no help text available) | |
1518 | </td></tr> |
|
1518 | </td></tr> | |
1519 | <tr><td> |
|
1519 | <tr><td> | |
1520 | <a href="/help/outgoing"> |
|
1520 | <a href="/help/outgoing"> | |
1521 | outgoing |
|
1521 | outgoing | |
1522 | </a> |
|
1522 | </a> | |
1523 | </td><td> |
|
1523 | </td><td> | |
1524 | show changesets not found in the destination |
|
1524 | show changesets not found in the destination | |
1525 | </td></tr> |
|
1525 | </td></tr> | |
1526 | <tr><td> |
|
1526 | <tr><td> | |
1527 | <a href="/help/parents"> |
|
1527 | <a href="/help/parents"> | |
1528 | parents |
|
1528 | parents | |
1529 | </a> |
|
1529 | </a> | |
1530 | </td><td> |
|
1530 | </td><td> | |
1531 | show the parents of the working directory or revision |
|
1531 | show the parents of the working directory or revision | |
1532 | </td></tr> |
|
1532 | </td></tr> | |
1533 | <tr><td> |
|
1533 | <tr><td> | |
1534 | <a href="/help/paths"> |
|
1534 | <a href="/help/paths"> | |
1535 | paths |
|
1535 | paths | |
1536 | </a> |
|
1536 | </a> | |
1537 | </td><td> |
|
1537 | </td><td> | |
1538 | show aliases for remote repositories |
|
1538 | show aliases for remote repositories | |
1539 | </td></tr> |
|
1539 | </td></tr> | |
1540 | <tr><td> |
|
1540 | <tr><td> | |
1541 | <a href="/help/phase"> |
|
1541 | <a href="/help/phase"> | |
1542 | phase |
|
1542 | phase | |
1543 | </a> |
|
1543 | </a> | |
1544 | </td><td> |
|
1544 | </td><td> | |
1545 | set or show the current phase name |
|
1545 | set or show the current phase name | |
1546 | </td></tr> |
|
1546 | </td></tr> | |
1547 | <tr><td> |
|
1547 | <tr><td> | |
1548 | <a href="/help/recover"> |
|
1548 | <a href="/help/recover"> | |
1549 | recover |
|
1549 | recover | |
1550 | </a> |
|
1550 | </a> | |
1551 | </td><td> |
|
1551 | </td><td> | |
1552 | roll back an interrupted transaction |
|
1552 | roll back an interrupted transaction | |
1553 | </td></tr> |
|
1553 | </td></tr> | |
1554 | <tr><td> |
|
1554 | <tr><td> | |
1555 | <a href="/help/rename"> |
|
1555 | <a href="/help/rename"> | |
1556 | rename |
|
1556 | rename | |
1557 | </a> |
|
1557 | </a> | |
1558 | </td><td> |
|
1558 | </td><td> | |
1559 | rename files; equivalent of copy + remove |
|
1559 | rename files; equivalent of copy + remove | |
1560 | </td></tr> |
|
1560 | </td></tr> | |
1561 | <tr><td> |
|
1561 | <tr><td> | |
1562 | <a href="/help/resolve"> |
|
1562 | <a href="/help/resolve"> | |
1563 | resolve |
|
1563 | resolve | |
1564 | </a> |
|
1564 | </a> | |
1565 | </td><td> |
|
1565 | </td><td> | |
1566 | redo merges or set/view the merge status of files |
|
1566 | redo merges or set/view the merge status of files | |
1567 | </td></tr> |
|
1567 | </td></tr> | |
1568 | <tr><td> |
|
1568 | <tr><td> | |
1569 | <a href="/help/revert"> |
|
1569 | <a href="/help/revert"> | |
1570 | revert |
|
1570 | revert | |
1571 | </a> |
|
1571 | </a> | |
1572 | </td><td> |
|
1572 | </td><td> | |
1573 | restore files to their checkout state |
|
1573 | restore files to their checkout state | |
1574 | </td></tr> |
|
1574 | </td></tr> | |
1575 | <tr><td> |
|
1575 | <tr><td> | |
1576 | <a href="/help/root"> |
|
1576 | <a href="/help/root"> | |
1577 | root |
|
1577 | root | |
1578 | </a> |
|
1578 | </a> | |
1579 | </td><td> |
|
1579 | </td><td> | |
1580 | print the root (top) of the current working directory |
|
1580 | print the root (top) of the current working directory | |
1581 | </td></tr> |
|
1581 | </td></tr> | |
1582 | <tr><td> |
|
1582 | <tr><td> | |
1583 | <a href="/help/tag"> |
|
1583 | <a href="/help/tag"> | |
1584 | tag |
|
1584 | tag | |
1585 | </a> |
|
1585 | </a> | |
1586 | </td><td> |
|
1586 | </td><td> | |
1587 | add one or more tags for the current or given revision |
|
1587 | add one or more tags for the current or given revision | |
1588 | </td></tr> |
|
1588 | </td></tr> | |
1589 | <tr><td> |
|
1589 | <tr><td> | |
1590 | <a href="/help/tags"> |
|
1590 | <a href="/help/tags"> | |
1591 | tags |
|
1591 | tags | |
1592 | </a> |
|
1592 | </a> | |
1593 | </td><td> |
|
1593 | </td><td> | |
1594 | list repository tags |
|
1594 | list repository tags | |
1595 | </td></tr> |
|
1595 | </td></tr> | |
1596 | <tr><td> |
|
1596 | <tr><td> | |
1597 | <a href="/help/unbundle"> |
|
1597 | <a href="/help/unbundle"> | |
1598 | unbundle |
|
1598 | unbundle | |
1599 | </a> |
|
1599 | </a> | |
1600 | </td><td> |
|
1600 | </td><td> | |
1601 | apply one or more changegroup files |
|
1601 | apply one or more changegroup files | |
1602 | </td></tr> |
|
1602 | </td></tr> | |
1603 | <tr><td> |
|
1603 | <tr><td> | |
1604 | <a href="/help/verify"> |
|
1604 | <a href="/help/verify"> | |
1605 | verify |
|
1605 | verify | |
1606 | </a> |
|
1606 | </a> | |
1607 | </td><td> |
|
1607 | </td><td> | |
1608 | verify the integrity of the repository |
|
1608 | verify the integrity of the repository | |
1609 | </td></tr> |
|
1609 | </td></tr> | |
1610 | <tr><td> |
|
1610 | <tr><td> | |
1611 | <a href="/help/version"> |
|
1611 | <a href="/help/version"> | |
1612 | version |
|
1612 | version | |
1613 | </a> |
|
1613 | </a> | |
1614 | </td><td> |
|
1614 | </td><td> | |
1615 | output version and copyright information |
|
1615 | output version and copyright information | |
1616 | </td></tr> |
|
1616 | </td></tr> | |
1617 | </table> |
|
1617 | </table> | |
1618 | </div> |
|
1618 | </div> | |
1619 | </div> |
|
1619 | </div> | |
1620 |
|
1620 | |||
1621 | <script type="text/javascript">process_dates()</script> |
|
1621 | <script type="text/javascript">process_dates()</script> | |
1622 |
|
1622 | |||
1623 |
|
1623 | |||
1624 | </body> |
|
1624 | </body> | |
1625 | </html> |
|
1625 | </html> | |
1626 |
|
1626 | |||
1627 |
|
1627 | |||
1628 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add" |
|
1628 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add" | |
1629 | 200 Script output follows |
|
1629 | 200 Script output follows | |
1630 |
|
1630 | |||
1631 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1631 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
1632 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1632 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
1633 | <head> |
|
1633 | <head> | |
1634 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1634 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
1635 | <meta name="robots" content="index, nofollow" /> |
|
1635 | <meta name="robots" content="index, nofollow" /> | |
1636 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1636 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
1637 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1637 | <script type="text/javascript" src="/static/mercurial.js"></script> | |
1638 |
|
1638 | |||
1639 | <title>Help: add</title> |
|
1639 | <title>Help: add</title> | |
1640 | </head> |
|
1640 | </head> | |
1641 | <body> |
|
1641 | <body> | |
1642 |
|
1642 | |||
1643 | <div class="container"> |
|
1643 | <div class="container"> | |
1644 | <div class="menu"> |
|
1644 | <div class="menu"> | |
1645 | <div class="logo"> |
|
1645 | <div class="logo"> | |
1646 | <a href="http://mercurial.selenic.com/"> |
|
1646 | <a href="http://mercurial.selenic.com/"> | |
1647 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1647 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
1648 | </div> |
|
1648 | </div> | |
1649 | <ul> |
|
1649 | <ul> | |
1650 | <li><a href="/shortlog">log</a></li> |
|
1650 | <li><a href="/shortlog">log</a></li> | |
1651 | <li><a href="/graph">graph</a></li> |
|
1651 | <li><a href="/graph">graph</a></li> | |
1652 | <li><a href="/tags">tags</a></li> |
|
1652 | <li><a href="/tags">tags</a></li> | |
1653 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1653 | <li><a href="/bookmarks">bookmarks</a></li> | |
1654 | <li><a href="/branches">branches</a></li> |
|
1654 | <li><a href="/branches">branches</a></li> | |
1655 | </ul> |
|
1655 | </ul> | |
1656 | <ul> |
|
1656 | <ul> | |
1657 | <li class="active"><a href="/help">help</a></li> |
|
1657 | <li class="active"><a href="/help">help</a></li> | |
1658 | </ul> |
|
1658 | </ul> | |
1659 | </div> |
|
1659 | </div> | |
1660 |
|
1660 | |||
1661 | <div class="main"> |
|
1661 | <div class="main"> | |
1662 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1662 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> | |
1663 | <h3>Help: add</h3> |
|
1663 | <h3>Help: add</h3> | |
1664 |
|
1664 | |||
1665 | <form class="search" action="/log"> |
|
1665 | <form class="search" action="/log"> | |
1666 |
|
1666 | |||
1667 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1667 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
1668 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
1668 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision | |
1669 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
1669 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> | |
1670 | </form> |
|
1670 | </form> | |
1671 | <div id="doc"> |
|
1671 | <div id="doc"> | |
1672 | <p> |
|
1672 | <p> | |
1673 | hg add [OPTION]... [FILE]... |
|
1673 | hg add [OPTION]... [FILE]... | |
1674 | </p> |
|
1674 | </p> | |
1675 | <p> |
|
1675 | <p> | |
1676 | add the specified files on the next commit |
|
1676 | add the specified files on the next commit | |
1677 | </p> |
|
1677 | </p> | |
1678 | <p> |
|
1678 | <p> | |
1679 | Schedule files to be version controlled and added to the |
|
1679 | Schedule files to be version controlled and added to the | |
1680 | repository. |
|
1680 | repository. | |
1681 | </p> |
|
1681 | </p> | |
1682 | <p> |
|
1682 | <p> | |
1683 | The files will be added to the repository at the next commit. To |
|
1683 | The files will be added to the repository at the next commit. To | |
1684 | undo an add before that, see "hg forget". |
|
1684 | undo an add before that, see "hg forget". | |
1685 | </p> |
|
1685 | </p> | |
1686 | <p> |
|
1686 | <p> | |
1687 | If no names are given, add all files to the repository. |
|
1687 | If no names are given, add all files to the repository. | |
1688 | </p> |
|
1688 | </p> | |
1689 | <p> |
|
1689 | <p> | |
1690 | An example showing how new (unknown) files are added |
|
1690 | An example showing how new (unknown) files are added | |
1691 | automatically by "hg add": |
|
1691 | automatically by "hg add": | |
1692 | </p> |
|
1692 | </p> | |
1693 | <pre> |
|
1693 | <pre> | |
1694 | \$ ls (re) |
|
1694 | \$ ls (re) | |
1695 | foo.c |
|
1695 | foo.c | |
1696 | \$ hg status (re) |
|
1696 | \$ hg status (re) | |
1697 | ? foo.c |
|
1697 | ? foo.c | |
1698 | \$ hg add (re) |
|
1698 | \$ hg add (re) | |
1699 | adding foo.c |
|
1699 | adding foo.c | |
1700 | \$ hg status (re) |
|
1700 | \$ hg status (re) | |
1701 | A foo.c |
|
1701 | A foo.c | |
1702 | </pre> |
|
1702 | </pre> | |
1703 | <p> |
|
1703 | <p> | |
1704 | Returns 0 if all files are successfully added. |
|
1704 | Returns 0 if all files are successfully added. | |
1705 | </p> |
|
1705 | </p> | |
1706 | <p> |
|
1706 | <p> | |
1707 | options: |
|
1707 | options: | |
1708 | </p> |
|
1708 | </p> | |
1709 | <table> |
|
1709 | <table> | |
1710 | <tr><td>-I</td> |
|
1710 | <tr><td>-I</td> | |
1711 | <td>--include PATTERN [+]</td> |
|
1711 | <td>--include PATTERN [+]</td> | |
1712 | <td>include names matching the given patterns</td></tr> |
|
1712 | <td>include names matching the given patterns</td></tr> | |
1713 | <tr><td>-X</td> |
|
1713 | <tr><td>-X</td> | |
1714 | <td>--exclude PATTERN [+]</td> |
|
1714 | <td>--exclude PATTERN [+]</td> | |
1715 | <td>exclude names matching the given patterns</td></tr> |
|
1715 | <td>exclude names matching the given patterns</td></tr> | |
1716 | <tr><td>-S</td> |
|
1716 | <tr><td>-S</td> | |
1717 | <td>--subrepos</td> |
|
1717 | <td>--subrepos</td> | |
1718 | <td>recurse into subrepositories</td></tr> |
|
1718 | <td>recurse into subrepositories</td></tr> | |
1719 | <tr><td>-n</td> |
|
1719 | <tr><td>-n</td> | |
1720 | <td>--dry-run</td> |
|
1720 | <td>--dry-run</td> | |
1721 | <td>do not perform actions, just print output</td></tr> |
|
1721 | <td>do not perform actions, just print output</td></tr> | |
1722 | </table> |
|
1722 | </table> | |
1723 | <p> |
|
1723 | <p> | |
1724 | [+] marked option can be specified multiple times |
|
1724 | [+] marked option can be specified multiple times | |
1725 | </p> |
|
1725 | </p> | |
1726 | <p> |
|
1726 | <p> | |
1727 | global options: |
|
1727 | global options: | |
1728 | </p> |
|
1728 | </p> | |
1729 | <table> |
|
1729 | <table> | |
1730 | <tr><td>-R</td> |
|
1730 | <tr><td>-R</td> | |
1731 | <td>--repository REPO</td> |
|
1731 | <td>--repository REPO</td> | |
1732 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
1732 | <td>repository root directory or name of overlay bundle file</td></tr> | |
1733 | <tr><td></td> |
|
1733 | <tr><td></td> | |
1734 | <td>--cwd DIR</td> |
|
1734 | <td>--cwd DIR</td> | |
1735 | <td>change working directory</td></tr> |
|
1735 | <td>change working directory</td></tr> | |
1736 | <tr><td>-y</td> |
|
1736 | <tr><td>-y</td> | |
1737 | <td>--noninteractive</td> |
|
1737 | <td>--noninteractive</td> | |
1738 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
1738 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> | |
1739 | <tr><td>-q</td> |
|
1739 | <tr><td>-q</td> | |
1740 | <td>--quiet</td> |
|
1740 | <td>--quiet</td> | |
1741 | <td>suppress output</td></tr> |
|
1741 | <td>suppress output</td></tr> | |
1742 | <tr><td>-v</td> |
|
1742 | <tr><td>-v</td> | |
1743 | <td>--verbose</td> |
|
1743 | <td>--verbose</td> | |
1744 | <td>enable additional output</td></tr> |
|
1744 | <td>enable additional output</td></tr> | |
1745 | <tr><td></td> |
|
1745 | <tr><td></td> | |
1746 | <td>--config CONFIG [+]</td> |
|
1746 | <td>--config CONFIG [+]</td> | |
1747 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
1747 | <td>set/override config option (use 'section.name=value')</td></tr> | |
1748 | <tr><td></td> |
|
1748 | <tr><td></td> | |
1749 | <td>--debug</td> |
|
1749 | <td>--debug</td> | |
1750 | <td>enable debugging output</td></tr> |
|
1750 | <td>enable debugging output</td></tr> | |
1751 | <tr><td></td> |
|
1751 | <tr><td></td> | |
1752 | <td>--debugger</td> |
|
1752 | <td>--debugger</td> | |
1753 | <td>start debugger</td></tr> |
|
1753 | <td>start debugger</td></tr> | |
1754 | <tr><td></td> |
|
1754 | <tr><td></td> | |
1755 | <td>--encoding ENCODE</td> |
|
1755 | <td>--encoding ENCODE</td> | |
1756 | <td>set the charset encoding (default: ascii)</td></tr> |
|
1756 | <td>set the charset encoding (default: ascii)</td></tr> | |
1757 | <tr><td></td> |
|
1757 | <tr><td></td> | |
1758 | <td>--encodingmode MODE</td> |
|
1758 | <td>--encodingmode MODE</td> | |
1759 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
1759 | <td>set the charset encoding mode (default: strict)</td></tr> | |
1760 | <tr><td></td> |
|
1760 | <tr><td></td> | |
1761 | <td>--traceback</td> |
|
1761 | <td>--traceback</td> | |
1762 | <td>always print a traceback on exception</td></tr> |
|
1762 | <td>always print a traceback on exception</td></tr> | |
1763 | <tr><td></td> |
|
1763 | <tr><td></td> | |
1764 | <td>--time</td> |
|
1764 | <td>--time</td> | |
1765 | <td>time how long the command takes</td></tr> |
|
1765 | <td>time how long the command takes</td></tr> | |
1766 | <tr><td></td> |
|
1766 | <tr><td></td> | |
1767 | <td>--profile</td> |
|
1767 | <td>--profile</td> | |
1768 | <td>print command execution profile</td></tr> |
|
1768 | <td>print command execution profile</td></tr> | |
1769 | <tr><td></td> |
|
1769 | <tr><td></td> | |
1770 | <td>--version</td> |
|
1770 | <td>--version</td> | |
1771 | <td>output version information and exit</td></tr> |
|
1771 | <td>output version information and exit</td></tr> | |
1772 | <tr><td>-h</td> |
|
1772 | <tr><td>-h</td> | |
1773 | <td>--help</td> |
|
1773 | <td>--help</td> | |
1774 | <td>display help and exit</td></tr> |
|
1774 | <td>display help and exit</td></tr> | |
1775 | <tr><td></td> |
|
1775 | <tr><td></td> | |
1776 | <td>--hidden</td> |
|
1776 | <td>--hidden</td> | |
1777 | <td>consider hidden changesets</td></tr> |
|
1777 | <td>consider hidden changesets</td></tr> | |
1778 | </table> |
|
1778 | </table> | |
1779 | <p> |
|
1779 | <p> | |
1780 | [+] marked option can be specified multiple times |
|
1780 | [+] marked option can be specified multiple times | |
1781 | </p> |
|
1781 | </p> | |
1782 |
|
1782 | |||
1783 | </div> |
|
1783 | </div> | |
1784 | </div> |
|
1784 | </div> | |
1785 | </div> |
|
1785 | </div> | |
1786 |
|
1786 | |||
1787 | <script type="text/javascript">process_dates()</script> |
|
1787 | <script type="text/javascript">process_dates()</script> | |
1788 |
|
1788 | |||
1789 |
|
1789 | |||
1790 | </body> |
|
1790 | </body> | |
1791 | </html> |
|
1791 | </html> | |
1792 |
|
1792 | |||
1793 |
|
1793 | |||
1794 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove" |
|
1794 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove" | |
1795 | 200 Script output follows |
|
1795 | 200 Script output follows | |
1796 |
|
1796 | |||
1797 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1797 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
1798 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1798 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
1799 | <head> |
|
1799 | <head> | |
1800 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1800 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
1801 | <meta name="robots" content="index, nofollow" /> |
|
1801 | <meta name="robots" content="index, nofollow" /> | |
1802 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1802 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
1803 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1803 | <script type="text/javascript" src="/static/mercurial.js"></script> | |
1804 |
|
1804 | |||
1805 | <title>Help: remove</title> |
|
1805 | <title>Help: remove</title> | |
1806 | </head> |
|
1806 | </head> | |
1807 | <body> |
|
1807 | <body> | |
1808 |
|
1808 | |||
1809 | <div class="container"> |
|
1809 | <div class="container"> | |
1810 | <div class="menu"> |
|
1810 | <div class="menu"> | |
1811 | <div class="logo"> |
|
1811 | <div class="logo"> | |
1812 | <a href="http://mercurial.selenic.com/"> |
|
1812 | <a href="http://mercurial.selenic.com/"> | |
1813 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1813 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
1814 | </div> |
|
1814 | </div> | |
1815 | <ul> |
|
1815 | <ul> | |
1816 | <li><a href="/shortlog">log</a></li> |
|
1816 | <li><a href="/shortlog">log</a></li> | |
1817 | <li><a href="/graph">graph</a></li> |
|
1817 | <li><a href="/graph">graph</a></li> | |
1818 | <li><a href="/tags">tags</a></li> |
|
1818 | <li><a href="/tags">tags</a></li> | |
1819 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1819 | <li><a href="/bookmarks">bookmarks</a></li> | |
1820 | <li><a href="/branches">branches</a></li> |
|
1820 | <li><a href="/branches">branches</a></li> | |
1821 | </ul> |
|
1821 | </ul> | |
1822 | <ul> |
|
1822 | <ul> | |
1823 | <li class="active"><a href="/help">help</a></li> |
|
1823 | <li class="active"><a href="/help">help</a></li> | |
1824 | </ul> |
|
1824 | </ul> | |
1825 | </div> |
|
1825 | </div> | |
1826 |
|
1826 | |||
1827 | <div class="main"> |
|
1827 | <div class="main"> | |
1828 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1828 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> | |
1829 | <h3>Help: remove</h3> |
|
1829 | <h3>Help: remove</h3> | |
1830 |
|
1830 | |||
1831 | <form class="search" action="/log"> |
|
1831 | <form class="search" action="/log"> | |
1832 |
|
1832 | |||
1833 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1833 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
1834 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
1834 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision | |
1835 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
1835 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> | |
1836 | </form> |
|
1836 | </form> | |
1837 | <div id="doc"> |
|
1837 | <div id="doc"> | |
1838 | <p> |
|
1838 | <p> | |
1839 | hg remove [OPTION]... FILE... |
|
1839 | hg remove [OPTION]... FILE... | |
1840 | </p> |
|
1840 | </p> | |
1841 | <p> |
|
1841 | <p> | |
1842 | aliases: rm |
|
1842 | aliases: rm | |
1843 | </p> |
|
1843 | </p> | |
1844 | <p> |
|
1844 | <p> | |
1845 | remove the specified files on the next commit |
|
1845 | remove the specified files on the next commit | |
1846 | </p> |
|
1846 | </p> | |
1847 | <p> |
|
1847 | <p> | |
1848 | Schedule the indicated files for removal from the current branch. |
|
1848 | Schedule the indicated files for removal from the current branch. | |
1849 | </p> |
|
1849 | </p> | |
1850 | <p> |
|
1850 | <p> | |
1851 | This command schedules the files to be removed at the next commit. |
|
1851 | This command schedules the files to be removed at the next commit. | |
1852 | To undo a remove before that, see "hg revert". To undo added |
|
1852 | To undo a remove before that, see "hg revert". To undo added | |
1853 | files, see "hg forget". |
|
1853 | files, see "hg forget". | |
1854 | </p> |
|
1854 | </p> | |
1855 | <p> |
|
1855 | <p> | |
1856 | -A/--after can be used to remove only files that have already |
|
1856 | -A/--after can be used to remove only files that have already | |
1857 | been deleted, -f/--force can be used to force deletion, and -Af |
|
1857 | been deleted, -f/--force can be used to force deletion, and -Af | |
1858 | can be used to remove files from the next revision without |
|
1858 | can be used to remove files from the next revision without | |
1859 | deleting them from the working directory. |
|
1859 | deleting them from the working directory. | |
1860 | </p> |
|
1860 | </p> | |
1861 | <p> |
|
1861 | <p> | |
1862 | The following table details the behavior of remove for different |
|
1862 | The following table details the behavior of remove for different | |
1863 | file states (columns) and option combinations (rows). The file |
|
1863 | file states (columns) and option combinations (rows). The file | |
1864 | states are Added [A], Clean [C], Modified [M] and Missing [!] |
|
1864 | states are Added [A], Clean [C], Modified [M] and Missing [!] | |
1865 | (as reported by "hg status"). The actions are Warn, Remove |
|
1865 | (as reported by "hg status"). The actions are Warn, Remove | |
1866 | (from branch) and Delete (from disk): |
|
1866 | (from branch) and Delete (from disk): | |
1867 | </p> |
|
1867 | </p> | |
1868 | <table> |
|
1868 | <table> | |
1869 | <tr><td>opt/state</td> |
|
1869 | <tr><td>opt/state</td> | |
1870 | <td>A</td> |
|
1870 | <td>A</td> | |
1871 | <td>C</td> |
|
1871 | <td>C</td> | |
1872 | <td>M</td> |
|
1872 | <td>M</td> | |
1873 | <td>!</td></tr> |
|
1873 | <td>!</td></tr> | |
1874 | <tr><td>none</td> |
|
1874 | <tr><td>none</td> | |
1875 | <td>W</td> |
|
1875 | <td>W</td> | |
1876 | <td>RD</td> |
|
1876 | <td>RD</td> | |
1877 | <td>W</td> |
|
1877 | <td>W</td> | |
1878 | <td>R</td></tr> |
|
1878 | <td>R</td></tr> | |
1879 | <tr><td>-f</td> |
|
1879 | <tr><td>-f</td> | |
1880 | <td>R</td> |
|
1880 | <td>R</td> | |
1881 | <td>RD</td> |
|
1881 | <td>RD</td> | |
1882 | <td>RD</td> |
|
1882 | <td>RD</td> | |
1883 | <td>R</td></tr> |
|
1883 | <td>R</td></tr> | |
1884 | <tr><td>-A</td> |
|
1884 | <tr><td>-A</td> | |
1885 | <td>W</td> |
|
1885 | <td>W</td> | |
1886 | <td>W</td> |
|
1886 | <td>W</td> | |
1887 | <td>W</td> |
|
1887 | <td>W</td> | |
1888 | <td>R</td></tr> |
|
1888 | <td>R</td></tr> | |
1889 | <tr><td>-Af</td> |
|
1889 | <tr><td>-Af</td> | |
1890 | <td>R</td> |
|
1890 | <td>R</td> | |
1891 | <td>R</td> |
|
1891 | <td>R</td> | |
1892 | <td>R</td> |
|
1892 | <td>R</td> | |
1893 | <td>R</td></tr> |
|
1893 | <td>R</td></tr> | |
1894 | </table> |
|
1894 | </table> | |
1895 | <p> |
|
1895 | <p> | |
1896 | Note that remove never deletes files in Added [A] state from the |
|
1896 | Note that remove never deletes files in Added [A] state from the | |
1897 | working directory, not even if option --force is specified. |
|
1897 | working directory, not even if option --force is specified. | |
1898 | </p> |
|
1898 | </p> | |
1899 | <p> |
|
1899 | <p> | |
1900 | Returns 0 on success, 1 if any warnings encountered. |
|
1900 | Returns 0 on success, 1 if any warnings encountered. | |
1901 | </p> |
|
1901 | </p> | |
1902 | <p> |
|
1902 | <p> | |
1903 | options: |
|
1903 | options: | |
1904 | </p> |
|
1904 | </p> | |
1905 | <table> |
|
1905 | <table> | |
1906 | <tr><td>-A</td> |
|
1906 | <tr><td>-A</td> | |
1907 | <td>--after</td> |
|
1907 | <td>--after</td> | |
1908 | <td>record delete for missing files</td></tr> |
|
1908 | <td>record delete for missing files</td></tr> | |
1909 | <tr><td>-f</td> |
|
1909 | <tr><td>-f</td> | |
1910 | <td>--force</td> |
|
1910 | <td>--force</td> | |
1911 | <td>remove (and delete) file even if added or modified</td></tr> |
|
1911 | <td>remove (and delete) file even if added or modified</td></tr> | |
1912 | <tr><td>-I</td> |
|
1912 | <tr><td>-I</td> | |
1913 | <td>--include PATTERN [+]</td> |
|
1913 | <td>--include PATTERN [+]</td> | |
1914 | <td>include names matching the given patterns</td></tr> |
|
1914 | <td>include names matching the given patterns</td></tr> | |
1915 | <tr><td>-X</td> |
|
1915 | <tr><td>-X</td> | |
1916 | <td>--exclude PATTERN [+]</td> |
|
1916 | <td>--exclude PATTERN [+]</td> | |
1917 | <td>exclude names matching the given patterns</td></tr> |
|
1917 | <td>exclude names matching the given patterns</td></tr> | |
1918 | </table> |
|
1918 | </table> | |
1919 | <p> |
|
1919 | <p> | |
1920 | [+] marked option can be specified multiple times |
|
1920 | [+] marked option can be specified multiple times | |
1921 | </p> |
|
1921 | </p> | |
1922 | <p> |
|
1922 | <p> | |
1923 | global options: |
|
1923 | global options: | |
1924 | </p> |
|
1924 | </p> | |
1925 | <table> |
|
1925 | <table> | |
1926 | <tr><td>-R</td> |
|
1926 | <tr><td>-R</td> | |
1927 | <td>--repository REPO</td> |
|
1927 | <td>--repository REPO</td> | |
1928 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
1928 | <td>repository root directory or name of overlay bundle file</td></tr> | |
1929 | <tr><td></td> |
|
1929 | <tr><td></td> | |
1930 | <td>--cwd DIR</td> |
|
1930 | <td>--cwd DIR</td> | |
1931 | <td>change working directory</td></tr> |
|
1931 | <td>change working directory</td></tr> | |
1932 | <tr><td>-y</td> |
|
1932 | <tr><td>-y</td> | |
1933 | <td>--noninteractive</td> |
|
1933 | <td>--noninteractive</td> | |
1934 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
1934 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> | |
1935 | <tr><td>-q</td> |
|
1935 | <tr><td>-q</td> | |
1936 | <td>--quiet</td> |
|
1936 | <td>--quiet</td> | |
1937 | <td>suppress output</td></tr> |
|
1937 | <td>suppress output</td></tr> | |
1938 | <tr><td>-v</td> |
|
1938 | <tr><td>-v</td> | |
1939 | <td>--verbose</td> |
|
1939 | <td>--verbose</td> | |
1940 | <td>enable additional output</td></tr> |
|
1940 | <td>enable additional output</td></tr> | |
1941 | <tr><td></td> |
|
1941 | <tr><td></td> | |
1942 | <td>--config CONFIG [+]</td> |
|
1942 | <td>--config CONFIG [+]</td> | |
1943 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
1943 | <td>set/override config option (use 'section.name=value')</td></tr> | |
1944 | <tr><td></td> |
|
1944 | <tr><td></td> | |
1945 | <td>--debug</td> |
|
1945 | <td>--debug</td> | |
1946 | <td>enable debugging output</td></tr> |
|
1946 | <td>enable debugging output</td></tr> | |
1947 | <tr><td></td> |
|
1947 | <tr><td></td> | |
1948 | <td>--debugger</td> |
|
1948 | <td>--debugger</td> | |
1949 | <td>start debugger</td></tr> |
|
1949 | <td>start debugger</td></tr> | |
1950 | <tr><td></td> |
|
1950 | <tr><td></td> | |
1951 | <td>--encoding ENCODE</td> |
|
1951 | <td>--encoding ENCODE</td> | |
1952 | <td>set the charset encoding (default: ascii)</td></tr> |
|
1952 | <td>set the charset encoding (default: ascii)</td></tr> | |
1953 | <tr><td></td> |
|
1953 | <tr><td></td> | |
1954 | <td>--encodingmode MODE</td> |
|
1954 | <td>--encodingmode MODE</td> | |
1955 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
1955 | <td>set the charset encoding mode (default: strict)</td></tr> | |
1956 | <tr><td></td> |
|
1956 | <tr><td></td> | |
1957 | <td>--traceback</td> |
|
1957 | <td>--traceback</td> | |
1958 | <td>always print a traceback on exception</td></tr> |
|
1958 | <td>always print a traceback on exception</td></tr> | |
1959 | <tr><td></td> |
|
1959 | <tr><td></td> | |
1960 | <td>--time</td> |
|
1960 | <td>--time</td> | |
1961 | <td>time how long the command takes</td></tr> |
|
1961 | <td>time how long the command takes</td></tr> | |
1962 | <tr><td></td> |
|
1962 | <tr><td></td> | |
1963 | <td>--profile</td> |
|
1963 | <td>--profile</td> | |
1964 | <td>print command execution profile</td></tr> |
|
1964 | <td>print command execution profile</td></tr> | |
1965 | <tr><td></td> |
|
1965 | <tr><td></td> | |
1966 | <td>--version</td> |
|
1966 | <td>--version</td> | |
1967 | <td>output version information and exit</td></tr> |
|
1967 | <td>output version information and exit</td></tr> | |
1968 | <tr><td>-h</td> |
|
1968 | <tr><td>-h</td> | |
1969 | <td>--help</td> |
|
1969 | <td>--help</td> | |
1970 | <td>display help and exit</td></tr> |
|
1970 | <td>display help and exit</td></tr> | |
1971 | <tr><td></td> |
|
1971 | <tr><td></td> | |
1972 | <td>--hidden</td> |
|
1972 | <td>--hidden</td> | |
1973 | <td>consider hidden changesets</td></tr> |
|
1973 | <td>consider hidden changesets</td></tr> | |
1974 | </table> |
|
1974 | </table> | |
1975 | <p> |
|
1975 | <p> | |
1976 | [+] marked option can be specified multiple times |
|
1976 | [+] marked option can be specified multiple times | |
1977 | </p> |
|
1977 | </p> | |
1978 |
|
1978 | |||
1979 | </div> |
|
1979 | </div> | |
1980 | </div> |
|
1980 | </div> | |
1981 | </div> |
|
1981 | </div> | |
1982 |
|
1982 | |||
1983 | <script type="text/javascript">process_dates()</script> |
|
1983 | <script type="text/javascript">process_dates()</script> | |
1984 |
|
1984 | |||
1985 |
|
1985 | |||
1986 | </body> |
|
1986 | </body> | |
1987 | </html> |
|
1987 | </html> | |
1988 |
|
1988 | |||
1989 |
|
1989 | |||
1990 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions" |
|
1990 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions" | |
1991 | 200 Script output follows |
|
1991 | 200 Script output follows | |
1992 |
|
1992 | |||
1993 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1993 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
1994 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1994 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
1995 | <head> |
|
1995 | <head> | |
1996 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1996 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
1997 | <meta name="robots" content="index, nofollow" /> |
|
1997 | <meta name="robots" content="index, nofollow" /> | |
1998 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1998 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
1999 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1999 | <script type="text/javascript" src="/static/mercurial.js"></script> | |
2000 |
|
2000 | |||
2001 | <title>Help: revisions</title> |
|
2001 | <title>Help: revisions</title> | |
2002 | </head> |
|
2002 | </head> | |
2003 | <body> |
|
2003 | <body> | |
2004 |
|
2004 | |||
2005 | <div class="container"> |
|
2005 | <div class="container"> | |
2006 | <div class="menu"> |
|
2006 | <div class="menu"> | |
2007 | <div class="logo"> |
|
2007 | <div class="logo"> | |
2008 | <a href="http://mercurial.selenic.com/"> |
|
2008 | <a href="http://mercurial.selenic.com/"> | |
2009 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2009 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
2010 | </div> |
|
2010 | </div> | |
2011 | <ul> |
|
2011 | <ul> | |
2012 | <li><a href="/shortlog">log</a></li> |
|
2012 | <li><a href="/shortlog">log</a></li> | |
2013 | <li><a href="/graph">graph</a></li> |
|
2013 | <li><a href="/graph">graph</a></li> | |
2014 | <li><a href="/tags">tags</a></li> |
|
2014 | <li><a href="/tags">tags</a></li> | |
2015 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2015 | <li><a href="/bookmarks">bookmarks</a></li> | |
2016 | <li><a href="/branches">branches</a></li> |
|
2016 | <li><a href="/branches">branches</a></li> | |
2017 | </ul> |
|
2017 | </ul> | |
2018 | <ul> |
|
2018 | <ul> | |
2019 | <li class="active"><a href="/help">help</a></li> |
|
2019 | <li class="active"><a href="/help">help</a></li> | |
2020 | </ul> |
|
2020 | </ul> | |
2021 | </div> |
|
2021 | </div> | |
2022 |
|
2022 | |||
2023 | <div class="main"> |
|
2023 | <div class="main"> | |
2024 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2024 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> | |
2025 | <h3>Help: revisions</h3> |
|
2025 | <h3>Help: revisions</h3> | |
2026 |
|
2026 | |||
2027 | <form class="search" action="/log"> |
|
2027 | <form class="search" action="/log"> | |
2028 |
|
2028 | |||
2029 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2029 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
2030 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2030 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision | |
2031 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2031 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> | |
2032 | </form> |
|
2032 | </form> | |
2033 | <div id="doc"> |
|
2033 | <div id="doc"> | |
2034 | <h1>Specifying Single Revisions</h1> |
|
2034 | <h1>Specifying Single Revisions</h1> | |
2035 | <p> |
|
2035 | <p> | |
2036 | Mercurial supports several ways to specify individual revisions. |
|
2036 | Mercurial supports several ways to specify individual revisions. | |
2037 | </p> |
|
2037 | </p> | |
2038 | <p> |
|
2038 | <p> | |
2039 | A plain integer is treated as a revision number. Negative integers are |
|
2039 | A plain integer is treated as a revision number. Negative integers are | |
2040 | treated as sequential offsets from the tip, with -1 denoting the tip, |
|
2040 | treated as sequential offsets from the tip, with -1 denoting the tip, | |
2041 | -2 denoting the revision prior to the tip, and so forth. |
|
2041 | -2 denoting the revision prior to the tip, and so forth. | |
2042 | </p> |
|
2042 | </p> | |
2043 | <p> |
|
2043 | <p> | |
2044 | A 40-digit hexadecimal string is treated as a unique revision |
|
2044 | A 40-digit hexadecimal string is treated as a unique revision | |
2045 | identifier. |
|
2045 | identifier. | |
2046 | </p> |
|
2046 | </p> | |
2047 | <p> |
|
2047 | <p> | |
2048 | A hexadecimal string less than 40 characters long is treated as a |
|
2048 | A hexadecimal string less than 40 characters long is treated as a | |
2049 | unique revision identifier and is referred to as a short-form |
|
2049 | unique revision identifier and is referred to as a short-form | |
2050 | identifier. A short-form identifier is only valid if it is the prefix |
|
2050 | identifier. A short-form identifier is only valid if it is the prefix | |
2051 | of exactly one full-length identifier. |
|
2051 | of exactly one full-length identifier. | |
2052 | </p> |
|
2052 | </p> | |
2053 | <p> |
|
2053 | <p> | |
2054 | Any other string is treated as a bookmark, tag, or branch name. A |
|
2054 | Any other string is treated as a bookmark, tag, or branch name. A | |
2055 | bookmark is a movable pointer to a revision. A tag is a permanent name |
|
2055 | bookmark is a movable pointer to a revision. A tag is a permanent name | |
2056 | associated with a revision. A branch name denotes the tipmost open branch head |
|
2056 | associated with a revision. A branch name denotes the tipmost open branch head | |
2057 | of that branch - or if they are all closed, the tipmost closed head of the |
|
2057 | of that branch - or if they are all closed, the tipmost closed head of the | |
2058 | branch. Bookmark, tag, and branch names must not contain the ":" character. |
|
2058 | branch. Bookmark, tag, and branch names must not contain the ":" character. | |
2059 | </p> |
|
2059 | </p> | |
2060 | <p> |
|
2060 | <p> | |
2061 | The reserved name "tip" always identifies the most recent revision. |
|
2061 | The reserved name "tip" always identifies the most recent revision. | |
2062 | </p> |
|
2062 | </p> | |
2063 | <p> |
|
2063 | <p> | |
2064 | The reserved name "null" indicates the null revision. This is the |
|
2064 | The reserved name "null" indicates the null revision. This is the | |
2065 | revision of an empty repository, and the parent of revision 0. |
|
2065 | revision of an empty repository, and the parent of revision 0. | |
2066 | </p> |
|
2066 | </p> | |
2067 | <p> |
|
2067 | <p> | |
2068 | The reserved name "." indicates the working directory parent. If no |
|
2068 | The reserved name "." indicates the working directory parent. If no | |
2069 | working directory is checked out, it is equivalent to null. If an |
|
2069 | working directory is checked out, it is equivalent to null. If an | |
2070 | uncommitted merge is in progress, "." is the revision of the first |
|
2070 | uncommitted merge is in progress, "." is the revision of the first | |
2071 | parent. |
|
2071 | parent. | |
2072 | </p> |
|
2072 | </p> | |
2073 |
|
2073 | |||
2074 | </div> |
|
2074 | </div> | |
2075 | </div> |
|
2075 | </div> | |
2076 | </div> |
|
2076 | </div> | |
2077 |
|
2077 | |||
2078 | <script type="text/javascript">process_dates()</script> |
|
2078 | <script type="text/javascript">process_dates()</script> | |
2079 |
|
2079 | |||
2080 |
|
2080 | |||
2081 | </body> |
|
2081 | </body> | |
2082 | </html> |
|
2082 | </html> | |
2083 |
|
2083 | |||
2084 |
|
2084 | |||
2085 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
2085 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS | |
2086 |
|
2086 | |||
2087 | #endif |
|
2087 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now