##// END OF EJS Templates
censor: add censor command to hgext with basic client-side tests...
Mike Edgar -
r24347:1bcfecbb default
parent child Browse files
Show More
@@ -0,0 +1,168 b''
1 # Copyright (C) 2015 - Mike Edgar <adgar@google.com>
2 #
3 # This extension enables removal of file content at a given revision,
4 # rewriting the data/metadata of successive revisions to preserve revision log
5 # integrity.
6
7 """erase file content at a given revision
8
9 The censor command instructs Mercurial to erase all content of a file at a given
10 revision *without updating the changeset hash.* This allows existing history to
11 remain valid while preventing future clones/pulls from receiving the erased
12 data.
13
14 Typical uses for censor are due to security or legal requirements, including::
15
16 * Passwords, private keys, crytographic material
17 * Licensed data/code/libraries for which the license has expired
18 * Personally Identifiable Information or other private data
19
20 Censored file revisions are listed in a tracked file called .hgcensored stored
21 in the repository root. The censor command adds an entry to the .hgcensored file
22 in the working directory and commits it (much like ``hg tag`` and .hgtags). The
23 censored file data is then replaced with a pointer to the new commit, enabling
24 verification.
25
26 Censored nodes can interrupt mercurial's typical operation whenever the excised
27 data needs to be materialized. Some commands, like ``hg cat``/``hg revert``,
28 simply fail when asked to produce censored data. Others, like ``hg verify`` and
29 ``hg update``, must be capable of tolerating censored data to continue to
30 function in a meaningful way. Such commands only tolerate censored file
31 revisions if they are allowed by the policy specified by the "censor.allow"
32 config option.
33 """
34
35 from mercurial.node import short
36 from mercurial import cmdutil, error, filelog, revlog, scmutil, util
37 from mercurial.i18n import _
38
39 cmdtable = {}
40 command = cmdutil.command(cmdtable)
41 testedwith = 'internal'
42
43 @command('censor',
44 [('r', 'rev', '', _('censor file from specified revision'), _('REV')),
45 ('t', 'tombstone', '', _('replacement tombstone data'), _('TEXT'))],
46 _('-r REV [-t TEXT] [FILE]'))
47 def censor(ui, repo, path, rev='', tombstone='', **opts):
48 if not path:
49 raise util.Abort(_('must specify file path to censor'))
50 if not rev:
51 raise util.Abort(_('must specify revision to censor'))
52
53 flog = repo.file(path)
54 if not len(flog):
55 raise util.Abort(_('cannot censor file with no history'))
56
57 rev = scmutil.revsingle(repo, rev, rev).rev()
58 try:
59 ctx = repo[rev]
60 except KeyError:
61 raise util.Abort(_('invalid revision identifier %s') % rev)
62
63 try:
64 fctx = ctx.filectx(path)
65 except error.LookupError:
66 raise util.Abort(_('file does not exist at revision %s') % rev)
67
68 fnode = fctx.filenode()
69 headctxs = [repo[c] for c in repo.heads()]
70 heads = [c for c in headctxs if path in c and c.filenode(path) == fnode]
71 if heads:
72 headlist = ', '.join([short(c.node()) for c in heads])
73 raise util.Abort(_('cannot censor file in heads (%s)') % headlist,
74 hint=_('clean/delete and commit first'))
75
76 wctx = repo[None]
77 wp = wctx.parents()
78 if ctx.node() in [p.node() for p in wp]:
79 raise util.Abort(_('cannot censor working directory'),
80 hint=_('clean/delete/update first'))
81
82 flogv = flog.version & 0xFFFF
83 if flogv != revlog.REVLOGNG:
84 raise util.Abort(
85 _('censor does not support revlog version %d') % (flogv,))
86
87 tombstone = filelog.packmeta({"censored": tombstone}, "")
88
89 crev = fctx.filerev()
90
91 if len(tombstone) > flog.rawsize(crev):
92 raise util.Abort(_(
93 'censor tombstone must be no longer than censored data'))
94
95 # Using two files instead of one makes it easy to rewrite entry-by-entry
96 idxread = repo.svfs(flog.indexfile, 'r')
97 idxwrite = repo.svfs(flog.indexfile, 'wb', atomictemp=True)
98 if flog.version & revlog.REVLOGNGINLINEDATA:
99 dataread, datawrite = idxread, idxwrite
100 else:
101 dataread = repo.svfs(flog.datafile, 'r')
102 datawrite = repo.svfs(flog.datafile, 'wb', atomictemp=True)
103
104 # Copy all revlog data up to the entry to be censored.
105 rio = revlog.revlogio()
106 offset = flog.start(crev)
107
108 for chunk in util.filechunkiter(idxread, limit=crev * rio.size):
109 idxwrite.write(chunk)
110 for chunk in util.filechunkiter(dataread, limit=offset):
111 datawrite.write(chunk)
112
113 def rewriteindex(r, newoffs, newdata=None):
114 """Rewrite the index entry with a new data offset and optional new data.
115
116 The newdata argument, if given, is a tuple of three positive integers:
117 (new compressed, new uncompressed, added flag bits).
118 """
119 offlags, comp, uncomp, base, link, p1, p2, nodeid = flog.index[r]
120 flags = revlog.gettype(offlags)
121 if newdata:
122 comp, uncomp, nflags = newdata
123 flags |= nflags
124 offlags = revlog.offset_type(newoffs, flags)
125 e = (offlags, comp, uncomp, r, link, p1, p2, nodeid)
126 idxwrite.write(rio.packentry(e, None, flog.version, r))
127 idxread.seek(rio.size, 1)
128
129 def rewrite(r, offs, data, nflags=revlog.REVIDX_DEFAULT_FLAGS):
130 """Write the given full text to the filelog with the given data offset.
131
132 Returns:
133 The integer number of data bytes written, for tracking data offsets.
134 """
135 flag, compdata = flog.compress(data)
136 newcomp = len(flag) + len(compdata)
137 rewriteindex(r, offs, (newcomp, len(data), nflags))
138 datawrite.write(flag)
139 datawrite.write(compdata)
140 dataread.seek(flog.length(r), 1)
141 return newcomp
142
143 # Rewrite censored revlog entry with (padded) tombstone data.
144 pad = ' ' * (flog.rawsize(crev) - len(tombstone))
145 offset += rewrite(crev, offset, tombstone + pad, revlog.REVIDX_ISCENSORED)
146
147 # Rewrite all following filelog revisions fixing up offsets and deltas.
148 for srev in xrange(crev + 1, len(flog)):
149 if crev in flog.parentrevs(srev):
150 # Immediate children of censored node must be re-added as fulltext.
151 try:
152 revdata = flog.revision(srev)
153 except error.CensoredNodeError, e:
154 revdata = e.tombstone
155 dlen = rewrite(srev, offset, revdata)
156 else:
157 # Copy any other revision data verbatim after fixing up the offset.
158 rewriteindex(srev, offset)
159 dlen = flog.length(srev)
160 for chunk in util.filechunkiter(dataread, limit=dlen):
161 datawrite.write(chunk)
162 offset += dlen
163
164 idxread.close()
165 idxwrite.close()
166 if dataread is not idxread:
167 dataread.close()
168 datawrite.close()
@@ -0,0 +1,315 b''
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > censor=
4 > EOF
5 $ cp $HGRCPATH $HGRCPATH.orig
6
7 Create repo with unimpeachable content
8
9 $ hg init r
10 $ cd r
11 $ echo 'Initially untainted file' > target
12 $ echo 'Normal file here' > bystander
13 $ hg add target bystander
14 $ hg ci -m init
15
16 Clone repo so we can test pull later
17
18 $ cd ..
19 $ hg clone r rpull
20 updating to branch default
21 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
22 $ cd r
23
24 Introduce content which will ultimately require censorship. Name the first
25 censored node C1, second C2, and so on
26
27 $ echo 'Tainted file' > target
28 $ echo 'Passwords: hunter2' >> target
29 $ hg ci -m taint target
30 $ C1=`hg id --debug -i`
31
32 $ echo 'hunter3' >> target
33 $ echo 'Normal file v2' > bystander
34 $ hg ci -m moretaint target bystander
35 $ C2=`hg id --debug -i`
36
37 Add a new sanitized versions to correct our mistake. Name the first head H1,
38 the second head H2, and so on
39
40 $ echo 'Tainted file is now sanitized' > target
41 $ hg ci -m sanitized target
42 $ H1=`hg id --debug -i`
43
44 $ hg update -r $C2
45 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
46 $ echo 'Tainted file now super sanitized' > target
47 $ hg ci -m 'super sanitized' target
48 created new head
49 $ H2=`hg id --debug -i`
50
51 Verify target contents before censorship at each revision
52
53 $ hg cat -r 3 target
54 Tainted file is now sanitized
55 $ hg cat -r $H2 target
56 Tainted file now super sanitized
57 $ hg cat -r $C2 target
58 Tainted file
59 Passwords: hunter2
60 hunter3
61 $ hg cat -r $C1 target
62 Tainted file
63 Passwords: hunter2
64 $ hg cat -r 0 target
65 Initially untainted file
66
67 Try to censor revision with too large of a tombstone message
68
69 $ hg censor -r $C1 -t 'blah blah blah blah blah blah blah blah bla' target
70 abort: censor tombstone must be no longer than censored data
71 [255]
72
73 Censor revision with 2 offenses
74
75 $ hg censor -r $C2 -t "remove password" target
76 $ hg cat -r 3 target
77 Tainted file is now sanitized
78 $ hg cat -r $H2 target
79 Tainted file now super sanitized
80 $ hg cat -r $C2 target
81 abort: censored node: 1e0247a9a4b7
82 (set censor.policy to ignore errors)
83 [255]
84 $ hg cat -r $C1 target
85 Tainted file
86 Passwords: hunter2
87 $ hg cat -r 0 target
88 Initially untainted file
89
90 Censor revision with 1 offense
91
92 $ hg censor -r $C1 target
93 $ hg cat -r 3 target
94 Tainted file is now sanitized
95 $ hg cat -r $H2 target
96 Tainted file now super sanitized
97 $ hg cat -r $C2 target
98 abort: censored node: 1e0247a9a4b7
99 (set censor.policy to ignore errors)
100 [255]
101 $ hg cat -r $C1 target
102 abort: censored node: 613bc869fceb
103 (set censor.policy to ignore errors)
104 [255]
105 $ hg cat -r 0 target
106 Initially untainted file
107
108 Can only checkout target at uncensored revisions, -X is workaround for --all
109
110 $ hg revert -r $C2 target
111 abort: censored node: 1e0247a9a4b7
112 (set censor.policy to ignore errors)
113 [255]
114 $ hg revert -r $C1 target
115 abort: censored node: 613bc869fceb
116 (set censor.policy to ignore errors)
117 [255]
118 $ hg revert -r $C1 --all
119 reverting bystander
120 reverting target
121 abort: censored node: 613bc869fceb
122 (set censor.policy to ignore errors)
123 [255]
124 $ hg revert -r $C1 --all -X target
125 $ cat target
126 Tainted file now super sanitized
127 $ hg revert -r 0 --all
128 reverting target
129 $ cat target
130 Initially untainted file
131 $ hg revert -r $H2 --all
132 reverting bystander
133 reverting target
134 $ cat target
135 Tainted file now super sanitized
136
137 Uncensored file can be viewed at any revision
138
139 $ hg cat -r 3 bystander
140 Normal file v2
141 $ hg cat -r $C2 bystander
142 Normal file v2
143 $ hg cat -r $C1 bystander
144 Normal file here
145 $ hg cat -r 0 bystander
146 Normal file here
147
148 Can update to children of censored revision
149
150 $ hg update -r 3
151 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 $ cat target
153 Tainted file is now sanitized
154 $ hg update -r $H2
155 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
156 $ cat target
157 Tainted file now super sanitized
158
159 Set censor policy to abort in trusted $HGRC so hg verify fails
160
161 $ cp $HGRCPATH.orig $HGRCPATH
162 $ cat >> $HGRCPATH <<EOF
163 > [censor]
164 > policy = abort
165 > EOF
166
167 Repo fails verification due to censorship
168
169 $ hg verify
170 checking changesets
171 checking manifests
172 crosschecking files in changesets and manifests
173 checking files
174 target@1: censored file data
175 target@2: censored file data
176 2 files, 5 changesets, 7 total revisions
177 2 integrity errors encountered!
178 (first damaged changeset appears to be 1)
179 [1]
180
181 Cannot update to revision with censored data
182
183 $ hg update -r $C2
184 abort: censored node: 1e0247a9a4b7
185 (set censor.policy to ignore errors)
186 [255]
187 $ hg update -r $C1
188 abort: censored node: 613bc869fceb
189 (set censor.policy to ignore errors)
190 [255]
191 $ hg update -r 0
192 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
193 $ hg update -r $H2
194 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
195
196 Set censor policy to ignore in trusted $HGRC so hg verify passes
197
198 $ cp $HGRCPATH.orig $HGRCPATH
199 $ cat >> $HGRCPATH <<EOF
200 > [censor]
201 > policy = ignore
202 > EOF
203
204 Repo passes verification with warnings with explicit config
205
206 $ hg verify
207 checking changesets
208 checking manifests
209 crosschecking files in changesets and manifests
210 checking files
211 2 files, 5 changesets, 7 total revisions
212
213 May update to revision with censored data with explicit config
214
215 $ hg update -r $C2
216 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
217 $ cat target
218 $ hg update -r $C1
219 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
220 $ cat target
221 $ hg update -r 0
222 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
223 $ cat target
224 Initially untainted file
225 $ hg update -r $H2
226 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
227 $ cat target
228 Tainted file now super sanitized
229
230 Can merge in revision with censored data. Test requires one branch of history
231 with the file censored, but we can't censor at a head, so advance H1.
232
233 $ hg update -r $H1
234 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
235 $ C3=$H1
236 $ echo 'advanced head H1' > target
237 $ hg ci -m 'advance head H1' target
238 $ H1=`hg id --debug -i`
239 $ hg censor -r $C3 target
240 $ hg update -r $H2
241 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
242 $ hg merge -r $C3
243 merging target
244 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
245 (branch merge, don't forget to commit)
246
247 Revisions present in repository heads may not be censored
248
249 $ hg update -C -r $H2
250 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
251 $ hg censor -r $H2 target
252 abort: cannot censor file in heads (78a8fc215e79)
253 (clean/delete and commit first)
254 [255]
255 $ echo 'twiddling thumbs' > bystander
256 $ hg ci -m 'bystander commit'
257 $ H2=`hg id --debug -i`
258 $ hg censor -r "$H2^" target
259 abort: cannot censor file in heads (efbe78065929)
260 (clean/delete and commit first)
261 [255]
262
263 Cannot censor working directory
264
265 $ echo 'seriously no passwords' > target
266 $ hg ci -m 'extend second head arbitrarily' target
267 $ H2=`hg id --debug -i`
268 $ hg update -r "$H2^"
269 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
270 $ hg censor -r . target
271 abort: cannot censor working directory
272 (clean/delete/update first)
273 [255]
274 $ hg update -r $H2
275 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
276
277 Can re-add file after being deleted + censored
278
279 $ C4=$H2
280 $ hg rm target
281 $ hg ci -m 'delete target so it may be censored'
282 $ H2=`hg id --debug -i`
283 $ hg censor -r $C4 target
284 $ hg cat -r $C4 target
285 $ hg cat -r "$H2^^" target
286 Tainted file now super sanitized
287 $ echo 'fresh start' > target
288 $ hg add target
289 $ hg ci -m reincarnated target
290 $ H2=`hg id --debug -i`
291 $ hg cat -r $H2 target
292 fresh start
293 $ hg cat -r "$H2^" target
294 target: no such file in rev 452ec1762369
295 [1]
296 $ hg cat -r $C4 target
297 $ hg cat -r "$H2^^^" target
298 Tainted file now super sanitized
299
300 Can censor after revlog has expanded to no longer permit inline storage
301
302 $ for x in `seq 0 50000`
303 > do
304 > echo "Password: hunter$x" >> target
305 > done
306 $ hg ci -m 'add 100k passwords'
307 $ H2=`hg id --debug -i`
308 $ C5=$H2
309 $ hg revert -r "$H2^" target
310 $ hg ci -m 'cleaned 100k passwords'
311 $ H2=`hg id --debug -i`
312 $ hg censor -r $C5 target
313 $ hg cat -r $C5 target
314 $ hg cat -r $H2 target
315 fresh start
@@ -1,2240 +1,2241 b''
1 1 Short help:
2 2
3 3 $ hg
4 4 Mercurial Distributed SCM
5 5
6 6 basic commands:
7 7
8 8 add add the specified files on the next commit
9 9 annotate show changeset information by line for each file
10 10 clone make a copy of an existing repository
11 11 commit commit the specified files or all outstanding changes
12 12 diff diff repository (or selected files)
13 13 export dump the header and diffs for one or more changesets
14 14 forget forget the specified files on the next commit
15 15 init create a new repository in the given directory
16 16 log show revision history of entire repository or files
17 17 merge merge another revision into working directory
18 18 pull pull changes from the specified source
19 19 push push changes to the specified destination
20 20 remove remove the specified files on the next commit
21 21 serve start stand-alone webserver
22 22 status show changed files in the working directory
23 23 summary summarize working directory state
24 24 update update working directory (or switch revisions)
25 25
26 26 (use "hg help" for the full list of commands or "hg -v" for details)
27 27
28 28 $ hg -q
29 29 add add the specified files on the next commit
30 30 annotate show changeset information by line for each file
31 31 clone make a copy of an existing repository
32 32 commit commit the specified files or all outstanding changes
33 33 diff diff repository (or selected files)
34 34 export dump the header and diffs for one or more changesets
35 35 forget forget the specified files on the next commit
36 36 init create a new repository in the given directory
37 37 log show revision history of entire repository or files
38 38 merge merge another revision into working directory
39 39 pull pull changes from the specified source
40 40 push push changes to the specified destination
41 41 remove remove the specified files on the next commit
42 42 serve start stand-alone webserver
43 43 status show changed files in the working directory
44 44 summary summarize working directory state
45 45 update update working directory (or switch revisions)
46 46
47 47 $ hg help
48 48 Mercurial Distributed SCM
49 49
50 50 list of commands:
51 51
52 52 add add the specified files on the next commit
53 53 addremove add all new files, delete all missing files
54 54 annotate show changeset information by line for each file
55 55 archive create an unversioned archive of a repository revision
56 56 backout reverse effect of earlier changeset
57 57 bisect subdivision search of changesets
58 58 bookmarks create a new bookmark or list existing bookmarks
59 59 branch set or show the current branch name
60 60 branches list repository named branches
61 61 bundle create a changegroup file
62 62 cat output the current or given revision of files
63 63 clone make a copy of an existing repository
64 64 commit commit the specified files or all outstanding changes
65 65 config show combined config settings from all hgrc files
66 66 copy mark files as copied for the next commit
67 67 diff diff repository (or selected files)
68 68 export dump the header and diffs for one or more changesets
69 69 files list tracked files
70 70 forget forget the specified files on the next commit
71 71 graft copy changes from other branches onto the current branch
72 72 grep search for a pattern in specified files and revisions
73 73 heads show branch heads
74 74 help show help for a given topic or a help overview
75 75 identify identify the working copy or specified revision
76 76 import import an ordered set of patches
77 77 incoming show new changesets found in source
78 78 init create a new repository in the given directory
79 79 log show revision history of entire repository or files
80 80 manifest output the current or given revision of the project manifest
81 81 merge merge another revision into working directory
82 82 outgoing show changesets not found in the destination
83 83 paths show aliases for remote repositories
84 84 phase set or show the current phase name
85 85 pull pull changes from the specified source
86 86 push push changes to the specified destination
87 87 recover roll back an interrupted transaction
88 88 remove remove the specified files on the next commit
89 89 rename rename files; equivalent of copy + remove
90 90 resolve redo merges or set/view the merge status of files
91 91 revert restore files to their checkout state
92 92 root print the root (top) of the current working directory
93 93 serve start stand-alone webserver
94 94 status show changed files in the working directory
95 95 summary summarize working directory state
96 96 tag add one or more tags for the current or given revision
97 97 tags list repository tags
98 98 unbundle apply one or more changegroup files
99 99 update update working directory (or switch revisions)
100 100 verify verify the integrity of the repository
101 101 version output version and copyright information
102 102
103 103 additional help topics:
104 104
105 105 config Configuration Files
106 106 dates Date Formats
107 107 diffs Diff Formats
108 108 environment Environment Variables
109 109 extensions Using Additional Features
110 110 filesets Specifying File Sets
111 111 glossary Glossary
112 112 hgignore Syntax for Mercurial Ignore Files
113 113 hgweb Configuring hgweb
114 114 merge-tools Merge Tools
115 115 multirevs Specifying Multiple Revisions
116 116 patterns File Name Patterns
117 117 phases Working with Phases
118 118 revisions Specifying Single Revisions
119 119 revsets Specifying Revision Sets
120 120 subrepos Subrepositories
121 121 templating Template Usage
122 122 urls URL Paths
123 123
124 124 (use "hg help -v" to show built-in aliases and global options)
125 125
126 126 $ hg -q help
127 127 add add the specified files on the next commit
128 128 addremove add all new files, delete all missing files
129 129 annotate show changeset information by line for each file
130 130 archive create an unversioned archive of a repository revision
131 131 backout reverse effect of earlier changeset
132 132 bisect subdivision search of changesets
133 133 bookmarks create a new bookmark or list existing bookmarks
134 134 branch set or show the current branch name
135 135 branches list repository named branches
136 136 bundle create a changegroup file
137 137 cat output the current or given revision of files
138 138 clone make a copy of an existing repository
139 139 commit commit the specified files or all outstanding changes
140 140 config show combined config settings from all hgrc files
141 141 copy mark files as copied for the next commit
142 142 diff diff repository (or selected files)
143 143 export dump the header and diffs for one or more changesets
144 144 files list tracked files
145 145 forget forget the specified files on the next commit
146 146 graft copy changes from other branches onto the current branch
147 147 grep search for a pattern in specified files and revisions
148 148 heads show branch heads
149 149 help show help for a given topic or a help overview
150 150 identify identify the working copy or specified revision
151 151 import import an ordered set of patches
152 152 incoming show new changesets found in source
153 153 init create a new repository in the given directory
154 154 log show revision history of entire repository or files
155 155 manifest output the current or given revision of the project manifest
156 156 merge merge another revision into working directory
157 157 outgoing show changesets not found in the destination
158 158 paths show aliases for remote repositories
159 159 phase set or show the current phase name
160 160 pull pull changes from the specified source
161 161 push push changes to the specified destination
162 162 recover roll back an interrupted transaction
163 163 remove remove the specified files on the next commit
164 164 rename rename files; equivalent of copy + remove
165 165 resolve redo merges or set/view the merge status of files
166 166 revert restore files to their checkout state
167 167 root print the root (top) of the current working directory
168 168 serve start stand-alone webserver
169 169 status show changed files in the working directory
170 170 summary summarize working directory state
171 171 tag add one or more tags for the current or given revision
172 172 tags list repository tags
173 173 unbundle apply one or more changegroup files
174 174 update update working directory (or switch revisions)
175 175 verify verify the integrity of the repository
176 176 version output version and copyright information
177 177
178 178 additional help topics:
179 179
180 180 config Configuration Files
181 181 dates Date Formats
182 182 diffs Diff Formats
183 183 environment Environment Variables
184 184 extensions Using Additional Features
185 185 filesets Specifying File Sets
186 186 glossary Glossary
187 187 hgignore Syntax for Mercurial Ignore Files
188 188 hgweb Configuring hgweb
189 189 merge-tools Merge Tools
190 190 multirevs Specifying Multiple Revisions
191 191 patterns File Name Patterns
192 192 phases Working with Phases
193 193 revisions Specifying Single Revisions
194 194 revsets Specifying Revision Sets
195 195 subrepos Subrepositories
196 196 templating Template Usage
197 197 urls URL Paths
198 198
199 199 Test extension help:
200 200 $ hg help extensions --config extensions.rebase= --config extensions.children=
201 201 Using Additional Features
202 202 """""""""""""""""""""""""
203 203
204 204 Mercurial has the ability to add new features through the use of
205 205 extensions. Extensions may add new commands, add options to existing
206 206 commands, change the default behavior of commands, or implement hooks.
207 207
208 208 To enable the "foo" extension, either shipped with Mercurial or in the
209 209 Python search path, create an entry for it in your configuration file,
210 210 like this:
211 211
212 212 [extensions]
213 213 foo =
214 214
215 215 You may also specify the full path to an extension:
216 216
217 217 [extensions]
218 218 myfeature = ~/.hgext/myfeature.py
219 219
220 220 See "hg help config" for more information on configuration files.
221 221
222 222 Extensions are not loaded by default for a variety of reasons: they can
223 223 increase startup overhead; they may be meant for advanced usage only; they
224 224 may provide potentially dangerous abilities (such as letting you destroy
225 225 or modify history); they might not be ready for prime time; or they may
226 226 alter some usual behaviors of stock Mercurial. It is thus up to the user
227 227 to activate extensions as needed.
228 228
229 229 To explicitly disable an extension enabled in a configuration file of
230 230 broader scope, prepend its path with !:
231 231
232 232 [extensions]
233 233 # disabling extension bar residing in /path/to/extension/bar.py
234 234 bar = !/path/to/extension/bar.py
235 235 # ditto, but no path was supplied for extension baz
236 236 baz = !
237 237
238 238 enabled extensions:
239 239
240 240 children command to display child changesets (DEPRECATED)
241 241 rebase command to move sets of revisions to a different ancestor
242 242
243 243 disabled extensions:
244 244
245 245 acl hooks for controlling repository access
246 246 blackbox log repository events to a blackbox for debugging
247 247 bugzilla hooks for integrating with the Bugzilla bug tracker
248 censor erase file content at a given revision
248 249 churn command to display statistics about repository history
249 250 color colorize output from some commands
250 251 convert import revisions from foreign VCS repositories into
251 252 Mercurial
252 253 eol automatically manage newlines in repository files
253 254 extdiff command to allow external programs to compare revisions
254 255 factotum http authentication with factotum
255 256 gpg commands to sign and verify changesets
256 257 hgcia hooks for integrating with the CIA.vc notification service
257 258 hgk browse the repository in a graphical way
258 259 highlight syntax highlighting for hgweb (requires Pygments)
259 260 histedit interactive history editing
260 261 keyword expand keywords in tracked files
261 262 largefiles track large binary files
262 263 mq manage a stack of patches
263 264 notify hooks for sending email push notifications
264 265 pager browse command output with an external pager
265 266 patchbomb command to send changesets as (a series of) patch emails
266 267 progress show progress bars for some actions
267 268 purge command to delete untracked files from the working
268 269 directory
269 270 record commands to interactively select changes for
270 271 commit/qrefresh
271 272 relink recreates hardlinks between repository clones
272 273 schemes extend schemes with shortcuts to repository swarms
273 274 share share a common history between several working directories
274 275 shelve save and restore changes to the working directory
275 276 strip strip changesets and their descendants from history
276 277 transplant command to transplant changesets from another branch
277 278 win32mbcs allow the use of MBCS paths with problematic encodings
278 279 zeroconf discover and advertise repositories on the local network
279 280 Test short command list with verbose option
280 281
281 282 $ hg -v help shortlist
282 283 Mercurial Distributed SCM
283 284
284 285 basic commands:
285 286
286 287 add add the specified files on the next commit
287 288 annotate, blame
288 289 show changeset information by line for each file
289 290 clone make a copy of an existing repository
290 291 commit, ci commit the specified files or all outstanding changes
291 292 diff diff repository (or selected files)
292 293 export dump the header and diffs for one or more changesets
293 294 forget forget the specified files on the next commit
294 295 init create a new repository in the given directory
295 296 log, history show revision history of entire repository or files
296 297 merge merge another revision into working directory
297 298 pull pull changes from the specified source
298 299 push push changes to the specified destination
299 300 remove, rm remove the specified files on the next commit
300 301 serve start stand-alone webserver
301 302 status, st show changed files in the working directory
302 303 summary, sum summarize working directory state
303 304 update, up, checkout, co
304 305 update working directory (or switch revisions)
305 306
306 307 global options ([+] can be repeated):
307 308
308 309 -R --repository REPO repository root directory or name of overlay bundle
309 310 file
310 311 --cwd DIR change working directory
311 312 -y --noninteractive do not prompt, automatically pick the first choice for
312 313 all prompts
313 314 -q --quiet suppress output
314 315 -v --verbose enable additional output
315 316 --config CONFIG [+] set/override config option (use 'section.name=value')
316 317 --debug enable debugging output
317 318 --debugger start debugger
318 319 --encoding ENCODE set the charset encoding (default: ascii)
319 320 --encodingmode MODE set the charset encoding mode (default: strict)
320 321 --traceback always print a traceback on exception
321 322 --time time how long the command takes
322 323 --profile print command execution profile
323 324 --version output version information and exit
324 325 -h --help display help and exit
325 326 --hidden consider hidden changesets
326 327
327 328 (use "hg help" for the full list of commands)
328 329
329 330 $ hg add -h
330 331 hg add [OPTION]... [FILE]...
331 332
332 333 add the specified files on the next commit
333 334
334 335 Schedule files to be version controlled and added to the repository.
335 336
336 337 The files will be added to the repository at the next commit. To undo an
337 338 add before that, see "hg forget".
338 339
339 340 If no names are given, add all files to the repository.
340 341
341 342 Returns 0 if all files are successfully added.
342 343
343 344 options ([+] can be repeated):
344 345
345 346 -I --include PATTERN [+] include names matching the given patterns
346 347 -X --exclude PATTERN [+] exclude names matching the given patterns
347 348 -S --subrepos recurse into subrepositories
348 349 -n --dry-run do not perform actions, just print output
349 350
350 351 (some details hidden, use --verbose to show complete help)
351 352
352 353 Verbose help for add
353 354
354 355 $ hg add -hv
355 356 hg add [OPTION]... [FILE]...
356 357
357 358 add the specified files on the next commit
358 359
359 360 Schedule files to be version controlled and added to the repository.
360 361
361 362 The files will be added to the repository at the next commit. To undo an
362 363 add before that, see "hg forget".
363 364
364 365 If no names are given, add all files to the repository.
365 366
366 367 An example showing how new (unknown) files are added automatically by "hg
367 368 add":
368 369
369 370 $ ls
370 371 foo.c
371 372 $ hg status
372 373 ? foo.c
373 374 $ hg add
374 375 adding foo.c
375 376 $ hg status
376 377 A foo.c
377 378
378 379 Returns 0 if all files are successfully added.
379 380
380 381 options ([+] can be repeated):
381 382
382 383 -I --include PATTERN [+] include names matching the given patterns
383 384 -X --exclude PATTERN [+] exclude names matching the given patterns
384 385 -S --subrepos recurse into subrepositories
385 386 -n --dry-run do not perform actions, just print output
386 387
387 388 global options ([+] can be repeated):
388 389
389 390 -R --repository REPO repository root directory or name of overlay bundle
390 391 file
391 392 --cwd DIR change working directory
392 393 -y --noninteractive do not prompt, automatically pick the first choice for
393 394 all prompts
394 395 -q --quiet suppress output
395 396 -v --verbose enable additional output
396 397 --config CONFIG [+] set/override config option (use 'section.name=value')
397 398 --debug enable debugging output
398 399 --debugger start debugger
399 400 --encoding ENCODE set the charset encoding (default: ascii)
400 401 --encodingmode MODE set the charset encoding mode (default: strict)
401 402 --traceback always print a traceback on exception
402 403 --time time how long the command takes
403 404 --profile print command execution profile
404 405 --version output version information and exit
405 406 -h --help display help and exit
406 407 --hidden consider hidden changesets
407 408
408 409 Test help option with version option
409 410
410 411 $ hg add -h --version
411 412 Mercurial Distributed SCM (version *) (glob)
412 413 (see http://mercurial.selenic.com for more information)
413 414
414 415 Copyright (C) 2005-2015 Matt Mackall and others
415 416 This is free software; see the source for copying conditions. There is NO
416 417 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
417 418
418 419 $ hg add --skjdfks
419 420 hg add: option --skjdfks not recognized
420 421 hg add [OPTION]... [FILE]...
421 422
422 423 add the specified files on the next commit
423 424
424 425 options ([+] can be repeated):
425 426
426 427 -I --include PATTERN [+] include names matching the given patterns
427 428 -X --exclude PATTERN [+] exclude names matching the given patterns
428 429 -S --subrepos recurse into subrepositories
429 430 -n --dry-run do not perform actions, just print output
430 431
431 432 (use "hg add -h" to show more help)
432 433 [255]
433 434
434 435 Test ambiguous command help
435 436
436 437 $ hg help ad
437 438 list of commands:
438 439
439 440 add add the specified files on the next commit
440 441 addremove add all new files, delete all missing files
441 442
442 443 (use "hg help -v ad" to show built-in aliases and global options)
443 444
444 445 Test command without options
445 446
446 447 $ hg help verify
447 448 hg verify
448 449
449 450 verify the integrity of the repository
450 451
451 452 Verify the integrity of the current repository.
452 453
453 454 This will perform an extensive check of the repository's integrity,
454 455 validating the hashes and checksums of each entry in the changelog,
455 456 manifest, and tracked files, as well as the integrity of their crosslinks
456 457 and indices.
457 458
458 459 Please see http://mercurial.selenic.com/wiki/RepositoryCorruption for more
459 460 information about recovery from corruption of the repository.
460 461
461 462 Returns 0 on success, 1 if errors are encountered.
462 463
463 464 (some details hidden, use --verbose to show complete help)
464 465
465 466 $ hg help diff
466 467 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
467 468
468 469 diff repository (or selected files)
469 470
470 471 Show differences between revisions for the specified files.
471 472
472 473 Differences between files are shown using the unified diff format.
473 474
474 475 Note:
475 476 diff may generate unexpected results for merges, as it will default to
476 477 comparing against the working directory's first parent changeset if no
477 478 revisions are specified.
478 479
479 480 When two revision arguments are given, then changes are shown between
480 481 those revisions. If only one revision is specified then that revision is
481 482 compared to the working directory, and, when no revisions are specified,
482 483 the working directory files are compared to its parent.
483 484
484 485 Alternatively you can specify -c/--change with a revision to see the
485 486 changes in that changeset relative to its first parent.
486 487
487 488 Without the -a/--text option, diff will avoid generating diffs of files it
488 489 detects as binary. With -a, diff will generate a diff anyway, probably
489 490 with undesirable results.
490 491
491 492 Use the -g/--git option to generate diffs in the git extended diff format.
492 493 For more information, read "hg help diffs".
493 494
494 495 Returns 0 on success.
495 496
496 497 options ([+] can be repeated):
497 498
498 499 -r --rev REV [+] revision
499 500 -c --change REV change made by revision
500 501 -a --text treat all files as text
501 502 -g --git use git extended diff format
502 503 --nodates omit dates from diff headers
503 504 --noprefix omit a/ and b/ prefixes from filenames
504 505 -p --show-function show which function each change is in
505 506 --reverse produce a diff that undoes the changes
506 507 -w --ignore-all-space ignore white space when comparing lines
507 508 -b --ignore-space-change ignore changes in the amount of white space
508 509 -B --ignore-blank-lines ignore changes whose lines are all blank
509 510 -U --unified NUM number of lines of context to show
510 511 --stat output diffstat-style summary of changes
511 512 -I --include PATTERN [+] include names matching the given patterns
512 513 -X --exclude PATTERN [+] exclude names matching the given patterns
513 514 -S --subrepos recurse into subrepositories
514 515
515 516 (some details hidden, use --verbose to show complete help)
516 517
517 518 $ hg help status
518 519 hg status [OPTION]... [FILE]...
519 520
520 521 aliases: st
521 522
522 523 show changed files in the working directory
523 524
524 525 Show status of files in the repository. If names are given, only files
525 526 that match are shown. Files that are clean or ignored or the source of a
526 527 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
527 528 -C/--copies or -A/--all are given. Unless options described with "show
528 529 only ..." are given, the options -mardu are used.
529 530
530 531 Option -q/--quiet hides untracked (unknown and ignored) files unless
531 532 explicitly requested with -u/--unknown or -i/--ignored.
532 533
533 534 Note:
534 535 status may appear to disagree with diff if permissions have changed or
535 536 a merge has occurred. The standard diff format does not report
536 537 permission changes and diff only reports changes relative to one merge
537 538 parent.
538 539
539 540 If one revision is given, it is used as the base revision. If two
540 541 revisions are given, the differences between them are shown. The --change
541 542 option can also be used as a shortcut to list the changed files of a
542 543 revision from its first parent.
543 544
544 545 The codes used to show the status of files are:
545 546
546 547 M = modified
547 548 A = added
548 549 R = removed
549 550 C = clean
550 551 ! = missing (deleted by non-hg command, but still tracked)
551 552 ? = not tracked
552 553 I = ignored
553 554 = origin of the previous file (with --copies)
554 555
555 556 Returns 0 on success.
556 557
557 558 options ([+] can be repeated):
558 559
559 560 -A --all show status of all files
560 561 -m --modified show only modified files
561 562 -a --added show only added files
562 563 -r --removed show only removed files
563 564 -d --deleted show only deleted (but tracked) files
564 565 -c --clean show only files without changes
565 566 -u --unknown show only unknown (not tracked) files
566 567 -i --ignored show only ignored files
567 568 -n --no-status hide status prefix
568 569 -C --copies show source of copied files
569 570 -0 --print0 end filenames with NUL, for use with xargs
570 571 --rev REV [+] show difference from revision
571 572 --change REV list the changed files of a revision
572 573 -I --include PATTERN [+] include names matching the given patterns
573 574 -X --exclude PATTERN [+] exclude names matching the given patterns
574 575 -S --subrepos recurse into subrepositories
575 576
576 577 (some details hidden, use --verbose to show complete help)
577 578
578 579 $ hg -q help status
579 580 hg status [OPTION]... [FILE]...
580 581
581 582 show changed files in the working directory
582 583
583 584 $ hg help foo
584 585 abort: no such help topic: foo
585 586 (try "hg help --keyword foo")
586 587 [255]
587 588
588 589 $ hg skjdfks
589 590 hg: unknown command 'skjdfks'
590 591 Mercurial Distributed SCM
591 592
592 593 basic commands:
593 594
594 595 add add the specified files on the next commit
595 596 annotate show changeset information by line for each file
596 597 clone make a copy of an existing repository
597 598 commit commit the specified files or all outstanding changes
598 599 diff diff repository (or selected files)
599 600 export dump the header and diffs for one or more changesets
600 601 forget forget the specified files on the next commit
601 602 init create a new repository in the given directory
602 603 log show revision history of entire repository or files
603 604 merge merge another revision into working directory
604 605 pull pull changes from the specified source
605 606 push push changes to the specified destination
606 607 remove remove the specified files on the next commit
607 608 serve start stand-alone webserver
608 609 status show changed files in the working directory
609 610 summary summarize working directory state
610 611 update update working directory (or switch revisions)
611 612
612 613 (use "hg help" for the full list of commands or "hg -v" for details)
613 614 [255]
614 615
615 616
616 617 $ cat > helpext.py <<EOF
617 618 > import os
618 619 > from mercurial import cmdutil, commands
619 620 >
620 621 > cmdtable = {}
621 622 > command = cmdutil.command(cmdtable)
622 623 >
623 624 > @command('nohelp',
624 625 > [('', 'longdesc', 3, 'x'*90),
625 626 > ('n', '', None, 'normal desc'),
626 627 > ('', 'newline', '', 'line1\nline2')],
627 628 > 'hg nohelp',
628 629 > norepo=True)
629 630 > @command('debugoptDEP', [('', 'dopt', None, 'option is DEPRECATED')])
630 631 > def nohelp(ui, *args, **kwargs):
631 632 > pass
632 633 >
633 634 > EOF
634 635 $ echo '[extensions]' >> $HGRCPATH
635 636 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
636 637
637 638 Test command with no help text
638 639
639 640 $ hg help nohelp
640 641 hg nohelp
641 642
642 643 (no help text available)
643 644
644 645 options:
645 646
646 647 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
647 648 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
648 649 -n -- normal desc
649 650 --newline VALUE line1 line2
650 651
651 652 (some details hidden, use --verbose to show complete help)
652 653
653 654 $ hg help -k nohelp
654 655 Commands:
655 656
656 657 nohelp hg nohelp
657 658
658 659 Extension Commands:
659 660
660 661 nohelp (no help text available)
661 662
662 663 Test that default list of commands omits extension commands
663 664
664 665 $ hg help
665 666 Mercurial Distributed SCM
666 667
667 668 list of commands:
668 669
669 670 add add the specified files on the next commit
670 671 addremove add all new files, delete all missing files
671 672 annotate show changeset information by line for each file
672 673 archive create an unversioned archive of a repository revision
673 674 backout reverse effect of earlier changeset
674 675 bisect subdivision search of changesets
675 676 bookmarks create a new bookmark or list existing bookmarks
676 677 branch set or show the current branch name
677 678 branches list repository named branches
678 679 bundle create a changegroup file
679 680 cat output the current or given revision of files
680 681 clone make a copy of an existing repository
681 682 commit commit the specified files or all outstanding changes
682 683 config show combined config settings from all hgrc files
683 684 copy mark files as copied for the next commit
684 685 diff diff repository (or selected files)
685 686 export dump the header and diffs for one or more changesets
686 687 files list tracked files
687 688 forget forget the specified files on the next commit
688 689 graft copy changes from other branches onto the current branch
689 690 grep search for a pattern in specified files and revisions
690 691 heads show branch heads
691 692 help show help for a given topic or a help overview
692 693 identify identify the working copy or specified revision
693 694 import import an ordered set of patches
694 695 incoming show new changesets found in source
695 696 init create a new repository in the given directory
696 697 log show revision history of entire repository or files
697 698 manifest output the current or given revision of the project manifest
698 699 merge merge another revision into working directory
699 700 outgoing show changesets not found in the destination
700 701 paths show aliases for remote repositories
701 702 phase set or show the current phase name
702 703 pull pull changes from the specified source
703 704 push push changes to the specified destination
704 705 recover roll back an interrupted transaction
705 706 remove remove the specified files on the next commit
706 707 rename rename files; equivalent of copy + remove
707 708 resolve redo merges or set/view the merge status of files
708 709 revert restore files to their checkout state
709 710 root print the root (top) of the current working directory
710 711 serve start stand-alone webserver
711 712 status show changed files in the working directory
712 713 summary summarize working directory state
713 714 tag add one or more tags for the current or given revision
714 715 tags list repository tags
715 716 unbundle apply one or more changegroup files
716 717 update update working directory (or switch revisions)
717 718 verify verify the integrity of the repository
718 719 version output version and copyright information
719 720
720 721 enabled extensions:
721 722
722 723 helpext (no help text available)
723 724
724 725 additional help topics:
725 726
726 727 config Configuration Files
727 728 dates Date Formats
728 729 diffs Diff Formats
729 730 environment Environment Variables
730 731 extensions Using Additional Features
731 732 filesets Specifying File Sets
732 733 glossary Glossary
733 734 hgignore Syntax for Mercurial Ignore Files
734 735 hgweb Configuring hgweb
735 736 merge-tools Merge Tools
736 737 multirevs Specifying Multiple Revisions
737 738 patterns File Name Patterns
738 739 phases Working with Phases
739 740 revisions Specifying Single Revisions
740 741 revsets Specifying Revision Sets
741 742 subrepos Subrepositories
742 743 templating Template Usage
743 744 urls URL Paths
744 745
745 746 (use "hg help -v" to show built-in aliases and global options)
746 747
747 748
748 749 Test list of internal help commands
749 750
750 751 $ hg help debug
751 752 debug commands (internal and unsupported):
752 753
753 754 debugancestor
754 755 find the ancestor revision of two revisions in a given index
755 756 debugbuilddag
756 757 builds a repo with a given DAG from scratch in the current
757 758 empty repo
758 759 debugbundle lists the contents of a bundle
759 760 debugcheckstate
760 761 validate the correctness of the current dirstate
761 762 debugcommands
762 763 list all available commands and options
763 764 debugcomplete
764 765 returns the completion list associated with the given command
765 766 debugdag format the changelog or an index DAG as a concise textual
766 767 description
767 768 debugdata dump the contents of a data file revision
768 769 debugdate parse and display a date
769 770 debugdirstate
770 771 show the contents of the current dirstate
771 772 debugdiscovery
772 773 runs the changeset discovery protocol in isolation
773 774 debugfileset parse and apply a fileset specification
774 775 debugfsinfo show information detected about current filesystem
775 776 debuggetbundle
776 777 retrieves a bundle from a repo
777 778 debugignore display the combined ignore pattern
778 779 debugindex dump the contents of an index file
779 780 debugindexdot
780 781 dump an index DAG as a graphviz dot file
781 782 debuginstall test Mercurial installation
782 783 debugknown test whether node ids are known to a repo
783 784 debuglocks show or modify state of locks
784 785 debugnamecomplete
785 786 complete "names" - tags, open branch names, bookmark names
786 787 debugobsolete
787 788 create arbitrary obsolete marker
788 789 debugoptDEP (no help text available)
789 790 debugpathcomplete
790 791 complete part or all of a tracked path
791 792 debugpushkey access the pushkey key/value protocol
792 793 debugpvec (no help text available)
793 794 debugrebuilddirstate
794 795 rebuild the dirstate as it would look like for the given
795 796 revision
796 797 debugrename dump rename information
797 798 debugrevlog show data and statistics about a revlog
798 799 debugrevspec parse and apply a revision specification
799 800 debugsetparents
800 801 manually set the parents of the current working directory
801 802 debugsub (no help text available)
802 803 debugsuccessorssets
803 804 show set of successors for revision
804 805 debugwalk show how files match on given patterns
805 806 debugwireargs
806 807 (no help text available)
807 808
808 809 (use "hg help -v debug" to show built-in aliases and global options)
809 810
810 811
811 812 Test list of commands with command with no help text
812 813
813 814 $ hg help helpext
814 815 helpext extension - no help text available
815 816
816 817 list of commands:
817 818
818 819 nohelp (no help text available)
819 820
820 821 (use "hg help -v helpext" to show built-in aliases and global options)
821 822
822 823
823 824 test deprecated option is hidden in command help
824 825 $ hg help debugoptDEP
825 826 hg debugoptDEP
826 827
827 828 (no help text available)
828 829
829 830 options:
830 831
831 832 (some details hidden, use --verbose to show complete help)
832 833
833 834 test deprecated option is shown with -v
834 835 $ hg help -v debugoptDEP | grep dopt
835 836 --dopt option is DEPRECATED
836 837
837 838 #if gettext
838 839 test deprecated option is hidden with translation with untranslated description
839 840 (use many globy for not failing on changed transaction)
840 841 $ LANGUAGE=sv hg help debugoptDEP
841 842 hg debugoptDEP
842 843
843 844 (*) (glob)
844 845
845 846 options:
846 847
847 848 (some details hidden, use --verbose to show complete help)
848 849 #endif
849 850
850 851 Test commands that collide with topics (issue4240)
851 852
852 853 $ hg config -hq
853 854 hg config [-u] [NAME]...
854 855
855 856 show combined config settings from all hgrc files
856 857 $ hg showconfig -hq
857 858 hg config [-u] [NAME]...
858 859
859 860 show combined config settings from all hgrc files
860 861
861 862 Test a help topic
862 863
863 864 $ hg help revs
864 865 Specifying Single Revisions
865 866 """""""""""""""""""""""""""
866 867
867 868 Mercurial supports several ways to specify individual revisions.
868 869
869 870 A plain integer is treated as a revision number. Negative integers are
870 871 treated as sequential offsets from the tip, with -1 denoting the tip, -2
871 872 denoting the revision prior to the tip, and so forth.
872 873
873 874 A 40-digit hexadecimal string is treated as a unique revision identifier.
874 875
875 876 A hexadecimal string less than 40 characters long is treated as a unique
876 877 revision identifier and is referred to as a short-form identifier. A
877 878 short-form identifier is only valid if it is the prefix of exactly one
878 879 full-length identifier.
879 880
880 881 Any other string is treated as a bookmark, tag, or branch name. A bookmark
881 882 is a movable pointer to a revision. A tag is a permanent name associated
882 883 with a revision. A branch name denotes the tipmost open branch head of
883 884 that branch - or if they are all closed, the tipmost closed head of the
884 885 branch. Bookmark, tag, and branch names must not contain the ":"
885 886 character.
886 887
887 888 The reserved name "tip" always identifies the most recent revision.
888 889
889 890 The reserved name "null" indicates the null revision. This is the revision
890 891 of an empty repository, and the parent of revision 0.
891 892
892 893 The reserved name "." indicates the working directory parent. If no
893 894 working directory is checked out, it is equivalent to null. If an
894 895 uncommitted merge is in progress, "." is the revision of the first parent.
895 896
896 897 Test templating help
897 898
898 899 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
899 900 desc String. The text of the changeset description.
900 901 diffstat String. Statistics of changes with the following format:
901 902 firstline Any text. Returns the first line of text.
902 903 nonempty Any text. Returns '(none)' if the string is empty.
903 904
904 905 Test help hooks
905 906
906 907 $ cat > helphook1.py <<EOF
907 908 > from mercurial import help
908 909 >
909 910 > def rewrite(topic, doc):
910 911 > return doc + '\nhelphook1\n'
911 912 >
912 913 > def extsetup(ui):
913 914 > help.addtopichook('revsets', rewrite)
914 915 > EOF
915 916 $ cat > helphook2.py <<EOF
916 917 > from mercurial import help
917 918 >
918 919 > def rewrite(topic, doc):
919 920 > return doc + '\nhelphook2\n'
920 921 >
921 922 > def extsetup(ui):
922 923 > help.addtopichook('revsets', rewrite)
923 924 > EOF
924 925 $ echo '[extensions]' >> $HGRCPATH
925 926 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
926 927 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
927 928 $ hg help revsets | grep helphook
928 929 helphook1
929 930 helphook2
930 931
931 932 Test keyword search help
932 933
933 934 $ cat > prefixedname.py <<EOF
934 935 > '''matched against word "clone"
935 936 > '''
936 937 > EOF
937 938 $ echo '[extensions]' >> $HGRCPATH
938 939 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
939 940 $ hg help -k clone
940 941 Topics:
941 942
942 943 config Configuration Files
943 944 extensions Using Additional Features
944 945 glossary Glossary
945 946 phases Working with Phases
946 947 subrepos Subrepositories
947 948 urls URL Paths
948 949
949 950 Commands:
950 951
951 952 bookmarks create a new bookmark or list existing bookmarks
952 953 clone make a copy of an existing repository
953 954 paths show aliases for remote repositories
954 955 update update working directory (or switch revisions)
955 956
956 957 Extensions:
957 958
958 959 prefixedname matched against word "clone"
959 960 relink recreates hardlinks between repository clones
960 961
961 962 Extension Commands:
962 963
963 964 qclone clone main and patch repository at same time
964 965
965 966 Test unfound topic
966 967
967 968 $ hg help nonexistingtopicthatwillneverexisteverever
968 969 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
969 970 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
970 971 [255]
971 972
972 973 Test unfound keyword
973 974
974 975 $ hg help --keyword nonexistingwordthatwillneverexisteverever
975 976 abort: no matches
976 977 (try "hg help" for a list of topics)
977 978 [255]
978 979
979 980 Test omit indicating for help
980 981
981 982 $ cat > addverboseitems.py <<EOF
982 983 > '''extension to test omit indicating.
983 984 >
984 985 > This paragraph is never omitted (for extension)
985 986 >
986 987 > .. container:: verbose
987 988 >
988 989 > This paragraph is omitted,
989 990 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
990 991 >
991 992 > This paragraph is never omitted, too (for extension)
992 993 > '''
993 994 >
994 995 > from mercurial import help, commands
995 996 > testtopic = """This paragraph is never omitted (for topic).
996 997 >
997 998 > .. container:: verbose
998 999 >
999 1000 > This paragraph is omitted,
1000 1001 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1001 1002 >
1002 1003 > This paragraph is never omitted, too (for topic)
1003 1004 > """
1004 1005 > def extsetup(ui):
1005 1006 > help.helptable.append((["topic-containing-verbose"],
1006 1007 > "This is the topic to test omit indicating.",
1007 1008 > lambda : testtopic))
1008 1009 > EOF
1009 1010 $ echo '[extensions]' >> $HGRCPATH
1010 1011 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1011 1012 $ hg help addverboseitems
1012 1013 addverboseitems extension - extension to test omit indicating.
1013 1014
1014 1015 This paragraph is never omitted (for extension)
1015 1016
1016 1017 This paragraph is never omitted, too (for extension)
1017 1018
1018 1019 (some details hidden, use --verbose to show complete help)
1019 1020
1020 1021 no commands defined
1021 1022 $ hg help -v addverboseitems
1022 1023 addverboseitems extension - extension to test omit indicating.
1023 1024
1024 1025 This paragraph is never omitted (for extension)
1025 1026
1026 1027 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1027 1028 extension)
1028 1029
1029 1030 This paragraph is never omitted, too (for extension)
1030 1031
1031 1032 no commands defined
1032 1033 $ hg help topic-containing-verbose
1033 1034 This is the topic to test omit indicating.
1034 1035 """"""""""""""""""""""""""""""""""""""""""
1035 1036
1036 1037 This paragraph is never omitted (for topic).
1037 1038
1038 1039 This paragraph is never omitted, too (for topic)
1039 1040
1040 1041 (some details hidden, use --verbose to show complete help)
1041 1042 $ hg help -v topic-containing-verbose
1042 1043 This is the topic to test omit indicating.
1043 1044 """"""""""""""""""""""""""""""""""""""""""
1044 1045
1045 1046 This paragraph is never omitted (for topic).
1046 1047
1047 1048 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1048 1049 topic)
1049 1050
1050 1051 This paragraph is never omitted, too (for topic)
1051 1052
1052 1053 Test section lookup
1053 1054
1054 1055 $ hg help revset.merge
1055 1056 "merge()"
1056 1057 Changeset is a merge changeset.
1057 1058
1058 1059 $ hg help glossary.dag
1059 1060 DAG
1060 1061 The repository of changesets of a distributed version control system
1061 1062 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1062 1063 of nodes and edges, where nodes correspond to changesets and edges
1063 1064 imply a parent -> child relation. This graph can be visualized by
1064 1065 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1065 1066 limited by the requirement for children to have at most two parents.
1066 1067
1067 1068
1068 1069 $ hg help hgrc.paths
1069 1070 "paths"
1070 1071 -------
1071 1072
1072 1073 Assigns symbolic names to repositories. The left side is the symbolic
1073 1074 name, and the right gives the directory or URL that is the location of the
1074 1075 repository. Default paths can be declared by setting the following
1075 1076 entries.
1076 1077
1077 1078 "default"
1078 1079 Directory or URL to use when pulling if no source is specified.
1079 1080 Default is set to repository from which the current repository was
1080 1081 cloned.
1081 1082
1082 1083 "default-push"
1083 1084 Optional. Directory or URL to use when pushing if no destination is
1084 1085 specified.
1085 1086
1086 1087 Custom paths can be defined by assigning the path to a name that later can
1087 1088 be used from the command line. Example:
1088 1089
1089 1090 [paths]
1090 1091 my_path = http://example.com/path
1091 1092
1092 1093 To push to the path defined in "my_path" run the command:
1093 1094
1094 1095 hg push my_path
1095 1096
1096 1097 $ hg help glossary.mcguffin
1097 1098 abort: help section not found
1098 1099 [255]
1099 1100
1100 1101 $ hg help glossary.mc.guffin
1101 1102 abort: help section not found
1102 1103 [255]
1103 1104
1104 1105 Test dynamic list of merge tools only shows up once
1105 1106 $ hg help merge-tools
1106 1107 Merge Tools
1107 1108 """""""""""
1108 1109
1109 1110 To merge files Mercurial uses merge tools.
1110 1111
1111 1112 A merge tool combines two different versions of a file into a merged file.
1112 1113 Merge tools are given the two files and the greatest common ancestor of
1113 1114 the two file versions, so they can determine the changes made on both
1114 1115 branches.
1115 1116
1116 1117 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1117 1118 backout" and in several extensions.
1118 1119
1119 1120 Usually, the merge tool tries to automatically reconcile the files by
1120 1121 combining all non-overlapping changes that occurred separately in the two
1121 1122 different evolutions of the same initial base file. Furthermore, some
1122 1123 interactive merge programs make it easier to manually resolve conflicting
1123 1124 merges, either in a graphical way, or by inserting some conflict markers.
1124 1125 Mercurial does not include any interactive merge programs but relies on
1125 1126 external tools for that.
1126 1127
1127 1128 Available merge tools
1128 1129 =====================
1129 1130
1130 1131 External merge tools and their properties are configured in the merge-
1131 1132 tools configuration section - see hgrc(5) - but they can often just be
1132 1133 named by their executable.
1133 1134
1134 1135 A merge tool is generally usable if its executable can be found on the
1135 1136 system and if it can handle the merge. The executable is found if it is an
1136 1137 absolute or relative executable path or the name of an application in the
1137 1138 executable search path. The tool is assumed to be able to handle the merge
1138 1139 if it can handle symlinks if the file is a symlink, if it can handle
1139 1140 binary files if the file is binary, and if a GUI is available if the tool
1140 1141 requires a GUI.
1141 1142
1142 1143 There are some internal merge tools which can be used. The internal merge
1143 1144 tools are:
1144 1145
1145 1146 ":dump"
1146 1147 Creates three versions of the files to merge, containing the contents of
1147 1148 local, other and base. These files can then be used to perform a merge
1148 1149 manually. If the file to be merged is named "a.txt", these files will
1149 1150 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1150 1151 they will be placed in the same directory as "a.txt".
1151 1152
1152 1153 ":fail"
1153 1154 Rather than attempting to merge files that were modified on both
1154 1155 branches, it marks them as unresolved. The resolve command must be used
1155 1156 to resolve these conflicts.
1156 1157
1157 1158 ":local"
1158 1159 Uses the local version of files as the merged version.
1159 1160
1160 1161 ":merge"
1161 1162 Uses the internal non-interactive simple merge algorithm for merging
1162 1163 files. It will fail if there are any conflicts and leave markers in the
1163 1164 partially merged file. Markers will have two sections, one for each side
1164 1165 of merge.
1165 1166
1166 1167 ":merge3"
1167 1168 Uses the internal non-interactive simple merge algorithm for merging
1168 1169 files. It will fail if there are any conflicts and leave markers in the
1169 1170 partially merged file. Marker will have three sections, one from each
1170 1171 side of the merge and one for the base content.
1171 1172
1172 1173 ":other"
1173 1174 Uses the other version of files as the merged version.
1174 1175
1175 1176 ":prompt"
1176 1177 Asks the user which of the local or the other version to keep as the
1177 1178 merged version.
1178 1179
1179 1180 ":tagmerge"
1180 1181 Uses the internal tag merge algorithm (experimental).
1181 1182
1182 1183 Internal tools are always available and do not require a GUI but will by
1183 1184 default not handle symlinks or binary files.
1184 1185
1185 1186 Choosing a merge tool
1186 1187 =====================
1187 1188
1188 1189 Mercurial uses these rules when deciding which merge tool to use:
1189 1190
1190 1191 1. If a tool has been specified with the --tool option to merge or
1191 1192 resolve, it is used. If it is the name of a tool in the merge-tools
1192 1193 configuration, its configuration is used. Otherwise the specified tool
1193 1194 must be executable by the shell.
1194 1195 2. If the "HGMERGE" environment variable is present, its value is used and
1195 1196 must be executable by the shell.
1196 1197 3. If the filename of the file to be merged matches any of the patterns in
1197 1198 the merge-patterns configuration section, the first usable merge tool
1198 1199 corresponding to a matching pattern is used. Here, binary capabilities
1199 1200 of the merge tool are not considered.
1200 1201 4. If ui.merge is set it will be considered next. If the value is not the
1201 1202 name of a configured tool, the specified value is used and must be
1202 1203 executable by the shell. Otherwise the named tool is used if it is
1203 1204 usable.
1204 1205 5. If any usable merge tools are present in the merge-tools configuration
1205 1206 section, the one with the highest priority is used.
1206 1207 6. If a program named "hgmerge" can be found on the system, it is used -
1207 1208 but it will by default not be used for symlinks and binary files.
1208 1209 7. If the file to be merged is not binary and is not a symlink, then
1209 1210 internal ":merge" is used.
1210 1211 8. The merge of the file fails and must be resolved before commit.
1211 1212
1212 1213 Note:
1213 1214 After selecting a merge program, Mercurial will by default attempt to
1214 1215 merge the files using a simple merge algorithm first. Only if it
1215 1216 doesn't succeed because of conflicting changes Mercurial will actually
1216 1217 execute the merge program. Whether to use the simple merge algorithm
1217 1218 first can be controlled by the premerge setting of the merge tool.
1218 1219 Premerge is enabled by default unless the file is binary or a symlink.
1219 1220
1220 1221 See the merge-tools and ui sections of hgrc(5) for details on the
1221 1222 configuration of merge tools.
1222 1223
1223 1224 Test usage of section marks in help documents
1224 1225
1225 1226 $ cd "$TESTDIR"/../doc
1226 1227 $ python check-seclevel.py
1227 1228 $ cd $TESTTMP
1228 1229
1229 1230 #if serve
1230 1231
1231 1232 Test the help pages in hgweb.
1232 1233
1233 1234 Dish up an empty repo; serve it cold.
1234 1235
1235 1236 $ hg init "$TESTTMP/test"
1236 1237 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1237 1238 $ cat hg.pid >> $DAEMON_PIDS
1238 1239
1239 1240 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help"
1240 1241 200 Script output follows
1241 1242
1242 1243 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1243 1244 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1244 1245 <head>
1245 1246 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1246 1247 <meta name="robots" content="index, nofollow" />
1247 1248 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1248 1249 <script type="text/javascript" src="/static/mercurial.js"></script>
1249 1250
1250 1251 <title>Help: Index</title>
1251 1252 </head>
1252 1253 <body>
1253 1254
1254 1255 <div class="container">
1255 1256 <div class="menu">
1256 1257 <div class="logo">
1257 1258 <a href="http://mercurial.selenic.com/">
1258 1259 <img src="/static/hglogo.png" alt="mercurial" /></a>
1259 1260 </div>
1260 1261 <ul>
1261 1262 <li><a href="/shortlog">log</a></li>
1262 1263 <li><a href="/graph">graph</a></li>
1263 1264 <li><a href="/tags">tags</a></li>
1264 1265 <li><a href="/bookmarks">bookmarks</a></li>
1265 1266 <li><a href="/branches">branches</a></li>
1266 1267 </ul>
1267 1268 <ul>
1268 1269 <li class="active">help</li>
1269 1270 </ul>
1270 1271 </div>
1271 1272
1272 1273 <div class="main">
1273 1274 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1274 1275 <form class="search" action="/log">
1275 1276
1276 1277 <p><input name="rev" id="search1" type="text" size="30" /></p>
1277 1278 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1278 1279 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1279 1280 </form>
1280 1281 <table class="bigtable">
1281 1282 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1282 1283
1283 1284 <tr><td>
1284 1285 <a href="/help/config">
1285 1286 config
1286 1287 </a>
1287 1288 </td><td>
1288 1289 Configuration Files
1289 1290 </td></tr>
1290 1291 <tr><td>
1291 1292 <a href="/help/dates">
1292 1293 dates
1293 1294 </a>
1294 1295 </td><td>
1295 1296 Date Formats
1296 1297 </td></tr>
1297 1298 <tr><td>
1298 1299 <a href="/help/diffs">
1299 1300 diffs
1300 1301 </a>
1301 1302 </td><td>
1302 1303 Diff Formats
1303 1304 </td></tr>
1304 1305 <tr><td>
1305 1306 <a href="/help/environment">
1306 1307 environment
1307 1308 </a>
1308 1309 </td><td>
1309 1310 Environment Variables
1310 1311 </td></tr>
1311 1312 <tr><td>
1312 1313 <a href="/help/extensions">
1313 1314 extensions
1314 1315 </a>
1315 1316 </td><td>
1316 1317 Using Additional Features
1317 1318 </td></tr>
1318 1319 <tr><td>
1319 1320 <a href="/help/filesets">
1320 1321 filesets
1321 1322 </a>
1322 1323 </td><td>
1323 1324 Specifying File Sets
1324 1325 </td></tr>
1325 1326 <tr><td>
1326 1327 <a href="/help/glossary">
1327 1328 glossary
1328 1329 </a>
1329 1330 </td><td>
1330 1331 Glossary
1331 1332 </td></tr>
1332 1333 <tr><td>
1333 1334 <a href="/help/hgignore">
1334 1335 hgignore
1335 1336 </a>
1336 1337 </td><td>
1337 1338 Syntax for Mercurial Ignore Files
1338 1339 </td></tr>
1339 1340 <tr><td>
1340 1341 <a href="/help/hgweb">
1341 1342 hgweb
1342 1343 </a>
1343 1344 </td><td>
1344 1345 Configuring hgweb
1345 1346 </td></tr>
1346 1347 <tr><td>
1347 1348 <a href="/help/merge-tools">
1348 1349 merge-tools
1349 1350 </a>
1350 1351 </td><td>
1351 1352 Merge Tools
1352 1353 </td></tr>
1353 1354 <tr><td>
1354 1355 <a href="/help/multirevs">
1355 1356 multirevs
1356 1357 </a>
1357 1358 </td><td>
1358 1359 Specifying Multiple Revisions
1359 1360 </td></tr>
1360 1361 <tr><td>
1361 1362 <a href="/help/patterns">
1362 1363 patterns
1363 1364 </a>
1364 1365 </td><td>
1365 1366 File Name Patterns
1366 1367 </td></tr>
1367 1368 <tr><td>
1368 1369 <a href="/help/phases">
1369 1370 phases
1370 1371 </a>
1371 1372 </td><td>
1372 1373 Working with Phases
1373 1374 </td></tr>
1374 1375 <tr><td>
1375 1376 <a href="/help/revisions">
1376 1377 revisions
1377 1378 </a>
1378 1379 </td><td>
1379 1380 Specifying Single Revisions
1380 1381 </td></tr>
1381 1382 <tr><td>
1382 1383 <a href="/help/revsets">
1383 1384 revsets
1384 1385 </a>
1385 1386 </td><td>
1386 1387 Specifying Revision Sets
1387 1388 </td></tr>
1388 1389 <tr><td>
1389 1390 <a href="/help/subrepos">
1390 1391 subrepos
1391 1392 </a>
1392 1393 </td><td>
1393 1394 Subrepositories
1394 1395 </td></tr>
1395 1396 <tr><td>
1396 1397 <a href="/help/templating">
1397 1398 templating
1398 1399 </a>
1399 1400 </td><td>
1400 1401 Template Usage
1401 1402 </td></tr>
1402 1403 <tr><td>
1403 1404 <a href="/help/urls">
1404 1405 urls
1405 1406 </a>
1406 1407 </td><td>
1407 1408 URL Paths
1408 1409 </td></tr>
1409 1410 <tr><td>
1410 1411 <a href="/help/topic-containing-verbose">
1411 1412 topic-containing-verbose
1412 1413 </a>
1413 1414 </td><td>
1414 1415 This is the topic to test omit indicating.
1415 1416 </td></tr>
1416 1417
1417 1418 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1418 1419
1419 1420 <tr><td>
1420 1421 <a href="/help/add">
1421 1422 add
1422 1423 </a>
1423 1424 </td><td>
1424 1425 add the specified files on the next commit
1425 1426 </td></tr>
1426 1427 <tr><td>
1427 1428 <a href="/help/annotate">
1428 1429 annotate
1429 1430 </a>
1430 1431 </td><td>
1431 1432 show changeset information by line for each file
1432 1433 </td></tr>
1433 1434 <tr><td>
1434 1435 <a href="/help/clone">
1435 1436 clone
1436 1437 </a>
1437 1438 </td><td>
1438 1439 make a copy of an existing repository
1439 1440 </td></tr>
1440 1441 <tr><td>
1441 1442 <a href="/help/commit">
1442 1443 commit
1443 1444 </a>
1444 1445 </td><td>
1445 1446 commit the specified files or all outstanding changes
1446 1447 </td></tr>
1447 1448 <tr><td>
1448 1449 <a href="/help/diff">
1449 1450 diff
1450 1451 </a>
1451 1452 </td><td>
1452 1453 diff repository (or selected files)
1453 1454 </td></tr>
1454 1455 <tr><td>
1455 1456 <a href="/help/export">
1456 1457 export
1457 1458 </a>
1458 1459 </td><td>
1459 1460 dump the header and diffs for one or more changesets
1460 1461 </td></tr>
1461 1462 <tr><td>
1462 1463 <a href="/help/forget">
1463 1464 forget
1464 1465 </a>
1465 1466 </td><td>
1466 1467 forget the specified files on the next commit
1467 1468 </td></tr>
1468 1469 <tr><td>
1469 1470 <a href="/help/init">
1470 1471 init
1471 1472 </a>
1472 1473 </td><td>
1473 1474 create a new repository in the given directory
1474 1475 </td></tr>
1475 1476 <tr><td>
1476 1477 <a href="/help/log">
1477 1478 log
1478 1479 </a>
1479 1480 </td><td>
1480 1481 show revision history of entire repository or files
1481 1482 </td></tr>
1482 1483 <tr><td>
1483 1484 <a href="/help/merge">
1484 1485 merge
1485 1486 </a>
1486 1487 </td><td>
1487 1488 merge another revision into working directory
1488 1489 </td></tr>
1489 1490 <tr><td>
1490 1491 <a href="/help/pull">
1491 1492 pull
1492 1493 </a>
1493 1494 </td><td>
1494 1495 pull changes from the specified source
1495 1496 </td></tr>
1496 1497 <tr><td>
1497 1498 <a href="/help/push">
1498 1499 push
1499 1500 </a>
1500 1501 </td><td>
1501 1502 push changes to the specified destination
1502 1503 </td></tr>
1503 1504 <tr><td>
1504 1505 <a href="/help/remove">
1505 1506 remove
1506 1507 </a>
1507 1508 </td><td>
1508 1509 remove the specified files on the next commit
1509 1510 </td></tr>
1510 1511 <tr><td>
1511 1512 <a href="/help/serve">
1512 1513 serve
1513 1514 </a>
1514 1515 </td><td>
1515 1516 start stand-alone webserver
1516 1517 </td></tr>
1517 1518 <tr><td>
1518 1519 <a href="/help/status">
1519 1520 status
1520 1521 </a>
1521 1522 </td><td>
1522 1523 show changed files in the working directory
1523 1524 </td></tr>
1524 1525 <tr><td>
1525 1526 <a href="/help/summary">
1526 1527 summary
1527 1528 </a>
1528 1529 </td><td>
1529 1530 summarize working directory state
1530 1531 </td></tr>
1531 1532 <tr><td>
1532 1533 <a href="/help/update">
1533 1534 update
1534 1535 </a>
1535 1536 </td><td>
1536 1537 update working directory (or switch revisions)
1537 1538 </td></tr>
1538 1539
1539 1540 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1540 1541
1541 1542 <tr><td>
1542 1543 <a href="/help/addremove">
1543 1544 addremove
1544 1545 </a>
1545 1546 </td><td>
1546 1547 add all new files, delete all missing files
1547 1548 </td></tr>
1548 1549 <tr><td>
1549 1550 <a href="/help/archive">
1550 1551 archive
1551 1552 </a>
1552 1553 </td><td>
1553 1554 create an unversioned archive of a repository revision
1554 1555 </td></tr>
1555 1556 <tr><td>
1556 1557 <a href="/help/backout">
1557 1558 backout
1558 1559 </a>
1559 1560 </td><td>
1560 1561 reverse effect of earlier changeset
1561 1562 </td></tr>
1562 1563 <tr><td>
1563 1564 <a href="/help/bisect">
1564 1565 bisect
1565 1566 </a>
1566 1567 </td><td>
1567 1568 subdivision search of changesets
1568 1569 </td></tr>
1569 1570 <tr><td>
1570 1571 <a href="/help/bookmarks">
1571 1572 bookmarks
1572 1573 </a>
1573 1574 </td><td>
1574 1575 create a new bookmark or list existing bookmarks
1575 1576 </td></tr>
1576 1577 <tr><td>
1577 1578 <a href="/help/branch">
1578 1579 branch
1579 1580 </a>
1580 1581 </td><td>
1581 1582 set or show the current branch name
1582 1583 </td></tr>
1583 1584 <tr><td>
1584 1585 <a href="/help/branches">
1585 1586 branches
1586 1587 </a>
1587 1588 </td><td>
1588 1589 list repository named branches
1589 1590 </td></tr>
1590 1591 <tr><td>
1591 1592 <a href="/help/bundle">
1592 1593 bundle
1593 1594 </a>
1594 1595 </td><td>
1595 1596 create a changegroup file
1596 1597 </td></tr>
1597 1598 <tr><td>
1598 1599 <a href="/help/cat">
1599 1600 cat
1600 1601 </a>
1601 1602 </td><td>
1602 1603 output the current or given revision of files
1603 1604 </td></tr>
1604 1605 <tr><td>
1605 1606 <a href="/help/config">
1606 1607 config
1607 1608 </a>
1608 1609 </td><td>
1609 1610 show combined config settings from all hgrc files
1610 1611 </td></tr>
1611 1612 <tr><td>
1612 1613 <a href="/help/copy">
1613 1614 copy
1614 1615 </a>
1615 1616 </td><td>
1616 1617 mark files as copied for the next commit
1617 1618 </td></tr>
1618 1619 <tr><td>
1619 1620 <a href="/help/files">
1620 1621 files
1621 1622 </a>
1622 1623 </td><td>
1623 1624 list tracked files
1624 1625 </td></tr>
1625 1626 <tr><td>
1626 1627 <a href="/help/graft">
1627 1628 graft
1628 1629 </a>
1629 1630 </td><td>
1630 1631 copy changes from other branches onto the current branch
1631 1632 </td></tr>
1632 1633 <tr><td>
1633 1634 <a href="/help/grep">
1634 1635 grep
1635 1636 </a>
1636 1637 </td><td>
1637 1638 search for a pattern in specified files and revisions
1638 1639 </td></tr>
1639 1640 <tr><td>
1640 1641 <a href="/help/heads">
1641 1642 heads
1642 1643 </a>
1643 1644 </td><td>
1644 1645 show branch heads
1645 1646 </td></tr>
1646 1647 <tr><td>
1647 1648 <a href="/help/help">
1648 1649 help
1649 1650 </a>
1650 1651 </td><td>
1651 1652 show help for a given topic or a help overview
1652 1653 </td></tr>
1653 1654 <tr><td>
1654 1655 <a href="/help/identify">
1655 1656 identify
1656 1657 </a>
1657 1658 </td><td>
1658 1659 identify the working copy or specified revision
1659 1660 </td></tr>
1660 1661 <tr><td>
1661 1662 <a href="/help/import">
1662 1663 import
1663 1664 </a>
1664 1665 </td><td>
1665 1666 import an ordered set of patches
1666 1667 </td></tr>
1667 1668 <tr><td>
1668 1669 <a href="/help/incoming">
1669 1670 incoming
1670 1671 </a>
1671 1672 </td><td>
1672 1673 show new changesets found in source
1673 1674 </td></tr>
1674 1675 <tr><td>
1675 1676 <a href="/help/manifest">
1676 1677 manifest
1677 1678 </a>
1678 1679 </td><td>
1679 1680 output the current or given revision of the project manifest
1680 1681 </td></tr>
1681 1682 <tr><td>
1682 1683 <a href="/help/nohelp">
1683 1684 nohelp
1684 1685 </a>
1685 1686 </td><td>
1686 1687 (no help text available)
1687 1688 </td></tr>
1688 1689 <tr><td>
1689 1690 <a href="/help/outgoing">
1690 1691 outgoing
1691 1692 </a>
1692 1693 </td><td>
1693 1694 show changesets not found in the destination
1694 1695 </td></tr>
1695 1696 <tr><td>
1696 1697 <a href="/help/paths">
1697 1698 paths
1698 1699 </a>
1699 1700 </td><td>
1700 1701 show aliases for remote repositories
1701 1702 </td></tr>
1702 1703 <tr><td>
1703 1704 <a href="/help/phase">
1704 1705 phase
1705 1706 </a>
1706 1707 </td><td>
1707 1708 set or show the current phase name
1708 1709 </td></tr>
1709 1710 <tr><td>
1710 1711 <a href="/help/recover">
1711 1712 recover
1712 1713 </a>
1713 1714 </td><td>
1714 1715 roll back an interrupted transaction
1715 1716 </td></tr>
1716 1717 <tr><td>
1717 1718 <a href="/help/rename">
1718 1719 rename
1719 1720 </a>
1720 1721 </td><td>
1721 1722 rename files; equivalent of copy + remove
1722 1723 </td></tr>
1723 1724 <tr><td>
1724 1725 <a href="/help/resolve">
1725 1726 resolve
1726 1727 </a>
1727 1728 </td><td>
1728 1729 redo merges or set/view the merge status of files
1729 1730 </td></tr>
1730 1731 <tr><td>
1731 1732 <a href="/help/revert">
1732 1733 revert
1733 1734 </a>
1734 1735 </td><td>
1735 1736 restore files to their checkout state
1736 1737 </td></tr>
1737 1738 <tr><td>
1738 1739 <a href="/help/root">
1739 1740 root
1740 1741 </a>
1741 1742 </td><td>
1742 1743 print the root (top) of the current working directory
1743 1744 </td></tr>
1744 1745 <tr><td>
1745 1746 <a href="/help/tag">
1746 1747 tag
1747 1748 </a>
1748 1749 </td><td>
1749 1750 add one or more tags for the current or given revision
1750 1751 </td></tr>
1751 1752 <tr><td>
1752 1753 <a href="/help/tags">
1753 1754 tags
1754 1755 </a>
1755 1756 </td><td>
1756 1757 list repository tags
1757 1758 </td></tr>
1758 1759 <tr><td>
1759 1760 <a href="/help/unbundle">
1760 1761 unbundle
1761 1762 </a>
1762 1763 </td><td>
1763 1764 apply one or more changegroup files
1764 1765 </td></tr>
1765 1766 <tr><td>
1766 1767 <a href="/help/verify">
1767 1768 verify
1768 1769 </a>
1769 1770 </td><td>
1770 1771 verify the integrity of the repository
1771 1772 </td></tr>
1772 1773 <tr><td>
1773 1774 <a href="/help/version">
1774 1775 version
1775 1776 </a>
1776 1777 </td><td>
1777 1778 output version and copyright information
1778 1779 </td></tr>
1779 1780 </table>
1780 1781 </div>
1781 1782 </div>
1782 1783
1783 1784 <script type="text/javascript">process_dates()</script>
1784 1785
1785 1786
1786 1787 </body>
1787 1788 </html>
1788 1789
1789 1790
1790 1791 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
1791 1792 200 Script output follows
1792 1793
1793 1794 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1794 1795 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1795 1796 <head>
1796 1797 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1797 1798 <meta name="robots" content="index, nofollow" />
1798 1799 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1799 1800 <script type="text/javascript" src="/static/mercurial.js"></script>
1800 1801
1801 1802 <title>Help: add</title>
1802 1803 </head>
1803 1804 <body>
1804 1805
1805 1806 <div class="container">
1806 1807 <div class="menu">
1807 1808 <div class="logo">
1808 1809 <a href="http://mercurial.selenic.com/">
1809 1810 <img src="/static/hglogo.png" alt="mercurial" /></a>
1810 1811 </div>
1811 1812 <ul>
1812 1813 <li><a href="/shortlog">log</a></li>
1813 1814 <li><a href="/graph">graph</a></li>
1814 1815 <li><a href="/tags">tags</a></li>
1815 1816 <li><a href="/bookmarks">bookmarks</a></li>
1816 1817 <li><a href="/branches">branches</a></li>
1817 1818 </ul>
1818 1819 <ul>
1819 1820 <li class="active"><a href="/help">help</a></li>
1820 1821 </ul>
1821 1822 </div>
1822 1823
1823 1824 <div class="main">
1824 1825 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1825 1826 <h3>Help: add</h3>
1826 1827
1827 1828 <form class="search" action="/log">
1828 1829
1829 1830 <p><input name="rev" id="search1" type="text" size="30" /></p>
1830 1831 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1831 1832 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1832 1833 </form>
1833 1834 <div id="doc">
1834 1835 <p>
1835 1836 hg add [OPTION]... [FILE]...
1836 1837 </p>
1837 1838 <p>
1838 1839 add the specified files on the next commit
1839 1840 </p>
1840 1841 <p>
1841 1842 Schedule files to be version controlled and added to the
1842 1843 repository.
1843 1844 </p>
1844 1845 <p>
1845 1846 The files will be added to the repository at the next commit. To
1846 1847 undo an add before that, see &quot;hg forget&quot;.
1847 1848 </p>
1848 1849 <p>
1849 1850 If no names are given, add all files to the repository.
1850 1851 </p>
1851 1852 <p>
1852 1853 An example showing how new (unknown) files are added
1853 1854 automatically by &quot;hg add&quot;:
1854 1855 </p>
1855 1856 <pre>
1856 1857 \$ ls (re)
1857 1858 foo.c
1858 1859 \$ hg status (re)
1859 1860 ? foo.c
1860 1861 \$ hg add (re)
1861 1862 adding foo.c
1862 1863 \$ hg status (re)
1863 1864 A foo.c
1864 1865 </pre>
1865 1866 <p>
1866 1867 Returns 0 if all files are successfully added.
1867 1868 </p>
1868 1869 <p>
1869 1870 options ([+] can be repeated):
1870 1871 </p>
1871 1872 <table>
1872 1873 <tr><td>-I</td>
1873 1874 <td>--include PATTERN [+]</td>
1874 1875 <td>include names matching the given patterns</td></tr>
1875 1876 <tr><td>-X</td>
1876 1877 <td>--exclude PATTERN [+]</td>
1877 1878 <td>exclude names matching the given patterns</td></tr>
1878 1879 <tr><td>-S</td>
1879 1880 <td>--subrepos</td>
1880 1881 <td>recurse into subrepositories</td></tr>
1881 1882 <tr><td>-n</td>
1882 1883 <td>--dry-run</td>
1883 1884 <td>do not perform actions, just print output</td></tr>
1884 1885 </table>
1885 1886 <p>
1886 1887 global options ([+] can be repeated):
1887 1888 </p>
1888 1889 <table>
1889 1890 <tr><td>-R</td>
1890 1891 <td>--repository REPO</td>
1891 1892 <td>repository root directory or name of overlay bundle file</td></tr>
1892 1893 <tr><td></td>
1893 1894 <td>--cwd DIR</td>
1894 1895 <td>change working directory</td></tr>
1895 1896 <tr><td>-y</td>
1896 1897 <td>--noninteractive</td>
1897 1898 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
1898 1899 <tr><td>-q</td>
1899 1900 <td>--quiet</td>
1900 1901 <td>suppress output</td></tr>
1901 1902 <tr><td>-v</td>
1902 1903 <td>--verbose</td>
1903 1904 <td>enable additional output</td></tr>
1904 1905 <tr><td></td>
1905 1906 <td>--config CONFIG [+]</td>
1906 1907 <td>set/override config option (use 'section.name=value')</td></tr>
1907 1908 <tr><td></td>
1908 1909 <td>--debug</td>
1909 1910 <td>enable debugging output</td></tr>
1910 1911 <tr><td></td>
1911 1912 <td>--debugger</td>
1912 1913 <td>start debugger</td></tr>
1913 1914 <tr><td></td>
1914 1915 <td>--encoding ENCODE</td>
1915 1916 <td>set the charset encoding (default: ascii)</td></tr>
1916 1917 <tr><td></td>
1917 1918 <td>--encodingmode MODE</td>
1918 1919 <td>set the charset encoding mode (default: strict)</td></tr>
1919 1920 <tr><td></td>
1920 1921 <td>--traceback</td>
1921 1922 <td>always print a traceback on exception</td></tr>
1922 1923 <tr><td></td>
1923 1924 <td>--time</td>
1924 1925 <td>time how long the command takes</td></tr>
1925 1926 <tr><td></td>
1926 1927 <td>--profile</td>
1927 1928 <td>print command execution profile</td></tr>
1928 1929 <tr><td></td>
1929 1930 <td>--version</td>
1930 1931 <td>output version information and exit</td></tr>
1931 1932 <tr><td>-h</td>
1932 1933 <td>--help</td>
1933 1934 <td>display help and exit</td></tr>
1934 1935 <tr><td></td>
1935 1936 <td>--hidden</td>
1936 1937 <td>consider hidden changesets</td></tr>
1937 1938 </table>
1938 1939
1939 1940 </div>
1940 1941 </div>
1941 1942 </div>
1942 1943
1943 1944 <script type="text/javascript">process_dates()</script>
1944 1945
1945 1946
1946 1947 </body>
1947 1948 </html>
1948 1949
1949 1950
1950 1951 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
1951 1952 200 Script output follows
1952 1953
1953 1954 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1954 1955 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1955 1956 <head>
1956 1957 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1957 1958 <meta name="robots" content="index, nofollow" />
1958 1959 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1959 1960 <script type="text/javascript" src="/static/mercurial.js"></script>
1960 1961
1961 1962 <title>Help: remove</title>
1962 1963 </head>
1963 1964 <body>
1964 1965
1965 1966 <div class="container">
1966 1967 <div class="menu">
1967 1968 <div class="logo">
1968 1969 <a href="http://mercurial.selenic.com/">
1969 1970 <img src="/static/hglogo.png" alt="mercurial" /></a>
1970 1971 </div>
1971 1972 <ul>
1972 1973 <li><a href="/shortlog">log</a></li>
1973 1974 <li><a href="/graph">graph</a></li>
1974 1975 <li><a href="/tags">tags</a></li>
1975 1976 <li><a href="/bookmarks">bookmarks</a></li>
1976 1977 <li><a href="/branches">branches</a></li>
1977 1978 </ul>
1978 1979 <ul>
1979 1980 <li class="active"><a href="/help">help</a></li>
1980 1981 </ul>
1981 1982 </div>
1982 1983
1983 1984 <div class="main">
1984 1985 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1985 1986 <h3>Help: remove</h3>
1986 1987
1987 1988 <form class="search" action="/log">
1988 1989
1989 1990 <p><input name="rev" id="search1" type="text" size="30" /></p>
1990 1991 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1991 1992 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1992 1993 </form>
1993 1994 <div id="doc">
1994 1995 <p>
1995 1996 hg remove [OPTION]... FILE...
1996 1997 </p>
1997 1998 <p>
1998 1999 aliases: rm
1999 2000 </p>
2000 2001 <p>
2001 2002 remove the specified files on the next commit
2002 2003 </p>
2003 2004 <p>
2004 2005 Schedule the indicated files for removal from the current branch.
2005 2006 </p>
2006 2007 <p>
2007 2008 This command schedules the files to be removed at the next commit.
2008 2009 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2009 2010 files, see &quot;hg forget&quot;.
2010 2011 </p>
2011 2012 <p>
2012 2013 -A/--after can be used to remove only files that have already
2013 2014 been deleted, -f/--force can be used to force deletion, and -Af
2014 2015 can be used to remove files from the next revision without
2015 2016 deleting them from the working directory.
2016 2017 </p>
2017 2018 <p>
2018 2019 The following table details the behavior of remove for different
2019 2020 file states (columns) and option combinations (rows). The file
2020 2021 states are Added [A], Clean [C], Modified [M] and Missing [!]
2021 2022 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2022 2023 (from branch) and Delete (from disk):
2023 2024 </p>
2024 2025 <table>
2025 2026 <tr><td>opt/state</td>
2026 2027 <td>A</td>
2027 2028 <td>C</td>
2028 2029 <td>M</td>
2029 2030 <td>!</td></tr>
2030 2031 <tr><td>none</td>
2031 2032 <td>W</td>
2032 2033 <td>RD</td>
2033 2034 <td>W</td>
2034 2035 <td>R</td></tr>
2035 2036 <tr><td>-f</td>
2036 2037 <td>R</td>
2037 2038 <td>RD</td>
2038 2039 <td>RD</td>
2039 2040 <td>R</td></tr>
2040 2041 <tr><td>-A</td>
2041 2042 <td>W</td>
2042 2043 <td>W</td>
2043 2044 <td>W</td>
2044 2045 <td>R</td></tr>
2045 2046 <tr><td>-Af</td>
2046 2047 <td>R</td>
2047 2048 <td>R</td>
2048 2049 <td>R</td>
2049 2050 <td>R</td></tr>
2050 2051 </table>
2051 2052 <p>
2052 2053 Note that remove never deletes files in Added [A] state from the
2053 2054 working directory, not even if option --force is specified.
2054 2055 </p>
2055 2056 <p>
2056 2057 Returns 0 on success, 1 if any warnings encountered.
2057 2058 </p>
2058 2059 <p>
2059 2060 options ([+] can be repeated):
2060 2061 </p>
2061 2062 <table>
2062 2063 <tr><td>-A</td>
2063 2064 <td>--after</td>
2064 2065 <td>record delete for missing files</td></tr>
2065 2066 <tr><td>-f</td>
2066 2067 <td>--force</td>
2067 2068 <td>remove (and delete) file even if added or modified</td></tr>
2068 2069 <tr><td>-S</td>
2069 2070 <td>--subrepos</td>
2070 2071 <td>recurse into subrepositories</td></tr>
2071 2072 <tr><td>-I</td>
2072 2073 <td>--include PATTERN [+]</td>
2073 2074 <td>include names matching the given patterns</td></tr>
2074 2075 <tr><td>-X</td>
2075 2076 <td>--exclude PATTERN [+]</td>
2076 2077 <td>exclude names matching the given patterns</td></tr>
2077 2078 </table>
2078 2079 <p>
2079 2080 global options ([+] can be repeated):
2080 2081 </p>
2081 2082 <table>
2082 2083 <tr><td>-R</td>
2083 2084 <td>--repository REPO</td>
2084 2085 <td>repository root directory or name of overlay bundle file</td></tr>
2085 2086 <tr><td></td>
2086 2087 <td>--cwd DIR</td>
2087 2088 <td>change working directory</td></tr>
2088 2089 <tr><td>-y</td>
2089 2090 <td>--noninteractive</td>
2090 2091 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2091 2092 <tr><td>-q</td>
2092 2093 <td>--quiet</td>
2093 2094 <td>suppress output</td></tr>
2094 2095 <tr><td>-v</td>
2095 2096 <td>--verbose</td>
2096 2097 <td>enable additional output</td></tr>
2097 2098 <tr><td></td>
2098 2099 <td>--config CONFIG [+]</td>
2099 2100 <td>set/override config option (use 'section.name=value')</td></tr>
2100 2101 <tr><td></td>
2101 2102 <td>--debug</td>
2102 2103 <td>enable debugging output</td></tr>
2103 2104 <tr><td></td>
2104 2105 <td>--debugger</td>
2105 2106 <td>start debugger</td></tr>
2106 2107 <tr><td></td>
2107 2108 <td>--encoding ENCODE</td>
2108 2109 <td>set the charset encoding (default: ascii)</td></tr>
2109 2110 <tr><td></td>
2110 2111 <td>--encodingmode MODE</td>
2111 2112 <td>set the charset encoding mode (default: strict)</td></tr>
2112 2113 <tr><td></td>
2113 2114 <td>--traceback</td>
2114 2115 <td>always print a traceback on exception</td></tr>
2115 2116 <tr><td></td>
2116 2117 <td>--time</td>
2117 2118 <td>time how long the command takes</td></tr>
2118 2119 <tr><td></td>
2119 2120 <td>--profile</td>
2120 2121 <td>print command execution profile</td></tr>
2121 2122 <tr><td></td>
2122 2123 <td>--version</td>
2123 2124 <td>output version information and exit</td></tr>
2124 2125 <tr><td>-h</td>
2125 2126 <td>--help</td>
2126 2127 <td>display help and exit</td></tr>
2127 2128 <tr><td></td>
2128 2129 <td>--hidden</td>
2129 2130 <td>consider hidden changesets</td></tr>
2130 2131 </table>
2131 2132
2132 2133 </div>
2133 2134 </div>
2134 2135 </div>
2135 2136
2136 2137 <script type="text/javascript">process_dates()</script>
2137 2138
2138 2139
2139 2140 </body>
2140 2141 </html>
2141 2142
2142 2143
2143 2144 $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
2144 2145 200 Script output follows
2145 2146
2146 2147 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2147 2148 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2148 2149 <head>
2149 2150 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2150 2151 <meta name="robots" content="index, nofollow" />
2151 2152 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2152 2153 <script type="text/javascript" src="/static/mercurial.js"></script>
2153 2154
2154 2155 <title>Help: revisions</title>
2155 2156 </head>
2156 2157 <body>
2157 2158
2158 2159 <div class="container">
2159 2160 <div class="menu">
2160 2161 <div class="logo">
2161 2162 <a href="http://mercurial.selenic.com/">
2162 2163 <img src="/static/hglogo.png" alt="mercurial" /></a>
2163 2164 </div>
2164 2165 <ul>
2165 2166 <li><a href="/shortlog">log</a></li>
2166 2167 <li><a href="/graph">graph</a></li>
2167 2168 <li><a href="/tags">tags</a></li>
2168 2169 <li><a href="/bookmarks">bookmarks</a></li>
2169 2170 <li><a href="/branches">branches</a></li>
2170 2171 </ul>
2171 2172 <ul>
2172 2173 <li class="active"><a href="/help">help</a></li>
2173 2174 </ul>
2174 2175 </div>
2175 2176
2176 2177 <div class="main">
2177 2178 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2178 2179 <h3>Help: revisions</h3>
2179 2180
2180 2181 <form class="search" action="/log">
2181 2182
2182 2183 <p><input name="rev" id="search1" type="text" size="30" /></p>
2183 2184 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2184 2185 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2185 2186 </form>
2186 2187 <div id="doc">
2187 2188 <h1>Specifying Single Revisions</h1>
2188 2189 <p>
2189 2190 Mercurial supports several ways to specify individual revisions.
2190 2191 </p>
2191 2192 <p>
2192 2193 A plain integer is treated as a revision number. Negative integers are
2193 2194 treated as sequential offsets from the tip, with -1 denoting the tip,
2194 2195 -2 denoting the revision prior to the tip, and so forth.
2195 2196 </p>
2196 2197 <p>
2197 2198 A 40-digit hexadecimal string is treated as a unique revision
2198 2199 identifier.
2199 2200 </p>
2200 2201 <p>
2201 2202 A hexadecimal string less than 40 characters long is treated as a
2202 2203 unique revision identifier and is referred to as a short-form
2203 2204 identifier. A short-form identifier is only valid if it is the prefix
2204 2205 of exactly one full-length identifier.
2205 2206 </p>
2206 2207 <p>
2207 2208 Any other string is treated as a bookmark, tag, or branch name. A
2208 2209 bookmark is a movable pointer to a revision. A tag is a permanent name
2209 2210 associated with a revision. A branch name denotes the tipmost open branch head
2210 2211 of that branch - or if they are all closed, the tipmost closed head of the
2211 2212 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2212 2213 </p>
2213 2214 <p>
2214 2215 The reserved name &quot;tip&quot; always identifies the most recent revision.
2215 2216 </p>
2216 2217 <p>
2217 2218 The reserved name &quot;null&quot; indicates the null revision. This is the
2218 2219 revision of an empty repository, and the parent of revision 0.
2219 2220 </p>
2220 2221 <p>
2221 2222 The reserved name &quot;.&quot; indicates the working directory parent. If no
2222 2223 working directory is checked out, it is equivalent to null. If an
2223 2224 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2224 2225 parent.
2225 2226 </p>
2226 2227
2227 2228 </div>
2228 2229 </div>
2229 2230 </div>
2230 2231
2231 2232 <script type="text/javascript">process_dates()</script>
2232 2233
2233 2234
2234 2235 </body>
2235 2236 </html>
2236 2237
2237 2238
2238 2239 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
2239 2240
2240 2241 #endif
General Comments 0
You need to be logged in to leave comments. Login now