Show More
@@ -1,6122 +1,6197 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, shlex |
|
11 | import os, re, difflib, time, tempfile, errno, shlex | |
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 | import extensions |
|
17 | import extensions | |
18 | from hgweb import server as hgweb_server |
|
18 | from hgweb import server as hgweb_server | |
19 | import merge as mergemod |
|
19 | import merge as mergemod | |
20 | import minirst, revset, fileset |
|
20 | import minirst, revset, fileset | |
21 | import dagparser, context, simplemerge, graphmod |
|
21 | import dagparser, context, simplemerge, graphmod | |
22 | import random |
|
22 | import random | |
23 | import setdiscovery, treediscovery, dagutil, pvec, localrepo |
|
23 | import setdiscovery, treediscovery, dagutil, pvec, localrepo | |
24 | import phases, obsolete, exchange |
|
24 | import phases, obsolete, exchange | |
25 |
|
25 | |||
26 | table = {} |
|
26 | table = {} | |
27 |
|
27 | |||
28 | command = cmdutil.command(table) |
|
28 | command = cmdutil.command(table) | |
29 |
|
29 | |||
30 | # Space delimited list of commands that don't require local repositories. |
|
30 | # Space delimited list of commands that don't require local repositories. | |
31 | # This should be populated by passing norepo=True into the @command decorator. |
|
31 | # This should be populated by passing norepo=True into the @command decorator. | |
32 | norepo = '' |
|
32 | norepo = '' | |
33 | # Space delimited list of commands that optionally require local repositories. |
|
33 | # Space delimited list of commands that optionally require local repositories. | |
34 | # This should be populated by passing optionalrepo=True into the @command |
|
34 | # This should be populated by passing optionalrepo=True into the @command | |
35 | # decorator. |
|
35 | # decorator. | |
36 | optionalrepo = '' |
|
36 | optionalrepo = '' | |
37 | # Space delimited list of commands that will examine arguments looking for |
|
37 | # Space delimited list of commands that will examine arguments looking for | |
38 | # a repository. This should be populated by passing inferrepo=True into the |
|
38 | # a repository. This should be populated by passing inferrepo=True into the | |
39 | # @command decorator. |
|
39 | # @command decorator. | |
40 | inferrepo = '' |
|
40 | inferrepo = '' | |
41 |
|
41 | |||
42 | # common command options |
|
42 | # common command options | |
43 |
|
43 | |||
44 | globalopts = [ |
|
44 | globalopts = [ | |
45 | ('R', 'repository', '', |
|
45 | ('R', 'repository', '', | |
46 | _('repository root directory or name of overlay bundle file'), |
|
46 | _('repository root directory or name of overlay bundle file'), | |
47 | _('REPO')), |
|
47 | _('REPO')), | |
48 | ('', 'cwd', '', |
|
48 | ('', 'cwd', '', | |
49 | _('change working directory'), _('DIR')), |
|
49 | _('change working directory'), _('DIR')), | |
50 | ('y', 'noninteractive', None, |
|
50 | ('y', 'noninteractive', None, | |
51 | _('do not prompt, automatically pick the first choice for all prompts')), |
|
51 | _('do not prompt, automatically pick the first choice for all prompts')), | |
52 | ('q', 'quiet', None, _('suppress output')), |
|
52 | ('q', 'quiet', None, _('suppress output')), | |
53 | ('v', 'verbose', None, _('enable additional output')), |
|
53 | ('v', 'verbose', None, _('enable additional output')), | |
54 | ('', 'config', [], |
|
54 | ('', 'config', [], | |
55 | _('set/override config option (use \'section.name=value\')'), |
|
55 | _('set/override config option (use \'section.name=value\')'), | |
56 | _('CONFIG')), |
|
56 | _('CONFIG')), | |
57 | ('', 'debug', None, _('enable debugging output')), |
|
57 | ('', 'debug', None, _('enable debugging output')), | |
58 | ('', 'debugger', None, _('start debugger')), |
|
58 | ('', 'debugger', None, _('start debugger')), | |
59 | ('', 'encoding', encoding.encoding, _('set the charset encoding'), |
|
59 | ('', 'encoding', encoding.encoding, _('set the charset encoding'), | |
60 | _('ENCODE')), |
|
60 | _('ENCODE')), | |
61 | ('', 'encodingmode', encoding.encodingmode, |
|
61 | ('', 'encodingmode', encoding.encodingmode, | |
62 | _('set the charset encoding mode'), _('MODE')), |
|
62 | _('set the charset encoding mode'), _('MODE')), | |
63 | ('', 'traceback', None, _('always print a traceback on exception')), |
|
63 | ('', 'traceback', None, _('always print a traceback on exception')), | |
64 | ('', 'time', None, _('time how long the command takes')), |
|
64 | ('', 'time', None, _('time how long the command takes')), | |
65 | ('', 'profile', None, _('print command execution profile')), |
|
65 | ('', 'profile', None, _('print command execution profile')), | |
66 | ('', 'version', None, _('output version information and exit')), |
|
66 | ('', 'version', None, _('output version information and exit')), | |
67 | ('h', 'help', None, _('display help and exit')), |
|
67 | ('h', 'help', None, _('display help and exit')), | |
68 | ('', 'hidden', False, _('consider hidden changesets')), |
|
68 | ('', 'hidden', False, _('consider hidden changesets')), | |
69 | ] |
|
69 | ] | |
70 |
|
70 | |||
71 | dryrunopts = [('n', 'dry-run', None, |
|
71 | dryrunopts = [('n', 'dry-run', None, | |
72 | _('do not perform actions, just print output'))] |
|
72 | _('do not perform actions, just print output'))] | |
73 |
|
73 | |||
74 | remoteopts = [ |
|
74 | remoteopts = [ | |
75 | ('e', 'ssh', '', |
|
75 | ('e', 'ssh', '', | |
76 | _('specify ssh command to use'), _('CMD')), |
|
76 | _('specify ssh command to use'), _('CMD')), | |
77 | ('', 'remotecmd', '', |
|
77 | ('', 'remotecmd', '', | |
78 | _('specify hg command to run on the remote side'), _('CMD')), |
|
78 | _('specify hg command to run on the remote side'), _('CMD')), | |
79 | ('', 'insecure', None, |
|
79 | ('', 'insecure', None, | |
80 | _('do not verify server certificate (ignoring web.cacerts config)')), |
|
80 | _('do not verify server certificate (ignoring web.cacerts config)')), | |
81 | ] |
|
81 | ] | |
82 |
|
82 | |||
83 | walkopts = [ |
|
83 | walkopts = [ | |
84 | ('I', 'include', [], |
|
84 | ('I', 'include', [], | |
85 | _('include names matching the given patterns'), _('PATTERN')), |
|
85 | _('include names matching the given patterns'), _('PATTERN')), | |
86 | ('X', 'exclude', [], |
|
86 | ('X', 'exclude', [], | |
87 | _('exclude names matching the given patterns'), _('PATTERN')), |
|
87 | _('exclude names matching the given patterns'), _('PATTERN')), | |
88 | ] |
|
88 | ] | |
89 |
|
89 | |||
90 | commitopts = [ |
|
90 | commitopts = [ | |
91 | ('m', 'message', '', |
|
91 | ('m', 'message', '', | |
92 | _('use text as commit message'), _('TEXT')), |
|
92 | _('use text as commit message'), _('TEXT')), | |
93 | ('l', 'logfile', '', |
|
93 | ('l', 'logfile', '', | |
94 | _('read commit message from file'), _('FILE')), |
|
94 | _('read commit message from file'), _('FILE')), | |
95 | ] |
|
95 | ] | |
96 |
|
96 | |||
97 | commitopts2 = [ |
|
97 | commitopts2 = [ | |
98 | ('d', 'date', '', |
|
98 | ('d', 'date', '', | |
99 | _('record the specified date as commit date'), _('DATE')), |
|
99 | _('record the specified date as commit date'), _('DATE')), | |
100 | ('u', 'user', '', |
|
100 | ('u', 'user', '', | |
101 | _('record the specified user as committer'), _('USER')), |
|
101 | _('record the specified user as committer'), _('USER')), | |
102 | ] |
|
102 | ] | |
103 |
|
103 | |||
104 | templateopts = [ |
|
104 | templateopts = [ | |
105 | ('', 'style', '', |
|
105 | ('', 'style', '', | |
106 | _('display using template map file (DEPRECATED)'), _('STYLE')), |
|
106 | _('display using template map file (DEPRECATED)'), _('STYLE')), | |
107 | ('T', 'template', '', |
|
107 | ('T', 'template', '', | |
108 | _('display with template'), _('TEMPLATE')), |
|
108 | _('display with template'), _('TEMPLATE')), | |
109 | ] |
|
109 | ] | |
110 |
|
110 | |||
111 | logopts = [ |
|
111 | logopts = [ | |
112 | ('p', 'patch', None, _('show patch')), |
|
112 | ('p', 'patch', None, _('show patch')), | |
113 | ('g', 'git', None, _('use git extended diff format')), |
|
113 | ('g', 'git', None, _('use git extended diff format')), | |
114 | ('l', 'limit', '', |
|
114 | ('l', 'limit', '', | |
115 | _('limit number of changes displayed'), _('NUM')), |
|
115 | _('limit number of changes displayed'), _('NUM')), | |
116 | ('M', 'no-merges', None, _('do not show merges')), |
|
116 | ('M', 'no-merges', None, _('do not show merges')), | |
117 | ('', 'stat', None, _('output diffstat-style summary of changes')), |
|
117 | ('', 'stat', None, _('output diffstat-style summary of changes')), | |
118 | ('G', 'graph', None, _("show the revision DAG")), |
|
118 | ('G', 'graph', None, _("show the revision DAG")), | |
119 | ] + templateopts |
|
119 | ] + templateopts | |
120 |
|
120 | |||
121 | diffopts = [ |
|
121 | diffopts = [ | |
122 | ('a', 'text', None, _('treat all files as text')), |
|
122 | ('a', 'text', None, _('treat all files as text')), | |
123 | ('g', 'git', None, _('use git extended diff format')), |
|
123 | ('g', 'git', None, _('use git extended diff format')), | |
124 | ('', 'nodates', None, _('omit dates from diff headers')) |
|
124 | ('', 'nodates', None, _('omit dates from diff headers')) | |
125 | ] |
|
125 | ] | |
126 |
|
126 | |||
127 | diffwsopts = [ |
|
127 | diffwsopts = [ | |
128 | ('w', 'ignore-all-space', None, |
|
128 | ('w', 'ignore-all-space', None, | |
129 | _('ignore white space when comparing lines')), |
|
129 | _('ignore white space when comparing lines')), | |
130 | ('b', 'ignore-space-change', None, |
|
130 | ('b', 'ignore-space-change', None, | |
131 | _('ignore changes in the amount of white space')), |
|
131 | _('ignore changes in the amount of white space')), | |
132 | ('B', 'ignore-blank-lines', None, |
|
132 | ('B', 'ignore-blank-lines', None, | |
133 | _('ignore changes whose lines are all blank')), |
|
133 | _('ignore changes whose lines are all blank')), | |
134 | ] |
|
134 | ] | |
135 |
|
135 | |||
136 | diffopts2 = [ |
|
136 | diffopts2 = [ | |
137 | ('p', 'show-function', None, _('show which function each change is in')), |
|
137 | ('p', 'show-function', None, _('show which function each change is in')), | |
138 | ('', 'reverse', None, _('produce a diff that undoes the changes')), |
|
138 | ('', 'reverse', None, _('produce a diff that undoes the changes')), | |
139 | ] + diffwsopts + [ |
|
139 | ] + diffwsopts + [ | |
140 | ('U', 'unified', '', |
|
140 | ('U', 'unified', '', | |
141 | _('number of lines of context to show'), _('NUM')), |
|
141 | _('number of lines of context to show'), _('NUM')), | |
142 | ('', 'stat', None, _('output diffstat-style summary of changes')), |
|
142 | ('', 'stat', None, _('output diffstat-style summary of changes')), | |
143 | ] |
|
143 | ] | |
144 |
|
144 | |||
145 | mergetoolopts = [ |
|
145 | mergetoolopts = [ | |
146 | ('t', 'tool', '', _('specify merge tool')), |
|
146 | ('t', 'tool', '', _('specify merge tool')), | |
147 | ] |
|
147 | ] | |
148 |
|
148 | |||
149 | similarityopts = [ |
|
149 | similarityopts = [ | |
150 | ('s', 'similarity', '', |
|
150 | ('s', 'similarity', '', | |
151 | _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY')) |
|
151 | _('guess renamed files by similarity (0<=s<=100)'), _('SIMILARITY')) | |
152 | ] |
|
152 | ] | |
153 |
|
153 | |||
154 | subrepoopts = [ |
|
154 | subrepoopts = [ | |
155 | ('S', 'subrepos', None, |
|
155 | ('S', 'subrepos', None, | |
156 | _('recurse into subrepositories')) |
|
156 | _('recurse into subrepositories')) | |
157 | ] |
|
157 | ] | |
158 |
|
158 | |||
159 | # Commands start here, listed alphabetically |
|
159 | # Commands start here, listed alphabetically | |
160 |
|
160 | |||
161 | @command('^add', |
|
161 | @command('^add', | |
162 | walkopts + subrepoopts + dryrunopts, |
|
162 | walkopts + subrepoopts + dryrunopts, | |
163 | _('[OPTION]... [FILE]...'), |
|
163 | _('[OPTION]... [FILE]...'), | |
164 | inferrepo=True) |
|
164 | inferrepo=True) | |
165 | def add(ui, repo, *pats, **opts): |
|
165 | def add(ui, repo, *pats, **opts): | |
166 | """add the specified files on the next commit |
|
166 | """add the specified files on the next commit | |
167 |
|
167 | |||
168 | Schedule files to be version controlled and added to the |
|
168 | Schedule files to be version controlled and added to the | |
169 | repository. |
|
169 | repository. | |
170 |
|
170 | |||
171 | The files will be added to the repository at the next commit. To |
|
171 | The files will be added to the repository at the next commit. To | |
172 | undo an add before that, see :hg:`forget`. |
|
172 | undo an add before that, see :hg:`forget`. | |
173 |
|
173 | |||
174 | If no names are given, add all files to the repository. |
|
174 | If no names are given, add all files to the repository. | |
175 |
|
175 | |||
176 | .. container:: verbose |
|
176 | .. container:: verbose | |
177 |
|
177 | |||
178 | An example showing how new (unknown) files are added |
|
178 | An example showing how new (unknown) files are added | |
179 | automatically by :hg:`add`:: |
|
179 | automatically by :hg:`add`:: | |
180 |
|
180 | |||
181 | $ ls |
|
181 | $ ls | |
182 | foo.c |
|
182 | foo.c | |
183 | $ hg status |
|
183 | $ hg status | |
184 | ? foo.c |
|
184 | ? foo.c | |
185 | $ hg add |
|
185 | $ hg add | |
186 | adding foo.c |
|
186 | adding foo.c | |
187 | $ hg status |
|
187 | $ hg status | |
188 | A foo.c |
|
188 | A foo.c | |
189 |
|
189 | |||
190 | Returns 0 if all files are successfully added. |
|
190 | Returns 0 if all files are successfully added. | |
191 | """ |
|
191 | """ | |
192 |
|
192 | |||
193 | m = scmutil.match(repo[None], pats, opts) |
|
193 | m = scmutil.match(repo[None], pats, opts) | |
194 | rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'), |
|
194 | rejected = cmdutil.add(ui, repo, m, opts.get('dry_run'), | |
195 | opts.get('subrepos'), prefix="", explicitonly=False) |
|
195 | opts.get('subrepos'), prefix="", explicitonly=False) | |
196 | return rejected and 1 or 0 |
|
196 | return rejected and 1 or 0 | |
197 |
|
197 | |||
198 | @command('addremove', |
|
198 | @command('addremove', | |
199 | similarityopts + walkopts + dryrunopts, |
|
199 | similarityopts + walkopts + dryrunopts, | |
200 | _('[OPTION]... [FILE]...'), |
|
200 | _('[OPTION]... [FILE]...'), | |
201 | inferrepo=True) |
|
201 | inferrepo=True) | |
202 | def addremove(ui, repo, *pats, **opts): |
|
202 | def addremove(ui, repo, *pats, **opts): | |
203 | """add all new files, delete all missing files |
|
203 | """add all new files, delete all missing files | |
204 |
|
204 | |||
205 | Add all new files and remove all missing files from the |
|
205 | Add all new files and remove all missing files from the | |
206 | repository. |
|
206 | repository. | |
207 |
|
207 | |||
208 | New files are ignored if they match any of the patterns in |
|
208 | New files are ignored if they match any of the patterns in | |
209 | ``.hgignore``. As with add, these changes take effect at the next |
|
209 | ``.hgignore``. As with add, these changes take effect at the next | |
210 | commit. |
|
210 | commit. | |
211 |
|
211 | |||
212 | Use the -s/--similarity option to detect renamed files. This |
|
212 | Use the -s/--similarity option to detect renamed files. This | |
213 | option takes a percentage between 0 (disabled) and 100 (files must |
|
213 | option takes a percentage between 0 (disabled) and 100 (files must | |
214 | be identical) as its parameter. With a parameter greater than 0, |
|
214 | be identical) as its parameter. With a parameter greater than 0, | |
215 | this compares every removed file with every added file and records |
|
215 | this compares every removed file with every added file and records | |
216 | those similar enough as renames. Detecting renamed files this way |
|
216 | those similar enough as renames. Detecting renamed files this way | |
217 | can be expensive. After using this option, :hg:`status -C` can be |
|
217 | can be expensive. After using this option, :hg:`status -C` can be | |
218 | used to check which files were identified as moved or renamed. If |
|
218 | used to check which files were identified as moved or renamed. If | |
219 | not specified, -s/--similarity defaults to 100 and only renames of |
|
219 | not specified, -s/--similarity defaults to 100 and only renames of | |
220 | identical files are detected. |
|
220 | identical files are detected. | |
221 |
|
221 | |||
222 | Returns 0 if all files are successfully added. |
|
222 | Returns 0 if all files are successfully added. | |
223 | """ |
|
223 | """ | |
224 | try: |
|
224 | try: | |
225 | sim = float(opts.get('similarity') or 100) |
|
225 | sim = float(opts.get('similarity') or 100) | |
226 | except ValueError: |
|
226 | except ValueError: | |
227 | raise util.Abort(_('similarity must be a number')) |
|
227 | raise util.Abort(_('similarity must be a number')) | |
228 | if sim < 0 or sim > 100: |
|
228 | if sim < 0 or sim > 100: | |
229 | raise util.Abort(_('similarity must be between 0 and 100')) |
|
229 | raise util.Abort(_('similarity must be between 0 and 100')) | |
230 | return scmutil.addremove(repo, pats, opts, similarity=sim / 100.0) |
|
230 | return scmutil.addremove(repo, pats, opts, similarity=sim / 100.0) | |
231 |
|
231 | |||
232 | @command('^annotate|blame', |
|
232 | @command('^annotate|blame', | |
233 | [('r', 'rev', '', _('annotate the specified revision'), _('REV')), |
|
233 | [('r', 'rev', '', _('annotate the specified revision'), _('REV')), | |
234 | ('', 'follow', None, |
|
234 | ('', 'follow', None, | |
235 | _('follow copies/renames and list the filename (DEPRECATED)')), |
|
235 | _('follow copies/renames and list the filename (DEPRECATED)')), | |
236 | ('', 'no-follow', None, _("don't follow copies and renames")), |
|
236 | ('', 'no-follow', None, _("don't follow copies and renames")), | |
237 | ('a', 'text', None, _('treat all files as text')), |
|
237 | ('a', 'text', None, _('treat all files as text')), | |
238 | ('u', 'user', None, _('list the author (long with -v)')), |
|
238 | ('u', 'user', None, _('list the author (long with -v)')), | |
239 | ('f', 'file', None, _('list the filename')), |
|
239 | ('f', 'file', None, _('list the filename')), | |
240 | ('d', 'date', None, _('list the date (short with -q)')), |
|
240 | ('d', 'date', None, _('list the date (short with -q)')), | |
241 | ('n', 'number', None, _('list the revision number (default)')), |
|
241 | ('n', 'number', None, _('list the revision number (default)')), | |
242 | ('c', 'changeset', None, _('list the changeset')), |
|
242 | ('c', 'changeset', None, _('list the changeset')), | |
243 | ('l', 'line-number', None, _('show line number at the first appearance')) |
|
243 | ('l', 'line-number', None, _('show line number at the first appearance')) | |
244 | ] + diffwsopts + walkopts, |
|
244 | ] + diffwsopts + walkopts, | |
245 | _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'), |
|
245 | _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'), | |
246 | inferrepo=True) |
|
246 | inferrepo=True) | |
247 | def annotate(ui, repo, *pats, **opts): |
|
247 | def annotate(ui, repo, *pats, **opts): | |
248 | """show changeset information by line for each file |
|
248 | """show changeset information by line for each file | |
249 |
|
249 | |||
250 | List changes in files, showing the revision id responsible for |
|
250 | List changes in files, showing the revision id responsible for | |
251 | each line |
|
251 | each line | |
252 |
|
252 | |||
253 | This command is useful for discovering when a change was made and |
|
253 | This command is useful for discovering when a change was made and | |
254 | by whom. |
|
254 | by whom. | |
255 |
|
255 | |||
256 | Without the -a/--text option, annotate will avoid processing files |
|
256 | Without the -a/--text option, annotate will avoid processing files | |
257 | it detects as binary. With -a, annotate will annotate the file |
|
257 | it detects as binary. With -a, annotate will annotate the file | |
258 | anyway, although the results will probably be neither useful |
|
258 | anyway, although the results will probably be neither useful | |
259 | nor desirable. |
|
259 | nor desirable. | |
260 |
|
260 | |||
261 | Returns 0 on success. |
|
261 | Returns 0 on success. | |
262 | """ |
|
262 | """ | |
263 | if not pats: |
|
263 | if not pats: | |
264 | raise util.Abort(_('at least one filename or pattern is required')) |
|
264 | raise util.Abort(_('at least one filename or pattern is required')) | |
265 |
|
265 | |||
266 | if opts.get('follow'): |
|
266 | if opts.get('follow'): | |
267 | # --follow is deprecated and now just an alias for -f/--file |
|
267 | # --follow is deprecated and now just an alias for -f/--file | |
268 | # to mimic the behavior of Mercurial before version 1.5 |
|
268 | # to mimic the behavior of Mercurial before version 1.5 | |
269 | opts['file'] = True |
|
269 | opts['file'] = True | |
270 |
|
270 | |||
271 | datefunc = ui.quiet and util.shortdate or util.datestr |
|
271 | datefunc = ui.quiet and util.shortdate or util.datestr | |
272 | getdate = util.cachefunc(lambda x: datefunc(x[0].date())) |
|
272 | getdate = util.cachefunc(lambda x: datefunc(x[0].date())) | |
273 | hexfn = ui.debugflag and hex or short |
|
273 | hexfn = ui.debugflag and hex or short | |
274 |
|
274 | |||
275 | opmap = [('user', ' ', lambda x: ui.shortuser(x[0].user())), |
|
275 | opmap = [('user', ' ', lambda x: ui.shortuser(x[0].user())), | |
276 | ('number', ' ', lambda x: str(x[0].rev())), |
|
276 | ('number', ' ', lambda x: str(x[0].rev())), | |
277 | ('changeset', ' ', lambda x: hexfn(x[0].node())), |
|
277 | ('changeset', ' ', lambda x: hexfn(x[0].node())), | |
278 | ('date', ' ', getdate), |
|
278 | ('date', ' ', getdate), | |
279 | ('file', ' ', lambda x: x[0].path()), |
|
279 | ('file', ' ', lambda x: x[0].path()), | |
280 | ('line_number', ':', lambda x: str(x[1])), |
|
280 | ('line_number', ':', lambda x: str(x[1])), | |
281 | ] |
|
281 | ] | |
282 |
|
282 | |||
283 | if (not opts.get('user') and not opts.get('changeset') |
|
283 | if (not opts.get('user') and not opts.get('changeset') | |
284 | and not opts.get('date') and not opts.get('file')): |
|
284 | and not opts.get('date') and not opts.get('file')): | |
285 | opts['number'] = True |
|
285 | opts['number'] = True | |
286 |
|
286 | |||
287 | linenumber = opts.get('line_number') is not None |
|
287 | linenumber = opts.get('line_number') is not None | |
288 | if linenumber and (not opts.get('changeset')) and (not opts.get('number')): |
|
288 | if linenumber and (not opts.get('changeset')) and (not opts.get('number')): | |
289 | raise util.Abort(_('at least one of -n/-c is required for -l')) |
|
289 | raise util.Abort(_('at least one of -n/-c is required for -l')) | |
290 |
|
290 | |||
291 | funcmap = [(func, sep) for op, sep, func in opmap if opts.get(op)] |
|
291 | funcmap = [(func, sep) for op, sep, func in opmap if opts.get(op)] | |
292 | funcmap[0] = (funcmap[0][0], '') # no separator in front of first column |
|
292 | funcmap[0] = (funcmap[0][0], '') # no separator in front of first column | |
293 |
|
293 | |||
294 | def bad(x, y): |
|
294 | def bad(x, y): | |
295 | raise util.Abort("%s: %s" % (x, y)) |
|
295 | raise util.Abort("%s: %s" % (x, y)) | |
296 |
|
296 | |||
297 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
297 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
298 | m = scmutil.match(ctx, pats, opts) |
|
298 | m = scmutil.match(ctx, pats, opts) | |
299 | m.bad = bad |
|
299 | m.bad = bad | |
300 | follow = not opts.get('no_follow') |
|
300 | follow = not opts.get('no_follow') | |
301 | diffopts = patch.diffopts(ui, opts, section='annotate') |
|
301 | diffopts = patch.diffopts(ui, opts, section='annotate') | |
302 | for abs in ctx.walk(m): |
|
302 | for abs in ctx.walk(m): | |
303 | fctx = ctx[abs] |
|
303 | fctx = ctx[abs] | |
304 | if not opts.get('text') and util.binary(fctx.data()): |
|
304 | if not opts.get('text') and util.binary(fctx.data()): | |
305 | ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) |
|
305 | ui.write(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs)) | |
306 | continue |
|
306 | continue | |
307 |
|
307 | |||
308 | lines = fctx.annotate(follow=follow, linenumber=linenumber, |
|
308 | lines = fctx.annotate(follow=follow, linenumber=linenumber, | |
309 | diffopts=diffopts) |
|
309 | diffopts=diffopts) | |
310 | pieces = [] |
|
310 | pieces = [] | |
311 |
|
311 | |||
312 | for f, sep in funcmap: |
|
312 | for f, sep in funcmap: | |
313 | l = [f(n) for n, dummy in lines] |
|
313 | l = [f(n) for n, dummy in lines] | |
314 | if l: |
|
314 | if l: | |
315 | sized = [(x, encoding.colwidth(x)) for x in l] |
|
315 | sized = [(x, encoding.colwidth(x)) for x in l] | |
316 | ml = max([w for x, w in sized]) |
|
316 | ml = max([w for x, w in sized]) | |
317 | pieces.append(["%s%s%s" % (sep, ' ' * (ml - w), x) |
|
317 | pieces.append(["%s%s%s" % (sep, ' ' * (ml - w), x) | |
318 | for x, w in sized]) |
|
318 | for x, w in sized]) | |
319 |
|
319 | |||
320 | if pieces: |
|
320 | if pieces: | |
321 | for p, l in zip(zip(*pieces), lines): |
|
321 | for p, l in zip(zip(*pieces), lines): | |
322 | ui.write("%s: %s" % ("".join(p), l[1])) |
|
322 | ui.write("%s: %s" % ("".join(p), l[1])) | |
323 |
|
323 | |||
324 | if lines and not lines[-1][1].endswith('\n'): |
|
324 | if lines and not lines[-1][1].endswith('\n'): | |
325 | ui.write('\n') |
|
325 | ui.write('\n') | |
326 |
|
326 | |||
327 | @command('archive', |
|
327 | @command('archive', | |
328 | [('', 'no-decode', None, _('do not pass files through decoders')), |
|
328 | [('', 'no-decode', None, _('do not pass files through decoders')), | |
329 | ('p', 'prefix', '', _('directory prefix for files in archive'), |
|
329 | ('p', 'prefix', '', _('directory prefix for files in archive'), | |
330 | _('PREFIX')), |
|
330 | _('PREFIX')), | |
331 | ('r', 'rev', '', _('revision to distribute'), _('REV')), |
|
331 | ('r', 'rev', '', _('revision to distribute'), _('REV')), | |
332 | ('t', 'type', '', _('type of distribution to create'), _('TYPE')), |
|
332 | ('t', 'type', '', _('type of distribution to create'), _('TYPE')), | |
333 | ] + subrepoopts + walkopts, |
|
333 | ] + subrepoopts + walkopts, | |
334 | _('[OPTION]... DEST')) |
|
334 | _('[OPTION]... DEST')) | |
335 | def archive(ui, repo, dest, **opts): |
|
335 | def archive(ui, repo, dest, **opts): | |
336 | '''create an unversioned archive of a repository revision |
|
336 | '''create an unversioned archive of a repository revision | |
337 |
|
337 | |||
338 | By default, the revision used is the parent of the working |
|
338 | By default, the revision used is the parent of the working | |
339 | directory; use -r/--rev to specify a different revision. |
|
339 | directory; use -r/--rev to specify a different revision. | |
340 |
|
340 | |||
341 | The archive type is automatically detected based on file |
|
341 | The archive type is automatically detected based on file | |
342 | extension (or override using -t/--type). |
|
342 | extension (or override using -t/--type). | |
343 |
|
343 | |||
344 | .. container:: verbose |
|
344 | .. container:: verbose | |
345 |
|
345 | |||
346 | Examples: |
|
346 | Examples: | |
347 |
|
347 | |||
348 | - create a zip file containing the 1.0 release:: |
|
348 | - create a zip file containing the 1.0 release:: | |
349 |
|
349 | |||
350 | hg archive -r 1.0 project-1.0.zip |
|
350 | hg archive -r 1.0 project-1.0.zip | |
351 |
|
351 | |||
352 | - create a tarball excluding .hg files:: |
|
352 | - create a tarball excluding .hg files:: | |
353 |
|
353 | |||
354 | hg archive project.tar.gz -X ".hg*" |
|
354 | hg archive project.tar.gz -X ".hg*" | |
355 |
|
355 | |||
356 | Valid types are: |
|
356 | Valid types are: | |
357 |
|
357 | |||
358 | :``files``: a directory full of files (default) |
|
358 | :``files``: a directory full of files (default) | |
359 | :``tar``: tar archive, uncompressed |
|
359 | :``tar``: tar archive, uncompressed | |
360 | :``tbz2``: tar archive, compressed using bzip2 |
|
360 | :``tbz2``: tar archive, compressed using bzip2 | |
361 | :``tgz``: tar archive, compressed using gzip |
|
361 | :``tgz``: tar archive, compressed using gzip | |
362 | :``uzip``: zip archive, uncompressed |
|
362 | :``uzip``: zip archive, uncompressed | |
363 | :``zip``: zip archive, compressed using deflate |
|
363 | :``zip``: zip archive, compressed using deflate | |
364 |
|
364 | |||
365 | The exact name of the destination archive or directory is given |
|
365 | The exact name of the destination archive or directory is given | |
366 | using a format string; see :hg:`help export` for details. |
|
366 | using a format string; see :hg:`help export` for details. | |
367 |
|
367 | |||
368 | Each member added to an archive file has a directory prefix |
|
368 | Each member added to an archive file has a directory prefix | |
369 | prepended. Use -p/--prefix to specify a format string for the |
|
369 | prepended. Use -p/--prefix to specify a format string for the | |
370 | prefix. The default is the basename of the archive, with suffixes |
|
370 | prefix. The default is the basename of the archive, with suffixes | |
371 | removed. |
|
371 | removed. | |
372 |
|
372 | |||
373 | Returns 0 on success. |
|
373 | Returns 0 on success. | |
374 | ''' |
|
374 | ''' | |
375 |
|
375 | |||
376 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
376 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
377 | if not ctx: |
|
377 | if not ctx: | |
378 | raise util.Abort(_('no working directory: please specify a revision')) |
|
378 | raise util.Abort(_('no working directory: please specify a revision')) | |
379 | node = ctx.node() |
|
379 | node = ctx.node() | |
380 | dest = cmdutil.makefilename(repo, dest, node) |
|
380 | dest = cmdutil.makefilename(repo, dest, node) | |
381 | if os.path.realpath(dest) == repo.root: |
|
381 | if os.path.realpath(dest) == repo.root: | |
382 | raise util.Abort(_('repository root cannot be destination')) |
|
382 | raise util.Abort(_('repository root cannot be destination')) | |
383 |
|
383 | |||
384 | kind = opts.get('type') or archival.guesskind(dest) or 'files' |
|
384 | kind = opts.get('type') or archival.guesskind(dest) or 'files' | |
385 | prefix = opts.get('prefix') |
|
385 | prefix = opts.get('prefix') | |
386 |
|
386 | |||
387 | if dest == '-': |
|
387 | if dest == '-': | |
388 | if kind == 'files': |
|
388 | if kind == 'files': | |
389 | raise util.Abort(_('cannot archive plain files to stdout')) |
|
389 | raise util.Abort(_('cannot archive plain files to stdout')) | |
390 | dest = cmdutil.makefileobj(repo, dest) |
|
390 | dest = cmdutil.makefileobj(repo, dest) | |
391 | if not prefix: |
|
391 | if not prefix: | |
392 | prefix = os.path.basename(repo.root) + '-%h' |
|
392 | prefix = os.path.basename(repo.root) + '-%h' | |
393 |
|
393 | |||
394 | prefix = cmdutil.makefilename(repo, prefix, node) |
|
394 | prefix = cmdutil.makefilename(repo, prefix, node) | |
395 | matchfn = scmutil.match(ctx, [], opts) |
|
395 | matchfn = scmutil.match(ctx, [], opts) | |
396 | archival.archive(repo, dest, node, kind, not opts.get('no_decode'), |
|
396 | archival.archive(repo, dest, node, kind, not opts.get('no_decode'), | |
397 | matchfn, prefix, subrepos=opts.get('subrepos')) |
|
397 | matchfn, prefix, subrepos=opts.get('subrepos')) | |
398 |
|
398 | |||
399 | @command('backout', |
|
399 | @command('backout', | |
400 | [('', 'merge', None, _('merge with old dirstate parent after backout')), |
|
400 | [('', 'merge', None, _('merge with old dirstate parent after backout')), | |
401 | ('', 'parent', '', |
|
401 | ('', 'parent', '', | |
402 | _('parent to choose when backing out merge (DEPRECATED)'), _('REV')), |
|
402 | _('parent to choose when backing out merge (DEPRECATED)'), _('REV')), | |
403 | ('r', 'rev', '', _('revision to backout'), _('REV')), |
|
403 | ('r', 'rev', '', _('revision to backout'), _('REV')), | |
404 | ('e', 'edit', False, _('invoke editor on commit messages')), |
|
404 | ('e', 'edit', False, _('invoke editor on commit messages')), | |
405 | ] + mergetoolopts + walkopts + commitopts + commitopts2, |
|
405 | ] + mergetoolopts + walkopts + commitopts + commitopts2, | |
406 | _('[OPTION]... [-r] REV')) |
|
406 | _('[OPTION]... [-r] REV')) | |
407 | def backout(ui, repo, node=None, rev=None, **opts): |
|
407 | def backout(ui, repo, node=None, rev=None, **opts): | |
408 | '''reverse effect of earlier changeset |
|
408 | '''reverse effect of earlier changeset | |
409 |
|
409 | |||
410 | Prepare a new changeset with the effect of REV undone in the |
|
410 | Prepare a new changeset with the effect of REV undone in the | |
411 | current working directory. |
|
411 | current working directory. | |
412 |
|
412 | |||
413 | If REV is the parent of the working directory, then this new changeset |
|
413 | If REV is the parent of the working directory, then this new changeset | |
414 | is committed automatically. Otherwise, hg needs to merge the |
|
414 | is committed automatically. Otherwise, hg needs to merge the | |
415 | changes and the merged result is left uncommitted. |
|
415 | changes and the merged result is left uncommitted. | |
416 |
|
416 | |||
417 | .. note:: |
|
417 | .. note:: | |
418 |
|
418 | |||
419 | backout cannot be used to fix either an unwanted or |
|
419 | backout cannot be used to fix either an unwanted or | |
420 | incorrect merge. |
|
420 | incorrect merge. | |
421 |
|
421 | |||
422 | .. container:: verbose |
|
422 | .. container:: verbose | |
423 |
|
423 | |||
424 | By default, the pending changeset will have one parent, |
|
424 | By default, the pending changeset will have one parent, | |
425 | maintaining a linear history. With --merge, the pending |
|
425 | maintaining a linear history. With --merge, the pending | |
426 | changeset will instead have two parents: the old parent of the |
|
426 | changeset will instead have two parents: the old parent of the | |
427 | working directory and a new child of REV that simply undoes REV. |
|
427 | working directory and a new child of REV that simply undoes REV. | |
428 |
|
428 | |||
429 | Before version 1.7, the behavior without --merge was equivalent |
|
429 | Before version 1.7, the behavior without --merge was equivalent | |
430 | to specifying --merge followed by :hg:`update --clean .` to |
|
430 | to specifying --merge followed by :hg:`update --clean .` to | |
431 | cancel the merge and leave the child of REV as a head to be |
|
431 | cancel the merge and leave the child of REV as a head to be | |
432 | merged separately. |
|
432 | merged separately. | |
433 |
|
433 | |||
434 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
434 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
435 |
|
435 | |||
436 | Returns 0 on success, 1 if nothing to backout or there are unresolved |
|
436 | Returns 0 on success, 1 if nothing to backout or there are unresolved | |
437 | files. |
|
437 | files. | |
438 | ''' |
|
438 | ''' | |
439 | if rev and node: |
|
439 | if rev and node: | |
440 | raise util.Abort(_("please specify just one revision")) |
|
440 | raise util.Abort(_("please specify just one revision")) | |
441 |
|
441 | |||
442 | if not rev: |
|
442 | if not rev: | |
443 | rev = node |
|
443 | rev = node | |
444 |
|
444 | |||
445 | if not rev: |
|
445 | if not rev: | |
446 | raise util.Abort(_("please specify a revision to backout")) |
|
446 | raise util.Abort(_("please specify a revision to backout")) | |
447 |
|
447 | |||
448 | date = opts.get('date') |
|
448 | date = opts.get('date') | |
449 | if date: |
|
449 | if date: | |
450 | opts['date'] = util.parsedate(date) |
|
450 | opts['date'] = util.parsedate(date) | |
451 |
|
451 | |||
452 | cmdutil.checkunfinished(repo) |
|
452 | cmdutil.checkunfinished(repo) | |
453 | cmdutil.bailifchanged(repo) |
|
453 | cmdutil.bailifchanged(repo) | |
454 | node = scmutil.revsingle(repo, rev).node() |
|
454 | node = scmutil.revsingle(repo, rev).node() | |
455 |
|
455 | |||
456 | op1, op2 = repo.dirstate.parents() |
|
456 | op1, op2 = repo.dirstate.parents() | |
457 | if not repo.changelog.isancestor(node, op1): |
|
457 | if not repo.changelog.isancestor(node, op1): | |
458 | raise util.Abort(_('cannot backout change that is not an ancestor')) |
|
458 | raise util.Abort(_('cannot backout change that is not an ancestor')) | |
459 |
|
459 | |||
460 | p1, p2 = repo.changelog.parents(node) |
|
460 | p1, p2 = repo.changelog.parents(node) | |
461 | if p1 == nullid: |
|
461 | if p1 == nullid: | |
462 | raise util.Abort(_('cannot backout a change with no parents')) |
|
462 | raise util.Abort(_('cannot backout a change with no parents')) | |
463 | if p2 != nullid: |
|
463 | if p2 != nullid: | |
464 | if not opts.get('parent'): |
|
464 | if not opts.get('parent'): | |
465 | raise util.Abort(_('cannot backout a merge changeset')) |
|
465 | raise util.Abort(_('cannot backout a merge changeset')) | |
466 | p = repo.lookup(opts['parent']) |
|
466 | p = repo.lookup(opts['parent']) | |
467 | if p not in (p1, p2): |
|
467 | if p not in (p1, p2): | |
468 | raise util.Abort(_('%s is not a parent of %s') % |
|
468 | raise util.Abort(_('%s is not a parent of %s') % | |
469 | (short(p), short(node))) |
|
469 | (short(p), short(node))) | |
470 | parent = p |
|
470 | parent = p | |
471 | else: |
|
471 | else: | |
472 | if opts.get('parent'): |
|
472 | if opts.get('parent'): | |
473 | raise util.Abort(_('cannot use --parent on non-merge changeset')) |
|
473 | raise util.Abort(_('cannot use --parent on non-merge changeset')) | |
474 | parent = p1 |
|
474 | parent = p1 | |
475 |
|
475 | |||
476 | # the backout should appear on the same branch |
|
476 | # the backout should appear on the same branch | |
477 | wlock = repo.wlock() |
|
477 | wlock = repo.wlock() | |
478 | try: |
|
478 | try: | |
479 | branch = repo.dirstate.branch() |
|
479 | branch = repo.dirstate.branch() | |
480 | bheads = repo.branchheads(branch) |
|
480 | bheads = repo.branchheads(branch) | |
481 | rctx = scmutil.revsingle(repo, hex(parent)) |
|
481 | rctx = scmutil.revsingle(repo, hex(parent)) | |
482 | if not opts.get('merge') and op1 != node: |
|
482 | if not opts.get('merge') and op1 != node: | |
483 | try: |
|
483 | try: | |
484 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
484 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
485 | 'backout') |
|
485 | 'backout') | |
486 | repo.dirstate.beginparentchange() |
|
486 | repo.dirstate.beginparentchange() | |
487 | stats = mergemod.update(repo, parent, True, True, False, |
|
487 | stats = mergemod.update(repo, parent, True, True, False, | |
488 | node, False) |
|
488 | node, False) | |
489 | repo.setparents(op1, op2) |
|
489 | repo.setparents(op1, op2) | |
490 | repo.dirstate.endparentchange() |
|
490 | repo.dirstate.endparentchange() | |
491 | hg._showstats(repo, stats) |
|
491 | hg._showstats(repo, stats) | |
492 | if stats[3]: |
|
492 | if stats[3]: | |
493 | repo.ui.status(_("use 'hg resolve' to retry unresolved " |
|
493 | repo.ui.status(_("use 'hg resolve' to retry unresolved " | |
494 | "file merges\n")) |
|
494 | "file merges\n")) | |
495 | else: |
|
495 | else: | |
496 | msg = _("changeset %s backed out, " |
|
496 | msg = _("changeset %s backed out, " | |
497 | "don't forget to commit.\n") |
|
497 | "don't forget to commit.\n") | |
498 | ui.status(msg % short(node)) |
|
498 | ui.status(msg % short(node)) | |
499 | return stats[3] > 0 |
|
499 | return stats[3] > 0 | |
500 | finally: |
|
500 | finally: | |
501 | ui.setconfig('ui', 'forcemerge', '', '') |
|
501 | ui.setconfig('ui', 'forcemerge', '', '') | |
502 | else: |
|
502 | else: | |
503 | hg.clean(repo, node, show_stats=False) |
|
503 | hg.clean(repo, node, show_stats=False) | |
504 | repo.dirstate.setbranch(branch) |
|
504 | repo.dirstate.setbranch(branch) | |
505 | cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) |
|
505 | cmdutil.revert(ui, repo, rctx, repo.dirstate.parents()) | |
506 |
|
506 | |||
507 |
|
507 | |||
508 | def commitfunc(ui, repo, message, match, opts): |
|
508 | def commitfunc(ui, repo, message, match, opts): | |
509 | editform = 'backout' |
|
509 | editform = 'backout' | |
510 | e = cmdutil.getcommiteditor(editform=editform, **opts) |
|
510 | e = cmdutil.getcommiteditor(editform=editform, **opts) | |
511 | if not message: |
|
511 | if not message: | |
512 | # we don't translate commit messages |
|
512 | # we don't translate commit messages | |
513 | message = "Backed out changeset %s" % short(node) |
|
513 | message = "Backed out changeset %s" % short(node) | |
514 | e = cmdutil.getcommiteditor(edit=True, editform=editform) |
|
514 | e = cmdutil.getcommiteditor(edit=True, editform=editform) | |
515 | return repo.commit(message, opts.get('user'), opts.get('date'), |
|
515 | return repo.commit(message, opts.get('user'), opts.get('date'), | |
516 | match, editor=e) |
|
516 | match, editor=e) | |
517 | newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) |
|
517 | newnode = cmdutil.commit(ui, repo, commitfunc, [], opts) | |
518 | if not newnode: |
|
518 | if not newnode: | |
519 | ui.status(_("nothing changed\n")) |
|
519 | ui.status(_("nothing changed\n")) | |
520 | return 1 |
|
520 | return 1 | |
521 | cmdutil.commitstatus(repo, newnode, branch, bheads) |
|
521 | cmdutil.commitstatus(repo, newnode, branch, bheads) | |
522 |
|
522 | |||
523 | def nice(node): |
|
523 | def nice(node): | |
524 | return '%d:%s' % (repo.changelog.rev(node), short(node)) |
|
524 | return '%d:%s' % (repo.changelog.rev(node), short(node)) | |
525 | ui.status(_('changeset %s backs out changeset %s\n') % |
|
525 | ui.status(_('changeset %s backs out changeset %s\n') % | |
526 | (nice(repo.changelog.tip()), nice(node))) |
|
526 | (nice(repo.changelog.tip()), nice(node))) | |
527 | if opts.get('merge') and op1 != node: |
|
527 | if opts.get('merge') and op1 != node: | |
528 | hg.clean(repo, op1, show_stats=False) |
|
528 | hg.clean(repo, op1, show_stats=False) | |
529 | ui.status(_('merging with changeset %s\n') |
|
529 | ui.status(_('merging with changeset %s\n') | |
530 | % nice(repo.changelog.tip())) |
|
530 | % nice(repo.changelog.tip())) | |
531 | try: |
|
531 | try: | |
532 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
532 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
533 | 'backout') |
|
533 | 'backout') | |
534 | return hg.merge(repo, hex(repo.changelog.tip())) |
|
534 | return hg.merge(repo, hex(repo.changelog.tip())) | |
535 | finally: |
|
535 | finally: | |
536 | ui.setconfig('ui', 'forcemerge', '', '') |
|
536 | ui.setconfig('ui', 'forcemerge', '', '') | |
537 | finally: |
|
537 | finally: | |
538 | wlock.release() |
|
538 | wlock.release() | |
539 | return 0 |
|
539 | return 0 | |
540 |
|
540 | |||
541 | @command('bisect', |
|
541 | @command('bisect', | |
542 | [('r', 'reset', False, _('reset bisect state')), |
|
542 | [('r', 'reset', False, _('reset bisect state')), | |
543 | ('g', 'good', False, _('mark changeset good')), |
|
543 | ('g', 'good', False, _('mark changeset good')), | |
544 | ('b', 'bad', False, _('mark changeset bad')), |
|
544 | ('b', 'bad', False, _('mark changeset bad')), | |
545 | ('s', 'skip', False, _('skip testing changeset')), |
|
545 | ('s', 'skip', False, _('skip testing changeset')), | |
546 | ('e', 'extend', False, _('extend the bisect range')), |
|
546 | ('e', 'extend', False, _('extend the bisect range')), | |
547 | ('c', 'command', '', _('use command to check changeset state'), _('CMD')), |
|
547 | ('c', 'command', '', _('use command to check changeset state'), _('CMD')), | |
548 | ('U', 'noupdate', False, _('do not update to target'))], |
|
548 | ('U', 'noupdate', False, _('do not update to target'))], | |
549 | _("[-gbsr] [-U] [-c CMD] [REV]")) |
|
549 | _("[-gbsr] [-U] [-c CMD] [REV]")) | |
550 | def bisect(ui, repo, rev=None, extra=None, command=None, |
|
550 | def bisect(ui, repo, rev=None, extra=None, command=None, | |
551 | reset=None, good=None, bad=None, skip=None, extend=None, |
|
551 | reset=None, good=None, bad=None, skip=None, extend=None, | |
552 | noupdate=None): |
|
552 | noupdate=None): | |
553 | """subdivision search of changesets |
|
553 | """subdivision search of changesets | |
554 |
|
554 | |||
555 | This command helps to find changesets which introduce problems. To |
|
555 | This command helps to find changesets which introduce problems. To | |
556 | use, mark the earliest changeset you know exhibits the problem as |
|
556 | use, mark the earliest changeset you know exhibits the problem as | |
557 | bad, then mark the latest changeset which is free from the problem |
|
557 | bad, then mark the latest changeset which is free from the problem | |
558 | as good. Bisect will update your working directory to a revision |
|
558 | as good. Bisect will update your working directory to a revision | |
559 | for testing (unless the -U/--noupdate option is specified). Once |
|
559 | for testing (unless the -U/--noupdate option is specified). Once | |
560 | you have performed tests, mark the working directory as good or |
|
560 | you have performed tests, mark the working directory as good or | |
561 | bad, and bisect will either update to another candidate changeset |
|
561 | bad, and bisect will either update to another candidate changeset | |
562 | or announce that it has found the bad revision. |
|
562 | or announce that it has found the bad revision. | |
563 |
|
563 | |||
564 | As a shortcut, you can also use the revision argument to mark a |
|
564 | As a shortcut, you can also use the revision argument to mark a | |
565 | revision as good or bad without checking it out first. |
|
565 | revision as good or bad without checking it out first. | |
566 |
|
566 | |||
567 | If you supply a command, it will be used for automatic bisection. |
|
567 | If you supply a command, it will be used for automatic bisection. | |
568 | The environment variable HG_NODE will contain the ID of the |
|
568 | The environment variable HG_NODE will contain the ID of the | |
569 | changeset being tested. The exit status of the command will be |
|
569 | changeset being tested. The exit status of the command will be | |
570 | used to mark revisions as good or bad: status 0 means good, 125 |
|
570 | used to mark revisions as good or bad: status 0 means good, 125 | |
571 | means to skip the revision, 127 (command not found) will abort the |
|
571 | means to skip the revision, 127 (command not found) will abort the | |
572 | bisection, and any other non-zero exit status means the revision |
|
572 | bisection, and any other non-zero exit status means the revision | |
573 | is bad. |
|
573 | is bad. | |
574 |
|
574 | |||
575 | .. container:: verbose |
|
575 | .. container:: verbose | |
576 |
|
576 | |||
577 | Some examples: |
|
577 | Some examples: | |
578 |
|
578 | |||
579 | - start a bisection with known bad revision 34, and good revision 12:: |
|
579 | - start a bisection with known bad revision 34, and good revision 12:: | |
580 |
|
580 | |||
581 | hg bisect --bad 34 |
|
581 | hg bisect --bad 34 | |
582 | hg bisect --good 12 |
|
582 | hg bisect --good 12 | |
583 |
|
583 | |||
584 | - advance the current bisection by marking current revision as good or |
|
584 | - advance the current bisection by marking current revision as good or | |
585 | bad:: |
|
585 | bad:: | |
586 |
|
586 | |||
587 | hg bisect --good |
|
587 | hg bisect --good | |
588 | hg bisect --bad |
|
588 | hg bisect --bad | |
589 |
|
589 | |||
590 | - mark the current revision, or a known revision, to be skipped (e.g. if |
|
590 | - mark the current revision, or a known revision, to be skipped (e.g. if | |
591 | that revision is not usable because of another issue):: |
|
591 | that revision is not usable because of another issue):: | |
592 |
|
592 | |||
593 | hg bisect --skip |
|
593 | hg bisect --skip | |
594 | hg bisect --skip 23 |
|
594 | hg bisect --skip 23 | |
595 |
|
595 | |||
596 | - skip all revisions that do not touch directories ``foo`` or ``bar``:: |
|
596 | - skip all revisions that do not touch directories ``foo`` or ``bar``:: | |
597 |
|
597 | |||
598 | hg bisect --skip "!( file('path:foo') & file('path:bar') )" |
|
598 | hg bisect --skip "!( file('path:foo') & file('path:bar') )" | |
599 |
|
599 | |||
600 | - forget the current bisection:: |
|
600 | - forget the current bisection:: | |
601 |
|
601 | |||
602 | hg bisect --reset |
|
602 | hg bisect --reset | |
603 |
|
603 | |||
604 | - use 'make && make tests' to automatically find the first broken |
|
604 | - use 'make && make tests' to automatically find the first broken | |
605 | revision:: |
|
605 | revision:: | |
606 |
|
606 | |||
607 | hg bisect --reset |
|
607 | hg bisect --reset | |
608 | hg bisect --bad 34 |
|
608 | hg bisect --bad 34 | |
609 | hg bisect --good 12 |
|
609 | hg bisect --good 12 | |
610 | hg bisect --command "make && make tests" |
|
610 | hg bisect --command "make && make tests" | |
611 |
|
611 | |||
612 | - see all changesets whose states are already known in the current |
|
612 | - see all changesets whose states are already known in the current | |
613 | bisection:: |
|
613 | bisection:: | |
614 |
|
614 | |||
615 | hg log -r "bisect(pruned)" |
|
615 | hg log -r "bisect(pruned)" | |
616 |
|
616 | |||
617 | - see the changeset currently being bisected (especially useful |
|
617 | - see the changeset currently being bisected (especially useful | |
618 | if running with -U/--noupdate):: |
|
618 | if running with -U/--noupdate):: | |
619 |
|
619 | |||
620 | hg log -r "bisect(current)" |
|
620 | hg log -r "bisect(current)" | |
621 |
|
621 | |||
622 | - see all changesets that took part in the current bisection:: |
|
622 | - see all changesets that took part in the current bisection:: | |
623 |
|
623 | |||
624 | hg log -r "bisect(range)" |
|
624 | hg log -r "bisect(range)" | |
625 |
|
625 | |||
626 | - you can even get a nice graph:: |
|
626 | - you can even get a nice graph:: | |
627 |
|
627 | |||
628 | hg log --graph -r "bisect(range)" |
|
628 | hg log --graph -r "bisect(range)" | |
629 |
|
629 | |||
630 | See :hg:`help revsets` for more about the `bisect()` keyword. |
|
630 | See :hg:`help revsets` for more about the `bisect()` keyword. | |
631 |
|
631 | |||
632 | Returns 0 on success. |
|
632 | Returns 0 on success. | |
633 | """ |
|
633 | """ | |
634 | def extendbisectrange(nodes, good): |
|
634 | def extendbisectrange(nodes, good): | |
635 | # bisect is incomplete when it ends on a merge node and |
|
635 | # bisect is incomplete when it ends on a merge node and | |
636 | # one of the parent was not checked. |
|
636 | # one of the parent was not checked. | |
637 | parents = repo[nodes[0]].parents() |
|
637 | parents = repo[nodes[0]].parents() | |
638 | if len(parents) > 1: |
|
638 | if len(parents) > 1: | |
639 | side = good and state['bad'] or state['good'] |
|
639 | side = good and state['bad'] or state['good'] | |
640 | num = len(set(i.node() for i in parents) & set(side)) |
|
640 | num = len(set(i.node() for i in parents) & set(side)) | |
641 | if num == 1: |
|
641 | if num == 1: | |
642 | return parents[0].ancestor(parents[1]) |
|
642 | return parents[0].ancestor(parents[1]) | |
643 | return None |
|
643 | return None | |
644 |
|
644 | |||
645 | def print_result(nodes, good): |
|
645 | def print_result(nodes, good): | |
646 | displayer = cmdutil.show_changeset(ui, repo, {}) |
|
646 | displayer = cmdutil.show_changeset(ui, repo, {}) | |
647 | if len(nodes) == 1: |
|
647 | if len(nodes) == 1: | |
648 | # narrowed it down to a single revision |
|
648 | # narrowed it down to a single revision | |
649 | if good: |
|
649 | if good: | |
650 | ui.write(_("The first good revision is:\n")) |
|
650 | ui.write(_("The first good revision is:\n")) | |
651 | else: |
|
651 | else: | |
652 | ui.write(_("The first bad revision is:\n")) |
|
652 | ui.write(_("The first bad revision is:\n")) | |
653 | displayer.show(repo[nodes[0]]) |
|
653 | displayer.show(repo[nodes[0]]) | |
654 | extendnode = extendbisectrange(nodes, good) |
|
654 | extendnode = extendbisectrange(nodes, good) | |
655 | if extendnode is not None: |
|
655 | if extendnode is not None: | |
656 | ui.write(_('Not all ancestors of this changeset have been' |
|
656 | ui.write(_('Not all ancestors of this changeset have been' | |
657 | ' checked.\nUse bisect --extend to continue the ' |
|
657 | ' checked.\nUse bisect --extend to continue the ' | |
658 | 'bisection from\nthe common ancestor, %s.\n') |
|
658 | 'bisection from\nthe common ancestor, %s.\n') | |
659 | % extendnode) |
|
659 | % extendnode) | |
660 | else: |
|
660 | else: | |
661 | # multiple possible revisions |
|
661 | # multiple possible revisions | |
662 | if good: |
|
662 | if good: | |
663 | ui.write(_("Due to skipped revisions, the first " |
|
663 | ui.write(_("Due to skipped revisions, the first " | |
664 | "good revision could be any of:\n")) |
|
664 | "good revision could be any of:\n")) | |
665 | else: |
|
665 | else: | |
666 | ui.write(_("Due to skipped revisions, the first " |
|
666 | ui.write(_("Due to skipped revisions, the first " | |
667 | "bad revision could be any of:\n")) |
|
667 | "bad revision could be any of:\n")) | |
668 | for n in nodes: |
|
668 | for n in nodes: | |
669 | displayer.show(repo[n]) |
|
669 | displayer.show(repo[n]) | |
670 | displayer.close() |
|
670 | displayer.close() | |
671 |
|
671 | |||
672 | def check_state(state, interactive=True): |
|
672 | def check_state(state, interactive=True): | |
673 | if not state['good'] or not state['bad']: |
|
673 | if not state['good'] or not state['bad']: | |
674 | if (good or bad or skip or reset) and interactive: |
|
674 | if (good or bad or skip or reset) and interactive: | |
675 | return |
|
675 | return | |
676 | if not state['good']: |
|
676 | if not state['good']: | |
677 | raise util.Abort(_('cannot bisect (no known good revisions)')) |
|
677 | raise util.Abort(_('cannot bisect (no known good revisions)')) | |
678 | else: |
|
678 | else: | |
679 | raise util.Abort(_('cannot bisect (no known bad revisions)')) |
|
679 | raise util.Abort(_('cannot bisect (no known bad revisions)')) | |
680 | return True |
|
680 | return True | |
681 |
|
681 | |||
682 | # backward compatibility |
|
682 | # backward compatibility | |
683 | if rev in "good bad reset init".split(): |
|
683 | if rev in "good bad reset init".split(): | |
684 | ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) |
|
684 | ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) | |
685 | cmd, rev, extra = rev, extra, None |
|
685 | cmd, rev, extra = rev, extra, None | |
686 | if cmd == "good": |
|
686 | if cmd == "good": | |
687 | good = True |
|
687 | good = True | |
688 | elif cmd == "bad": |
|
688 | elif cmd == "bad": | |
689 | bad = True |
|
689 | bad = True | |
690 | else: |
|
690 | else: | |
691 | reset = True |
|
691 | reset = True | |
692 | elif extra or good + bad + skip + reset + extend + bool(command) > 1: |
|
692 | elif extra or good + bad + skip + reset + extend + bool(command) > 1: | |
693 | raise util.Abort(_('incompatible arguments')) |
|
693 | raise util.Abort(_('incompatible arguments')) | |
694 |
|
694 | |||
695 | cmdutil.checkunfinished(repo) |
|
695 | cmdutil.checkunfinished(repo) | |
696 |
|
696 | |||
697 | if reset: |
|
697 | if reset: | |
698 | p = repo.join("bisect.state") |
|
698 | p = repo.join("bisect.state") | |
699 | if os.path.exists(p): |
|
699 | if os.path.exists(p): | |
700 | os.unlink(p) |
|
700 | os.unlink(p) | |
701 | return |
|
701 | return | |
702 |
|
702 | |||
703 | state = hbisect.load_state(repo) |
|
703 | state = hbisect.load_state(repo) | |
704 |
|
704 | |||
705 | if command: |
|
705 | if command: | |
706 | changesets = 1 |
|
706 | changesets = 1 | |
707 | if noupdate: |
|
707 | if noupdate: | |
708 | try: |
|
708 | try: | |
709 | node = state['current'][0] |
|
709 | node = state['current'][0] | |
710 | except LookupError: |
|
710 | except LookupError: | |
711 | raise util.Abort(_('current bisect revision is unknown - ' |
|
711 | raise util.Abort(_('current bisect revision is unknown - ' | |
712 | 'start a new bisect to fix')) |
|
712 | 'start a new bisect to fix')) | |
713 | else: |
|
713 | else: | |
714 | node, p2 = repo.dirstate.parents() |
|
714 | node, p2 = repo.dirstate.parents() | |
715 | if p2 != nullid: |
|
715 | if p2 != nullid: | |
716 | raise util.Abort(_('current bisect revision is a merge')) |
|
716 | raise util.Abort(_('current bisect revision is a merge')) | |
717 | try: |
|
717 | try: | |
718 | while changesets: |
|
718 | while changesets: | |
719 | # update state |
|
719 | # update state | |
720 | state['current'] = [node] |
|
720 | state['current'] = [node] | |
721 | hbisect.save_state(repo, state) |
|
721 | hbisect.save_state(repo, state) | |
722 | status = util.system(command, |
|
722 | status = util.system(command, | |
723 | environ={'HG_NODE': hex(node)}, |
|
723 | environ={'HG_NODE': hex(node)}, | |
724 | out=ui.fout) |
|
724 | out=ui.fout) | |
725 | if status == 125: |
|
725 | if status == 125: | |
726 | transition = "skip" |
|
726 | transition = "skip" | |
727 | elif status == 0: |
|
727 | elif status == 0: | |
728 | transition = "good" |
|
728 | transition = "good" | |
729 | # status < 0 means process was killed |
|
729 | # status < 0 means process was killed | |
730 | elif status == 127: |
|
730 | elif status == 127: | |
731 | raise util.Abort(_("failed to execute %s") % command) |
|
731 | raise util.Abort(_("failed to execute %s") % command) | |
732 | elif status < 0: |
|
732 | elif status < 0: | |
733 | raise util.Abort(_("%s killed") % command) |
|
733 | raise util.Abort(_("%s killed") % command) | |
734 | else: |
|
734 | else: | |
735 | transition = "bad" |
|
735 | transition = "bad" | |
736 | ctx = scmutil.revsingle(repo, rev, node) |
|
736 | ctx = scmutil.revsingle(repo, rev, node) | |
737 | rev = None # clear for future iterations |
|
737 | rev = None # clear for future iterations | |
738 | state[transition].append(ctx.node()) |
|
738 | state[transition].append(ctx.node()) | |
739 | ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) |
|
739 | ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) | |
740 | check_state(state, interactive=False) |
|
740 | check_state(state, interactive=False) | |
741 | # bisect |
|
741 | # bisect | |
742 | nodes, changesets, bgood = hbisect.bisect(repo.changelog, state) |
|
742 | nodes, changesets, bgood = hbisect.bisect(repo.changelog, state) | |
743 | # update to next check |
|
743 | # update to next check | |
744 | node = nodes[0] |
|
744 | node = nodes[0] | |
745 | if not noupdate: |
|
745 | if not noupdate: | |
746 | cmdutil.bailifchanged(repo) |
|
746 | cmdutil.bailifchanged(repo) | |
747 | hg.clean(repo, node, show_stats=False) |
|
747 | hg.clean(repo, node, show_stats=False) | |
748 | finally: |
|
748 | finally: | |
749 | state['current'] = [node] |
|
749 | state['current'] = [node] | |
750 | hbisect.save_state(repo, state) |
|
750 | hbisect.save_state(repo, state) | |
751 | print_result(nodes, bgood) |
|
751 | print_result(nodes, bgood) | |
752 | return |
|
752 | return | |
753 |
|
753 | |||
754 | # update state |
|
754 | # update state | |
755 |
|
755 | |||
756 | if rev: |
|
756 | if rev: | |
757 | nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])] |
|
757 | nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])] | |
758 | else: |
|
758 | else: | |
759 | nodes = [repo.lookup('.')] |
|
759 | nodes = [repo.lookup('.')] | |
760 |
|
760 | |||
761 | if good or bad or skip: |
|
761 | if good or bad or skip: | |
762 | if good: |
|
762 | if good: | |
763 | state['good'] += nodes |
|
763 | state['good'] += nodes | |
764 | elif bad: |
|
764 | elif bad: | |
765 | state['bad'] += nodes |
|
765 | state['bad'] += nodes | |
766 | elif skip: |
|
766 | elif skip: | |
767 | state['skip'] += nodes |
|
767 | state['skip'] += nodes | |
768 | hbisect.save_state(repo, state) |
|
768 | hbisect.save_state(repo, state) | |
769 |
|
769 | |||
770 | if not check_state(state): |
|
770 | if not check_state(state): | |
771 | return |
|
771 | return | |
772 |
|
772 | |||
773 | # actually bisect |
|
773 | # actually bisect | |
774 | nodes, changesets, good = hbisect.bisect(repo.changelog, state) |
|
774 | nodes, changesets, good = hbisect.bisect(repo.changelog, state) | |
775 | if extend: |
|
775 | if extend: | |
776 | if not changesets: |
|
776 | if not changesets: | |
777 | extendnode = extendbisectrange(nodes, good) |
|
777 | extendnode = extendbisectrange(nodes, good) | |
778 | if extendnode is not None: |
|
778 | if extendnode is not None: | |
779 | ui.write(_("Extending search to changeset %d:%s\n") |
|
779 | ui.write(_("Extending search to changeset %d:%s\n") | |
780 | % (extendnode.rev(), extendnode)) |
|
780 | % (extendnode.rev(), extendnode)) | |
781 | state['current'] = [extendnode.node()] |
|
781 | state['current'] = [extendnode.node()] | |
782 | hbisect.save_state(repo, state) |
|
782 | hbisect.save_state(repo, state) | |
783 | if noupdate: |
|
783 | if noupdate: | |
784 | return |
|
784 | return | |
785 | cmdutil.bailifchanged(repo) |
|
785 | cmdutil.bailifchanged(repo) | |
786 | return hg.clean(repo, extendnode.node()) |
|
786 | return hg.clean(repo, extendnode.node()) | |
787 | raise util.Abort(_("nothing to extend")) |
|
787 | raise util.Abort(_("nothing to extend")) | |
788 |
|
788 | |||
789 | if changesets == 0: |
|
789 | if changesets == 0: | |
790 | print_result(nodes, good) |
|
790 | print_result(nodes, good) | |
791 | else: |
|
791 | else: | |
792 | assert len(nodes) == 1 # only a single node can be tested next |
|
792 | assert len(nodes) == 1 # only a single node can be tested next | |
793 | node = nodes[0] |
|
793 | node = nodes[0] | |
794 | # compute the approximate number of remaining tests |
|
794 | # compute the approximate number of remaining tests | |
795 | tests, size = 0, 2 |
|
795 | tests, size = 0, 2 | |
796 | while size <= changesets: |
|
796 | while size <= changesets: | |
797 | tests, size = tests + 1, size * 2 |
|
797 | tests, size = tests + 1, size * 2 | |
798 | rev = repo.changelog.rev(node) |
|
798 | rev = repo.changelog.rev(node) | |
799 | ui.write(_("Testing changeset %d:%s " |
|
799 | ui.write(_("Testing changeset %d:%s " | |
800 | "(%d changesets remaining, ~%d tests)\n") |
|
800 | "(%d changesets remaining, ~%d tests)\n") | |
801 | % (rev, short(node), changesets, tests)) |
|
801 | % (rev, short(node), changesets, tests)) | |
802 | state['current'] = [node] |
|
802 | state['current'] = [node] | |
803 | hbisect.save_state(repo, state) |
|
803 | hbisect.save_state(repo, state) | |
804 | if not noupdate: |
|
804 | if not noupdate: | |
805 | cmdutil.bailifchanged(repo) |
|
805 | cmdutil.bailifchanged(repo) | |
806 | return hg.clean(repo, node) |
|
806 | return hg.clean(repo, node) | |
807 |
|
807 | |||
808 | @command('bookmarks|bookmark', |
|
808 | @command('bookmarks|bookmark', | |
809 | [('f', 'force', False, _('force')), |
|
809 | [('f', 'force', False, _('force')), | |
810 | ('r', 'rev', '', _('revision'), _('REV')), |
|
810 | ('r', 'rev', '', _('revision'), _('REV')), | |
811 | ('d', 'delete', False, _('delete a given bookmark')), |
|
811 | ('d', 'delete', False, _('delete a given bookmark')), | |
812 | ('m', 'rename', '', _('rename a given bookmark'), _('NAME')), |
|
812 | ('m', 'rename', '', _('rename a given bookmark'), _('NAME')), | |
813 | ('i', 'inactive', False, _('mark a bookmark inactive'))], |
|
813 | ('i', 'inactive', False, _('mark a bookmark inactive'))], | |
814 | _('hg bookmarks [OPTIONS]... [NAME]...')) |
|
814 | _('hg bookmarks [OPTIONS]... [NAME]...')) | |
815 | def bookmark(ui, repo, *names, **opts): |
|
815 | def bookmark(ui, repo, *names, **opts): | |
816 | '''create a new bookmark or list existing bookmarks |
|
816 | '''create a new bookmark or list existing bookmarks | |
817 |
|
817 | |||
818 | Bookmarks are labels on changesets to help track lines of development. |
|
818 | Bookmarks are labels on changesets to help track lines of development. | |
819 | Bookmarks are unversioned and can be moved, renamed and deleted. |
|
819 | Bookmarks are unversioned and can be moved, renamed and deleted. | |
820 | Deleting or moving a bookmark has no effect on the associated changesets. |
|
820 | Deleting or moving a bookmark has no effect on the associated changesets. | |
821 |
|
821 | |||
822 | Creating or updating to a bookmark causes it to be marked as 'active'. |
|
822 | Creating or updating to a bookmark causes it to be marked as 'active'. | |
823 | The active bookmark is indicated with a '*'. |
|
823 | The active bookmark is indicated with a '*'. | |
824 | When a commit is made, the active bookmark will advance to the new commit. |
|
824 | When a commit is made, the active bookmark will advance to the new commit. | |
825 | A plain :hg:`update` will also advance an active bookmark, if possible. |
|
825 | A plain :hg:`update` will also advance an active bookmark, if possible. | |
826 | Updating away from a bookmark will cause it to be deactivated. |
|
826 | Updating away from a bookmark will cause it to be deactivated. | |
827 |
|
827 | |||
828 | Bookmarks can be pushed and pulled between repositories (see |
|
828 | Bookmarks can be pushed and pulled between repositories (see | |
829 | :hg:`help push` and :hg:`help pull`). If a shared bookmark has |
|
829 | :hg:`help push` and :hg:`help pull`). If a shared bookmark has | |
830 | diverged, a new 'divergent bookmark' of the form 'name@path' will |
|
830 | diverged, a new 'divergent bookmark' of the form 'name@path' will | |
831 | be created. Using :hg:'merge' will resolve the divergence. |
|
831 | be created. Using :hg:'merge' will resolve the divergence. | |
832 |
|
832 | |||
833 | A bookmark named '@' has the special property that :hg:`clone` will |
|
833 | A bookmark named '@' has the special property that :hg:`clone` will | |
834 | check it out by default if it exists. |
|
834 | check it out by default if it exists. | |
835 |
|
835 | |||
836 | .. container:: verbose |
|
836 | .. container:: verbose | |
837 |
|
837 | |||
838 | Examples: |
|
838 | Examples: | |
839 |
|
839 | |||
840 | - create an active bookmark for a new line of development:: |
|
840 | - create an active bookmark for a new line of development:: | |
841 |
|
841 | |||
842 | hg book new-feature |
|
842 | hg book new-feature | |
843 |
|
843 | |||
844 | - create an inactive bookmark as a place marker:: |
|
844 | - create an inactive bookmark as a place marker:: | |
845 |
|
845 | |||
846 | hg book -i reviewed |
|
846 | hg book -i reviewed | |
847 |
|
847 | |||
848 | - create an inactive bookmark on another changeset:: |
|
848 | - create an inactive bookmark on another changeset:: | |
849 |
|
849 | |||
850 | hg book -r .^ tested |
|
850 | hg book -r .^ tested | |
851 |
|
851 | |||
852 | - move the '@' bookmark from another branch:: |
|
852 | - move the '@' bookmark from another branch:: | |
853 |
|
853 | |||
854 | hg book -f @ |
|
854 | hg book -f @ | |
855 | ''' |
|
855 | ''' | |
856 | force = opts.get('force') |
|
856 | force = opts.get('force') | |
857 | rev = opts.get('rev') |
|
857 | rev = opts.get('rev') | |
858 | delete = opts.get('delete') |
|
858 | delete = opts.get('delete') | |
859 | rename = opts.get('rename') |
|
859 | rename = opts.get('rename') | |
860 | inactive = opts.get('inactive') |
|
860 | inactive = opts.get('inactive') | |
861 |
|
861 | |||
862 | def checkformat(mark): |
|
862 | def checkformat(mark): | |
863 | mark = mark.strip() |
|
863 | mark = mark.strip() | |
864 | if not mark: |
|
864 | if not mark: | |
865 | raise util.Abort(_("bookmark names cannot consist entirely of " |
|
865 | raise util.Abort(_("bookmark names cannot consist entirely of " | |
866 | "whitespace")) |
|
866 | "whitespace")) | |
867 | scmutil.checknewlabel(repo, mark, 'bookmark') |
|
867 | scmutil.checknewlabel(repo, mark, 'bookmark') | |
868 | return mark |
|
868 | return mark | |
869 |
|
869 | |||
870 | def checkconflict(repo, mark, cur, force=False, target=None): |
|
870 | def checkconflict(repo, mark, cur, force=False, target=None): | |
871 | if mark in marks and not force: |
|
871 | if mark in marks and not force: | |
872 | if target: |
|
872 | if target: | |
873 | if marks[mark] == target and target == cur: |
|
873 | if marks[mark] == target and target == cur: | |
874 | # re-activating a bookmark |
|
874 | # re-activating a bookmark | |
875 | return |
|
875 | return | |
876 | anc = repo.changelog.ancestors([repo[target].rev()]) |
|
876 | anc = repo.changelog.ancestors([repo[target].rev()]) | |
877 | bmctx = repo[marks[mark]] |
|
877 | bmctx = repo[marks[mark]] | |
878 | divs = [repo[b].node() for b in marks |
|
878 | divs = [repo[b].node() for b in marks | |
879 | if b.split('@', 1)[0] == mark.split('@', 1)[0]] |
|
879 | if b.split('@', 1)[0] == mark.split('@', 1)[0]] | |
880 |
|
880 | |||
881 | # allow resolving a single divergent bookmark even if moving |
|
881 | # allow resolving a single divergent bookmark even if moving | |
882 | # the bookmark across branches when a revision is specified |
|
882 | # the bookmark across branches when a revision is specified | |
883 | # that contains a divergent bookmark |
|
883 | # that contains a divergent bookmark | |
884 | if bmctx.rev() not in anc and target in divs: |
|
884 | if bmctx.rev() not in anc and target in divs: | |
885 | bookmarks.deletedivergent(repo, [target], mark) |
|
885 | bookmarks.deletedivergent(repo, [target], mark) | |
886 | return |
|
886 | return | |
887 |
|
887 | |||
888 | deletefrom = [b for b in divs |
|
888 | deletefrom = [b for b in divs | |
889 | if repo[b].rev() in anc or b == target] |
|
889 | if repo[b].rev() in anc or b == target] | |
890 | bookmarks.deletedivergent(repo, deletefrom, mark) |
|
890 | bookmarks.deletedivergent(repo, deletefrom, mark) | |
891 | if bookmarks.validdest(repo, bmctx, repo[target]): |
|
891 | if bookmarks.validdest(repo, bmctx, repo[target]): | |
892 | ui.status(_("moving bookmark '%s' forward from %s\n") % |
|
892 | ui.status(_("moving bookmark '%s' forward from %s\n") % | |
893 | (mark, short(bmctx.node()))) |
|
893 | (mark, short(bmctx.node()))) | |
894 | return |
|
894 | return | |
895 | raise util.Abort(_("bookmark '%s' already exists " |
|
895 | raise util.Abort(_("bookmark '%s' already exists " | |
896 | "(use -f to force)") % mark) |
|
896 | "(use -f to force)") % mark) | |
897 | if ((mark in repo.branchmap() or mark == repo.dirstate.branch()) |
|
897 | if ((mark in repo.branchmap() or mark == repo.dirstate.branch()) | |
898 | and not force): |
|
898 | and not force): | |
899 | raise util.Abort( |
|
899 | raise util.Abort( | |
900 | _("a bookmark cannot have the name of an existing branch")) |
|
900 | _("a bookmark cannot have the name of an existing branch")) | |
901 |
|
901 | |||
902 | if delete and rename: |
|
902 | if delete and rename: | |
903 | raise util.Abort(_("--delete and --rename are incompatible")) |
|
903 | raise util.Abort(_("--delete and --rename are incompatible")) | |
904 | if delete and rev: |
|
904 | if delete and rev: | |
905 | raise util.Abort(_("--rev is incompatible with --delete")) |
|
905 | raise util.Abort(_("--rev is incompatible with --delete")) | |
906 | if rename and rev: |
|
906 | if rename and rev: | |
907 | raise util.Abort(_("--rev is incompatible with --rename")) |
|
907 | raise util.Abort(_("--rev is incompatible with --rename")) | |
908 | if not names and (delete or rev): |
|
908 | if not names and (delete or rev): | |
909 | raise util.Abort(_("bookmark name required")) |
|
909 | raise util.Abort(_("bookmark name required")) | |
910 |
|
910 | |||
911 | if delete or rename or names or inactive: |
|
911 | if delete or rename or names or inactive: | |
912 | wlock = repo.wlock() |
|
912 | wlock = repo.wlock() | |
913 | try: |
|
913 | try: | |
914 | cur = repo.changectx('.').node() |
|
914 | cur = repo.changectx('.').node() | |
915 | marks = repo._bookmarks |
|
915 | marks = repo._bookmarks | |
916 | if delete: |
|
916 | if delete: | |
917 | for mark in names: |
|
917 | for mark in names: | |
918 | if mark not in marks: |
|
918 | if mark not in marks: | |
919 | raise util.Abort(_("bookmark '%s' does not exist") % |
|
919 | raise util.Abort(_("bookmark '%s' does not exist") % | |
920 | mark) |
|
920 | mark) | |
921 | if mark == repo._bookmarkcurrent: |
|
921 | if mark == repo._bookmarkcurrent: | |
922 | bookmarks.unsetcurrent(repo) |
|
922 | bookmarks.unsetcurrent(repo) | |
923 | del marks[mark] |
|
923 | del marks[mark] | |
924 | marks.write() |
|
924 | marks.write() | |
925 |
|
925 | |||
926 | elif rename: |
|
926 | elif rename: | |
927 | if not names: |
|
927 | if not names: | |
928 | raise util.Abort(_("new bookmark name required")) |
|
928 | raise util.Abort(_("new bookmark name required")) | |
929 | elif len(names) > 1: |
|
929 | elif len(names) > 1: | |
930 | raise util.Abort(_("only one new bookmark name allowed")) |
|
930 | raise util.Abort(_("only one new bookmark name allowed")) | |
931 | mark = checkformat(names[0]) |
|
931 | mark = checkformat(names[0]) | |
932 | if rename not in marks: |
|
932 | if rename not in marks: | |
933 | raise util.Abort(_("bookmark '%s' does not exist") % rename) |
|
933 | raise util.Abort(_("bookmark '%s' does not exist") % rename) | |
934 | checkconflict(repo, mark, cur, force) |
|
934 | checkconflict(repo, mark, cur, force) | |
935 | marks[mark] = marks[rename] |
|
935 | marks[mark] = marks[rename] | |
936 | if repo._bookmarkcurrent == rename and not inactive: |
|
936 | if repo._bookmarkcurrent == rename and not inactive: | |
937 | bookmarks.setcurrent(repo, mark) |
|
937 | bookmarks.setcurrent(repo, mark) | |
938 | del marks[rename] |
|
938 | del marks[rename] | |
939 | marks.write() |
|
939 | marks.write() | |
940 |
|
940 | |||
941 | elif names: |
|
941 | elif names: | |
942 | newact = None |
|
942 | newact = None | |
943 | for mark in names: |
|
943 | for mark in names: | |
944 | mark = checkformat(mark) |
|
944 | mark = checkformat(mark) | |
945 | if newact is None: |
|
945 | if newact is None: | |
946 | newact = mark |
|
946 | newact = mark | |
947 | if inactive and mark == repo._bookmarkcurrent: |
|
947 | if inactive and mark == repo._bookmarkcurrent: | |
948 | bookmarks.unsetcurrent(repo) |
|
948 | bookmarks.unsetcurrent(repo) | |
949 | return |
|
949 | return | |
950 | tgt = cur |
|
950 | tgt = cur | |
951 | if rev: |
|
951 | if rev: | |
952 | tgt = scmutil.revsingle(repo, rev).node() |
|
952 | tgt = scmutil.revsingle(repo, rev).node() | |
953 | checkconflict(repo, mark, cur, force, tgt) |
|
953 | checkconflict(repo, mark, cur, force, tgt) | |
954 | marks[mark] = tgt |
|
954 | marks[mark] = tgt | |
955 | if not inactive and cur == marks[newact] and not rev: |
|
955 | if not inactive and cur == marks[newact] and not rev: | |
956 | bookmarks.setcurrent(repo, newact) |
|
956 | bookmarks.setcurrent(repo, newact) | |
957 | elif cur != tgt and newact == repo._bookmarkcurrent: |
|
957 | elif cur != tgt and newact == repo._bookmarkcurrent: | |
958 | bookmarks.unsetcurrent(repo) |
|
958 | bookmarks.unsetcurrent(repo) | |
959 | marks.write() |
|
959 | marks.write() | |
960 |
|
960 | |||
961 | elif inactive: |
|
961 | elif inactive: | |
962 | if len(marks) == 0: |
|
962 | if len(marks) == 0: | |
963 | ui.status(_("no bookmarks set\n")) |
|
963 | ui.status(_("no bookmarks set\n")) | |
964 | elif not repo._bookmarkcurrent: |
|
964 | elif not repo._bookmarkcurrent: | |
965 | ui.status(_("no active bookmark\n")) |
|
965 | ui.status(_("no active bookmark\n")) | |
966 | else: |
|
966 | else: | |
967 | bookmarks.unsetcurrent(repo) |
|
967 | bookmarks.unsetcurrent(repo) | |
968 | finally: |
|
968 | finally: | |
969 | wlock.release() |
|
969 | wlock.release() | |
970 | else: # show bookmarks |
|
970 | else: # show bookmarks | |
971 | hexfn = ui.debugflag and hex or short |
|
971 | hexfn = ui.debugflag and hex or short | |
972 | marks = repo._bookmarks |
|
972 | marks = repo._bookmarks | |
973 | if len(marks) == 0: |
|
973 | if len(marks) == 0: | |
974 | ui.status(_("no bookmarks set\n")) |
|
974 | ui.status(_("no bookmarks set\n")) | |
975 | else: |
|
975 | else: | |
976 | for bmark, n in sorted(marks.iteritems()): |
|
976 | for bmark, n in sorted(marks.iteritems()): | |
977 | current = repo._bookmarkcurrent |
|
977 | current = repo._bookmarkcurrent | |
978 | if bmark == current: |
|
978 | if bmark == current: | |
979 | prefix, label = '*', 'bookmarks.current' |
|
979 | prefix, label = '*', 'bookmarks.current' | |
980 | else: |
|
980 | else: | |
981 | prefix, label = ' ', '' |
|
981 | prefix, label = ' ', '' | |
982 |
|
982 | |||
983 | if ui.quiet: |
|
983 | if ui.quiet: | |
984 | ui.write("%s\n" % bmark, label=label) |
|
984 | ui.write("%s\n" % bmark, label=label) | |
985 | else: |
|
985 | else: | |
986 | pad = " " * (25 - encoding.colwidth(bmark)) |
|
986 | pad = " " * (25 - encoding.colwidth(bmark)) | |
987 | ui.write(" %s %s%s %d:%s\n" % ( |
|
987 | ui.write(" %s %s%s %d:%s\n" % ( | |
988 | prefix, bmark, pad, repo.changelog.rev(n), hexfn(n)), |
|
988 | prefix, bmark, pad, repo.changelog.rev(n), hexfn(n)), | |
989 | label=label) |
|
989 | label=label) | |
990 |
|
990 | |||
991 | @command('branch', |
|
991 | @command('branch', | |
992 | [('f', 'force', None, |
|
992 | [('f', 'force', None, | |
993 | _('set branch name even if it shadows an existing branch')), |
|
993 | _('set branch name even if it shadows an existing branch')), | |
994 | ('C', 'clean', None, _('reset branch name to parent branch name'))], |
|
994 | ('C', 'clean', None, _('reset branch name to parent branch name'))], | |
995 | _('[-fC] [NAME]')) |
|
995 | _('[-fC] [NAME]')) | |
996 | def branch(ui, repo, label=None, **opts): |
|
996 | def branch(ui, repo, label=None, **opts): | |
997 | """set or show the current branch name |
|
997 | """set or show the current branch name | |
998 |
|
998 | |||
999 | .. note:: |
|
999 | .. note:: | |
1000 |
|
1000 | |||
1001 | Branch names are permanent and global. Use :hg:`bookmark` to create a |
|
1001 | Branch names are permanent and global. Use :hg:`bookmark` to create a | |
1002 | light-weight bookmark instead. See :hg:`help glossary` for more |
|
1002 | light-weight bookmark instead. See :hg:`help glossary` for more | |
1003 | information about named branches and bookmarks. |
|
1003 | information about named branches and bookmarks. | |
1004 |
|
1004 | |||
1005 | With no argument, show the current branch name. With one argument, |
|
1005 | With no argument, show the current branch name. With one argument, | |
1006 | set the working directory branch name (the branch will not exist |
|
1006 | set the working directory branch name (the branch will not exist | |
1007 | in the repository until the next commit). Standard practice |
|
1007 | in the repository until the next commit). Standard practice | |
1008 | recommends that primary development take place on the 'default' |
|
1008 | recommends that primary development take place on the 'default' | |
1009 | branch. |
|
1009 | branch. | |
1010 |
|
1010 | |||
1011 | Unless -f/--force is specified, branch will not let you set a |
|
1011 | Unless -f/--force is specified, branch will not let you set a | |
1012 | branch name that already exists, even if it's inactive. |
|
1012 | branch name that already exists, even if it's inactive. | |
1013 |
|
1013 | |||
1014 | Use -C/--clean to reset the working directory branch to that of |
|
1014 | Use -C/--clean to reset the working directory branch to that of | |
1015 | the parent of the working directory, negating a previous branch |
|
1015 | the parent of the working directory, negating a previous branch | |
1016 | change. |
|
1016 | change. | |
1017 |
|
1017 | |||
1018 | Use the command :hg:`update` to switch to an existing branch. Use |
|
1018 | Use the command :hg:`update` to switch to an existing branch. Use | |
1019 | :hg:`commit --close-branch` to mark this branch as closed. |
|
1019 | :hg:`commit --close-branch` to mark this branch as closed. | |
1020 |
|
1020 | |||
1021 | Returns 0 on success. |
|
1021 | Returns 0 on success. | |
1022 | """ |
|
1022 | """ | |
1023 | if label: |
|
1023 | if label: | |
1024 | label = label.strip() |
|
1024 | label = label.strip() | |
1025 |
|
1025 | |||
1026 | if not opts.get('clean') and not label: |
|
1026 | if not opts.get('clean') and not label: | |
1027 | ui.write("%s\n" % repo.dirstate.branch()) |
|
1027 | ui.write("%s\n" % repo.dirstate.branch()) | |
1028 | return |
|
1028 | return | |
1029 |
|
1029 | |||
1030 | wlock = repo.wlock() |
|
1030 | wlock = repo.wlock() | |
1031 | try: |
|
1031 | try: | |
1032 | if opts.get('clean'): |
|
1032 | if opts.get('clean'): | |
1033 | label = repo[None].p1().branch() |
|
1033 | label = repo[None].p1().branch() | |
1034 | repo.dirstate.setbranch(label) |
|
1034 | repo.dirstate.setbranch(label) | |
1035 | ui.status(_('reset working directory to branch %s\n') % label) |
|
1035 | ui.status(_('reset working directory to branch %s\n') % label) | |
1036 | elif label: |
|
1036 | elif label: | |
1037 | if not opts.get('force') and label in repo.branchmap(): |
|
1037 | if not opts.get('force') and label in repo.branchmap(): | |
1038 | if label not in [p.branch() for p in repo.parents()]: |
|
1038 | if label not in [p.branch() for p in repo.parents()]: | |
1039 | raise util.Abort(_('a branch of the same name already' |
|
1039 | raise util.Abort(_('a branch of the same name already' | |
1040 | ' exists'), |
|
1040 | ' exists'), | |
1041 | # i18n: "it" refers to an existing branch |
|
1041 | # i18n: "it" refers to an existing branch | |
1042 | hint=_("use 'hg update' to switch to it")) |
|
1042 | hint=_("use 'hg update' to switch to it")) | |
1043 | scmutil.checknewlabel(repo, label, 'branch') |
|
1043 | scmutil.checknewlabel(repo, label, 'branch') | |
1044 | repo.dirstate.setbranch(label) |
|
1044 | repo.dirstate.setbranch(label) | |
1045 | ui.status(_('marked working directory as branch %s\n') % label) |
|
1045 | ui.status(_('marked working directory as branch %s\n') % label) | |
1046 | ui.status(_('(branches are permanent and global, ' |
|
1046 | ui.status(_('(branches are permanent and global, ' | |
1047 | 'did you want a bookmark?)\n')) |
|
1047 | 'did you want a bookmark?)\n')) | |
1048 | finally: |
|
1048 | finally: | |
1049 | wlock.release() |
|
1049 | wlock.release() | |
1050 |
|
1050 | |||
1051 | @command('branches', |
|
1051 | @command('branches', | |
1052 | [('a', 'active', False, _('show only branches that have unmerged heads')), |
|
1052 | [('a', 'active', False, _('show only branches that have unmerged heads')), | |
1053 | ('c', 'closed', False, _('show normal and closed branches'))], |
|
1053 | ('c', 'closed', False, _('show normal and closed branches'))], | |
1054 | _('[-ac]')) |
|
1054 | _('[-ac]')) | |
1055 | def branches(ui, repo, active=False, closed=False): |
|
1055 | def branches(ui, repo, active=False, closed=False): | |
1056 | """list repository named branches |
|
1056 | """list repository named branches | |
1057 |
|
1057 | |||
1058 | List the repository's named branches, indicating which ones are |
|
1058 | List the repository's named branches, indicating which ones are | |
1059 | inactive. If -c/--closed is specified, also list branches which have |
|
1059 | inactive. If -c/--closed is specified, also list branches which have | |
1060 | been marked closed (see :hg:`commit --close-branch`). |
|
1060 | been marked closed (see :hg:`commit --close-branch`). | |
1061 |
|
1061 | |||
1062 | If -a/--active is specified, only show active branches. A branch |
|
1062 | If -a/--active is specified, only show active branches. A branch | |
1063 | is considered active if it contains repository heads. |
|
1063 | is considered active if it contains repository heads. | |
1064 |
|
1064 | |||
1065 | Use the command :hg:`update` to switch to an existing branch. |
|
1065 | Use the command :hg:`update` to switch to an existing branch. | |
1066 |
|
1066 | |||
1067 | Returns 0. |
|
1067 | Returns 0. | |
1068 | """ |
|
1068 | """ | |
1069 |
|
1069 | |||
1070 | hexfunc = ui.debugflag and hex or short |
|
1070 | hexfunc = ui.debugflag and hex or short | |
1071 |
|
1071 | |||
1072 | allheads = set(repo.heads()) |
|
1072 | allheads = set(repo.heads()) | |
1073 | branches = [] |
|
1073 | branches = [] | |
1074 | for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): |
|
1074 | for tag, heads, tip, isclosed in repo.branchmap().iterbranches(): | |
1075 | isactive = not isclosed and bool(set(heads) & allheads) |
|
1075 | isactive = not isclosed and bool(set(heads) & allheads) | |
1076 | branches.append((tag, repo[tip], isactive, not isclosed)) |
|
1076 | branches.append((tag, repo[tip], isactive, not isclosed)) | |
1077 | branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]), |
|
1077 | branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]), | |
1078 | reverse=True) |
|
1078 | reverse=True) | |
1079 |
|
1079 | |||
1080 | for tag, ctx, isactive, isopen in branches: |
|
1080 | for tag, ctx, isactive, isopen in branches: | |
1081 | if (not active) or isactive: |
|
1081 | if (not active) or isactive: | |
1082 | if isactive: |
|
1082 | if isactive: | |
1083 | label = 'branches.active' |
|
1083 | label = 'branches.active' | |
1084 | notice = '' |
|
1084 | notice = '' | |
1085 | elif not isopen: |
|
1085 | elif not isopen: | |
1086 | if not closed: |
|
1086 | if not closed: | |
1087 | continue |
|
1087 | continue | |
1088 | label = 'branches.closed' |
|
1088 | label = 'branches.closed' | |
1089 | notice = _(' (closed)') |
|
1089 | notice = _(' (closed)') | |
1090 | else: |
|
1090 | else: | |
1091 | label = 'branches.inactive' |
|
1091 | label = 'branches.inactive' | |
1092 | notice = _(' (inactive)') |
|
1092 | notice = _(' (inactive)') | |
1093 | if tag == repo.dirstate.branch(): |
|
1093 | if tag == repo.dirstate.branch(): | |
1094 | label = 'branches.current' |
|
1094 | label = 'branches.current' | |
1095 | rev = str(ctx.rev()).rjust(31 - encoding.colwidth(tag)) |
|
1095 | rev = str(ctx.rev()).rjust(31 - encoding.colwidth(tag)) | |
1096 | rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())), |
|
1096 | rev = ui.label('%s:%s' % (rev, hexfunc(ctx.node())), | |
1097 | 'log.changeset changeset.%s' % ctx.phasestr()) |
|
1097 | 'log.changeset changeset.%s' % ctx.phasestr()) | |
1098 | labeledtag = ui.label(tag, label) |
|
1098 | labeledtag = ui.label(tag, label) | |
1099 | if ui.quiet: |
|
1099 | if ui.quiet: | |
1100 | ui.write("%s\n" % labeledtag) |
|
1100 | ui.write("%s\n" % labeledtag) | |
1101 | else: |
|
1101 | else: | |
1102 | ui.write("%s %s%s\n" % (labeledtag, rev, notice)) |
|
1102 | ui.write("%s %s%s\n" % (labeledtag, rev, notice)) | |
1103 |
|
1103 | |||
1104 | @command('bundle', |
|
1104 | @command('bundle', | |
1105 | [('f', 'force', None, _('run even when the destination is unrelated')), |
|
1105 | [('f', 'force', None, _('run even when the destination is unrelated')), | |
1106 | ('r', 'rev', [], _('a changeset intended to be added to the destination'), |
|
1106 | ('r', 'rev', [], _('a changeset intended to be added to the destination'), | |
1107 | _('REV')), |
|
1107 | _('REV')), | |
1108 | ('b', 'branch', [], _('a specific branch you would like to bundle'), |
|
1108 | ('b', 'branch', [], _('a specific branch you would like to bundle'), | |
1109 | _('BRANCH')), |
|
1109 | _('BRANCH')), | |
1110 | ('', 'base', [], |
|
1110 | ('', 'base', [], | |
1111 | _('a base changeset assumed to be available at the destination'), |
|
1111 | _('a base changeset assumed to be available at the destination'), | |
1112 | _('REV')), |
|
1112 | _('REV')), | |
1113 | ('a', 'all', None, _('bundle all changesets in the repository')), |
|
1113 | ('a', 'all', None, _('bundle all changesets in the repository')), | |
1114 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')), |
|
1114 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')), | |
1115 | ] + remoteopts, |
|
1115 | ] + remoteopts, | |
1116 | _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')) |
|
1116 | _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')) | |
1117 | def bundle(ui, repo, fname, dest=None, **opts): |
|
1117 | def bundle(ui, repo, fname, dest=None, **opts): | |
1118 | """create a changegroup file |
|
1118 | """create a changegroup file | |
1119 |
|
1119 | |||
1120 | Generate a compressed changegroup file collecting changesets not |
|
1120 | Generate a compressed changegroup file collecting changesets not | |
1121 | known to be in another repository. |
|
1121 | known to be in another repository. | |
1122 |
|
1122 | |||
1123 | If you omit the destination repository, then hg assumes the |
|
1123 | If you omit the destination repository, then hg assumes the | |
1124 | destination will have all the nodes you specify with --base |
|
1124 | destination will have all the nodes you specify with --base | |
1125 | parameters. To create a bundle containing all changesets, use |
|
1125 | parameters. To create a bundle containing all changesets, use | |
1126 | -a/--all (or --base null). |
|
1126 | -a/--all (or --base null). | |
1127 |
|
1127 | |||
1128 | You can change compression method with the -t/--type option. |
|
1128 | You can change compression method with the -t/--type option. | |
1129 | The available compression methods are: none, bzip2, and |
|
1129 | The available compression methods are: none, bzip2, and | |
1130 | gzip (by default, bundles are compressed using bzip2). |
|
1130 | gzip (by default, bundles are compressed using bzip2). | |
1131 |
|
1131 | |||
1132 | The bundle file can then be transferred using conventional means |
|
1132 | The bundle file can then be transferred using conventional means | |
1133 | and applied to another repository with the unbundle or pull |
|
1133 | and applied to another repository with the unbundle or pull | |
1134 | command. This is useful when direct push and pull are not |
|
1134 | command. This is useful when direct push and pull are not | |
1135 | available or when exporting an entire repository is undesirable. |
|
1135 | available or when exporting an entire repository is undesirable. | |
1136 |
|
1136 | |||
1137 | Applying bundles preserves all changeset contents including |
|
1137 | Applying bundles preserves all changeset contents including | |
1138 | permissions, copy/rename information, and revision history. |
|
1138 | permissions, copy/rename information, and revision history. | |
1139 |
|
1139 | |||
1140 | Returns 0 on success, 1 if no changes found. |
|
1140 | Returns 0 on success, 1 if no changes found. | |
1141 | """ |
|
1141 | """ | |
1142 | revs = None |
|
1142 | revs = None | |
1143 | if 'rev' in opts: |
|
1143 | if 'rev' in opts: | |
1144 | revs = scmutil.revrange(repo, opts['rev']) |
|
1144 | revs = scmutil.revrange(repo, opts['rev']) | |
1145 |
|
1145 | |||
1146 | bundletype = opts.get('type', 'bzip2').lower() |
|
1146 | bundletype = opts.get('type', 'bzip2').lower() | |
1147 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} |
|
1147 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} | |
1148 | bundletype = btypes.get(bundletype) |
|
1148 | bundletype = btypes.get(bundletype) | |
1149 | if bundletype not in changegroup.bundletypes: |
|
1149 | if bundletype not in changegroup.bundletypes: | |
1150 | raise util.Abort(_('unknown bundle type specified with --type')) |
|
1150 | raise util.Abort(_('unknown bundle type specified with --type')) | |
1151 |
|
1151 | |||
1152 | if opts.get('all'): |
|
1152 | if opts.get('all'): | |
1153 | base = ['null'] |
|
1153 | base = ['null'] | |
1154 | else: |
|
1154 | else: | |
1155 | base = scmutil.revrange(repo, opts.get('base')) |
|
1155 | base = scmutil.revrange(repo, opts.get('base')) | |
1156 | # TODO: get desired bundlecaps from command line. |
|
1156 | # TODO: get desired bundlecaps from command line. | |
1157 | bundlecaps = None |
|
1157 | bundlecaps = None | |
1158 | if base: |
|
1158 | if base: | |
1159 | if dest: |
|
1159 | if dest: | |
1160 | raise util.Abort(_("--base is incompatible with specifying " |
|
1160 | raise util.Abort(_("--base is incompatible with specifying " | |
1161 | "a destination")) |
|
1161 | "a destination")) | |
1162 | common = [repo.lookup(rev) for rev in base] |
|
1162 | common = [repo.lookup(rev) for rev in base] | |
1163 | heads = revs and map(repo.lookup, revs) or revs |
|
1163 | heads = revs and map(repo.lookup, revs) or revs | |
1164 | cg = changegroup.getchangegroup(repo, 'bundle', heads=heads, |
|
1164 | cg = changegroup.getchangegroup(repo, 'bundle', heads=heads, | |
1165 | common=common, bundlecaps=bundlecaps) |
|
1165 | common=common, bundlecaps=bundlecaps) | |
1166 | outgoing = None |
|
1166 | outgoing = None | |
1167 | else: |
|
1167 | else: | |
1168 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
1168 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
1169 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
1169 | dest, branches = hg.parseurl(dest, opts.get('branch')) | |
1170 | other = hg.peer(repo, opts, dest) |
|
1170 | other = hg.peer(repo, opts, dest) | |
1171 | revs, checkout = hg.addbranchrevs(repo, repo, branches, revs) |
|
1171 | revs, checkout = hg.addbranchrevs(repo, repo, branches, revs) | |
1172 | heads = revs and map(repo.lookup, revs) or revs |
|
1172 | heads = revs and map(repo.lookup, revs) or revs | |
1173 | outgoing = discovery.findcommonoutgoing(repo, other, |
|
1173 | outgoing = discovery.findcommonoutgoing(repo, other, | |
1174 | onlyheads=heads, |
|
1174 | onlyheads=heads, | |
1175 | force=opts.get('force'), |
|
1175 | force=opts.get('force'), | |
1176 | portable=True) |
|
1176 | portable=True) | |
1177 | cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing, |
|
1177 | cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing, | |
1178 | bundlecaps) |
|
1178 | bundlecaps) | |
1179 | if not cg: |
|
1179 | if not cg: | |
1180 | scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded) |
|
1180 | scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded) | |
1181 | return 1 |
|
1181 | return 1 | |
1182 |
|
1182 | |||
1183 | changegroup.writebundle(cg, fname, bundletype) |
|
1183 | changegroup.writebundle(cg, fname, bundletype) | |
1184 |
|
1184 | |||
1185 | @command('cat', |
|
1185 | @command('cat', | |
1186 | [('o', 'output', '', |
|
1186 | [('o', 'output', '', | |
1187 | _('print output to file with formatted name'), _('FORMAT')), |
|
1187 | _('print output to file with formatted name'), _('FORMAT')), | |
1188 | ('r', 'rev', '', _('print the given revision'), _('REV')), |
|
1188 | ('r', 'rev', '', _('print the given revision'), _('REV')), | |
1189 | ('', 'decode', None, _('apply any matching decode filter')), |
|
1189 | ('', 'decode', None, _('apply any matching decode filter')), | |
1190 | ] + walkopts, |
|
1190 | ] + walkopts, | |
1191 | _('[OPTION]... FILE...'), |
|
1191 | _('[OPTION]... FILE...'), | |
1192 | inferrepo=True) |
|
1192 | inferrepo=True) | |
1193 | def cat(ui, repo, file1, *pats, **opts): |
|
1193 | def cat(ui, repo, file1, *pats, **opts): | |
1194 | """output the current or given revision of files |
|
1194 | """output the current or given revision of files | |
1195 |
|
1195 | |||
1196 | Print the specified files as they were at the given revision. If |
|
1196 | Print the specified files as they were at the given revision. If | |
1197 | no revision is given, the parent of the working directory is used. |
|
1197 | no revision is given, the parent of the working directory is used. | |
1198 |
|
1198 | |||
1199 | Output may be to a file, in which case the name of the file is |
|
1199 | Output may be to a file, in which case the name of the file is | |
1200 | given using a format string. The formatting rules as follows: |
|
1200 | given using a format string. The formatting rules as follows: | |
1201 |
|
1201 | |||
1202 | :``%%``: literal "%" character |
|
1202 | :``%%``: literal "%" character | |
1203 | :``%s``: basename of file being printed |
|
1203 | :``%s``: basename of file being printed | |
1204 | :``%d``: dirname of file being printed, or '.' if in repository root |
|
1204 | :``%d``: dirname of file being printed, or '.' if in repository root | |
1205 | :``%p``: root-relative path name of file being printed |
|
1205 | :``%p``: root-relative path name of file being printed | |
1206 | :``%H``: changeset hash (40 hexadecimal digits) |
|
1206 | :``%H``: changeset hash (40 hexadecimal digits) | |
1207 | :``%R``: changeset revision number |
|
1207 | :``%R``: changeset revision number | |
1208 | :``%h``: short-form changeset hash (12 hexadecimal digits) |
|
1208 | :``%h``: short-form changeset hash (12 hexadecimal digits) | |
1209 | :``%r``: zero-padded changeset revision number |
|
1209 | :``%r``: zero-padded changeset revision number | |
1210 | :``%b``: basename of the exporting repository |
|
1210 | :``%b``: basename of the exporting repository | |
1211 |
|
1211 | |||
1212 | Returns 0 on success. |
|
1212 | Returns 0 on success. | |
1213 | """ |
|
1213 | """ | |
1214 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
1214 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
1215 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
1215 | m = scmutil.match(ctx, (file1,) + pats, opts) | |
1216 |
|
1216 | |||
1217 | return cmdutil.cat(ui, repo, ctx, m, '', **opts) |
|
1217 | return cmdutil.cat(ui, repo, ctx, m, '', **opts) | |
1218 |
|
1218 | |||
1219 | @command('^clone', |
|
1219 | @command('^clone', | |
1220 | [('U', 'noupdate', None, |
|
1220 | [('U', 'noupdate', None, | |
1221 | _('the clone will include an empty working copy (only a repository)')), |
|
1221 | _('the clone will include an empty working copy (only a repository)')), | |
1222 | ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')), |
|
1222 | ('u', 'updaterev', '', _('revision, tag or branch to check out'), _('REV')), | |
1223 | ('r', 'rev', [], _('include the specified changeset'), _('REV')), |
|
1223 | ('r', 'rev', [], _('include the specified changeset'), _('REV')), | |
1224 | ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')), |
|
1224 | ('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')), | |
1225 | ('', 'pull', None, _('use pull protocol to copy metadata')), |
|
1225 | ('', 'pull', None, _('use pull protocol to copy metadata')), | |
1226 | ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')), |
|
1226 | ('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')), | |
1227 | ] + remoteopts, |
|
1227 | ] + remoteopts, | |
1228 | _('[OPTION]... SOURCE [DEST]'), |
|
1228 | _('[OPTION]... SOURCE [DEST]'), | |
1229 | norepo=True) |
|
1229 | norepo=True) | |
1230 | def clone(ui, source, dest=None, **opts): |
|
1230 | def clone(ui, source, dest=None, **opts): | |
1231 | """make a copy of an existing repository |
|
1231 | """make a copy of an existing repository | |
1232 |
|
1232 | |||
1233 | Create a copy of an existing repository in a new directory. |
|
1233 | Create a copy of an existing repository in a new directory. | |
1234 |
|
1234 | |||
1235 | If no destination directory name is specified, it defaults to the |
|
1235 | If no destination directory name is specified, it defaults to the | |
1236 | basename of the source. |
|
1236 | basename of the source. | |
1237 |
|
1237 | |||
1238 | The location of the source is added to the new repository's |
|
1238 | The location of the source is added to the new repository's | |
1239 | ``.hg/hgrc`` file, as the default to be used for future pulls. |
|
1239 | ``.hg/hgrc`` file, as the default to be used for future pulls. | |
1240 |
|
1240 | |||
1241 | Only local paths and ``ssh://`` URLs are supported as |
|
1241 | Only local paths and ``ssh://`` URLs are supported as | |
1242 | destinations. For ``ssh://`` destinations, no working directory or |
|
1242 | destinations. For ``ssh://`` destinations, no working directory or | |
1243 | ``.hg/hgrc`` will be created on the remote side. |
|
1243 | ``.hg/hgrc`` will be created on the remote side. | |
1244 |
|
1244 | |||
1245 | To pull only a subset of changesets, specify one or more revisions |
|
1245 | To pull only a subset of changesets, specify one or more revisions | |
1246 | identifiers with -r/--rev or branches with -b/--branch. The |
|
1246 | identifiers with -r/--rev or branches with -b/--branch. The | |
1247 | resulting clone will contain only the specified changesets and |
|
1247 | resulting clone will contain only the specified changesets and | |
1248 | their ancestors. These options (or 'clone src#rev dest') imply |
|
1248 | their ancestors. These options (or 'clone src#rev dest') imply | |
1249 | --pull, even for local source repositories. Note that specifying a |
|
1249 | --pull, even for local source repositories. Note that specifying a | |
1250 | tag will include the tagged changeset but not the changeset |
|
1250 | tag will include the tagged changeset but not the changeset | |
1251 | containing the tag. |
|
1251 | containing the tag. | |
1252 |
|
1252 | |||
1253 | If the source repository has a bookmark called '@' set, that |
|
1253 | If the source repository has a bookmark called '@' set, that | |
1254 | revision will be checked out in the new repository by default. |
|
1254 | revision will be checked out in the new repository by default. | |
1255 |
|
1255 | |||
1256 | To check out a particular version, use -u/--update, or |
|
1256 | To check out a particular version, use -u/--update, or | |
1257 | -U/--noupdate to create a clone with no working directory. |
|
1257 | -U/--noupdate to create a clone with no working directory. | |
1258 |
|
1258 | |||
1259 | .. container:: verbose |
|
1259 | .. container:: verbose | |
1260 |
|
1260 | |||
1261 | For efficiency, hardlinks are used for cloning whenever the |
|
1261 | For efficiency, hardlinks are used for cloning whenever the | |
1262 | source and destination are on the same filesystem (note this |
|
1262 | source and destination are on the same filesystem (note this | |
1263 | applies only to the repository data, not to the working |
|
1263 | applies only to the repository data, not to the working | |
1264 | directory). Some filesystems, such as AFS, implement hardlinking |
|
1264 | directory). Some filesystems, such as AFS, implement hardlinking | |
1265 | incorrectly, but do not report errors. In these cases, use the |
|
1265 | incorrectly, but do not report errors. In these cases, use the | |
1266 | --pull option to avoid hardlinking. |
|
1266 | --pull option to avoid hardlinking. | |
1267 |
|
1267 | |||
1268 | In some cases, you can clone repositories and the working |
|
1268 | In some cases, you can clone repositories and the working | |
1269 | directory using full hardlinks with :: |
|
1269 | directory using full hardlinks with :: | |
1270 |
|
1270 | |||
1271 | $ cp -al REPO REPOCLONE |
|
1271 | $ cp -al REPO REPOCLONE | |
1272 |
|
1272 | |||
1273 | This is the fastest way to clone, but it is not always safe. The |
|
1273 | This is the fastest way to clone, but it is not always safe. The | |
1274 | operation is not atomic (making sure REPO is not modified during |
|
1274 | operation is not atomic (making sure REPO is not modified during | |
1275 | the operation is up to you) and you have to make sure your |
|
1275 | the operation is up to you) and you have to make sure your | |
1276 | editor breaks hardlinks (Emacs and most Linux Kernel tools do |
|
1276 | editor breaks hardlinks (Emacs and most Linux Kernel tools do | |
1277 | so). Also, this is not compatible with certain extensions that |
|
1277 | so). Also, this is not compatible with certain extensions that | |
1278 | place their metadata under the .hg directory, such as mq. |
|
1278 | place their metadata under the .hg directory, such as mq. | |
1279 |
|
1279 | |||
1280 | Mercurial will update the working directory to the first applicable |
|
1280 | Mercurial will update the working directory to the first applicable | |
1281 | revision from this list: |
|
1281 | revision from this list: | |
1282 |
|
1282 | |||
1283 | a) null if -U or the source repository has no changesets |
|
1283 | a) null if -U or the source repository has no changesets | |
1284 | b) if -u . and the source repository is local, the first parent of |
|
1284 | b) if -u . and the source repository is local, the first parent of | |
1285 | the source repository's working directory |
|
1285 | the source repository's working directory | |
1286 | c) the changeset specified with -u (if a branch name, this means the |
|
1286 | c) the changeset specified with -u (if a branch name, this means the | |
1287 | latest head of that branch) |
|
1287 | latest head of that branch) | |
1288 | d) the changeset specified with -r |
|
1288 | d) the changeset specified with -r | |
1289 | e) the tipmost head specified with -b |
|
1289 | e) the tipmost head specified with -b | |
1290 | f) the tipmost head specified with the url#branch source syntax |
|
1290 | f) the tipmost head specified with the url#branch source syntax | |
1291 | g) the revision marked with the '@' bookmark, if present |
|
1291 | g) the revision marked with the '@' bookmark, if present | |
1292 | h) the tipmost head of the default branch |
|
1292 | h) the tipmost head of the default branch | |
1293 | i) tip |
|
1293 | i) tip | |
1294 |
|
1294 | |||
1295 | Examples: |
|
1295 | Examples: | |
1296 |
|
1296 | |||
1297 | - clone a remote repository to a new directory named hg/:: |
|
1297 | - clone a remote repository to a new directory named hg/:: | |
1298 |
|
1298 | |||
1299 | hg clone http://selenic.com/hg |
|
1299 | hg clone http://selenic.com/hg | |
1300 |
|
1300 | |||
1301 | - create a lightweight local clone:: |
|
1301 | - create a lightweight local clone:: | |
1302 |
|
1302 | |||
1303 | hg clone project/ project-feature/ |
|
1303 | hg clone project/ project-feature/ | |
1304 |
|
1304 | |||
1305 | - clone from an absolute path on an ssh server (note double-slash):: |
|
1305 | - clone from an absolute path on an ssh server (note double-slash):: | |
1306 |
|
1306 | |||
1307 | hg clone ssh://user@server//home/projects/alpha/ |
|
1307 | hg clone ssh://user@server//home/projects/alpha/ | |
1308 |
|
1308 | |||
1309 | - do a high-speed clone over a LAN while checking out a |
|
1309 | - do a high-speed clone over a LAN while checking out a | |
1310 | specified version:: |
|
1310 | specified version:: | |
1311 |
|
1311 | |||
1312 | hg clone --uncompressed http://server/repo -u 1.5 |
|
1312 | hg clone --uncompressed http://server/repo -u 1.5 | |
1313 |
|
1313 | |||
1314 | - create a repository without changesets after a particular revision:: |
|
1314 | - create a repository without changesets after a particular revision:: | |
1315 |
|
1315 | |||
1316 | hg clone -r 04e544 experimental/ good/ |
|
1316 | hg clone -r 04e544 experimental/ good/ | |
1317 |
|
1317 | |||
1318 | - clone (and track) a particular named branch:: |
|
1318 | - clone (and track) a particular named branch:: | |
1319 |
|
1319 | |||
1320 | hg clone http://selenic.com/hg#stable |
|
1320 | hg clone http://selenic.com/hg#stable | |
1321 |
|
1321 | |||
1322 | See :hg:`help urls` for details on specifying URLs. |
|
1322 | See :hg:`help urls` for details on specifying URLs. | |
1323 |
|
1323 | |||
1324 | Returns 0 on success. |
|
1324 | Returns 0 on success. | |
1325 | """ |
|
1325 | """ | |
1326 | if opts.get('noupdate') and opts.get('updaterev'): |
|
1326 | if opts.get('noupdate') and opts.get('updaterev'): | |
1327 | raise util.Abort(_("cannot specify both --noupdate and --updaterev")) |
|
1327 | raise util.Abort(_("cannot specify both --noupdate and --updaterev")) | |
1328 |
|
1328 | |||
1329 | r = hg.clone(ui, opts, source, dest, |
|
1329 | r = hg.clone(ui, opts, source, dest, | |
1330 | pull=opts.get('pull'), |
|
1330 | pull=opts.get('pull'), | |
1331 | stream=opts.get('uncompressed'), |
|
1331 | stream=opts.get('uncompressed'), | |
1332 | rev=opts.get('rev'), |
|
1332 | rev=opts.get('rev'), | |
1333 | update=opts.get('updaterev') or not opts.get('noupdate'), |
|
1333 | update=opts.get('updaterev') or not opts.get('noupdate'), | |
1334 | branch=opts.get('branch')) |
|
1334 | branch=opts.get('branch')) | |
1335 |
|
1335 | |||
1336 | return r is None |
|
1336 | return r is None | |
1337 |
|
1337 | |||
1338 | @command('^commit|ci', |
|
1338 | @command('^commit|ci', | |
1339 | [('A', 'addremove', None, |
|
1339 | [('A', 'addremove', None, | |
1340 | _('mark new/missing files as added/removed before committing')), |
|
1340 | _('mark new/missing files as added/removed before committing')), | |
1341 | ('', 'close-branch', None, |
|
1341 | ('', 'close-branch', None, | |
1342 | _('mark a branch as closed, hiding it from the branch list')), |
|
1342 | _('mark a branch as closed, hiding it from the branch list')), | |
1343 | ('', 'amend', None, _('amend the parent of the working dir')), |
|
1343 | ('', 'amend', None, _('amend the parent of the working dir')), | |
1344 | ('s', 'secret', None, _('use the secret phase for committing')), |
|
1344 | ('s', 'secret', None, _('use the secret phase for committing')), | |
1345 | ('e', 'edit', None, _('invoke editor on commit messages')), |
|
1345 | ('e', 'edit', None, _('invoke editor on commit messages')), | |
1346 | ] + walkopts + commitopts + commitopts2 + subrepoopts, |
|
1346 | ] + walkopts + commitopts + commitopts2 + subrepoopts, | |
1347 | _('[OPTION]... [FILE]...'), |
|
1347 | _('[OPTION]... [FILE]...'), | |
1348 | inferrepo=True) |
|
1348 | inferrepo=True) | |
1349 | def commit(ui, repo, *pats, **opts): |
|
1349 | def commit(ui, repo, *pats, **opts): | |
1350 | """commit the specified files or all outstanding changes |
|
1350 | """commit the specified files or all outstanding changes | |
1351 |
|
1351 | |||
1352 | Commit changes to the given files into the repository. Unlike a |
|
1352 | Commit changes to the given files into the repository. Unlike a | |
1353 | centralized SCM, this operation is a local operation. See |
|
1353 | centralized SCM, this operation is a local operation. See | |
1354 | :hg:`push` for a way to actively distribute your changes. |
|
1354 | :hg:`push` for a way to actively distribute your changes. | |
1355 |
|
1355 | |||
1356 | If a list of files is omitted, all changes reported by :hg:`status` |
|
1356 | If a list of files is omitted, all changes reported by :hg:`status` | |
1357 | will be committed. |
|
1357 | will be committed. | |
1358 |
|
1358 | |||
1359 | If you are committing the result of a merge, do not provide any |
|
1359 | If you are committing the result of a merge, do not provide any | |
1360 | filenames or -I/-X filters. |
|
1360 | filenames or -I/-X filters. | |
1361 |
|
1361 | |||
1362 | If no commit message is specified, Mercurial starts your |
|
1362 | If no commit message is specified, Mercurial starts your | |
1363 | configured editor where you can enter a message. In case your |
|
1363 | configured editor where you can enter a message. In case your | |
1364 | commit fails, you will find a backup of your message in |
|
1364 | commit fails, you will find a backup of your message in | |
1365 | ``.hg/last-message.txt``. |
|
1365 | ``.hg/last-message.txt``. | |
1366 |
|
1366 | |||
1367 | The --amend flag can be used to amend the parent of the |
|
1367 | The --amend flag can be used to amend the parent of the | |
1368 | working directory with a new commit that contains the changes |
|
1368 | working directory with a new commit that contains the changes | |
1369 | in the parent in addition to those currently reported by :hg:`status`, |
|
1369 | in the parent in addition to those currently reported by :hg:`status`, | |
1370 | if there are any. The old commit is stored in a backup bundle in |
|
1370 | if there are any. The old commit is stored in a backup bundle in | |
1371 | ``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle` |
|
1371 | ``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle` | |
1372 | on how to restore it). |
|
1372 | on how to restore it). | |
1373 |
|
1373 | |||
1374 | Message, user and date are taken from the amended commit unless |
|
1374 | Message, user and date are taken from the amended commit unless | |
1375 | specified. When a message isn't specified on the command line, |
|
1375 | specified. When a message isn't specified on the command line, | |
1376 | the editor will open with the message of the amended commit. |
|
1376 | the editor will open with the message of the amended commit. | |
1377 |
|
1377 | |||
1378 | It is not possible to amend public changesets (see :hg:`help phases`) |
|
1378 | It is not possible to amend public changesets (see :hg:`help phases`) | |
1379 | or changesets that have children. |
|
1379 | or changesets that have children. | |
1380 |
|
1380 | |||
1381 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
1381 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
1382 |
|
1382 | |||
1383 | Returns 0 on success, 1 if nothing changed. |
|
1383 | Returns 0 on success, 1 if nothing changed. | |
1384 | """ |
|
1384 | """ | |
1385 | if opts.get('subrepos'): |
|
1385 | if opts.get('subrepos'): | |
1386 | if opts.get('amend'): |
|
1386 | if opts.get('amend'): | |
1387 | raise util.Abort(_('cannot amend with --subrepos')) |
|
1387 | raise util.Abort(_('cannot amend with --subrepos')) | |
1388 | # Let --subrepos on the command line override config setting. |
|
1388 | # Let --subrepos on the command line override config setting. | |
1389 | ui.setconfig('ui', 'commitsubrepos', True, 'commit') |
|
1389 | ui.setconfig('ui', 'commitsubrepos', True, 'commit') | |
1390 |
|
1390 | |||
1391 | cmdutil.checkunfinished(repo, commit=True) |
|
1391 | cmdutil.checkunfinished(repo, commit=True) | |
1392 |
|
1392 | |||
1393 | branch = repo[None].branch() |
|
1393 | branch = repo[None].branch() | |
1394 | bheads = repo.branchheads(branch) |
|
1394 | bheads = repo.branchheads(branch) | |
1395 |
|
1395 | |||
1396 | extra = {} |
|
1396 | extra = {} | |
1397 | if opts.get('close_branch'): |
|
1397 | if opts.get('close_branch'): | |
1398 | extra['close'] = 1 |
|
1398 | extra['close'] = 1 | |
1399 |
|
1399 | |||
1400 | if not bheads: |
|
1400 | if not bheads: | |
1401 | raise util.Abort(_('can only close branch heads')) |
|
1401 | raise util.Abort(_('can only close branch heads')) | |
1402 | elif opts.get('amend'): |
|
1402 | elif opts.get('amend'): | |
1403 | if repo.parents()[0].p1().branch() != branch and \ |
|
1403 | if repo.parents()[0].p1().branch() != branch and \ | |
1404 | repo.parents()[0].p2().branch() != branch: |
|
1404 | repo.parents()[0].p2().branch() != branch: | |
1405 | raise util.Abort(_('can only close branch heads')) |
|
1405 | raise util.Abort(_('can only close branch heads')) | |
1406 |
|
1406 | |||
1407 | if opts.get('amend'): |
|
1407 | if opts.get('amend'): | |
1408 | if ui.configbool('ui', 'commitsubrepos'): |
|
1408 | if ui.configbool('ui', 'commitsubrepos'): | |
1409 | raise util.Abort(_('cannot amend with ui.commitsubrepos enabled')) |
|
1409 | raise util.Abort(_('cannot amend with ui.commitsubrepos enabled')) | |
1410 |
|
1410 | |||
1411 | old = repo['.'] |
|
1411 | old = repo['.'] | |
1412 | if not old.mutable(): |
|
1412 | if not old.mutable(): | |
1413 | raise util.Abort(_('cannot amend public changesets')) |
|
1413 | raise util.Abort(_('cannot amend public changesets')) | |
1414 | if len(repo[None].parents()) > 1: |
|
1414 | if len(repo[None].parents()) > 1: | |
1415 | raise util.Abort(_('cannot amend while merging')) |
|
1415 | raise util.Abort(_('cannot amend while merging')) | |
1416 | if (not obsolete._enabled) and old.children(): |
|
1416 | if (not obsolete._enabled) and old.children(): | |
1417 | raise util.Abort(_('cannot amend changeset with children')) |
|
1417 | raise util.Abort(_('cannot amend changeset with children')) | |
1418 |
|
1418 | |||
1419 | # commitfunc is used only for temporary amend commit by cmdutil.amend |
|
1419 | # commitfunc is used only for temporary amend commit by cmdutil.amend | |
1420 | def commitfunc(ui, repo, message, match, opts): |
|
1420 | def commitfunc(ui, repo, message, match, opts): | |
1421 | return repo.commit(message, |
|
1421 | return repo.commit(message, | |
1422 | opts.get('user') or old.user(), |
|
1422 | opts.get('user') or old.user(), | |
1423 | opts.get('date') or old.date(), |
|
1423 | opts.get('date') or old.date(), | |
1424 | match, |
|
1424 | match, | |
1425 | extra=extra) |
|
1425 | extra=extra) | |
1426 |
|
1426 | |||
1427 | current = repo._bookmarkcurrent |
|
1427 | current = repo._bookmarkcurrent | |
1428 | marks = old.bookmarks() |
|
1428 | marks = old.bookmarks() | |
1429 | node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) |
|
1429 | node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts) | |
1430 | if node == old.node(): |
|
1430 | if node == old.node(): | |
1431 | ui.status(_("nothing changed\n")) |
|
1431 | ui.status(_("nothing changed\n")) | |
1432 | return 1 |
|
1432 | return 1 | |
1433 | elif marks: |
|
1433 | elif marks: | |
1434 | ui.debug('moving bookmarks %r from %s to %s\n' % |
|
1434 | ui.debug('moving bookmarks %r from %s to %s\n' % | |
1435 | (marks, old.hex(), hex(node))) |
|
1435 | (marks, old.hex(), hex(node))) | |
1436 | newmarks = repo._bookmarks |
|
1436 | newmarks = repo._bookmarks | |
1437 | for bm in marks: |
|
1437 | for bm in marks: | |
1438 | newmarks[bm] = node |
|
1438 | newmarks[bm] = node | |
1439 | if bm == current: |
|
1439 | if bm == current: | |
1440 | bookmarks.setcurrent(repo, bm) |
|
1440 | bookmarks.setcurrent(repo, bm) | |
1441 | newmarks.write() |
|
1441 | newmarks.write() | |
1442 | else: |
|
1442 | else: | |
1443 | def commitfunc(ui, repo, message, match, opts): |
|
1443 | def commitfunc(ui, repo, message, match, opts): | |
1444 | backup = ui.backupconfig('phases', 'new-commit') |
|
1444 | backup = ui.backupconfig('phases', 'new-commit') | |
1445 | baseui = repo.baseui |
|
1445 | baseui = repo.baseui | |
1446 | basebackup = baseui.backupconfig('phases', 'new-commit') |
|
1446 | basebackup = baseui.backupconfig('phases', 'new-commit') | |
1447 | try: |
|
1447 | try: | |
1448 | if opts.get('secret'): |
|
1448 | if opts.get('secret'): | |
1449 | ui.setconfig('phases', 'new-commit', 'secret', 'commit') |
|
1449 | ui.setconfig('phases', 'new-commit', 'secret', 'commit') | |
1450 | # Propagate to subrepos |
|
1450 | # Propagate to subrepos | |
1451 | baseui.setconfig('phases', 'new-commit', 'secret', 'commit') |
|
1451 | baseui.setconfig('phases', 'new-commit', 'secret', 'commit') | |
1452 |
|
1452 | |||
1453 | editform = cmdutil.mergeeditform(repo[None], 'commit.normal') |
|
1453 | editform = cmdutil.mergeeditform(repo[None], 'commit.normal') | |
1454 | editor = cmdutil.getcommiteditor(editform=editform, **opts) |
|
1454 | editor = cmdutil.getcommiteditor(editform=editform, **opts) | |
1455 | return repo.commit(message, opts.get('user'), opts.get('date'), |
|
1455 | return repo.commit(message, opts.get('user'), opts.get('date'), | |
1456 | match, |
|
1456 | match, | |
1457 | editor=editor, |
|
1457 | editor=editor, | |
1458 | extra=extra) |
|
1458 | extra=extra) | |
1459 | finally: |
|
1459 | finally: | |
1460 | ui.restoreconfig(backup) |
|
1460 | ui.restoreconfig(backup) | |
1461 | repo.baseui.restoreconfig(basebackup) |
|
1461 | repo.baseui.restoreconfig(basebackup) | |
1462 |
|
1462 | |||
1463 |
|
1463 | |||
1464 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) |
|
1464 | node = cmdutil.commit(ui, repo, commitfunc, pats, opts) | |
1465 |
|
1465 | |||
1466 | if not node: |
|
1466 | if not node: | |
1467 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) |
|
1467 | stat = repo.status(match=scmutil.match(repo[None], pats, opts)) | |
1468 | if stat[3]: |
|
1468 | if stat[3]: | |
1469 | ui.status(_("nothing changed (%d missing files, see " |
|
1469 | ui.status(_("nothing changed (%d missing files, see " | |
1470 | "'hg status')\n") % len(stat[3])) |
|
1470 | "'hg status')\n") % len(stat[3])) | |
1471 | else: |
|
1471 | else: | |
1472 | ui.status(_("nothing changed\n")) |
|
1472 | ui.status(_("nothing changed\n")) | |
1473 | return 1 |
|
1473 | return 1 | |
1474 |
|
1474 | |||
1475 | cmdutil.commitstatus(repo, node, branch, bheads, opts) |
|
1475 | cmdutil.commitstatus(repo, node, branch, bheads, opts) | |
1476 |
|
1476 | |||
1477 | @command('config|showconfig|debugconfig', |
|
1477 | @command('config|showconfig|debugconfig', | |
1478 | [('u', 'untrusted', None, _('show untrusted configuration options')), |
|
1478 | [('u', 'untrusted', None, _('show untrusted configuration options')), | |
1479 | ('e', 'edit', None, _('edit user config')), |
|
1479 | ('e', 'edit', None, _('edit user config')), | |
1480 | ('l', 'local', None, _('edit repository config')), |
|
1480 | ('l', 'local', None, _('edit repository config')), | |
1481 | ('g', 'global', None, _('edit global config'))], |
|
1481 | ('g', 'global', None, _('edit global config'))], | |
1482 | _('[-u] [NAME]...'), |
|
1482 | _('[-u] [NAME]...'), | |
1483 | optionalrepo=True) |
|
1483 | optionalrepo=True) | |
1484 | def config(ui, repo, *values, **opts): |
|
1484 | def config(ui, repo, *values, **opts): | |
1485 | """show combined config settings from all hgrc files |
|
1485 | """show combined config settings from all hgrc files | |
1486 |
|
1486 | |||
1487 | With no arguments, print names and values of all config items. |
|
1487 | With no arguments, print names and values of all config items. | |
1488 |
|
1488 | |||
1489 | With one argument of the form section.name, print just the value |
|
1489 | With one argument of the form section.name, print just the value | |
1490 | of that config item. |
|
1490 | of that config item. | |
1491 |
|
1491 | |||
1492 | With multiple arguments, print names and values of all config |
|
1492 | With multiple arguments, print names and values of all config | |
1493 | items with matching section names. |
|
1493 | items with matching section names. | |
1494 |
|
1494 | |||
1495 | With --edit, start an editor on the user-level config file. With |
|
1495 | With --edit, start an editor on the user-level config file. With | |
1496 | --global, edit the system-wide config file. With --local, edit the |
|
1496 | --global, edit the system-wide config file. With --local, edit the | |
1497 | repository-level config file. |
|
1497 | repository-level config file. | |
1498 |
|
1498 | |||
1499 | With --debug, the source (filename and line number) is printed |
|
1499 | With --debug, the source (filename and line number) is printed | |
1500 | for each config item. |
|
1500 | for each config item. | |
1501 |
|
1501 | |||
1502 | See :hg:`help config` for more information about config files. |
|
1502 | See :hg:`help config` for more information about config files. | |
1503 |
|
1503 | |||
1504 | Returns 0 on success, 1 if NAME does not exist. |
|
1504 | Returns 0 on success, 1 if NAME does not exist. | |
1505 |
|
1505 | |||
1506 | """ |
|
1506 | """ | |
1507 |
|
1507 | |||
1508 | if opts.get('edit') or opts.get('local') or opts.get('global'): |
|
1508 | if opts.get('edit') or opts.get('local') or opts.get('global'): | |
1509 | if opts.get('local') and opts.get('global'): |
|
1509 | if opts.get('local') and opts.get('global'): | |
1510 | raise util.Abort(_("can't use --local and --global together")) |
|
1510 | raise util.Abort(_("can't use --local and --global together")) | |
1511 |
|
1511 | |||
1512 | if opts.get('local'): |
|
1512 | if opts.get('local'): | |
1513 | if not repo: |
|
1513 | if not repo: | |
1514 | raise util.Abort(_("can't use --local outside a repository")) |
|
1514 | raise util.Abort(_("can't use --local outside a repository")) | |
1515 | paths = [repo.join('hgrc')] |
|
1515 | paths = [repo.join('hgrc')] | |
1516 | elif opts.get('global'): |
|
1516 | elif opts.get('global'): | |
1517 | paths = scmutil.systemrcpath() |
|
1517 | paths = scmutil.systemrcpath() | |
1518 | else: |
|
1518 | else: | |
1519 | paths = scmutil.userrcpath() |
|
1519 | paths = scmutil.userrcpath() | |
1520 |
|
1520 | |||
1521 | for f in paths: |
|
1521 | for f in paths: | |
1522 | if os.path.exists(f): |
|
1522 | if os.path.exists(f): | |
1523 | break |
|
1523 | break | |
1524 | else: |
|
1524 | else: | |
1525 | from ui import samplehgrcs |
|
1525 | from ui import samplehgrcs | |
1526 |
|
1526 | |||
1527 | if opts.get('global'): |
|
1527 | if opts.get('global'): | |
1528 | samplehgrc = samplehgrcs['global'] |
|
1528 | samplehgrc = samplehgrcs['global'] | |
1529 | elif opts.get('local'): |
|
1529 | elif opts.get('local'): | |
1530 | samplehgrc = samplehgrcs['local'] |
|
1530 | samplehgrc = samplehgrcs['local'] | |
1531 | else: |
|
1531 | else: | |
1532 | samplehgrc = samplehgrcs['user'] |
|
1532 | samplehgrc = samplehgrcs['user'] | |
1533 |
|
1533 | |||
1534 | f = paths[0] |
|
1534 | f = paths[0] | |
1535 | fp = open(f, "w") |
|
1535 | fp = open(f, "w") | |
1536 | fp.write(samplehgrc) |
|
1536 | fp.write(samplehgrc) | |
1537 | fp.close() |
|
1537 | fp.close() | |
1538 |
|
1538 | |||
1539 | editor = ui.geteditor() |
|
1539 | editor = ui.geteditor() | |
1540 | util.system("%s \"%s\"" % (editor, f), |
|
1540 | util.system("%s \"%s\"" % (editor, f), | |
1541 | onerr=util.Abort, errprefix=_("edit failed"), |
|
1541 | onerr=util.Abort, errprefix=_("edit failed"), | |
1542 | out=ui.fout) |
|
1542 | out=ui.fout) | |
1543 | return |
|
1543 | return | |
1544 |
|
1544 | |||
1545 | for f in scmutil.rcpath(): |
|
1545 | for f in scmutil.rcpath(): | |
1546 | ui.debug('read config from: %s\n' % f) |
|
1546 | ui.debug('read config from: %s\n' % f) | |
1547 | untrusted = bool(opts.get('untrusted')) |
|
1547 | untrusted = bool(opts.get('untrusted')) | |
1548 | if values: |
|
1548 | if values: | |
1549 | sections = [v for v in values if '.' not in v] |
|
1549 | sections = [v for v in values if '.' not in v] | |
1550 | items = [v for v in values if '.' in v] |
|
1550 | items = [v for v in values if '.' in v] | |
1551 | if len(items) > 1 or items and sections: |
|
1551 | if len(items) > 1 or items and sections: | |
1552 | raise util.Abort(_('only one config item permitted')) |
|
1552 | raise util.Abort(_('only one config item permitted')) | |
1553 | matched = False |
|
1553 | matched = False | |
1554 | for section, name, value in ui.walkconfig(untrusted=untrusted): |
|
1554 | for section, name, value in ui.walkconfig(untrusted=untrusted): | |
1555 | value = str(value).replace('\n', '\\n') |
|
1555 | value = str(value).replace('\n', '\\n') | |
1556 | sectname = section + '.' + name |
|
1556 | sectname = section + '.' + name | |
1557 | if values: |
|
1557 | if values: | |
1558 | for v in values: |
|
1558 | for v in values: | |
1559 | if v == section: |
|
1559 | if v == section: | |
1560 | ui.debug('%s: ' % |
|
1560 | ui.debug('%s: ' % | |
1561 | ui.configsource(section, name, untrusted)) |
|
1561 | ui.configsource(section, name, untrusted)) | |
1562 | ui.write('%s=%s\n' % (sectname, value)) |
|
1562 | ui.write('%s=%s\n' % (sectname, value)) | |
1563 | matched = True |
|
1563 | matched = True | |
1564 | elif v == sectname: |
|
1564 | elif v == sectname: | |
1565 | ui.debug('%s: ' % |
|
1565 | ui.debug('%s: ' % | |
1566 | ui.configsource(section, name, untrusted)) |
|
1566 | ui.configsource(section, name, untrusted)) | |
1567 | ui.write(value, '\n') |
|
1567 | ui.write(value, '\n') | |
1568 | matched = True |
|
1568 | matched = True | |
1569 | else: |
|
1569 | else: | |
1570 | ui.debug('%s: ' % |
|
1570 | ui.debug('%s: ' % | |
1571 | ui.configsource(section, name, untrusted)) |
|
1571 | ui.configsource(section, name, untrusted)) | |
1572 | ui.write('%s=%s\n' % (sectname, value)) |
|
1572 | ui.write('%s=%s\n' % (sectname, value)) | |
1573 | matched = True |
|
1573 | matched = True | |
1574 | if matched: |
|
1574 | if matched: | |
1575 | return 0 |
|
1575 | return 0 | |
1576 | return 1 |
|
1576 | return 1 | |
1577 |
|
1577 | |||
1578 | @command('copy|cp', |
|
1578 | @command('copy|cp', | |
1579 | [('A', 'after', None, _('record a copy that has already occurred')), |
|
1579 | [('A', 'after', None, _('record a copy that has already occurred')), | |
1580 | ('f', 'force', None, _('forcibly copy over an existing managed file')), |
|
1580 | ('f', 'force', None, _('forcibly copy over an existing managed file')), | |
1581 | ] + walkopts + dryrunopts, |
|
1581 | ] + walkopts + dryrunopts, | |
1582 | _('[OPTION]... [SOURCE]... DEST')) |
|
1582 | _('[OPTION]... [SOURCE]... DEST')) | |
1583 | def copy(ui, repo, *pats, **opts): |
|
1583 | def copy(ui, repo, *pats, **opts): | |
1584 | """mark files as copied for the next commit |
|
1584 | """mark files as copied for the next commit | |
1585 |
|
1585 | |||
1586 | Mark dest as having copies of source files. If dest is a |
|
1586 | Mark dest as having copies of source files. If dest is a | |
1587 | directory, copies are put in that directory. If dest is a file, |
|
1587 | directory, copies are put in that directory. If dest is a file, | |
1588 | the source must be a single file. |
|
1588 | the source must be a single file. | |
1589 |
|
1589 | |||
1590 | By default, this command copies the contents of files as they |
|
1590 | By default, this command copies the contents of files as they | |
1591 | exist in the working directory. If invoked with -A/--after, the |
|
1591 | exist in the working directory. If invoked with -A/--after, the | |
1592 | operation is recorded, but no copying is performed. |
|
1592 | operation is recorded, but no copying is performed. | |
1593 |
|
1593 | |||
1594 | This command takes effect with the next commit. To undo a copy |
|
1594 | This command takes effect with the next commit. To undo a copy | |
1595 | before that, see :hg:`revert`. |
|
1595 | before that, see :hg:`revert`. | |
1596 |
|
1596 | |||
1597 | Returns 0 on success, 1 if errors are encountered. |
|
1597 | Returns 0 on success, 1 if errors are encountered. | |
1598 | """ |
|
1598 | """ | |
1599 | wlock = repo.wlock(False) |
|
1599 | wlock = repo.wlock(False) | |
1600 | try: |
|
1600 | try: | |
1601 | return cmdutil.copy(ui, repo, pats, opts) |
|
1601 | return cmdutil.copy(ui, repo, pats, opts) | |
1602 | finally: |
|
1602 | finally: | |
1603 | wlock.release() |
|
1603 | wlock.release() | |
1604 |
|
1604 | |||
1605 | @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) |
|
1605 | @command('debugancestor', [], _('[INDEX] REV1 REV2'), optionalrepo=True) | |
1606 | def debugancestor(ui, repo, *args): |
|
1606 | def debugancestor(ui, repo, *args): | |
1607 | """find the ancestor revision of two revisions in a given index""" |
|
1607 | """find the ancestor revision of two revisions in a given index""" | |
1608 | if len(args) == 3: |
|
1608 | if len(args) == 3: | |
1609 | index, rev1, rev2 = args |
|
1609 | index, rev1, rev2 = args | |
1610 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), index) |
|
1610 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), index) | |
1611 | lookup = r.lookup |
|
1611 | lookup = r.lookup | |
1612 | elif len(args) == 2: |
|
1612 | elif len(args) == 2: | |
1613 | if not repo: |
|
1613 | if not repo: | |
1614 | raise util.Abort(_("there is no Mercurial repository here " |
|
1614 | raise util.Abort(_("there is no Mercurial repository here " | |
1615 | "(.hg not found)")) |
|
1615 | "(.hg not found)")) | |
1616 | rev1, rev2 = args |
|
1616 | rev1, rev2 = args | |
1617 | r = repo.changelog |
|
1617 | r = repo.changelog | |
1618 | lookup = repo.lookup |
|
1618 | lookup = repo.lookup | |
1619 | else: |
|
1619 | else: | |
1620 | raise util.Abort(_('either two or three arguments required')) |
|
1620 | raise util.Abort(_('either two or three arguments required')) | |
1621 | a = r.ancestor(lookup(rev1), lookup(rev2)) |
|
1621 | a = r.ancestor(lookup(rev1), lookup(rev2)) | |
1622 | ui.write("%d:%s\n" % (r.rev(a), hex(a))) |
|
1622 | ui.write("%d:%s\n" % (r.rev(a), hex(a))) | |
1623 |
|
1623 | |||
1624 | @command('debugbuilddag', |
|
1624 | @command('debugbuilddag', | |
1625 | [('m', 'mergeable-file', None, _('add single file mergeable changes')), |
|
1625 | [('m', 'mergeable-file', None, _('add single file mergeable changes')), | |
1626 | ('o', 'overwritten-file', None, _('add single file all revs overwrite')), |
|
1626 | ('o', 'overwritten-file', None, _('add single file all revs overwrite')), | |
1627 | ('n', 'new-file', None, _('add new file at each rev'))], |
|
1627 | ('n', 'new-file', None, _('add new file at each rev'))], | |
1628 | _('[OPTION]... [TEXT]')) |
|
1628 | _('[OPTION]... [TEXT]')) | |
1629 | def debugbuilddag(ui, repo, text=None, |
|
1629 | def debugbuilddag(ui, repo, text=None, | |
1630 | mergeable_file=False, |
|
1630 | mergeable_file=False, | |
1631 | overwritten_file=False, |
|
1631 | overwritten_file=False, | |
1632 | new_file=False): |
|
1632 | new_file=False): | |
1633 | """builds a repo with a given DAG from scratch in the current empty repo |
|
1633 | """builds a repo with a given DAG from scratch in the current empty repo | |
1634 |
|
1634 | |||
1635 | The description of the DAG is read from stdin if not given on the |
|
1635 | The description of the DAG is read from stdin if not given on the | |
1636 | command line. |
|
1636 | command line. | |
1637 |
|
1637 | |||
1638 | Elements: |
|
1638 | Elements: | |
1639 |
|
1639 | |||
1640 | - "+n" is a linear run of n nodes based on the current default parent |
|
1640 | - "+n" is a linear run of n nodes based on the current default parent | |
1641 | - "." is a single node based on the current default parent |
|
1641 | - "." is a single node based on the current default parent | |
1642 | - "$" resets the default parent to null (implied at the start); |
|
1642 | - "$" resets the default parent to null (implied at the start); | |
1643 | otherwise the default parent is always the last node created |
|
1643 | otherwise the default parent is always the last node created | |
1644 | - "<p" sets the default parent to the backref p |
|
1644 | - "<p" sets the default parent to the backref p | |
1645 | - "*p" is a fork at parent p, which is a backref |
|
1645 | - "*p" is a fork at parent p, which is a backref | |
1646 | - "*p1/p2" is a merge of parents p1 and p2, which are backrefs |
|
1646 | - "*p1/p2" is a merge of parents p1 and p2, which are backrefs | |
1647 | - "/p2" is a merge of the preceding node and p2 |
|
1647 | - "/p2" is a merge of the preceding node and p2 | |
1648 | - ":tag" defines a local tag for the preceding node |
|
1648 | - ":tag" defines a local tag for the preceding node | |
1649 | - "@branch" sets the named branch for subsequent nodes |
|
1649 | - "@branch" sets the named branch for subsequent nodes | |
1650 | - "#...\\n" is a comment up to the end of the line |
|
1650 | - "#...\\n" is a comment up to the end of the line | |
1651 |
|
1651 | |||
1652 | Whitespace between the above elements is ignored. |
|
1652 | Whitespace between the above elements is ignored. | |
1653 |
|
1653 | |||
1654 | A backref is either |
|
1654 | A backref is either | |
1655 |
|
1655 | |||
1656 | - a number n, which references the node curr-n, where curr is the current |
|
1656 | - a number n, which references the node curr-n, where curr is the current | |
1657 | node, or |
|
1657 | node, or | |
1658 | - the name of a local tag you placed earlier using ":tag", or |
|
1658 | - the name of a local tag you placed earlier using ":tag", or | |
1659 | - empty to denote the default parent. |
|
1659 | - empty to denote the default parent. | |
1660 |
|
1660 | |||
1661 | All string valued-elements are either strictly alphanumeric, or must |
|
1661 | All string valued-elements are either strictly alphanumeric, or must | |
1662 | be enclosed in double quotes ("..."), with "\\" as escape character. |
|
1662 | be enclosed in double quotes ("..."), with "\\" as escape character. | |
1663 | """ |
|
1663 | """ | |
1664 |
|
1664 | |||
1665 | if text is None: |
|
1665 | if text is None: | |
1666 | ui.status(_("reading DAG from stdin\n")) |
|
1666 | ui.status(_("reading DAG from stdin\n")) | |
1667 | text = ui.fin.read() |
|
1667 | text = ui.fin.read() | |
1668 |
|
1668 | |||
1669 | cl = repo.changelog |
|
1669 | cl = repo.changelog | |
1670 | if len(cl) > 0: |
|
1670 | if len(cl) > 0: | |
1671 | raise util.Abort(_('repository is not empty')) |
|
1671 | raise util.Abort(_('repository is not empty')) | |
1672 |
|
1672 | |||
1673 | # determine number of revs in DAG |
|
1673 | # determine number of revs in DAG | |
1674 | total = 0 |
|
1674 | total = 0 | |
1675 | for type, data in dagparser.parsedag(text): |
|
1675 | for type, data in dagparser.parsedag(text): | |
1676 | if type == 'n': |
|
1676 | if type == 'n': | |
1677 | total += 1 |
|
1677 | total += 1 | |
1678 |
|
1678 | |||
1679 | if mergeable_file: |
|
1679 | if mergeable_file: | |
1680 | linesperrev = 2 |
|
1680 | linesperrev = 2 | |
1681 | # make a file with k lines per rev |
|
1681 | # make a file with k lines per rev | |
1682 | initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)] |
|
1682 | initialmergedlines = [str(i) for i in xrange(0, total * linesperrev)] | |
1683 | initialmergedlines.append("") |
|
1683 | initialmergedlines.append("") | |
1684 |
|
1684 | |||
1685 | tags = [] |
|
1685 | tags = [] | |
1686 |
|
1686 | |||
1687 | lock = tr = None |
|
1687 | lock = tr = None | |
1688 | try: |
|
1688 | try: | |
1689 | lock = repo.lock() |
|
1689 | lock = repo.lock() | |
1690 | tr = repo.transaction("builddag") |
|
1690 | tr = repo.transaction("builddag") | |
1691 |
|
1691 | |||
1692 | at = -1 |
|
1692 | at = -1 | |
1693 | atbranch = 'default' |
|
1693 | atbranch = 'default' | |
1694 | nodeids = [] |
|
1694 | nodeids = [] | |
1695 | id = 0 |
|
1695 | id = 0 | |
1696 | ui.progress(_('building'), id, unit=_('revisions'), total=total) |
|
1696 | ui.progress(_('building'), id, unit=_('revisions'), total=total) | |
1697 | for type, data in dagparser.parsedag(text): |
|
1697 | for type, data in dagparser.parsedag(text): | |
1698 | if type == 'n': |
|
1698 | if type == 'n': | |
1699 | ui.note(('node %s\n' % str(data))) |
|
1699 | ui.note(('node %s\n' % str(data))) | |
1700 | id, ps = data |
|
1700 | id, ps = data | |
1701 |
|
1701 | |||
1702 | files = [] |
|
1702 | files = [] | |
1703 | fctxs = {} |
|
1703 | fctxs = {} | |
1704 |
|
1704 | |||
1705 | p2 = None |
|
1705 | p2 = None | |
1706 | if mergeable_file: |
|
1706 | if mergeable_file: | |
1707 | fn = "mf" |
|
1707 | fn = "mf" | |
1708 | p1 = repo[ps[0]] |
|
1708 | p1 = repo[ps[0]] | |
1709 | if len(ps) > 1: |
|
1709 | if len(ps) > 1: | |
1710 | p2 = repo[ps[1]] |
|
1710 | p2 = repo[ps[1]] | |
1711 | pa = p1.ancestor(p2) |
|
1711 | pa = p1.ancestor(p2) | |
1712 | base, local, other = [x[fn].data() for x in (pa, p1, |
|
1712 | base, local, other = [x[fn].data() for x in (pa, p1, | |
1713 | p2)] |
|
1713 | p2)] | |
1714 | m3 = simplemerge.Merge3Text(base, local, other) |
|
1714 | m3 = simplemerge.Merge3Text(base, local, other) | |
1715 | ml = [l.strip() for l in m3.merge_lines()] |
|
1715 | ml = [l.strip() for l in m3.merge_lines()] | |
1716 | ml.append("") |
|
1716 | ml.append("") | |
1717 | elif at > 0: |
|
1717 | elif at > 0: | |
1718 | ml = p1[fn].data().split("\n") |
|
1718 | ml = p1[fn].data().split("\n") | |
1719 | else: |
|
1719 | else: | |
1720 | ml = initialmergedlines |
|
1720 | ml = initialmergedlines | |
1721 | ml[id * linesperrev] += " r%i" % id |
|
1721 | ml[id * linesperrev] += " r%i" % id | |
1722 | mergedtext = "\n".join(ml) |
|
1722 | mergedtext = "\n".join(ml) | |
1723 | files.append(fn) |
|
1723 | files.append(fn) | |
1724 | fctxs[fn] = context.memfilectx(repo, fn, mergedtext) |
|
1724 | fctxs[fn] = context.memfilectx(repo, fn, mergedtext) | |
1725 |
|
1725 | |||
1726 | if overwritten_file: |
|
1726 | if overwritten_file: | |
1727 | fn = "of" |
|
1727 | fn = "of" | |
1728 | files.append(fn) |
|
1728 | files.append(fn) | |
1729 | fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) |
|
1729 | fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) | |
1730 |
|
1730 | |||
1731 | if new_file: |
|
1731 | if new_file: | |
1732 | fn = "nf%i" % id |
|
1732 | fn = "nf%i" % id | |
1733 | files.append(fn) |
|
1733 | files.append(fn) | |
1734 | fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) |
|
1734 | fctxs[fn] = context.memfilectx(repo, fn, "r%i\n" % id) | |
1735 | if len(ps) > 1: |
|
1735 | if len(ps) > 1: | |
1736 | if not p2: |
|
1736 | if not p2: | |
1737 | p2 = repo[ps[1]] |
|
1737 | p2 = repo[ps[1]] | |
1738 | for fn in p2: |
|
1738 | for fn in p2: | |
1739 | if fn.startswith("nf"): |
|
1739 | if fn.startswith("nf"): | |
1740 | files.append(fn) |
|
1740 | files.append(fn) | |
1741 | fctxs[fn] = p2[fn] |
|
1741 | fctxs[fn] = p2[fn] | |
1742 |
|
1742 | |||
1743 | def fctxfn(repo, cx, path): |
|
1743 | def fctxfn(repo, cx, path): | |
1744 | return fctxs.get(path) |
|
1744 | return fctxs.get(path) | |
1745 |
|
1745 | |||
1746 | if len(ps) == 0 or ps[0] < 0: |
|
1746 | if len(ps) == 0 or ps[0] < 0: | |
1747 | pars = [None, None] |
|
1747 | pars = [None, None] | |
1748 | elif len(ps) == 1: |
|
1748 | elif len(ps) == 1: | |
1749 | pars = [nodeids[ps[0]], None] |
|
1749 | pars = [nodeids[ps[0]], None] | |
1750 | else: |
|
1750 | else: | |
1751 | pars = [nodeids[p] for p in ps] |
|
1751 | pars = [nodeids[p] for p in ps] | |
1752 | cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, |
|
1752 | cx = context.memctx(repo, pars, "r%i" % id, files, fctxfn, | |
1753 | date=(id, 0), |
|
1753 | date=(id, 0), | |
1754 | user="debugbuilddag", |
|
1754 | user="debugbuilddag", | |
1755 | extra={'branch': atbranch}) |
|
1755 | extra={'branch': atbranch}) | |
1756 | nodeid = repo.commitctx(cx) |
|
1756 | nodeid = repo.commitctx(cx) | |
1757 | nodeids.append(nodeid) |
|
1757 | nodeids.append(nodeid) | |
1758 | at = id |
|
1758 | at = id | |
1759 | elif type == 'l': |
|
1759 | elif type == 'l': | |
1760 | id, name = data |
|
1760 | id, name = data | |
1761 | ui.note(('tag %s\n' % name)) |
|
1761 | ui.note(('tag %s\n' % name)) | |
1762 | tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) |
|
1762 | tags.append("%s %s\n" % (hex(repo.changelog.node(id)), name)) | |
1763 | elif type == 'a': |
|
1763 | elif type == 'a': | |
1764 | ui.note(('branch %s\n' % data)) |
|
1764 | ui.note(('branch %s\n' % data)) | |
1765 | atbranch = data |
|
1765 | atbranch = data | |
1766 | ui.progress(_('building'), id, unit=_('revisions'), total=total) |
|
1766 | ui.progress(_('building'), id, unit=_('revisions'), total=total) | |
1767 | tr.close() |
|
1767 | tr.close() | |
1768 |
|
1768 | |||
1769 | if tags: |
|
1769 | if tags: | |
1770 | repo.opener.write("localtags", "".join(tags)) |
|
1770 | repo.opener.write("localtags", "".join(tags)) | |
1771 | finally: |
|
1771 | finally: | |
1772 | ui.progress(_('building'), None) |
|
1772 | ui.progress(_('building'), None) | |
1773 | release(tr, lock) |
|
1773 | release(tr, lock) | |
1774 |
|
1774 | |||
1775 | @command('debugbundle', |
|
1775 | @command('debugbundle', | |
1776 | [('a', 'all', None, _('show all details'))], |
|
1776 | [('a', 'all', None, _('show all details'))], | |
1777 | _('FILE'), |
|
1777 | _('FILE'), | |
1778 | norepo=True) |
|
1778 | norepo=True) | |
1779 | def debugbundle(ui, bundlepath, all=None, **opts): |
|
1779 | def debugbundle(ui, bundlepath, all=None, **opts): | |
1780 | """lists the contents of a bundle""" |
|
1780 | """lists the contents of a bundle""" | |
1781 | f = hg.openpath(ui, bundlepath) |
|
1781 | f = hg.openpath(ui, bundlepath) | |
1782 | try: |
|
1782 | try: | |
1783 | gen = exchange.readbundle(ui, f, bundlepath) |
|
1783 | gen = exchange.readbundle(ui, f, bundlepath) | |
1784 | if all: |
|
1784 | if all: | |
1785 | ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n")) |
|
1785 | ui.write(("format: id, p1, p2, cset, delta base, len(delta)\n")) | |
1786 |
|
1786 | |||
1787 | def showchunks(named): |
|
1787 | def showchunks(named): | |
1788 | ui.write("\n%s\n" % named) |
|
1788 | ui.write("\n%s\n" % named) | |
1789 | chain = None |
|
1789 | chain = None | |
1790 | while True: |
|
1790 | while True: | |
1791 | chunkdata = gen.deltachunk(chain) |
|
1791 | chunkdata = gen.deltachunk(chain) | |
1792 | if not chunkdata: |
|
1792 | if not chunkdata: | |
1793 | break |
|
1793 | break | |
1794 | node = chunkdata['node'] |
|
1794 | node = chunkdata['node'] | |
1795 | p1 = chunkdata['p1'] |
|
1795 | p1 = chunkdata['p1'] | |
1796 | p2 = chunkdata['p2'] |
|
1796 | p2 = chunkdata['p2'] | |
1797 | cs = chunkdata['cs'] |
|
1797 | cs = chunkdata['cs'] | |
1798 | deltabase = chunkdata['deltabase'] |
|
1798 | deltabase = chunkdata['deltabase'] | |
1799 | delta = chunkdata['delta'] |
|
1799 | delta = chunkdata['delta'] | |
1800 | ui.write("%s %s %s %s %s %s\n" % |
|
1800 | ui.write("%s %s %s %s %s %s\n" % | |
1801 | (hex(node), hex(p1), hex(p2), |
|
1801 | (hex(node), hex(p1), hex(p2), | |
1802 | hex(cs), hex(deltabase), len(delta))) |
|
1802 | hex(cs), hex(deltabase), len(delta))) | |
1803 | chain = node |
|
1803 | chain = node | |
1804 |
|
1804 | |||
1805 | chunkdata = gen.changelogheader() |
|
1805 | chunkdata = gen.changelogheader() | |
1806 | showchunks("changelog") |
|
1806 | showchunks("changelog") | |
1807 | chunkdata = gen.manifestheader() |
|
1807 | chunkdata = gen.manifestheader() | |
1808 | showchunks("manifest") |
|
1808 | showchunks("manifest") | |
1809 | while True: |
|
1809 | while True: | |
1810 | chunkdata = gen.filelogheader() |
|
1810 | chunkdata = gen.filelogheader() | |
1811 | if not chunkdata: |
|
1811 | if not chunkdata: | |
1812 | break |
|
1812 | break | |
1813 | fname = chunkdata['filename'] |
|
1813 | fname = chunkdata['filename'] | |
1814 | showchunks(fname) |
|
1814 | showchunks(fname) | |
1815 | else: |
|
1815 | else: | |
1816 | chunkdata = gen.changelogheader() |
|
1816 | chunkdata = gen.changelogheader() | |
1817 | chain = None |
|
1817 | chain = None | |
1818 | while True: |
|
1818 | while True: | |
1819 | chunkdata = gen.deltachunk(chain) |
|
1819 | chunkdata = gen.deltachunk(chain) | |
1820 | if not chunkdata: |
|
1820 | if not chunkdata: | |
1821 | break |
|
1821 | break | |
1822 | node = chunkdata['node'] |
|
1822 | node = chunkdata['node'] | |
1823 | ui.write("%s\n" % hex(node)) |
|
1823 | ui.write("%s\n" % hex(node)) | |
1824 | chain = node |
|
1824 | chain = node | |
1825 | finally: |
|
1825 | finally: | |
1826 | f.close() |
|
1826 | f.close() | |
1827 |
|
1827 | |||
1828 | @command('debugcheckstate', [], '') |
|
1828 | @command('debugcheckstate', [], '') | |
1829 | def debugcheckstate(ui, repo): |
|
1829 | def debugcheckstate(ui, repo): | |
1830 | """validate the correctness of the current dirstate""" |
|
1830 | """validate the correctness of the current dirstate""" | |
1831 | parent1, parent2 = repo.dirstate.parents() |
|
1831 | parent1, parent2 = repo.dirstate.parents() | |
1832 | m1 = repo[parent1].manifest() |
|
1832 | m1 = repo[parent1].manifest() | |
1833 | m2 = repo[parent2].manifest() |
|
1833 | m2 = repo[parent2].manifest() | |
1834 | errors = 0 |
|
1834 | errors = 0 | |
1835 | for f in repo.dirstate: |
|
1835 | for f in repo.dirstate: | |
1836 | state = repo.dirstate[f] |
|
1836 | state = repo.dirstate[f] | |
1837 | if state in "nr" and f not in m1: |
|
1837 | if state in "nr" and f not in m1: | |
1838 | ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) |
|
1838 | ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state)) | |
1839 | errors += 1 |
|
1839 | errors += 1 | |
1840 | if state in "a" and f in m1: |
|
1840 | if state in "a" and f in m1: | |
1841 | ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) |
|
1841 | ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state)) | |
1842 | errors += 1 |
|
1842 | errors += 1 | |
1843 | if state in "m" and f not in m1 and f not in m2: |
|
1843 | if state in "m" and f not in m1 and f not in m2: | |
1844 | ui.warn(_("%s in state %s, but not in either manifest\n") % |
|
1844 | ui.warn(_("%s in state %s, but not in either manifest\n") % | |
1845 | (f, state)) |
|
1845 | (f, state)) | |
1846 | errors += 1 |
|
1846 | errors += 1 | |
1847 | for f in m1: |
|
1847 | for f in m1: | |
1848 | state = repo.dirstate[f] |
|
1848 | state = repo.dirstate[f] | |
1849 | if state not in "nrm": |
|
1849 | if state not in "nrm": | |
1850 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) |
|
1850 | ui.warn(_("%s in manifest1, but listed as state %s") % (f, state)) | |
1851 | errors += 1 |
|
1851 | errors += 1 | |
1852 | if errors: |
|
1852 | if errors: | |
1853 | error = _(".hg/dirstate inconsistent with current parent's manifest") |
|
1853 | error = _(".hg/dirstate inconsistent with current parent's manifest") | |
1854 | raise util.Abort(error) |
|
1854 | raise util.Abort(error) | |
1855 |
|
1855 | |||
1856 | @command('debugcommands', [], _('[COMMAND]'), norepo=True) |
|
1856 | @command('debugcommands', [], _('[COMMAND]'), norepo=True) | |
1857 | def debugcommands(ui, cmd='', *args): |
|
1857 | def debugcommands(ui, cmd='', *args): | |
1858 | """list all available commands and options""" |
|
1858 | """list all available commands and options""" | |
1859 | for cmd, vals in sorted(table.iteritems()): |
|
1859 | for cmd, vals in sorted(table.iteritems()): | |
1860 | cmd = cmd.split('|')[0].strip('^') |
|
1860 | cmd = cmd.split('|')[0].strip('^') | |
1861 | opts = ', '.join([i[1] for i in vals[1]]) |
|
1861 | opts = ', '.join([i[1] for i in vals[1]]) | |
1862 | ui.write('%s: %s\n' % (cmd, opts)) |
|
1862 | ui.write('%s: %s\n' % (cmd, opts)) | |
1863 |
|
1863 | |||
1864 | @command('debugcomplete', |
|
1864 | @command('debugcomplete', | |
1865 | [('o', 'options', None, _('show the command options'))], |
|
1865 | [('o', 'options', None, _('show the command options'))], | |
1866 | _('[-o] CMD'), |
|
1866 | _('[-o] CMD'), | |
1867 | norepo=True) |
|
1867 | norepo=True) | |
1868 | def debugcomplete(ui, cmd='', **opts): |
|
1868 | def debugcomplete(ui, cmd='', **opts): | |
1869 | """returns the completion list associated with the given command""" |
|
1869 | """returns the completion list associated with the given command""" | |
1870 |
|
1870 | |||
1871 | if opts.get('options'): |
|
1871 | if opts.get('options'): | |
1872 | options = [] |
|
1872 | options = [] | |
1873 | otables = [globalopts] |
|
1873 | otables = [globalopts] | |
1874 | if cmd: |
|
1874 | if cmd: | |
1875 | aliases, entry = cmdutil.findcmd(cmd, table, False) |
|
1875 | aliases, entry = cmdutil.findcmd(cmd, table, False) | |
1876 | otables.append(entry[1]) |
|
1876 | otables.append(entry[1]) | |
1877 | for t in otables: |
|
1877 | for t in otables: | |
1878 | for o in t: |
|
1878 | for o in t: | |
1879 | if "(DEPRECATED)" in o[3]: |
|
1879 | if "(DEPRECATED)" in o[3]: | |
1880 | continue |
|
1880 | continue | |
1881 | if o[0]: |
|
1881 | if o[0]: | |
1882 | options.append('-%s' % o[0]) |
|
1882 | options.append('-%s' % o[0]) | |
1883 | options.append('--%s' % o[1]) |
|
1883 | options.append('--%s' % o[1]) | |
1884 | ui.write("%s\n" % "\n".join(options)) |
|
1884 | ui.write("%s\n" % "\n".join(options)) | |
1885 | return |
|
1885 | return | |
1886 |
|
1886 | |||
1887 | cmdlist = cmdutil.findpossible(cmd, table) |
|
1887 | cmdlist = cmdutil.findpossible(cmd, table) | |
1888 | if ui.verbose: |
|
1888 | if ui.verbose: | |
1889 | cmdlist = [' '.join(c[0]) for c in cmdlist.values()] |
|
1889 | cmdlist = [' '.join(c[0]) for c in cmdlist.values()] | |
1890 | ui.write("%s\n" % "\n".join(sorted(cmdlist))) |
|
1890 | ui.write("%s\n" % "\n".join(sorted(cmdlist))) | |
1891 |
|
1891 | |||
1892 | @command('debugdag', |
|
1892 | @command('debugdag', | |
1893 | [('t', 'tags', None, _('use tags as labels')), |
|
1893 | [('t', 'tags', None, _('use tags as labels')), | |
1894 | ('b', 'branches', None, _('annotate with branch names')), |
|
1894 | ('b', 'branches', None, _('annotate with branch names')), | |
1895 | ('', 'dots', None, _('use dots for runs')), |
|
1895 | ('', 'dots', None, _('use dots for runs')), | |
1896 | ('s', 'spaces', None, _('separate elements by spaces'))], |
|
1896 | ('s', 'spaces', None, _('separate elements by spaces'))], | |
1897 | _('[OPTION]... [FILE [REV]...]'), |
|
1897 | _('[OPTION]... [FILE [REV]...]'), | |
1898 | optionalrepo=True) |
|
1898 | optionalrepo=True) | |
1899 | def debugdag(ui, repo, file_=None, *revs, **opts): |
|
1899 | def debugdag(ui, repo, file_=None, *revs, **opts): | |
1900 | """format the changelog or an index DAG as a concise textual description |
|
1900 | """format the changelog or an index DAG as a concise textual description | |
1901 |
|
1901 | |||
1902 | If you pass a revlog index, the revlog's DAG is emitted. If you list |
|
1902 | If you pass a revlog index, the revlog's DAG is emitted. If you list | |
1903 | revision numbers, they get labeled in the output as rN. |
|
1903 | revision numbers, they get labeled in the output as rN. | |
1904 |
|
1904 | |||
1905 | Otherwise, the changelog DAG of the current repo is emitted. |
|
1905 | Otherwise, the changelog DAG of the current repo is emitted. | |
1906 | """ |
|
1906 | """ | |
1907 | spaces = opts.get('spaces') |
|
1907 | spaces = opts.get('spaces') | |
1908 | dots = opts.get('dots') |
|
1908 | dots = opts.get('dots') | |
1909 | if file_: |
|
1909 | if file_: | |
1910 | rlog = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) |
|
1910 | rlog = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) | |
1911 | revs = set((int(r) for r in revs)) |
|
1911 | revs = set((int(r) for r in revs)) | |
1912 | def events(): |
|
1912 | def events(): | |
1913 | for r in rlog: |
|
1913 | for r in rlog: | |
1914 | yield 'n', (r, list(p for p in rlog.parentrevs(r) |
|
1914 | yield 'n', (r, list(p for p in rlog.parentrevs(r) | |
1915 | if p != -1)) |
|
1915 | if p != -1)) | |
1916 | if r in revs: |
|
1916 | if r in revs: | |
1917 | yield 'l', (r, "r%i" % r) |
|
1917 | yield 'l', (r, "r%i" % r) | |
1918 | elif repo: |
|
1918 | elif repo: | |
1919 | cl = repo.changelog |
|
1919 | cl = repo.changelog | |
1920 | tags = opts.get('tags') |
|
1920 | tags = opts.get('tags') | |
1921 | branches = opts.get('branches') |
|
1921 | branches = opts.get('branches') | |
1922 | if tags: |
|
1922 | if tags: | |
1923 | labels = {} |
|
1923 | labels = {} | |
1924 | for l, n in repo.tags().items(): |
|
1924 | for l, n in repo.tags().items(): | |
1925 | labels.setdefault(cl.rev(n), []).append(l) |
|
1925 | labels.setdefault(cl.rev(n), []).append(l) | |
1926 | def events(): |
|
1926 | def events(): | |
1927 | b = "default" |
|
1927 | b = "default" | |
1928 | for r in cl: |
|
1928 | for r in cl: | |
1929 | if branches: |
|
1929 | if branches: | |
1930 | newb = cl.read(cl.node(r))[5]['branch'] |
|
1930 | newb = cl.read(cl.node(r))[5]['branch'] | |
1931 | if newb != b: |
|
1931 | if newb != b: | |
1932 | yield 'a', newb |
|
1932 | yield 'a', newb | |
1933 | b = newb |
|
1933 | b = newb | |
1934 | yield 'n', (r, list(p for p in cl.parentrevs(r) |
|
1934 | yield 'n', (r, list(p for p in cl.parentrevs(r) | |
1935 | if p != -1)) |
|
1935 | if p != -1)) | |
1936 | if tags: |
|
1936 | if tags: | |
1937 | ls = labels.get(r) |
|
1937 | ls = labels.get(r) | |
1938 | if ls: |
|
1938 | if ls: | |
1939 | for l in ls: |
|
1939 | for l in ls: | |
1940 | yield 'l', (r, l) |
|
1940 | yield 'l', (r, l) | |
1941 | else: |
|
1941 | else: | |
1942 | raise util.Abort(_('need repo for changelog dag')) |
|
1942 | raise util.Abort(_('need repo for changelog dag')) | |
1943 |
|
1943 | |||
1944 | for line in dagparser.dagtextlines(events(), |
|
1944 | for line in dagparser.dagtextlines(events(), | |
1945 | addspaces=spaces, |
|
1945 | addspaces=spaces, | |
1946 | wraplabels=True, |
|
1946 | wraplabels=True, | |
1947 | wrapannotations=True, |
|
1947 | wrapannotations=True, | |
1948 | wrapnonlinear=dots, |
|
1948 | wrapnonlinear=dots, | |
1949 | usedots=dots, |
|
1949 | usedots=dots, | |
1950 | maxlinewidth=70): |
|
1950 | maxlinewidth=70): | |
1951 | ui.write(line) |
|
1951 | ui.write(line) | |
1952 | ui.write("\n") |
|
1952 | ui.write("\n") | |
1953 |
|
1953 | |||
1954 | @command('debugdata', |
|
1954 | @command('debugdata', | |
1955 | [('c', 'changelog', False, _('open changelog')), |
|
1955 | [('c', 'changelog', False, _('open changelog')), | |
1956 | ('m', 'manifest', False, _('open manifest'))], |
|
1956 | ('m', 'manifest', False, _('open manifest'))], | |
1957 | _('-c|-m|FILE REV')) |
|
1957 | _('-c|-m|FILE REV')) | |
1958 | def debugdata(ui, repo, file_, rev=None, **opts): |
|
1958 | def debugdata(ui, repo, file_, rev=None, **opts): | |
1959 | """dump the contents of a data file revision""" |
|
1959 | """dump the contents of a data file revision""" | |
1960 | if opts.get('changelog') or opts.get('manifest'): |
|
1960 | if opts.get('changelog') or opts.get('manifest'): | |
1961 | file_, rev = None, file_ |
|
1961 | file_, rev = None, file_ | |
1962 | elif rev is None: |
|
1962 | elif rev is None: | |
1963 | raise error.CommandError('debugdata', _('invalid arguments')) |
|
1963 | raise error.CommandError('debugdata', _('invalid arguments')) | |
1964 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) |
|
1964 | r = cmdutil.openrevlog(repo, 'debugdata', file_, opts) | |
1965 | try: |
|
1965 | try: | |
1966 | ui.write(r.revision(r.lookup(rev))) |
|
1966 | ui.write(r.revision(r.lookup(rev))) | |
1967 | except KeyError: |
|
1967 | except KeyError: | |
1968 | raise util.Abort(_('invalid revision identifier %s') % rev) |
|
1968 | raise util.Abort(_('invalid revision identifier %s') % rev) | |
1969 |
|
1969 | |||
1970 | @command('debugdate', |
|
1970 | @command('debugdate', | |
1971 | [('e', 'extended', None, _('try extended date formats'))], |
|
1971 | [('e', 'extended', None, _('try extended date formats'))], | |
1972 | _('[-e] DATE [RANGE]'), |
|
1972 | _('[-e] DATE [RANGE]'), | |
1973 | norepo=True, optionalrepo=True) |
|
1973 | norepo=True, optionalrepo=True) | |
1974 | def debugdate(ui, date, range=None, **opts): |
|
1974 | def debugdate(ui, date, range=None, **opts): | |
1975 | """parse and display a date""" |
|
1975 | """parse and display a date""" | |
1976 | if opts["extended"]: |
|
1976 | if opts["extended"]: | |
1977 | d = util.parsedate(date, util.extendeddateformats) |
|
1977 | d = util.parsedate(date, util.extendeddateformats) | |
1978 | else: |
|
1978 | else: | |
1979 | d = util.parsedate(date) |
|
1979 | d = util.parsedate(date) | |
1980 | ui.write(("internal: %s %s\n") % d) |
|
1980 | ui.write(("internal: %s %s\n") % d) | |
1981 | ui.write(("standard: %s\n") % util.datestr(d)) |
|
1981 | ui.write(("standard: %s\n") % util.datestr(d)) | |
1982 | if range: |
|
1982 | if range: | |
1983 | m = util.matchdate(range) |
|
1983 | m = util.matchdate(range) | |
1984 | ui.write(("match: %s\n") % m(d[0])) |
|
1984 | ui.write(("match: %s\n") % m(d[0])) | |
1985 |
|
1985 | |||
1986 | @command('debugdiscovery', |
|
1986 | @command('debugdiscovery', | |
1987 | [('', 'old', None, _('use old-style discovery')), |
|
1987 | [('', 'old', None, _('use old-style discovery')), | |
1988 | ('', 'nonheads', None, |
|
1988 | ('', 'nonheads', None, | |
1989 | _('use old-style discovery with non-heads included')), |
|
1989 | _('use old-style discovery with non-heads included')), | |
1990 | ] + remoteopts, |
|
1990 | ] + remoteopts, | |
1991 | _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]')) |
|
1991 | _('[-l REV] [-r REV] [-b BRANCH]... [OTHER]')) | |
1992 | def debugdiscovery(ui, repo, remoteurl="default", **opts): |
|
1992 | def debugdiscovery(ui, repo, remoteurl="default", **opts): | |
1993 | """runs the changeset discovery protocol in isolation""" |
|
1993 | """runs the changeset discovery protocol in isolation""" | |
1994 | remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), |
|
1994 | remoteurl, branches = hg.parseurl(ui.expandpath(remoteurl), | |
1995 | opts.get('branch')) |
|
1995 | opts.get('branch')) | |
1996 | remote = hg.peer(repo, opts, remoteurl) |
|
1996 | remote = hg.peer(repo, opts, remoteurl) | |
1997 | ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) |
|
1997 | ui.status(_('comparing with %s\n') % util.hidepassword(remoteurl)) | |
1998 |
|
1998 | |||
1999 | # make sure tests are repeatable |
|
1999 | # make sure tests are repeatable | |
2000 | random.seed(12323) |
|
2000 | random.seed(12323) | |
2001 |
|
2001 | |||
2002 | def doit(localheads, remoteheads, remote=remote): |
|
2002 | def doit(localheads, remoteheads, remote=remote): | |
2003 | if opts.get('old'): |
|
2003 | if opts.get('old'): | |
2004 | if localheads: |
|
2004 | if localheads: | |
2005 | raise util.Abort('cannot use localheads with old style ' |
|
2005 | raise util.Abort('cannot use localheads with old style ' | |
2006 | 'discovery') |
|
2006 | 'discovery') | |
2007 | if not util.safehasattr(remote, 'branches'): |
|
2007 | if not util.safehasattr(remote, 'branches'): | |
2008 | # enable in-client legacy support |
|
2008 | # enable in-client legacy support | |
2009 | remote = localrepo.locallegacypeer(remote.local()) |
|
2009 | remote = localrepo.locallegacypeer(remote.local()) | |
2010 | common, _in, hds = treediscovery.findcommonincoming(repo, remote, |
|
2010 | common, _in, hds = treediscovery.findcommonincoming(repo, remote, | |
2011 | force=True) |
|
2011 | force=True) | |
2012 | common = set(common) |
|
2012 | common = set(common) | |
2013 | if not opts.get('nonheads'): |
|
2013 | if not opts.get('nonheads'): | |
2014 | ui.write(("unpruned common: %s\n") % |
|
2014 | ui.write(("unpruned common: %s\n") % | |
2015 | " ".join(sorted(short(n) for n in common))) |
|
2015 | " ".join(sorted(short(n) for n in common))) | |
2016 | dag = dagutil.revlogdag(repo.changelog) |
|
2016 | dag = dagutil.revlogdag(repo.changelog) | |
2017 | all = dag.ancestorset(dag.internalizeall(common)) |
|
2017 | all = dag.ancestorset(dag.internalizeall(common)) | |
2018 | common = dag.externalizeall(dag.headsetofconnecteds(all)) |
|
2018 | common = dag.externalizeall(dag.headsetofconnecteds(all)) | |
2019 | else: |
|
2019 | else: | |
2020 | common, any, hds = setdiscovery.findcommonheads(ui, repo, remote) |
|
2020 | common, any, hds = setdiscovery.findcommonheads(ui, repo, remote) | |
2021 | common = set(common) |
|
2021 | common = set(common) | |
2022 | rheads = set(hds) |
|
2022 | rheads = set(hds) | |
2023 | lheads = set(repo.heads()) |
|
2023 | lheads = set(repo.heads()) | |
2024 | ui.write(("common heads: %s\n") % |
|
2024 | ui.write(("common heads: %s\n") % | |
2025 | " ".join(sorted(short(n) for n in common))) |
|
2025 | " ".join(sorted(short(n) for n in common))) | |
2026 | if lheads <= common: |
|
2026 | if lheads <= common: | |
2027 | ui.write(("local is subset\n")) |
|
2027 | ui.write(("local is subset\n")) | |
2028 | elif rheads <= common: |
|
2028 | elif rheads <= common: | |
2029 | ui.write(("remote is subset\n")) |
|
2029 | ui.write(("remote is subset\n")) | |
2030 |
|
2030 | |||
2031 | serverlogs = opts.get('serverlog') |
|
2031 | serverlogs = opts.get('serverlog') | |
2032 | if serverlogs: |
|
2032 | if serverlogs: | |
2033 | for filename in serverlogs: |
|
2033 | for filename in serverlogs: | |
2034 | logfile = open(filename, 'r') |
|
2034 | logfile = open(filename, 'r') | |
2035 | try: |
|
2035 | try: | |
2036 | line = logfile.readline() |
|
2036 | line = logfile.readline() | |
2037 | while line: |
|
2037 | while line: | |
2038 | parts = line.strip().split(';') |
|
2038 | parts = line.strip().split(';') | |
2039 | op = parts[1] |
|
2039 | op = parts[1] | |
2040 | if op == 'cg': |
|
2040 | if op == 'cg': | |
2041 | pass |
|
2041 | pass | |
2042 | elif op == 'cgss': |
|
2042 | elif op == 'cgss': | |
2043 | doit(parts[2].split(' '), parts[3].split(' ')) |
|
2043 | doit(parts[2].split(' '), parts[3].split(' ')) | |
2044 | elif op == 'unb': |
|
2044 | elif op == 'unb': | |
2045 | doit(parts[3].split(' '), parts[2].split(' ')) |
|
2045 | doit(parts[3].split(' '), parts[2].split(' ')) | |
2046 | line = logfile.readline() |
|
2046 | line = logfile.readline() | |
2047 | finally: |
|
2047 | finally: | |
2048 | logfile.close() |
|
2048 | logfile.close() | |
2049 |
|
2049 | |||
2050 | else: |
|
2050 | else: | |
2051 | remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, |
|
2051 | remoterevs, _checkout = hg.addbranchrevs(repo, remote, branches, | |
2052 | opts.get('remote_head')) |
|
2052 | opts.get('remote_head')) | |
2053 | localrevs = opts.get('local_head') |
|
2053 | localrevs = opts.get('local_head') | |
2054 | doit(localrevs, remoterevs) |
|
2054 | doit(localrevs, remoterevs) | |
2055 |
|
2055 | |||
2056 | @command('debugfileset', |
|
2056 | @command('debugfileset', | |
2057 | [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], |
|
2057 | [('r', 'rev', '', _('apply the filespec on this revision'), _('REV'))], | |
2058 | _('[-r REV] FILESPEC')) |
|
2058 | _('[-r REV] FILESPEC')) | |
2059 | def debugfileset(ui, repo, expr, **opts): |
|
2059 | def debugfileset(ui, repo, expr, **opts): | |
2060 | '''parse and apply a fileset specification''' |
|
2060 | '''parse and apply a fileset specification''' | |
2061 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) |
|
2061 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) | |
2062 | if ui.verbose: |
|
2062 | if ui.verbose: | |
2063 | tree = fileset.parse(expr)[0] |
|
2063 | tree = fileset.parse(expr)[0] | |
2064 | ui.note(tree, "\n") |
|
2064 | ui.note(tree, "\n") | |
2065 |
|
2065 | |||
2066 | for f in ctx.getfileset(expr): |
|
2066 | for f in ctx.getfileset(expr): | |
2067 | ui.write("%s\n" % f) |
|
2067 | ui.write("%s\n" % f) | |
2068 |
|
2068 | |||
2069 | @command('debugfsinfo', [], _('[PATH]'), norepo=True) |
|
2069 | @command('debugfsinfo', [], _('[PATH]'), norepo=True) | |
2070 | def debugfsinfo(ui, path="."): |
|
2070 | def debugfsinfo(ui, path="."): | |
2071 | """show information detected about current filesystem""" |
|
2071 | """show information detected about current filesystem""" | |
2072 | util.writefile('.debugfsinfo', '') |
|
2072 | util.writefile('.debugfsinfo', '') | |
2073 | ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) |
|
2073 | ui.write(('exec: %s\n') % (util.checkexec(path) and 'yes' or 'no')) | |
2074 | ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) |
|
2074 | ui.write(('symlink: %s\n') % (util.checklink(path) and 'yes' or 'no')) | |
2075 | ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) |
|
2075 | ui.write(('hardlink: %s\n') % (util.checknlink(path) and 'yes' or 'no')) | |
2076 | ui.write(('case-sensitive: %s\n') % (util.checkcase('.debugfsinfo') |
|
2076 | ui.write(('case-sensitive: %s\n') % (util.checkcase('.debugfsinfo') | |
2077 | and 'yes' or 'no')) |
|
2077 | and 'yes' or 'no')) | |
2078 | os.unlink('.debugfsinfo') |
|
2078 | os.unlink('.debugfsinfo') | |
2079 |
|
2079 | |||
2080 | @command('debuggetbundle', |
|
2080 | @command('debuggetbundle', | |
2081 | [('H', 'head', [], _('id of head node'), _('ID')), |
|
2081 | [('H', 'head', [], _('id of head node'), _('ID')), | |
2082 | ('C', 'common', [], _('id of common node'), _('ID')), |
|
2082 | ('C', 'common', [], _('id of common node'), _('ID')), | |
2083 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], |
|
2083 | ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))], | |
2084 | _('REPO FILE [-H|-C ID]...'), |
|
2084 | _('REPO FILE [-H|-C ID]...'), | |
2085 | norepo=True) |
|
2085 | norepo=True) | |
2086 | def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): |
|
2086 | def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts): | |
2087 | """retrieves a bundle from a repo |
|
2087 | """retrieves a bundle from a repo | |
2088 |
|
2088 | |||
2089 | Every ID must be a full-length hex node id string. Saves the bundle to the |
|
2089 | Every ID must be a full-length hex node id string. Saves the bundle to the | |
2090 | given file. |
|
2090 | given file. | |
2091 | """ |
|
2091 | """ | |
2092 | repo = hg.peer(ui, opts, repopath) |
|
2092 | repo = hg.peer(ui, opts, repopath) | |
2093 | if not repo.capable('getbundle'): |
|
2093 | if not repo.capable('getbundle'): | |
2094 | raise util.Abort("getbundle() not supported by target repository") |
|
2094 | raise util.Abort("getbundle() not supported by target repository") | |
2095 | args = {} |
|
2095 | args = {} | |
2096 | if common: |
|
2096 | if common: | |
2097 | args['common'] = [bin(s) for s in common] |
|
2097 | args['common'] = [bin(s) for s in common] | |
2098 | if head: |
|
2098 | if head: | |
2099 | args['heads'] = [bin(s) for s in head] |
|
2099 | args['heads'] = [bin(s) for s in head] | |
2100 | # TODO: get desired bundlecaps from command line. |
|
2100 | # TODO: get desired bundlecaps from command line. | |
2101 | args['bundlecaps'] = None |
|
2101 | args['bundlecaps'] = None | |
2102 | bundle = repo.getbundle('debug', **args) |
|
2102 | bundle = repo.getbundle('debug', **args) | |
2103 |
|
2103 | |||
2104 | bundletype = opts.get('type', 'bzip2').lower() |
|
2104 | bundletype = opts.get('type', 'bzip2').lower() | |
2105 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} |
|
2105 | btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} | |
2106 | bundletype = btypes.get(bundletype) |
|
2106 | bundletype = btypes.get(bundletype) | |
2107 | if bundletype not in changegroup.bundletypes: |
|
2107 | if bundletype not in changegroup.bundletypes: | |
2108 | raise util.Abort(_('unknown bundle type specified with --type')) |
|
2108 | raise util.Abort(_('unknown bundle type specified with --type')) | |
2109 | changegroup.writebundle(bundle, bundlepath, bundletype) |
|
2109 | changegroup.writebundle(bundle, bundlepath, bundletype) | |
2110 |
|
2110 | |||
2111 | @command('debugignore', [], '') |
|
2111 | @command('debugignore', [], '') | |
2112 | def debugignore(ui, repo, *values, **opts): |
|
2112 | def debugignore(ui, repo, *values, **opts): | |
2113 | """display the combined ignore pattern""" |
|
2113 | """display the combined ignore pattern""" | |
2114 | ignore = repo.dirstate._ignore |
|
2114 | ignore = repo.dirstate._ignore | |
2115 | includepat = getattr(ignore, 'includepat', None) |
|
2115 | includepat = getattr(ignore, 'includepat', None) | |
2116 | if includepat is not None: |
|
2116 | if includepat is not None: | |
2117 | ui.write("%s\n" % includepat) |
|
2117 | ui.write("%s\n" % includepat) | |
2118 | else: |
|
2118 | else: | |
2119 | raise util.Abort(_("no ignore patterns found")) |
|
2119 | raise util.Abort(_("no ignore patterns found")) | |
2120 |
|
2120 | |||
2121 | @command('debugindex', |
|
2121 | @command('debugindex', | |
2122 | [('c', 'changelog', False, _('open changelog')), |
|
2122 | [('c', 'changelog', False, _('open changelog')), | |
2123 | ('m', 'manifest', False, _('open manifest')), |
|
2123 | ('m', 'manifest', False, _('open manifest')), | |
2124 | ('f', 'format', 0, _('revlog format'), _('FORMAT'))], |
|
2124 | ('f', 'format', 0, _('revlog format'), _('FORMAT'))], | |
2125 | _('[-f FORMAT] -c|-m|FILE'), |
|
2125 | _('[-f FORMAT] -c|-m|FILE'), | |
2126 | optionalrepo=True) |
|
2126 | optionalrepo=True) | |
2127 | def debugindex(ui, repo, file_=None, **opts): |
|
2127 | def debugindex(ui, repo, file_=None, **opts): | |
2128 | """dump the contents of an index file""" |
|
2128 | """dump the contents of an index file""" | |
2129 | r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) |
|
2129 | r = cmdutil.openrevlog(repo, 'debugindex', file_, opts) | |
2130 | format = opts.get('format', 0) |
|
2130 | format = opts.get('format', 0) | |
2131 | if format not in (0, 1): |
|
2131 | if format not in (0, 1): | |
2132 | raise util.Abort(_("unknown format %d") % format) |
|
2132 | raise util.Abort(_("unknown format %d") % format) | |
2133 |
|
2133 | |||
2134 | generaldelta = r.version & revlog.REVLOGGENERALDELTA |
|
2134 | generaldelta = r.version & revlog.REVLOGGENERALDELTA | |
2135 | if generaldelta: |
|
2135 | if generaldelta: | |
2136 | basehdr = ' delta' |
|
2136 | basehdr = ' delta' | |
2137 | else: |
|
2137 | else: | |
2138 | basehdr = ' base' |
|
2138 | basehdr = ' base' | |
2139 |
|
2139 | |||
2140 | if format == 0: |
|
2140 | if format == 0: | |
2141 | ui.write(" rev offset length " + basehdr + " linkrev" |
|
2141 | ui.write(" rev offset length " + basehdr + " linkrev" | |
2142 | " nodeid p1 p2\n") |
|
2142 | " nodeid p1 p2\n") | |
2143 | elif format == 1: |
|
2143 | elif format == 1: | |
2144 | ui.write(" rev flag offset length" |
|
2144 | ui.write(" rev flag offset length" | |
2145 | " size " + basehdr + " link p1 p2" |
|
2145 | " size " + basehdr + " link p1 p2" | |
2146 | " nodeid\n") |
|
2146 | " nodeid\n") | |
2147 |
|
2147 | |||
2148 | for i in r: |
|
2148 | for i in r: | |
2149 | node = r.node(i) |
|
2149 | node = r.node(i) | |
2150 | if generaldelta: |
|
2150 | if generaldelta: | |
2151 | base = r.deltaparent(i) |
|
2151 | base = r.deltaparent(i) | |
2152 | else: |
|
2152 | else: | |
2153 | base = r.chainbase(i) |
|
2153 | base = r.chainbase(i) | |
2154 | if format == 0: |
|
2154 | if format == 0: | |
2155 | try: |
|
2155 | try: | |
2156 | pp = r.parents(node) |
|
2156 | pp = r.parents(node) | |
2157 | except Exception: |
|
2157 | except Exception: | |
2158 | pp = [nullid, nullid] |
|
2158 | pp = [nullid, nullid] | |
2159 | ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( |
|
2159 | ui.write("% 6d % 9d % 7d % 6d % 7d %s %s %s\n" % ( | |
2160 | i, r.start(i), r.length(i), base, r.linkrev(i), |
|
2160 | i, r.start(i), r.length(i), base, r.linkrev(i), | |
2161 | short(node), short(pp[0]), short(pp[1]))) |
|
2161 | short(node), short(pp[0]), short(pp[1]))) | |
2162 | elif format == 1: |
|
2162 | elif format == 1: | |
2163 | pr = r.parentrevs(i) |
|
2163 | pr = r.parentrevs(i) | |
2164 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ( |
|
2164 | ui.write("% 6d %04x % 8d % 8d % 8d % 6d % 6d % 6d % 6d %s\n" % ( | |
2165 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), |
|
2165 | i, r.flags(i), r.start(i), r.length(i), r.rawsize(i), | |
2166 | base, r.linkrev(i), pr[0], pr[1], short(node))) |
|
2166 | base, r.linkrev(i), pr[0], pr[1], short(node))) | |
2167 |
|
2167 | |||
2168 | @command('debugindexdot', [], _('FILE'), optionalrepo=True) |
|
2168 | @command('debugindexdot', [], _('FILE'), optionalrepo=True) | |
2169 | def debugindexdot(ui, repo, file_): |
|
2169 | def debugindexdot(ui, repo, file_): | |
2170 | """dump an index DAG as a graphviz dot file""" |
|
2170 | """dump an index DAG as a graphviz dot file""" | |
2171 | r = None |
|
2171 | r = None | |
2172 | if repo: |
|
2172 | if repo: | |
2173 | filelog = repo.file(file_) |
|
2173 | filelog = repo.file(file_) | |
2174 | if len(filelog): |
|
2174 | if len(filelog): | |
2175 | r = filelog |
|
2175 | r = filelog | |
2176 | if not r: |
|
2176 | if not r: | |
2177 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) |
|
2177 | r = revlog.revlog(scmutil.opener(os.getcwd(), audit=False), file_) | |
2178 | ui.write(("digraph G {\n")) |
|
2178 | ui.write(("digraph G {\n")) | |
2179 | for i in r: |
|
2179 | for i in r: | |
2180 | node = r.node(i) |
|
2180 | node = r.node(i) | |
2181 | pp = r.parents(node) |
|
2181 | pp = r.parents(node) | |
2182 | ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) |
|
2182 | ui.write("\t%d -> %d\n" % (r.rev(pp[0]), i)) | |
2183 | if pp[1] != nullid: |
|
2183 | if pp[1] != nullid: | |
2184 | ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
|
2184 | ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) | |
2185 | ui.write("}\n") |
|
2185 | ui.write("}\n") | |
2186 |
|
2186 | |||
2187 | @command('debuginstall', [], '', norepo=True) |
|
2187 | @command('debuginstall', [], '', norepo=True) | |
2188 | def debuginstall(ui): |
|
2188 | def debuginstall(ui): | |
2189 | '''test Mercurial installation |
|
2189 | '''test Mercurial installation | |
2190 |
|
2190 | |||
2191 | Returns 0 on success. |
|
2191 | Returns 0 on success. | |
2192 | ''' |
|
2192 | ''' | |
2193 |
|
2193 | |||
2194 | def writetemp(contents): |
|
2194 | def writetemp(contents): | |
2195 | (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") |
|
2195 | (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-") | |
2196 | f = os.fdopen(fd, "wb") |
|
2196 | f = os.fdopen(fd, "wb") | |
2197 | f.write(contents) |
|
2197 | f.write(contents) | |
2198 | f.close() |
|
2198 | f.close() | |
2199 | return name |
|
2199 | return name | |
2200 |
|
2200 | |||
2201 | problems = 0 |
|
2201 | problems = 0 | |
2202 |
|
2202 | |||
2203 | # encoding |
|
2203 | # encoding | |
2204 | ui.status(_("checking encoding (%s)...\n") % encoding.encoding) |
|
2204 | ui.status(_("checking encoding (%s)...\n") % encoding.encoding) | |
2205 | try: |
|
2205 | try: | |
2206 | encoding.fromlocal("test") |
|
2206 | encoding.fromlocal("test") | |
2207 | except util.Abort, inst: |
|
2207 | except util.Abort, inst: | |
2208 | ui.write(" %s\n" % inst) |
|
2208 | ui.write(" %s\n" % inst) | |
2209 | ui.write(_(" (check that your locale is properly set)\n")) |
|
2209 | ui.write(_(" (check that your locale is properly set)\n")) | |
2210 | problems += 1 |
|
2210 | problems += 1 | |
2211 |
|
2211 | |||
2212 | # Python |
|
2212 | # Python | |
2213 | ui.status(_("checking Python executable (%s)\n") % sys.executable) |
|
2213 | ui.status(_("checking Python executable (%s)\n") % sys.executable) | |
2214 | ui.status(_("checking Python version (%s)\n") |
|
2214 | ui.status(_("checking Python version (%s)\n") | |
2215 | % ("%s.%s.%s" % sys.version_info[:3])) |
|
2215 | % ("%s.%s.%s" % sys.version_info[:3])) | |
2216 | ui.status(_("checking Python lib (%s)...\n") |
|
2216 | ui.status(_("checking Python lib (%s)...\n") | |
2217 | % os.path.dirname(os.__file__)) |
|
2217 | % os.path.dirname(os.__file__)) | |
2218 |
|
2218 | |||
2219 | # compiled modules |
|
2219 | # compiled modules | |
2220 | ui.status(_("checking installed modules (%s)...\n") |
|
2220 | ui.status(_("checking installed modules (%s)...\n") | |
2221 | % os.path.dirname(__file__)) |
|
2221 | % os.path.dirname(__file__)) | |
2222 | try: |
|
2222 | try: | |
2223 | import bdiff, mpatch, base85, osutil |
|
2223 | import bdiff, mpatch, base85, osutil | |
2224 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes |
|
2224 | dir(bdiff), dir(mpatch), dir(base85), dir(osutil) # quiet pyflakes | |
2225 | except Exception, inst: |
|
2225 | except Exception, inst: | |
2226 | ui.write(" %s\n" % inst) |
|
2226 | ui.write(" %s\n" % inst) | |
2227 | ui.write(_(" One or more extensions could not be found")) |
|
2227 | ui.write(_(" One or more extensions could not be found")) | |
2228 | ui.write(_(" (check that you compiled the extensions)\n")) |
|
2228 | ui.write(_(" (check that you compiled the extensions)\n")) | |
2229 | problems += 1 |
|
2229 | problems += 1 | |
2230 |
|
2230 | |||
2231 | # templates |
|
2231 | # templates | |
2232 | import templater |
|
2232 | import templater | |
2233 | p = templater.templatepath() |
|
2233 | p = templater.templatepath() | |
2234 | ui.status(_("checking templates (%s)...\n") % ' '.join(p)) |
|
2234 | ui.status(_("checking templates (%s)...\n") % ' '.join(p)) | |
2235 | if p: |
|
2235 | if p: | |
2236 | m = templater.templatepath("map-cmdline.default") |
|
2236 | m = templater.templatepath("map-cmdline.default") | |
2237 | if m: |
|
2237 | if m: | |
2238 | # template found, check if it is working |
|
2238 | # template found, check if it is working | |
2239 | try: |
|
2239 | try: | |
2240 | templater.templater(m) |
|
2240 | templater.templater(m) | |
2241 | except Exception, inst: |
|
2241 | except Exception, inst: | |
2242 | ui.write(" %s\n" % inst) |
|
2242 | ui.write(" %s\n" % inst) | |
2243 | p = None |
|
2243 | p = None | |
2244 | else: |
|
2244 | else: | |
2245 | ui.write(_(" template 'default' not found\n")) |
|
2245 | ui.write(_(" template 'default' not found\n")) | |
2246 | p = None |
|
2246 | p = None | |
2247 | else: |
|
2247 | else: | |
2248 | ui.write(_(" no template directories found\n")) |
|
2248 | ui.write(_(" no template directories found\n")) | |
2249 | if not p: |
|
2249 | if not p: | |
2250 | ui.write(_(" (templates seem to have been installed incorrectly)\n")) |
|
2250 | ui.write(_(" (templates seem to have been installed incorrectly)\n")) | |
2251 | problems += 1 |
|
2251 | problems += 1 | |
2252 |
|
2252 | |||
2253 | # editor |
|
2253 | # editor | |
2254 | ui.status(_("checking commit editor...\n")) |
|
2254 | ui.status(_("checking commit editor...\n")) | |
2255 | editor = ui.geteditor() |
|
2255 | editor = ui.geteditor() | |
2256 | cmdpath = util.findexe(shlex.split(editor)[0]) |
|
2256 | cmdpath = util.findexe(shlex.split(editor)[0]) | |
2257 | if not cmdpath: |
|
2257 | if not cmdpath: | |
2258 | if editor == 'vi': |
|
2258 | if editor == 'vi': | |
2259 | ui.write(_(" No commit editor set and can't find vi in PATH\n")) |
|
2259 | ui.write(_(" No commit editor set and can't find vi in PATH\n")) | |
2260 | ui.write(_(" (specify a commit editor in your configuration" |
|
2260 | ui.write(_(" (specify a commit editor in your configuration" | |
2261 | " file)\n")) |
|
2261 | " file)\n")) | |
2262 | else: |
|
2262 | else: | |
2263 | ui.write(_(" Can't find editor '%s' in PATH\n") % editor) |
|
2263 | ui.write(_(" Can't find editor '%s' in PATH\n") % editor) | |
2264 | ui.write(_(" (specify a commit editor in your configuration" |
|
2264 | ui.write(_(" (specify a commit editor in your configuration" | |
2265 | " file)\n")) |
|
2265 | " file)\n")) | |
2266 | problems += 1 |
|
2266 | problems += 1 | |
2267 |
|
2267 | |||
2268 | # check username |
|
2268 | # check username | |
2269 | ui.status(_("checking username...\n")) |
|
2269 | ui.status(_("checking username...\n")) | |
2270 | try: |
|
2270 | try: | |
2271 | ui.username() |
|
2271 | ui.username() | |
2272 | except util.Abort, e: |
|
2272 | except util.Abort, e: | |
2273 | ui.write(" %s\n" % e) |
|
2273 | ui.write(" %s\n" % e) | |
2274 | ui.write(_(" (specify a username in your configuration file)\n")) |
|
2274 | ui.write(_(" (specify a username in your configuration file)\n")) | |
2275 | problems += 1 |
|
2275 | problems += 1 | |
2276 |
|
2276 | |||
2277 | if not problems: |
|
2277 | if not problems: | |
2278 | ui.status(_("no problems detected\n")) |
|
2278 | ui.status(_("no problems detected\n")) | |
2279 | else: |
|
2279 | else: | |
2280 | ui.write(_("%s problems detected," |
|
2280 | ui.write(_("%s problems detected," | |
2281 | " please check your install!\n") % problems) |
|
2281 | " please check your install!\n") % problems) | |
2282 |
|
2282 | |||
2283 | return problems |
|
2283 | return problems | |
2284 |
|
2284 | |||
2285 | @command('debugknown', [], _('REPO ID...'), norepo=True) |
|
2285 | @command('debugknown', [], _('REPO ID...'), norepo=True) | |
2286 | def debugknown(ui, repopath, *ids, **opts): |
|
2286 | def debugknown(ui, repopath, *ids, **opts): | |
2287 | """test whether node ids are known to a repo |
|
2287 | """test whether node ids are known to a repo | |
2288 |
|
2288 | |||
2289 | Every ID must be a full-length hex node id string. Returns a list of 0s |
|
2289 | Every ID must be a full-length hex node id string. Returns a list of 0s | |
2290 | and 1s indicating unknown/known. |
|
2290 | and 1s indicating unknown/known. | |
2291 | """ |
|
2291 | """ | |
2292 | repo = hg.peer(ui, opts, repopath) |
|
2292 | repo = hg.peer(ui, opts, repopath) | |
2293 | if not repo.capable('known'): |
|
2293 | if not repo.capable('known'): | |
2294 | raise util.Abort("known() not supported by target repository") |
|
2294 | raise util.Abort("known() not supported by target repository") | |
2295 | flags = repo.known([bin(s) for s in ids]) |
|
2295 | flags = repo.known([bin(s) for s in ids]) | |
2296 | ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) |
|
2296 | ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags]))) | |
2297 |
|
2297 | |||
2298 | @command('debuglabelcomplete', [], _('LABEL...')) |
|
2298 | @command('debuglabelcomplete', [], _('LABEL...')) | |
2299 | def debuglabelcomplete(ui, repo, *args): |
|
2299 | def debuglabelcomplete(ui, repo, *args): | |
2300 | '''complete "labels" - tags, open branch names, bookmark names''' |
|
2300 | '''complete "labels" - tags, open branch names, bookmark names''' | |
2301 |
|
2301 | |||
2302 | labels = set() |
|
2302 | labels = set() | |
2303 | labels.update(t[0] for t in repo.tagslist()) |
|
2303 | labels.update(t[0] for t in repo.tagslist()) | |
2304 | labels.update(repo._bookmarks.keys()) |
|
2304 | labels.update(repo._bookmarks.keys()) | |
2305 | labels.update(tag for (tag, heads, tip, closed) |
|
2305 | labels.update(tag for (tag, heads, tip, closed) | |
2306 | in repo.branchmap().iterbranches() if not closed) |
|
2306 | in repo.branchmap().iterbranches() if not closed) | |
2307 | completions = set() |
|
2307 | completions = set() | |
2308 | if not args: |
|
2308 | if not args: | |
2309 | args = [''] |
|
2309 | args = [''] | |
2310 | for a in args: |
|
2310 | for a in args: | |
2311 | completions.update(l for l in labels if l.startswith(a)) |
|
2311 | completions.update(l for l in labels if l.startswith(a)) | |
2312 | ui.write('\n'.join(sorted(completions))) |
|
2312 | ui.write('\n'.join(sorted(completions))) | |
2313 | ui.write('\n') |
|
2313 | ui.write('\n') | |
2314 |
|
2314 | |||
2315 | @command('debugobsolete', |
|
2315 | @command('debugobsolete', | |
2316 | [('', 'flags', 0, _('markers flag')), |
|
2316 | [('', 'flags', 0, _('markers flag')), | |
2317 | ('', 'record-parents', False, |
|
2317 | ('', 'record-parents', False, | |
2318 | _('record parent information for the precursor')), |
|
2318 | _('record parent information for the precursor')), | |
2319 | ('r', 'rev', [], _('display markers relevant to REV')), |
|
2319 | ('r', 'rev', [], _('display markers relevant to REV')), | |
2320 | ] + commitopts2, |
|
2320 | ] + commitopts2, | |
2321 | _('[OBSOLETED [REPLACEMENT] [REPL... ]')) |
|
2321 | _('[OBSOLETED [REPLACEMENT] [REPL... ]')) | |
2322 | def debugobsolete(ui, repo, precursor=None, *successors, **opts): |
|
2322 | def debugobsolete(ui, repo, precursor=None, *successors, **opts): | |
2323 | """create arbitrary obsolete marker |
|
2323 | """create arbitrary obsolete marker | |
2324 |
|
2324 | |||
2325 | With no arguments, displays the list of obsolescence markers.""" |
|
2325 | With no arguments, displays the list of obsolescence markers.""" | |
2326 |
|
2326 | |||
2327 | def parsenodeid(s): |
|
2327 | def parsenodeid(s): | |
2328 | try: |
|
2328 | try: | |
2329 | # We do not use revsingle/revrange functions here to accept |
|
2329 | # We do not use revsingle/revrange functions here to accept | |
2330 | # arbitrary node identifiers, possibly not present in the |
|
2330 | # arbitrary node identifiers, possibly not present in the | |
2331 | # local repository. |
|
2331 | # local repository. | |
2332 | n = bin(s) |
|
2332 | n = bin(s) | |
2333 | if len(n) != len(nullid): |
|
2333 | if len(n) != len(nullid): | |
2334 | raise TypeError() |
|
2334 | raise TypeError() | |
2335 | return n |
|
2335 | return n | |
2336 | except TypeError: |
|
2336 | except TypeError: | |
2337 | raise util.Abort('changeset references must be full hexadecimal ' |
|
2337 | raise util.Abort('changeset references must be full hexadecimal ' | |
2338 | 'node identifiers') |
|
2338 | 'node identifiers') | |
2339 |
|
2339 | |||
2340 | if precursor is not None: |
|
2340 | if precursor is not None: | |
2341 | if opts['rev']: |
|
2341 | if opts['rev']: | |
2342 | raise util.Abort('cannot select revision when creating marker') |
|
2342 | raise util.Abort('cannot select revision when creating marker') | |
2343 | metadata = {} |
|
2343 | metadata = {} | |
2344 | metadata['user'] = opts['user'] or ui.username() |
|
2344 | metadata['user'] = opts['user'] or ui.username() | |
2345 | succs = tuple(parsenodeid(succ) for succ in successors) |
|
2345 | succs = tuple(parsenodeid(succ) for succ in successors) | |
2346 | l = repo.lock() |
|
2346 | l = repo.lock() | |
2347 | try: |
|
2347 | try: | |
2348 | tr = repo.transaction('debugobsolete') |
|
2348 | tr = repo.transaction('debugobsolete') | |
2349 | try: |
|
2349 | try: | |
2350 | try: |
|
2350 | try: | |
2351 | date = opts.get('date') |
|
2351 | date = opts.get('date') | |
2352 | if date: |
|
2352 | if date: | |
2353 | date = util.parsedate(date) |
|
2353 | date = util.parsedate(date) | |
2354 | else: |
|
2354 | else: | |
2355 | date = None |
|
2355 | date = None | |
2356 | prec = parsenodeid(precursor) |
|
2356 | prec = parsenodeid(precursor) | |
2357 | parents = None |
|
2357 | parents = None | |
2358 | if opts['record_parents']: |
|
2358 | if opts['record_parents']: | |
2359 | if prec not in repo.unfiltered(): |
|
2359 | if prec not in repo.unfiltered(): | |
2360 | raise util.Abort('cannot used --record-parents on ' |
|
2360 | raise util.Abort('cannot used --record-parents on ' | |
2361 | 'unknown changesets') |
|
2361 | 'unknown changesets') | |
2362 | parents = repo.unfiltered()[prec].parents() |
|
2362 | parents = repo.unfiltered()[prec].parents() | |
2363 | parents = tuple(p.node() for p in parents) |
|
2363 | parents = tuple(p.node() for p in parents) | |
2364 | repo.obsstore.create(tr, prec, succs, opts['flags'], |
|
2364 | repo.obsstore.create(tr, prec, succs, opts['flags'], | |
2365 | parents=parents, date=date, |
|
2365 | parents=parents, date=date, | |
2366 | metadata=metadata) |
|
2366 | metadata=metadata) | |
2367 | tr.close() |
|
2367 | tr.close() | |
2368 | except ValueError, exc: |
|
2368 | except ValueError, exc: | |
2369 | raise util.Abort(_('bad obsmarker input: %s') % exc) |
|
2369 | raise util.Abort(_('bad obsmarker input: %s') % exc) | |
2370 | finally: |
|
2370 | finally: | |
2371 | tr.release() |
|
2371 | tr.release() | |
2372 | finally: |
|
2372 | finally: | |
2373 | l.release() |
|
2373 | l.release() | |
2374 | else: |
|
2374 | else: | |
2375 | if opts['rev']: |
|
2375 | if opts['rev']: | |
2376 | revs = scmutil.revrange(repo, opts['rev']) |
|
2376 | revs = scmutil.revrange(repo, opts['rev']) | |
2377 | nodes = [repo[r].node() for r in revs] |
|
2377 | nodes = [repo[r].node() for r in revs] | |
2378 | markers = list(obsolete.getmarkers(repo, nodes=nodes)) |
|
2378 | markers = list(obsolete.getmarkers(repo, nodes=nodes)) | |
2379 | markers.sort(key=lambda x: x._data) |
|
2379 | markers.sort(key=lambda x: x._data) | |
2380 | else: |
|
2380 | else: | |
2381 | markers = obsolete.getmarkers(repo) |
|
2381 | markers = obsolete.getmarkers(repo) | |
2382 |
|
2382 | |||
2383 | for m in markers: |
|
2383 | for m in markers: | |
2384 | cmdutil.showmarker(ui, m) |
|
2384 | cmdutil.showmarker(ui, m) | |
2385 |
|
2385 | |||
2386 | @command('debugpathcomplete', |
|
2386 | @command('debugpathcomplete', | |
2387 | [('f', 'full', None, _('complete an entire path')), |
|
2387 | [('f', 'full', None, _('complete an entire path')), | |
2388 | ('n', 'normal', None, _('show only normal files')), |
|
2388 | ('n', 'normal', None, _('show only normal files')), | |
2389 | ('a', 'added', None, _('show only added files')), |
|
2389 | ('a', 'added', None, _('show only added files')), | |
2390 | ('r', 'removed', None, _('show only removed files'))], |
|
2390 | ('r', 'removed', None, _('show only removed files'))], | |
2391 | _('FILESPEC...')) |
|
2391 | _('FILESPEC...')) | |
2392 | def debugpathcomplete(ui, repo, *specs, **opts): |
|
2392 | def debugpathcomplete(ui, repo, *specs, **opts): | |
2393 | '''complete part or all of a tracked path |
|
2393 | '''complete part or all of a tracked path | |
2394 |
|
2394 | |||
2395 | This command supports shells that offer path name completion. It |
|
2395 | This command supports shells that offer path name completion. It | |
2396 | currently completes only files already known to the dirstate. |
|
2396 | currently completes only files already known to the dirstate. | |
2397 |
|
2397 | |||
2398 | Completion extends only to the next path segment unless |
|
2398 | Completion extends only to the next path segment unless | |
2399 | --full is specified, in which case entire paths are used.''' |
|
2399 | --full is specified, in which case entire paths are used.''' | |
2400 |
|
2400 | |||
2401 | def complete(path, acceptable): |
|
2401 | def complete(path, acceptable): | |
2402 | dirstate = repo.dirstate |
|
2402 | dirstate = repo.dirstate | |
2403 | spec = os.path.normpath(os.path.join(os.getcwd(), path)) |
|
2403 | spec = os.path.normpath(os.path.join(os.getcwd(), path)) | |
2404 | rootdir = repo.root + os.sep |
|
2404 | rootdir = repo.root + os.sep | |
2405 | if spec != repo.root and not spec.startswith(rootdir): |
|
2405 | if spec != repo.root and not spec.startswith(rootdir): | |
2406 | return [], [] |
|
2406 | return [], [] | |
2407 | if os.path.isdir(spec): |
|
2407 | if os.path.isdir(spec): | |
2408 | spec += '/' |
|
2408 | spec += '/' | |
2409 | spec = spec[len(rootdir):] |
|
2409 | spec = spec[len(rootdir):] | |
2410 | fixpaths = os.sep != '/' |
|
2410 | fixpaths = os.sep != '/' | |
2411 | if fixpaths: |
|
2411 | if fixpaths: | |
2412 | spec = spec.replace(os.sep, '/') |
|
2412 | spec = spec.replace(os.sep, '/') | |
2413 | speclen = len(spec) |
|
2413 | speclen = len(spec) | |
2414 | fullpaths = opts['full'] |
|
2414 | fullpaths = opts['full'] | |
2415 | files, dirs = set(), set() |
|
2415 | files, dirs = set(), set() | |
2416 | adddir, addfile = dirs.add, files.add |
|
2416 | adddir, addfile = dirs.add, files.add | |
2417 | for f, st in dirstate.iteritems(): |
|
2417 | for f, st in dirstate.iteritems(): | |
2418 | if f.startswith(spec) and st[0] in acceptable: |
|
2418 | if f.startswith(spec) and st[0] in acceptable: | |
2419 | if fixpaths: |
|
2419 | if fixpaths: | |
2420 | f = f.replace('/', os.sep) |
|
2420 | f = f.replace('/', os.sep) | |
2421 | if fullpaths: |
|
2421 | if fullpaths: | |
2422 | addfile(f) |
|
2422 | addfile(f) | |
2423 | continue |
|
2423 | continue | |
2424 | s = f.find(os.sep, speclen) |
|
2424 | s = f.find(os.sep, speclen) | |
2425 | if s >= 0: |
|
2425 | if s >= 0: | |
2426 | adddir(f[:s]) |
|
2426 | adddir(f[:s]) | |
2427 | else: |
|
2427 | else: | |
2428 | addfile(f) |
|
2428 | addfile(f) | |
2429 | return files, dirs |
|
2429 | return files, dirs | |
2430 |
|
2430 | |||
2431 | acceptable = '' |
|
2431 | acceptable = '' | |
2432 | if opts['normal']: |
|
2432 | if opts['normal']: | |
2433 | acceptable += 'nm' |
|
2433 | acceptable += 'nm' | |
2434 | if opts['added']: |
|
2434 | if opts['added']: | |
2435 | acceptable += 'a' |
|
2435 | acceptable += 'a' | |
2436 | if opts['removed']: |
|
2436 | if opts['removed']: | |
2437 | acceptable += 'r' |
|
2437 | acceptable += 'r' | |
2438 | cwd = repo.getcwd() |
|
2438 | cwd = repo.getcwd() | |
2439 | if not specs: |
|
2439 | if not specs: | |
2440 | specs = ['.'] |
|
2440 | specs = ['.'] | |
2441 |
|
2441 | |||
2442 | files, dirs = set(), set() |
|
2442 | files, dirs = set(), set() | |
2443 | for spec in specs: |
|
2443 | for spec in specs: | |
2444 | f, d = complete(spec, acceptable or 'nmar') |
|
2444 | f, d = complete(spec, acceptable or 'nmar') | |
2445 | files.update(f) |
|
2445 | files.update(f) | |
2446 | dirs.update(d) |
|
2446 | dirs.update(d) | |
2447 | files.update(dirs) |
|
2447 | files.update(dirs) | |
2448 | ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) |
|
2448 | ui.write('\n'.join(repo.pathto(p, cwd) for p in sorted(files))) | |
2449 | ui.write('\n') |
|
2449 | ui.write('\n') | |
2450 |
|
2450 | |||
2451 | @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True) |
|
2451 | @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'), norepo=True) | |
2452 | def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): |
|
2452 | def debugpushkey(ui, repopath, namespace, *keyinfo, **opts): | |
2453 | '''access the pushkey key/value protocol |
|
2453 | '''access the pushkey key/value protocol | |
2454 |
|
2454 | |||
2455 | With two args, list the keys in the given namespace. |
|
2455 | With two args, list the keys in the given namespace. | |
2456 |
|
2456 | |||
2457 | With five args, set a key to new if it currently is set to old. |
|
2457 | With five args, set a key to new if it currently is set to old. | |
2458 | Reports success or failure. |
|
2458 | Reports success or failure. | |
2459 | ''' |
|
2459 | ''' | |
2460 |
|
2460 | |||
2461 | target = hg.peer(ui, {}, repopath) |
|
2461 | target = hg.peer(ui, {}, repopath) | |
2462 | if keyinfo: |
|
2462 | if keyinfo: | |
2463 | key, old, new = keyinfo |
|
2463 | key, old, new = keyinfo | |
2464 | r = target.pushkey(namespace, key, old, new) |
|
2464 | r = target.pushkey(namespace, key, old, new) | |
2465 | ui.status(str(r) + '\n') |
|
2465 | ui.status(str(r) + '\n') | |
2466 | return not r |
|
2466 | return not r | |
2467 | else: |
|
2467 | else: | |
2468 | for k, v in sorted(target.listkeys(namespace).iteritems()): |
|
2468 | for k, v in sorted(target.listkeys(namespace).iteritems()): | |
2469 | ui.write("%s\t%s\n" % (k.encode('string-escape'), |
|
2469 | ui.write("%s\t%s\n" % (k.encode('string-escape'), | |
2470 | v.encode('string-escape'))) |
|
2470 | v.encode('string-escape'))) | |
2471 |
|
2471 | |||
2472 | @command('debugpvec', [], _('A B')) |
|
2472 | @command('debugpvec', [], _('A B')) | |
2473 | def debugpvec(ui, repo, a, b=None): |
|
2473 | def debugpvec(ui, repo, a, b=None): | |
2474 | ca = scmutil.revsingle(repo, a) |
|
2474 | ca = scmutil.revsingle(repo, a) | |
2475 | cb = scmutil.revsingle(repo, b) |
|
2475 | cb = scmutil.revsingle(repo, b) | |
2476 | pa = pvec.ctxpvec(ca) |
|
2476 | pa = pvec.ctxpvec(ca) | |
2477 | pb = pvec.ctxpvec(cb) |
|
2477 | pb = pvec.ctxpvec(cb) | |
2478 | if pa == pb: |
|
2478 | if pa == pb: | |
2479 | rel = "=" |
|
2479 | rel = "=" | |
2480 | elif pa > pb: |
|
2480 | elif pa > pb: | |
2481 | rel = ">" |
|
2481 | rel = ">" | |
2482 | elif pa < pb: |
|
2482 | elif pa < pb: | |
2483 | rel = "<" |
|
2483 | rel = "<" | |
2484 | elif pa | pb: |
|
2484 | elif pa | pb: | |
2485 | rel = "|" |
|
2485 | rel = "|" | |
2486 | ui.write(_("a: %s\n") % pa) |
|
2486 | ui.write(_("a: %s\n") % pa) | |
2487 | ui.write(_("b: %s\n") % pb) |
|
2487 | ui.write(_("b: %s\n") % pb) | |
2488 | ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth)) |
|
2488 | ui.write(_("depth(a): %d depth(b): %d\n") % (pa._depth, pb._depth)) | |
2489 | ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") % |
|
2489 | ui.write(_("delta: %d hdist: %d distance: %d relation: %s\n") % | |
2490 | (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec), |
|
2490 | (abs(pa._depth - pb._depth), pvec._hamming(pa._vec, pb._vec), | |
2491 | pa.distance(pb), rel)) |
|
2491 | pa.distance(pb), rel)) | |
2492 |
|
2492 | |||
2493 | @command('debugrebuilddirstate|debugrebuildstate', |
|
2493 | @command('debugrebuilddirstate|debugrebuildstate', | |
2494 | [('r', 'rev', '', _('revision to rebuild to'), _('REV'))], |
|
2494 | [('r', 'rev', '', _('revision to rebuild to'), _('REV'))], | |
2495 | _('[-r REV]')) |
|
2495 | _('[-r REV]')) | |
2496 | def debugrebuilddirstate(ui, repo, rev): |
|
2496 | def debugrebuilddirstate(ui, repo, rev): | |
2497 | """rebuild the dirstate as it would look like for the given revision |
|
2497 | """rebuild the dirstate as it would look like for the given revision | |
2498 |
|
2498 | |||
2499 | If no revision is specified the first current parent will be used. |
|
2499 | If no revision is specified the first current parent will be used. | |
2500 |
|
2500 | |||
2501 | The dirstate will be set to the files of the given revision. |
|
2501 | The dirstate will be set to the files of the given revision. | |
2502 | The actual working directory content or existing dirstate |
|
2502 | The actual working directory content or existing dirstate | |
2503 | information such as adds or removes is not considered. |
|
2503 | information such as adds or removes is not considered. | |
2504 |
|
2504 | |||
2505 | One use of this command is to make the next :hg:`status` invocation |
|
2505 | One use of this command is to make the next :hg:`status` invocation | |
2506 | check the actual file content. |
|
2506 | check the actual file content. | |
2507 | """ |
|
2507 | """ | |
2508 | ctx = scmutil.revsingle(repo, rev) |
|
2508 | ctx = scmutil.revsingle(repo, rev) | |
2509 | wlock = repo.wlock() |
|
2509 | wlock = repo.wlock() | |
2510 | try: |
|
2510 | try: | |
2511 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) |
|
2511 | repo.dirstate.rebuild(ctx.node(), ctx.manifest()) | |
2512 | finally: |
|
2512 | finally: | |
2513 | wlock.release() |
|
2513 | wlock.release() | |
2514 |
|
2514 | |||
2515 | @command('debugrename', |
|
2515 | @command('debugrename', | |
2516 | [('r', 'rev', '', _('revision to debug'), _('REV'))], |
|
2516 | [('r', 'rev', '', _('revision to debug'), _('REV'))], | |
2517 | _('[-r REV] FILE')) |
|
2517 | _('[-r REV] FILE')) | |
2518 | def debugrename(ui, repo, file1, *pats, **opts): |
|
2518 | def debugrename(ui, repo, file1, *pats, **opts): | |
2519 | """dump rename information""" |
|
2519 | """dump rename information""" | |
2520 |
|
2520 | |||
2521 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
2521 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
2522 | m = scmutil.match(ctx, (file1,) + pats, opts) |
|
2522 | m = scmutil.match(ctx, (file1,) + pats, opts) | |
2523 | for abs in ctx.walk(m): |
|
2523 | for abs in ctx.walk(m): | |
2524 | fctx = ctx[abs] |
|
2524 | fctx = ctx[abs] | |
2525 | o = fctx.filelog().renamed(fctx.filenode()) |
|
2525 | o = fctx.filelog().renamed(fctx.filenode()) | |
2526 | rel = m.rel(abs) |
|
2526 | rel = m.rel(abs) | |
2527 | if o: |
|
2527 | if o: | |
2528 | ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) |
|
2528 | ui.write(_("%s renamed from %s:%s\n") % (rel, o[0], hex(o[1]))) | |
2529 | else: |
|
2529 | else: | |
2530 | ui.write(_("%s not renamed\n") % rel) |
|
2530 | ui.write(_("%s not renamed\n") % rel) | |
2531 |
|
2531 | |||
2532 | @command('debugrevlog', |
|
2532 | @command('debugrevlog', | |
2533 | [('c', 'changelog', False, _('open changelog')), |
|
2533 | [('c', 'changelog', False, _('open changelog')), | |
2534 | ('m', 'manifest', False, _('open manifest')), |
|
2534 | ('m', 'manifest', False, _('open manifest')), | |
2535 | ('d', 'dump', False, _('dump index data'))], |
|
2535 | ('d', 'dump', False, _('dump index data'))], | |
2536 | _('-c|-m|FILE'), |
|
2536 | _('-c|-m|FILE'), | |
2537 | optionalrepo=True) |
|
2537 | optionalrepo=True) | |
2538 | def debugrevlog(ui, repo, file_=None, **opts): |
|
2538 | def debugrevlog(ui, repo, file_=None, **opts): | |
2539 | """show data and statistics about a revlog""" |
|
2539 | """show data and statistics about a revlog""" | |
2540 | r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) |
|
2540 | r = cmdutil.openrevlog(repo, 'debugrevlog', file_, opts) | |
2541 |
|
2541 | |||
2542 | if opts.get("dump"): |
|
2542 | if opts.get("dump"): | |
2543 | numrevs = len(r) |
|
2543 | numrevs = len(r) | |
2544 | ui.write("# rev p1rev p2rev start end deltastart base p1 p2" |
|
2544 | ui.write("# rev p1rev p2rev start end deltastart base p1 p2" | |
2545 | " rawsize totalsize compression heads chainlen\n") |
|
2545 | " rawsize totalsize compression heads chainlen\n") | |
2546 | ts = 0 |
|
2546 | ts = 0 | |
2547 | heads = set() |
|
2547 | heads = set() | |
2548 | rindex = r.index |
|
2548 | rindex = r.index | |
2549 |
|
2549 | |||
2550 | def chainbaseandlen(rev): |
|
2550 | def chainbaseandlen(rev): | |
2551 | clen = 0 |
|
2551 | clen = 0 | |
2552 | base = rindex[rev][3] |
|
2552 | base = rindex[rev][3] | |
2553 | while base != rev: |
|
2553 | while base != rev: | |
2554 | clen += 1 |
|
2554 | clen += 1 | |
2555 | rev = base |
|
2555 | rev = base | |
2556 | base = rindex[rev][3] |
|
2556 | base = rindex[rev][3] | |
2557 | return base, clen |
|
2557 | return base, clen | |
2558 |
|
2558 | |||
2559 | for rev in xrange(numrevs): |
|
2559 | for rev in xrange(numrevs): | |
2560 | dbase = r.deltaparent(rev) |
|
2560 | dbase = r.deltaparent(rev) | |
2561 | if dbase == -1: |
|
2561 | if dbase == -1: | |
2562 | dbase = rev |
|
2562 | dbase = rev | |
2563 | cbase, clen = chainbaseandlen(rev) |
|
2563 | cbase, clen = chainbaseandlen(rev) | |
2564 | p1, p2 = r.parentrevs(rev) |
|
2564 | p1, p2 = r.parentrevs(rev) | |
2565 | rs = r.rawsize(rev) |
|
2565 | rs = r.rawsize(rev) | |
2566 | ts = ts + rs |
|
2566 | ts = ts + rs | |
2567 | heads -= set(r.parentrevs(rev)) |
|
2567 | heads -= set(r.parentrevs(rev)) | |
2568 | heads.add(rev) |
|
2568 | heads.add(rev) | |
2569 | ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d " |
|
2569 | ui.write("%5d %5d %5d %5d %5d %10d %4d %4d %4d %7d %9d " | |
2570 | "%11d %5d %8d\n" % |
|
2570 | "%11d %5d %8d\n" % | |
2571 | (rev, p1, p2, r.start(rev), r.end(rev), |
|
2571 | (rev, p1, p2, r.start(rev), r.end(rev), | |
2572 | r.start(dbase), r.start(cbase), |
|
2572 | r.start(dbase), r.start(cbase), | |
2573 | r.start(p1), r.start(p2), |
|
2573 | r.start(p1), r.start(p2), | |
2574 | rs, ts, ts / r.end(rev), len(heads), clen)) |
|
2574 | rs, ts, ts / r.end(rev), len(heads), clen)) | |
2575 | return 0 |
|
2575 | return 0 | |
2576 |
|
2576 | |||
2577 | v = r.version |
|
2577 | v = r.version | |
2578 | format = v & 0xFFFF |
|
2578 | format = v & 0xFFFF | |
2579 | flags = [] |
|
2579 | flags = [] | |
2580 | gdelta = False |
|
2580 | gdelta = False | |
2581 | if v & revlog.REVLOGNGINLINEDATA: |
|
2581 | if v & revlog.REVLOGNGINLINEDATA: | |
2582 | flags.append('inline') |
|
2582 | flags.append('inline') | |
2583 | if v & revlog.REVLOGGENERALDELTA: |
|
2583 | if v & revlog.REVLOGGENERALDELTA: | |
2584 | gdelta = True |
|
2584 | gdelta = True | |
2585 | flags.append('generaldelta') |
|
2585 | flags.append('generaldelta') | |
2586 | if not flags: |
|
2586 | if not flags: | |
2587 | flags = ['(none)'] |
|
2587 | flags = ['(none)'] | |
2588 |
|
2588 | |||
2589 | nummerges = 0 |
|
2589 | nummerges = 0 | |
2590 | numfull = 0 |
|
2590 | numfull = 0 | |
2591 | numprev = 0 |
|
2591 | numprev = 0 | |
2592 | nump1 = 0 |
|
2592 | nump1 = 0 | |
2593 | nump2 = 0 |
|
2593 | nump2 = 0 | |
2594 | numother = 0 |
|
2594 | numother = 0 | |
2595 | nump1prev = 0 |
|
2595 | nump1prev = 0 | |
2596 | nump2prev = 0 |
|
2596 | nump2prev = 0 | |
2597 | chainlengths = [] |
|
2597 | chainlengths = [] | |
2598 |
|
2598 | |||
2599 | datasize = [None, 0, 0L] |
|
2599 | datasize = [None, 0, 0L] | |
2600 | fullsize = [None, 0, 0L] |
|
2600 | fullsize = [None, 0, 0L] | |
2601 | deltasize = [None, 0, 0L] |
|
2601 | deltasize = [None, 0, 0L] | |
2602 |
|
2602 | |||
2603 | def addsize(size, l): |
|
2603 | def addsize(size, l): | |
2604 | if l[0] is None or size < l[0]: |
|
2604 | if l[0] is None or size < l[0]: | |
2605 | l[0] = size |
|
2605 | l[0] = size | |
2606 | if size > l[1]: |
|
2606 | if size > l[1]: | |
2607 | l[1] = size |
|
2607 | l[1] = size | |
2608 | l[2] += size |
|
2608 | l[2] += size | |
2609 |
|
2609 | |||
2610 | numrevs = len(r) |
|
2610 | numrevs = len(r) | |
2611 | for rev in xrange(numrevs): |
|
2611 | for rev in xrange(numrevs): | |
2612 | p1, p2 = r.parentrevs(rev) |
|
2612 | p1, p2 = r.parentrevs(rev) | |
2613 | delta = r.deltaparent(rev) |
|
2613 | delta = r.deltaparent(rev) | |
2614 | if format > 0: |
|
2614 | if format > 0: | |
2615 | addsize(r.rawsize(rev), datasize) |
|
2615 | addsize(r.rawsize(rev), datasize) | |
2616 | if p2 != nullrev: |
|
2616 | if p2 != nullrev: | |
2617 | nummerges += 1 |
|
2617 | nummerges += 1 | |
2618 | size = r.length(rev) |
|
2618 | size = r.length(rev) | |
2619 | if delta == nullrev: |
|
2619 | if delta == nullrev: | |
2620 | chainlengths.append(0) |
|
2620 | chainlengths.append(0) | |
2621 | numfull += 1 |
|
2621 | numfull += 1 | |
2622 | addsize(size, fullsize) |
|
2622 | addsize(size, fullsize) | |
2623 | else: |
|
2623 | else: | |
2624 | chainlengths.append(chainlengths[delta] + 1) |
|
2624 | chainlengths.append(chainlengths[delta] + 1) | |
2625 | addsize(size, deltasize) |
|
2625 | addsize(size, deltasize) | |
2626 | if delta == rev - 1: |
|
2626 | if delta == rev - 1: | |
2627 | numprev += 1 |
|
2627 | numprev += 1 | |
2628 | if delta == p1: |
|
2628 | if delta == p1: | |
2629 | nump1prev += 1 |
|
2629 | nump1prev += 1 | |
2630 | elif delta == p2: |
|
2630 | elif delta == p2: | |
2631 | nump2prev += 1 |
|
2631 | nump2prev += 1 | |
2632 | elif delta == p1: |
|
2632 | elif delta == p1: | |
2633 | nump1 += 1 |
|
2633 | nump1 += 1 | |
2634 | elif delta == p2: |
|
2634 | elif delta == p2: | |
2635 | nump2 += 1 |
|
2635 | nump2 += 1 | |
2636 | elif delta != nullrev: |
|
2636 | elif delta != nullrev: | |
2637 | numother += 1 |
|
2637 | numother += 1 | |
2638 |
|
2638 | |||
2639 | # Adjust size min value for empty cases |
|
2639 | # Adjust size min value for empty cases | |
2640 | for size in (datasize, fullsize, deltasize): |
|
2640 | for size in (datasize, fullsize, deltasize): | |
2641 | if size[0] is None: |
|
2641 | if size[0] is None: | |
2642 | size[0] = 0 |
|
2642 | size[0] = 0 | |
2643 |
|
2643 | |||
2644 | numdeltas = numrevs - numfull |
|
2644 | numdeltas = numrevs - numfull | |
2645 | numoprev = numprev - nump1prev - nump2prev |
|
2645 | numoprev = numprev - nump1prev - nump2prev | |
2646 | totalrawsize = datasize[2] |
|
2646 | totalrawsize = datasize[2] | |
2647 | datasize[2] /= numrevs |
|
2647 | datasize[2] /= numrevs | |
2648 | fulltotal = fullsize[2] |
|
2648 | fulltotal = fullsize[2] | |
2649 | fullsize[2] /= numfull |
|
2649 | fullsize[2] /= numfull | |
2650 | deltatotal = deltasize[2] |
|
2650 | deltatotal = deltasize[2] | |
2651 | if numrevs - numfull > 0: |
|
2651 | if numrevs - numfull > 0: | |
2652 | deltasize[2] /= numrevs - numfull |
|
2652 | deltasize[2] /= numrevs - numfull | |
2653 | totalsize = fulltotal + deltatotal |
|
2653 | totalsize = fulltotal + deltatotal | |
2654 | avgchainlen = sum(chainlengths) / numrevs |
|
2654 | avgchainlen = sum(chainlengths) / numrevs | |
2655 | compratio = totalrawsize / totalsize |
|
2655 | compratio = totalrawsize / totalsize | |
2656 |
|
2656 | |||
2657 | basedfmtstr = '%%%dd\n' |
|
2657 | basedfmtstr = '%%%dd\n' | |
2658 | basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n' |
|
2658 | basepcfmtstr = '%%%dd %s(%%5.2f%%%%)\n' | |
2659 |
|
2659 | |||
2660 | def dfmtstr(max): |
|
2660 | def dfmtstr(max): | |
2661 | return basedfmtstr % len(str(max)) |
|
2661 | return basedfmtstr % len(str(max)) | |
2662 | def pcfmtstr(max, padding=0): |
|
2662 | def pcfmtstr(max, padding=0): | |
2663 | return basepcfmtstr % (len(str(max)), ' ' * padding) |
|
2663 | return basepcfmtstr % (len(str(max)), ' ' * padding) | |
2664 |
|
2664 | |||
2665 | def pcfmt(value, total): |
|
2665 | def pcfmt(value, total): | |
2666 | return (value, 100 * float(value) / total) |
|
2666 | return (value, 100 * float(value) / total) | |
2667 |
|
2667 | |||
2668 | ui.write(('format : %d\n') % format) |
|
2668 | ui.write(('format : %d\n') % format) | |
2669 | ui.write(('flags : %s\n') % ', '.join(flags)) |
|
2669 | ui.write(('flags : %s\n') % ', '.join(flags)) | |
2670 |
|
2670 | |||
2671 | ui.write('\n') |
|
2671 | ui.write('\n') | |
2672 | fmt = pcfmtstr(totalsize) |
|
2672 | fmt = pcfmtstr(totalsize) | |
2673 | fmt2 = dfmtstr(totalsize) |
|
2673 | fmt2 = dfmtstr(totalsize) | |
2674 | ui.write(('revisions : ') + fmt2 % numrevs) |
|
2674 | ui.write(('revisions : ') + fmt2 % numrevs) | |
2675 | ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) |
|
2675 | ui.write((' merges : ') + fmt % pcfmt(nummerges, numrevs)) | |
2676 | ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) |
|
2676 | ui.write((' normal : ') + fmt % pcfmt(numrevs - nummerges, numrevs)) | |
2677 | ui.write(('revisions : ') + fmt2 % numrevs) |
|
2677 | ui.write(('revisions : ') + fmt2 % numrevs) | |
2678 | ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) |
|
2678 | ui.write((' full : ') + fmt % pcfmt(numfull, numrevs)) | |
2679 | ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) |
|
2679 | ui.write((' deltas : ') + fmt % pcfmt(numdeltas, numrevs)) | |
2680 | ui.write(('revision size : ') + fmt2 % totalsize) |
|
2680 | ui.write(('revision size : ') + fmt2 % totalsize) | |
2681 | ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) |
|
2681 | ui.write((' full : ') + fmt % pcfmt(fulltotal, totalsize)) | |
2682 | ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) |
|
2682 | ui.write((' deltas : ') + fmt % pcfmt(deltatotal, totalsize)) | |
2683 |
|
2683 | |||
2684 | ui.write('\n') |
|
2684 | ui.write('\n') | |
2685 | fmt = dfmtstr(max(avgchainlen, compratio)) |
|
2685 | fmt = dfmtstr(max(avgchainlen, compratio)) | |
2686 | ui.write(('avg chain length : ') + fmt % avgchainlen) |
|
2686 | ui.write(('avg chain length : ') + fmt % avgchainlen) | |
2687 | ui.write(('compression ratio : ') + fmt % compratio) |
|
2687 | ui.write(('compression ratio : ') + fmt % compratio) | |
2688 |
|
2688 | |||
2689 | if format > 0: |
|
2689 | if format > 0: | |
2690 | ui.write('\n') |
|
2690 | ui.write('\n') | |
2691 | ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') |
|
2691 | ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') | |
2692 | % tuple(datasize)) |
|
2692 | % tuple(datasize)) | |
2693 | ui.write(('full revision size (min/max/avg) : %d / %d / %d\n') |
|
2693 | ui.write(('full revision size (min/max/avg) : %d / %d / %d\n') | |
2694 | % tuple(fullsize)) |
|
2694 | % tuple(fullsize)) | |
2695 | ui.write(('delta size (min/max/avg) : %d / %d / %d\n') |
|
2695 | ui.write(('delta size (min/max/avg) : %d / %d / %d\n') | |
2696 | % tuple(deltasize)) |
|
2696 | % tuple(deltasize)) | |
2697 |
|
2697 | |||
2698 | if numdeltas > 0: |
|
2698 | if numdeltas > 0: | |
2699 | ui.write('\n') |
|
2699 | ui.write('\n') | |
2700 | fmt = pcfmtstr(numdeltas) |
|
2700 | fmt = pcfmtstr(numdeltas) | |
2701 | fmt2 = pcfmtstr(numdeltas, 4) |
|
2701 | fmt2 = pcfmtstr(numdeltas, 4) | |
2702 | ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas)) |
|
2702 | ui.write(('deltas against prev : ') + fmt % pcfmt(numprev, numdeltas)) | |
2703 | if numprev > 0: |
|
2703 | if numprev > 0: | |
2704 | ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev, |
|
2704 | ui.write((' where prev = p1 : ') + fmt2 % pcfmt(nump1prev, | |
2705 | numprev)) |
|
2705 | numprev)) | |
2706 | ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev, |
|
2706 | ui.write((' where prev = p2 : ') + fmt2 % pcfmt(nump2prev, | |
2707 | numprev)) |
|
2707 | numprev)) | |
2708 | ui.write((' other : ') + fmt2 % pcfmt(numoprev, |
|
2708 | ui.write((' other : ') + fmt2 % pcfmt(numoprev, | |
2709 | numprev)) |
|
2709 | numprev)) | |
2710 | if gdelta: |
|
2710 | if gdelta: | |
2711 | ui.write(('deltas against p1 : ') |
|
2711 | ui.write(('deltas against p1 : ') | |
2712 | + fmt % pcfmt(nump1, numdeltas)) |
|
2712 | + fmt % pcfmt(nump1, numdeltas)) | |
2713 | ui.write(('deltas against p2 : ') |
|
2713 | ui.write(('deltas against p2 : ') | |
2714 | + fmt % pcfmt(nump2, numdeltas)) |
|
2714 | + fmt % pcfmt(nump2, numdeltas)) | |
2715 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, |
|
2715 | ui.write(('deltas against other : ') + fmt % pcfmt(numother, | |
2716 | numdeltas)) |
|
2716 | numdeltas)) | |
2717 |
|
2717 | |||
2718 | @command('debugrevspec', |
|
2718 | @command('debugrevspec', | |
2719 | [('', 'optimize', None, _('print parsed tree after optimizing'))], |
|
2719 | [('', 'optimize', None, _('print parsed tree after optimizing'))], | |
2720 | ('REVSPEC')) |
|
2720 | ('REVSPEC')) | |
2721 | def debugrevspec(ui, repo, expr, **opts): |
|
2721 | def debugrevspec(ui, repo, expr, **opts): | |
2722 | """parse and apply a revision specification |
|
2722 | """parse and apply a revision specification | |
2723 |
|
2723 | |||
2724 | Use --verbose to print the parsed tree before and after aliases |
|
2724 | Use --verbose to print the parsed tree before and after aliases | |
2725 | expansion. |
|
2725 | expansion. | |
2726 | """ |
|
2726 | """ | |
2727 | if ui.verbose: |
|
2727 | if ui.verbose: | |
2728 | tree = revset.parse(expr)[0] |
|
2728 | tree = revset.parse(expr)[0] | |
2729 | ui.note(revset.prettyformat(tree), "\n") |
|
2729 | ui.note(revset.prettyformat(tree), "\n") | |
2730 | newtree = revset.findaliases(ui, tree) |
|
2730 | newtree = revset.findaliases(ui, tree) | |
2731 | if newtree != tree: |
|
2731 | if newtree != tree: | |
2732 | ui.note(revset.prettyformat(newtree), "\n") |
|
2732 | ui.note(revset.prettyformat(newtree), "\n") | |
2733 | if opts["optimize"]: |
|
2733 | if opts["optimize"]: | |
2734 | weight, optimizedtree = revset.optimize(newtree, True) |
|
2734 | weight, optimizedtree = revset.optimize(newtree, True) | |
2735 | ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n") |
|
2735 | ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n") | |
2736 | func = revset.match(ui, expr) |
|
2736 | func = revset.match(ui, expr) | |
2737 | for c in func(repo, revset.spanset(repo)): |
|
2737 | for c in func(repo, revset.spanset(repo)): | |
2738 | ui.write("%s\n" % c) |
|
2738 | ui.write("%s\n" % c) | |
2739 |
|
2739 | |||
2740 | @command('debugsetparents', [], _('REV1 [REV2]')) |
|
2740 | @command('debugsetparents', [], _('REV1 [REV2]')) | |
2741 | def debugsetparents(ui, repo, rev1, rev2=None): |
|
2741 | def debugsetparents(ui, repo, rev1, rev2=None): | |
2742 | """manually set the parents of the current working directory |
|
2742 | """manually set the parents of the current working directory | |
2743 |
|
2743 | |||
2744 | This is useful for writing repository conversion tools, but should |
|
2744 | This is useful for writing repository conversion tools, but should | |
2745 | be used with care. |
|
2745 | be used with care. | |
2746 |
|
2746 | |||
2747 | Returns 0 on success. |
|
2747 | Returns 0 on success. | |
2748 | """ |
|
2748 | """ | |
2749 |
|
2749 | |||
2750 | r1 = scmutil.revsingle(repo, rev1).node() |
|
2750 | r1 = scmutil.revsingle(repo, rev1).node() | |
2751 | r2 = scmutil.revsingle(repo, rev2, 'null').node() |
|
2751 | r2 = scmutil.revsingle(repo, rev2, 'null').node() | |
2752 |
|
2752 | |||
2753 | wlock = repo.wlock() |
|
2753 | wlock = repo.wlock() | |
2754 | try: |
|
2754 | try: | |
2755 | repo.dirstate.beginparentchange() |
|
2755 | repo.dirstate.beginparentchange() | |
2756 | repo.setparents(r1, r2) |
|
2756 | repo.setparents(r1, r2) | |
2757 | repo.dirstate.endparentchange() |
|
2757 | repo.dirstate.endparentchange() | |
2758 | finally: |
|
2758 | finally: | |
2759 | wlock.release() |
|
2759 | wlock.release() | |
2760 |
|
2760 | |||
2761 | @command('debugdirstate|debugstate', |
|
2761 | @command('debugdirstate|debugstate', | |
2762 | [('', 'nodates', None, _('do not display the saved mtime')), |
|
2762 | [('', 'nodates', None, _('do not display the saved mtime')), | |
2763 | ('', 'datesort', None, _('sort by saved mtime'))], |
|
2763 | ('', 'datesort', None, _('sort by saved mtime'))], | |
2764 | _('[OPTION]...')) |
|
2764 | _('[OPTION]...')) | |
2765 | def debugstate(ui, repo, nodates=None, datesort=None): |
|
2765 | def debugstate(ui, repo, nodates=None, datesort=None): | |
2766 | """show the contents of the current dirstate""" |
|
2766 | """show the contents of the current dirstate""" | |
2767 | timestr = "" |
|
2767 | timestr = "" | |
2768 | showdate = not nodates |
|
2768 | showdate = not nodates | |
2769 | if datesort: |
|
2769 | if datesort: | |
2770 | keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename |
|
2770 | keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename | |
2771 | else: |
|
2771 | else: | |
2772 | keyfunc = None # sort by filename |
|
2772 | keyfunc = None # sort by filename | |
2773 | for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): |
|
2773 | for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc): | |
2774 | if showdate: |
|
2774 | if showdate: | |
2775 | if ent[3] == -1: |
|
2775 | if ent[3] == -1: | |
2776 | # Pad or slice to locale representation |
|
2776 | # Pad or slice to locale representation | |
2777 | locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", |
|
2777 | locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ", | |
2778 | time.localtime(0))) |
|
2778 | time.localtime(0))) | |
2779 | timestr = 'unset' |
|
2779 | timestr = 'unset' | |
2780 | timestr = (timestr[:locale_len] + |
|
2780 | timestr = (timestr[:locale_len] + | |
2781 | ' ' * (locale_len - len(timestr))) |
|
2781 | ' ' * (locale_len - len(timestr))) | |
2782 | else: |
|
2782 | else: | |
2783 | timestr = time.strftime("%Y-%m-%d %H:%M:%S ", |
|
2783 | timestr = time.strftime("%Y-%m-%d %H:%M:%S ", | |
2784 | time.localtime(ent[3])) |
|
2784 | time.localtime(ent[3])) | |
2785 | if ent[1] & 020000: |
|
2785 | if ent[1] & 020000: | |
2786 | mode = 'lnk' |
|
2786 | mode = 'lnk' | |
2787 | else: |
|
2787 | else: | |
2788 | mode = '%3o' % (ent[1] & 0777 & ~util.umask) |
|
2788 | mode = '%3o' % (ent[1] & 0777 & ~util.umask) | |
2789 | ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) |
|
2789 | ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_)) | |
2790 | for f in repo.dirstate.copies(): |
|
2790 | for f in repo.dirstate.copies(): | |
2791 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) |
|
2791 | ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f)) | |
2792 |
|
2792 | |||
2793 | @command('debugsub', |
|
2793 | @command('debugsub', | |
2794 | [('r', 'rev', '', |
|
2794 | [('r', 'rev', '', | |
2795 | _('revision to check'), _('REV'))], |
|
2795 | _('revision to check'), _('REV'))], | |
2796 | _('[-r REV] [REV]')) |
|
2796 | _('[-r REV] [REV]')) | |
2797 | def debugsub(ui, repo, rev=None): |
|
2797 | def debugsub(ui, repo, rev=None): | |
2798 | ctx = scmutil.revsingle(repo, rev, None) |
|
2798 | ctx = scmutil.revsingle(repo, rev, None) | |
2799 | for k, v in sorted(ctx.substate.items()): |
|
2799 | for k, v in sorted(ctx.substate.items()): | |
2800 | ui.write(('path %s\n') % k) |
|
2800 | ui.write(('path %s\n') % k) | |
2801 | ui.write((' source %s\n') % v[0]) |
|
2801 | ui.write((' source %s\n') % v[0]) | |
2802 | ui.write((' revision %s\n') % v[1]) |
|
2802 | ui.write((' revision %s\n') % v[1]) | |
2803 |
|
2803 | |||
2804 | @command('debugsuccessorssets', |
|
2804 | @command('debugsuccessorssets', | |
2805 | [], |
|
2805 | [], | |
2806 | _('[REV]')) |
|
2806 | _('[REV]')) | |
2807 | def debugsuccessorssets(ui, repo, *revs): |
|
2807 | def debugsuccessorssets(ui, repo, *revs): | |
2808 | """show set of successors for revision |
|
2808 | """show set of successors for revision | |
2809 |
|
2809 | |||
2810 | A successors set of changeset A is a consistent group of revisions that |
|
2810 | A successors set of changeset A is a consistent group of revisions that | |
2811 | succeed A. It contains non-obsolete changesets only. |
|
2811 | succeed A. It contains non-obsolete changesets only. | |
2812 |
|
2812 | |||
2813 | In most cases a changeset A has a single successors set containing a single |
|
2813 | In most cases a changeset A has a single successors set containing a single | |
2814 | successor (changeset A replaced by A'). |
|
2814 | successor (changeset A replaced by A'). | |
2815 |
|
2815 | |||
2816 | A changeset that is made obsolete with no successors are called "pruned". |
|
2816 | A changeset that is made obsolete with no successors are called "pruned". | |
2817 | Such changesets have no successors sets at all. |
|
2817 | Such changesets have no successors sets at all. | |
2818 |
|
2818 | |||
2819 | A changeset that has been "split" will have a successors set containing |
|
2819 | A changeset that has been "split" will have a successors set containing | |
2820 | more than one successor. |
|
2820 | more than one successor. | |
2821 |
|
2821 | |||
2822 | A changeset that has been rewritten in multiple different ways is called |
|
2822 | A changeset that has been rewritten in multiple different ways is called | |
2823 | "divergent". Such changesets have multiple successor sets (each of which |
|
2823 | "divergent". Such changesets have multiple successor sets (each of which | |
2824 | may also be split, i.e. have multiple successors). |
|
2824 | may also be split, i.e. have multiple successors). | |
2825 |
|
2825 | |||
2826 | Results are displayed as follows:: |
|
2826 | Results are displayed as follows:: | |
2827 |
|
2827 | |||
2828 | <rev1> |
|
2828 | <rev1> | |
2829 | <successors-1A> |
|
2829 | <successors-1A> | |
2830 | <rev2> |
|
2830 | <rev2> | |
2831 | <successors-2A> |
|
2831 | <successors-2A> | |
2832 | <successors-2B1> <successors-2B2> <successors-2B3> |
|
2832 | <successors-2B1> <successors-2B2> <successors-2B3> | |
2833 |
|
2833 | |||
2834 | Here rev2 has two possible (i.e. divergent) successors sets. The first |
|
2834 | Here rev2 has two possible (i.e. divergent) successors sets. The first | |
2835 | holds one element, whereas the second holds three (i.e. the changeset has |
|
2835 | holds one element, whereas the second holds three (i.e. the changeset has | |
2836 | been split). |
|
2836 | been split). | |
2837 | """ |
|
2837 | """ | |
2838 | # passed to successorssets caching computation from one call to another |
|
2838 | # passed to successorssets caching computation from one call to another | |
2839 | cache = {} |
|
2839 | cache = {} | |
2840 | ctx2str = str |
|
2840 | ctx2str = str | |
2841 | node2str = short |
|
2841 | node2str = short | |
2842 | if ui.debug(): |
|
2842 | if ui.debug(): | |
2843 | def ctx2str(ctx): |
|
2843 | def ctx2str(ctx): | |
2844 | return ctx.hex() |
|
2844 | return ctx.hex() | |
2845 | node2str = hex |
|
2845 | node2str = hex | |
2846 | for rev in scmutil.revrange(repo, revs): |
|
2846 | for rev in scmutil.revrange(repo, revs): | |
2847 | ctx = repo[rev] |
|
2847 | ctx = repo[rev] | |
2848 | ui.write('%s\n'% ctx2str(ctx)) |
|
2848 | ui.write('%s\n'% ctx2str(ctx)) | |
2849 | for succsset in obsolete.successorssets(repo, ctx.node(), cache): |
|
2849 | for succsset in obsolete.successorssets(repo, ctx.node(), cache): | |
2850 | if succsset: |
|
2850 | if succsset: | |
2851 | ui.write(' ') |
|
2851 | ui.write(' ') | |
2852 | ui.write(node2str(succsset[0])) |
|
2852 | ui.write(node2str(succsset[0])) | |
2853 | for node in succsset[1:]: |
|
2853 | for node in succsset[1:]: | |
2854 | ui.write(' ') |
|
2854 | ui.write(' ') | |
2855 | ui.write(node2str(node)) |
|
2855 | ui.write(node2str(node)) | |
2856 | ui.write('\n') |
|
2856 | ui.write('\n') | |
2857 |
|
2857 | |||
2858 | @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'), inferrepo=True) |
|
2858 | @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'), inferrepo=True) | |
2859 | def debugwalk(ui, repo, *pats, **opts): |
|
2859 | def debugwalk(ui, repo, *pats, **opts): | |
2860 | """show how files match on given patterns""" |
|
2860 | """show how files match on given patterns""" | |
2861 | m = scmutil.match(repo[None], pats, opts) |
|
2861 | m = scmutil.match(repo[None], pats, opts) | |
2862 | items = list(repo.walk(m)) |
|
2862 | items = list(repo.walk(m)) | |
2863 | if not items: |
|
2863 | if not items: | |
2864 | return |
|
2864 | return | |
2865 | f = lambda fn: fn |
|
2865 | f = lambda fn: fn | |
2866 | if ui.configbool('ui', 'slash') and os.sep != '/': |
|
2866 | if ui.configbool('ui', 'slash') and os.sep != '/': | |
2867 | f = lambda fn: util.normpath(fn) |
|
2867 | f = lambda fn: util.normpath(fn) | |
2868 | fmt = 'f %%-%ds %%-%ds %%s' % ( |
|
2868 | fmt = 'f %%-%ds %%-%ds %%s' % ( | |
2869 | max([len(abs) for abs in items]), |
|
2869 | max([len(abs) for abs in items]), | |
2870 | max([len(m.rel(abs)) for abs in items])) |
|
2870 | max([len(m.rel(abs)) for abs in items])) | |
2871 | for abs in items: |
|
2871 | for abs in items: | |
2872 | line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') |
|
2872 | line = fmt % (abs, f(m.rel(abs)), m.exact(abs) and 'exact' or '') | |
2873 | ui.write("%s\n" % line.rstrip()) |
|
2873 | ui.write("%s\n" % line.rstrip()) | |
2874 |
|
2874 | |||
2875 | @command('debugwireargs', |
|
2875 | @command('debugwireargs', | |
2876 | [('', 'three', '', 'three'), |
|
2876 | [('', 'three', '', 'three'), | |
2877 | ('', 'four', '', 'four'), |
|
2877 | ('', 'four', '', 'four'), | |
2878 | ('', 'five', '', 'five'), |
|
2878 | ('', 'five', '', 'five'), | |
2879 | ] + remoteopts, |
|
2879 | ] + remoteopts, | |
2880 | _('REPO [OPTIONS]... [ONE [TWO]]'), |
|
2880 | _('REPO [OPTIONS]... [ONE [TWO]]'), | |
2881 | norepo=True) |
|
2881 | norepo=True) | |
2882 | def debugwireargs(ui, repopath, *vals, **opts): |
|
2882 | def debugwireargs(ui, repopath, *vals, **opts): | |
2883 | repo = hg.peer(ui, opts, repopath) |
|
2883 | repo = hg.peer(ui, opts, repopath) | |
2884 | for opt in remoteopts: |
|
2884 | for opt in remoteopts: | |
2885 | del opts[opt[1]] |
|
2885 | del opts[opt[1]] | |
2886 | args = {} |
|
2886 | args = {} | |
2887 | for k, v in opts.iteritems(): |
|
2887 | for k, v in opts.iteritems(): | |
2888 | if v: |
|
2888 | if v: | |
2889 | args[k] = v |
|
2889 | args[k] = v | |
2890 | # run twice to check that we don't mess up the stream for the next command |
|
2890 | # run twice to check that we don't mess up the stream for the next command | |
2891 | res1 = repo.debugwireargs(*vals, **args) |
|
2891 | res1 = repo.debugwireargs(*vals, **args) | |
2892 | res2 = repo.debugwireargs(*vals, **args) |
|
2892 | res2 = repo.debugwireargs(*vals, **args) | |
2893 | ui.write("%s\n" % res1) |
|
2893 | ui.write("%s\n" % res1) | |
2894 | if res1 != res2: |
|
2894 | if res1 != res2: | |
2895 | ui.warn("%s\n" % res2) |
|
2895 | ui.warn("%s\n" % res2) | |
2896 |
|
2896 | |||
2897 | @command('^diff', |
|
2897 | @command('^diff', | |
2898 | [('r', 'rev', [], _('revision'), _('REV')), |
|
2898 | [('r', 'rev', [], _('revision'), _('REV')), | |
2899 | ('c', 'change', '', _('change made by revision'), _('REV')) |
|
2899 | ('c', 'change', '', _('change made by revision'), _('REV')) | |
2900 | ] + diffopts + diffopts2 + walkopts + subrepoopts, |
|
2900 | ] + diffopts + diffopts2 + walkopts + subrepoopts, | |
2901 | _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'), |
|
2901 | _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'), | |
2902 | inferrepo=True) |
|
2902 | inferrepo=True) | |
2903 | def diff(ui, repo, *pats, **opts): |
|
2903 | def diff(ui, repo, *pats, **opts): | |
2904 | """diff repository (or selected files) |
|
2904 | """diff repository (or selected files) | |
2905 |
|
2905 | |||
2906 | Show differences between revisions for the specified files. |
|
2906 | Show differences between revisions for the specified files. | |
2907 |
|
2907 | |||
2908 | Differences between files are shown using the unified diff format. |
|
2908 | Differences between files are shown using the unified diff format. | |
2909 |
|
2909 | |||
2910 | .. note:: |
|
2910 | .. note:: | |
2911 |
|
2911 | |||
2912 | diff may generate unexpected results for merges, as it will |
|
2912 | diff may generate unexpected results for merges, as it will | |
2913 | default to comparing against the working directory's first |
|
2913 | default to comparing against the working directory's first | |
2914 | parent changeset if no revisions are specified. |
|
2914 | parent changeset if no revisions are specified. | |
2915 |
|
2915 | |||
2916 | When two revision arguments are given, then changes are shown |
|
2916 | When two revision arguments are given, then changes are shown | |
2917 | between those revisions. If only one revision is specified then |
|
2917 | between those revisions. If only one revision is specified then | |
2918 | that revision is compared to the working directory, and, when no |
|
2918 | that revision is compared to the working directory, and, when no | |
2919 | revisions are specified, the working directory files are compared |
|
2919 | revisions are specified, the working directory files are compared | |
2920 | to its parent. |
|
2920 | to its parent. | |
2921 |
|
2921 | |||
2922 | Alternatively you can specify -c/--change with a revision to see |
|
2922 | Alternatively you can specify -c/--change with a revision to see | |
2923 | the changes in that changeset relative to its first parent. |
|
2923 | the changes in that changeset relative to its first parent. | |
2924 |
|
2924 | |||
2925 | Without the -a/--text option, diff will avoid generating diffs of |
|
2925 | Without the -a/--text option, diff will avoid generating diffs of | |
2926 | files it detects as binary. With -a, diff will generate a diff |
|
2926 | files it detects as binary. With -a, diff will generate a diff | |
2927 | anyway, probably with undesirable results. |
|
2927 | anyway, probably with undesirable results. | |
2928 |
|
2928 | |||
2929 | Use the -g/--git option to generate diffs in the git extended diff |
|
2929 | Use the -g/--git option to generate diffs in the git extended diff | |
2930 | format. For more information, read :hg:`help diffs`. |
|
2930 | format. For more information, read :hg:`help diffs`. | |
2931 |
|
2931 | |||
2932 | .. container:: verbose |
|
2932 | .. container:: verbose | |
2933 |
|
2933 | |||
2934 | Examples: |
|
2934 | Examples: | |
2935 |
|
2935 | |||
2936 | - compare a file in the current working directory to its parent:: |
|
2936 | - compare a file in the current working directory to its parent:: | |
2937 |
|
2937 | |||
2938 | hg diff foo.c |
|
2938 | hg diff foo.c | |
2939 |
|
2939 | |||
2940 | - compare two historical versions of a directory, with rename info:: |
|
2940 | - compare two historical versions of a directory, with rename info:: | |
2941 |
|
2941 | |||
2942 | hg diff --git -r 1.0:1.2 lib/ |
|
2942 | hg diff --git -r 1.0:1.2 lib/ | |
2943 |
|
2943 | |||
2944 | - get change stats relative to the last change on some date:: |
|
2944 | - get change stats relative to the last change on some date:: | |
2945 |
|
2945 | |||
2946 | hg diff --stat -r "date('may 2')" |
|
2946 | hg diff --stat -r "date('may 2')" | |
2947 |
|
2947 | |||
2948 | - diff all newly-added files that contain a keyword:: |
|
2948 | - diff all newly-added files that contain a keyword:: | |
2949 |
|
2949 | |||
2950 | hg diff "set:added() and grep(GNU)" |
|
2950 | hg diff "set:added() and grep(GNU)" | |
2951 |
|
2951 | |||
2952 | - compare a revision and its parents:: |
|
2952 | - compare a revision and its parents:: | |
2953 |
|
2953 | |||
2954 | hg diff -c 9353 # compare against first parent |
|
2954 | hg diff -c 9353 # compare against first parent | |
2955 | hg diff -r 9353^:9353 # same using revset syntax |
|
2955 | hg diff -r 9353^:9353 # same using revset syntax | |
2956 | hg diff -r 9353^2:9353 # compare against the second parent |
|
2956 | hg diff -r 9353^2:9353 # compare against the second parent | |
2957 |
|
2957 | |||
2958 | Returns 0 on success. |
|
2958 | Returns 0 on success. | |
2959 | """ |
|
2959 | """ | |
2960 |
|
2960 | |||
2961 | revs = opts.get('rev') |
|
2961 | revs = opts.get('rev') | |
2962 | change = opts.get('change') |
|
2962 | change = opts.get('change') | |
2963 | stat = opts.get('stat') |
|
2963 | stat = opts.get('stat') | |
2964 | reverse = opts.get('reverse') |
|
2964 | reverse = opts.get('reverse') | |
2965 |
|
2965 | |||
2966 | if revs and change: |
|
2966 | if revs and change: | |
2967 | msg = _('cannot specify --rev and --change at the same time') |
|
2967 | msg = _('cannot specify --rev and --change at the same time') | |
2968 | raise util.Abort(msg) |
|
2968 | raise util.Abort(msg) | |
2969 | elif change: |
|
2969 | elif change: | |
2970 | node2 = scmutil.revsingle(repo, change, None).node() |
|
2970 | node2 = scmutil.revsingle(repo, change, None).node() | |
2971 | node1 = repo[node2].p1().node() |
|
2971 | node1 = repo[node2].p1().node() | |
2972 | else: |
|
2972 | else: | |
2973 | node1, node2 = scmutil.revpair(repo, revs) |
|
2973 | node1, node2 = scmutil.revpair(repo, revs) | |
2974 |
|
2974 | |||
2975 | if reverse: |
|
2975 | if reverse: | |
2976 | node1, node2 = node2, node1 |
|
2976 | node1, node2 = node2, node1 | |
2977 |
|
2977 | |||
2978 | diffopts = patch.diffopts(ui, opts) |
|
2978 | diffopts = patch.diffopts(ui, opts) | |
2979 | m = scmutil.match(repo[node2], pats, opts) |
|
2979 | m = scmutil.match(repo[node2], pats, opts) | |
2980 | cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, |
|
2980 | cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat, | |
2981 | listsubrepos=opts.get('subrepos')) |
|
2981 | listsubrepos=opts.get('subrepos')) | |
2982 |
|
2982 | |||
2983 | @command('^export', |
|
2983 | @command('^export', | |
2984 | [('o', 'output', '', |
|
2984 | [('o', 'output', '', | |
2985 | _('print output to file with formatted name'), _('FORMAT')), |
|
2985 | _('print output to file with formatted name'), _('FORMAT')), | |
2986 | ('', 'switch-parent', None, _('diff against the second parent')), |
|
2986 | ('', 'switch-parent', None, _('diff against the second parent')), | |
2987 | ('r', 'rev', [], _('revisions to export'), _('REV')), |
|
2987 | ('r', 'rev', [], _('revisions to export'), _('REV')), | |
2988 | ] + diffopts, |
|
2988 | ] + diffopts, | |
2989 | _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...')) |
|
2989 | _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...')) | |
2990 | def export(ui, repo, *changesets, **opts): |
|
2990 | def export(ui, repo, *changesets, **opts): | |
2991 | """dump the header and diffs for one or more changesets |
|
2991 | """dump the header and diffs for one or more changesets | |
2992 |
|
2992 | |||
2993 | Print the changeset header and diffs for one or more revisions. |
|
2993 | Print the changeset header and diffs for one or more revisions. | |
2994 | If no revision is given, the parent of the working directory is used. |
|
2994 | If no revision is given, the parent of the working directory is used. | |
2995 |
|
2995 | |||
2996 | The information shown in the changeset header is: author, date, |
|
2996 | The information shown in the changeset header is: author, date, | |
2997 | branch name (if non-default), changeset hash, parent(s) and commit |
|
2997 | branch name (if non-default), changeset hash, parent(s) and commit | |
2998 | comment. |
|
2998 | comment. | |
2999 |
|
2999 | |||
3000 | .. note:: |
|
3000 | .. note:: | |
3001 |
|
3001 | |||
3002 | export may generate unexpected diff output for merge |
|
3002 | export may generate unexpected diff output for merge | |
3003 | changesets, as it will compare the merge changeset against its |
|
3003 | changesets, as it will compare the merge changeset against its | |
3004 | first parent only. |
|
3004 | first parent only. | |
3005 |
|
3005 | |||
3006 | Output may be to a file, in which case the name of the file is |
|
3006 | Output may be to a file, in which case the name of the file is | |
3007 | given using a format string. The formatting rules are as follows: |
|
3007 | given using a format string. The formatting rules are as follows: | |
3008 |
|
3008 | |||
3009 | :``%%``: literal "%" character |
|
3009 | :``%%``: literal "%" character | |
3010 | :``%H``: changeset hash (40 hexadecimal digits) |
|
3010 | :``%H``: changeset hash (40 hexadecimal digits) | |
3011 | :``%N``: number of patches being generated |
|
3011 | :``%N``: number of patches being generated | |
3012 | :``%R``: changeset revision number |
|
3012 | :``%R``: changeset revision number | |
3013 | :``%b``: basename of the exporting repository |
|
3013 | :``%b``: basename of the exporting repository | |
3014 | :``%h``: short-form changeset hash (12 hexadecimal digits) |
|
3014 | :``%h``: short-form changeset hash (12 hexadecimal digits) | |
3015 | :``%m``: first line of the commit message (only alphanumeric characters) |
|
3015 | :``%m``: first line of the commit message (only alphanumeric characters) | |
3016 | :``%n``: zero-padded sequence number, starting at 1 |
|
3016 | :``%n``: zero-padded sequence number, starting at 1 | |
3017 | :``%r``: zero-padded changeset revision number |
|
3017 | :``%r``: zero-padded changeset revision number | |
3018 |
|
3018 | |||
3019 | Without the -a/--text option, export will avoid generating diffs |
|
3019 | Without the -a/--text option, export will avoid generating diffs | |
3020 | of files it detects as binary. With -a, export will generate a |
|
3020 | of files it detects as binary. With -a, export will generate a | |
3021 | diff anyway, probably with undesirable results. |
|
3021 | diff anyway, probably with undesirable results. | |
3022 |
|
3022 | |||
3023 | Use the -g/--git option to generate diffs in the git extended diff |
|
3023 | Use the -g/--git option to generate diffs in the git extended diff | |
3024 | format. See :hg:`help diffs` for more information. |
|
3024 | format. See :hg:`help diffs` for more information. | |
3025 |
|
3025 | |||
3026 | With the --switch-parent option, the diff will be against the |
|
3026 | With the --switch-parent option, the diff will be against the | |
3027 | second parent. It can be useful to review a merge. |
|
3027 | second parent. It can be useful to review a merge. | |
3028 |
|
3028 | |||
3029 | .. container:: verbose |
|
3029 | .. container:: verbose | |
3030 |
|
3030 | |||
3031 | Examples: |
|
3031 | Examples: | |
3032 |
|
3032 | |||
3033 | - use export and import to transplant a bugfix to the current |
|
3033 | - use export and import to transplant a bugfix to the current | |
3034 | branch:: |
|
3034 | branch:: | |
3035 |
|
3035 | |||
3036 | hg export -r 9353 | hg import - |
|
3036 | hg export -r 9353 | hg import - | |
3037 |
|
3037 | |||
3038 | - export all the changesets between two revisions to a file with |
|
3038 | - export all the changesets between two revisions to a file with | |
3039 | rename information:: |
|
3039 | rename information:: | |
3040 |
|
3040 | |||
3041 | hg export --git -r 123:150 > changes.txt |
|
3041 | hg export --git -r 123:150 > changes.txt | |
3042 |
|
3042 | |||
3043 | - split outgoing changes into a series of patches with |
|
3043 | - split outgoing changes into a series of patches with | |
3044 | descriptive names:: |
|
3044 | descriptive names:: | |
3045 |
|
3045 | |||
3046 | hg export -r "outgoing()" -o "%n-%m.patch" |
|
3046 | hg export -r "outgoing()" -o "%n-%m.patch" | |
3047 |
|
3047 | |||
3048 | Returns 0 on success. |
|
3048 | Returns 0 on success. | |
3049 | """ |
|
3049 | """ | |
3050 | changesets += tuple(opts.get('rev', [])) |
|
3050 | changesets += tuple(opts.get('rev', [])) | |
3051 | if not changesets: |
|
3051 | if not changesets: | |
3052 | changesets = ['.'] |
|
3052 | changesets = ['.'] | |
3053 | revs = scmutil.revrange(repo, changesets) |
|
3053 | revs = scmutil.revrange(repo, changesets) | |
3054 | if not revs: |
|
3054 | if not revs: | |
3055 | raise util.Abort(_("export requires at least one changeset")) |
|
3055 | raise util.Abort(_("export requires at least one changeset")) | |
3056 | if len(revs) > 1: |
|
3056 | if len(revs) > 1: | |
3057 | ui.note(_('exporting patches:\n')) |
|
3057 | ui.note(_('exporting patches:\n')) | |
3058 | else: |
|
3058 | else: | |
3059 | ui.note(_('exporting patch:\n')) |
|
3059 | ui.note(_('exporting patch:\n')) | |
3060 | cmdutil.export(repo, revs, template=opts.get('output'), |
|
3060 | cmdutil.export(repo, revs, template=opts.get('output'), | |
3061 | switch_parent=opts.get('switch_parent'), |
|
3061 | switch_parent=opts.get('switch_parent'), | |
3062 | opts=patch.diffopts(ui, opts)) |
|
3062 | opts=patch.diffopts(ui, opts)) | |
3063 |
|
3063 | |||
|
3064 | @command('files', | |||
|
3065 | [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), | |||
|
3066 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), | |||
|
3067 | ] + walkopts, | |||
|
3068 | _('[OPTION]... [PATTERN]...')) | |||
|
3069 | def files(ui, repo, *pats, **opts): | |||
|
3070 | """list tracked files | |||
|
3071 | ||||
|
3072 | Print files under Mercurial control in the working directory or | |||
|
3073 | specified revision whose names match the given patterns (excluding | |||
|
3074 | removed files). | |||
|
3075 | ||||
|
3076 | If no patterns are given to match, this command prints the names | |||
|
3077 | of all files under Mercurial control in the working copy. | |||
|
3078 | ||||
|
3079 | .. container:: verbose | |||
|
3080 | ||||
|
3081 | Examples: | |||
|
3082 | ||||
|
3083 | - list all files under the current directory:: | |||
|
3084 | ||||
|
3085 | hg files . | |||
|
3086 | ||||
|
3087 | - shows sizes and flags for current revision:: | |||
|
3088 | ||||
|
3089 | hg files -vr . | |||
|
3090 | ||||
|
3091 | - list all files named README:: | |||
|
3092 | ||||
|
3093 | hg files -I "**/README" | |||
|
3094 | ||||
|
3095 | - list all binary files:: | |||
|
3096 | ||||
|
3097 | hg files "set:binary()" | |||
|
3098 | ||||
|
3099 | - find files containing a regular expression: | |||
|
3100 | ||||
|
3101 | hg files "set:grep('bob')" | |||
|
3102 | ||||
|
3103 | - search tracked file contents with xargs and grep:: | |||
|
3104 | ||||
|
3105 | hg files -0 | xargs -0 grep foo | |||
|
3106 | ||||
|
3107 | See :hg:'help pattern' and :hg:'help revsets' for more information | |||
|
3108 | on specifying file patterns. | |||
|
3109 | ||||
|
3110 | Returns 0 if a match is found, 1 otherwise. | |||
|
3111 | ||||
|
3112 | """ | |||
|
3113 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) | |||
|
3114 | rev = ctx.rev() | |||
|
3115 | ret = 1 | |||
|
3116 | ||||
|
3117 | end = '\n' | |||
|
3118 | if opts.get('print0'): | |||
|
3119 | end = '\0' | |||
|
3120 | fm = ui.formatter('status', opts) | |||
|
3121 | fmt = '%s' + end | |||
|
3122 | ||||
|
3123 | m = scmutil.match(ctx, pats, opts) | |||
|
3124 | for f in ctx.walk(m): | |||
|
3125 | if rev is None and repo.dirstate[f] in 'R?!': | |||
|
3126 | continue | |||
|
3127 | fm.startitem() | |||
|
3128 | if ui.verbose: | |||
|
3129 | fc = ctx[f] | |||
|
3130 | fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags()) | |||
|
3131 | fm.data(abspath=f) | |||
|
3132 | fm.write('path', fmt, m.rel(f)) | |||
|
3133 | ret = 0 | |||
|
3134 | ||||
|
3135 | fm.end() | |||
|
3136 | ||||
|
3137 | return ret | |||
|
3138 | ||||
3064 | @command('^forget', walkopts, _('[OPTION]... FILE...'), inferrepo=True) |
|
3139 | @command('^forget', walkopts, _('[OPTION]... FILE...'), inferrepo=True) | |
3065 | def forget(ui, repo, *pats, **opts): |
|
3140 | def forget(ui, repo, *pats, **opts): | |
3066 | """forget the specified files on the next commit |
|
3141 | """forget the specified files on the next commit | |
3067 |
|
3142 | |||
3068 | Mark the specified files so they will no longer be tracked |
|
3143 | Mark the specified files so they will no longer be tracked | |
3069 | after the next commit. |
|
3144 | after the next commit. | |
3070 |
|
3145 | |||
3071 | This only removes files from the current branch, not from the |
|
3146 | This only removes files from the current branch, not from the | |
3072 | entire project history, and it does not delete them from the |
|
3147 | entire project history, and it does not delete them from the | |
3073 | working directory. |
|
3148 | working directory. | |
3074 |
|
3149 | |||
3075 | To undo a forget before the next commit, see :hg:`add`. |
|
3150 | To undo a forget before the next commit, see :hg:`add`. | |
3076 |
|
3151 | |||
3077 | .. container:: verbose |
|
3152 | .. container:: verbose | |
3078 |
|
3153 | |||
3079 | Examples: |
|
3154 | Examples: | |
3080 |
|
3155 | |||
3081 | - forget newly-added binary files:: |
|
3156 | - forget newly-added binary files:: | |
3082 |
|
3157 | |||
3083 | hg forget "set:added() and binary()" |
|
3158 | hg forget "set:added() and binary()" | |
3084 |
|
3159 | |||
3085 | - forget files that would be excluded by .hgignore:: |
|
3160 | - forget files that would be excluded by .hgignore:: | |
3086 |
|
3161 | |||
3087 | hg forget "set:hgignore()" |
|
3162 | hg forget "set:hgignore()" | |
3088 |
|
3163 | |||
3089 | Returns 0 on success. |
|
3164 | Returns 0 on success. | |
3090 | """ |
|
3165 | """ | |
3091 |
|
3166 | |||
3092 | if not pats: |
|
3167 | if not pats: | |
3093 | raise util.Abort(_('no files specified')) |
|
3168 | raise util.Abort(_('no files specified')) | |
3094 |
|
3169 | |||
3095 | m = scmutil.match(repo[None], pats, opts) |
|
3170 | m = scmutil.match(repo[None], pats, opts) | |
3096 | rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0] |
|
3171 | rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0] | |
3097 | return rejected and 1 or 0 |
|
3172 | return rejected and 1 or 0 | |
3098 |
|
3173 | |||
3099 | @command( |
|
3174 | @command( | |
3100 | 'graft', |
|
3175 | 'graft', | |
3101 | [('r', 'rev', [], _('revisions to graft'), _('REV')), |
|
3176 | [('r', 'rev', [], _('revisions to graft'), _('REV')), | |
3102 | ('c', 'continue', False, _('resume interrupted graft')), |
|
3177 | ('c', 'continue', False, _('resume interrupted graft')), | |
3103 | ('e', 'edit', False, _('invoke editor on commit messages')), |
|
3178 | ('e', 'edit', False, _('invoke editor on commit messages')), | |
3104 | ('', 'log', None, _('append graft info to log message')), |
|
3179 | ('', 'log', None, _('append graft info to log message')), | |
3105 | ('f', 'force', False, _('force graft')), |
|
3180 | ('f', 'force', False, _('force graft')), | |
3106 | ('D', 'currentdate', False, |
|
3181 | ('D', 'currentdate', False, | |
3107 | _('record the current date as commit date')), |
|
3182 | _('record the current date as commit date')), | |
3108 | ('U', 'currentuser', False, |
|
3183 | ('U', 'currentuser', False, | |
3109 | _('record the current user as committer'), _('DATE'))] |
|
3184 | _('record the current user as committer'), _('DATE'))] | |
3110 | + commitopts2 + mergetoolopts + dryrunopts, |
|
3185 | + commitopts2 + mergetoolopts + dryrunopts, | |
3111 | _('[OPTION]... [-r] REV...')) |
|
3186 | _('[OPTION]... [-r] REV...')) | |
3112 | def graft(ui, repo, *revs, **opts): |
|
3187 | def graft(ui, repo, *revs, **opts): | |
3113 | '''copy changes from other branches onto the current branch |
|
3188 | '''copy changes from other branches onto the current branch | |
3114 |
|
3189 | |||
3115 | This command uses Mercurial's merge logic to copy individual |
|
3190 | This command uses Mercurial's merge logic to copy individual | |
3116 | changes from other branches without merging branches in the |
|
3191 | changes from other branches without merging branches in the | |
3117 | history graph. This is sometimes known as 'backporting' or |
|
3192 | history graph. This is sometimes known as 'backporting' or | |
3118 | 'cherry-picking'. By default, graft will copy user, date, and |
|
3193 | 'cherry-picking'. By default, graft will copy user, date, and | |
3119 | description from the source changesets. |
|
3194 | description from the source changesets. | |
3120 |
|
3195 | |||
3121 | Changesets that are ancestors of the current revision, that have |
|
3196 | Changesets that are ancestors of the current revision, that have | |
3122 | already been grafted, or that are merges will be skipped. |
|
3197 | already been grafted, or that are merges will be skipped. | |
3123 |
|
3198 | |||
3124 | If --log is specified, log messages will have a comment appended |
|
3199 | If --log is specified, log messages will have a comment appended | |
3125 | of the form:: |
|
3200 | of the form:: | |
3126 |
|
3201 | |||
3127 | (grafted from CHANGESETHASH) |
|
3202 | (grafted from CHANGESETHASH) | |
3128 |
|
3203 | |||
3129 | If --force is specified, revisions will be grafted even if they |
|
3204 | If --force is specified, revisions will be grafted even if they | |
3130 | are already ancestors of or have been grafted to the destination. |
|
3205 | are already ancestors of or have been grafted to the destination. | |
3131 | This is useful when the revisions have since been backed out. |
|
3206 | This is useful when the revisions have since been backed out. | |
3132 |
|
3207 | |||
3133 | If a graft merge results in conflicts, the graft process is |
|
3208 | If a graft merge results in conflicts, the graft process is | |
3134 | interrupted so that the current merge can be manually resolved. |
|
3209 | interrupted so that the current merge can be manually resolved. | |
3135 | Once all conflicts are addressed, the graft process can be |
|
3210 | Once all conflicts are addressed, the graft process can be | |
3136 | continued with the -c/--continue option. |
|
3211 | continued with the -c/--continue option. | |
3137 |
|
3212 | |||
3138 | .. note:: |
|
3213 | .. note:: | |
3139 |
|
3214 | |||
3140 | The -c/--continue option does not reapply earlier options, except |
|
3215 | The -c/--continue option does not reapply earlier options, except | |
3141 | for --force. |
|
3216 | for --force. | |
3142 |
|
3217 | |||
3143 | .. container:: verbose |
|
3218 | .. container:: verbose | |
3144 |
|
3219 | |||
3145 | Examples: |
|
3220 | Examples: | |
3146 |
|
3221 | |||
3147 | - copy a single change to the stable branch and edit its description:: |
|
3222 | - copy a single change to the stable branch and edit its description:: | |
3148 |
|
3223 | |||
3149 | hg update stable |
|
3224 | hg update stable | |
3150 | hg graft --edit 9393 |
|
3225 | hg graft --edit 9393 | |
3151 |
|
3226 | |||
3152 | - graft a range of changesets with one exception, updating dates:: |
|
3227 | - graft a range of changesets with one exception, updating dates:: | |
3153 |
|
3228 | |||
3154 | hg graft -D "2085::2093 and not 2091" |
|
3229 | hg graft -D "2085::2093 and not 2091" | |
3155 |
|
3230 | |||
3156 | - continue a graft after resolving conflicts:: |
|
3231 | - continue a graft after resolving conflicts:: | |
3157 |
|
3232 | |||
3158 | hg graft -c |
|
3233 | hg graft -c | |
3159 |
|
3234 | |||
3160 | - show the source of a grafted changeset:: |
|
3235 | - show the source of a grafted changeset:: | |
3161 |
|
3236 | |||
3162 | hg log --debug -r . |
|
3237 | hg log --debug -r . | |
3163 |
|
3238 | |||
3164 | See :hg:`help revisions` and :hg:`help revsets` for more about |
|
3239 | See :hg:`help revisions` and :hg:`help revsets` for more about | |
3165 | specifying revisions. |
|
3240 | specifying revisions. | |
3166 |
|
3241 | |||
3167 | Returns 0 on successful completion. |
|
3242 | Returns 0 on successful completion. | |
3168 | ''' |
|
3243 | ''' | |
3169 |
|
3244 | |||
3170 | revs = list(revs) |
|
3245 | revs = list(revs) | |
3171 | revs.extend(opts['rev']) |
|
3246 | revs.extend(opts['rev']) | |
3172 |
|
3247 | |||
3173 | if not opts.get('user') and opts.get('currentuser'): |
|
3248 | if not opts.get('user') and opts.get('currentuser'): | |
3174 | opts['user'] = ui.username() |
|
3249 | opts['user'] = ui.username() | |
3175 | if not opts.get('date') and opts.get('currentdate'): |
|
3250 | if not opts.get('date') and opts.get('currentdate'): | |
3176 | opts['date'] = "%d %d" % util.makedate() |
|
3251 | opts['date'] = "%d %d" % util.makedate() | |
3177 |
|
3252 | |||
3178 | editor = cmdutil.getcommiteditor(editform='graft', **opts) |
|
3253 | editor = cmdutil.getcommiteditor(editform='graft', **opts) | |
3179 |
|
3254 | |||
3180 | cont = False |
|
3255 | cont = False | |
3181 | if opts['continue']: |
|
3256 | if opts['continue']: | |
3182 | cont = True |
|
3257 | cont = True | |
3183 | if revs: |
|
3258 | if revs: | |
3184 | raise util.Abort(_("can't specify --continue and revisions")) |
|
3259 | raise util.Abort(_("can't specify --continue and revisions")) | |
3185 | # read in unfinished revisions |
|
3260 | # read in unfinished revisions | |
3186 | try: |
|
3261 | try: | |
3187 | nodes = repo.opener.read('graftstate').splitlines() |
|
3262 | nodes = repo.opener.read('graftstate').splitlines() | |
3188 | revs = [repo[node].rev() for node in nodes] |
|
3263 | revs = [repo[node].rev() for node in nodes] | |
3189 | except IOError, inst: |
|
3264 | except IOError, inst: | |
3190 | if inst.errno != errno.ENOENT: |
|
3265 | if inst.errno != errno.ENOENT: | |
3191 | raise |
|
3266 | raise | |
3192 | raise util.Abort(_("no graft state found, can't continue")) |
|
3267 | raise util.Abort(_("no graft state found, can't continue")) | |
3193 | else: |
|
3268 | else: | |
3194 | cmdutil.checkunfinished(repo) |
|
3269 | cmdutil.checkunfinished(repo) | |
3195 | cmdutil.bailifchanged(repo) |
|
3270 | cmdutil.bailifchanged(repo) | |
3196 | if not revs: |
|
3271 | if not revs: | |
3197 | raise util.Abort(_('no revisions specified')) |
|
3272 | raise util.Abort(_('no revisions specified')) | |
3198 | revs = scmutil.revrange(repo, revs) |
|
3273 | revs = scmutil.revrange(repo, revs) | |
3199 |
|
3274 | |||
3200 | # check for merges |
|
3275 | # check for merges | |
3201 | for rev in repo.revs('%ld and merge()', revs): |
|
3276 | for rev in repo.revs('%ld and merge()', revs): | |
3202 | ui.warn(_('skipping ungraftable merge revision %s\n') % rev) |
|
3277 | ui.warn(_('skipping ungraftable merge revision %s\n') % rev) | |
3203 | revs.remove(rev) |
|
3278 | revs.remove(rev) | |
3204 | if not revs: |
|
3279 | if not revs: | |
3205 | return -1 |
|
3280 | return -1 | |
3206 |
|
3281 | |||
3207 | # Don't check in the --continue case, in effect retaining --force across |
|
3282 | # Don't check in the --continue case, in effect retaining --force across | |
3208 | # --continues. That's because without --force, any revisions we decided to |
|
3283 | # --continues. That's because without --force, any revisions we decided to | |
3209 | # skip would have been filtered out here, so they wouldn't have made their |
|
3284 | # skip would have been filtered out here, so they wouldn't have made their | |
3210 | # way to the graftstate. With --force, any revisions we would have otherwise |
|
3285 | # way to the graftstate. With --force, any revisions we would have otherwise | |
3211 | # skipped would not have been filtered out, and if they hadn't been applied |
|
3286 | # skipped would not have been filtered out, and if they hadn't been applied | |
3212 | # already, they'd have been in the graftstate. |
|
3287 | # already, they'd have been in the graftstate. | |
3213 | if not (cont or opts.get('force')): |
|
3288 | if not (cont or opts.get('force')): | |
3214 | # check for ancestors of dest branch |
|
3289 | # check for ancestors of dest branch | |
3215 | crev = repo['.'].rev() |
|
3290 | crev = repo['.'].rev() | |
3216 | ancestors = repo.changelog.ancestors([crev], inclusive=True) |
|
3291 | ancestors = repo.changelog.ancestors([crev], inclusive=True) | |
3217 | # Cannot use x.remove(y) on smart set, this has to be a list. |
|
3292 | # Cannot use x.remove(y) on smart set, this has to be a list. | |
3218 | # XXX make this lazy in the future |
|
3293 | # XXX make this lazy in the future | |
3219 | revs = list(revs) |
|
3294 | revs = list(revs) | |
3220 | # don't mutate while iterating, create a copy |
|
3295 | # don't mutate while iterating, create a copy | |
3221 | for rev in list(revs): |
|
3296 | for rev in list(revs): | |
3222 | if rev in ancestors: |
|
3297 | if rev in ancestors: | |
3223 | ui.warn(_('skipping ancestor revision %s\n') % rev) |
|
3298 | ui.warn(_('skipping ancestor revision %s\n') % rev) | |
3224 | # XXX remove on list is slow |
|
3299 | # XXX remove on list is slow | |
3225 | revs.remove(rev) |
|
3300 | revs.remove(rev) | |
3226 | if not revs: |
|
3301 | if not revs: | |
3227 | return -1 |
|
3302 | return -1 | |
3228 |
|
3303 | |||
3229 | # analyze revs for earlier grafts |
|
3304 | # analyze revs for earlier grafts | |
3230 | ids = {} |
|
3305 | ids = {} | |
3231 | for ctx in repo.set("%ld", revs): |
|
3306 | for ctx in repo.set("%ld", revs): | |
3232 | ids[ctx.hex()] = ctx.rev() |
|
3307 | ids[ctx.hex()] = ctx.rev() | |
3233 | n = ctx.extra().get('source') |
|
3308 | n = ctx.extra().get('source') | |
3234 | if n: |
|
3309 | if n: | |
3235 | ids[n] = ctx.rev() |
|
3310 | ids[n] = ctx.rev() | |
3236 |
|
3311 | |||
3237 | # check ancestors for earlier grafts |
|
3312 | # check ancestors for earlier grafts | |
3238 | ui.debug('scanning for duplicate grafts\n') |
|
3313 | ui.debug('scanning for duplicate grafts\n') | |
3239 |
|
3314 | |||
3240 | for rev in repo.changelog.findmissingrevs(revs, [crev]): |
|
3315 | for rev in repo.changelog.findmissingrevs(revs, [crev]): | |
3241 | ctx = repo[rev] |
|
3316 | ctx = repo[rev] | |
3242 | n = ctx.extra().get('source') |
|
3317 | n = ctx.extra().get('source') | |
3243 | if n in ids: |
|
3318 | if n in ids: | |
3244 | try: |
|
3319 | try: | |
3245 | r = repo[n].rev() |
|
3320 | r = repo[n].rev() | |
3246 | except error.RepoLookupError: |
|
3321 | except error.RepoLookupError: | |
3247 | r = None |
|
3322 | r = None | |
3248 | if r in revs: |
|
3323 | if r in revs: | |
3249 | ui.warn(_('skipping revision %s (already grafted to %s)\n') |
|
3324 | ui.warn(_('skipping revision %s (already grafted to %s)\n') | |
3250 | % (r, rev)) |
|
3325 | % (r, rev)) | |
3251 | revs.remove(r) |
|
3326 | revs.remove(r) | |
3252 | elif ids[n] in revs: |
|
3327 | elif ids[n] in revs: | |
3253 | if r is None: |
|
3328 | if r is None: | |
3254 | ui.warn(_('skipping already grafted revision %s ' |
|
3329 | ui.warn(_('skipping already grafted revision %s ' | |
3255 | '(%s also has unknown origin %s)\n') |
|
3330 | '(%s also has unknown origin %s)\n') | |
3256 | % (ids[n], rev, n)) |
|
3331 | % (ids[n], rev, n)) | |
3257 | else: |
|
3332 | else: | |
3258 | ui.warn(_('skipping already grafted revision %s ' |
|
3333 | ui.warn(_('skipping already grafted revision %s ' | |
3259 | '(%s also has origin %d)\n') |
|
3334 | '(%s also has origin %d)\n') | |
3260 | % (ids[n], rev, r)) |
|
3335 | % (ids[n], rev, r)) | |
3261 | revs.remove(ids[n]) |
|
3336 | revs.remove(ids[n]) | |
3262 | elif ctx.hex() in ids: |
|
3337 | elif ctx.hex() in ids: | |
3263 | r = ids[ctx.hex()] |
|
3338 | r = ids[ctx.hex()] | |
3264 | ui.warn(_('skipping already grafted revision %s ' |
|
3339 | ui.warn(_('skipping already grafted revision %s ' | |
3265 | '(was grafted from %d)\n') % (r, rev)) |
|
3340 | '(was grafted from %d)\n') % (r, rev)) | |
3266 | revs.remove(r) |
|
3341 | revs.remove(r) | |
3267 | if not revs: |
|
3342 | if not revs: | |
3268 | return -1 |
|
3343 | return -1 | |
3269 |
|
3344 | |||
3270 | wlock = repo.wlock() |
|
3345 | wlock = repo.wlock() | |
3271 | try: |
|
3346 | try: | |
3272 | current = repo['.'] |
|
3347 | current = repo['.'] | |
3273 | for pos, ctx in enumerate(repo.set("%ld", revs)): |
|
3348 | for pos, ctx in enumerate(repo.set("%ld", revs)): | |
3274 |
|
3349 | |||
3275 | ui.status(_('grafting revision %s\n') % ctx.rev()) |
|
3350 | ui.status(_('grafting revision %s\n') % ctx.rev()) | |
3276 | if opts.get('dry_run'): |
|
3351 | if opts.get('dry_run'): | |
3277 | continue |
|
3352 | continue | |
3278 |
|
3353 | |||
3279 | source = ctx.extra().get('source') |
|
3354 | source = ctx.extra().get('source') | |
3280 | if not source: |
|
3355 | if not source: | |
3281 | source = ctx.hex() |
|
3356 | source = ctx.hex() | |
3282 | extra = {'source': source} |
|
3357 | extra = {'source': source} | |
3283 | user = ctx.user() |
|
3358 | user = ctx.user() | |
3284 | if opts.get('user'): |
|
3359 | if opts.get('user'): | |
3285 | user = opts['user'] |
|
3360 | user = opts['user'] | |
3286 | date = ctx.date() |
|
3361 | date = ctx.date() | |
3287 | if opts.get('date'): |
|
3362 | if opts.get('date'): | |
3288 | date = opts['date'] |
|
3363 | date = opts['date'] | |
3289 | message = ctx.description() |
|
3364 | message = ctx.description() | |
3290 | if opts.get('log'): |
|
3365 | if opts.get('log'): | |
3291 | message += '\n(grafted from %s)' % ctx.hex() |
|
3366 | message += '\n(grafted from %s)' % ctx.hex() | |
3292 |
|
3367 | |||
3293 | # we don't merge the first commit when continuing |
|
3368 | # we don't merge the first commit when continuing | |
3294 | if not cont: |
|
3369 | if not cont: | |
3295 | # perform the graft merge with p1(rev) as 'ancestor' |
|
3370 | # perform the graft merge with p1(rev) as 'ancestor' | |
3296 | try: |
|
3371 | try: | |
3297 | # ui.forcemerge is an internal variable, do not document |
|
3372 | # ui.forcemerge is an internal variable, do not document | |
3298 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
3373 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
3299 | 'graft') |
|
3374 | 'graft') | |
3300 | stats = mergemod.update(repo, ctx.node(), True, True, False, |
|
3375 | stats = mergemod.update(repo, ctx.node(), True, True, False, | |
3301 | ctx.p1().node(), |
|
3376 | ctx.p1().node(), | |
3302 | labels=['local', 'graft']) |
|
3377 | labels=['local', 'graft']) | |
3303 | finally: |
|
3378 | finally: | |
3304 | repo.ui.setconfig('ui', 'forcemerge', '', 'graft') |
|
3379 | repo.ui.setconfig('ui', 'forcemerge', '', 'graft') | |
3305 | # report any conflicts |
|
3380 | # report any conflicts | |
3306 | if stats and stats[3] > 0: |
|
3381 | if stats and stats[3] > 0: | |
3307 | # write out state for --continue |
|
3382 | # write out state for --continue | |
3308 | nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] |
|
3383 | nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]] | |
3309 | repo.opener.write('graftstate', ''.join(nodelines)) |
|
3384 | repo.opener.write('graftstate', ''.join(nodelines)) | |
3310 | raise util.Abort( |
|
3385 | raise util.Abort( | |
3311 | _("unresolved conflicts, can't continue"), |
|
3386 | _("unresolved conflicts, can't continue"), | |
3312 | hint=_('use hg resolve and hg graft --continue')) |
|
3387 | hint=_('use hg resolve and hg graft --continue')) | |
3313 | else: |
|
3388 | else: | |
3314 | cont = False |
|
3389 | cont = False | |
3315 |
|
3390 | |||
3316 | # drop the second merge parent |
|
3391 | # drop the second merge parent | |
3317 | repo.dirstate.beginparentchange() |
|
3392 | repo.dirstate.beginparentchange() | |
3318 | repo.setparents(current.node(), nullid) |
|
3393 | repo.setparents(current.node(), nullid) | |
3319 | repo.dirstate.write() |
|
3394 | repo.dirstate.write() | |
3320 | # fix up dirstate for copies and renames |
|
3395 | # fix up dirstate for copies and renames | |
3321 | cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) |
|
3396 | cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) | |
3322 | repo.dirstate.endparentchange() |
|
3397 | repo.dirstate.endparentchange() | |
3323 |
|
3398 | |||
3324 | # commit |
|
3399 | # commit | |
3325 | node = repo.commit(text=message, user=user, |
|
3400 | node = repo.commit(text=message, user=user, | |
3326 | date=date, extra=extra, editor=editor) |
|
3401 | date=date, extra=extra, editor=editor) | |
3327 | if node is None: |
|
3402 | if node is None: | |
3328 | ui.status(_('graft for revision %s is empty\n') % ctx.rev()) |
|
3403 | ui.status(_('graft for revision %s is empty\n') % ctx.rev()) | |
3329 | else: |
|
3404 | else: | |
3330 | current = repo[node] |
|
3405 | current = repo[node] | |
3331 | finally: |
|
3406 | finally: | |
3332 | wlock.release() |
|
3407 | wlock.release() | |
3333 |
|
3408 | |||
3334 | # remove state when we complete successfully |
|
3409 | # remove state when we complete successfully | |
3335 | if not opts.get('dry_run'): |
|
3410 | if not opts.get('dry_run'): | |
3336 | util.unlinkpath(repo.join('graftstate'), ignoremissing=True) |
|
3411 | util.unlinkpath(repo.join('graftstate'), ignoremissing=True) | |
3337 |
|
3412 | |||
3338 | return 0 |
|
3413 | return 0 | |
3339 |
|
3414 | |||
3340 | @command('grep', |
|
3415 | @command('grep', | |
3341 | [('0', 'print0', None, _('end fields with NUL')), |
|
3416 | [('0', 'print0', None, _('end fields with NUL')), | |
3342 | ('', 'all', None, _('print all revisions that match')), |
|
3417 | ('', 'all', None, _('print all revisions that match')), | |
3343 | ('a', 'text', None, _('treat all files as text')), |
|
3418 | ('a', 'text', None, _('treat all files as text')), | |
3344 | ('f', 'follow', None, |
|
3419 | ('f', 'follow', None, | |
3345 | _('follow changeset history,' |
|
3420 | _('follow changeset history,' | |
3346 | ' or file history across copies and renames')), |
|
3421 | ' or file history across copies and renames')), | |
3347 | ('i', 'ignore-case', None, _('ignore case when matching')), |
|
3422 | ('i', 'ignore-case', None, _('ignore case when matching')), | |
3348 | ('l', 'files-with-matches', None, |
|
3423 | ('l', 'files-with-matches', None, | |
3349 | _('print only filenames and revisions that match')), |
|
3424 | _('print only filenames and revisions that match')), | |
3350 | ('n', 'line-number', None, _('print matching line numbers')), |
|
3425 | ('n', 'line-number', None, _('print matching line numbers')), | |
3351 | ('r', 'rev', [], |
|
3426 | ('r', 'rev', [], | |
3352 | _('only search files changed within revision range'), _('REV')), |
|
3427 | _('only search files changed within revision range'), _('REV')), | |
3353 | ('u', 'user', None, _('list the author (long with -v)')), |
|
3428 | ('u', 'user', None, _('list the author (long with -v)')), | |
3354 | ('d', 'date', None, _('list the date (short with -q)')), |
|
3429 | ('d', 'date', None, _('list the date (short with -q)')), | |
3355 | ] + walkopts, |
|
3430 | ] + walkopts, | |
3356 | _('[OPTION]... PATTERN [FILE]...'), |
|
3431 | _('[OPTION]... PATTERN [FILE]...'), | |
3357 | inferrepo=True) |
|
3432 | inferrepo=True) | |
3358 | def grep(ui, repo, pattern, *pats, **opts): |
|
3433 | def grep(ui, repo, pattern, *pats, **opts): | |
3359 | """search for a pattern in specified files and revisions |
|
3434 | """search for a pattern in specified files and revisions | |
3360 |
|
3435 | |||
3361 | Search revisions of files for a regular expression. |
|
3436 | Search revisions of files for a regular expression. | |
3362 |
|
3437 | |||
3363 | This command behaves differently than Unix grep. It only accepts |
|
3438 | This command behaves differently than Unix grep. It only accepts | |
3364 | Python/Perl regexps. It searches repository history, not the |
|
3439 | Python/Perl regexps. It searches repository history, not the | |
3365 | working directory. It always prints the revision number in which a |
|
3440 | working directory. It always prints the revision number in which a | |
3366 | match appears. |
|
3441 | match appears. | |
3367 |
|
3442 | |||
3368 | By default, grep only prints output for the first revision of a |
|
3443 | By default, grep only prints output for the first revision of a | |
3369 | file in which it finds a match. To get it to print every revision |
|
3444 | file in which it finds a match. To get it to print every revision | |
3370 | that contains a change in match status ("-" for a match that |
|
3445 | that contains a change in match status ("-" for a match that | |
3371 | becomes a non-match, or "+" for a non-match that becomes a match), |
|
3446 | becomes a non-match, or "+" for a non-match that becomes a match), | |
3372 | use the --all flag. |
|
3447 | use the --all flag. | |
3373 |
|
3448 | |||
3374 | Returns 0 if a match is found, 1 otherwise. |
|
3449 | Returns 0 if a match is found, 1 otherwise. | |
3375 | """ |
|
3450 | """ | |
3376 | reflags = re.M |
|
3451 | reflags = re.M | |
3377 | if opts.get('ignore_case'): |
|
3452 | if opts.get('ignore_case'): | |
3378 | reflags |= re.I |
|
3453 | reflags |= re.I | |
3379 | try: |
|
3454 | try: | |
3380 | regexp = util.re.compile(pattern, reflags) |
|
3455 | regexp = util.re.compile(pattern, reflags) | |
3381 | except re.error, inst: |
|
3456 | except re.error, inst: | |
3382 | ui.warn(_("grep: invalid match pattern: %s\n") % inst) |
|
3457 | ui.warn(_("grep: invalid match pattern: %s\n") % inst) | |
3383 | return 1 |
|
3458 | return 1 | |
3384 | sep, eol = ':', '\n' |
|
3459 | sep, eol = ':', '\n' | |
3385 | if opts.get('print0'): |
|
3460 | if opts.get('print0'): | |
3386 | sep = eol = '\0' |
|
3461 | sep = eol = '\0' | |
3387 |
|
3462 | |||
3388 | getfile = util.lrucachefunc(repo.file) |
|
3463 | getfile = util.lrucachefunc(repo.file) | |
3389 |
|
3464 | |||
3390 | def matchlines(body): |
|
3465 | def matchlines(body): | |
3391 | begin = 0 |
|
3466 | begin = 0 | |
3392 | linenum = 0 |
|
3467 | linenum = 0 | |
3393 | while begin < len(body): |
|
3468 | while begin < len(body): | |
3394 | match = regexp.search(body, begin) |
|
3469 | match = regexp.search(body, begin) | |
3395 | if not match: |
|
3470 | if not match: | |
3396 | break |
|
3471 | break | |
3397 | mstart, mend = match.span() |
|
3472 | mstart, mend = match.span() | |
3398 | linenum += body.count('\n', begin, mstart) + 1 |
|
3473 | linenum += body.count('\n', begin, mstart) + 1 | |
3399 | lstart = body.rfind('\n', begin, mstart) + 1 or begin |
|
3474 | lstart = body.rfind('\n', begin, mstart) + 1 or begin | |
3400 | begin = body.find('\n', mend) + 1 or len(body) + 1 |
|
3475 | begin = body.find('\n', mend) + 1 or len(body) + 1 | |
3401 | lend = begin - 1 |
|
3476 | lend = begin - 1 | |
3402 | yield linenum, mstart - lstart, mend - lstart, body[lstart:lend] |
|
3477 | yield linenum, mstart - lstart, mend - lstart, body[lstart:lend] | |
3403 |
|
3478 | |||
3404 | class linestate(object): |
|
3479 | class linestate(object): | |
3405 | def __init__(self, line, linenum, colstart, colend): |
|
3480 | def __init__(self, line, linenum, colstart, colend): | |
3406 | self.line = line |
|
3481 | self.line = line | |
3407 | self.linenum = linenum |
|
3482 | self.linenum = linenum | |
3408 | self.colstart = colstart |
|
3483 | self.colstart = colstart | |
3409 | self.colend = colend |
|
3484 | self.colend = colend | |
3410 |
|
3485 | |||
3411 | def __hash__(self): |
|
3486 | def __hash__(self): | |
3412 | return hash((self.linenum, self.line)) |
|
3487 | return hash((self.linenum, self.line)) | |
3413 |
|
3488 | |||
3414 | def __eq__(self, other): |
|
3489 | def __eq__(self, other): | |
3415 | return self.line == other.line |
|
3490 | return self.line == other.line | |
3416 |
|
3491 | |||
3417 | def __iter__(self): |
|
3492 | def __iter__(self): | |
3418 | yield (self.line[:self.colstart], '') |
|
3493 | yield (self.line[:self.colstart], '') | |
3419 | yield (self.line[self.colstart:self.colend], 'grep.match') |
|
3494 | yield (self.line[self.colstart:self.colend], 'grep.match') | |
3420 | rest = self.line[self.colend:] |
|
3495 | rest = self.line[self.colend:] | |
3421 | while rest != '': |
|
3496 | while rest != '': | |
3422 | match = regexp.search(rest) |
|
3497 | match = regexp.search(rest) | |
3423 | if not match: |
|
3498 | if not match: | |
3424 | yield (rest, '') |
|
3499 | yield (rest, '') | |
3425 | break |
|
3500 | break | |
3426 | mstart, mend = match.span() |
|
3501 | mstart, mend = match.span() | |
3427 | yield (rest[:mstart], '') |
|
3502 | yield (rest[:mstart], '') | |
3428 | yield (rest[mstart:mend], 'grep.match') |
|
3503 | yield (rest[mstart:mend], 'grep.match') | |
3429 | rest = rest[mend:] |
|
3504 | rest = rest[mend:] | |
3430 |
|
3505 | |||
3431 | matches = {} |
|
3506 | matches = {} | |
3432 | copies = {} |
|
3507 | copies = {} | |
3433 | def grepbody(fn, rev, body): |
|
3508 | def grepbody(fn, rev, body): | |
3434 | matches[rev].setdefault(fn, []) |
|
3509 | matches[rev].setdefault(fn, []) | |
3435 | m = matches[rev][fn] |
|
3510 | m = matches[rev][fn] | |
3436 | for lnum, cstart, cend, line in matchlines(body): |
|
3511 | for lnum, cstart, cend, line in matchlines(body): | |
3437 | s = linestate(line, lnum, cstart, cend) |
|
3512 | s = linestate(line, lnum, cstart, cend) | |
3438 | m.append(s) |
|
3513 | m.append(s) | |
3439 |
|
3514 | |||
3440 | def difflinestates(a, b): |
|
3515 | def difflinestates(a, b): | |
3441 | sm = difflib.SequenceMatcher(None, a, b) |
|
3516 | sm = difflib.SequenceMatcher(None, a, b) | |
3442 | for tag, alo, ahi, blo, bhi in sm.get_opcodes(): |
|
3517 | for tag, alo, ahi, blo, bhi in sm.get_opcodes(): | |
3443 | if tag == 'insert': |
|
3518 | if tag == 'insert': | |
3444 | for i in xrange(blo, bhi): |
|
3519 | for i in xrange(blo, bhi): | |
3445 | yield ('+', b[i]) |
|
3520 | yield ('+', b[i]) | |
3446 | elif tag == 'delete': |
|
3521 | elif tag == 'delete': | |
3447 | for i in xrange(alo, ahi): |
|
3522 | for i in xrange(alo, ahi): | |
3448 | yield ('-', a[i]) |
|
3523 | yield ('-', a[i]) | |
3449 | elif tag == 'replace': |
|
3524 | elif tag == 'replace': | |
3450 | for i in xrange(alo, ahi): |
|
3525 | for i in xrange(alo, ahi): | |
3451 | yield ('-', a[i]) |
|
3526 | yield ('-', a[i]) | |
3452 | for i in xrange(blo, bhi): |
|
3527 | for i in xrange(blo, bhi): | |
3453 | yield ('+', b[i]) |
|
3528 | yield ('+', b[i]) | |
3454 |
|
3529 | |||
3455 | def display(fn, ctx, pstates, states): |
|
3530 | def display(fn, ctx, pstates, states): | |
3456 | rev = ctx.rev() |
|
3531 | rev = ctx.rev() | |
3457 | datefunc = ui.quiet and util.shortdate or util.datestr |
|
3532 | datefunc = ui.quiet and util.shortdate or util.datestr | |
3458 | found = False |
|
3533 | found = False | |
3459 | @util.cachefunc |
|
3534 | @util.cachefunc | |
3460 | def binary(): |
|
3535 | def binary(): | |
3461 | flog = getfile(fn) |
|
3536 | flog = getfile(fn) | |
3462 | return util.binary(flog.read(ctx.filenode(fn))) |
|
3537 | return util.binary(flog.read(ctx.filenode(fn))) | |
3463 |
|
3538 | |||
3464 | if opts.get('all'): |
|
3539 | if opts.get('all'): | |
3465 | iter = difflinestates(pstates, states) |
|
3540 | iter = difflinestates(pstates, states) | |
3466 | else: |
|
3541 | else: | |
3467 | iter = [('', l) for l in states] |
|
3542 | iter = [('', l) for l in states] | |
3468 | for change, l in iter: |
|
3543 | for change, l in iter: | |
3469 | cols = [(fn, 'grep.filename'), (str(rev), 'grep.rev')] |
|
3544 | cols = [(fn, 'grep.filename'), (str(rev), 'grep.rev')] | |
3470 |
|
3545 | |||
3471 | if opts.get('line_number'): |
|
3546 | if opts.get('line_number'): | |
3472 | cols.append((str(l.linenum), 'grep.linenumber')) |
|
3547 | cols.append((str(l.linenum), 'grep.linenumber')) | |
3473 | if opts.get('all'): |
|
3548 | if opts.get('all'): | |
3474 | cols.append((change, 'grep.change')) |
|
3549 | cols.append((change, 'grep.change')) | |
3475 | if opts.get('user'): |
|
3550 | if opts.get('user'): | |
3476 | cols.append((ui.shortuser(ctx.user()), 'grep.user')) |
|
3551 | cols.append((ui.shortuser(ctx.user()), 'grep.user')) | |
3477 | if opts.get('date'): |
|
3552 | if opts.get('date'): | |
3478 | cols.append((datefunc(ctx.date()), 'grep.date')) |
|
3553 | cols.append((datefunc(ctx.date()), 'grep.date')) | |
3479 | for col, label in cols[:-1]: |
|
3554 | for col, label in cols[:-1]: | |
3480 | ui.write(col, label=label) |
|
3555 | ui.write(col, label=label) | |
3481 | ui.write(sep, label='grep.sep') |
|
3556 | ui.write(sep, label='grep.sep') | |
3482 | ui.write(cols[-1][0], label=cols[-1][1]) |
|
3557 | ui.write(cols[-1][0], label=cols[-1][1]) | |
3483 | if not opts.get('files_with_matches'): |
|
3558 | if not opts.get('files_with_matches'): | |
3484 | ui.write(sep, label='grep.sep') |
|
3559 | ui.write(sep, label='grep.sep') | |
3485 | if not opts.get('text') and binary(): |
|
3560 | if not opts.get('text') and binary(): | |
3486 | ui.write(" Binary file matches") |
|
3561 | ui.write(" Binary file matches") | |
3487 | else: |
|
3562 | else: | |
3488 | for s, label in l: |
|
3563 | for s, label in l: | |
3489 | ui.write(s, label=label) |
|
3564 | ui.write(s, label=label) | |
3490 | ui.write(eol) |
|
3565 | ui.write(eol) | |
3491 | found = True |
|
3566 | found = True | |
3492 | if opts.get('files_with_matches'): |
|
3567 | if opts.get('files_with_matches'): | |
3493 | break |
|
3568 | break | |
3494 | return found |
|
3569 | return found | |
3495 |
|
3570 | |||
3496 | skip = {} |
|
3571 | skip = {} | |
3497 | revfiles = {} |
|
3572 | revfiles = {} | |
3498 | matchfn = scmutil.match(repo[None], pats, opts) |
|
3573 | matchfn = scmutil.match(repo[None], pats, opts) | |
3499 | found = False |
|
3574 | found = False | |
3500 | follow = opts.get('follow') |
|
3575 | follow = opts.get('follow') | |
3501 |
|
3576 | |||
3502 | def prep(ctx, fns): |
|
3577 | def prep(ctx, fns): | |
3503 | rev = ctx.rev() |
|
3578 | rev = ctx.rev() | |
3504 | pctx = ctx.p1() |
|
3579 | pctx = ctx.p1() | |
3505 | parent = pctx.rev() |
|
3580 | parent = pctx.rev() | |
3506 | matches.setdefault(rev, {}) |
|
3581 | matches.setdefault(rev, {}) | |
3507 | matches.setdefault(parent, {}) |
|
3582 | matches.setdefault(parent, {}) | |
3508 | files = revfiles.setdefault(rev, []) |
|
3583 | files = revfiles.setdefault(rev, []) | |
3509 | for fn in fns: |
|
3584 | for fn in fns: | |
3510 | flog = getfile(fn) |
|
3585 | flog = getfile(fn) | |
3511 | try: |
|
3586 | try: | |
3512 | fnode = ctx.filenode(fn) |
|
3587 | fnode = ctx.filenode(fn) | |
3513 | except error.LookupError: |
|
3588 | except error.LookupError: | |
3514 | continue |
|
3589 | continue | |
3515 |
|
3590 | |||
3516 | copied = flog.renamed(fnode) |
|
3591 | copied = flog.renamed(fnode) | |
3517 | copy = follow and copied and copied[0] |
|
3592 | copy = follow and copied and copied[0] | |
3518 | if copy: |
|
3593 | if copy: | |
3519 | copies.setdefault(rev, {})[fn] = copy |
|
3594 | copies.setdefault(rev, {})[fn] = copy | |
3520 | if fn in skip: |
|
3595 | if fn in skip: | |
3521 | if copy: |
|
3596 | if copy: | |
3522 | skip[copy] = True |
|
3597 | skip[copy] = True | |
3523 | continue |
|
3598 | continue | |
3524 | files.append(fn) |
|
3599 | files.append(fn) | |
3525 |
|
3600 | |||
3526 | if fn not in matches[rev]: |
|
3601 | if fn not in matches[rev]: | |
3527 | grepbody(fn, rev, flog.read(fnode)) |
|
3602 | grepbody(fn, rev, flog.read(fnode)) | |
3528 |
|
3603 | |||
3529 | pfn = copy or fn |
|
3604 | pfn = copy or fn | |
3530 | if pfn not in matches[parent]: |
|
3605 | if pfn not in matches[parent]: | |
3531 | try: |
|
3606 | try: | |
3532 | fnode = pctx.filenode(pfn) |
|
3607 | fnode = pctx.filenode(pfn) | |
3533 | grepbody(pfn, parent, flog.read(fnode)) |
|
3608 | grepbody(pfn, parent, flog.read(fnode)) | |
3534 | except error.LookupError: |
|
3609 | except error.LookupError: | |
3535 | pass |
|
3610 | pass | |
3536 |
|
3611 | |||
3537 | for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep): |
|
3612 | for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep): | |
3538 | rev = ctx.rev() |
|
3613 | rev = ctx.rev() | |
3539 | parent = ctx.p1().rev() |
|
3614 | parent = ctx.p1().rev() | |
3540 | for fn in sorted(revfiles.get(rev, [])): |
|
3615 | for fn in sorted(revfiles.get(rev, [])): | |
3541 | states = matches[rev][fn] |
|
3616 | states = matches[rev][fn] | |
3542 | copy = copies.get(rev, {}).get(fn) |
|
3617 | copy = copies.get(rev, {}).get(fn) | |
3543 | if fn in skip: |
|
3618 | if fn in skip: | |
3544 | if copy: |
|
3619 | if copy: | |
3545 | skip[copy] = True |
|
3620 | skip[copy] = True | |
3546 | continue |
|
3621 | continue | |
3547 | pstates = matches.get(parent, {}).get(copy or fn, []) |
|
3622 | pstates = matches.get(parent, {}).get(copy or fn, []) | |
3548 | if pstates or states: |
|
3623 | if pstates or states: | |
3549 | r = display(fn, ctx, pstates, states) |
|
3624 | r = display(fn, ctx, pstates, states) | |
3550 | found = found or r |
|
3625 | found = found or r | |
3551 | if r and not opts.get('all'): |
|
3626 | if r and not opts.get('all'): | |
3552 | skip[fn] = True |
|
3627 | skip[fn] = True | |
3553 | if copy: |
|
3628 | if copy: | |
3554 | skip[copy] = True |
|
3629 | skip[copy] = True | |
3555 | del matches[rev] |
|
3630 | del matches[rev] | |
3556 | del revfiles[rev] |
|
3631 | del revfiles[rev] | |
3557 |
|
3632 | |||
3558 | return not found |
|
3633 | return not found | |
3559 |
|
3634 | |||
3560 | @command('heads', |
|
3635 | @command('heads', | |
3561 | [('r', 'rev', '', |
|
3636 | [('r', 'rev', '', | |
3562 | _('show only heads which are descendants of STARTREV'), _('STARTREV')), |
|
3637 | _('show only heads which are descendants of STARTREV'), _('STARTREV')), | |
3563 | ('t', 'topo', False, _('show topological heads only')), |
|
3638 | ('t', 'topo', False, _('show topological heads only')), | |
3564 | ('a', 'active', False, _('show active branchheads only (DEPRECATED)')), |
|
3639 | ('a', 'active', False, _('show active branchheads only (DEPRECATED)')), | |
3565 | ('c', 'closed', False, _('show normal and closed branch heads')), |
|
3640 | ('c', 'closed', False, _('show normal and closed branch heads')), | |
3566 | ] + templateopts, |
|
3641 | ] + templateopts, | |
3567 | _('[-ct] [-r STARTREV] [REV]...')) |
|
3642 | _('[-ct] [-r STARTREV] [REV]...')) | |
3568 | def heads(ui, repo, *branchrevs, **opts): |
|
3643 | def heads(ui, repo, *branchrevs, **opts): | |
3569 | """show branch heads |
|
3644 | """show branch heads | |
3570 |
|
3645 | |||
3571 | With no arguments, show all open branch heads in the repository. |
|
3646 | With no arguments, show all open branch heads in the repository. | |
3572 | Branch heads are changesets that have no descendants on the |
|
3647 | Branch heads are changesets that have no descendants on the | |
3573 | same branch. They are where development generally takes place and |
|
3648 | same branch. They are where development generally takes place and | |
3574 | are the usual targets for update and merge operations. |
|
3649 | are the usual targets for update and merge operations. | |
3575 |
|
3650 | |||
3576 | If one or more REVs are given, only open branch heads on the |
|
3651 | If one or more REVs are given, only open branch heads on the | |
3577 | branches associated with the specified changesets are shown. This |
|
3652 | branches associated with the specified changesets are shown. This | |
3578 | means that you can use :hg:`heads .` to see the heads on the |
|
3653 | means that you can use :hg:`heads .` to see the heads on the | |
3579 | currently checked-out branch. |
|
3654 | currently checked-out branch. | |
3580 |
|
3655 | |||
3581 | If -c/--closed is specified, also show branch heads marked closed |
|
3656 | If -c/--closed is specified, also show branch heads marked closed | |
3582 | (see :hg:`commit --close-branch`). |
|
3657 | (see :hg:`commit --close-branch`). | |
3583 |
|
3658 | |||
3584 | If STARTREV is specified, only those heads that are descendants of |
|
3659 | If STARTREV is specified, only those heads that are descendants of | |
3585 | STARTREV will be displayed. |
|
3660 | STARTREV will be displayed. | |
3586 |
|
3661 | |||
3587 | If -t/--topo is specified, named branch mechanics will be ignored and only |
|
3662 | If -t/--topo is specified, named branch mechanics will be ignored and only | |
3588 | topological heads (changesets with no children) will be shown. |
|
3663 | topological heads (changesets with no children) will be shown. | |
3589 |
|
3664 | |||
3590 | Returns 0 if matching heads are found, 1 if not. |
|
3665 | Returns 0 if matching heads are found, 1 if not. | |
3591 | """ |
|
3666 | """ | |
3592 |
|
3667 | |||
3593 | start = None |
|
3668 | start = None | |
3594 | if 'rev' in opts: |
|
3669 | if 'rev' in opts: | |
3595 | start = scmutil.revsingle(repo, opts['rev'], None).node() |
|
3670 | start = scmutil.revsingle(repo, opts['rev'], None).node() | |
3596 |
|
3671 | |||
3597 | if opts.get('topo'): |
|
3672 | if opts.get('topo'): | |
3598 | heads = [repo[h] for h in repo.heads(start)] |
|
3673 | heads = [repo[h] for h in repo.heads(start)] | |
3599 | else: |
|
3674 | else: | |
3600 | heads = [] |
|
3675 | heads = [] | |
3601 | for branch in repo.branchmap(): |
|
3676 | for branch in repo.branchmap(): | |
3602 | heads += repo.branchheads(branch, start, opts.get('closed')) |
|
3677 | heads += repo.branchheads(branch, start, opts.get('closed')) | |
3603 | heads = [repo[h] for h in heads] |
|
3678 | heads = [repo[h] for h in heads] | |
3604 |
|
3679 | |||
3605 | if branchrevs: |
|
3680 | if branchrevs: | |
3606 | branches = set(repo[br].branch() for br in branchrevs) |
|
3681 | branches = set(repo[br].branch() for br in branchrevs) | |
3607 | heads = [h for h in heads if h.branch() in branches] |
|
3682 | heads = [h for h in heads if h.branch() in branches] | |
3608 |
|
3683 | |||
3609 | if opts.get('active') and branchrevs: |
|
3684 | if opts.get('active') and branchrevs: | |
3610 | dagheads = repo.heads(start) |
|
3685 | dagheads = repo.heads(start) | |
3611 | heads = [h for h in heads if h.node() in dagheads] |
|
3686 | heads = [h for h in heads if h.node() in dagheads] | |
3612 |
|
3687 | |||
3613 | if branchrevs: |
|
3688 | if branchrevs: | |
3614 | haveheads = set(h.branch() for h in heads) |
|
3689 | haveheads = set(h.branch() for h in heads) | |
3615 | if branches - haveheads: |
|
3690 | if branches - haveheads: | |
3616 | headless = ', '.join(b for b in branches - haveheads) |
|
3691 | headless = ', '.join(b for b in branches - haveheads) | |
3617 | msg = _('no open branch heads found on branches %s') |
|
3692 | msg = _('no open branch heads found on branches %s') | |
3618 | if opts.get('rev'): |
|
3693 | if opts.get('rev'): | |
3619 | msg += _(' (started at %s)') % opts['rev'] |
|
3694 | msg += _(' (started at %s)') % opts['rev'] | |
3620 | ui.warn((msg + '\n') % headless) |
|
3695 | ui.warn((msg + '\n') % headless) | |
3621 |
|
3696 | |||
3622 | if not heads: |
|
3697 | if not heads: | |
3623 | return 1 |
|
3698 | return 1 | |
3624 |
|
3699 | |||
3625 | heads = sorted(heads, key=lambda x: -x.rev()) |
|
3700 | heads = sorted(heads, key=lambda x: -x.rev()) | |
3626 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
3701 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
3627 | for ctx in heads: |
|
3702 | for ctx in heads: | |
3628 | displayer.show(ctx) |
|
3703 | displayer.show(ctx) | |
3629 | displayer.close() |
|
3704 | displayer.close() | |
3630 |
|
3705 | |||
3631 | @command('help', |
|
3706 | @command('help', | |
3632 | [('e', 'extension', None, _('show only help for extensions')), |
|
3707 | [('e', 'extension', None, _('show only help for extensions')), | |
3633 | ('c', 'command', None, _('show only help for commands')), |
|
3708 | ('c', 'command', None, _('show only help for commands')), | |
3634 | ('k', 'keyword', '', _('show topics matching keyword')), |
|
3709 | ('k', 'keyword', '', _('show topics matching keyword')), | |
3635 | ], |
|
3710 | ], | |
3636 | _('[-ec] [TOPIC]'), |
|
3711 | _('[-ec] [TOPIC]'), | |
3637 | norepo=True) |
|
3712 | norepo=True) | |
3638 | def help_(ui, name=None, **opts): |
|
3713 | def help_(ui, name=None, **opts): | |
3639 | """show help for a given topic or a help overview |
|
3714 | """show help for a given topic or a help overview | |
3640 |
|
3715 | |||
3641 | With no arguments, print a list of commands with short help messages. |
|
3716 | With no arguments, print a list of commands with short help messages. | |
3642 |
|
3717 | |||
3643 | Given a topic, extension, or command name, print help for that |
|
3718 | Given a topic, extension, or command name, print help for that | |
3644 | topic. |
|
3719 | topic. | |
3645 |
|
3720 | |||
3646 | Returns 0 if successful. |
|
3721 | Returns 0 if successful. | |
3647 | """ |
|
3722 | """ | |
3648 |
|
3723 | |||
3649 | textwidth = min(ui.termwidth(), 80) - 2 |
|
3724 | textwidth = min(ui.termwidth(), 80) - 2 | |
3650 |
|
3725 | |||
3651 | keep = ui.verbose and ['verbose'] or [] |
|
3726 | keep = ui.verbose and ['verbose'] or [] | |
3652 | text = help.help_(ui, name, **opts) |
|
3727 | text = help.help_(ui, name, **opts) | |
3653 |
|
3728 | |||
3654 | formatted, pruned = minirst.format(text, textwidth, keep=keep) |
|
3729 | formatted, pruned = minirst.format(text, textwidth, keep=keep) | |
3655 | if 'verbose' in pruned: |
|
3730 | if 'verbose' in pruned: | |
3656 | keep.append('omitted') |
|
3731 | keep.append('omitted') | |
3657 | else: |
|
3732 | else: | |
3658 | keep.append('notomitted') |
|
3733 | keep.append('notomitted') | |
3659 | formatted, pruned = minirst.format(text, textwidth, keep=keep) |
|
3734 | formatted, pruned = minirst.format(text, textwidth, keep=keep) | |
3660 | ui.write(formatted) |
|
3735 | ui.write(formatted) | |
3661 |
|
3736 | |||
3662 |
|
3737 | |||
3663 | @command('identify|id', |
|
3738 | @command('identify|id', | |
3664 | [('r', 'rev', '', |
|
3739 | [('r', 'rev', '', | |
3665 | _('identify the specified revision'), _('REV')), |
|
3740 | _('identify the specified revision'), _('REV')), | |
3666 | ('n', 'num', None, _('show local revision number')), |
|
3741 | ('n', 'num', None, _('show local revision number')), | |
3667 | ('i', 'id', None, _('show global revision id')), |
|
3742 | ('i', 'id', None, _('show global revision id')), | |
3668 | ('b', 'branch', None, _('show branch')), |
|
3743 | ('b', 'branch', None, _('show branch')), | |
3669 | ('t', 'tags', None, _('show tags')), |
|
3744 | ('t', 'tags', None, _('show tags')), | |
3670 | ('B', 'bookmarks', None, _('show bookmarks')), |
|
3745 | ('B', 'bookmarks', None, _('show bookmarks')), | |
3671 | ] + remoteopts, |
|
3746 | ] + remoteopts, | |
3672 | _('[-nibtB] [-r REV] [SOURCE]'), |
|
3747 | _('[-nibtB] [-r REV] [SOURCE]'), | |
3673 | optionalrepo=True) |
|
3748 | optionalrepo=True) | |
3674 | def identify(ui, repo, source=None, rev=None, |
|
3749 | def identify(ui, repo, source=None, rev=None, | |
3675 | num=None, id=None, branch=None, tags=None, bookmarks=None, **opts): |
|
3750 | num=None, id=None, branch=None, tags=None, bookmarks=None, **opts): | |
3676 | """identify the working copy or specified revision |
|
3751 | """identify the working copy or specified revision | |
3677 |
|
3752 | |||
3678 | Print a summary identifying the repository state at REV using one or |
|
3753 | Print a summary identifying the repository state at REV using one or | |
3679 | two parent hash identifiers, followed by a "+" if the working |
|
3754 | two parent hash identifiers, followed by a "+" if the working | |
3680 | directory has uncommitted changes, the branch name (if not default), |
|
3755 | directory has uncommitted changes, the branch name (if not default), | |
3681 | a list of tags, and a list of bookmarks. |
|
3756 | a list of tags, and a list of bookmarks. | |
3682 |
|
3757 | |||
3683 | When REV is not given, print a summary of the current state of the |
|
3758 | When REV is not given, print a summary of the current state of the | |
3684 | repository. |
|
3759 | repository. | |
3685 |
|
3760 | |||
3686 | Specifying a path to a repository root or Mercurial bundle will |
|
3761 | Specifying a path to a repository root or Mercurial bundle will | |
3687 | cause lookup to operate on that repository/bundle. |
|
3762 | cause lookup to operate on that repository/bundle. | |
3688 |
|
3763 | |||
3689 | .. container:: verbose |
|
3764 | .. container:: verbose | |
3690 |
|
3765 | |||
3691 | Examples: |
|
3766 | Examples: | |
3692 |
|
3767 | |||
3693 | - generate a build identifier for the working directory:: |
|
3768 | - generate a build identifier for the working directory:: | |
3694 |
|
3769 | |||
3695 | hg id --id > build-id.dat |
|
3770 | hg id --id > build-id.dat | |
3696 |
|
3771 | |||
3697 | - find the revision corresponding to a tag:: |
|
3772 | - find the revision corresponding to a tag:: | |
3698 |
|
3773 | |||
3699 | hg id -n -r 1.3 |
|
3774 | hg id -n -r 1.3 | |
3700 |
|
3775 | |||
3701 | - check the most recent revision of a remote repository:: |
|
3776 | - check the most recent revision of a remote repository:: | |
3702 |
|
3777 | |||
3703 | hg id -r tip http://selenic.com/hg/ |
|
3778 | hg id -r tip http://selenic.com/hg/ | |
3704 |
|
3779 | |||
3705 | Returns 0 if successful. |
|
3780 | Returns 0 if successful. | |
3706 | """ |
|
3781 | """ | |
3707 |
|
3782 | |||
3708 | if not repo and not source: |
|
3783 | if not repo and not source: | |
3709 | raise util.Abort(_("there is no Mercurial repository here " |
|
3784 | raise util.Abort(_("there is no Mercurial repository here " | |
3710 | "(.hg not found)")) |
|
3785 | "(.hg not found)")) | |
3711 |
|
3786 | |||
3712 | hexfunc = ui.debugflag and hex or short |
|
3787 | hexfunc = ui.debugflag and hex or short | |
3713 | default = not (num or id or branch or tags or bookmarks) |
|
3788 | default = not (num or id or branch or tags or bookmarks) | |
3714 | output = [] |
|
3789 | output = [] | |
3715 | revs = [] |
|
3790 | revs = [] | |
3716 |
|
3791 | |||
3717 | if source: |
|
3792 | if source: | |
3718 | source, branches = hg.parseurl(ui.expandpath(source)) |
|
3793 | source, branches = hg.parseurl(ui.expandpath(source)) | |
3719 | peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo |
|
3794 | peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo | |
3720 | repo = peer.local() |
|
3795 | repo = peer.local() | |
3721 | revs, checkout = hg.addbranchrevs(repo, peer, branches, None) |
|
3796 | revs, checkout = hg.addbranchrevs(repo, peer, branches, None) | |
3722 |
|
3797 | |||
3723 | if not repo: |
|
3798 | if not repo: | |
3724 | if num or branch or tags: |
|
3799 | if num or branch or tags: | |
3725 | raise util.Abort( |
|
3800 | raise util.Abort( | |
3726 | _("can't query remote revision number, branch, or tags")) |
|
3801 | _("can't query remote revision number, branch, or tags")) | |
3727 | if not rev and revs: |
|
3802 | if not rev and revs: | |
3728 | rev = revs[0] |
|
3803 | rev = revs[0] | |
3729 | if not rev: |
|
3804 | if not rev: | |
3730 | rev = "tip" |
|
3805 | rev = "tip" | |
3731 |
|
3806 | |||
3732 | remoterev = peer.lookup(rev) |
|
3807 | remoterev = peer.lookup(rev) | |
3733 | if default or id: |
|
3808 | if default or id: | |
3734 | output = [hexfunc(remoterev)] |
|
3809 | output = [hexfunc(remoterev)] | |
3735 |
|
3810 | |||
3736 | def getbms(): |
|
3811 | def getbms(): | |
3737 | bms = [] |
|
3812 | bms = [] | |
3738 |
|
3813 | |||
3739 | if 'bookmarks' in peer.listkeys('namespaces'): |
|
3814 | if 'bookmarks' in peer.listkeys('namespaces'): | |
3740 | hexremoterev = hex(remoterev) |
|
3815 | hexremoterev = hex(remoterev) | |
3741 | bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems() |
|
3816 | bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems() | |
3742 | if bmr == hexremoterev] |
|
3817 | if bmr == hexremoterev] | |
3743 |
|
3818 | |||
3744 | return sorted(bms) |
|
3819 | return sorted(bms) | |
3745 |
|
3820 | |||
3746 | if bookmarks: |
|
3821 | if bookmarks: | |
3747 | output.extend(getbms()) |
|
3822 | output.extend(getbms()) | |
3748 | elif default and not ui.quiet: |
|
3823 | elif default and not ui.quiet: | |
3749 | # multiple bookmarks for a single parent separated by '/' |
|
3824 | # multiple bookmarks for a single parent separated by '/' | |
3750 | bm = '/'.join(getbms()) |
|
3825 | bm = '/'.join(getbms()) | |
3751 | if bm: |
|
3826 | if bm: | |
3752 | output.append(bm) |
|
3827 | output.append(bm) | |
3753 | else: |
|
3828 | else: | |
3754 | if not rev: |
|
3829 | if not rev: | |
3755 | ctx = repo[None] |
|
3830 | ctx = repo[None] | |
3756 | parents = ctx.parents() |
|
3831 | parents = ctx.parents() | |
3757 | changed = "" |
|
3832 | changed = "" | |
3758 | if default or id or num: |
|
3833 | if default or id or num: | |
3759 | if (util.any(repo.status()) |
|
3834 | if (util.any(repo.status()) | |
3760 | or util.any(ctx.sub(s).dirty() for s in ctx.substate)): |
|
3835 | or util.any(ctx.sub(s).dirty() for s in ctx.substate)): | |
3761 | changed = '+' |
|
3836 | changed = '+' | |
3762 | if default or id: |
|
3837 | if default or id: | |
3763 | output = ["%s%s" % |
|
3838 | output = ["%s%s" % | |
3764 | ('+'.join([hexfunc(p.node()) for p in parents]), changed)] |
|
3839 | ('+'.join([hexfunc(p.node()) for p in parents]), changed)] | |
3765 | if num: |
|
3840 | if num: | |
3766 | output.append("%s%s" % |
|
3841 | output.append("%s%s" % | |
3767 | ('+'.join([str(p.rev()) for p in parents]), changed)) |
|
3842 | ('+'.join([str(p.rev()) for p in parents]), changed)) | |
3768 | else: |
|
3843 | else: | |
3769 | ctx = scmutil.revsingle(repo, rev) |
|
3844 | ctx = scmutil.revsingle(repo, rev) | |
3770 | if default or id: |
|
3845 | if default or id: | |
3771 | output = [hexfunc(ctx.node())] |
|
3846 | output = [hexfunc(ctx.node())] | |
3772 | if num: |
|
3847 | if num: | |
3773 | output.append(str(ctx.rev())) |
|
3848 | output.append(str(ctx.rev())) | |
3774 |
|
3849 | |||
3775 | if default and not ui.quiet: |
|
3850 | if default and not ui.quiet: | |
3776 | b = ctx.branch() |
|
3851 | b = ctx.branch() | |
3777 | if b != 'default': |
|
3852 | if b != 'default': | |
3778 | output.append("(%s)" % b) |
|
3853 | output.append("(%s)" % b) | |
3779 |
|
3854 | |||
3780 | # multiple tags for a single parent separated by '/' |
|
3855 | # multiple tags for a single parent separated by '/' | |
3781 | t = '/'.join(ctx.tags()) |
|
3856 | t = '/'.join(ctx.tags()) | |
3782 | if t: |
|
3857 | if t: | |
3783 | output.append(t) |
|
3858 | output.append(t) | |
3784 |
|
3859 | |||
3785 | # multiple bookmarks for a single parent separated by '/' |
|
3860 | # multiple bookmarks for a single parent separated by '/' | |
3786 | bm = '/'.join(ctx.bookmarks()) |
|
3861 | bm = '/'.join(ctx.bookmarks()) | |
3787 | if bm: |
|
3862 | if bm: | |
3788 | output.append(bm) |
|
3863 | output.append(bm) | |
3789 | else: |
|
3864 | else: | |
3790 | if branch: |
|
3865 | if branch: | |
3791 | output.append(ctx.branch()) |
|
3866 | output.append(ctx.branch()) | |
3792 |
|
3867 | |||
3793 | if tags: |
|
3868 | if tags: | |
3794 | output.extend(ctx.tags()) |
|
3869 | output.extend(ctx.tags()) | |
3795 |
|
3870 | |||
3796 | if bookmarks: |
|
3871 | if bookmarks: | |
3797 | output.extend(ctx.bookmarks()) |
|
3872 | output.extend(ctx.bookmarks()) | |
3798 |
|
3873 | |||
3799 | ui.write("%s\n" % ' '.join(output)) |
|
3874 | ui.write("%s\n" % ' '.join(output)) | |
3800 |
|
3875 | |||
3801 | @command('import|patch', |
|
3876 | @command('import|patch', | |
3802 | [('p', 'strip', 1, |
|
3877 | [('p', 'strip', 1, | |
3803 | _('directory strip option for patch. This has the same ' |
|
3878 | _('directory strip option for patch. This has the same ' | |
3804 | 'meaning as the corresponding patch option'), _('NUM')), |
|
3879 | 'meaning as the corresponding patch option'), _('NUM')), | |
3805 | ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')), |
|
3880 | ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')), | |
3806 | ('e', 'edit', False, _('invoke editor on commit messages')), |
|
3881 | ('e', 'edit', False, _('invoke editor on commit messages')), | |
3807 | ('f', 'force', None, |
|
3882 | ('f', 'force', None, | |
3808 | _('skip check for outstanding uncommitted changes (DEPRECATED)')), |
|
3883 | _('skip check for outstanding uncommitted changes (DEPRECATED)')), | |
3809 | ('', 'no-commit', None, |
|
3884 | ('', 'no-commit', None, | |
3810 | _("don't commit, just update the working directory")), |
|
3885 | _("don't commit, just update the working directory")), | |
3811 | ('', 'bypass', None, |
|
3886 | ('', 'bypass', None, | |
3812 | _("apply patch without touching the working directory")), |
|
3887 | _("apply patch without touching the working directory")), | |
3813 | ('', 'partial', None, |
|
3888 | ('', 'partial', None, | |
3814 | _('commit even if some hunks fail')), |
|
3889 | _('commit even if some hunks fail')), | |
3815 | ('', 'exact', None, |
|
3890 | ('', 'exact', None, | |
3816 | _('apply patch to the nodes from which it was generated')), |
|
3891 | _('apply patch to the nodes from which it was generated')), | |
3817 | ('', 'import-branch', None, |
|
3892 | ('', 'import-branch', None, | |
3818 | _('use any branch information in patch (implied by --exact)'))] + |
|
3893 | _('use any branch information in patch (implied by --exact)'))] + | |
3819 | commitopts + commitopts2 + similarityopts, |
|
3894 | commitopts + commitopts2 + similarityopts, | |
3820 | _('[OPTION]... PATCH...')) |
|
3895 | _('[OPTION]... PATCH...')) | |
3821 | def import_(ui, repo, patch1=None, *patches, **opts): |
|
3896 | def import_(ui, repo, patch1=None, *patches, **opts): | |
3822 | """import an ordered set of patches |
|
3897 | """import an ordered set of patches | |
3823 |
|
3898 | |||
3824 | Import a list of patches and commit them individually (unless |
|
3899 | Import a list of patches and commit them individually (unless | |
3825 | --no-commit is specified). |
|
3900 | --no-commit is specified). | |
3826 |
|
3901 | |||
3827 | Because import first applies changes to the working directory, |
|
3902 | Because import first applies changes to the working directory, | |
3828 | import will abort if there are outstanding changes. |
|
3903 | import will abort if there are outstanding changes. | |
3829 |
|
3904 | |||
3830 | You can import a patch straight from a mail message. Even patches |
|
3905 | You can import a patch straight from a mail message. Even patches | |
3831 | as attachments work (to use the body part, it must have type |
|
3906 | as attachments work (to use the body part, it must have type | |
3832 | text/plain or text/x-patch). From and Subject headers of email |
|
3907 | text/plain or text/x-patch). From and Subject headers of email | |
3833 | message are used as default committer and commit message. All |
|
3908 | message are used as default committer and commit message. All | |
3834 | text/plain body parts before first diff are added to commit |
|
3909 | text/plain body parts before first diff are added to commit | |
3835 | message. |
|
3910 | message. | |
3836 |
|
3911 | |||
3837 | If the imported patch was generated by :hg:`export`, user and |
|
3912 | If the imported patch was generated by :hg:`export`, user and | |
3838 | description from patch override values from message headers and |
|
3913 | description from patch override values from message headers and | |
3839 | body. Values given on command line with -m/--message and -u/--user |
|
3914 | body. Values given on command line with -m/--message and -u/--user | |
3840 | override these. |
|
3915 | override these. | |
3841 |
|
3916 | |||
3842 | If --exact is specified, import will set the working directory to |
|
3917 | If --exact is specified, import will set the working directory to | |
3843 | the parent of each patch before applying it, and will abort if the |
|
3918 | the parent of each patch before applying it, and will abort if the | |
3844 | resulting changeset has a different ID than the one recorded in |
|
3919 | resulting changeset has a different ID than the one recorded in | |
3845 | the patch. This may happen due to character set problems or other |
|
3920 | the patch. This may happen due to character set problems or other | |
3846 | deficiencies in the text patch format. |
|
3921 | deficiencies in the text patch format. | |
3847 |
|
3922 | |||
3848 | Use --bypass to apply and commit patches directly to the |
|
3923 | Use --bypass to apply and commit patches directly to the | |
3849 | repository, not touching the working directory. Without --exact, |
|
3924 | repository, not touching the working directory. Without --exact, | |
3850 | patches will be applied on top of the working directory parent |
|
3925 | patches will be applied on top of the working directory parent | |
3851 | revision. |
|
3926 | revision. | |
3852 |
|
3927 | |||
3853 | With -s/--similarity, hg will attempt to discover renames and |
|
3928 | With -s/--similarity, hg will attempt to discover renames and | |
3854 | copies in the patch in the same way as :hg:`addremove`. |
|
3929 | copies in the patch in the same way as :hg:`addremove`. | |
3855 |
|
3930 | |||
3856 | Use --partial to ensure a changeset will be created from the patch |
|
3931 | Use --partial to ensure a changeset will be created from the patch | |
3857 | even if some hunks fail to apply. Hunks that fail to apply will be |
|
3932 | even if some hunks fail to apply. Hunks that fail to apply will be | |
3858 | written to a <target-file>.rej file. Conflicts can then be resolved |
|
3933 | written to a <target-file>.rej file. Conflicts can then be resolved | |
3859 | by hand before :hg:`commit --amend` is run to update the created |
|
3934 | by hand before :hg:`commit --amend` is run to update the created | |
3860 | changeset. This flag exists to let people import patches that |
|
3935 | changeset. This flag exists to let people import patches that | |
3861 | partially apply without losing the associated metadata (author, |
|
3936 | partially apply without losing the associated metadata (author, | |
3862 | date, description, ...). Note that when none of the hunk applies |
|
3937 | date, description, ...). Note that when none of the hunk applies | |
3863 | cleanly, :hg:`import --partial` will create an empty changeset, |
|
3938 | cleanly, :hg:`import --partial` will create an empty changeset, | |
3864 | importing only the patch metadata. |
|
3939 | importing only the patch metadata. | |
3865 |
|
3940 | |||
3866 | To read a patch from standard input, use "-" as the patch name. If |
|
3941 | To read a patch from standard input, use "-" as the patch name. If | |
3867 | a URL is specified, the patch will be downloaded from it. |
|
3942 | a URL is specified, the patch will be downloaded from it. | |
3868 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
3943 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
3869 |
|
3944 | |||
3870 | .. container:: verbose |
|
3945 | .. container:: verbose | |
3871 |
|
3946 | |||
3872 | Examples: |
|
3947 | Examples: | |
3873 |
|
3948 | |||
3874 | - import a traditional patch from a website and detect renames:: |
|
3949 | - import a traditional patch from a website and detect renames:: | |
3875 |
|
3950 | |||
3876 | hg import -s 80 http://example.com/bugfix.patch |
|
3951 | hg import -s 80 http://example.com/bugfix.patch | |
3877 |
|
3952 | |||
3878 | - import a changeset from an hgweb server:: |
|
3953 | - import a changeset from an hgweb server:: | |
3879 |
|
3954 | |||
3880 | hg import http://www.selenic.com/hg/rev/5ca8c111e9aa |
|
3955 | hg import http://www.selenic.com/hg/rev/5ca8c111e9aa | |
3881 |
|
3956 | |||
3882 | - import all the patches in an Unix-style mbox:: |
|
3957 | - import all the patches in an Unix-style mbox:: | |
3883 |
|
3958 | |||
3884 | hg import incoming-patches.mbox |
|
3959 | hg import incoming-patches.mbox | |
3885 |
|
3960 | |||
3886 | - attempt to exactly restore an exported changeset (not always |
|
3961 | - attempt to exactly restore an exported changeset (not always | |
3887 | possible):: |
|
3962 | possible):: | |
3888 |
|
3963 | |||
3889 | hg import --exact proposed-fix.patch |
|
3964 | hg import --exact proposed-fix.patch | |
3890 |
|
3965 | |||
3891 | Returns 0 on success, 1 on partial success (see --partial). |
|
3966 | Returns 0 on success, 1 on partial success (see --partial). | |
3892 | """ |
|
3967 | """ | |
3893 |
|
3968 | |||
3894 | if not patch1: |
|
3969 | if not patch1: | |
3895 | raise util.Abort(_('need at least one patch to import')) |
|
3970 | raise util.Abort(_('need at least one patch to import')) | |
3896 |
|
3971 | |||
3897 | patches = (patch1,) + patches |
|
3972 | patches = (patch1,) + patches | |
3898 |
|
3973 | |||
3899 | date = opts.get('date') |
|
3974 | date = opts.get('date') | |
3900 | if date: |
|
3975 | if date: | |
3901 | opts['date'] = util.parsedate(date) |
|
3976 | opts['date'] = util.parsedate(date) | |
3902 |
|
3977 | |||
3903 | update = not opts.get('bypass') |
|
3978 | update = not opts.get('bypass') | |
3904 | if not update and opts.get('no_commit'): |
|
3979 | if not update and opts.get('no_commit'): | |
3905 | raise util.Abort(_('cannot use --no-commit with --bypass')) |
|
3980 | raise util.Abort(_('cannot use --no-commit with --bypass')) | |
3906 | try: |
|
3981 | try: | |
3907 | sim = float(opts.get('similarity') or 0) |
|
3982 | sim = float(opts.get('similarity') or 0) | |
3908 | except ValueError: |
|
3983 | except ValueError: | |
3909 | raise util.Abort(_('similarity must be a number')) |
|
3984 | raise util.Abort(_('similarity must be a number')) | |
3910 | if sim < 0 or sim > 100: |
|
3985 | if sim < 0 or sim > 100: | |
3911 | raise util.Abort(_('similarity must be between 0 and 100')) |
|
3986 | raise util.Abort(_('similarity must be between 0 and 100')) | |
3912 | if sim and not update: |
|
3987 | if sim and not update: | |
3913 | raise util.Abort(_('cannot use --similarity with --bypass')) |
|
3988 | raise util.Abort(_('cannot use --similarity with --bypass')) | |
3914 | if opts.get('exact') and opts.get('edit'): |
|
3989 | if opts.get('exact') and opts.get('edit'): | |
3915 | raise util.Abort(_('cannot use --exact with --edit')) |
|
3990 | raise util.Abort(_('cannot use --exact with --edit')) | |
3916 |
|
3991 | |||
3917 | if update: |
|
3992 | if update: | |
3918 | cmdutil.checkunfinished(repo) |
|
3993 | cmdutil.checkunfinished(repo) | |
3919 | if (opts.get('exact') or not opts.get('force')) and update: |
|
3994 | if (opts.get('exact') or not opts.get('force')) and update: | |
3920 | cmdutil.bailifchanged(repo) |
|
3995 | cmdutil.bailifchanged(repo) | |
3921 |
|
3996 | |||
3922 | base = opts["base"] |
|
3997 | base = opts["base"] | |
3923 | wlock = lock = tr = None |
|
3998 | wlock = lock = tr = None | |
3924 | msgs = [] |
|
3999 | msgs = [] | |
3925 | ret = 0 |
|
4000 | ret = 0 | |
3926 |
|
4001 | |||
3927 |
|
4002 | |||
3928 | try: |
|
4003 | try: | |
3929 | try: |
|
4004 | try: | |
3930 | wlock = repo.wlock() |
|
4005 | wlock = repo.wlock() | |
3931 | repo.dirstate.beginparentchange() |
|
4006 | repo.dirstate.beginparentchange() | |
3932 | if not opts.get('no_commit'): |
|
4007 | if not opts.get('no_commit'): | |
3933 | lock = repo.lock() |
|
4008 | lock = repo.lock() | |
3934 | tr = repo.transaction('import') |
|
4009 | tr = repo.transaction('import') | |
3935 | parents = repo.parents() |
|
4010 | parents = repo.parents() | |
3936 | for patchurl in patches: |
|
4011 | for patchurl in patches: | |
3937 | if patchurl == '-': |
|
4012 | if patchurl == '-': | |
3938 | ui.status(_('applying patch from stdin\n')) |
|
4013 | ui.status(_('applying patch from stdin\n')) | |
3939 | patchfile = ui.fin |
|
4014 | patchfile = ui.fin | |
3940 | patchurl = 'stdin' # for error message |
|
4015 | patchurl = 'stdin' # for error message | |
3941 | else: |
|
4016 | else: | |
3942 | patchurl = os.path.join(base, patchurl) |
|
4017 | patchurl = os.path.join(base, patchurl) | |
3943 | ui.status(_('applying %s\n') % patchurl) |
|
4018 | ui.status(_('applying %s\n') % patchurl) | |
3944 | patchfile = hg.openpath(ui, patchurl) |
|
4019 | patchfile = hg.openpath(ui, patchurl) | |
3945 |
|
4020 | |||
3946 | haspatch = False |
|
4021 | haspatch = False | |
3947 | for hunk in patch.split(patchfile): |
|
4022 | for hunk in patch.split(patchfile): | |
3948 | (msg, node, rej) = cmdutil.tryimportone(ui, repo, hunk, |
|
4023 | (msg, node, rej) = cmdutil.tryimportone(ui, repo, hunk, | |
3949 | parents, opts, |
|
4024 | parents, opts, | |
3950 | msgs, hg.clean) |
|
4025 | msgs, hg.clean) | |
3951 | if msg: |
|
4026 | if msg: | |
3952 | haspatch = True |
|
4027 | haspatch = True | |
3953 | ui.note(msg + '\n') |
|
4028 | ui.note(msg + '\n') | |
3954 | if update or opts.get('exact'): |
|
4029 | if update or opts.get('exact'): | |
3955 | parents = repo.parents() |
|
4030 | parents = repo.parents() | |
3956 | else: |
|
4031 | else: | |
3957 | parents = [repo[node]] |
|
4032 | parents = [repo[node]] | |
3958 | if rej: |
|
4033 | if rej: | |
3959 | ui.write_err(_("patch applied partially\n")) |
|
4034 | ui.write_err(_("patch applied partially\n")) | |
3960 | ui.write_err(_("(fix the .rej files and run " |
|
4035 | ui.write_err(_("(fix the .rej files and run " | |
3961 | "`hg commit --amend`)\n")) |
|
4036 | "`hg commit --amend`)\n")) | |
3962 | ret = 1 |
|
4037 | ret = 1 | |
3963 | break |
|
4038 | break | |
3964 |
|
4039 | |||
3965 | if not haspatch: |
|
4040 | if not haspatch: | |
3966 | raise util.Abort(_('%s: no diffs found') % patchurl) |
|
4041 | raise util.Abort(_('%s: no diffs found') % patchurl) | |
3967 |
|
4042 | |||
3968 | if tr: |
|
4043 | if tr: | |
3969 | tr.close() |
|
4044 | tr.close() | |
3970 | if msgs: |
|
4045 | if msgs: | |
3971 | repo.savecommitmessage('\n* * *\n'.join(msgs)) |
|
4046 | repo.savecommitmessage('\n* * *\n'.join(msgs)) | |
3972 | repo.dirstate.endparentchange() |
|
4047 | repo.dirstate.endparentchange() | |
3973 | return ret |
|
4048 | return ret | |
3974 | except: # re-raises |
|
4049 | except: # re-raises | |
3975 | # wlock.release() indirectly calls dirstate.write(): since |
|
4050 | # wlock.release() indirectly calls dirstate.write(): since | |
3976 | # we're crashing, we do not want to change the working dir |
|
4051 | # we're crashing, we do not want to change the working dir | |
3977 | # parent after all, so make sure it writes nothing |
|
4052 | # parent after all, so make sure it writes nothing | |
3978 | repo.dirstate.invalidate() |
|
4053 | repo.dirstate.invalidate() | |
3979 | raise |
|
4054 | raise | |
3980 | finally: |
|
4055 | finally: | |
3981 | if tr: |
|
4056 | if tr: | |
3982 | tr.release() |
|
4057 | tr.release() | |
3983 | release(lock, wlock) |
|
4058 | release(lock, wlock) | |
3984 |
|
4059 | |||
3985 | @command('incoming|in', |
|
4060 | @command('incoming|in', | |
3986 | [('f', 'force', None, |
|
4061 | [('f', 'force', None, | |
3987 | _('run even if remote repository is unrelated')), |
|
4062 | _('run even if remote repository is unrelated')), | |
3988 | ('n', 'newest-first', None, _('show newest record first')), |
|
4063 | ('n', 'newest-first', None, _('show newest record first')), | |
3989 | ('', 'bundle', '', |
|
4064 | ('', 'bundle', '', | |
3990 | _('file to store the bundles into'), _('FILE')), |
|
4065 | _('file to store the bundles into'), _('FILE')), | |
3991 | ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), |
|
4066 | ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), | |
3992 | ('B', 'bookmarks', False, _("compare bookmarks")), |
|
4067 | ('B', 'bookmarks', False, _("compare bookmarks")), | |
3993 | ('b', 'branch', [], |
|
4068 | ('b', 'branch', [], | |
3994 | _('a specific branch you would like to pull'), _('BRANCH')), |
|
4069 | _('a specific branch you would like to pull'), _('BRANCH')), | |
3995 | ] + logopts + remoteopts + subrepoopts, |
|
4070 | ] + logopts + remoteopts + subrepoopts, | |
3996 | _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]')) |
|
4071 | _('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]')) | |
3997 | def incoming(ui, repo, source="default", **opts): |
|
4072 | def incoming(ui, repo, source="default", **opts): | |
3998 | """show new changesets found in source |
|
4073 | """show new changesets found in source | |
3999 |
|
4074 | |||
4000 | Show new changesets found in the specified path/URL or the default |
|
4075 | Show new changesets found in the specified path/URL or the default | |
4001 | pull location. These are the changesets that would have been pulled |
|
4076 | pull location. These are the changesets that would have been pulled | |
4002 | if a pull at the time you issued this command. |
|
4077 | if a pull at the time you issued this command. | |
4003 |
|
4078 | |||
4004 | For remote repository, using --bundle avoids downloading the |
|
4079 | For remote repository, using --bundle avoids downloading the | |
4005 | changesets twice if the incoming is followed by a pull. |
|
4080 | changesets twice if the incoming is followed by a pull. | |
4006 |
|
4081 | |||
4007 | See pull for valid source format details. |
|
4082 | See pull for valid source format details. | |
4008 |
|
4083 | |||
4009 | .. container:: verbose |
|
4084 | .. container:: verbose | |
4010 |
|
4085 | |||
4011 | Examples: |
|
4086 | Examples: | |
4012 |
|
4087 | |||
4013 | - show incoming changes with patches and full description:: |
|
4088 | - show incoming changes with patches and full description:: | |
4014 |
|
4089 | |||
4015 | hg incoming -vp |
|
4090 | hg incoming -vp | |
4016 |
|
4091 | |||
4017 | - show incoming changes excluding merges, store a bundle:: |
|
4092 | - show incoming changes excluding merges, store a bundle:: | |
4018 |
|
4093 | |||
4019 | hg in -vpM --bundle incoming.hg |
|
4094 | hg in -vpM --bundle incoming.hg | |
4020 | hg pull incoming.hg |
|
4095 | hg pull incoming.hg | |
4021 |
|
4096 | |||
4022 | - briefly list changes inside a bundle:: |
|
4097 | - briefly list changes inside a bundle:: | |
4023 |
|
4098 | |||
4024 | hg in changes.hg -T "{desc|firstline}\\n" |
|
4099 | hg in changes.hg -T "{desc|firstline}\\n" | |
4025 |
|
4100 | |||
4026 | Returns 0 if there are incoming changes, 1 otherwise. |
|
4101 | Returns 0 if there are incoming changes, 1 otherwise. | |
4027 | """ |
|
4102 | """ | |
4028 | if opts.get('graph'): |
|
4103 | if opts.get('graph'): | |
4029 | cmdutil.checkunsupportedgraphflags([], opts) |
|
4104 | cmdutil.checkunsupportedgraphflags([], opts) | |
4030 | def display(other, chlist, displayer): |
|
4105 | def display(other, chlist, displayer): | |
4031 | revdag = cmdutil.graphrevs(other, chlist, opts) |
|
4106 | revdag = cmdutil.graphrevs(other, chlist, opts) | |
4032 | showparents = [ctx.node() for ctx in repo[None].parents()] |
|
4107 | showparents = [ctx.node() for ctx in repo[None].parents()] | |
4033 | cmdutil.displaygraph(ui, revdag, displayer, showparents, |
|
4108 | cmdutil.displaygraph(ui, revdag, displayer, showparents, | |
4034 | graphmod.asciiedges) |
|
4109 | graphmod.asciiedges) | |
4035 |
|
4110 | |||
4036 | hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True) |
|
4111 | hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True) | |
4037 | return 0 |
|
4112 | return 0 | |
4038 |
|
4113 | |||
4039 | if opts.get('bundle') and opts.get('subrepos'): |
|
4114 | if opts.get('bundle') and opts.get('subrepos'): | |
4040 | raise util.Abort(_('cannot combine --bundle and --subrepos')) |
|
4115 | raise util.Abort(_('cannot combine --bundle and --subrepos')) | |
4041 |
|
4116 | |||
4042 | if opts.get('bookmarks'): |
|
4117 | if opts.get('bookmarks'): | |
4043 | source, branches = hg.parseurl(ui.expandpath(source), |
|
4118 | source, branches = hg.parseurl(ui.expandpath(source), | |
4044 | opts.get('branch')) |
|
4119 | opts.get('branch')) | |
4045 | other = hg.peer(repo, opts, source) |
|
4120 | other = hg.peer(repo, opts, source) | |
4046 | if 'bookmarks' not in other.listkeys('namespaces'): |
|
4121 | if 'bookmarks' not in other.listkeys('namespaces'): | |
4047 | ui.warn(_("remote doesn't support bookmarks\n")) |
|
4122 | ui.warn(_("remote doesn't support bookmarks\n")) | |
4048 | return 0 |
|
4123 | return 0 | |
4049 | ui.status(_('comparing with %s\n') % util.hidepassword(source)) |
|
4124 | ui.status(_('comparing with %s\n') % util.hidepassword(source)) | |
4050 | return bookmarks.diff(ui, repo, other) |
|
4125 | return bookmarks.diff(ui, repo, other) | |
4051 |
|
4126 | |||
4052 | repo._subtoppath = ui.expandpath(source) |
|
4127 | repo._subtoppath = ui.expandpath(source) | |
4053 | try: |
|
4128 | try: | |
4054 | return hg.incoming(ui, repo, source, opts) |
|
4129 | return hg.incoming(ui, repo, source, opts) | |
4055 | finally: |
|
4130 | finally: | |
4056 | del repo._subtoppath |
|
4131 | del repo._subtoppath | |
4057 |
|
4132 | |||
4058 |
|
4133 | |||
4059 | @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'), |
|
4134 | @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'), | |
4060 | norepo=True) |
|
4135 | norepo=True) | |
4061 | def init(ui, dest=".", **opts): |
|
4136 | def init(ui, dest=".", **opts): | |
4062 | """create a new repository in the given directory |
|
4137 | """create a new repository in the given directory | |
4063 |
|
4138 | |||
4064 | Initialize a new repository in the given directory. If the given |
|
4139 | Initialize a new repository in the given directory. If the given | |
4065 | directory does not exist, it will be created. |
|
4140 | directory does not exist, it will be created. | |
4066 |
|
4141 | |||
4067 | If no directory is given, the current directory is used. |
|
4142 | If no directory is given, the current directory is used. | |
4068 |
|
4143 | |||
4069 | It is possible to specify an ``ssh://`` URL as the destination. |
|
4144 | It is possible to specify an ``ssh://`` URL as the destination. | |
4070 | See :hg:`help urls` for more information. |
|
4145 | See :hg:`help urls` for more information. | |
4071 |
|
4146 | |||
4072 | Returns 0 on success. |
|
4147 | Returns 0 on success. | |
4073 | """ |
|
4148 | """ | |
4074 | hg.peer(ui, opts, ui.expandpath(dest), create=True) |
|
4149 | hg.peer(ui, opts, ui.expandpath(dest), create=True) | |
4075 |
|
4150 | |||
4076 | @command('locate', |
|
4151 | @command('locate', | |
4077 | [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), |
|
4152 | [('r', 'rev', '', _('search the repository as it is in REV'), _('REV')), | |
4078 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
|
4153 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), | |
4079 | ('f', 'fullpath', None, _('print complete paths from the filesystem root')), |
|
4154 | ('f', 'fullpath', None, _('print complete paths from the filesystem root')), | |
4080 | ] + walkopts, |
|
4155 | ] + walkopts, | |
4081 | _('[OPTION]... [PATTERN]...')) |
|
4156 | _('[OPTION]... [PATTERN]...')) | |
4082 | def locate(ui, repo, *pats, **opts): |
|
4157 | def locate(ui, repo, *pats, **opts): | |
4083 | """locate files matching specific patterns |
|
4158 | """locate files matching specific patterns | |
4084 |
|
4159 | |||
4085 | Print files under Mercurial control in the working directory whose |
|
4160 | Print files under Mercurial control in the working directory whose | |
4086 | names match the given patterns. |
|
4161 | names match the given patterns. | |
4087 |
|
4162 | |||
4088 | By default, this command searches all directories in the working |
|
4163 | By default, this command searches all directories in the working | |
4089 | directory. To search just the current directory and its |
|
4164 | directory. To search just the current directory and its | |
4090 | subdirectories, use "--include .". |
|
4165 | subdirectories, use "--include .". | |
4091 |
|
4166 | |||
4092 | If no patterns are given to match, this command prints the names |
|
4167 | If no patterns are given to match, this command prints the names | |
4093 | of all files under Mercurial control in the working directory. |
|
4168 | of all files under Mercurial control in the working directory. | |
4094 |
|
4169 | |||
4095 | If you want to feed the output of this command into the "xargs" |
|
4170 | If you want to feed the output of this command into the "xargs" | |
4096 | command, use the -0 option to both this command and "xargs". This |
|
4171 | command, use the -0 option to both this command and "xargs". This | |
4097 | will avoid the problem of "xargs" treating single filenames that |
|
4172 | will avoid the problem of "xargs" treating single filenames that | |
4098 | contain whitespace as multiple filenames. |
|
4173 | contain whitespace as multiple filenames. | |
4099 |
|
4174 | |||
4100 | Returns 0 if a match is found, 1 otherwise. |
|
4175 | Returns 0 if a match is found, 1 otherwise. | |
4101 | """ |
|
4176 | """ | |
4102 | end = opts.get('print0') and '\0' or '\n' |
|
4177 | end = opts.get('print0') and '\0' or '\n' | |
4103 | rev = scmutil.revsingle(repo, opts.get('rev'), None).node() |
|
4178 | rev = scmutil.revsingle(repo, opts.get('rev'), None).node() | |
4104 |
|
4179 | |||
4105 | ret = 1 |
|
4180 | ret = 1 | |
4106 | ctx = repo[rev] |
|
4181 | ctx = repo[rev] | |
4107 | m = scmutil.match(ctx, pats, opts, default='relglob') |
|
4182 | m = scmutil.match(ctx, pats, opts, default='relglob') | |
4108 | m.bad = lambda x, y: False |
|
4183 | m.bad = lambda x, y: False | |
4109 |
|
4184 | |||
4110 | for abs in ctx.matches(m): |
|
4185 | for abs in ctx.matches(m): | |
4111 | if opts.get('fullpath'): |
|
4186 | if opts.get('fullpath'): | |
4112 | ui.write(repo.wjoin(abs), end) |
|
4187 | ui.write(repo.wjoin(abs), end) | |
4113 | else: |
|
4188 | else: | |
4114 | ui.write(((pats and m.rel(abs)) or abs), end) |
|
4189 | ui.write(((pats and m.rel(abs)) or abs), end) | |
4115 | ret = 0 |
|
4190 | ret = 0 | |
4116 |
|
4191 | |||
4117 | return ret |
|
4192 | return ret | |
4118 |
|
4193 | |||
4119 | @command('^log|history', |
|
4194 | @command('^log|history', | |
4120 | [('f', 'follow', None, |
|
4195 | [('f', 'follow', None, | |
4121 | _('follow changeset history, or file history across copies and renames')), |
|
4196 | _('follow changeset history, or file history across copies and renames')), | |
4122 | ('', 'follow-first', None, |
|
4197 | ('', 'follow-first', None, | |
4123 | _('only follow the first parent of merge changesets (DEPRECATED)')), |
|
4198 | _('only follow the first parent of merge changesets (DEPRECATED)')), | |
4124 | ('d', 'date', '', _('show revisions matching date spec'), _('DATE')), |
|
4199 | ('d', 'date', '', _('show revisions matching date spec'), _('DATE')), | |
4125 | ('C', 'copies', None, _('show copied files')), |
|
4200 | ('C', 'copies', None, _('show copied files')), | |
4126 | ('k', 'keyword', [], |
|
4201 | ('k', 'keyword', [], | |
4127 | _('do case-insensitive search for a given text'), _('TEXT')), |
|
4202 | _('do case-insensitive search for a given text'), _('TEXT')), | |
4128 | ('r', 'rev', [], _('show the specified revision or range'), _('REV')), |
|
4203 | ('r', 'rev', [], _('show the specified revision or range'), _('REV')), | |
4129 | ('', 'removed', None, _('include revisions where files were removed')), |
|
4204 | ('', 'removed', None, _('include revisions where files were removed')), | |
4130 | ('m', 'only-merges', None, _('show only merges (DEPRECATED)')), |
|
4205 | ('m', 'only-merges', None, _('show only merges (DEPRECATED)')), | |
4131 | ('u', 'user', [], _('revisions committed by user'), _('USER')), |
|
4206 | ('u', 'user', [], _('revisions committed by user'), _('USER')), | |
4132 | ('', 'only-branch', [], |
|
4207 | ('', 'only-branch', [], | |
4133 | _('show only changesets within the given named branch (DEPRECATED)'), |
|
4208 | _('show only changesets within the given named branch (DEPRECATED)'), | |
4134 | _('BRANCH')), |
|
4209 | _('BRANCH')), | |
4135 | ('b', 'branch', [], |
|
4210 | ('b', 'branch', [], | |
4136 | _('show changesets within the given named branch'), _('BRANCH')), |
|
4211 | _('show changesets within the given named branch'), _('BRANCH')), | |
4137 | ('P', 'prune', [], |
|
4212 | ('P', 'prune', [], | |
4138 | _('do not display revision or any of its ancestors'), _('REV')), |
|
4213 | _('do not display revision or any of its ancestors'), _('REV')), | |
4139 | ] + logopts + walkopts, |
|
4214 | ] + logopts + walkopts, | |
4140 | _('[OPTION]... [FILE]'), |
|
4215 | _('[OPTION]... [FILE]'), | |
4141 | inferrepo=True) |
|
4216 | inferrepo=True) | |
4142 | def log(ui, repo, *pats, **opts): |
|
4217 | def log(ui, repo, *pats, **opts): | |
4143 | """show revision history of entire repository or files |
|
4218 | """show revision history of entire repository or files | |
4144 |
|
4219 | |||
4145 | Print the revision history of the specified files or the entire |
|
4220 | Print the revision history of the specified files or the entire | |
4146 | project. |
|
4221 | project. | |
4147 |
|
4222 | |||
4148 | If no revision range is specified, the default is ``tip:0`` unless |
|
4223 | If no revision range is specified, the default is ``tip:0`` unless | |
4149 | --follow is set, in which case the working directory parent is |
|
4224 | --follow is set, in which case the working directory parent is | |
4150 | used as the starting revision. |
|
4225 | used as the starting revision. | |
4151 |
|
4226 | |||
4152 | File history is shown without following rename or copy history of |
|
4227 | File history is shown without following rename or copy history of | |
4153 | files. Use -f/--follow with a filename to follow history across |
|
4228 | files. Use -f/--follow with a filename to follow history across | |
4154 | renames and copies. --follow without a filename will only show |
|
4229 | renames and copies. --follow without a filename will only show | |
4155 | ancestors or descendants of the starting revision. |
|
4230 | ancestors or descendants of the starting revision. | |
4156 |
|
4231 | |||
4157 | By default this command prints revision number and changeset id, |
|
4232 | By default this command prints revision number and changeset id, | |
4158 | tags, non-trivial parents, user, date and time, and a summary for |
|
4233 | tags, non-trivial parents, user, date and time, and a summary for | |
4159 | each commit. When the -v/--verbose switch is used, the list of |
|
4234 | each commit. When the -v/--verbose switch is used, the list of | |
4160 | changed files and full commit message are shown. |
|
4235 | changed files and full commit message are shown. | |
4161 |
|
4236 | |||
4162 | With --graph the revisions are shown as an ASCII art DAG with the most |
|
4237 | With --graph the revisions are shown as an ASCII art DAG with the most | |
4163 | recent changeset at the top. |
|
4238 | recent changeset at the top. | |
4164 | 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete, |
|
4239 | 'o' is a changeset, '@' is a working directory parent, 'x' is obsolete, | |
4165 | and '+' represents a fork where the changeset from the lines below is a |
|
4240 | and '+' represents a fork where the changeset from the lines below is a | |
4166 | parent of the 'o' merge on the same line. |
|
4241 | parent of the 'o' merge on the same line. | |
4167 |
|
4242 | |||
4168 | .. note:: |
|
4243 | .. note:: | |
4169 |
|
4244 | |||
4170 | log -p/--patch may generate unexpected diff output for merge |
|
4245 | log -p/--patch may generate unexpected diff output for merge | |
4171 | changesets, as it will only compare the merge changeset against |
|
4246 | changesets, as it will only compare the merge changeset against | |
4172 | its first parent. Also, only files different from BOTH parents |
|
4247 | its first parent. Also, only files different from BOTH parents | |
4173 | will appear in files:. |
|
4248 | will appear in files:. | |
4174 |
|
4249 | |||
4175 | .. note:: |
|
4250 | .. note:: | |
4176 |
|
4251 | |||
4177 | for performance reasons, log FILE may omit duplicate changes |
|
4252 | for performance reasons, log FILE may omit duplicate changes | |
4178 | made on branches and will not show deletions. To see all |
|
4253 | made on branches and will not show deletions. To see all | |
4179 | changes including duplicates and deletions, use the --removed |
|
4254 | changes including duplicates and deletions, use the --removed | |
4180 | switch. |
|
4255 | switch. | |
4181 |
|
4256 | |||
4182 | .. container:: verbose |
|
4257 | .. container:: verbose | |
4183 |
|
4258 | |||
4184 | Some examples: |
|
4259 | Some examples: | |
4185 |
|
4260 | |||
4186 | - changesets with full descriptions and file lists:: |
|
4261 | - changesets with full descriptions and file lists:: | |
4187 |
|
4262 | |||
4188 | hg log -v |
|
4263 | hg log -v | |
4189 |
|
4264 | |||
4190 | - changesets ancestral to the working directory:: |
|
4265 | - changesets ancestral to the working directory:: | |
4191 |
|
4266 | |||
4192 | hg log -f |
|
4267 | hg log -f | |
4193 |
|
4268 | |||
4194 | - last 10 commits on the current branch:: |
|
4269 | - last 10 commits on the current branch:: | |
4195 |
|
4270 | |||
4196 | hg log -l 10 -b . |
|
4271 | hg log -l 10 -b . | |
4197 |
|
4272 | |||
4198 | - changesets showing all modifications of a file, including removals:: |
|
4273 | - changesets showing all modifications of a file, including removals:: | |
4199 |
|
4274 | |||
4200 | hg log --removed file.c |
|
4275 | hg log --removed file.c | |
4201 |
|
4276 | |||
4202 | - all changesets that touch a directory, with diffs, excluding merges:: |
|
4277 | - all changesets that touch a directory, with diffs, excluding merges:: | |
4203 |
|
4278 | |||
4204 | hg log -Mp lib/ |
|
4279 | hg log -Mp lib/ | |
4205 |
|
4280 | |||
4206 | - all revision numbers that match a keyword:: |
|
4281 | - all revision numbers that match a keyword:: | |
4207 |
|
4282 | |||
4208 | hg log -k bug --template "{rev}\\n" |
|
4283 | hg log -k bug --template "{rev}\\n" | |
4209 |
|
4284 | |||
4210 | - list available log templates:: |
|
4285 | - list available log templates:: | |
4211 |
|
4286 | |||
4212 | hg log -T list |
|
4287 | hg log -T list | |
4213 |
|
4288 | |||
4214 | - check if a given changeset is included is a tagged release:: |
|
4289 | - check if a given changeset is included is a tagged release:: | |
4215 |
|
4290 | |||
4216 | hg log -r "a21ccf and ancestor(1.9)" |
|
4291 | hg log -r "a21ccf and ancestor(1.9)" | |
4217 |
|
4292 | |||
4218 | - find all changesets by some user in a date range:: |
|
4293 | - find all changesets by some user in a date range:: | |
4219 |
|
4294 | |||
4220 | hg log -k alice -d "may 2008 to jul 2008" |
|
4295 | hg log -k alice -d "may 2008 to jul 2008" | |
4221 |
|
4296 | |||
4222 | - summary of all changesets after the last tag:: |
|
4297 | - summary of all changesets after the last tag:: | |
4223 |
|
4298 | |||
4224 | hg log -r "last(tagged())::" --template "{desc|firstline}\\n" |
|
4299 | hg log -r "last(tagged())::" --template "{desc|firstline}\\n" | |
4225 |
|
4300 | |||
4226 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
4301 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
4227 |
|
4302 | |||
4228 | See :hg:`help revisions` and :hg:`help revsets` for more about |
|
4303 | See :hg:`help revisions` and :hg:`help revsets` for more about | |
4229 | specifying revisions. |
|
4304 | specifying revisions. | |
4230 |
|
4305 | |||
4231 | See :hg:`help templates` for more about pre-packaged styles and |
|
4306 | See :hg:`help templates` for more about pre-packaged styles and | |
4232 | specifying custom templates. |
|
4307 | specifying custom templates. | |
4233 |
|
4308 | |||
4234 | Returns 0 on success. |
|
4309 | Returns 0 on success. | |
4235 | """ |
|
4310 | """ | |
4236 | if opts.get('graph'): |
|
4311 | if opts.get('graph'): | |
4237 | return cmdutil.graphlog(ui, repo, *pats, **opts) |
|
4312 | return cmdutil.graphlog(ui, repo, *pats, **opts) | |
4238 |
|
4313 | |||
4239 | revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts) |
|
4314 | revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts) | |
4240 | limit = cmdutil.loglimit(opts) |
|
4315 | limit = cmdutil.loglimit(opts) | |
4241 | count = 0 |
|
4316 | count = 0 | |
4242 |
|
4317 | |||
4243 | getrenamed = None |
|
4318 | getrenamed = None | |
4244 | if opts.get('copies'): |
|
4319 | if opts.get('copies'): | |
4245 | endrev = None |
|
4320 | endrev = None | |
4246 | if opts.get('rev'): |
|
4321 | if opts.get('rev'): | |
4247 | endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 |
|
4322 | endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1 | |
4248 | getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) |
|
4323 | getrenamed = templatekw.getrenamedfn(repo, endrev=endrev) | |
4249 |
|
4324 | |||
4250 | displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) |
|
4325 | displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) | |
4251 | for rev in revs: |
|
4326 | for rev in revs: | |
4252 | if count == limit: |
|
4327 | if count == limit: | |
4253 | break |
|
4328 | break | |
4254 | ctx = repo[rev] |
|
4329 | ctx = repo[rev] | |
4255 | copies = None |
|
4330 | copies = None | |
4256 | if getrenamed is not None and rev: |
|
4331 | if getrenamed is not None and rev: | |
4257 | copies = [] |
|
4332 | copies = [] | |
4258 | for fn in ctx.files(): |
|
4333 | for fn in ctx.files(): | |
4259 | rename = getrenamed(fn, rev) |
|
4334 | rename = getrenamed(fn, rev) | |
4260 | if rename: |
|
4335 | if rename: | |
4261 | copies.append((fn, rename[0])) |
|
4336 | copies.append((fn, rename[0])) | |
4262 | revmatchfn = filematcher and filematcher(ctx.rev()) or None |
|
4337 | revmatchfn = filematcher and filematcher(ctx.rev()) or None | |
4263 | displayer.show(ctx, copies=copies, matchfn=revmatchfn) |
|
4338 | displayer.show(ctx, copies=copies, matchfn=revmatchfn) | |
4264 | if displayer.flush(rev): |
|
4339 | if displayer.flush(rev): | |
4265 | count += 1 |
|
4340 | count += 1 | |
4266 |
|
4341 | |||
4267 | displayer.close() |
|
4342 | displayer.close() | |
4268 |
|
4343 | |||
4269 | @command('manifest', |
|
4344 | @command('manifest', | |
4270 | [('r', 'rev', '', _('revision to display'), _('REV')), |
|
4345 | [('r', 'rev', '', _('revision to display'), _('REV')), | |
4271 | ('', 'all', False, _("list files from all revisions"))], |
|
4346 | ('', 'all', False, _("list files from all revisions"))], | |
4272 | _('[-r REV]')) |
|
4347 | _('[-r REV]')) | |
4273 | def manifest(ui, repo, node=None, rev=None, **opts): |
|
4348 | def manifest(ui, repo, node=None, rev=None, **opts): | |
4274 | """output the current or given revision of the project manifest |
|
4349 | """output the current or given revision of the project manifest | |
4275 |
|
4350 | |||
4276 | Print a list of version controlled files for the given revision. |
|
4351 | Print a list of version controlled files for the given revision. | |
4277 | If no revision is given, the first parent of the working directory |
|
4352 | If no revision is given, the first parent of the working directory | |
4278 | is used, or the null revision if no revision is checked out. |
|
4353 | is used, or the null revision if no revision is checked out. | |
4279 |
|
4354 | |||
4280 | With -v, print file permissions, symlink and executable bits. |
|
4355 | With -v, print file permissions, symlink and executable bits. | |
4281 | With --debug, print file revision hashes. |
|
4356 | With --debug, print file revision hashes. | |
4282 |
|
4357 | |||
4283 | If option --all is specified, the list of all files from all revisions |
|
4358 | If option --all is specified, the list of all files from all revisions | |
4284 | is printed. This includes deleted and renamed files. |
|
4359 | is printed. This includes deleted and renamed files. | |
4285 |
|
4360 | |||
4286 | Returns 0 on success. |
|
4361 | Returns 0 on success. | |
4287 | """ |
|
4362 | """ | |
4288 |
|
4363 | |||
4289 | fm = ui.formatter('manifest', opts) |
|
4364 | fm = ui.formatter('manifest', opts) | |
4290 |
|
4365 | |||
4291 | if opts.get('all'): |
|
4366 | if opts.get('all'): | |
4292 | if rev or node: |
|
4367 | if rev or node: | |
4293 | raise util.Abort(_("can't specify a revision with --all")) |
|
4368 | raise util.Abort(_("can't specify a revision with --all")) | |
4294 |
|
4369 | |||
4295 | res = [] |
|
4370 | res = [] | |
4296 | prefix = "data/" |
|
4371 | prefix = "data/" | |
4297 | suffix = ".i" |
|
4372 | suffix = ".i" | |
4298 | plen = len(prefix) |
|
4373 | plen = len(prefix) | |
4299 | slen = len(suffix) |
|
4374 | slen = len(suffix) | |
4300 | lock = repo.lock() |
|
4375 | lock = repo.lock() | |
4301 | try: |
|
4376 | try: | |
4302 | for fn, b, size in repo.store.datafiles(): |
|
4377 | for fn, b, size in repo.store.datafiles(): | |
4303 | if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix: |
|
4378 | if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix: | |
4304 | res.append(fn[plen:-slen]) |
|
4379 | res.append(fn[plen:-slen]) | |
4305 | finally: |
|
4380 | finally: | |
4306 | lock.release() |
|
4381 | lock.release() | |
4307 | for f in res: |
|
4382 | for f in res: | |
4308 | fm.startitem() |
|
4383 | fm.startitem() | |
4309 | fm.write("path", '%s\n', f) |
|
4384 | fm.write("path", '%s\n', f) | |
4310 | fm.end() |
|
4385 | fm.end() | |
4311 | return |
|
4386 | return | |
4312 |
|
4387 | |||
4313 | if rev and node: |
|
4388 | if rev and node: | |
4314 | raise util.Abort(_("please specify just one revision")) |
|
4389 | raise util.Abort(_("please specify just one revision")) | |
4315 |
|
4390 | |||
4316 | if not node: |
|
4391 | if not node: | |
4317 | node = rev |
|
4392 | node = rev | |
4318 |
|
4393 | |||
4319 | char = {'l': '@', 'x': '*', '': ''} |
|
4394 | char = {'l': '@', 'x': '*', '': ''} | |
4320 | mode = {'l': '644', 'x': '755', '': '644'} |
|
4395 | mode = {'l': '644', 'x': '755', '': '644'} | |
4321 | ctx = scmutil.revsingle(repo, node) |
|
4396 | ctx = scmutil.revsingle(repo, node) | |
4322 | mf = ctx.manifest() |
|
4397 | mf = ctx.manifest() | |
4323 | for f in ctx: |
|
4398 | for f in ctx: | |
4324 | fm.startitem() |
|
4399 | fm.startitem() | |
4325 | fl = ctx[f].flags() |
|
4400 | fl = ctx[f].flags() | |
4326 | fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f])) |
|
4401 | fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f])) | |
4327 | fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl]) |
|
4402 | fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl]) | |
4328 | fm.write('path', '%s\n', f) |
|
4403 | fm.write('path', '%s\n', f) | |
4329 | fm.end() |
|
4404 | fm.end() | |
4330 |
|
4405 | |||
4331 | @command('^merge', |
|
4406 | @command('^merge', | |
4332 | [('f', 'force', None, |
|
4407 | [('f', 'force', None, | |
4333 | _('force a merge including outstanding changes (DEPRECATED)')), |
|
4408 | _('force a merge including outstanding changes (DEPRECATED)')), | |
4334 | ('r', 'rev', '', _('revision to merge'), _('REV')), |
|
4409 | ('r', 'rev', '', _('revision to merge'), _('REV')), | |
4335 | ('P', 'preview', None, |
|
4410 | ('P', 'preview', None, | |
4336 | _('review revisions to merge (no merge is performed)')) |
|
4411 | _('review revisions to merge (no merge is performed)')) | |
4337 | ] + mergetoolopts, |
|
4412 | ] + mergetoolopts, | |
4338 | _('[-P] [-f] [[-r] REV]')) |
|
4413 | _('[-P] [-f] [[-r] REV]')) | |
4339 | def merge(ui, repo, node=None, **opts): |
|
4414 | def merge(ui, repo, node=None, **opts): | |
4340 | """merge working directory with another revision |
|
4415 | """merge working directory with another revision | |
4341 |
|
4416 | |||
4342 | The current working directory is updated with all changes made in |
|
4417 | The current working directory is updated with all changes made in | |
4343 | the requested revision since the last common predecessor revision. |
|
4418 | the requested revision since the last common predecessor revision. | |
4344 |
|
4419 | |||
4345 | Files that changed between either parent are marked as changed for |
|
4420 | Files that changed between either parent are marked as changed for | |
4346 | the next commit and a commit must be performed before any further |
|
4421 | the next commit and a commit must be performed before any further | |
4347 | updates to the repository are allowed. The next commit will have |
|
4422 | updates to the repository are allowed. The next commit will have | |
4348 | two parents. |
|
4423 | two parents. | |
4349 |
|
4424 | |||
4350 | ``--tool`` can be used to specify the merge tool used for file |
|
4425 | ``--tool`` can be used to specify the merge tool used for file | |
4351 | merges. It overrides the HGMERGE environment variable and your |
|
4426 | merges. It overrides the HGMERGE environment variable and your | |
4352 | configuration files. See :hg:`help merge-tools` for options. |
|
4427 | configuration files. See :hg:`help merge-tools` for options. | |
4353 |
|
4428 | |||
4354 | If no revision is specified, the working directory's parent is a |
|
4429 | If no revision is specified, the working directory's parent is a | |
4355 | head revision, and the current branch contains exactly one other |
|
4430 | head revision, and the current branch contains exactly one other | |
4356 | head, the other head is merged with by default. Otherwise, an |
|
4431 | head, the other head is merged with by default. Otherwise, an | |
4357 | explicit revision with which to merge with must be provided. |
|
4432 | explicit revision with which to merge with must be provided. | |
4358 |
|
4433 | |||
4359 | :hg:`resolve` must be used to resolve unresolved files. |
|
4434 | :hg:`resolve` must be used to resolve unresolved files. | |
4360 |
|
4435 | |||
4361 | To undo an uncommitted merge, use :hg:`update --clean .` which |
|
4436 | To undo an uncommitted merge, use :hg:`update --clean .` which | |
4362 | will check out a clean copy of the original merge parent, losing |
|
4437 | will check out a clean copy of the original merge parent, losing | |
4363 | all changes. |
|
4438 | all changes. | |
4364 |
|
4439 | |||
4365 | Returns 0 on success, 1 if there are unresolved files. |
|
4440 | Returns 0 on success, 1 if there are unresolved files. | |
4366 | """ |
|
4441 | """ | |
4367 |
|
4442 | |||
4368 | if opts.get('rev') and node: |
|
4443 | if opts.get('rev') and node: | |
4369 | raise util.Abort(_("please specify just one revision")) |
|
4444 | raise util.Abort(_("please specify just one revision")) | |
4370 | if not node: |
|
4445 | if not node: | |
4371 | node = opts.get('rev') |
|
4446 | node = opts.get('rev') | |
4372 |
|
4447 | |||
4373 | if node: |
|
4448 | if node: | |
4374 | node = scmutil.revsingle(repo, node).node() |
|
4449 | node = scmutil.revsingle(repo, node).node() | |
4375 |
|
4450 | |||
4376 | if not node and repo._bookmarkcurrent: |
|
4451 | if not node and repo._bookmarkcurrent: | |
4377 | bmheads = repo.bookmarkheads(repo._bookmarkcurrent) |
|
4452 | bmheads = repo.bookmarkheads(repo._bookmarkcurrent) | |
4378 | curhead = repo[repo._bookmarkcurrent].node() |
|
4453 | curhead = repo[repo._bookmarkcurrent].node() | |
4379 | if len(bmheads) == 2: |
|
4454 | if len(bmheads) == 2: | |
4380 | if curhead == bmheads[0]: |
|
4455 | if curhead == bmheads[0]: | |
4381 | node = bmheads[1] |
|
4456 | node = bmheads[1] | |
4382 | else: |
|
4457 | else: | |
4383 | node = bmheads[0] |
|
4458 | node = bmheads[0] | |
4384 | elif len(bmheads) > 2: |
|
4459 | elif len(bmheads) > 2: | |
4385 | raise util.Abort(_("multiple matching bookmarks to merge - " |
|
4460 | raise util.Abort(_("multiple matching bookmarks to merge - " | |
4386 | "please merge with an explicit rev or bookmark"), |
|
4461 | "please merge with an explicit rev or bookmark"), | |
4387 | hint=_("run 'hg heads' to see all heads")) |
|
4462 | hint=_("run 'hg heads' to see all heads")) | |
4388 | elif len(bmheads) <= 1: |
|
4463 | elif len(bmheads) <= 1: | |
4389 | raise util.Abort(_("no matching bookmark to merge - " |
|
4464 | raise util.Abort(_("no matching bookmark to merge - " | |
4390 | "please merge with an explicit rev or bookmark"), |
|
4465 | "please merge with an explicit rev or bookmark"), | |
4391 | hint=_("run 'hg heads' to see all heads")) |
|
4466 | hint=_("run 'hg heads' to see all heads")) | |
4392 |
|
4467 | |||
4393 | if not node and not repo._bookmarkcurrent: |
|
4468 | if not node and not repo._bookmarkcurrent: | |
4394 | branch = repo[None].branch() |
|
4469 | branch = repo[None].branch() | |
4395 | bheads = repo.branchheads(branch) |
|
4470 | bheads = repo.branchheads(branch) | |
4396 | nbhs = [bh for bh in bheads if not repo[bh].bookmarks()] |
|
4471 | nbhs = [bh for bh in bheads if not repo[bh].bookmarks()] | |
4397 |
|
4472 | |||
4398 | if len(nbhs) > 2: |
|
4473 | if len(nbhs) > 2: | |
4399 | raise util.Abort(_("branch '%s' has %d heads - " |
|
4474 | raise util.Abort(_("branch '%s' has %d heads - " | |
4400 | "please merge with an explicit rev") |
|
4475 | "please merge with an explicit rev") | |
4401 | % (branch, len(bheads)), |
|
4476 | % (branch, len(bheads)), | |
4402 | hint=_("run 'hg heads .' to see heads")) |
|
4477 | hint=_("run 'hg heads .' to see heads")) | |
4403 |
|
4478 | |||
4404 | parent = repo.dirstate.p1() |
|
4479 | parent = repo.dirstate.p1() | |
4405 | if len(nbhs) <= 1: |
|
4480 | if len(nbhs) <= 1: | |
4406 | if len(bheads) > 1: |
|
4481 | if len(bheads) > 1: | |
4407 | raise util.Abort(_("heads are bookmarked - " |
|
4482 | raise util.Abort(_("heads are bookmarked - " | |
4408 | "please merge with an explicit rev"), |
|
4483 | "please merge with an explicit rev"), | |
4409 | hint=_("run 'hg heads' to see all heads")) |
|
4484 | hint=_("run 'hg heads' to see all heads")) | |
4410 | if len(repo.heads()) > 1: |
|
4485 | if len(repo.heads()) > 1: | |
4411 | raise util.Abort(_("branch '%s' has one head - " |
|
4486 | raise util.Abort(_("branch '%s' has one head - " | |
4412 | "please merge with an explicit rev") |
|
4487 | "please merge with an explicit rev") | |
4413 | % branch, |
|
4488 | % branch, | |
4414 | hint=_("run 'hg heads' to see all heads")) |
|
4489 | hint=_("run 'hg heads' to see all heads")) | |
4415 | msg, hint = _('nothing to merge'), None |
|
4490 | msg, hint = _('nothing to merge'), None | |
4416 | if parent != repo.lookup(branch): |
|
4491 | if parent != repo.lookup(branch): | |
4417 | hint = _("use 'hg update' instead") |
|
4492 | hint = _("use 'hg update' instead") | |
4418 | raise util.Abort(msg, hint=hint) |
|
4493 | raise util.Abort(msg, hint=hint) | |
4419 |
|
4494 | |||
4420 | if parent not in bheads: |
|
4495 | if parent not in bheads: | |
4421 | raise util.Abort(_('working directory not at a head revision'), |
|
4496 | raise util.Abort(_('working directory not at a head revision'), | |
4422 | hint=_("use 'hg update' or merge with an " |
|
4497 | hint=_("use 'hg update' or merge with an " | |
4423 | "explicit revision")) |
|
4498 | "explicit revision")) | |
4424 | if parent == nbhs[0]: |
|
4499 | if parent == nbhs[0]: | |
4425 | node = nbhs[-1] |
|
4500 | node = nbhs[-1] | |
4426 | else: |
|
4501 | else: | |
4427 | node = nbhs[0] |
|
4502 | node = nbhs[0] | |
4428 |
|
4503 | |||
4429 | if opts.get('preview'): |
|
4504 | if opts.get('preview'): | |
4430 | # find nodes that are ancestors of p2 but not of p1 |
|
4505 | # find nodes that are ancestors of p2 but not of p1 | |
4431 | p1 = repo.lookup('.') |
|
4506 | p1 = repo.lookup('.') | |
4432 | p2 = repo.lookup(node) |
|
4507 | p2 = repo.lookup(node) | |
4433 | nodes = repo.changelog.findmissing(common=[p1], heads=[p2]) |
|
4508 | nodes = repo.changelog.findmissing(common=[p1], heads=[p2]) | |
4434 |
|
4509 | |||
4435 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
4510 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
4436 | for node in nodes: |
|
4511 | for node in nodes: | |
4437 | displayer.show(repo[node]) |
|
4512 | displayer.show(repo[node]) | |
4438 | displayer.close() |
|
4513 | displayer.close() | |
4439 | return 0 |
|
4514 | return 0 | |
4440 |
|
4515 | |||
4441 | try: |
|
4516 | try: | |
4442 | # ui.forcemerge is an internal variable, do not document |
|
4517 | # ui.forcemerge is an internal variable, do not document | |
4443 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge') |
|
4518 | repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge') | |
4444 | return hg.merge(repo, node, force=opts.get('force')) |
|
4519 | return hg.merge(repo, node, force=opts.get('force')) | |
4445 | finally: |
|
4520 | finally: | |
4446 | ui.setconfig('ui', 'forcemerge', '', 'merge') |
|
4521 | ui.setconfig('ui', 'forcemerge', '', 'merge') | |
4447 |
|
4522 | |||
4448 | @command('outgoing|out', |
|
4523 | @command('outgoing|out', | |
4449 | [('f', 'force', None, _('run even when the destination is unrelated')), |
|
4524 | [('f', 'force', None, _('run even when the destination is unrelated')), | |
4450 | ('r', 'rev', [], |
|
4525 | ('r', 'rev', [], | |
4451 | _('a changeset intended to be included in the destination'), _('REV')), |
|
4526 | _('a changeset intended to be included in the destination'), _('REV')), | |
4452 | ('n', 'newest-first', None, _('show newest record first')), |
|
4527 | ('n', 'newest-first', None, _('show newest record first')), | |
4453 | ('B', 'bookmarks', False, _('compare bookmarks')), |
|
4528 | ('B', 'bookmarks', False, _('compare bookmarks')), | |
4454 | ('b', 'branch', [], _('a specific branch you would like to push'), |
|
4529 | ('b', 'branch', [], _('a specific branch you would like to push'), | |
4455 | _('BRANCH')), |
|
4530 | _('BRANCH')), | |
4456 | ] + logopts + remoteopts + subrepoopts, |
|
4531 | ] + logopts + remoteopts + subrepoopts, | |
4457 | _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')) |
|
4532 | _('[-M] [-p] [-n] [-f] [-r REV]... [DEST]')) | |
4458 | def outgoing(ui, repo, dest=None, **opts): |
|
4533 | def outgoing(ui, repo, dest=None, **opts): | |
4459 | """show changesets not found in the destination |
|
4534 | """show changesets not found in the destination | |
4460 |
|
4535 | |||
4461 | Show changesets not found in the specified destination repository |
|
4536 | Show changesets not found in the specified destination repository | |
4462 | or the default push location. These are the changesets that would |
|
4537 | or the default push location. These are the changesets that would | |
4463 | be pushed if a push was requested. |
|
4538 | be pushed if a push was requested. | |
4464 |
|
4539 | |||
4465 | See pull for details of valid destination formats. |
|
4540 | See pull for details of valid destination formats. | |
4466 |
|
4541 | |||
4467 | Returns 0 if there are outgoing changes, 1 otherwise. |
|
4542 | Returns 0 if there are outgoing changes, 1 otherwise. | |
4468 | """ |
|
4543 | """ | |
4469 | if opts.get('graph'): |
|
4544 | if opts.get('graph'): | |
4470 | cmdutil.checkunsupportedgraphflags([], opts) |
|
4545 | cmdutil.checkunsupportedgraphflags([], opts) | |
4471 | o, other = hg._outgoing(ui, repo, dest, opts) |
|
4546 | o, other = hg._outgoing(ui, repo, dest, opts) | |
4472 | if not o: |
|
4547 | if not o: | |
4473 | cmdutil.outgoinghooks(ui, repo, other, opts, o) |
|
4548 | cmdutil.outgoinghooks(ui, repo, other, opts, o) | |
4474 | return |
|
4549 | return | |
4475 |
|
4550 | |||
4476 | revdag = cmdutil.graphrevs(repo, o, opts) |
|
4551 | revdag = cmdutil.graphrevs(repo, o, opts) | |
4477 | displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) |
|
4552 | displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True) | |
4478 | showparents = [ctx.node() for ctx in repo[None].parents()] |
|
4553 | showparents = [ctx.node() for ctx in repo[None].parents()] | |
4479 | cmdutil.displaygraph(ui, revdag, displayer, showparents, |
|
4554 | cmdutil.displaygraph(ui, revdag, displayer, showparents, | |
4480 | graphmod.asciiedges) |
|
4555 | graphmod.asciiedges) | |
4481 | cmdutil.outgoinghooks(ui, repo, other, opts, o) |
|
4556 | cmdutil.outgoinghooks(ui, repo, other, opts, o) | |
4482 | return 0 |
|
4557 | return 0 | |
4483 |
|
4558 | |||
4484 | if opts.get('bookmarks'): |
|
4559 | if opts.get('bookmarks'): | |
4485 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
4560 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
4486 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
4561 | dest, branches = hg.parseurl(dest, opts.get('branch')) | |
4487 | other = hg.peer(repo, opts, dest) |
|
4562 | other = hg.peer(repo, opts, dest) | |
4488 | if 'bookmarks' not in other.listkeys('namespaces'): |
|
4563 | if 'bookmarks' not in other.listkeys('namespaces'): | |
4489 | ui.warn(_("remote doesn't support bookmarks\n")) |
|
4564 | ui.warn(_("remote doesn't support bookmarks\n")) | |
4490 | return 0 |
|
4565 | return 0 | |
4491 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) |
|
4566 | ui.status(_('comparing with %s\n') % util.hidepassword(dest)) | |
4492 | return bookmarks.diff(ui, other, repo) |
|
4567 | return bookmarks.diff(ui, other, repo) | |
4493 |
|
4568 | |||
4494 | repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default') |
|
4569 | repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default') | |
4495 | try: |
|
4570 | try: | |
4496 | return hg.outgoing(ui, repo, dest, opts) |
|
4571 | return hg.outgoing(ui, repo, dest, opts) | |
4497 | finally: |
|
4572 | finally: | |
4498 | del repo._subtoppath |
|
4573 | del repo._subtoppath | |
4499 |
|
4574 | |||
4500 | @command('parents', |
|
4575 | @command('parents', | |
4501 | [('r', 'rev', '', _('show parents of the specified revision'), _('REV')), |
|
4576 | [('r', 'rev', '', _('show parents of the specified revision'), _('REV')), | |
4502 | ] + templateopts, |
|
4577 | ] + templateopts, | |
4503 | _('[-r REV] [FILE]'), |
|
4578 | _('[-r REV] [FILE]'), | |
4504 | inferrepo=True) |
|
4579 | inferrepo=True) | |
4505 | def parents(ui, repo, file_=None, **opts): |
|
4580 | def parents(ui, repo, file_=None, **opts): | |
4506 | """show the parents of the working directory or revision |
|
4581 | """show the parents of the working directory or revision | |
4507 |
|
4582 | |||
4508 | Print the working directory's parent revisions. If a revision is |
|
4583 | Print the working directory's parent revisions. If a revision is | |
4509 | given via -r/--rev, the parent of that revision will be printed. |
|
4584 | given via -r/--rev, the parent of that revision will be printed. | |
4510 | If a file argument is given, the revision in which the file was |
|
4585 | If a file argument is given, the revision in which the file was | |
4511 | last changed (before the working directory revision or the |
|
4586 | last changed (before the working directory revision or the | |
4512 | argument to --rev if given) is printed. |
|
4587 | argument to --rev if given) is printed. | |
4513 |
|
4588 | |||
4514 | Returns 0 on success. |
|
4589 | Returns 0 on success. | |
4515 | """ |
|
4590 | """ | |
4516 |
|
4591 | |||
4517 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) |
|
4592 | ctx = scmutil.revsingle(repo, opts.get('rev'), None) | |
4518 |
|
4593 | |||
4519 | if file_: |
|
4594 | if file_: | |
4520 | m = scmutil.match(ctx, (file_,), opts) |
|
4595 | m = scmutil.match(ctx, (file_,), opts) | |
4521 | if m.anypats() or len(m.files()) != 1: |
|
4596 | if m.anypats() or len(m.files()) != 1: | |
4522 | raise util.Abort(_('can only specify an explicit filename')) |
|
4597 | raise util.Abort(_('can only specify an explicit filename')) | |
4523 | file_ = m.files()[0] |
|
4598 | file_ = m.files()[0] | |
4524 | filenodes = [] |
|
4599 | filenodes = [] | |
4525 | for cp in ctx.parents(): |
|
4600 | for cp in ctx.parents(): | |
4526 | if not cp: |
|
4601 | if not cp: | |
4527 | continue |
|
4602 | continue | |
4528 | try: |
|
4603 | try: | |
4529 | filenodes.append(cp.filenode(file_)) |
|
4604 | filenodes.append(cp.filenode(file_)) | |
4530 | except error.LookupError: |
|
4605 | except error.LookupError: | |
4531 | pass |
|
4606 | pass | |
4532 | if not filenodes: |
|
4607 | if not filenodes: | |
4533 | raise util.Abort(_("'%s' not found in manifest!") % file_) |
|
4608 | raise util.Abort(_("'%s' not found in manifest!") % file_) | |
4534 | p = [] |
|
4609 | p = [] | |
4535 | for fn in filenodes: |
|
4610 | for fn in filenodes: | |
4536 | fctx = repo.filectx(file_, fileid=fn) |
|
4611 | fctx = repo.filectx(file_, fileid=fn) | |
4537 | p.append(fctx.node()) |
|
4612 | p.append(fctx.node()) | |
4538 | else: |
|
4613 | else: | |
4539 | p = [cp.node() for cp in ctx.parents()] |
|
4614 | p = [cp.node() for cp in ctx.parents()] | |
4540 |
|
4615 | |||
4541 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
4616 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
4542 | for n in p: |
|
4617 | for n in p: | |
4543 | if n != nullid: |
|
4618 | if n != nullid: | |
4544 | displayer.show(repo[n]) |
|
4619 | displayer.show(repo[n]) | |
4545 | displayer.close() |
|
4620 | displayer.close() | |
4546 |
|
4621 | |||
4547 | @command('paths', [], _('[NAME]'), optionalrepo=True) |
|
4622 | @command('paths', [], _('[NAME]'), optionalrepo=True) | |
4548 | def paths(ui, repo, search=None): |
|
4623 | def paths(ui, repo, search=None): | |
4549 | """show aliases for remote repositories |
|
4624 | """show aliases for remote repositories | |
4550 |
|
4625 | |||
4551 | Show definition of symbolic path name NAME. If no name is given, |
|
4626 | Show definition of symbolic path name NAME. If no name is given, | |
4552 | show definition of all available names. |
|
4627 | show definition of all available names. | |
4553 |
|
4628 | |||
4554 | Option -q/--quiet suppresses all output when searching for NAME |
|
4629 | Option -q/--quiet suppresses all output when searching for NAME | |
4555 | and shows only the path names when listing all definitions. |
|
4630 | and shows only the path names when listing all definitions. | |
4556 |
|
4631 | |||
4557 | Path names are defined in the [paths] section of your |
|
4632 | Path names are defined in the [paths] section of your | |
4558 | configuration file and in ``/etc/mercurial/hgrc``. If run inside a |
|
4633 | configuration file and in ``/etc/mercurial/hgrc``. If run inside a | |
4559 | repository, ``.hg/hgrc`` is used, too. |
|
4634 | repository, ``.hg/hgrc`` is used, too. | |
4560 |
|
4635 | |||
4561 | The path names ``default`` and ``default-push`` have a special |
|
4636 | The path names ``default`` and ``default-push`` have a special | |
4562 | meaning. When performing a push or pull operation, they are used |
|
4637 | meaning. When performing a push or pull operation, they are used | |
4563 | as fallbacks if no location is specified on the command-line. |
|
4638 | as fallbacks if no location is specified on the command-line. | |
4564 | When ``default-push`` is set, it will be used for push and |
|
4639 | When ``default-push`` is set, it will be used for push and | |
4565 | ``default`` will be used for pull; otherwise ``default`` is used |
|
4640 | ``default`` will be used for pull; otherwise ``default`` is used | |
4566 | as the fallback for both. When cloning a repository, the clone |
|
4641 | as the fallback for both. When cloning a repository, the clone | |
4567 | source is written as ``default`` in ``.hg/hgrc``. Note that |
|
4642 | source is written as ``default`` in ``.hg/hgrc``. Note that | |
4568 | ``default`` and ``default-push`` apply to all inbound (e.g. |
|
4643 | ``default`` and ``default-push`` apply to all inbound (e.g. | |
4569 | :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email` and |
|
4644 | :hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email` and | |
4570 | :hg:`bundle`) operations. |
|
4645 | :hg:`bundle`) operations. | |
4571 |
|
4646 | |||
4572 | See :hg:`help urls` for more information. |
|
4647 | See :hg:`help urls` for more information. | |
4573 |
|
4648 | |||
4574 | Returns 0 on success. |
|
4649 | Returns 0 on success. | |
4575 | """ |
|
4650 | """ | |
4576 | if search: |
|
4651 | if search: | |
4577 | for name, path in ui.configitems("paths"): |
|
4652 | for name, path in ui.configitems("paths"): | |
4578 | if name == search: |
|
4653 | if name == search: | |
4579 | ui.status("%s\n" % util.hidepassword(path)) |
|
4654 | ui.status("%s\n" % util.hidepassword(path)) | |
4580 | return |
|
4655 | return | |
4581 | if not ui.quiet: |
|
4656 | if not ui.quiet: | |
4582 | ui.warn(_("not found!\n")) |
|
4657 | ui.warn(_("not found!\n")) | |
4583 | return 1 |
|
4658 | return 1 | |
4584 | else: |
|
4659 | else: | |
4585 | for name, path in ui.configitems("paths"): |
|
4660 | for name, path in ui.configitems("paths"): | |
4586 | if ui.quiet: |
|
4661 | if ui.quiet: | |
4587 | ui.write("%s\n" % name) |
|
4662 | ui.write("%s\n" % name) | |
4588 | else: |
|
4663 | else: | |
4589 | ui.write("%s = %s\n" % (name, util.hidepassword(path))) |
|
4664 | ui.write("%s = %s\n" % (name, util.hidepassword(path))) | |
4590 |
|
4665 | |||
4591 | @command('phase', |
|
4666 | @command('phase', | |
4592 | [('p', 'public', False, _('set changeset phase to public')), |
|
4667 | [('p', 'public', False, _('set changeset phase to public')), | |
4593 | ('d', 'draft', False, _('set changeset phase to draft')), |
|
4668 | ('d', 'draft', False, _('set changeset phase to draft')), | |
4594 | ('s', 'secret', False, _('set changeset phase to secret')), |
|
4669 | ('s', 'secret', False, _('set changeset phase to secret')), | |
4595 | ('f', 'force', False, _('allow to move boundary backward')), |
|
4670 | ('f', 'force', False, _('allow to move boundary backward')), | |
4596 | ('r', 'rev', [], _('target revision'), _('REV')), |
|
4671 | ('r', 'rev', [], _('target revision'), _('REV')), | |
4597 | ], |
|
4672 | ], | |
4598 | _('[-p|-d|-s] [-f] [-r] REV...')) |
|
4673 | _('[-p|-d|-s] [-f] [-r] REV...')) | |
4599 | def phase(ui, repo, *revs, **opts): |
|
4674 | def phase(ui, repo, *revs, **opts): | |
4600 | """set or show the current phase name |
|
4675 | """set or show the current phase name | |
4601 |
|
4676 | |||
4602 | With no argument, show the phase name of specified revisions. |
|
4677 | With no argument, show the phase name of specified revisions. | |
4603 |
|
4678 | |||
4604 | With one of -p/--public, -d/--draft or -s/--secret, change the |
|
4679 | With one of -p/--public, -d/--draft or -s/--secret, change the | |
4605 | phase value of the specified revisions. |
|
4680 | phase value of the specified revisions. | |
4606 |
|
4681 | |||
4607 | Unless -f/--force is specified, :hg:`phase` won't move changeset from a |
|
4682 | Unless -f/--force is specified, :hg:`phase` won't move changeset from a | |
4608 | lower phase to an higher phase. Phases are ordered as follows:: |
|
4683 | lower phase to an higher phase. Phases are ordered as follows:: | |
4609 |
|
4684 | |||
4610 | public < draft < secret |
|
4685 | public < draft < secret | |
4611 |
|
4686 | |||
4612 | Returns 0 on success, 1 if no phases were changed or some could not |
|
4687 | Returns 0 on success, 1 if no phases were changed or some could not | |
4613 | be changed. |
|
4688 | be changed. | |
4614 | """ |
|
4689 | """ | |
4615 | # search for a unique phase argument |
|
4690 | # search for a unique phase argument | |
4616 | targetphase = None |
|
4691 | targetphase = None | |
4617 | for idx, name in enumerate(phases.phasenames): |
|
4692 | for idx, name in enumerate(phases.phasenames): | |
4618 | if opts[name]: |
|
4693 | if opts[name]: | |
4619 | if targetphase is not None: |
|
4694 | if targetphase is not None: | |
4620 | raise util.Abort(_('only one phase can be specified')) |
|
4695 | raise util.Abort(_('only one phase can be specified')) | |
4621 | targetphase = idx |
|
4696 | targetphase = idx | |
4622 |
|
4697 | |||
4623 | # look for specified revision |
|
4698 | # look for specified revision | |
4624 | revs = list(revs) |
|
4699 | revs = list(revs) | |
4625 | revs.extend(opts['rev']) |
|
4700 | revs.extend(opts['rev']) | |
4626 | if not revs: |
|
4701 | if not revs: | |
4627 | raise util.Abort(_('no revisions specified')) |
|
4702 | raise util.Abort(_('no revisions specified')) | |
4628 |
|
4703 | |||
4629 | revs = scmutil.revrange(repo, revs) |
|
4704 | revs = scmutil.revrange(repo, revs) | |
4630 |
|
4705 | |||
4631 | lock = None |
|
4706 | lock = None | |
4632 | ret = 0 |
|
4707 | ret = 0 | |
4633 | if targetphase is None: |
|
4708 | if targetphase is None: | |
4634 | # display |
|
4709 | # display | |
4635 | for r in revs: |
|
4710 | for r in revs: | |
4636 | ctx = repo[r] |
|
4711 | ctx = repo[r] | |
4637 | ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr())) |
|
4712 | ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr())) | |
4638 | else: |
|
4713 | else: | |
4639 | tr = None |
|
4714 | tr = None | |
4640 | lock = repo.lock() |
|
4715 | lock = repo.lock() | |
4641 | try: |
|
4716 | try: | |
4642 | tr = repo.transaction("phase") |
|
4717 | tr = repo.transaction("phase") | |
4643 | # set phase |
|
4718 | # set phase | |
4644 | if not revs: |
|
4719 | if not revs: | |
4645 | raise util.Abort(_('empty revision set')) |
|
4720 | raise util.Abort(_('empty revision set')) | |
4646 | nodes = [repo[r].node() for r in revs] |
|
4721 | nodes = [repo[r].node() for r in revs] | |
4647 | olddata = repo._phasecache.getphaserevs(repo)[:] |
|
4722 | olddata = repo._phasecache.getphaserevs(repo)[:] | |
4648 | phases.advanceboundary(repo, tr, targetphase, nodes) |
|
4723 | phases.advanceboundary(repo, tr, targetphase, nodes) | |
4649 | if opts['force']: |
|
4724 | if opts['force']: | |
4650 | phases.retractboundary(repo, tr, targetphase, nodes) |
|
4725 | phases.retractboundary(repo, tr, targetphase, nodes) | |
4651 | tr.close() |
|
4726 | tr.close() | |
4652 | finally: |
|
4727 | finally: | |
4653 | if tr is not None: |
|
4728 | if tr is not None: | |
4654 | tr.release() |
|
4729 | tr.release() | |
4655 | lock.release() |
|
4730 | lock.release() | |
4656 | # moving revision from public to draft may hide them |
|
4731 | # moving revision from public to draft may hide them | |
4657 | # We have to check result on an unfiltered repository |
|
4732 | # We have to check result on an unfiltered repository | |
4658 | unfi = repo.unfiltered() |
|
4733 | unfi = repo.unfiltered() | |
4659 | newdata = repo._phasecache.getphaserevs(unfi) |
|
4734 | newdata = repo._phasecache.getphaserevs(unfi) | |
4660 | changes = sum(o != newdata[i] for i, o in enumerate(olddata)) |
|
4735 | changes = sum(o != newdata[i] for i, o in enumerate(olddata)) | |
4661 | cl = unfi.changelog |
|
4736 | cl = unfi.changelog | |
4662 | rejected = [n for n in nodes |
|
4737 | rejected = [n for n in nodes | |
4663 | if newdata[cl.rev(n)] < targetphase] |
|
4738 | if newdata[cl.rev(n)] < targetphase] | |
4664 | if rejected: |
|
4739 | if rejected: | |
4665 | ui.warn(_('cannot move %i changesets to a higher ' |
|
4740 | ui.warn(_('cannot move %i changesets to a higher ' | |
4666 | 'phase, use --force\n') % len(rejected)) |
|
4741 | 'phase, use --force\n') % len(rejected)) | |
4667 | ret = 1 |
|
4742 | ret = 1 | |
4668 | if changes: |
|
4743 | if changes: | |
4669 | msg = _('phase changed for %i changesets\n') % changes |
|
4744 | msg = _('phase changed for %i changesets\n') % changes | |
4670 | if ret: |
|
4745 | if ret: | |
4671 | ui.status(msg) |
|
4746 | ui.status(msg) | |
4672 | else: |
|
4747 | else: | |
4673 | ui.note(msg) |
|
4748 | ui.note(msg) | |
4674 | else: |
|
4749 | else: | |
4675 | ui.warn(_('no phases changed\n')) |
|
4750 | ui.warn(_('no phases changed\n')) | |
4676 | ret = 1 |
|
4751 | ret = 1 | |
4677 | return ret |
|
4752 | return ret | |
4678 |
|
4753 | |||
4679 | def postincoming(ui, repo, modheads, optupdate, checkout): |
|
4754 | def postincoming(ui, repo, modheads, optupdate, checkout): | |
4680 | if modheads == 0: |
|
4755 | if modheads == 0: | |
4681 | return |
|
4756 | return | |
4682 | if optupdate: |
|
4757 | if optupdate: | |
4683 | checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout) |
|
4758 | checkout, movemarkfrom = bookmarks.calculateupdate(ui, repo, checkout) | |
4684 | try: |
|
4759 | try: | |
4685 | ret = hg.update(repo, checkout) |
|
4760 | ret = hg.update(repo, checkout) | |
4686 | except util.Abort, inst: |
|
4761 | except util.Abort, inst: | |
4687 | ui.warn(_("not updating: %s\n") % str(inst)) |
|
4762 | ui.warn(_("not updating: %s\n") % str(inst)) | |
4688 | if inst.hint: |
|
4763 | if inst.hint: | |
4689 | ui.warn(_("(%s)\n") % inst.hint) |
|
4764 | ui.warn(_("(%s)\n") % inst.hint) | |
4690 | return 0 |
|
4765 | return 0 | |
4691 | if not ret and not checkout: |
|
4766 | if not ret and not checkout: | |
4692 | if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): |
|
4767 | if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): | |
4693 | ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) |
|
4768 | ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) | |
4694 | return ret |
|
4769 | return ret | |
4695 | if modheads > 1: |
|
4770 | if modheads > 1: | |
4696 | currentbranchheads = len(repo.branchheads()) |
|
4771 | currentbranchheads = len(repo.branchheads()) | |
4697 | if currentbranchheads == modheads: |
|
4772 | if currentbranchheads == modheads: | |
4698 | ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) |
|
4773 | ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n")) | |
4699 | elif currentbranchheads > 1: |
|
4774 | elif currentbranchheads > 1: | |
4700 | ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to " |
|
4775 | ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to " | |
4701 | "merge)\n")) |
|
4776 | "merge)\n")) | |
4702 | else: |
|
4777 | else: | |
4703 | ui.status(_("(run 'hg heads' to see heads)\n")) |
|
4778 | ui.status(_("(run 'hg heads' to see heads)\n")) | |
4704 | else: |
|
4779 | else: | |
4705 | ui.status(_("(run 'hg update' to get a working copy)\n")) |
|
4780 | ui.status(_("(run 'hg update' to get a working copy)\n")) | |
4706 |
|
4781 | |||
4707 | @command('^pull', |
|
4782 | @command('^pull', | |
4708 | [('u', 'update', None, |
|
4783 | [('u', 'update', None, | |
4709 | _('update to new branch head if changesets were pulled')), |
|
4784 | _('update to new branch head if changesets were pulled')), | |
4710 | ('f', 'force', None, _('run even when remote repository is unrelated')), |
|
4785 | ('f', 'force', None, _('run even when remote repository is unrelated')), | |
4711 | ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), |
|
4786 | ('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')), | |
4712 | ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')), |
|
4787 | ('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')), | |
4713 | ('b', 'branch', [], _('a specific branch you would like to pull'), |
|
4788 | ('b', 'branch', [], _('a specific branch you would like to pull'), | |
4714 | _('BRANCH')), |
|
4789 | _('BRANCH')), | |
4715 | ] + remoteopts, |
|
4790 | ] + remoteopts, | |
4716 | _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')) |
|
4791 | _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')) | |
4717 | def pull(ui, repo, source="default", **opts): |
|
4792 | def pull(ui, repo, source="default", **opts): | |
4718 | """pull changes from the specified source |
|
4793 | """pull changes from the specified source | |
4719 |
|
4794 | |||
4720 | Pull changes from a remote repository to a local one. |
|
4795 | Pull changes from a remote repository to a local one. | |
4721 |
|
4796 | |||
4722 | This finds all changes from the repository at the specified path |
|
4797 | This finds all changes from the repository at the specified path | |
4723 | or URL and adds them to a local repository (the current one unless |
|
4798 | or URL and adds them to a local repository (the current one unless | |
4724 | -R is specified). By default, this does not update the copy of the |
|
4799 | -R is specified). By default, this does not update the copy of the | |
4725 | project in the working directory. |
|
4800 | project in the working directory. | |
4726 |
|
4801 | |||
4727 | Use :hg:`incoming` if you want to see what would have been added |
|
4802 | Use :hg:`incoming` if you want to see what would have been added | |
4728 | by a pull at the time you issued this command. If you then decide |
|
4803 | by a pull at the time you issued this command. If you then decide | |
4729 | to add those changes to the repository, you should use :hg:`pull |
|
4804 | to add those changes to the repository, you should use :hg:`pull | |
4730 | -r X` where ``X`` is the last changeset listed by :hg:`incoming`. |
|
4805 | -r X` where ``X`` is the last changeset listed by :hg:`incoming`. | |
4731 |
|
4806 | |||
4732 | If SOURCE is omitted, the 'default' path will be used. |
|
4807 | If SOURCE is omitted, the 'default' path will be used. | |
4733 | See :hg:`help urls` for more information. |
|
4808 | See :hg:`help urls` for more information. | |
4734 |
|
4809 | |||
4735 | Returns 0 on success, 1 if an update had unresolved files. |
|
4810 | Returns 0 on success, 1 if an update had unresolved files. | |
4736 | """ |
|
4811 | """ | |
4737 | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) |
|
4812 | source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) | |
4738 | other = hg.peer(repo, opts, source) |
|
4813 | other = hg.peer(repo, opts, source) | |
4739 | try: |
|
4814 | try: | |
4740 | ui.status(_('pulling from %s\n') % util.hidepassword(source)) |
|
4815 | ui.status(_('pulling from %s\n') % util.hidepassword(source)) | |
4741 | revs, checkout = hg.addbranchrevs(repo, other, branches, |
|
4816 | revs, checkout = hg.addbranchrevs(repo, other, branches, | |
4742 | opts.get('rev')) |
|
4817 | opts.get('rev')) | |
4743 |
|
4818 | |||
4744 | remotebookmarks = other.listkeys('bookmarks') |
|
4819 | remotebookmarks = other.listkeys('bookmarks') | |
4745 |
|
4820 | |||
4746 | if opts.get('bookmark'): |
|
4821 | if opts.get('bookmark'): | |
4747 | if not revs: |
|
4822 | if not revs: | |
4748 | revs = [] |
|
4823 | revs = [] | |
4749 | for b in opts['bookmark']: |
|
4824 | for b in opts['bookmark']: | |
4750 | if b not in remotebookmarks: |
|
4825 | if b not in remotebookmarks: | |
4751 | raise util.Abort(_('remote bookmark %s not found!') % b) |
|
4826 | raise util.Abort(_('remote bookmark %s not found!') % b) | |
4752 | revs.append(remotebookmarks[b]) |
|
4827 | revs.append(remotebookmarks[b]) | |
4753 |
|
4828 | |||
4754 | if revs: |
|
4829 | if revs: | |
4755 | try: |
|
4830 | try: | |
4756 | revs = [other.lookup(rev) for rev in revs] |
|
4831 | revs = [other.lookup(rev) for rev in revs] | |
4757 | except error.CapabilityError: |
|
4832 | except error.CapabilityError: | |
4758 | err = _("other repository doesn't support revision lookup, " |
|
4833 | err = _("other repository doesn't support revision lookup, " | |
4759 | "so a rev cannot be specified.") |
|
4834 | "so a rev cannot be specified.") | |
4760 | raise util.Abort(err) |
|
4835 | raise util.Abort(err) | |
4761 |
|
4836 | |||
4762 | modheads = repo.pull(other, heads=revs, force=opts.get('force')) |
|
4837 | modheads = repo.pull(other, heads=revs, force=opts.get('force')) | |
4763 | bookmarks.updatefromremote(ui, repo, remotebookmarks, source) |
|
4838 | bookmarks.updatefromremote(ui, repo, remotebookmarks, source) | |
4764 | if checkout: |
|
4839 | if checkout: | |
4765 | checkout = str(repo.changelog.rev(other.lookup(checkout))) |
|
4840 | checkout = str(repo.changelog.rev(other.lookup(checkout))) | |
4766 | repo._subtoppath = source |
|
4841 | repo._subtoppath = source | |
4767 | try: |
|
4842 | try: | |
4768 | ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) |
|
4843 | ret = postincoming(ui, repo, modheads, opts.get('update'), checkout) | |
4769 |
|
4844 | |||
4770 | finally: |
|
4845 | finally: | |
4771 | del repo._subtoppath |
|
4846 | del repo._subtoppath | |
4772 |
|
4847 | |||
4773 | # update specified bookmarks |
|
4848 | # update specified bookmarks | |
4774 | if opts.get('bookmark'): |
|
4849 | if opts.get('bookmark'): | |
4775 | marks = repo._bookmarks |
|
4850 | marks = repo._bookmarks | |
4776 | for b in opts['bookmark']: |
|
4851 | for b in opts['bookmark']: | |
4777 | # explicit pull overrides local bookmark if any |
|
4852 | # explicit pull overrides local bookmark if any | |
4778 | ui.status(_("importing bookmark %s\n") % b) |
|
4853 | ui.status(_("importing bookmark %s\n") % b) | |
4779 | marks[b] = repo[remotebookmarks[b]].node() |
|
4854 | marks[b] = repo[remotebookmarks[b]].node() | |
4780 | marks.write() |
|
4855 | marks.write() | |
4781 | finally: |
|
4856 | finally: | |
4782 | other.close() |
|
4857 | other.close() | |
4783 | return ret |
|
4858 | return ret | |
4784 |
|
4859 | |||
4785 | @command('^push', |
|
4860 | @command('^push', | |
4786 | [('f', 'force', None, _('force push')), |
|
4861 | [('f', 'force', None, _('force push')), | |
4787 | ('r', 'rev', [], |
|
4862 | ('r', 'rev', [], | |
4788 | _('a changeset intended to be included in the destination'), |
|
4863 | _('a changeset intended to be included in the destination'), | |
4789 | _('REV')), |
|
4864 | _('REV')), | |
4790 | ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')), |
|
4865 | ('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')), | |
4791 | ('b', 'branch', [], |
|
4866 | ('b', 'branch', [], | |
4792 | _('a specific branch you would like to push'), _('BRANCH')), |
|
4867 | _('a specific branch you would like to push'), _('BRANCH')), | |
4793 | ('', 'new-branch', False, _('allow pushing a new branch')), |
|
4868 | ('', 'new-branch', False, _('allow pushing a new branch')), | |
4794 | ] + remoteopts, |
|
4869 | ] + remoteopts, | |
4795 | _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')) |
|
4870 | _('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]')) | |
4796 | def push(ui, repo, dest=None, **opts): |
|
4871 | def push(ui, repo, dest=None, **opts): | |
4797 | """push changes to the specified destination |
|
4872 | """push changes to the specified destination | |
4798 |
|
4873 | |||
4799 | Push changesets from the local repository to the specified |
|
4874 | Push changesets from the local repository to the specified | |
4800 | destination. |
|
4875 | destination. | |
4801 |
|
4876 | |||
4802 | This operation is symmetrical to pull: it is identical to a pull |
|
4877 | This operation is symmetrical to pull: it is identical to a pull | |
4803 | in the destination repository from the current one. |
|
4878 | in the destination repository from the current one. | |
4804 |
|
4879 | |||
4805 | By default, push will not allow creation of new heads at the |
|
4880 | By default, push will not allow creation of new heads at the | |
4806 | destination, since multiple heads would make it unclear which head |
|
4881 | destination, since multiple heads would make it unclear which head | |
4807 | to use. In this situation, it is recommended to pull and merge |
|
4882 | to use. In this situation, it is recommended to pull and merge | |
4808 | before pushing. |
|
4883 | before pushing. | |
4809 |
|
4884 | |||
4810 | Use --new-branch if you want to allow push to create a new named |
|
4885 | Use --new-branch if you want to allow push to create a new named | |
4811 | branch that is not present at the destination. This allows you to |
|
4886 | branch that is not present at the destination. This allows you to | |
4812 | only create a new branch without forcing other changes. |
|
4887 | only create a new branch without forcing other changes. | |
4813 |
|
4888 | |||
4814 | .. note:: |
|
4889 | .. note:: | |
4815 |
|
4890 | |||
4816 | Extra care should be taken with the -f/--force option, |
|
4891 | Extra care should be taken with the -f/--force option, | |
4817 | which will push all new heads on all branches, an action which will |
|
4892 | which will push all new heads on all branches, an action which will | |
4818 | almost always cause confusion for collaborators. |
|
4893 | almost always cause confusion for collaborators. | |
4819 |
|
4894 | |||
4820 | If -r/--rev is used, the specified revision and all its ancestors |
|
4895 | If -r/--rev is used, the specified revision and all its ancestors | |
4821 | will be pushed to the remote repository. |
|
4896 | will be pushed to the remote repository. | |
4822 |
|
4897 | |||
4823 | If -B/--bookmark is used, the specified bookmarked revision, its |
|
4898 | If -B/--bookmark is used, the specified bookmarked revision, its | |
4824 | ancestors, and the bookmark will be pushed to the remote |
|
4899 | ancestors, and the bookmark will be pushed to the remote | |
4825 | repository. |
|
4900 | repository. | |
4826 |
|
4901 | |||
4827 | Please see :hg:`help urls` for important details about ``ssh://`` |
|
4902 | Please see :hg:`help urls` for important details about ``ssh://`` | |
4828 | URLs. If DESTINATION is omitted, a default path will be used. |
|
4903 | URLs. If DESTINATION is omitted, a default path will be used. | |
4829 |
|
4904 | |||
4830 | Returns 0 if push was successful, 1 if nothing to push. |
|
4905 | Returns 0 if push was successful, 1 if nothing to push. | |
4831 | """ |
|
4906 | """ | |
4832 |
|
4907 | |||
4833 | if opts.get('bookmark'): |
|
4908 | if opts.get('bookmark'): | |
4834 | ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push') |
|
4909 | ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push') | |
4835 | for b in opts['bookmark']: |
|
4910 | for b in opts['bookmark']: | |
4836 | # translate -B options to -r so changesets get pushed |
|
4911 | # translate -B options to -r so changesets get pushed | |
4837 | if b in repo._bookmarks: |
|
4912 | if b in repo._bookmarks: | |
4838 | opts.setdefault('rev', []).append(b) |
|
4913 | opts.setdefault('rev', []).append(b) | |
4839 | else: |
|
4914 | else: | |
4840 | # if we try to push a deleted bookmark, translate it to null |
|
4915 | # if we try to push a deleted bookmark, translate it to null | |
4841 | # this lets simultaneous -r, -b options continue working |
|
4916 | # this lets simultaneous -r, -b options continue working | |
4842 | opts.setdefault('rev', []).append("null") |
|
4917 | opts.setdefault('rev', []).append("null") | |
4843 |
|
4918 | |||
4844 | dest = ui.expandpath(dest or 'default-push', dest or 'default') |
|
4919 | dest = ui.expandpath(dest or 'default-push', dest or 'default') | |
4845 | dest, branches = hg.parseurl(dest, opts.get('branch')) |
|
4920 | dest, branches = hg.parseurl(dest, opts.get('branch')) | |
4846 | ui.status(_('pushing to %s\n') % util.hidepassword(dest)) |
|
4921 | ui.status(_('pushing to %s\n') % util.hidepassword(dest)) | |
4847 | revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) |
|
4922 | revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev')) | |
4848 | try: |
|
4923 | try: | |
4849 | other = hg.peer(repo, opts, dest) |
|
4924 | other = hg.peer(repo, opts, dest) | |
4850 | except error.RepoError: |
|
4925 | except error.RepoError: | |
4851 | if dest == "default-push": |
|
4926 | if dest == "default-push": | |
4852 | raise util.Abort(_("default repository not configured!"), |
|
4927 | raise util.Abort(_("default repository not configured!"), | |
4853 | hint=_('see the "path" section in "hg help config"')) |
|
4928 | hint=_('see the "path" section in "hg help config"')) | |
4854 | else: |
|
4929 | else: | |
4855 | raise |
|
4930 | raise | |
4856 |
|
4931 | |||
4857 | if revs: |
|
4932 | if revs: | |
4858 | revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] |
|
4933 | revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)] | |
4859 |
|
4934 | |||
4860 | repo._subtoppath = dest |
|
4935 | repo._subtoppath = dest | |
4861 | try: |
|
4936 | try: | |
4862 | # push subrepos depth-first for coherent ordering |
|
4937 | # push subrepos depth-first for coherent ordering | |
4863 | c = repo[''] |
|
4938 | c = repo[''] | |
4864 | subs = c.substate # only repos that are committed |
|
4939 | subs = c.substate # only repos that are committed | |
4865 | for s in sorted(subs): |
|
4940 | for s in sorted(subs): | |
4866 | result = c.sub(s).push(opts) |
|
4941 | result = c.sub(s).push(opts) | |
4867 | if result == 0: |
|
4942 | if result == 0: | |
4868 | return not result |
|
4943 | return not result | |
4869 | finally: |
|
4944 | finally: | |
4870 | del repo._subtoppath |
|
4945 | del repo._subtoppath | |
4871 | result = repo.push(other, opts.get('force'), revs=revs, |
|
4946 | result = repo.push(other, opts.get('force'), revs=revs, | |
4872 | newbranch=opts.get('new_branch')) |
|
4947 | newbranch=opts.get('new_branch')) | |
4873 |
|
4948 | |||
4874 | result = not result |
|
4949 | result = not result | |
4875 |
|
4950 | |||
4876 | if opts.get('bookmark'): |
|
4951 | if opts.get('bookmark'): | |
4877 | bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark']) |
|
4952 | bresult = bookmarks.pushtoremote(ui, repo, other, opts['bookmark']) | |
4878 | if bresult == 2: |
|
4953 | if bresult == 2: | |
4879 | return 2 |
|
4954 | return 2 | |
4880 | if not result and bresult: |
|
4955 | if not result and bresult: | |
4881 | result = 2 |
|
4956 | result = 2 | |
4882 |
|
4957 | |||
4883 | return result |
|
4958 | return result | |
4884 |
|
4959 | |||
4885 | @command('recover', []) |
|
4960 | @command('recover', []) | |
4886 | def recover(ui, repo): |
|
4961 | def recover(ui, repo): | |
4887 | """roll back an interrupted transaction |
|
4962 | """roll back an interrupted transaction | |
4888 |
|
4963 | |||
4889 | Recover from an interrupted commit or pull. |
|
4964 | Recover from an interrupted commit or pull. | |
4890 |
|
4965 | |||
4891 | This command tries to fix the repository status after an |
|
4966 | This command tries to fix the repository status after an | |
4892 | interrupted operation. It should only be necessary when Mercurial |
|
4967 | interrupted operation. It should only be necessary when Mercurial | |
4893 | suggests it. |
|
4968 | suggests it. | |
4894 |
|
4969 | |||
4895 | Returns 0 if successful, 1 if nothing to recover or verify fails. |
|
4970 | Returns 0 if successful, 1 if nothing to recover or verify fails. | |
4896 | """ |
|
4971 | """ | |
4897 | if repo.recover(): |
|
4972 | if repo.recover(): | |
4898 | return hg.verify(repo) |
|
4973 | return hg.verify(repo) | |
4899 | return 1 |
|
4974 | return 1 | |
4900 |
|
4975 | |||
4901 | @command('^remove|rm', |
|
4976 | @command('^remove|rm', | |
4902 | [('A', 'after', None, _('record delete for missing files')), |
|
4977 | [('A', 'after', None, _('record delete for missing files')), | |
4903 | ('f', 'force', None, |
|
4978 | ('f', 'force', None, | |
4904 | _('remove (and delete) file even if added or modified')), |
|
4979 | _('remove (and delete) file even if added or modified')), | |
4905 | ] + walkopts, |
|
4980 | ] + walkopts, | |
4906 | _('[OPTION]... FILE...'), |
|
4981 | _('[OPTION]... FILE...'), | |
4907 | inferrepo=True) |
|
4982 | inferrepo=True) | |
4908 | def remove(ui, repo, *pats, **opts): |
|
4983 | def remove(ui, repo, *pats, **opts): | |
4909 | """remove the specified files on the next commit |
|
4984 | """remove the specified files on the next commit | |
4910 |
|
4985 | |||
4911 | Schedule the indicated files for removal from the current branch. |
|
4986 | Schedule the indicated files for removal from the current branch. | |
4912 |
|
4987 | |||
4913 | This command schedules the files to be removed at the next commit. |
|
4988 | This command schedules the files to be removed at the next commit. | |
4914 | To undo a remove before that, see :hg:`revert`. To undo added |
|
4989 | To undo a remove before that, see :hg:`revert`. To undo added | |
4915 | files, see :hg:`forget`. |
|
4990 | files, see :hg:`forget`. | |
4916 |
|
4991 | |||
4917 | .. container:: verbose |
|
4992 | .. container:: verbose | |
4918 |
|
4993 | |||
4919 | -A/--after can be used to remove only files that have already |
|
4994 | -A/--after can be used to remove only files that have already | |
4920 | been deleted, -f/--force can be used to force deletion, and -Af |
|
4995 | been deleted, -f/--force can be used to force deletion, and -Af | |
4921 | can be used to remove files from the next revision without |
|
4996 | can be used to remove files from the next revision without | |
4922 | deleting them from the working directory. |
|
4997 | deleting them from the working directory. | |
4923 |
|
4998 | |||
4924 | The following table details the behavior of remove for different |
|
4999 | The following table details the behavior of remove for different | |
4925 | file states (columns) and option combinations (rows). The file |
|
5000 | file states (columns) and option combinations (rows). The file | |
4926 | states are Added [A], Clean [C], Modified [M] and Missing [!] |
|
5001 | states are Added [A], Clean [C], Modified [M] and Missing [!] | |
4927 | (as reported by :hg:`status`). The actions are Warn, Remove |
|
5002 | (as reported by :hg:`status`). The actions are Warn, Remove | |
4928 | (from branch) and Delete (from disk): |
|
5003 | (from branch) and Delete (from disk): | |
4929 |
|
5004 | |||
4930 | ========= == == == == |
|
5005 | ========= == == == == | |
4931 | opt/state A C M ! |
|
5006 | opt/state A C M ! | |
4932 | ========= == == == == |
|
5007 | ========= == == == == | |
4933 | none W RD W R |
|
5008 | none W RD W R | |
4934 | -f R RD RD R |
|
5009 | -f R RD RD R | |
4935 | -A W W W R |
|
5010 | -A W W W R | |
4936 | -Af R R R R |
|
5011 | -Af R R R R | |
4937 | ========= == == == == |
|
5012 | ========= == == == == | |
4938 |
|
5013 | |||
4939 | Note that remove never deletes files in Added [A] state from the |
|
5014 | Note that remove never deletes files in Added [A] state from the | |
4940 | working directory, not even if option --force is specified. |
|
5015 | working directory, not even if option --force is specified. | |
4941 |
|
5016 | |||
4942 | Returns 0 on success, 1 if any warnings encountered. |
|
5017 | Returns 0 on success, 1 if any warnings encountered. | |
4943 | """ |
|
5018 | """ | |
4944 |
|
5019 | |||
4945 | ret = 0 |
|
5020 | ret = 0 | |
4946 | after, force = opts.get('after'), opts.get('force') |
|
5021 | after, force = opts.get('after'), opts.get('force') | |
4947 | if not pats and not after: |
|
5022 | if not pats and not after: | |
4948 | raise util.Abort(_('no files specified')) |
|
5023 | raise util.Abort(_('no files specified')) | |
4949 |
|
5024 | |||
4950 | m = scmutil.match(repo[None], pats, opts) |
|
5025 | m = scmutil.match(repo[None], pats, opts) | |
4951 | s = repo.status(match=m, clean=True) |
|
5026 | s = repo.status(match=m, clean=True) | |
4952 | modified, added, deleted, clean = s[0], s[1], s[3], s[6] |
|
5027 | modified, added, deleted, clean = s[0], s[1], s[3], s[6] | |
4953 |
|
5028 | |||
4954 | # warn about failure to delete explicit files/dirs |
|
5029 | # warn about failure to delete explicit files/dirs | |
4955 | wctx = repo[None] |
|
5030 | wctx = repo[None] | |
4956 | for f in m.files(): |
|
5031 | for f in m.files(): | |
4957 | if f in repo.dirstate or f in wctx.dirs(): |
|
5032 | if f in repo.dirstate or f in wctx.dirs(): | |
4958 | continue |
|
5033 | continue | |
4959 | if os.path.exists(m.rel(f)): |
|
5034 | if os.path.exists(m.rel(f)): | |
4960 | if os.path.isdir(m.rel(f)): |
|
5035 | if os.path.isdir(m.rel(f)): | |
4961 | ui.warn(_('not removing %s: no tracked files\n') % m.rel(f)) |
|
5036 | ui.warn(_('not removing %s: no tracked files\n') % m.rel(f)) | |
4962 | else: |
|
5037 | else: | |
4963 | ui.warn(_('not removing %s: file is untracked\n') % m.rel(f)) |
|
5038 | ui.warn(_('not removing %s: file is untracked\n') % m.rel(f)) | |
4964 | # missing files will generate a warning elsewhere |
|
5039 | # missing files will generate a warning elsewhere | |
4965 | ret = 1 |
|
5040 | ret = 1 | |
4966 |
|
5041 | |||
4967 | if force: |
|
5042 | if force: | |
4968 | list = modified + deleted + clean + added |
|
5043 | list = modified + deleted + clean + added | |
4969 | elif after: |
|
5044 | elif after: | |
4970 | list = deleted |
|
5045 | list = deleted | |
4971 | for f in modified + added + clean: |
|
5046 | for f in modified + added + clean: | |
4972 | ui.warn(_('not removing %s: file still exists\n') % m.rel(f)) |
|
5047 | ui.warn(_('not removing %s: file still exists\n') % m.rel(f)) | |
4973 | ret = 1 |
|
5048 | ret = 1 | |
4974 | else: |
|
5049 | else: | |
4975 | list = deleted + clean |
|
5050 | list = deleted + clean | |
4976 | for f in modified: |
|
5051 | for f in modified: | |
4977 | ui.warn(_('not removing %s: file is modified (use -f' |
|
5052 | ui.warn(_('not removing %s: file is modified (use -f' | |
4978 | ' to force removal)\n') % m.rel(f)) |
|
5053 | ' to force removal)\n') % m.rel(f)) | |
4979 | ret = 1 |
|
5054 | ret = 1 | |
4980 | for f in added: |
|
5055 | for f in added: | |
4981 | ui.warn(_('not removing %s: file has been marked for add' |
|
5056 | ui.warn(_('not removing %s: file has been marked for add' | |
4982 | ' (use forget to undo)\n') % m.rel(f)) |
|
5057 | ' (use forget to undo)\n') % m.rel(f)) | |
4983 | ret = 1 |
|
5058 | ret = 1 | |
4984 |
|
5059 | |||
4985 | for f in sorted(list): |
|
5060 | for f in sorted(list): | |
4986 | if ui.verbose or not m.exact(f): |
|
5061 | if ui.verbose or not m.exact(f): | |
4987 | ui.status(_('removing %s\n') % m.rel(f)) |
|
5062 | ui.status(_('removing %s\n') % m.rel(f)) | |
4988 |
|
5063 | |||
4989 | wlock = repo.wlock() |
|
5064 | wlock = repo.wlock() | |
4990 | try: |
|
5065 | try: | |
4991 | if not after: |
|
5066 | if not after: | |
4992 | for f in list: |
|
5067 | for f in list: | |
4993 | if f in added: |
|
5068 | if f in added: | |
4994 | continue # we never unlink added files on remove |
|
5069 | continue # we never unlink added files on remove | |
4995 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) |
|
5070 | util.unlinkpath(repo.wjoin(f), ignoremissing=True) | |
4996 | repo[None].forget(list) |
|
5071 | repo[None].forget(list) | |
4997 | finally: |
|
5072 | finally: | |
4998 | wlock.release() |
|
5073 | wlock.release() | |
4999 |
|
5074 | |||
5000 | return ret |
|
5075 | return ret | |
5001 |
|
5076 | |||
5002 | @command('rename|move|mv', |
|
5077 | @command('rename|move|mv', | |
5003 | [('A', 'after', None, _('record a rename that has already occurred')), |
|
5078 | [('A', 'after', None, _('record a rename that has already occurred')), | |
5004 | ('f', 'force', None, _('forcibly copy over an existing managed file')), |
|
5079 | ('f', 'force', None, _('forcibly copy over an existing managed file')), | |
5005 | ] + walkopts + dryrunopts, |
|
5080 | ] + walkopts + dryrunopts, | |
5006 | _('[OPTION]... SOURCE... DEST')) |
|
5081 | _('[OPTION]... SOURCE... DEST')) | |
5007 | def rename(ui, repo, *pats, **opts): |
|
5082 | def rename(ui, repo, *pats, **opts): | |
5008 | """rename files; equivalent of copy + remove |
|
5083 | """rename files; equivalent of copy + remove | |
5009 |
|
5084 | |||
5010 | Mark dest as copies of sources; mark sources for deletion. If dest |
|
5085 | Mark dest as copies of sources; mark sources for deletion. If dest | |
5011 | is a directory, copies are put in that directory. If dest is a |
|
5086 | is a directory, copies are put in that directory. If dest is a | |
5012 | file, there can only be one source. |
|
5087 | file, there can only be one source. | |
5013 |
|
5088 | |||
5014 | By default, this command copies the contents of files as they |
|
5089 | By default, this command copies the contents of files as they | |
5015 | exist in the working directory. If invoked with -A/--after, the |
|
5090 | exist in the working directory. If invoked with -A/--after, the | |
5016 | operation is recorded, but no copying is performed. |
|
5091 | operation is recorded, but no copying is performed. | |
5017 |
|
5092 | |||
5018 | This command takes effect at the next commit. To undo a rename |
|
5093 | This command takes effect at the next commit. To undo a rename | |
5019 | before that, see :hg:`revert`. |
|
5094 | before that, see :hg:`revert`. | |
5020 |
|
5095 | |||
5021 | Returns 0 on success, 1 if errors are encountered. |
|
5096 | Returns 0 on success, 1 if errors are encountered. | |
5022 | """ |
|
5097 | """ | |
5023 | wlock = repo.wlock(False) |
|
5098 | wlock = repo.wlock(False) | |
5024 | try: |
|
5099 | try: | |
5025 | return cmdutil.copy(ui, repo, pats, opts, rename=True) |
|
5100 | return cmdutil.copy(ui, repo, pats, opts, rename=True) | |
5026 | finally: |
|
5101 | finally: | |
5027 | wlock.release() |
|
5102 | wlock.release() | |
5028 |
|
5103 | |||
5029 | @command('resolve', |
|
5104 | @command('resolve', | |
5030 | [('a', 'all', None, _('select all unresolved files')), |
|
5105 | [('a', 'all', None, _('select all unresolved files')), | |
5031 | ('l', 'list', None, _('list state of files needing merge')), |
|
5106 | ('l', 'list', None, _('list state of files needing merge')), | |
5032 | ('m', 'mark', None, _('mark files as resolved')), |
|
5107 | ('m', 'mark', None, _('mark files as resolved')), | |
5033 | ('u', 'unmark', None, _('mark files as unresolved')), |
|
5108 | ('u', 'unmark', None, _('mark files as unresolved')), | |
5034 | ('n', 'no-status', None, _('hide status prefix'))] |
|
5109 | ('n', 'no-status', None, _('hide status prefix'))] | |
5035 | + mergetoolopts + walkopts, |
|
5110 | + mergetoolopts + walkopts, | |
5036 | _('[OPTION]... [FILE]...'), |
|
5111 | _('[OPTION]... [FILE]...'), | |
5037 | inferrepo=True) |
|
5112 | inferrepo=True) | |
5038 | def resolve(ui, repo, *pats, **opts): |
|
5113 | def resolve(ui, repo, *pats, **opts): | |
5039 | """redo merges or set/view the merge status of files |
|
5114 | """redo merges or set/view the merge status of files | |
5040 |
|
5115 | |||
5041 | Merges with unresolved conflicts are often the result of |
|
5116 | Merges with unresolved conflicts are often the result of | |
5042 | non-interactive merging using the ``internal:merge`` configuration |
|
5117 | non-interactive merging using the ``internal:merge`` configuration | |
5043 | setting, or a command-line merge tool like ``diff3``. The resolve |
|
5118 | setting, or a command-line merge tool like ``diff3``. The resolve | |
5044 | command is used to manage the files involved in a merge, after |
|
5119 | command is used to manage the files involved in a merge, after | |
5045 | :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the |
|
5120 | :hg:`merge` has been run, and before :hg:`commit` is run (i.e. the | |
5046 | working directory must have two parents). See :hg:`help |
|
5121 | working directory must have two parents). See :hg:`help | |
5047 | merge-tools` for information on configuring merge tools. |
|
5122 | merge-tools` for information on configuring merge tools. | |
5048 |
|
5123 | |||
5049 | The resolve command can be used in the following ways: |
|
5124 | The resolve command can be used in the following ways: | |
5050 |
|
5125 | |||
5051 | - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified |
|
5126 | - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified | |
5052 | files, discarding any previous merge attempts. Re-merging is not |
|
5127 | files, discarding any previous merge attempts. Re-merging is not | |
5053 | performed for files already marked as resolved. Use ``--all/-a`` |
|
5128 | performed for files already marked as resolved. Use ``--all/-a`` | |
5054 | to select all unresolved files. ``--tool`` can be used to specify |
|
5129 | to select all unresolved files. ``--tool`` can be used to specify | |
5055 | the merge tool used for the given files. It overrides the HGMERGE |
|
5130 | the merge tool used for the given files. It overrides the HGMERGE | |
5056 | environment variable and your configuration files. Previous file |
|
5131 | environment variable and your configuration files. Previous file | |
5057 | contents are saved with a ``.orig`` suffix. |
|
5132 | contents are saved with a ``.orig`` suffix. | |
5058 |
|
5133 | |||
5059 | - :hg:`resolve -m [FILE]`: mark a file as having been resolved |
|
5134 | - :hg:`resolve -m [FILE]`: mark a file as having been resolved | |
5060 | (e.g. after having manually fixed-up the files). The default is |
|
5135 | (e.g. after having manually fixed-up the files). The default is | |
5061 | to mark all unresolved files. |
|
5136 | to mark all unresolved files. | |
5062 |
|
5137 | |||
5063 | - :hg:`resolve -u [FILE]...`: mark a file as unresolved. The |
|
5138 | - :hg:`resolve -u [FILE]...`: mark a file as unresolved. The | |
5064 | default is to mark all resolved files. |
|
5139 | default is to mark all resolved files. | |
5065 |
|
5140 | |||
5066 | - :hg:`resolve -l`: list files which had or still have conflicts. |
|
5141 | - :hg:`resolve -l`: list files which had or still have conflicts. | |
5067 | In the printed list, ``U`` = unresolved and ``R`` = resolved. |
|
5142 | In the printed list, ``U`` = unresolved and ``R`` = resolved. | |
5068 |
|
5143 | |||
5069 | Note that Mercurial will not let you commit files with unresolved |
|
5144 | Note that Mercurial will not let you commit files with unresolved | |
5070 | merge conflicts. You must use :hg:`resolve -m ...` before you can |
|
5145 | merge conflicts. You must use :hg:`resolve -m ...` before you can | |
5071 | commit after a conflicting merge. |
|
5146 | commit after a conflicting merge. | |
5072 |
|
5147 | |||
5073 | Returns 0 on success, 1 if any files fail a resolve attempt. |
|
5148 | Returns 0 on success, 1 if any files fail a resolve attempt. | |
5074 | """ |
|
5149 | """ | |
5075 |
|
5150 | |||
5076 | all, mark, unmark, show, nostatus = \ |
|
5151 | all, mark, unmark, show, nostatus = \ | |
5077 | [opts.get(o) for o in 'all mark unmark list no_status'.split()] |
|
5152 | [opts.get(o) for o in 'all mark unmark list no_status'.split()] | |
5078 |
|
5153 | |||
5079 | if (show and (mark or unmark)) or (mark and unmark): |
|
5154 | if (show and (mark or unmark)) or (mark and unmark): | |
5080 | raise util.Abort(_("too many options specified")) |
|
5155 | raise util.Abort(_("too many options specified")) | |
5081 | if pats and all: |
|
5156 | if pats and all: | |
5082 | raise util.Abort(_("can't specify --all and patterns")) |
|
5157 | raise util.Abort(_("can't specify --all and patterns")) | |
5083 | if not (all or pats or show or mark or unmark): |
|
5158 | if not (all or pats or show or mark or unmark): | |
5084 | raise util.Abort(_('no files or directories specified'), |
|
5159 | raise util.Abort(_('no files or directories specified'), | |
5085 | hint=('use --all to remerge all files')) |
|
5160 | hint=('use --all to remerge all files')) | |
5086 |
|
5161 | |||
5087 | wlock = repo.wlock() |
|
5162 | wlock = repo.wlock() | |
5088 | try: |
|
5163 | try: | |
5089 | ms = mergemod.mergestate(repo) |
|
5164 | ms = mergemod.mergestate(repo) | |
5090 |
|
5165 | |||
5091 | if not ms.active() and not show: |
|
5166 | if not ms.active() and not show: | |
5092 | raise util.Abort( |
|
5167 | raise util.Abort( | |
5093 | _('resolve command not applicable when not merging')) |
|
5168 | _('resolve command not applicable when not merging')) | |
5094 |
|
5169 | |||
5095 | m = scmutil.match(repo[None], pats, opts) |
|
5170 | m = scmutil.match(repo[None], pats, opts) | |
5096 | ret = 0 |
|
5171 | ret = 0 | |
5097 | didwork = False |
|
5172 | didwork = False | |
5098 |
|
5173 | |||
5099 | for f in ms: |
|
5174 | for f in ms: | |
5100 | if not m(f): |
|
5175 | if not m(f): | |
5101 | continue |
|
5176 | continue | |
5102 |
|
5177 | |||
5103 | didwork = True |
|
5178 | didwork = True | |
5104 |
|
5179 | |||
5105 | if show: |
|
5180 | if show: | |
5106 | if nostatus: |
|
5181 | if nostatus: | |
5107 | ui.write("%s\n" % f) |
|
5182 | ui.write("%s\n" % f) | |
5108 | else: |
|
5183 | else: | |
5109 | ui.write("%s %s\n" % (ms[f].upper(), f), |
|
5184 | ui.write("%s %s\n" % (ms[f].upper(), f), | |
5110 | label='resolve.' + |
|
5185 | label='resolve.' + | |
5111 | {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) |
|
5186 | {'u': 'unresolved', 'r': 'resolved'}[ms[f]]) | |
5112 | elif mark: |
|
5187 | elif mark: | |
5113 | ms.mark(f, "r") |
|
5188 | ms.mark(f, "r") | |
5114 | elif unmark: |
|
5189 | elif unmark: | |
5115 | ms.mark(f, "u") |
|
5190 | ms.mark(f, "u") | |
5116 | else: |
|
5191 | else: | |
5117 | wctx = repo[None] |
|
5192 | wctx = repo[None] | |
5118 |
|
5193 | |||
5119 | # backup pre-resolve (merge uses .orig for its own purposes) |
|
5194 | # backup pre-resolve (merge uses .orig for its own purposes) | |
5120 | a = repo.wjoin(f) |
|
5195 | a = repo.wjoin(f) | |
5121 | util.copyfile(a, a + ".resolve") |
|
5196 | util.copyfile(a, a + ".resolve") | |
5122 |
|
5197 | |||
5123 | try: |
|
5198 | try: | |
5124 | # resolve file |
|
5199 | # resolve file | |
5125 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), |
|
5200 | ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), | |
5126 | 'resolve') |
|
5201 | 'resolve') | |
5127 | if ms.resolve(f, wctx): |
|
5202 | if ms.resolve(f, wctx): | |
5128 | ret = 1 |
|
5203 | ret = 1 | |
5129 | finally: |
|
5204 | finally: | |
5130 | ui.setconfig('ui', 'forcemerge', '', 'resolve') |
|
5205 | ui.setconfig('ui', 'forcemerge', '', 'resolve') | |
5131 | ms.commit() |
|
5206 | ms.commit() | |
5132 |
|
5207 | |||
5133 | # replace filemerge's .orig file with our resolve file |
|
5208 | # replace filemerge's .orig file with our resolve file | |
5134 | util.rename(a + ".resolve", a + ".orig") |
|
5209 | util.rename(a + ".resolve", a + ".orig") | |
5135 |
|
5210 | |||
5136 | ms.commit() |
|
5211 | ms.commit() | |
5137 |
|
5212 | |||
5138 | if not didwork and pats: |
|
5213 | if not didwork and pats: | |
5139 | ui.warn(_("arguments do not match paths that need resolving\n")) |
|
5214 | ui.warn(_("arguments do not match paths that need resolving\n")) | |
5140 |
|
5215 | |||
5141 | finally: |
|
5216 | finally: | |
5142 | wlock.release() |
|
5217 | wlock.release() | |
5143 |
|
5218 | |||
5144 | # Nudge users into finishing an unfinished operation. We don't print |
|
5219 | # Nudge users into finishing an unfinished operation. We don't print | |
5145 | # this with the list/show operation because we want list/show to remain |
|
5220 | # this with the list/show operation because we want list/show to remain | |
5146 | # machine readable. |
|
5221 | # machine readable. | |
5147 | if not list(ms.unresolved()) and not show: |
|
5222 | if not list(ms.unresolved()) and not show: | |
5148 | ui.status(_('(no more unresolved files)\n')) |
|
5223 | ui.status(_('(no more unresolved files)\n')) | |
5149 |
|
5224 | |||
5150 | return ret |
|
5225 | return ret | |
5151 |
|
5226 | |||
5152 | @command('revert', |
|
5227 | @command('revert', | |
5153 | [('a', 'all', None, _('revert all changes when no arguments given')), |
|
5228 | [('a', 'all', None, _('revert all changes when no arguments given')), | |
5154 | ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), |
|
5229 | ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), | |
5155 | ('r', 'rev', '', _('revert to the specified revision'), _('REV')), |
|
5230 | ('r', 'rev', '', _('revert to the specified revision'), _('REV')), | |
5156 | ('C', 'no-backup', None, _('do not save backup copies of files')), |
|
5231 | ('C', 'no-backup', None, _('do not save backup copies of files')), | |
5157 | ] + walkopts + dryrunopts, |
|
5232 | ] + walkopts + dryrunopts, | |
5158 | _('[OPTION]... [-r REV] [NAME]...')) |
|
5233 | _('[OPTION]... [-r REV] [NAME]...')) | |
5159 | def revert(ui, repo, *pats, **opts): |
|
5234 | def revert(ui, repo, *pats, **opts): | |
5160 | """restore files to their checkout state |
|
5235 | """restore files to their checkout state | |
5161 |
|
5236 | |||
5162 | .. note:: |
|
5237 | .. note:: | |
5163 |
|
5238 | |||
5164 | To check out earlier revisions, you should use :hg:`update REV`. |
|
5239 | To check out earlier revisions, you should use :hg:`update REV`. | |
5165 | To cancel an uncommitted merge (and lose your changes), |
|
5240 | To cancel an uncommitted merge (and lose your changes), | |
5166 | use :hg:`update --clean .`. |
|
5241 | use :hg:`update --clean .`. | |
5167 |
|
5242 | |||
5168 | With no revision specified, revert the specified files or directories |
|
5243 | With no revision specified, revert the specified files or directories | |
5169 | to the contents they had in the parent of the working directory. |
|
5244 | to the contents they had in the parent of the working directory. | |
5170 | This restores the contents of files to an unmodified |
|
5245 | This restores the contents of files to an unmodified | |
5171 | state and unschedules adds, removes, copies, and renames. If the |
|
5246 | state and unschedules adds, removes, copies, and renames. If the | |
5172 | working directory has two parents, you must explicitly specify a |
|
5247 | working directory has two parents, you must explicitly specify a | |
5173 | revision. |
|
5248 | revision. | |
5174 |
|
5249 | |||
5175 | Using the -r/--rev or -d/--date options, revert the given files or |
|
5250 | Using the -r/--rev or -d/--date options, revert the given files or | |
5176 | directories to their states as of a specific revision. Because |
|
5251 | directories to their states as of a specific revision. Because | |
5177 | revert does not change the working directory parents, this will |
|
5252 | revert does not change the working directory parents, this will | |
5178 | cause these files to appear modified. This can be helpful to "back |
|
5253 | cause these files to appear modified. This can be helpful to "back | |
5179 | out" some or all of an earlier change. See :hg:`backout` for a |
|
5254 | out" some or all of an earlier change. See :hg:`backout` for a | |
5180 | related method. |
|
5255 | related method. | |
5181 |
|
5256 | |||
5182 | Modified files are saved with a .orig suffix before reverting. |
|
5257 | Modified files are saved with a .orig suffix before reverting. | |
5183 | To disable these backups, use --no-backup. |
|
5258 | To disable these backups, use --no-backup. | |
5184 |
|
5259 | |||
5185 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
5260 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
5186 |
|
5261 | |||
5187 | Returns 0 on success. |
|
5262 | Returns 0 on success. | |
5188 | """ |
|
5263 | """ | |
5189 |
|
5264 | |||
5190 | if opts.get("date"): |
|
5265 | if opts.get("date"): | |
5191 | if opts.get("rev"): |
|
5266 | if opts.get("rev"): | |
5192 | raise util.Abort(_("you can't specify a revision and a date")) |
|
5267 | raise util.Abort(_("you can't specify a revision and a date")) | |
5193 | opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) |
|
5268 | opts["rev"] = cmdutil.finddate(ui, repo, opts["date"]) | |
5194 |
|
5269 | |||
5195 | parent, p2 = repo.dirstate.parents() |
|
5270 | parent, p2 = repo.dirstate.parents() | |
5196 | if not opts.get('rev') and p2 != nullid: |
|
5271 | if not opts.get('rev') and p2 != nullid: | |
5197 | # revert after merge is a trap for new users (issue2915) |
|
5272 | # revert after merge is a trap for new users (issue2915) | |
5198 | raise util.Abort(_('uncommitted merge with no revision specified'), |
|
5273 | raise util.Abort(_('uncommitted merge with no revision specified'), | |
5199 | hint=_('use "hg update" or see "hg help revert"')) |
|
5274 | hint=_('use "hg update" or see "hg help revert"')) | |
5200 |
|
5275 | |||
5201 | ctx = scmutil.revsingle(repo, opts.get('rev')) |
|
5276 | ctx = scmutil.revsingle(repo, opts.get('rev')) | |
5202 |
|
5277 | |||
5203 | if not pats and not opts.get('all'): |
|
5278 | if not pats and not opts.get('all'): | |
5204 | msg = _("no files or directories specified") |
|
5279 | msg = _("no files or directories specified") | |
5205 | if p2 != nullid: |
|
5280 | if p2 != nullid: | |
5206 | hint = _("uncommitted merge, use --all to discard all changes," |
|
5281 | hint = _("uncommitted merge, use --all to discard all changes," | |
5207 | " or 'hg update -C .' to abort the merge") |
|
5282 | " or 'hg update -C .' to abort the merge") | |
5208 | raise util.Abort(msg, hint=hint) |
|
5283 | raise util.Abort(msg, hint=hint) | |
5209 | dirty = util.any(repo.status()) |
|
5284 | dirty = util.any(repo.status()) | |
5210 | node = ctx.node() |
|
5285 | node = ctx.node() | |
5211 | if node != parent: |
|
5286 | if node != parent: | |
5212 | if dirty: |
|
5287 | if dirty: | |
5213 | hint = _("uncommitted changes, use --all to discard all" |
|
5288 | hint = _("uncommitted changes, use --all to discard all" | |
5214 | " changes, or 'hg update %s' to update") % ctx.rev() |
|
5289 | " changes, or 'hg update %s' to update") % ctx.rev() | |
5215 | else: |
|
5290 | else: | |
5216 | hint = _("use --all to revert all files," |
|
5291 | hint = _("use --all to revert all files," | |
5217 | " or 'hg update %s' to update") % ctx.rev() |
|
5292 | " or 'hg update %s' to update") % ctx.rev() | |
5218 | elif dirty: |
|
5293 | elif dirty: | |
5219 | hint = _("uncommitted changes, use --all to discard all changes") |
|
5294 | hint = _("uncommitted changes, use --all to discard all changes") | |
5220 | else: |
|
5295 | else: | |
5221 | hint = _("use --all to revert all files") |
|
5296 | hint = _("use --all to revert all files") | |
5222 | raise util.Abort(msg, hint=hint) |
|
5297 | raise util.Abort(msg, hint=hint) | |
5223 |
|
5298 | |||
5224 | return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) |
|
5299 | return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts) | |
5225 |
|
5300 | |||
5226 | @command('rollback', dryrunopts + |
|
5301 | @command('rollback', dryrunopts + | |
5227 | [('f', 'force', False, _('ignore safety measures'))]) |
|
5302 | [('f', 'force', False, _('ignore safety measures'))]) | |
5228 | def rollback(ui, repo, **opts): |
|
5303 | def rollback(ui, repo, **opts): | |
5229 | """roll back the last transaction (DANGEROUS) (DEPRECATED) |
|
5304 | """roll back the last transaction (DANGEROUS) (DEPRECATED) | |
5230 |
|
5305 | |||
5231 | Please use :hg:`commit --amend` instead of rollback to correct |
|
5306 | Please use :hg:`commit --amend` instead of rollback to correct | |
5232 | mistakes in the last commit. |
|
5307 | mistakes in the last commit. | |
5233 |
|
5308 | |||
5234 | This command should be used with care. There is only one level of |
|
5309 | This command should be used with care. There is only one level of | |
5235 | rollback, and there is no way to undo a rollback. It will also |
|
5310 | rollback, and there is no way to undo a rollback. It will also | |
5236 | restore the dirstate at the time of the last transaction, losing |
|
5311 | restore the dirstate at the time of the last transaction, losing | |
5237 | any dirstate changes since that time. This command does not alter |
|
5312 | any dirstate changes since that time. This command does not alter | |
5238 | the working directory. |
|
5313 | the working directory. | |
5239 |
|
5314 | |||
5240 | Transactions are used to encapsulate the effects of all commands |
|
5315 | Transactions are used to encapsulate the effects of all commands | |
5241 | that create new changesets or propagate existing changesets into a |
|
5316 | that create new changesets or propagate existing changesets into a | |
5242 | repository. |
|
5317 | repository. | |
5243 |
|
5318 | |||
5244 | .. container:: verbose |
|
5319 | .. container:: verbose | |
5245 |
|
5320 | |||
5246 | For example, the following commands are transactional, and their |
|
5321 | For example, the following commands are transactional, and their | |
5247 | effects can be rolled back: |
|
5322 | effects can be rolled back: | |
5248 |
|
5323 | |||
5249 | - commit |
|
5324 | - commit | |
5250 | - import |
|
5325 | - import | |
5251 | - pull |
|
5326 | - pull | |
5252 | - push (with this repository as the destination) |
|
5327 | - push (with this repository as the destination) | |
5253 | - unbundle |
|
5328 | - unbundle | |
5254 |
|
5329 | |||
5255 | To avoid permanent data loss, rollback will refuse to rollback a |
|
5330 | To avoid permanent data loss, rollback will refuse to rollback a | |
5256 | commit transaction if it isn't checked out. Use --force to |
|
5331 | commit transaction if it isn't checked out. Use --force to | |
5257 | override this protection. |
|
5332 | override this protection. | |
5258 |
|
5333 | |||
5259 | This command is not intended for use on public repositories. Once |
|
5334 | This command is not intended for use on public repositories. Once | |
5260 | changes are visible for pull by other users, rolling a transaction |
|
5335 | changes are visible for pull by other users, rolling a transaction | |
5261 | back locally is ineffective (someone else may already have pulled |
|
5336 | back locally is ineffective (someone else may already have pulled | |
5262 | the changes). Furthermore, a race is possible with readers of the |
|
5337 | the changes). Furthermore, a race is possible with readers of the | |
5263 | repository; for example an in-progress pull from the repository |
|
5338 | repository; for example an in-progress pull from the repository | |
5264 | may fail if a rollback is performed. |
|
5339 | may fail if a rollback is performed. | |
5265 |
|
5340 | |||
5266 | Returns 0 on success, 1 if no rollback data is available. |
|
5341 | Returns 0 on success, 1 if no rollback data is available. | |
5267 | """ |
|
5342 | """ | |
5268 | return repo.rollback(dryrun=opts.get('dry_run'), |
|
5343 | return repo.rollback(dryrun=opts.get('dry_run'), | |
5269 | force=opts.get('force')) |
|
5344 | force=opts.get('force')) | |
5270 |
|
5345 | |||
5271 | @command('root', []) |
|
5346 | @command('root', []) | |
5272 | def root(ui, repo): |
|
5347 | def root(ui, repo): | |
5273 | """print the root (top) of the current working directory |
|
5348 | """print the root (top) of the current working directory | |
5274 |
|
5349 | |||
5275 | Print the root directory of the current repository. |
|
5350 | Print the root directory of the current repository. | |
5276 |
|
5351 | |||
5277 | Returns 0 on success. |
|
5352 | Returns 0 on success. | |
5278 | """ |
|
5353 | """ | |
5279 | ui.write(repo.root + "\n") |
|
5354 | ui.write(repo.root + "\n") | |
5280 |
|
5355 | |||
5281 | @command('^serve', |
|
5356 | @command('^serve', | |
5282 | [('A', 'accesslog', '', _('name of access log file to write to'), |
|
5357 | [('A', 'accesslog', '', _('name of access log file to write to'), | |
5283 | _('FILE')), |
|
5358 | _('FILE')), | |
5284 | ('d', 'daemon', None, _('run server in background')), |
|
5359 | ('d', 'daemon', None, _('run server in background')), | |
5285 | ('', 'daemon-pipefds', '', _('used internally by daemon mode'), _('NUM')), |
|
5360 | ('', 'daemon-pipefds', '', _('used internally by daemon mode'), _('NUM')), | |
5286 | ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')), |
|
5361 | ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')), | |
5287 | # use string type, then we can check if something was passed |
|
5362 | # use string type, then we can check if something was passed | |
5288 | ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')), |
|
5363 | ('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')), | |
5289 | ('a', 'address', '', _('address to listen on (default: all interfaces)'), |
|
5364 | ('a', 'address', '', _('address to listen on (default: all interfaces)'), | |
5290 | _('ADDR')), |
|
5365 | _('ADDR')), | |
5291 | ('', 'prefix', '', _('prefix path to serve from (default: server root)'), |
|
5366 | ('', 'prefix', '', _('prefix path to serve from (default: server root)'), | |
5292 | _('PREFIX')), |
|
5367 | _('PREFIX')), | |
5293 | ('n', 'name', '', |
|
5368 | ('n', 'name', '', | |
5294 | _('name to show in web pages (default: working directory)'), _('NAME')), |
|
5369 | _('name to show in web pages (default: working directory)'), _('NAME')), | |
5295 | ('', 'web-conf', '', |
|
5370 | ('', 'web-conf', '', | |
5296 | _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')), |
|
5371 | _('name of the hgweb config file (see "hg help hgweb")'), _('FILE')), | |
5297 | ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'), |
|
5372 | ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'), | |
5298 | _('FILE')), |
|
5373 | _('FILE')), | |
5299 | ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')), |
|
5374 | ('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')), | |
5300 | ('', 'stdio', None, _('for remote clients')), |
|
5375 | ('', 'stdio', None, _('for remote clients')), | |
5301 | ('', 'cmdserver', '', _('for remote clients'), _('MODE')), |
|
5376 | ('', 'cmdserver', '', _('for remote clients'), _('MODE')), | |
5302 | ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), |
|
5377 | ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')), | |
5303 | ('', 'style', '', _('template style to use'), _('STYLE')), |
|
5378 | ('', 'style', '', _('template style to use'), _('STYLE')), | |
5304 | ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), |
|
5379 | ('6', 'ipv6', None, _('use IPv6 in addition to IPv4')), | |
5305 | ('', 'certificate', '', _('SSL certificate file'), _('FILE'))], |
|
5380 | ('', 'certificate', '', _('SSL certificate file'), _('FILE'))], | |
5306 | _('[OPTION]...'), |
|
5381 | _('[OPTION]...'), | |
5307 | optionalrepo=True) |
|
5382 | optionalrepo=True) | |
5308 | def serve(ui, repo, **opts): |
|
5383 | def serve(ui, repo, **opts): | |
5309 | """start stand-alone webserver |
|
5384 | """start stand-alone webserver | |
5310 |
|
5385 | |||
5311 | Start a local HTTP repository browser and pull server. You can use |
|
5386 | Start a local HTTP repository browser and pull server. You can use | |
5312 | this for ad-hoc sharing and browsing of repositories. It is |
|
5387 | this for ad-hoc sharing and browsing of repositories. It is | |
5313 | recommended to use a real web server to serve a repository for |
|
5388 | recommended to use a real web server to serve a repository for | |
5314 | longer periods of time. |
|
5389 | longer periods of time. | |
5315 |
|
5390 | |||
5316 | Please note that the server does not implement access control. |
|
5391 | Please note that the server does not implement access control. | |
5317 | This means that, by default, anybody can read from the server and |
|
5392 | This means that, by default, anybody can read from the server and | |
5318 | nobody can write to it by default. Set the ``web.allow_push`` |
|
5393 | nobody can write to it by default. Set the ``web.allow_push`` | |
5319 | option to ``*`` to allow everybody to push to the server. You |
|
5394 | option to ``*`` to allow everybody to push to the server. You | |
5320 | should use a real web server if you need to authenticate users. |
|
5395 | should use a real web server if you need to authenticate users. | |
5321 |
|
5396 | |||
5322 | By default, the server logs accesses to stdout and errors to |
|
5397 | By default, the server logs accesses to stdout and errors to | |
5323 | stderr. Use the -A/--accesslog and -E/--errorlog options to log to |
|
5398 | stderr. Use the -A/--accesslog and -E/--errorlog options to log to | |
5324 | files. |
|
5399 | files. | |
5325 |
|
5400 | |||
5326 | To have the server choose a free port number to listen on, specify |
|
5401 | To have the server choose a free port number to listen on, specify | |
5327 | a port number of 0; in this case, the server will print the port |
|
5402 | a port number of 0; in this case, the server will print the port | |
5328 | number it uses. |
|
5403 | number it uses. | |
5329 |
|
5404 | |||
5330 | Returns 0 on success. |
|
5405 | Returns 0 on success. | |
5331 | """ |
|
5406 | """ | |
5332 |
|
5407 | |||
5333 | if opts["stdio"] and opts["cmdserver"]: |
|
5408 | if opts["stdio"] and opts["cmdserver"]: | |
5334 | raise util.Abort(_("cannot use --stdio with --cmdserver")) |
|
5409 | raise util.Abort(_("cannot use --stdio with --cmdserver")) | |
5335 |
|
5410 | |||
5336 | if opts["stdio"]: |
|
5411 | if opts["stdio"]: | |
5337 | if repo is None: |
|
5412 | if repo is None: | |
5338 | raise error.RepoError(_("there is no Mercurial repository here" |
|
5413 | raise error.RepoError(_("there is no Mercurial repository here" | |
5339 | " (.hg not found)")) |
|
5414 | " (.hg not found)")) | |
5340 | s = sshserver.sshserver(ui, repo) |
|
5415 | s = sshserver.sshserver(ui, repo) | |
5341 | s.serve_forever() |
|
5416 | s.serve_forever() | |
5342 |
|
5417 | |||
5343 | if opts["cmdserver"]: |
|
5418 | if opts["cmdserver"]: | |
5344 | s = commandserver.server(ui, repo, opts["cmdserver"]) |
|
5419 | s = commandserver.server(ui, repo, opts["cmdserver"]) | |
5345 | return s.serve() |
|
5420 | return s.serve() | |
5346 |
|
5421 | |||
5347 | # this way we can check if something was given in the command-line |
|
5422 | # this way we can check if something was given in the command-line | |
5348 | if opts.get('port'): |
|
5423 | if opts.get('port'): | |
5349 | opts['port'] = util.getport(opts.get('port')) |
|
5424 | opts['port'] = util.getport(opts.get('port')) | |
5350 |
|
5425 | |||
5351 | baseui = repo and repo.baseui or ui |
|
5426 | baseui = repo and repo.baseui or ui | |
5352 | optlist = ("name templates style address port prefix ipv6" |
|
5427 | optlist = ("name templates style address port prefix ipv6" | |
5353 | " accesslog errorlog certificate encoding") |
|
5428 | " accesslog errorlog certificate encoding") | |
5354 | for o in optlist.split(): |
|
5429 | for o in optlist.split(): | |
5355 | val = opts.get(o, '') |
|
5430 | val = opts.get(o, '') | |
5356 | if val in (None, ''): # should check against default options instead |
|
5431 | if val in (None, ''): # should check against default options instead | |
5357 | continue |
|
5432 | continue | |
5358 | baseui.setconfig("web", o, val, 'serve') |
|
5433 | baseui.setconfig("web", o, val, 'serve') | |
5359 | if repo and repo.ui != baseui: |
|
5434 | if repo and repo.ui != baseui: | |
5360 | repo.ui.setconfig("web", o, val, 'serve') |
|
5435 | repo.ui.setconfig("web", o, val, 'serve') | |
5361 |
|
5436 | |||
5362 | o = opts.get('web_conf') or opts.get('webdir_conf') |
|
5437 | o = opts.get('web_conf') or opts.get('webdir_conf') | |
5363 | if not o: |
|
5438 | if not o: | |
5364 | if not repo: |
|
5439 | if not repo: | |
5365 | raise error.RepoError(_("there is no Mercurial repository" |
|
5440 | raise error.RepoError(_("there is no Mercurial repository" | |
5366 | " here (.hg not found)")) |
|
5441 | " here (.hg not found)")) | |
5367 | o = repo |
|
5442 | o = repo | |
5368 |
|
5443 | |||
5369 | app = hgweb.hgweb(o, baseui=baseui) |
|
5444 | app = hgweb.hgweb(o, baseui=baseui) | |
5370 | service = httpservice(ui, app, opts) |
|
5445 | service = httpservice(ui, app, opts) | |
5371 | cmdutil.service(opts, initfn=service.init, runfn=service.run) |
|
5446 | cmdutil.service(opts, initfn=service.init, runfn=service.run) | |
5372 |
|
5447 | |||
5373 | class httpservice(object): |
|
5448 | class httpservice(object): | |
5374 | def __init__(self, ui, app, opts): |
|
5449 | def __init__(self, ui, app, opts): | |
5375 | self.ui = ui |
|
5450 | self.ui = ui | |
5376 | self.app = app |
|
5451 | self.app = app | |
5377 | self.opts = opts |
|
5452 | self.opts = opts | |
5378 |
|
5453 | |||
5379 | def init(self): |
|
5454 | def init(self): | |
5380 | util.setsignalhandler() |
|
5455 | util.setsignalhandler() | |
5381 | self.httpd = hgweb_server.create_server(self.ui, self.app) |
|
5456 | self.httpd = hgweb_server.create_server(self.ui, self.app) | |
5382 |
|
5457 | |||
5383 | if self.opts['port'] and not self.ui.verbose: |
|
5458 | if self.opts['port'] and not self.ui.verbose: | |
5384 | return |
|
5459 | return | |
5385 |
|
5460 | |||
5386 | if self.httpd.prefix: |
|
5461 | if self.httpd.prefix: | |
5387 | prefix = self.httpd.prefix.strip('/') + '/' |
|
5462 | prefix = self.httpd.prefix.strip('/') + '/' | |
5388 | else: |
|
5463 | else: | |
5389 | prefix = '' |
|
5464 | prefix = '' | |
5390 |
|
5465 | |||
5391 | port = ':%d' % self.httpd.port |
|
5466 | port = ':%d' % self.httpd.port | |
5392 | if port == ':80': |
|
5467 | if port == ':80': | |
5393 | port = '' |
|
5468 | port = '' | |
5394 |
|
5469 | |||
5395 | bindaddr = self.httpd.addr |
|
5470 | bindaddr = self.httpd.addr | |
5396 | if bindaddr == '0.0.0.0': |
|
5471 | if bindaddr == '0.0.0.0': | |
5397 | bindaddr = '*' |
|
5472 | bindaddr = '*' | |
5398 | elif ':' in bindaddr: # IPv6 |
|
5473 | elif ':' in bindaddr: # IPv6 | |
5399 | bindaddr = '[%s]' % bindaddr |
|
5474 | bindaddr = '[%s]' % bindaddr | |
5400 |
|
5475 | |||
5401 | fqaddr = self.httpd.fqaddr |
|
5476 | fqaddr = self.httpd.fqaddr | |
5402 | if ':' in fqaddr: |
|
5477 | if ':' in fqaddr: | |
5403 | fqaddr = '[%s]' % fqaddr |
|
5478 | fqaddr = '[%s]' % fqaddr | |
5404 | if self.opts['port']: |
|
5479 | if self.opts['port']: | |
5405 | write = self.ui.status |
|
5480 | write = self.ui.status | |
5406 | else: |
|
5481 | else: | |
5407 | write = self.ui.write |
|
5482 | write = self.ui.write | |
5408 | write(_('listening at http://%s%s/%s (bound to %s:%d)\n') % |
|
5483 | write(_('listening at http://%s%s/%s (bound to %s:%d)\n') % | |
5409 | (fqaddr, port, prefix, bindaddr, self.httpd.port)) |
|
5484 | (fqaddr, port, prefix, bindaddr, self.httpd.port)) | |
5410 | self.ui.flush() # avoid buffering of status message |
|
5485 | self.ui.flush() # avoid buffering of status message | |
5411 |
|
5486 | |||
5412 | def run(self): |
|
5487 | def run(self): | |
5413 | self.httpd.serve_forever() |
|
5488 | self.httpd.serve_forever() | |
5414 |
|
5489 | |||
5415 |
|
5490 | |||
5416 | @command('^status|st', |
|
5491 | @command('^status|st', | |
5417 | [('A', 'all', None, _('show status of all files')), |
|
5492 | [('A', 'all', None, _('show status of all files')), | |
5418 | ('m', 'modified', None, _('show only modified files')), |
|
5493 | ('m', 'modified', None, _('show only modified files')), | |
5419 | ('a', 'added', None, _('show only added files')), |
|
5494 | ('a', 'added', None, _('show only added files')), | |
5420 | ('r', 'removed', None, _('show only removed files')), |
|
5495 | ('r', 'removed', None, _('show only removed files')), | |
5421 | ('d', 'deleted', None, _('show only deleted (but tracked) files')), |
|
5496 | ('d', 'deleted', None, _('show only deleted (but tracked) files')), | |
5422 | ('c', 'clean', None, _('show only files without changes')), |
|
5497 | ('c', 'clean', None, _('show only files without changes')), | |
5423 | ('u', 'unknown', None, _('show only unknown (not tracked) files')), |
|
5498 | ('u', 'unknown', None, _('show only unknown (not tracked) files')), | |
5424 | ('i', 'ignored', None, _('show only ignored files')), |
|
5499 | ('i', 'ignored', None, _('show only ignored files')), | |
5425 | ('n', 'no-status', None, _('hide status prefix')), |
|
5500 | ('n', 'no-status', None, _('hide status prefix')), | |
5426 | ('C', 'copies', None, _('show source of copied files')), |
|
5501 | ('C', 'copies', None, _('show source of copied files')), | |
5427 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), |
|
5502 | ('0', 'print0', None, _('end filenames with NUL, for use with xargs')), | |
5428 | ('', 'rev', [], _('show difference from revision'), _('REV')), |
|
5503 | ('', 'rev', [], _('show difference from revision'), _('REV')), | |
5429 | ('', 'change', '', _('list the changed files of a revision'), _('REV')), |
|
5504 | ('', 'change', '', _('list the changed files of a revision'), _('REV')), | |
5430 | ] + walkopts + subrepoopts, |
|
5505 | ] + walkopts + subrepoopts, | |
5431 | _('[OPTION]... [FILE]...'), |
|
5506 | _('[OPTION]... [FILE]...'), | |
5432 | inferrepo=True) |
|
5507 | inferrepo=True) | |
5433 | def status(ui, repo, *pats, **opts): |
|
5508 | def status(ui, repo, *pats, **opts): | |
5434 | """show changed files in the working directory |
|
5509 | """show changed files in the working directory | |
5435 |
|
5510 | |||
5436 | Show status of files in the repository. If names are given, only |
|
5511 | Show status of files in the repository. If names are given, only | |
5437 | files that match are shown. Files that are clean or ignored or |
|
5512 | files that match are shown. Files that are clean or ignored or | |
5438 | the source of a copy/move operation, are not listed unless |
|
5513 | the source of a copy/move operation, are not listed unless | |
5439 | -c/--clean, -i/--ignored, -C/--copies or -A/--all are given. |
|
5514 | -c/--clean, -i/--ignored, -C/--copies or -A/--all are given. | |
5440 | Unless options described with "show only ..." are given, the |
|
5515 | Unless options described with "show only ..." are given, the | |
5441 | options -mardu are used. |
|
5516 | options -mardu are used. | |
5442 |
|
5517 | |||
5443 | Option -q/--quiet hides untracked (unknown and ignored) files |
|
5518 | Option -q/--quiet hides untracked (unknown and ignored) files | |
5444 | unless explicitly requested with -u/--unknown or -i/--ignored. |
|
5519 | unless explicitly requested with -u/--unknown or -i/--ignored. | |
5445 |
|
5520 | |||
5446 | .. note:: |
|
5521 | .. note:: | |
5447 |
|
5522 | |||
5448 | status may appear to disagree with diff if permissions have |
|
5523 | status may appear to disagree with diff if permissions have | |
5449 | changed or a merge has occurred. The standard diff format does |
|
5524 | changed or a merge has occurred. The standard diff format does | |
5450 | not report permission changes and diff only reports changes |
|
5525 | not report permission changes and diff only reports changes | |
5451 | relative to one merge parent. |
|
5526 | relative to one merge parent. | |
5452 |
|
5527 | |||
5453 | If one revision is given, it is used as the base revision. |
|
5528 | If one revision is given, it is used as the base revision. | |
5454 | If two revisions are given, the differences between them are |
|
5529 | If two revisions are given, the differences between them are | |
5455 | shown. The --change option can also be used as a shortcut to list |
|
5530 | shown. The --change option can also be used as a shortcut to list | |
5456 | the changed files of a revision from its first parent. |
|
5531 | the changed files of a revision from its first parent. | |
5457 |
|
5532 | |||
5458 | The codes used to show the status of files are:: |
|
5533 | The codes used to show the status of files are:: | |
5459 |
|
5534 | |||
5460 | M = modified |
|
5535 | M = modified | |
5461 | A = added |
|
5536 | A = added | |
5462 | R = removed |
|
5537 | R = removed | |
5463 | C = clean |
|
5538 | C = clean | |
5464 | ! = missing (deleted by non-hg command, but still tracked) |
|
5539 | ! = missing (deleted by non-hg command, but still tracked) | |
5465 | ? = not tracked |
|
5540 | ? = not tracked | |
5466 | I = ignored |
|
5541 | I = ignored | |
5467 | = origin of the previous file (with --copies) |
|
5542 | = origin of the previous file (with --copies) | |
5468 |
|
5543 | |||
5469 | .. container:: verbose |
|
5544 | .. container:: verbose | |
5470 |
|
5545 | |||
5471 | Examples: |
|
5546 | Examples: | |
5472 |
|
5547 | |||
5473 | - show changes in the working directory relative to a |
|
5548 | - show changes in the working directory relative to a | |
5474 | changeset:: |
|
5549 | changeset:: | |
5475 |
|
5550 | |||
5476 | hg status --rev 9353 |
|
5551 | hg status --rev 9353 | |
5477 |
|
5552 | |||
5478 | - show all changes including copies in an existing changeset:: |
|
5553 | - show all changes including copies in an existing changeset:: | |
5479 |
|
5554 | |||
5480 | hg status --copies --change 9353 |
|
5555 | hg status --copies --change 9353 | |
5481 |
|
5556 | |||
5482 | - get a NUL separated list of added files, suitable for xargs:: |
|
5557 | - get a NUL separated list of added files, suitable for xargs:: | |
5483 |
|
5558 | |||
5484 | hg status -an0 |
|
5559 | hg status -an0 | |
5485 |
|
5560 | |||
5486 | Returns 0 on success. |
|
5561 | Returns 0 on success. | |
5487 | """ |
|
5562 | """ | |
5488 |
|
5563 | |||
5489 | revs = opts.get('rev') |
|
5564 | revs = opts.get('rev') | |
5490 | change = opts.get('change') |
|
5565 | change = opts.get('change') | |
5491 |
|
5566 | |||
5492 | if revs and change: |
|
5567 | if revs and change: | |
5493 | msg = _('cannot specify --rev and --change at the same time') |
|
5568 | msg = _('cannot specify --rev and --change at the same time') | |
5494 | raise util.Abort(msg) |
|
5569 | raise util.Abort(msg) | |
5495 | elif change: |
|
5570 | elif change: | |
5496 | node2 = scmutil.revsingle(repo, change, None).node() |
|
5571 | node2 = scmutil.revsingle(repo, change, None).node() | |
5497 | node1 = repo[node2].p1().node() |
|
5572 | node1 = repo[node2].p1().node() | |
5498 | else: |
|
5573 | else: | |
5499 | node1, node2 = scmutil.revpair(repo, revs) |
|
5574 | node1, node2 = scmutil.revpair(repo, revs) | |
5500 |
|
5575 | |||
5501 | cwd = (pats and repo.getcwd()) or '' |
|
5576 | cwd = (pats and repo.getcwd()) or '' | |
5502 | end = opts.get('print0') and '\0' or '\n' |
|
5577 | end = opts.get('print0') and '\0' or '\n' | |
5503 | copy = {} |
|
5578 | copy = {} | |
5504 | states = 'modified added removed deleted unknown ignored clean'.split() |
|
5579 | states = 'modified added removed deleted unknown ignored clean'.split() | |
5505 | show = [k for k in states if opts.get(k)] |
|
5580 | show = [k for k in states if opts.get(k)] | |
5506 | if opts.get('all'): |
|
5581 | if opts.get('all'): | |
5507 | show += ui.quiet and (states[:4] + ['clean']) or states |
|
5582 | show += ui.quiet and (states[:4] + ['clean']) or states | |
5508 | if not show: |
|
5583 | if not show: | |
5509 | show = ui.quiet and states[:4] or states[:5] |
|
5584 | show = ui.quiet and states[:4] or states[:5] | |
5510 |
|
5585 | |||
5511 | stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts), |
|
5586 | stat = repo.status(node1, node2, scmutil.match(repo[node2], pats, opts), | |
5512 | 'ignored' in show, 'clean' in show, 'unknown' in show, |
|
5587 | 'ignored' in show, 'clean' in show, 'unknown' in show, | |
5513 | opts.get('subrepos')) |
|
5588 | opts.get('subrepos')) | |
5514 | changestates = zip(states, 'MAR!?IC', stat) |
|
5589 | changestates = zip(states, 'MAR!?IC', stat) | |
5515 |
|
5590 | |||
5516 | if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'): |
|
5591 | if (opts.get('all') or opts.get('copies')) and not opts.get('no_status'): | |
5517 | copy = copies.pathcopies(repo[node1], repo[node2]) |
|
5592 | copy = copies.pathcopies(repo[node1], repo[node2]) | |
5518 |
|
5593 | |||
5519 | fm = ui.formatter('status', opts) |
|
5594 | fm = ui.formatter('status', opts) | |
5520 | fmt = '%s' + end |
|
5595 | fmt = '%s' + end | |
5521 | showchar = not opts.get('no_status') |
|
5596 | showchar = not opts.get('no_status') | |
5522 |
|
5597 | |||
5523 | for state, char, files in changestates: |
|
5598 | for state, char, files in changestates: | |
5524 | if state in show: |
|
5599 | if state in show: | |
5525 | label = 'status.' + state |
|
5600 | label = 'status.' + state | |
5526 | for f in files: |
|
5601 | for f in files: | |
5527 | fm.startitem() |
|
5602 | fm.startitem() | |
5528 | fm.condwrite(showchar, 'status', '%s ', char, label=label) |
|
5603 | fm.condwrite(showchar, 'status', '%s ', char, label=label) | |
5529 | fm.write('path', fmt, repo.pathto(f, cwd), label=label) |
|
5604 | fm.write('path', fmt, repo.pathto(f, cwd), label=label) | |
5530 | if f in copy: |
|
5605 | if f in copy: | |
5531 | fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd), |
|
5606 | fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd), | |
5532 | label='status.copied') |
|
5607 | label='status.copied') | |
5533 | fm.end() |
|
5608 | fm.end() | |
5534 |
|
5609 | |||
5535 | @command('^summary|sum', |
|
5610 | @command('^summary|sum', | |
5536 | [('', 'remote', None, _('check for push and pull'))], '[--remote]') |
|
5611 | [('', 'remote', None, _('check for push and pull'))], '[--remote]') | |
5537 | def summary(ui, repo, **opts): |
|
5612 | def summary(ui, repo, **opts): | |
5538 | """summarize working directory state |
|
5613 | """summarize working directory state | |
5539 |
|
5614 | |||
5540 | This generates a brief summary of the working directory state, |
|
5615 | This generates a brief summary of the working directory state, | |
5541 | including parents, branch, commit status, and available updates. |
|
5616 | including parents, branch, commit status, and available updates. | |
5542 |
|
5617 | |||
5543 | With the --remote option, this will check the default paths for |
|
5618 | With the --remote option, this will check the default paths for | |
5544 | incoming and outgoing changes. This can be time-consuming. |
|
5619 | incoming and outgoing changes. This can be time-consuming. | |
5545 |
|
5620 | |||
5546 | Returns 0 on success. |
|
5621 | Returns 0 on success. | |
5547 | """ |
|
5622 | """ | |
5548 |
|
5623 | |||
5549 | ctx = repo[None] |
|
5624 | ctx = repo[None] | |
5550 | parents = ctx.parents() |
|
5625 | parents = ctx.parents() | |
5551 | pnode = parents[0].node() |
|
5626 | pnode = parents[0].node() | |
5552 | marks = [] |
|
5627 | marks = [] | |
5553 |
|
5628 | |||
5554 | for p in parents: |
|
5629 | for p in parents: | |
5555 | # label with log.changeset (instead of log.parent) since this |
|
5630 | # label with log.changeset (instead of log.parent) since this | |
5556 | # shows a working directory parent *changeset*: |
|
5631 | # shows a working directory parent *changeset*: | |
5557 | # i18n: column positioning for "hg summary" |
|
5632 | # i18n: column positioning for "hg summary" | |
5558 | ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), |
|
5633 | ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), | |
5559 | label='log.changeset changeset.%s' % p.phasestr()) |
|
5634 | label='log.changeset changeset.%s' % p.phasestr()) | |
5560 | ui.write(' '.join(p.tags()), label='log.tag') |
|
5635 | ui.write(' '.join(p.tags()), label='log.tag') | |
5561 | if p.bookmarks(): |
|
5636 | if p.bookmarks(): | |
5562 | marks.extend(p.bookmarks()) |
|
5637 | marks.extend(p.bookmarks()) | |
5563 | if p.rev() == -1: |
|
5638 | if p.rev() == -1: | |
5564 | if not len(repo): |
|
5639 | if not len(repo): | |
5565 | ui.write(_(' (empty repository)')) |
|
5640 | ui.write(_(' (empty repository)')) | |
5566 | else: |
|
5641 | else: | |
5567 | ui.write(_(' (no revision checked out)')) |
|
5642 | ui.write(_(' (no revision checked out)')) | |
5568 | ui.write('\n') |
|
5643 | ui.write('\n') | |
5569 | if p.description(): |
|
5644 | if p.description(): | |
5570 | ui.status(' ' + p.description().splitlines()[0].strip() + '\n', |
|
5645 | ui.status(' ' + p.description().splitlines()[0].strip() + '\n', | |
5571 | label='log.summary') |
|
5646 | label='log.summary') | |
5572 |
|
5647 | |||
5573 | branch = ctx.branch() |
|
5648 | branch = ctx.branch() | |
5574 | bheads = repo.branchheads(branch) |
|
5649 | bheads = repo.branchheads(branch) | |
5575 | # i18n: column positioning for "hg summary" |
|
5650 | # i18n: column positioning for "hg summary" | |
5576 | m = _('branch: %s\n') % branch |
|
5651 | m = _('branch: %s\n') % branch | |
5577 | if branch != 'default': |
|
5652 | if branch != 'default': | |
5578 | ui.write(m, label='log.branch') |
|
5653 | ui.write(m, label='log.branch') | |
5579 | else: |
|
5654 | else: | |
5580 | ui.status(m, label='log.branch') |
|
5655 | ui.status(m, label='log.branch') | |
5581 |
|
5656 | |||
5582 | if marks: |
|
5657 | if marks: | |
5583 | current = repo._bookmarkcurrent |
|
5658 | current = repo._bookmarkcurrent | |
5584 | # i18n: column positioning for "hg summary" |
|
5659 | # i18n: column positioning for "hg summary" | |
5585 | ui.write(_('bookmarks:'), label='log.bookmark') |
|
5660 | ui.write(_('bookmarks:'), label='log.bookmark') | |
5586 | if current is not None: |
|
5661 | if current is not None: | |
5587 | if current in marks: |
|
5662 | if current in marks: | |
5588 | ui.write(' *' + current, label='bookmarks.current') |
|
5663 | ui.write(' *' + current, label='bookmarks.current') | |
5589 | marks.remove(current) |
|
5664 | marks.remove(current) | |
5590 | else: |
|
5665 | else: | |
5591 | ui.write(' [%s]' % current, label='bookmarks.current') |
|
5666 | ui.write(' [%s]' % current, label='bookmarks.current') | |
5592 | for m in marks: |
|
5667 | for m in marks: | |
5593 | ui.write(' ' + m, label='log.bookmark') |
|
5668 | ui.write(' ' + m, label='log.bookmark') | |
5594 | ui.write('\n', label='log.bookmark') |
|
5669 | ui.write('\n', label='log.bookmark') | |
5595 |
|
5670 | |||
5596 | st = list(repo.status(unknown=True))[:6] |
|
5671 | st = list(repo.status(unknown=True))[:6] | |
5597 |
|
5672 | |||
5598 | c = repo.dirstate.copies() |
|
5673 | c = repo.dirstate.copies() | |
5599 | copied, renamed = [], [] |
|
5674 | copied, renamed = [], [] | |
5600 | for d, s in c.iteritems(): |
|
5675 | for d, s in c.iteritems(): | |
5601 | if s in st[2]: |
|
5676 | if s in st[2]: | |
5602 | st[2].remove(s) |
|
5677 | st[2].remove(s) | |
5603 | renamed.append(d) |
|
5678 | renamed.append(d) | |
5604 | else: |
|
5679 | else: | |
5605 | copied.append(d) |
|
5680 | copied.append(d) | |
5606 | if d in st[1]: |
|
5681 | if d in st[1]: | |
5607 | st[1].remove(d) |
|
5682 | st[1].remove(d) | |
5608 | st.insert(3, renamed) |
|
5683 | st.insert(3, renamed) | |
5609 | st.insert(4, copied) |
|
5684 | st.insert(4, copied) | |
5610 |
|
5685 | |||
5611 | ms = mergemod.mergestate(repo) |
|
5686 | ms = mergemod.mergestate(repo) | |
5612 | st.append([f for f in ms if ms[f] == 'u']) |
|
5687 | st.append([f for f in ms if ms[f] == 'u']) | |
5613 |
|
5688 | |||
5614 | subs = [s for s in ctx.substate if ctx.sub(s).dirty()] |
|
5689 | subs = [s for s in ctx.substate if ctx.sub(s).dirty()] | |
5615 | st.append(subs) |
|
5690 | st.append(subs) | |
5616 |
|
5691 | |||
5617 | labels = [ui.label(_('%d modified'), 'status.modified'), |
|
5692 | labels = [ui.label(_('%d modified'), 'status.modified'), | |
5618 | ui.label(_('%d added'), 'status.added'), |
|
5693 | ui.label(_('%d added'), 'status.added'), | |
5619 | ui.label(_('%d removed'), 'status.removed'), |
|
5694 | ui.label(_('%d removed'), 'status.removed'), | |
5620 | ui.label(_('%d renamed'), 'status.copied'), |
|
5695 | ui.label(_('%d renamed'), 'status.copied'), | |
5621 | ui.label(_('%d copied'), 'status.copied'), |
|
5696 | ui.label(_('%d copied'), 'status.copied'), | |
5622 | ui.label(_('%d deleted'), 'status.deleted'), |
|
5697 | ui.label(_('%d deleted'), 'status.deleted'), | |
5623 | ui.label(_('%d unknown'), 'status.unknown'), |
|
5698 | ui.label(_('%d unknown'), 'status.unknown'), | |
5624 | ui.label(_('%d ignored'), 'status.ignored'), |
|
5699 | ui.label(_('%d ignored'), 'status.ignored'), | |
5625 | ui.label(_('%d unresolved'), 'resolve.unresolved'), |
|
5700 | ui.label(_('%d unresolved'), 'resolve.unresolved'), | |
5626 | ui.label(_('%d subrepos'), 'status.modified')] |
|
5701 | ui.label(_('%d subrepos'), 'status.modified')] | |
5627 | t = [] |
|
5702 | t = [] | |
5628 | for s, l in zip(st, labels): |
|
5703 | for s, l in zip(st, labels): | |
5629 | if s: |
|
5704 | if s: | |
5630 | t.append(l % len(s)) |
|
5705 | t.append(l % len(s)) | |
5631 |
|
5706 | |||
5632 | t = ', '.join(t) |
|
5707 | t = ', '.join(t) | |
5633 | cleanworkdir = False |
|
5708 | cleanworkdir = False | |
5634 |
|
5709 | |||
5635 | if repo.vfs.exists('updatestate'): |
|
5710 | if repo.vfs.exists('updatestate'): | |
5636 | t += _(' (interrupted update)') |
|
5711 | t += _(' (interrupted update)') | |
5637 | elif len(parents) > 1: |
|
5712 | elif len(parents) > 1: | |
5638 | t += _(' (merge)') |
|
5713 | t += _(' (merge)') | |
5639 | elif branch != parents[0].branch(): |
|
5714 | elif branch != parents[0].branch(): | |
5640 | t += _(' (new branch)') |
|
5715 | t += _(' (new branch)') | |
5641 | elif (parents[0].closesbranch() and |
|
5716 | elif (parents[0].closesbranch() and | |
5642 | pnode in repo.branchheads(branch, closed=True)): |
|
5717 | pnode in repo.branchheads(branch, closed=True)): | |
5643 | t += _(' (head closed)') |
|
5718 | t += _(' (head closed)') | |
5644 | elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]): |
|
5719 | elif not (st[0] or st[1] or st[2] or st[3] or st[4] or st[9]): | |
5645 | t += _(' (clean)') |
|
5720 | t += _(' (clean)') | |
5646 | cleanworkdir = True |
|
5721 | cleanworkdir = True | |
5647 | elif pnode not in bheads: |
|
5722 | elif pnode not in bheads: | |
5648 | t += _(' (new branch head)') |
|
5723 | t += _(' (new branch head)') | |
5649 |
|
5724 | |||
5650 | if cleanworkdir: |
|
5725 | if cleanworkdir: | |
5651 | # i18n: column positioning for "hg summary" |
|
5726 | # i18n: column positioning for "hg summary" | |
5652 | ui.status(_('commit: %s\n') % t.strip()) |
|
5727 | ui.status(_('commit: %s\n') % t.strip()) | |
5653 | else: |
|
5728 | else: | |
5654 | # i18n: column positioning for "hg summary" |
|
5729 | # i18n: column positioning for "hg summary" | |
5655 | ui.write(_('commit: %s\n') % t.strip()) |
|
5730 | ui.write(_('commit: %s\n') % t.strip()) | |
5656 |
|
5731 | |||
5657 | # all ancestors of branch heads - all ancestors of parent = new csets |
|
5732 | # all ancestors of branch heads - all ancestors of parent = new csets | |
5658 | new = len(repo.changelog.findmissing([pctx.node() for pctx in parents], |
|
5733 | new = len(repo.changelog.findmissing([pctx.node() for pctx in parents], | |
5659 | bheads)) |
|
5734 | bheads)) | |
5660 |
|
5735 | |||
5661 | if new == 0: |
|
5736 | if new == 0: | |
5662 | # i18n: column positioning for "hg summary" |
|
5737 | # i18n: column positioning for "hg summary" | |
5663 | ui.status(_('update: (current)\n')) |
|
5738 | ui.status(_('update: (current)\n')) | |
5664 | elif pnode not in bheads: |
|
5739 | elif pnode not in bheads: | |
5665 | # i18n: column positioning for "hg summary" |
|
5740 | # i18n: column positioning for "hg summary" | |
5666 | ui.write(_('update: %d new changesets (update)\n') % new) |
|
5741 | ui.write(_('update: %d new changesets (update)\n') % new) | |
5667 | else: |
|
5742 | else: | |
5668 | # i18n: column positioning for "hg summary" |
|
5743 | # i18n: column positioning for "hg summary" | |
5669 | ui.write(_('update: %d new changesets, %d branch heads (merge)\n') % |
|
5744 | ui.write(_('update: %d new changesets, %d branch heads (merge)\n') % | |
5670 | (new, len(bheads))) |
|
5745 | (new, len(bheads))) | |
5671 |
|
5746 | |||
5672 | cmdutil.summaryhooks(ui, repo) |
|
5747 | cmdutil.summaryhooks(ui, repo) | |
5673 |
|
5748 | |||
5674 | if opts.get('remote'): |
|
5749 | if opts.get('remote'): | |
5675 | needsincoming, needsoutgoing = True, True |
|
5750 | needsincoming, needsoutgoing = True, True | |
5676 | else: |
|
5751 | else: | |
5677 | needsincoming, needsoutgoing = False, False |
|
5752 | needsincoming, needsoutgoing = False, False | |
5678 | for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None): |
|
5753 | for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None): | |
5679 | if i: |
|
5754 | if i: | |
5680 | needsincoming = True |
|
5755 | needsincoming = True | |
5681 | if o: |
|
5756 | if o: | |
5682 | needsoutgoing = True |
|
5757 | needsoutgoing = True | |
5683 | if not needsincoming and not needsoutgoing: |
|
5758 | if not needsincoming and not needsoutgoing: | |
5684 | return |
|
5759 | return | |
5685 |
|
5760 | |||
5686 | def getincoming(): |
|
5761 | def getincoming(): | |
5687 | source, branches = hg.parseurl(ui.expandpath('default')) |
|
5762 | source, branches = hg.parseurl(ui.expandpath('default')) | |
5688 | sbranch = branches[0] |
|
5763 | sbranch = branches[0] | |
5689 | try: |
|
5764 | try: | |
5690 | other = hg.peer(repo, {}, source) |
|
5765 | other = hg.peer(repo, {}, source) | |
5691 | except error.RepoError: |
|
5766 | except error.RepoError: | |
5692 | if opts.get('remote'): |
|
5767 | if opts.get('remote'): | |
5693 | raise |
|
5768 | raise | |
5694 | return source, sbranch, None, None, None |
|
5769 | return source, sbranch, None, None, None | |
5695 | revs, checkout = hg.addbranchrevs(repo, other, branches, None) |
|
5770 | revs, checkout = hg.addbranchrevs(repo, other, branches, None) | |
5696 | if revs: |
|
5771 | if revs: | |
5697 | revs = [other.lookup(rev) for rev in revs] |
|
5772 | revs = [other.lookup(rev) for rev in revs] | |
5698 | ui.debug('comparing with %s\n' % util.hidepassword(source)) |
|
5773 | ui.debug('comparing with %s\n' % util.hidepassword(source)) | |
5699 | repo.ui.pushbuffer() |
|
5774 | repo.ui.pushbuffer() | |
5700 | commoninc = discovery.findcommonincoming(repo, other, heads=revs) |
|
5775 | commoninc = discovery.findcommonincoming(repo, other, heads=revs) | |
5701 | repo.ui.popbuffer() |
|
5776 | repo.ui.popbuffer() | |
5702 | return source, sbranch, other, commoninc, commoninc[1] |
|
5777 | return source, sbranch, other, commoninc, commoninc[1] | |
5703 |
|
5778 | |||
5704 | if needsincoming: |
|
5779 | if needsincoming: | |
5705 | source, sbranch, sother, commoninc, incoming = getincoming() |
|
5780 | source, sbranch, sother, commoninc, incoming = getincoming() | |
5706 | else: |
|
5781 | else: | |
5707 | source = sbranch = sother = commoninc = incoming = None |
|
5782 | source = sbranch = sother = commoninc = incoming = None | |
5708 |
|
5783 | |||
5709 | def getoutgoing(): |
|
5784 | def getoutgoing(): | |
5710 | dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) |
|
5785 | dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) | |
5711 | dbranch = branches[0] |
|
5786 | dbranch = branches[0] | |
5712 | revs, checkout = hg.addbranchrevs(repo, repo, branches, None) |
|
5787 | revs, checkout = hg.addbranchrevs(repo, repo, branches, None) | |
5713 | if source != dest: |
|
5788 | if source != dest: | |
5714 | try: |
|
5789 | try: | |
5715 | dother = hg.peer(repo, {}, dest) |
|
5790 | dother = hg.peer(repo, {}, dest) | |
5716 | except error.RepoError: |
|
5791 | except error.RepoError: | |
5717 | if opts.get('remote'): |
|
5792 | if opts.get('remote'): | |
5718 | raise |
|
5793 | raise | |
5719 | return dest, dbranch, None, None |
|
5794 | return dest, dbranch, None, None | |
5720 | ui.debug('comparing with %s\n' % util.hidepassword(dest)) |
|
5795 | ui.debug('comparing with %s\n' % util.hidepassword(dest)) | |
5721 | elif sother is None: |
|
5796 | elif sother is None: | |
5722 | # there is no explicit destination peer, but source one is invalid |
|
5797 | # there is no explicit destination peer, but source one is invalid | |
5723 | return dest, dbranch, None, None |
|
5798 | return dest, dbranch, None, None | |
5724 | else: |
|
5799 | else: | |
5725 | dother = sother |
|
5800 | dother = sother | |
5726 | if (source != dest or (sbranch is not None and sbranch != dbranch)): |
|
5801 | if (source != dest or (sbranch is not None and sbranch != dbranch)): | |
5727 | common = None |
|
5802 | common = None | |
5728 | else: |
|
5803 | else: | |
5729 | common = commoninc |
|
5804 | common = commoninc | |
5730 | if revs: |
|
5805 | if revs: | |
5731 | revs = [repo.lookup(rev) for rev in revs] |
|
5806 | revs = [repo.lookup(rev) for rev in revs] | |
5732 | repo.ui.pushbuffer() |
|
5807 | repo.ui.pushbuffer() | |
5733 | outgoing = discovery.findcommonoutgoing(repo, dother, onlyheads=revs, |
|
5808 | outgoing = discovery.findcommonoutgoing(repo, dother, onlyheads=revs, | |
5734 | commoninc=common) |
|
5809 | commoninc=common) | |
5735 | repo.ui.popbuffer() |
|
5810 | repo.ui.popbuffer() | |
5736 | return dest, dbranch, dother, outgoing |
|
5811 | return dest, dbranch, dother, outgoing | |
5737 |
|
5812 | |||
5738 | if needsoutgoing: |
|
5813 | if needsoutgoing: | |
5739 | dest, dbranch, dother, outgoing = getoutgoing() |
|
5814 | dest, dbranch, dother, outgoing = getoutgoing() | |
5740 | else: |
|
5815 | else: | |
5741 | dest = dbranch = dother = outgoing = None |
|
5816 | dest = dbranch = dother = outgoing = None | |
5742 |
|
5817 | |||
5743 | if opts.get('remote'): |
|
5818 | if opts.get('remote'): | |
5744 | t = [] |
|
5819 | t = [] | |
5745 | if incoming: |
|
5820 | if incoming: | |
5746 | t.append(_('1 or more incoming')) |
|
5821 | t.append(_('1 or more incoming')) | |
5747 | o = outgoing.missing |
|
5822 | o = outgoing.missing | |
5748 | if o: |
|
5823 | if o: | |
5749 | t.append(_('%d outgoing') % len(o)) |
|
5824 | t.append(_('%d outgoing') % len(o)) | |
5750 | other = dother or sother |
|
5825 | other = dother or sother | |
5751 | if 'bookmarks' in other.listkeys('namespaces'): |
|
5826 | if 'bookmarks' in other.listkeys('namespaces'): | |
5752 | lmarks = repo.listkeys('bookmarks') |
|
5827 | lmarks = repo.listkeys('bookmarks') | |
5753 | rmarks = other.listkeys('bookmarks') |
|
5828 | rmarks = other.listkeys('bookmarks') | |
5754 | diff = set(rmarks) - set(lmarks) |
|
5829 | diff = set(rmarks) - set(lmarks) | |
5755 | if len(diff) > 0: |
|
5830 | if len(diff) > 0: | |
5756 | t.append(_('%d incoming bookmarks') % len(diff)) |
|
5831 | t.append(_('%d incoming bookmarks') % len(diff)) | |
5757 | diff = set(lmarks) - set(rmarks) |
|
5832 | diff = set(lmarks) - set(rmarks) | |
5758 | if len(diff) > 0: |
|
5833 | if len(diff) > 0: | |
5759 | t.append(_('%d outgoing bookmarks') % len(diff)) |
|
5834 | t.append(_('%d outgoing bookmarks') % len(diff)) | |
5760 |
|
5835 | |||
5761 | if t: |
|
5836 | if t: | |
5762 | # i18n: column positioning for "hg summary" |
|
5837 | # i18n: column positioning for "hg summary" | |
5763 | ui.write(_('remote: %s\n') % (', '.join(t))) |
|
5838 | ui.write(_('remote: %s\n') % (', '.join(t))) | |
5764 | else: |
|
5839 | else: | |
5765 | # i18n: column positioning for "hg summary" |
|
5840 | # i18n: column positioning for "hg summary" | |
5766 | ui.status(_('remote: (synced)\n')) |
|
5841 | ui.status(_('remote: (synced)\n')) | |
5767 |
|
5842 | |||
5768 | cmdutil.summaryremotehooks(ui, repo, opts, |
|
5843 | cmdutil.summaryremotehooks(ui, repo, opts, | |
5769 | ((source, sbranch, sother, commoninc), |
|
5844 | ((source, sbranch, sother, commoninc), | |
5770 | (dest, dbranch, dother, outgoing))) |
|
5845 | (dest, dbranch, dother, outgoing))) | |
5771 |
|
5846 | |||
5772 | @command('tag', |
|
5847 | @command('tag', | |
5773 | [('f', 'force', None, _('force tag')), |
|
5848 | [('f', 'force', None, _('force tag')), | |
5774 | ('l', 'local', None, _('make the tag local')), |
|
5849 | ('l', 'local', None, _('make the tag local')), | |
5775 | ('r', 'rev', '', _('revision to tag'), _('REV')), |
|
5850 | ('r', 'rev', '', _('revision to tag'), _('REV')), | |
5776 | ('', 'remove', None, _('remove a tag')), |
|
5851 | ('', 'remove', None, _('remove a tag')), | |
5777 | # -l/--local is already there, commitopts cannot be used |
|
5852 | # -l/--local is already there, commitopts cannot be used | |
5778 | ('e', 'edit', None, _('invoke editor on commit messages')), |
|
5853 | ('e', 'edit', None, _('invoke editor on commit messages')), | |
5779 | ('m', 'message', '', _('use text as commit message'), _('TEXT')), |
|
5854 | ('m', 'message', '', _('use text as commit message'), _('TEXT')), | |
5780 | ] + commitopts2, |
|
5855 | ] + commitopts2, | |
5781 | _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')) |
|
5856 | _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')) | |
5782 | def tag(ui, repo, name1, *names, **opts): |
|
5857 | def tag(ui, repo, name1, *names, **opts): | |
5783 | """add one or more tags for the current or given revision |
|
5858 | """add one or more tags for the current or given revision | |
5784 |
|
5859 | |||
5785 | Name a particular revision using <name>. |
|
5860 | Name a particular revision using <name>. | |
5786 |
|
5861 | |||
5787 | Tags are used to name particular revisions of the repository and are |
|
5862 | Tags are used to name particular revisions of the repository and are | |
5788 | very useful to compare different revisions, to go back to significant |
|
5863 | very useful to compare different revisions, to go back to significant | |
5789 | earlier versions or to mark branch points as releases, etc. Changing |
|
5864 | earlier versions or to mark branch points as releases, etc. Changing | |
5790 | an existing tag is normally disallowed; use -f/--force to override. |
|
5865 | an existing tag is normally disallowed; use -f/--force to override. | |
5791 |
|
5866 | |||
5792 | If no revision is given, the parent of the working directory is |
|
5867 | If no revision is given, the parent of the working directory is | |
5793 | used. |
|
5868 | used. | |
5794 |
|
5869 | |||
5795 | To facilitate version control, distribution, and merging of tags, |
|
5870 | To facilitate version control, distribution, and merging of tags, | |
5796 | they are stored as a file named ".hgtags" which is managed similarly |
|
5871 | they are stored as a file named ".hgtags" which is managed similarly | |
5797 | to other project files and can be hand-edited if necessary. This |
|
5872 | to other project files and can be hand-edited if necessary. This | |
5798 | also means that tagging creates a new commit. The file |
|
5873 | also means that tagging creates a new commit. The file | |
5799 | ".hg/localtags" is used for local tags (not shared among |
|
5874 | ".hg/localtags" is used for local tags (not shared among | |
5800 | repositories). |
|
5875 | repositories). | |
5801 |
|
5876 | |||
5802 | Tag commits are usually made at the head of a branch. If the parent |
|
5877 | Tag commits are usually made at the head of a branch. If the parent | |
5803 | of the working directory is not a branch head, :hg:`tag` aborts; use |
|
5878 | of the working directory is not a branch head, :hg:`tag` aborts; use | |
5804 | -f/--force to force the tag commit to be based on a non-head |
|
5879 | -f/--force to force the tag commit to be based on a non-head | |
5805 | changeset. |
|
5880 | changeset. | |
5806 |
|
5881 | |||
5807 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
5882 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
5808 |
|
5883 | |||
5809 | Since tag names have priority over branch names during revision |
|
5884 | Since tag names have priority over branch names during revision | |
5810 | lookup, using an existing branch name as a tag name is discouraged. |
|
5885 | lookup, using an existing branch name as a tag name is discouraged. | |
5811 |
|
5886 | |||
5812 | Returns 0 on success. |
|
5887 | Returns 0 on success. | |
5813 | """ |
|
5888 | """ | |
5814 | wlock = lock = None |
|
5889 | wlock = lock = None | |
5815 | try: |
|
5890 | try: | |
5816 | wlock = repo.wlock() |
|
5891 | wlock = repo.wlock() | |
5817 | lock = repo.lock() |
|
5892 | lock = repo.lock() | |
5818 | rev_ = "." |
|
5893 | rev_ = "." | |
5819 | names = [t.strip() for t in (name1,) + names] |
|
5894 | names = [t.strip() for t in (name1,) + names] | |
5820 | if len(names) != len(set(names)): |
|
5895 | if len(names) != len(set(names)): | |
5821 | raise util.Abort(_('tag names must be unique')) |
|
5896 | raise util.Abort(_('tag names must be unique')) | |
5822 | for n in names: |
|
5897 | for n in names: | |
5823 | scmutil.checknewlabel(repo, n, 'tag') |
|
5898 | scmutil.checknewlabel(repo, n, 'tag') | |
5824 | if not n: |
|
5899 | if not n: | |
5825 | raise util.Abort(_('tag names cannot consist entirely of ' |
|
5900 | raise util.Abort(_('tag names cannot consist entirely of ' | |
5826 | 'whitespace')) |
|
5901 | 'whitespace')) | |
5827 | if opts.get('rev') and opts.get('remove'): |
|
5902 | if opts.get('rev') and opts.get('remove'): | |
5828 | raise util.Abort(_("--rev and --remove are incompatible")) |
|
5903 | raise util.Abort(_("--rev and --remove are incompatible")) | |
5829 | if opts.get('rev'): |
|
5904 | if opts.get('rev'): | |
5830 | rev_ = opts['rev'] |
|
5905 | rev_ = opts['rev'] | |
5831 | message = opts.get('message') |
|
5906 | message = opts.get('message') | |
5832 | if opts.get('remove'): |
|
5907 | if opts.get('remove'): | |
5833 | expectedtype = opts.get('local') and 'local' or 'global' |
|
5908 | expectedtype = opts.get('local') and 'local' or 'global' | |
5834 | for n in names: |
|
5909 | for n in names: | |
5835 | if not repo.tagtype(n): |
|
5910 | if not repo.tagtype(n): | |
5836 | raise util.Abort(_("tag '%s' does not exist") % n) |
|
5911 | raise util.Abort(_("tag '%s' does not exist") % n) | |
5837 | if repo.tagtype(n) != expectedtype: |
|
5912 | if repo.tagtype(n) != expectedtype: | |
5838 | if expectedtype == 'global': |
|
5913 | if expectedtype == 'global': | |
5839 | raise util.Abort(_("tag '%s' is not a global tag") % n) |
|
5914 | raise util.Abort(_("tag '%s' is not a global tag") % n) | |
5840 | else: |
|
5915 | else: | |
5841 | raise util.Abort(_("tag '%s' is not a local tag") % n) |
|
5916 | raise util.Abort(_("tag '%s' is not a local tag") % n) | |
5842 | rev_ = nullid |
|
5917 | rev_ = nullid | |
5843 | if not message: |
|
5918 | if not message: | |
5844 | # we don't translate commit messages |
|
5919 | # we don't translate commit messages | |
5845 | message = 'Removed tag %s' % ', '.join(names) |
|
5920 | message = 'Removed tag %s' % ', '.join(names) | |
5846 | elif not opts.get('force'): |
|
5921 | elif not opts.get('force'): | |
5847 | for n in names: |
|
5922 | for n in names: | |
5848 | if n in repo.tags(): |
|
5923 | if n in repo.tags(): | |
5849 | raise util.Abort(_("tag '%s' already exists " |
|
5924 | raise util.Abort(_("tag '%s' already exists " | |
5850 | "(use -f to force)") % n) |
|
5925 | "(use -f to force)") % n) | |
5851 | if not opts.get('local'): |
|
5926 | if not opts.get('local'): | |
5852 | p1, p2 = repo.dirstate.parents() |
|
5927 | p1, p2 = repo.dirstate.parents() | |
5853 | if p2 != nullid: |
|
5928 | if p2 != nullid: | |
5854 | raise util.Abort(_('uncommitted merge')) |
|
5929 | raise util.Abort(_('uncommitted merge')) | |
5855 | bheads = repo.branchheads() |
|
5930 | bheads = repo.branchheads() | |
5856 | if not opts.get('force') and bheads and p1 not in bheads: |
|
5931 | if not opts.get('force') and bheads and p1 not in bheads: | |
5857 | raise util.Abort(_('not at a branch head (use -f to force)')) |
|
5932 | raise util.Abort(_('not at a branch head (use -f to force)')) | |
5858 | r = scmutil.revsingle(repo, rev_).node() |
|
5933 | r = scmutil.revsingle(repo, rev_).node() | |
5859 |
|
5934 | |||
5860 | if not message: |
|
5935 | if not message: | |
5861 | # we don't translate commit messages |
|
5936 | # we don't translate commit messages | |
5862 | message = ('Added tag %s for changeset %s' % |
|
5937 | message = ('Added tag %s for changeset %s' % | |
5863 | (', '.join(names), short(r))) |
|
5938 | (', '.join(names), short(r))) | |
5864 |
|
5939 | |||
5865 | date = opts.get('date') |
|
5940 | date = opts.get('date') | |
5866 | if date: |
|
5941 | if date: | |
5867 | date = util.parsedate(date) |
|
5942 | date = util.parsedate(date) | |
5868 |
|
5943 | |||
5869 | if opts.get('remove'): |
|
5944 | if opts.get('remove'): | |
5870 | editform = 'tag.remove' |
|
5945 | editform = 'tag.remove' | |
5871 | else: |
|
5946 | else: | |
5872 | editform = 'tag.add' |
|
5947 | editform = 'tag.add' | |
5873 | editor = cmdutil.getcommiteditor(editform=editform, **opts) |
|
5948 | editor = cmdutil.getcommiteditor(editform=editform, **opts) | |
5874 |
|
5949 | |||
5875 | # don't allow tagging the null rev |
|
5950 | # don't allow tagging the null rev | |
5876 | if (not opts.get('remove') and |
|
5951 | if (not opts.get('remove') and | |
5877 | scmutil.revsingle(repo, rev_).rev() == nullrev): |
|
5952 | scmutil.revsingle(repo, rev_).rev() == nullrev): | |
5878 | raise util.Abort(_("cannot tag null revision")) |
|
5953 | raise util.Abort(_("cannot tag null revision")) | |
5879 |
|
5954 | |||
5880 | repo.tag(names, r, message, opts.get('local'), opts.get('user'), date, |
|
5955 | repo.tag(names, r, message, opts.get('local'), opts.get('user'), date, | |
5881 | editor=editor) |
|
5956 | editor=editor) | |
5882 | finally: |
|
5957 | finally: | |
5883 | release(lock, wlock) |
|
5958 | release(lock, wlock) | |
5884 |
|
5959 | |||
5885 | @command('tags', [], '') |
|
5960 | @command('tags', [], '') | |
5886 | def tags(ui, repo, **opts): |
|
5961 | def tags(ui, repo, **opts): | |
5887 | """list repository tags |
|
5962 | """list repository tags | |
5888 |
|
5963 | |||
5889 | This lists both regular and local tags. When the -v/--verbose |
|
5964 | This lists both regular and local tags. When the -v/--verbose | |
5890 | switch is used, a third column "local" is printed for local tags. |
|
5965 | switch is used, a third column "local" is printed for local tags. | |
5891 |
|
5966 | |||
5892 | Returns 0 on success. |
|
5967 | Returns 0 on success. | |
5893 | """ |
|
5968 | """ | |
5894 |
|
5969 | |||
5895 | fm = ui.formatter('tags', opts) |
|
5970 | fm = ui.formatter('tags', opts) | |
5896 | hexfunc = ui.debugflag and hex or short |
|
5971 | hexfunc = ui.debugflag and hex or short | |
5897 | tagtype = "" |
|
5972 | tagtype = "" | |
5898 |
|
5973 | |||
5899 | for t, n in reversed(repo.tagslist()): |
|
5974 | for t, n in reversed(repo.tagslist()): | |
5900 | hn = hexfunc(n) |
|
5975 | hn = hexfunc(n) | |
5901 | label = 'tags.normal' |
|
5976 | label = 'tags.normal' | |
5902 | tagtype = '' |
|
5977 | tagtype = '' | |
5903 | if repo.tagtype(t) == 'local': |
|
5978 | if repo.tagtype(t) == 'local': | |
5904 | label = 'tags.local' |
|
5979 | label = 'tags.local' | |
5905 | tagtype = 'local' |
|
5980 | tagtype = 'local' | |
5906 |
|
5981 | |||
5907 | fm.startitem() |
|
5982 | fm.startitem() | |
5908 | fm.write('tag', '%s', t, label=label) |
|
5983 | fm.write('tag', '%s', t, label=label) | |
5909 | fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s' |
|
5984 | fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s' | |
5910 | fm.condwrite(not ui.quiet, 'rev id', fmt, |
|
5985 | fm.condwrite(not ui.quiet, 'rev id', fmt, | |
5911 | repo.changelog.rev(n), hn, label=label) |
|
5986 | repo.changelog.rev(n), hn, label=label) | |
5912 | fm.condwrite(ui.verbose and tagtype, 'type', ' %s', |
|
5987 | fm.condwrite(ui.verbose and tagtype, 'type', ' %s', | |
5913 | tagtype, label=label) |
|
5988 | tagtype, label=label) | |
5914 | fm.plain('\n') |
|
5989 | fm.plain('\n') | |
5915 | fm.end() |
|
5990 | fm.end() | |
5916 |
|
5991 | |||
5917 | @command('tip', |
|
5992 | @command('tip', | |
5918 | [('p', 'patch', None, _('show patch')), |
|
5993 | [('p', 'patch', None, _('show patch')), | |
5919 | ('g', 'git', None, _('use git extended diff format')), |
|
5994 | ('g', 'git', None, _('use git extended diff format')), | |
5920 | ] + templateopts, |
|
5995 | ] + templateopts, | |
5921 | _('[-p] [-g]')) |
|
5996 | _('[-p] [-g]')) | |
5922 | def tip(ui, repo, **opts): |
|
5997 | def tip(ui, repo, **opts): | |
5923 | """show the tip revision (DEPRECATED) |
|
5998 | """show the tip revision (DEPRECATED) | |
5924 |
|
5999 | |||
5925 | The tip revision (usually just called the tip) is the changeset |
|
6000 | The tip revision (usually just called the tip) is the changeset | |
5926 | most recently added to the repository (and therefore the most |
|
6001 | most recently added to the repository (and therefore the most | |
5927 | recently changed head). |
|
6002 | recently changed head). | |
5928 |
|
6003 | |||
5929 | If you have just made a commit, that commit will be the tip. If |
|
6004 | If you have just made a commit, that commit will be the tip. If | |
5930 | you have just pulled changes from another repository, the tip of |
|
6005 | you have just pulled changes from another repository, the tip of | |
5931 | that repository becomes the current tip. The "tip" tag is special |
|
6006 | that repository becomes the current tip. The "tip" tag is special | |
5932 | and cannot be renamed or assigned to a different changeset. |
|
6007 | and cannot be renamed or assigned to a different changeset. | |
5933 |
|
6008 | |||
5934 | This command is deprecated, please use :hg:`heads` instead. |
|
6009 | This command is deprecated, please use :hg:`heads` instead. | |
5935 |
|
6010 | |||
5936 | Returns 0 on success. |
|
6011 | Returns 0 on success. | |
5937 | """ |
|
6012 | """ | |
5938 | displayer = cmdutil.show_changeset(ui, repo, opts) |
|
6013 | displayer = cmdutil.show_changeset(ui, repo, opts) | |
5939 | displayer.show(repo['tip']) |
|
6014 | displayer.show(repo['tip']) | |
5940 | displayer.close() |
|
6015 | displayer.close() | |
5941 |
|
6016 | |||
5942 | @command('unbundle', |
|
6017 | @command('unbundle', | |
5943 | [('u', 'update', None, |
|
6018 | [('u', 'update', None, | |
5944 | _('update to new branch head if changesets were unbundled'))], |
|
6019 | _('update to new branch head if changesets were unbundled'))], | |
5945 | _('[-u] FILE...')) |
|
6020 | _('[-u] FILE...')) | |
5946 | def unbundle(ui, repo, fname1, *fnames, **opts): |
|
6021 | def unbundle(ui, repo, fname1, *fnames, **opts): | |
5947 | """apply one or more changegroup files |
|
6022 | """apply one or more changegroup files | |
5948 |
|
6023 | |||
5949 | Apply one or more compressed changegroup files generated by the |
|
6024 | Apply one or more compressed changegroup files generated by the | |
5950 | bundle command. |
|
6025 | bundle command. | |
5951 |
|
6026 | |||
5952 | Returns 0 on success, 1 if an update has unresolved files. |
|
6027 | Returns 0 on success, 1 if an update has unresolved files. | |
5953 | """ |
|
6028 | """ | |
5954 | fnames = (fname1,) + fnames |
|
6029 | fnames = (fname1,) + fnames | |
5955 |
|
6030 | |||
5956 | lock = repo.lock() |
|
6031 | lock = repo.lock() | |
5957 | try: |
|
6032 | try: | |
5958 | for fname in fnames: |
|
6033 | for fname in fnames: | |
5959 | f = hg.openpath(ui, fname) |
|
6034 | f = hg.openpath(ui, fname) | |
5960 | gen = exchange.readbundle(ui, f, fname) |
|
6035 | gen = exchange.readbundle(ui, f, fname) | |
5961 | modheads = changegroup.addchangegroup(repo, gen, 'unbundle', |
|
6036 | modheads = changegroup.addchangegroup(repo, gen, 'unbundle', | |
5962 | 'bundle:' + fname) |
|
6037 | 'bundle:' + fname) | |
5963 | finally: |
|
6038 | finally: | |
5964 | lock.release() |
|
6039 | lock.release() | |
5965 |
|
6040 | |||
5966 | return postincoming(ui, repo, modheads, opts.get('update'), None) |
|
6041 | return postincoming(ui, repo, modheads, opts.get('update'), None) | |
5967 |
|
6042 | |||
5968 | @command('^update|up|checkout|co', |
|
6043 | @command('^update|up|checkout|co', | |
5969 | [('C', 'clean', None, _('discard uncommitted changes (no backup)')), |
|
6044 | [('C', 'clean', None, _('discard uncommitted changes (no backup)')), | |
5970 | ('c', 'check', None, |
|
6045 | ('c', 'check', None, | |
5971 | _('update across branches if no uncommitted changes')), |
|
6046 | _('update across branches if no uncommitted changes')), | |
5972 | ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), |
|
6047 | ('d', 'date', '', _('tipmost revision matching date'), _('DATE')), | |
5973 | ('r', 'rev', '', _('revision'), _('REV')) |
|
6048 | ('r', 'rev', '', _('revision'), _('REV')) | |
5974 | ] + mergetoolopts, |
|
6049 | ] + mergetoolopts, | |
5975 | _('[-c] [-C] [-d DATE] [[-r] REV]')) |
|
6050 | _('[-c] [-C] [-d DATE] [[-r] REV]')) | |
5976 | def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False, |
|
6051 | def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False, | |
5977 | tool=None): |
|
6052 | tool=None): | |
5978 | """update working directory (or switch revisions) |
|
6053 | """update working directory (or switch revisions) | |
5979 |
|
6054 | |||
5980 | Update the repository's working directory to the specified |
|
6055 | Update the repository's working directory to the specified | |
5981 | changeset. If no changeset is specified, update to the tip of the |
|
6056 | changeset. If no changeset is specified, update to the tip of the | |
5982 | current named branch and move the current bookmark (see :hg:`help |
|
6057 | current named branch and move the current bookmark (see :hg:`help | |
5983 | bookmarks`). |
|
6058 | bookmarks`). | |
5984 |
|
6059 | |||
5985 | Update sets the working directory's parent revision to the specified |
|
6060 | Update sets the working directory's parent revision to the specified | |
5986 | changeset (see :hg:`help parents`). |
|
6061 | changeset (see :hg:`help parents`). | |
5987 |
|
6062 | |||
5988 | If the changeset is not a descendant or ancestor of the working |
|
6063 | If the changeset is not a descendant or ancestor of the working | |
5989 | directory's parent, the update is aborted. With the -c/--check |
|
6064 | directory's parent, the update is aborted. With the -c/--check | |
5990 | option, the working directory is checked for uncommitted changes; if |
|
6065 | option, the working directory is checked for uncommitted changes; if | |
5991 | none are found, the working directory is updated to the specified |
|
6066 | none are found, the working directory is updated to the specified | |
5992 | changeset. |
|
6067 | changeset. | |
5993 |
|
6068 | |||
5994 | .. container:: verbose |
|
6069 | .. container:: verbose | |
5995 |
|
6070 | |||
5996 | The following rules apply when the working directory contains |
|
6071 | The following rules apply when the working directory contains | |
5997 | uncommitted changes: |
|
6072 | uncommitted changes: | |
5998 |
|
6073 | |||
5999 | 1. If neither -c/--check nor -C/--clean is specified, and if |
|
6074 | 1. If neither -c/--check nor -C/--clean is specified, and if | |
6000 | the requested changeset is an ancestor or descendant of |
|
6075 | the requested changeset is an ancestor or descendant of | |
6001 | the working directory's parent, the uncommitted changes |
|
6076 | the working directory's parent, the uncommitted changes | |
6002 | are merged into the requested changeset and the merged |
|
6077 | are merged into the requested changeset and the merged | |
6003 | result is left uncommitted. If the requested changeset is |
|
6078 | result is left uncommitted. If the requested changeset is | |
6004 | not an ancestor or descendant (that is, it is on another |
|
6079 | not an ancestor or descendant (that is, it is on another | |
6005 | branch), the update is aborted and the uncommitted changes |
|
6080 | branch), the update is aborted and the uncommitted changes | |
6006 | are preserved. |
|
6081 | are preserved. | |
6007 |
|
6082 | |||
6008 | 2. With the -c/--check option, the update is aborted and the |
|
6083 | 2. With the -c/--check option, the update is aborted and the | |
6009 | uncommitted changes are preserved. |
|
6084 | uncommitted changes are preserved. | |
6010 |
|
6085 | |||
6011 | 3. With the -C/--clean option, uncommitted changes are discarded and |
|
6086 | 3. With the -C/--clean option, uncommitted changes are discarded and | |
6012 | the working directory is updated to the requested changeset. |
|
6087 | the working directory is updated to the requested changeset. | |
6013 |
|
6088 | |||
6014 | To cancel an uncommitted merge (and lose your changes), use |
|
6089 | To cancel an uncommitted merge (and lose your changes), use | |
6015 | :hg:`update --clean .`. |
|
6090 | :hg:`update --clean .`. | |
6016 |
|
6091 | |||
6017 | Use null as the changeset to remove the working directory (like |
|
6092 | Use null as the changeset to remove the working directory (like | |
6018 | :hg:`clone -U`). |
|
6093 | :hg:`clone -U`). | |
6019 |
|
6094 | |||
6020 | If you want to revert just one file to an older revision, use |
|
6095 | If you want to revert just one file to an older revision, use | |
6021 | :hg:`revert [-r REV] NAME`. |
|
6096 | :hg:`revert [-r REV] NAME`. | |
6022 |
|
6097 | |||
6023 | See :hg:`help dates` for a list of formats valid for -d/--date. |
|
6098 | See :hg:`help dates` for a list of formats valid for -d/--date. | |
6024 |
|
6099 | |||
6025 | Returns 0 on success, 1 if there are unresolved files. |
|
6100 | Returns 0 on success, 1 if there are unresolved files. | |
6026 | """ |
|
6101 | """ | |
6027 | if rev and node: |
|
6102 | if rev and node: | |
6028 | raise util.Abort(_("please specify just one revision")) |
|
6103 | raise util.Abort(_("please specify just one revision")) | |
6029 |
|
6104 | |||
6030 | if rev is None or rev == '': |
|
6105 | if rev is None or rev == '': | |
6031 | rev = node |
|
6106 | rev = node | |
6032 |
|
6107 | |||
6033 | cmdutil.clearunfinished(repo) |
|
6108 | cmdutil.clearunfinished(repo) | |
6034 |
|
6109 | |||
6035 | # with no argument, we also move the current bookmark, if any |
|
6110 | # with no argument, we also move the current bookmark, if any | |
6036 | rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) |
|
6111 | rev, movemarkfrom = bookmarks.calculateupdate(ui, repo, rev) | |
6037 |
|
6112 | |||
6038 | # if we defined a bookmark, we have to remember the original bookmark name |
|
6113 | # if we defined a bookmark, we have to remember the original bookmark name | |
6039 | brev = rev |
|
6114 | brev = rev | |
6040 | rev = scmutil.revsingle(repo, rev, rev).rev() |
|
6115 | rev = scmutil.revsingle(repo, rev, rev).rev() | |
6041 |
|
6116 | |||
6042 | if check and clean: |
|
6117 | if check and clean: | |
6043 | raise util.Abort(_("cannot specify both -c/--check and -C/--clean")) |
|
6118 | raise util.Abort(_("cannot specify both -c/--check and -C/--clean")) | |
6044 |
|
6119 | |||
6045 | if date: |
|
6120 | if date: | |
6046 | if rev is not None: |
|
6121 | if rev is not None: | |
6047 | raise util.Abort(_("you can't specify a revision and a date")) |
|
6122 | raise util.Abort(_("you can't specify a revision and a date")) | |
6048 | rev = cmdutil.finddate(ui, repo, date) |
|
6123 | rev = cmdutil.finddate(ui, repo, date) | |
6049 |
|
6124 | |||
6050 | if check: |
|
6125 | if check: | |
6051 | c = repo[None] |
|
6126 | c = repo[None] | |
6052 | if c.dirty(merge=False, branch=False, missing=True): |
|
6127 | if c.dirty(merge=False, branch=False, missing=True): | |
6053 | raise util.Abort(_("uncommitted changes")) |
|
6128 | raise util.Abort(_("uncommitted changes")) | |
6054 | if rev is None: |
|
6129 | if rev is None: | |
6055 | rev = repo[repo[None].branch()].rev() |
|
6130 | rev = repo[repo[None].branch()].rev() | |
6056 | mergemod._checkunknown(repo, repo[None], repo[rev]) |
|
6131 | mergemod._checkunknown(repo, repo[None], repo[rev]) | |
6057 |
|
6132 | |||
6058 | repo.ui.setconfig('ui', 'forcemerge', tool, 'update') |
|
6133 | repo.ui.setconfig('ui', 'forcemerge', tool, 'update') | |
6059 |
|
6134 | |||
6060 | if clean: |
|
6135 | if clean: | |
6061 | ret = hg.clean(repo, rev) |
|
6136 | ret = hg.clean(repo, rev) | |
6062 | else: |
|
6137 | else: | |
6063 | ret = hg.update(repo, rev) |
|
6138 | ret = hg.update(repo, rev) | |
6064 |
|
6139 | |||
6065 | if not ret and movemarkfrom: |
|
6140 | if not ret and movemarkfrom: | |
6066 | if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): |
|
6141 | if bookmarks.update(repo, [movemarkfrom], repo['.'].node()): | |
6067 | ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) |
|
6142 | ui.status(_("updating bookmark %s\n") % repo._bookmarkcurrent) | |
6068 | elif brev in repo._bookmarks: |
|
6143 | elif brev in repo._bookmarks: | |
6069 | bookmarks.setcurrent(repo, brev) |
|
6144 | bookmarks.setcurrent(repo, brev) | |
6070 | ui.status(_("(activating bookmark %s)\n") % brev) |
|
6145 | ui.status(_("(activating bookmark %s)\n") % brev) | |
6071 | elif brev: |
|
6146 | elif brev: | |
6072 | if repo._bookmarkcurrent: |
|
6147 | if repo._bookmarkcurrent: | |
6073 | ui.status(_("(leaving bookmark %s)\n") % |
|
6148 | ui.status(_("(leaving bookmark %s)\n") % | |
6074 | repo._bookmarkcurrent) |
|
6149 | repo._bookmarkcurrent) | |
6075 | bookmarks.unsetcurrent(repo) |
|
6150 | bookmarks.unsetcurrent(repo) | |
6076 |
|
6151 | |||
6077 | return ret |
|
6152 | return ret | |
6078 |
|
6153 | |||
6079 | @command('verify', []) |
|
6154 | @command('verify', []) | |
6080 | def verify(ui, repo): |
|
6155 | def verify(ui, repo): | |
6081 | """verify the integrity of the repository |
|
6156 | """verify the integrity of the repository | |
6082 |
|
6157 | |||
6083 | Verify the integrity of the current repository. |
|
6158 | Verify the integrity of the current repository. | |
6084 |
|
6159 | |||
6085 | This will perform an extensive check of the repository's |
|
6160 | This will perform an extensive check of the repository's | |
6086 | integrity, validating the hashes and checksums of each entry in |
|
6161 | integrity, validating the hashes and checksums of each entry in | |
6087 | the changelog, manifest, and tracked files, as well as the |
|
6162 | the changelog, manifest, and tracked files, as well as the | |
6088 | integrity of their crosslinks and indices. |
|
6163 | integrity of their crosslinks and indices. | |
6089 |
|
6164 | |||
6090 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption |
|
6165 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption | |
6091 | for more information about recovery from corruption of the |
|
6166 | for more information about recovery from corruption of the | |
6092 | repository. |
|
6167 | repository. | |
6093 |
|
6168 | |||
6094 | Returns 0 on success, 1 if errors are encountered. |
|
6169 | Returns 0 on success, 1 if errors are encountered. | |
6095 | """ |
|
6170 | """ | |
6096 | return hg.verify(repo) |
|
6171 | return hg.verify(repo) | |
6097 |
|
6172 | |||
6098 | @command('version', [], norepo=True) |
|
6173 | @command('version', [], norepo=True) | |
6099 | def version_(ui): |
|
6174 | def version_(ui): | |
6100 | """output version and copyright information""" |
|
6175 | """output version and copyright information""" | |
6101 | ui.write(_("Mercurial Distributed SCM (version %s)\n") |
|
6176 | ui.write(_("Mercurial Distributed SCM (version %s)\n") | |
6102 | % util.version()) |
|
6177 | % util.version()) | |
6103 | ui.status(_( |
|
6178 | ui.status(_( | |
6104 | "(see http://mercurial.selenic.com for more information)\n" |
|
6179 | "(see http://mercurial.selenic.com for more information)\n" | |
6105 | "\nCopyright (C) 2005-2014 Matt Mackall and others\n" |
|
6180 | "\nCopyright (C) 2005-2014 Matt Mackall and others\n" | |
6106 | "This is free software; see the source for copying conditions. " |
|
6181 | "This is free software; see the source for copying conditions. " | |
6107 | "There is NO\nwarranty; " |
|
6182 | "There is NO\nwarranty; " | |
6108 | "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" |
|
6183 | "not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" | |
6109 | )) |
|
6184 | )) | |
6110 |
|
6185 | |||
6111 | ui.note(_("\nEnabled extensions:\n\n")) |
|
6186 | ui.note(_("\nEnabled extensions:\n\n")) | |
6112 | if ui.verbose: |
|
6187 | if ui.verbose: | |
6113 | # format names and versions into columns |
|
6188 | # format names and versions into columns | |
6114 | names = [] |
|
6189 | names = [] | |
6115 | vers = [] |
|
6190 | vers = [] | |
6116 | for name, module in extensions.extensions(): |
|
6191 | for name, module in extensions.extensions(): | |
6117 | names.append(name) |
|
6192 | names.append(name) | |
6118 | vers.append(extensions.moduleversion(module)) |
|
6193 | vers.append(extensions.moduleversion(module)) | |
6119 | if names: |
|
6194 | if names: | |
6120 | maxnamelen = max(len(n) for n in names) |
|
6195 | maxnamelen = max(len(n) for n in names) | |
6121 | for i, name in enumerate(names): |
|
6196 | for i, name in enumerate(names): | |
6122 | ui.write(" %-*s %s\n" % (maxnamelen, name, vers[i])) |
|
6197 | ui.write(" %-*s %s\n" % (maxnamelen, name, vers[i])) |
@@ -1,332 +1,334 b'' | |||||
1 | Show all commands except debug commands |
|
1 | Show all commands except debug commands | |
2 | $ hg debugcomplete |
|
2 | $ hg debugcomplete | |
3 | add |
|
3 | add | |
4 | addremove |
|
4 | addremove | |
5 | annotate |
|
5 | annotate | |
6 | archive |
|
6 | archive | |
7 | backout |
|
7 | backout | |
8 | bisect |
|
8 | bisect | |
9 | bookmarks |
|
9 | bookmarks | |
10 | branch |
|
10 | branch | |
11 | branches |
|
11 | branches | |
12 | bundle |
|
12 | bundle | |
13 | cat |
|
13 | cat | |
14 | clone |
|
14 | clone | |
15 | commit |
|
15 | commit | |
16 | config |
|
16 | config | |
17 | copy |
|
17 | copy | |
18 | diff |
|
18 | diff | |
19 | export |
|
19 | export | |
|
20 | files | |||
20 | forget |
|
21 | forget | |
21 | graft |
|
22 | graft | |
22 | grep |
|
23 | grep | |
23 | heads |
|
24 | heads | |
24 | help |
|
25 | help | |
25 | identify |
|
26 | identify | |
26 | import |
|
27 | import | |
27 | incoming |
|
28 | incoming | |
28 | init |
|
29 | init | |
29 | locate |
|
30 | locate | |
30 | log |
|
31 | log | |
31 | manifest |
|
32 | manifest | |
32 | merge |
|
33 | merge | |
33 | outgoing |
|
34 | outgoing | |
34 | parents |
|
35 | parents | |
35 | paths |
|
36 | paths | |
36 | phase |
|
37 | phase | |
37 | pull |
|
38 | pull | |
38 | push |
|
39 | push | |
39 | recover |
|
40 | recover | |
40 | remove |
|
41 | remove | |
41 | rename |
|
42 | rename | |
42 | resolve |
|
43 | resolve | |
43 | revert |
|
44 | revert | |
44 | rollback |
|
45 | rollback | |
45 | root |
|
46 | root | |
46 | serve |
|
47 | serve | |
47 | status |
|
48 | status | |
48 | summary |
|
49 | summary | |
49 | tag |
|
50 | tag | |
50 | tags |
|
51 | tags | |
51 | tip |
|
52 | tip | |
52 | unbundle |
|
53 | unbundle | |
53 | update |
|
54 | update | |
54 | verify |
|
55 | verify | |
55 | version |
|
56 | version | |
56 |
|
57 | |||
57 | Show all commands that start with "a" |
|
58 | Show all commands that start with "a" | |
58 | $ hg debugcomplete a |
|
59 | $ hg debugcomplete a | |
59 | add |
|
60 | add | |
60 | addremove |
|
61 | addremove | |
61 | annotate |
|
62 | annotate | |
62 | archive |
|
63 | archive | |
63 |
|
64 | |||
64 | Do not show debug commands if there are other candidates |
|
65 | Do not show debug commands if there are other candidates | |
65 | $ hg debugcomplete d |
|
66 | $ hg debugcomplete d | |
66 | diff |
|
67 | diff | |
67 |
|
68 | |||
68 | Show debug commands if there are no other candidates |
|
69 | Show debug commands if there are no other candidates | |
69 | $ hg debugcomplete debug |
|
70 | $ hg debugcomplete debug | |
70 | debugancestor |
|
71 | debugancestor | |
71 | debugbuilddag |
|
72 | debugbuilddag | |
72 | debugbundle |
|
73 | debugbundle | |
73 | debugcheckstate |
|
74 | debugcheckstate | |
74 | debugcommands |
|
75 | debugcommands | |
75 | debugcomplete |
|
76 | debugcomplete | |
76 | debugconfig |
|
77 | debugconfig | |
77 | debugdag |
|
78 | debugdag | |
78 | debugdata |
|
79 | debugdata | |
79 | debugdate |
|
80 | debugdate | |
80 | debugdirstate |
|
81 | debugdirstate | |
81 | debugdiscovery |
|
82 | debugdiscovery | |
82 | debugfileset |
|
83 | debugfileset | |
83 | debugfsinfo |
|
84 | debugfsinfo | |
84 | debuggetbundle |
|
85 | debuggetbundle | |
85 | debugignore |
|
86 | debugignore | |
86 | debugindex |
|
87 | debugindex | |
87 | debugindexdot |
|
88 | debugindexdot | |
88 | debuginstall |
|
89 | debuginstall | |
89 | debugknown |
|
90 | debugknown | |
90 | debuglabelcomplete |
|
91 | debuglabelcomplete | |
91 | debugobsolete |
|
92 | debugobsolete | |
92 | debugpathcomplete |
|
93 | debugpathcomplete | |
93 | debugpushkey |
|
94 | debugpushkey | |
94 | debugpvec |
|
95 | debugpvec | |
95 | debugrebuilddirstate |
|
96 | debugrebuilddirstate | |
96 | debugrename |
|
97 | debugrename | |
97 | debugrevlog |
|
98 | debugrevlog | |
98 | debugrevspec |
|
99 | debugrevspec | |
99 | debugsetparents |
|
100 | debugsetparents | |
100 | debugsub |
|
101 | debugsub | |
101 | debugsuccessorssets |
|
102 | debugsuccessorssets | |
102 | debugwalk |
|
103 | debugwalk | |
103 | debugwireargs |
|
104 | debugwireargs | |
104 |
|
105 | |||
105 | Do not show the alias of a debug command if there are other candidates |
|
106 | Do not show the alias of a debug command if there are other candidates | |
106 | (this should hide rawcommit) |
|
107 | (this should hide rawcommit) | |
107 | $ hg debugcomplete r |
|
108 | $ hg debugcomplete r | |
108 | recover |
|
109 | recover | |
109 | remove |
|
110 | remove | |
110 | rename |
|
111 | rename | |
111 | resolve |
|
112 | resolve | |
112 | revert |
|
113 | revert | |
113 | rollback |
|
114 | rollback | |
114 | root |
|
115 | root | |
115 | Show the alias of a debug command if there are no other candidates |
|
116 | Show the alias of a debug command if there are no other candidates | |
116 | $ hg debugcomplete rawc |
|
117 | $ hg debugcomplete rawc | |
117 |
|
118 | |||
118 |
|
119 | |||
119 | Show the global options |
|
120 | Show the global options | |
120 | $ hg debugcomplete --options | sort |
|
121 | $ hg debugcomplete --options | sort | |
121 | --config |
|
122 | --config | |
122 | --cwd |
|
123 | --cwd | |
123 | --debug |
|
124 | --debug | |
124 | --debugger |
|
125 | --debugger | |
125 | --encoding |
|
126 | --encoding | |
126 | --encodingmode |
|
127 | --encodingmode | |
127 | --help |
|
128 | --help | |
128 | --hidden |
|
129 | --hidden | |
129 | --noninteractive |
|
130 | --noninteractive | |
130 | --profile |
|
131 | --profile | |
131 | --quiet |
|
132 | --quiet | |
132 | --repository |
|
133 | --repository | |
133 | --time |
|
134 | --time | |
134 | --traceback |
|
135 | --traceback | |
135 | --verbose |
|
136 | --verbose | |
136 | --version |
|
137 | --version | |
137 | -R |
|
138 | -R | |
138 | -h |
|
139 | -h | |
139 | -q |
|
140 | -q | |
140 | -v |
|
141 | -v | |
141 | -y |
|
142 | -y | |
142 |
|
143 | |||
143 | Show the options for the "serve" command |
|
144 | Show the options for the "serve" command | |
144 | $ hg debugcomplete --options serve | sort |
|
145 | $ hg debugcomplete --options serve | sort | |
145 | --accesslog |
|
146 | --accesslog | |
146 | --address |
|
147 | --address | |
147 | --certificate |
|
148 | --certificate | |
148 | --cmdserver |
|
149 | --cmdserver | |
149 | --config |
|
150 | --config | |
150 | --cwd |
|
151 | --cwd | |
151 | --daemon |
|
152 | --daemon | |
152 | --daemon-pipefds |
|
153 | --daemon-pipefds | |
153 | --debug |
|
154 | --debug | |
154 | --debugger |
|
155 | --debugger | |
155 | --encoding |
|
156 | --encoding | |
156 | --encodingmode |
|
157 | --encodingmode | |
157 | --errorlog |
|
158 | --errorlog | |
158 | --help |
|
159 | --help | |
159 | --hidden |
|
160 | --hidden | |
160 | --ipv6 |
|
161 | --ipv6 | |
161 | --name |
|
162 | --name | |
162 | --noninteractive |
|
163 | --noninteractive | |
163 | --pid-file |
|
164 | --pid-file | |
164 | --port |
|
165 | --port | |
165 | --prefix |
|
166 | --prefix | |
166 | --profile |
|
167 | --profile | |
167 | --quiet |
|
168 | --quiet | |
168 | --repository |
|
169 | --repository | |
169 | --stdio |
|
170 | --stdio | |
170 | --style |
|
171 | --style | |
171 | --templates |
|
172 | --templates | |
172 | --time |
|
173 | --time | |
173 | --traceback |
|
174 | --traceback | |
174 | --verbose |
|
175 | --verbose | |
175 | --version |
|
176 | --version | |
176 | --web-conf |
|
177 | --web-conf | |
177 | -6 |
|
178 | -6 | |
178 | -A |
|
179 | -A | |
179 | -E |
|
180 | -E | |
180 | -R |
|
181 | -R | |
181 | -a |
|
182 | -a | |
182 | -d |
|
183 | -d | |
183 | -h |
|
184 | -h | |
184 | -n |
|
185 | -n | |
185 | -p |
|
186 | -p | |
186 | -q |
|
187 | -q | |
187 | -t |
|
188 | -t | |
188 | -v |
|
189 | -v | |
189 | -y |
|
190 | -y | |
190 |
|
191 | |||
191 | Show an error if we use --options with an ambiguous abbreviation |
|
192 | Show an error if we use --options with an ambiguous abbreviation | |
192 | $ hg debugcomplete --options s |
|
193 | $ hg debugcomplete --options s | |
193 | hg: command 's' is ambiguous: |
|
194 | hg: command 's' is ambiguous: | |
194 | serve showconfig status summary |
|
195 | serve showconfig status summary | |
195 | [255] |
|
196 | [255] | |
196 |
|
197 | |||
197 | Show all commands + options |
|
198 | Show all commands + options | |
198 | $ hg debugcommands |
|
199 | $ hg debugcommands | |
199 | add: include, exclude, subrepos, dry-run |
|
200 | add: include, exclude, subrepos, dry-run | |
200 | annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude |
|
201 | annotate: rev, follow, no-follow, text, user, file, date, number, changeset, line-number, ignore-all-space, ignore-space-change, ignore-blank-lines, include, exclude | |
201 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure |
|
202 | clone: noupdate, updaterev, rev, branch, pull, uncompressed, ssh, remotecmd, insecure | |
202 | commit: addremove, close-branch, amend, secret, edit, include, exclude, message, logfile, date, user, subrepos |
|
203 | commit: addremove, close-branch, amend, secret, edit, include, exclude, message, logfile, date, user, subrepos | |
203 | diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos |
|
204 | diff: rev, change, text, git, nodates, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude, subrepos | |
204 | export: output, switch-parent, rev, text, git, nodates |
|
205 | export: output, switch-parent, rev, text, git, nodates | |
205 | forget: include, exclude |
|
206 | forget: include, exclude | |
206 | init: ssh, remotecmd, insecure |
|
207 | init: ssh, remotecmd, insecure | |
207 | log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude |
|
208 | log: follow, follow-first, date, copies, keyword, rev, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude | |
208 | merge: force, rev, preview, tool |
|
209 | merge: force, rev, preview, tool | |
209 | pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure |
|
210 | pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure | |
210 | push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure |
|
211 | push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure | |
211 | remove: after, force, include, exclude |
|
212 | remove: after, force, include, exclude | |
212 | serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate |
|
213 | serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate | |
213 | status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos |
|
214 | status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos | |
214 | summary: remote |
|
215 | summary: remote | |
215 | update: clean, check, date, rev, tool |
|
216 | update: clean, check, date, rev, tool | |
216 | addremove: similarity, include, exclude, dry-run |
|
217 | addremove: similarity, include, exclude, dry-run | |
217 | archive: no-decode, prefix, rev, type, subrepos, include, exclude |
|
218 | archive: no-decode, prefix, rev, type, subrepos, include, exclude | |
218 | backout: merge, parent, rev, edit, tool, include, exclude, message, logfile, date, user |
|
219 | backout: merge, parent, rev, edit, tool, include, exclude, message, logfile, date, user | |
219 | bisect: reset, good, bad, skip, extend, command, noupdate |
|
220 | bisect: reset, good, bad, skip, extend, command, noupdate | |
220 | bookmarks: force, rev, delete, rename, inactive |
|
221 | bookmarks: force, rev, delete, rename, inactive | |
221 | branch: force, clean |
|
222 | branch: force, clean | |
222 | branches: active, closed |
|
223 | branches: active, closed | |
223 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure |
|
224 | bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure | |
224 | cat: output, rev, decode, include, exclude |
|
225 | cat: output, rev, decode, include, exclude | |
225 | config: untrusted, edit, local, global |
|
226 | config: untrusted, edit, local, global | |
226 | copy: after, force, include, exclude, dry-run |
|
227 | copy: after, force, include, exclude, dry-run | |
227 | debugancestor: |
|
228 | debugancestor: | |
228 | debugbuilddag: mergeable-file, overwritten-file, new-file |
|
229 | debugbuilddag: mergeable-file, overwritten-file, new-file | |
229 | debugbundle: all |
|
230 | debugbundle: all | |
230 | debugcheckstate: |
|
231 | debugcheckstate: | |
231 | debugcommands: |
|
232 | debugcommands: | |
232 | debugcomplete: options |
|
233 | debugcomplete: options | |
233 | debugdag: tags, branches, dots, spaces |
|
234 | debugdag: tags, branches, dots, spaces | |
234 | debugdata: changelog, manifest |
|
235 | debugdata: changelog, manifest | |
235 | debugdate: extended |
|
236 | debugdate: extended | |
236 | debugdirstate: nodates, datesort |
|
237 | debugdirstate: nodates, datesort | |
237 | debugdiscovery: old, nonheads, ssh, remotecmd, insecure |
|
238 | debugdiscovery: old, nonheads, ssh, remotecmd, insecure | |
238 | debugfileset: rev |
|
239 | debugfileset: rev | |
239 | debugfsinfo: |
|
240 | debugfsinfo: | |
240 | debuggetbundle: head, common, type |
|
241 | debuggetbundle: head, common, type | |
241 | debugignore: |
|
242 | debugignore: | |
242 | debugindex: changelog, manifest, format |
|
243 | debugindex: changelog, manifest, format | |
243 | debugindexdot: |
|
244 | debugindexdot: | |
244 | debuginstall: |
|
245 | debuginstall: | |
245 | debugknown: |
|
246 | debugknown: | |
246 | debuglabelcomplete: |
|
247 | debuglabelcomplete: | |
247 | debugobsolete: flags, record-parents, rev, date, user |
|
248 | debugobsolete: flags, record-parents, rev, date, user | |
248 | debugpathcomplete: full, normal, added, removed |
|
249 | debugpathcomplete: full, normal, added, removed | |
249 | debugpushkey: |
|
250 | debugpushkey: | |
250 | debugpvec: |
|
251 | debugpvec: | |
251 | debugrebuilddirstate: rev |
|
252 | debugrebuilddirstate: rev | |
252 | debugrename: rev |
|
253 | debugrename: rev | |
253 | debugrevlog: changelog, manifest, dump |
|
254 | debugrevlog: changelog, manifest, dump | |
254 | debugrevspec: optimize |
|
255 | debugrevspec: optimize | |
255 | debugsetparents: |
|
256 | debugsetparents: | |
256 | debugsub: rev |
|
257 | debugsub: rev | |
257 | debugsuccessorssets: |
|
258 | debugsuccessorssets: | |
258 | debugwalk: include, exclude |
|
259 | debugwalk: include, exclude | |
259 | debugwireargs: three, four, five, ssh, remotecmd, insecure |
|
260 | debugwireargs: three, four, five, ssh, remotecmd, insecure | |
|
261 | files: rev, print0, include, exclude | |||
260 | graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run |
|
262 | graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run | |
261 | grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude |
|
263 | grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, include, exclude | |
262 | heads: rev, topo, active, closed, style, template |
|
264 | heads: rev, topo, active, closed, style, template | |
263 | help: extension, command, keyword |
|
265 | help: extension, command, keyword | |
264 | identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure |
|
266 | identify: rev, num, id, branch, tags, bookmarks, ssh, remotecmd, insecure | |
265 | import: strip, base, edit, force, no-commit, bypass, partial, exact, import-branch, message, logfile, date, user, similarity |
|
267 | import: strip, base, edit, force, no-commit, bypass, partial, exact, import-branch, message, logfile, date, user, similarity | |
266 | incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos |
|
268 | incoming: force, newest-first, bundle, rev, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos | |
267 | locate: rev, print0, fullpath, include, exclude |
|
269 | locate: rev, print0, fullpath, include, exclude | |
268 | manifest: rev, all |
|
270 | manifest: rev, all | |
269 | outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos |
|
271 | outgoing: force, rev, newest-first, bookmarks, branch, patch, git, limit, no-merges, stat, graph, style, template, ssh, remotecmd, insecure, subrepos | |
270 | parents: rev, style, template |
|
272 | parents: rev, style, template | |
271 | paths: |
|
273 | paths: | |
272 | phase: public, draft, secret, force, rev |
|
274 | phase: public, draft, secret, force, rev | |
273 | recover: |
|
275 | recover: | |
274 | rename: after, force, include, exclude, dry-run |
|
276 | rename: after, force, include, exclude, dry-run | |
275 | resolve: all, list, mark, unmark, no-status, tool, include, exclude |
|
277 | resolve: all, list, mark, unmark, no-status, tool, include, exclude | |
276 | revert: all, date, rev, no-backup, include, exclude, dry-run |
|
278 | revert: all, date, rev, no-backup, include, exclude, dry-run | |
277 | rollback: dry-run, force |
|
279 | rollback: dry-run, force | |
278 | root: |
|
280 | root: | |
279 | tag: force, local, rev, remove, edit, message, date, user |
|
281 | tag: force, local, rev, remove, edit, message, date, user | |
280 | tags: |
|
282 | tags: | |
281 | tip: patch, git, style, template |
|
283 | tip: patch, git, style, template | |
282 | unbundle: update |
|
284 | unbundle: update | |
283 | verify: |
|
285 | verify: | |
284 | version: |
|
286 | version: | |
285 |
|
287 | |||
286 | $ hg init a |
|
288 | $ hg init a | |
287 | $ cd a |
|
289 | $ cd a | |
288 | $ echo fee > fee |
|
290 | $ echo fee > fee | |
289 | $ hg ci -q -Amfee |
|
291 | $ hg ci -q -Amfee | |
290 | $ hg tag fee |
|
292 | $ hg tag fee | |
291 | $ mkdir fie |
|
293 | $ mkdir fie | |
292 | $ echo dead > fie/dead |
|
294 | $ echo dead > fie/dead | |
293 | $ echo live > fie/live |
|
295 | $ echo live > fie/live | |
294 | $ hg bookmark fo |
|
296 | $ hg bookmark fo | |
295 | $ hg branch -q fie |
|
297 | $ hg branch -q fie | |
296 | $ hg ci -q -Amfie |
|
298 | $ hg ci -q -Amfie | |
297 | $ echo fo > fo |
|
299 | $ echo fo > fo | |
298 | $ hg branch -qf default |
|
300 | $ hg branch -qf default | |
299 | $ hg ci -q -Amfo |
|
301 | $ hg ci -q -Amfo | |
300 | $ echo Fum > Fum |
|
302 | $ echo Fum > Fum | |
301 | $ hg ci -q -AmFum |
|
303 | $ hg ci -q -AmFum | |
302 | $ hg bookmark Fum |
|
304 | $ hg bookmark Fum | |
303 |
|
305 | |||
304 | Test debugpathcomplete |
|
306 | Test debugpathcomplete | |
305 |
|
307 | |||
306 | $ hg debugpathcomplete f |
|
308 | $ hg debugpathcomplete f | |
307 | fee |
|
309 | fee | |
308 | fie |
|
310 | fie | |
309 | fo |
|
311 | fo | |
310 | $ hg debugpathcomplete -f f |
|
312 | $ hg debugpathcomplete -f f | |
311 | fee |
|
313 | fee | |
312 | fie/dead |
|
314 | fie/dead | |
313 | fie/live |
|
315 | fie/live | |
314 | fo |
|
316 | fo | |
315 |
|
317 | |||
316 | $ hg rm Fum |
|
318 | $ hg rm Fum | |
317 | $ hg debugpathcomplete -r F |
|
319 | $ hg debugpathcomplete -r F | |
318 | Fum |
|
320 | Fum | |
319 |
|
321 | |||
320 | Test debuglabelcomplete |
|
322 | Test debuglabelcomplete | |
321 |
|
323 | |||
322 | $ hg debuglabelcomplete |
|
324 | $ hg debuglabelcomplete | |
323 | Fum |
|
325 | Fum | |
324 | default |
|
326 | default | |
325 | fee |
|
327 | fee | |
326 | fie |
|
328 | fie | |
327 | fo |
|
329 | fo | |
328 | tip |
|
330 | tip | |
329 | $ hg debuglabelcomplete f |
|
331 | $ hg debuglabelcomplete f | |
330 | fee |
|
332 | fee | |
331 | fie |
|
333 | fie | |
332 | fo |
|
334 | fo |
@@ -1,445 +1,447 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 create a new bookmark or list existing bookmarks |
|
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 | files list tracked files | |||
304 | forget forget the specified files on the next commit |
|
305 | forget forget the specified files on the next commit | |
305 | graft copy changes from other branches onto the current branch |
|
306 | graft copy changes from other branches onto the current branch | |
306 | grep search for a pattern in specified files and revisions |
|
307 | grep search for a pattern in specified files and revisions | |
307 | heads show branch heads |
|
308 | heads show branch heads | |
308 | help show help for a given topic or a help overview |
|
309 | help show help for a given topic or a help overview | |
309 | identify identify the working copy or specified revision |
|
310 | identify identify the working copy or specified revision | |
310 | import import an ordered set of patches |
|
311 | import import an ordered set of patches | |
311 | incoming show new changesets found in source |
|
312 | incoming show new changesets found in source | |
312 | init create a new repository in the given directory |
|
313 | init create a new repository in the given directory | |
313 | locate locate files matching specific patterns |
|
314 | locate locate files matching specific patterns | |
314 | log show revision history of entire repository or files |
|
315 | log show revision history of entire repository or files | |
315 | manifest output the current or given revision of the project manifest |
|
316 | manifest output the current or given revision of the project manifest | |
316 | merge merge working directory with another revision |
|
317 | merge merge working directory with another revision | |
317 | outgoing show changesets not found in the destination |
|
318 | outgoing show changesets not found in the destination | |
318 | parents show the parents of the working directory or revision |
|
319 | parents show the parents of the working directory or revision | |
319 | paths show aliases for remote repositories |
|
320 | paths show aliases for remote repositories | |
320 | phase set or show the current phase name |
|
321 | phase set or show the current phase name | |
321 | pull pull changes from the specified source |
|
322 | pull pull changes from the specified source | |
322 | push push changes to the specified destination |
|
323 | push push changes to the specified destination | |
323 | recover roll back an interrupted transaction |
|
324 | recover roll back an interrupted transaction | |
324 | remove remove the specified files on the next commit |
|
325 | remove remove the specified files on the next commit | |
325 | rename rename files; equivalent of copy + remove |
|
326 | rename rename files; equivalent of copy + remove | |
326 | resolve redo merges or set/view the merge status of files |
|
327 | resolve redo merges or set/view the merge status of files | |
327 | revert restore files to their checkout state |
|
328 | revert restore files to their checkout state | |
328 | root print the root (top) of the current working directory |
|
329 | root print the root (top) of the current working directory | |
329 | serve start stand-alone webserver |
|
330 | serve start stand-alone webserver | |
330 | status show changed files in the working directory |
|
331 | status show changed files in the working directory | |
331 | summary summarize working directory state |
|
332 | summary summarize working directory state | |
332 | tag add one or more tags for the current or given revision |
|
333 | tag add one or more tags for the current or given revision | |
333 | tags list repository tags |
|
334 | tags list repository tags | |
334 | unbundle apply one or more changegroup files |
|
335 | unbundle apply one or more changegroup files | |
335 | update update working directory (or switch revisions) |
|
336 | update update working directory (or switch revisions) | |
336 | verify verify the integrity of the repository |
|
337 | verify verify the integrity of the repository | |
337 | version output version and copyright information |
|
338 | version output version and copyright information | |
338 |
|
339 | |||
339 | additional help topics: |
|
340 | additional help topics: | |
340 |
|
341 | |||
341 | config Configuration Files |
|
342 | config Configuration Files | |
342 | dates Date Formats |
|
343 | dates Date Formats | |
343 | diffs Diff Formats |
|
344 | diffs Diff Formats | |
344 | environment Environment Variables |
|
345 | environment Environment Variables | |
345 | extensions Using Additional Features |
|
346 | extensions Using Additional Features | |
346 | filesets Specifying File Sets |
|
347 | filesets Specifying File Sets | |
347 | glossary Glossary |
|
348 | glossary Glossary | |
348 | hgignore Syntax for Mercurial Ignore Files |
|
349 | hgignore Syntax for Mercurial Ignore Files | |
349 | hgweb Configuring hgweb |
|
350 | hgweb Configuring hgweb | |
350 | merge-tools Merge Tools |
|
351 | merge-tools Merge Tools | |
351 | multirevs Specifying Multiple Revisions |
|
352 | multirevs Specifying Multiple Revisions | |
352 | patterns File Name Patterns |
|
353 | patterns File Name Patterns | |
353 | phases Working with Phases |
|
354 | phases Working with Phases | |
354 | revisions Specifying Single Revisions |
|
355 | revisions Specifying Single Revisions | |
355 | revsets Specifying Revision Sets |
|
356 | revsets Specifying Revision Sets | |
356 | subrepos Subrepositories |
|
357 | subrepos Subrepositories | |
357 | templating Template Usage |
|
358 | templating Template Usage | |
358 | urls URL Paths |
|
359 | urls URL Paths | |
359 |
|
360 | |||
360 | (use "hg help -v" to show built-in aliases and global options) |
|
361 | (use "hg help -v" to show built-in aliases and global options) | |
361 |
|
362 | |||
362 |
|
363 | |||
363 |
|
364 | |||
364 | $ hg --help |
|
365 | $ hg --help | |
365 | Mercurial Distributed SCM |
|
366 | Mercurial Distributed SCM | |
366 |
|
367 | |||
367 | list of commands: |
|
368 | list of commands: | |
368 |
|
369 | |||
369 | add add the specified files on the next commit |
|
370 | add add the specified files on the next commit | |
370 | addremove add all new files, delete all missing files |
|
371 | addremove add all new files, delete all missing files | |
371 | annotate show changeset information by line for each file |
|
372 | annotate show changeset information by line for each file | |
372 | archive create an unversioned archive of a repository revision |
|
373 | archive create an unversioned archive of a repository revision | |
373 | backout reverse effect of earlier changeset |
|
374 | backout reverse effect of earlier changeset | |
374 | bisect subdivision search of changesets |
|
375 | bisect subdivision search of changesets | |
375 | bookmarks create a new bookmark or list existing bookmarks |
|
376 | bookmarks create a new bookmark or list existing bookmarks | |
376 | branch set or show the current branch name |
|
377 | branch set or show the current branch name | |
377 | branches list repository named branches |
|
378 | branches list repository named branches | |
378 | bundle create a changegroup file |
|
379 | bundle create a changegroup file | |
379 | cat output the current or given revision of files |
|
380 | cat output the current or given revision of files | |
380 | clone make a copy of an existing repository |
|
381 | clone make a copy of an existing repository | |
381 | commit commit the specified files or all outstanding changes |
|
382 | commit commit the specified files or all outstanding changes | |
382 | config show combined config settings from all hgrc files |
|
383 | config show combined config settings from all hgrc files | |
383 | copy mark files as copied for the next commit |
|
384 | copy mark files as copied for the next commit | |
384 | diff diff repository (or selected files) |
|
385 | diff diff repository (or selected files) | |
385 | export dump the header and diffs for one or more changesets |
|
386 | export dump the header and diffs for one or more changesets | |
|
387 | files list tracked files | |||
386 | forget forget the specified files on the next commit |
|
388 | forget forget the specified files on the next commit | |
387 | graft copy changes from other branches onto the current branch |
|
389 | graft copy changes from other branches onto the current branch | |
388 | grep search for a pattern in specified files and revisions |
|
390 | grep search for a pattern in specified files and revisions | |
389 | heads show branch heads |
|
391 | heads show branch heads | |
390 | help show help for a given topic or a help overview |
|
392 | help show help for a given topic or a help overview | |
391 | identify identify the working copy or specified revision |
|
393 | identify identify the working copy or specified revision | |
392 | import import an ordered set of patches |
|
394 | import import an ordered set of patches | |
393 | incoming show new changesets found in source |
|
395 | incoming show new changesets found in source | |
394 | init create a new repository in the given directory |
|
396 | init create a new repository in the given directory | |
395 | locate locate files matching specific patterns |
|
397 | locate locate files matching specific patterns | |
396 | log show revision history of entire repository or files |
|
398 | log show revision history of entire repository or files | |
397 | manifest output the current or given revision of the project manifest |
|
399 | manifest output the current or given revision of the project manifest | |
398 | merge merge working directory with another revision |
|
400 | merge merge working directory with another revision | |
399 | outgoing show changesets not found in the destination |
|
401 | outgoing show changesets not found in the destination | |
400 | parents show the parents of the working directory or revision |
|
402 | parents show the parents of the working directory or revision | |
401 | paths show aliases for remote repositories |
|
403 | paths show aliases for remote repositories | |
402 | phase set or show the current phase name |
|
404 | phase set or show the current phase name | |
403 | pull pull changes from the specified source |
|
405 | pull pull changes from the specified source | |
404 | push push changes to the specified destination |
|
406 | push push changes to the specified destination | |
405 | recover roll back an interrupted transaction |
|
407 | recover roll back an interrupted transaction | |
406 | remove remove the specified files on the next commit |
|
408 | remove remove the specified files on the next commit | |
407 | rename rename files; equivalent of copy + remove |
|
409 | rename rename files; equivalent of copy + remove | |
408 | resolve redo merges or set/view the merge status of files |
|
410 | resolve redo merges or set/view the merge status of files | |
409 | revert restore files to their checkout state |
|
411 | revert restore files to their checkout state | |
410 | root print the root (top) of the current working directory |
|
412 | root print the root (top) of the current working directory | |
411 | serve start stand-alone webserver |
|
413 | serve start stand-alone webserver | |
412 | status show changed files in the working directory |
|
414 | status show changed files in the working directory | |
413 | summary summarize working directory state |
|
415 | summary summarize working directory state | |
414 | tag add one or more tags for the current or given revision |
|
416 | tag add one or more tags for the current or given revision | |
415 | tags list repository tags |
|
417 | tags list repository tags | |
416 | unbundle apply one or more changegroup files |
|
418 | unbundle apply one or more changegroup files | |
417 | update update working directory (or switch revisions) |
|
419 | update update working directory (or switch revisions) | |
418 | verify verify the integrity of the repository |
|
420 | verify verify the integrity of the repository | |
419 | version output version and copyright information |
|
421 | version output version and copyright information | |
420 |
|
422 | |||
421 | additional help topics: |
|
423 | additional help topics: | |
422 |
|
424 | |||
423 | config Configuration Files |
|
425 | config Configuration Files | |
424 | dates Date Formats |
|
426 | dates Date Formats | |
425 | diffs Diff Formats |
|
427 | diffs Diff Formats | |
426 | environment Environment Variables |
|
428 | environment Environment Variables | |
427 | extensions Using Additional Features |
|
429 | extensions Using Additional Features | |
428 | filesets Specifying File Sets |
|
430 | filesets Specifying File Sets | |
429 | glossary Glossary |
|
431 | glossary Glossary | |
430 | hgignore Syntax for Mercurial Ignore Files |
|
432 | hgignore Syntax for Mercurial Ignore Files | |
431 | hgweb Configuring hgweb |
|
433 | hgweb Configuring hgweb | |
432 | merge-tools Merge Tools |
|
434 | merge-tools Merge Tools | |
433 | multirevs Specifying Multiple Revisions |
|
435 | multirevs Specifying Multiple Revisions | |
434 | patterns File Name Patterns |
|
436 | patterns File Name Patterns | |
435 | phases Working with Phases |
|
437 | phases Working with Phases | |
436 | revisions Specifying Single Revisions |
|
438 | revisions Specifying Single Revisions | |
437 | revsets Specifying Revision Sets |
|
439 | revsets Specifying Revision Sets | |
438 | subrepos Subrepositories |
|
440 | subrepos Subrepositories | |
439 | templating Template Usage |
|
441 | templating Template Usage | |
440 | urls URL Paths |
|
442 | urls URL Paths | |
441 |
|
443 | |||
442 | (use "hg help -v" to show built-in aliases and global options) |
|
444 | (use "hg help -v" to show built-in aliases and global options) | |
443 |
|
445 | |||
444 | Not tested: --debugger |
|
446 | Not tested: --debugger | |
445 |
|
447 |
@@ -1,2072 +1,2082 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 create a new bookmark or list existing bookmarks |
|
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 | files list tracked files | |||
69 | forget forget the specified files on the next commit |
|
70 | forget forget the specified files on the next commit | |
70 | graft copy changes from other branches onto the current branch |
|
71 | graft copy changes from other branches onto the current branch | |
71 | grep search for a pattern in specified files and revisions |
|
72 | grep search for a pattern in specified files and revisions | |
72 | heads show branch heads |
|
73 | heads show branch heads | |
73 | help show help for a given topic or a help overview |
|
74 | help show help for a given topic or a help overview | |
74 | identify identify the working copy or specified revision |
|
75 | identify identify the working copy or specified revision | |
75 | import import an ordered set of patches |
|
76 | import import an ordered set of patches | |
76 | incoming show new changesets found in source |
|
77 | incoming show new changesets found in source | |
77 | init create a new repository in the given directory |
|
78 | init create a new repository in the given directory | |
78 | locate locate files matching specific patterns |
|
79 | locate locate files matching specific patterns | |
79 | log show revision history of entire repository or files |
|
80 | log show revision history of entire repository or files | |
80 | manifest output the current or given revision of the project manifest |
|
81 | manifest output the current or given revision of the project manifest | |
81 | merge merge working directory with another revision |
|
82 | merge merge working directory with another revision | |
82 | outgoing show changesets not found in the destination |
|
83 | outgoing show changesets not found in the destination | |
83 | parents show the parents of the working directory or revision |
|
84 | parents show the parents of the working directory or revision | |
84 | paths show aliases for remote repositories |
|
85 | paths show aliases for remote repositories | |
85 | phase set or show the current phase name |
|
86 | phase set or show the current phase name | |
86 | pull pull changes from the specified source |
|
87 | pull pull changes from the specified source | |
87 | push push changes to the specified destination |
|
88 | push push changes to the specified destination | |
88 | recover roll back an interrupted transaction |
|
89 | recover roll back an interrupted transaction | |
89 | remove remove the specified files on the next commit |
|
90 | remove remove the specified files on the next commit | |
90 | rename rename files; equivalent of copy + remove |
|
91 | rename rename files; equivalent of copy + remove | |
91 | resolve redo merges or set/view the merge status of files |
|
92 | resolve redo merges or set/view the merge status of files | |
92 | revert restore files to their checkout state |
|
93 | revert restore files to their checkout state | |
93 | root print the root (top) of the current working directory |
|
94 | root print the root (top) of the current working directory | |
94 | serve start stand-alone webserver |
|
95 | serve start stand-alone webserver | |
95 | status show changed files in the working directory |
|
96 | status show changed files in the working directory | |
96 | summary summarize working directory state |
|
97 | summary summarize working directory state | |
97 | tag add one or more tags for the current or given revision |
|
98 | tag add one or more tags for the current or given revision | |
98 | tags list repository tags |
|
99 | tags list repository tags | |
99 | unbundle apply one or more changegroup files |
|
100 | unbundle apply one or more changegroup files | |
100 | update update working directory (or switch revisions) |
|
101 | update update working directory (or switch revisions) | |
101 | verify verify the integrity of the repository |
|
102 | verify verify the integrity of the repository | |
102 | version output version and copyright information |
|
103 | version output version and copyright information | |
103 |
|
104 | |||
104 | additional help topics: |
|
105 | additional help topics: | |
105 |
|
106 | |||
106 | config Configuration Files |
|
107 | config Configuration Files | |
107 | dates Date Formats |
|
108 | dates Date Formats | |
108 | diffs Diff Formats |
|
109 | diffs Diff Formats | |
109 | environment Environment Variables |
|
110 | environment Environment Variables | |
110 | extensions Using Additional Features |
|
111 | extensions Using Additional Features | |
111 | filesets Specifying File Sets |
|
112 | filesets Specifying File Sets | |
112 | glossary Glossary |
|
113 | glossary Glossary | |
113 | hgignore Syntax for Mercurial Ignore Files |
|
114 | hgignore Syntax for Mercurial Ignore Files | |
114 | hgweb Configuring hgweb |
|
115 | hgweb Configuring hgweb | |
115 | merge-tools Merge Tools |
|
116 | merge-tools Merge Tools | |
116 | multirevs Specifying Multiple Revisions |
|
117 | multirevs Specifying Multiple Revisions | |
117 | patterns File Name Patterns |
|
118 | patterns File Name Patterns | |
118 | phases Working with Phases |
|
119 | phases Working with Phases | |
119 | revisions Specifying Single Revisions |
|
120 | revisions Specifying Single Revisions | |
120 | revsets Specifying Revision Sets |
|
121 | revsets Specifying Revision Sets | |
121 | subrepos Subrepositories |
|
122 | subrepos Subrepositories | |
122 | templating Template Usage |
|
123 | templating Template Usage | |
123 | urls URL Paths |
|
124 | urls URL Paths | |
124 |
|
125 | |||
125 | (use "hg help -v" to show built-in aliases and global options) |
|
126 | (use "hg help -v" to show built-in aliases and global options) | |
126 |
|
127 | |||
127 | $ hg -q help |
|
128 | $ hg -q help | |
128 | add add the specified files on the next commit |
|
129 | add add the specified files on the next commit | |
129 | addremove add all new files, delete all missing files |
|
130 | addremove add all new files, delete all missing files | |
130 | annotate show changeset information by line for each file |
|
131 | annotate show changeset information by line for each file | |
131 | archive create an unversioned archive of a repository revision |
|
132 | archive create an unversioned archive of a repository revision | |
132 | backout reverse effect of earlier changeset |
|
133 | backout reverse effect of earlier changeset | |
133 | bisect subdivision search of changesets |
|
134 | bisect subdivision search of changesets | |
134 | bookmarks create a new bookmark or list existing bookmarks |
|
135 | bookmarks create a new bookmark or list existing bookmarks | |
135 | branch set or show the current branch name |
|
136 | branch set or show the current branch name | |
136 | branches list repository named branches |
|
137 | branches list repository named branches | |
137 | bundle create a changegroup file |
|
138 | bundle create a changegroup file | |
138 | cat output the current or given revision of files |
|
139 | cat output the current or given revision of files | |
139 | clone make a copy of an existing repository |
|
140 | clone make a copy of an existing repository | |
140 | commit commit the specified files or all outstanding changes |
|
141 | commit commit the specified files or all outstanding changes | |
141 | config show combined config settings from all hgrc files |
|
142 | config show combined config settings from all hgrc files | |
142 | copy mark files as copied for the next commit |
|
143 | copy mark files as copied for the next commit | |
143 | diff diff repository (or selected files) |
|
144 | diff diff repository (or selected files) | |
144 | export dump the header and diffs for one or more changesets |
|
145 | export dump the header and diffs for one or more changesets | |
|
146 | files list tracked files | |||
145 | forget forget the specified files on the next commit |
|
147 | forget forget the specified files on the next commit | |
146 | graft copy changes from other branches onto the current branch |
|
148 | graft copy changes from other branches onto the current branch | |
147 | grep search for a pattern in specified files and revisions |
|
149 | grep search for a pattern in specified files and revisions | |
148 | heads show branch heads |
|
150 | heads show branch heads | |
149 | help show help for a given topic or a help overview |
|
151 | help show help for a given topic or a help overview | |
150 | identify identify the working copy or specified revision |
|
152 | identify identify the working copy or specified revision | |
151 | import import an ordered set of patches |
|
153 | import import an ordered set of patches | |
152 | incoming show new changesets found in source |
|
154 | incoming show new changesets found in source | |
153 | init create a new repository in the given directory |
|
155 | init create a new repository in the given directory | |
154 | locate locate files matching specific patterns |
|
156 | locate locate files matching specific patterns | |
155 | log show revision history of entire repository or files |
|
157 | log show revision history of entire repository or files | |
156 | manifest output the current or given revision of the project manifest |
|
158 | manifest output the current or given revision of the project manifest | |
157 | merge merge working directory with another revision |
|
159 | merge merge working directory with another revision | |
158 | outgoing show changesets not found in the destination |
|
160 | outgoing show changesets not found in the destination | |
159 | parents show the parents of the working directory or revision |
|
161 | parents show the parents of the working directory or revision | |
160 | paths show aliases for remote repositories |
|
162 | paths show aliases for remote repositories | |
161 | phase set or show the current phase name |
|
163 | phase set or show the current phase name | |
162 | pull pull changes from the specified source |
|
164 | pull pull changes from the specified source | |
163 | push push changes to the specified destination |
|
165 | push push changes to the specified destination | |
164 | recover roll back an interrupted transaction |
|
166 | recover roll back an interrupted transaction | |
165 | remove remove the specified files on the next commit |
|
167 | remove remove the specified files on the next commit | |
166 | rename rename files; equivalent of copy + remove |
|
168 | rename rename files; equivalent of copy + remove | |
167 | resolve redo merges or set/view the merge status of files |
|
169 | resolve redo merges or set/view the merge status of files | |
168 | revert restore files to their checkout state |
|
170 | revert restore files to their checkout state | |
169 | root print the root (top) of the current working directory |
|
171 | root print the root (top) of the current working directory | |
170 | serve start stand-alone webserver |
|
172 | serve start stand-alone webserver | |
171 | status show changed files in the working directory |
|
173 | status show changed files in the working directory | |
172 | summary summarize working directory state |
|
174 | summary summarize working directory state | |
173 | tag add one or more tags for the current or given revision |
|
175 | tag add one or more tags for the current or given revision | |
174 | tags list repository tags |
|
176 | tags list repository tags | |
175 | unbundle apply one or more changegroup files |
|
177 | unbundle apply one or more changegroup files | |
176 | update update working directory (or switch revisions) |
|
178 | update update working directory (or switch revisions) | |
177 | verify verify the integrity of the repository |
|
179 | verify verify the integrity of the repository | |
178 | version output version and copyright information |
|
180 | version output version and copyright information | |
179 |
|
181 | |||
180 | additional help topics: |
|
182 | additional help topics: | |
181 |
|
183 | |||
182 | config Configuration Files |
|
184 | config Configuration Files | |
183 | dates Date Formats |
|
185 | dates Date Formats | |
184 | diffs Diff Formats |
|
186 | diffs Diff Formats | |
185 | environment Environment Variables |
|
187 | environment Environment Variables | |
186 | extensions Using Additional Features |
|
188 | extensions Using Additional Features | |
187 | filesets Specifying File Sets |
|
189 | filesets Specifying File Sets | |
188 | glossary Glossary |
|
190 | glossary Glossary | |
189 | hgignore Syntax for Mercurial Ignore Files |
|
191 | hgignore Syntax for Mercurial Ignore Files | |
190 | hgweb Configuring hgweb |
|
192 | hgweb Configuring hgweb | |
191 | merge-tools Merge Tools |
|
193 | merge-tools Merge Tools | |
192 | multirevs Specifying Multiple Revisions |
|
194 | multirevs Specifying Multiple Revisions | |
193 | patterns File Name Patterns |
|
195 | patterns File Name Patterns | |
194 | phases Working with Phases |
|
196 | phases Working with Phases | |
195 | revisions Specifying Single Revisions |
|
197 | revisions Specifying Single Revisions | |
196 | revsets Specifying Revision Sets |
|
198 | revsets Specifying Revision Sets | |
197 | subrepos Subrepositories |
|
199 | subrepos Subrepositories | |
198 | templating Template Usage |
|
200 | templating Template Usage | |
199 | urls URL Paths |
|
201 | urls URL Paths | |
200 |
|
202 | |||
201 | Test extension help: |
|
203 | Test extension help: | |
202 | $ hg help extensions --config extensions.rebase= --config extensions.children= |
|
204 | $ hg help extensions --config extensions.rebase= --config extensions.children= | |
203 | Using Additional Features |
|
205 | Using Additional Features | |
204 | """"""""""""""""""""""""" |
|
206 | """"""""""""""""""""""""" | |
205 |
|
207 | |||
206 | Mercurial has the ability to add new features through the use of |
|
208 | Mercurial has the ability to add new features through the use of | |
207 | extensions. Extensions may add new commands, add options to existing |
|
209 | extensions. Extensions may add new commands, add options to existing | |
208 | commands, change the default behavior of commands, or implement hooks. |
|
210 | commands, change the default behavior of commands, or implement hooks. | |
209 |
|
211 | |||
210 | To enable the "foo" extension, either shipped with Mercurial or in the |
|
212 | 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, |
|
213 | Python search path, create an entry for it in your configuration file, | |
212 | like this: |
|
214 | like this: | |
213 |
|
215 | |||
214 | [extensions] |
|
216 | [extensions] | |
215 | foo = |
|
217 | foo = | |
216 |
|
218 | |||
217 | You may also specify the full path to an extension: |
|
219 | You may also specify the full path to an extension: | |
218 |
|
220 | |||
219 | [extensions] |
|
221 | [extensions] | |
220 | myfeature = ~/.hgext/myfeature.py |
|
222 | myfeature = ~/.hgext/myfeature.py | |
221 |
|
223 | |||
222 | See "hg help config" for more information on configuration files. |
|
224 | See "hg help config" for more information on configuration files. | |
223 |
|
225 | |||
224 | Extensions are not loaded by default for a variety of reasons: they can |
|
226 | 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 |
|
227 | increase startup overhead; they may be meant for advanced usage only; they | |
226 | may provide potentially dangerous abilities (such as letting you destroy |
|
228 | 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 |
|
229 | 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 |
|
230 | alter some usual behaviors of stock Mercurial. It is thus up to the user | |
229 | to activate extensions as needed. |
|
231 | to activate extensions as needed. | |
230 |
|
232 | |||
231 | To explicitly disable an extension enabled in a configuration file of |
|
233 | To explicitly disable an extension enabled in a configuration file of | |
232 | broader scope, prepend its path with !: |
|
234 | broader scope, prepend its path with !: | |
233 |
|
235 | |||
234 | [extensions] |
|
236 | [extensions] | |
235 | # disabling extension bar residing in /path/to/extension/bar.py |
|
237 | # disabling extension bar residing in /path/to/extension/bar.py | |
236 | bar = !/path/to/extension/bar.py |
|
238 | bar = !/path/to/extension/bar.py | |
237 | # ditto, but no path was supplied for extension baz |
|
239 | # ditto, but no path was supplied for extension baz | |
238 | baz = ! |
|
240 | baz = ! | |
239 |
|
241 | |||
240 | enabled extensions: |
|
242 | enabled extensions: | |
241 |
|
243 | |||
242 | children command to display child changesets (DEPRECATED) |
|
244 | children command to display child changesets (DEPRECATED) | |
243 | rebase command to move sets of revisions to a different ancestor |
|
245 | rebase command to move sets of revisions to a different ancestor | |
244 |
|
246 | |||
245 | disabled extensions: |
|
247 | disabled extensions: | |
246 |
|
248 | |||
247 | acl hooks for controlling repository access |
|
249 | acl hooks for controlling repository access | |
248 | blackbox log repository events to a blackbox for debugging |
|
250 | blackbox log repository events to a blackbox for debugging | |
249 | bugzilla hooks for integrating with the Bugzilla bug tracker |
|
251 | bugzilla hooks for integrating with the Bugzilla bug tracker | |
250 | churn command to display statistics about repository history |
|
252 | churn command to display statistics about repository history | |
251 | color colorize output from some commands |
|
253 | color colorize output from some commands | |
252 | convert import revisions from foreign VCS repositories into |
|
254 | convert import revisions from foreign VCS repositories into | |
253 | Mercurial |
|
255 | Mercurial | |
254 | eol automatically manage newlines in repository files |
|
256 | eol automatically manage newlines in repository files | |
255 | extdiff command to allow external programs to compare revisions |
|
257 | extdiff command to allow external programs to compare revisions | |
256 | factotum http authentication with factotum |
|
258 | factotum http authentication with factotum | |
257 | gpg commands to sign and verify changesets |
|
259 | gpg commands to sign and verify changesets | |
258 | hgcia hooks for integrating with the CIA.vc notification service |
|
260 | hgcia hooks for integrating with the CIA.vc notification service | |
259 | hgk browse the repository in a graphical way |
|
261 | hgk browse the repository in a graphical way | |
260 | highlight syntax highlighting for hgweb (requires Pygments) |
|
262 | highlight syntax highlighting for hgweb (requires Pygments) | |
261 | histedit interactive history editing |
|
263 | histedit interactive history editing | |
262 | keyword expand keywords in tracked files |
|
264 | keyword expand keywords in tracked files | |
263 | largefiles track large binary files |
|
265 | largefiles track large binary files | |
264 | mq manage a stack of patches |
|
266 | mq manage a stack of patches | |
265 | notify hooks for sending email push notifications |
|
267 | notify hooks for sending email push notifications | |
266 | pager browse command output with an external pager |
|
268 | pager browse command output with an external pager | |
267 | patchbomb command to send changesets as (a series of) patch emails |
|
269 | patchbomb command to send changesets as (a series of) patch emails | |
268 | progress show progress bars for some actions |
|
270 | progress show progress bars for some actions | |
269 | purge command to delete untracked files from the working |
|
271 | purge command to delete untracked files from the working | |
270 | directory |
|
272 | directory | |
271 | record commands to interactively select changes for |
|
273 | record commands to interactively select changes for | |
272 | commit/qrefresh |
|
274 | commit/qrefresh | |
273 | relink recreates hardlinks between repository clones |
|
275 | relink recreates hardlinks between repository clones | |
274 | schemes extend schemes with shortcuts to repository swarms |
|
276 | schemes extend schemes with shortcuts to repository swarms | |
275 | share share a common history between several working directories |
|
277 | share share a common history between several working directories | |
276 | shelve save and restore changes to the working directory |
|
278 | shelve save and restore changes to the working directory | |
277 | strip strip changesets and their descendents from history |
|
279 | strip strip changesets and their descendents from history | |
278 | transplant command to transplant changesets from another branch |
|
280 | transplant command to transplant changesets from another branch | |
279 | win32mbcs allow the use of MBCS paths with problematic encodings |
|
281 | win32mbcs allow the use of MBCS paths with problematic encodings | |
280 | zeroconf discover and advertise repositories on the local network |
|
282 | zeroconf discover and advertise repositories on the local network | |
281 | Test short command list with verbose option |
|
283 | Test short command list with verbose option | |
282 |
|
284 | |||
283 | $ hg -v help shortlist |
|
285 | $ hg -v help shortlist | |
284 | Mercurial Distributed SCM |
|
286 | Mercurial Distributed SCM | |
285 |
|
287 | |||
286 | basic commands: |
|
288 | basic commands: | |
287 |
|
289 | |||
288 | add add the specified files on the next commit |
|
290 | add add the specified files on the next commit | |
289 | annotate, blame |
|
291 | annotate, blame | |
290 | show changeset information by line for each file |
|
292 | show changeset information by line for each file | |
291 | clone make a copy of an existing repository |
|
293 | clone make a copy of an existing repository | |
292 | commit, ci commit the specified files or all outstanding changes |
|
294 | commit, ci commit the specified files or all outstanding changes | |
293 | diff diff repository (or selected files) |
|
295 | diff diff repository (or selected files) | |
294 | export dump the header and diffs for one or more changesets |
|
296 | export dump the header and diffs for one or more changesets | |
295 | forget forget the specified files on the next commit |
|
297 | forget forget the specified files on the next commit | |
296 | init create a new repository in the given directory |
|
298 | init create a new repository in the given directory | |
297 | log, history show revision history of entire repository or files |
|
299 | log, history show revision history of entire repository or files | |
298 | merge merge working directory with another revision |
|
300 | merge merge working directory with another revision | |
299 | pull pull changes from the specified source |
|
301 | pull pull changes from the specified source | |
300 | push push changes to the specified destination |
|
302 | push push changes to the specified destination | |
301 | remove, rm remove the specified files on the next commit |
|
303 | remove, rm remove the specified files on the next commit | |
302 | serve start stand-alone webserver |
|
304 | serve start stand-alone webserver | |
303 | status, st show changed files in the working directory |
|
305 | status, st show changed files in the working directory | |
304 | summary, sum summarize working directory state |
|
306 | summary, sum summarize working directory state | |
305 | update, up, checkout, co |
|
307 | update, up, checkout, co | |
306 | update working directory (or switch revisions) |
|
308 | update working directory (or switch revisions) | |
307 |
|
309 | |||
308 | global options ([+] can be repeated): |
|
310 | global options ([+] can be repeated): | |
309 |
|
311 | |||
310 | -R --repository REPO repository root directory or name of overlay bundle |
|
312 | -R --repository REPO repository root directory or name of overlay bundle | |
311 | file |
|
313 | file | |
312 | --cwd DIR change working directory |
|
314 | --cwd DIR change working directory | |
313 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
315 | -y --noninteractive do not prompt, automatically pick the first choice for | |
314 | all prompts |
|
316 | all prompts | |
315 | -q --quiet suppress output |
|
317 | -q --quiet suppress output | |
316 | -v --verbose enable additional output |
|
318 | -v --verbose enable additional output | |
317 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
319 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
318 | --debug enable debugging output |
|
320 | --debug enable debugging output | |
319 | --debugger start debugger |
|
321 | --debugger start debugger | |
320 | --encoding ENCODE set the charset encoding (default: ascii) |
|
322 | --encoding ENCODE set the charset encoding (default: ascii) | |
321 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
323 | --encodingmode MODE set the charset encoding mode (default: strict) | |
322 | --traceback always print a traceback on exception |
|
324 | --traceback always print a traceback on exception | |
323 | --time time how long the command takes |
|
325 | --time time how long the command takes | |
324 | --profile print command execution profile |
|
326 | --profile print command execution profile | |
325 | --version output version information and exit |
|
327 | --version output version information and exit | |
326 | -h --help display help and exit |
|
328 | -h --help display help and exit | |
327 | --hidden consider hidden changesets |
|
329 | --hidden consider hidden changesets | |
328 |
|
330 | |||
329 | (use "hg help" for the full list of commands) |
|
331 | (use "hg help" for the full list of commands) | |
330 |
|
332 | |||
331 | $ hg add -h |
|
333 | $ hg add -h | |
332 | hg add [OPTION]... [FILE]... |
|
334 | hg add [OPTION]... [FILE]... | |
333 |
|
335 | |||
334 | add the specified files on the next commit |
|
336 | add the specified files on the next commit | |
335 |
|
337 | |||
336 | Schedule files to be version controlled and added to the repository. |
|
338 | Schedule files to be version controlled and added to the repository. | |
337 |
|
339 | |||
338 | 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 | |
339 | add before that, see "hg forget". |
|
341 | add before that, see "hg forget". | |
340 |
|
342 | |||
341 | If no names are given, add all files to the repository. |
|
343 | If no names are given, add all files to the repository. | |
342 |
|
344 | |||
343 | Returns 0 if all files are successfully added. |
|
345 | Returns 0 if all files are successfully added. | |
344 |
|
346 | |||
345 | options ([+] can be repeated): |
|
347 | options ([+] can be repeated): | |
346 |
|
348 | |||
347 | -I --include PATTERN [+] include names matching the given patterns |
|
349 | -I --include PATTERN [+] include names matching the given patterns | |
348 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
350 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
349 | -S --subrepos recurse into subrepositories |
|
351 | -S --subrepos recurse into subrepositories | |
350 | -n --dry-run do not perform actions, just print output |
|
352 | -n --dry-run do not perform actions, just print output | |
351 |
|
353 | |||
352 | (some details hidden, use --verbose to show complete help) |
|
354 | (some details hidden, use --verbose to show complete help) | |
353 |
|
355 | |||
354 | Verbose help for add |
|
356 | Verbose help for add | |
355 |
|
357 | |||
356 | $ hg add -hv |
|
358 | $ hg add -hv | |
357 | hg add [OPTION]... [FILE]... |
|
359 | hg add [OPTION]... [FILE]... | |
358 |
|
360 | |||
359 | add the specified files on the next commit |
|
361 | add the specified files on the next commit | |
360 |
|
362 | |||
361 | Schedule files to be version controlled and added to the repository. |
|
363 | Schedule files to be version controlled and added to the repository. | |
362 |
|
364 | |||
363 | The files will be added to the repository at the next commit. To undo an |
|
365 | The files will be added to the repository at the next commit. To undo an | |
364 | add before that, see "hg forget". |
|
366 | add before that, see "hg forget". | |
365 |
|
367 | |||
366 | If no names are given, add all files to the repository. |
|
368 | If no names are given, add all files to the repository. | |
367 |
|
369 | |||
368 | An example showing how new (unknown) files are added automatically by "hg |
|
370 | An example showing how new (unknown) files are added automatically by "hg | |
369 | add": |
|
371 | add": | |
370 |
|
372 | |||
371 | $ ls |
|
373 | $ ls | |
372 | foo.c |
|
374 | foo.c | |
373 | $ hg status |
|
375 | $ hg status | |
374 | ? foo.c |
|
376 | ? foo.c | |
375 | $ hg add |
|
377 | $ hg add | |
376 | adding foo.c |
|
378 | adding foo.c | |
377 | $ hg status |
|
379 | $ hg status | |
378 | A foo.c |
|
380 | A foo.c | |
379 |
|
381 | |||
380 | Returns 0 if all files are successfully added. |
|
382 | Returns 0 if all files are successfully added. | |
381 |
|
383 | |||
382 | options ([+] can be repeated): |
|
384 | options ([+] can be repeated): | |
383 |
|
385 | |||
384 | -I --include PATTERN [+] include names matching the given patterns |
|
386 | -I --include PATTERN [+] include names matching the given patterns | |
385 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
387 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
386 | -S --subrepos recurse into subrepositories |
|
388 | -S --subrepos recurse into subrepositories | |
387 | -n --dry-run do not perform actions, just print output |
|
389 | -n --dry-run do not perform actions, just print output | |
388 |
|
390 | |||
389 | global options ([+] can be repeated): |
|
391 | global options ([+] can be repeated): | |
390 |
|
392 | |||
391 | -R --repository REPO repository root directory or name of overlay bundle |
|
393 | -R --repository REPO repository root directory or name of overlay bundle | |
392 | file |
|
394 | file | |
393 | --cwd DIR change working directory |
|
395 | --cwd DIR change working directory | |
394 | -y --noninteractive do not prompt, automatically pick the first choice for |
|
396 | -y --noninteractive do not prompt, automatically pick the first choice for | |
395 | all prompts |
|
397 | all prompts | |
396 | -q --quiet suppress output |
|
398 | -q --quiet suppress output | |
397 | -v --verbose enable additional output |
|
399 | -v --verbose enable additional output | |
398 | --config CONFIG [+] set/override config option (use 'section.name=value') |
|
400 | --config CONFIG [+] set/override config option (use 'section.name=value') | |
399 | --debug enable debugging output |
|
401 | --debug enable debugging output | |
400 | --debugger start debugger |
|
402 | --debugger start debugger | |
401 | --encoding ENCODE set the charset encoding (default: ascii) |
|
403 | --encoding ENCODE set the charset encoding (default: ascii) | |
402 | --encodingmode MODE set the charset encoding mode (default: strict) |
|
404 | --encodingmode MODE set the charset encoding mode (default: strict) | |
403 | --traceback always print a traceback on exception |
|
405 | --traceback always print a traceback on exception | |
404 | --time time how long the command takes |
|
406 | --time time how long the command takes | |
405 | --profile print command execution profile |
|
407 | --profile print command execution profile | |
406 | --version output version information and exit |
|
408 | --version output version information and exit | |
407 | -h --help display help and exit |
|
409 | -h --help display help and exit | |
408 | --hidden consider hidden changesets |
|
410 | --hidden consider hidden changesets | |
409 |
|
411 | |||
410 | Test help option with version option |
|
412 | Test help option with version option | |
411 |
|
413 | |||
412 | $ hg add -h --version |
|
414 | $ hg add -h --version | |
413 | Mercurial Distributed SCM (version *) (glob) |
|
415 | Mercurial Distributed SCM (version *) (glob) | |
414 | (see http://mercurial.selenic.com for more information) |
|
416 | (see http://mercurial.selenic.com for more information) | |
415 |
|
417 | |||
416 | Copyright (C) 2005-2014 Matt Mackall and others |
|
418 | Copyright (C) 2005-2014 Matt Mackall and others | |
417 | This is free software; see the source for copying conditions. There is NO |
|
419 | This is free software; see the source for copying conditions. There is NO | |
418 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
420 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
419 |
|
421 | |||
420 | $ hg add --skjdfks |
|
422 | $ hg add --skjdfks | |
421 | hg add: option --skjdfks not recognized |
|
423 | hg add: option --skjdfks not recognized | |
422 | hg add [OPTION]... [FILE]... |
|
424 | hg add [OPTION]... [FILE]... | |
423 |
|
425 | |||
424 | add the specified files on the next commit |
|
426 | add the specified files on the next commit | |
425 |
|
427 | |||
426 | options ([+] can be repeated): |
|
428 | options ([+] can be repeated): | |
427 |
|
429 | |||
428 | -I --include PATTERN [+] include names matching the given patterns |
|
430 | -I --include PATTERN [+] include names matching the given patterns | |
429 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
431 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
430 | -S --subrepos recurse into subrepositories |
|
432 | -S --subrepos recurse into subrepositories | |
431 | -n --dry-run do not perform actions, just print output |
|
433 | -n --dry-run do not perform actions, just print output | |
432 |
|
434 | |||
433 | (use "hg add -h" to show more help) |
|
435 | (use "hg add -h" to show more help) | |
434 | [255] |
|
436 | [255] | |
435 |
|
437 | |||
436 | Test ambiguous command help |
|
438 | Test ambiguous command help | |
437 |
|
439 | |||
438 | $ hg help ad |
|
440 | $ hg help ad | |
439 | list of commands: |
|
441 | list of commands: | |
440 |
|
442 | |||
441 | add add the specified files on the next commit |
|
443 | add add the specified files on the next commit | |
442 | addremove add all new files, delete all missing files |
|
444 | addremove add all new files, delete all missing files | |
443 |
|
445 | |||
444 | (use "hg help -v ad" to show built-in aliases and global options) |
|
446 | (use "hg help -v ad" to show built-in aliases and global options) | |
445 |
|
447 | |||
446 | Test command without options |
|
448 | Test command without options | |
447 |
|
449 | |||
448 | $ hg help verify |
|
450 | $ hg help verify | |
449 | hg verify |
|
451 | hg verify | |
450 |
|
452 | |||
451 | verify the integrity of the repository |
|
453 | verify the integrity of the repository | |
452 |
|
454 | |||
453 | Verify the integrity of the current repository. |
|
455 | Verify the integrity of the current repository. | |
454 |
|
456 | |||
455 | This will perform an extensive check of the repository's integrity, |
|
457 | This will perform an extensive check of the repository's integrity, | |
456 | validating the hashes and checksums of each entry in the changelog, |
|
458 | validating the hashes and checksums of each entry in the changelog, | |
457 | manifest, and tracked files, as well as the integrity of their crosslinks |
|
459 | manifest, and tracked files, as well as the integrity of their crosslinks | |
458 | and indices. |
|
460 | and indices. | |
459 |
|
461 | |||
460 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more |
|
462 | Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more | |
461 | information about recovery from corruption of the repository. |
|
463 | information about recovery from corruption of the repository. | |
462 |
|
464 | |||
463 | Returns 0 on success, 1 if errors are encountered. |
|
465 | Returns 0 on success, 1 if errors are encountered. | |
464 |
|
466 | |||
465 | (some details hidden, use --verbose to show complete help) |
|
467 | (some details hidden, use --verbose to show complete help) | |
466 |
|
468 | |||
467 | $ hg help diff |
|
469 | $ hg help diff | |
468 | hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]... |
|
470 | hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]... | |
469 |
|
471 | |||
470 | diff repository (or selected files) |
|
472 | diff repository (or selected files) | |
471 |
|
473 | |||
472 | Show differences between revisions for the specified files. |
|
474 | Show differences between revisions for the specified files. | |
473 |
|
475 | |||
474 | Differences between files are shown using the unified diff format. |
|
476 | Differences between files are shown using the unified diff format. | |
475 |
|
477 | |||
476 | Note: |
|
478 | Note: | |
477 | diff may generate unexpected results for merges, as it will default to |
|
479 | diff may generate unexpected results for merges, as it will default to | |
478 | comparing against the working directory's first parent changeset if no |
|
480 | comparing against the working directory's first parent changeset if no | |
479 | revisions are specified. |
|
481 | revisions are specified. | |
480 |
|
482 | |||
481 | When two revision arguments are given, then changes are shown between |
|
483 | When two revision arguments are given, then changes are shown between | |
482 | those revisions. If only one revision is specified then that revision is |
|
484 | those revisions. If only one revision is specified then that revision is | |
483 | compared to the working directory, and, when no revisions are specified, |
|
485 | compared to the working directory, and, when no revisions are specified, | |
484 | the working directory files are compared to its parent. |
|
486 | the working directory files are compared to its parent. | |
485 |
|
487 | |||
486 | Alternatively you can specify -c/--change with a revision to see the |
|
488 | Alternatively you can specify -c/--change with a revision to see the | |
487 | changes in that changeset relative to its first parent. |
|
489 | changes in that changeset relative to its first parent. | |
488 |
|
490 | |||
489 | Without the -a/--text option, diff will avoid generating diffs of files it |
|
491 | Without the -a/--text option, diff will avoid generating diffs of files it | |
490 | detects as binary. With -a, diff will generate a diff anyway, probably |
|
492 | detects as binary. With -a, diff will generate a diff anyway, probably | |
491 | with undesirable results. |
|
493 | with undesirable results. | |
492 |
|
494 | |||
493 | Use the -g/--git option to generate diffs in the git extended diff format. |
|
495 | Use the -g/--git option to generate diffs in the git extended diff format. | |
494 | For more information, read "hg help diffs". |
|
496 | For more information, read "hg help diffs". | |
495 |
|
497 | |||
496 | Returns 0 on success. |
|
498 | Returns 0 on success. | |
497 |
|
499 | |||
498 | options ([+] can be repeated): |
|
500 | options ([+] can be repeated): | |
499 |
|
501 | |||
500 | -r --rev REV [+] revision |
|
502 | -r --rev REV [+] revision | |
501 | -c --change REV change made by revision |
|
503 | -c --change REV change made by revision | |
502 | -a --text treat all files as text |
|
504 | -a --text treat all files as text | |
503 | -g --git use git extended diff format |
|
505 | -g --git use git extended diff format | |
504 | --nodates omit dates from diff headers |
|
506 | --nodates omit dates from diff headers | |
505 | -p --show-function show which function each change is in |
|
507 | -p --show-function show which function each change is in | |
506 | --reverse produce a diff that undoes the changes |
|
508 | --reverse produce a diff that undoes the changes | |
507 | -w --ignore-all-space ignore white space when comparing lines |
|
509 | -w --ignore-all-space ignore white space when comparing lines | |
508 | -b --ignore-space-change ignore changes in the amount of white space |
|
510 | -b --ignore-space-change ignore changes in the amount of white space | |
509 | -B --ignore-blank-lines ignore changes whose lines are all blank |
|
511 | -B --ignore-blank-lines ignore changes whose lines are all blank | |
510 | -U --unified NUM number of lines of context to show |
|
512 | -U --unified NUM number of lines of context to show | |
511 | --stat output diffstat-style summary of changes |
|
513 | --stat output diffstat-style summary of changes | |
512 | -I --include PATTERN [+] include names matching the given patterns |
|
514 | -I --include PATTERN [+] include names matching the given patterns | |
513 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
515 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
514 | -S --subrepos recurse into subrepositories |
|
516 | -S --subrepos recurse into subrepositories | |
515 |
|
517 | |||
516 | (some details hidden, use --verbose to show complete help) |
|
518 | (some details hidden, use --verbose to show complete help) | |
517 |
|
519 | |||
518 | $ hg help status |
|
520 | $ hg help status | |
519 | hg status [OPTION]... [FILE]... |
|
521 | hg status [OPTION]... [FILE]... | |
520 |
|
522 | |||
521 | aliases: st |
|
523 | aliases: st | |
522 |
|
524 | |||
523 | show changed files in the working directory |
|
525 | show changed files in the working directory | |
524 |
|
526 | |||
525 | Show status of files in the repository. If names are given, only files |
|
527 | Show status of files in the repository. If names are given, only files | |
526 | that match are shown. Files that are clean or ignored or the source of a |
|
528 | that match are shown. Files that are clean or ignored or the source of a | |
527 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, |
|
529 | copy/move operation, are not listed unless -c/--clean, -i/--ignored, | |
528 | -C/--copies or -A/--all are given. Unless options described with "show |
|
530 | -C/--copies or -A/--all are given. Unless options described with "show | |
529 | only ..." are given, the options -mardu are used. |
|
531 | only ..." are given, the options -mardu are used. | |
530 |
|
532 | |||
531 | Option -q/--quiet hides untracked (unknown and ignored) files unless |
|
533 | Option -q/--quiet hides untracked (unknown and ignored) files unless | |
532 | explicitly requested with -u/--unknown or -i/--ignored. |
|
534 | explicitly requested with -u/--unknown or -i/--ignored. | |
533 |
|
535 | |||
534 | Note: |
|
536 | Note: | |
535 | status may appear to disagree with diff if permissions have changed or |
|
537 | status may appear to disagree with diff if permissions have changed or | |
536 | a merge has occurred. The standard diff format does not report |
|
538 | a merge has occurred. The standard diff format does not report | |
537 | permission changes and diff only reports changes relative to one merge |
|
539 | permission changes and diff only reports changes relative to one merge | |
538 | parent. |
|
540 | parent. | |
539 |
|
541 | |||
540 | If one revision is given, it is used as the base revision. If two |
|
542 | If one revision is given, it is used as the base revision. If two | |
541 | revisions are given, the differences between them are shown. The --change |
|
543 | revisions are given, the differences between them are shown. The --change | |
542 | option can also be used as a shortcut to list the changed files of a |
|
544 | option can also be used as a shortcut to list the changed files of a | |
543 | revision from its first parent. |
|
545 | revision from its first parent. | |
544 |
|
546 | |||
545 | The codes used to show the status of files are: |
|
547 | The codes used to show the status of files are: | |
546 |
|
548 | |||
547 | M = modified |
|
549 | M = modified | |
548 | A = added |
|
550 | A = added | |
549 | R = removed |
|
551 | R = removed | |
550 | C = clean |
|
552 | C = clean | |
551 | ! = missing (deleted by non-hg command, but still tracked) |
|
553 | ! = missing (deleted by non-hg command, but still tracked) | |
552 | ? = not tracked |
|
554 | ? = not tracked | |
553 | I = ignored |
|
555 | I = ignored | |
554 | = origin of the previous file (with --copies) |
|
556 | = origin of the previous file (with --copies) | |
555 |
|
557 | |||
556 | Returns 0 on success. |
|
558 | Returns 0 on success. | |
557 |
|
559 | |||
558 | options ([+] can be repeated): |
|
560 | options ([+] can be repeated): | |
559 |
|
561 | |||
560 | -A --all show status of all files |
|
562 | -A --all show status of all files | |
561 | -m --modified show only modified files |
|
563 | -m --modified show only modified files | |
562 | -a --added show only added files |
|
564 | -a --added show only added files | |
563 | -r --removed show only removed files |
|
565 | -r --removed show only removed files | |
564 | -d --deleted show only deleted (but tracked) files |
|
566 | -d --deleted show only deleted (but tracked) files | |
565 | -c --clean show only files without changes |
|
567 | -c --clean show only files without changes | |
566 | -u --unknown show only unknown (not tracked) files |
|
568 | -u --unknown show only unknown (not tracked) files | |
567 | -i --ignored show only ignored files |
|
569 | -i --ignored show only ignored files | |
568 | -n --no-status hide status prefix |
|
570 | -n --no-status hide status prefix | |
569 | -C --copies show source of copied files |
|
571 | -C --copies show source of copied files | |
570 | -0 --print0 end filenames with NUL, for use with xargs |
|
572 | -0 --print0 end filenames with NUL, for use with xargs | |
571 | --rev REV [+] show difference from revision |
|
573 | --rev REV [+] show difference from revision | |
572 | --change REV list the changed files of a revision |
|
574 | --change REV list the changed files of a revision | |
573 | -I --include PATTERN [+] include names matching the given patterns |
|
575 | -I --include PATTERN [+] include names matching the given patterns | |
574 | -X --exclude PATTERN [+] exclude names matching the given patterns |
|
576 | -X --exclude PATTERN [+] exclude names matching the given patterns | |
575 | -S --subrepos recurse into subrepositories |
|
577 | -S --subrepos recurse into subrepositories | |
576 |
|
578 | |||
577 | (some details hidden, use --verbose to show complete help) |
|
579 | (some details hidden, use --verbose to show complete help) | |
578 |
|
580 | |||
579 | $ hg -q help status |
|
581 | $ hg -q help status | |
580 | hg status [OPTION]... [FILE]... |
|
582 | hg status [OPTION]... [FILE]... | |
581 |
|
583 | |||
582 | show changed files in the working directory |
|
584 | show changed files in the working directory | |
583 |
|
585 | |||
584 | $ hg help foo |
|
586 | $ hg help foo | |
585 | abort: no such help topic: foo |
|
587 | abort: no such help topic: foo | |
586 | (try "hg help --keyword foo") |
|
588 | (try "hg help --keyword foo") | |
587 | [255] |
|
589 | [255] | |
588 |
|
590 | |||
589 | $ hg skjdfks |
|
591 | $ hg skjdfks | |
590 | hg: unknown command 'skjdfks' |
|
592 | hg: unknown command 'skjdfks' | |
591 | Mercurial Distributed SCM |
|
593 | Mercurial Distributed SCM | |
592 |
|
594 | |||
593 | basic commands: |
|
595 | basic commands: | |
594 |
|
596 | |||
595 | add add the specified files on the next commit |
|
597 | add add the specified files on the next commit | |
596 | annotate show changeset information by line for each file |
|
598 | annotate show changeset information by line for each file | |
597 | clone make a copy of an existing repository |
|
599 | clone make a copy of an existing repository | |
598 | commit commit the specified files or all outstanding changes |
|
600 | commit commit the specified files or all outstanding changes | |
599 | diff diff repository (or selected files) |
|
601 | diff diff repository (or selected files) | |
600 | export dump the header and diffs for one or more changesets |
|
602 | export dump the header and diffs for one or more changesets | |
601 | forget forget the specified files on the next commit |
|
603 | forget forget the specified files on the next commit | |
602 | init create a new repository in the given directory |
|
604 | init create a new repository in the given directory | |
603 | log show revision history of entire repository or files |
|
605 | log show revision history of entire repository or files | |
604 | merge merge working directory with another revision |
|
606 | merge merge working directory with another revision | |
605 | pull pull changes from the specified source |
|
607 | pull pull changes from the specified source | |
606 | push push changes to the specified destination |
|
608 | push push changes to the specified destination | |
607 | remove remove the specified files on the next commit |
|
609 | remove remove the specified files on the next commit | |
608 | serve start stand-alone webserver |
|
610 | serve start stand-alone webserver | |
609 | status show changed files in the working directory |
|
611 | status show changed files in the working directory | |
610 | summary summarize working directory state |
|
612 | summary summarize working directory state | |
611 | update update working directory (or switch revisions) |
|
613 | update update working directory (or switch revisions) | |
612 |
|
614 | |||
613 | (use "hg help" for the full list of commands or "hg -v" for details) |
|
615 | (use "hg help" for the full list of commands or "hg -v" for details) | |
614 | [255] |
|
616 | [255] | |
615 |
|
617 | |||
616 |
|
618 | |||
617 | $ cat > helpext.py <<EOF |
|
619 | $ cat > helpext.py <<EOF | |
618 | > import os |
|
620 | > import os | |
619 | > from mercurial import cmdutil, commands |
|
621 | > from mercurial import cmdutil, commands | |
620 | > |
|
622 | > | |
621 | > cmdtable = {} |
|
623 | > cmdtable = {} | |
622 | > command = cmdutil.command(cmdtable) |
|
624 | > command = cmdutil.command(cmdtable) | |
623 | > |
|
625 | > | |
624 | > @command('nohelp', |
|
626 | > @command('nohelp', | |
625 | > [('', 'longdesc', 3, 'x'*90), |
|
627 | > [('', 'longdesc', 3, 'x'*90), | |
626 | > ('n', '', None, 'normal desc'), |
|
628 | > ('n', '', None, 'normal desc'), | |
627 | > ('', 'newline', '', 'line1\nline2')], |
|
629 | > ('', 'newline', '', 'line1\nline2')], | |
628 | > 'hg nohelp', |
|
630 | > 'hg nohelp', | |
629 | > norepo=True) |
|
631 | > norepo=True) | |
630 | > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')]) |
|
632 | > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')]) | |
631 | > def nohelp(ui, *args, **kwargs): |
|
633 | > def nohelp(ui, *args, **kwargs): | |
632 | > pass |
|
634 | > pass | |
633 | > |
|
635 | > | |
634 | > EOF |
|
636 | > EOF | |
635 | $ echo '[extensions]' >> $HGRCPATH |
|
637 | $ echo '[extensions]' >> $HGRCPATH | |
636 | $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH |
|
638 | $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH | |
637 |
|
639 | |||
638 | Test command with no help text |
|
640 | Test command with no help text | |
639 |
|
641 | |||
640 | $ hg help nohelp |
|
642 | $ hg help nohelp | |
641 | hg nohelp |
|
643 | hg nohelp | |
642 |
|
644 | |||
643 | (no help text available) |
|
645 | (no help text available) | |
644 |
|
646 | |||
645 | options: |
|
647 | options: | |
646 |
|
648 | |||
647 | --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
|
649 | --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
648 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3) |
|
650 | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3) | |
649 | -n -- normal desc |
|
651 | -n -- normal desc | |
650 | --newline VALUE line1 line2 |
|
652 | --newline VALUE line1 line2 | |
651 |
|
653 | |||
652 | (some details hidden, use --verbose to show complete help) |
|
654 | (some details hidden, use --verbose to show complete help) | |
653 |
|
655 | |||
654 | $ hg help -k nohelp |
|
656 | $ hg help -k nohelp | |
655 | Commands: |
|
657 | Commands: | |
656 |
|
658 | |||
657 | nohelp hg nohelp |
|
659 | nohelp hg nohelp | |
658 |
|
660 | |||
659 | Extension Commands: |
|
661 | Extension Commands: | |
660 |
|
662 | |||
661 | nohelp (no help text available) |
|
663 | nohelp (no help text available) | |
662 |
|
664 | |||
663 | Test that default list of commands omits extension commands |
|
665 | Test that default list of commands omits extension commands | |
664 |
|
666 | |||
665 | $ hg help |
|
667 | $ hg help | |
666 | Mercurial Distributed SCM |
|
668 | Mercurial Distributed SCM | |
667 |
|
669 | |||
668 | list of commands: |
|
670 | list of commands: | |
669 |
|
671 | |||
670 | add add the specified files on the next commit |
|
672 | add add the specified files on the next commit | |
671 | addremove add all new files, delete all missing files |
|
673 | addremove add all new files, delete all missing files | |
672 | annotate show changeset information by line for each file |
|
674 | annotate show changeset information by line for each file | |
673 | archive create an unversioned archive of a repository revision |
|
675 | archive create an unversioned archive of a repository revision | |
674 | backout reverse effect of earlier changeset |
|
676 | backout reverse effect of earlier changeset | |
675 | bisect subdivision search of changesets |
|
677 | bisect subdivision search of changesets | |
676 | bookmarks create a new bookmark or list existing bookmarks |
|
678 | bookmarks create a new bookmark or list existing bookmarks | |
677 | branch set or show the current branch name |
|
679 | branch set or show the current branch name | |
678 | branches list repository named branches |
|
680 | branches list repository named branches | |
679 | bundle create a changegroup file |
|
681 | bundle create a changegroup file | |
680 | cat output the current or given revision of files |
|
682 | cat output the current or given revision of files | |
681 | clone make a copy of an existing repository |
|
683 | clone make a copy of an existing repository | |
682 | commit commit the specified files or all outstanding changes |
|
684 | commit commit the specified files or all outstanding changes | |
683 | config show combined config settings from all hgrc files |
|
685 | config show combined config settings from all hgrc files | |
684 | copy mark files as copied for the next commit |
|
686 | copy mark files as copied for the next commit | |
685 | diff diff repository (or selected files) |
|
687 | diff diff repository (or selected files) | |
686 | export dump the header and diffs for one or more changesets |
|
688 | export dump the header and diffs for one or more changesets | |
|
689 | files list tracked files | |||
687 | forget forget the specified files on the next commit |
|
690 | forget forget the specified files on the next commit | |
688 | graft copy changes from other branches onto the current branch |
|
691 | graft copy changes from other branches onto the current branch | |
689 | grep search for a pattern in specified files and revisions |
|
692 | grep search for a pattern in specified files and revisions | |
690 | heads show branch heads |
|
693 | heads show branch heads | |
691 | help show help for a given topic or a help overview |
|
694 | help show help for a given topic or a help overview | |
692 | identify identify the working copy or specified revision |
|
695 | identify identify the working copy or specified revision | |
693 | import import an ordered set of patches |
|
696 | import import an ordered set of patches | |
694 | incoming show new changesets found in source |
|
697 | incoming show new changesets found in source | |
695 | init create a new repository in the given directory |
|
698 | init create a new repository in the given directory | |
696 | locate locate files matching specific patterns |
|
699 | locate locate files matching specific patterns | |
697 | log show revision history of entire repository or files |
|
700 | log show revision history of entire repository or files | |
698 | manifest output the current or given revision of the project manifest |
|
701 | manifest output the current or given revision of the project manifest | |
699 | merge merge working directory with another revision |
|
702 | merge merge working directory with another revision | |
700 | outgoing show changesets not found in the destination |
|
703 | outgoing show changesets not found in the destination | |
701 | parents show the parents of the working directory or revision |
|
704 | parents show the parents of the working directory or revision | |
702 | paths show aliases for remote repositories |
|
705 | paths show aliases for remote repositories | |
703 | phase set or show the current phase name |
|
706 | phase set or show the current phase name | |
704 | pull pull changes from the specified source |
|
707 | pull pull changes from the specified source | |
705 | push push changes to the specified destination |
|
708 | push push changes to the specified destination | |
706 | recover roll back an interrupted transaction |
|
709 | recover roll back an interrupted transaction | |
707 | remove remove the specified files on the next commit |
|
710 | remove remove the specified files on the next commit | |
708 | rename rename files; equivalent of copy + remove |
|
711 | rename rename files; equivalent of copy + remove | |
709 | resolve redo merges or set/view the merge status of files |
|
712 | resolve redo merges or set/view the merge status of files | |
710 | revert restore files to their checkout state |
|
713 | revert restore files to their checkout state | |
711 | root print the root (top) of the current working directory |
|
714 | root print the root (top) of the current working directory | |
712 | serve start stand-alone webserver |
|
715 | serve start stand-alone webserver | |
713 | status show changed files in the working directory |
|
716 | status show changed files in the working directory | |
714 | summary summarize working directory state |
|
717 | summary summarize working directory state | |
715 | tag add one or more tags for the current or given revision |
|
718 | tag add one or more tags for the current or given revision | |
716 | tags list repository tags |
|
719 | tags list repository tags | |
717 | unbundle apply one or more changegroup files |
|
720 | unbundle apply one or more changegroup files | |
718 | update update working directory (or switch revisions) |
|
721 | update update working directory (or switch revisions) | |
719 | verify verify the integrity of the repository |
|
722 | verify verify the integrity of the repository | |
720 | version output version and copyright information |
|
723 | version output version and copyright information | |
721 |
|
724 | |||
722 | enabled extensions: |
|
725 | enabled extensions: | |
723 |
|
726 | |||
724 | helpext (no help text available) |
|
727 | helpext (no help text available) | |
725 |
|
728 | |||
726 | additional help topics: |
|
729 | additional help topics: | |
727 |
|
730 | |||
728 | config Configuration Files |
|
731 | config Configuration Files | |
729 | dates Date Formats |
|
732 | dates Date Formats | |
730 | diffs Diff Formats |
|
733 | diffs Diff Formats | |
731 | environment Environment Variables |
|
734 | environment Environment Variables | |
732 | extensions Using Additional Features |
|
735 | extensions Using Additional Features | |
733 | filesets Specifying File Sets |
|
736 | filesets Specifying File Sets | |
734 | glossary Glossary |
|
737 | glossary Glossary | |
735 | hgignore Syntax for Mercurial Ignore Files |
|
738 | hgignore Syntax for Mercurial Ignore Files | |
736 | hgweb Configuring hgweb |
|
739 | hgweb Configuring hgweb | |
737 | merge-tools Merge Tools |
|
740 | merge-tools Merge Tools | |
738 | multirevs Specifying Multiple Revisions |
|
741 | multirevs Specifying Multiple Revisions | |
739 | patterns File Name Patterns |
|
742 | patterns File Name Patterns | |
740 | phases Working with Phases |
|
743 | phases Working with Phases | |
741 | revisions Specifying Single Revisions |
|
744 | revisions Specifying Single Revisions | |
742 | revsets Specifying Revision Sets |
|
745 | revsets Specifying Revision Sets | |
743 | subrepos Subrepositories |
|
746 | subrepos Subrepositories | |
744 | templating Template Usage |
|
747 | templating Template Usage | |
745 | urls URL Paths |
|
748 | urls URL Paths | |
746 |
|
749 | |||
747 | (use "hg help -v" to show built-in aliases and global options) |
|
750 | (use "hg help -v" to show built-in aliases and global options) | |
748 |
|
751 | |||
749 |
|
752 | |||
750 | Test list of internal help commands |
|
753 | Test list of internal help commands | |
751 |
|
754 | |||
752 | $ hg help debug |
|
755 | $ hg help debug | |
753 | debug commands (internal and unsupported): |
|
756 | debug commands (internal and unsupported): | |
754 |
|
757 | |||
755 | debugancestor |
|
758 | debugancestor | |
756 | find the ancestor revision of two revisions in a given index |
|
759 | find the ancestor revision of two revisions in a given index | |
757 | debugbuilddag |
|
760 | debugbuilddag | |
758 | builds a repo with a given DAG from scratch in the current |
|
761 | builds a repo with a given DAG from scratch in the current | |
759 | empty repo |
|
762 | empty repo | |
760 | debugbundle lists the contents of a bundle |
|
763 | debugbundle lists the contents of a bundle | |
761 | debugcheckstate |
|
764 | debugcheckstate | |
762 | validate the correctness of the current dirstate |
|
765 | validate the correctness of the current dirstate | |
763 | debugcommands |
|
766 | debugcommands | |
764 | list all available commands and options |
|
767 | list all available commands and options | |
765 | debugcomplete |
|
768 | debugcomplete | |
766 | returns the completion list associated with the given command |
|
769 | returns the completion list associated with the given command | |
767 | debugdag format the changelog or an index DAG as a concise textual |
|
770 | debugdag format the changelog or an index DAG as a concise textual | |
768 | description |
|
771 | description | |
769 | debugdata dump the contents of a data file revision |
|
772 | debugdata dump the contents of a data file revision | |
770 | debugdate parse and display a date |
|
773 | debugdate parse and display a date | |
771 | debugdirstate |
|
774 | debugdirstate | |
772 | show the contents of the current dirstate |
|
775 | show the contents of the current dirstate | |
773 | debugdiscovery |
|
776 | debugdiscovery | |
774 | runs the changeset discovery protocol in isolation |
|
777 | runs the changeset discovery protocol in isolation | |
775 | debugfileset parse and apply a fileset specification |
|
778 | debugfileset parse and apply a fileset specification | |
776 | debugfsinfo show information detected about current filesystem |
|
779 | debugfsinfo show information detected about current filesystem | |
777 | debuggetbundle |
|
780 | debuggetbundle | |
778 | retrieves a bundle from a repo |
|
781 | retrieves a bundle from a repo | |
779 | debugignore display the combined ignore pattern |
|
782 | debugignore display the combined ignore pattern | |
780 | debugindex dump the contents of an index file |
|
783 | debugindex dump the contents of an index file | |
781 | debugindexdot |
|
784 | debugindexdot | |
782 | dump an index DAG as a graphviz dot file |
|
785 | dump an index DAG as a graphviz dot file | |
783 | debuginstall test Mercurial installation |
|
786 | debuginstall test Mercurial installation | |
784 | debugknown test whether node ids are known to a repo |
|
787 | debugknown test whether node ids are known to a repo | |
785 | debuglabelcomplete |
|
788 | debuglabelcomplete | |
786 | complete "labels" - tags, open branch names, bookmark names |
|
789 | complete "labels" - tags, open branch names, bookmark names | |
787 | debugobsolete |
|
790 | debugobsolete | |
788 | create arbitrary obsolete marker |
|
791 | create arbitrary obsolete marker | |
789 | debugoptDEP (no help text available) |
|
792 | debugoptDEP (no help text available) | |
790 | debugpathcomplete |
|
793 | debugpathcomplete | |
791 | complete part or all of a tracked path |
|
794 | complete part or all of a tracked path | |
792 | debugpushkey access the pushkey key/value protocol |
|
795 | debugpushkey access the pushkey key/value protocol | |
793 | debugpvec (no help text available) |
|
796 | debugpvec (no help text available) | |
794 | debugrebuilddirstate |
|
797 | debugrebuilddirstate | |
795 | rebuild the dirstate as it would look like for the given |
|
798 | rebuild the dirstate as it would look like for the given | |
796 | revision |
|
799 | revision | |
797 | debugrename dump rename information |
|
800 | debugrename dump rename information | |
798 | debugrevlog show data and statistics about a revlog |
|
801 | debugrevlog show data and statistics about a revlog | |
799 | debugrevspec parse and apply a revision specification |
|
802 | debugrevspec parse and apply a revision specification | |
800 | debugsetparents |
|
803 | debugsetparents | |
801 | manually set the parents of the current working directory |
|
804 | manually set the parents of the current working directory | |
802 | debugsub (no help text available) |
|
805 | debugsub (no help text available) | |
803 | debugsuccessorssets |
|
806 | debugsuccessorssets | |
804 | show set of successors for revision |
|
807 | show set of successors for revision | |
805 | debugwalk show how files match on given patterns |
|
808 | debugwalk show how files match on given patterns | |
806 | debugwireargs |
|
809 | debugwireargs | |
807 | (no help text available) |
|
810 | (no help text available) | |
808 |
|
811 | |||
809 | (use "hg help -v debug" to show built-in aliases and global options) |
|
812 | (use "hg help -v debug" to show built-in aliases and global options) | |
810 |
|
813 | |||
811 |
|
814 | |||
812 | Test list of commands with command with no help text |
|
815 | Test list of commands with command with no help text | |
813 |
|
816 | |||
814 | $ hg help helpext |
|
817 | $ hg help helpext | |
815 | helpext extension - no help text available |
|
818 | helpext extension - no help text available | |
816 |
|
819 | |||
817 | list of commands: |
|
820 | list of commands: | |
818 |
|
821 | |||
819 | nohelp (no help text available) |
|
822 | nohelp (no help text available) | |
820 |
|
823 | |||
821 | (use "hg help -v helpext" to show built-in aliases and global options) |
|
824 | (use "hg help -v helpext" to show built-in aliases and global options) | |
822 |
|
825 | |||
823 |
|
826 | |||
824 | test deprecated option is hidden in command help |
|
827 | test deprecated option is hidden in command help | |
825 | $ hg help debugoptDEP |
|
828 | $ hg help debugoptDEP | |
826 | hg debugoptDEP |
|
829 | hg debugoptDEP | |
827 |
|
830 | |||
828 | (no help text available) |
|
831 | (no help text available) | |
829 |
|
832 | |||
830 | options: |
|
833 | options: | |
831 |
|
834 | |||
832 | (some details hidden, use --verbose to show complete help) |
|
835 | (some details hidden, use --verbose to show complete help) | |
833 |
|
836 | |||
834 | test deprecated option is shown with -v |
|
837 | test deprecated option is shown with -v | |
835 | $ hg help -v debugoptDEP | grep dopt |
|
838 | $ hg help -v debugoptDEP | grep dopt | |
836 | --dopt option is DEPRECATED |
|
839 | --dopt option is DEPRECATED | |
837 |
|
840 | |||
838 | #if gettext |
|
841 | #if gettext | |
839 | test deprecated option is hidden with translation with untranslated description |
|
842 | test deprecated option is hidden with translation with untranslated description | |
840 | (use many globy for not failing on changed transaction) |
|
843 | (use many globy for not failing on changed transaction) | |
841 | $ LANGUAGE=sv hg help debugoptDEP |
|
844 | $ LANGUAGE=sv hg help debugoptDEP | |
842 | hg debugoptDEP |
|
845 | hg debugoptDEP | |
843 |
|
846 | |||
844 | (*) (glob) |
|
847 | (*) (glob) | |
845 |
|
848 | |||
846 | options: |
|
849 | options: | |
847 |
|
850 | |||
848 | (some details hidden, use --verbose to show complete help) |
|
851 | (some details hidden, use --verbose to show complete help) | |
849 | #endif |
|
852 | #endif | |
850 |
|
853 | |||
851 | Test commands that collide with topics (issue4240) |
|
854 | Test commands that collide with topics (issue4240) | |
852 |
|
855 | |||
853 | $ hg config -hq |
|
856 | $ hg config -hq | |
854 | hg config [-u] [NAME]... |
|
857 | hg config [-u] [NAME]... | |
855 |
|
858 | |||
856 | show combined config settings from all hgrc files |
|
859 | show combined config settings from all hgrc files | |
857 | $ hg showconfig -hq |
|
860 | $ hg showconfig -hq | |
858 | hg config [-u] [NAME]... |
|
861 | hg config [-u] [NAME]... | |
859 |
|
862 | |||
860 | show combined config settings from all hgrc files |
|
863 | show combined config settings from all hgrc files | |
861 |
|
864 | |||
862 | Test a help topic |
|
865 | Test a help topic | |
863 |
|
866 | |||
864 | $ hg help revs |
|
867 | $ hg help revs | |
865 | Specifying Single Revisions |
|
868 | Specifying Single Revisions | |
866 | """"""""""""""""""""""""""" |
|
869 | """"""""""""""""""""""""""" | |
867 |
|
870 | |||
868 | Mercurial supports several ways to specify individual revisions. |
|
871 | Mercurial supports several ways to specify individual revisions. | |
869 |
|
872 | |||
870 | 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 | |
871 | 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 | |
872 | denoting the revision prior to the tip, and so forth. |
|
875 | denoting the revision prior to the tip, and so forth. | |
873 |
|
876 | |||
874 | 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. | |
875 |
|
878 | |||
876 | 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 | |
877 | 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 | |
878 | 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 | |
879 | full-length identifier. |
|
882 | full-length identifier. | |
880 |
|
883 | |||
881 | 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 | |
882 | 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 | |
883 | 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 | |
884 | 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 | |
885 | branch. Bookmark, tag, and branch names must not contain the ":" |
|
888 | branch. Bookmark, tag, and branch names must not contain the ":" | |
886 | character. |
|
889 | character. | |
887 |
|
890 | |||
888 | The reserved name "tip" always identifies the most recent revision. |
|
891 | The reserved name "tip" always identifies the most recent revision. | |
889 |
|
892 | |||
890 | 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 | |
891 | of an empty repository, and the parent of revision 0. |
|
894 | of an empty repository, and the parent of revision 0. | |
892 |
|
895 | |||
893 | The reserved name "." indicates the working directory parent. If no |
|
896 | The reserved name "." indicates the working directory parent. If no | |
894 | 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 | |
895 | 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. | |
896 |
|
899 | |||
897 | Test templating help |
|
900 | Test templating help | |
898 |
|
901 | |||
899 | $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' |
|
902 | $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) ' | |
900 | desc String. The text of the changeset description. |
|
903 | desc String. The text of the changeset description. | |
901 | diffstat String. Statistics of changes with the following format: |
|
904 | diffstat String. Statistics of changes with the following format: | |
902 | firstline Any text. Returns the first line of text. |
|
905 | firstline Any text. Returns the first line of text. | |
903 | nonempty Any text. Returns '(none)' if the string is empty. |
|
906 | nonempty Any text. Returns '(none)' if the string is empty. | |
904 |
|
907 | |||
905 | Test help hooks |
|
908 | Test help hooks | |
906 |
|
909 | |||
907 | $ cat > helphook1.py <<EOF |
|
910 | $ cat > helphook1.py <<EOF | |
908 | > from mercurial import help |
|
911 | > from mercurial import help | |
909 | > |
|
912 | > | |
910 | > def rewrite(topic, doc): |
|
913 | > def rewrite(topic, doc): | |
911 | > return doc + '\nhelphook1\n' |
|
914 | > return doc + '\nhelphook1\n' | |
912 | > |
|
915 | > | |
913 | > def extsetup(ui): |
|
916 | > def extsetup(ui): | |
914 | > help.addtopichook('revsets', rewrite) |
|
917 | > help.addtopichook('revsets', rewrite) | |
915 | > EOF |
|
918 | > EOF | |
916 | $ cat > helphook2.py <<EOF |
|
919 | $ cat > helphook2.py <<EOF | |
917 | > from mercurial import help |
|
920 | > from mercurial import help | |
918 | > |
|
921 | > | |
919 | > def rewrite(topic, doc): |
|
922 | > def rewrite(topic, doc): | |
920 | > return doc + '\nhelphook2\n' |
|
923 | > return doc + '\nhelphook2\n' | |
921 | > |
|
924 | > | |
922 | > def extsetup(ui): |
|
925 | > def extsetup(ui): | |
923 | > help.addtopichook('revsets', rewrite) |
|
926 | > help.addtopichook('revsets', rewrite) | |
924 | > EOF |
|
927 | > EOF | |
925 | $ echo '[extensions]' >> $HGRCPATH |
|
928 | $ echo '[extensions]' >> $HGRCPATH | |
926 | $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH |
|
929 | $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH | |
927 | $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH |
|
930 | $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH | |
928 | $ hg help revsets | grep helphook |
|
931 | $ hg help revsets | grep helphook | |
929 | helphook1 |
|
932 | helphook1 | |
930 | helphook2 |
|
933 | helphook2 | |
931 |
|
934 | |||
932 | Test keyword search help |
|
935 | Test keyword search help | |
933 |
|
936 | |||
934 | $ cat > prefixedname.py <<EOF |
|
937 | $ cat > prefixedname.py <<EOF | |
935 | > '''matched against word "clone" |
|
938 | > '''matched against word "clone" | |
936 | > ''' |
|
939 | > ''' | |
937 | > EOF |
|
940 | > EOF | |
938 | $ echo '[extensions]' >> $HGRCPATH |
|
941 | $ echo '[extensions]' >> $HGRCPATH | |
939 | $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH |
|
942 | $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH | |
940 | $ hg help -k clone |
|
943 | $ hg help -k clone | |
941 | Topics: |
|
944 | Topics: | |
942 |
|
945 | |||
943 | config Configuration Files |
|
946 | config Configuration Files | |
944 | extensions Using Additional Features |
|
947 | extensions Using Additional Features | |
945 | glossary Glossary |
|
948 | glossary Glossary | |
946 | phases Working with Phases |
|
949 | phases Working with Phases | |
947 | subrepos Subrepositories |
|
950 | subrepos Subrepositories | |
948 | urls URL Paths |
|
951 | urls URL Paths | |
949 |
|
952 | |||
950 | Commands: |
|
953 | Commands: | |
951 |
|
954 | |||
952 | bookmarks create a new bookmark or list existing bookmarks |
|
955 | bookmarks create a new bookmark or list existing bookmarks | |
953 | clone make a copy of an existing repository |
|
956 | clone make a copy of an existing repository | |
954 | paths show aliases for remote repositories |
|
957 | paths show aliases for remote repositories | |
955 | update update working directory (or switch revisions) |
|
958 | update update working directory (or switch revisions) | |
956 |
|
959 | |||
957 | Extensions: |
|
960 | Extensions: | |
958 |
|
961 | |||
959 | prefixedname matched against word "clone" |
|
962 | prefixedname matched against word "clone" | |
960 | relink recreates hardlinks between repository clones |
|
963 | relink recreates hardlinks between repository clones | |
961 |
|
964 | |||
962 | Extension Commands: |
|
965 | Extension Commands: | |
963 |
|
966 | |||
964 | qclone clone main and patch repository at same time |
|
967 | qclone clone main and patch repository at same time | |
965 |
|
968 | |||
966 | Test unfound topic |
|
969 | Test unfound topic | |
967 |
|
970 | |||
968 | $ hg help nonexistingtopicthatwillneverexisteverever |
|
971 | $ hg help nonexistingtopicthatwillneverexisteverever | |
969 | abort: no such help topic: nonexistingtopicthatwillneverexisteverever |
|
972 | abort: no such help topic: nonexistingtopicthatwillneverexisteverever | |
970 | (try "hg help --keyword nonexistingtopicthatwillneverexisteverever") |
|
973 | (try "hg help --keyword nonexistingtopicthatwillneverexisteverever") | |
971 | [255] |
|
974 | [255] | |
972 |
|
975 | |||
973 | Test unfound keyword |
|
976 | Test unfound keyword | |
974 |
|
977 | |||
975 | $ hg help --keyword nonexistingwordthatwillneverexisteverever |
|
978 | $ hg help --keyword nonexistingwordthatwillneverexisteverever | |
976 | abort: no matches |
|
979 | abort: no matches | |
977 | (try "hg help" for a list of topics) |
|
980 | (try "hg help" for a list of topics) | |
978 | [255] |
|
981 | [255] | |
979 |
|
982 | |||
980 | Test omit indicating for help |
|
983 | Test omit indicating for help | |
981 |
|
984 | |||
982 | $ cat > addverboseitems.py <<EOF |
|
985 | $ cat > addverboseitems.py <<EOF | |
983 | > '''extension to test omit indicating. |
|
986 | > '''extension to test omit indicating. | |
984 | > |
|
987 | > | |
985 | > This paragraph is never omitted (for extension) |
|
988 | > This paragraph is never omitted (for extension) | |
986 | > |
|
989 | > | |
987 | > .. container:: verbose |
|
990 | > .. container:: verbose | |
988 | > |
|
991 | > | |
989 | > This paragraph is omitted, |
|
992 | > This paragraph is omitted, | |
990 | > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension) |
|
993 | > if :hg:\`help\` is invoked witout \`\`-v\`\` (for extension) | |
991 | > |
|
994 | > | |
992 | > This paragraph is never omitted, too (for extension) |
|
995 | > This paragraph is never omitted, too (for extension) | |
993 | > ''' |
|
996 | > ''' | |
994 | > |
|
997 | > | |
995 | > from mercurial import help, commands |
|
998 | > from mercurial import help, commands | |
996 | > testtopic = """This paragraph is never omitted (for topic). |
|
999 | > testtopic = """This paragraph is never omitted (for topic). | |
997 | > |
|
1000 | > | |
998 | > .. container:: verbose |
|
1001 | > .. container:: verbose | |
999 | > |
|
1002 | > | |
1000 | > This paragraph is omitted, |
|
1003 | > This paragraph is omitted, | |
1001 | > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic) |
|
1004 | > if :hg:\`help\` is invoked witout \`\`-v\`\` (for topic) | |
1002 | > |
|
1005 | > | |
1003 | > This paragraph is never omitted, too (for topic) |
|
1006 | > This paragraph is never omitted, too (for topic) | |
1004 | > """ |
|
1007 | > """ | |
1005 | > def extsetup(ui): |
|
1008 | > def extsetup(ui): | |
1006 | > help.helptable.append((["topic-containing-verbose"], |
|
1009 | > help.helptable.append((["topic-containing-verbose"], | |
1007 | > "This is the topic to test omit indicating.", |
|
1010 | > "This is the topic to test omit indicating.", | |
1008 | > lambda : testtopic)) |
|
1011 | > lambda : testtopic)) | |
1009 | > EOF |
|
1012 | > EOF | |
1010 | $ echo '[extensions]' >> $HGRCPATH |
|
1013 | $ echo '[extensions]' >> $HGRCPATH | |
1011 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH |
|
1014 | $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH | |
1012 | $ hg help addverboseitems |
|
1015 | $ hg help addverboseitems | |
1013 | addverboseitems extension - extension to test omit indicating. |
|
1016 | addverboseitems extension - extension to test omit indicating. | |
1014 |
|
1017 | |||
1015 | This paragraph is never omitted (for extension) |
|
1018 | This paragraph is never omitted (for extension) | |
1016 |
|
1019 | |||
1017 | This paragraph is never omitted, too (for extension) |
|
1020 | This paragraph is never omitted, too (for extension) | |
1018 |
|
1021 | |||
1019 | (some details hidden, use --verbose to show complete help) |
|
1022 | (some details hidden, use --verbose to show complete help) | |
1020 |
|
1023 | |||
1021 | no commands defined |
|
1024 | no commands defined | |
1022 | $ hg help -v addverboseitems |
|
1025 | $ hg help -v addverboseitems | |
1023 | addverboseitems extension - extension to test omit indicating. |
|
1026 | addverboseitems extension - extension to test omit indicating. | |
1024 |
|
1027 | |||
1025 | This paragraph is never omitted (for extension) |
|
1028 | This paragraph is never omitted (for extension) | |
1026 |
|
1029 | |||
1027 | 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) | |
1028 |
|
1031 | |||
1029 | This paragraph is never omitted, too (for extension) |
|
1032 | This paragraph is never omitted, too (for extension) | |
1030 |
|
1033 | |||
1031 | no commands defined |
|
1034 | no commands defined | |
1032 | $ hg help topic-containing-verbose |
|
1035 | $ hg help topic-containing-verbose | |
1033 | This is the topic to test omit indicating. |
|
1036 | This is the topic to test omit indicating. | |
1034 | """""""""""""""""""""""""""""""""""""""""" |
|
1037 | """""""""""""""""""""""""""""""""""""""""" | |
1035 |
|
1038 | |||
1036 | This paragraph is never omitted (for topic). |
|
1039 | This paragraph is never omitted (for topic). | |
1037 |
|
1040 | |||
1038 | This paragraph is never omitted, too (for topic) |
|
1041 | This paragraph is never omitted, too (for topic) | |
1039 |
|
1042 | |||
1040 | (some details hidden, use --verbose to show complete help) |
|
1043 | (some details hidden, use --verbose to show complete help) | |
1041 | $ hg help -v topic-containing-verbose |
|
1044 | $ hg help -v topic-containing-verbose | |
1042 | This is the topic to test omit indicating. |
|
1045 | This is the topic to test omit indicating. | |
1043 | """""""""""""""""""""""""""""""""""""""""" |
|
1046 | """""""""""""""""""""""""""""""""""""""""" | |
1044 |
|
1047 | |||
1045 | This paragraph is never omitted (for topic). |
|
1048 | This paragraph is never omitted (for topic). | |
1046 |
|
1049 | |||
1047 | 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) | |
1048 |
|
1051 | |||
1049 | This paragraph is never omitted, too (for topic) |
|
1052 | This paragraph is never omitted, too (for topic) | |
1050 |
|
1053 | |||
1051 | Test usage of section marks in help documents |
|
1054 | Test usage of section marks in help documents | |
1052 |
|
1055 | |||
1053 | $ cd "$TESTDIR"/../doc |
|
1056 | $ cd "$TESTDIR"/../doc | |
1054 | $ python check-seclevel.py |
|
1057 | $ python check-seclevel.py | |
1055 | $ cd $TESTTMP |
|
1058 | $ cd $TESTTMP | |
1056 |
|
1059 | |||
1057 | #if serve |
|
1060 | #if serve | |
1058 |
|
1061 | |||
1059 | Test the help pages in hgweb. |
|
1062 | Test the help pages in hgweb. | |
1060 |
|
1063 | |||
1061 | Dish up an empty repo; serve it cold. |
|
1064 | Dish up an empty repo; serve it cold. | |
1062 |
|
1065 | |||
1063 | $ hg init "$TESTTMP/test" |
|
1066 | $ hg init "$TESTTMP/test" | |
1064 | $ 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 | |
1065 | $ cat hg.pid >> $DAEMON_PIDS |
|
1068 | $ cat hg.pid >> $DAEMON_PIDS | |
1066 |
|
1069 | |||
1067 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help" |
|
1070 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help" | |
1068 | 200 Script output follows |
|
1071 | 200 Script output follows | |
1069 |
|
1072 | |||
1070 | <!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"> | |
1071 | <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"> | |
1072 | <head> |
|
1075 | <head> | |
1073 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1076 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
1074 | <meta name="robots" content="index, nofollow" /> |
|
1077 | <meta name="robots" content="index, nofollow" /> | |
1075 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1078 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
1076 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1079 | <script type="text/javascript" src="/static/mercurial.js"></script> | |
1077 |
|
1080 | |||
1078 | <title>Help: Index</title> |
|
1081 | <title>Help: Index</title> | |
1079 | </head> |
|
1082 | </head> | |
1080 | <body> |
|
1083 | <body> | |
1081 |
|
1084 | |||
1082 | <div class="container"> |
|
1085 | <div class="container"> | |
1083 | <div class="menu"> |
|
1086 | <div class="menu"> | |
1084 | <div class="logo"> |
|
1087 | <div class="logo"> | |
1085 | <a href="http://mercurial.selenic.com/"> |
|
1088 | <a href="http://mercurial.selenic.com/"> | |
1086 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1089 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
1087 | </div> |
|
1090 | </div> | |
1088 | <ul> |
|
1091 | <ul> | |
1089 | <li><a href="/shortlog">log</a></li> |
|
1092 | <li><a href="/shortlog">log</a></li> | |
1090 | <li><a href="/graph">graph</a></li> |
|
1093 | <li><a href="/graph">graph</a></li> | |
1091 | <li><a href="/tags">tags</a></li> |
|
1094 | <li><a href="/tags">tags</a></li> | |
1092 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1095 | <li><a href="/bookmarks">bookmarks</a></li> | |
1093 | <li><a href="/branches">branches</a></li> |
|
1096 | <li><a href="/branches">branches</a></li> | |
1094 | </ul> |
|
1097 | </ul> | |
1095 | <ul> |
|
1098 | <ul> | |
1096 | <li class="active">help</li> |
|
1099 | <li class="active">help</li> | |
1097 | </ul> |
|
1100 | </ul> | |
1098 | </div> |
|
1101 | </div> | |
1099 |
|
1102 | |||
1100 | <div class="main"> |
|
1103 | <div class="main"> | |
1101 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1104 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> | |
1102 | <form class="search" action="/log"> |
|
1105 | <form class="search" action="/log"> | |
1103 |
|
1106 | |||
1104 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1107 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
1105 | <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 | |
1106 | 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> | |
1107 | </form> |
|
1110 | </form> | |
1108 | <table class="bigtable"> |
|
1111 | <table class="bigtable"> | |
1109 | <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> | |
1110 |
|
1113 | |||
1111 | <tr><td> |
|
1114 | <tr><td> | |
1112 | <a href="/help/config"> |
|
1115 | <a href="/help/config"> | |
1113 | config |
|
1116 | config | |
1114 | </a> |
|
1117 | </a> | |
1115 | </td><td> |
|
1118 | </td><td> | |
1116 | Configuration Files |
|
1119 | Configuration Files | |
1117 | </td></tr> |
|
1120 | </td></tr> | |
1118 | <tr><td> |
|
1121 | <tr><td> | |
1119 | <a href="/help/dates"> |
|
1122 | <a href="/help/dates"> | |
1120 | dates |
|
1123 | dates | |
1121 | </a> |
|
1124 | </a> | |
1122 | </td><td> |
|
1125 | </td><td> | |
1123 | Date Formats |
|
1126 | Date Formats | |
1124 | </td></tr> |
|
1127 | </td></tr> | |
1125 | <tr><td> |
|
1128 | <tr><td> | |
1126 | <a href="/help/diffs"> |
|
1129 | <a href="/help/diffs"> | |
1127 | diffs |
|
1130 | diffs | |
1128 | </a> |
|
1131 | </a> | |
1129 | </td><td> |
|
1132 | </td><td> | |
1130 | Diff Formats |
|
1133 | Diff Formats | |
1131 | </td></tr> |
|
1134 | </td></tr> | |
1132 | <tr><td> |
|
1135 | <tr><td> | |
1133 | <a href="/help/environment"> |
|
1136 | <a href="/help/environment"> | |
1134 | environment |
|
1137 | environment | |
1135 | </a> |
|
1138 | </a> | |
1136 | </td><td> |
|
1139 | </td><td> | |
1137 | Environment Variables |
|
1140 | Environment Variables | |
1138 | </td></tr> |
|
1141 | </td></tr> | |
1139 | <tr><td> |
|
1142 | <tr><td> | |
1140 | <a href="/help/extensions"> |
|
1143 | <a href="/help/extensions"> | |
1141 | extensions |
|
1144 | extensions | |
1142 | </a> |
|
1145 | </a> | |
1143 | </td><td> |
|
1146 | </td><td> | |
1144 | Using Additional Features |
|
1147 | Using Additional Features | |
1145 | </td></tr> |
|
1148 | </td></tr> | |
1146 | <tr><td> |
|
1149 | <tr><td> | |
1147 | <a href="/help/filesets"> |
|
1150 | <a href="/help/filesets"> | |
1148 | filesets |
|
1151 | filesets | |
1149 | </a> |
|
1152 | </a> | |
1150 | </td><td> |
|
1153 | </td><td> | |
1151 | Specifying File Sets |
|
1154 | Specifying File Sets | |
1152 | </td></tr> |
|
1155 | </td></tr> | |
1153 | <tr><td> |
|
1156 | <tr><td> | |
1154 | <a href="/help/glossary"> |
|
1157 | <a href="/help/glossary"> | |
1155 | glossary |
|
1158 | glossary | |
1156 | </a> |
|
1159 | </a> | |
1157 | </td><td> |
|
1160 | </td><td> | |
1158 | Glossary |
|
1161 | Glossary | |
1159 | </td></tr> |
|
1162 | </td></tr> | |
1160 | <tr><td> |
|
1163 | <tr><td> | |
1161 | <a href="/help/hgignore"> |
|
1164 | <a href="/help/hgignore"> | |
1162 | hgignore |
|
1165 | hgignore | |
1163 | </a> |
|
1166 | </a> | |
1164 | </td><td> |
|
1167 | </td><td> | |
1165 | Syntax for Mercurial Ignore Files |
|
1168 | Syntax for Mercurial Ignore Files | |
1166 | </td></tr> |
|
1169 | </td></tr> | |
1167 | <tr><td> |
|
1170 | <tr><td> | |
1168 | <a href="/help/hgweb"> |
|
1171 | <a href="/help/hgweb"> | |
1169 | hgweb |
|
1172 | hgweb | |
1170 | </a> |
|
1173 | </a> | |
1171 | </td><td> |
|
1174 | </td><td> | |
1172 | Configuring hgweb |
|
1175 | Configuring hgweb | |
1173 | </td></tr> |
|
1176 | </td></tr> | |
1174 | <tr><td> |
|
1177 | <tr><td> | |
1175 | <a href="/help/merge-tools"> |
|
1178 | <a href="/help/merge-tools"> | |
1176 | merge-tools |
|
1179 | merge-tools | |
1177 | </a> |
|
1180 | </a> | |
1178 | </td><td> |
|
1181 | </td><td> | |
1179 | Merge Tools |
|
1182 | Merge Tools | |
1180 | </td></tr> |
|
1183 | </td></tr> | |
1181 | <tr><td> |
|
1184 | <tr><td> | |
1182 | <a href="/help/multirevs"> |
|
1185 | <a href="/help/multirevs"> | |
1183 | multirevs |
|
1186 | multirevs | |
1184 | </a> |
|
1187 | </a> | |
1185 | </td><td> |
|
1188 | </td><td> | |
1186 | Specifying Multiple Revisions |
|
1189 | Specifying Multiple Revisions | |
1187 | </td></tr> |
|
1190 | </td></tr> | |
1188 | <tr><td> |
|
1191 | <tr><td> | |
1189 | <a href="/help/patterns"> |
|
1192 | <a href="/help/patterns"> | |
1190 | patterns |
|
1193 | patterns | |
1191 | </a> |
|
1194 | </a> | |
1192 | </td><td> |
|
1195 | </td><td> | |
1193 | File Name Patterns |
|
1196 | File Name Patterns | |
1194 | </td></tr> |
|
1197 | </td></tr> | |
1195 | <tr><td> |
|
1198 | <tr><td> | |
1196 | <a href="/help/phases"> |
|
1199 | <a href="/help/phases"> | |
1197 | phases |
|
1200 | phases | |
1198 | </a> |
|
1201 | </a> | |
1199 | </td><td> |
|
1202 | </td><td> | |
1200 | Working with Phases |
|
1203 | Working with Phases | |
1201 | </td></tr> |
|
1204 | </td></tr> | |
1202 | <tr><td> |
|
1205 | <tr><td> | |
1203 | <a href="/help/revisions"> |
|
1206 | <a href="/help/revisions"> | |
1204 | revisions |
|
1207 | revisions | |
1205 | </a> |
|
1208 | </a> | |
1206 | </td><td> |
|
1209 | </td><td> | |
1207 | Specifying Single Revisions |
|
1210 | Specifying Single Revisions | |
1208 | </td></tr> |
|
1211 | </td></tr> | |
1209 | <tr><td> |
|
1212 | <tr><td> | |
1210 | <a href="/help/revsets"> |
|
1213 | <a href="/help/revsets"> | |
1211 | revsets |
|
1214 | revsets | |
1212 | </a> |
|
1215 | </a> | |
1213 | </td><td> |
|
1216 | </td><td> | |
1214 | Specifying Revision Sets |
|
1217 | Specifying Revision Sets | |
1215 | </td></tr> |
|
1218 | </td></tr> | |
1216 | <tr><td> |
|
1219 | <tr><td> | |
1217 | <a href="/help/subrepos"> |
|
1220 | <a href="/help/subrepos"> | |
1218 | subrepos |
|
1221 | subrepos | |
1219 | </a> |
|
1222 | </a> | |
1220 | </td><td> |
|
1223 | </td><td> | |
1221 | Subrepositories |
|
1224 | Subrepositories | |
1222 | </td></tr> |
|
1225 | </td></tr> | |
1223 | <tr><td> |
|
1226 | <tr><td> | |
1224 | <a href="/help/templating"> |
|
1227 | <a href="/help/templating"> | |
1225 | templating |
|
1228 | templating | |
1226 | </a> |
|
1229 | </a> | |
1227 | </td><td> |
|
1230 | </td><td> | |
1228 | Template Usage |
|
1231 | Template Usage | |
1229 | </td></tr> |
|
1232 | </td></tr> | |
1230 | <tr><td> |
|
1233 | <tr><td> | |
1231 | <a href="/help/urls"> |
|
1234 | <a href="/help/urls"> | |
1232 | urls |
|
1235 | urls | |
1233 | </a> |
|
1236 | </a> | |
1234 | </td><td> |
|
1237 | </td><td> | |
1235 | URL Paths |
|
1238 | URL Paths | |
1236 | </td></tr> |
|
1239 | </td></tr> | |
1237 | <tr><td> |
|
1240 | <tr><td> | |
1238 | <a href="/help/topic-containing-verbose"> |
|
1241 | <a href="/help/topic-containing-verbose"> | |
1239 | topic-containing-verbose |
|
1242 | topic-containing-verbose | |
1240 | </a> |
|
1243 | </a> | |
1241 | </td><td> |
|
1244 | </td><td> | |
1242 | This is the topic to test omit indicating. |
|
1245 | This is the topic to test omit indicating. | |
1243 | </td></tr> |
|
1246 | </td></tr> | |
1244 |
|
1247 | |||
1245 | <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> | |
1246 |
|
1249 | |||
1247 | <tr><td> |
|
1250 | <tr><td> | |
1248 | <a href="/help/add"> |
|
1251 | <a href="/help/add"> | |
1249 | add |
|
1252 | add | |
1250 | </a> |
|
1253 | </a> | |
1251 | </td><td> |
|
1254 | </td><td> | |
1252 | add the specified files on the next commit |
|
1255 | add the specified files on the next commit | |
1253 | </td></tr> |
|
1256 | </td></tr> | |
1254 | <tr><td> |
|
1257 | <tr><td> | |
1255 | <a href="/help/annotate"> |
|
1258 | <a href="/help/annotate"> | |
1256 | annotate |
|
1259 | annotate | |
1257 | </a> |
|
1260 | </a> | |
1258 | </td><td> |
|
1261 | </td><td> | |
1259 | show changeset information by line for each file |
|
1262 | show changeset information by line for each file | |
1260 | </td></tr> |
|
1263 | </td></tr> | |
1261 | <tr><td> |
|
1264 | <tr><td> | |
1262 | <a href="/help/clone"> |
|
1265 | <a href="/help/clone"> | |
1263 | clone |
|
1266 | clone | |
1264 | </a> |
|
1267 | </a> | |
1265 | </td><td> |
|
1268 | </td><td> | |
1266 | make a copy of an existing repository |
|
1269 | make a copy of an existing repository | |
1267 | </td></tr> |
|
1270 | </td></tr> | |
1268 | <tr><td> |
|
1271 | <tr><td> | |
1269 | <a href="/help/commit"> |
|
1272 | <a href="/help/commit"> | |
1270 | commit |
|
1273 | commit | |
1271 | </a> |
|
1274 | </a> | |
1272 | </td><td> |
|
1275 | </td><td> | |
1273 | commit the specified files or all outstanding changes |
|
1276 | commit the specified files or all outstanding changes | |
1274 | </td></tr> |
|
1277 | </td></tr> | |
1275 | <tr><td> |
|
1278 | <tr><td> | |
1276 | <a href="/help/diff"> |
|
1279 | <a href="/help/diff"> | |
1277 | diff |
|
1280 | diff | |
1278 | </a> |
|
1281 | </a> | |
1279 | </td><td> |
|
1282 | </td><td> | |
1280 | diff repository (or selected files) |
|
1283 | diff repository (or selected files) | |
1281 | </td></tr> |
|
1284 | </td></tr> | |
1282 | <tr><td> |
|
1285 | <tr><td> | |
1283 | <a href="/help/export"> |
|
1286 | <a href="/help/export"> | |
1284 | export |
|
1287 | export | |
1285 | </a> |
|
1288 | </a> | |
1286 | </td><td> |
|
1289 | </td><td> | |
1287 | dump the header and diffs for one or more changesets |
|
1290 | dump the header and diffs for one or more changesets | |
1288 | </td></tr> |
|
1291 | </td></tr> | |
1289 | <tr><td> |
|
1292 | <tr><td> | |
1290 | <a href="/help/forget"> |
|
1293 | <a href="/help/forget"> | |
1291 | forget |
|
1294 | forget | |
1292 | </a> |
|
1295 | </a> | |
1293 | </td><td> |
|
1296 | </td><td> | |
1294 | forget the specified files on the next commit |
|
1297 | forget the specified files on the next commit | |
1295 | </td></tr> |
|
1298 | </td></tr> | |
1296 | <tr><td> |
|
1299 | <tr><td> | |
1297 | <a href="/help/init"> |
|
1300 | <a href="/help/init"> | |
1298 | init |
|
1301 | init | |
1299 | </a> |
|
1302 | </a> | |
1300 | </td><td> |
|
1303 | </td><td> | |
1301 | create a new repository in the given directory |
|
1304 | create a new repository in the given directory | |
1302 | </td></tr> |
|
1305 | </td></tr> | |
1303 | <tr><td> |
|
1306 | <tr><td> | |
1304 | <a href="/help/log"> |
|
1307 | <a href="/help/log"> | |
1305 | log |
|
1308 | log | |
1306 | </a> |
|
1309 | </a> | |
1307 | </td><td> |
|
1310 | </td><td> | |
1308 | show revision history of entire repository or files |
|
1311 | show revision history of entire repository or files | |
1309 | </td></tr> |
|
1312 | </td></tr> | |
1310 | <tr><td> |
|
1313 | <tr><td> | |
1311 | <a href="/help/merge"> |
|
1314 | <a href="/help/merge"> | |
1312 | merge |
|
1315 | merge | |
1313 | </a> |
|
1316 | </a> | |
1314 | </td><td> |
|
1317 | </td><td> | |
1315 | merge working directory with another revision |
|
1318 | merge working directory with another revision | |
1316 | </td></tr> |
|
1319 | </td></tr> | |
1317 | <tr><td> |
|
1320 | <tr><td> | |
1318 | <a href="/help/pull"> |
|
1321 | <a href="/help/pull"> | |
1319 | pull |
|
1322 | pull | |
1320 | </a> |
|
1323 | </a> | |
1321 | </td><td> |
|
1324 | </td><td> | |
1322 | pull changes from the specified source |
|
1325 | pull changes from the specified source | |
1323 | </td></tr> |
|
1326 | </td></tr> | |
1324 | <tr><td> |
|
1327 | <tr><td> | |
1325 | <a href="/help/push"> |
|
1328 | <a href="/help/push"> | |
1326 | push |
|
1329 | push | |
1327 | </a> |
|
1330 | </a> | |
1328 | </td><td> |
|
1331 | </td><td> | |
1329 | push changes to the specified destination |
|
1332 | push changes to the specified destination | |
1330 | </td></tr> |
|
1333 | </td></tr> | |
1331 | <tr><td> |
|
1334 | <tr><td> | |
1332 | <a href="/help/remove"> |
|
1335 | <a href="/help/remove"> | |
1333 | remove |
|
1336 | remove | |
1334 | </a> |
|
1337 | </a> | |
1335 | </td><td> |
|
1338 | </td><td> | |
1336 | remove the specified files on the next commit |
|
1339 | remove the specified files on the next commit | |
1337 | </td></tr> |
|
1340 | </td></tr> | |
1338 | <tr><td> |
|
1341 | <tr><td> | |
1339 | <a href="/help/serve"> |
|
1342 | <a href="/help/serve"> | |
1340 | serve |
|
1343 | serve | |
1341 | </a> |
|
1344 | </a> | |
1342 | </td><td> |
|
1345 | </td><td> | |
1343 | start stand-alone webserver |
|
1346 | start stand-alone webserver | |
1344 | </td></tr> |
|
1347 | </td></tr> | |
1345 | <tr><td> |
|
1348 | <tr><td> | |
1346 | <a href="/help/status"> |
|
1349 | <a href="/help/status"> | |
1347 | status |
|
1350 | status | |
1348 | </a> |
|
1351 | </a> | |
1349 | </td><td> |
|
1352 | </td><td> | |
1350 | show changed files in the working directory |
|
1353 | show changed files in the working directory | |
1351 | </td></tr> |
|
1354 | </td></tr> | |
1352 | <tr><td> |
|
1355 | <tr><td> | |
1353 | <a href="/help/summary"> |
|
1356 | <a href="/help/summary"> | |
1354 | summary |
|
1357 | summary | |
1355 | </a> |
|
1358 | </a> | |
1356 | </td><td> |
|
1359 | </td><td> | |
1357 | summarize working directory state |
|
1360 | summarize working directory state | |
1358 | </td></tr> |
|
1361 | </td></tr> | |
1359 | <tr><td> |
|
1362 | <tr><td> | |
1360 | <a href="/help/update"> |
|
1363 | <a href="/help/update"> | |
1361 | update |
|
1364 | update | |
1362 | </a> |
|
1365 | </a> | |
1363 | </td><td> |
|
1366 | </td><td> | |
1364 | update working directory (or switch revisions) |
|
1367 | update working directory (or switch revisions) | |
1365 | </td></tr> |
|
1368 | </td></tr> | |
1366 |
|
1369 | |||
1367 | <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> | |
1368 |
|
1371 | |||
1369 | <tr><td> |
|
1372 | <tr><td> | |
1370 | <a href="/help/addremove"> |
|
1373 | <a href="/help/addremove"> | |
1371 | addremove |
|
1374 | addremove | |
1372 | </a> |
|
1375 | </a> | |
1373 | </td><td> |
|
1376 | </td><td> | |
1374 | add all new files, delete all missing files |
|
1377 | add all new files, delete all missing files | |
1375 | </td></tr> |
|
1378 | </td></tr> | |
1376 | <tr><td> |
|
1379 | <tr><td> | |
1377 | <a href="/help/archive"> |
|
1380 | <a href="/help/archive"> | |
1378 | archive |
|
1381 | archive | |
1379 | </a> |
|
1382 | </a> | |
1380 | </td><td> |
|
1383 | </td><td> | |
1381 | create an unversioned archive of a repository revision |
|
1384 | create an unversioned archive of a repository revision | |
1382 | </td></tr> |
|
1385 | </td></tr> | |
1383 | <tr><td> |
|
1386 | <tr><td> | |
1384 | <a href="/help/backout"> |
|
1387 | <a href="/help/backout"> | |
1385 | backout |
|
1388 | backout | |
1386 | </a> |
|
1389 | </a> | |
1387 | </td><td> |
|
1390 | </td><td> | |
1388 | reverse effect of earlier changeset |
|
1391 | reverse effect of earlier changeset | |
1389 | </td></tr> |
|
1392 | </td></tr> | |
1390 | <tr><td> |
|
1393 | <tr><td> | |
1391 | <a href="/help/bisect"> |
|
1394 | <a href="/help/bisect"> | |
1392 | bisect |
|
1395 | bisect | |
1393 | </a> |
|
1396 | </a> | |
1394 | </td><td> |
|
1397 | </td><td> | |
1395 | subdivision search of changesets |
|
1398 | subdivision search of changesets | |
1396 | </td></tr> |
|
1399 | </td></tr> | |
1397 | <tr><td> |
|
1400 | <tr><td> | |
1398 | <a href="/help/bookmarks"> |
|
1401 | <a href="/help/bookmarks"> | |
1399 | bookmarks |
|
1402 | bookmarks | |
1400 | </a> |
|
1403 | </a> | |
1401 | </td><td> |
|
1404 | </td><td> | |
1402 | create a new bookmark or list existing bookmarks |
|
1405 | create a new bookmark or list existing bookmarks | |
1403 | </td></tr> |
|
1406 | </td></tr> | |
1404 | <tr><td> |
|
1407 | <tr><td> | |
1405 | <a href="/help/branch"> |
|
1408 | <a href="/help/branch"> | |
1406 | branch |
|
1409 | branch | |
1407 | </a> |
|
1410 | </a> | |
1408 | </td><td> |
|
1411 | </td><td> | |
1409 | set or show the current branch name |
|
1412 | set or show the current branch name | |
1410 | </td></tr> |
|
1413 | </td></tr> | |
1411 | <tr><td> |
|
1414 | <tr><td> | |
1412 | <a href="/help/branches"> |
|
1415 | <a href="/help/branches"> | |
1413 | branches |
|
1416 | branches | |
1414 | </a> |
|
1417 | </a> | |
1415 | </td><td> |
|
1418 | </td><td> | |
1416 | list repository named branches |
|
1419 | list repository named branches | |
1417 | </td></tr> |
|
1420 | </td></tr> | |
1418 | <tr><td> |
|
1421 | <tr><td> | |
1419 | <a href="/help/bundle"> |
|
1422 | <a href="/help/bundle"> | |
1420 | bundle |
|
1423 | bundle | |
1421 | </a> |
|
1424 | </a> | |
1422 | </td><td> |
|
1425 | </td><td> | |
1423 | create a changegroup file |
|
1426 | create a changegroup file | |
1424 | </td></tr> |
|
1427 | </td></tr> | |
1425 | <tr><td> |
|
1428 | <tr><td> | |
1426 | <a href="/help/cat"> |
|
1429 | <a href="/help/cat"> | |
1427 | cat |
|
1430 | cat | |
1428 | </a> |
|
1431 | </a> | |
1429 | </td><td> |
|
1432 | </td><td> | |
1430 | output the current or given revision of files |
|
1433 | output the current or given revision of files | |
1431 | </td></tr> |
|
1434 | </td></tr> | |
1432 | <tr><td> |
|
1435 | <tr><td> | |
1433 | <a href="/help/config"> |
|
1436 | <a href="/help/config"> | |
1434 | config |
|
1437 | config | |
1435 | </a> |
|
1438 | </a> | |
1436 | </td><td> |
|
1439 | </td><td> | |
1437 | show combined config settings from all hgrc files |
|
1440 | show combined config settings from all hgrc files | |
1438 | </td></tr> |
|
1441 | </td></tr> | |
1439 | <tr><td> |
|
1442 | <tr><td> | |
1440 | <a href="/help/copy"> |
|
1443 | <a href="/help/copy"> | |
1441 | copy |
|
1444 | copy | |
1442 | </a> |
|
1445 | </a> | |
1443 | </td><td> |
|
1446 | </td><td> | |
1444 | mark files as copied for the next commit |
|
1447 | mark files as copied for the next commit | |
1445 | </td></tr> |
|
1448 | </td></tr> | |
1446 | <tr><td> |
|
1449 | <tr><td> | |
|
1450 | <a href="/help/files"> | |||
|
1451 | files | |||
|
1452 | </a> | |||
|
1453 | </td><td> | |||
|
1454 | list tracked files | |||
|
1455 | </td></tr> | |||
|
1456 | <tr><td> | |||
1447 | <a href="/help/graft"> |
|
1457 | <a href="/help/graft"> | |
1448 | graft |
|
1458 | graft | |
1449 | </a> |
|
1459 | </a> | |
1450 | </td><td> |
|
1460 | </td><td> | |
1451 | copy changes from other branches onto the current branch |
|
1461 | copy changes from other branches onto the current branch | |
1452 | </td></tr> |
|
1462 | </td></tr> | |
1453 | <tr><td> |
|
1463 | <tr><td> | |
1454 | <a href="/help/grep"> |
|
1464 | <a href="/help/grep"> | |
1455 | grep |
|
1465 | grep | |
1456 | </a> |
|
1466 | </a> | |
1457 | </td><td> |
|
1467 | </td><td> | |
1458 | search for a pattern in specified files and revisions |
|
1468 | search for a pattern in specified files and revisions | |
1459 | </td></tr> |
|
1469 | </td></tr> | |
1460 | <tr><td> |
|
1470 | <tr><td> | |
1461 | <a href="/help/heads"> |
|
1471 | <a href="/help/heads"> | |
1462 | heads |
|
1472 | heads | |
1463 | </a> |
|
1473 | </a> | |
1464 | </td><td> |
|
1474 | </td><td> | |
1465 | show branch heads |
|
1475 | show branch heads | |
1466 | </td></tr> |
|
1476 | </td></tr> | |
1467 | <tr><td> |
|
1477 | <tr><td> | |
1468 | <a href="/help/help"> |
|
1478 | <a href="/help/help"> | |
1469 | help |
|
1479 | help | |
1470 | </a> |
|
1480 | </a> | |
1471 | </td><td> |
|
1481 | </td><td> | |
1472 | show help for a given topic or a help overview |
|
1482 | show help for a given topic or a help overview | |
1473 | </td></tr> |
|
1483 | </td></tr> | |
1474 | <tr><td> |
|
1484 | <tr><td> | |
1475 | <a href="/help/identify"> |
|
1485 | <a href="/help/identify"> | |
1476 | identify |
|
1486 | identify | |
1477 | </a> |
|
1487 | </a> | |
1478 | </td><td> |
|
1488 | </td><td> | |
1479 | identify the working copy or specified revision |
|
1489 | identify the working copy or specified revision | |
1480 | </td></tr> |
|
1490 | </td></tr> | |
1481 | <tr><td> |
|
1491 | <tr><td> | |
1482 | <a href="/help/import"> |
|
1492 | <a href="/help/import"> | |
1483 | import |
|
1493 | import | |
1484 | </a> |
|
1494 | </a> | |
1485 | </td><td> |
|
1495 | </td><td> | |
1486 | import an ordered set of patches |
|
1496 | import an ordered set of patches | |
1487 | </td></tr> |
|
1497 | </td></tr> | |
1488 | <tr><td> |
|
1498 | <tr><td> | |
1489 | <a href="/help/incoming"> |
|
1499 | <a href="/help/incoming"> | |
1490 | incoming |
|
1500 | incoming | |
1491 | </a> |
|
1501 | </a> | |
1492 | </td><td> |
|
1502 | </td><td> | |
1493 | show new changesets found in source |
|
1503 | show new changesets found in source | |
1494 | </td></tr> |
|
1504 | </td></tr> | |
1495 | <tr><td> |
|
1505 | <tr><td> | |
1496 | <a href="/help/locate"> |
|
1506 | <a href="/help/locate"> | |
1497 | locate |
|
1507 | locate | |
1498 | </a> |
|
1508 | </a> | |
1499 | </td><td> |
|
1509 | </td><td> | |
1500 | locate files matching specific patterns |
|
1510 | locate files matching specific patterns | |
1501 | </td></tr> |
|
1511 | </td></tr> | |
1502 | <tr><td> |
|
1512 | <tr><td> | |
1503 | <a href="/help/manifest"> |
|
1513 | <a href="/help/manifest"> | |
1504 | manifest |
|
1514 | manifest | |
1505 | </a> |
|
1515 | </a> | |
1506 | </td><td> |
|
1516 | </td><td> | |
1507 | output the current or given revision of the project manifest |
|
1517 | output the current or given revision of the project manifest | |
1508 | </td></tr> |
|
1518 | </td></tr> | |
1509 | <tr><td> |
|
1519 | <tr><td> | |
1510 | <a href="/help/nohelp"> |
|
1520 | <a href="/help/nohelp"> | |
1511 | nohelp |
|
1521 | nohelp | |
1512 | </a> |
|
1522 | </a> | |
1513 | </td><td> |
|
1523 | </td><td> | |
1514 | (no help text available) |
|
1524 | (no help text available) | |
1515 | </td></tr> |
|
1525 | </td></tr> | |
1516 | <tr><td> |
|
1526 | <tr><td> | |
1517 | <a href="/help/outgoing"> |
|
1527 | <a href="/help/outgoing"> | |
1518 | outgoing |
|
1528 | outgoing | |
1519 | </a> |
|
1529 | </a> | |
1520 | </td><td> |
|
1530 | </td><td> | |
1521 | show changesets not found in the destination |
|
1531 | show changesets not found in the destination | |
1522 | </td></tr> |
|
1532 | </td></tr> | |
1523 | <tr><td> |
|
1533 | <tr><td> | |
1524 | <a href="/help/parents"> |
|
1534 | <a href="/help/parents"> | |
1525 | parents |
|
1535 | parents | |
1526 | </a> |
|
1536 | </a> | |
1527 | </td><td> |
|
1537 | </td><td> | |
1528 | show the parents of the working directory or revision |
|
1538 | show the parents of the working directory or revision | |
1529 | </td></tr> |
|
1539 | </td></tr> | |
1530 | <tr><td> |
|
1540 | <tr><td> | |
1531 | <a href="/help/paths"> |
|
1541 | <a href="/help/paths"> | |
1532 | paths |
|
1542 | paths | |
1533 | </a> |
|
1543 | </a> | |
1534 | </td><td> |
|
1544 | </td><td> | |
1535 | show aliases for remote repositories |
|
1545 | show aliases for remote repositories | |
1536 | </td></tr> |
|
1546 | </td></tr> | |
1537 | <tr><td> |
|
1547 | <tr><td> | |
1538 | <a href="/help/phase"> |
|
1548 | <a href="/help/phase"> | |
1539 | phase |
|
1549 | phase | |
1540 | </a> |
|
1550 | </a> | |
1541 | </td><td> |
|
1551 | </td><td> | |
1542 | set or show the current phase name |
|
1552 | set or show the current phase name | |
1543 | </td></tr> |
|
1553 | </td></tr> | |
1544 | <tr><td> |
|
1554 | <tr><td> | |
1545 | <a href="/help/recover"> |
|
1555 | <a href="/help/recover"> | |
1546 | recover |
|
1556 | recover | |
1547 | </a> |
|
1557 | </a> | |
1548 | </td><td> |
|
1558 | </td><td> | |
1549 | roll back an interrupted transaction |
|
1559 | roll back an interrupted transaction | |
1550 | </td></tr> |
|
1560 | </td></tr> | |
1551 | <tr><td> |
|
1561 | <tr><td> | |
1552 | <a href="/help/rename"> |
|
1562 | <a href="/help/rename"> | |
1553 | rename |
|
1563 | rename | |
1554 | </a> |
|
1564 | </a> | |
1555 | </td><td> |
|
1565 | </td><td> | |
1556 | rename files; equivalent of copy + remove |
|
1566 | rename files; equivalent of copy + remove | |
1557 | </td></tr> |
|
1567 | </td></tr> | |
1558 | <tr><td> |
|
1568 | <tr><td> | |
1559 | <a href="/help/resolve"> |
|
1569 | <a href="/help/resolve"> | |
1560 | resolve |
|
1570 | resolve | |
1561 | </a> |
|
1571 | </a> | |
1562 | </td><td> |
|
1572 | </td><td> | |
1563 | redo merges or set/view the merge status of files |
|
1573 | redo merges or set/view the merge status of files | |
1564 | </td></tr> |
|
1574 | </td></tr> | |
1565 | <tr><td> |
|
1575 | <tr><td> | |
1566 | <a href="/help/revert"> |
|
1576 | <a href="/help/revert"> | |
1567 | revert |
|
1577 | revert | |
1568 | </a> |
|
1578 | </a> | |
1569 | </td><td> |
|
1579 | </td><td> | |
1570 | restore files to their checkout state |
|
1580 | restore files to their checkout state | |
1571 | </td></tr> |
|
1581 | </td></tr> | |
1572 | <tr><td> |
|
1582 | <tr><td> | |
1573 | <a href="/help/root"> |
|
1583 | <a href="/help/root"> | |
1574 | root |
|
1584 | root | |
1575 | </a> |
|
1585 | </a> | |
1576 | </td><td> |
|
1586 | </td><td> | |
1577 | print the root (top) of the current working directory |
|
1587 | print the root (top) of the current working directory | |
1578 | </td></tr> |
|
1588 | </td></tr> | |
1579 | <tr><td> |
|
1589 | <tr><td> | |
1580 | <a href="/help/tag"> |
|
1590 | <a href="/help/tag"> | |
1581 | tag |
|
1591 | tag | |
1582 | </a> |
|
1592 | </a> | |
1583 | </td><td> |
|
1593 | </td><td> | |
1584 | add one or more tags for the current or given revision |
|
1594 | add one or more tags for the current or given revision | |
1585 | </td></tr> |
|
1595 | </td></tr> | |
1586 | <tr><td> |
|
1596 | <tr><td> | |
1587 | <a href="/help/tags"> |
|
1597 | <a href="/help/tags"> | |
1588 | tags |
|
1598 | tags | |
1589 | </a> |
|
1599 | </a> | |
1590 | </td><td> |
|
1600 | </td><td> | |
1591 | list repository tags |
|
1601 | list repository tags | |
1592 | </td></tr> |
|
1602 | </td></tr> | |
1593 | <tr><td> |
|
1603 | <tr><td> | |
1594 | <a href="/help/unbundle"> |
|
1604 | <a href="/help/unbundle"> | |
1595 | unbundle |
|
1605 | unbundle | |
1596 | </a> |
|
1606 | </a> | |
1597 | </td><td> |
|
1607 | </td><td> | |
1598 | apply one or more changegroup files |
|
1608 | apply one or more changegroup files | |
1599 | </td></tr> |
|
1609 | </td></tr> | |
1600 | <tr><td> |
|
1610 | <tr><td> | |
1601 | <a href="/help/verify"> |
|
1611 | <a href="/help/verify"> | |
1602 | verify |
|
1612 | verify | |
1603 | </a> |
|
1613 | </a> | |
1604 | </td><td> |
|
1614 | </td><td> | |
1605 | verify the integrity of the repository |
|
1615 | verify the integrity of the repository | |
1606 | </td></tr> |
|
1616 | </td></tr> | |
1607 | <tr><td> |
|
1617 | <tr><td> | |
1608 | <a href="/help/version"> |
|
1618 | <a href="/help/version"> | |
1609 | version |
|
1619 | version | |
1610 | </a> |
|
1620 | </a> | |
1611 | </td><td> |
|
1621 | </td><td> | |
1612 | output version and copyright information |
|
1622 | output version and copyright information | |
1613 | </td></tr> |
|
1623 | </td></tr> | |
1614 | </table> |
|
1624 | </table> | |
1615 | </div> |
|
1625 | </div> | |
1616 | </div> |
|
1626 | </div> | |
1617 |
|
1627 | |||
1618 | <script type="text/javascript">process_dates()</script> |
|
1628 | <script type="text/javascript">process_dates()</script> | |
1619 |
|
1629 | |||
1620 |
|
1630 | |||
1621 | </body> |
|
1631 | </body> | |
1622 | </html> |
|
1632 | </html> | |
1623 |
|
1633 | |||
1624 |
|
1634 | |||
1625 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add" |
|
1635 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add" | |
1626 | 200 Script output follows |
|
1636 | 200 Script output follows | |
1627 |
|
1637 | |||
1628 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1638 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
1629 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1639 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
1630 | <head> |
|
1640 | <head> | |
1631 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1641 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
1632 | <meta name="robots" content="index, nofollow" /> |
|
1642 | <meta name="robots" content="index, nofollow" /> | |
1633 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1643 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
1634 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1644 | <script type="text/javascript" src="/static/mercurial.js"></script> | |
1635 |
|
1645 | |||
1636 | <title>Help: add</title> |
|
1646 | <title>Help: add</title> | |
1637 | </head> |
|
1647 | </head> | |
1638 | <body> |
|
1648 | <body> | |
1639 |
|
1649 | |||
1640 | <div class="container"> |
|
1650 | <div class="container"> | |
1641 | <div class="menu"> |
|
1651 | <div class="menu"> | |
1642 | <div class="logo"> |
|
1652 | <div class="logo"> | |
1643 | <a href="http://mercurial.selenic.com/"> |
|
1653 | <a href="http://mercurial.selenic.com/"> | |
1644 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1654 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
1645 | </div> |
|
1655 | </div> | |
1646 | <ul> |
|
1656 | <ul> | |
1647 | <li><a href="/shortlog">log</a></li> |
|
1657 | <li><a href="/shortlog">log</a></li> | |
1648 | <li><a href="/graph">graph</a></li> |
|
1658 | <li><a href="/graph">graph</a></li> | |
1649 | <li><a href="/tags">tags</a></li> |
|
1659 | <li><a href="/tags">tags</a></li> | |
1650 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1660 | <li><a href="/bookmarks">bookmarks</a></li> | |
1651 | <li><a href="/branches">branches</a></li> |
|
1661 | <li><a href="/branches">branches</a></li> | |
1652 | </ul> |
|
1662 | </ul> | |
1653 | <ul> |
|
1663 | <ul> | |
1654 | <li class="active"><a href="/help">help</a></li> |
|
1664 | <li class="active"><a href="/help">help</a></li> | |
1655 | </ul> |
|
1665 | </ul> | |
1656 | </div> |
|
1666 | </div> | |
1657 |
|
1667 | |||
1658 | <div class="main"> |
|
1668 | <div class="main"> | |
1659 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1669 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> | |
1660 | <h3>Help: add</h3> |
|
1670 | <h3>Help: add</h3> | |
1661 |
|
1671 | |||
1662 | <form class="search" action="/log"> |
|
1672 | <form class="search" action="/log"> | |
1663 |
|
1673 | |||
1664 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1674 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
1665 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
1675 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision | |
1666 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
1676 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> | |
1667 | </form> |
|
1677 | </form> | |
1668 | <div id="doc"> |
|
1678 | <div id="doc"> | |
1669 | <p> |
|
1679 | <p> | |
1670 | hg add [OPTION]... [FILE]... |
|
1680 | hg add [OPTION]... [FILE]... | |
1671 | </p> |
|
1681 | </p> | |
1672 | <p> |
|
1682 | <p> | |
1673 | add the specified files on the next commit |
|
1683 | add the specified files on the next commit | |
1674 | </p> |
|
1684 | </p> | |
1675 | <p> |
|
1685 | <p> | |
1676 | Schedule files to be version controlled and added to the |
|
1686 | Schedule files to be version controlled and added to the | |
1677 | repository. |
|
1687 | repository. | |
1678 | </p> |
|
1688 | </p> | |
1679 | <p> |
|
1689 | <p> | |
1680 | The files will be added to the repository at the next commit. To |
|
1690 | The files will be added to the repository at the next commit. To | |
1681 | undo an add before that, see "hg forget". |
|
1691 | undo an add before that, see "hg forget". | |
1682 | </p> |
|
1692 | </p> | |
1683 | <p> |
|
1693 | <p> | |
1684 | If no names are given, add all files to the repository. |
|
1694 | If no names are given, add all files to the repository. | |
1685 | </p> |
|
1695 | </p> | |
1686 | <p> |
|
1696 | <p> | |
1687 | An example showing how new (unknown) files are added |
|
1697 | An example showing how new (unknown) files are added | |
1688 | automatically by "hg add": |
|
1698 | automatically by "hg add": | |
1689 | </p> |
|
1699 | </p> | |
1690 | <pre> |
|
1700 | <pre> | |
1691 | \$ ls (re) |
|
1701 | \$ ls (re) | |
1692 | foo.c |
|
1702 | foo.c | |
1693 | \$ hg status (re) |
|
1703 | \$ hg status (re) | |
1694 | ? foo.c |
|
1704 | ? foo.c | |
1695 | \$ hg add (re) |
|
1705 | \$ hg add (re) | |
1696 | adding foo.c |
|
1706 | adding foo.c | |
1697 | \$ hg status (re) |
|
1707 | \$ hg status (re) | |
1698 | A foo.c |
|
1708 | A foo.c | |
1699 | </pre> |
|
1709 | </pre> | |
1700 | <p> |
|
1710 | <p> | |
1701 | Returns 0 if all files are successfully added. |
|
1711 | Returns 0 if all files are successfully added. | |
1702 | </p> |
|
1712 | </p> | |
1703 | <p> |
|
1713 | <p> | |
1704 | options ([+] can be repeated): |
|
1714 | options ([+] can be repeated): | |
1705 | </p> |
|
1715 | </p> | |
1706 | <table> |
|
1716 | <table> | |
1707 | <tr><td>-I</td> |
|
1717 | <tr><td>-I</td> | |
1708 | <td>--include PATTERN [+]</td> |
|
1718 | <td>--include PATTERN [+]</td> | |
1709 | <td>include names matching the given patterns</td></tr> |
|
1719 | <td>include names matching the given patterns</td></tr> | |
1710 | <tr><td>-X</td> |
|
1720 | <tr><td>-X</td> | |
1711 | <td>--exclude PATTERN [+]</td> |
|
1721 | <td>--exclude PATTERN [+]</td> | |
1712 | <td>exclude names matching the given patterns</td></tr> |
|
1722 | <td>exclude names matching the given patterns</td></tr> | |
1713 | <tr><td>-S</td> |
|
1723 | <tr><td>-S</td> | |
1714 | <td>--subrepos</td> |
|
1724 | <td>--subrepos</td> | |
1715 | <td>recurse into subrepositories</td></tr> |
|
1725 | <td>recurse into subrepositories</td></tr> | |
1716 | <tr><td>-n</td> |
|
1726 | <tr><td>-n</td> | |
1717 | <td>--dry-run</td> |
|
1727 | <td>--dry-run</td> | |
1718 | <td>do not perform actions, just print output</td></tr> |
|
1728 | <td>do not perform actions, just print output</td></tr> | |
1719 | </table> |
|
1729 | </table> | |
1720 | <p> |
|
1730 | <p> | |
1721 | global options ([+] can be repeated): |
|
1731 | global options ([+] can be repeated): | |
1722 | </p> |
|
1732 | </p> | |
1723 | <table> |
|
1733 | <table> | |
1724 | <tr><td>-R</td> |
|
1734 | <tr><td>-R</td> | |
1725 | <td>--repository REPO</td> |
|
1735 | <td>--repository REPO</td> | |
1726 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
1736 | <td>repository root directory or name of overlay bundle file</td></tr> | |
1727 | <tr><td></td> |
|
1737 | <tr><td></td> | |
1728 | <td>--cwd DIR</td> |
|
1738 | <td>--cwd DIR</td> | |
1729 | <td>change working directory</td></tr> |
|
1739 | <td>change working directory</td></tr> | |
1730 | <tr><td>-y</td> |
|
1740 | <tr><td>-y</td> | |
1731 | <td>--noninteractive</td> |
|
1741 | <td>--noninteractive</td> | |
1732 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
1742 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> | |
1733 | <tr><td>-q</td> |
|
1743 | <tr><td>-q</td> | |
1734 | <td>--quiet</td> |
|
1744 | <td>--quiet</td> | |
1735 | <td>suppress output</td></tr> |
|
1745 | <td>suppress output</td></tr> | |
1736 | <tr><td>-v</td> |
|
1746 | <tr><td>-v</td> | |
1737 | <td>--verbose</td> |
|
1747 | <td>--verbose</td> | |
1738 | <td>enable additional output</td></tr> |
|
1748 | <td>enable additional output</td></tr> | |
1739 | <tr><td></td> |
|
1749 | <tr><td></td> | |
1740 | <td>--config CONFIG [+]</td> |
|
1750 | <td>--config CONFIG [+]</td> | |
1741 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
1751 | <td>set/override config option (use 'section.name=value')</td></tr> | |
1742 | <tr><td></td> |
|
1752 | <tr><td></td> | |
1743 | <td>--debug</td> |
|
1753 | <td>--debug</td> | |
1744 | <td>enable debugging output</td></tr> |
|
1754 | <td>enable debugging output</td></tr> | |
1745 | <tr><td></td> |
|
1755 | <tr><td></td> | |
1746 | <td>--debugger</td> |
|
1756 | <td>--debugger</td> | |
1747 | <td>start debugger</td></tr> |
|
1757 | <td>start debugger</td></tr> | |
1748 | <tr><td></td> |
|
1758 | <tr><td></td> | |
1749 | <td>--encoding ENCODE</td> |
|
1759 | <td>--encoding ENCODE</td> | |
1750 | <td>set the charset encoding (default: ascii)</td></tr> |
|
1760 | <td>set the charset encoding (default: ascii)</td></tr> | |
1751 | <tr><td></td> |
|
1761 | <tr><td></td> | |
1752 | <td>--encodingmode MODE</td> |
|
1762 | <td>--encodingmode MODE</td> | |
1753 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
1763 | <td>set the charset encoding mode (default: strict)</td></tr> | |
1754 | <tr><td></td> |
|
1764 | <tr><td></td> | |
1755 | <td>--traceback</td> |
|
1765 | <td>--traceback</td> | |
1756 | <td>always print a traceback on exception</td></tr> |
|
1766 | <td>always print a traceback on exception</td></tr> | |
1757 | <tr><td></td> |
|
1767 | <tr><td></td> | |
1758 | <td>--time</td> |
|
1768 | <td>--time</td> | |
1759 | <td>time how long the command takes</td></tr> |
|
1769 | <td>time how long the command takes</td></tr> | |
1760 | <tr><td></td> |
|
1770 | <tr><td></td> | |
1761 | <td>--profile</td> |
|
1771 | <td>--profile</td> | |
1762 | <td>print command execution profile</td></tr> |
|
1772 | <td>print command execution profile</td></tr> | |
1763 | <tr><td></td> |
|
1773 | <tr><td></td> | |
1764 | <td>--version</td> |
|
1774 | <td>--version</td> | |
1765 | <td>output version information and exit</td></tr> |
|
1775 | <td>output version information and exit</td></tr> | |
1766 | <tr><td>-h</td> |
|
1776 | <tr><td>-h</td> | |
1767 | <td>--help</td> |
|
1777 | <td>--help</td> | |
1768 | <td>display help and exit</td></tr> |
|
1778 | <td>display help and exit</td></tr> | |
1769 | <tr><td></td> |
|
1779 | <tr><td></td> | |
1770 | <td>--hidden</td> |
|
1780 | <td>--hidden</td> | |
1771 | <td>consider hidden changesets</td></tr> |
|
1781 | <td>consider hidden changesets</td></tr> | |
1772 | </table> |
|
1782 | </table> | |
1773 |
|
1783 | |||
1774 | </div> |
|
1784 | </div> | |
1775 | </div> |
|
1785 | </div> | |
1776 | </div> |
|
1786 | </div> | |
1777 |
|
1787 | |||
1778 | <script type="text/javascript">process_dates()</script> |
|
1788 | <script type="text/javascript">process_dates()</script> | |
1779 |
|
1789 | |||
1780 |
|
1790 | |||
1781 | </body> |
|
1791 | </body> | |
1782 | </html> |
|
1792 | </html> | |
1783 |
|
1793 | |||
1784 |
|
1794 | |||
1785 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove" |
|
1795 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove" | |
1786 | 200 Script output follows |
|
1796 | 200 Script output follows | |
1787 |
|
1797 | |||
1788 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1798 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
1789 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1799 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
1790 | <head> |
|
1800 | <head> | |
1791 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1801 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
1792 | <meta name="robots" content="index, nofollow" /> |
|
1802 | <meta name="robots" content="index, nofollow" /> | |
1793 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1803 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
1794 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1804 | <script type="text/javascript" src="/static/mercurial.js"></script> | |
1795 |
|
1805 | |||
1796 | <title>Help: remove</title> |
|
1806 | <title>Help: remove</title> | |
1797 | </head> |
|
1807 | </head> | |
1798 | <body> |
|
1808 | <body> | |
1799 |
|
1809 | |||
1800 | <div class="container"> |
|
1810 | <div class="container"> | |
1801 | <div class="menu"> |
|
1811 | <div class="menu"> | |
1802 | <div class="logo"> |
|
1812 | <div class="logo"> | |
1803 | <a href="http://mercurial.selenic.com/"> |
|
1813 | <a href="http://mercurial.selenic.com/"> | |
1804 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
1814 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
1805 | </div> |
|
1815 | </div> | |
1806 | <ul> |
|
1816 | <ul> | |
1807 | <li><a href="/shortlog">log</a></li> |
|
1817 | <li><a href="/shortlog">log</a></li> | |
1808 | <li><a href="/graph">graph</a></li> |
|
1818 | <li><a href="/graph">graph</a></li> | |
1809 | <li><a href="/tags">tags</a></li> |
|
1819 | <li><a href="/tags">tags</a></li> | |
1810 | <li><a href="/bookmarks">bookmarks</a></li> |
|
1820 | <li><a href="/bookmarks">bookmarks</a></li> | |
1811 | <li><a href="/branches">branches</a></li> |
|
1821 | <li><a href="/branches">branches</a></li> | |
1812 | </ul> |
|
1822 | </ul> | |
1813 | <ul> |
|
1823 | <ul> | |
1814 | <li class="active"><a href="/help">help</a></li> |
|
1824 | <li class="active"><a href="/help">help</a></li> | |
1815 | </ul> |
|
1825 | </ul> | |
1816 | </div> |
|
1826 | </div> | |
1817 |
|
1827 | |||
1818 | <div class="main"> |
|
1828 | <div class="main"> | |
1819 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
1829 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> | |
1820 | <h3>Help: remove</h3> |
|
1830 | <h3>Help: remove</h3> | |
1821 |
|
1831 | |||
1822 | <form class="search" action="/log"> |
|
1832 | <form class="search" action="/log"> | |
1823 |
|
1833 | |||
1824 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
1834 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
1825 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
1835 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision | |
1826 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
1836 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> | |
1827 | </form> |
|
1837 | </form> | |
1828 | <div id="doc"> |
|
1838 | <div id="doc"> | |
1829 | <p> |
|
1839 | <p> | |
1830 | hg remove [OPTION]... FILE... |
|
1840 | hg remove [OPTION]... FILE... | |
1831 | </p> |
|
1841 | </p> | |
1832 | <p> |
|
1842 | <p> | |
1833 | aliases: rm |
|
1843 | aliases: rm | |
1834 | </p> |
|
1844 | </p> | |
1835 | <p> |
|
1845 | <p> | |
1836 | remove the specified files on the next commit |
|
1846 | remove the specified files on the next commit | |
1837 | </p> |
|
1847 | </p> | |
1838 | <p> |
|
1848 | <p> | |
1839 | Schedule the indicated files for removal from the current branch. |
|
1849 | Schedule the indicated files for removal from the current branch. | |
1840 | </p> |
|
1850 | </p> | |
1841 | <p> |
|
1851 | <p> | |
1842 | This command schedules the files to be removed at the next commit. |
|
1852 | This command schedules the files to be removed at the next commit. | |
1843 | To undo a remove before that, see "hg revert". To undo added |
|
1853 | To undo a remove before that, see "hg revert". To undo added | |
1844 | files, see "hg forget". |
|
1854 | files, see "hg forget". | |
1845 | </p> |
|
1855 | </p> | |
1846 | <p> |
|
1856 | <p> | |
1847 | -A/--after can be used to remove only files that have already |
|
1857 | -A/--after can be used to remove only files that have already | |
1848 | been deleted, -f/--force can be used to force deletion, and -Af |
|
1858 | been deleted, -f/--force can be used to force deletion, and -Af | |
1849 | can be used to remove files from the next revision without |
|
1859 | can be used to remove files from the next revision without | |
1850 | deleting them from the working directory. |
|
1860 | deleting them from the working directory. | |
1851 | </p> |
|
1861 | </p> | |
1852 | <p> |
|
1862 | <p> | |
1853 | The following table details the behavior of remove for different |
|
1863 | The following table details the behavior of remove for different | |
1854 | file states (columns) and option combinations (rows). The file |
|
1864 | file states (columns) and option combinations (rows). The file | |
1855 | states are Added [A], Clean [C], Modified [M] and Missing [!] |
|
1865 | states are Added [A], Clean [C], Modified [M] and Missing [!] | |
1856 | (as reported by "hg status"). The actions are Warn, Remove |
|
1866 | (as reported by "hg status"). The actions are Warn, Remove | |
1857 | (from branch) and Delete (from disk): |
|
1867 | (from branch) and Delete (from disk): | |
1858 | </p> |
|
1868 | </p> | |
1859 | <table> |
|
1869 | <table> | |
1860 | <tr><td>opt/state</td> |
|
1870 | <tr><td>opt/state</td> | |
1861 | <td>A</td> |
|
1871 | <td>A</td> | |
1862 | <td>C</td> |
|
1872 | <td>C</td> | |
1863 | <td>M</td> |
|
1873 | <td>M</td> | |
1864 | <td>!</td></tr> |
|
1874 | <td>!</td></tr> | |
1865 | <tr><td>none</td> |
|
1875 | <tr><td>none</td> | |
1866 | <td>W</td> |
|
1876 | <td>W</td> | |
1867 | <td>RD</td> |
|
1877 | <td>RD</td> | |
1868 | <td>W</td> |
|
1878 | <td>W</td> | |
1869 | <td>R</td></tr> |
|
1879 | <td>R</td></tr> | |
1870 | <tr><td>-f</td> |
|
1880 | <tr><td>-f</td> | |
1871 | <td>R</td> |
|
1881 | <td>R</td> | |
1872 | <td>RD</td> |
|
1882 | <td>RD</td> | |
1873 | <td>RD</td> |
|
1883 | <td>RD</td> | |
1874 | <td>R</td></tr> |
|
1884 | <td>R</td></tr> | |
1875 | <tr><td>-A</td> |
|
1885 | <tr><td>-A</td> | |
1876 | <td>W</td> |
|
1886 | <td>W</td> | |
1877 | <td>W</td> |
|
1887 | <td>W</td> | |
1878 | <td>W</td> |
|
1888 | <td>W</td> | |
1879 | <td>R</td></tr> |
|
1889 | <td>R</td></tr> | |
1880 | <tr><td>-Af</td> |
|
1890 | <tr><td>-Af</td> | |
1881 | <td>R</td> |
|
1891 | <td>R</td> | |
1882 | <td>R</td> |
|
1892 | <td>R</td> | |
1883 | <td>R</td> |
|
1893 | <td>R</td> | |
1884 | <td>R</td></tr> |
|
1894 | <td>R</td></tr> | |
1885 | </table> |
|
1895 | </table> | |
1886 | <p> |
|
1896 | <p> | |
1887 | Note that remove never deletes files in Added [A] state from the |
|
1897 | Note that remove never deletes files in Added [A] state from the | |
1888 | working directory, not even if option --force is specified. |
|
1898 | working directory, not even if option --force is specified. | |
1889 | </p> |
|
1899 | </p> | |
1890 | <p> |
|
1900 | <p> | |
1891 | Returns 0 on success, 1 if any warnings encountered. |
|
1901 | Returns 0 on success, 1 if any warnings encountered. | |
1892 | </p> |
|
1902 | </p> | |
1893 | <p> |
|
1903 | <p> | |
1894 | options ([+] can be repeated): |
|
1904 | options ([+] can be repeated): | |
1895 | </p> |
|
1905 | </p> | |
1896 | <table> |
|
1906 | <table> | |
1897 | <tr><td>-A</td> |
|
1907 | <tr><td>-A</td> | |
1898 | <td>--after</td> |
|
1908 | <td>--after</td> | |
1899 | <td>record delete for missing files</td></tr> |
|
1909 | <td>record delete for missing files</td></tr> | |
1900 | <tr><td>-f</td> |
|
1910 | <tr><td>-f</td> | |
1901 | <td>--force</td> |
|
1911 | <td>--force</td> | |
1902 | <td>remove (and delete) file even if added or modified</td></tr> |
|
1912 | <td>remove (and delete) file even if added or modified</td></tr> | |
1903 | <tr><td>-I</td> |
|
1913 | <tr><td>-I</td> | |
1904 | <td>--include PATTERN [+]</td> |
|
1914 | <td>--include PATTERN [+]</td> | |
1905 | <td>include names matching the given patterns</td></tr> |
|
1915 | <td>include names matching the given patterns</td></tr> | |
1906 | <tr><td>-X</td> |
|
1916 | <tr><td>-X</td> | |
1907 | <td>--exclude PATTERN [+]</td> |
|
1917 | <td>--exclude PATTERN [+]</td> | |
1908 | <td>exclude names matching the given patterns</td></tr> |
|
1918 | <td>exclude names matching the given patterns</td></tr> | |
1909 | </table> |
|
1919 | </table> | |
1910 | <p> |
|
1920 | <p> | |
1911 | global options ([+] can be repeated): |
|
1921 | global options ([+] can be repeated): | |
1912 | </p> |
|
1922 | </p> | |
1913 | <table> |
|
1923 | <table> | |
1914 | <tr><td>-R</td> |
|
1924 | <tr><td>-R</td> | |
1915 | <td>--repository REPO</td> |
|
1925 | <td>--repository REPO</td> | |
1916 | <td>repository root directory or name of overlay bundle file</td></tr> |
|
1926 | <td>repository root directory or name of overlay bundle file</td></tr> | |
1917 | <tr><td></td> |
|
1927 | <tr><td></td> | |
1918 | <td>--cwd DIR</td> |
|
1928 | <td>--cwd DIR</td> | |
1919 | <td>change working directory</td></tr> |
|
1929 | <td>change working directory</td></tr> | |
1920 | <tr><td>-y</td> |
|
1930 | <tr><td>-y</td> | |
1921 | <td>--noninteractive</td> |
|
1931 | <td>--noninteractive</td> | |
1922 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> |
|
1932 | <td>do not prompt, automatically pick the first choice for all prompts</td></tr> | |
1923 | <tr><td>-q</td> |
|
1933 | <tr><td>-q</td> | |
1924 | <td>--quiet</td> |
|
1934 | <td>--quiet</td> | |
1925 | <td>suppress output</td></tr> |
|
1935 | <td>suppress output</td></tr> | |
1926 | <tr><td>-v</td> |
|
1936 | <tr><td>-v</td> | |
1927 | <td>--verbose</td> |
|
1937 | <td>--verbose</td> | |
1928 | <td>enable additional output</td></tr> |
|
1938 | <td>enable additional output</td></tr> | |
1929 | <tr><td></td> |
|
1939 | <tr><td></td> | |
1930 | <td>--config CONFIG [+]</td> |
|
1940 | <td>--config CONFIG [+]</td> | |
1931 | <td>set/override config option (use 'section.name=value')</td></tr> |
|
1941 | <td>set/override config option (use 'section.name=value')</td></tr> | |
1932 | <tr><td></td> |
|
1942 | <tr><td></td> | |
1933 | <td>--debug</td> |
|
1943 | <td>--debug</td> | |
1934 | <td>enable debugging output</td></tr> |
|
1944 | <td>enable debugging output</td></tr> | |
1935 | <tr><td></td> |
|
1945 | <tr><td></td> | |
1936 | <td>--debugger</td> |
|
1946 | <td>--debugger</td> | |
1937 | <td>start debugger</td></tr> |
|
1947 | <td>start debugger</td></tr> | |
1938 | <tr><td></td> |
|
1948 | <tr><td></td> | |
1939 | <td>--encoding ENCODE</td> |
|
1949 | <td>--encoding ENCODE</td> | |
1940 | <td>set the charset encoding (default: ascii)</td></tr> |
|
1950 | <td>set the charset encoding (default: ascii)</td></tr> | |
1941 | <tr><td></td> |
|
1951 | <tr><td></td> | |
1942 | <td>--encodingmode MODE</td> |
|
1952 | <td>--encodingmode MODE</td> | |
1943 | <td>set the charset encoding mode (default: strict)</td></tr> |
|
1953 | <td>set the charset encoding mode (default: strict)</td></tr> | |
1944 | <tr><td></td> |
|
1954 | <tr><td></td> | |
1945 | <td>--traceback</td> |
|
1955 | <td>--traceback</td> | |
1946 | <td>always print a traceback on exception</td></tr> |
|
1956 | <td>always print a traceback on exception</td></tr> | |
1947 | <tr><td></td> |
|
1957 | <tr><td></td> | |
1948 | <td>--time</td> |
|
1958 | <td>--time</td> | |
1949 | <td>time how long the command takes</td></tr> |
|
1959 | <td>time how long the command takes</td></tr> | |
1950 | <tr><td></td> |
|
1960 | <tr><td></td> | |
1951 | <td>--profile</td> |
|
1961 | <td>--profile</td> | |
1952 | <td>print command execution profile</td></tr> |
|
1962 | <td>print command execution profile</td></tr> | |
1953 | <tr><td></td> |
|
1963 | <tr><td></td> | |
1954 | <td>--version</td> |
|
1964 | <td>--version</td> | |
1955 | <td>output version information and exit</td></tr> |
|
1965 | <td>output version information and exit</td></tr> | |
1956 | <tr><td>-h</td> |
|
1966 | <tr><td>-h</td> | |
1957 | <td>--help</td> |
|
1967 | <td>--help</td> | |
1958 | <td>display help and exit</td></tr> |
|
1968 | <td>display help and exit</td></tr> | |
1959 | <tr><td></td> |
|
1969 | <tr><td></td> | |
1960 | <td>--hidden</td> |
|
1970 | <td>--hidden</td> | |
1961 | <td>consider hidden changesets</td></tr> |
|
1971 | <td>consider hidden changesets</td></tr> | |
1962 | </table> |
|
1972 | </table> | |
1963 |
|
1973 | |||
1964 | </div> |
|
1974 | </div> | |
1965 | </div> |
|
1975 | </div> | |
1966 | </div> |
|
1976 | </div> | |
1967 |
|
1977 | |||
1968 | <script type="text/javascript">process_dates()</script> |
|
1978 | <script type="text/javascript">process_dates()</script> | |
1969 |
|
1979 | |||
1970 |
|
1980 | |||
1971 | </body> |
|
1981 | </body> | |
1972 | </html> |
|
1982 | </html> | |
1973 |
|
1983 | |||
1974 |
|
1984 | |||
1975 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions" |
|
1985 | $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions" | |
1976 | 200 Script output follows |
|
1986 | 200 Script output follows | |
1977 |
|
1987 | |||
1978 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1988 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
1979 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> |
|
1989 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US"> | |
1980 | <head> |
|
1990 | <head> | |
1981 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> |
|
1991 | <link rel="icon" href="/static/hgicon.png" type="image/png" /> | |
1982 | <meta name="robots" content="index, nofollow" /> |
|
1992 | <meta name="robots" content="index, nofollow" /> | |
1983 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> |
|
1993 | <link rel="stylesheet" href="/static/style-paper.css" type="text/css" /> | |
1984 | <script type="text/javascript" src="/static/mercurial.js"></script> |
|
1994 | <script type="text/javascript" src="/static/mercurial.js"></script> | |
1985 |
|
1995 | |||
1986 | <title>Help: revisions</title> |
|
1996 | <title>Help: revisions</title> | |
1987 | </head> |
|
1997 | </head> | |
1988 | <body> |
|
1998 | <body> | |
1989 |
|
1999 | |||
1990 | <div class="container"> |
|
2000 | <div class="container"> | |
1991 | <div class="menu"> |
|
2001 | <div class="menu"> | |
1992 | <div class="logo"> |
|
2002 | <div class="logo"> | |
1993 | <a href="http://mercurial.selenic.com/"> |
|
2003 | <a href="http://mercurial.selenic.com/"> | |
1994 | <img src="/static/hglogo.png" alt="mercurial" /></a> |
|
2004 | <img src="/static/hglogo.png" alt="mercurial" /></a> | |
1995 | </div> |
|
2005 | </div> | |
1996 | <ul> |
|
2006 | <ul> | |
1997 | <li><a href="/shortlog">log</a></li> |
|
2007 | <li><a href="/shortlog">log</a></li> | |
1998 | <li><a href="/graph">graph</a></li> |
|
2008 | <li><a href="/graph">graph</a></li> | |
1999 | <li><a href="/tags">tags</a></li> |
|
2009 | <li><a href="/tags">tags</a></li> | |
2000 | <li><a href="/bookmarks">bookmarks</a></li> |
|
2010 | <li><a href="/bookmarks">bookmarks</a></li> | |
2001 | <li><a href="/branches">branches</a></li> |
|
2011 | <li><a href="/branches">branches</a></li> | |
2002 | </ul> |
|
2012 | </ul> | |
2003 | <ul> |
|
2013 | <ul> | |
2004 | <li class="active"><a href="/help">help</a></li> |
|
2014 | <li class="active"><a href="/help">help</a></li> | |
2005 | </ul> |
|
2015 | </ul> | |
2006 | </div> |
|
2016 | </div> | |
2007 |
|
2017 | |||
2008 | <div class="main"> |
|
2018 | <div class="main"> | |
2009 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> |
|
2019 | <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2> | |
2010 | <h3>Help: revisions</h3> |
|
2020 | <h3>Help: revisions</h3> | |
2011 |
|
2021 | |||
2012 | <form class="search" action="/log"> |
|
2022 | <form class="search" action="/log"> | |
2013 |
|
2023 | |||
2014 | <p><input name="rev" id="search1" type="text" size="30" /></p> |
|
2024 | <p><input name="rev" id="search1" type="text" size="30" /></p> | |
2015 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision |
|
2025 | <div id="hint">Find changesets by keywords (author, files, the commit message), revision | |
2016 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> |
|
2026 | number or hash, or <a href="/help/revsets">revset expression</a>.</div> | |
2017 | </form> |
|
2027 | </form> | |
2018 | <div id="doc"> |
|
2028 | <div id="doc"> | |
2019 | <h1>Specifying Single Revisions</h1> |
|
2029 | <h1>Specifying Single Revisions</h1> | |
2020 | <p> |
|
2030 | <p> | |
2021 | Mercurial supports several ways to specify individual revisions. |
|
2031 | Mercurial supports several ways to specify individual revisions. | |
2022 | </p> |
|
2032 | </p> | |
2023 | <p> |
|
2033 | <p> | |
2024 | A plain integer is treated as a revision number. Negative integers are |
|
2034 | A plain integer is treated as a revision number. Negative integers are | |
2025 | treated as sequential offsets from the tip, with -1 denoting the tip, |
|
2035 | treated as sequential offsets from the tip, with -1 denoting the tip, | |
2026 | -2 denoting the revision prior to the tip, and so forth. |
|
2036 | -2 denoting the revision prior to the tip, and so forth. | |
2027 | </p> |
|
2037 | </p> | |
2028 | <p> |
|
2038 | <p> | |
2029 | A 40-digit hexadecimal string is treated as a unique revision |
|
2039 | A 40-digit hexadecimal string is treated as a unique revision | |
2030 | identifier. |
|
2040 | identifier. | |
2031 | </p> |
|
2041 | </p> | |
2032 | <p> |
|
2042 | <p> | |
2033 | A hexadecimal string less than 40 characters long is treated as a |
|
2043 | A hexadecimal string less than 40 characters long is treated as a | |
2034 | unique revision identifier and is referred to as a short-form |
|
2044 | unique revision identifier and is referred to as a short-form | |
2035 | identifier. A short-form identifier is only valid if it is the prefix |
|
2045 | identifier. A short-form identifier is only valid if it is the prefix | |
2036 | of exactly one full-length identifier. |
|
2046 | of exactly one full-length identifier. | |
2037 | </p> |
|
2047 | </p> | |
2038 | <p> |
|
2048 | <p> | |
2039 | Any other string is treated as a bookmark, tag, or branch name. A |
|
2049 | Any other string is treated as a bookmark, tag, or branch name. A | |
2040 | bookmark is a movable pointer to a revision. A tag is a permanent name |
|
2050 | bookmark is a movable pointer to a revision. A tag is a permanent name | |
2041 | associated with a revision. A branch name denotes the tipmost open branch head |
|
2051 | associated with a revision. A branch name denotes the tipmost open branch head | |
2042 | of that branch - or if they are all closed, the tipmost closed head of the |
|
2052 | of that branch - or if they are all closed, the tipmost closed head of the | |
2043 | branch. Bookmark, tag, and branch names must not contain the ":" character. |
|
2053 | branch. Bookmark, tag, and branch names must not contain the ":" character. | |
2044 | </p> |
|
2054 | </p> | |
2045 | <p> |
|
2055 | <p> | |
2046 | The reserved name "tip" always identifies the most recent revision. |
|
2056 | The reserved name "tip" always identifies the most recent revision. | |
2047 | </p> |
|
2057 | </p> | |
2048 | <p> |
|
2058 | <p> | |
2049 | The reserved name "null" indicates the null revision. This is the |
|
2059 | The reserved name "null" indicates the null revision. This is the | |
2050 | revision of an empty repository, and the parent of revision 0. |
|
2060 | revision of an empty repository, and the parent of revision 0. | |
2051 | </p> |
|
2061 | </p> | |
2052 | <p> |
|
2062 | <p> | |
2053 | The reserved name "." indicates the working directory parent. If no |
|
2063 | The reserved name "." indicates the working directory parent. If no | |
2054 | working directory is checked out, it is equivalent to null. If an |
|
2064 | working directory is checked out, it is equivalent to null. If an | |
2055 | uncommitted merge is in progress, "." is the revision of the first |
|
2065 | uncommitted merge is in progress, "." is the revision of the first | |
2056 | parent. |
|
2066 | parent. | |
2057 | </p> |
|
2067 | </p> | |
2058 |
|
2068 | |||
2059 | </div> |
|
2069 | </div> | |
2060 | </div> |
|
2070 | </div> | |
2061 | </div> |
|
2071 | </div> | |
2062 |
|
2072 | |||
2063 | <script type="text/javascript">process_dates()</script> |
|
2073 | <script type="text/javascript">process_dates()</script> | |
2064 |
|
2074 | |||
2065 |
|
2075 | |||
2066 | </body> |
|
2076 | </body> | |
2067 | </html> |
|
2077 | </html> | |
2068 |
|
2078 | |||
2069 |
|
2079 | |||
2070 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS |
|
2080 | $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS | |
2071 |
|
2081 | |||
2072 | #endif |
|
2082 | #endif |
@@ -1,121 +1,131 b'' | |||||
1 | $ hg init repo |
|
1 | $ hg init repo | |
2 | $ cd repo |
|
2 | $ cd repo | |
3 | $ echo 0 > a |
|
3 | $ echo 0 > a | |
4 | $ echo 0 > b |
|
4 | $ echo 0 > b | |
5 | $ echo 0 > t.h |
|
5 | $ echo 0 > t.h | |
6 | $ mkdir t |
|
6 | $ mkdir t | |
7 | $ echo 0 > t/x |
|
7 | $ echo 0 > t/x | |
8 | $ echo 0 > t/b |
|
8 | $ echo 0 > t/b | |
9 | $ echo 0 > t/e.h |
|
9 | $ echo 0 > t/e.h | |
10 | $ mkdir dir.h |
|
10 | $ mkdir dir.h | |
11 | $ echo 0 > dir.h/foo |
|
11 | $ echo 0 > dir.h/foo | |
12 |
|
12 | |||
13 | $ hg ci -A -m m |
|
13 | $ hg ci -A -m m | |
14 | adding a |
|
14 | adding a | |
15 | adding b |
|
15 | adding b | |
16 | adding dir.h/foo |
|
16 | adding dir.h/foo | |
17 | adding t.h |
|
17 | adding t.h | |
18 | adding t/b |
|
18 | adding t/b | |
19 | adding t/e.h |
|
19 | adding t/e.h | |
20 | adding t/x |
|
20 | adding t/x | |
21 |
|
21 | |||
22 | $ touch nottracked |
|
22 | $ touch nottracked | |
23 |
|
23 | |||
24 | $ hg locate a |
|
24 | $ hg locate a | |
25 | a |
|
25 | a | |
26 |
|
26 | |||
27 | $ hg locate NONEXISTENT |
|
27 | $ hg locate NONEXISTENT | |
28 | [1] |
|
28 | [1] | |
29 |
|
29 | |||
30 | $ hg locate |
|
30 | $ hg locate | |
31 | a |
|
31 | a | |
32 | b |
|
32 | b | |
33 | dir.h/foo |
|
33 | dir.h/foo | |
34 | t.h |
|
34 | t.h | |
35 | t/b |
|
35 | t/b | |
36 | t/e.h |
|
36 | t/e.h | |
37 | t/x |
|
37 | t/x | |
38 |
|
38 | |||
39 | $ hg rm a |
|
39 | $ hg rm a | |
40 | $ hg ci -m m |
|
40 | $ hg ci -m m | |
41 |
|
41 | |||
42 | $ hg locate a |
|
42 | $ hg locate a | |
43 | [1] |
|
43 | [1] | |
44 | $ hg locate NONEXISTENT |
|
44 | $ hg locate NONEXISTENT | |
45 | [1] |
|
45 | [1] | |
46 | $ hg locate relpath:NONEXISTENT |
|
46 | $ hg locate relpath:NONEXISTENT | |
47 | [1] |
|
47 | [1] | |
48 | $ hg locate |
|
48 | $ hg locate | |
49 | b |
|
49 | b | |
50 | dir.h/foo |
|
50 | dir.h/foo | |
51 | t.h |
|
51 | t.h | |
52 | t/b |
|
52 | t/b | |
53 | t/e.h |
|
53 | t/e.h | |
54 | t/x |
|
54 | t/x | |
55 | $ hg locate -r 0 a |
|
55 | $ hg locate -r 0 a | |
56 | a |
|
56 | a | |
57 | $ hg locate -r 0 NONEXISTENT |
|
57 | $ hg locate -r 0 NONEXISTENT | |
58 | [1] |
|
58 | [1] | |
59 | $ hg locate -r 0 relpath:NONEXISTENT |
|
59 | $ hg locate -r 0 relpath:NONEXISTENT | |
60 | [1] |
|
60 | [1] | |
61 | $ hg locate -r 0 |
|
61 | $ hg locate -r 0 | |
62 | a |
|
62 | a | |
63 | b |
|
63 | b | |
64 | dir.h/foo |
|
64 | dir.h/foo | |
65 | t.h |
|
65 | t.h | |
66 | t/b |
|
66 | t/b | |
67 | t/e.h |
|
67 | t/e.h | |
68 | t/x |
|
68 | t/x | |
69 |
|
69 | |||
70 | -I/-X with relative path should work: |
|
70 | -I/-X with relative path should work: | |
71 |
|
71 | |||
72 | $ cd t |
|
72 | $ cd t | |
73 | $ hg locate |
|
73 | $ hg locate | |
74 | b |
|
74 | b | |
75 | dir.h/foo |
|
75 | dir.h/foo | |
76 | t.h |
|
76 | t.h | |
77 | t/b |
|
77 | t/b | |
78 | t/e.h |
|
78 | t/e.h | |
79 | t/x |
|
79 | t/x | |
80 | $ hg locate -I ../t |
|
80 | $ hg locate -I ../t | |
81 | t/b |
|
81 | t/b | |
82 | t/e.h |
|
82 | t/e.h | |
83 | t/x |
|
83 | t/x | |
84 |
|
84 | |||
85 | Issue294: hg remove --after dir fails when dir.* also exists |
|
85 | Issue294: hg remove --after dir fails when dir.* also exists | |
86 |
|
86 | |||
87 | $ cd .. |
|
87 | $ cd .. | |
88 | $ rm -r t |
|
88 | $ rm -r t | |
89 |
|
89 | |||
90 | $ hg locate 't/**' |
|
90 | $ hg locate 't/**' | |
91 | t/b (glob) |
|
91 | t/b (glob) | |
92 | t/e.h (glob) |
|
92 | t/e.h (glob) | |
93 | t/x (glob) |
|
93 | t/x (glob) | |
94 |
|
94 | |||
|
95 | $ hg files | |||
|
96 | b | |||
|
97 | dir.h/foo | |||
|
98 | t.h | |||
|
99 | t/b | |||
|
100 | t/e.h | |||
|
101 | t/x | |||
|
102 | $ hg files b | |||
|
103 | b | |||
|
104 | ||||
95 | $ mkdir otherdir |
|
105 | $ mkdir otherdir | |
96 | $ cd otherdir |
|
106 | $ cd otherdir | |
97 |
|
107 | |||
98 | $ hg locate b |
|
108 | $ hg locate b | |
99 | ../b (glob) |
|
109 | ../b (glob) | |
100 | ../t/b (glob) |
|
110 | ../t/b (glob) | |
101 | $ hg locate '*.h' |
|
111 | $ hg locate '*.h' | |
102 | ../t.h (glob) |
|
112 | ../t.h (glob) | |
103 | ../t/e.h (glob) |
|
113 | ../t/e.h (glob) | |
104 | $ hg locate path:t/x |
|
114 | $ hg locate path:t/x | |
105 | ../t/x (glob) |
|
115 | ../t/x (glob) | |
106 | $ hg locate 're:.*\.h$' |
|
116 | $ hg locate 're:.*\.h$' | |
107 | ../t.h (glob) |
|
117 | ../t.h (glob) | |
108 | ../t/e.h (glob) |
|
118 | ../t/e.h (glob) | |
109 | $ hg locate -r 0 b |
|
119 | $ hg locate -r 0 b | |
110 | ../b (glob) |
|
120 | ../b (glob) | |
111 | ../t/b (glob) |
|
121 | ../t/b (glob) | |
112 | $ hg locate -r 0 '*.h' |
|
122 | $ hg locate -r 0 '*.h' | |
113 | ../t.h (glob) |
|
123 | ../t.h (glob) | |
114 | ../t/e.h (glob) |
|
124 | ../t/e.h (glob) | |
115 | $ hg locate -r 0 path:t/x |
|
125 | $ hg locate -r 0 path:t/x | |
116 | ../t/x (glob) |
|
126 | ../t/x (glob) | |
117 | $ hg locate -r 0 're:.*\.h$' |
|
127 | $ hg locate -r 0 're:.*\.h$' | |
118 | ../t.h (glob) |
|
128 | ../t.h (glob) | |
119 | ../t/e.h (glob) |
|
129 | ../t/e.h (glob) | |
120 |
|
130 | |||
121 | $ cd ../.. |
|
131 | $ cd ../.. |
@@ -1,69 +1,77 b'' | |||||
1 | Source bundle was generated with the following script: |
|
1 | Source bundle was generated with the following script: | |
2 |
|
2 | |||
3 | # hg init |
|
3 | # hg init | |
4 | # echo a > a |
|
4 | # echo a > a | |
5 | # ln -s a l |
|
5 | # ln -s a l | |
6 | # hg ci -Ama -d'0 0' |
|
6 | # hg ci -Ama -d'0 0' | |
7 | # mkdir b |
|
7 | # mkdir b | |
8 | # echo a > b/a |
|
8 | # echo a > b/a | |
9 | # chmod +x b/a |
|
9 | # chmod +x b/a | |
10 | # hg ci -Amb -d'1 0' |
|
10 | # hg ci -Amb -d'1 0' | |
11 |
|
11 | |||
12 | $ hg init |
|
12 | $ hg init | |
13 | $ hg -q pull "$TESTDIR/bundles/test-manifest.hg" |
|
13 | $ hg -q pull "$TESTDIR/bundles/test-manifest.hg" | |
14 |
|
14 | |||
15 | The next call is expected to return nothing: |
|
15 | The next call is expected to return nothing: | |
16 |
|
16 | |||
17 | $ hg manifest |
|
17 | $ hg manifest | |
18 |
|
18 | |||
19 | $ hg co |
|
19 | $ hg co | |
20 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
20 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
21 |
|
21 | |||
22 | $ hg manifest |
|
22 | $ hg manifest | |
23 | a |
|
23 | a | |
24 | b/a |
|
24 | b/a | |
25 | l |
|
25 | l | |
26 |
|
26 | |||
|
27 | $ hg files -vr . | |||
|
28 | 2 a | |||
|
29 | 2 x b/a | |||
|
30 | 1 l l | |||
|
31 | $ hg files -r . -X b | |||
|
32 | a | |||
|
33 | l | |||
|
34 | ||||
27 | $ hg manifest -v |
|
35 | $ hg manifest -v | |
28 | 644 a |
|
36 | 644 a | |
29 | 755 * b/a |
|
37 | 755 * b/a | |
30 | 644 @ l |
|
38 | 644 @ l | |
31 |
|
39 | |||
32 | $ hg manifest --debug |
|
40 | $ hg manifest --debug | |
33 | b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a |
|
41 | b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a | |
34 | b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 755 * b/a |
|
42 | b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 755 * b/a | |
35 | 047b75c6d7a3ef6a2243bd0e99f94f6ea6683597 644 @ l |
|
43 | 047b75c6d7a3ef6a2243bd0e99f94f6ea6683597 644 @ l | |
36 |
|
44 | |||
37 | $ hg manifest -r 0 |
|
45 | $ hg manifest -r 0 | |
38 | a |
|
46 | a | |
39 | l |
|
47 | l | |
40 |
|
48 | |||
41 | $ hg manifest -r 1 |
|
49 | $ hg manifest -r 1 | |
42 | a |
|
50 | a | |
43 | b/a |
|
51 | b/a | |
44 | l |
|
52 | l | |
45 |
|
53 | |||
46 | $ hg manifest -r tip |
|
54 | $ hg manifest -r tip | |
47 | a |
|
55 | a | |
48 | b/a |
|
56 | b/a | |
49 | l |
|
57 | l | |
50 |
|
58 | |||
51 | $ hg manifest tip |
|
59 | $ hg manifest tip | |
52 | a |
|
60 | a | |
53 | b/a |
|
61 | b/a | |
54 | l |
|
62 | l | |
55 |
|
63 | |||
56 | $ hg manifest --all |
|
64 | $ hg manifest --all | |
57 | a |
|
65 | a | |
58 | b/a |
|
66 | b/a | |
59 | l |
|
67 | l | |
60 |
|
68 | |||
61 | The next two calls are expected to abort: |
|
69 | The next two calls are expected to abort: | |
62 |
|
70 | |||
63 | $ hg manifest -r 2 |
|
71 | $ hg manifest -r 2 | |
64 | abort: unknown revision '2'! |
|
72 | abort: unknown revision '2'! | |
65 | [255] |
|
73 | [255] | |
66 |
|
74 | |||
67 | $ hg manifest -r tip tip |
|
75 | $ hg manifest -r tip tip | |
68 | abort: please specify just one revision |
|
76 | abort: please specify just one revision | |
69 | [255] |
|
77 | [255] |
General Comments 0
You need to be logged in to leave comments.
Login now