##// END OF EJS Templates
clonebundles: support for seeding clones from pre-generated bundles...
Gregory Szorc -
r26623:5a95fe44 default
parent child Browse files
Show More
@@ -0,0 +1,69 b''
1 # This software may be used and distributed according to the terms of the
2 # GNU General Public License version 2 or any later version.
3
4 """server side extension to advertise pre-generated bundles to seed clones.
5
6 The extension essentially serves the content of a .hg/clonebundles.manifest
7 file to clients that request it.
8
9 The clonebundles.manifest file contains a list of URLs and attributes. URLs
10 hold pre-generated bundles that a client fetches and applies. After applying
11 the pre-generated bundle, the client will connect back to the original server
12 and pull data not in the pre-generated bundle.
13
14 Manifest File Format:
15
16 The manifest file contains a newline (\n) delimited list of entries.
17
18 Each line in this file defines an available bundle. Lines have the format:
19
20 <URL> [<key>=<value]
21
22 That is, a URL followed by extra metadata describing it. Metadata keys and
23 values should be URL encoded.
24
25 This metadata is optional. It is up to server operators to populate this
26 metadata.
27
28 Keys in UPPERCASE are reserved for use by Mercurial. All non-uppercase keys
29 can be used by site installations.
30
31 The server operator is responsible for generating the bundle manifest file.
32
33 Metadata Attributes:
34
35 TBD
36 """
37
38 from mercurial import (
39 extensions,
40 wireproto,
41 )
42
43 testedwith = 'internal'
44
45 def capabilities(orig, repo, proto):
46 caps = orig(repo, proto)
47
48 # Only advertise if a manifest exists. This does add some I/O to requests.
49 # But this should be cheaper than a wasted network round trip due to
50 # missing file.
51 if repo.opener.exists('clonebundles.manifest'):
52 caps.append('clonebundles')
53
54 return caps
55
56 @wireproto.wireprotocommand('clonebundles', '')
57 def bundles(repo, proto):
58 """Server command for returning info for available bundles to seed clones.
59
60 Clients will parse this response and determine what bundle to fetch.
61
62 Other extensions may wrap this command to filter or dynamically emit
63 data depending on the request. e.g. you could advertise URLs for
64 the closest data center given the client's IP address.
65 """
66 return repo.opener.tryread('clonebundles.manifest')
67
68 def extsetup(ui):
69 extensions.wrapfunction(wireproto, '_capabilities', capabilities)
@@ -0,0 +1,143 b''
1 Set up a server
2
3 $ hg init server
4 $ cd server
5 $ cat >> .hg/hgrc << EOF
6 > [extensions]
7 > clonebundles =
8 > EOF
9
10 $ touch foo
11 $ hg -q commit -A -m 'add foo'
12 $ touch bar
13 $ hg -q commit -A -m 'add bar'
14
15 $ hg serve -d -p $HGPORT --pid-file hg.pid --accesslog access.log
16 $ cat hg.pid >> $DAEMON_PIDS
17 $ cd ..
18
19 Feature disabled by default
20 (client should not request manifest)
21
22 $ hg clone -U http://localhost:$HGPORT feature-disabled
23 requesting all changes
24 adding changesets
25 adding manifests
26 adding file changes
27 added 2 changesets with 2 changes to 2 files
28
29 $ cat server/access.log
30 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
31 * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
32 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob)
33 * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob)
34
35 $ cat >> $HGRCPATH << EOF
36 > [experimental]
37 > clonebundles = true
38 > EOF
39
40 Missing manifest should not result in server lookup
41
42 $ hg --verbose clone -U http://localhost:$HGPORT no-manifest
43 requesting all changes
44 adding changesets
45 adding manifests
46 adding file changes
47 added 2 changesets with 2 changes to 2 files
48
49 $ tail -4 server/access.log
50 * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob)
51 * - - [*] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D (glob)
52 * - - [*] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bundlecaps=HG20%2Cbundle2%3DHG20%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=1&common=0000000000000000000000000000000000000000&heads=aaff8d2ffbbf07a46dd1f05d8ae7877e3f56e2a2&listkeys=phase%2Cbookmarks (glob)
53 * - - [*] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases (glob)
54
55 Empty manifest file results in retrieval
56 (the extension only checks if the manifest file exists)
57
58 $ touch server/.hg/clonebundles.manifest
59 $ hg --verbose clone -U http://localhost:$HGPORT empty-manifest
60 no clone bundles available on remote; falling back to regular clone
61 requesting all changes
62 adding changesets
63 adding manifests
64 adding file changes
65 added 2 changesets with 2 changes to 2 files
66
67 Manifest file with invalid URL aborts
68
69 $ echo 'http://does.not.exist/bundle.hg' > server/.hg/clonebundles.manifest
70 $ hg clone http://localhost:$HGPORT 404-url
71 applying clone bundle from http://does.not.exist/bundle.hg
72 error fetching bundle: [Errno -2] Name or service not known
73 abort: error applying bundle
74 (consider contacting the server operator if this error persists)
75 [255]
76
77 Server is not running aborts
78
79 $ echo "http://localhost:$HGPORT1/bundle.hg" > server/.hg/clonebundles.manifest
80 $ hg clone http://localhost:$HGPORT server-not-runner
81 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
82 error fetching bundle: [Errno 111] Connection refused
83 abort: error applying bundle
84 (consider contacting the server operator if this error persists)
85 [255]
86
87 Server returns 404
88
89 $ python $TESTDIR/dumbhttp.py -p $HGPORT1 --pid http.pid
90 $ cat http.pid >> $DAEMON_PIDS
91 $ hg clone http://localhost:$HGPORT running-404
92 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
93 HTTP error fetching bundle: HTTP Error 404: File not found
94 abort: error applying bundle
95 (consider contacting the server operator if this error persists)
96 [255]
97
98 We can override failure to fall back to regular clone
99
100 $ hg --config ui.clonebundlefallback=true clone -U http://localhost:$HGPORT 404-fallback
101 applying clone bundle from http://localhost:$HGPORT1/bundle.hg
102 HTTP error fetching bundle: HTTP Error 404: File not found
103 falling back to normal clone
104 requesting all changes
105 adding changesets
106 adding manifests
107 adding file changes
108 added 2 changesets with 2 changes to 2 files
109
110 Bundle with partial content works
111
112 $ hg -R server bundle --type gzip --base null -r 53245c60e682 partial.hg
113 1 changesets found
114
115 $ echo "http://localhost:$HGPORT1/partial.hg" > server/.hg/clonebundles.manifest
116 $ hg clone -U http://localhost:$HGPORT partial-bundle
117 applying clone bundle from http://localhost:$HGPORT1/partial.hg
118 adding changesets
119 adding manifests
120 adding file changes
121 added 1 changesets with 1 changes to 1 files
122 finished applying clone bundle
123 searching for changes
124 adding changesets
125 adding manifests
126 adding file changes
127 added 1 changesets with 1 changes to 1 files
128
129 Bundle with full content works
130
131 $ hg -R server bundle --type gzip --base null -r tip full.hg
132 2 changesets found
133
134 $ echo "http://localhost:$HGPORT1/full.hg" > server/.hg/clonebundles.manifest
135 $ hg clone -U http://localhost:$HGPORT full-bundle
136 applying clone bundle from http://localhost:$HGPORT1/full.hg
137 adding changesets
138 adding manifests
139 adding file changes
140 added 2 changesets with 2 changes to 2 files
141 finished applying clone bundle
142 searching for changes
143 no changes found
@@ -1,1501 +1,1590 b''
1 # exchange.py - utility to exchange data between repos.
1 # exchange.py - utility to exchange data between repos.
2 #
2 #
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
3 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
4 #
4 #
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from i18n import _
8 from i18n import _
9 from node import hex, nullid
9 from node import hex, nullid
10 import errno, urllib
10 import errno, urllib, urllib2
11 import util, scmutil, changegroup, base85, error
11 import util, scmutil, changegroup, base85, error
12 import discovery, phases, obsolete, bookmarks as bookmod, bundle2, pushkey
12 import discovery, phases, obsolete, bookmarks as bookmod, bundle2, pushkey
13 import lock as lockmod
13 import lock as lockmod
14 import streamclone
14 import streamclone
15 import tags
15 import tags
16 import url as urlmod
16
17
17 def readbundle(ui, fh, fname, vfs=None):
18 def readbundle(ui, fh, fname, vfs=None):
18 header = changegroup.readexactly(fh, 4)
19 header = changegroup.readexactly(fh, 4)
19
20
20 alg = None
21 alg = None
21 if not fname:
22 if not fname:
22 fname = "stream"
23 fname = "stream"
23 if not header.startswith('HG') and header.startswith('\0'):
24 if not header.startswith('HG') and header.startswith('\0'):
24 fh = changegroup.headerlessfixup(fh, header)
25 fh = changegroup.headerlessfixup(fh, header)
25 header = "HG10"
26 header = "HG10"
26 alg = 'UN'
27 alg = 'UN'
27 elif vfs:
28 elif vfs:
28 fname = vfs.join(fname)
29 fname = vfs.join(fname)
29
30
30 magic, version = header[0:2], header[2:4]
31 magic, version = header[0:2], header[2:4]
31
32
32 if magic != 'HG':
33 if magic != 'HG':
33 raise error.Abort(_('%s: not a Mercurial bundle') % fname)
34 raise error.Abort(_('%s: not a Mercurial bundle') % fname)
34 if version == '10':
35 if version == '10':
35 if alg is None:
36 if alg is None:
36 alg = changegroup.readexactly(fh, 2)
37 alg = changegroup.readexactly(fh, 2)
37 return changegroup.cg1unpacker(fh, alg)
38 return changegroup.cg1unpacker(fh, alg)
38 elif version.startswith('2'):
39 elif version.startswith('2'):
39 return bundle2.getunbundler(ui, fh, magicstring=magic + version)
40 return bundle2.getunbundler(ui, fh, magicstring=magic + version)
40 else:
41 else:
41 raise error.Abort(_('%s: unknown bundle version %s') % (fname, version))
42 raise error.Abort(_('%s: unknown bundle version %s') % (fname, version))
42
43
43 def buildobsmarkerspart(bundler, markers):
44 def buildobsmarkerspart(bundler, markers):
44 """add an obsmarker part to the bundler with <markers>
45 """add an obsmarker part to the bundler with <markers>
45
46
46 No part is created if markers is empty.
47 No part is created if markers is empty.
47 Raises ValueError if the bundler doesn't support any known obsmarker format.
48 Raises ValueError if the bundler doesn't support any known obsmarker format.
48 """
49 """
49 if markers:
50 if markers:
50 remoteversions = bundle2.obsmarkersversion(bundler.capabilities)
51 remoteversions = bundle2.obsmarkersversion(bundler.capabilities)
51 version = obsolete.commonversion(remoteversions)
52 version = obsolete.commonversion(remoteversions)
52 if version is None:
53 if version is None:
53 raise ValueError('bundler do not support common obsmarker format')
54 raise ValueError('bundler do not support common obsmarker format')
54 stream = obsolete.encodemarkers(markers, True, version=version)
55 stream = obsolete.encodemarkers(markers, True, version=version)
55 return bundler.newpart('obsmarkers', data=stream)
56 return bundler.newpart('obsmarkers', data=stream)
56 return None
57 return None
57
58
58 def _canusebundle2(op):
59 def _canusebundle2(op):
59 """return true if a pull/push can use bundle2
60 """return true if a pull/push can use bundle2
60
61
61 Feel free to nuke this function when we drop the experimental option"""
62 Feel free to nuke this function when we drop the experimental option"""
62 return (op.repo.ui.configbool('experimental', 'bundle2-exp', True)
63 return (op.repo.ui.configbool('experimental', 'bundle2-exp', True)
63 and op.remote.capable('bundle2'))
64 and op.remote.capable('bundle2'))
64
65
65
66
66 class pushoperation(object):
67 class pushoperation(object):
67 """A object that represent a single push operation
68 """A object that represent a single push operation
68
69
69 It purpose is to carry push related state and very common operation.
70 It purpose is to carry push related state and very common operation.
70
71
71 A new should be created at the beginning of each push and discarded
72 A new should be created at the beginning of each push and discarded
72 afterward.
73 afterward.
73 """
74 """
74
75
75 def __init__(self, repo, remote, force=False, revs=None, newbranch=False,
76 def __init__(self, repo, remote, force=False, revs=None, newbranch=False,
76 bookmarks=()):
77 bookmarks=()):
77 # repo we push from
78 # repo we push from
78 self.repo = repo
79 self.repo = repo
79 self.ui = repo.ui
80 self.ui = repo.ui
80 # repo we push to
81 # repo we push to
81 self.remote = remote
82 self.remote = remote
82 # force option provided
83 # force option provided
83 self.force = force
84 self.force = force
84 # revs to be pushed (None is "all")
85 # revs to be pushed (None is "all")
85 self.revs = revs
86 self.revs = revs
86 # bookmark explicitly pushed
87 # bookmark explicitly pushed
87 self.bookmarks = bookmarks
88 self.bookmarks = bookmarks
88 # allow push of new branch
89 # allow push of new branch
89 self.newbranch = newbranch
90 self.newbranch = newbranch
90 # did a local lock get acquired?
91 # did a local lock get acquired?
91 self.locallocked = None
92 self.locallocked = None
92 # step already performed
93 # step already performed
93 # (used to check what steps have been already performed through bundle2)
94 # (used to check what steps have been already performed through bundle2)
94 self.stepsdone = set()
95 self.stepsdone = set()
95 # Integer version of the changegroup push result
96 # Integer version of the changegroup push result
96 # - None means nothing to push
97 # - None means nothing to push
97 # - 0 means HTTP error
98 # - 0 means HTTP error
98 # - 1 means we pushed and remote head count is unchanged *or*
99 # - 1 means we pushed and remote head count is unchanged *or*
99 # we have outgoing changesets but refused to push
100 # we have outgoing changesets but refused to push
100 # - other values as described by addchangegroup()
101 # - other values as described by addchangegroup()
101 self.cgresult = None
102 self.cgresult = None
102 # Boolean value for the bookmark push
103 # Boolean value for the bookmark push
103 self.bkresult = None
104 self.bkresult = None
104 # discover.outgoing object (contains common and outgoing data)
105 # discover.outgoing object (contains common and outgoing data)
105 self.outgoing = None
106 self.outgoing = None
106 # all remote heads before the push
107 # all remote heads before the push
107 self.remoteheads = None
108 self.remoteheads = None
108 # testable as a boolean indicating if any nodes are missing locally.
109 # testable as a boolean indicating if any nodes are missing locally.
109 self.incoming = None
110 self.incoming = None
110 # phases changes that must be pushed along side the changesets
111 # phases changes that must be pushed along side the changesets
111 self.outdatedphases = None
112 self.outdatedphases = None
112 # phases changes that must be pushed if changeset push fails
113 # phases changes that must be pushed if changeset push fails
113 self.fallbackoutdatedphases = None
114 self.fallbackoutdatedphases = None
114 # outgoing obsmarkers
115 # outgoing obsmarkers
115 self.outobsmarkers = set()
116 self.outobsmarkers = set()
116 # outgoing bookmarks
117 # outgoing bookmarks
117 self.outbookmarks = []
118 self.outbookmarks = []
118 # transaction manager
119 # transaction manager
119 self.trmanager = None
120 self.trmanager = None
120 # map { pushkey partid -> callback handling failure}
121 # map { pushkey partid -> callback handling failure}
121 # used to handle exception from mandatory pushkey part failure
122 # used to handle exception from mandatory pushkey part failure
122 self.pkfailcb = {}
123 self.pkfailcb = {}
123
124
124 @util.propertycache
125 @util.propertycache
125 def futureheads(self):
126 def futureheads(self):
126 """future remote heads if the changeset push succeeds"""
127 """future remote heads if the changeset push succeeds"""
127 return self.outgoing.missingheads
128 return self.outgoing.missingheads
128
129
129 @util.propertycache
130 @util.propertycache
130 def fallbackheads(self):
131 def fallbackheads(self):
131 """future remote heads if the changeset push fails"""
132 """future remote heads if the changeset push fails"""
132 if self.revs is None:
133 if self.revs is None:
133 # not target to push, all common are relevant
134 # not target to push, all common are relevant
134 return self.outgoing.commonheads
135 return self.outgoing.commonheads
135 unfi = self.repo.unfiltered()
136 unfi = self.repo.unfiltered()
136 # I want cheads = heads(::missingheads and ::commonheads)
137 # I want cheads = heads(::missingheads and ::commonheads)
137 # (missingheads is revs with secret changeset filtered out)
138 # (missingheads is revs with secret changeset filtered out)
138 #
139 #
139 # This can be expressed as:
140 # This can be expressed as:
140 # cheads = ( (missingheads and ::commonheads)
141 # cheads = ( (missingheads and ::commonheads)
141 # + (commonheads and ::missingheads))"
142 # + (commonheads and ::missingheads))"
142 # )
143 # )
143 #
144 #
144 # while trying to push we already computed the following:
145 # while trying to push we already computed the following:
145 # common = (::commonheads)
146 # common = (::commonheads)
146 # missing = ((commonheads::missingheads) - commonheads)
147 # missing = ((commonheads::missingheads) - commonheads)
147 #
148 #
148 # We can pick:
149 # We can pick:
149 # * missingheads part of common (::commonheads)
150 # * missingheads part of common (::commonheads)
150 common = self.outgoing.common
151 common = self.outgoing.common
151 nm = self.repo.changelog.nodemap
152 nm = self.repo.changelog.nodemap
152 cheads = [node for node in self.revs if nm[node] in common]
153 cheads = [node for node in self.revs if nm[node] in common]
153 # and
154 # and
154 # * commonheads parents on missing
155 # * commonheads parents on missing
155 revset = unfi.set('%ln and parents(roots(%ln))',
156 revset = unfi.set('%ln and parents(roots(%ln))',
156 self.outgoing.commonheads,
157 self.outgoing.commonheads,
157 self.outgoing.missing)
158 self.outgoing.missing)
158 cheads.extend(c.node() for c in revset)
159 cheads.extend(c.node() for c in revset)
159 return cheads
160 return cheads
160
161
161 @property
162 @property
162 def commonheads(self):
163 def commonheads(self):
163 """set of all common heads after changeset bundle push"""
164 """set of all common heads after changeset bundle push"""
164 if self.cgresult:
165 if self.cgresult:
165 return self.futureheads
166 return self.futureheads
166 else:
167 else:
167 return self.fallbackheads
168 return self.fallbackheads
168
169
169 # mapping of message used when pushing bookmark
170 # mapping of message used when pushing bookmark
170 bookmsgmap = {'update': (_("updating bookmark %s\n"),
171 bookmsgmap = {'update': (_("updating bookmark %s\n"),
171 _('updating bookmark %s failed!\n')),
172 _('updating bookmark %s failed!\n')),
172 'export': (_("exporting bookmark %s\n"),
173 'export': (_("exporting bookmark %s\n"),
173 _('exporting bookmark %s failed!\n')),
174 _('exporting bookmark %s failed!\n')),
174 'delete': (_("deleting remote bookmark %s\n"),
175 'delete': (_("deleting remote bookmark %s\n"),
175 _('deleting remote bookmark %s failed!\n')),
176 _('deleting remote bookmark %s failed!\n')),
176 }
177 }
177
178
178
179
179 def push(repo, remote, force=False, revs=None, newbranch=False, bookmarks=()):
180 def push(repo, remote, force=False, revs=None, newbranch=False, bookmarks=()):
180 '''Push outgoing changesets (limited by revs) from a local
181 '''Push outgoing changesets (limited by revs) from a local
181 repository to remote. Return an integer:
182 repository to remote. Return an integer:
182 - None means nothing to push
183 - None means nothing to push
183 - 0 means HTTP error
184 - 0 means HTTP error
184 - 1 means we pushed and remote head count is unchanged *or*
185 - 1 means we pushed and remote head count is unchanged *or*
185 we have outgoing changesets but refused to push
186 we have outgoing changesets but refused to push
186 - other values as described by addchangegroup()
187 - other values as described by addchangegroup()
187 '''
188 '''
188 pushop = pushoperation(repo, remote, force, revs, newbranch, bookmarks)
189 pushop = pushoperation(repo, remote, force, revs, newbranch, bookmarks)
189 if pushop.remote.local():
190 if pushop.remote.local():
190 missing = (set(pushop.repo.requirements)
191 missing = (set(pushop.repo.requirements)
191 - pushop.remote.local().supported)
192 - pushop.remote.local().supported)
192 if missing:
193 if missing:
193 msg = _("required features are not"
194 msg = _("required features are not"
194 " supported in the destination:"
195 " supported in the destination:"
195 " %s") % (', '.join(sorted(missing)))
196 " %s") % (', '.join(sorted(missing)))
196 raise error.Abort(msg)
197 raise error.Abort(msg)
197
198
198 # there are two ways to push to remote repo:
199 # there are two ways to push to remote repo:
199 #
200 #
200 # addchangegroup assumes local user can lock remote
201 # addchangegroup assumes local user can lock remote
201 # repo (local filesystem, old ssh servers).
202 # repo (local filesystem, old ssh servers).
202 #
203 #
203 # unbundle assumes local user cannot lock remote repo (new ssh
204 # unbundle assumes local user cannot lock remote repo (new ssh
204 # servers, http servers).
205 # servers, http servers).
205
206
206 if not pushop.remote.canpush():
207 if not pushop.remote.canpush():
207 raise error.Abort(_("destination does not support push"))
208 raise error.Abort(_("destination does not support push"))
208 # get local lock as we might write phase data
209 # get local lock as we might write phase data
209 localwlock = locallock = None
210 localwlock = locallock = None
210 try:
211 try:
211 # bundle2 push may receive a reply bundle touching bookmarks or other
212 # bundle2 push may receive a reply bundle touching bookmarks or other
212 # things requiring the wlock. Take it now to ensure proper ordering.
213 # things requiring the wlock. Take it now to ensure proper ordering.
213 maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback')
214 maypushback = pushop.ui.configbool('experimental', 'bundle2.pushback')
214 if _canusebundle2(pushop) and maypushback:
215 if _canusebundle2(pushop) and maypushback:
215 localwlock = pushop.repo.wlock()
216 localwlock = pushop.repo.wlock()
216 locallock = pushop.repo.lock()
217 locallock = pushop.repo.lock()
217 pushop.locallocked = True
218 pushop.locallocked = True
218 except IOError as err:
219 except IOError as err:
219 pushop.locallocked = False
220 pushop.locallocked = False
220 if err.errno != errno.EACCES:
221 if err.errno != errno.EACCES:
221 raise
222 raise
222 # source repo cannot be locked.
223 # source repo cannot be locked.
223 # We do not abort the push, but just disable the local phase
224 # We do not abort the push, but just disable the local phase
224 # synchronisation.
225 # synchronisation.
225 msg = 'cannot lock source repository: %s\n' % err
226 msg = 'cannot lock source repository: %s\n' % err
226 pushop.ui.debug(msg)
227 pushop.ui.debug(msg)
227 try:
228 try:
228 if pushop.locallocked:
229 if pushop.locallocked:
229 pushop.trmanager = transactionmanager(repo,
230 pushop.trmanager = transactionmanager(repo,
230 'push-response',
231 'push-response',
231 pushop.remote.url())
232 pushop.remote.url())
232 pushop.repo.checkpush(pushop)
233 pushop.repo.checkpush(pushop)
233 lock = None
234 lock = None
234 unbundle = pushop.remote.capable('unbundle')
235 unbundle = pushop.remote.capable('unbundle')
235 if not unbundle:
236 if not unbundle:
236 lock = pushop.remote.lock()
237 lock = pushop.remote.lock()
237 try:
238 try:
238 _pushdiscovery(pushop)
239 _pushdiscovery(pushop)
239 if _canusebundle2(pushop):
240 if _canusebundle2(pushop):
240 _pushbundle2(pushop)
241 _pushbundle2(pushop)
241 _pushchangeset(pushop)
242 _pushchangeset(pushop)
242 _pushsyncphase(pushop)
243 _pushsyncphase(pushop)
243 _pushobsolete(pushop)
244 _pushobsolete(pushop)
244 _pushbookmark(pushop)
245 _pushbookmark(pushop)
245 finally:
246 finally:
246 if lock is not None:
247 if lock is not None:
247 lock.release()
248 lock.release()
248 if pushop.trmanager:
249 if pushop.trmanager:
249 pushop.trmanager.close()
250 pushop.trmanager.close()
250 finally:
251 finally:
251 if pushop.trmanager:
252 if pushop.trmanager:
252 pushop.trmanager.release()
253 pushop.trmanager.release()
253 if locallock is not None:
254 if locallock is not None:
254 locallock.release()
255 locallock.release()
255 if localwlock is not None:
256 if localwlock is not None:
256 localwlock.release()
257 localwlock.release()
257
258
258 return pushop
259 return pushop
259
260
260 # list of steps to perform discovery before push
261 # list of steps to perform discovery before push
261 pushdiscoveryorder = []
262 pushdiscoveryorder = []
262
263
263 # Mapping between step name and function
264 # Mapping between step name and function
264 #
265 #
265 # This exists to help extensions wrap steps if necessary
266 # This exists to help extensions wrap steps if necessary
266 pushdiscoverymapping = {}
267 pushdiscoverymapping = {}
267
268
268 def pushdiscovery(stepname):
269 def pushdiscovery(stepname):
269 """decorator for function performing discovery before push
270 """decorator for function performing discovery before push
270
271
271 The function is added to the step -> function mapping and appended to the
272 The function is added to the step -> function mapping and appended to the
272 list of steps. Beware that decorated function will be added in order (this
273 list of steps. Beware that decorated function will be added in order (this
273 may matter).
274 may matter).
274
275
275 You can only use this decorator for a new step, if you want to wrap a step
276 You can only use this decorator for a new step, if you want to wrap a step
276 from an extension, change the pushdiscovery dictionary directly."""
277 from an extension, change the pushdiscovery dictionary directly."""
277 def dec(func):
278 def dec(func):
278 assert stepname not in pushdiscoverymapping
279 assert stepname not in pushdiscoverymapping
279 pushdiscoverymapping[stepname] = func
280 pushdiscoverymapping[stepname] = func
280 pushdiscoveryorder.append(stepname)
281 pushdiscoveryorder.append(stepname)
281 return func
282 return func
282 return dec
283 return dec
283
284
284 def _pushdiscovery(pushop):
285 def _pushdiscovery(pushop):
285 """Run all discovery steps"""
286 """Run all discovery steps"""
286 for stepname in pushdiscoveryorder:
287 for stepname in pushdiscoveryorder:
287 step = pushdiscoverymapping[stepname]
288 step = pushdiscoverymapping[stepname]
288 step(pushop)
289 step(pushop)
289
290
290 @pushdiscovery('changeset')
291 @pushdiscovery('changeset')
291 def _pushdiscoverychangeset(pushop):
292 def _pushdiscoverychangeset(pushop):
292 """discover the changeset that need to be pushed"""
293 """discover the changeset that need to be pushed"""
293 fci = discovery.findcommonincoming
294 fci = discovery.findcommonincoming
294 commoninc = fci(pushop.repo, pushop.remote, force=pushop.force)
295 commoninc = fci(pushop.repo, pushop.remote, force=pushop.force)
295 common, inc, remoteheads = commoninc
296 common, inc, remoteheads = commoninc
296 fco = discovery.findcommonoutgoing
297 fco = discovery.findcommonoutgoing
297 outgoing = fco(pushop.repo, pushop.remote, onlyheads=pushop.revs,
298 outgoing = fco(pushop.repo, pushop.remote, onlyheads=pushop.revs,
298 commoninc=commoninc, force=pushop.force)
299 commoninc=commoninc, force=pushop.force)
299 pushop.outgoing = outgoing
300 pushop.outgoing = outgoing
300 pushop.remoteheads = remoteheads
301 pushop.remoteheads = remoteheads
301 pushop.incoming = inc
302 pushop.incoming = inc
302
303
303 @pushdiscovery('phase')
304 @pushdiscovery('phase')
304 def _pushdiscoveryphase(pushop):
305 def _pushdiscoveryphase(pushop):
305 """discover the phase that needs to be pushed
306 """discover the phase that needs to be pushed
306
307
307 (computed for both success and failure case for changesets push)"""
308 (computed for both success and failure case for changesets push)"""
308 outgoing = pushop.outgoing
309 outgoing = pushop.outgoing
309 unfi = pushop.repo.unfiltered()
310 unfi = pushop.repo.unfiltered()
310 remotephases = pushop.remote.listkeys('phases')
311 remotephases = pushop.remote.listkeys('phases')
311 publishing = remotephases.get('publishing', False)
312 publishing = remotephases.get('publishing', False)
312 if (pushop.ui.configbool('ui', '_usedassubrepo', False)
313 if (pushop.ui.configbool('ui', '_usedassubrepo', False)
313 and remotephases # server supports phases
314 and remotephases # server supports phases
314 and not pushop.outgoing.missing # no changesets to be pushed
315 and not pushop.outgoing.missing # no changesets to be pushed
315 and publishing):
316 and publishing):
316 # When:
317 # When:
317 # - this is a subrepo push
318 # - this is a subrepo push
318 # - and remote support phase
319 # - and remote support phase
319 # - and no changeset are to be pushed
320 # - and no changeset are to be pushed
320 # - and remote is publishing
321 # - and remote is publishing
321 # We may be in issue 3871 case!
322 # We may be in issue 3871 case!
322 # We drop the possible phase synchronisation done by
323 # We drop the possible phase synchronisation done by
323 # courtesy to publish changesets possibly locally draft
324 # courtesy to publish changesets possibly locally draft
324 # on the remote.
325 # on the remote.
325 remotephases = {'publishing': 'True'}
326 remotephases = {'publishing': 'True'}
326 ana = phases.analyzeremotephases(pushop.repo,
327 ana = phases.analyzeremotephases(pushop.repo,
327 pushop.fallbackheads,
328 pushop.fallbackheads,
328 remotephases)
329 remotephases)
329 pheads, droots = ana
330 pheads, droots = ana
330 extracond = ''
331 extracond = ''
331 if not publishing:
332 if not publishing:
332 extracond = ' and public()'
333 extracond = ' and public()'
333 revset = 'heads((%%ln::%%ln) %s)' % extracond
334 revset = 'heads((%%ln::%%ln) %s)' % extracond
334 # Get the list of all revs draft on remote by public here.
335 # Get the list of all revs draft on remote by public here.
335 # XXX Beware that revset break if droots is not strictly
336 # XXX Beware that revset break if droots is not strictly
336 # XXX root we may want to ensure it is but it is costly
337 # XXX root we may want to ensure it is but it is costly
337 fallback = list(unfi.set(revset, droots, pushop.fallbackheads))
338 fallback = list(unfi.set(revset, droots, pushop.fallbackheads))
338 if not outgoing.missing:
339 if not outgoing.missing:
339 future = fallback
340 future = fallback
340 else:
341 else:
341 # adds changeset we are going to push as draft
342 # adds changeset we are going to push as draft
342 #
343 #
343 # should not be necessary for publishing server, but because of an
344 # should not be necessary for publishing server, but because of an
344 # issue fixed in xxxxx we have to do it anyway.
345 # issue fixed in xxxxx we have to do it anyway.
345 fdroots = list(unfi.set('roots(%ln + %ln::)',
346 fdroots = list(unfi.set('roots(%ln + %ln::)',
346 outgoing.missing, droots))
347 outgoing.missing, droots))
347 fdroots = [f.node() for f in fdroots]
348 fdroots = [f.node() for f in fdroots]
348 future = list(unfi.set(revset, fdroots, pushop.futureheads))
349 future = list(unfi.set(revset, fdroots, pushop.futureheads))
349 pushop.outdatedphases = future
350 pushop.outdatedphases = future
350 pushop.fallbackoutdatedphases = fallback
351 pushop.fallbackoutdatedphases = fallback
351
352
352 @pushdiscovery('obsmarker')
353 @pushdiscovery('obsmarker')
353 def _pushdiscoveryobsmarkers(pushop):
354 def _pushdiscoveryobsmarkers(pushop):
354 if (obsolete.isenabled(pushop.repo, obsolete.exchangeopt)
355 if (obsolete.isenabled(pushop.repo, obsolete.exchangeopt)
355 and pushop.repo.obsstore
356 and pushop.repo.obsstore
356 and 'obsolete' in pushop.remote.listkeys('namespaces')):
357 and 'obsolete' in pushop.remote.listkeys('namespaces')):
357 repo = pushop.repo
358 repo = pushop.repo
358 # very naive computation, that can be quite expensive on big repo.
359 # very naive computation, that can be quite expensive on big repo.
359 # However: evolution is currently slow on them anyway.
360 # However: evolution is currently slow on them anyway.
360 nodes = (c.node() for c in repo.set('::%ln', pushop.futureheads))
361 nodes = (c.node() for c in repo.set('::%ln', pushop.futureheads))
361 pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes)
362 pushop.outobsmarkers = pushop.repo.obsstore.relevantmarkers(nodes)
362
363
363 @pushdiscovery('bookmarks')
364 @pushdiscovery('bookmarks')
364 def _pushdiscoverybookmarks(pushop):
365 def _pushdiscoverybookmarks(pushop):
365 ui = pushop.ui
366 ui = pushop.ui
366 repo = pushop.repo.unfiltered()
367 repo = pushop.repo.unfiltered()
367 remote = pushop.remote
368 remote = pushop.remote
368 ui.debug("checking for updated bookmarks\n")
369 ui.debug("checking for updated bookmarks\n")
369 ancestors = ()
370 ancestors = ()
370 if pushop.revs:
371 if pushop.revs:
371 revnums = map(repo.changelog.rev, pushop.revs)
372 revnums = map(repo.changelog.rev, pushop.revs)
372 ancestors = repo.changelog.ancestors(revnums, inclusive=True)
373 ancestors = repo.changelog.ancestors(revnums, inclusive=True)
373 remotebookmark = remote.listkeys('bookmarks')
374 remotebookmark = remote.listkeys('bookmarks')
374
375
375 explicit = set(pushop.bookmarks)
376 explicit = set(pushop.bookmarks)
376
377
377 comp = bookmod.compare(repo, repo._bookmarks, remotebookmark, srchex=hex)
378 comp = bookmod.compare(repo, repo._bookmarks, remotebookmark, srchex=hex)
378 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp
379 addsrc, adddst, advsrc, advdst, diverge, differ, invalid, same = comp
379 for b, scid, dcid in advsrc:
380 for b, scid, dcid in advsrc:
380 if b in explicit:
381 if b in explicit:
381 explicit.remove(b)
382 explicit.remove(b)
382 if not ancestors or repo[scid].rev() in ancestors:
383 if not ancestors or repo[scid].rev() in ancestors:
383 pushop.outbookmarks.append((b, dcid, scid))
384 pushop.outbookmarks.append((b, dcid, scid))
384 # search added bookmark
385 # search added bookmark
385 for b, scid, dcid in addsrc:
386 for b, scid, dcid in addsrc:
386 if b in explicit:
387 if b in explicit:
387 explicit.remove(b)
388 explicit.remove(b)
388 pushop.outbookmarks.append((b, '', scid))
389 pushop.outbookmarks.append((b, '', scid))
389 # search for overwritten bookmark
390 # search for overwritten bookmark
390 for b, scid, dcid in advdst + diverge + differ:
391 for b, scid, dcid in advdst + diverge + differ:
391 if b in explicit:
392 if b in explicit:
392 explicit.remove(b)
393 explicit.remove(b)
393 pushop.outbookmarks.append((b, dcid, scid))
394 pushop.outbookmarks.append((b, dcid, scid))
394 # search for bookmark to delete
395 # search for bookmark to delete
395 for b, scid, dcid in adddst:
396 for b, scid, dcid in adddst:
396 if b in explicit:
397 if b in explicit:
397 explicit.remove(b)
398 explicit.remove(b)
398 # treat as "deleted locally"
399 # treat as "deleted locally"
399 pushop.outbookmarks.append((b, dcid, ''))
400 pushop.outbookmarks.append((b, dcid, ''))
400 # identical bookmarks shouldn't get reported
401 # identical bookmarks shouldn't get reported
401 for b, scid, dcid in same:
402 for b, scid, dcid in same:
402 if b in explicit:
403 if b in explicit:
403 explicit.remove(b)
404 explicit.remove(b)
404
405
405 if explicit:
406 if explicit:
406 explicit = sorted(explicit)
407 explicit = sorted(explicit)
407 # we should probably list all of them
408 # we should probably list all of them
408 ui.warn(_('bookmark %s does not exist on the local '
409 ui.warn(_('bookmark %s does not exist on the local '
409 'or remote repository!\n') % explicit[0])
410 'or remote repository!\n') % explicit[0])
410 pushop.bkresult = 2
411 pushop.bkresult = 2
411
412
412 pushop.outbookmarks.sort()
413 pushop.outbookmarks.sort()
413
414
414 def _pushcheckoutgoing(pushop):
415 def _pushcheckoutgoing(pushop):
415 outgoing = pushop.outgoing
416 outgoing = pushop.outgoing
416 unfi = pushop.repo.unfiltered()
417 unfi = pushop.repo.unfiltered()
417 if not outgoing.missing:
418 if not outgoing.missing:
418 # nothing to push
419 # nothing to push
419 scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)
420 scmutil.nochangesfound(unfi.ui, unfi, outgoing.excluded)
420 return False
421 return False
421 # something to push
422 # something to push
422 if not pushop.force:
423 if not pushop.force:
423 # if repo.obsstore == False --> no obsolete
424 # if repo.obsstore == False --> no obsolete
424 # then, save the iteration
425 # then, save the iteration
425 if unfi.obsstore:
426 if unfi.obsstore:
426 # this message are here for 80 char limit reason
427 # this message are here for 80 char limit reason
427 mso = _("push includes obsolete changeset: %s!")
428 mso = _("push includes obsolete changeset: %s!")
428 mst = {"unstable": _("push includes unstable changeset: %s!"),
429 mst = {"unstable": _("push includes unstable changeset: %s!"),
429 "bumped": _("push includes bumped changeset: %s!"),
430 "bumped": _("push includes bumped changeset: %s!"),
430 "divergent": _("push includes divergent changeset: %s!")}
431 "divergent": _("push includes divergent changeset: %s!")}
431 # If we are to push if there is at least one
432 # If we are to push if there is at least one
432 # obsolete or unstable changeset in missing, at
433 # obsolete or unstable changeset in missing, at
433 # least one of the missinghead will be obsolete or
434 # least one of the missinghead will be obsolete or
434 # unstable. So checking heads only is ok
435 # unstable. So checking heads only is ok
435 for node in outgoing.missingheads:
436 for node in outgoing.missingheads:
436 ctx = unfi[node]
437 ctx = unfi[node]
437 if ctx.obsolete():
438 if ctx.obsolete():
438 raise error.Abort(mso % ctx)
439 raise error.Abort(mso % ctx)
439 elif ctx.troubled():
440 elif ctx.troubled():
440 raise error.Abort(mst[ctx.troubles()[0]] % ctx)
441 raise error.Abort(mst[ctx.troubles()[0]] % ctx)
441
442
442 # internal config: bookmarks.pushing
443 # internal config: bookmarks.pushing
443 newbm = pushop.ui.configlist('bookmarks', 'pushing')
444 newbm = pushop.ui.configlist('bookmarks', 'pushing')
444 discovery.checkheads(unfi, pushop.remote, outgoing,
445 discovery.checkheads(unfi, pushop.remote, outgoing,
445 pushop.remoteheads,
446 pushop.remoteheads,
446 pushop.newbranch,
447 pushop.newbranch,
447 bool(pushop.incoming),
448 bool(pushop.incoming),
448 newbm)
449 newbm)
449 return True
450 return True
450
451
451 # List of names of steps to perform for an outgoing bundle2, order matters.
452 # List of names of steps to perform for an outgoing bundle2, order matters.
452 b2partsgenorder = []
453 b2partsgenorder = []
453
454
454 # Mapping between step name and function
455 # Mapping between step name and function
455 #
456 #
456 # This exists to help extensions wrap steps if necessary
457 # This exists to help extensions wrap steps if necessary
457 b2partsgenmapping = {}
458 b2partsgenmapping = {}
458
459
459 def b2partsgenerator(stepname, idx=None):
460 def b2partsgenerator(stepname, idx=None):
460 """decorator for function generating bundle2 part
461 """decorator for function generating bundle2 part
461
462
462 The function is added to the step -> function mapping and appended to the
463 The function is added to the step -> function mapping and appended to the
463 list of steps. Beware that decorated functions will be added in order
464 list of steps. Beware that decorated functions will be added in order
464 (this may matter).
465 (this may matter).
465
466
466 You can only use this decorator for new steps, if you want to wrap a step
467 You can only use this decorator for new steps, if you want to wrap a step
467 from an extension, attack the b2partsgenmapping dictionary directly."""
468 from an extension, attack the b2partsgenmapping dictionary directly."""
468 def dec(func):
469 def dec(func):
469 assert stepname not in b2partsgenmapping
470 assert stepname not in b2partsgenmapping
470 b2partsgenmapping[stepname] = func
471 b2partsgenmapping[stepname] = func
471 if idx is None:
472 if idx is None:
472 b2partsgenorder.append(stepname)
473 b2partsgenorder.append(stepname)
473 else:
474 else:
474 b2partsgenorder.insert(idx, stepname)
475 b2partsgenorder.insert(idx, stepname)
475 return func
476 return func
476 return dec
477 return dec
477
478
478 def _pushb2ctxcheckheads(pushop, bundler):
479 def _pushb2ctxcheckheads(pushop, bundler):
479 """Generate race condition checking parts
480 """Generate race condition checking parts
480
481
481 Exists as an indepedent function to aid extensions
482 Exists as an indepedent function to aid extensions
482 """
483 """
483 if not pushop.force:
484 if not pushop.force:
484 bundler.newpart('check:heads', data=iter(pushop.remoteheads))
485 bundler.newpart('check:heads', data=iter(pushop.remoteheads))
485
486
486 @b2partsgenerator('changeset')
487 @b2partsgenerator('changeset')
487 def _pushb2ctx(pushop, bundler):
488 def _pushb2ctx(pushop, bundler):
488 """handle changegroup push through bundle2
489 """handle changegroup push through bundle2
489
490
490 addchangegroup result is stored in the ``pushop.cgresult`` attribute.
491 addchangegroup result is stored in the ``pushop.cgresult`` attribute.
491 """
492 """
492 if 'changesets' in pushop.stepsdone:
493 if 'changesets' in pushop.stepsdone:
493 return
494 return
494 pushop.stepsdone.add('changesets')
495 pushop.stepsdone.add('changesets')
495 # Send known heads to the server for race detection.
496 # Send known heads to the server for race detection.
496 if not _pushcheckoutgoing(pushop):
497 if not _pushcheckoutgoing(pushop):
497 return
498 return
498 pushop.repo.prepushoutgoinghooks(pushop.repo,
499 pushop.repo.prepushoutgoinghooks(pushop.repo,
499 pushop.remote,
500 pushop.remote,
500 pushop.outgoing)
501 pushop.outgoing)
501
502
502 _pushb2ctxcheckheads(pushop, bundler)
503 _pushb2ctxcheckheads(pushop, bundler)
503
504
504 b2caps = bundle2.bundle2caps(pushop.remote)
505 b2caps = bundle2.bundle2caps(pushop.remote)
505 version = None
506 version = None
506 cgversions = b2caps.get('changegroup')
507 cgversions = b2caps.get('changegroup')
507 if not cgversions: # 3.1 and 3.2 ship with an empty value
508 if not cgversions: # 3.1 and 3.2 ship with an empty value
508 cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
509 cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
509 pushop.outgoing)
510 pushop.outgoing)
510 else:
511 else:
511 cgversions = [v for v in cgversions if v in changegroup.packermap]
512 cgversions = [v for v in cgversions if v in changegroup.packermap]
512 if not cgversions:
513 if not cgversions:
513 raise ValueError(_('no common changegroup version'))
514 raise ValueError(_('no common changegroup version'))
514 version = max(cgversions)
515 version = max(cgversions)
515 cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
516 cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
516 pushop.outgoing,
517 pushop.outgoing,
517 version=version)
518 version=version)
518 cgpart = bundler.newpart('changegroup', data=cg)
519 cgpart = bundler.newpart('changegroup', data=cg)
519 if version is not None:
520 if version is not None:
520 cgpart.addparam('version', version)
521 cgpart.addparam('version', version)
521 def handlereply(op):
522 def handlereply(op):
522 """extract addchangegroup returns from server reply"""
523 """extract addchangegroup returns from server reply"""
523 cgreplies = op.records.getreplies(cgpart.id)
524 cgreplies = op.records.getreplies(cgpart.id)
524 assert len(cgreplies['changegroup']) == 1
525 assert len(cgreplies['changegroup']) == 1
525 pushop.cgresult = cgreplies['changegroup'][0]['return']
526 pushop.cgresult = cgreplies['changegroup'][0]['return']
526 return handlereply
527 return handlereply
527
528
528 @b2partsgenerator('phase')
529 @b2partsgenerator('phase')
529 def _pushb2phases(pushop, bundler):
530 def _pushb2phases(pushop, bundler):
530 """handle phase push through bundle2"""
531 """handle phase push through bundle2"""
531 if 'phases' in pushop.stepsdone:
532 if 'phases' in pushop.stepsdone:
532 return
533 return
533 b2caps = bundle2.bundle2caps(pushop.remote)
534 b2caps = bundle2.bundle2caps(pushop.remote)
534 if not 'pushkey' in b2caps:
535 if not 'pushkey' in b2caps:
535 return
536 return
536 pushop.stepsdone.add('phases')
537 pushop.stepsdone.add('phases')
537 part2node = []
538 part2node = []
538
539
539 def handlefailure(pushop, exc):
540 def handlefailure(pushop, exc):
540 targetid = int(exc.partid)
541 targetid = int(exc.partid)
541 for partid, node in part2node:
542 for partid, node in part2node:
542 if partid == targetid:
543 if partid == targetid:
543 raise error.Abort(_('updating %s to public failed') % node)
544 raise error.Abort(_('updating %s to public failed') % node)
544
545
545 enc = pushkey.encode
546 enc = pushkey.encode
546 for newremotehead in pushop.outdatedphases:
547 for newremotehead in pushop.outdatedphases:
547 part = bundler.newpart('pushkey')
548 part = bundler.newpart('pushkey')
548 part.addparam('namespace', enc('phases'))
549 part.addparam('namespace', enc('phases'))
549 part.addparam('key', enc(newremotehead.hex()))
550 part.addparam('key', enc(newremotehead.hex()))
550 part.addparam('old', enc(str(phases.draft)))
551 part.addparam('old', enc(str(phases.draft)))
551 part.addparam('new', enc(str(phases.public)))
552 part.addparam('new', enc(str(phases.public)))
552 part2node.append((part.id, newremotehead))
553 part2node.append((part.id, newremotehead))
553 pushop.pkfailcb[part.id] = handlefailure
554 pushop.pkfailcb[part.id] = handlefailure
554
555
555 def handlereply(op):
556 def handlereply(op):
556 for partid, node in part2node:
557 for partid, node in part2node:
557 partrep = op.records.getreplies(partid)
558 partrep = op.records.getreplies(partid)
558 results = partrep['pushkey']
559 results = partrep['pushkey']
559 assert len(results) <= 1
560 assert len(results) <= 1
560 msg = None
561 msg = None
561 if not results:
562 if not results:
562 msg = _('server ignored update of %s to public!\n') % node
563 msg = _('server ignored update of %s to public!\n') % node
563 elif not int(results[0]['return']):
564 elif not int(results[0]['return']):
564 msg = _('updating %s to public failed!\n') % node
565 msg = _('updating %s to public failed!\n') % node
565 if msg is not None:
566 if msg is not None:
566 pushop.ui.warn(msg)
567 pushop.ui.warn(msg)
567 return handlereply
568 return handlereply
568
569
569 @b2partsgenerator('obsmarkers')
570 @b2partsgenerator('obsmarkers')
570 def _pushb2obsmarkers(pushop, bundler):
571 def _pushb2obsmarkers(pushop, bundler):
571 if 'obsmarkers' in pushop.stepsdone:
572 if 'obsmarkers' in pushop.stepsdone:
572 return
573 return
573 remoteversions = bundle2.obsmarkersversion(bundler.capabilities)
574 remoteversions = bundle2.obsmarkersversion(bundler.capabilities)
574 if obsolete.commonversion(remoteversions) is None:
575 if obsolete.commonversion(remoteversions) is None:
575 return
576 return
576 pushop.stepsdone.add('obsmarkers')
577 pushop.stepsdone.add('obsmarkers')
577 if pushop.outobsmarkers:
578 if pushop.outobsmarkers:
578 markers = sorted(pushop.outobsmarkers)
579 markers = sorted(pushop.outobsmarkers)
579 buildobsmarkerspart(bundler, markers)
580 buildobsmarkerspart(bundler, markers)
580
581
581 @b2partsgenerator('bookmarks')
582 @b2partsgenerator('bookmarks')
582 def _pushb2bookmarks(pushop, bundler):
583 def _pushb2bookmarks(pushop, bundler):
583 """handle bookmark push through bundle2"""
584 """handle bookmark push through bundle2"""
584 if 'bookmarks' in pushop.stepsdone:
585 if 'bookmarks' in pushop.stepsdone:
585 return
586 return
586 b2caps = bundle2.bundle2caps(pushop.remote)
587 b2caps = bundle2.bundle2caps(pushop.remote)
587 if 'pushkey' not in b2caps:
588 if 'pushkey' not in b2caps:
588 return
589 return
589 pushop.stepsdone.add('bookmarks')
590 pushop.stepsdone.add('bookmarks')
590 part2book = []
591 part2book = []
591 enc = pushkey.encode
592 enc = pushkey.encode
592
593
593 def handlefailure(pushop, exc):
594 def handlefailure(pushop, exc):
594 targetid = int(exc.partid)
595 targetid = int(exc.partid)
595 for partid, book, action in part2book:
596 for partid, book, action in part2book:
596 if partid == targetid:
597 if partid == targetid:
597 raise error.Abort(bookmsgmap[action][1].rstrip() % book)
598 raise error.Abort(bookmsgmap[action][1].rstrip() % book)
598 # we should not be called for part we did not generated
599 # we should not be called for part we did not generated
599 assert False
600 assert False
600
601
601 for book, old, new in pushop.outbookmarks:
602 for book, old, new in pushop.outbookmarks:
602 part = bundler.newpart('pushkey')
603 part = bundler.newpart('pushkey')
603 part.addparam('namespace', enc('bookmarks'))
604 part.addparam('namespace', enc('bookmarks'))
604 part.addparam('key', enc(book))
605 part.addparam('key', enc(book))
605 part.addparam('old', enc(old))
606 part.addparam('old', enc(old))
606 part.addparam('new', enc(new))
607 part.addparam('new', enc(new))
607 action = 'update'
608 action = 'update'
608 if not old:
609 if not old:
609 action = 'export'
610 action = 'export'
610 elif not new:
611 elif not new:
611 action = 'delete'
612 action = 'delete'
612 part2book.append((part.id, book, action))
613 part2book.append((part.id, book, action))
613 pushop.pkfailcb[part.id] = handlefailure
614 pushop.pkfailcb[part.id] = handlefailure
614
615
615 def handlereply(op):
616 def handlereply(op):
616 ui = pushop.ui
617 ui = pushop.ui
617 for partid, book, action in part2book:
618 for partid, book, action in part2book:
618 partrep = op.records.getreplies(partid)
619 partrep = op.records.getreplies(partid)
619 results = partrep['pushkey']
620 results = partrep['pushkey']
620 assert len(results) <= 1
621 assert len(results) <= 1
621 if not results:
622 if not results:
622 pushop.ui.warn(_('server ignored bookmark %s update\n') % book)
623 pushop.ui.warn(_('server ignored bookmark %s update\n') % book)
623 else:
624 else:
624 ret = int(results[0]['return'])
625 ret = int(results[0]['return'])
625 if ret:
626 if ret:
626 ui.status(bookmsgmap[action][0] % book)
627 ui.status(bookmsgmap[action][0] % book)
627 else:
628 else:
628 ui.warn(bookmsgmap[action][1] % book)
629 ui.warn(bookmsgmap[action][1] % book)
629 if pushop.bkresult is not None:
630 if pushop.bkresult is not None:
630 pushop.bkresult = 1
631 pushop.bkresult = 1
631 return handlereply
632 return handlereply
632
633
633
634
634 def _pushbundle2(pushop):
635 def _pushbundle2(pushop):
635 """push data to the remote using bundle2
636 """push data to the remote using bundle2
636
637
637 The only currently supported type of data is changegroup but this will
638 The only currently supported type of data is changegroup but this will
638 evolve in the future."""
639 evolve in the future."""
639 bundler = bundle2.bundle20(pushop.ui, bundle2.bundle2caps(pushop.remote))
640 bundler = bundle2.bundle20(pushop.ui, bundle2.bundle2caps(pushop.remote))
640 pushback = (pushop.trmanager
641 pushback = (pushop.trmanager
641 and pushop.ui.configbool('experimental', 'bundle2.pushback'))
642 and pushop.ui.configbool('experimental', 'bundle2.pushback'))
642
643
643 # create reply capability
644 # create reply capability
644 capsblob = bundle2.encodecaps(bundle2.getrepocaps(pushop.repo,
645 capsblob = bundle2.encodecaps(bundle2.getrepocaps(pushop.repo,
645 allowpushback=pushback))
646 allowpushback=pushback))
646 bundler.newpart('replycaps', data=capsblob)
647 bundler.newpart('replycaps', data=capsblob)
647 replyhandlers = []
648 replyhandlers = []
648 for partgenname in b2partsgenorder:
649 for partgenname in b2partsgenorder:
649 partgen = b2partsgenmapping[partgenname]
650 partgen = b2partsgenmapping[partgenname]
650 ret = partgen(pushop, bundler)
651 ret = partgen(pushop, bundler)
651 if callable(ret):
652 if callable(ret):
652 replyhandlers.append(ret)
653 replyhandlers.append(ret)
653 # do not push if nothing to push
654 # do not push if nothing to push
654 if bundler.nbparts <= 1:
655 if bundler.nbparts <= 1:
655 return
656 return
656 stream = util.chunkbuffer(bundler.getchunks())
657 stream = util.chunkbuffer(bundler.getchunks())
657 try:
658 try:
658 try:
659 try:
659 reply = pushop.remote.unbundle(stream, ['force'], 'push')
660 reply = pushop.remote.unbundle(stream, ['force'], 'push')
660 except error.BundleValueError as exc:
661 except error.BundleValueError as exc:
661 raise error.Abort('missing support for %s' % exc)
662 raise error.Abort('missing support for %s' % exc)
662 try:
663 try:
663 trgetter = None
664 trgetter = None
664 if pushback:
665 if pushback:
665 trgetter = pushop.trmanager.transaction
666 trgetter = pushop.trmanager.transaction
666 op = bundle2.processbundle(pushop.repo, reply, trgetter)
667 op = bundle2.processbundle(pushop.repo, reply, trgetter)
667 except error.BundleValueError as exc:
668 except error.BundleValueError as exc:
668 raise error.Abort('missing support for %s' % exc)
669 raise error.Abort('missing support for %s' % exc)
669 except error.PushkeyFailed as exc:
670 except error.PushkeyFailed as exc:
670 partid = int(exc.partid)
671 partid = int(exc.partid)
671 if partid not in pushop.pkfailcb:
672 if partid not in pushop.pkfailcb:
672 raise
673 raise
673 pushop.pkfailcb[partid](pushop, exc)
674 pushop.pkfailcb[partid](pushop, exc)
674 for rephand in replyhandlers:
675 for rephand in replyhandlers:
675 rephand(op)
676 rephand(op)
676
677
677 def _pushchangeset(pushop):
678 def _pushchangeset(pushop):
678 """Make the actual push of changeset bundle to remote repo"""
679 """Make the actual push of changeset bundle to remote repo"""
679 if 'changesets' in pushop.stepsdone:
680 if 'changesets' in pushop.stepsdone:
680 return
681 return
681 pushop.stepsdone.add('changesets')
682 pushop.stepsdone.add('changesets')
682 if not _pushcheckoutgoing(pushop):
683 if not _pushcheckoutgoing(pushop):
683 return
684 return
684 pushop.repo.prepushoutgoinghooks(pushop.repo,
685 pushop.repo.prepushoutgoinghooks(pushop.repo,
685 pushop.remote,
686 pushop.remote,
686 pushop.outgoing)
687 pushop.outgoing)
687 outgoing = pushop.outgoing
688 outgoing = pushop.outgoing
688 unbundle = pushop.remote.capable('unbundle')
689 unbundle = pushop.remote.capable('unbundle')
689 # TODO: get bundlecaps from remote
690 # TODO: get bundlecaps from remote
690 bundlecaps = None
691 bundlecaps = None
691 # create a changegroup from local
692 # create a changegroup from local
692 if pushop.revs is None and not (outgoing.excluded
693 if pushop.revs is None and not (outgoing.excluded
693 or pushop.repo.changelog.filteredrevs):
694 or pushop.repo.changelog.filteredrevs):
694 # push everything,
695 # push everything,
695 # use the fast path, no race possible on push
696 # use the fast path, no race possible on push
696 bundler = changegroup.cg1packer(pushop.repo, bundlecaps)
697 bundler = changegroup.cg1packer(pushop.repo, bundlecaps)
697 cg = changegroup.getsubset(pushop.repo,
698 cg = changegroup.getsubset(pushop.repo,
698 outgoing,
699 outgoing,
699 bundler,
700 bundler,
700 'push',
701 'push',
701 fastpath=True)
702 fastpath=True)
702 else:
703 else:
703 cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing,
704 cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing,
704 bundlecaps)
705 bundlecaps)
705
706
706 # apply changegroup to remote
707 # apply changegroup to remote
707 if unbundle:
708 if unbundle:
708 # local repo finds heads on server, finds out what
709 # local repo finds heads on server, finds out what
709 # revs it must push. once revs transferred, if server
710 # revs it must push. once revs transferred, if server
710 # finds it has different heads (someone else won
711 # finds it has different heads (someone else won
711 # commit/push race), server aborts.
712 # commit/push race), server aborts.
712 if pushop.force:
713 if pushop.force:
713 remoteheads = ['force']
714 remoteheads = ['force']
714 else:
715 else:
715 remoteheads = pushop.remoteheads
716 remoteheads = pushop.remoteheads
716 # ssh: return remote's addchangegroup()
717 # ssh: return remote's addchangegroup()
717 # http: return remote's addchangegroup() or 0 for error
718 # http: return remote's addchangegroup() or 0 for error
718 pushop.cgresult = pushop.remote.unbundle(cg, remoteheads,
719 pushop.cgresult = pushop.remote.unbundle(cg, remoteheads,
719 pushop.repo.url())
720 pushop.repo.url())
720 else:
721 else:
721 # we return an integer indicating remote head count
722 # we return an integer indicating remote head count
722 # change
723 # change
723 pushop.cgresult = pushop.remote.addchangegroup(cg, 'push',
724 pushop.cgresult = pushop.remote.addchangegroup(cg, 'push',
724 pushop.repo.url())
725 pushop.repo.url())
725
726
726 def _pushsyncphase(pushop):
727 def _pushsyncphase(pushop):
727 """synchronise phase information locally and remotely"""
728 """synchronise phase information locally and remotely"""
728 cheads = pushop.commonheads
729 cheads = pushop.commonheads
729 # even when we don't push, exchanging phase data is useful
730 # even when we don't push, exchanging phase data is useful
730 remotephases = pushop.remote.listkeys('phases')
731 remotephases = pushop.remote.listkeys('phases')
731 if (pushop.ui.configbool('ui', '_usedassubrepo', False)
732 if (pushop.ui.configbool('ui', '_usedassubrepo', False)
732 and remotephases # server supports phases
733 and remotephases # server supports phases
733 and pushop.cgresult is None # nothing was pushed
734 and pushop.cgresult is None # nothing was pushed
734 and remotephases.get('publishing', False)):
735 and remotephases.get('publishing', False)):
735 # When:
736 # When:
736 # - this is a subrepo push
737 # - this is a subrepo push
737 # - and remote support phase
738 # - and remote support phase
738 # - and no changeset was pushed
739 # - and no changeset was pushed
739 # - and remote is publishing
740 # - and remote is publishing
740 # We may be in issue 3871 case!
741 # We may be in issue 3871 case!
741 # We drop the possible phase synchronisation done by
742 # We drop the possible phase synchronisation done by
742 # courtesy to publish changesets possibly locally draft
743 # courtesy to publish changesets possibly locally draft
743 # on the remote.
744 # on the remote.
744 remotephases = {'publishing': 'True'}
745 remotephases = {'publishing': 'True'}
745 if not remotephases: # old server or public only reply from non-publishing
746 if not remotephases: # old server or public only reply from non-publishing
746 _localphasemove(pushop, cheads)
747 _localphasemove(pushop, cheads)
747 # don't push any phase data as there is nothing to push
748 # don't push any phase data as there is nothing to push
748 else:
749 else:
749 ana = phases.analyzeremotephases(pushop.repo, cheads,
750 ana = phases.analyzeremotephases(pushop.repo, cheads,
750 remotephases)
751 remotephases)
751 pheads, droots = ana
752 pheads, droots = ana
752 ### Apply remote phase on local
753 ### Apply remote phase on local
753 if remotephases.get('publishing', False):
754 if remotephases.get('publishing', False):
754 _localphasemove(pushop, cheads)
755 _localphasemove(pushop, cheads)
755 else: # publish = False
756 else: # publish = False
756 _localphasemove(pushop, pheads)
757 _localphasemove(pushop, pheads)
757 _localphasemove(pushop, cheads, phases.draft)
758 _localphasemove(pushop, cheads, phases.draft)
758 ### Apply local phase on remote
759 ### Apply local phase on remote
759
760
760 if pushop.cgresult:
761 if pushop.cgresult:
761 if 'phases' in pushop.stepsdone:
762 if 'phases' in pushop.stepsdone:
762 # phases already pushed though bundle2
763 # phases already pushed though bundle2
763 return
764 return
764 outdated = pushop.outdatedphases
765 outdated = pushop.outdatedphases
765 else:
766 else:
766 outdated = pushop.fallbackoutdatedphases
767 outdated = pushop.fallbackoutdatedphases
767
768
768 pushop.stepsdone.add('phases')
769 pushop.stepsdone.add('phases')
769
770
770 # filter heads already turned public by the push
771 # filter heads already turned public by the push
771 outdated = [c for c in outdated if c.node() not in pheads]
772 outdated = [c for c in outdated if c.node() not in pheads]
772 # fallback to independent pushkey command
773 # fallback to independent pushkey command
773 for newremotehead in outdated:
774 for newremotehead in outdated:
774 r = pushop.remote.pushkey('phases',
775 r = pushop.remote.pushkey('phases',
775 newremotehead.hex(),
776 newremotehead.hex(),
776 str(phases.draft),
777 str(phases.draft),
777 str(phases.public))
778 str(phases.public))
778 if not r:
779 if not r:
779 pushop.ui.warn(_('updating %s to public failed!\n')
780 pushop.ui.warn(_('updating %s to public failed!\n')
780 % newremotehead)
781 % newremotehead)
781
782
782 def _localphasemove(pushop, nodes, phase=phases.public):
783 def _localphasemove(pushop, nodes, phase=phases.public):
783 """move <nodes> to <phase> in the local source repo"""
784 """move <nodes> to <phase> in the local source repo"""
784 if pushop.trmanager:
785 if pushop.trmanager:
785 phases.advanceboundary(pushop.repo,
786 phases.advanceboundary(pushop.repo,
786 pushop.trmanager.transaction(),
787 pushop.trmanager.transaction(),
787 phase,
788 phase,
788 nodes)
789 nodes)
789 else:
790 else:
790 # repo is not locked, do not change any phases!
791 # repo is not locked, do not change any phases!
791 # Informs the user that phases should have been moved when
792 # Informs the user that phases should have been moved when
792 # applicable.
793 # applicable.
793 actualmoves = [n for n in nodes if phase < pushop.repo[n].phase()]
794 actualmoves = [n for n in nodes if phase < pushop.repo[n].phase()]
794 phasestr = phases.phasenames[phase]
795 phasestr = phases.phasenames[phase]
795 if actualmoves:
796 if actualmoves:
796 pushop.ui.status(_('cannot lock source repo, skipping '
797 pushop.ui.status(_('cannot lock source repo, skipping '
797 'local %s phase update\n') % phasestr)
798 'local %s phase update\n') % phasestr)
798
799
799 def _pushobsolete(pushop):
800 def _pushobsolete(pushop):
800 """utility function to push obsolete markers to a remote"""
801 """utility function to push obsolete markers to a remote"""
801 if 'obsmarkers' in pushop.stepsdone:
802 if 'obsmarkers' in pushop.stepsdone:
802 return
803 return
803 repo = pushop.repo
804 repo = pushop.repo
804 remote = pushop.remote
805 remote = pushop.remote
805 pushop.stepsdone.add('obsmarkers')
806 pushop.stepsdone.add('obsmarkers')
806 if pushop.outobsmarkers:
807 if pushop.outobsmarkers:
807 pushop.ui.debug('try to push obsolete markers to remote\n')
808 pushop.ui.debug('try to push obsolete markers to remote\n')
808 rslts = []
809 rslts = []
809 remotedata = obsolete._pushkeyescape(sorted(pushop.outobsmarkers))
810 remotedata = obsolete._pushkeyescape(sorted(pushop.outobsmarkers))
810 for key in sorted(remotedata, reverse=True):
811 for key in sorted(remotedata, reverse=True):
811 # reverse sort to ensure we end with dump0
812 # reverse sort to ensure we end with dump0
812 data = remotedata[key]
813 data = remotedata[key]
813 rslts.append(remote.pushkey('obsolete', key, '', data))
814 rslts.append(remote.pushkey('obsolete', key, '', data))
814 if [r for r in rslts if not r]:
815 if [r for r in rslts if not r]:
815 msg = _('failed to push some obsolete markers!\n')
816 msg = _('failed to push some obsolete markers!\n')
816 repo.ui.warn(msg)
817 repo.ui.warn(msg)
817
818
818 def _pushbookmark(pushop):
819 def _pushbookmark(pushop):
819 """Update bookmark position on remote"""
820 """Update bookmark position on remote"""
820 if pushop.cgresult == 0 or 'bookmarks' in pushop.stepsdone:
821 if pushop.cgresult == 0 or 'bookmarks' in pushop.stepsdone:
821 return
822 return
822 pushop.stepsdone.add('bookmarks')
823 pushop.stepsdone.add('bookmarks')
823 ui = pushop.ui
824 ui = pushop.ui
824 remote = pushop.remote
825 remote = pushop.remote
825
826
826 for b, old, new in pushop.outbookmarks:
827 for b, old, new in pushop.outbookmarks:
827 action = 'update'
828 action = 'update'
828 if not old:
829 if not old:
829 action = 'export'
830 action = 'export'
830 elif not new:
831 elif not new:
831 action = 'delete'
832 action = 'delete'
832 if remote.pushkey('bookmarks', b, old, new):
833 if remote.pushkey('bookmarks', b, old, new):
833 ui.status(bookmsgmap[action][0] % b)
834 ui.status(bookmsgmap[action][0] % b)
834 else:
835 else:
835 ui.warn(bookmsgmap[action][1] % b)
836 ui.warn(bookmsgmap[action][1] % b)
836 # discovery can have set the value form invalid entry
837 # discovery can have set the value form invalid entry
837 if pushop.bkresult is not None:
838 if pushop.bkresult is not None:
838 pushop.bkresult = 1
839 pushop.bkresult = 1
839
840
840 class pulloperation(object):
841 class pulloperation(object):
841 """A object that represent a single pull operation
842 """A object that represent a single pull operation
842
843
843 It purpose is to carry pull related state and very common operation.
844 It purpose is to carry pull related state and very common operation.
844
845
845 A new should be created at the beginning of each pull and discarded
846 A new should be created at the beginning of each pull and discarded
846 afterward.
847 afterward.
847 """
848 """
848
849
849 def __init__(self, repo, remote, heads=None, force=False, bookmarks=(),
850 def __init__(self, repo, remote, heads=None, force=False, bookmarks=(),
850 remotebookmarks=None, streamclonerequested=None):
851 remotebookmarks=None, streamclonerequested=None):
851 # repo we pull into
852 # repo we pull into
852 self.repo = repo
853 self.repo = repo
853 # repo we pull from
854 # repo we pull from
854 self.remote = remote
855 self.remote = remote
855 # revision we try to pull (None is "all")
856 # revision we try to pull (None is "all")
856 self.heads = heads
857 self.heads = heads
857 # bookmark pulled explicitly
858 # bookmark pulled explicitly
858 self.explicitbookmarks = bookmarks
859 self.explicitbookmarks = bookmarks
859 # do we force pull?
860 # do we force pull?
860 self.force = force
861 self.force = force
861 # whether a streaming clone was requested
862 # whether a streaming clone was requested
862 self.streamclonerequested = streamclonerequested
863 self.streamclonerequested = streamclonerequested
863 # transaction manager
864 # transaction manager
864 self.trmanager = None
865 self.trmanager = None
865 # set of common changeset between local and remote before pull
866 # set of common changeset between local and remote before pull
866 self.common = None
867 self.common = None
867 # set of pulled head
868 # set of pulled head
868 self.rheads = None
869 self.rheads = None
869 # list of missing changeset to fetch remotely
870 # list of missing changeset to fetch remotely
870 self.fetch = None
871 self.fetch = None
871 # remote bookmarks data
872 # remote bookmarks data
872 self.remotebookmarks = remotebookmarks
873 self.remotebookmarks = remotebookmarks
873 # result of changegroup pulling (used as return code by pull)
874 # result of changegroup pulling (used as return code by pull)
874 self.cgresult = None
875 self.cgresult = None
875 # list of step already done
876 # list of step already done
876 self.stepsdone = set()
877 self.stepsdone = set()
877
878
878 @util.propertycache
879 @util.propertycache
879 def pulledsubset(self):
880 def pulledsubset(self):
880 """heads of the set of changeset target by the pull"""
881 """heads of the set of changeset target by the pull"""
881 # compute target subset
882 # compute target subset
882 if self.heads is None:
883 if self.heads is None:
883 # We pulled every thing possible
884 # We pulled every thing possible
884 # sync on everything common
885 # sync on everything common
885 c = set(self.common)
886 c = set(self.common)
886 ret = list(self.common)
887 ret = list(self.common)
887 for n in self.rheads:
888 for n in self.rheads:
888 if n not in c:
889 if n not in c:
889 ret.append(n)
890 ret.append(n)
890 return ret
891 return ret
891 else:
892 else:
892 # We pulled a specific subset
893 # We pulled a specific subset
893 # sync on this subset
894 # sync on this subset
894 return self.heads
895 return self.heads
895
896
896 @util.propertycache
897 @util.propertycache
897 def canusebundle2(self):
898 def canusebundle2(self):
898 return _canusebundle2(self)
899 return _canusebundle2(self)
899
900
900 @util.propertycache
901 @util.propertycache
901 def remotebundle2caps(self):
902 def remotebundle2caps(self):
902 return bundle2.bundle2caps(self.remote)
903 return bundle2.bundle2caps(self.remote)
903
904
904 def gettransaction(self):
905 def gettransaction(self):
905 # deprecated; talk to trmanager directly
906 # deprecated; talk to trmanager directly
906 return self.trmanager.transaction()
907 return self.trmanager.transaction()
907
908
908 class transactionmanager(object):
909 class transactionmanager(object):
909 """An object to manage the life cycle of a transaction
910 """An object to manage the life cycle of a transaction
910
911
911 It creates the transaction on demand and calls the appropriate hooks when
912 It creates the transaction on demand and calls the appropriate hooks when
912 closing the transaction."""
913 closing the transaction."""
913 def __init__(self, repo, source, url):
914 def __init__(self, repo, source, url):
914 self.repo = repo
915 self.repo = repo
915 self.source = source
916 self.source = source
916 self.url = url
917 self.url = url
917 self._tr = None
918 self._tr = None
918
919
919 def transaction(self):
920 def transaction(self):
920 """Return an open transaction object, constructing if necessary"""
921 """Return an open transaction object, constructing if necessary"""
921 if not self._tr:
922 if not self._tr:
922 trname = '%s\n%s' % (self.source, util.hidepassword(self.url))
923 trname = '%s\n%s' % (self.source, util.hidepassword(self.url))
923 self._tr = self.repo.transaction(trname)
924 self._tr = self.repo.transaction(trname)
924 self._tr.hookargs['source'] = self.source
925 self._tr.hookargs['source'] = self.source
925 self._tr.hookargs['url'] = self.url
926 self._tr.hookargs['url'] = self.url
926 return self._tr
927 return self._tr
927
928
928 def close(self):
929 def close(self):
929 """close transaction if created"""
930 """close transaction if created"""
930 if self._tr is not None:
931 if self._tr is not None:
931 self._tr.close()
932 self._tr.close()
932
933
933 def release(self):
934 def release(self):
934 """release transaction if created"""
935 """release transaction if created"""
935 if self._tr is not None:
936 if self._tr is not None:
936 self._tr.release()
937 self._tr.release()
937
938
938 def pull(repo, remote, heads=None, force=False, bookmarks=(), opargs=None,
939 def pull(repo, remote, heads=None, force=False, bookmarks=(), opargs=None,
939 streamclonerequested=None):
940 streamclonerequested=None):
940 """Fetch repository data from a remote.
941 """Fetch repository data from a remote.
941
942
942 This is the main function used to retrieve data from a remote repository.
943 This is the main function used to retrieve data from a remote repository.
943
944
944 ``repo`` is the local repository to clone into.
945 ``repo`` is the local repository to clone into.
945 ``remote`` is a peer instance.
946 ``remote`` is a peer instance.
946 ``heads`` is an iterable of revisions we want to pull. ``None`` (the
947 ``heads`` is an iterable of revisions we want to pull. ``None`` (the
947 default) means to pull everything from the remote.
948 default) means to pull everything from the remote.
948 ``bookmarks`` is an iterable of bookmarks requesting to be pulled. By
949 ``bookmarks`` is an iterable of bookmarks requesting to be pulled. By
949 default, all remote bookmarks are pulled.
950 default, all remote bookmarks are pulled.
950 ``opargs`` are additional keyword arguments to pass to ``pulloperation``
951 ``opargs`` are additional keyword arguments to pass to ``pulloperation``
951 initialization.
952 initialization.
952 ``streamclonerequested`` is a boolean indicating whether a "streaming
953 ``streamclonerequested`` is a boolean indicating whether a "streaming
953 clone" is requested. A "streaming clone" is essentially a raw file copy
954 clone" is requested. A "streaming clone" is essentially a raw file copy
954 of revlogs from the server. This only works when the local repository is
955 of revlogs from the server. This only works when the local repository is
955 empty. The default value of ``None`` means to respect the server
956 empty. The default value of ``None`` means to respect the server
956 configuration for preferring stream clones.
957 configuration for preferring stream clones.
957
958
958 Returns the ``pulloperation`` created for this pull.
959 Returns the ``pulloperation`` created for this pull.
959 """
960 """
960 if opargs is None:
961 if opargs is None:
961 opargs = {}
962 opargs = {}
962 pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks,
963 pullop = pulloperation(repo, remote, heads, force, bookmarks=bookmarks,
963 streamclonerequested=streamclonerequested, **opargs)
964 streamclonerequested=streamclonerequested, **opargs)
964 if pullop.remote.local():
965 if pullop.remote.local():
965 missing = set(pullop.remote.requirements) - pullop.repo.supported
966 missing = set(pullop.remote.requirements) - pullop.repo.supported
966 if missing:
967 if missing:
967 msg = _("required features are not"
968 msg = _("required features are not"
968 " supported in the destination:"
969 " supported in the destination:"
969 " %s") % (', '.join(sorted(missing)))
970 " %s") % (', '.join(sorted(missing)))
970 raise error.Abort(msg)
971 raise error.Abort(msg)
971
972
972 lock = pullop.repo.lock()
973 lock = pullop.repo.lock()
973 try:
974 try:
974 pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
975 pullop.trmanager = transactionmanager(repo, 'pull', remote.url())
975 streamclone.maybeperformlegacystreamclone(pullop)
976 streamclone.maybeperformlegacystreamclone(pullop)
977 # This should ideally be in _pullbundle2(). However, it needs to run
978 # before discovery to avoid extra work.
979 _maybeapplyclonebundle(pullop)
976 _pulldiscovery(pullop)
980 _pulldiscovery(pullop)
977 if pullop.canusebundle2:
981 if pullop.canusebundle2:
978 _pullbundle2(pullop)
982 _pullbundle2(pullop)
979 _pullchangeset(pullop)
983 _pullchangeset(pullop)
980 _pullphase(pullop)
984 _pullphase(pullop)
981 _pullbookmarks(pullop)
985 _pullbookmarks(pullop)
982 _pullobsolete(pullop)
986 _pullobsolete(pullop)
983 pullop.trmanager.close()
987 pullop.trmanager.close()
984 finally:
988 finally:
985 pullop.trmanager.release()
989 pullop.trmanager.release()
986 lock.release()
990 lock.release()
987
991
988 return pullop
992 return pullop
989
993
990 # list of steps to perform discovery before pull
994 # list of steps to perform discovery before pull
991 pulldiscoveryorder = []
995 pulldiscoveryorder = []
992
996
993 # Mapping between step name and function
997 # Mapping between step name and function
994 #
998 #
995 # This exists to help extensions wrap steps if necessary
999 # This exists to help extensions wrap steps if necessary
996 pulldiscoverymapping = {}
1000 pulldiscoverymapping = {}
997
1001
998 def pulldiscovery(stepname):
1002 def pulldiscovery(stepname):
999 """decorator for function performing discovery before pull
1003 """decorator for function performing discovery before pull
1000
1004
1001 The function is added to the step -> function mapping and appended to the
1005 The function is added to the step -> function mapping and appended to the
1002 list of steps. Beware that decorated function will be added in order (this
1006 list of steps. Beware that decorated function will be added in order (this
1003 may matter).
1007 may matter).
1004
1008
1005 You can only use this decorator for a new step, if you want to wrap a step
1009 You can only use this decorator for a new step, if you want to wrap a step
1006 from an extension, change the pulldiscovery dictionary directly."""
1010 from an extension, change the pulldiscovery dictionary directly."""
1007 def dec(func):
1011 def dec(func):
1008 assert stepname not in pulldiscoverymapping
1012 assert stepname not in pulldiscoverymapping
1009 pulldiscoverymapping[stepname] = func
1013 pulldiscoverymapping[stepname] = func
1010 pulldiscoveryorder.append(stepname)
1014 pulldiscoveryorder.append(stepname)
1011 return func
1015 return func
1012 return dec
1016 return dec
1013
1017
1014 def _pulldiscovery(pullop):
1018 def _pulldiscovery(pullop):
1015 """Run all discovery steps"""
1019 """Run all discovery steps"""
1016 for stepname in pulldiscoveryorder:
1020 for stepname in pulldiscoveryorder:
1017 step = pulldiscoverymapping[stepname]
1021 step = pulldiscoverymapping[stepname]
1018 step(pullop)
1022 step(pullop)
1019
1023
1020 @pulldiscovery('b1:bookmarks')
1024 @pulldiscovery('b1:bookmarks')
1021 def _pullbookmarkbundle1(pullop):
1025 def _pullbookmarkbundle1(pullop):
1022 """fetch bookmark data in bundle1 case
1026 """fetch bookmark data in bundle1 case
1023
1027
1024 If not using bundle2, we have to fetch bookmarks before changeset
1028 If not using bundle2, we have to fetch bookmarks before changeset
1025 discovery to reduce the chance and impact of race conditions."""
1029 discovery to reduce the chance and impact of race conditions."""
1026 if pullop.remotebookmarks is not None:
1030 if pullop.remotebookmarks is not None:
1027 return
1031 return
1028 if pullop.canusebundle2 and 'listkeys' in pullop.remotebundle2caps:
1032 if pullop.canusebundle2 and 'listkeys' in pullop.remotebundle2caps:
1029 # all known bundle2 servers now support listkeys, but lets be nice with
1033 # all known bundle2 servers now support listkeys, but lets be nice with
1030 # new implementation.
1034 # new implementation.
1031 return
1035 return
1032 pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
1036 pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
1033
1037
1034
1038
1035 @pulldiscovery('changegroup')
1039 @pulldiscovery('changegroup')
1036 def _pulldiscoverychangegroup(pullop):
1040 def _pulldiscoverychangegroup(pullop):
1037 """discovery phase for the pull
1041 """discovery phase for the pull
1038
1042
1039 Current handle changeset discovery only, will change handle all discovery
1043 Current handle changeset discovery only, will change handle all discovery
1040 at some point."""
1044 at some point."""
1041 tmp = discovery.findcommonincoming(pullop.repo,
1045 tmp = discovery.findcommonincoming(pullop.repo,
1042 pullop.remote,
1046 pullop.remote,
1043 heads=pullop.heads,
1047 heads=pullop.heads,
1044 force=pullop.force)
1048 force=pullop.force)
1045 common, fetch, rheads = tmp
1049 common, fetch, rheads = tmp
1046 nm = pullop.repo.unfiltered().changelog.nodemap
1050 nm = pullop.repo.unfiltered().changelog.nodemap
1047 if fetch and rheads:
1051 if fetch and rheads:
1048 # If a remote heads in filtered locally, lets drop it from the unknown
1052 # If a remote heads in filtered locally, lets drop it from the unknown
1049 # remote heads and put in back in common.
1053 # remote heads and put in back in common.
1050 #
1054 #
1051 # This is a hackish solution to catch most of "common but locally
1055 # This is a hackish solution to catch most of "common but locally
1052 # hidden situation". We do not performs discovery on unfiltered
1056 # hidden situation". We do not performs discovery on unfiltered
1053 # repository because it end up doing a pathological amount of round
1057 # repository because it end up doing a pathological amount of round
1054 # trip for w huge amount of changeset we do not care about.
1058 # trip for w huge amount of changeset we do not care about.
1055 #
1059 #
1056 # If a set of such "common but filtered" changeset exist on the server
1060 # If a set of such "common but filtered" changeset exist on the server
1057 # but are not including a remote heads, we'll not be able to detect it,
1061 # but are not including a remote heads, we'll not be able to detect it,
1058 scommon = set(common)
1062 scommon = set(common)
1059 filteredrheads = []
1063 filteredrheads = []
1060 for n in rheads:
1064 for n in rheads:
1061 if n in nm:
1065 if n in nm:
1062 if n not in scommon:
1066 if n not in scommon:
1063 common.append(n)
1067 common.append(n)
1064 else:
1068 else:
1065 filteredrheads.append(n)
1069 filteredrheads.append(n)
1066 if not filteredrheads:
1070 if not filteredrheads:
1067 fetch = []
1071 fetch = []
1068 rheads = filteredrheads
1072 rheads = filteredrheads
1069 pullop.common = common
1073 pullop.common = common
1070 pullop.fetch = fetch
1074 pullop.fetch = fetch
1071 pullop.rheads = rheads
1075 pullop.rheads = rheads
1072
1076
1073 def _pullbundle2(pullop):
1077 def _pullbundle2(pullop):
1074 """pull data using bundle2
1078 """pull data using bundle2
1075
1079
1076 For now, the only supported data are changegroup."""
1080 For now, the only supported data are changegroup."""
1077 kwargs = {'bundlecaps': caps20to10(pullop.repo)}
1081 kwargs = {'bundlecaps': caps20to10(pullop.repo)}
1078
1082
1079 streaming, streamreqs = streamclone.canperformstreamclone(pullop)
1083 streaming, streamreqs = streamclone.canperformstreamclone(pullop)
1080
1084
1081 # pulling changegroup
1085 # pulling changegroup
1082 pullop.stepsdone.add('changegroup')
1086 pullop.stepsdone.add('changegroup')
1083
1087
1084 kwargs['common'] = pullop.common
1088 kwargs['common'] = pullop.common
1085 kwargs['heads'] = pullop.heads or pullop.rheads
1089 kwargs['heads'] = pullop.heads or pullop.rheads
1086 kwargs['cg'] = pullop.fetch
1090 kwargs['cg'] = pullop.fetch
1087 if 'listkeys' in pullop.remotebundle2caps:
1091 if 'listkeys' in pullop.remotebundle2caps:
1088 kwargs['listkeys'] = ['phase']
1092 kwargs['listkeys'] = ['phase']
1089 if pullop.remotebookmarks is None:
1093 if pullop.remotebookmarks is None:
1090 # make sure to always includes bookmark data when migrating
1094 # make sure to always includes bookmark data when migrating
1091 # `hg incoming --bundle` to using this function.
1095 # `hg incoming --bundle` to using this function.
1092 kwargs['listkeys'].append('bookmarks')
1096 kwargs['listkeys'].append('bookmarks')
1093 if streaming:
1097 if streaming:
1094 pullop.repo.ui.status(_('streaming all changes\n'))
1098 pullop.repo.ui.status(_('streaming all changes\n'))
1095 elif not pullop.fetch:
1099 elif not pullop.fetch:
1096 pullop.repo.ui.status(_("no changes found\n"))
1100 pullop.repo.ui.status(_("no changes found\n"))
1097 pullop.cgresult = 0
1101 pullop.cgresult = 0
1098 else:
1102 else:
1099 if pullop.heads is None and list(pullop.common) == [nullid]:
1103 if pullop.heads is None and list(pullop.common) == [nullid]:
1100 pullop.repo.ui.status(_("requesting all changes\n"))
1104 pullop.repo.ui.status(_("requesting all changes\n"))
1101 if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
1105 if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
1102 remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps)
1106 remoteversions = bundle2.obsmarkersversion(pullop.remotebundle2caps)
1103 if obsolete.commonversion(remoteversions) is not None:
1107 if obsolete.commonversion(remoteversions) is not None:
1104 kwargs['obsmarkers'] = True
1108 kwargs['obsmarkers'] = True
1105 pullop.stepsdone.add('obsmarkers')
1109 pullop.stepsdone.add('obsmarkers')
1106 _pullbundle2extraprepare(pullop, kwargs)
1110 _pullbundle2extraprepare(pullop, kwargs)
1107 bundle = pullop.remote.getbundle('pull', **kwargs)
1111 bundle = pullop.remote.getbundle('pull', **kwargs)
1108 try:
1112 try:
1109 op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
1113 op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
1110 except error.BundleValueError as exc:
1114 except error.BundleValueError as exc:
1111 raise error.Abort('missing support for %s' % exc)
1115 raise error.Abort('missing support for %s' % exc)
1112
1116
1113 if pullop.fetch:
1117 if pullop.fetch:
1114 results = [cg['return'] for cg in op.records['changegroup']]
1118 results = [cg['return'] for cg in op.records['changegroup']]
1115 pullop.cgresult = changegroup.combineresults(results)
1119 pullop.cgresult = changegroup.combineresults(results)
1116
1120
1117 # processing phases change
1121 # processing phases change
1118 for namespace, value in op.records['listkeys']:
1122 for namespace, value in op.records['listkeys']:
1119 if namespace == 'phases':
1123 if namespace == 'phases':
1120 _pullapplyphases(pullop, value)
1124 _pullapplyphases(pullop, value)
1121
1125
1122 # processing bookmark update
1126 # processing bookmark update
1123 for namespace, value in op.records['listkeys']:
1127 for namespace, value in op.records['listkeys']:
1124 if namespace == 'bookmarks':
1128 if namespace == 'bookmarks':
1125 pullop.remotebookmarks = value
1129 pullop.remotebookmarks = value
1126
1130
1127 # bookmark data were either already there or pulled in the bundle
1131 # bookmark data were either already there or pulled in the bundle
1128 if pullop.remotebookmarks is not None:
1132 if pullop.remotebookmarks is not None:
1129 _pullbookmarks(pullop)
1133 _pullbookmarks(pullop)
1130
1134
1131 def _pullbundle2extraprepare(pullop, kwargs):
1135 def _pullbundle2extraprepare(pullop, kwargs):
1132 """hook function so that extensions can extend the getbundle call"""
1136 """hook function so that extensions can extend the getbundle call"""
1133 pass
1137 pass
1134
1138
1135 def _pullchangeset(pullop):
1139 def _pullchangeset(pullop):
1136 """pull changeset from unbundle into the local repo"""
1140 """pull changeset from unbundle into the local repo"""
1137 # We delay the open of the transaction as late as possible so we
1141 # We delay the open of the transaction as late as possible so we
1138 # don't open transaction for nothing or you break future useful
1142 # don't open transaction for nothing or you break future useful
1139 # rollback call
1143 # rollback call
1140 if 'changegroup' in pullop.stepsdone:
1144 if 'changegroup' in pullop.stepsdone:
1141 return
1145 return
1142 pullop.stepsdone.add('changegroup')
1146 pullop.stepsdone.add('changegroup')
1143 if not pullop.fetch:
1147 if not pullop.fetch:
1144 pullop.repo.ui.status(_("no changes found\n"))
1148 pullop.repo.ui.status(_("no changes found\n"))
1145 pullop.cgresult = 0
1149 pullop.cgresult = 0
1146 return
1150 return
1147 pullop.gettransaction()
1151 pullop.gettransaction()
1148 if pullop.heads is None and list(pullop.common) == [nullid]:
1152 if pullop.heads is None and list(pullop.common) == [nullid]:
1149 pullop.repo.ui.status(_("requesting all changes\n"))
1153 pullop.repo.ui.status(_("requesting all changes\n"))
1150 elif pullop.heads is None and pullop.remote.capable('changegroupsubset'):
1154 elif pullop.heads is None and pullop.remote.capable('changegroupsubset'):
1151 # issue1320, avoid a race if remote changed after discovery
1155 # issue1320, avoid a race if remote changed after discovery
1152 pullop.heads = pullop.rheads
1156 pullop.heads = pullop.rheads
1153
1157
1154 if pullop.remote.capable('getbundle'):
1158 if pullop.remote.capable('getbundle'):
1155 # TODO: get bundlecaps from remote
1159 # TODO: get bundlecaps from remote
1156 cg = pullop.remote.getbundle('pull', common=pullop.common,
1160 cg = pullop.remote.getbundle('pull', common=pullop.common,
1157 heads=pullop.heads or pullop.rheads)
1161 heads=pullop.heads or pullop.rheads)
1158 elif pullop.heads is None:
1162 elif pullop.heads is None:
1159 cg = pullop.remote.changegroup(pullop.fetch, 'pull')
1163 cg = pullop.remote.changegroup(pullop.fetch, 'pull')
1160 elif not pullop.remote.capable('changegroupsubset'):
1164 elif not pullop.remote.capable('changegroupsubset'):
1161 raise error.Abort(_("partial pull cannot be done because "
1165 raise error.Abort(_("partial pull cannot be done because "
1162 "other repository doesn't support "
1166 "other repository doesn't support "
1163 "changegroupsubset."))
1167 "changegroupsubset."))
1164 else:
1168 else:
1165 cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
1169 cg = pullop.remote.changegroupsubset(pullop.fetch, pullop.heads, 'pull')
1166 pullop.cgresult = changegroup.addchangegroup(pullop.repo, cg, 'pull',
1170 pullop.cgresult = changegroup.addchangegroup(pullop.repo, cg, 'pull',
1167 pullop.remote.url())
1171 pullop.remote.url())
1168
1172
1169 def _pullphase(pullop):
1173 def _pullphase(pullop):
1170 # Get remote phases data from remote
1174 # Get remote phases data from remote
1171 if 'phases' in pullop.stepsdone:
1175 if 'phases' in pullop.stepsdone:
1172 return
1176 return
1173 remotephases = pullop.remote.listkeys('phases')
1177 remotephases = pullop.remote.listkeys('phases')
1174 _pullapplyphases(pullop, remotephases)
1178 _pullapplyphases(pullop, remotephases)
1175
1179
1176 def _pullapplyphases(pullop, remotephases):
1180 def _pullapplyphases(pullop, remotephases):
1177 """apply phase movement from observed remote state"""
1181 """apply phase movement from observed remote state"""
1178 if 'phases' in pullop.stepsdone:
1182 if 'phases' in pullop.stepsdone:
1179 return
1183 return
1180 pullop.stepsdone.add('phases')
1184 pullop.stepsdone.add('phases')
1181 publishing = bool(remotephases.get('publishing', False))
1185 publishing = bool(remotephases.get('publishing', False))
1182 if remotephases and not publishing:
1186 if remotephases and not publishing:
1183 # remote is new and unpublishing
1187 # remote is new and unpublishing
1184 pheads, _dr = phases.analyzeremotephases(pullop.repo,
1188 pheads, _dr = phases.analyzeremotephases(pullop.repo,
1185 pullop.pulledsubset,
1189 pullop.pulledsubset,
1186 remotephases)
1190 remotephases)
1187 dheads = pullop.pulledsubset
1191 dheads = pullop.pulledsubset
1188 else:
1192 else:
1189 # Remote is old or publishing all common changesets
1193 # Remote is old or publishing all common changesets
1190 # should be seen as public
1194 # should be seen as public
1191 pheads = pullop.pulledsubset
1195 pheads = pullop.pulledsubset
1192 dheads = []
1196 dheads = []
1193 unfi = pullop.repo.unfiltered()
1197 unfi = pullop.repo.unfiltered()
1194 phase = unfi._phasecache.phase
1198 phase = unfi._phasecache.phase
1195 rev = unfi.changelog.nodemap.get
1199 rev = unfi.changelog.nodemap.get
1196 public = phases.public
1200 public = phases.public
1197 draft = phases.draft
1201 draft = phases.draft
1198
1202
1199 # exclude changesets already public locally and update the others
1203 # exclude changesets already public locally and update the others
1200 pheads = [pn for pn in pheads if phase(unfi, rev(pn)) > public]
1204 pheads = [pn for pn in pheads if phase(unfi, rev(pn)) > public]
1201 if pheads:
1205 if pheads:
1202 tr = pullop.gettransaction()
1206 tr = pullop.gettransaction()
1203 phases.advanceboundary(pullop.repo, tr, public, pheads)
1207 phases.advanceboundary(pullop.repo, tr, public, pheads)
1204
1208
1205 # exclude changesets already draft locally and update the others
1209 # exclude changesets already draft locally and update the others
1206 dheads = [pn for pn in dheads if phase(unfi, rev(pn)) > draft]
1210 dheads = [pn for pn in dheads if phase(unfi, rev(pn)) > draft]
1207 if dheads:
1211 if dheads:
1208 tr = pullop.gettransaction()
1212 tr = pullop.gettransaction()
1209 phases.advanceboundary(pullop.repo, tr, draft, dheads)
1213 phases.advanceboundary(pullop.repo, tr, draft, dheads)
1210
1214
1211 def _pullbookmarks(pullop):
1215 def _pullbookmarks(pullop):
1212 """process the remote bookmark information to update the local one"""
1216 """process the remote bookmark information to update the local one"""
1213 if 'bookmarks' in pullop.stepsdone:
1217 if 'bookmarks' in pullop.stepsdone:
1214 return
1218 return
1215 pullop.stepsdone.add('bookmarks')
1219 pullop.stepsdone.add('bookmarks')
1216 repo = pullop.repo
1220 repo = pullop.repo
1217 remotebookmarks = pullop.remotebookmarks
1221 remotebookmarks = pullop.remotebookmarks
1218 bookmod.updatefromremote(repo.ui, repo, remotebookmarks,
1222 bookmod.updatefromremote(repo.ui, repo, remotebookmarks,
1219 pullop.remote.url(),
1223 pullop.remote.url(),
1220 pullop.gettransaction,
1224 pullop.gettransaction,
1221 explicit=pullop.explicitbookmarks)
1225 explicit=pullop.explicitbookmarks)
1222
1226
1223 def _pullobsolete(pullop):
1227 def _pullobsolete(pullop):
1224 """utility function to pull obsolete markers from a remote
1228 """utility function to pull obsolete markers from a remote
1225
1229
1226 The `gettransaction` is function that return the pull transaction, creating
1230 The `gettransaction` is function that return the pull transaction, creating
1227 one if necessary. We return the transaction to inform the calling code that
1231 one if necessary. We return the transaction to inform the calling code that
1228 a new transaction have been created (when applicable).
1232 a new transaction have been created (when applicable).
1229
1233
1230 Exists mostly to allow overriding for experimentation purpose"""
1234 Exists mostly to allow overriding for experimentation purpose"""
1231 if 'obsmarkers' in pullop.stepsdone:
1235 if 'obsmarkers' in pullop.stepsdone:
1232 return
1236 return
1233 pullop.stepsdone.add('obsmarkers')
1237 pullop.stepsdone.add('obsmarkers')
1234 tr = None
1238 tr = None
1235 if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
1239 if obsolete.isenabled(pullop.repo, obsolete.exchangeopt):
1236 pullop.repo.ui.debug('fetching remote obsolete markers\n')
1240 pullop.repo.ui.debug('fetching remote obsolete markers\n')
1237 remoteobs = pullop.remote.listkeys('obsolete')
1241 remoteobs = pullop.remote.listkeys('obsolete')
1238 if 'dump0' in remoteobs:
1242 if 'dump0' in remoteobs:
1239 tr = pullop.gettransaction()
1243 tr = pullop.gettransaction()
1240 for key in sorted(remoteobs, reverse=True):
1244 for key in sorted(remoteobs, reverse=True):
1241 if key.startswith('dump'):
1245 if key.startswith('dump'):
1242 data = base85.b85decode(remoteobs[key])
1246 data = base85.b85decode(remoteobs[key])
1243 pullop.repo.obsstore.mergemarkers(tr, data)
1247 pullop.repo.obsstore.mergemarkers(tr, data)
1244 pullop.repo.invalidatevolatilesets()
1248 pullop.repo.invalidatevolatilesets()
1245 return tr
1249 return tr
1246
1250
1247 def caps20to10(repo):
1251 def caps20to10(repo):
1248 """return a set with appropriate options to use bundle20 during getbundle"""
1252 """return a set with appropriate options to use bundle20 during getbundle"""
1249 caps = set(['HG20'])
1253 caps = set(['HG20'])
1250 capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
1254 capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
1251 caps.add('bundle2=' + urllib.quote(capsblob))
1255 caps.add('bundle2=' + urllib.quote(capsblob))
1252 return caps
1256 return caps
1253
1257
1254 # List of names of steps to perform for a bundle2 for getbundle, order matters.
1258 # List of names of steps to perform for a bundle2 for getbundle, order matters.
1255 getbundle2partsorder = []
1259 getbundle2partsorder = []
1256
1260
1257 # Mapping between step name and function
1261 # Mapping between step name and function
1258 #
1262 #
1259 # This exists to help extensions wrap steps if necessary
1263 # This exists to help extensions wrap steps if necessary
1260 getbundle2partsmapping = {}
1264 getbundle2partsmapping = {}
1261
1265
1262 def getbundle2partsgenerator(stepname, idx=None):
1266 def getbundle2partsgenerator(stepname, idx=None):
1263 """decorator for function generating bundle2 part for getbundle
1267 """decorator for function generating bundle2 part for getbundle
1264
1268
1265 The function is added to the step -> function mapping and appended to the
1269 The function is added to the step -> function mapping and appended to the
1266 list of steps. Beware that decorated functions will be added in order
1270 list of steps. Beware that decorated functions will be added in order
1267 (this may matter).
1271 (this may matter).
1268
1272
1269 You can only use this decorator for new steps, if you want to wrap a step
1273 You can only use this decorator for new steps, if you want to wrap a step
1270 from an extension, attack the getbundle2partsmapping dictionary directly."""
1274 from an extension, attack the getbundle2partsmapping dictionary directly."""
1271 def dec(func):
1275 def dec(func):
1272 assert stepname not in getbundle2partsmapping
1276 assert stepname not in getbundle2partsmapping
1273 getbundle2partsmapping[stepname] = func
1277 getbundle2partsmapping[stepname] = func
1274 if idx is None:
1278 if idx is None:
1275 getbundle2partsorder.append(stepname)
1279 getbundle2partsorder.append(stepname)
1276 else:
1280 else:
1277 getbundle2partsorder.insert(idx, stepname)
1281 getbundle2partsorder.insert(idx, stepname)
1278 return func
1282 return func
1279 return dec
1283 return dec
1280
1284
1281 def getbundle(repo, source, heads=None, common=None, bundlecaps=None,
1285 def getbundle(repo, source, heads=None, common=None, bundlecaps=None,
1282 **kwargs):
1286 **kwargs):
1283 """return a full bundle (with potentially multiple kind of parts)
1287 """return a full bundle (with potentially multiple kind of parts)
1284
1288
1285 Could be a bundle HG10 or a bundle HG20 depending on bundlecaps
1289 Could be a bundle HG10 or a bundle HG20 depending on bundlecaps
1286 passed. For now, the bundle can contain only changegroup, but this will
1290 passed. For now, the bundle can contain only changegroup, but this will
1287 changes when more part type will be available for bundle2.
1291 changes when more part type will be available for bundle2.
1288
1292
1289 This is different from changegroup.getchangegroup that only returns an HG10
1293 This is different from changegroup.getchangegroup that only returns an HG10
1290 changegroup bundle. They may eventually get reunited in the future when we
1294 changegroup bundle. They may eventually get reunited in the future when we
1291 have a clearer idea of the API we what to query different data.
1295 have a clearer idea of the API we what to query different data.
1292
1296
1293 The implementation is at a very early stage and will get massive rework
1297 The implementation is at a very early stage and will get massive rework
1294 when the API of bundle is refined.
1298 when the API of bundle is refined.
1295 """
1299 """
1296 # bundle10 case
1300 # bundle10 case
1297 usebundle2 = False
1301 usebundle2 = False
1298 if bundlecaps is not None:
1302 if bundlecaps is not None:
1299 usebundle2 = any((cap.startswith('HG2') for cap in bundlecaps))
1303 usebundle2 = any((cap.startswith('HG2') for cap in bundlecaps))
1300 if not usebundle2:
1304 if not usebundle2:
1301 if bundlecaps and not kwargs.get('cg', True):
1305 if bundlecaps and not kwargs.get('cg', True):
1302 raise ValueError(_('request for bundle10 must include changegroup'))
1306 raise ValueError(_('request for bundle10 must include changegroup'))
1303
1307
1304 if kwargs:
1308 if kwargs:
1305 raise ValueError(_('unsupported getbundle arguments: %s')
1309 raise ValueError(_('unsupported getbundle arguments: %s')
1306 % ', '.join(sorted(kwargs.keys())))
1310 % ', '.join(sorted(kwargs.keys())))
1307 return changegroup.getchangegroup(repo, source, heads=heads,
1311 return changegroup.getchangegroup(repo, source, heads=heads,
1308 common=common, bundlecaps=bundlecaps)
1312 common=common, bundlecaps=bundlecaps)
1309
1313
1310 # bundle20 case
1314 # bundle20 case
1311 b2caps = {}
1315 b2caps = {}
1312 for bcaps in bundlecaps:
1316 for bcaps in bundlecaps:
1313 if bcaps.startswith('bundle2='):
1317 if bcaps.startswith('bundle2='):
1314 blob = urllib.unquote(bcaps[len('bundle2='):])
1318 blob = urllib.unquote(bcaps[len('bundle2='):])
1315 b2caps.update(bundle2.decodecaps(blob))
1319 b2caps.update(bundle2.decodecaps(blob))
1316 bundler = bundle2.bundle20(repo.ui, b2caps)
1320 bundler = bundle2.bundle20(repo.ui, b2caps)
1317
1321
1318 kwargs['heads'] = heads
1322 kwargs['heads'] = heads
1319 kwargs['common'] = common
1323 kwargs['common'] = common
1320
1324
1321 for name in getbundle2partsorder:
1325 for name in getbundle2partsorder:
1322 func = getbundle2partsmapping[name]
1326 func = getbundle2partsmapping[name]
1323 func(bundler, repo, source, bundlecaps=bundlecaps, b2caps=b2caps,
1327 func(bundler, repo, source, bundlecaps=bundlecaps, b2caps=b2caps,
1324 **kwargs)
1328 **kwargs)
1325
1329
1326 return util.chunkbuffer(bundler.getchunks())
1330 return util.chunkbuffer(bundler.getchunks())
1327
1331
1328 @getbundle2partsgenerator('changegroup')
1332 @getbundle2partsgenerator('changegroup')
1329 def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
1333 def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
1330 b2caps=None, heads=None, common=None, **kwargs):
1334 b2caps=None, heads=None, common=None, **kwargs):
1331 """add a changegroup part to the requested bundle"""
1335 """add a changegroup part to the requested bundle"""
1332 cg = None
1336 cg = None
1333 if kwargs.get('cg', True):
1337 if kwargs.get('cg', True):
1334 # build changegroup bundle here.
1338 # build changegroup bundle here.
1335 version = None
1339 version = None
1336 cgversions = b2caps.get('changegroup')
1340 cgversions = b2caps.get('changegroup')
1337 getcgkwargs = {}
1341 getcgkwargs = {}
1338 if cgversions: # 3.1 and 3.2 ship with an empty value
1342 if cgversions: # 3.1 and 3.2 ship with an empty value
1339 cgversions = [v for v in cgversions if v in changegroup.packermap]
1343 cgversions = [v for v in cgversions if v in changegroup.packermap]
1340 if not cgversions:
1344 if not cgversions:
1341 raise ValueError(_('no common changegroup version'))
1345 raise ValueError(_('no common changegroup version'))
1342 version = getcgkwargs['version'] = max(cgversions)
1346 version = getcgkwargs['version'] = max(cgversions)
1343 outgoing = changegroup.computeoutgoing(repo, heads, common)
1347 outgoing = changegroup.computeoutgoing(repo, heads, common)
1344 cg = changegroup.getlocalchangegroupraw(repo, source, outgoing,
1348 cg = changegroup.getlocalchangegroupraw(repo, source, outgoing,
1345 bundlecaps=bundlecaps,
1349 bundlecaps=bundlecaps,
1346 **getcgkwargs)
1350 **getcgkwargs)
1347
1351
1348 if cg:
1352 if cg:
1349 part = bundler.newpart('changegroup', data=cg)
1353 part = bundler.newpart('changegroup', data=cg)
1350 if version is not None:
1354 if version is not None:
1351 part.addparam('version', version)
1355 part.addparam('version', version)
1352 part.addparam('nbchanges', str(len(outgoing.missing)), mandatory=False)
1356 part.addparam('nbchanges', str(len(outgoing.missing)), mandatory=False)
1353
1357
1354 @getbundle2partsgenerator('listkeys')
1358 @getbundle2partsgenerator('listkeys')
1355 def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
1359 def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
1356 b2caps=None, **kwargs):
1360 b2caps=None, **kwargs):
1357 """add parts containing listkeys namespaces to the requested bundle"""
1361 """add parts containing listkeys namespaces to the requested bundle"""
1358 listkeys = kwargs.get('listkeys', ())
1362 listkeys = kwargs.get('listkeys', ())
1359 for namespace in listkeys:
1363 for namespace in listkeys:
1360 part = bundler.newpart('listkeys')
1364 part = bundler.newpart('listkeys')
1361 part.addparam('namespace', namespace)
1365 part.addparam('namespace', namespace)
1362 keys = repo.listkeys(namespace).items()
1366 keys = repo.listkeys(namespace).items()
1363 part.data = pushkey.encodekeys(keys)
1367 part.data = pushkey.encodekeys(keys)
1364
1368
1365 @getbundle2partsgenerator('obsmarkers')
1369 @getbundle2partsgenerator('obsmarkers')
1366 def _getbundleobsmarkerpart(bundler, repo, source, bundlecaps=None,
1370 def _getbundleobsmarkerpart(bundler, repo, source, bundlecaps=None,
1367 b2caps=None, heads=None, **kwargs):
1371 b2caps=None, heads=None, **kwargs):
1368 """add an obsolescence markers part to the requested bundle"""
1372 """add an obsolescence markers part to the requested bundle"""
1369 if kwargs.get('obsmarkers', False):
1373 if kwargs.get('obsmarkers', False):
1370 if heads is None:
1374 if heads is None:
1371 heads = repo.heads()
1375 heads = repo.heads()
1372 subset = [c.node() for c in repo.set('::%ln', heads)]
1376 subset = [c.node() for c in repo.set('::%ln', heads)]
1373 markers = repo.obsstore.relevantmarkers(subset)
1377 markers = repo.obsstore.relevantmarkers(subset)
1374 markers = sorted(markers)
1378 markers = sorted(markers)
1375 buildobsmarkerspart(bundler, markers)
1379 buildobsmarkerspart(bundler, markers)
1376
1380
1377 @getbundle2partsgenerator('hgtagsfnodes')
1381 @getbundle2partsgenerator('hgtagsfnodes')
1378 def _getbundletagsfnodes(bundler, repo, source, bundlecaps=None,
1382 def _getbundletagsfnodes(bundler, repo, source, bundlecaps=None,
1379 b2caps=None, heads=None, common=None,
1383 b2caps=None, heads=None, common=None,
1380 **kwargs):
1384 **kwargs):
1381 """Transfer the .hgtags filenodes mapping.
1385 """Transfer the .hgtags filenodes mapping.
1382
1386
1383 Only values for heads in this bundle will be transferred.
1387 Only values for heads in this bundle will be transferred.
1384
1388
1385 The part data consists of pairs of 20 byte changeset node and .hgtags
1389 The part data consists of pairs of 20 byte changeset node and .hgtags
1386 filenodes raw values.
1390 filenodes raw values.
1387 """
1391 """
1388 # Don't send unless:
1392 # Don't send unless:
1389 # - changeset are being exchanged,
1393 # - changeset are being exchanged,
1390 # - the client supports it.
1394 # - the client supports it.
1391 if not (kwargs.get('cg', True) and 'hgtagsfnodes' in b2caps):
1395 if not (kwargs.get('cg', True) and 'hgtagsfnodes' in b2caps):
1392 return
1396 return
1393
1397
1394 outgoing = changegroup.computeoutgoing(repo, heads, common)
1398 outgoing = changegroup.computeoutgoing(repo, heads, common)
1395
1399
1396 if not outgoing.missingheads:
1400 if not outgoing.missingheads:
1397 return
1401 return
1398
1402
1399 cache = tags.hgtagsfnodescache(repo.unfiltered())
1403 cache = tags.hgtagsfnodescache(repo.unfiltered())
1400 chunks = []
1404 chunks = []
1401
1405
1402 # .hgtags fnodes are only relevant for head changesets. While we could
1406 # .hgtags fnodes are only relevant for head changesets. While we could
1403 # transfer values for all known nodes, there will likely be little to
1407 # transfer values for all known nodes, there will likely be little to
1404 # no benefit.
1408 # no benefit.
1405 #
1409 #
1406 # We don't bother using a generator to produce output data because
1410 # We don't bother using a generator to produce output data because
1407 # a) we only have 40 bytes per head and even esoteric numbers of heads
1411 # a) we only have 40 bytes per head and even esoteric numbers of heads
1408 # consume little memory (1M heads is 40MB) b) we don't want to send the
1412 # consume little memory (1M heads is 40MB) b) we don't want to send the
1409 # part if we don't have entries and knowing if we have entries requires
1413 # part if we don't have entries and knowing if we have entries requires
1410 # cache lookups.
1414 # cache lookups.
1411 for node in outgoing.missingheads:
1415 for node in outgoing.missingheads:
1412 # Don't compute missing, as this may slow down serving.
1416 # Don't compute missing, as this may slow down serving.
1413 fnode = cache.getfnode(node, computemissing=False)
1417 fnode = cache.getfnode(node, computemissing=False)
1414 if fnode is not None:
1418 if fnode is not None:
1415 chunks.extend([node, fnode])
1419 chunks.extend([node, fnode])
1416
1420
1417 if chunks:
1421 if chunks:
1418 bundler.newpart('hgtagsfnodes', data=''.join(chunks))
1422 bundler.newpart('hgtagsfnodes', data=''.join(chunks))
1419
1423
1420 def check_heads(repo, their_heads, context):
1424 def check_heads(repo, their_heads, context):
1421 """check if the heads of a repo have been modified
1425 """check if the heads of a repo have been modified
1422
1426
1423 Used by peer for unbundling.
1427 Used by peer for unbundling.
1424 """
1428 """
1425 heads = repo.heads()
1429 heads = repo.heads()
1426 heads_hash = util.sha1(''.join(sorted(heads))).digest()
1430 heads_hash = util.sha1(''.join(sorted(heads))).digest()
1427 if not (their_heads == ['force'] or their_heads == heads or
1431 if not (their_heads == ['force'] or their_heads == heads or
1428 their_heads == ['hashed', heads_hash]):
1432 their_heads == ['hashed', heads_hash]):
1429 # someone else committed/pushed/unbundled while we
1433 # someone else committed/pushed/unbundled while we
1430 # were transferring data
1434 # were transferring data
1431 raise error.PushRaced('repository changed while %s - '
1435 raise error.PushRaced('repository changed while %s - '
1432 'please try again' % context)
1436 'please try again' % context)
1433
1437
1434 def unbundle(repo, cg, heads, source, url):
1438 def unbundle(repo, cg, heads, source, url):
1435 """Apply a bundle to a repo.
1439 """Apply a bundle to a repo.
1436
1440
1437 this function makes sure the repo is locked during the application and have
1441 this function makes sure the repo is locked during the application and have
1438 mechanism to check that no push race occurred between the creation of the
1442 mechanism to check that no push race occurred between the creation of the
1439 bundle and its application.
1443 bundle and its application.
1440
1444
1441 If the push was raced as PushRaced exception is raised."""
1445 If the push was raced as PushRaced exception is raised."""
1442 r = 0
1446 r = 0
1443 # need a transaction when processing a bundle2 stream
1447 # need a transaction when processing a bundle2 stream
1444 # [wlock, lock, tr] - needs to be an array so nested functions can modify it
1448 # [wlock, lock, tr] - needs to be an array so nested functions can modify it
1445 lockandtr = [None, None, None]
1449 lockandtr = [None, None, None]
1446 recordout = None
1450 recordout = None
1447 # quick fix for output mismatch with bundle2 in 3.4
1451 # quick fix for output mismatch with bundle2 in 3.4
1448 captureoutput = repo.ui.configbool('experimental', 'bundle2-output-capture',
1452 captureoutput = repo.ui.configbool('experimental', 'bundle2-output-capture',
1449 False)
1453 False)
1450 if url.startswith('remote:http:') or url.startswith('remote:https:'):
1454 if url.startswith('remote:http:') or url.startswith('remote:https:'):
1451 captureoutput = True
1455 captureoutput = True
1452 try:
1456 try:
1453 check_heads(repo, heads, 'uploading changes')
1457 check_heads(repo, heads, 'uploading changes')
1454 # push can proceed
1458 # push can proceed
1455 if util.safehasattr(cg, 'params'):
1459 if util.safehasattr(cg, 'params'):
1456 r = None
1460 r = None
1457 try:
1461 try:
1458 def gettransaction():
1462 def gettransaction():
1459 if not lockandtr[2]:
1463 if not lockandtr[2]:
1460 lockandtr[0] = repo.wlock()
1464 lockandtr[0] = repo.wlock()
1461 lockandtr[1] = repo.lock()
1465 lockandtr[1] = repo.lock()
1462 lockandtr[2] = repo.transaction(source)
1466 lockandtr[2] = repo.transaction(source)
1463 lockandtr[2].hookargs['source'] = source
1467 lockandtr[2].hookargs['source'] = source
1464 lockandtr[2].hookargs['url'] = url
1468 lockandtr[2].hookargs['url'] = url
1465 lockandtr[2].hookargs['bundle2'] = '1'
1469 lockandtr[2].hookargs['bundle2'] = '1'
1466 return lockandtr[2]
1470 return lockandtr[2]
1467
1471
1468 # Do greedy locking by default until we're satisfied with lazy
1472 # Do greedy locking by default until we're satisfied with lazy
1469 # locking.
1473 # locking.
1470 if not repo.ui.configbool('experimental', 'bundle2lazylocking'):
1474 if not repo.ui.configbool('experimental', 'bundle2lazylocking'):
1471 gettransaction()
1475 gettransaction()
1472
1476
1473 op = bundle2.bundleoperation(repo, gettransaction,
1477 op = bundle2.bundleoperation(repo, gettransaction,
1474 captureoutput=captureoutput)
1478 captureoutput=captureoutput)
1475 try:
1479 try:
1476 op = bundle2.processbundle(repo, cg, op=op)
1480 op = bundle2.processbundle(repo, cg, op=op)
1477 finally:
1481 finally:
1478 r = op.reply
1482 r = op.reply
1479 if captureoutput and r is not None:
1483 if captureoutput and r is not None:
1480 repo.ui.pushbuffer(error=True, subproc=True)
1484 repo.ui.pushbuffer(error=True, subproc=True)
1481 def recordout(output):
1485 def recordout(output):
1482 r.newpart('output', data=output, mandatory=False)
1486 r.newpart('output', data=output, mandatory=False)
1483 if lockandtr[2] is not None:
1487 if lockandtr[2] is not None:
1484 lockandtr[2].close()
1488 lockandtr[2].close()
1485 except BaseException as exc:
1489 except BaseException as exc:
1486 exc.duringunbundle2 = True
1490 exc.duringunbundle2 = True
1487 if captureoutput and r is not None:
1491 if captureoutput and r is not None:
1488 parts = exc._bundle2salvagedoutput = r.salvageoutput()
1492 parts = exc._bundle2salvagedoutput = r.salvageoutput()
1489 def recordout(output):
1493 def recordout(output):
1490 part = bundle2.bundlepart('output', data=output,
1494 part = bundle2.bundlepart('output', data=output,
1491 mandatory=False)
1495 mandatory=False)
1492 parts.append(part)
1496 parts.append(part)
1493 raise
1497 raise
1494 else:
1498 else:
1495 lockandtr[1] = repo.lock()
1499 lockandtr[1] = repo.lock()
1496 r = changegroup.addchangegroup(repo, cg, source, url)
1500 r = changegroup.addchangegroup(repo, cg, source, url)
1497 finally:
1501 finally:
1498 lockmod.release(lockandtr[2], lockandtr[1], lockandtr[0])
1502 lockmod.release(lockandtr[2], lockandtr[1], lockandtr[0])
1499 if recordout is not None:
1503 if recordout is not None:
1500 recordout(repo.ui.popbuffer())
1504 recordout(repo.ui.popbuffer())
1501 return r
1505 return r
1506
1507 def _maybeapplyclonebundle(pullop):
1508 """Apply a clone bundle from a remote, if possible."""
1509
1510 repo = pullop.repo
1511 remote = pullop.remote
1512
1513 if not repo.ui.configbool('experimental', 'clonebundles', False):
1514 return
1515
1516 if pullop.heads:
1517 return
1518
1519 if not remote.capable('clonebundles'):
1520 return
1521
1522 res = remote._call('clonebundles')
1523 entries = parseclonebundlesmanifest(res)
1524
1525 # TODO filter entries by supported features.
1526 # TODO sort entries by user preferences.
1527
1528 if not entries:
1529 repo.ui.note(_('no clone bundles available on remote; '
1530 'falling back to regular clone\n'))
1531 return
1532
1533 url = entries[0]['URL']
1534 repo.ui.status(_('applying clone bundle from %s\n') % url)
1535 if trypullbundlefromurl(repo.ui, repo, url):
1536 repo.ui.status(_('finished applying clone bundle\n'))
1537 # Bundle failed.
1538 #
1539 # We abort by default to avoid the thundering herd of
1540 # clients flooding a server that was expecting expensive
1541 # clone load to be offloaded.
1542 elif repo.ui.configbool('ui', 'clonebundlefallback', False):
1543 repo.ui.warn(_('falling back to normal clone\n'))
1544 else:
1545 raise error.Abort(_('error applying bundle'),
1546 hint=_('consider contacting the server '
1547 'operator if this error persists'))
1548
1549 def parseclonebundlesmanifest(s):
1550 """Parses the raw text of a clone bundles manifest.
1551
1552 Returns a list of dicts. The dicts have a ``URL`` key corresponding
1553 to the URL and other keys are the attributes for the entry.
1554 """
1555 m = []
1556 for line in s.splitlines():
1557 fields = line.split()
1558 if not fields:
1559 continue
1560 attrs = {'URL': fields[0]}
1561 for rawattr in fields[1:]:
1562 key, value = rawattr.split('=', 1)
1563 attrs[urllib.unquote(key)] = urllib.unquote(value)
1564
1565 m.append(attrs)
1566
1567 return m
1568
1569 def trypullbundlefromurl(ui, repo, url):
1570 """Attempt to apply a bundle from a URL."""
1571 lock = repo.lock()
1572 try:
1573 tr = repo.transaction('bundleurl')
1574 try:
1575 try:
1576 fh = urlmod.open(ui, url)
1577 cg = readbundle(ui, fh, 'stream')
1578 changegroup.addchangegroup(repo, cg, 'clonebundles', url)
1579 tr.close()
1580 return True
1581 except urllib2.HTTPError as e:
1582 ui.warn(_('HTTP error fetching bundle: %s\n') % str(e))
1583 except urllib2.URLError as e:
1584 ui.warn(_('error fetching bundle: %s\n') % e.reason)
1585
1586 return False
1587 finally:
1588 tr.release()
1589 finally:
1590 lock.release()
@@ -1,1850 +1,1865 b''
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Format
14 Format
15 ======
15 ======
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself: global configuration like
33 appropriate configuration files yourself: global configuration like
34 the username setting is typically put into
34 the username setting is typically put into
35 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
35 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
36 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
37
37
38 The names of these files depend on the system on which Mercurial is
38 The names of these files depend on the system on which Mercurial is
39 installed. ``*.rc`` files from a single directory are read in
39 installed. ``*.rc`` files from a single directory are read in
40 alphabetical order, later ones overriding earlier ones. Where multiple
40 alphabetical order, later ones overriding earlier ones. Where multiple
41 paths are given below, settings from earlier paths override later
41 paths are given below, settings from earlier paths override later
42 ones.
42 ones.
43
43
44 .. container:: verbose.unix
44 .. container:: verbose.unix
45
45
46 On Unix, the following files are consulted:
46 On Unix, the following files are consulted:
47
47
48 - ``<repo>/.hg/hgrc`` (per-repository)
48 - ``<repo>/.hg/hgrc`` (per-repository)
49 - ``$HOME/.hgrc`` (per-user)
49 - ``$HOME/.hgrc`` (per-user)
50 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
50 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
51 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
51 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
52 - ``/etc/mercurial/hgrc`` (per-system)
52 - ``/etc/mercurial/hgrc`` (per-system)
53 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
53 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
54 - ``<internal>/default.d/*.rc`` (defaults)
54 - ``<internal>/default.d/*.rc`` (defaults)
55
55
56 .. container:: verbose.windows
56 .. container:: verbose.windows
57
57
58 On Windows, the following files are consulted:
58 On Windows, the following files are consulted:
59
59
60 - ``<repo>/.hg/hgrc`` (per-repository)
60 - ``<repo>/.hg/hgrc`` (per-repository)
61 - ``%USERPROFILE%\.hgrc`` (per-user)
61 - ``%USERPROFILE%\.hgrc`` (per-user)
62 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
62 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
63 - ``%HOME%\.hgrc`` (per-user)
63 - ``%HOME%\.hgrc`` (per-user)
64 - ``%HOME%\Mercurial.ini`` (per-user)
64 - ``%HOME%\Mercurial.ini`` (per-user)
65 - ``<install-dir>\Mercurial.ini`` (per-installation)
65 - ``<install-dir>\Mercurial.ini`` (per-installation)
66 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
66 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
67 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
67 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
68 - ``<internal>/default.d/*.rc`` (defaults)
68 - ``<internal>/default.d/*.rc`` (defaults)
69
69
70 .. note::
70 .. note::
71
71
72 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
72 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
73 is used when running 32-bit Python on 64-bit Windows.
73 is used when running 32-bit Python on 64-bit Windows.
74
74
75 .. container:: verbose.plan9
75 .. container:: verbose.plan9
76
76
77 On Plan9, the following files are consulted:
77 On Plan9, the following files are consulted:
78
78
79 - ``<repo>/.hg/hgrc`` (per-repository)
79 - ``<repo>/.hg/hgrc`` (per-repository)
80 - ``$home/lib/hgrc`` (per-user)
80 - ``$home/lib/hgrc`` (per-user)
81 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
81 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
82 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
82 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
83 - ``/lib/mercurial/hgrc`` (per-system)
83 - ``/lib/mercurial/hgrc`` (per-system)
84 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
84 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
85 - ``<internal>/default.d/*.rc`` (defaults)
85 - ``<internal>/default.d/*.rc`` (defaults)
86
86
87 Per-repository configuration options only apply in a
87 Per-repository configuration options only apply in a
88 particular repository. This file is not version-controlled, and
88 particular repository. This file is not version-controlled, and
89 will not get transferred during a "clone" operation. Options in
89 will not get transferred during a "clone" operation. Options in
90 this file override options in all other configuration files. On
90 this file override options in all other configuration files. On
91 Plan 9 and Unix, most of this file will be ignored if it doesn't
91 Plan 9 and Unix, most of this file will be ignored if it doesn't
92 belong to a trusted user or to a trusted group. See
92 belong to a trusted user or to a trusted group. See
93 :hg:`help config.trusted` for more details.
93 :hg:`help config.trusted` for more details.
94
94
95 Per-user configuration file(s) are for the user running Mercurial. On
95 Per-user configuration file(s) are for the user running Mercurial. On
96 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
96 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
97 files apply to all Mercurial commands executed by this user in any
97 files apply to all Mercurial commands executed by this user in any
98 directory. Options in these files override per-system and per-installation
98 directory. Options in these files override per-system and per-installation
99 options.
99 options.
100
100
101 Per-installation configuration files are searched for in the
101 Per-installation configuration files are searched for in the
102 directory where Mercurial is installed. ``<install-root>`` is the
102 directory where Mercurial is installed. ``<install-root>`` is the
103 parent directory of the **hg** executable (or symlink) being run. For
103 parent directory of the **hg** executable (or symlink) being run. For
104 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
104 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
105 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
105 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
106 to all Mercurial commands executed by any user in any directory.
106 to all Mercurial commands executed by any user in any directory.
107
107
108 Per-installation configuration files are for the system on
108 Per-installation configuration files are for the system on
109 which Mercurial is running. Options in these files apply to all
109 which Mercurial is running. Options in these files apply to all
110 Mercurial commands executed by any user in any directory. Registry
110 Mercurial commands executed by any user in any directory. Registry
111 keys contain PATH-like strings, every part of which must reference
111 keys contain PATH-like strings, every part of which must reference
112 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
112 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
113 be read. Mercurial checks each of these locations in the specified
113 be read. Mercurial checks each of these locations in the specified
114 order until one or more configuration files are detected.
114 order until one or more configuration files are detected.
115
115
116 Per-system configuration files are for the system on which Mercurial
116 Per-system configuration files are for the system on which Mercurial
117 is running. Options in these files apply to all Mercurial commands
117 is running. Options in these files apply to all Mercurial commands
118 executed by any user in any directory. Options in these files
118 executed by any user in any directory. Options in these files
119 override per-installation options.
119 override per-installation options.
120
120
121 Mercurial comes with some default configuration. The default configuration
121 Mercurial comes with some default configuration. The default configuration
122 files are installed with Mercurial and will be overwritten on upgrades. Default
122 files are installed with Mercurial and will be overwritten on upgrades. Default
123 configuration files should never be edited by users or administrators but can
123 configuration files should never be edited by users or administrators but can
124 be overridden in other configuration files. So far the directory only contains
124 be overridden in other configuration files. So far the directory only contains
125 merge tool configuration but packagers can also put other default configuration
125 merge tool configuration but packagers can also put other default configuration
126 there.
126 there.
127
127
128 Syntax
128 Syntax
129 ======
129 ======
130
130
131 A configuration file consists of sections, led by a ``[section]`` header
131 A configuration file consists of sections, led by a ``[section]`` header
132 and followed by ``name = value`` entries (sometimes called
132 and followed by ``name = value`` entries (sometimes called
133 ``configuration keys``)::
133 ``configuration keys``)::
134
134
135 [spam]
135 [spam]
136 eggs=ham
136 eggs=ham
137 green=
137 green=
138 eggs
138 eggs
139
139
140 Each line contains one entry. If the lines that follow are indented,
140 Each line contains one entry. If the lines that follow are indented,
141 they are treated as continuations of that entry. Leading whitespace is
141 they are treated as continuations of that entry. Leading whitespace is
142 removed from values. Empty lines are skipped. Lines beginning with
142 removed from values. Empty lines are skipped. Lines beginning with
143 ``#`` or ``;`` are ignored and may be used to provide comments.
143 ``#`` or ``;`` are ignored and may be used to provide comments.
144
144
145 Configuration keys can be set multiple times, in which case Mercurial
145 Configuration keys can be set multiple times, in which case Mercurial
146 will use the value that was configured last. As an example::
146 will use the value that was configured last. As an example::
147
147
148 [spam]
148 [spam]
149 eggs=large
149 eggs=large
150 ham=serrano
150 ham=serrano
151 eggs=small
151 eggs=small
152
152
153 This would set the configuration key named ``eggs`` to ``small``.
153 This would set the configuration key named ``eggs`` to ``small``.
154
154
155 It is also possible to define a section multiple times. A section can
155 It is also possible to define a section multiple times. A section can
156 be redefined on the same and/or on different configuration files. For
156 be redefined on the same and/or on different configuration files. For
157 example::
157 example::
158
158
159 [foo]
159 [foo]
160 eggs=large
160 eggs=large
161 ham=serrano
161 ham=serrano
162 eggs=small
162 eggs=small
163
163
164 [bar]
164 [bar]
165 eggs=ham
165 eggs=ham
166 green=
166 green=
167 eggs
167 eggs
168
168
169 [foo]
169 [foo]
170 ham=prosciutto
170 ham=prosciutto
171 eggs=medium
171 eggs=medium
172 bread=toasted
172 bread=toasted
173
173
174 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
174 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
175 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
175 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
176 respectively. As you can see there only thing that matters is the last
176 respectively. As you can see there only thing that matters is the last
177 value that was set for each of the configuration keys.
177 value that was set for each of the configuration keys.
178
178
179 If a configuration key is set multiple times in different
179 If a configuration key is set multiple times in different
180 configuration files the final value will depend on the order in which
180 configuration files the final value will depend on the order in which
181 the different configuration files are read, with settings from earlier
181 the different configuration files are read, with settings from earlier
182 paths overriding later ones as described on the ``Files`` section
182 paths overriding later ones as described on the ``Files`` section
183 above.
183 above.
184
184
185 A line of the form ``%include file`` will include ``file`` into the
185 A line of the form ``%include file`` will include ``file`` into the
186 current configuration file. The inclusion is recursive, which means
186 current configuration file. The inclusion is recursive, which means
187 that included files can include other files. Filenames are relative to
187 that included files can include other files. Filenames are relative to
188 the configuration file in which the ``%include`` directive is found.
188 the configuration file in which the ``%include`` directive is found.
189 Environment variables and ``~user`` constructs are expanded in
189 Environment variables and ``~user`` constructs are expanded in
190 ``file``. This lets you do something like::
190 ``file``. This lets you do something like::
191
191
192 %include ~/.hgrc.d/$HOST.rc
192 %include ~/.hgrc.d/$HOST.rc
193
193
194 to include a different configuration file on each computer you use.
194 to include a different configuration file on each computer you use.
195
195
196 A line with ``%unset name`` will remove ``name`` from the current
196 A line with ``%unset name`` will remove ``name`` from the current
197 section, if it has been set previously.
197 section, if it has been set previously.
198
198
199 The values are either free-form text strings, lists of text strings,
199 The values are either free-form text strings, lists of text strings,
200 or Boolean values. Boolean values can be set to true using any of "1",
200 or Boolean values. Boolean values can be set to true using any of "1",
201 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
201 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
202 (all case insensitive).
202 (all case insensitive).
203
203
204 List values are separated by whitespace or comma, except when values are
204 List values are separated by whitespace or comma, except when values are
205 placed in double quotation marks::
205 placed in double quotation marks::
206
206
207 allow_read = "John Doe, PhD", brian, betty
207 allow_read = "John Doe, PhD", brian, betty
208
208
209 Quotation marks can be escaped by prefixing them with a backslash. Only
209 Quotation marks can be escaped by prefixing them with a backslash. Only
210 quotation marks at the beginning of a word is counted as a quotation
210 quotation marks at the beginning of a word is counted as a quotation
211 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
211 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
212
212
213 Sections
213 Sections
214 ========
214 ========
215
215
216 This section describes the different sections that may appear in a
216 This section describes the different sections that may appear in a
217 Mercurial configuration file, the purpose of each section, its possible
217 Mercurial configuration file, the purpose of each section, its possible
218 keys, and their possible values.
218 keys, and their possible values.
219
219
220 ``alias``
220 ``alias``
221 ---------
221 ---------
222
222
223 Defines command aliases.
223 Defines command aliases.
224
224
225 Aliases allow you to define your own commands in terms of other
225 Aliases allow you to define your own commands in terms of other
226 commands (or aliases), optionally including arguments. Positional
226 commands (or aliases), optionally including arguments. Positional
227 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
227 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
228 are expanded by Mercurial before execution. Positional arguments not
228 are expanded by Mercurial before execution. Positional arguments not
229 already used by ``$N`` in the definition are put at the end of the
229 already used by ``$N`` in the definition are put at the end of the
230 command to be executed.
230 command to be executed.
231
231
232 Alias definitions consist of lines of the form::
232 Alias definitions consist of lines of the form::
233
233
234 <alias> = <command> [<argument>]...
234 <alias> = <command> [<argument>]...
235
235
236 For example, this definition::
236 For example, this definition::
237
237
238 latest = log --limit 5
238 latest = log --limit 5
239
239
240 creates a new command ``latest`` that shows only the five most recent
240 creates a new command ``latest`` that shows only the five most recent
241 changesets. You can define subsequent aliases using earlier ones::
241 changesets. You can define subsequent aliases using earlier ones::
242
242
243 stable5 = latest -b stable
243 stable5 = latest -b stable
244
244
245 .. note::
245 .. note::
246
246
247 It is possible to create aliases with the same names as
247 It is possible to create aliases with the same names as
248 existing commands, which will then override the original
248 existing commands, which will then override the original
249 definitions. This is almost always a bad idea!
249 definitions. This is almost always a bad idea!
250
250
251 An alias can start with an exclamation point (``!``) to make it a
251 An alias can start with an exclamation point (``!``) to make it a
252 shell alias. A shell alias is executed with the shell and will let you
252 shell alias. A shell alias is executed with the shell and will let you
253 run arbitrary commands. As an example, ::
253 run arbitrary commands. As an example, ::
254
254
255 echo = !echo $@
255 echo = !echo $@
256
256
257 will let you do ``hg echo foo`` to have ``foo`` printed in your
257 will let you do ``hg echo foo`` to have ``foo`` printed in your
258 terminal. A better example might be::
258 terminal. A better example might be::
259
259
260 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
260 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
261
261
262 which will make ``hg purge`` delete all unknown files in the
262 which will make ``hg purge`` delete all unknown files in the
263 repository in the same manner as the purge extension.
263 repository in the same manner as the purge extension.
264
264
265 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
265 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
266 expand to the command arguments. Unmatched arguments are
266 expand to the command arguments. Unmatched arguments are
267 removed. ``$0`` expands to the alias name and ``$@`` expands to all
267 removed. ``$0`` expands to the alias name and ``$@`` expands to all
268 arguments separated by a space. ``"$@"`` (with quotes) expands to all
268 arguments separated by a space. ``"$@"`` (with quotes) expands to all
269 arguments quoted individually and separated by a space. These expansions
269 arguments quoted individually and separated by a space. These expansions
270 happen before the command is passed to the shell.
270 happen before the command is passed to the shell.
271
271
272 Shell aliases are executed in an environment where ``$HG`` expands to
272 Shell aliases are executed in an environment where ``$HG`` expands to
273 the path of the Mercurial that was used to execute the alias. This is
273 the path of the Mercurial that was used to execute the alias. This is
274 useful when you want to call further Mercurial commands in a shell
274 useful when you want to call further Mercurial commands in a shell
275 alias, as was done above for the purge alias. In addition,
275 alias, as was done above for the purge alias. In addition,
276 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
276 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
277 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
277 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
278
278
279 .. note::
279 .. note::
280
280
281 Some global configuration options such as ``-R`` are
281 Some global configuration options such as ``-R`` are
282 processed before shell aliases and will thus not be passed to
282 processed before shell aliases and will thus not be passed to
283 aliases.
283 aliases.
284
284
285
285
286 ``annotate``
286 ``annotate``
287 ------------
287 ------------
288
288
289 Settings used when displaying file annotations. All values are
289 Settings used when displaying file annotations. All values are
290 Booleans and default to False. See :hg:`help config.diff` for
290 Booleans and default to False. See :hg:`help config.diff` for
291 related options for the diff command.
291 related options for the diff command.
292
292
293 ``ignorews``
293 ``ignorews``
294 Ignore white space when comparing lines.
294 Ignore white space when comparing lines.
295
295
296 ``ignorewsamount``
296 ``ignorewsamount``
297 Ignore changes in the amount of white space.
297 Ignore changes in the amount of white space.
298
298
299 ``ignoreblanklines``
299 ``ignoreblanklines``
300 Ignore changes whose lines are all blank.
300 Ignore changes whose lines are all blank.
301
301
302
302
303 ``auth``
303 ``auth``
304 --------
304 --------
305
305
306 Authentication credentials for HTTP authentication. This section
306 Authentication credentials for HTTP authentication. This section
307 allows you to store usernames and passwords for use when logging
307 allows you to store usernames and passwords for use when logging
308 *into* HTTP servers. See :hg:`help config.web` if
308 *into* HTTP servers. See :hg:`help config.web` if
309 you want to configure *who* can login to your HTTP server.
309 you want to configure *who* can login to your HTTP server.
310
310
311 Each line has the following format::
311 Each line has the following format::
312
312
313 <name>.<argument> = <value>
313 <name>.<argument> = <value>
314
314
315 where ``<name>`` is used to group arguments into authentication
315 where ``<name>`` is used to group arguments into authentication
316 entries. Example::
316 entries. Example::
317
317
318 foo.prefix = hg.intevation.org/mercurial
318 foo.prefix = hg.intevation.org/mercurial
319 foo.username = foo
319 foo.username = foo
320 foo.password = bar
320 foo.password = bar
321 foo.schemes = http https
321 foo.schemes = http https
322
322
323 bar.prefix = secure.example.org
323 bar.prefix = secure.example.org
324 bar.key = path/to/file.key
324 bar.key = path/to/file.key
325 bar.cert = path/to/file.cert
325 bar.cert = path/to/file.cert
326 bar.schemes = https
326 bar.schemes = https
327
327
328 Supported arguments:
328 Supported arguments:
329
329
330 ``prefix``
330 ``prefix``
331 Either ``*`` or a URI prefix with or without the scheme part.
331 Either ``*`` or a URI prefix with or without the scheme part.
332 The authentication entry with the longest matching prefix is used
332 The authentication entry with the longest matching prefix is used
333 (where ``*`` matches everything and counts as a match of length
333 (where ``*`` matches everything and counts as a match of length
334 1). If the prefix doesn't include a scheme, the match is performed
334 1). If the prefix doesn't include a scheme, the match is performed
335 against the URI with its scheme stripped as well, and the schemes
335 against the URI with its scheme stripped as well, and the schemes
336 argument, q.v., is then subsequently consulted.
336 argument, q.v., is then subsequently consulted.
337
337
338 ``username``
338 ``username``
339 Optional. Username to authenticate with. If not given, and the
339 Optional. Username to authenticate with. If not given, and the
340 remote site requires basic or digest authentication, the user will
340 remote site requires basic or digest authentication, the user will
341 be prompted for it. Environment variables are expanded in the
341 be prompted for it. Environment variables are expanded in the
342 username letting you do ``foo.username = $USER``. If the URI
342 username letting you do ``foo.username = $USER``. If the URI
343 includes a username, only ``[auth]`` entries with a matching
343 includes a username, only ``[auth]`` entries with a matching
344 username or without a username will be considered.
344 username or without a username will be considered.
345
345
346 ``password``
346 ``password``
347 Optional. Password to authenticate with. If not given, and the
347 Optional. Password to authenticate with. If not given, and the
348 remote site requires basic or digest authentication, the user
348 remote site requires basic or digest authentication, the user
349 will be prompted for it.
349 will be prompted for it.
350
350
351 ``key``
351 ``key``
352 Optional. PEM encoded client certificate key file. Environment
352 Optional. PEM encoded client certificate key file. Environment
353 variables are expanded in the filename.
353 variables are expanded in the filename.
354
354
355 ``cert``
355 ``cert``
356 Optional. PEM encoded client certificate chain file. Environment
356 Optional. PEM encoded client certificate chain file. Environment
357 variables are expanded in the filename.
357 variables are expanded in the filename.
358
358
359 ``schemes``
359 ``schemes``
360 Optional. Space separated list of URI schemes to use this
360 Optional. Space separated list of URI schemes to use this
361 authentication entry with. Only used if the prefix doesn't include
361 authentication entry with. Only used if the prefix doesn't include
362 a scheme. Supported schemes are http and https. They will match
362 a scheme. Supported schemes are http and https. They will match
363 static-http and static-https respectively, as well.
363 static-http and static-https respectively, as well.
364 (default: https)
364 (default: https)
365
365
366 If no suitable authentication entry is found, the user is prompted
366 If no suitable authentication entry is found, the user is prompted
367 for credentials as usual if required by the remote.
367 for credentials as usual if required by the remote.
368
368
369
369
370 ``committemplate``
370 ``committemplate``
371 ------------------
371 ------------------
372
372
373 ``changeset``
373 ``changeset``
374 String: configuration in this section is used as the template to
374 String: configuration in this section is used as the template to
375 customize the text shown in the editor when committing.
375 customize the text shown in the editor when committing.
376
376
377 In addition to pre-defined template keywords, commit log specific one
377 In addition to pre-defined template keywords, commit log specific one
378 below can be used for customization:
378 below can be used for customization:
379
379
380 ``extramsg``
380 ``extramsg``
381 String: Extra message (typically 'Leave message empty to abort
381 String: Extra message (typically 'Leave message empty to abort
382 commit.'). This may be changed by some commands or extensions.
382 commit.'). This may be changed by some commands or extensions.
383
383
384 For example, the template configuration below shows as same text as
384 For example, the template configuration below shows as same text as
385 one shown by default::
385 one shown by default::
386
386
387 [committemplate]
387 [committemplate]
388 changeset = {desc}\n\n
388 changeset = {desc}\n\n
389 HG: Enter commit message. Lines beginning with 'HG:' are removed.
389 HG: Enter commit message. Lines beginning with 'HG:' are removed.
390 HG: {extramsg}
390 HG: {extramsg}
391 HG: --
391 HG: --
392 HG: user: {author}\n{ifeq(p2rev, "-1", "",
392 HG: user: {author}\n{ifeq(p2rev, "-1", "",
393 "HG: branch merge\n")
393 "HG: branch merge\n")
394 }HG: branch '{branch}'\n{if(activebookmark,
394 }HG: branch '{branch}'\n{if(activebookmark,
395 "HG: bookmark '{activebookmark}'\n") }{subrepos %
395 "HG: bookmark '{activebookmark}'\n") }{subrepos %
396 "HG: subrepo {subrepo}\n" }{file_adds %
396 "HG: subrepo {subrepo}\n" }{file_adds %
397 "HG: added {file}\n" }{file_mods %
397 "HG: added {file}\n" }{file_mods %
398 "HG: changed {file}\n" }{file_dels %
398 "HG: changed {file}\n" }{file_dels %
399 "HG: removed {file}\n" }{if(files, "",
399 "HG: removed {file}\n" }{if(files, "",
400 "HG: no files changed\n")}
400 "HG: no files changed\n")}
401
401
402 .. note::
402 .. note::
403
403
404 For some problematic encodings (see :hg:`help win32mbcs` for
404 For some problematic encodings (see :hg:`help win32mbcs` for
405 detail), this customization should be configured carefully, to
405 detail), this customization should be configured carefully, to
406 avoid showing broken characters.
406 avoid showing broken characters.
407
407
408 For example, if a multibyte character ending with backslash (0x5c) is
408 For example, if a multibyte character ending with backslash (0x5c) is
409 followed by the ASCII character 'n' in the customized template,
409 followed by the ASCII character 'n' in the customized template,
410 the sequence of backslash and 'n' is treated as line-feed unexpectedly
410 the sequence of backslash and 'n' is treated as line-feed unexpectedly
411 (and the multibyte character is broken, too).
411 (and the multibyte character is broken, too).
412
412
413 Customized template is used for commands below (``--edit`` may be
413 Customized template is used for commands below (``--edit`` may be
414 required):
414 required):
415
415
416 - :hg:`backout`
416 - :hg:`backout`
417 - :hg:`commit`
417 - :hg:`commit`
418 - :hg:`fetch` (for merge commit only)
418 - :hg:`fetch` (for merge commit only)
419 - :hg:`graft`
419 - :hg:`graft`
420 - :hg:`histedit`
420 - :hg:`histedit`
421 - :hg:`import`
421 - :hg:`import`
422 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
422 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
423 - :hg:`rebase`
423 - :hg:`rebase`
424 - :hg:`shelve`
424 - :hg:`shelve`
425 - :hg:`sign`
425 - :hg:`sign`
426 - :hg:`tag`
426 - :hg:`tag`
427 - :hg:`transplant`
427 - :hg:`transplant`
428
428
429 Configuring items below instead of ``changeset`` allows showing
429 Configuring items below instead of ``changeset`` allows showing
430 customized message only for specific actions, or showing different
430 customized message only for specific actions, or showing different
431 messages for each action.
431 messages for each action.
432
432
433 - ``changeset.backout`` for :hg:`backout`
433 - ``changeset.backout`` for :hg:`backout`
434 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
434 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
435 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
435 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
436 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
436 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
437 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
437 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
438 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
438 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
439 - ``changeset.gpg.sign`` for :hg:`sign`
439 - ``changeset.gpg.sign`` for :hg:`sign`
440 - ``changeset.graft`` for :hg:`graft`
440 - ``changeset.graft`` for :hg:`graft`
441 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
441 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
442 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
442 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
443 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
443 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
444 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
444 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
445 - ``changeset.import.bypass`` for :hg:`import --bypass`
445 - ``changeset.import.bypass`` for :hg:`import --bypass`
446 - ``changeset.import.normal.merge`` for :hg:`import` on merges
446 - ``changeset.import.normal.merge`` for :hg:`import` on merges
447 - ``changeset.import.normal.normal`` for :hg:`import` on other
447 - ``changeset.import.normal.normal`` for :hg:`import` on other
448 - ``changeset.mq.qnew`` for :hg:`qnew`
448 - ``changeset.mq.qnew`` for :hg:`qnew`
449 - ``changeset.mq.qfold`` for :hg:`qfold`
449 - ``changeset.mq.qfold`` for :hg:`qfold`
450 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
450 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
451 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
451 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
452 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
452 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
453 - ``changeset.rebase.normal`` for :hg:`rebase` on other
453 - ``changeset.rebase.normal`` for :hg:`rebase` on other
454 - ``changeset.shelve.shelve`` for :hg:`shelve`
454 - ``changeset.shelve.shelve`` for :hg:`shelve`
455 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
455 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
456 - ``changeset.tag.remove`` for :hg:`tag --remove`
456 - ``changeset.tag.remove`` for :hg:`tag --remove`
457 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
457 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
458 - ``changeset.transplant.normal`` for :hg:`transplant` on other
458 - ``changeset.transplant.normal`` for :hg:`transplant` on other
459
459
460 These dot-separated lists of names are treated as hierarchical ones.
460 These dot-separated lists of names are treated as hierarchical ones.
461 For example, ``changeset.tag.remove`` customizes the commit message
461 For example, ``changeset.tag.remove`` customizes the commit message
462 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
462 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
463 commit message for :hg:`tag` regardless of ``--remove`` option.
463 commit message for :hg:`tag` regardless of ``--remove`` option.
464
464
465 When the external editor is invoked for a commit, the corresponding
465 When the external editor is invoked for a commit, the corresponding
466 dot-separated list of names without the ``changeset.`` prefix
466 dot-separated list of names without the ``changeset.`` prefix
467 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
467 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
468 variable.
468 variable.
469
469
470 In this section, items other than ``changeset`` can be referred from
470 In this section, items other than ``changeset`` can be referred from
471 others. For example, the configuration to list committed files up
471 others. For example, the configuration to list committed files up
472 below can be referred as ``{listupfiles}``::
472 below can be referred as ``{listupfiles}``::
473
473
474 [committemplate]
474 [committemplate]
475 listupfiles = {file_adds %
475 listupfiles = {file_adds %
476 "HG: added {file}\n" }{file_mods %
476 "HG: added {file}\n" }{file_mods %
477 "HG: changed {file}\n" }{file_dels %
477 "HG: changed {file}\n" }{file_dels %
478 "HG: removed {file}\n" }{if(files, "",
478 "HG: removed {file}\n" }{if(files, "",
479 "HG: no files changed\n")}
479 "HG: no files changed\n")}
480
480
481 ``decode/encode``
481 ``decode/encode``
482 -----------------
482 -----------------
483
483
484 Filters for transforming files on checkout/checkin. This would
484 Filters for transforming files on checkout/checkin. This would
485 typically be used for newline processing or other
485 typically be used for newline processing or other
486 localization/canonicalization of files.
486 localization/canonicalization of files.
487
487
488 Filters consist of a filter pattern followed by a filter command.
488 Filters consist of a filter pattern followed by a filter command.
489 Filter patterns are globs by default, rooted at the repository root.
489 Filter patterns are globs by default, rooted at the repository root.
490 For example, to match any file ending in ``.txt`` in the root
490 For example, to match any file ending in ``.txt`` in the root
491 directory only, use the pattern ``*.txt``. To match any file ending
491 directory only, use the pattern ``*.txt``. To match any file ending
492 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
492 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
493 For each file only the first matching filter applies.
493 For each file only the first matching filter applies.
494
494
495 The filter command can start with a specifier, either ``pipe:`` or
495 The filter command can start with a specifier, either ``pipe:`` or
496 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
496 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
497
497
498 A ``pipe:`` command must accept data on stdin and return the transformed
498 A ``pipe:`` command must accept data on stdin and return the transformed
499 data on stdout.
499 data on stdout.
500
500
501 Pipe example::
501 Pipe example::
502
502
503 [encode]
503 [encode]
504 # uncompress gzip files on checkin to improve delta compression
504 # uncompress gzip files on checkin to improve delta compression
505 # note: not necessarily a good idea, just an example
505 # note: not necessarily a good idea, just an example
506 *.gz = pipe: gunzip
506 *.gz = pipe: gunzip
507
507
508 [decode]
508 [decode]
509 # recompress gzip files when writing them to the working dir (we
509 # recompress gzip files when writing them to the working dir (we
510 # can safely omit "pipe:", because it's the default)
510 # can safely omit "pipe:", because it's the default)
511 *.gz = gzip
511 *.gz = gzip
512
512
513 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
513 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
514 with the name of a temporary file that contains the data to be
514 with the name of a temporary file that contains the data to be
515 filtered by the command. The string ``OUTFILE`` is replaced with the name
515 filtered by the command. The string ``OUTFILE`` is replaced with the name
516 of an empty temporary file, where the filtered data must be written by
516 of an empty temporary file, where the filtered data must be written by
517 the command.
517 the command.
518
518
519 .. note::
519 .. note::
520
520
521 The tempfile mechanism is recommended for Windows systems,
521 The tempfile mechanism is recommended for Windows systems,
522 where the standard shell I/O redirection operators often have
522 where the standard shell I/O redirection operators often have
523 strange effects and may corrupt the contents of your files.
523 strange effects and may corrupt the contents of your files.
524
524
525 This filter mechanism is used internally by the ``eol`` extension to
525 This filter mechanism is used internally by the ``eol`` extension to
526 translate line ending characters between Windows (CRLF) and Unix (LF)
526 translate line ending characters between Windows (CRLF) and Unix (LF)
527 format. We suggest you use the ``eol`` extension for convenience.
527 format. We suggest you use the ``eol`` extension for convenience.
528
528
529
529
530 ``defaults``
530 ``defaults``
531 ------------
531 ------------
532
532
533 (defaults are deprecated. Don't use them. Use aliases instead.)
533 (defaults are deprecated. Don't use them. Use aliases instead.)
534
534
535 Use the ``[defaults]`` section to define command defaults, i.e. the
535 Use the ``[defaults]`` section to define command defaults, i.e. the
536 default options/arguments to pass to the specified commands.
536 default options/arguments to pass to the specified commands.
537
537
538 The following example makes :hg:`log` run in verbose mode, and
538 The following example makes :hg:`log` run in verbose mode, and
539 :hg:`status` show only the modified files, by default::
539 :hg:`status` show only the modified files, by default::
540
540
541 [defaults]
541 [defaults]
542 log = -v
542 log = -v
543 status = -m
543 status = -m
544
544
545 The actual commands, instead of their aliases, must be used when
545 The actual commands, instead of their aliases, must be used when
546 defining command defaults. The command defaults will also be applied
546 defining command defaults. The command defaults will also be applied
547 to the aliases of the commands defined.
547 to the aliases of the commands defined.
548
548
549
549
550 ``diff``
550 ``diff``
551 --------
551 --------
552
552
553 Settings used when displaying diffs. Everything except for ``unified``
553 Settings used when displaying diffs. Everything except for ``unified``
554 is a Boolean and defaults to False. See :hg:`help config.annotate`
554 is a Boolean and defaults to False. See :hg:`help config.annotate`
555 for related options for the annotate command.
555 for related options for the annotate command.
556
556
557 ``git``
557 ``git``
558 Use git extended diff format.
558 Use git extended diff format.
559
559
560 ``nobinary``
560 ``nobinary``
561 Omit git binary patches.
561 Omit git binary patches.
562
562
563 ``nodates``
563 ``nodates``
564 Don't include dates in diff headers.
564 Don't include dates in diff headers.
565
565
566 ``noprefix``
566 ``noprefix``
567 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
567 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
568
568
569 ``showfunc``
569 ``showfunc``
570 Show which function each change is in.
570 Show which function each change is in.
571
571
572 ``ignorews``
572 ``ignorews``
573 Ignore white space when comparing lines.
573 Ignore white space when comparing lines.
574
574
575 ``ignorewsamount``
575 ``ignorewsamount``
576 Ignore changes in the amount of white space.
576 Ignore changes in the amount of white space.
577
577
578 ``ignoreblanklines``
578 ``ignoreblanklines``
579 Ignore changes whose lines are all blank.
579 Ignore changes whose lines are all blank.
580
580
581 ``unified``
581 ``unified``
582 Number of lines of context to show.
582 Number of lines of context to show.
583
583
584 ``email``
584 ``email``
585 ---------
585 ---------
586
586
587 Settings for extensions that send email messages.
587 Settings for extensions that send email messages.
588
588
589 ``from``
589 ``from``
590 Optional. Email address to use in "From" header and SMTP envelope
590 Optional. Email address to use in "From" header and SMTP envelope
591 of outgoing messages.
591 of outgoing messages.
592
592
593 ``to``
593 ``to``
594 Optional. Comma-separated list of recipients' email addresses.
594 Optional. Comma-separated list of recipients' email addresses.
595
595
596 ``cc``
596 ``cc``
597 Optional. Comma-separated list of carbon copy recipients'
597 Optional. Comma-separated list of carbon copy recipients'
598 email addresses.
598 email addresses.
599
599
600 ``bcc``
600 ``bcc``
601 Optional. Comma-separated list of blind carbon copy recipients'
601 Optional. Comma-separated list of blind carbon copy recipients'
602 email addresses.
602 email addresses.
603
603
604 ``method``
604 ``method``
605 Optional. Method to use to send email messages. If value is ``smtp``
605 Optional. Method to use to send email messages. If value is ``smtp``
606 (default), use SMTP (see the ``[smtp]`` section for configuration).
606 (default), use SMTP (see the ``[smtp]`` section for configuration).
607 Otherwise, use as name of program to run that acts like sendmail
607 Otherwise, use as name of program to run that acts like sendmail
608 (takes ``-f`` option for sender, list of recipients on command line,
608 (takes ``-f`` option for sender, list of recipients on command line,
609 message on stdin). Normally, setting this to ``sendmail`` or
609 message on stdin). Normally, setting this to ``sendmail`` or
610 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
610 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
611
611
612 ``charsets``
612 ``charsets``
613 Optional. Comma-separated list of character sets considered
613 Optional. Comma-separated list of character sets considered
614 convenient for recipients. Addresses, headers, and parts not
614 convenient for recipients. Addresses, headers, and parts not
615 containing patches of outgoing messages will be encoded in the
615 containing patches of outgoing messages will be encoded in the
616 first character set to which conversion from local encoding
616 first character set to which conversion from local encoding
617 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
617 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
618 conversion fails, the text in question is sent as is.
618 conversion fails, the text in question is sent as is.
619 (default: '')
619 (default: '')
620
620
621 Order of outgoing email character sets:
621 Order of outgoing email character sets:
622
622
623 1. ``us-ascii``: always first, regardless of settings
623 1. ``us-ascii``: always first, regardless of settings
624 2. ``email.charsets``: in order given by user
624 2. ``email.charsets``: in order given by user
625 3. ``ui.fallbackencoding``: if not in email.charsets
625 3. ``ui.fallbackencoding``: if not in email.charsets
626 4. ``$HGENCODING``: if not in email.charsets
626 4. ``$HGENCODING``: if not in email.charsets
627 5. ``utf-8``: always last, regardless of settings
627 5. ``utf-8``: always last, regardless of settings
628
628
629 Email example::
629 Email example::
630
630
631 [email]
631 [email]
632 from = Joseph User <joe.user@example.com>
632 from = Joseph User <joe.user@example.com>
633 method = /usr/sbin/sendmail
633 method = /usr/sbin/sendmail
634 # charsets for western Europeans
634 # charsets for western Europeans
635 # us-ascii, utf-8 omitted, as they are tried first and last
635 # us-ascii, utf-8 omitted, as they are tried first and last
636 charsets = iso-8859-1, iso-8859-15, windows-1252
636 charsets = iso-8859-1, iso-8859-15, windows-1252
637
637
638
638
639 ``extensions``
639 ``extensions``
640 --------------
640 --------------
641
641
642 Mercurial has an extension mechanism for adding new features. To
642 Mercurial has an extension mechanism for adding new features. To
643 enable an extension, create an entry for it in this section.
643 enable an extension, create an entry for it in this section.
644
644
645 If you know that the extension is already in Python's search path,
645 If you know that the extension is already in Python's search path,
646 you can give the name of the module, followed by ``=``, with nothing
646 you can give the name of the module, followed by ``=``, with nothing
647 after the ``=``.
647 after the ``=``.
648
648
649 Otherwise, give a name that you choose, followed by ``=``, followed by
649 Otherwise, give a name that you choose, followed by ``=``, followed by
650 the path to the ``.py`` file (including the file name extension) that
650 the path to the ``.py`` file (including the file name extension) that
651 defines the extension.
651 defines the extension.
652
652
653 To explicitly disable an extension that is enabled in an hgrc of
653 To explicitly disable an extension that is enabled in an hgrc of
654 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
654 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
655 or ``foo = !`` when path is not supplied.
655 or ``foo = !`` when path is not supplied.
656
656
657 Example for ``~/.hgrc``::
657 Example for ``~/.hgrc``::
658
658
659 [extensions]
659 [extensions]
660 # (the color extension will get loaded from Mercurial's path)
660 # (the color extension will get loaded from Mercurial's path)
661 color =
661 color =
662 # (this extension will get loaded from the file specified)
662 # (this extension will get loaded from the file specified)
663 myfeature = ~/.hgext/myfeature.py
663 myfeature = ~/.hgext/myfeature.py
664
664
665
665
666 ``format``
666 ``format``
667 ----------
667 ----------
668
668
669 ``usestore``
669 ``usestore``
670 Enable or disable the "store" repository format which improves
670 Enable or disable the "store" repository format which improves
671 compatibility with systems that fold case or otherwise mangle
671 compatibility with systems that fold case or otherwise mangle
672 filenames. Enabled by default. Disabling this option will allow
672 filenames. Enabled by default. Disabling this option will allow
673 you to store longer filenames in some situations at the expense of
673 you to store longer filenames in some situations at the expense of
674 compatibility and ensures that the on-disk format of newly created
674 compatibility and ensures that the on-disk format of newly created
675 repositories will be compatible with Mercurial before version 0.9.4.
675 repositories will be compatible with Mercurial before version 0.9.4.
676
676
677 ``usefncache``
677 ``usefncache``
678 Enable or disable the "fncache" repository format which enhances
678 Enable or disable the "fncache" repository format which enhances
679 the "store" repository format (which has to be enabled to use
679 the "store" repository format (which has to be enabled to use
680 fncache) to allow longer filenames and avoids using Windows
680 fncache) to allow longer filenames and avoids using Windows
681 reserved names, e.g. "nul". Enabled by default. Disabling this
681 reserved names, e.g. "nul". Enabled by default. Disabling this
682 option ensures that the on-disk format of newly created
682 option ensures that the on-disk format of newly created
683 repositories will be compatible with Mercurial before version 1.1.
683 repositories will be compatible with Mercurial before version 1.1.
684
684
685 ``dotencode``
685 ``dotencode``
686 Enable or disable the "dotencode" repository format which enhances
686 Enable or disable the "dotencode" repository format which enhances
687 the "fncache" repository format (which has to be enabled to use
687 the "fncache" repository format (which has to be enabled to use
688 dotencode) to avoid issues with filenames starting with ._ on
688 dotencode) to avoid issues with filenames starting with ._ on
689 Mac OS X and spaces on Windows. Enabled by default. Disabling this
689 Mac OS X and spaces on Windows. Enabled by default. Disabling this
690 option ensures that the on-disk format of newly created
690 option ensures that the on-disk format of newly created
691 repositories will be compatible with Mercurial before version 1.7.
691 repositories will be compatible with Mercurial before version 1.7.
692
692
693 ``graph``
693 ``graph``
694 ---------
694 ---------
695
695
696 Web graph view configuration. This section let you change graph
696 Web graph view configuration. This section let you change graph
697 elements display properties by branches, for instance to make the
697 elements display properties by branches, for instance to make the
698 ``default`` branch stand out.
698 ``default`` branch stand out.
699
699
700 Each line has the following format::
700 Each line has the following format::
701
701
702 <branch>.<argument> = <value>
702 <branch>.<argument> = <value>
703
703
704 where ``<branch>`` is the name of the branch being
704 where ``<branch>`` is the name of the branch being
705 customized. Example::
705 customized. Example::
706
706
707 [graph]
707 [graph]
708 # 2px width
708 # 2px width
709 default.width = 2
709 default.width = 2
710 # red color
710 # red color
711 default.color = FF0000
711 default.color = FF0000
712
712
713 Supported arguments:
713 Supported arguments:
714
714
715 ``width``
715 ``width``
716 Set branch edges width in pixels.
716 Set branch edges width in pixels.
717
717
718 ``color``
718 ``color``
719 Set branch edges color in hexadecimal RGB notation.
719 Set branch edges color in hexadecimal RGB notation.
720
720
721 ``hooks``
721 ``hooks``
722 ---------
722 ---------
723
723
724 Commands or Python functions that get automatically executed by
724 Commands or Python functions that get automatically executed by
725 various actions such as starting or finishing a commit. Multiple
725 various actions such as starting or finishing a commit. Multiple
726 hooks can be run for the same action by appending a suffix to the
726 hooks can be run for the same action by appending a suffix to the
727 action. Overriding a site-wide hook can be done by changing its
727 action. Overriding a site-wide hook can be done by changing its
728 value or setting it to an empty string. Hooks can be prioritized
728 value or setting it to an empty string. Hooks can be prioritized
729 by adding a prefix of ``priority`` to the hook name on a new line
729 by adding a prefix of ``priority`` to the hook name on a new line
730 and setting the priority. The default priority is 0.
730 and setting the priority. The default priority is 0.
731
731
732 Example ``.hg/hgrc``::
732 Example ``.hg/hgrc``::
733
733
734 [hooks]
734 [hooks]
735 # update working directory after adding changesets
735 # update working directory after adding changesets
736 changegroup.update = hg update
736 changegroup.update = hg update
737 # do not use the site-wide hook
737 # do not use the site-wide hook
738 incoming =
738 incoming =
739 incoming.email = /my/email/hook
739 incoming.email = /my/email/hook
740 incoming.autobuild = /my/build/hook
740 incoming.autobuild = /my/build/hook
741 # force autobuild hook to run before other incoming hooks
741 # force autobuild hook to run before other incoming hooks
742 priority.incoming.autobuild = 1
742 priority.incoming.autobuild = 1
743
743
744 Most hooks are run with environment variables set that give useful
744 Most hooks are run with environment variables set that give useful
745 additional information. For each hook below, the environment
745 additional information. For each hook below, the environment
746 variables it is passed are listed with names of the form ``$HG_foo``.
746 variables it is passed are listed with names of the form ``$HG_foo``.
747
747
748 ``changegroup``
748 ``changegroup``
749 Run after a changegroup has been added via push, pull or unbundle.
749 Run after a changegroup has been added via push, pull or unbundle.
750 ID of the first new changeset is in ``$HG_NODE``. URL from which
750 ID of the first new changeset is in ``$HG_NODE``. URL from which
751 changes came is in ``$HG_URL``.
751 changes came is in ``$HG_URL``.
752
752
753 ``commit``
753 ``commit``
754 Run after a changeset has been created in the local repository. ID
754 Run after a changeset has been created in the local repository. ID
755 of the newly created changeset is in ``$HG_NODE``. Parent changeset
755 of the newly created changeset is in ``$HG_NODE``. Parent changeset
756 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
756 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
757
757
758 ``incoming``
758 ``incoming``
759 Run after a changeset has been pulled, pushed, or unbundled into
759 Run after a changeset has been pulled, pushed, or unbundled into
760 the local repository. The ID of the newly arrived changeset is in
760 the local repository. The ID of the newly arrived changeset is in
761 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
761 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
762
762
763 ``outgoing``
763 ``outgoing``
764 Run after sending changes from local repository to another. ID of
764 Run after sending changes from local repository to another. ID of
765 first changeset sent is in ``$HG_NODE``. Source of operation is in
765 first changeset sent is in ``$HG_NODE``. Source of operation is in
766 ``$HG_SOURCE``; Also see :hg:`help config.preoutgoing` hook.
766 ``$HG_SOURCE``; Also see :hg:`help config.preoutgoing` hook.
767
767
768 ``post-<command>``
768 ``post-<command>``
769 Run after successful invocations of the associated command. The
769 Run after successful invocations of the associated command. The
770 contents of the command line are passed as ``$HG_ARGS`` and the result
770 contents of the command line are passed as ``$HG_ARGS`` and the result
771 code in ``$HG_RESULT``. Parsed command line arguments are passed as
771 code in ``$HG_RESULT``. Parsed command line arguments are passed as
772 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
772 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
773 the python data internally passed to <command>. ``$HG_OPTS`` is a
773 the python data internally passed to <command>. ``$HG_OPTS`` is a
774 dictionary of options (with unspecified options set to their defaults).
774 dictionary of options (with unspecified options set to their defaults).
775 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
775 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
776
776
777 ``pre-<command>``
777 ``pre-<command>``
778 Run before executing the associated command. The contents of the
778 Run before executing the associated command. The contents of the
779 command line are passed as ``$HG_ARGS``. Parsed command line arguments
779 command line are passed as ``$HG_ARGS``. Parsed command line arguments
780 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
780 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
781 representations of the data internally passed to <command>. ``$HG_OPTS``
781 representations of the data internally passed to <command>. ``$HG_OPTS``
782 is a dictionary of options (with unspecified options set to their
782 is a dictionary of options (with unspecified options set to their
783 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
783 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
784 failure, the command doesn't execute and Mercurial returns the failure
784 failure, the command doesn't execute and Mercurial returns the failure
785 code.
785 code.
786
786
787 ``prechangegroup``
787 ``prechangegroup``
788 Run before a changegroup is added via push, pull or unbundle. Exit
788 Run before a changegroup is added via push, pull or unbundle. Exit
789 status 0 allows the changegroup to proceed. Non-zero status will
789 status 0 allows the changegroup to proceed. Non-zero status will
790 cause the push, pull or unbundle to fail. URL from which changes
790 cause the push, pull or unbundle to fail. URL from which changes
791 will come is in ``$HG_URL``.
791 will come is in ``$HG_URL``.
792
792
793 ``precommit``
793 ``precommit``
794 Run before starting a local commit. Exit status 0 allows the
794 Run before starting a local commit. Exit status 0 allows the
795 commit to proceed. Non-zero status will cause the commit to fail.
795 commit to proceed. Non-zero status will cause the commit to fail.
796 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
796 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
797
797
798 ``prelistkeys``
798 ``prelistkeys``
799 Run before listing pushkeys (like bookmarks) in the
799 Run before listing pushkeys (like bookmarks) in the
800 repository. Non-zero status will cause failure. The key namespace is
800 repository. Non-zero status will cause failure. The key namespace is
801 in ``$HG_NAMESPACE``.
801 in ``$HG_NAMESPACE``.
802
802
803 ``preoutgoing``
803 ``preoutgoing``
804 Run before collecting changes to send from the local repository to
804 Run before collecting changes to send from the local repository to
805 another. Non-zero status will cause failure. This lets you prevent
805 another. Non-zero status will cause failure. This lets you prevent
806 pull over HTTP or SSH. Also prevents against local pull, push
806 pull over HTTP or SSH. Also prevents against local pull, push
807 (outbound) or bundle commands, but not effective, since you can
807 (outbound) or bundle commands, but not effective, since you can
808 just copy files instead then. Source of operation is in
808 just copy files instead then. Source of operation is in
809 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
809 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
810 SSH or HTTP repository. If "push", "pull" or "bundle", operation
810 SSH or HTTP repository. If "push", "pull" or "bundle", operation
811 is happening on behalf of repository on same system.
811 is happening on behalf of repository on same system.
812
812
813 ``prepushkey``
813 ``prepushkey``
814 Run before a pushkey (like a bookmark) is added to the
814 Run before a pushkey (like a bookmark) is added to the
815 repository. Non-zero status will cause the key to be rejected. The
815 repository. Non-zero status will cause the key to be rejected. The
816 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
816 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
817 the old value (if any) is in ``$HG_OLD``, and the new value is in
817 the old value (if any) is in ``$HG_OLD``, and the new value is in
818 ``$HG_NEW``.
818 ``$HG_NEW``.
819
819
820 ``pretag``
820 ``pretag``
821 Run before creating a tag. Exit status 0 allows the tag to be
821 Run before creating a tag. Exit status 0 allows the tag to be
822 created. Non-zero status will cause the tag to fail. ID of
822 created. Non-zero status will cause the tag to fail. ID of
823 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
823 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
824 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
824 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
825
825
826 ``pretxnopen``
826 ``pretxnopen``
827 Run before any new repository transaction is open. The reason for the
827 Run before any new repository transaction is open. The reason for the
828 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
828 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
829 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
829 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
830 transaction from being opened.
830 transaction from being opened.
831
831
832 ``pretxnclose``
832 ``pretxnclose``
833 Run right before the transaction is actually finalized. Any
833 Run right before the transaction is actually finalized. Any
834 repository change will be visible to the hook program. This lets you
834 repository change will be visible to the hook program. This lets you
835 validate the transaction content or change it. Exit status 0 allows
835 validate the transaction content or change it. Exit status 0 allows
836 the commit to proceed. Non-zero status will cause the transaction to
836 the commit to proceed. Non-zero status will cause the transaction to
837 be rolled back. The reason for the transaction opening will be in
837 be rolled back. The reason for the transaction opening will be in
838 ``$HG_TXNNAME`` and a unique identifier for the transaction will be in
838 ``$HG_TXNNAME`` and a unique identifier for the transaction will be in
839 ``HG_TXNID``. The rest of the available data will vary according the
839 ``HG_TXNID``. The rest of the available data will vary according the
840 transaction type. New changesets will add ``$HG_NODE`` (id of the
840 transaction type. New changesets will add ``$HG_NODE`` (id of the
841 first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables,
841 first added changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables,
842 bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and
842 bookmarks and phases changes will set ``HG_BOOKMARK_MOVED`` and
843 ``HG_PHASES_MOVED`` to ``1``, etc.
843 ``HG_PHASES_MOVED`` to ``1``, etc.
844
844
845 ``txnclose``
845 ``txnclose``
846 Run after any repository transaction has been committed. At this
846 Run after any repository transaction has been committed. At this
847 point, the transaction can no longer be rolled back. The hook will run
847 point, the transaction can no longer be rolled back. The hook will run
848 after the lock is released. See :hg:`help config.pretxnclose` docs for
848 after the lock is released. See :hg:`help config.pretxnclose` docs for
849 details about available variables.
849 details about available variables.
850
850
851 ``txnabort``
851 ``txnabort``
852 Run when a transaction is aborted. See :hg:`help config.pretxnclose`
852 Run when a transaction is aborted. See :hg:`help config.pretxnclose`
853 docs for details about available variables.
853 docs for details about available variables.
854
854
855 ``pretxnchangegroup``
855 ``pretxnchangegroup``
856 Run after a changegroup has been added via push, pull or unbundle,
856 Run after a changegroup has been added via push, pull or unbundle,
857 but before the transaction has been committed. Changegroup is
857 but before the transaction has been committed. Changegroup is
858 visible to hook program. This lets you validate incoming changes
858 visible to hook program. This lets you validate incoming changes
859 before accepting them. Passed the ID of the first new changeset in
859 before accepting them. Passed the ID of the first new changeset in
860 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
860 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
861 status will cause the transaction to be rolled back and the push,
861 status will cause the transaction to be rolled back and the push,
862 pull or unbundle will fail. URL that was source of changes is in
862 pull or unbundle will fail. URL that was source of changes is in
863 ``$HG_URL``.
863 ``$HG_URL``.
864
864
865 ``pretxncommit``
865 ``pretxncommit``
866 Run after a changeset has been created but the transaction not yet
866 Run after a changeset has been created but the transaction not yet
867 committed. Changeset is visible to hook program. This lets you
867 committed. Changeset is visible to hook program. This lets you
868 validate commit message and changes. Exit status 0 allows the
868 validate commit message and changes. Exit status 0 allows the
869 commit to proceed. Non-zero status will cause the transaction to
869 commit to proceed. Non-zero status will cause the transaction to
870 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
870 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
871 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
871 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
872
872
873 ``preupdate``
873 ``preupdate``
874 Run before updating the working directory. Exit status 0 allows
874 Run before updating the working directory. Exit status 0 allows
875 the update to proceed. Non-zero status will prevent the update.
875 the update to proceed. Non-zero status will prevent the update.
876 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
876 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
877 of second new parent is in ``$HG_PARENT2``.
877 of second new parent is in ``$HG_PARENT2``.
878
878
879 ``listkeys``
879 ``listkeys``
880 Run after listing pushkeys (like bookmarks) in the repository. The
880 Run after listing pushkeys (like bookmarks) in the repository. The
881 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
881 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
882 dictionary containing the keys and values.
882 dictionary containing the keys and values.
883
883
884 ``pushkey``
884 ``pushkey``
885 Run after a pushkey (like a bookmark) is added to the
885 Run after a pushkey (like a bookmark) is added to the
886 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
886 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
887 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
887 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
888 value is in ``$HG_NEW``.
888 value is in ``$HG_NEW``.
889
889
890 ``tag``
890 ``tag``
891 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
891 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
892 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
892 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
893 repository if ``$HG_LOCAL=0``.
893 repository if ``$HG_LOCAL=0``.
894
894
895 ``update``
895 ``update``
896 Run after updating the working directory. Changeset ID of first
896 Run after updating the working directory. Changeset ID of first
897 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
897 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
898 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
898 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
899 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
899 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
900
900
901 .. note::
901 .. note::
902
902
903 It is generally better to use standard hooks rather than the
903 It is generally better to use standard hooks rather than the
904 generic pre- and post- command hooks as they are guaranteed to be
904 generic pre- and post- command hooks as they are guaranteed to be
905 called in the appropriate contexts for influencing transactions.
905 called in the appropriate contexts for influencing transactions.
906 Also, hooks like "commit" will be called in all contexts that
906 Also, hooks like "commit" will be called in all contexts that
907 generate a commit (e.g. tag) and not just the commit command.
907 generate a commit (e.g. tag) and not just the commit command.
908
908
909 .. note::
909 .. note::
910
910
911 Environment variables with empty values may not be passed to
911 Environment variables with empty values may not be passed to
912 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
912 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
913 will have an empty value under Unix-like platforms for non-merge
913 will have an empty value under Unix-like platforms for non-merge
914 changesets, while it will not be available at all under Windows.
914 changesets, while it will not be available at all under Windows.
915
915
916 The syntax for Python hooks is as follows::
916 The syntax for Python hooks is as follows::
917
917
918 hookname = python:modulename.submodule.callable
918 hookname = python:modulename.submodule.callable
919 hookname = python:/path/to/python/module.py:callable
919 hookname = python:/path/to/python/module.py:callable
920
920
921 Python hooks are run within the Mercurial process. Each hook is
921 Python hooks are run within the Mercurial process. Each hook is
922 called with at least three keyword arguments: a ui object (keyword
922 called with at least three keyword arguments: a ui object (keyword
923 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
923 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
924 keyword that tells what kind of hook is used. Arguments listed as
924 keyword that tells what kind of hook is used. Arguments listed as
925 environment variables above are passed as keyword arguments, with no
925 environment variables above are passed as keyword arguments, with no
926 ``HG_`` prefix, and names in lower case.
926 ``HG_`` prefix, and names in lower case.
927
927
928 If a Python hook returns a "true" value or raises an exception, this
928 If a Python hook returns a "true" value or raises an exception, this
929 is treated as a failure.
929 is treated as a failure.
930
930
931
931
932 ``hostfingerprints``
932 ``hostfingerprints``
933 --------------------
933 --------------------
934
934
935 Fingerprints of the certificates of known HTTPS servers.
935 Fingerprints of the certificates of known HTTPS servers.
936 A HTTPS connection to a server with a fingerprint configured here will
936 A HTTPS connection to a server with a fingerprint configured here will
937 only succeed if the servers certificate matches the fingerprint.
937 only succeed if the servers certificate matches the fingerprint.
938 This is very similar to how ssh known hosts works.
938 This is very similar to how ssh known hosts works.
939 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
939 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
940 The CA chain and web.cacerts is not used for servers with a fingerprint.
940 The CA chain and web.cacerts is not used for servers with a fingerprint.
941
941
942 For example::
942 For example::
943
943
944 [hostfingerprints]
944 [hostfingerprints]
945 hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0
945 hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0
946
946
947 This feature is only supported when using Python 2.6 or later.
947 This feature is only supported when using Python 2.6 or later.
948
948
949
949
950 ``http_proxy``
950 ``http_proxy``
951 --------------
951 --------------
952
952
953 Used to access web-based Mercurial repositories through a HTTP
953 Used to access web-based Mercurial repositories through a HTTP
954 proxy.
954 proxy.
955
955
956 ``host``
956 ``host``
957 Host name and (optional) port of the proxy server, for example
957 Host name and (optional) port of the proxy server, for example
958 "myproxy:8000".
958 "myproxy:8000".
959
959
960 ``no``
960 ``no``
961 Optional. Comma-separated list of host names that should bypass
961 Optional. Comma-separated list of host names that should bypass
962 the proxy.
962 the proxy.
963
963
964 ``passwd``
964 ``passwd``
965 Optional. Password to authenticate with at the proxy server.
965 Optional. Password to authenticate with at the proxy server.
966
966
967 ``user``
967 ``user``
968 Optional. User name to authenticate with at the proxy server.
968 Optional. User name to authenticate with at the proxy server.
969
969
970 ``always``
970 ``always``
971 Optional. Always use the proxy, even for localhost and any entries
971 Optional. Always use the proxy, even for localhost and any entries
972 in ``http_proxy.no``. (default: False)
972 in ``http_proxy.no``. (default: False)
973
973
974 ``merge-patterns``
974 ``merge-patterns``
975 ------------------
975 ------------------
976
976
977 This section specifies merge tools to associate with particular file
977 This section specifies merge tools to associate with particular file
978 patterns. Tools matched here will take precedence over the default
978 patterns. Tools matched here will take precedence over the default
979 merge tool. Patterns are globs by default, rooted at the repository
979 merge tool. Patterns are globs by default, rooted at the repository
980 root.
980 root.
981
981
982 Example::
982 Example::
983
983
984 [merge-patterns]
984 [merge-patterns]
985 **.c = kdiff3
985 **.c = kdiff3
986 **.jpg = myimgmerge
986 **.jpg = myimgmerge
987
987
988 ``merge-tools``
988 ``merge-tools``
989 ---------------
989 ---------------
990
990
991 This section configures external merge tools to use for file-level
991 This section configures external merge tools to use for file-level
992 merges. This section has likely been preconfigured at install time.
992 merges. This section has likely been preconfigured at install time.
993 Use :hg:`config merge-tools` to check the existing configuration.
993 Use :hg:`config merge-tools` to check the existing configuration.
994 Also see :hg:`help merge-tools` for more details.
994 Also see :hg:`help merge-tools` for more details.
995
995
996 Example ``~/.hgrc``::
996 Example ``~/.hgrc``::
997
997
998 [merge-tools]
998 [merge-tools]
999 # Override stock tool location
999 # Override stock tool location
1000 kdiff3.executable = ~/bin/kdiff3
1000 kdiff3.executable = ~/bin/kdiff3
1001 # Specify command line
1001 # Specify command line
1002 kdiff3.args = $base $local $other -o $output
1002 kdiff3.args = $base $local $other -o $output
1003 # Give higher priority
1003 # Give higher priority
1004 kdiff3.priority = 1
1004 kdiff3.priority = 1
1005
1005
1006 # Changing the priority of preconfigured tool
1006 # Changing the priority of preconfigured tool
1007 vimdiff.priority = 0
1007 vimdiff.priority = 0
1008
1008
1009 # Define new tool
1009 # Define new tool
1010 myHtmlTool.args = -m $local $other $base $output
1010 myHtmlTool.args = -m $local $other $base $output
1011 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1011 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1012 myHtmlTool.priority = 1
1012 myHtmlTool.priority = 1
1013
1013
1014 Supported arguments:
1014 Supported arguments:
1015
1015
1016 ``priority``
1016 ``priority``
1017 The priority in which to evaluate this tool.
1017 The priority in which to evaluate this tool.
1018 (default: 0)
1018 (default: 0)
1019
1019
1020 ``executable``
1020 ``executable``
1021 Either just the name of the executable or its pathname. On Windows,
1021 Either just the name of the executable or its pathname. On Windows,
1022 the path can use environment variables with ${ProgramFiles} syntax.
1022 the path can use environment variables with ${ProgramFiles} syntax.
1023 (default: the tool name)
1023 (default: the tool name)
1024
1024
1025 ``args``
1025 ``args``
1026 The arguments to pass to the tool executable. You can refer to the
1026 The arguments to pass to the tool executable. You can refer to the
1027 files being merged as well as the output file through these
1027 files being merged as well as the output file through these
1028 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1028 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1029 of ``$local`` and ``$other`` can vary depending on which action is being
1029 of ``$local`` and ``$other`` can vary depending on which action is being
1030 performed. During and update or merge, ``$local`` represents the original
1030 performed. During and update or merge, ``$local`` represents the original
1031 state of the file, while ``$other`` represents the commit you are updating
1031 state of the file, while ``$other`` represents the commit you are updating
1032 to or the commit you are merging with. During a rebase ``$local``
1032 to or the commit you are merging with. During a rebase ``$local``
1033 represents the destination of the rebase, and ``$other`` represents the
1033 represents the destination of the rebase, and ``$other`` represents the
1034 commit being rebased.
1034 commit being rebased.
1035 (default: ``$local $base $other``)
1035 (default: ``$local $base $other``)
1036
1036
1037 ``premerge``
1037 ``premerge``
1038 Attempt to run internal non-interactive 3-way merge tool before
1038 Attempt to run internal non-interactive 3-way merge tool before
1039 launching external tool. Options are ``true``, ``false``, ``keep`` or
1039 launching external tool. Options are ``true``, ``false``, ``keep`` or
1040 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1040 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1041 premerge fails. The ``keep-merge3`` will do the same but include information
1041 premerge fails. The ``keep-merge3`` will do the same but include information
1042 about the base of the merge in the marker (see internal :merge3 in
1042 about the base of the merge in the marker (see internal :merge3 in
1043 :hg:`help merge-tools`).
1043 :hg:`help merge-tools`).
1044 (default: True)
1044 (default: True)
1045
1045
1046 ``binary``
1046 ``binary``
1047 This tool can merge binary files. (default: False, unless tool
1047 This tool can merge binary files. (default: False, unless tool
1048 was selected by file pattern match)
1048 was selected by file pattern match)
1049
1049
1050 ``symlink``
1050 ``symlink``
1051 This tool can merge symlinks. (default: False)
1051 This tool can merge symlinks. (default: False)
1052
1052
1053 ``check``
1053 ``check``
1054 A list of merge success-checking options:
1054 A list of merge success-checking options:
1055
1055
1056 ``changed``
1056 ``changed``
1057 Ask whether merge was successful when the merged file shows no changes.
1057 Ask whether merge was successful when the merged file shows no changes.
1058 ``conflicts``
1058 ``conflicts``
1059 Check whether there are conflicts even though the tool reported success.
1059 Check whether there are conflicts even though the tool reported success.
1060 ``prompt``
1060 ``prompt``
1061 Always prompt for merge success, regardless of success reported by tool.
1061 Always prompt for merge success, regardless of success reported by tool.
1062
1062
1063 ``fixeol``
1063 ``fixeol``
1064 Attempt to fix up EOL changes caused by the merge tool.
1064 Attempt to fix up EOL changes caused by the merge tool.
1065 (default: False)
1065 (default: False)
1066
1066
1067 ``gui``
1067 ``gui``
1068 This tool requires a graphical interface to run. (default: False)
1068 This tool requires a graphical interface to run. (default: False)
1069
1069
1070 ``regkey``
1070 ``regkey``
1071 Windows registry key which describes install location of this
1071 Windows registry key which describes install location of this
1072 tool. Mercurial will search for this key first under
1072 tool. Mercurial will search for this key first under
1073 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1073 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1074 (default: None)
1074 (default: None)
1075
1075
1076 ``regkeyalt``
1076 ``regkeyalt``
1077 An alternate Windows registry key to try if the first key is not
1077 An alternate Windows registry key to try if the first key is not
1078 found. The alternate key uses the same ``regname`` and ``regappend``
1078 found. The alternate key uses the same ``regname`` and ``regappend``
1079 semantics of the primary key. The most common use for this key
1079 semantics of the primary key. The most common use for this key
1080 is to search for 32bit applications on 64bit operating systems.
1080 is to search for 32bit applications on 64bit operating systems.
1081 (default: None)
1081 (default: None)
1082
1082
1083 ``regname``
1083 ``regname``
1084 Name of value to read from specified registry key.
1084 Name of value to read from specified registry key.
1085 (default: the unnamed (default) value)
1085 (default: the unnamed (default) value)
1086
1086
1087 ``regappend``
1087 ``regappend``
1088 String to append to the value read from the registry, typically
1088 String to append to the value read from the registry, typically
1089 the executable name of the tool.
1089 the executable name of the tool.
1090 (default: None)
1090 (default: None)
1091
1091
1092
1092
1093 ``patch``
1093 ``patch``
1094 ---------
1094 ---------
1095
1095
1096 Settings used when applying patches, for instance through the 'import'
1096 Settings used when applying patches, for instance through the 'import'
1097 command or with Mercurial Queues extension.
1097 command or with Mercurial Queues extension.
1098
1098
1099 ``eol``
1099 ``eol``
1100 When set to 'strict' patch content and patched files end of lines
1100 When set to 'strict' patch content and patched files end of lines
1101 are preserved. When set to ``lf`` or ``crlf``, both files end of
1101 are preserved. When set to ``lf`` or ``crlf``, both files end of
1102 lines are ignored when patching and the result line endings are
1102 lines are ignored when patching and the result line endings are
1103 normalized to either LF (Unix) or CRLF (Windows). When set to
1103 normalized to either LF (Unix) or CRLF (Windows). When set to
1104 ``auto``, end of lines are again ignored while patching but line
1104 ``auto``, end of lines are again ignored while patching but line
1105 endings in patched files are normalized to their original setting
1105 endings in patched files are normalized to their original setting
1106 on a per-file basis. If target file does not exist or has no end
1106 on a per-file basis. If target file does not exist or has no end
1107 of line, patch line endings are preserved.
1107 of line, patch line endings are preserved.
1108 (default: strict)
1108 (default: strict)
1109
1109
1110 ``fuzz``
1110 ``fuzz``
1111 The number of lines of 'fuzz' to allow when applying patches. This
1111 The number of lines of 'fuzz' to allow when applying patches. This
1112 controls how much context the patcher is allowed to ignore when
1112 controls how much context the patcher is allowed to ignore when
1113 trying to apply a patch.
1113 trying to apply a patch.
1114 (default: 2)
1114 (default: 2)
1115
1115
1116 ``paths``
1116 ``paths``
1117 ---------
1117 ---------
1118
1118
1119 Assigns symbolic names to repositories. The left side is the
1119 Assigns symbolic names to repositories. The left side is the
1120 symbolic name, and the right gives the directory or URL that is the
1120 symbolic name, and the right gives the directory or URL that is the
1121 location of the repository. Default paths can be declared by setting
1121 location of the repository. Default paths can be declared by setting
1122 the following entries.
1122 the following entries.
1123
1123
1124 ``default``
1124 ``default``
1125 Directory or URL to use when pulling if no source is specified.
1125 Directory or URL to use when pulling if no source is specified.
1126 (default: repository from which the current repository was cloned)
1126 (default: repository from which the current repository was cloned)
1127
1127
1128 ``default-push``
1128 ``default-push``
1129 Optional. Directory or URL to use when pushing if no destination
1129 Optional. Directory or URL to use when pushing if no destination
1130 is specified.
1130 is specified.
1131
1131
1132 Custom paths can be defined by assigning the path to a name that later can be
1132 Custom paths can be defined by assigning the path to a name that later can be
1133 used from the command line. Example::
1133 used from the command line. Example::
1134
1134
1135 [paths]
1135 [paths]
1136 my_path = http://example.com/path
1136 my_path = http://example.com/path
1137
1137
1138 To push to the path defined in ``my_path`` run the command::
1138 To push to the path defined in ``my_path`` run the command::
1139
1139
1140 hg push my_path
1140 hg push my_path
1141
1141
1142
1142
1143 ``phases``
1143 ``phases``
1144 ----------
1144 ----------
1145
1145
1146 Specifies default handling of phases. See :hg:`help phases` for more
1146 Specifies default handling of phases. See :hg:`help phases` for more
1147 information about working with phases.
1147 information about working with phases.
1148
1148
1149 ``publish``
1149 ``publish``
1150 Controls draft phase behavior when working as a server. When true,
1150 Controls draft phase behavior when working as a server. When true,
1151 pushed changesets are set to public in both client and server and
1151 pushed changesets are set to public in both client and server and
1152 pulled or cloned changesets are set to public in the client.
1152 pulled or cloned changesets are set to public in the client.
1153 (default: True)
1153 (default: True)
1154
1154
1155 ``new-commit``
1155 ``new-commit``
1156 Phase of newly-created commits.
1156 Phase of newly-created commits.
1157 (default: draft)
1157 (default: draft)
1158
1158
1159 ``checksubrepos``
1159 ``checksubrepos``
1160 Check the phase of the current revision of each subrepository. Allowed
1160 Check the phase of the current revision of each subrepository. Allowed
1161 values are "ignore", "follow" and "abort". For settings other than
1161 values are "ignore", "follow" and "abort". For settings other than
1162 "ignore", the phase of the current revision of each subrepository is
1162 "ignore", the phase of the current revision of each subrepository is
1163 checked before committing the parent repository. If any of those phases is
1163 checked before committing the parent repository. If any of those phases is
1164 greater than the phase of the parent repository (e.g. if a subrepo is in a
1164 greater than the phase of the parent repository (e.g. if a subrepo is in a
1165 "secret" phase while the parent repo is in "draft" phase), the commit is
1165 "secret" phase while the parent repo is in "draft" phase), the commit is
1166 either aborted (if checksubrepos is set to "abort") or the higher phase is
1166 either aborted (if checksubrepos is set to "abort") or the higher phase is
1167 used for the parent repository commit (if set to "follow").
1167 used for the parent repository commit (if set to "follow").
1168 (default: follow)
1168 (default: follow)
1169
1169
1170
1170
1171 ``profiling``
1171 ``profiling``
1172 -------------
1172 -------------
1173
1173
1174 Specifies profiling type, format, and file output. Two profilers are
1174 Specifies profiling type, format, and file output. Two profilers are
1175 supported: an instrumenting profiler (named ``ls``), and a sampling
1175 supported: an instrumenting profiler (named ``ls``), and a sampling
1176 profiler (named ``stat``).
1176 profiler (named ``stat``).
1177
1177
1178 In this section description, 'profiling data' stands for the raw data
1178 In this section description, 'profiling data' stands for the raw data
1179 collected during profiling, while 'profiling report' stands for a
1179 collected during profiling, while 'profiling report' stands for a
1180 statistical text report generated from the profiling data. The
1180 statistical text report generated from the profiling data. The
1181 profiling is done using lsprof.
1181 profiling is done using lsprof.
1182
1182
1183 ``type``
1183 ``type``
1184 The type of profiler to use.
1184 The type of profiler to use.
1185 (default: ls)
1185 (default: ls)
1186
1186
1187 ``ls``
1187 ``ls``
1188 Use Python's built-in instrumenting profiler. This profiler
1188 Use Python's built-in instrumenting profiler. This profiler
1189 works on all platforms, but each line number it reports is the
1189 works on all platforms, but each line number it reports is the
1190 first line of a function. This restriction makes it difficult to
1190 first line of a function. This restriction makes it difficult to
1191 identify the expensive parts of a non-trivial function.
1191 identify the expensive parts of a non-trivial function.
1192 ``stat``
1192 ``stat``
1193 Use a third-party statistical profiler, statprof. This profiler
1193 Use a third-party statistical profiler, statprof. This profiler
1194 currently runs only on Unix systems, and is most useful for
1194 currently runs only on Unix systems, and is most useful for
1195 profiling commands that run for longer than about 0.1 seconds.
1195 profiling commands that run for longer than about 0.1 seconds.
1196
1196
1197 ``format``
1197 ``format``
1198 Profiling format. Specific to the ``ls`` instrumenting profiler.
1198 Profiling format. Specific to the ``ls`` instrumenting profiler.
1199 (default: text)
1199 (default: text)
1200
1200
1201 ``text``
1201 ``text``
1202 Generate a profiling report. When saving to a file, it should be
1202 Generate a profiling report. When saving to a file, it should be
1203 noted that only the report is saved, and the profiling data is
1203 noted that only the report is saved, and the profiling data is
1204 not kept.
1204 not kept.
1205 ``kcachegrind``
1205 ``kcachegrind``
1206 Format profiling data for kcachegrind use: when saving to a
1206 Format profiling data for kcachegrind use: when saving to a
1207 file, the generated file can directly be loaded into
1207 file, the generated file can directly be loaded into
1208 kcachegrind.
1208 kcachegrind.
1209
1209
1210 ``frequency``
1210 ``frequency``
1211 Sampling frequency. Specific to the ``stat`` sampling profiler.
1211 Sampling frequency. Specific to the ``stat`` sampling profiler.
1212 (default: 1000)
1212 (default: 1000)
1213
1213
1214 ``output``
1214 ``output``
1215 File path where profiling data or report should be saved. If the
1215 File path where profiling data or report should be saved. If the
1216 file exists, it is replaced. (default: None, data is printed on
1216 file exists, it is replaced. (default: None, data is printed on
1217 stderr)
1217 stderr)
1218
1218
1219 ``sort``
1219 ``sort``
1220 Sort field. Specific to the ``ls`` instrumenting profiler.
1220 Sort field. Specific to the ``ls`` instrumenting profiler.
1221 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1221 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1222 ``inlinetime``.
1222 ``inlinetime``.
1223 (default: inlinetime)
1223 (default: inlinetime)
1224
1224
1225 ``limit``
1225 ``limit``
1226 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1226 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1227 (default: 30)
1227 (default: 30)
1228
1228
1229 ``nested``
1229 ``nested``
1230 Show at most this number of lines of drill-down info after each main entry.
1230 Show at most this number of lines of drill-down info after each main entry.
1231 This can help explain the difference between Total and Inline.
1231 This can help explain the difference between Total and Inline.
1232 Specific to the ``ls`` instrumenting profiler.
1232 Specific to the ``ls`` instrumenting profiler.
1233 (default: 5)
1233 (default: 5)
1234
1234
1235 ``progress``
1235 ``progress``
1236 ------------
1236 ------------
1237
1237
1238 Mercurial commands can draw progress bars that are as informative as
1238 Mercurial commands can draw progress bars that are as informative as
1239 possible. Some progress bars only offer indeterminate information, while others
1239 possible. Some progress bars only offer indeterminate information, while others
1240 have a definite end point.
1240 have a definite end point.
1241
1241
1242 ``delay``
1242 ``delay``
1243 Number of seconds (float) before showing the progress bar. (default: 3)
1243 Number of seconds (float) before showing the progress bar. (default: 3)
1244
1244
1245 ``changedelay``
1245 ``changedelay``
1246 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1246 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1247 that value will be used instead. (default: 1)
1247 that value will be used instead. (default: 1)
1248
1248
1249 ``refresh``
1249 ``refresh``
1250 Time in seconds between refreshes of the progress bar. (default: 0.1)
1250 Time in seconds between refreshes of the progress bar. (default: 0.1)
1251
1251
1252 ``format``
1252 ``format``
1253 Format of the progress bar.
1253 Format of the progress bar.
1254
1254
1255 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1255 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1256 ``unit``, ``estimate``, speed, and item. item defaults to the last 20
1256 ``unit``, ``estimate``, speed, and item. item defaults to the last 20
1257 characters of the item, but this can be changed by adding either ``-<num>``
1257 characters of the item, but this can be changed by adding either ``-<num>``
1258 which would take the last num characters, or ``+<num>`` for the first num
1258 which would take the last num characters, or ``+<num>`` for the first num
1259 characters.
1259 characters.
1260
1260
1261 (default: Topic bar number estimate)
1261 (default: Topic bar number estimate)
1262
1262
1263 ``width``
1263 ``width``
1264 If set, the maximum width of the progress information (that is, min(width,
1264 If set, the maximum width of the progress information (that is, min(width,
1265 term width) will be used).
1265 term width) will be used).
1266
1266
1267 ``clear-complete``
1267 ``clear-complete``
1268 Clear the progress bar after it's done. (default: True)
1268 Clear the progress bar after it's done. (default: True)
1269
1269
1270 ``disable``
1270 ``disable``
1271 If true, don't show a progress bar.
1271 If true, don't show a progress bar.
1272
1272
1273 ``assume-tty``
1273 ``assume-tty``
1274 If true, ALWAYS show a progress bar, unless disable is given.
1274 If true, ALWAYS show a progress bar, unless disable is given.
1275
1275
1276 ``revsetalias``
1276 ``revsetalias``
1277 ---------------
1277 ---------------
1278
1278
1279 Alias definitions for revsets. See :hg:`help revsets` for details.
1279 Alias definitions for revsets. See :hg:`help revsets` for details.
1280
1280
1281 ``server``
1281 ``server``
1282 ----------
1282 ----------
1283
1283
1284 Controls generic server settings.
1284 Controls generic server settings.
1285
1285
1286 ``uncompressed``
1286 ``uncompressed``
1287 Whether to allow clients to clone a repository using the
1287 Whether to allow clients to clone a repository using the
1288 uncompressed streaming protocol. This transfers about 40% more
1288 uncompressed streaming protocol. This transfers about 40% more
1289 data than a regular clone, but uses less memory and CPU on both
1289 data than a regular clone, but uses less memory and CPU on both
1290 server and client. Over a LAN (100 Mbps or better) or a very fast
1290 server and client. Over a LAN (100 Mbps or better) or a very fast
1291 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1291 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1292 regular clone. Over most WAN connections (anything slower than
1292 regular clone. Over most WAN connections (anything slower than
1293 about 6 Mbps), uncompressed streaming is slower, because of the
1293 about 6 Mbps), uncompressed streaming is slower, because of the
1294 extra data transfer overhead. This mode will also temporarily hold
1294 extra data transfer overhead. This mode will also temporarily hold
1295 the write lock while determining what data to transfer.
1295 the write lock while determining what data to transfer.
1296 (default: True)
1296 (default: True)
1297
1297
1298 ``preferuncompressed``
1298 ``preferuncompressed``
1299 When set, clients will try to use the uncompressed streaming
1299 When set, clients will try to use the uncompressed streaming
1300 protocol. (default: False)
1300 protocol. (default: False)
1301
1301
1302 ``validate``
1302 ``validate``
1303 Whether to validate the completeness of pushed changesets by
1303 Whether to validate the completeness of pushed changesets by
1304 checking that all new file revisions specified in manifests are
1304 checking that all new file revisions specified in manifests are
1305 present. (default: False)
1305 present. (default: False)
1306
1306
1307 ``maxhttpheaderlen``
1307 ``maxhttpheaderlen``
1308 Instruct HTTP clients not to send request headers longer than this
1308 Instruct HTTP clients not to send request headers longer than this
1309 many bytes. (default: 1024)
1309 many bytes. (default: 1024)
1310
1310
1311 ``smtp``
1311 ``smtp``
1312 --------
1312 --------
1313
1313
1314 Configuration for extensions that need to send email messages.
1314 Configuration for extensions that need to send email messages.
1315
1315
1316 ``host``
1316 ``host``
1317 Host name of mail server, e.g. "mail.example.com".
1317 Host name of mail server, e.g. "mail.example.com".
1318
1318
1319 ``port``
1319 ``port``
1320 Optional. Port to connect to on mail server. (default: 465 if
1320 Optional. Port to connect to on mail server. (default: 465 if
1321 ``tls`` is smtps; 25 otherwise)
1321 ``tls`` is smtps; 25 otherwise)
1322
1322
1323 ``tls``
1323 ``tls``
1324 Optional. Method to enable TLS when connecting to mail server: starttls,
1324 Optional. Method to enable TLS when connecting to mail server: starttls,
1325 smtps or none. (default: none)
1325 smtps or none. (default: none)
1326
1326
1327 ``verifycert``
1327 ``verifycert``
1328 Optional. Verification for the certificate of mail server, when
1328 Optional. Verification for the certificate of mail server, when
1329 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1329 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1330 "strict" or "loose", the certificate is verified as same as the
1330 "strict" or "loose", the certificate is verified as same as the
1331 verification for HTTPS connections (see ``[hostfingerprints]`` and
1331 verification for HTTPS connections (see ``[hostfingerprints]`` and
1332 ``[web] cacerts`` also). For "strict", sending email is also
1332 ``[web] cacerts`` also). For "strict", sending email is also
1333 aborted, if there is no configuration for mail server in
1333 aborted, if there is no configuration for mail server in
1334 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1334 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1335 :hg:`email` overwrites this as "loose". (default: strict)
1335 :hg:`email` overwrites this as "loose". (default: strict)
1336
1336
1337 ``username``
1337 ``username``
1338 Optional. User name for authenticating with the SMTP server.
1338 Optional. User name for authenticating with the SMTP server.
1339 (default: None)
1339 (default: None)
1340
1340
1341 ``password``
1341 ``password``
1342 Optional. Password for authenticating with the SMTP server. If not
1342 Optional. Password for authenticating with the SMTP server. If not
1343 specified, interactive sessions will prompt the user for a
1343 specified, interactive sessions will prompt the user for a
1344 password; non-interactive sessions will fail. (default: None)
1344 password; non-interactive sessions will fail. (default: None)
1345
1345
1346 ``local_hostname``
1346 ``local_hostname``
1347 Optional. The hostname that the sender can use to identify
1347 Optional. The hostname that the sender can use to identify
1348 itself to the MTA.
1348 itself to the MTA.
1349
1349
1350
1350
1351 ``subpaths``
1351 ``subpaths``
1352 ------------
1352 ------------
1353
1353
1354 Subrepository source URLs can go stale if a remote server changes name
1354 Subrepository source URLs can go stale if a remote server changes name
1355 or becomes temporarily unavailable. This section lets you define
1355 or becomes temporarily unavailable. This section lets you define
1356 rewrite rules of the form::
1356 rewrite rules of the form::
1357
1357
1358 <pattern> = <replacement>
1358 <pattern> = <replacement>
1359
1359
1360 where ``pattern`` is a regular expression matching a subrepository
1360 where ``pattern`` is a regular expression matching a subrepository
1361 source URL and ``replacement`` is the replacement string used to
1361 source URL and ``replacement`` is the replacement string used to
1362 rewrite it. Groups can be matched in ``pattern`` and referenced in
1362 rewrite it. Groups can be matched in ``pattern`` and referenced in
1363 ``replacements``. For instance::
1363 ``replacements``. For instance::
1364
1364
1365 http://server/(.*)-hg/ = http://hg.server/\1/
1365 http://server/(.*)-hg/ = http://hg.server/\1/
1366
1366
1367 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1367 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1368
1368
1369 Relative subrepository paths are first made absolute, and the
1369 Relative subrepository paths are first made absolute, and the
1370 rewrite rules are then applied on the full (absolute) path. The rules
1370 rewrite rules are then applied on the full (absolute) path. The rules
1371 are applied in definition order.
1371 are applied in definition order.
1372
1372
1373 ``trusted``
1373 ``trusted``
1374 -----------
1374 -----------
1375
1375
1376 Mercurial will not use the settings in the
1376 Mercurial will not use the settings in the
1377 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1377 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1378 user or to a trusted group, as various hgrc features allow arbitrary
1378 user or to a trusted group, as various hgrc features allow arbitrary
1379 commands to be run. This issue is often encountered when configuring
1379 commands to be run. This issue is often encountered when configuring
1380 hooks or extensions for shared repositories or servers. However,
1380 hooks or extensions for shared repositories or servers. However,
1381 the web interface will use some safe settings from the ``[web]``
1381 the web interface will use some safe settings from the ``[web]``
1382 section.
1382 section.
1383
1383
1384 This section specifies what users and groups are trusted. The
1384 This section specifies what users and groups are trusted. The
1385 current user is always trusted. To trust everybody, list a user or a
1385 current user is always trusted. To trust everybody, list a user or a
1386 group with name ``*``. These settings must be placed in an
1386 group with name ``*``. These settings must be placed in an
1387 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1387 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1388 user or service running Mercurial.
1388 user or service running Mercurial.
1389
1389
1390 ``users``
1390 ``users``
1391 Comma-separated list of trusted users.
1391 Comma-separated list of trusted users.
1392
1392
1393 ``groups``
1393 ``groups``
1394 Comma-separated list of trusted groups.
1394 Comma-separated list of trusted groups.
1395
1395
1396
1396
1397 ``ui``
1397 ``ui``
1398 ------
1398 ------
1399
1399
1400 User interface controls.
1400 User interface controls.
1401
1401
1402 ``archivemeta``
1402 ``archivemeta``
1403 Whether to include the .hg_archival.txt file containing meta data
1403 Whether to include the .hg_archival.txt file containing meta data
1404 (hashes for the repository base and for tip) in archives created
1404 (hashes for the repository base and for tip) in archives created
1405 by the :hg:`archive` command or downloaded via hgweb.
1405 by the :hg:`archive` command or downloaded via hgweb.
1406 (default: True)
1406 (default: True)
1407
1407
1408 ``askusername``
1408 ``askusername``
1409 Whether to prompt for a username when committing. If True, and
1409 Whether to prompt for a username when committing. If True, and
1410 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1410 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1411 be prompted to enter a username. If no username is entered, the
1411 be prompted to enter a username. If no username is entered, the
1412 default ``USER@HOST`` is used instead.
1412 default ``USER@HOST`` is used instead.
1413 (default: False)
1413 (default: False)
1414
1414
1415 ``clonebundlefallback``
1416 Whether failure to apply an advertised "clone bundle" from a server
1417 should result in fallback to a regular clone.
1418
1419 This is disabled by default because servers advertising "clone
1420 bundles" often do so to reduce server load. If advertised bundles
1421 start mass failing and clients automatically fall back to a regular
1422 clone, this would add significant and unexpected load to the server
1423 since the server is expecting clone operations to be offloaded to
1424 pre-generated bundles. Failing fast (the default behavior) ensures
1425 clients don't overwhelm the server when "clone bundle" application
1426 fails.
1427
1428 (default: False)
1429
1415 ``commitsubrepos``
1430 ``commitsubrepos``
1416 Whether to commit modified subrepositories when committing the
1431 Whether to commit modified subrepositories when committing the
1417 parent repository. If False and one subrepository has uncommitted
1432 parent repository. If False and one subrepository has uncommitted
1418 changes, abort the commit.
1433 changes, abort the commit.
1419 (default: False)
1434 (default: False)
1420
1435
1421 ``debug``
1436 ``debug``
1422 Print debugging information. (default: False)
1437 Print debugging information. (default: False)
1423
1438
1424 ``editor``
1439 ``editor``
1425 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
1440 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
1426
1441
1427 ``fallbackencoding``
1442 ``fallbackencoding``
1428 Encoding to try if it's not possible to decode the changelog using
1443 Encoding to try if it's not possible to decode the changelog using
1429 UTF-8. (default: ISO-8859-1)
1444 UTF-8. (default: ISO-8859-1)
1430
1445
1431 ``ignore``
1446 ``ignore``
1432 A file to read per-user ignore patterns from. This file should be
1447 A file to read per-user ignore patterns from. This file should be
1433 in the same format as a repository-wide .hgignore file. Filenames
1448 in the same format as a repository-wide .hgignore file. Filenames
1434 are relative to the repository root. This option supports hook syntax,
1449 are relative to the repository root. This option supports hook syntax,
1435 so if you want to specify multiple ignore files, you can do so by
1450 so if you want to specify multiple ignore files, you can do so by
1436 setting something like ``ignore.other = ~/.hgignore2``. For details
1451 setting something like ``ignore.other = ~/.hgignore2``. For details
1437 of the ignore file format, see the ``hgignore(5)`` man page.
1452 of the ignore file format, see the ``hgignore(5)`` man page.
1438
1453
1439 ``interactive``
1454 ``interactive``
1440 Allow to prompt the user. (default: True)
1455 Allow to prompt the user. (default: True)
1441
1456
1442 ``logtemplate``
1457 ``logtemplate``
1443 Template string for commands that print changesets.
1458 Template string for commands that print changesets.
1444
1459
1445 ``merge``
1460 ``merge``
1446 The conflict resolution program to use during a manual merge.
1461 The conflict resolution program to use during a manual merge.
1447 For more information on merge tools see :hg:`help merge-tools`.
1462 For more information on merge tools see :hg:`help merge-tools`.
1448 For configuring merge tools see the ``[merge-tools]`` section.
1463 For configuring merge tools see the ``[merge-tools]`` section.
1449
1464
1450 ``mergemarkers``
1465 ``mergemarkers``
1451 Sets the merge conflict marker label styling. The ``detailed``
1466 Sets the merge conflict marker label styling. The ``detailed``
1452 style uses the ``mergemarkertemplate`` setting to style the labels.
1467 style uses the ``mergemarkertemplate`` setting to style the labels.
1453 The ``basic`` style just uses 'local' and 'other' as the marker label.
1468 The ``basic`` style just uses 'local' and 'other' as the marker label.
1454 One of ``basic`` or ``detailed``.
1469 One of ``basic`` or ``detailed``.
1455 (default: ``basic``)
1470 (default: ``basic``)
1456
1471
1457 ``mergemarkertemplate``
1472 ``mergemarkertemplate``
1458 The template used to print the commit description next to each conflict
1473 The template used to print the commit description next to each conflict
1459 marker during merge conflicts. See :hg:`help templates` for the template
1474 marker during merge conflicts. See :hg:`help templates` for the template
1460 format.
1475 format.
1461
1476
1462 Defaults to showing the hash, tags, branches, bookmarks, author, and
1477 Defaults to showing the hash, tags, branches, bookmarks, author, and
1463 the first line of the commit description.
1478 the first line of the commit description.
1464
1479
1465 If you use non-ASCII characters in names for tags, branches, bookmarks,
1480 If you use non-ASCII characters in names for tags, branches, bookmarks,
1466 authors, and/or commit descriptions, you must pay attention to encodings of
1481 authors, and/or commit descriptions, you must pay attention to encodings of
1467 managed files. At template expansion, non-ASCII characters use the encoding
1482 managed files. At template expansion, non-ASCII characters use the encoding
1468 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1483 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1469 environment variables that govern your locale. If the encoding of the merge
1484 environment variables that govern your locale. If the encoding of the merge
1470 markers is different from the encoding of the merged files,
1485 markers is different from the encoding of the merged files,
1471 serious problems may occur.
1486 serious problems may occur.
1472
1487
1473 ``patch``
1488 ``patch``
1474 An optional external tool that ``hg import`` and some extensions
1489 An optional external tool that ``hg import`` and some extensions
1475 will use for applying patches. By default Mercurial uses an
1490 will use for applying patches. By default Mercurial uses an
1476 internal patch utility. The external tool must work as the common
1491 internal patch utility. The external tool must work as the common
1477 Unix ``patch`` program. In particular, it must accept a ``-p``
1492 Unix ``patch`` program. In particular, it must accept a ``-p``
1478 argument to strip patch headers, a ``-d`` argument to specify the
1493 argument to strip patch headers, a ``-d`` argument to specify the
1479 current directory, a file name to patch, and a patch file to take
1494 current directory, a file name to patch, and a patch file to take
1480 from stdin.
1495 from stdin.
1481
1496
1482 It is possible to specify a patch tool together with extra
1497 It is possible to specify a patch tool together with extra
1483 arguments. For example, setting this option to ``patch --merge``
1498 arguments. For example, setting this option to ``patch --merge``
1484 will use the ``patch`` program with its 2-way merge option.
1499 will use the ``patch`` program with its 2-way merge option.
1485
1500
1486 ``portablefilenames``
1501 ``portablefilenames``
1487 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1502 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1488 (default: ``warn``)
1503 (default: ``warn``)
1489 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1504 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1490 platforms, if a file with a non-portable filename is added (e.g. a file
1505 platforms, if a file with a non-portable filename is added (e.g. a file
1491 with a name that can't be created on Windows because it contains reserved
1506 with a name that can't be created on Windows because it contains reserved
1492 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1507 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1493 collision with an existing file).
1508 collision with an existing file).
1494 If set to ``ignore`` (or ``false``), no warning is printed.
1509 If set to ``ignore`` (or ``false``), no warning is printed.
1495 If set to ``abort``, the command is aborted.
1510 If set to ``abort``, the command is aborted.
1496 On Windows, this configuration option is ignored and the command aborted.
1511 On Windows, this configuration option is ignored and the command aborted.
1497
1512
1498 ``quiet``
1513 ``quiet``
1499 Reduce the amount of output printed. (default: False)
1514 Reduce the amount of output printed. (default: False)
1500
1515
1501 ``remotecmd``
1516 ``remotecmd``
1502 Remote command to use for clone/push/pull operations. (default: ``hg``)
1517 Remote command to use for clone/push/pull operations. (default: ``hg``)
1503
1518
1504 ``report_untrusted``
1519 ``report_untrusted``
1505 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1520 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1506 trusted user or group. (default: True)
1521 trusted user or group. (default: True)
1507
1522
1508 ``slash``
1523 ``slash``
1509 Display paths using a slash (``/``) as the path separator. This
1524 Display paths using a slash (``/``) as the path separator. This
1510 only makes a difference on systems where the default path
1525 only makes a difference on systems where the default path
1511 separator is not the slash character (e.g. Windows uses the
1526 separator is not the slash character (e.g. Windows uses the
1512 backslash character (``\``)).
1527 backslash character (``\``)).
1513 (default: False)
1528 (default: False)
1514
1529
1515 ``statuscopies``
1530 ``statuscopies``
1516 Display copies in the status command.
1531 Display copies in the status command.
1517
1532
1518 ``ssh``
1533 ``ssh``
1519 Command to use for SSH connections. (default: ``ssh``)
1534 Command to use for SSH connections. (default: ``ssh``)
1520
1535
1521 ``strict``
1536 ``strict``
1522 Require exact command names, instead of allowing unambiguous
1537 Require exact command names, instead of allowing unambiguous
1523 abbreviations. (default: False)
1538 abbreviations. (default: False)
1524
1539
1525 ``style``
1540 ``style``
1526 Name of style to use for command output.
1541 Name of style to use for command output.
1527
1542
1528 ``supportcontact``
1543 ``supportcontact``
1529 A URL where users should report a Mercurial traceback. Use this if you are a
1544 A URL where users should report a Mercurial traceback. Use this if you are a
1530 large organisation with its own Mercurial deployment process and crash
1545 large organisation with its own Mercurial deployment process and crash
1531 reports should be addressed to your internal support.
1546 reports should be addressed to your internal support.
1532
1547
1533 ``timeout``
1548 ``timeout``
1534 The timeout used when a lock is held (in seconds), a negative value
1549 The timeout used when a lock is held (in seconds), a negative value
1535 means no timeout. (default: 600)
1550 means no timeout. (default: 600)
1536
1551
1537 ``traceback``
1552 ``traceback``
1538 Mercurial always prints a traceback when an unknown exception
1553 Mercurial always prints a traceback when an unknown exception
1539 occurs. Setting this to True will make Mercurial print a traceback
1554 occurs. Setting this to True will make Mercurial print a traceback
1540 on all exceptions, even those recognized by Mercurial (such as
1555 on all exceptions, even those recognized by Mercurial (such as
1541 IOError or MemoryError). (default: False)
1556 IOError or MemoryError). (default: False)
1542
1557
1543 ``username``
1558 ``username``
1544 The committer of a changeset created when running "commit".
1559 The committer of a changeset created when running "commit".
1545 Typically a person's name and email address, e.g. ``Fred Widget
1560 Typically a person's name and email address, e.g. ``Fred Widget
1546 <fred@example.com>``. Environment variables in the
1561 <fred@example.com>``. Environment variables in the
1547 username are expanded.
1562 username are expanded.
1548
1563
1549 (default: ``$EMAIL`` or ``username@hostname``. If the username in
1564 (default: ``$EMAIL`` or ``username@hostname``. If the username in
1550 hgrc is empty, e.g. if the system admin set ``username =`` in the
1565 hgrc is empty, e.g. if the system admin set ``username =`` in the
1551 system hgrc, it has to be specified manually or in a different
1566 system hgrc, it has to be specified manually or in a different
1552 hgrc file)
1567 hgrc file)
1553
1568
1554 ``verbose``
1569 ``verbose``
1555 Increase the amount of output printed. (default: False)
1570 Increase the amount of output printed. (default: False)
1556
1571
1557
1572
1558 ``web``
1573 ``web``
1559 -------
1574 -------
1560
1575
1561 Web interface configuration. The settings in this section apply to
1576 Web interface configuration. The settings in this section apply to
1562 both the builtin webserver (started by :hg:`serve`) and the script you
1577 both the builtin webserver (started by :hg:`serve`) and the script you
1563 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1578 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1564 and WSGI).
1579 and WSGI).
1565
1580
1566 The Mercurial webserver does no authentication (it does not prompt for
1581 The Mercurial webserver does no authentication (it does not prompt for
1567 usernames and passwords to validate *who* users are), but it does do
1582 usernames and passwords to validate *who* users are), but it does do
1568 authorization (it grants or denies access for *authenticated users*
1583 authorization (it grants or denies access for *authenticated users*
1569 based on settings in this section). You must either configure your
1584 based on settings in this section). You must either configure your
1570 webserver to do authentication for you, or disable the authorization
1585 webserver to do authentication for you, or disable the authorization
1571 checks.
1586 checks.
1572
1587
1573 For a quick setup in a trusted environment, e.g., a private LAN, where
1588 For a quick setup in a trusted environment, e.g., a private LAN, where
1574 you want it to accept pushes from anybody, you can use the following
1589 you want it to accept pushes from anybody, you can use the following
1575 command line::
1590 command line::
1576
1591
1577 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1592 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1578
1593
1579 Note that this will allow anybody to push anything to the server and
1594 Note that this will allow anybody to push anything to the server and
1580 that this should not be used for public servers.
1595 that this should not be used for public servers.
1581
1596
1582 The full set of options is:
1597 The full set of options is:
1583
1598
1584 ``accesslog``
1599 ``accesslog``
1585 Where to output the access log. (default: stdout)
1600 Where to output the access log. (default: stdout)
1586
1601
1587 ``address``
1602 ``address``
1588 Interface address to bind to. (default: all)
1603 Interface address to bind to. (default: all)
1589
1604
1590 ``allow_archive``
1605 ``allow_archive``
1591 List of archive format (bz2, gz, zip) allowed for downloading.
1606 List of archive format (bz2, gz, zip) allowed for downloading.
1592 (default: empty)
1607 (default: empty)
1593
1608
1594 ``allowbz2``
1609 ``allowbz2``
1595 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1610 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1596 revisions.
1611 revisions.
1597 (default: False)
1612 (default: False)
1598
1613
1599 ``allowgz``
1614 ``allowgz``
1600 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1615 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1601 revisions.
1616 revisions.
1602 (default: False)
1617 (default: False)
1603
1618
1604 ``allowpull``
1619 ``allowpull``
1605 Whether to allow pulling from the repository. (default: True)
1620 Whether to allow pulling from the repository. (default: True)
1606
1621
1607 ``allow_push``
1622 ``allow_push``
1608 Whether to allow pushing to the repository. If empty or not set,
1623 Whether to allow pushing to the repository. If empty or not set,
1609 pushing is not allowed. If the special value ``*``, any remote
1624 pushing is not allowed. If the special value ``*``, any remote
1610 user can push, including unauthenticated users. Otherwise, the
1625 user can push, including unauthenticated users. Otherwise, the
1611 remote user must have been authenticated, and the authenticated
1626 remote user must have been authenticated, and the authenticated
1612 user name must be present in this list. The contents of the
1627 user name must be present in this list. The contents of the
1613 allow_push list are examined after the deny_push list.
1628 allow_push list are examined after the deny_push list.
1614
1629
1615 ``allow_read``
1630 ``allow_read``
1616 If the user has not already been denied repository access due to
1631 If the user has not already been denied repository access due to
1617 the contents of deny_read, this list determines whether to grant
1632 the contents of deny_read, this list determines whether to grant
1618 repository access to the user. If this list is not empty, and the
1633 repository access to the user. If this list is not empty, and the
1619 user is unauthenticated or not present in the list, then access is
1634 user is unauthenticated or not present in the list, then access is
1620 denied for the user. If the list is empty or not set, then access
1635 denied for the user. If the list is empty or not set, then access
1621 is permitted to all users by default. Setting allow_read to the
1636 is permitted to all users by default. Setting allow_read to the
1622 special value ``*`` is equivalent to it not being set (i.e. access
1637 special value ``*`` is equivalent to it not being set (i.e. access
1623 is permitted to all users). The contents of the allow_read list are
1638 is permitted to all users). The contents of the allow_read list are
1624 examined after the deny_read list.
1639 examined after the deny_read list.
1625
1640
1626 ``allowzip``
1641 ``allowzip``
1627 (DEPRECATED) Whether to allow .zip downloading of repository
1642 (DEPRECATED) Whether to allow .zip downloading of repository
1628 revisions. This feature creates temporary files.
1643 revisions. This feature creates temporary files.
1629 (default: False)
1644 (default: False)
1630
1645
1631 ``archivesubrepos``
1646 ``archivesubrepos``
1632 Whether to recurse into subrepositories when archiving.
1647 Whether to recurse into subrepositories when archiving.
1633 (default: False)
1648 (default: False)
1634
1649
1635 ``baseurl``
1650 ``baseurl``
1636 Base URL to use when publishing URLs in other locations, so
1651 Base URL to use when publishing URLs in other locations, so
1637 third-party tools like email notification hooks can construct
1652 third-party tools like email notification hooks can construct
1638 URLs. Example: ``http://hgserver/repos/``.
1653 URLs. Example: ``http://hgserver/repos/``.
1639
1654
1640 ``cacerts``
1655 ``cacerts``
1641 Path to file containing a list of PEM encoded certificate
1656 Path to file containing a list of PEM encoded certificate
1642 authority certificates. Environment variables and ``~user``
1657 authority certificates. Environment variables and ``~user``
1643 constructs are expanded in the filename. If specified on the
1658 constructs are expanded in the filename. If specified on the
1644 client, then it will verify the identity of remote HTTPS servers
1659 client, then it will verify the identity of remote HTTPS servers
1645 with these certificates.
1660 with these certificates.
1646
1661
1647 This feature is only supported when using Python 2.6 or later. If you wish
1662 This feature is only supported when using Python 2.6 or later. If you wish
1648 to use it with earlier versions of Python, install the backported
1663 to use it with earlier versions of Python, install the backported
1649 version of the ssl library that is available from
1664 version of the ssl library that is available from
1650 ``http://pypi.python.org``.
1665 ``http://pypi.python.org``.
1651
1666
1652 To disable SSL verification temporarily, specify ``--insecure`` from
1667 To disable SSL verification temporarily, specify ``--insecure`` from
1653 command line.
1668 command line.
1654
1669
1655 You can use OpenSSL's CA certificate file if your platform has
1670 You can use OpenSSL's CA certificate file if your platform has
1656 one. On most Linux systems this will be
1671 one. On most Linux systems this will be
1657 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1672 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1658 generate this file manually. The form must be as follows::
1673 generate this file manually. The form must be as follows::
1659
1674
1660 -----BEGIN CERTIFICATE-----
1675 -----BEGIN CERTIFICATE-----
1661 ... (certificate in base64 PEM encoding) ...
1676 ... (certificate in base64 PEM encoding) ...
1662 -----END CERTIFICATE-----
1677 -----END CERTIFICATE-----
1663 -----BEGIN CERTIFICATE-----
1678 -----BEGIN CERTIFICATE-----
1664 ... (certificate in base64 PEM encoding) ...
1679 ... (certificate in base64 PEM encoding) ...
1665 -----END CERTIFICATE-----
1680 -----END CERTIFICATE-----
1666
1681
1667 ``cache``
1682 ``cache``
1668 Whether to support caching in hgweb. (default: True)
1683 Whether to support caching in hgweb. (default: True)
1669
1684
1670 ``certificate``
1685 ``certificate``
1671 Certificate to use when running :hg:`serve`.
1686 Certificate to use when running :hg:`serve`.
1672
1687
1673 ``collapse``
1688 ``collapse``
1674 With ``descend`` enabled, repositories in subdirectories are shown at
1689 With ``descend`` enabled, repositories in subdirectories are shown at
1675 a single level alongside repositories in the current path. With
1690 a single level alongside repositories in the current path. With
1676 ``collapse`` also enabled, repositories residing at a deeper level than
1691 ``collapse`` also enabled, repositories residing at a deeper level than
1677 the current path are grouped behind navigable directory entries that
1692 the current path are grouped behind navigable directory entries that
1678 lead to the locations of these repositories. In effect, this setting
1693 lead to the locations of these repositories. In effect, this setting
1679 collapses each collection of repositories found within a subdirectory
1694 collapses each collection of repositories found within a subdirectory
1680 into a single entry for that subdirectory. (default: False)
1695 into a single entry for that subdirectory. (default: False)
1681
1696
1682 ``comparisoncontext``
1697 ``comparisoncontext``
1683 Number of lines of context to show in side-by-side file comparison. If
1698 Number of lines of context to show in side-by-side file comparison. If
1684 negative or the value ``full``, whole files are shown. (default: 5)
1699 negative or the value ``full``, whole files are shown. (default: 5)
1685
1700
1686 This setting can be overridden by a ``context`` request parameter to the
1701 This setting can be overridden by a ``context`` request parameter to the
1687 ``comparison`` command, taking the same values.
1702 ``comparison`` command, taking the same values.
1688
1703
1689 ``contact``
1704 ``contact``
1690 Name or email address of the person in charge of the repository.
1705 Name or email address of the person in charge of the repository.
1691 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
1706 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
1692
1707
1693 ``deny_push``
1708 ``deny_push``
1694 Whether to deny pushing to the repository. If empty or not set,
1709 Whether to deny pushing to the repository. If empty or not set,
1695 push is not denied. If the special value ``*``, all remote users are
1710 push is not denied. If the special value ``*``, all remote users are
1696 denied push. Otherwise, unauthenticated users are all denied, and
1711 denied push. Otherwise, unauthenticated users are all denied, and
1697 any authenticated user name present in this list is also denied. The
1712 any authenticated user name present in this list is also denied. The
1698 contents of the deny_push list are examined before the allow_push list.
1713 contents of the deny_push list are examined before the allow_push list.
1699
1714
1700 ``deny_read``
1715 ``deny_read``
1701 Whether to deny reading/viewing of the repository. If this list is
1716 Whether to deny reading/viewing of the repository. If this list is
1702 not empty, unauthenticated users are all denied, and any
1717 not empty, unauthenticated users are all denied, and any
1703 authenticated user name present in this list is also denied access to
1718 authenticated user name present in this list is also denied access to
1704 the repository. If set to the special value ``*``, all remote users
1719 the repository. If set to the special value ``*``, all remote users
1705 are denied access (rarely needed ;). If deny_read is empty or not set,
1720 are denied access (rarely needed ;). If deny_read is empty or not set,
1706 the determination of repository access depends on the presence and
1721 the determination of repository access depends on the presence and
1707 content of the allow_read list (see description). If both
1722 content of the allow_read list (see description). If both
1708 deny_read and allow_read are empty or not set, then access is
1723 deny_read and allow_read are empty or not set, then access is
1709 permitted to all users by default. If the repository is being
1724 permitted to all users by default. If the repository is being
1710 served via hgwebdir, denied users will not be able to see it in
1725 served via hgwebdir, denied users will not be able to see it in
1711 the list of repositories. The contents of the deny_read list have
1726 the list of repositories. The contents of the deny_read list have
1712 priority over (are examined before) the contents of the allow_read
1727 priority over (are examined before) the contents of the allow_read
1713 list.
1728 list.
1714
1729
1715 ``descend``
1730 ``descend``
1716 hgwebdir indexes will not descend into subdirectories. Only repositories
1731 hgwebdir indexes will not descend into subdirectories. Only repositories
1717 directly in the current path will be shown (other repositories are still
1732 directly in the current path will be shown (other repositories are still
1718 available from the index corresponding to their containing path).
1733 available from the index corresponding to their containing path).
1719
1734
1720 ``description``
1735 ``description``
1721 Textual description of the repository's purpose or contents.
1736 Textual description of the repository's purpose or contents.
1722 (default: "unknown")
1737 (default: "unknown")
1723
1738
1724 ``encoding``
1739 ``encoding``
1725 Character encoding name. (default: the current locale charset)
1740 Character encoding name. (default: the current locale charset)
1726 Example: "UTF-8".
1741 Example: "UTF-8".
1727
1742
1728 ``errorlog``
1743 ``errorlog``
1729 Where to output the error log. (default: stderr)
1744 Where to output the error log. (default: stderr)
1730
1745
1731 ``guessmime``
1746 ``guessmime``
1732 Control MIME types for raw download of file content.
1747 Control MIME types for raw download of file content.
1733 Set to True to let hgweb guess the content type from the file
1748 Set to True to let hgweb guess the content type from the file
1734 extension. This will serve HTML files as ``text/html`` and might
1749 extension. This will serve HTML files as ``text/html`` and might
1735 allow cross-site scripting attacks when serving untrusted
1750 allow cross-site scripting attacks when serving untrusted
1736 repositories. (default: False)
1751 repositories. (default: False)
1737
1752
1738 ``hidden``
1753 ``hidden``
1739 Whether to hide the repository in the hgwebdir index.
1754 Whether to hide the repository in the hgwebdir index.
1740 (default: False)
1755 (default: False)
1741
1756
1742 ``ipv6``
1757 ``ipv6``
1743 Whether to use IPv6. (default: False)
1758 Whether to use IPv6. (default: False)
1744
1759
1745 ``logoimg``
1760 ``logoimg``
1746 File name of the logo image that some templates display on each page.
1761 File name of the logo image that some templates display on each page.
1747 The file name is relative to ``staticurl``. That is, the full path to
1762 The file name is relative to ``staticurl``. That is, the full path to
1748 the logo image is "staticurl/logoimg".
1763 the logo image is "staticurl/logoimg".
1749 If unset, ``hglogo.png`` will be used.
1764 If unset, ``hglogo.png`` will be used.
1750
1765
1751 ``logourl``
1766 ``logourl``
1752 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
1767 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
1753 will be used.
1768 will be used.
1754
1769
1755 ``maxchanges``
1770 ``maxchanges``
1756 Maximum number of changes to list on the changelog. (default: 10)
1771 Maximum number of changes to list on the changelog. (default: 10)
1757
1772
1758 ``maxfiles``
1773 ``maxfiles``
1759 Maximum number of files to list per changeset. (default: 10)
1774 Maximum number of files to list per changeset. (default: 10)
1760
1775
1761 ``maxshortchanges``
1776 ``maxshortchanges``
1762 Maximum number of changes to list on the shortlog, graph or filelog
1777 Maximum number of changes to list on the shortlog, graph or filelog
1763 pages. (default: 60)
1778 pages. (default: 60)
1764
1779
1765 ``name``
1780 ``name``
1766 Repository name to use in the web interface.
1781 Repository name to use in the web interface.
1767 (default: current working directory)
1782 (default: current working directory)
1768
1783
1769 ``port``
1784 ``port``
1770 Port to listen on. (default: 8000)
1785 Port to listen on. (default: 8000)
1771
1786
1772 ``prefix``
1787 ``prefix``
1773 Prefix path to serve from. (default: '' (server root))
1788 Prefix path to serve from. (default: '' (server root))
1774
1789
1775 ``push_ssl``
1790 ``push_ssl``
1776 Whether to require that inbound pushes be transported over SSL to
1791 Whether to require that inbound pushes be transported over SSL to
1777 prevent password sniffing. (default: True)
1792 prevent password sniffing. (default: True)
1778
1793
1779 ``refreshinterval``
1794 ``refreshinterval``
1780 How frequently directory listings re-scan the filesystem for new
1795 How frequently directory listings re-scan the filesystem for new
1781 repositories, in seconds. This is relevant when wildcards are used
1796 repositories, in seconds. This is relevant when wildcards are used
1782 to define paths. Depending on how much filesystem traversal is
1797 to define paths. Depending on how much filesystem traversal is
1783 required, refreshing may negatively impact performance.
1798 required, refreshing may negatively impact performance.
1784
1799
1785 Values less than or equal to 0 always refresh.
1800 Values less than or equal to 0 always refresh.
1786 (default: 20)
1801 (default: 20)
1787
1802
1788 ``staticurl``
1803 ``staticurl``
1789 Base URL to use for static files. If unset, static files (e.g. the
1804 Base URL to use for static files. If unset, static files (e.g. the
1790 hgicon.png favicon) will be served by the CGI script itself. Use
1805 hgicon.png favicon) will be served by the CGI script itself. Use
1791 this setting to serve them directly with the HTTP server.
1806 this setting to serve them directly with the HTTP server.
1792 Example: ``http://hgserver/static/``.
1807 Example: ``http://hgserver/static/``.
1793
1808
1794 ``stripes``
1809 ``stripes``
1795 How many lines a "zebra stripe" should span in multi-line output.
1810 How many lines a "zebra stripe" should span in multi-line output.
1796 Set to 0 to disable. (default: 1)
1811 Set to 0 to disable. (default: 1)
1797
1812
1798 ``style``
1813 ``style``
1799 Which template map style to use. The available options are the names of
1814 Which template map style to use. The available options are the names of
1800 subdirectories in the HTML templates path. (default: ``paper``)
1815 subdirectories in the HTML templates path. (default: ``paper``)
1801 Example: ``monoblue``.
1816 Example: ``monoblue``.
1802
1817
1803 ``templates``
1818 ``templates``
1804 Where to find the HTML templates. The default path to the HTML templates
1819 Where to find the HTML templates. The default path to the HTML templates
1805 can be obtained from ``hg debuginstall``.
1820 can be obtained from ``hg debuginstall``.
1806
1821
1807 ``websub``
1822 ``websub``
1808 ----------
1823 ----------
1809
1824
1810 Web substitution filter definition. You can use this section to
1825 Web substitution filter definition. You can use this section to
1811 define a set of regular expression substitution patterns which
1826 define a set of regular expression substitution patterns which
1812 let you automatically modify the hgweb server output.
1827 let you automatically modify the hgweb server output.
1813
1828
1814 The default hgweb templates only apply these substitution patterns
1829 The default hgweb templates only apply these substitution patterns
1815 on the revision description fields. You can apply them anywhere
1830 on the revision description fields. You can apply them anywhere
1816 you want when you create your own templates by adding calls to the
1831 you want when you create your own templates by adding calls to the
1817 "websub" filter (usually after calling the "escape" filter).
1832 "websub" filter (usually after calling the "escape" filter).
1818
1833
1819 This can be used, for example, to convert issue references to links
1834 This can be used, for example, to convert issue references to links
1820 to your issue tracker, or to convert "markdown-like" syntax into
1835 to your issue tracker, or to convert "markdown-like" syntax into
1821 HTML (see the examples below).
1836 HTML (see the examples below).
1822
1837
1823 Each entry in this section names a substitution filter.
1838 Each entry in this section names a substitution filter.
1824 The value of each entry defines the substitution expression itself.
1839 The value of each entry defines the substitution expression itself.
1825 The websub expressions follow the old interhg extension syntax,
1840 The websub expressions follow the old interhg extension syntax,
1826 which in turn imitates the Unix sed replacement syntax::
1841 which in turn imitates the Unix sed replacement syntax::
1827
1842
1828 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
1843 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
1829
1844
1830 You can use any separator other than "/". The final "i" is optional
1845 You can use any separator other than "/". The final "i" is optional
1831 and indicates that the search must be case insensitive.
1846 and indicates that the search must be case insensitive.
1832
1847
1833 Examples::
1848 Examples::
1834
1849
1835 [websub]
1850 [websub]
1836 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
1851 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
1837 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
1852 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
1838 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
1853 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
1839
1854
1840 ``worker``
1855 ``worker``
1841 ----------
1856 ----------
1842
1857
1843 Parallel master/worker configuration. We currently perform working
1858 Parallel master/worker configuration. We currently perform working
1844 directory updates in parallel on Unix-like systems, which greatly
1859 directory updates in parallel on Unix-like systems, which greatly
1845 helps performance.
1860 helps performance.
1846
1861
1847 ``numcpus``
1862 ``numcpus``
1848 Number of CPUs to use for parallel operations. A zero or
1863 Number of CPUs to use for parallel operations. A zero or
1849 negative value is treated as ``use the default``.
1864 negative value is treated as ``use the default``.
1850 (default: 4 or the number of CPUs on the system, whichever is larger)
1865 (default: 4 or the number of CPUs on the system, whichever is larger)
@@ -1,2377 +1,2381 b''
1 Short help:
1 Short help:
2
2
3 $ hg
3 $ hg
4 Mercurial Distributed SCM
4 Mercurial Distributed SCM
5
5
6 basic commands:
6 basic commands:
7
7
8 add add the specified files on the next commit
8 add add the specified files on the next commit
9 annotate show changeset information by line for each file
9 annotate show changeset information by line for each file
10 clone make a copy of an existing repository
10 clone make a copy of an existing repository
11 commit commit the specified files or all outstanding changes
11 commit commit the specified files or all outstanding changes
12 diff diff repository (or selected files)
12 diff diff repository (or selected files)
13 export dump the header and diffs for one or more changesets
13 export dump the header and diffs for one or more changesets
14 forget forget the specified files on the next commit
14 forget forget the specified files on the next commit
15 init create a new repository in the given directory
15 init create a new repository in the given directory
16 log show revision history of entire repository or files
16 log show revision history of entire repository or files
17 merge merge another revision into working directory
17 merge merge another revision into working directory
18 pull pull changes from the specified source
18 pull pull changes from the specified source
19 push push changes to the specified destination
19 push push changes to the specified destination
20 remove remove the specified files on the next commit
20 remove remove the specified files on the next commit
21 serve start stand-alone webserver
21 serve start stand-alone webserver
22 status show changed files in the working directory
22 status show changed files in the working directory
23 summary summarize working directory state
23 summary summarize working directory state
24 update update working directory (or switch revisions)
24 update update working directory (or switch revisions)
25
25
26 (use "hg help" for the full list of commands or "hg -v" for details)
26 (use "hg help" for the full list of commands or "hg -v" for details)
27
27
28 $ hg -q
28 $ hg -q
29 add add the specified files on the next commit
29 add add the specified files on the next commit
30 annotate show changeset information by line for each file
30 annotate show changeset information by line for each file
31 clone make a copy of an existing repository
31 clone make a copy of an existing repository
32 commit commit the specified files or all outstanding changes
32 commit commit the specified files or all outstanding changes
33 diff diff repository (or selected files)
33 diff diff repository (or selected files)
34 export dump the header and diffs for one or more changesets
34 export dump the header and diffs for one or more changesets
35 forget forget the specified files on the next commit
35 forget forget the specified files on the next commit
36 init create a new repository in the given directory
36 init create a new repository in the given directory
37 log show revision history of entire repository or files
37 log show revision history of entire repository or files
38 merge merge another revision into working directory
38 merge merge another revision into working directory
39 pull pull changes from the specified source
39 pull pull changes from the specified source
40 push push changes to the specified destination
40 push push changes to the specified destination
41 remove remove the specified files on the next commit
41 remove remove the specified files on the next commit
42 serve start stand-alone webserver
42 serve start stand-alone webserver
43 status show changed files in the working directory
43 status show changed files in the working directory
44 summary summarize working directory state
44 summary summarize working directory state
45 update update working directory (or switch revisions)
45 update update working directory (or switch revisions)
46
46
47 $ hg help
47 $ hg help
48 Mercurial Distributed SCM
48 Mercurial Distributed SCM
49
49
50 list of commands:
50 list of commands:
51
51
52 add add the specified files on the next commit
52 add add the specified files on the next commit
53 addremove add all new files, delete all missing files
53 addremove add all new files, delete all missing files
54 annotate show changeset information by line for each file
54 annotate show changeset information by line for each file
55 archive create an unversioned archive of a repository revision
55 archive create an unversioned archive of a repository revision
56 backout reverse effect of earlier changeset
56 backout reverse effect of earlier changeset
57 bisect subdivision search of changesets
57 bisect subdivision search of changesets
58 bookmarks create a new bookmark or list existing bookmarks
58 bookmarks create a new bookmark or list existing bookmarks
59 branch set or show the current branch name
59 branch set or show the current branch name
60 branches list repository named branches
60 branches list repository named branches
61 bundle create a changegroup file
61 bundle create a changegroup file
62 cat output the current or given revision of files
62 cat output the current or given revision of files
63 clone make a copy of an existing repository
63 clone make a copy of an existing repository
64 commit commit the specified files or all outstanding changes
64 commit commit the specified files or all outstanding changes
65 config show combined config settings from all hgrc files
65 config show combined config settings from all hgrc files
66 copy mark files as copied for the next commit
66 copy mark files as copied for the next commit
67 diff diff repository (or selected files)
67 diff diff repository (or selected files)
68 export dump the header and diffs for one or more changesets
68 export dump the header and diffs for one or more changesets
69 files list tracked files
69 files list tracked files
70 forget forget the specified files on the next commit
70 forget forget the specified files on the next commit
71 graft copy changes from other branches onto the current branch
71 graft copy changes from other branches onto the current branch
72 grep search for a pattern in specified files and revisions
72 grep search for a pattern in specified files and revisions
73 heads show branch heads
73 heads show branch heads
74 help show help for a given topic or a help overview
74 help show help for a given topic or a help overview
75 identify identify the working directory or specified revision
75 identify identify the working directory or specified revision
76 import import an ordered set of patches
76 import import an ordered set of patches
77 incoming show new changesets found in source
77 incoming show new changesets found in source
78 init create a new repository in the given directory
78 init create a new repository in the given directory
79 log show revision history of entire repository or files
79 log show revision history of entire repository or files
80 manifest output the current or given revision of the project manifest
80 manifest output the current or given revision of the project manifest
81 merge merge another revision into working directory
81 merge merge another revision into working directory
82 outgoing show changesets not found in the destination
82 outgoing show changesets not found in the destination
83 paths show aliases for remote repositories
83 paths show aliases for remote repositories
84 phase set or show the current phase name
84 phase set or show the current phase name
85 pull pull changes from the specified source
85 pull pull changes from the specified source
86 push push changes to the specified destination
86 push push changes to the specified destination
87 recover roll back an interrupted transaction
87 recover roll back an interrupted transaction
88 remove remove the specified files on the next commit
88 remove remove the specified files on the next commit
89 rename rename files; equivalent of copy + remove
89 rename rename files; equivalent of copy + remove
90 resolve redo merges or set/view the merge status of files
90 resolve redo merges or set/view the merge status of files
91 revert restore files to their checkout state
91 revert restore files to their checkout state
92 root print the root (top) of the current working directory
92 root print the root (top) of the current working directory
93 serve start stand-alone webserver
93 serve start stand-alone webserver
94 status show changed files in the working directory
94 status show changed files in the working directory
95 summary summarize working directory state
95 summary summarize working directory state
96 tag add one or more tags for the current or given revision
96 tag add one or more tags for the current or given revision
97 tags list repository tags
97 tags list repository tags
98 unbundle apply one or more changegroup files
98 unbundle apply one or more changegroup files
99 update update working directory (or switch revisions)
99 update update working directory (or switch revisions)
100 verify verify the integrity of the repository
100 verify verify the integrity of the repository
101 version output version and copyright information
101 version output version and copyright information
102
102
103 additional help topics:
103 additional help topics:
104
104
105 config Configuration Files
105 config Configuration Files
106 dates Date Formats
106 dates Date Formats
107 diffs Diff Formats
107 diffs Diff Formats
108 environment Environment Variables
108 environment Environment Variables
109 extensions Using Additional Features
109 extensions Using Additional Features
110 filesets Specifying File Sets
110 filesets Specifying File Sets
111 glossary Glossary
111 glossary Glossary
112 hgignore Syntax for Mercurial Ignore Files
112 hgignore Syntax for Mercurial Ignore Files
113 hgweb Configuring hgweb
113 hgweb Configuring hgweb
114 merge-tools Merge Tools
114 merge-tools Merge Tools
115 multirevs Specifying Multiple Revisions
115 multirevs Specifying Multiple Revisions
116 patterns File Name Patterns
116 patterns File Name Patterns
117 phases Working with Phases
117 phases Working with Phases
118 revisions Specifying Single Revisions
118 revisions Specifying Single Revisions
119 revsets Specifying Revision Sets
119 revsets Specifying Revision Sets
120 scripting Using Mercurial from scripts and automation
120 scripting Using Mercurial from scripts and automation
121 subrepos Subrepositories
121 subrepos Subrepositories
122 templating Template Usage
122 templating Template Usage
123 urls URL Paths
123 urls URL Paths
124
124
125 (use "hg help -v" to show built-in aliases and global options)
125 (use "hg help -v" to show built-in aliases and global options)
126
126
127 $ hg -q help
127 $ hg -q help
128 add add the specified files on the next commit
128 add add the specified files on the next commit
129 addremove add all new files, delete all missing files
129 addremove add all new files, delete all missing files
130 annotate show changeset information by line for each file
130 annotate show changeset information by line for each file
131 archive create an unversioned archive of a repository revision
131 archive create an unversioned archive of a repository revision
132 backout reverse effect of earlier changeset
132 backout reverse effect of earlier changeset
133 bisect subdivision search of changesets
133 bisect subdivision search of changesets
134 bookmarks create a new bookmark or list existing bookmarks
134 bookmarks create a new bookmark or list existing bookmarks
135 branch set or show the current branch name
135 branch set or show the current branch name
136 branches list repository named branches
136 branches list repository named branches
137 bundle create a changegroup file
137 bundle create a changegroup file
138 cat output the current or given revision of files
138 cat output the current or given revision of files
139 clone make a copy of an existing repository
139 clone make a copy of an existing repository
140 commit commit the specified files or all outstanding changes
140 commit commit the specified files or all outstanding changes
141 config show combined config settings from all hgrc files
141 config show combined config settings from all hgrc files
142 copy mark files as copied for the next commit
142 copy mark files as copied for the next commit
143 diff diff repository (or selected files)
143 diff diff repository (or selected files)
144 export dump the header and diffs for one or more changesets
144 export dump the header and diffs for one or more changesets
145 files list tracked files
145 files list tracked files
146 forget forget the specified files on the next commit
146 forget forget the specified files on the next commit
147 graft copy changes from other branches onto the current branch
147 graft copy changes from other branches onto the current branch
148 grep search for a pattern in specified files and revisions
148 grep search for a pattern in specified files and revisions
149 heads show branch heads
149 heads show branch heads
150 help show help for a given topic or a help overview
150 help show help for a given topic or a help overview
151 identify identify the working directory or specified revision
151 identify identify the working directory or specified revision
152 import import an ordered set of patches
152 import import an ordered set of patches
153 incoming show new changesets found in source
153 incoming show new changesets found in source
154 init create a new repository in the given directory
154 init create a new repository in the given directory
155 log show revision history of entire repository or files
155 log show revision history of entire repository or files
156 manifest output the current or given revision of the project manifest
156 manifest output the current or given revision of the project manifest
157 merge merge another revision into working directory
157 merge merge another revision into working directory
158 outgoing show changesets not found in the destination
158 outgoing show changesets not found in the destination
159 paths show aliases for remote repositories
159 paths show aliases for remote repositories
160 phase set or show the current phase name
160 phase set or show the current phase name
161 pull pull changes from the specified source
161 pull pull changes from the specified source
162 push push changes to the specified destination
162 push push changes to the specified destination
163 recover roll back an interrupted transaction
163 recover roll back an interrupted transaction
164 remove remove the specified files on the next commit
164 remove remove the specified files on the next commit
165 rename rename files; equivalent of copy + remove
165 rename rename files; equivalent of copy + remove
166 resolve redo merges or set/view the merge status of files
166 resolve redo merges or set/view the merge status of files
167 revert restore files to their checkout state
167 revert restore files to their checkout state
168 root print the root (top) of the current working directory
168 root print the root (top) of the current working directory
169 serve start stand-alone webserver
169 serve start stand-alone webserver
170 status show changed files in the working directory
170 status show changed files in the working directory
171 summary summarize working directory state
171 summary summarize working directory state
172 tag add one or more tags for the current or given revision
172 tag add one or more tags for the current or given revision
173 tags list repository tags
173 tags list repository tags
174 unbundle apply one or more changegroup files
174 unbundle apply one or more changegroup files
175 update update working directory (or switch revisions)
175 update update working directory (or switch revisions)
176 verify verify the integrity of the repository
176 verify verify the integrity of the repository
177 version output version and copyright information
177 version output version and copyright information
178
178
179 additional help topics:
179 additional help topics:
180
180
181 config Configuration Files
181 config Configuration Files
182 dates Date Formats
182 dates Date Formats
183 diffs Diff Formats
183 diffs Diff Formats
184 environment Environment Variables
184 environment Environment Variables
185 extensions Using Additional Features
185 extensions Using Additional Features
186 filesets Specifying File Sets
186 filesets Specifying File Sets
187 glossary Glossary
187 glossary Glossary
188 hgignore Syntax for Mercurial Ignore Files
188 hgignore Syntax for Mercurial Ignore Files
189 hgweb Configuring hgweb
189 hgweb Configuring hgweb
190 merge-tools Merge Tools
190 merge-tools Merge Tools
191 multirevs Specifying Multiple Revisions
191 multirevs Specifying Multiple Revisions
192 patterns File Name Patterns
192 patterns File Name Patterns
193 phases Working with Phases
193 phases Working with Phases
194 revisions Specifying Single Revisions
194 revisions Specifying Single Revisions
195 revsets Specifying Revision Sets
195 revsets Specifying Revision Sets
196 scripting Using Mercurial from scripts and automation
196 scripting Using Mercurial from scripts and automation
197 subrepos Subrepositories
197 subrepos Subrepositories
198 templating Template Usage
198 templating Template Usage
199 urls URL Paths
199 urls URL Paths
200
200
201 Test extension help:
201 Test extension help:
202 $ hg help extensions --config extensions.rebase= --config extensions.children=
202 $ hg help extensions --config extensions.rebase= --config extensions.children=
203 Using Additional Features
203 Using Additional Features
204 """""""""""""""""""""""""
204 """""""""""""""""""""""""
205
205
206 Mercurial has the ability to add new features through the use of
206 Mercurial has the ability to add new features through the use of
207 extensions. Extensions may add new commands, add options to existing
207 extensions. Extensions may add new commands, add options to existing
208 commands, change the default behavior of commands, or implement hooks.
208 commands, change the default behavior of commands, or implement hooks.
209
209
210 To enable the "foo" extension, either shipped with Mercurial or in the
210 To enable the "foo" extension, either shipped with Mercurial or in the
211 Python search path, create an entry for it in your configuration file,
211 Python search path, create an entry for it in your configuration file,
212 like this:
212 like this:
213
213
214 [extensions]
214 [extensions]
215 foo =
215 foo =
216
216
217 You may also specify the full path to an extension:
217 You may also specify the full path to an extension:
218
218
219 [extensions]
219 [extensions]
220 myfeature = ~/.hgext/myfeature.py
220 myfeature = ~/.hgext/myfeature.py
221
221
222 See "hg help config" for more information on configuration files.
222 See "hg help config" for more information on configuration files.
223
223
224 Extensions are not loaded by default for a variety of reasons: they can
224 Extensions are not loaded by default for a variety of reasons: they can
225 increase startup overhead; they may be meant for advanced usage only; they
225 increase startup overhead; they may be meant for advanced usage only; they
226 may provide potentially dangerous abilities (such as letting you destroy
226 may provide potentially dangerous abilities (such as letting you destroy
227 or modify history); they might not be ready for prime time; or they may
227 or modify history); they might not be ready for prime time; or they may
228 alter some usual behaviors of stock Mercurial. It is thus up to the user
228 alter some usual behaviors of stock Mercurial. It is thus up to the user
229 to activate extensions as needed.
229 to activate extensions as needed.
230
230
231 To explicitly disable an extension enabled in a configuration file of
231 To explicitly disable an extension enabled in a configuration file of
232 broader scope, prepend its path with !:
232 broader scope, prepend its path with !:
233
233
234 [extensions]
234 [extensions]
235 # disabling extension bar residing in /path/to/extension/bar.py
235 # disabling extension bar residing in /path/to/extension/bar.py
236 bar = !/path/to/extension/bar.py
236 bar = !/path/to/extension/bar.py
237 # ditto, but no path was supplied for extension baz
237 # ditto, but no path was supplied for extension baz
238 baz = !
238 baz = !
239
239
240 enabled extensions:
240 enabled extensions:
241
241
242 children command to display child changesets (DEPRECATED)
242 children command to display child changesets (DEPRECATED)
243 rebase command to move sets of revisions to a different ancestor
243 rebase command to move sets of revisions to a different ancestor
244
244
245 disabled extensions:
245 disabled extensions:
246
246
247 acl hooks for controlling repository access
247 acl hooks for controlling repository access
248 blackbox log repository events to a blackbox for debugging
248 blackbox log repository events to a blackbox for debugging
249 bugzilla hooks for integrating with the Bugzilla bug tracker
249 bugzilla hooks for integrating with the Bugzilla bug tracker
250 censor erase file content at a given revision
250 censor erase file content at a given revision
251 churn command to display statistics about repository history
251 churn command to display statistics about repository history
252 clonebundles server side extension to advertise pre-generated bundles to
253 seed clones.
252 color colorize output from some commands
254 color colorize output from some commands
253 convert import revisions from foreign VCS repositories into
255 convert import revisions from foreign VCS repositories into
254 Mercurial
256 Mercurial
255 eol automatically manage newlines in repository files
257 eol automatically manage newlines in repository files
256 extdiff command to allow external programs to compare revisions
258 extdiff command to allow external programs to compare revisions
257 factotum http authentication with factotum
259 factotum http authentication with factotum
258 gpg commands to sign and verify changesets
260 gpg commands to sign and verify changesets
259 hgcia hooks for integrating with the CIA.vc notification service
261 hgcia hooks for integrating with the CIA.vc notification service
260 hgk browse the repository in a graphical way
262 hgk browse the repository in a graphical way
261 highlight syntax highlighting for hgweb (requires Pygments)
263 highlight syntax highlighting for hgweb (requires Pygments)
262 histedit interactive history editing
264 histedit interactive history editing
263 keyword expand keywords in tracked files
265 keyword expand keywords in tracked files
264 largefiles track large binary files
266 largefiles track large binary files
265 mq manage a stack of patches
267 mq manage a stack of patches
266 notify hooks for sending email push notifications
268 notify hooks for sending email push notifications
267 pager browse command output with an external pager
269 pager browse command output with an external pager
268 patchbomb command to send changesets as (a series of) patch emails
270 patchbomb command to send changesets as (a series of) patch emails
269 purge command to delete untracked files from the working
271 purge command to delete untracked files from the working
270 directory
272 directory
271 record commands to interactively select changes for
273 record commands to interactively select changes for
272 commit/qrefresh
274 commit/qrefresh
273 relink recreates hardlinks between repository clones
275 relink recreates hardlinks between repository clones
274 schemes extend schemes with shortcuts to repository swarms
276 schemes extend schemes with shortcuts to repository swarms
275 share share a common history between several working directories
277 share share a common history between several working directories
276 shelve save and restore changes to the working directory
278 shelve save and restore changes to the working directory
277 strip strip changesets and their descendants from history
279 strip strip changesets and their descendants from history
278 transplant command to transplant changesets from another branch
280 transplant command to transplant changesets from another branch
279 win32mbcs allow the use of MBCS paths with problematic encodings
281 win32mbcs allow the use of MBCS paths with problematic encodings
280 zeroconf discover and advertise repositories on the local network
282 zeroconf discover and advertise repositories on the local network
281
283
282 Verify that extension keywords appear in help templates
284 Verify that extension keywords appear in help templates
283
285
284 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
286 $ hg help --config extensions.transplant= templating|grep transplant > /dev/null
285
287
286 Test short command list with verbose option
288 Test short command list with verbose option
287
289
288 $ hg -v help shortlist
290 $ hg -v help shortlist
289 Mercurial Distributed SCM
291 Mercurial Distributed SCM
290
292
291 basic commands:
293 basic commands:
292
294
293 add add the specified files on the next commit
295 add add the specified files on the next commit
294 annotate, blame
296 annotate, blame
295 show changeset information by line for each file
297 show changeset information by line for each file
296 clone make a copy of an existing repository
298 clone make a copy of an existing repository
297 commit, ci commit the specified files or all outstanding changes
299 commit, ci commit the specified files or all outstanding changes
298 diff diff repository (or selected files)
300 diff diff repository (or selected files)
299 export dump the header and diffs for one or more changesets
301 export dump the header and diffs for one or more changesets
300 forget forget the specified files on the next commit
302 forget forget the specified files on the next commit
301 init create a new repository in the given directory
303 init create a new repository in the given directory
302 log, history show revision history of entire repository or files
304 log, history show revision history of entire repository or files
303 merge merge another revision into working directory
305 merge merge another revision into working directory
304 pull pull changes from the specified source
306 pull pull changes from the specified source
305 push push changes to the specified destination
307 push push changes to the specified destination
306 remove, rm remove the specified files on the next commit
308 remove, rm remove the specified files on the next commit
307 serve start stand-alone webserver
309 serve start stand-alone webserver
308 status, st show changed files in the working directory
310 status, st show changed files in the working directory
309 summary, sum summarize working directory state
311 summary, sum summarize working directory state
310 update, up, checkout, co
312 update, up, checkout, co
311 update working directory (or switch revisions)
313 update working directory (or switch revisions)
312
314
313 global options ([+] can be repeated):
315 global options ([+] can be repeated):
314
316
315 -R --repository REPO repository root directory or name of overlay bundle
317 -R --repository REPO repository root directory or name of overlay bundle
316 file
318 file
317 --cwd DIR change working directory
319 --cwd DIR change working directory
318 -y --noninteractive do not prompt, automatically pick the first choice for
320 -y --noninteractive do not prompt, automatically pick the first choice for
319 all prompts
321 all prompts
320 -q --quiet suppress output
322 -q --quiet suppress output
321 -v --verbose enable additional output
323 -v --verbose enable additional output
322 --config CONFIG [+] set/override config option (use 'section.name=value')
324 --config CONFIG [+] set/override config option (use 'section.name=value')
323 --debug enable debugging output
325 --debug enable debugging output
324 --debugger start debugger
326 --debugger start debugger
325 --encoding ENCODE set the charset encoding (default: ascii)
327 --encoding ENCODE set the charset encoding (default: ascii)
326 --encodingmode MODE set the charset encoding mode (default: strict)
328 --encodingmode MODE set the charset encoding mode (default: strict)
327 --traceback always print a traceback on exception
329 --traceback always print a traceback on exception
328 --time time how long the command takes
330 --time time how long the command takes
329 --profile print command execution profile
331 --profile print command execution profile
330 --version output version information and exit
332 --version output version information and exit
331 -h --help display help and exit
333 -h --help display help and exit
332 --hidden consider hidden changesets
334 --hidden consider hidden changesets
333
335
334 (use "hg help" for the full list of commands)
336 (use "hg help" for the full list of commands)
335
337
336 $ hg add -h
338 $ hg add -h
337 hg add [OPTION]... [FILE]...
339 hg add [OPTION]... [FILE]...
338
340
339 add the specified files on the next commit
341 add the specified files on the next commit
340
342
341 Schedule files to be version controlled and added to the repository.
343 Schedule files to be version controlled and added to the repository.
342
344
343 The files will be added to the repository at the next commit. To undo an
345 The files will be added to the repository at the next commit. To undo an
344 add before that, see "hg forget".
346 add before that, see "hg forget".
345
347
346 If no names are given, add all files to the repository.
348 If no names are given, add all files to the repository.
347
349
348 Returns 0 if all files are successfully added.
350 Returns 0 if all files are successfully added.
349
351
350 options ([+] can be repeated):
352 options ([+] can be repeated):
351
353
352 -I --include PATTERN [+] include names matching the given patterns
354 -I --include PATTERN [+] include names matching the given patterns
353 -X --exclude PATTERN [+] exclude names matching the given patterns
355 -X --exclude PATTERN [+] exclude names matching the given patterns
354 -S --subrepos recurse into subrepositories
356 -S --subrepos recurse into subrepositories
355 -n --dry-run do not perform actions, just print output
357 -n --dry-run do not perform actions, just print output
356
358
357 (some details hidden, use --verbose to show complete help)
359 (some details hidden, use --verbose to show complete help)
358
360
359 Verbose help for add
361 Verbose help for add
360
362
361 $ hg add -hv
363 $ hg add -hv
362 hg add [OPTION]... [FILE]...
364 hg add [OPTION]... [FILE]...
363
365
364 add the specified files on the next commit
366 add the specified files on the next commit
365
367
366 Schedule files to be version controlled and added to the repository.
368 Schedule files to be version controlled and added to the repository.
367
369
368 The files will be added to the repository at the next commit. To undo an
370 The files will be added to the repository at the next commit. To undo an
369 add before that, see "hg forget".
371 add before that, see "hg forget".
370
372
371 If no names are given, add all files to the repository.
373 If no names are given, add all files to the repository.
372
374
373 An example showing how new (unknown) files are added automatically by "hg
375 An example showing how new (unknown) files are added automatically by "hg
374 add":
376 add":
375
377
376 $ ls
378 $ ls
377 foo.c
379 foo.c
378 $ hg status
380 $ hg status
379 ? foo.c
381 ? foo.c
380 $ hg add
382 $ hg add
381 adding foo.c
383 adding foo.c
382 $ hg status
384 $ hg status
383 A foo.c
385 A foo.c
384
386
385 Returns 0 if all files are successfully added.
387 Returns 0 if all files are successfully added.
386
388
387 options ([+] can be repeated):
389 options ([+] can be repeated):
388
390
389 -I --include PATTERN [+] include names matching the given patterns
391 -I --include PATTERN [+] include names matching the given patterns
390 -X --exclude PATTERN [+] exclude names matching the given patterns
392 -X --exclude PATTERN [+] exclude names matching the given patterns
391 -S --subrepos recurse into subrepositories
393 -S --subrepos recurse into subrepositories
392 -n --dry-run do not perform actions, just print output
394 -n --dry-run do not perform actions, just print output
393
395
394 global options ([+] can be repeated):
396 global options ([+] can be repeated):
395
397
396 -R --repository REPO repository root directory or name of overlay bundle
398 -R --repository REPO repository root directory or name of overlay bundle
397 file
399 file
398 --cwd DIR change working directory
400 --cwd DIR change working directory
399 -y --noninteractive do not prompt, automatically pick the first choice for
401 -y --noninteractive do not prompt, automatically pick the first choice for
400 all prompts
402 all prompts
401 -q --quiet suppress output
403 -q --quiet suppress output
402 -v --verbose enable additional output
404 -v --verbose enable additional output
403 --config CONFIG [+] set/override config option (use 'section.name=value')
405 --config CONFIG [+] set/override config option (use 'section.name=value')
404 --debug enable debugging output
406 --debug enable debugging output
405 --debugger start debugger
407 --debugger start debugger
406 --encoding ENCODE set the charset encoding (default: ascii)
408 --encoding ENCODE set the charset encoding (default: ascii)
407 --encodingmode MODE set the charset encoding mode (default: strict)
409 --encodingmode MODE set the charset encoding mode (default: strict)
408 --traceback always print a traceback on exception
410 --traceback always print a traceback on exception
409 --time time how long the command takes
411 --time time how long the command takes
410 --profile print command execution profile
412 --profile print command execution profile
411 --version output version information and exit
413 --version output version information and exit
412 -h --help display help and exit
414 -h --help display help and exit
413 --hidden consider hidden changesets
415 --hidden consider hidden changesets
414
416
415 Test help option with version option
417 Test help option with version option
416
418
417 $ hg add -h --version
419 $ hg add -h --version
418 Mercurial Distributed SCM (version *) (glob)
420 Mercurial Distributed SCM (version *) (glob)
419 (see https://mercurial-scm.org for more information)
421 (see https://mercurial-scm.org for more information)
420
422
421 Copyright (C) 2005-2015 Matt Mackall and others
423 Copyright (C) 2005-2015 Matt Mackall and others
422 This is free software; see the source for copying conditions. There is NO
424 This is free software; see the source for copying conditions. There is NO
423 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
425 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
424
426
425 $ hg add --skjdfks
427 $ hg add --skjdfks
426 hg add: option --skjdfks not recognized
428 hg add: option --skjdfks not recognized
427 hg add [OPTION]... [FILE]...
429 hg add [OPTION]... [FILE]...
428
430
429 add the specified files on the next commit
431 add the specified files on the next commit
430
432
431 options ([+] can be repeated):
433 options ([+] can be repeated):
432
434
433 -I --include PATTERN [+] include names matching the given patterns
435 -I --include PATTERN [+] include names matching the given patterns
434 -X --exclude PATTERN [+] exclude names matching the given patterns
436 -X --exclude PATTERN [+] exclude names matching the given patterns
435 -S --subrepos recurse into subrepositories
437 -S --subrepos recurse into subrepositories
436 -n --dry-run do not perform actions, just print output
438 -n --dry-run do not perform actions, just print output
437
439
438 (use "hg add -h" to show more help)
440 (use "hg add -h" to show more help)
439 [255]
441 [255]
440
442
441 Test ambiguous command help
443 Test ambiguous command help
442
444
443 $ hg help ad
445 $ hg help ad
444 list of commands:
446 list of commands:
445
447
446 add add the specified files on the next commit
448 add add the specified files on the next commit
447 addremove add all new files, delete all missing files
449 addremove add all new files, delete all missing files
448
450
449 (use "hg help -v ad" to show built-in aliases and global options)
451 (use "hg help -v ad" to show built-in aliases and global options)
450
452
451 Test command without options
453 Test command without options
452
454
453 $ hg help verify
455 $ hg help verify
454 hg verify
456 hg verify
455
457
456 verify the integrity of the repository
458 verify the integrity of the repository
457
459
458 Verify the integrity of the current repository.
460 Verify the integrity of the current repository.
459
461
460 This will perform an extensive check of the repository's integrity,
462 This will perform an extensive check of the repository's integrity,
461 validating the hashes and checksums of each entry in the changelog,
463 validating the hashes and checksums of each entry in the changelog,
462 manifest, and tracked files, as well as the integrity of their crosslinks
464 manifest, and tracked files, as well as the integrity of their crosslinks
463 and indices.
465 and indices.
464
466
465 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
467 Please see https://mercurial-scm.org/wiki/RepositoryCorruption for more
466 information about recovery from corruption of the repository.
468 information about recovery from corruption of the repository.
467
469
468 Returns 0 on success, 1 if errors are encountered.
470 Returns 0 on success, 1 if errors are encountered.
469
471
470 (some details hidden, use --verbose to show complete help)
472 (some details hidden, use --verbose to show complete help)
471
473
472 $ hg help diff
474 $ hg help diff
473 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
475 hg diff [OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...
474
476
475 diff repository (or selected files)
477 diff repository (or selected files)
476
478
477 Show differences between revisions for the specified files.
479 Show differences between revisions for the specified files.
478
480
479 Differences between files are shown using the unified diff format.
481 Differences between files are shown using the unified diff format.
480
482
481 Note:
483 Note:
482 diff may generate unexpected results for merges, as it will default to
484 diff may generate unexpected results for merges, as it will default to
483 comparing against the working directory's first parent changeset if no
485 comparing against the working directory's first parent changeset if no
484 revisions are specified.
486 revisions are specified.
485
487
486 When two revision arguments are given, then changes are shown between
488 When two revision arguments are given, then changes are shown between
487 those revisions. If only one revision is specified then that revision is
489 those revisions. If only one revision is specified then that revision is
488 compared to the working directory, and, when no revisions are specified,
490 compared to the working directory, and, when no revisions are specified,
489 the working directory files are compared to its parent.
491 the working directory files are compared to its parent.
490
492
491 Alternatively you can specify -c/--change with a revision to see the
493 Alternatively you can specify -c/--change with a revision to see the
492 changes in that changeset relative to its first parent.
494 changes in that changeset relative to its first parent.
493
495
494 Without the -a/--text option, diff will avoid generating diffs of files it
496 Without the -a/--text option, diff will avoid generating diffs of files it
495 detects as binary. With -a, diff will generate a diff anyway, probably
497 detects as binary. With -a, diff will generate a diff anyway, probably
496 with undesirable results.
498 with undesirable results.
497
499
498 Use the -g/--git option to generate diffs in the git extended diff format.
500 Use the -g/--git option to generate diffs in the git extended diff format.
499 For more information, read "hg help diffs".
501 For more information, read "hg help diffs".
500
502
501 Returns 0 on success.
503 Returns 0 on success.
502
504
503 options ([+] can be repeated):
505 options ([+] can be repeated):
504
506
505 -r --rev REV [+] revision
507 -r --rev REV [+] revision
506 -c --change REV change made by revision
508 -c --change REV change made by revision
507 -a --text treat all files as text
509 -a --text treat all files as text
508 -g --git use git extended diff format
510 -g --git use git extended diff format
509 --nodates omit dates from diff headers
511 --nodates omit dates from diff headers
510 --noprefix omit a/ and b/ prefixes from filenames
512 --noprefix omit a/ and b/ prefixes from filenames
511 -p --show-function show which function each change is in
513 -p --show-function show which function each change is in
512 --reverse produce a diff that undoes the changes
514 --reverse produce a diff that undoes the changes
513 -w --ignore-all-space ignore white space when comparing lines
515 -w --ignore-all-space ignore white space when comparing lines
514 -b --ignore-space-change ignore changes in the amount of white space
516 -b --ignore-space-change ignore changes in the amount of white space
515 -B --ignore-blank-lines ignore changes whose lines are all blank
517 -B --ignore-blank-lines ignore changes whose lines are all blank
516 -U --unified NUM number of lines of context to show
518 -U --unified NUM number of lines of context to show
517 --stat output diffstat-style summary of changes
519 --stat output diffstat-style summary of changes
518 --root DIR produce diffs relative to subdirectory
520 --root DIR produce diffs relative to subdirectory
519 -I --include PATTERN [+] include names matching the given patterns
521 -I --include PATTERN [+] include names matching the given patterns
520 -X --exclude PATTERN [+] exclude names matching the given patterns
522 -X --exclude PATTERN [+] exclude names matching the given patterns
521 -S --subrepos recurse into subrepositories
523 -S --subrepos recurse into subrepositories
522
524
523 (some details hidden, use --verbose to show complete help)
525 (some details hidden, use --verbose to show complete help)
524
526
525 $ hg help status
527 $ hg help status
526 hg status [OPTION]... [FILE]...
528 hg status [OPTION]... [FILE]...
527
529
528 aliases: st
530 aliases: st
529
531
530 show changed files in the working directory
532 show changed files in the working directory
531
533
532 Show status of files in the repository. If names are given, only files
534 Show status of files in the repository. If names are given, only files
533 that match are shown. Files that are clean or ignored or the source of a
535 that match are shown. Files that are clean or ignored or the source of a
534 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
536 copy/move operation, are not listed unless -c/--clean, -i/--ignored,
535 -C/--copies or -A/--all are given. Unless options described with "show
537 -C/--copies or -A/--all are given. Unless options described with "show
536 only ..." are given, the options -mardu are used.
538 only ..." are given, the options -mardu are used.
537
539
538 Option -q/--quiet hides untracked (unknown and ignored) files unless
540 Option -q/--quiet hides untracked (unknown and ignored) files unless
539 explicitly requested with -u/--unknown or -i/--ignored.
541 explicitly requested with -u/--unknown or -i/--ignored.
540
542
541 Note:
543 Note:
542 status may appear to disagree with diff if permissions have changed or
544 status may appear to disagree with diff if permissions have changed or
543 a merge has occurred. The standard diff format does not report
545 a merge has occurred. The standard diff format does not report
544 permission changes and diff only reports changes relative to one merge
546 permission changes and diff only reports changes relative to one merge
545 parent.
547 parent.
546
548
547 If one revision is given, it is used as the base revision. If two
549 If one revision is given, it is used as the base revision. If two
548 revisions are given, the differences between them are shown. The --change
550 revisions are given, the differences between them are shown. The --change
549 option can also be used as a shortcut to list the changed files of a
551 option can also be used as a shortcut to list the changed files of a
550 revision from its first parent.
552 revision from its first parent.
551
553
552 The codes used to show the status of files are:
554 The codes used to show the status of files are:
553
555
554 M = modified
556 M = modified
555 A = added
557 A = added
556 R = removed
558 R = removed
557 C = clean
559 C = clean
558 ! = missing (deleted by non-hg command, but still tracked)
560 ! = missing (deleted by non-hg command, but still tracked)
559 ? = not tracked
561 ? = not tracked
560 I = ignored
562 I = ignored
561 = origin of the previous file (with --copies)
563 = origin of the previous file (with --copies)
562
564
563 Returns 0 on success.
565 Returns 0 on success.
564
566
565 options ([+] can be repeated):
567 options ([+] can be repeated):
566
568
567 -A --all show status of all files
569 -A --all show status of all files
568 -m --modified show only modified files
570 -m --modified show only modified files
569 -a --added show only added files
571 -a --added show only added files
570 -r --removed show only removed files
572 -r --removed show only removed files
571 -d --deleted show only deleted (but tracked) files
573 -d --deleted show only deleted (but tracked) files
572 -c --clean show only files without changes
574 -c --clean show only files without changes
573 -u --unknown show only unknown (not tracked) files
575 -u --unknown show only unknown (not tracked) files
574 -i --ignored show only ignored files
576 -i --ignored show only ignored files
575 -n --no-status hide status prefix
577 -n --no-status hide status prefix
576 -C --copies show source of copied files
578 -C --copies show source of copied files
577 -0 --print0 end filenames with NUL, for use with xargs
579 -0 --print0 end filenames with NUL, for use with xargs
578 --rev REV [+] show difference from revision
580 --rev REV [+] show difference from revision
579 --change REV list the changed files of a revision
581 --change REV list the changed files of a revision
580 -I --include PATTERN [+] include names matching the given patterns
582 -I --include PATTERN [+] include names matching the given patterns
581 -X --exclude PATTERN [+] exclude names matching the given patterns
583 -X --exclude PATTERN [+] exclude names matching the given patterns
582 -S --subrepos recurse into subrepositories
584 -S --subrepos recurse into subrepositories
583
585
584 (some details hidden, use --verbose to show complete help)
586 (some details hidden, use --verbose to show complete help)
585
587
586 $ hg -q help status
588 $ hg -q help status
587 hg status [OPTION]... [FILE]...
589 hg status [OPTION]... [FILE]...
588
590
589 show changed files in the working directory
591 show changed files in the working directory
590
592
591 $ hg help foo
593 $ hg help foo
592 abort: no such help topic: foo
594 abort: no such help topic: foo
593 (try "hg help --keyword foo")
595 (try "hg help --keyword foo")
594 [255]
596 [255]
595
597
596 $ hg skjdfks
598 $ hg skjdfks
597 hg: unknown command 'skjdfks'
599 hg: unknown command 'skjdfks'
598 Mercurial Distributed SCM
600 Mercurial Distributed SCM
599
601
600 basic commands:
602 basic commands:
601
603
602 add add the specified files on the next commit
604 add add the specified files on the next commit
603 annotate show changeset information by line for each file
605 annotate show changeset information by line for each file
604 clone make a copy of an existing repository
606 clone make a copy of an existing repository
605 commit commit the specified files or all outstanding changes
607 commit commit the specified files or all outstanding changes
606 diff diff repository (or selected files)
608 diff diff repository (or selected files)
607 export dump the header and diffs for one or more changesets
609 export dump the header and diffs for one or more changesets
608 forget forget the specified files on the next commit
610 forget forget the specified files on the next commit
609 init create a new repository in the given directory
611 init create a new repository in the given directory
610 log show revision history of entire repository or files
612 log show revision history of entire repository or files
611 merge merge another revision into working directory
613 merge merge another revision into working directory
612 pull pull changes from the specified source
614 pull pull changes from the specified source
613 push push changes to the specified destination
615 push push changes to the specified destination
614 remove remove the specified files on the next commit
616 remove remove the specified files on the next commit
615 serve start stand-alone webserver
617 serve start stand-alone webserver
616 status show changed files in the working directory
618 status show changed files in the working directory
617 summary summarize working directory state
619 summary summarize working directory state
618 update update working directory (or switch revisions)
620 update update working directory (or switch revisions)
619
621
620 (use "hg help" for the full list of commands or "hg -v" for details)
622 (use "hg help" for the full list of commands or "hg -v" for details)
621 [255]
623 [255]
622
624
623
625
624 Make sure that we don't run afoul of the help system thinking that
626 Make sure that we don't run afoul of the help system thinking that
625 this is a section and erroring out weirdly.
627 this is a section and erroring out weirdly.
626
628
627 $ hg .log
629 $ hg .log
628 hg: unknown command '.log'
630 hg: unknown command '.log'
629 (did you mean one of log?)
631 (did you mean one of log?)
630 [255]
632 [255]
631
633
632 $ hg log.
634 $ hg log.
633 hg: unknown command 'log.'
635 hg: unknown command 'log.'
634 (did you mean one of log?)
636 (did you mean one of log?)
635 [255]
637 [255]
636 $ hg pu.lh
638 $ hg pu.lh
637 hg: unknown command 'pu.lh'
639 hg: unknown command 'pu.lh'
638 (did you mean one of pull, push?)
640 (did you mean one of pull, push?)
639 [255]
641 [255]
640
642
641 $ cat > helpext.py <<EOF
643 $ cat > helpext.py <<EOF
642 > import os
644 > import os
643 > from mercurial import cmdutil, commands
645 > from mercurial import cmdutil, commands
644 >
646 >
645 > cmdtable = {}
647 > cmdtable = {}
646 > command = cmdutil.command(cmdtable)
648 > command = cmdutil.command(cmdtable)
647 >
649 >
648 > @command('nohelp',
650 > @command('nohelp',
649 > [('', 'longdesc', 3, 'x'*90),
651 > [('', 'longdesc', 3, 'x'*90),
650 > ('n', '', None, 'normal desc'),
652 > ('n', '', None, 'normal desc'),
651 > ('', 'newline', '', 'line1\nline2')],
653 > ('', 'newline', '', 'line1\nline2')],
652 > 'hg nohelp',
654 > 'hg nohelp',
653 > norepo=True)
655 > norepo=True)
654 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
656 > @command('debugoptDEP', [('', 'dopt', None, 'option is (DEPRECATED)')])
655 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
657 > @command('debugoptEXP', [('', 'eopt', None, 'option is (EXPERIMENTAL)')])
656 > def nohelp(ui, *args, **kwargs):
658 > def nohelp(ui, *args, **kwargs):
657 > pass
659 > pass
658 >
660 >
659 > EOF
661 > EOF
660 $ echo '[extensions]' >> $HGRCPATH
662 $ echo '[extensions]' >> $HGRCPATH
661 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
663 $ echo "helpext = `pwd`/helpext.py" >> $HGRCPATH
662
664
663 Test command with no help text
665 Test command with no help text
664
666
665 $ hg help nohelp
667 $ hg help nohelp
666 hg nohelp
668 hg nohelp
667
669
668 (no help text available)
670 (no help text available)
669
671
670 options:
672 options:
671
673
672 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
674 --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
673 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
675 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3)
674 -n -- normal desc
676 -n -- normal desc
675 --newline VALUE line1 line2
677 --newline VALUE line1 line2
676
678
677 (some details hidden, use --verbose to show complete help)
679 (some details hidden, use --verbose to show complete help)
678
680
679 $ hg help -k nohelp
681 $ hg help -k nohelp
680 Commands:
682 Commands:
681
683
682 nohelp hg nohelp
684 nohelp hg nohelp
683
685
684 Extension Commands:
686 Extension Commands:
685
687
686 nohelp (no help text available)
688 nohelp (no help text available)
687
689
688 Test that default list of commands omits extension commands
690 Test that default list of commands omits extension commands
689
691
690 $ hg help
692 $ hg help
691 Mercurial Distributed SCM
693 Mercurial Distributed SCM
692
694
693 list of commands:
695 list of commands:
694
696
695 add add the specified files on the next commit
697 add add the specified files on the next commit
696 addremove add all new files, delete all missing files
698 addremove add all new files, delete all missing files
697 annotate show changeset information by line for each file
699 annotate show changeset information by line for each file
698 archive create an unversioned archive of a repository revision
700 archive create an unversioned archive of a repository revision
699 backout reverse effect of earlier changeset
701 backout reverse effect of earlier changeset
700 bisect subdivision search of changesets
702 bisect subdivision search of changesets
701 bookmarks create a new bookmark or list existing bookmarks
703 bookmarks create a new bookmark or list existing bookmarks
702 branch set or show the current branch name
704 branch set or show the current branch name
703 branches list repository named branches
705 branches list repository named branches
704 bundle create a changegroup file
706 bundle create a changegroup file
705 cat output the current or given revision of files
707 cat output the current or given revision of files
706 clone make a copy of an existing repository
708 clone make a copy of an existing repository
707 commit commit the specified files or all outstanding changes
709 commit commit the specified files or all outstanding changes
708 config show combined config settings from all hgrc files
710 config show combined config settings from all hgrc files
709 copy mark files as copied for the next commit
711 copy mark files as copied for the next commit
710 diff diff repository (or selected files)
712 diff diff repository (or selected files)
711 export dump the header and diffs for one or more changesets
713 export dump the header and diffs for one or more changesets
712 files list tracked files
714 files list tracked files
713 forget forget the specified files on the next commit
715 forget forget the specified files on the next commit
714 graft copy changes from other branches onto the current branch
716 graft copy changes from other branches onto the current branch
715 grep search for a pattern in specified files and revisions
717 grep search for a pattern in specified files and revisions
716 heads show branch heads
718 heads show branch heads
717 help show help for a given topic or a help overview
719 help show help for a given topic or a help overview
718 identify identify the working directory or specified revision
720 identify identify the working directory or specified revision
719 import import an ordered set of patches
721 import import an ordered set of patches
720 incoming show new changesets found in source
722 incoming show new changesets found in source
721 init create a new repository in the given directory
723 init create a new repository in the given directory
722 log show revision history of entire repository or files
724 log show revision history of entire repository or files
723 manifest output the current or given revision of the project manifest
725 manifest output the current or given revision of the project manifest
724 merge merge another revision into working directory
726 merge merge another revision into working directory
725 outgoing show changesets not found in the destination
727 outgoing show changesets not found in the destination
726 paths show aliases for remote repositories
728 paths show aliases for remote repositories
727 phase set or show the current phase name
729 phase set or show the current phase name
728 pull pull changes from the specified source
730 pull pull changes from the specified source
729 push push changes to the specified destination
731 push push changes to the specified destination
730 recover roll back an interrupted transaction
732 recover roll back an interrupted transaction
731 remove remove the specified files on the next commit
733 remove remove the specified files on the next commit
732 rename rename files; equivalent of copy + remove
734 rename rename files; equivalent of copy + remove
733 resolve redo merges or set/view the merge status of files
735 resolve redo merges or set/view the merge status of files
734 revert restore files to their checkout state
736 revert restore files to their checkout state
735 root print the root (top) of the current working directory
737 root print the root (top) of the current working directory
736 serve start stand-alone webserver
738 serve start stand-alone webserver
737 status show changed files in the working directory
739 status show changed files in the working directory
738 summary summarize working directory state
740 summary summarize working directory state
739 tag add one or more tags for the current or given revision
741 tag add one or more tags for the current or given revision
740 tags list repository tags
742 tags list repository tags
741 unbundle apply one or more changegroup files
743 unbundle apply one or more changegroup files
742 update update working directory (or switch revisions)
744 update update working directory (or switch revisions)
743 verify verify the integrity of the repository
745 verify verify the integrity of the repository
744 version output version and copyright information
746 version output version and copyright information
745
747
746 enabled extensions:
748 enabled extensions:
747
749
748 helpext (no help text available)
750 helpext (no help text available)
749
751
750 additional help topics:
752 additional help topics:
751
753
752 config Configuration Files
754 config Configuration Files
753 dates Date Formats
755 dates Date Formats
754 diffs Diff Formats
756 diffs Diff Formats
755 environment Environment Variables
757 environment Environment Variables
756 extensions Using Additional Features
758 extensions Using Additional Features
757 filesets Specifying File Sets
759 filesets Specifying File Sets
758 glossary Glossary
760 glossary Glossary
759 hgignore Syntax for Mercurial Ignore Files
761 hgignore Syntax for Mercurial Ignore Files
760 hgweb Configuring hgweb
762 hgweb Configuring hgweb
761 merge-tools Merge Tools
763 merge-tools Merge Tools
762 multirevs Specifying Multiple Revisions
764 multirevs Specifying Multiple Revisions
763 patterns File Name Patterns
765 patterns File Name Patterns
764 phases Working with Phases
766 phases Working with Phases
765 revisions Specifying Single Revisions
767 revisions Specifying Single Revisions
766 revsets Specifying Revision Sets
768 revsets Specifying Revision Sets
767 scripting Using Mercurial from scripts and automation
769 scripting Using Mercurial from scripts and automation
768 subrepos Subrepositories
770 subrepos Subrepositories
769 templating Template Usage
771 templating Template Usage
770 urls URL Paths
772 urls URL Paths
771
773
772 (use "hg help -v" to show built-in aliases and global options)
774 (use "hg help -v" to show built-in aliases and global options)
773
775
774
776
775 Test list of internal help commands
777 Test list of internal help commands
776
778
777 $ hg help debug
779 $ hg help debug
778 debug commands (internal and unsupported):
780 debug commands (internal and unsupported):
779
781
780 debugancestor
782 debugancestor
781 find the ancestor revision of two revisions in a given index
783 find the ancestor revision of two revisions in a given index
782 debugbuilddag
784 debugbuilddag
783 builds a repo with a given DAG from scratch in the current
785 builds a repo with a given DAG from scratch in the current
784 empty repo
786 empty repo
785 debugbundle lists the contents of a bundle
787 debugbundle lists the contents of a bundle
786 debugcheckstate
788 debugcheckstate
787 validate the correctness of the current dirstate
789 validate the correctness of the current dirstate
788 debugcommands
790 debugcommands
789 list all available commands and options
791 list all available commands and options
790 debugcomplete
792 debugcomplete
791 returns the completion list associated with the given command
793 returns the completion list associated with the given command
792 debugdag format the changelog or an index DAG as a concise textual
794 debugdag format the changelog or an index DAG as a concise textual
793 description
795 description
794 debugdata dump the contents of a data file revision
796 debugdata dump the contents of a data file revision
795 debugdate parse and display a date
797 debugdate parse and display a date
796 debugdirstate
798 debugdirstate
797 show the contents of the current dirstate
799 show the contents of the current dirstate
798 debugdiscovery
800 debugdiscovery
799 runs the changeset discovery protocol in isolation
801 runs the changeset discovery protocol in isolation
800 debugextensions
802 debugextensions
801 show information about active extensions
803 show information about active extensions
802 debugfileset parse and apply a fileset specification
804 debugfileset parse and apply a fileset specification
803 debugfsinfo show information detected about current filesystem
805 debugfsinfo show information detected about current filesystem
804 debuggetbundle
806 debuggetbundle
805 retrieves a bundle from a repo
807 retrieves a bundle from a repo
806 debugignore display the combined ignore pattern
808 debugignore display the combined ignore pattern
807 debugindex dump the contents of an index file
809 debugindex dump the contents of an index file
808 debugindexdot
810 debugindexdot
809 dump an index DAG as a graphviz dot file
811 dump an index DAG as a graphviz dot file
810 debuginstall test Mercurial installation
812 debuginstall test Mercurial installation
811 debugknown test whether node ids are known to a repo
813 debugknown test whether node ids are known to a repo
812 debuglocks show or modify state of locks
814 debuglocks show or modify state of locks
813 debugmergestate
815 debugmergestate
814 print merge state
816 print merge state
815 debugnamecomplete
817 debugnamecomplete
816 complete "names" - tags, open branch names, bookmark names
818 complete "names" - tags, open branch names, bookmark names
817 debugobsolete
819 debugobsolete
818 create arbitrary obsolete marker
820 create arbitrary obsolete marker
819 debugoptDEP (no help text available)
821 debugoptDEP (no help text available)
820 debugoptEXP (no help text available)
822 debugoptEXP (no help text available)
821 debugpathcomplete
823 debugpathcomplete
822 complete part or all of a tracked path
824 complete part or all of a tracked path
823 debugpushkey access the pushkey key/value protocol
825 debugpushkey access the pushkey key/value protocol
824 debugpvec (no help text available)
826 debugpvec (no help text available)
825 debugrebuilddirstate
827 debugrebuilddirstate
826 rebuild the dirstate as it would look like for the given
828 rebuild the dirstate as it would look like for the given
827 revision
829 revision
828 debugrebuildfncache
830 debugrebuildfncache
829 rebuild the fncache file
831 rebuild the fncache file
830 debugrename dump rename information
832 debugrename dump rename information
831 debugrevlog show data and statistics about a revlog
833 debugrevlog show data and statistics about a revlog
832 debugrevspec parse and apply a revision specification
834 debugrevspec parse and apply a revision specification
833 debugsetparents
835 debugsetparents
834 manually set the parents of the current working directory
836 manually set the parents of the current working directory
835 debugsub (no help text available)
837 debugsub (no help text available)
836 debugsuccessorssets
838 debugsuccessorssets
837 show set of successors for revision
839 show set of successors for revision
838 debugwalk show how files match on given patterns
840 debugwalk show how files match on given patterns
839 debugwireargs
841 debugwireargs
840 (no help text available)
842 (no help text available)
841
843
842 (use "hg help -v debug" to show built-in aliases and global options)
844 (use "hg help -v debug" to show built-in aliases and global options)
843
845
844
846
845 Test list of commands with command with no help text
847 Test list of commands with command with no help text
846
848
847 $ hg help helpext
849 $ hg help helpext
848 helpext extension - no help text available
850 helpext extension - no help text available
849
851
850 list of commands:
852 list of commands:
851
853
852 nohelp (no help text available)
854 nohelp (no help text available)
853
855
854 (use "hg help -v helpext" to show built-in aliases and global options)
856 (use "hg help -v helpext" to show built-in aliases and global options)
855
857
856
858
857 test deprecated and experimental options are hidden in command help
859 test deprecated and experimental options are hidden in command help
858 $ hg help debugoptDEP
860 $ hg help debugoptDEP
859 hg debugoptDEP
861 hg debugoptDEP
860
862
861 (no help text available)
863 (no help text available)
862
864
863 options:
865 options:
864
866
865 (some details hidden, use --verbose to show complete help)
867 (some details hidden, use --verbose to show complete help)
866
868
867 $ hg help debugoptEXP
869 $ hg help debugoptEXP
868 hg debugoptEXP
870 hg debugoptEXP
869
871
870 (no help text available)
872 (no help text available)
871
873
872 options:
874 options:
873
875
874 (some details hidden, use --verbose to show complete help)
876 (some details hidden, use --verbose to show complete help)
875
877
876 test deprecated and experimental options is shown with -v
878 test deprecated and experimental options is shown with -v
877 $ hg help -v debugoptDEP | grep dopt
879 $ hg help -v debugoptDEP | grep dopt
878 --dopt option is (DEPRECATED)
880 --dopt option is (DEPRECATED)
879 $ hg help -v debugoptEXP | grep eopt
881 $ hg help -v debugoptEXP | grep eopt
880 --eopt option is (EXPERIMENTAL)
882 --eopt option is (EXPERIMENTAL)
881
883
882 #if gettext
884 #if gettext
883 test deprecated option is hidden with translation with untranslated description
885 test deprecated option is hidden with translation with untranslated description
884 (use many globy for not failing on changed transaction)
886 (use many globy for not failing on changed transaction)
885 $ LANGUAGE=sv hg help debugoptDEP
887 $ LANGUAGE=sv hg help debugoptDEP
886 hg debugoptDEP
888 hg debugoptDEP
887
889
888 (*) (glob)
890 (*) (glob)
889
891
890 options:
892 options:
891
893
892 (some details hidden, use --verbose to show complete help)
894 (some details hidden, use --verbose to show complete help)
893 #endif
895 #endif
894
896
895 Test commands that collide with topics (issue4240)
897 Test commands that collide with topics (issue4240)
896
898
897 $ hg config -hq
899 $ hg config -hq
898 hg config [-u] [NAME]...
900 hg config [-u] [NAME]...
899
901
900 show combined config settings from all hgrc files
902 show combined config settings from all hgrc files
901 $ hg showconfig -hq
903 $ hg showconfig -hq
902 hg config [-u] [NAME]...
904 hg config [-u] [NAME]...
903
905
904 show combined config settings from all hgrc files
906 show combined config settings from all hgrc files
905
907
906 Test a help topic
908 Test a help topic
907
909
908 $ hg help revs
910 $ hg help revs
909 Specifying Single Revisions
911 Specifying Single Revisions
910 """""""""""""""""""""""""""
912 """""""""""""""""""""""""""
911
913
912 Mercurial supports several ways to specify individual revisions.
914 Mercurial supports several ways to specify individual revisions.
913
915
914 A plain integer is treated as a revision number. Negative integers are
916 A plain integer is treated as a revision number. Negative integers are
915 treated as sequential offsets from the tip, with -1 denoting the tip, -2
917 treated as sequential offsets from the tip, with -1 denoting the tip, -2
916 denoting the revision prior to the tip, and so forth.
918 denoting the revision prior to the tip, and so forth.
917
919
918 A 40-digit hexadecimal string is treated as a unique revision identifier.
920 A 40-digit hexadecimal string is treated as a unique revision identifier.
919
921
920 A hexadecimal string less than 40 characters long is treated as a unique
922 A hexadecimal string less than 40 characters long is treated as a unique
921 revision identifier and is referred to as a short-form identifier. A
923 revision identifier and is referred to as a short-form identifier. A
922 short-form identifier is only valid if it is the prefix of exactly one
924 short-form identifier is only valid if it is the prefix of exactly one
923 full-length identifier.
925 full-length identifier.
924
926
925 Any other string is treated as a bookmark, tag, or branch name. A bookmark
927 Any other string is treated as a bookmark, tag, or branch name. A bookmark
926 is a movable pointer to a revision. A tag is a permanent name associated
928 is a movable pointer to a revision. A tag is a permanent name associated
927 with a revision. A branch name denotes the tipmost open branch head of
929 with a revision. A branch name denotes the tipmost open branch head of
928 that branch - or if they are all closed, the tipmost closed head of the
930 that branch - or if they are all closed, the tipmost closed head of the
929 branch. Bookmark, tag, and branch names must not contain the ":"
931 branch. Bookmark, tag, and branch names must not contain the ":"
930 character.
932 character.
931
933
932 The reserved name "tip" always identifies the most recent revision.
934 The reserved name "tip" always identifies the most recent revision.
933
935
934 The reserved name "null" indicates the null revision. This is the revision
936 The reserved name "null" indicates the null revision. This is the revision
935 of an empty repository, and the parent of revision 0.
937 of an empty repository, and the parent of revision 0.
936
938
937 The reserved name "." indicates the working directory parent. If no
939 The reserved name "." indicates the working directory parent. If no
938 working directory is checked out, it is equivalent to null. If an
940 working directory is checked out, it is equivalent to null. If an
939 uncommitted merge is in progress, "." is the revision of the first parent.
941 uncommitted merge is in progress, "." is the revision of the first parent.
940
942
941 Test repeated config section name
943 Test repeated config section name
942
944
943 $ hg help config.host
945 $ hg help config.host
944 "http_proxy.host"
946 "http_proxy.host"
945 Host name and (optional) port of the proxy server, for example
947 Host name and (optional) port of the proxy server, for example
946 "myproxy:8000".
948 "myproxy:8000".
947
949
948 "smtp.host"
950 "smtp.host"
949 Host name of mail server, e.g. "mail.example.com".
951 Host name of mail server, e.g. "mail.example.com".
950
952
951 Unrelated trailing paragraphs shouldn't be included
953 Unrelated trailing paragraphs shouldn't be included
952
954
953 $ hg help config.extramsg | grep '^$'
955 $ hg help config.extramsg | grep '^$'
954
956
955
957
956 Test capitalized section name
958 Test capitalized section name
957
959
958 $ hg help scripting.HGPLAIN > /dev/null
960 $ hg help scripting.HGPLAIN > /dev/null
959
961
960 Help subsection:
962 Help subsection:
961
963
962 $ hg help config.charsets |grep "Email example:" > /dev/null
964 $ hg help config.charsets |grep "Email example:" > /dev/null
963 [1]
965 [1]
964
966
965 Show nested definitions
967 Show nested definitions
966 ("profiling.type"[break]"ls"[break]"stat"[break])
968 ("profiling.type"[break]"ls"[break]"stat"[break])
967
969
968 $ hg help config.type | egrep '^$'|wc -l
970 $ hg help config.type | egrep '^$'|wc -l
969 \s*3 (re)
971 \s*3 (re)
970
972
971 Last item in help config.*:
973 Last item in help config.*:
972
974
973 $ hg help config.`hg help config|grep '^ "'| \
975 $ hg help config.`hg help config|grep '^ "'| \
974 > tail -1|sed 's![ "]*!!g'`| \
976 > tail -1|sed 's![ "]*!!g'`| \
975 > grep "hg help -c config" > /dev/null
977 > grep "hg help -c config" > /dev/null
976 [1]
978 [1]
977
979
978 note to use help -c for general hg help config:
980 note to use help -c for general hg help config:
979
981
980 $ hg help config |grep "hg help -c config" > /dev/null
982 $ hg help config |grep "hg help -c config" > /dev/null
981
983
982 Test templating help
984 Test templating help
983
985
984 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
986 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
985 desc String. The text of the changeset description.
987 desc String. The text of the changeset description.
986 diffstat String. Statistics of changes with the following format:
988 diffstat String. Statistics of changes with the following format:
987 firstline Any text. Returns the first line of text.
989 firstline Any text. Returns the first line of text.
988 nonempty Any text. Returns '(none)' if the string is empty.
990 nonempty Any text. Returns '(none)' if the string is empty.
989
991
990 Test deprecated items
992 Test deprecated items
991
993
992 $ hg help -v templating | grep currentbookmark
994 $ hg help -v templating | grep currentbookmark
993 currentbookmark
995 currentbookmark
994 $ hg help templating | (grep currentbookmark || true)
996 $ hg help templating | (grep currentbookmark || true)
995
997
996 Test help hooks
998 Test help hooks
997
999
998 $ cat > helphook1.py <<EOF
1000 $ cat > helphook1.py <<EOF
999 > from mercurial import help
1001 > from mercurial import help
1000 >
1002 >
1001 > def rewrite(ui, topic, doc):
1003 > def rewrite(ui, topic, doc):
1002 > return doc + '\nhelphook1\n'
1004 > return doc + '\nhelphook1\n'
1003 >
1005 >
1004 > def extsetup(ui):
1006 > def extsetup(ui):
1005 > help.addtopichook('revsets', rewrite)
1007 > help.addtopichook('revsets', rewrite)
1006 > EOF
1008 > EOF
1007 $ cat > helphook2.py <<EOF
1009 $ cat > helphook2.py <<EOF
1008 > from mercurial import help
1010 > from mercurial import help
1009 >
1011 >
1010 > def rewrite(ui, topic, doc):
1012 > def rewrite(ui, topic, doc):
1011 > return doc + '\nhelphook2\n'
1013 > return doc + '\nhelphook2\n'
1012 >
1014 >
1013 > def extsetup(ui):
1015 > def extsetup(ui):
1014 > help.addtopichook('revsets', rewrite)
1016 > help.addtopichook('revsets', rewrite)
1015 > EOF
1017 > EOF
1016 $ echo '[extensions]' >> $HGRCPATH
1018 $ echo '[extensions]' >> $HGRCPATH
1017 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1019 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
1018 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1020 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
1019 $ hg help revsets | grep helphook
1021 $ hg help revsets | grep helphook
1020 helphook1
1022 helphook1
1021 helphook2
1023 helphook2
1022
1024
1023 Test -e / -c / -k combinations
1025 Test -e / -c / -k combinations
1024
1026
1025 $ hg help -c progress
1027 $ hg help -c progress
1026 abort: no such help topic: progress
1028 abort: no such help topic: progress
1027 (try "hg help --keyword progress")
1029 (try "hg help --keyword progress")
1028 [255]
1030 [255]
1029 $ hg help -e progress |head -1
1031 $ hg help -e progress |head -1
1030 progress extension - show progress bars for some actions (DEPRECATED)
1032 progress extension - show progress bars for some actions (DEPRECATED)
1031 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1033 $ hg help -c -k dates |egrep '^(Topics|Extensions|Commands):'
1032 Commands:
1034 Commands:
1033 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1035 $ hg help -e -k a |egrep '^(Topics|Extensions|Commands):'
1034 Extensions:
1036 Extensions:
1035 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1037 $ hg help -e -c -k date |egrep '^(Topics|Extensions|Commands):'
1036 Extensions:
1038 Extensions:
1037 Commands:
1039 Commands:
1038 $ hg help -c commit > /dev/null
1040 $ hg help -c commit > /dev/null
1039 $ hg help -e -c commit > /dev/null
1041 $ hg help -e -c commit > /dev/null
1040 $ hg help -e commit > /dev/null
1042 $ hg help -e commit > /dev/null
1041 abort: no such help topic: commit
1043 abort: no such help topic: commit
1042 (try "hg help --keyword commit")
1044 (try "hg help --keyword commit")
1043 [255]
1045 [255]
1044
1046
1045 Test keyword search help
1047 Test keyword search help
1046
1048
1047 $ cat > prefixedname.py <<EOF
1049 $ cat > prefixedname.py <<EOF
1048 > '''matched against word "clone"
1050 > '''matched against word "clone"
1049 > '''
1051 > '''
1050 > EOF
1052 > EOF
1051 $ echo '[extensions]' >> $HGRCPATH
1053 $ echo '[extensions]' >> $HGRCPATH
1052 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1054 $ echo "dot.dot.prefixedname = `pwd`/prefixedname.py" >> $HGRCPATH
1053 $ hg help -k clone
1055 $ hg help -k clone
1054 Topics:
1056 Topics:
1055
1057
1056 config Configuration Files
1058 config Configuration Files
1057 extensions Using Additional Features
1059 extensions Using Additional Features
1058 glossary Glossary
1060 glossary Glossary
1059 phases Working with Phases
1061 phases Working with Phases
1060 subrepos Subrepositories
1062 subrepos Subrepositories
1061 urls URL Paths
1063 urls URL Paths
1062
1064
1063 Commands:
1065 Commands:
1064
1066
1065 bookmarks create a new bookmark or list existing bookmarks
1067 bookmarks create a new bookmark or list existing bookmarks
1066 clone make a copy of an existing repository
1068 clone make a copy of an existing repository
1067 paths show aliases for remote repositories
1069 paths show aliases for remote repositories
1068 update update working directory (or switch revisions)
1070 update update working directory (or switch revisions)
1069
1071
1070 Extensions:
1072 Extensions:
1071
1073
1074 clonebundles server side extension to advertise pre-generated bundles to seed
1075 clones.
1072 prefixedname matched against word "clone"
1076 prefixedname matched against word "clone"
1073 relink recreates hardlinks between repository clones
1077 relink recreates hardlinks between repository clones
1074
1078
1075 Extension Commands:
1079 Extension Commands:
1076
1080
1077 qclone clone main and patch repository at same time
1081 qclone clone main and patch repository at same time
1078
1082
1079 Test unfound topic
1083 Test unfound topic
1080
1084
1081 $ hg help nonexistingtopicthatwillneverexisteverever
1085 $ hg help nonexistingtopicthatwillneverexisteverever
1082 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1086 abort: no such help topic: nonexistingtopicthatwillneverexisteverever
1083 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1087 (try "hg help --keyword nonexistingtopicthatwillneverexisteverever")
1084 [255]
1088 [255]
1085
1089
1086 Test unfound keyword
1090 Test unfound keyword
1087
1091
1088 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1092 $ hg help --keyword nonexistingwordthatwillneverexisteverever
1089 abort: no matches
1093 abort: no matches
1090 (try "hg help" for a list of topics)
1094 (try "hg help" for a list of topics)
1091 [255]
1095 [255]
1092
1096
1093 Test omit indicating for help
1097 Test omit indicating for help
1094
1098
1095 $ cat > addverboseitems.py <<EOF
1099 $ cat > addverboseitems.py <<EOF
1096 > '''extension to test omit indicating.
1100 > '''extension to test omit indicating.
1097 >
1101 >
1098 > This paragraph is never omitted (for extension)
1102 > This paragraph is never omitted (for extension)
1099 >
1103 >
1100 > .. container:: verbose
1104 > .. container:: verbose
1101 >
1105 >
1102 > This paragraph is omitted,
1106 > This paragraph is omitted,
1103 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1107 > if :hg:\`help\` is invoked without \`\`-v\`\` (for extension)
1104 >
1108 >
1105 > This paragraph is never omitted, too (for extension)
1109 > This paragraph is never omitted, too (for extension)
1106 > '''
1110 > '''
1107 >
1111 >
1108 > from mercurial import help, commands
1112 > from mercurial import help, commands
1109 > testtopic = """This paragraph is never omitted (for topic).
1113 > testtopic = """This paragraph is never omitted (for topic).
1110 >
1114 >
1111 > .. container:: verbose
1115 > .. container:: verbose
1112 >
1116 >
1113 > This paragraph is omitted,
1117 > This paragraph is omitted,
1114 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1118 > if :hg:\`help\` is invoked without \`\`-v\`\` (for topic)
1115 >
1119 >
1116 > This paragraph is never omitted, too (for topic)
1120 > This paragraph is never omitted, too (for topic)
1117 > """
1121 > """
1118 > def extsetup(ui):
1122 > def extsetup(ui):
1119 > help.helptable.append((["topic-containing-verbose"],
1123 > help.helptable.append((["topic-containing-verbose"],
1120 > "This is the topic to test omit indicating.",
1124 > "This is the topic to test omit indicating.",
1121 > lambda ui: testtopic))
1125 > lambda ui: testtopic))
1122 > EOF
1126 > EOF
1123 $ echo '[extensions]' >> $HGRCPATH
1127 $ echo '[extensions]' >> $HGRCPATH
1124 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1128 $ echo "addverboseitems = `pwd`/addverboseitems.py" >> $HGRCPATH
1125 $ hg help addverboseitems
1129 $ hg help addverboseitems
1126 addverboseitems extension - extension to test omit indicating.
1130 addverboseitems extension - extension to test omit indicating.
1127
1131
1128 This paragraph is never omitted (for extension)
1132 This paragraph is never omitted (for extension)
1129
1133
1130 This paragraph is never omitted, too (for extension)
1134 This paragraph is never omitted, too (for extension)
1131
1135
1132 (some details hidden, use --verbose to show complete help)
1136 (some details hidden, use --verbose to show complete help)
1133
1137
1134 no commands defined
1138 no commands defined
1135 $ hg help -v addverboseitems
1139 $ hg help -v addverboseitems
1136 addverboseitems extension - extension to test omit indicating.
1140 addverboseitems extension - extension to test omit indicating.
1137
1141
1138 This paragraph is never omitted (for extension)
1142 This paragraph is never omitted (for extension)
1139
1143
1140 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1144 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1141 extension)
1145 extension)
1142
1146
1143 This paragraph is never omitted, too (for extension)
1147 This paragraph is never omitted, too (for extension)
1144
1148
1145 no commands defined
1149 no commands defined
1146 $ hg help topic-containing-verbose
1150 $ hg help topic-containing-verbose
1147 This is the topic to test omit indicating.
1151 This is the topic to test omit indicating.
1148 """"""""""""""""""""""""""""""""""""""""""
1152 """"""""""""""""""""""""""""""""""""""""""
1149
1153
1150 This paragraph is never omitted (for topic).
1154 This paragraph is never omitted (for topic).
1151
1155
1152 This paragraph is never omitted, too (for topic)
1156 This paragraph is never omitted, too (for topic)
1153
1157
1154 (some details hidden, use --verbose to show complete help)
1158 (some details hidden, use --verbose to show complete help)
1155 $ hg help -v topic-containing-verbose
1159 $ hg help -v topic-containing-verbose
1156 This is the topic to test omit indicating.
1160 This is the topic to test omit indicating.
1157 """"""""""""""""""""""""""""""""""""""""""
1161 """"""""""""""""""""""""""""""""""""""""""
1158
1162
1159 This paragraph is never omitted (for topic).
1163 This paragraph is never omitted (for topic).
1160
1164
1161 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1165 This paragraph is omitted, if "hg help" is invoked without "-v" (for
1162 topic)
1166 topic)
1163
1167
1164 This paragraph is never omitted, too (for topic)
1168 This paragraph is never omitted, too (for topic)
1165
1169
1166 Test section lookup
1170 Test section lookup
1167
1171
1168 $ hg help revset.merge
1172 $ hg help revset.merge
1169 "merge()"
1173 "merge()"
1170 Changeset is a merge changeset.
1174 Changeset is a merge changeset.
1171
1175
1172 $ hg help glossary.dag
1176 $ hg help glossary.dag
1173 DAG
1177 DAG
1174 The repository of changesets of a distributed version control system
1178 The repository of changesets of a distributed version control system
1175 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1179 (DVCS) can be described as a directed acyclic graph (DAG), consisting
1176 of nodes and edges, where nodes correspond to changesets and edges
1180 of nodes and edges, where nodes correspond to changesets and edges
1177 imply a parent -> child relation. This graph can be visualized by
1181 imply a parent -> child relation. This graph can be visualized by
1178 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1182 graphical tools such as "hg log --graph". In Mercurial, the DAG is
1179 limited by the requirement for children to have at most two parents.
1183 limited by the requirement for children to have at most two parents.
1180
1184
1181
1185
1182 $ hg help hgrc.paths
1186 $ hg help hgrc.paths
1183 "paths"
1187 "paths"
1184 -------
1188 -------
1185
1189
1186 Assigns symbolic names to repositories. The left side is the symbolic
1190 Assigns symbolic names to repositories. The left side is the symbolic
1187 name, and the right gives the directory or URL that is the location of the
1191 name, and the right gives the directory or URL that is the location of the
1188 repository. Default paths can be declared by setting the following
1192 repository. Default paths can be declared by setting the following
1189 entries.
1193 entries.
1190
1194
1191 "default"
1195 "default"
1192 Directory or URL to use when pulling if no source is specified.
1196 Directory or URL to use when pulling if no source is specified.
1193 (default: repository from which the current repository was cloned)
1197 (default: repository from which the current repository was cloned)
1194
1198
1195 "default-push"
1199 "default-push"
1196 Optional. Directory or URL to use when pushing if no destination is
1200 Optional. Directory or URL to use when pushing if no destination is
1197 specified.
1201 specified.
1198
1202
1199 Custom paths can be defined by assigning the path to a name that later can
1203 Custom paths can be defined by assigning the path to a name that later can
1200 be used from the command line. Example:
1204 be used from the command line. Example:
1201
1205
1202 [paths]
1206 [paths]
1203 my_path = http://example.com/path
1207 my_path = http://example.com/path
1204
1208
1205 To push to the path defined in "my_path" run the command:
1209 To push to the path defined in "my_path" run the command:
1206
1210
1207 hg push my_path
1211 hg push my_path
1208
1212
1209 $ hg help glossary.mcguffin
1213 $ hg help glossary.mcguffin
1210 abort: help section not found
1214 abort: help section not found
1211 [255]
1215 [255]
1212
1216
1213 $ hg help glossary.mc.guffin
1217 $ hg help glossary.mc.guffin
1214 abort: help section not found
1218 abort: help section not found
1215 [255]
1219 [255]
1216
1220
1217 $ hg help template.files
1221 $ hg help template.files
1218 files List of strings. All files modified, added, or removed by
1222 files List of strings. All files modified, added, or removed by
1219 this changeset.
1223 this changeset.
1220
1224
1221 Test dynamic list of merge tools only shows up once
1225 Test dynamic list of merge tools only shows up once
1222 $ hg help merge-tools
1226 $ hg help merge-tools
1223 Merge Tools
1227 Merge Tools
1224 """""""""""
1228 """""""""""
1225
1229
1226 To merge files Mercurial uses merge tools.
1230 To merge files Mercurial uses merge tools.
1227
1231
1228 A merge tool combines two different versions of a file into a merged file.
1232 A merge tool combines two different versions of a file into a merged file.
1229 Merge tools are given the two files and the greatest common ancestor of
1233 Merge tools are given the two files and the greatest common ancestor of
1230 the two file versions, so they can determine the changes made on both
1234 the two file versions, so they can determine the changes made on both
1231 branches.
1235 branches.
1232
1236
1233 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1237 Merge tools are used both for "hg resolve", "hg merge", "hg update", "hg
1234 backout" and in several extensions.
1238 backout" and in several extensions.
1235
1239
1236 Usually, the merge tool tries to automatically reconcile the files by
1240 Usually, the merge tool tries to automatically reconcile the files by
1237 combining all non-overlapping changes that occurred separately in the two
1241 combining all non-overlapping changes that occurred separately in the two
1238 different evolutions of the same initial base file. Furthermore, some
1242 different evolutions of the same initial base file. Furthermore, some
1239 interactive merge programs make it easier to manually resolve conflicting
1243 interactive merge programs make it easier to manually resolve conflicting
1240 merges, either in a graphical way, or by inserting some conflict markers.
1244 merges, either in a graphical way, or by inserting some conflict markers.
1241 Mercurial does not include any interactive merge programs but relies on
1245 Mercurial does not include any interactive merge programs but relies on
1242 external tools for that.
1246 external tools for that.
1243
1247
1244 Available merge tools
1248 Available merge tools
1245 =====================
1249 =====================
1246
1250
1247 External merge tools and their properties are configured in the merge-
1251 External merge tools and their properties are configured in the merge-
1248 tools configuration section - see hgrc(5) - but they can often just be
1252 tools configuration section - see hgrc(5) - but they can often just be
1249 named by their executable.
1253 named by their executable.
1250
1254
1251 A merge tool is generally usable if its executable can be found on the
1255 A merge tool is generally usable if its executable can be found on the
1252 system and if it can handle the merge. The executable is found if it is an
1256 system and if it can handle the merge. The executable is found if it is an
1253 absolute or relative executable path or the name of an application in the
1257 absolute or relative executable path or the name of an application in the
1254 executable search path. The tool is assumed to be able to handle the merge
1258 executable search path. The tool is assumed to be able to handle the merge
1255 if it can handle symlinks if the file is a symlink, if it can handle
1259 if it can handle symlinks if the file is a symlink, if it can handle
1256 binary files if the file is binary, and if a GUI is available if the tool
1260 binary files if the file is binary, and if a GUI is available if the tool
1257 requires a GUI.
1261 requires a GUI.
1258
1262
1259 There are some internal merge tools which can be used. The internal merge
1263 There are some internal merge tools which can be used. The internal merge
1260 tools are:
1264 tools are:
1261
1265
1262 ":dump"
1266 ":dump"
1263 Creates three versions of the files to merge, containing the contents of
1267 Creates three versions of the files to merge, containing the contents of
1264 local, other and base. These files can then be used to perform a merge
1268 local, other and base. These files can then be used to perform a merge
1265 manually. If the file to be merged is named "a.txt", these files will
1269 manually. If the file to be merged is named "a.txt", these files will
1266 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1270 accordingly be named "a.txt.local", "a.txt.other" and "a.txt.base" and
1267 they will be placed in the same directory as "a.txt".
1271 they will be placed in the same directory as "a.txt".
1268
1272
1269 ":fail"
1273 ":fail"
1270 Rather than attempting to merge files that were modified on both
1274 Rather than attempting to merge files that were modified on both
1271 branches, it marks them as unresolved. The resolve command must be used
1275 branches, it marks them as unresolved. The resolve command must be used
1272 to resolve these conflicts.
1276 to resolve these conflicts.
1273
1277
1274 ":local"
1278 ":local"
1275 Uses the local version of files as the merged version.
1279 Uses the local version of files as the merged version.
1276
1280
1277 ":merge"
1281 ":merge"
1278 Uses the internal non-interactive simple merge algorithm for merging
1282 Uses the internal non-interactive simple merge algorithm for merging
1279 files. It will fail if there are any conflicts and leave markers in the
1283 files. It will fail if there are any conflicts and leave markers in the
1280 partially merged file. Markers will have two sections, one for each side
1284 partially merged file. Markers will have two sections, one for each side
1281 of merge.
1285 of merge.
1282
1286
1283 ":merge-local"
1287 ":merge-local"
1284 Like :merge, but resolve all conflicts non-interactively in favor of the
1288 Like :merge, but resolve all conflicts non-interactively in favor of the
1285 local changes.
1289 local changes.
1286
1290
1287 ":merge-other"
1291 ":merge-other"
1288 Like :merge, but resolve all conflicts non-interactively in favor of the
1292 Like :merge, but resolve all conflicts non-interactively in favor of the
1289 other changes.
1293 other changes.
1290
1294
1291 ":merge3"
1295 ":merge3"
1292 Uses the internal non-interactive simple merge algorithm for merging
1296 Uses the internal non-interactive simple merge algorithm for merging
1293 files. It will fail if there are any conflicts and leave markers in the
1297 files. It will fail if there are any conflicts and leave markers in the
1294 partially merged file. Marker will have three sections, one from each
1298 partially merged file. Marker will have three sections, one from each
1295 side of the merge and one for the base content.
1299 side of the merge and one for the base content.
1296
1300
1297 ":other"
1301 ":other"
1298 Uses the other version of files as the merged version.
1302 Uses the other version of files as the merged version.
1299
1303
1300 ":prompt"
1304 ":prompt"
1301 Asks the user which of the local or the other version to keep as the
1305 Asks the user which of the local or the other version to keep as the
1302 merged version.
1306 merged version.
1303
1307
1304 ":tagmerge"
1308 ":tagmerge"
1305 Uses the internal tag merge algorithm (experimental).
1309 Uses the internal tag merge algorithm (experimental).
1306
1310
1307 ":union"
1311 ":union"
1308 Uses the internal non-interactive simple merge algorithm for merging
1312 Uses the internal non-interactive simple merge algorithm for merging
1309 files. It will use both left and right sides for conflict regions. No
1313 files. It will use both left and right sides for conflict regions. No
1310 markers are inserted.
1314 markers are inserted.
1311
1315
1312 Internal tools are always available and do not require a GUI but will by
1316 Internal tools are always available and do not require a GUI but will by
1313 default not handle symlinks or binary files.
1317 default not handle symlinks or binary files.
1314
1318
1315 Choosing a merge tool
1319 Choosing a merge tool
1316 =====================
1320 =====================
1317
1321
1318 Mercurial uses these rules when deciding which merge tool to use:
1322 Mercurial uses these rules when deciding which merge tool to use:
1319
1323
1320 1. If a tool has been specified with the --tool option to merge or
1324 1. If a tool has been specified with the --tool option to merge or
1321 resolve, it is used. If it is the name of a tool in the merge-tools
1325 resolve, it is used. If it is the name of a tool in the merge-tools
1322 configuration, its configuration is used. Otherwise the specified tool
1326 configuration, its configuration is used. Otherwise the specified tool
1323 must be executable by the shell.
1327 must be executable by the shell.
1324 2. If the "HGMERGE" environment variable is present, its value is used and
1328 2. If the "HGMERGE" environment variable is present, its value is used and
1325 must be executable by the shell.
1329 must be executable by the shell.
1326 3. If the filename of the file to be merged matches any of the patterns in
1330 3. If the filename of the file to be merged matches any of the patterns in
1327 the merge-patterns configuration section, the first usable merge tool
1331 the merge-patterns configuration section, the first usable merge tool
1328 corresponding to a matching pattern is used. Here, binary capabilities
1332 corresponding to a matching pattern is used. Here, binary capabilities
1329 of the merge tool are not considered.
1333 of the merge tool are not considered.
1330 4. If ui.merge is set it will be considered next. If the value is not the
1334 4. If ui.merge is set it will be considered next. If the value is not the
1331 name of a configured tool, the specified value is used and must be
1335 name of a configured tool, the specified value is used and must be
1332 executable by the shell. Otherwise the named tool is used if it is
1336 executable by the shell. Otherwise the named tool is used if it is
1333 usable.
1337 usable.
1334 5. If any usable merge tools are present in the merge-tools configuration
1338 5. If any usable merge tools are present in the merge-tools configuration
1335 section, the one with the highest priority is used.
1339 section, the one with the highest priority is used.
1336 6. If a program named "hgmerge" can be found on the system, it is used -
1340 6. If a program named "hgmerge" can be found on the system, it is used -
1337 but it will by default not be used for symlinks and binary files.
1341 but it will by default not be used for symlinks and binary files.
1338 7. If the file to be merged is not binary and is not a symlink, then
1342 7. If the file to be merged is not binary and is not a symlink, then
1339 internal ":merge" is used.
1343 internal ":merge" is used.
1340 8. The merge of the file fails and must be resolved before commit.
1344 8. The merge of the file fails and must be resolved before commit.
1341
1345
1342 Note:
1346 Note:
1343 After selecting a merge program, Mercurial will by default attempt to
1347 After selecting a merge program, Mercurial will by default attempt to
1344 merge the files using a simple merge algorithm first. Only if it
1348 merge the files using a simple merge algorithm first. Only if it
1345 doesn't succeed because of conflicting changes Mercurial will actually
1349 doesn't succeed because of conflicting changes Mercurial will actually
1346 execute the merge program. Whether to use the simple merge algorithm
1350 execute the merge program. Whether to use the simple merge algorithm
1347 first can be controlled by the premerge setting of the merge tool.
1351 first can be controlled by the premerge setting of the merge tool.
1348 Premerge is enabled by default unless the file is binary or a symlink.
1352 Premerge is enabled by default unless the file is binary or a symlink.
1349
1353
1350 See the merge-tools and ui sections of hgrc(5) for details on the
1354 See the merge-tools and ui sections of hgrc(5) for details on the
1351 configuration of merge tools.
1355 configuration of merge tools.
1352
1356
1353 Test usage of section marks in help documents
1357 Test usage of section marks in help documents
1354
1358
1355 $ cd "$TESTDIR"/../doc
1359 $ cd "$TESTDIR"/../doc
1356 $ python check-seclevel.py
1360 $ python check-seclevel.py
1357 $ cd $TESTTMP
1361 $ cd $TESTTMP
1358
1362
1359 #if serve
1363 #if serve
1360
1364
1361 Test the help pages in hgweb.
1365 Test the help pages in hgweb.
1362
1366
1363 Dish up an empty repo; serve it cold.
1367 Dish up an empty repo; serve it cold.
1364
1368
1365 $ hg init "$TESTTMP/test"
1369 $ hg init "$TESTTMP/test"
1366 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1370 $ hg serve -R "$TESTTMP/test" -n test -p $HGPORT -d --pid-file=hg.pid
1367 $ cat hg.pid >> $DAEMON_PIDS
1371 $ cat hg.pid >> $DAEMON_PIDS
1368
1372
1369 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1373 $ get-with-headers.py 127.0.0.1:$HGPORT "help"
1370 200 Script output follows
1374 200 Script output follows
1371
1375
1372 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1376 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1373 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1377 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1374 <head>
1378 <head>
1375 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1379 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1376 <meta name="robots" content="index, nofollow" />
1380 <meta name="robots" content="index, nofollow" />
1377 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1381 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1378 <script type="text/javascript" src="/static/mercurial.js"></script>
1382 <script type="text/javascript" src="/static/mercurial.js"></script>
1379
1383
1380 <title>Help: Index</title>
1384 <title>Help: Index</title>
1381 </head>
1385 </head>
1382 <body>
1386 <body>
1383
1387
1384 <div class="container">
1388 <div class="container">
1385 <div class="menu">
1389 <div class="menu">
1386 <div class="logo">
1390 <div class="logo">
1387 <a href="https://mercurial-scm.org/">
1391 <a href="https://mercurial-scm.org/">
1388 <img src="/static/hglogo.png" alt="mercurial" /></a>
1392 <img src="/static/hglogo.png" alt="mercurial" /></a>
1389 </div>
1393 </div>
1390 <ul>
1394 <ul>
1391 <li><a href="/shortlog">log</a></li>
1395 <li><a href="/shortlog">log</a></li>
1392 <li><a href="/graph">graph</a></li>
1396 <li><a href="/graph">graph</a></li>
1393 <li><a href="/tags">tags</a></li>
1397 <li><a href="/tags">tags</a></li>
1394 <li><a href="/bookmarks">bookmarks</a></li>
1398 <li><a href="/bookmarks">bookmarks</a></li>
1395 <li><a href="/branches">branches</a></li>
1399 <li><a href="/branches">branches</a></li>
1396 </ul>
1400 </ul>
1397 <ul>
1401 <ul>
1398 <li class="active">help</li>
1402 <li class="active">help</li>
1399 </ul>
1403 </ul>
1400 </div>
1404 </div>
1401
1405
1402 <div class="main">
1406 <div class="main">
1403 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1407 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1404 <form class="search" action="/log">
1408 <form class="search" action="/log">
1405
1409
1406 <p><input name="rev" id="search1" type="text" size="30" /></p>
1410 <p><input name="rev" id="search1" type="text" size="30" /></p>
1407 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1411 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1408 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1412 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1409 </form>
1413 </form>
1410 <table class="bigtable">
1414 <table class="bigtable">
1411 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1415 <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
1412
1416
1413 <tr><td>
1417 <tr><td>
1414 <a href="/help/config">
1418 <a href="/help/config">
1415 config
1419 config
1416 </a>
1420 </a>
1417 </td><td>
1421 </td><td>
1418 Configuration Files
1422 Configuration Files
1419 </td></tr>
1423 </td></tr>
1420 <tr><td>
1424 <tr><td>
1421 <a href="/help/dates">
1425 <a href="/help/dates">
1422 dates
1426 dates
1423 </a>
1427 </a>
1424 </td><td>
1428 </td><td>
1425 Date Formats
1429 Date Formats
1426 </td></tr>
1430 </td></tr>
1427 <tr><td>
1431 <tr><td>
1428 <a href="/help/diffs">
1432 <a href="/help/diffs">
1429 diffs
1433 diffs
1430 </a>
1434 </a>
1431 </td><td>
1435 </td><td>
1432 Diff Formats
1436 Diff Formats
1433 </td></tr>
1437 </td></tr>
1434 <tr><td>
1438 <tr><td>
1435 <a href="/help/environment">
1439 <a href="/help/environment">
1436 environment
1440 environment
1437 </a>
1441 </a>
1438 </td><td>
1442 </td><td>
1439 Environment Variables
1443 Environment Variables
1440 </td></tr>
1444 </td></tr>
1441 <tr><td>
1445 <tr><td>
1442 <a href="/help/extensions">
1446 <a href="/help/extensions">
1443 extensions
1447 extensions
1444 </a>
1448 </a>
1445 </td><td>
1449 </td><td>
1446 Using Additional Features
1450 Using Additional Features
1447 </td></tr>
1451 </td></tr>
1448 <tr><td>
1452 <tr><td>
1449 <a href="/help/filesets">
1453 <a href="/help/filesets">
1450 filesets
1454 filesets
1451 </a>
1455 </a>
1452 </td><td>
1456 </td><td>
1453 Specifying File Sets
1457 Specifying File Sets
1454 </td></tr>
1458 </td></tr>
1455 <tr><td>
1459 <tr><td>
1456 <a href="/help/glossary">
1460 <a href="/help/glossary">
1457 glossary
1461 glossary
1458 </a>
1462 </a>
1459 </td><td>
1463 </td><td>
1460 Glossary
1464 Glossary
1461 </td></tr>
1465 </td></tr>
1462 <tr><td>
1466 <tr><td>
1463 <a href="/help/hgignore">
1467 <a href="/help/hgignore">
1464 hgignore
1468 hgignore
1465 </a>
1469 </a>
1466 </td><td>
1470 </td><td>
1467 Syntax for Mercurial Ignore Files
1471 Syntax for Mercurial Ignore Files
1468 </td></tr>
1472 </td></tr>
1469 <tr><td>
1473 <tr><td>
1470 <a href="/help/hgweb">
1474 <a href="/help/hgweb">
1471 hgweb
1475 hgweb
1472 </a>
1476 </a>
1473 </td><td>
1477 </td><td>
1474 Configuring hgweb
1478 Configuring hgweb
1475 </td></tr>
1479 </td></tr>
1476 <tr><td>
1480 <tr><td>
1477 <a href="/help/merge-tools">
1481 <a href="/help/merge-tools">
1478 merge-tools
1482 merge-tools
1479 </a>
1483 </a>
1480 </td><td>
1484 </td><td>
1481 Merge Tools
1485 Merge Tools
1482 </td></tr>
1486 </td></tr>
1483 <tr><td>
1487 <tr><td>
1484 <a href="/help/multirevs">
1488 <a href="/help/multirevs">
1485 multirevs
1489 multirevs
1486 </a>
1490 </a>
1487 </td><td>
1491 </td><td>
1488 Specifying Multiple Revisions
1492 Specifying Multiple Revisions
1489 </td></tr>
1493 </td></tr>
1490 <tr><td>
1494 <tr><td>
1491 <a href="/help/patterns">
1495 <a href="/help/patterns">
1492 patterns
1496 patterns
1493 </a>
1497 </a>
1494 </td><td>
1498 </td><td>
1495 File Name Patterns
1499 File Name Patterns
1496 </td></tr>
1500 </td></tr>
1497 <tr><td>
1501 <tr><td>
1498 <a href="/help/phases">
1502 <a href="/help/phases">
1499 phases
1503 phases
1500 </a>
1504 </a>
1501 </td><td>
1505 </td><td>
1502 Working with Phases
1506 Working with Phases
1503 </td></tr>
1507 </td></tr>
1504 <tr><td>
1508 <tr><td>
1505 <a href="/help/revisions">
1509 <a href="/help/revisions">
1506 revisions
1510 revisions
1507 </a>
1511 </a>
1508 </td><td>
1512 </td><td>
1509 Specifying Single Revisions
1513 Specifying Single Revisions
1510 </td></tr>
1514 </td></tr>
1511 <tr><td>
1515 <tr><td>
1512 <a href="/help/revsets">
1516 <a href="/help/revsets">
1513 revsets
1517 revsets
1514 </a>
1518 </a>
1515 </td><td>
1519 </td><td>
1516 Specifying Revision Sets
1520 Specifying Revision Sets
1517 </td></tr>
1521 </td></tr>
1518 <tr><td>
1522 <tr><td>
1519 <a href="/help/scripting">
1523 <a href="/help/scripting">
1520 scripting
1524 scripting
1521 </a>
1525 </a>
1522 </td><td>
1526 </td><td>
1523 Using Mercurial from scripts and automation
1527 Using Mercurial from scripts and automation
1524 </td></tr>
1528 </td></tr>
1525 <tr><td>
1529 <tr><td>
1526 <a href="/help/subrepos">
1530 <a href="/help/subrepos">
1527 subrepos
1531 subrepos
1528 </a>
1532 </a>
1529 </td><td>
1533 </td><td>
1530 Subrepositories
1534 Subrepositories
1531 </td></tr>
1535 </td></tr>
1532 <tr><td>
1536 <tr><td>
1533 <a href="/help/templating">
1537 <a href="/help/templating">
1534 templating
1538 templating
1535 </a>
1539 </a>
1536 </td><td>
1540 </td><td>
1537 Template Usage
1541 Template Usage
1538 </td></tr>
1542 </td></tr>
1539 <tr><td>
1543 <tr><td>
1540 <a href="/help/urls">
1544 <a href="/help/urls">
1541 urls
1545 urls
1542 </a>
1546 </a>
1543 </td><td>
1547 </td><td>
1544 URL Paths
1548 URL Paths
1545 </td></tr>
1549 </td></tr>
1546 <tr><td>
1550 <tr><td>
1547 <a href="/help/topic-containing-verbose">
1551 <a href="/help/topic-containing-verbose">
1548 topic-containing-verbose
1552 topic-containing-verbose
1549 </a>
1553 </a>
1550 </td><td>
1554 </td><td>
1551 This is the topic to test omit indicating.
1555 This is the topic to test omit indicating.
1552 </td></tr>
1556 </td></tr>
1553
1557
1554 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1558 <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
1555
1559
1556 <tr><td>
1560 <tr><td>
1557 <a href="/help/add">
1561 <a href="/help/add">
1558 add
1562 add
1559 </a>
1563 </a>
1560 </td><td>
1564 </td><td>
1561 add the specified files on the next commit
1565 add the specified files on the next commit
1562 </td></tr>
1566 </td></tr>
1563 <tr><td>
1567 <tr><td>
1564 <a href="/help/annotate">
1568 <a href="/help/annotate">
1565 annotate
1569 annotate
1566 </a>
1570 </a>
1567 </td><td>
1571 </td><td>
1568 show changeset information by line for each file
1572 show changeset information by line for each file
1569 </td></tr>
1573 </td></tr>
1570 <tr><td>
1574 <tr><td>
1571 <a href="/help/clone">
1575 <a href="/help/clone">
1572 clone
1576 clone
1573 </a>
1577 </a>
1574 </td><td>
1578 </td><td>
1575 make a copy of an existing repository
1579 make a copy of an existing repository
1576 </td></tr>
1580 </td></tr>
1577 <tr><td>
1581 <tr><td>
1578 <a href="/help/commit">
1582 <a href="/help/commit">
1579 commit
1583 commit
1580 </a>
1584 </a>
1581 </td><td>
1585 </td><td>
1582 commit the specified files or all outstanding changes
1586 commit the specified files or all outstanding changes
1583 </td></tr>
1587 </td></tr>
1584 <tr><td>
1588 <tr><td>
1585 <a href="/help/diff">
1589 <a href="/help/diff">
1586 diff
1590 diff
1587 </a>
1591 </a>
1588 </td><td>
1592 </td><td>
1589 diff repository (or selected files)
1593 diff repository (or selected files)
1590 </td></tr>
1594 </td></tr>
1591 <tr><td>
1595 <tr><td>
1592 <a href="/help/export">
1596 <a href="/help/export">
1593 export
1597 export
1594 </a>
1598 </a>
1595 </td><td>
1599 </td><td>
1596 dump the header and diffs for one or more changesets
1600 dump the header and diffs for one or more changesets
1597 </td></tr>
1601 </td></tr>
1598 <tr><td>
1602 <tr><td>
1599 <a href="/help/forget">
1603 <a href="/help/forget">
1600 forget
1604 forget
1601 </a>
1605 </a>
1602 </td><td>
1606 </td><td>
1603 forget the specified files on the next commit
1607 forget the specified files on the next commit
1604 </td></tr>
1608 </td></tr>
1605 <tr><td>
1609 <tr><td>
1606 <a href="/help/init">
1610 <a href="/help/init">
1607 init
1611 init
1608 </a>
1612 </a>
1609 </td><td>
1613 </td><td>
1610 create a new repository in the given directory
1614 create a new repository in the given directory
1611 </td></tr>
1615 </td></tr>
1612 <tr><td>
1616 <tr><td>
1613 <a href="/help/log">
1617 <a href="/help/log">
1614 log
1618 log
1615 </a>
1619 </a>
1616 </td><td>
1620 </td><td>
1617 show revision history of entire repository or files
1621 show revision history of entire repository or files
1618 </td></tr>
1622 </td></tr>
1619 <tr><td>
1623 <tr><td>
1620 <a href="/help/merge">
1624 <a href="/help/merge">
1621 merge
1625 merge
1622 </a>
1626 </a>
1623 </td><td>
1627 </td><td>
1624 merge another revision into working directory
1628 merge another revision into working directory
1625 </td></tr>
1629 </td></tr>
1626 <tr><td>
1630 <tr><td>
1627 <a href="/help/pull">
1631 <a href="/help/pull">
1628 pull
1632 pull
1629 </a>
1633 </a>
1630 </td><td>
1634 </td><td>
1631 pull changes from the specified source
1635 pull changes from the specified source
1632 </td></tr>
1636 </td></tr>
1633 <tr><td>
1637 <tr><td>
1634 <a href="/help/push">
1638 <a href="/help/push">
1635 push
1639 push
1636 </a>
1640 </a>
1637 </td><td>
1641 </td><td>
1638 push changes to the specified destination
1642 push changes to the specified destination
1639 </td></tr>
1643 </td></tr>
1640 <tr><td>
1644 <tr><td>
1641 <a href="/help/remove">
1645 <a href="/help/remove">
1642 remove
1646 remove
1643 </a>
1647 </a>
1644 </td><td>
1648 </td><td>
1645 remove the specified files on the next commit
1649 remove the specified files on the next commit
1646 </td></tr>
1650 </td></tr>
1647 <tr><td>
1651 <tr><td>
1648 <a href="/help/serve">
1652 <a href="/help/serve">
1649 serve
1653 serve
1650 </a>
1654 </a>
1651 </td><td>
1655 </td><td>
1652 start stand-alone webserver
1656 start stand-alone webserver
1653 </td></tr>
1657 </td></tr>
1654 <tr><td>
1658 <tr><td>
1655 <a href="/help/status">
1659 <a href="/help/status">
1656 status
1660 status
1657 </a>
1661 </a>
1658 </td><td>
1662 </td><td>
1659 show changed files in the working directory
1663 show changed files in the working directory
1660 </td></tr>
1664 </td></tr>
1661 <tr><td>
1665 <tr><td>
1662 <a href="/help/summary">
1666 <a href="/help/summary">
1663 summary
1667 summary
1664 </a>
1668 </a>
1665 </td><td>
1669 </td><td>
1666 summarize working directory state
1670 summarize working directory state
1667 </td></tr>
1671 </td></tr>
1668 <tr><td>
1672 <tr><td>
1669 <a href="/help/update">
1673 <a href="/help/update">
1670 update
1674 update
1671 </a>
1675 </a>
1672 </td><td>
1676 </td><td>
1673 update working directory (or switch revisions)
1677 update working directory (or switch revisions)
1674 </td></tr>
1678 </td></tr>
1675
1679
1676 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1680 <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
1677
1681
1678 <tr><td>
1682 <tr><td>
1679 <a href="/help/addremove">
1683 <a href="/help/addremove">
1680 addremove
1684 addremove
1681 </a>
1685 </a>
1682 </td><td>
1686 </td><td>
1683 add all new files, delete all missing files
1687 add all new files, delete all missing files
1684 </td></tr>
1688 </td></tr>
1685 <tr><td>
1689 <tr><td>
1686 <a href="/help/archive">
1690 <a href="/help/archive">
1687 archive
1691 archive
1688 </a>
1692 </a>
1689 </td><td>
1693 </td><td>
1690 create an unversioned archive of a repository revision
1694 create an unversioned archive of a repository revision
1691 </td></tr>
1695 </td></tr>
1692 <tr><td>
1696 <tr><td>
1693 <a href="/help/backout">
1697 <a href="/help/backout">
1694 backout
1698 backout
1695 </a>
1699 </a>
1696 </td><td>
1700 </td><td>
1697 reverse effect of earlier changeset
1701 reverse effect of earlier changeset
1698 </td></tr>
1702 </td></tr>
1699 <tr><td>
1703 <tr><td>
1700 <a href="/help/bisect">
1704 <a href="/help/bisect">
1701 bisect
1705 bisect
1702 </a>
1706 </a>
1703 </td><td>
1707 </td><td>
1704 subdivision search of changesets
1708 subdivision search of changesets
1705 </td></tr>
1709 </td></tr>
1706 <tr><td>
1710 <tr><td>
1707 <a href="/help/bookmarks">
1711 <a href="/help/bookmarks">
1708 bookmarks
1712 bookmarks
1709 </a>
1713 </a>
1710 </td><td>
1714 </td><td>
1711 create a new bookmark or list existing bookmarks
1715 create a new bookmark or list existing bookmarks
1712 </td></tr>
1716 </td></tr>
1713 <tr><td>
1717 <tr><td>
1714 <a href="/help/branch">
1718 <a href="/help/branch">
1715 branch
1719 branch
1716 </a>
1720 </a>
1717 </td><td>
1721 </td><td>
1718 set or show the current branch name
1722 set or show the current branch name
1719 </td></tr>
1723 </td></tr>
1720 <tr><td>
1724 <tr><td>
1721 <a href="/help/branches">
1725 <a href="/help/branches">
1722 branches
1726 branches
1723 </a>
1727 </a>
1724 </td><td>
1728 </td><td>
1725 list repository named branches
1729 list repository named branches
1726 </td></tr>
1730 </td></tr>
1727 <tr><td>
1731 <tr><td>
1728 <a href="/help/bundle">
1732 <a href="/help/bundle">
1729 bundle
1733 bundle
1730 </a>
1734 </a>
1731 </td><td>
1735 </td><td>
1732 create a changegroup file
1736 create a changegroup file
1733 </td></tr>
1737 </td></tr>
1734 <tr><td>
1738 <tr><td>
1735 <a href="/help/cat">
1739 <a href="/help/cat">
1736 cat
1740 cat
1737 </a>
1741 </a>
1738 </td><td>
1742 </td><td>
1739 output the current or given revision of files
1743 output the current or given revision of files
1740 </td></tr>
1744 </td></tr>
1741 <tr><td>
1745 <tr><td>
1742 <a href="/help/config">
1746 <a href="/help/config">
1743 config
1747 config
1744 </a>
1748 </a>
1745 </td><td>
1749 </td><td>
1746 show combined config settings from all hgrc files
1750 show combined config settings from all hgrc files
1747 </td></tr>
1751 </td></tr>
1748 <tr><td>
1752 <tr><td>
1749 <a href="/help/copy">
1753 <a href="/help/copy">
1750 copy
1754 copy
1751 </a>
1755 </a>
1752 </td><td>
1756 </td><td>
1753 mark files as copied for the next commit
1757 mark files as copied for the next commit
1754 </td></tr>
1758 </td></tr>
1755 <tr><td>
1759 <tr><td>
1756 <a href="/help/files">
1760 <a href="/help/files">
1757 files
1761 files
1758 </a>
1762 </a>
1759 </td><td>
1763 </td><td>
1760 list tracked files
1764 list tracked files
1761 </td></tr>
1765 </td></tr>
1762 <tr><td>
1766 <tr><td>
1763 <a href="/help/graft">
1767 <a href="/help/graft">
1764 graft
1768 graft
1765 </a>
1769 </a>
1766 </td><td>
1770 </td><td>
1767 copy changes from other branches onto the current branch
1771 copy changes from other branches onto the current branch
1768 </td></tr>
1772 </td></tr>
1769 <tr><td>
1773 <tr><td>
1770 <a href="/help/grep">
1774 <a href="/help/grep">
1771 grep
1775 grep
1772 </a>
1776 </a>
1773 </td><td>
1777 </td><td>
1774 search for a pattern in specified files and revisions
1778 search for a pattern in specified files and revisions
1775 </td></tr>
1779 </td></tr>
1776 <tr><td>
1780 <tr><td>
1777 <a href="/help/heads">
1781 <a href="/help/heads">
1778 heads
1782 heads
1779 </a>
1783 </a>
1780 </td><td>
1784 </td><td>
1781 show branch heads
1785 show branch heads
1782 </td></tr>
1786 </td></tr>
1783 <tr><td>
1787 <tr><td>
1784 <a href="/help/help">
1788 <a href="/help/help">
1785 help
1789 help
1786 </a>
1790 </a>
1787 </td><td>
1791 </td><td>
1788 show help for a given topic or a help overview
1792 show help for a given topic or a help overview
1789 </td></tr>
1793 </td></tr>
1790 <tr><td>
1794 <tr><td>
1791 <a href="/help/identify">
1795 <a href="/help/identify">
1792 identify
1796 identify
1793 </a>
1797 </a>
1794 </td><td>
1798 </td><td>
1795 identify the working directory or specified revision
1799 identify the working directory or specified revision
1796 </td></tr>
1800 </td></tr>
1797 <tr><td>
1801 <tr><td>
1798 <a href="/help/import">
1802 <a href="/help/import">
1799 import
1803 import
1800 </a>
1804 </a>
1801 </td><td>
1805 </td><td>
1802 import an ordered set of patches
1806 import an ordered set of patches
1803 </td></tr>
1807 </td></tr>
1804 <tr><td>
1808 <tr><td>
1805 <a href="/help/incoming">
1809 <a href="/help/incoming">
1806 incoming
1810 incoming
1807 </a>
1811 </a>
1808 </td><td>
1812 </td><td>
1809 show new changesets found in source
1813 show new changesets found in source
1810 </td></tr>
1814 </td></tr>
1811 <tr><td>
1815 <tr><td>
1812 <a href="/help/manifest">
1816 <a href="/help/manifest">
1813 manifest
1817 manifest
1814 </a>
1818 </a>
1815 </td><td>
1819 </td><td>
1816 output the current or given revision of the project manifest
1820 output the current or given revision of the project manifest
1817 </td></tr>
1821 </td></tr>
1818 <tr><td>
1822 <tr><td>
1819 <a href="/help/nohelp">
1823 <a href="/help/nohelp">
1820 nohelp
1824 nohelp
1821 </a>
1825 </a>
1822 </td><td>
1826 </td><td>
1823 (no help text available)
1827 (no help text available)
1824 </td></tr>
1828 </td></tr>
1825 <tr><td>
1829 <tr><td>
1826 <a href="/help/outgoing">
1830 <a href="/help/outgoing">
1827 outgoing
1831 outgoing
1828 </a>
1832 </a>
1829 </td><td>
1833 </td><td>
1830 show changesets not found in the destination
1834 show changesets not found in the destination
1831 </td></tr>
1835 </td></tr>
1832 <tr><td>
1836 <tr><td>
1833 <a href="/help/paths">
1837 <a href="/help/paths">
1834 paths
1838 paths
1835 </a>
1839 </a>
1836 </td><td>
1840 </td><td>
1837 show aliases for remote repositories
1841 show aliases for remote repositories
1838 </td></tr>
1842 </td></tr>
1839 <tr><td>
1843 <tr><td>
1840 <a href="/help/phase">
1844 <a href="/help/phase">
1841 phase
1845 phase
1842 </a>
1846 </a>
1843 </td><td>
1847 </td><td>
1844 set or show the current phase name
1848 set or show the current phase name
1845 </td></tr>
1849 </td></tr>
1846 <tr><td>
1850 <tr><td>
1847 <a href="/help/recover">
1851 <a href="/help/recover">
1848 recover
1852 recover
1849 </a>
1853 </a>
1850 </td><td>
1854 </td><td>
1851 roll back an interrupted transaction
1855 roll back an interrupted transaction
1852 </td></tr>
1856 </td></tr>
1853 <tr><td>
1857 <tr><td>
1854 <a href="/help/rename">
1858 <a href="/help/rename">
1855 rename
1859 rename
1856 </a>
1860 </a>
1857 </td><td>
1861 </td><td>
1858 rename files; equivalent of copy + remove
1862 rename files; equivalent of copy + remove
1859 </td></tr>
1863 </td></tr>
1860 <tr><td>
1864 <tr><td>
1861 <a href="/help/resolve">
1865 <a href="/help/resolve">
1862 resolve
1866 resolve
1863 </a>
1867 </a>
1864 </td><td>
1868 </td><td>
1865 redo merges or set/view the merge status of files
1869 redo merges or set/view the merge status of files
1866 </td></tr>
1870 </td></tr>
1867 <tr><td>
1871 <tr><td>
1868 <a href="/help/revert">
1872 <a href="/help/revert">
1869 revert
1873 revert
1870 </a>
1874 </a>
1871 </td><td>
1875 </td><td>
1872 restore files to their checkout state
1876 restore files to their checkout state
1873 </td></tr>
1877 </td></tr>
1874 <tr><td>
1878 <tr><td>
1875 <a href="/help/root">
1879 <a href="/help/root">
1876 root
1880 root
1877 </a>
1881 </a>
1878 </td><td>
1882 </td><td>
1879 print the root (top) of the current working directory
1883 print the root (top) of the current working directory
1880 </td></tr>
1884 </td></tr>
1881 <tr><td>
1885 <tr><td>
1882 <a href="/help/tag">
1886 <a href="/help/tag">
1883 tag
1887 tag
1884 </a>
1888 </a>
1885 </td><td>
1889 </td><td>
1886 add one or more tags for the current or given revision
1890 add one or more tags for the current or given revision
1887 </td></tr>
1891 </td></tr>
1888 <tr><td>
1892 <tr><td>
1889 <a href="/help/tags">
1893 <a href="/help/tags">
1890 tags
1894 tags
1891 </a>
1895 </a>
1892 </td><td>
1896 </td><td>
1893 list repository tags
1897 list repository tags
1894 </td></tr>
1898 </td></tr>
1895 <tr><td>
1899 <tr><td>
1896 <a href="/help/unbundle">
1900 <a href="/help/unbundle">
1897 unbundle
1901 unbundle
1898 </a>
1902 </a>
1899 </td><td>
1903 </td><td>
1900 apply one or more changegroup files
1904 apply one or more changegroup files
1901 </td></tr>
1905 </td></tr>
1902 <tr><td>
1906 <tr><td>
1903 <a href="/help/verify">
1907 <a href="/help/verify">
1904 verify
1908 verify
1905 </a>
1909 </a>
1906 </td><td>
1910 </td><td>
1907 verify the integrity of the repository
1911 verify the integrity of the repository
1908 </td></tr>
1912 </td></tr>
1909 <tr><td>
1913 <tr><td>
1910 <a href="/help/version">
1914 <a href="/help/version">
1911 version
1915 version
1912 </a>
1916 </a>
1913 </td><td>
1917 </td><td>
1914 output version and copyright information
1918 output version and copyright information
1915 </td></tr>
1919 </td></tr>
1916 </table>
1920 </table>
1917 </div>
1921 </div>
1918 </div>
1922 </div>
1919
1923
1920 <script type="text/javascript">process_dates()</script>
1924 <script type="text/javascript">process_dates()</script>
1921
1925
1922
1926
1923 </body>
1927 </body>
1924 </html>
1928 </html>
1925
1929
1926
1930
1927 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
1931 $ get-with-headers.py 127.0.0.1:$HGPORT "help/add"
1928 200 Script output follows
1932 200 Script output follows
1929
1933
1930 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1934 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
1931 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1935 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
1932 <head>
1936 <head>
1933 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1937 <link rel="icon" href="/static/hgicon.png" type="image/png" />
1934 <meta name="robots" content="index, nofollow" />
1938 <meta name="robots" content="index, nofollow" />
1935 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1939 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
1936 <script type="text/javascript" src="/static/mercurial.js"></script>
1940 <script type="text/javascript" src="/static/mercurial.js"></script>
1937
1941
1938 <title>Help: add</title>
1942 <title>Help: add</title>
1939 </head>
1943 </head>
1940 <body>
1944 <body>
1941
1945
1942 <div class="container">
1946 <div class="container">
1943 <div class="menu">
1947 <div class="menu">
1944 <div class="logo">
1948 <div class="logo">
1945 <a href="https://mercurial-scm.org/">
1949 <a href="https://mercurial-scm.org/">
1946 <img src="/static/hglogo.png" alt="mercurial" /></a>
1950 <img src="/static/hglogo.png" alt="mercurial" /></a>
1947 </div>
1951 </div>
1948 <ul>
1952 <ul>
1949 <li><a href="/shortlog">log</a></li>
1953 <li><a href="/shortlog">log</a></li>
1950 <li><a href="/graph">graph</a></li>
1954 <li><a href="/graph">graph</a></li>
1951 <li><a href="/tags">tags</a></li>
1955 <li><a href="/tags">tags</a></li>
1952 <li><a href="/bookmarks">bookmarks</a></li>
1956 <li><a href="/bookmarks">bookmarks</a></li>
1953 <li><a href="/branches">branches</a></li>
1957 <li><a href="/branches">branches</a></li>
1954 </ul>
1958 </ul>
1955 <ul>
1959 <ul>
1956 <li class="active"><a href="/help">help</a></li>
1960 <li class="active"><a href="/help">help</a></li>
1957 </ul>
1961 </ul>
1958 </div>
1962 </div>
1959
1963
1960 <div class="main">
1964 <div class="main">
1961 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1965 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
1962 <h3>Help: add</h3>
1966 <h3>Help: add</h3>
1963
1967
1964 <form class="search" action="/log">
1968 <form class="search" action="/log">
1965
1969
1966 <p><input name="rev" id="search1" type="text" size="30" /></p>
1970 <p><input name="rev" id="search1" type="text" size="30" /></p>
1967 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1971 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
1968 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1972 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
1969 </form>
1973 </form>
1970 <div id="doc">
1974 <div id="doc">
1971 <p>
1975 <p>
1972 hg add [OPTION]... [FILE]...
1976 hg add [OPTION]... [FILE]...
1973 </p>
1977 </p>
1974 <p>
1978 <p>
1975 add the specified files on the next commit
1979 add the specified files on the next commit
1976 </p>
1980 </p>
1977 <p>
1981 <p>
1978 Schedule files to be version controlled and added to the
1982 Schedule files to be version controlled and added to the
1979 repository.
1983 repository.
1980 </p>
1984 </p>
1981 <p>
1985 <p>
1982 The files will be added to the repository at the next commit. To
1986 The files will be added to the repository at the next commit. To
1983 undo an add before that, see &quot;hg forget&quot;.
1987 undo an add before that, see &quot;hg forget&quot;.
1984 </p>
1988 </p>
1985 <p>
1989 <p>
1986 If no names are given, add all files to the repository.
1990 If no names are given, add all files to the repository.
1987 </p>
1991 </p>
1988 <p>
1992 <p>
1989 An example showing how new (unknown) files are added
1993 An example showing how new (unknown) files are added
1990 automatically by &quot;hg add&quot;:
1994 automatically by &quot;hg add&quot;:
1991 </p>
1995 </p>
1992 <pre>
1996 <pre>
1993 \$ ls (re)
1997 \$ ls (re)
1994 foo.c
1998 foo.c
1995 \$ hg status (re)
1999 \$ hg status (re)
1996 ? foo.c
2000 ? foo.c
1997 \$ hg add (re)
2001 \$ hg add (re)
1998 adding foo.c
2002 adding foo.c
1999 \$ hg status (re)
2003 \$ hg status (re)
2000 A foo.c
2004 A foo.c
2001 </pre>
2005 </pre>
2002 <p>
2006 <p>
2003 Returns 0 if all files are successfully added.
2007 Returns 0 if all files are successfully added.
2004 </p>
2008 </p>
2005 <p>
2009 <p>
2006 options ([+] can be repeated):
2010 options ([+] can be repeated):
2007 </p>
2011 </p>
2008 <table>
2012 <table>
2009 <tr><td>-I</td>
2013 <tr><td>-I</td>
2010 <td>--include PATTERN [+]</td>
2014 <td>--include PATTERN [+]</td>
2011 <td>include names matching the given patterns</td></tr>
2015 <td>include names matching the given patterns</td></tr>
2012 <tr><td>-X</td>
2016 <tr><td>-X</td>
2013 <td>--exclude PATTERN [+]</td>
2017 <td>--exclude PATTERN [+]</td>
2014 <td>exclude names matching the given patterns</td></tr>
2018 <td>exclude names matching the given patterns</td></tr>
2015 <tr><td>-S</td>
2019 <tr><td>-S</td>
2016 <td>--subrepos</td>
2020 <td>--subrepos</td>
2017 <td>recurse into subrepositories</td></tr>
2021 <td>recurse into subrepositories</td></tr>
2018 <tr><td>-n</td>
2022 <tr><td>-n</td>
2019 <td>--dry-run</td>
2023 <td>--dry-run</td>
2020 <td>do not perform actions, just print output</td></tr>
2024 <td>do not perform actions, just print output</td></tr>
2021 </table>
2025 </table>
2022 <p>
2026 <p>
2023 global options ([+] can be repeated):
2027 global options ([+] can be repeated):
2024 </p>
2028 </p>
2025 <table>
2029 <table>
2026 <tr><td>-R</td>
2030 <tr><td>-R</td>
2027 <td>--repository REPO</td>
2031 <td>--repository REPO</td>
2028 <td>repository root directory or name of overlay bundle file</td></tr>
2032 <td>repository root directory or name of overlay bundle file</td></tr>
2029 <tr><td></td>
2033 <tr><td></td>
2030 <td>--cwd DIR</td>
2034 <td>--cwd DIR</td>
2031 <td>change working directory</td></tr>
2035 <td>change working directory</td></tr>
2032 <tr><td>-y</td>
2036 <tr><td>-y</td>
2033 <td>--noninteractive</td>
2037 <td>--noninteractive</td>
2034 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2038 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2035 <tr><td>-q</td>
2039 <tr><td>-q</td>
2036 <td>--quiet</td>
2040 <td>--quiet</td>
2037 <td>suppress output</td></tr>
2041 <td>suppress output</td></tr>
2038 <tr><td>-v</td>
2042 <tr><td>-v</td>
2039 <td>--verbose</td>
2043 <td>--verbose</td>
2040 <td>enable additional output</td></tr>
2044 <td>enable additional output</td></tr>
2041 <tr><td></td>
2045 <tr><td></td>
2042 <td>--config CONFIG [+]</td>
2046 <td>--config CONFIG [+]</td>
2043 <td>set/override config option (use 'section.name=value')</td></tr>
2047 <td>set/override config option (use 'section.name=value')</td></tr>
2044 <tr><td></td>
2048 <tr><td></td>
2045 <td>--debug</td>
2049 <td>--debug</td>
2046 <td>enable debugging output</td></tr>
2050 <td>enable debugging output</td></tr>
2047 <tr><td></td>
2051 <tr><td></td>
2048 <td>--debugger</td>
2052 <td>--debugger</td>
2049 <td>start debugger</td></tr>
2053 <td>start debugger</td></tr>
2050 <tr><td></td>
2054 <tr><td></td>
2051 <td>--encoding ENCODE</td>
2055 <td>--encoding ENCODE</td>
2052 <td>set the charset encoding (default: ascii)</td></tr>
2056 <td>set the charset encoding (default: ascii)</td></tr>
2053 <tr><td></td>
2057 <tr><td></td>
2054 <td>--encodingmode MODE</td>
2058 <td>--encodingmode MODE</td>
2055 <td>set the charset encoding mode (default: strict)</td></tr>
2059 <td>set the charset encoding mode (default: strict)</td></tr>
2056 <tr><td></td>
2060 <tr><td></td>
2057 <td>--traceback</td>
2061 <td>--traceback</td>
2058 <td>always print a traceback on exception</td></tr>
2062 <td>always print a traceback on exception</td></tr>
2059 <tr><td></td>
2063 <tr><td></td>
2060 <td>--time</td>
2064 <td>--time</td>
2061 <td>time how long the command takes</td></tr>
2065 <td>time how long the command takes</td></tr>
2062 <tr><td></td>
2066 <tr><td></td>
2063 <td>--profile</td>
2067 <td>--profile</td>
2064 <td>print command execution profile</td></tr>
2068 <td>print command execution profile</td></tr>
2065 <tr><td></td>
2069 <tr><td></td>
2066 <td>--version</td>
2070 <td>--version</td>
2067 <td>output version information and exit</td></tr>
2071 <td>output version information and exit</td></tr>
2068 <tr><td>-h</td>
2072 <tr><td>-h</td>
2069 <td>--help</td>
2073 <td>--help</td>
2070 <td>display help and exit</td></tr>
2074 <td>display help and exit</td></tr>
2071 <tr><td></td>
2075 <tr><td></td>
2072 <td>--hidden</td>
2076 <td>--hidden</td>
2073 <td>consider hidden changesets</td></tr>
2077 <td>consider hidden changesets</td></tr>
2074 </table>
2078 </table>
2075
2079
2076 </div>
2080 </div>
2077 </div>
2081 </div>
2078 </div>
2082 </div>
2079
2083
2080 <script type="text/javascript">process_dates()</script>
2084 <script type="text/javascript">process_dates()</script>
2081
2085
2082
2086
2083 </body>
2087 </body>
2084 </html>
2088 </html>
2085
2089
2086
2090
2087 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2091 $ get-with-headers.py 127.0.0.1:$HGPORT "help/remove"
2088 200 Script output follows
2092 200 Script output follows
2089
2093
2090 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2094 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2091 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2095 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2092 <head>
2096 <head>
2093 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2097 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2094 <meta name="robots" content="index, nofollow" />
2098 <meta name="robots" content="index, nofollow" />
2095 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2099 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2096 <script type="text/javascript" src="/static/mercurial.js"></script>
2100 <script type="text/javascript" src="/static/mercurial.js"></script>
2097
2101
2098 <title>Help: remove</title>
2102 <title>Help: remove</title>
2099 </head>
2103 </head>
2100 <body>
2104 <body>
2101
2105
2102 <div class="container">
2106 <div class="container">
2103 <div class="menu">
2107 <div class="menu">
2104 <div class="logo">
2108 <div class="logo">
2105 <a href="https://mercurial-scm.org/">
2109 <a href="https://mercurial-scm.org/">
2106 <img src="/static/hglogo.png" alt="mercurial" /></a>
2110 <img src="/static/hglogo.png" alt="mercurial" /></a>
2107 </div>
2111 </div>
2108 <ul>
2112 <ul>
2109 <li><a href="/shortlog">log</a></li>
2113 <li><a href="/shortlog">log</a></li>
2110 <li><a href="/graph">graph</a></li>
2114 <li><a href="/graph">graph</a></li>
2111 <li><a href="/tags">tags</a></li>
2115 <li><a href="/tags">tags</a></li>
2112 <li><a href="/bookmarks">bookmarks</a></li>
2116 <li><a href="/bookmarks">bookmarks</a></li>
2113 <li><a href="/branches">branches</a></li>
2117 <li><a href="/branches">branches</a></li>
2114 </ul>
2118 </ul>
2115 <ul>
2119 <ul>
2116 <li class="active"><a href="/help">help</a></li>
2120 <li class="active"><a href="/help">help</a></li>
2117 </ul>
2121 </ul>
2118 </div>
2122 </div>
2119
2123
2120 <div class="main">
2124 <div class="main">
2121 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2125 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2122 <h3>Help: remove</h3>
2126 <h3>Help: remove</h3>
2123
2127
2124 <form class="search" action="/log">
2128 <form class="search" action="/log">
2125
2129
2126 <p><input name="rev" id="search1" type="text" size="30" /></p>
2130 <p><input name="rev" id="search1" type="text" size="30" /></p>
2127 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2131 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2128 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2132 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2129 </form>
2133 </form>
2130 <div id="doc">
2134 <div id="doc">
2131 <p>
2135 <p>
2132 hg remove [OPTION]... FILE...
2136 hg remove [OPTION]... FILE...
2133 </p>
2137 </p>
2134 <p>
2138 <p>
2135 aliases: rm
2139 aliases: rm
2136 </p>
2140 </p>
2137 <p>
2141 <p>
2138 remove the specified files on the next commit
2142 remove the specified files on the next commit
2139 </p>
2143 </p>
2140 <p>
2144 <p>
2141 Schedule the indicated files for removal from the current branch.
2145 Schedule the indicated files for removal from the current branch.
2142 </p>
2146 </p>
2143 <p>
2147 <p>
2144 This command schedules the files to be removed at the next commit.
2148 This command schedules the files to be removed at the next commit.
2145 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2149 To undo a remove before that, see &quot;hg revert&quot;. To undo added
2146 files, see &quot;hg forget&quot;.
2150 files, see &quot;hg forget&quot;.
2147 </p>
2151 </p>
2148 <p>
2152 <p>
2149 -A/--after can be used to remove only files that have already
2153 -A/--after can be used to remove only files that have already
2150 been deleted, -f/--force can be used to force deletion, and -Af
2154 been deleted, -f/--force can be used to force deletion, and -Af
2151 can be used to remove files from the next revision without
2155 can be used to remove files from the next revision without
2152 deleting them from the working directory.
2156 deleting them from the working directory.
2153 </p>
2157 </p>
2154 <p>
2158 <p>
2155 The following table details the behavior of remove for different
2159 The following table details the behavior of remove for different
2156 file states (columns) and option combinations (rows). The file
2160 file states (columns) and option combinations (rows). The file
2157 states are Added [A], Clean [C], Modified [M] and Missing [!]
2161 states are Added [A], Clean [C], Modified [M] and Missing [!]
2158 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2162 (as reported by &quot;hg status&quot;). The actions are Warn, Remove
2159 (from branch) and Delete (from disk):
2163 (from branch) and Delete (from disk):
2160 </p>
2164 </p>
2161 <table>
2165 <table>
2162 <tr><td>opt/state</td>
2166 <tr><td>opt/state</td>
2163 <td>A</td>
2167 <td>A</td>
2164 <td>C</td>
2168 <td>C</td>
2165 <td>M</td>
2169 <td>M</td>
2166 <td>!</td></tr>
2170 <td>!</td></tr>
2167 <tr><td>none</td>
2171 <tr><td>none</td>
2168 <td>W</td>
2172 <td>W</td>
2169 <td>RD</td>
2173 <td>RD</td>
2170 <td>W</td>
2174 <td>W</td>
2171 <td>R</td></tr>
2175 <td>R</td></tr>
2172 <tr><td>-f</td>
2176 <tr><td>-f</td>
2173 <td>R</td>
2177 <td>R</td>
2174 <td>RD</td>
2178 <td>RD</td>
2175 <td>RD</td>
2179 <td>RD</td>
2176 <td>R</td></tr>
2180 <td>R</td></tr>
2177 <tr><td>-A</td>
2181 <tr><td>-A</td>
2178 <td>W</td>
2182 <td>W</td>
2179 <td>W</td>
2183 <td>W</td>
2180 <td>W</td>
2184 <td>W</td>
2181 <td>R</td></tr>
2185 <td>R</td></tr>
2182 <tr><td>-Af</td>
2186 <tr><td>-Af</td>
2183 <td>R</td>
2187 <td>R</td>
2184 <td>R</td>
2188 <td>R</td>
2185 <td>R</td>
2189 <td>R</td>
2186 <td>R</td></tr>
2190 <td>R</td></tr>
2187 </table>
2191 </table>
2188 <p>
2192 <p>
2189 Note that remove never deletes files in Added [A] state from the
2193 Note that remove never deletes files in Added [A] state from the
2190 working directory, not even if option --force is specified.
2194 working directory, not even if option --force is specified.
2191 </p>
2195 </p>
2192 <p>
2196 <p>
2193 Returns 0 on success, 1 if any warnings encountered.
2197 Returns 0 on success, 1 if any warnings encountered.
2194 </p>
2198 </p>
2195 <p>
2199 <p>
2196 options ([+] can be repeated):
2200 options ([+] can be repeated):
2197 </p>
2201 </p>
2198 <table>
2202 <table>
2199 <tr><td>-A</td>
2203 <tr><td>-A</td>
2200 <td>--after</td>
2204 <td>--after</td>
2201 <td>record delete for missing files</td></tr>
2205 <td>record delete for missing files</td></tr>
2202 <tr><td>-f</td>
2206 <tr><td>-f</td>
2203 <td>--force</td>
2207 <td>--force</td>
2204 <td>remove (and delete) file even if added or modified</td></tr>
2208 <td>remove (and delete) file even if added or modified</td></tr>
2205 <tr><td>-S</td>
2209 <tr><td>-S</td>
2206 <td>--subrepos</td>
2210 <td>--subrepos</td>
2207 <td>recurse into subrepositories</td></tr>
2211 <td>recurse into subrepositories</td></tr>
2208 <tr><td>-I</td>
2212 <tr><td>-I</td>
2209 <td>--include PATTERN [+]</td>
2213 <td>--include PATTERN [+]</td>
2210 <td>include names matching the given patterns</td></tr>
2214 <td>include names matching the given patterns</td></tr>
2211 <tr><td>-X</td>
2215 <tr><td>-X</td>
2212 <td>--exclude PATTERN [+]</td>
2216 <td>--exclude PATTERN [+]</td>
2213 <td>exclude names matching the given patterns</td></tr>
2217 <td>exclude names matching the given patterns</td></tr>
2214 </table>
2218 </table>
2215 <p>
2219 <p>
2216 global options ([+] can be repeated):
2220 global options ([+] can be repeated):
2217 </p>
2221 </p>
2218 <table>
2222 <table>
2219 <tr><td>-R</td>
2223 <tr><td>-R</td>
2220 <td>--repository REPO</td>
2224 <td>--repository REPO</td>
2221 <td>repository root directory or name of overlay bundle file</td></tr>
2225 <td>repository root directory or name of overlay bundle file</td></tr>
2222 <tr><td></td>
2226 <tr><td></td>
2223 <td>--cwd DIR</td>
2227 <td>--cwd DIR</td>
2224 <td>change working directory</td></tr>
2228 <td>change working directory</td></tr>
2225 <tr><td>-y</td>
2229 <tr><td>-y</td>
2226 <td>--noninteractive</td>
2230 <td>--noninteractive</td>
2227 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2231 <td>do not prompt, automatically pick the first choice for all prompts</td></tr>
2228 <tr><td>-q</td>
2232 <tr><td>-q</td>
2229 <td>--quiet</td>
2233 <td>--quiet</td>
2230 <td>suppress output</td></tr>
2234 <td>suppress output</td></tr>
2231 <tr><td>-v</td>
2235 <tr><td>-v</td>
2232 <td>--verbose</td>
2236 <td>--verbose</td>
2233 <td>enable additional output</td></tr>
2237 <td>enable additional output</td></tr>
2234 <tr><td></td>
2238 <tr><td></td>
2235 <td>--config CONFIG [+]</td>
2239 <td>--config CONFIG [+]</td>
2236 <td>set/override config option (use 'section.name=value')</td></tr>
2240 <td>set/override config option (use 'section.name=value')</td></tr>
2237 <tr><td></td>
2241 <tr><td></td>
2238 <td>--debug</td>
2242 <td>--debug</td>
2239 <td>enable debugging output</td></tr>
2243 <td>enable debugging output</td></tr>
2240 <tr><td></td>
2244 <tr><td></td>
2241 <td>--debugger</td>
2245 <td>--debugger</td>
2242 <td>start debugger</td></tr>
2246 <td>start debugger</td></tr>
2243 <tr><td></td>
2247 <tr><td></td>
2244 <td>--encoding ENCODE</td>
2248 <td>--encoding ENCODE</td>
2245 <td>set the charset encoding (default: ascii)</td></tr>
2249 <td>set the charset encoding (default: ascii)</td></tr>
2246 <tr><td></td>
2250 <tr><td></td>
2247 <td>--encodingmode MODE</td>
2251 <td>--encodingmode MODE</td>
2248 <td>set the charset encoding mode (default: strict)</td></tr>
2252 <td>set the charset encoding mode (default: strict)</td></tr>
2249 <tr><td></td>
2253 <tr><td></td>
2250 <td>--traceback</td>
2254 <td>--traceback</td>
2251 <td>always print a traceback on exception</td></tr>
2255 <td>always print a traceback on exception</td></tr>
2252 <tr><td></td>
2256 <tr><td></td>
2253 <td>--time</td>
2257 <td>--time</td>
2254 <td>time how long the command takes</td></tr>
2258 <td>time how long the command takes</td></tr>
2255 <tr><td></td>
2259 <tr><td></td>
2256 <td>--profile</td>
2260 <td>--profile</td>
2257 <td>print command execution profile</td></tr>
2261 <td>print command execution profile</td></tr>
2258 <tr><td></td>
2262 <tr><td></td>
2259 <td>--version</td>
2263 <td>--version</td>
2260 <td>output version information and exit</td></tr>
2264 <td>output version information and exit</td></tr>
2261 <tr><td>-h</td>
2265 <tr><td>-h</td>
2262 <td>--help</td>
2266 <td>--help</td>
2263 <td>display help and exit</td></tr>
2267 <td>display help and exit</td></tr>
2264 <tr><td></td>
2268 <tr><td></td>
2265 <td>--hidden</td>
2269 <td>--hidden</td>
2266 <td>consider hidden changesets</td></tr>
2270 <td>consider hidden changesets</td></tr>
2267 </table>
2271 </table>
2268
2272
2269 </div>
2273 </div>
2270 </div>
2274 </div>
2271 </div>
2275 </div>
2272
2276
2273 <script type="text/javascript">process_dates()</script>
2277 <script type="text/javascript">process_dates()</script>
2274
2278
2275
2279
2276 </body>
2280 </body>
2277 </html>
2281 </html>
2278
2282
2279
2283
2280 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2284 $ get-with-headers.py 127.0.0.1:$HGPORT "help/revisions"
2281 200 Script output follows
2285 200 Script output follows
2282
2286
2283 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2287 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
2284 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2288 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
2285 <head>
2289 <head>
2286 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2290 <link rel="icon" href="/static/hgicon.png" type="image/png" />
2287 <meta name="robots" content="index, nofollow" />
2291 <meta name="robots" content="index, nofollow" />
2288 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2292 <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
2289 <script type="text/javascript" src="/static/mercurial.js"></script>
2293 <script type="text/javascript" src="/static/mercurial.js"></script>
2290
2294
2291 <title>Help: revisions</title>
2295 <title>Help: revisions</title>
2292 </head>
2296 </head>
2293 <body>
2297 <body>
2294
2298
2295 <div class="container">
2299 <div class="container">
2296 <div class="menu">
2300 <div class="menu">
2297 <div class="logo">
2301 <div class="logo">
2298 <a href="https://mercurial-scm.org/">
2302 <a href="https://mercurial-scm.org/">
2299 <img src="/static/hglogo.png" alt="mercurial" /></a>
2303 <img src="/static/hglogo.png" alt="mercurial" /></a>
2300 </div>
2304 </div>
2301 <ul>
2305 <ul>
2302 <li><a href="/shortlog">log</a></li>
2306 <li><a href="/shortlog">log</a></li>
2303 <li><a href="/graph">graph</a></li>
2307 <li><a href="/graph">graph</a></li>
2304 <li><a href="/tags">tags</a></li>
2308 <li><a href="/tags">tags</a></li>
2305 <li><a href="/bookmarks">bookmarks</a></li>
2309 <li><a href="/bookmarks">bookmarks</a></li>
2306 <li><a href="/branches">branches</a></li>
2310 <li><a href="/branches">branches</a></li>
2307 </ul>
2311 </ul>
2308 <ul>
2312 <ul>
2309 <li class="active"><a href="/help">help</a></li>
2313 <li class="active"><a href="/help">help</a></li>
2310 </ul>
2314 </ul>
2311 </div>
2315 </div>
2312
2316
2313 <div class="main">
2317 <div class="main">
2314 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2318 <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
2315 <h3>Help: revisions</h3>
2319 <h3>Help: revisions</h3>
2316
2320
2317 <form class="search" action="/log">
2321 <form class="search" action="/log">
2318
2322
2319 <p><input name="rev" id="search1" type="text" size="30" /></p>
2323 <p><input name="rev" id="search1" type="text" size="30" /></p>
2320 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2324 <div id="hint">Find changesets by keywords (author, files, the commit message), revision
2321 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2325 number or hash, or <a href="/help/revsets">revset expression</a>.</div>
2322 </form>
2326 </form>
2323 <div id="doc">
2327 <div id="doc">
2324 <h1>Specifying Single Revisions</h1>
2328 <h1>Specifying Single Revisions</h1>
2325 <p>
2329 <p>
2326 Mercurial supports several ways to specify individual revisions.
2330 Mercurial supports several ways to specify individual revisions.
2327 </p>
2331 </p>
2328 <p>
2332 <p>
2329 A plain integer is treated as a revision number. Negative integers are
2333 A plain integer is treated as a revision number. Negative integers are
2330 treated as sequential offsets from the tip, with -1 denoting the tip,
2334 treated as sequential offsets from the tip, with -1 denoting the tip,
2331 -2 denoting the revision prior to the tip, and so forth.
2335 -2 denoting the revision prior to the tip, and so forth.
2332 </p>
2336 </p>
2333 <p>
2337 <p>
2334 A 40-digit hexadecimal string is treated as a unique revision
2338 A 40-digit hexadecimal string is treated as a unique revision
2335 identifier.
2339 identifier.
2336 </p>
2340 </p>
2337 <p>
2341 <p>
2338 A hexadecimal string less than 40 characters long is treated as a
2342 A hexadecimal string less than 40 characters long is treated as a
2339 unique revision identifier and is referred to as a short-form
2343 unique revision identifier and is referred to as a short-form
2340 identifier. A short-form identifier is only valid if it is the prefix
2344 identifier. A short-form identifier is only valid if it is the prefix
2341 of exactly one full-length identifier.
2345 of exactly one full-length identifier.
2342 </p>
2346 </p>
2343 <p>
2347 <p>
2344 Any other string is treated as a bookmark, tag, or branch name. A
2348 Any other string is treated as a bookmark, tag, or branch name. A
2345 bookmark is a movable pointer to a revision. A tag is a permanent name
2349 bookmark is a movable pointer to a revision. A tag is a permanent name
2346 associated with a revision. A branch name denotes the tipmost open branch head
2350 associated with a revision. A branch name denotes the tipmost open branch head
2347 of that branch - or if they are all closed, the tipmost closed head of the
2351 of that branch - or if they are all closed, the tipmost closed head of the
2348 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2352 branch. Bookmark, tag, and branch names must not contain the &quot;:&quot; character.
2349 </p>
2353 </p>
2350 <p>
2354 <p>
2351 The reserved name &quot;tip&quot; always identifies the most recent revision.
2355 The reserved name &quot;tip&quot; always identifies the most recent revision.
2352 </p>
2356 </p>
2353 <p>
2357 <p>
2354 The reserved name &quot;null&quot; indicates the null revision. This is the
2358 The reserved name &quot;null&quot; indicates the null revision. This is the
2355 revision of an empty repository, and the parent of revision 0.
2359 revision of an empty repository, and the parent of revision 0.
2356 </p>
2360 </p>
2357 <p>
2361 <p>
2358 The reserved name &quot;.&quot; indicates the working directory parent. If no
2362 The reserved name &quot;.&quot; indicates the working directory parent. If no
2359 working directory is checked out, it is equivalent to null. If an
2363 working directory is checked out, it is equivalent to null. If an
2360 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2364 uncommitted merge is in progress, &quot;.&quot; is the revision of the first
2361 parent.
2365 parent.
2362 </p>
2366 </p>
2363
2367
2364 </div>
2368 </div>
2365 </div>
2369 </div>
2366 </div>
2370 </div>
2367
2371
2368 <script type="text/javascript">process_dates()</script>
2372 <script type="text/javascript">process_dates()</script>
2369
2373
2370
2374
2371 </body>
2375 </body>
2372 </html>
2376 </html>
2373
2377
2374
2378
2375 $ killdaemons.py
2379 $ killdaemons.py
2376
2380
2377 #endif
2381 #endif
General Comments 0
You need to be logged in to leave comments. Login now