##// END OF EJS Templates
transplant: change "editform" to distinguish merge commits from others...
FUJIWARA Katsunori -
r22252:de783f24 default
parent child Browse files
Show More
@@ -1,689 +1,692
1 # Patch transplanting extension for Mercurial
1 # Patch transplanting extension for Mercurial
2 #
2 #
3 # Copyright 2006, 2007 Brendan Cully <brendan@kublai.com>
3 # Copyright 2006, 2007 Brendan Cully <brendan@kublai.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 '''command to transplant changesets from another branch
8 '''command to transplant changesets from another branch
9
9
10 This extension allows you to transplant changes to another parent revision,
10 This extension allows you to transplant changes to another parent revision,
11 possibly in another repository. The transplant is done using 'diff' patches.
11 possibly in another repository. The transplant is done using 'diff' patches.
12
12
13 Transplanted patches are recorded in .hg/transplant/transplants, as a
13 Transplanted patches are recorded in .hg/transplant/transplants, as a
14 map from a changeset hash to its hash in the source repository.
14 map from a changeset hash to its hash in the source repository.
15 '''
15 '''
16
16
17 from mercurial.i18n import _
17 from mercurial.i18n import _
18 import os, tempfile
18 import os, tempfile
19 from mercurial.node import short
19 from mercurial.node import short
20 from mercurial import bundlerepo, hg, merge, match
20 from mercurial import bundlerepo, hg, merge, match
21 from mercurial import patch, revlog, scmutil, util, error, cmdutil
21 from mercurial import patch, revlog, scmutil, util, error, cmdutil
22 from mercurial import revset, templatekw
22 from mercurial import revset, templatekw
23
23
24 class TransplantError(error.Abort):
24 class TransplantError(error.Abort):
25 pass
25 pass
26
26
27 cmdtable = {}
27 cmdtable = {}
28 command = cmdutil.command(cmdtable)
28 command = cmdutil.command(cmdtable)
29 testedwith = 'internal'
29 testedwith = 'internal'
30
30
31 class transplantentry(object):
31 class transplantentry(object):
32 def __init__(self, lnode, rnode):
32 def __init__(self, lnode, rnode):
33 self.lnode = lnode
33 self.lnode = lnode
34 self.rnode = rnode
34 self.rnode = rnode
35
35
36 class transplants(object):
36 class transplants(object):
37 def __init__(self, path=None, transplantfile=None, opener=None):
37 def __init__(self, path=None, transplantfile=None, opener=None):
38 self.path = path
38 self.path = path
39 self.transplantfile = transplantfile
39 self.transplantfile = transplantfile
40 self.opener = opener
40 self.opener = opener
41
41
42 if not opener:
42 if not opener:
43 self.opener = scmutil.opener(self.path)
43 self.opener = scmutil.opener(self.path)
44 self.transplants = {}
44 self.transplants = {}
45 self.dirty = False
45 self.dirty = False
46 self.read()
46 self.read()
47
47
48 def read(self):
48 def read(self):
49 abspath = os.path.join(self.path, self.transplantfile)
49 abspath = os.path.join(self.path, self.transplantfile)
50 if self.transplantfile and os.path.exists(abspath):
50 if self.transplantfile and os.path.exists(abspath):
51 for line in self.opener.read(self.transplantfile).splitlines():
51 for line in self.opener.read(self.transplantfile).splitlines():
52 lnode, rnode = map(revlog.bin, line.split(':'))
52 lnode, rnode = map(revlog.bin, line.split(':'))
53 list = self.transplants.setdefault(rnode, [])
53 list = self.transplants.setdefault(rnode, [])
54 list.append(transplantentry(lnode, rnode))
54 list.append(transplantentry(lnode, rnode))
55
55
56 def write(self):
56 def write(self):
57 if self.dirty and self.transplantfile:
57 if self.dirty and self.transplantfile:
58 if not os.path.isdir(self.path):
58 if not os.path.isdir(self.path):
59 os.mkdir(self.path)
59 os.mkdir(self.path)
60 fp = self.opener(self.transplantfile, 'w')
60 fp = self.opener(self.transplantfile, 'w')
61 for list in self.transplants.itervalues():
61 for list in self.transplants.itervalues():
62 for t in list:
62 for t in list:
63 l, r = map(revlog.hex, (t.lnode, t.rnode))
63 l, r = map(revlog.hex, (t.lnode, t.rnode))
64 fp.write(l + ':' + r + '\n')
64 fp.write(l + ':' + r + '\n')
65 fp.close()
65 fp.close()
66 self.dirty = False
66 self.dirty = False
67
67
68 def get(self, rnode):
68 def get(self, rnode):
69 return self.transplants.get(rnode) or []
69 return self.transplants.get(rnode) or []
70
70
71 def set(self, lnode, rnode):
71 def set(self, lnode, rnode):
72 list = self.transplants.setdefault(rnode, [])
72 list = self.transplants.setdefault(rnode, [])
73 list.append(transplantentry(lnode, rnode))
73 list.append(transplantentry(lnode, rnode))
74 self.dirty = True
74 self.dirty = True
75
75
76 def remove(self, transplant):
76 def remove(self, transplant):
77 list = self.transplants.get(transplant.rnode)
77 list = self.transplants.get(transplant.rnode)
78 if list:
78 if list:
79 del list[list.index(transplant)]
79 del list[list.index(transplant)]
80 self.dirty = True
80 self.dirty = True
81
81
82 class transplanter(object):
82 class transplanter(object):
83 def __init__(self, ui, repo, opts):
83 def __init__(self, ui, repo, opts):
84 self.ui = ui
84 self.ui = ui
85 self.path = repo.join('transplant')
85 self.path = repo.join('transplant')
86 self.opener = scmutil.opener(self.path)
86 self.opener = scmutil.opener(self.path)
87 self.transplants = transplants(self.path, 'transplants',
87 self.transplants = transplants(self.path, 'transplants',
88 opener=self.opener)
88 opener=self.opener)
89 self.editor = cmdutil.getcommiteditor(editform='transplant', **opts)
89 def getcommiteditor():
90 editform = cmdutil.mergeeditform(repo[None], 'transplant')
91 return cmdutil.getcommiteditor(editform=editform, **opts)
92 self.getcommiteditor = getcommiteditor
90
93
91 def applied(self, repo, node, parent):
94 def applied(self, repo, node, parent):
92 '''returns True if a node is already an ancestor of parent
95 '''returns True if a node is already an ancestor of parent
93 or is parent or has already been transplanted'''
96 or is parent or has already been transplanted'''
94 if hasnode(repo, parent):
97 if hasnode(repo, parent):
95 parentrev = repo.changelog.rev(parent)
98 parentrev = repo.changelog.rev(parent)
96 if hasnode(repo, node):
99 if hasnode(repo, node):
97 rev = repo.changelog.rev(node)
100 rev = repo.changelog.rev(node)
98 reachable = repo.changelog.ancestors([parentrev], rev,
101 reachable = repo.changelog.ancestors([parentrev], rev,
99 inclusive=True)
102 inclusive=True)
100 if rev in reachable:
103 if rev in reachable:
101 return True
104 return True
102 for t in self.transplants.get(node):
105 for t in self.transplants.get(node):
103 # it might have been stripped
106 # it might have been stripped
104 if not hasnode(repo, t.lnode):
107 if not hasnode(repo, t.lnode):
105 self.transplants.remove(t)
108 self.transplants.remove(t)
106 return False
109 return False
107 lnoderev = repo.changelog.rev(t.lnode)
110 lnoderev = repo.changelog.rev(t.lnode)
108 if lnoderev in repo.changelog.ancestors([parentrev], lnoderev,
111 if lnoderev in repo.changelog.ancestors([parentrev], lnoderev,
109 inclusive=True):
112 inclusive=True):
110 return True
113 return True
111 return False
114 return False
112
115
113 def apply(self, repo, source, revmap, merges, opts={}):
116 def apply(self, repo, source, revmap, merges, opts={}):
114 '''apply the revisions in revmap one by one in revision order'''
117 '''apply the revisions in revmap one by one in revision order'''
115 revs = sorted(revmap)
118 revs = sorted(revmap)
116 p1, p2 = repo.dirstate.parents()
119 p1, p2 = repo.dirstate.parents()
117 pulls = []
120 pulls = []
118 diffopts = patch.diffopts(self.ui, opts)
121 diffopts = patch.diffopts(self.ui, opts)
119 diffopts.git = True
122 diffopts.git = True
120
123
121 lock = wlock = tr = None
124 lock = wlock = tr = None
122 try:
125 try:
123 wlock = repo.wlock()
126 wlock = repo.wlock()
124 lock = repo.lock()
127 lock = repo.lock()
125 tr = repo.transaction('transplant')
128 tr = repo.transaction('transplant')
126 for rev in revs:
129 for rev in revs:
127 node = revmap[rev]
130 node = revmap[rev]
128 revstr = '%s:%s' % (rev, short(node))
131 revstr = '%s:%s' % (rev, short(node))
129
132
130 if self.applied(repo, node, p1):
133 if self.applied(repo, node, p1):
131 self.ui.warn(_('skipping already applied revision %s\n') %
134 self.ui.warn(_('skipping already applied revision %s\n') %
132 revstr)
135 revstr)
133 continue
136 continue
134
137
135 parents = source.changelog.parents(node)
138 parents = source.changelog.parents(node)
136 if not (opts.get('filter') or opts.get('log')):
139 if not (opts.get('filter') or opts.get('log')):
137 # If the changeset parent is the same as the
140 # If the changeset parent is the same as the
138 # wdir's parent, just pull it.
141 # wdir's parent, just pull it.
139 if parents[0] == p1:
142 if parents[0] == p1:
140 pulls.append(node)
143 pulls.append(node)
141 p1 = node
144 p1 = node
142 continue
145 continue
143 if pulls:
146 if pulls:
144 if source != repo:
147 if source != repo:
145 repo.pull(source.peer(), heads=pulls)
148 repo.pull(source.peer(), heads=pulls)
146 merge.update(repo, pulls[-1], False, False, None)
149 merge.update(repo, pulls[-1], False, False, None)
147 p1, p2 = repo.dirstate.parents()
150 p1, p2 = repo.dirstate.parents()
148 pulls = []
151 pulls = []
149
152
150 domerge = False
153 domerge = False
151 if node in merges:
154 if node in merges:
152 # pulling all the merge revs at once would mean we
155 # pulling all the merge revs at once would mean we
153 # couldn't transplant after the latest even if
156 # couldn't transplant after the latest even if
154 # transplants before them fail.
157 # transplants before them fail.
155 domerge = True
158 domerge = True
156 if not hasnode(repo, node):
159 if not hasnode(repo, node):
157 repo.pull(source.peer(), heads=[node])
160 repo.pull(source.peer(), heads=[node])
158
161
159 skipmerge = False
162 skipmerge = False
160 if parents[1] != revlog.nullid:
163 if parents[1] != revlog.nullid:
161 if not opts.get('parent'):
164 if not opts.get('parent'):
162 self.ui.note(_('skipping merge changeset %s:%s\n')
165 self.ui.note(_('skipping merge changeset %s:%s\n')
163 % (rev, short(node)))
166 % (rev, short(node)))
164 skipmerge = True
167 skipmerge = True
165 else:
168 else:
166 parent = source.lookup(opts['parent'])
169 parent = source.lookup(opts['parent'])
167 if parent not in parents:
170 if parent not in parents:
168 raise util.Abort(_('%s is not a parent of %s') %
171 raise util.Abort(_('%s is not a parent of %s') %
169 (short(parent), short(node)))
172 (short(parent), short(node)))
170 else:
173 else:
171 parent = parents[0]
174 parent = parents[0]
172
175
173 if skipmerge:
176 if skipmerge:
174 patchfile = None
177 patchfile = None
175 else:
178 else:
176 fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-')
179 fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-')
177 fp = os.fdopen(fd, 'w')
180 fp = os.fdopen(fd, 'w')
178 gen = patch.diff(source, parent, node, opts=diffopts)
181 gen = patch.diff(source, parent, node, opts=diffopts)
179 for chunk in gen:
182 for chunk in gen:
180 fp.write(chunk)
183 fp.write(chunk)
181 fp.close()
184 fp.close()
182
185
183 del revmap[rev]
186 del revmap[rev]
184 if patchfile or domerge:
187 if patchfile or domerge:
185 try:
188 try:
186 try:
189 try:
187 n = self.applyone(repo, node,
190 n = self.applyone(repo, node,
188 source.changelog.read(node),
191 source.changelog.read(node),
189 patchfile, merge=domerge,
192 patchfile, merge=domerge,
190 log=opts.get('log'),
193 log=opts.get('log'),
191 filter=opts.get('filter'))
194 filter=opts.get('filter'))
192 except TransplantError:
195 except TransplantError:
193 # Do not rollback, it is up to the user to
196 # Do not rollback, it is up to the user to
194 # fix the merge or cancel everything
197 # fix the merge or cancel everything
195 tr.close()
198 tr.close()
196 raise
199 raise
197 if n and domerge:
200 if n and domerge:
198 self.ui.status(_('%s merged at %s\n') % (revstr,
201 self.ui.status(_('%s merged at %s\n') % (revstr,
199 short(n)))
202 short(n)))
200 elif n:
203 elif n:
201 self.ui.status(_('%s transplanted to %s\n')
204 self.ui.status(_('%s transplanted to %s\n')
202 % (short(node),
205 % (short(node),
203 short(n)))
206 short(n)))
204 finally:
207 finally:
205 if patchfile:
208 if patchfile:
206 os.unlink(patchfile)
209 os.unlink(patchfile)
207 tr.close()
210 tr.close()
208 if pulls:
211 if pulls:
209 repo.pull(source.peer(), heads=pulls)
212 repo.pull(source.peer(), heads=pulls)
210 merge.update(repo, pulls[-1], False, False, None)
213 merge.update(repo, pulls[-1], False, False, None)
211 finally:
214 finally:
212 self.saveseries(revmap, merges)
215 self.saveseries(revmap, merges)
213 self.transplants.write()
216 self.transplants.write()
214 if tr:
217 if tr:
215 tr.release()
218 tr.release()
216 lock.release()
219 lock.release()
217 wlock.release()
220 wlock.release()
218
221
219 def filter(self, filter, node, changelog, patchfile):
222 def filter(self, filter, node, changelog, patchfile):
220 '''arbitrarily rewrite changeset before applying it'''
223 '''arbitrarily rewrite changeset before applying it'''
221
224
222 self.ui.status(_('filtering %s\n') % patchfile)
225 self.ui.status(_('filtering %s\n') % patchfile)
223 user, date, msg = (changelog[1], changelog[2], changelog[4])
226 user, date, msg = (changelog[1], changelog[2], changelog[4])
224 fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-')
227 fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-')
225 fp = os.fdopen(fd, 'w')
228 fp = os.fdopen(fd, 'w')
226 fp.write("# HG changeset patch\n")
229 fp.write("# HG changeset patch\n")
227 fp.write("# User %s\n" % user)
230 fp.write("# User %s\n" % user)
228 fp.write("# Date %d %d\n" % date)
231 fp.write("# Date %d %d\n" % date)
229 fp.write(msg + '\n')
232 fp.write(msg + '\n')
230 fp.close()
233 fp.close()
231
234
232 try:
235 try:
233 util.system('%s %s %s' % (filter, util.shellquote(headerfile),
236 util.system('%s %s %s' % (filter, util.shellquote(headerfile),
234 util.shellquote(patchfile)),
237 util.shellquote(patchfile)),
235 environ={'HGUSER': changelog[1],
238 environ={'HGUSER': changelog[1],
236 'HGREVISION': revlog.hex(node),
239 'HGREVISION': revlog.hex(node),
237 },
240 },
238 onerr=util.Abort, errprefix=_('filter failed'),
241 onerr=util.Abort, errprefix=_('filter failed'),
239 out=self.ui.fout)
242 out=self.ui.fout)
240 user, date, msg = self.parselog(file(headerfile))[1:4]
243 user, date, msg = self.parselog(file(headerfile))[1:4]
241 finally:
244 finally:
242 os.unlink(headerfile)
245 os.unlink(headerfile)
243
246
244 return (user, date, msg)
247 return (user, date, msg)
245
248
246 def applyone(self, repo, node, cl, patchfile, merge=False, log=False,
249 def applyone(self, repo, node, cl, patchfile, merge=False, log=False,
247 filter=None):
250 filter=None):
248 '''apply the patch in patchfile to the repository as a transplant'''
251 '''apply the patch in patchfile to the repository as a transplant'''
249 (manifest, user, (time, timezone), files, message) = cl[:5]
252 (manifest, user, (time, timezone), files, message) = cl[:5]
250 date = "%d %d" % (time, timezone)
253 date = "%d %d" % (time, timezone)
251 extra = {'transplant_source': node}
254 extra = {'transplant_source': node}
252 if filter:
255 if filter:
253 (user, date, message) = self.filter(filter, node, cl, patchfile)
256 (user, date, message) = self.filter(filter, node, cl, patchfile)
254
257
255 if log:
258 if log:
256 # we don't translate messages inserted into commits
259 # we don't translate messages inserted into commits
257 message += '\n(transplanted from %s)' % revlog.hex(node)
260 message += '\n(transplanted from %s)' % revlog.hex(node)
258
261
259 self.ui.status(_('applying %s\n') % short(node))
262 self.ui.status(_('applying %s\n') % short(node))
260 self.ui.note('%s %s\n%s\n' % (user, date, message))
263 self.ui.note('%s %s\n%s\n' % (user, date, message))
261
264
262 if not patchfile and not merge:
265 if not patchfile and not merge:
263 raise util.Abort(_('can only omit patchfile if merging'))
266 raise util.Abort(_('can only omit patchfile if merging'))
264 if patchfile:
267 if patchfile:
265 try:
268 try:
266 files = set()
269 files = set()
267 patch.patch(self.ui, repo, patchfile, files=files, eolmode=None)
270 patch.patch(self.ui, repo, patchfile, files=files, eolmode=None)
268 files = list(files)
271 files = list(files)
269 except Exception, inst:
272 except Exception, inst:
270 seriespath = os.path.join(self.path, 'series')
273 seriespath = os.path.join(self.path, 'series')
271 if os.path.exists(seriespath):
274 if os.path.exists(seriespath):
272 os.unlink(seriespath)
275 os.unlink(seriespath)
273 p1 = repo.dirstate.p1()
276 p1 = repo.dirstate.p1()
274 p2 = node
277 p2 = node
275 self.log(user, date, message, p1, p2, merge=merge)
278 self.log(user, date, message, p1, p2, merge=merge)
276 self.ui.write(str(inst) + '\n')
279 self.ui.write(str(inst) + '\n')
277 raise TransplantError(_('fix up the merge and run '
280 raise TransplantError(_('fix up the merge and run '
278 'hg transplant --continue'))
281 'hg transplant --continue'))
279 else:
282 else:
280 files = None
283 files = None
281 if merge:
284 if merge:
282 p1, p2 = repo.dirstate.parents()
285 p1, p2 = repo.dirstate.parents()
283 repo.setparents(p1, node)
286 repo.setparents(p1, node)
284 m = match.always(repo.root, '')
287 m = match.always(repo.root, '')
285 else:
288 else:
286 m = match.exact(repo.root, '', files)
289 m = match.exact(repo.root, '', files)
287
290
288 n = repo.commit(message, user, date, extra=extra, match=m,
291 n = repo.commit(message, user, date, extra=extra, match=m,
289 editor=self.editor)
292 editor=self.getcommiteditor())
290 if not n:
293 if not n:
291 self.ui.warn(_('skipping emptied changeset %s\n') % short(node))
294 self.ui.warn(_('skipping emptied changeset %s\n') % short(node))
292 return None
295 return None
293 if not merge:
296 if not merge:
294 self.transplants.set(n, node)
297 self.transplants.set(n, node)
295
298
296 return n
299 return n
297
300
298 def resume(self, repo, source, opts):
301 def resume(self, repo, source, opts):
299 '''recover last transaction and apply remaining changesets'''
302 '''recover last transaction and apply remaining changesets'''
300 if os.path.exists(os.path.join(self.path, 'journal')):
303 if os.path.exists(os.path.join(self.path, 'journal')):
301 n, node = self.recover(repo, source, opts)
304 n, node = self.recover(repo, source, opts)
302 self.ui.status(_('%s transplanted as %s\n') % (short(node),
305 self.ui.status(_('%s transplanted as %s\n') % (short(node),
303 short(n)))
306 short(n)))
304 seriespath = os.path.join(self.path, 'series')
307 seriespath = os.path.join(self.path, 'series')
305 if not os.path.exists(seriespath):
308 if not os.path.exists(seriespath):
306 self.transplants.write()
309 self.transplants.write()
307 return
310 return
308 nodes, merges = self.readseries()
311 nodes, merges = self.readseries()
309 revmap = {}
312 revmap = {}
310 for n in nodes:
313 for n in nodes:
311 revmap[source.changelog.rev(n)] = n
314 revmap[source.changelog.rev(n)] = n
312 os.unlink(seriespath)
315 os.unlink(seriespath)
313
316
314 self.apply(repo, source, revmap, merges, opts)
317 self.apply(repo, source, revmap, merges, opts)
315
318
316 def recover(self, repo, source, opts):
319 def recover(self, repo, source, opts):
317 '''commit working directory using journal metadata'''
320 '''commit working directory using journal metadata'''
318 node, user, date, message, parents = self.readlog()
321 node, user, date, message, parents = self.readlog()
319 merge = False
322 merge = False
320
323
321 if not user or not date or not message or not parents[0]:
324 if not user or not date or not message or not parents[0]:
322 raise util.Abort(_('transplant log file is corrupt'))
325 raise util.Abort(_('transplant log file is corrupt'))
323
326
324 parent = parents[0]
327 parent = parents[0]
325 if len(parents) > 1:
328 if len(parents) > 1:
326 if opts.get('parent'):
329 if opts.get('parent'):
327 parent = source.lookup(opts['parent'])
330 parent = source.lookup(opts['parent'])
328 if parent not in parents:
331 if parent not in parents:
329 raise util.Abort(_('%s is not a parent of %s') %
332 raise util.Abort(_('%s is not a parent of %s') %
330 (short(parent), short(node)))
333 (short(parent), short(node)))
331 else:
334 else:
332 merge = True
335 merge = True
333
336
334 extra = {'transplant_source': node}
337 extra = {'transplant_source': node}
335 wlock = repo.wlock()
338 wlock = repo.wlock()
336 try:
339 try:
337 p1, p2 = repo.dirstate.parents()
340 p1, p2 = repo.dirstate.parents()
338 if p1 != parent:
341 if p1 != parent:
339 raise util.Abort(
342 raise util.Abort(
340 _('working dir not at transplant parent %s') %
343 _('working dir not at transplant parent %s') %
341 revlog.hex(parent))
344 revlog.hex(parent))
342 if merge:
345 if merge:
343 repo.setparents(p1, parents[1])
346 repo.setparents(p1, parents[1])
344 n = repo.commit(message, user, date, extra=extra,
347 n = repo.commit(message, user, date, extra=extra,
345 editor=self.editor)
348 editor=self.getcommiteditor())
346 if not n:
349 if not n:
347 raise util.Abort(_('commit failed'))
350 raise util.Abort(_('commit failed'))
348 if not merge:
351 if not merge:
349 self.transplants.set(n, node)
352 self.transplants.set(n, node)
350 self.unlog()
353 self.unlog()
351
354
352 return n, node
355 return n, node
353 finally:
356 finally:
354 wlock.release()
357 wlock.release()
355
358
356 def readseries(self):
359 def readseries(self):
357 nodes = []
360 nodes = []
358 merges = []
361 merges = []
359 cur = nodes
362 cur = nodes
360 for line in self.opener.read('series').splitlines():
363 for line in self.opener.read('series').splitlines():
361 if line.startswith('# Merges'):
364 if line.startswith('# Merges'):
362 cur = merges
365 cur = merges
363 continue
366 continue
364 cur.append(revlog.bin(line))
367 cur.append(revlog.bin(line))
365
368
366 return (nodes, merges)
369 return (nodes, merges)
367
370
368 def saveseries(self, revmap, merges):
371 def saveseries(self, revmap, merges):
369 if not revmap:
372 if not revmap:
370 return
373 return
371
374
372 if not os.path.isdir(self.path):
375 if not os.path.isdir(self.path):
373 os.mkdir(self.path)
376 os.mkdir(self.path)
374 series = self.opener('series', 'w')
377 series = self.opener('series', 'w')
375 for rev in sorted(revmap):
378 for rev in sorted(revmap):
376 series.write(revlog.hex(revmap[rev]) + '\n')
379 series.write(revlog.hex(revmap[rev]) + '\n')
377 if merges:
380 if merges:
378 series.write('# Merges\n')
381 series.write('# Merges\n')
379 for m in merges:
382 for m in merges:
380 series.write(revlog.hex(m) + '\n')
383 series.write(revlog.hex(m) + '\n')
381 series.close()
384 series.close()
382
385
383 def parselog(self, fp):
386 def parselog(self, fp):
384 parents = []
387 parents = []
385 message = []
388 message = []
386 node = revlog.nullid
389 node = revlog.nullid
387 inmsg = False
390 inmsg = False
388 user = None
391 user = None
389 date = None
392 date = None
390 for line in fp.read().splitlines():
393 for line in fp.read().splitlines():
391 if inmsg:
394 if inmsg:
392 message.append(line)
395 message.append(line)
393 elif line.startswith('# User '):
396 elif line.startswith('# User '):
394 user = line[7:]
397 user = line[7:]
395 elif line.startswith('# Date '):
398 elif line.startswith('# Date '):
396 date = line[7:]
399 date = line[7:]
397 elif line.startswith('# Node ID '):
400 elif line.startswith('# Node ID '):
398 node = revlog.bin(line[10:])
401 node = revlog.bin(line[10:])
399 elif line.startswith('# Parent '):
402 elif line.startswith('# Parent '):
400 parents.append(revlog.bin(line[9:]))
403 parents.append(revlog.bin(line[9:]))
401 elif not line.startswith('# '):
404 elif not line.startswith('# '):
402 inmsg = True
405 inmsg = True
403 message.append(line)
406 message.append(line)
404 if None in (user, date):
407 if None in (user, date):
405 raise util.Abort(_("filter corrupted changeset (no user or date)"))
408 raise util.Abort(_("filter corrupted changeset (no user or date)"))
406 return (node, user, date, '\n'.join(message), parents)
409 return (node, user, date, '\n'.join(message), parents)
407
410
408 def log(self, user, date, message, p1, p2, merge=False):
411 def log(self, user, date, message, p1, p2, merge=False):
409 '''journal changelog metadata for later recover'''
412 '''journal changelog metadata for later recover'''
410
413
411 if not os.path.isdir(self.path):
414 if not os.path.isdir(self.path):
412 os.mkdir(self.path)
415 os.mkdir(self.path)
413 fp = self.opener('journal', 'w')
416 fp = self.opener('journal', 'w')
414 fp.write('# User %s\n' % user)
417 fp.write('# User %s\n' % user)
415 fp.write('# Date %s\n' % date)
418 fp.write('# Date %s\n' % date)
416 fp.write('# Node ID %s\n' % revlog.hex(p2))
419 fp.write('# Node ID %s\n' % revlog.hex(p2))
417 fp.write('# Parent ' + revlog.hex(p1) + '\n')
420 fp.write('# Parent ' + revlog.hex(p1) + '\n')
418 if merge:
421 if merge:
419 fp.write('# Parent ' + revlog.hex(p2) + '\n')
422 fp.write('# Parent ' + revlog.hex(p2) + '\n')
420 fp.write(message.rstrip() + '\n')
423 fp.write(message.rstrip() + '\n')
421 fp.close()
424 fp.close()
422
425
423 def readlog(self):
426 def readlog(self):
424 return self.parselog(self.opener('journal'))
427 return self.parselog(self.opener('journal'))
425
428
426 def unlog(self):
429 def unlog(self):
427 '''remove changelog journal'''
430 '''remove changelog journal'''
428 absdst = os.path.join(self.path, 'journal')
431 absdst = os.path.join(self.path, 'journal')
429 if os.path.exists(absdst):
432 if os.path.exists(absdst):
430 os.unlink(absdst)
433 os.unlink(absdst)
431
434
432 def transplantfilter(self, repo, source, root):
435 def transplantfilter(self, repo, source, root):
433 def matchfn(node):
436 def matchfn(node):
434 if self.applied(repo, node, root):
437 if self.applied(repo, node, root):
435 return False
438 return False
436 if source.changelog.parents(node)[1] != revlog.nullid:
439 if source.changelog.parents(node)[1] != revlog.nullid:
437 return False
440 return False
438 extra = source.changelog.read(node)[5]
441 extra = source.changelog.read(node)[5]
439 cnode = extra.get('transplant_source')
442 cnode = extra.get('transplant_source')
440 if cnode and self.applied(repo, cnode, root):
443 if cnode and self.applied(repo, cnode, root):
441 return False
444 return False
442 return True
445 return True
443
446
444 return matchfn
447 return matchfn
445
448
446 def hasnode(repo, node):
449 def hasnode(repo, node):
447 try:
450 try:
448 return repo.changelog.rev(node) is not None
451 return repo.changelog.rev(node) is not None
449 except error.RevlogError:
452 except error.RevlogError:
450 return False
453 return False
451
454
452 def browserevs(ui, repo, nodes, opts):
455 def browserevs(ui, repo, nodes, opts):
453 '''interactively transplant changesets'''
456 '''interactively transplant changesets'''
454 displayer = cmdutil.show_changeset(ui, repo, opts)
457 displayer = cmdutil.show_changeset(ui, repo, opts)
455 transplants = []
458 transplants = []
456 merges = []
459 merges = []
457 prompt = _('apply changeset? [ynmpcq?]:'
460 prompt = _('apply changeset? [ynmpcq?]:'
458 '$$ &yes, transplant this changeset'
461 '$$ &yes, transplant this changeset'
459 '$$ &no, skip this changeset'
462 '$$ &no, skip this changeset'
460 '$$ &merge at this changeset'
463 '$$ &merge at this changeset'
461 '$$ show &patch'
464 '$$ show &patch'
462 '$$ &commit selected changesets'
465 '$$ &commit selected changesets'
463 '$$ &quit and cancel transplant'
466 '$$ &quit and cancel transplant'
464 '$$ &? (show this help)')
467 '$$ &? (show this help)')
465 for node in nodes:
468 for node in nodes:
466 displayer.show(repo[node])
469 displayer.show(repo[node])
467 action = None
470 action = None
468 while not action:
471 while not action:
469 action = 'ynmpcq?'[ui.promptchoice(prompt)]
472 action = 'ynmpcq?'[ui.promptchoice(prompt)]
470 if action == '?':
473 if action == '?':
471 for c, t in ui.extractchoices(prompt)[1]:
474 for c, t in ui.extractchoices(prompt)[1]:
472 ui.write('%s: %s\n' % (c, t))
475 ui.write('%s: %s\n' % (c, t))
473 action = None
476 action = None
474 elif action == 'p':
477 elif action == 'p':
475 parent = repo.changelog.parents(node)[0]
478 parent = repo.changelog.parents(node)[0]
476 for chunk in patch.diff(repo, parent, node):
479 for chunk in patch.diff(repo, parent, node):
477 ui.write(chunk)
480 ui.write(chunk)
478 action = None
481 action = None
479 if action == 'y':
482 if action == 'y':
480 transplants.append(node)
483 transplants.append(node)
481 elif action == 'm':
484 elif action == 'm':
482 merges.append(node)
485 merges.append(node)
483 elif action == 'c':
486 elif action == 'c':
484 break
487 break
485 elif action == 'q':
488 elif action == 'q':
486 transplants = ()
489 transplants = ()
487 merges = ()
490 merges = ()
488 break
491 break
489 displayer.close()
492 displayer.close()
490 return (transplants, merges)
493 return (transplants, merges)
491
494
492 @command('transplant',
495 @command('transplant',
493 [('s', 'source', '', _('transplant changesets from REPO'), _('REPO')),
496 [('s', 'source', '', _('transplant changesets from REPO'), _('REPO')),
494 ('b', 'branch', [], _('use this source changeset as head'), _('REV')),
497 ('b', 'branch', [], _('use this source changeset as head'), _('REV')),
495 ('a', 'all', None, _('pull all changesets up to the --branch revisions')),
498 ('a', 'all', None, _('pull all changesets up to the --branch revisions')),
496 ('p', 'prune', [], _('skip over REV'), _('REV')),
499 ('p', 'prune', [], _('skip over REV'), _('REV')),
497 ('m', 'merge', [], _('merge at REV'), _('REV')),
500 ('m', 'merge', [], _('merge at REV'), _('REV')),
498 ('', 'parent', '',
501 ('', 'parent', '',
499 _('parent to choose when transplanting merge'), _('REV')),
502 _('parent to choose when transplanting merge'), _('REV')),
500 ('e', 'edit', False, _('invoke editor on commit messages')),
503 ('e', 'edit', False, _('invoke editor on commit messages')),
501 ('', 'log', None, _('append transplant info to log message')),
504 ('', 'log', None, _('append transplant info to log message')),
502 ('c', 'continue', None, _('continue last transplant session '
505 ('c', 'continue', None, _('continue last transplant session '
503 'after fixing conflicts')),
506 'after fixing conflicts')),
504 ('', 'filter', '',
507 ('', 'filter', '',
505 _('filter changesets through command'), _('CMD'))],
508 _('filter changesets through command'), _('CMD'))],
506 _('hg transplant [-s REPO] [-b BRANCH [-a]] [-p REV] '
509 _('hg transplant [-s REPO] [-b BRANCH [-a]] [-p REV] '
507 '[-m REV] [REV]...'))
510 '[-m REV] [REV]...'))
508 def transplant(ui, repo, *revs, **opts):
511 def transplant(ui, repo, *revs, **opts):
509 '''transplant changesets from another branch
512 '''transplant changesets from another branch
510
513
511 Selected changesets will be applied on top of the current working
514 Selected changesets will be applied on top of the current working
512 directory with the log of the original changeset. The changesets
515 directory with the log of the original changeset. The changesets
513 are copied and will thus appear twice in the history with different
516 are copied and will thus appear twice in the history with different
514 identities.
517 identities.
515
518
516 Consider using the graft command if everything is inside the same
519 Consider using the graft command if everything is inside the same
517 repository - it will use merges and will usually give a better result.
520 repository - it will use merges and will usually give a better result.
518 Use the rebase extension if the changesets are unpublished and you want
521 Use the rebase extension if the changesets are unpublished and you want
519 to move them instead of copying them.
522 to move them instead of copying them.
520
523
521 If --log is specified, log messages will have a comment appended
524 If --log is specified, log messages will have a comment appended
522 of the form::
525 of the form::
523
526
524 (transplanted from CHANGESETHASH)
527 (transplanted from CHANGESETHASH)
525
528
526 You can rewrite the changelog message with the --filter option.
529 You can rewrite the changelog message with the --filter option.
527 Its argument will be invoked with the current changelog message as
530 Its argument will be invoked with the current changelog message as
528 $1 and the patch as $2.
531 $1 and the patch as $2.
529
532
530 --source/-s specifies another repository to use for selecting changesets,
533 --source/-s specifies another repository to use for selecting changesets,
531 just as if it temporarily had been pulled.
534 just as if it temporarily had been pulled.
532 If --branch/-b is specified, these revisions will be used as
535 If --branch/-b is specified, these revisions will be used as
533 heads when deciding which changesets to transplant, just as if only
536 heads when deciding which changesets to transplant, just as if only
534 these revisions had been pulled.
537 these revisions had been pulled.
535 If --all/-a is specified, all the revisions up to the heads specified
538 If --all/-a is specified, all the revisions up to the heads specified
536 with --branch will be transplanted.
539 with --branch will be transplanted.
537
540
538 Example:
541 Example:
539
542
540 - transplant all changes up to REV on top of your current revision::
543 - transplant all changes up to REV on top of your current revision::
541
544
542 hg transplant --branch REV --all
545 hg transplant --branch REV --all
543
546
544 You can optionally mark selected transplanted changesets as merge
547 You can optionally mark selected transplanted changesets as merge
545 changesets. You will not be prompted to transplant any ancestors
548 changesets. You will not be prompted to transplant any ancestors
546 of a merged transplant, and you can merge descendants of them
549 of a merged transplant, and you can merge descendants of them
547 normally instead of transplanting them.
550 normally instead of transplanting them.
548
551
549 Merge changesets may be transplanted directly by specifying the
552 Merge changesets may be transplanted directly by specifying the
550 proper parent changeset by calling :hg:`transplant --parent`.
553 proper parent changeset by calling :hg:`transplant --parent`.
551
554
552 If no merges or revisions are provided, :hg:`transplant` will
555 If no merges or revisions are provided, :hg:`transplant` will
553 start an interactive changeset browser.
556 start an interactive changeset browser.
554
557
555 If a changeset application fails, you can fix the merge by hand
558 If a changeset application fails, you can fix the merge by hand
556 and then resume where you left off by calling :hg:`transplant
559 and then resume where you left off by calling :hg:`transplant
557 --continue/-c`.
560 --continue/-c`.
558 '''
561 '''
559 def incwalk(repo, csets, match=util.always):
562 def incwalk(repo, csets, match=util.always):
560 for node in csets:
563 for node in csets:
561 if match(node):
564 if match(node):
562 yield node
565 yield node
563
566
564 def transplantwalk(repo, dest, heads, match=util.always):
567 def transplantwalk(repo, dest, heads, match=util.always):
565 '''Yield all nodes that are ancestors of a head but not ancestors
568 '''Yield all nodes that are ancestors of a head but not ancestors
566 of dest.
569 of dest.
567 If no heads are specified, the heads of repo will be used.'''
570 If no heads are specified, the heads of repo will be used.'''
568 if not heads:
571 if not heads:
569 heads = repo.heads()
572 heads = repo.heads()
570 ancestors = []
573 ancestors = []
571 ctx = repo[dest]
574 ctx = repo[dest]
572 for head in heads:
575 for head in heads:
573 ancestors.append(ctx.ancestor(repo[head]).node())
576 ancestors.append(ctx.ancestor(repo[head]).node())
574 for node in repo.changelog.nodesbetween(ancestors, heads)[0]:
577 for node in repo.changelog.nodesbetween(ancestors, heads)[0]:
575 if match(node):
578 if match(node):
576 yield node
579 yield node
577
580
578 def checkopts(opts, revs):
581 def checkopts(opts, revs):
579 if opts.get('continue'):
582 if opts.get('continue'):
580 if opts.get('branch') or opts.get('all') or opts.get('merge'):
583 if opts.get('branch') or opts.get('all') or opts.get('merge'):
581 raise util.Abort(_('--continue is incompatible with '
584 raise util.Abort(_('--continue is incompatible with '
582 '--branch, --all and --merge'))
585 '--branch, --all and --merge'))
583 return
586 return
584 if not (opts.get('source') or revs or
587 if not (opts.get('source') or revs or
585 opts.get('merge') or opts.get('branch')):
588 opts.get('merge') or opts.get('branch')):
586 raise util.Abort(_('no source URL, branch revision or revision '
589 raise util.Abort(_('no source URL, branch revision or revision '
587 'list provided'))
590 'list provided'))
588 if opts.get('all'):
591 if opts.get('all'):
589 if not opts.get('branch'):
592 if not opts.get('branch'):
590 raise util.Abort(_('--all requires a branch revision'))
593 raise util.Abort(_('--all requires a branch revision'))
591 if revs:
594 if revs:
592 raise util.Abort(_('--all is incompatible with a '
595 raise util.Abort(_('--all is incompatible with a '
593 'revision list'))
596 'revision list'))
594
597
595 checkopts(opts, revs)
598 checkopts(opts, revs)
596
599
597 if not opts.get('log'):
600 if not opts.get('log'):
598 opts['log'] = ui.config('transplant', 'log')
601 opts['log'] = ui.config('transplant', 'log')
599 if not opts.get('filter'):
602 if not opts.get('filter'):
600 opts['filter'] = ui.config('transplant', 'filter')
603 opts['filter'] = ui.config('transplant', 'filter')
601
604
602 tp = transplanter(ui, repo, opts)
605 tp = transplanter(ui, repo, opts)
603
606
604 cmdutil.checkunfinished(repo)
607 cmdutil.checkunfinished(repo)
605 p1, p2 = repo.dirstate.parents()
608 p1, p2 = repo.dirstate.parents()
606 if len(repo) > 0 and p1 == revlog.nullid:
609 if len(repo) > 0 and p1 == revlog.nullid:
607 raise util.Abort(_('no revision checked out'))
610 raise util.Abort(_('no revision checked out'))
608 if not opts.get('continue'):
611 if not opts.get('continue'):
609 if p2 != revlog.nullid:
612 if p2 != revlog.nullid:
610 raise util.Abort(_('outstanding uncommitted merges'))
613 raise util.Abort(_('outstanding uncommitted merges'))
611 m, a, r, d = repo.status()[:4]
614 m, a, r, d = repo.status()[:4]
612 if m or a or r or d:
615 if m or a or r or d:
613 raise util.Abort(_('outstanding local changes'))
616 raise util.Abort(_('outstanding local changes'))
614
617
615 sourcerepo = opts.get('source')
618 sourcerepo = opts.get('source')
616 if sourcerepo:
619 if sourcerepo:
617 peer = hg.peer(repo, opts, ui.expandpath(sourcerepo))
620 peer = hg.peer(repo, opts, ui.expandpath(sourcerepo))
618 heads = map(peer.lookup, opts.get('branch', ()))
621 heads = map(peer.lookup, opts.get('branch', ()))
619 source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer,
622 source, csets, cleanupfn = bundlerepo.getremotechanges(ui, repo, peer,
620 onlyheads=heads, force=True)
623 onlyheads=heads, force=True)
621 else:
624 else:
622 source = repo
625 source = repo
623 heads = map(source.lookup, opts.get('branch', ()))
626 heads = map(source.lookup, opts.get('branch', ()))
624 cleanupfn = None
627 cleanupfn = None
625
628
626 try:
629 try:
627 if opts.get('continue'):
630 if opts.get('continue'):
628 tp.resume(repo, source, opts)
631 tp.resume(repo, source, opts)
629 return
632 return
630
633
631 tf = tp.transplantfilter(repo, source, p1)
634 tf = tp.transplantfilter(repo, source, p1)
632 if opts.get('prune'):
635 if opts.get('prune'):
633 prune = set(source.lookup(r)
636 prune = set(source.lookup(r)
634 for r in scmutil.revrange(source, opts.get('prune')))
637 for r in scmutil.revrange(source, opts.get('prune')))
635 matchfn = lambda x: tf(x) and x not in prune
638 matchfn = lambda x: tf(x) and x not in prune
636 else:
639 else:
637 matchfn = tf
640 matchfn = tf
638 merges = map(source.lookup, opts.get('merge', ()))
641 merges = map(source.lookup, opts.get('merge', ()))
639 revmap = {}
642 revmap = {}
640 if revs:
643 if revs:
641 for r in scmutil.revrange(source, revs):
644 for r in scmutil.revrange(source, revs):
642 revmap[int(r)] = source.lookup(r)
645 revmap[int(r)] = source.lookup(r)
643 elif opts.get('all') or not merges:
646 elif opts.get('all') or not merges:
644 if source != repo:
647 if source != repo:
645 alltransplants = incwalk(source, csets, match=matchfn)
648 alltransplants = incwalk(source, csets, match=matchfn)
646 else:
649 else:
647 alltransplants = transplantwalk(source, p1, heads,
650 alltransplants = transplantwalk(source, p1, heads,
648 match=matchfn)
651 match=matchfn)
649 if opts.get('all'):
652 if opts.get('all'):
650 revs = alltransplants
653 revs = alltransplants
651 else:
654 else:
652 revs, newmerges = browserevs(ui, source, alltransplants, opts)
655 revs, newmerges = browserevs(ui, source, alltransplants, opts)
653 merges.extend(newmerges)
656 merges.extend(newmerges)
654 for r in revs:
657 for r in revs:
655 revmap[source.changelog.rev(r)] = r
658 revmap[source.changelog.rev(r)] = r
656 for r in merges:
659 for r in merges:
657 revmap[source.changelog.rev(r)] = r
660 revmap[source.changelog.rev(r)] = r
658
661
659 tp.apply(repo, source, revmap, merges, opts)
662 tp.apply(repo, source, revmap, merges, opts)
660 finally:
663 finally:
661 if cleanupfn:
664 if cleanupfn:
662 cleanupfn()
665 cleanupfn()
663
666
664 def revsettransplanted(repo, subset, x):
667 def revsettransplanted(repo, subset, x):
665 """``transplanted([set])``
668 """``transplanted([set])``
666 Transplanted changesets in set, or all transplanted changesets.
669 Transplanted changesets in set, or all transplanted changesets.
667 """
670 """
668 if x:
671 if x:
669 s = revset.getset(repo, subset, x)
672 s = revset.getset(repo, subset, x)
670 else:
673 else:
671 s = subset
674 s = subset
672 return revset.baseset([r for r in s if
675 return revset.baseset([r for r in s if
673 repo[r].extra().get('transplant_source')])
676 repo[r].extra().get('transplant_source')])
674
677
675 def kwtransplanted(repo, ctx, **args):
678 def kwtransplanted(repo, ctx, **args):
676 """:transplanted: String. The node identifier of the transplanted
679 """:transplanted: String. The node identifier of the transplanted
677 changeset if any."""
680 changeset if any."""
678 n = ctx.extra().get('transplant_source')
681 n = ctx.extra().get('transplant_source')
679 return n and revlog.hex(n) or ''
682 return n and revlog.hex(n) or ''
680
683
681 def extsetup(ui):
684 def extsetup(ui):
682 revset.symbols['transplanted'] = revsettransplanted
685 revset.symbols['transplanted'] = revsettransplanted
683 templatekw.keywords['transplanted'] = kwtransplanted
686 templatekw.keywords['transplanted'] = kwtransplanted
684 cmdutil.unfinishedstates.append(
687 cmdutil.unfinishedstates.append(
685 ['series', True, False, _('transplant in progress'),
688 ['series', True, False, _('transplant in progress'),
686 _("use 'hg transplant --continue' or 'hg update' to abort")])
689 _("use 'hg transplant --continue' or 'hg update' to abort")])
687
690
688 # tell hggettext to extract docstrings from these functions:
691 # tell hggettext to extract docstrings from these functions:
689 i18nfunctions = [revsettransplanted, kwtransplanted]
692 i18nfunctions = [revsettransplanted, kwtransplanted]
@@ -1,1690 +1,1691
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 The configuration files use a simple ini-file format. A configuration
4 The configuration files use a simple ini-file format. A configuration
5 file consists of sections, led by a ``[section]`` header and followed
5 file consists of sections, led by a ``[section]`` header and followed
6 by ``name = value`` entries::
6 by ``name = value`` entries::
7
7
8 [ui]
8 [ui]
9 username = Firstname Lastname <firstname.lastname@example.net>
9 username = Firstname Lastname <firstname.lastname@example.net>
10 verbose = True
10 verbose = True
11
11
12 The above entries will be referred to as ``ui.username`` and
12 The above entries will be referred to as ``ui.username`` and
13 ``ui.verbose``, respectively. See the Syntax section below.
13 ``ui.verbose``, respectively. See the Syntax section below.
14
14
15 Files
15 Files
16 =====
16 =====
17
17
18 Mercurial reads configuration data from several files, if they exist.
18 Mercurial reads configuration data from several files, if they exist.
19 These files do not exist by default and you will have to create the
19 These files do not exist by default and you will have to create the
20 appropriate configuration files yourself: global configuration like
20 appropriate configuration files yourself: global configuration like
21 the username setting is typically put into
21 the username setting is typically put into
22 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
22 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
23 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
23 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
24
24
25 The names of these files depend on the system on which Mercurial is
25 The names of these files depend on the system on which Mercurial is
26 installed. ``*.rc`` files from a single directory are read in
26 installed. ``*.rc`` files from a single directory are read in
27 alphabetical order, later ones overriding earlier ones. Where multiple
27 alphabetical order, later ones overriding earlier ones. Where multiple
28 paths are given below, settings from earlier paths override later
28 paths are given below, settings from earlier paths override later
29 ones.
29 ones.
30
30
31 | (All) ``<repo>/.hg/hgrc``
31 | (All) ``<repo>/.hg/hgrc``
32
32
33 Per-repository configuration options that only apply in a
33 Per-repository configuration options that only apply in a
34 particular repository. This file is not version-controlled, and
34 particular repository. This file is not version-controlled, and
35 will not get transferred during a "clone" operation. Options in
35 will not get transferred during a "clone" operation. Options in
36 this file override options in all other configuration files. On
36 this file override options in all other configuration files. On
37 Plan 9 and Unix, most of this file will be ignored if it doesn't
37 Plan 9 and Unix, most of this file will be ignored if it doesn't
38 belong to a trusted user or to a trusted group. See the documentation
38 belong to a trusted user or to a trusted group. See the documentation
39 for the ``[trusted]`` section below for more details.
39 for the ``[trusted]`` section below for more details.
40
40
41 | (Plan 9) ``$home/lib/hgrc``
41 | (Plan 9) ``$home/lib/hgrc``
42 | (Unix) ``$HOME/.hgrc``
42 | (Unix) ``$HOME/.hgrc``
43 | (Windows) ``%USERPROFILE%\.hgrc``
43 | (Windows) ``%USERPROFILE%\.hgrc``
44 | (Windows) ``%USERPROFILE%\Mercurial.ini``
44 | (Windows) ``%USERPROFILE%\Mercurial.ini``
45 | (Windows) ``%HOME%\.hgrc``
45 | (Windows) ``%HOME%\.hgrc``
46 | (Windows) ``%HOME%\Mercurial.ini``
46 | (Windows) ``%HOME%\Mercurial.ini``
47
47
48 Per-user configuration file(s), for the user running Mercurial. On
48 Per-user configuration file(s), for the user running Mercurial. On
49 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
49 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
50 files apply to all Mercurial commands executed by this user in any
50 files apply to all Mercurial commands executed by this user in any
51 directory. Options in these files override per-system and per-installation
51 directory. Options in these files override per-system and per-installation
52 options.
52 options.
53
53
54 | (Plan 9) ``/lib/mercurial/hgrc``
54 | (Plan 9) ``/lib/mercurial/hgrc``
55 | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc``
55 | (Plan 9) ``/lib/mercurial/hgrc.d/*.rc``
56 | (Unix) ``/etc/mercurial/hgrc``
56 | (Unix) ``/etc/mercurial/hgrc``
57 | (Unix) ``/etc/mercurial/hgrc.d/*.rc``
57 | (Unix) ``/etc/mercurial/hgrc.d/*.rc``
58
58
59 Per-system configuration files, for the system on which Mercurial
59 Per-system configuration files, for the system on which Mercurial
60 is running. Options in these files apply to all Mercurial commands
60 is running. Options in these files apply to all Mercurial commands
61 executed by any user in any directory. Options in these files
61 executed by any user in any directory. Options in these files
62 override per-installation options.
62 override per-installation options.
63
63
64 | (Plan 9) ``<install-root>/lib/mercurial/hgrc``
64 | (Plan 9) ``<install-root>/lib/mercurial/hgrc``
65 | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc``
65 | (Plan 9) ``<install-root>/lib/mercurial/hgrc.d/*.rc``
66 | (Unix) ``<install-root>/etc/mercurial/hgrc``
66 | (Unix) ``<install-root>/etc/mercurial/hgrc``
67 | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc``
67 | (Unix) ``<install-root>/etc/mercurial/hgrc.d/*.rc``
68
68
69 Per-installation configuration files, searched for in the
69 Per-installation configuration files, searched for in the
70 directory where Mercurial is installed. ``<install-root>`` is the
70 directory where Mercurial is installed. ``<install-root>`` is the
71 parent directory of the **hg** executable (or symlink) being run. For
71 parent directory of the **hg** executable (or symlink) being run. For
72 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
72 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
73 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
73 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
74 to all Mercurial commands executed by any user in any directory.
74 to all Mercurial commands executed by any user in any directory.
75
75
76 | (Windows) ``<install-dir>\Mercurial.ini`` **or**
76 | (Windows) ``<install-dir>\Mercurial.ini`` **or**
77 | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or**
77 | (Windows) ``<install-dir>\hgrc.d\*.rc`` **or**
78 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
78 | (Windows) ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial``
79
79
80 Per-installation/system configuration files, for the system on
80 Per-installation/system configuration files, for the system on
81 which Mercurial is running. Options in these files apply to all
81 which Mercurial is running. Options in these files apply to all
82 Mercurial commands executed by any user in any directory. Registry
82 Mercurial commands executed by any user in any directory. Registry
83 keys contain PATH-like strings, every part of which must reference
83 keys contain PATH-like strings, every part of which must reference
84 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
84 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
85 be read. Mercurial checks each of these locations in the specified
85 be read. Mercurial checks each of these locations in the specified
86 order until one or more configuration files are detected.
86 order until one or more configuration files are detected.
87
87
88 .. note::
88 .. note::
89
89
90 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
90 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
91 is used when running 32-bit Python on 64-bit Windows.
91 is used when running 32-bit Python on 64-bit Windows.
92
92
93 Syntax
93 Syntax
94 ======
94 ======
95
95
96 A configuration file consists of sections, led by a ``[section]`` header
96 A configuration file consists of sections, led by a ``[section]`` header
97 and followed by ``name = value`` entries (sometimes called
97 and followed by ``name = value`` entries (sometimes called
98 ``configuration keys``)::
98 ``configuration keys``)::
99
99
100 [spam]
100 [spam]
101 eggs=ham
101 eggs=ham
102 green=
102 green=
103 eggs
103 eggs
104
104
105 Each line contains one entry. If the lines that follow are indented,
105 Each line contains one entry. If the lines that follow are indented,
106 they are treated as continuations of that entry. Leading whitespace is
106 they are treated as continuations of that entry. Leading whitespace is
107 removed from values. Empty lines are skipped. Lines beginning with
107 removed from values. Empty lines are skipped. Lines beginning with
108 ``#`` or ``;`` are ignored and may be used to provide comments.
108 ``#`` or ``;`` are ignored and may be used to provide comments.
109
109
110 Configuration keys can be set multiple times, in which case Mercurial
110 Configuration keys can be set multiple times, in which case Mercurial
111 will use the value that was configured last. As an example::
111 will use the value that was configured last. As an example::
112
112
113 [spam]
113 [spam]
114 eggs=large
114 eggs=large
115 ham=serrano
115 ham=serrano
116 eggs=small
116 eggs=small
117
117
118 This would set the configuration key named ``eggs`` to ``small``.
118 This would set the configuration key named ``eggs`` to ``small``.
119
119
120 It is also possible to define a section multiple times. A section can
120 It is also possible to define a section multiple times. A section can
121 be redefined on the same and/or on different configuration files. For
121 be redefined on the same and/or on different configuration files. For
122 example::
122 example::
123
123
124 [foo]
124 [foo]
125 eggs=large
125 eggs=large
126 ham=serrano
126 ham=serrano
127 eggs=small
127 eggs=small
128
128
129 [bar]
129 [bar]
130 eggs=ham
130 eggs=ham
131 green=
131 green=
132 eggs
132 eggs
133
133
134 [foo]
134 [foo]
135 ham=prosciutto
135 ham=prosciutto
136 eggs=medium
136 eggs=medium
137 bread=toasted
137 bread=toasted
138
138
139 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
139 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
140 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
140 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
141 respectively. As you can see there only thing that matters is the last
141 respectively. As you can see there only thing that matters is the last
142 value that was set for each of the configuration keys.
142 value that was set for each of the configuration keys.
143
143
144 If a configuration key is set multiple times in different
144 If a configuration key is set multiple times in different
145 configuration files the final value will depend on the order in which
145 configuration files the final value will depend on the order in which
146 the different configuration files are read, with settings from earlier
146 the different configuration files are read, with settings from earlier
147 paths overriding later ones as described on the ``Files`` section
147 paths overriding later ones as described on the ``Files`` section
148 above.
148 above.
149
149
150 A line of the form ``%include file`` will include ``file`` into the
150 A line of the form ``%include file`` will include ``file`` into the
151 current configuration file. The inclusion is recursive, which means
151 current configuration file. The inclusion is recursive, which means
152 that included files can include other files. Filenames are relative to
152 that included files can include other files. Filenames are relative to
153 the configuration file in which the ``%include`` directive is found.
153 the configuration file in which the ``%include`` directive is found.
154 Environment variables and ``~user`` constructs are expanded in
154 Environment variables and ``~user`` constructs are expanded in
155 ``file``. This lets you do something like::
155 ``file``. This lets you do something like::
156
156
157 %include ~/.hgrc.d/$HOST.rc
157 %include ~/.hgrc.d/$HOST.rc
158
158
159 to include a different configuration file on each computer you use.
159 to include a different configuration file on each computer you use.
160
160
161 A line with ``%unset name`` will remove ``name`` from the current
161 A line with ``%unset name`` will remove ``name`` from the current
162 section, if it has been set previously.
162 section, if it has been set previously.
163
163
164 The values are either free-form text strings, lists of text strings,
164 The values are either free-form text strings, lists of text strings,
165 or Boolean values. Boolean values can be set to true using any of "1",
165 or Boolean values. Boolean values can be set to true using any of "1",
166 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
166 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
167 (all case insensitive).
167 (all case insensitive).
168
168
169 List values are separated by whitespace or comma, except when values are
169 List values are separated by whitespace or comma, except when values are
170 placed in double quotation marks::
170 placed in double quotation marks::
171
171
172 allow_read = "John Doe, PhD", brian, betty
172 allow_read = "John Doe, PhD", brian, betty
173
173
174 Quotation marks can be escaped by prefixing them with a backslash. Only
174 Quotation marks can be escaped by prefixing them with a backslash. Only
175 quotation marks at the beginning of a word is counted as a quotation
175 quotation marks at the beginning of a word is counted as a quotation
176 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
176 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
177
177
178 Sections
178 Sections
179 ========
179 ========
180
180
181 This section describes the different sections that may appear in a
181 This section describes the different sections that may appear in a
182 Mercurial configuration file, the purpose of each section, its possible
182 Mercurial configuration file, the purpose of each section, its possible
183 keys, and their possible values.
183 keys, and their possible values.
184
184
185 ``alias``
185 ``alias``
186 ---------
186 ---------
187
187
188 Defines command aliases.
188 Defines command aliases.
189 Aliases allow you to define your own commands in terms of other
189 Aliases allow you to define your own commands in terms of other
190 commands (or aliases), optionally including arguments. Positional
190 commands (or aliases), optionally including arguments. Positional
191 arguments in the form of ``$1``, ``$2``, etc in the alias definition
191 arguments in the form of ``$1``, ``$2``, etc in the alias definition
192 are expanded by Mercurial before execution. Positional arguments not
192 are expanded by Mercurial before execution. Positional arguments not
193 already used by ``$N`` in the definition are put at the end of the
193 already used by ``$N`` in the definition are put at the end of the
194 command to be executed.
194 command to be executed.
195
195
196 Alias definitions consist of lines of the form::
196 Alias definitions consist of lines of the form::
197
197
198 <alias> = <command> [<argument>]...
198 <alias> = <command> [<argument>]...
199
199
200 For example, this definition::
200 For example, this definition::
201
201
202 latest = log --limit 5
202 latest = log --limit 5
203
203
204 creates a new command ``latest`` that shows only the five most recent
204 creates a new command ``latest`` that shows only the five most recent
205 changesets. You can define subsequent aliases using earlier ones::
205 changesets. You can define subsequent aliases using earlier ones::
206
206
207 stable5 = latest -b stable
207 stable5 = latest -b stable
208
208
209 .. note::
209 .. note::
210
210
211 It is possible to create aliases with the same names as
211 It is possible to create aliases with the same names as
212 existing commands, which will then override the original
212 existing commands, which will then override the original
213 definitions. This is almost always a bad idea!
213 definitions. This is almost always a bad idea!
214
214
215 An alias can start with an exclamation point (``!``) to make it a
215 An alias can start with an exclamation point (``!``) to make it a
216 shell alias. A shell alias is executed with the shell and will let you
216 shell alias. A shell alias is executed with the shell and will let you
217 run arbitrary commands. As an example, ::
217 run arbitrary commands. As an example, ::
218
218
219 echo = !echo $@
219 echo = !echo $@
220
220
221 will let you do ``hg echo foo`` to have ``foo`` printed in your
221 will let you do ``hg echo foo`` to have ``foo`` printed in your
222 terminal. A better example might be::
222 terminal. A better example might be::
223
223
224 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
224 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
225
225
226 which will make ``hg purge`` delete all unknown files in the
226 which will make ``hg purge`` delete all unknown files in the
227 repository in the same manner as the purge extension.
227 repository in the same manner as the purge extension.
228
228
229 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
229 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
230 expand to the command arguments. Unmatched arguments are
230 expand to the command arguments. Unmatched arguments are
231 removed. ``$0`` expands to the alias name and ``$@`` expands to all
231 removed. ``$0`` expands to the alias name and ``$@`` expands to all
232 arguments separated by a space. ``"$@"`` (with quotes) expands to all
232 arguments separated by a space. ``"$@"`` (with quotes) expands to all
233 arguments quoted individually and separated by a space. These expansions
233 arguments quoted individually and separated by a space. These expansions
234 happen before the command is passed to the shell.
234 happen before the command is passed to the shell.
235
235
236 Shell aliases are executed in an environment where ``$HG`` expands to
236 Shell aliases are executed in an environment where ``$HG`` expands to
237 the path of the Mercurial that was used to execute the alias. This is
237 the path of the Mercurial that was used to execute the alias. This is
238 useful when you want to call further Mercurial commands in a shell
238 useful when you want to call further Mercurial commands in a shell
239 alias, as was done above for the purge alias. In addition,
239 alias, as was done above for the purge alias. In addition,
240 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
240 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
241 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
241 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
242
242
243 .. note::
243 .. note::
244
244
245 Some global configuration options such as ``-R`` are
245 Some global configuration options such as ``-R`` are
246 processed before shell aliases and will thus not be passed to
246 processed before shell aliases and will thus not be passed to
247 aliases.
247 aliases.
248
248
249
249
250 ``annotate``
250 ``annotate``
251 ------------
251 ------------
252
252
253 Settings used when displaying file annotations. All values are
253 Settings used when displaying file annotations. All values are
254 Booleans and default to False. See ``diff`` section for related
254 Booleans and default to False. See ``diff`` section for related
255 options for the diff command.
255 options for the diff command.
256
256
257 ``ignorews``
257 ``ignorews``
258 Ignore white space when comparing lines.
258 Ignore white space when comparing lines.
259
259
260 ``ignorewsamount``
260 ``ignorewsamount``
261 Ignore changes in the amount of white space.
261 Ignore changes in the amount of white space.
262
262
263 ``ignoreblanklines``
263 ``ignoreblanklines``
264 Ignore changes whose lines are all blank.
264 Ignore changes whose lines are all blank.
265
265
266
266
267 ``auth``
267 ``auth``
268 --------
268 --------
269
269
270 Authentication credentials for HTTP authentication. This section
270 Authentication credentials for HTTP authentication. This section
271 allows you to store usernames and passwords for use when logging
271 allows you to store usernames and passwords for use when logging
272 *into* HTTP servers. See the ``[web]`` configuration section if
272 *into* HTTP servers. See the ``[web]`` configuration section if
273 you want to configure *who* can login to your HTTP server.
273 you want to configure *who* can login to your HTTP server.
274
274
275 Each line has the following format::
275 Each line has the following format::
276
276
277 <name>.<argument> = <value>
277 <name>.<argument> = <value>
278
278
279 where ``<name>`` is used to group arguments into authentication
279 where ``<name>`` is used to group arguments into authentication
280 entries. Example::
280 entries. Example::
281
281
282 foo.prefix = hg.intevation.org/mercurial
282 foo.prefix = hg.intevation.org/mercurial
283 foo.username = foo
283 foo.username = foo
284 foo.password = bar
284 foo.password = bar
285 foo.schemes = http https
285 foo.schemes = http https
286
286
287 bar.prefix = secure.example.org
287 bar.prefix = secure.example.org
288 bar.key = path/to/file.key
288 bar.key = path/to/file.key
289 bar.cert = path/to/file.cert
289 bar.cert = path/to/file.cert
290 bar.schemes = https
290 bar.schemes = https
291
291
292 Supported arguments:
292 Supported arguments:
293
293
294 ``prefix``
294 ``prefix``
295 Either ``*`` or a URI prefix with or without the scheme part.
295 Either ``*`` or a URI prefix with or without the scheme part.
296 The authentication entry with the longest matching prefix is used
296 The authentication entry with the longest matching prefix is used
297 (where ``*`` matches everything and counts as a match of length
297 (where ``*`` matches everything and counts as a match of length
298 1). If the prefix doesn't include a scheme, the match is performed
298 1). If the prefix doesn't include a scheme, the match is performed
299 against the URI with its scheme stripped as well, and the schemes
299 against the URI with its scheme stripped as well, and the schemes
300 argument, q.v., is then subsequently consulted.
300 argument, q.v., is then subsequently consulted.
301
301
302 ``username``
302 ``username``
303 Optional. Username to authenticate with. If not given, and the
303 Optional. Username to authenticate with. If not given, and the
304 remote site requires basic or digest authentication, the user will
304 remote site requires basic or digest authentication, the user will
305 be prompted for it. Environment variables are expanded in the
305 be prompted for it. Environment variables are expanded in the
306 username letting you do ``foo.username = $USER``. If the URI
306 username letting you do ``foo.username = $USER``. If the URI
307 includes a username, only ``[auth]`` entries with a matching
307 includes a username, only ``[auth]`` entries with a matching
308 username or without a username will be considered.
308 username or without a username will be considered.
309
309
310 ``password``
310 ``password``
311 Optional. Password to authenticate with. If not given, and the
311 Optional. Password to authenticate with. If not given, and the
312 remote site requires basic or digest authentication, the user
312 remote site requires basic or digest authentication, the user
313 will be prompted for it.
313 will be prompted for it.
314
314
315 ``key``
315 ``key``
316 Optional. PEM encoded client certificate key file. Environment
316 Optional. PEM encoded client certificate key file. Environment
317 variables are expanded in the filename.
317 variables are expanded in the filename.
318
318
319 ``cert``
319 ``cert``
320 Optional. PEM encoded client certificate chain file. Environment
320 Optional. PEM encoded client certificate chain file. Environment
321 variables are expanded in the filename.
321 variables are expanded in the filename.
322
322
323 ``schemes``
323 ``schemes``
324 Optional. Space separated list of URI schemes to use this
324 Optional. Space separated list of URI schemes to use this
325 authentication entry with. Only used if the prefix doesn't include
325 authentication entry with. Only used if the prefix doesn't include
326 a scheme. Supported schemes are http and https. They will match
326 a scheme. Supported schemes are http and https. They will match
327 static-http and static-https respectively, as well.
327 static-http and static-https respectively, as well.
328 Default: https.
328 Default: https.
329
329
330 If no suitable authentication entry is found, the user is prompted
330 If no suitable authentication entry is found, the user is prompted
331 for credentials as usual if required by the remote.
331 for credentials as usual if required by the remote.
332
332
333
333
334 ``committemplate``
334 ``committemplate``
335 ------------------
335 ------------------
336
336
337 ``changeset`` configuration in this section is used as the template to
337 ``changeset`` configuration in this section is used as the template to
338 customize the text shown in the editor when committing.
338 customize the text shown in the editor when committing.
339
339
340 In addition to pre-defined template keywords, commit log specific one
340 In addition to pre-defined template keywords, commit log specific one
341 below can be used for customization:
341 below can be used for customization:
342
342
343 ``extramsg``
343 ``extramsg``
344 String: Extra message (typically 'Leave message empty to abort
344 String: Extra message (typically 'Leave message empty to abort
345 commit.'). This may be changed by some commands or extensions.
345 commit.'). This may be changed by some commands or extensions.
346
346
347 For example, the template configuration below shows as same text as
347 For example, the template configuration below shows as same text as
348 one shown by default::
348 one shown by default::
349
349
350 [committemplate]
350 [committemplate]
351 changeset = {desc}\n\n
351 changeset = {desc}\n\n
352 HG: Enter commit message. Lines beginning with 'HG:' are removed.
352 HG: Enter commit message. Lines beginning with 'HG:' are removed.
353 HG: {extramsg}
353 HG: {extramsg}
354 HG: --
354 HG: --
355 HG: user: {author}\n{ifeq(p2rev, "-1", "",
355 HG: user: {author}\n{ifeq(p2rev, "-1", "",
356 "HG: branch merge\n")
356 "HG: branch merge\n")
357 }HG: branch '{branch}'\n{if(currentbookmark,
357 }HG: branch '{branch}'\n{if(currentbookmark,
358 "HG: bookmark '{currentbookmark}'\n") }{subrepos %
358 "HG: bookmark '{currentbookmark}'\n") }{subrepos %
359 "HG: subrepo {subrepo}\n" }{file_adds %
359 "HG: subrepo {subrepo}\n" }{file_adds %
360 "HG: added {file}\n" }{file_mods %
360 "HG: added {file}\n" }{file_mods %
361 "HG: changed {file}\n" }{file_dels %
361 "HG: changed {file}\n" }{file_dels %
362 "HG: removed {file}\n" }{if(files, "",
362 "HG: removed {file}\n" }{if(files, "",
363 "HG: no files changed\n")}
363 "HG: no files changed\n")}
364
364
365 .. note::
365 .. note::
366
366
367 For some problematic encodings (see :hg:`help win32mbcs` for
367 For some problematic encodings (see :hg:`help win32mbcs` for
368 detail), this customization should be configured carefully, to
368 detail), this customization should be configured carefully, to
369 avoid showing broken characters.
369 avoid showing broken characters.
370
370
371 For example, if multibyte character ending with backslash (0x5c) is
371 For example, if multibyte character ending with backslash (0x5c) is
372 followed by ASCII character 'n' in the customized template,
372 followed by ASCII character 'n' in the customized template,
373 sequence of backslash and 'n' is treated as line-feed unexpectedly
373 sequence of backslash and 'n' is treated as line-feed unexpectedly
374 (and multibyte character is broken, too).
374 (and multibyte character is broken, too).
375
375
376 Customized template is used for commands below (``--edit`` may be
376 Customized template is used for commands below (``--edit`` may be
377 required):
377 required):
378
378
379 - :hg:`backout`
379 - :hg:`backout`
380 - :hg:`commit`
380 - :hg:`commit`
381 - :hg:`fetch` (for merge commit only)
381 - :hg:`fetch` (for merge commit only)
382 - :hg:`graft`
382 - :hg:`graft`
383 - :hg:`histedit`
383 - :hg:`histedit`
384 - :hg:`import`
384 - :hg:`import`
385 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
385 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
386 - :hg:`rebase`
386 - :hg:`rebase`
387 - :hg:`shelve`
387 - :hg:`shelve`
388 - :hg:`sign`
388 - :hg:`sign`
389 - :hg:`tag`
389 - :hg:`tag`
390 - :hg:`transplant`
390 - :hg:`transplant`
391
391
392 Configuring items below instead of ``changeset`` allows showing
392 Configuring items below instead of ``changeset`` allows showing
393 customized message only for specific actions, or showing different
393 customized message only for specific actions, or showing different
394 messages for each actions.
394 messages for each actions.
395
395
396 - ``changeset.backout`` for :hg:`backout`
396 - ``changeset.backout`` for :hg:`backout`
397 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
397 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
398 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
398 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
399 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
399 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
400 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
400 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
401 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
401 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
402 - ``changeset.gpg.sign`` for :hg:`sign`
402 - ``changeset.gpg.sign`` for :hg:`sign`
403 - ``changeset.graft`` for :hg:`graft`
403 - ``changeset.graft`` for :hg:`graft`
404 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
404 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
405 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
405 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
406 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
406 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
407 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
407 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
408 - ``changeset.import.bypass`` for :hg:`import --bypass`
408 - ``changeset.import.bypass`` for :hg:`import --bypass`
409 - ``changeset.import.normal.merge`` for :hg:`import` on merges
409 - ``changeset.import.normal.merge`` for :hg:`import` on merges
410 - ``changeset.import.normal.normal`` for :hg:`import` on other
410 - ``changeset.import.normal.normal`` for :hg:`import` on other
411 - ``changeset.mq.qnew`` for :hg:`qnew`
411 - ``changeset.mq.qnew`` for :hg:`qnew`
412 - ``changeset.mq.qfold`` for :hg:`qfold`
412 - ``changeset.mq.qfold`` for :hg:`qfold`
413 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
413 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
414 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
414 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
415 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
415 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
416 - ``changeset.rebase.normal`` for :hg:`rebase` on other
416 - ``changeset.rebase.normal`` for :hg:`rebase` on other
417 - ``changeset.shelve.shelve`` for :hg:`shelve`
417 - ``changeset.shelve.shelve`` for :hg:`shelve`
418 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
418 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
419 - ``changeset.tag.remove`` for :hg:`tag --remove`
419 - ``changeset.tag.remove`` for :hg:`tag --remove`
420 - ``changeset.transplant`` for :hg:`transplant`
420 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
421 - ``changeset.transplant.normal`` for :hg:`transplant` on other
421
422
422 These dot-separated lists of names are treated as hierarchical ones.
423 These dot-separated lists of names are treated as hierarchical ones.
423 For example, ``changeset.tag.remove`` customizes the commit message
424 For example, ``changeset.tag.remove`` customizes the commit message
424 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
425 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
425 commit message for :hg:`tag` regardless of ``--remove`` option.
426 commit message for :hg:`tag` regardless of ``--remove`` option.
426
427
427 At the external editor invocation for committing, corresponding
428 At the external editor invocation for committing, corresponding
428 dot-separated list of names without ``changeset.`` prefix
429 dot-separated list of names without ``changeset.`` prefix
429 (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable.
430 (e.g. ``commit.normal.normal``) is in ``HGEDITFORM`` environment variable.
430
431
431 In this section, items other than ``changeset`` can be referred from
432 In this section, items other than ``changeset`` can be referred from
432 others. For example, the configuration to list committed files up
433 others. For example, the configuration to list committed files up
433 below can be referred as ``{listupfiles}``::
434 below can be referred as ``{listupfiles}``::
434
435
435 [committemplate]
436 [committemplate]
436 listupfiles = {file_adds %
437 listupfiles = {file_adds %
437 "HG: added {file}\n" }{file_mods %
438 "HG: added {file}\n" }{file_mods %
438 "HG: changed {file}\n" }{file_dels %
439 "HG: changed {file}\n" }{file_dels %
439 "HG: removed {file}\n" }{if(files, "",
440 "HG: removed {file}\n" }{if(files, "",
440 "HG: no files changed\n")}
441 "HG: no files changed\n")}
441
442
442 ``decode/encode``
443 ``decode/encode``
443 -----------------
444 -----------------
444
445
445 Filters for transforming files on checkout/checkin. This would
446 Filters for transforming files on checkout/checkin. This would
446 typically be used for newline processing or other
447 typically be used for newline processing or other
447 localization/canonicalization of files.
448 localization/canonicalization of files.
448
449
449 Filters consist of a filter pattern followed by a filter command.
450 Filters consist of a filter pattern followed by a filter command.
450 Filter patterns are globs by default, rooted at the repository root.
451 Filter patterns are globs by default, rooted at the repository root.
451 For example, to match any file ending in ``.txt`` in the root
452 For example, to match any file ending in ``.txt`` in the root
452 directory only, use the pattern ``*.txt``. To match any file ending
453 directory only, use the pattern ``*.txt``. To match any file ending
453 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
454 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
454 For each file only the first matching filter applies.
455 For each file only the first matching filter applies.
455
456
456 The filter command can start with a specifier, either ``pipe:`` or
457 The filter command can start with a specifier, either ``pipe:`` or
457 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
458 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
458
459
459 A ``pipe:`` command must accept data on stdin and return the transformed
460 A ``pipe:`` command must accept data on stdin and return the transformed
460 data on stdout.
461 data on stdout.
461
462
462 Pipe example::
463 Pipe example::
463
464
464 [encode]
465 [encode]
465 # uncompress gzip files on checkin to improve delta compression
466 # uncompress gzip files on checkin to improve delta compression
466 # note: not necessarily a good idea, just an example
467 # note: not necessarily a good idea, just an example
467 *.gz = pipe: gunzip
468 *.gz = pipe: gunzip
468
469
469 [decode]
470 [decode]
470 # recompress gzip files when writing them to the working dir (we
471 # recompress gzip files when writing them to the working dir (we
471 # can safely omit "pipe:", because it's the default)
472 # can safely omit "pipe:", because it's the default)
472 *.gz = gzip
473 *.gz = gzip
473
474
474 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
475 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
475 with the name of a temporary file that contains the data to be
476 with the name of a temporary file that contains the data to be
476 filtered by the command. The string ``OUTFILE`` is replaced with the name
477 filtered by the command. The string ``OUTFILE`` is replaced with the name
477 of an empty temporary file, where the filtered data must be written by
478 of an empty temporary file, where the filtered data must be written by
478 the command.
479 the command.
479
480
480 .. note::
481 .. note::
481
482
482 The tempfile mechanism is recommended for Windows systems,
483 The tempfile mechanism is recommended for Windows systems,
483 where the standard shell I/O redirection operators often have
484 where the standard shell I/O redirection operators often have
484 strange effects and may corrupt the contents of your files.
485 strange effects and may corrupt the contents of your files.
485
486
486 This filter mechanism is used internally by the ``eol`` extension to
487 This filter mechanism is used internally by the ``eol`` extension to
487 translate line ending characters between Windows (CRLF) and Unix (LF)
488 translate line ending characters between Windows (CRLF) and Unix (LF)
488 format. We suggest you use the ``eol`` extension for convenience.
489 format. We suggest you use the ``eol`` extension for convenience.
489
490
490
491
491 ``defaults``
492 ``defaults``
492 ------------
493 ------------
493
494
494 (defaults are deprecated. Don't use them. Use aliases instead)
495 (defaults are deprecated. Don't use them. Use aliases instead)
495
496
496 Use the ``[defaults]`` section to define command defaults, i.e. the
497 Use the ``[defaults]`` section to define command defaults, i.e. the
497 default options/arguments to pass to the specified commands.
498 default options/arguments to pass to the specified commands.
498
499
499 The following example makes :hg:`log` run in verbose mode, and
500 The following example makes :hg:`log` run in verbose mode, and
500 :hg:`status` show only the modified files, by default::
501 :hg:`status` show only the modified files, by default::
501
502
502 [defaults]
503 [defaults]
503 log = -v
504 log = -v
504 status = -m
505 status = -m
505
506
506 The actual commands, instead of their aliases, must be used when
507 The actual commands, instead of their aliases, must be used when
507 defining command defaults. The command defaults will also be applied
508 defining command defaults. The command defaults will also be applied
508 to the aliases of the commands defined.
509 to the aliases of the commands defined.
509
510
510
511
511 ``diff``
512 ``diff``
512 --------
513 --------
513
514
514 Settings used when displaying diffs. Everything except for ``unified``
515 Settings used when displaying diffs. Everything except for ``unified``
515 is a Boolean and defaults to False. See ``annotate`` section for
516 is a Boolean and defaults to False. See ``annotate`` section for
516 related options for the annotate command.
517 related options for the annotate command.
517
518
518 ``git``
519 ``git``
519 Use git extended diff format.
520 Use git extended diff format.
520
521
521 ``nodates``
522 ``nodates``
522 Don't include dates in diff headers.
523 Don't include dates in diff headers.
523
524
524 ``showfunc``
525 ``showfunc``
525 Show which function each change is in.
526 Show which function each change is in.
526
527
527 ``ignorews``
528 ``ignorews``
528 Ignore white space when comparing lines.
529 Ignore white space when comparing lines.
529
530
530 ``ignorewsamount``
531 ``ignorewsamount``
531 Ignore changes in the amount of white space.
532 Ignore changes in the amount of white space.
532
533
533 ``ignoreblanklines``
534 ``ignoreblanklines``
534 Ignore changes whose lines are all blank.
535 Ignore changes whose lines are all blank.
535
536
536 ``unified``
537 ``unified``
537 Number of lines of context to show.
538 Number of lines of context to show.
538
539
539 ``email``
540 ``email``
540 ---------
541 ---------
541
542
542 Settings for extensions that send email messages.
543 Settings for extensions that send email messages.
543
544
544 ``from``
545 ``from``
545 Optional. Email address to use in "From" header and SMTP envelope
546 Optional. Email address to use in "From" header and SMTP envelope
546 of outgoing messages.
547 of outgoing messages.
547
548
548 ``to``
549 ``to``
549 Optional. Comma-separated list of recipients' email addresses.
550 Optional. Comma-separated list of recipients' email addresses.
550
551
551 ``cc``
552 ``cc``
552 Optional. Comma-separated list of carbon copy recipients'
553 Optional. Comma-separated list of carbon copy recipients'
553 email addresses.
554 email addresses.
554
555
555 ``bcc``
556 ``bcc``
556 Optional. Comma-separated list of blind carbon copy recipients'
557 Optional. Comma-separated list of blind carbon copy recipients'
557 email addresses.
558 email addresses.
558
559
559 ``method``
560 ``method``
560 Optional. Method to use to send email messages. If value is ``smtp``
561 Optional. Method to use to send email messages. If value is ``smtp``
561 (default), use SMTP (see the ``[smtp]`` section for configuration).
562 (default), use SMTP (see the ``[smtp]`` section for configuration).
562 Otherwise, use as name of program to run that acts like sendmail
563 Otherwise, use as name of program to run that acts like sendmail
563 (takes ``-f`` option for sender, list of recipients on command line,
564 (takes ``-f`` option for sender, list of recipients on command line,
564 message on stdin). Normally, setting this to ``sendmail`` or
565 message on stdin). Normally, setting this to ``sendmail`` or
565 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
566 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
566
567
567 ``charsets``
568 ``charsets``
568 Optional. Comma-separated list of character sets considered
569 Optional. Comma-separated list of character sets considered
569 convenient for recipients. Addresses, headers, and parts not
570 convenient for recipients. Addresses, headers, and parts not
570 containing patches of outgoing messages will be encoded in the
571 containing patches of outgoing messages will be encoded in the
571 first character set to which conversion from local encoding
572 first character set to which conversion from local encoding
572 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
573 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
573 conversion fails, the text in question is sent as is. Defaults to
574 conversion fails, the text in question is sent as is. Defaults to
574 empty (explicit) list.
575 empty (explicit) list.
575
576
576 Order of outgoing email character sets:
577 Order of outgoing email character sets:
577
578
578 1. ``us-ascii``: always first, regardless of settings
579 1. ``us-ascii``: always first, regardless of settings
579 2. ``email.charsets``: in order given by user
580 2. ``email.charsets``: in order given by user
580 3. ``ui.fallbackencoding``: if not in email.charsets
581 3. ``ui.fallbackencoding``: if not in email.charsets
581 4. ``$HGENCODING``: if not in email.charsets
582 4. ``$HGENCODING``: if not in email.charsets
582 5. ``utf-8``: always last, regardless of settings
583 5. ``utf-8``: always last, regardless of settings
583
584
584 Email example::
585 Email example::
585
586
586 [email]
587 [email]
587 from = Joseph User <joe.user@example.com>
588 from = Joseph User <joe.user@example.com>
588 method = /usr/sbin/sendmail
589 method = /usr/sbin/sendmail
589 # charsets for western Europeans
590 # charsets for western Europeans
590 # us-ascii, utf-8 omitted, as they are tried first and last
591 # us-ascii, utf-8 omitted, as they are tried first and last
591 charsets = iso-8859-1, iso-8859-15, windows-1252
592 charsets = iso-8859-1, iso-8859-15, windows-1252
592
593
593
594
594 ``extensions``
595 ``extensions``
595 --------------
596 --------------
596
597
597 Mercurial has an extension mechanism for adding new features. To
598 Mercurial has an extension mechanism for adding new features. To
598 enable an extension, create an entry for it in this section.
599 enable an extension, create an entry for it in this section.
599
600
600 If you know that the extension is already in Python's search path,
601 If you know that the extension is already in Python's search path,
601 you can give the name of the module, followed by ``=``, with nothing
602 you can give the name of the module, followed by ``=``, with nothing
602 after the ``=``.
603 after the ``=``.
603
604
604 Otherwise, give a name that you choose, followed by ``=``, followed by
605 Otherwise, give a name that you choose, followed by ``=``, followed by
605 the path to the ``.py`` file (including the file name extension) that
606 the path to the ``.py`` file (including the file name extension) that
606 defines the extension.
607 defines the extension.
607
608
608 To explicitly disable an extension that is enabled in an hgrc of
609 To explicitly disable an extension that is enabled in an hgrc of
609 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
610 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
610 or ``foo = !`` when path is not supplied.
611 or ``foo = !`` when path is not supplied.
611
612
612 Example for ``~/.hgrc``::
613 Example for ``~/.hgrc``::
613
614
614 [extensions]
615 [extensions]
615 # (the progress extension will get loaded from Mercurial's path)
616 # (the progress extension will get loaded from Mercurial's path)
616 progress =
617 progress =
617 # (this extension will get loaded from the file specified)
618 # (this extension will get loaded from the file specified)
618 myfeature = ~/.hgext/myfeature.py
619 myfeature = ~/.hgext/myfeature.py
619
620
620
621
621 ``format``
622 ``format``
622 ----------
623 ----------
623
624
624 ``usestore``
625 ``usestore``
625 Enable or disable the "store" repository format which improves
626 Enable or disable the "store" repository format which improves
626 compatibility with systems that fold case or otherwise mangle
627 compatibility with systems that fold case or otherwise mangle
627 filenames. Enabled by default. Disabling this option will allow
628 filenames. Enabled by default. Disabling this option will allow
628 you to store longer filenames in some situations at the expense of
629 you to store longer filenames in some situations at the expense of
629 compatibility and ensures that the on-disk format of newly created
630 compatibility and ensures that the on-disk format of newly created
630 repositories will be compatible with Mercurial before version 0.9.4.
631 repositories will be compatible with Mercurial before version 0.9.4.
631
632
632 ``usefncache``
633 ``usefncache``
633 Enable or disable the "fncache" repository format which enhances
634 Enable or disable the "fncache" repository format which enhances
634 the "store" repository format (which has to be enabled to use
635 the "store" repository format (which has to be enabled to use
635 fncache) to allow longer filenames and avoids using Windows
636 fncache) to allow longer filenames and avoids using Windows
636 reserved names, e.g. "nul". Enabled by default. Disabling this
637 reserved names, e.g. "nul". Enabled by default. Disabling this
637 option ensures that the on-disk format of newly created
638 option ensures that the on-disk format of newly created
638 repositories will be compatible with Mercurial before version 1.1.
639 repositories will be compatible with Mercurial before version 1.1.
639
640
640 ``dotencode``
641 ``dotencode``
641 Enable or disable the "dotencode" repository format which enhances
642 Enable or disable the "dotencode" repository format which enhances
642 the "fncache" repository format (which has to be enabled to use
643 the "fncache" repository format (which has to be enabled to use
643 dotencode) to avoid issues with filenames starting with ._ on
644 dotencode) to avoid issues with filenames starting with ._ on
644 Mac OS X and spaces on Windows. Enabled by default. Disabling this
645 Mac OS X and spaces on Windows. Enabled by default. Disabling this
645 option ensures that the on-disk format of newly created
646 option ensures that the on-disk format of newly created
646 repositories will be compatible with Mercurial before version 1.7.
647 repositories will be compatible with Mercurial before version 1.7.
647
648
648 ``graph``
649 ``graph``
649 ---------
650 ---------
650
651
651 Web graph view configuration. This section let you change graph
652 Web graph view configuration. This section let you change graph
652 elements display properties by branches, for instance to make the
653 elements display properties by branches, for instance to make the
653 ``default`` branch stand out.
654 ``default`` branch stand out.
654
655
655 Each line has the following format::
656 Each line has the following format::
656
657
657 <branch>.<argument> = <value>
658 <branch>.<argument> = <value>
658
659
659 where ``<branch>`` is the name of the branch being
660 where ``<branch>`` is the name of the branch being
660 customized. Example::
661 customized. Example::
661
662
662 [graph]
663 [graph]
663 # 2px width
664 # 2px width
664 default.width = 2
665 default.width = 2
665 # red color
666 # red color
666 default.color = FF0000
667 default.color = FF0000
667
668
668 Supported arguments:
669 Supported arguments:
669
670
670 ``width``
671 ``width``
671 Set branch edges width in pixels.
672 Set branch edges width in pixels.
672
673
673 ``color``
674 ``color``
674 Set branch edges color in hexadecimal RGB notation.
675 Set branch edges color in hexadecimal RGB notation.
675
676
676 ``hooks``
677 ``hooks``
677 ---------
678 ---------
678
679
679 Commands or Python functions that get automatically executed by
680 Commands or Python functions that get automatically executed by
680 various actions such as starting or finishing a commit. Multiple
681 various actions such as starting or finishing a commit. Multiple
681 hooks can be run for the same action by appending a suffix to the
682 hooks can be run for the same action by appending a suffix to the
682 action. Overriding a site-wide hook can be done by changing its
683 action. Overriding a site-wide hook can be done by changing its
683 value or setting it to an empty string. Hooks can be prioritized
684 value or setting it to an empty string. Hooks can be prioritized
684 by adding a prefix of ``priority`` to the hook name on a new line
685 by adding a prefix of ``priority`` to the hook name on a new line
685 and setting the priority. The default priority is 0 if
686 and setting the priority. The default priority is 0 if
686 not specified.
687 not specified.
687
688
688 Example ``.hg/hgrc``::
689 Example ``.hg/hgrc``::
689
690
690 [hooks]
691 [hooks]
691 # update working directory after adding changesets
692 # update working directory after adding changesets
692 changegroup.update = hg update
693 changegroup.update = hg update
693 # do not use the site-wide hook
694 # do not use the site-wide hook
694 incoming =
695 incoming =
695 incoming.email = /my/email/hook
696 incoming.email = /my/email/hook
696 incoming.autobuild = /my/build/hook
697 incoming.autobuild = /my/build/hook
697 # force autobuild hook to run before other incoming hooks
698 # force autobuild hook to run before other incoming hooks
698 priority.incoming.autobuild = 1
699 priority.incoming.autobuild = 1
699
700
700 Most hooks are run with environment variables set that give useful
701 Most hooks are run with environment variables set that give useful
701 additional information. For each hook below, the environment
702 additional information. For each hook below, the environment
702 variables it is passed are listed with names of the form ``$HG_foo``.
703 variables it is passed are listed with names of the form ``$HG_foo``.
703
704
704 ``changegroup``
705 ``changegroup``
705 Run after a changegroup has been added via push, pull or unbundle.
706 Run after a changegroup has been added via push, pull or unbundle.
706 ID of the first new changeset is in ``$HG_NODE``. URL from which
707 ID of the first new changeset is in ``$HG_NODE``. URL from which
707 changes came is in ``$HG_URL``.
708 changes came is in ``$HG_URL``.
708
709
709 ``commit``
710 ``commit``
710 Run after a changeset has been created in the local repository. ID
711 Run after a changeset has been created in the local repository. ID
711 of the newly created changeset is in ``$HG_NODE``. Parent changeset
712 of the newly created changeset is in ``$HG_NODE``. Parent changeset
712 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
713 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
713
714
714 ``incoming``
715 ``incoming``
715 Run after a changeset has been pulled, pushed, or unbundled into
716 Run after a changeset has been pulled, pushed, or unbundled into
716 the local repository. The ID of the newly arrived changeset is in
717 the local repository. The ID of the newly arrived changeset is in
717 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
718 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
718
719
719 ``outgoing``
720 ``outgoing``
720 Run after sending changes from local repository to another. ID of
721 Run after sending changes from local repository to another. ID of
721 first changeset sent is in ``$HG_NODE``. Source of operation is in
722 first changeset sent is in ``$HG_NODE``. Source of operation is in
722 ``$HG_SOURCE``; see "preoutgoing" hook for description.
723 ``$HG_SOURCE``; see "preoutgoing" hook for description.
723
724
724 ``post-<command>``
725 ``post-<command>``
725 Run after successful invocations of the associated command. The
726 Run after successful invocations of the associated command. The
726 contents of the command line are passed as ``$HG_ARGS`` and the result
727 contents of the command line are passed as ``$HG_ARGS`` and the result
727 code in ``$HG_RESULT``. Parsed command line arguments are passed as
728 code in ``$HG_RESULT``. Parsed command line arguments are passed as
728 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
729 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
729 the python data internally passed to <command>. ``$HG_OPTS`` is a
730 the python data internally passed to <command>. ``$HG_OPTS`` is a
730 dictionary of options (with unspecified options set to their defaults).
731 dictionary of options (with unspecified options set to their defaults).
731 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
732 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
732
733
733 ``pre-<command>``
734 ``pre-<command>``
734 Run before executing the associated command. The contents of the
735 Run before executing the associated command. The contents of the
735 command line are passed as ``$HG_ARGS``. Parsed command line arguments
736 command line are passed as ``$HG_ARGS``. Parsed command line arguments
736 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
737 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
737 representations of the data internally passed to <command>. ``$HG_OPTS``
738 representations of the data internally passed to <command>. ``$HG_OPTS``
738 is a dictionary of options (with unspecified options set to their
739 is a dictionary of options (with unspecified options set to their
739 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
740 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
740 failure, the command doesn't execute and Mercurial returns the failure
741 failure, the command doesn't execute and Mercurial returns the failure
741 code.
742 code.
742
743
743 ``prechangegroup``
744 ``prechangegroup``
744 Run before a changegroup is added via push, pull or unbundle. Exit
745 Run before a changegroup is added via push, pull or unbundle. Exit
745 status 0 allows the changegroup to proceed. Non-zero status will
746 status 0 allows the changegroup to proceed. Non-zero status will
746 cause the push, pull or unbundle to fail. URL from which changes
747 cause the push, pull or unbundle to fail. URL from which changes
747 will come is in ``$HG_URL``.
748 will come is in ``$HG_URL``.
748
749
749 ``precommit``
750 ``precommit``
750 Run before starting a local commit. Exit status 0 allows the
751 Run before starting a local commit. Exit status 0 allows the
751 commit to proceed. Non-zero status will cause the commit to fail.
752 commit to proceed. Non-zero status will cause the commit to fail.
752 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
753 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
753
754
754 ``prelistkeys``
755 ``prelistkeys``
755 Run before listing pushkeys (like bookmarks) in the
756 Run before listing pushkeys (like bookmarks) in the
756 repository. Non-zero status will cause failure. The key namespace is
757 repository. Non-zero status will cause failure. The key namespace is
757 in ``$HG_NAMESPACE``.
758 in ``$HG_NAMESPACE``.
758
759
759 ``preoutgoing``
760 ``preoutgoing``
760 Run before collecting changes to send from the local repository to
761 Run before collecting changes to send from the local repository to
761 another. Non-zero status will cause failure. This lets you prevent
762 another. Non-zero status will cause failure. This lets you prevent
762 pull over HTTP or SSH. Also prevents against local pull, push
763 pull over HTTP or SSH. Also prevents against local pull, push
763 (outbound) or bundle commands, but not effective, since you can
764 (outbound) or bundle commands, but not effective, since you can
764 just copy files instead then. Source of operation is in
765 just copy files instead then. Source of operation is in
765 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
766 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
766 SSH or HTTP repository. If "push", "pull" or "bundle", operation
767 SSH or HTTP repository. If "push", "pull" or "bundle", operation
767 is happening on behalf of repository on same system.
768 is happening on behalf of repository on same system.
768
769
769 ``prepushkey``
770 ``prepushkey``
770 Run before a pushkey (like a bookmark) is added to the
771 Run before a pushkey (like a bookmark) is added to the
771 repository. Non-zero status will cause the key to be rejected. The
772 repository. Non-zero status will cause the key to be rejected. The
772 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
773 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
773 the old value (if any) is in ``$HG_OLD``, and the new value is in
774 the old value (if any) is in ``$HG_OLD``, and the new value is in
774 ``$HG_NEW``.
775 ``$HG_NEW``.
775
776
776 ``pretag``
777 ``pretag``
777 Run before creating a tag. Exit status 0 allows the tag to be
778 Run before creating a tag. Exit status 0 allows the tag to be
778 created. Non-zero status will cause the tag to fail. ID of
779 created. Non-zero status will cause the tag to fail. ID of
779 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
780 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
780 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
781 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
781
782
782 ``pretxnchangegroup``
783 ``pretxnchangegroup``
783 Run after a changegroup has been added via push, pull or unbundle,
784 Run after a changegroup has been added via push, pull or unbundle,
784 but before the transaction has been committed. Changegroup is
785 but before the transaction has been committed. Changegroup is
785 visible to hook program. This lets you validate incoming changes
786 visible to hook program. This lets you validate incoming changes
786 before accepting them. Passed the ID of the first new changeset in
787 before accepting them. Passed the ID of the first new changeset in
787 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
788 ``$HG_NODE``. Exit status 0 allows the transaction to commit. Non-zero
788 status will cause the transaction to be rolled back and the push,
789 status will cause the transaction to be rolled back and the push,
789 pull or unbundle will fail. URL that was source of changes is in
790 pull or unbundle will fail. URL that was source of changes is in
790 ``$HG_URL``.
791 ``$HG_URL``.
791
792
792 ``pretxncommit``
793 ``pretxncommit``
793 Run after a changeset has been created but the transaction not yet
794 Run after a changeset has been created but the transaction not yet
794 committed. Changeset is visible to hook program. This lets you
795 committed. Changeset is visible to hook program. This lets you
795 validate commit message and changes. Exit status 0 allows the
796 validate commit message and changes. Exit status 0 allows the
796 commit to proceed. Non-zero status will cause the transaction to
797 commit to proceed. Non-zero status will cause the transaction to
797 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
798 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
798 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
799 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
799
800
800 ``preupdate``
801 ``preupdate``
801 Run before updating the working directory. Exit status 0 allows
802 Run before updating the working directory. Exit status 0 allows
802 the update to proceed. Non-zero status will prevent the update.
803 the update to proceed. Non-zero status will prevent the update.
803 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
804 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
804 of second new parent is in ``$HG_PARENT2``.
805 of second new parent is in ``$HG_PARENT2``.
805
806
806 ``listkeys``
807 ``listkeys``
807 Run after listing pushkeys (like bookmarks) in the repository. The
808 Run after listing pushkeys (like bookmarks) in the repository. The
808 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
809 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
809 dictionary containing the keys and values.
810 dictionary containing the keys and values.
810
811
811 ``pushkey``
812 ``pushkey``
812 Run after a pushkey (like a bookmark) is added to the
813 Run after a pushkey (like a bookmark) is added to the
813 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
814 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
814 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
815 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
815 value is in ``$HG_NEW``.
816 value is in ``$HG_NEW``.
816
817
817 ``tag``
818 ``tag``
818 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
819 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
819 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
820 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
820 repository if ``$HG_LOCAL=0``.
821 repository if ``$HG_LOCAL=0``.
821
822
822 ``update``
823 ``update``
823 Run after updating the working directory. Changeset ID of first
824 Run after updating the working directory. Changeset ID of first
824 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
825 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
825 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
826 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
826 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
827 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
827
828
828 .. note::
829 .. note::
829
830
830 It is generally better to use standard hooks rather than the
831 It is generally better to use standard hooks rather than the
831 generic pre- and post- command hooks as they are guaranteed to be
832 generic pre- and post- command hooks as they are guaranteed to be
832 called in the appropriate contexts for influencing transactions.
833 called in the appropriate contexts for influencing transactions.
833 Also, hooks like "commit" will be called in all contexts that
834 Also, hooks like "commit" will be called in all contexts that
834 generate a commit (e.g. tag) and not just the commit command.
835 generate a commit (e.g. tag) and not just the commit command.
835
836
836 .. note::
837 .. note::
837
838
838 Environment variables with empty values may not be passed to
839 Environment variables with empty values may not be passed to
839 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
840 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
840 will have an empty value under Unix-like platforms for non-merge
841 will have an empty value under Unix-like platforms for non-merge
841 changesets, while it will not be available at all under Windows.
842 changesets, while it will not be available at all under Windows.
842
843
843 The syntax for Python hooks is as follows::
844 The syntax for Python hooks is as follows::
844
845
845 hookname = python:modulename.submodule.callable
846 hookname = python:modulename.submodule.callable
846 hookname = python:/path/to/python/module.py:callable
847 hookname = python:/path/to/python/module.py:callable
847
848
848 Python hooks are run within the Mercurial process. Each hook is
849 Python hooks are run within the Mercurial process. Each hook is
849 called with at least three keyword arguments: a ui object (keyword
850 called with at least three keyword arguments: a ui object (keyword
850 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
851 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
851 keyword that tells what kind of hook is used. Arguments listed as
852 keyword that tells what kind of hook is used. Arguments listed as
852 environment variables above are passed as keyword arguments, with no
853 environment variables above are passed as keyword arguments, with no
853 ``HG_`` prefix, and names in lower case.
854 ``HG_`` prefix, and names in lower case.
854
855
855 If a Python hook returns a "true" value or raises an exception, this
856 If a Python hook returns a "true" value or raises an exception, this
856 is treated as a failure.
857 is treated as a failure.
857
858
858
859
859 ``hostfingerprints``
860 ``hostfingerprints``
860 --------------------
861 --------------------
861
862
862 Fingerprints of the certificates of known HTTPS servers.
863 Fingerprints of the certificates of known HTTPS servers.
863 A HTTPS connection to a server with a fingerprint configured here will
864 A HTTPS connection to a server with a fingerprint configured here will
864 only succeed if the servers certificate matches the fingerprint.
865 only succeed if the servers certificate matches the fingerprint.
865 This is very similar to how ssh known hosts works.
866 This is very similar to how ssh known hosts works.
866 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
867 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
867 The CA chain and web.cacerts is not used for servers with a fingerprint.
868 The CA chain and web.cacerts is not used for servers with a fingerprint.
868
869
869 For example::
870 For example::
870
871
871 [hostfingerprints]
872 [hostfingerprints]
872 hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0
873 hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0
873
874
874 This feature is only supported when using Python 2.6 or later.
875 This feature is only supported when using Python 2.6 or later.
875
876
876
877
877 ``http_proxy``
878 ``http_proxy``
878 --------------
879 --------------
879
880
880 Used to access web-based Mercurial repositories through a HTTP
881 Used to access web-based Mercurial repositories through a HTTP
881 proxy.
882 proxy.
882
883
883 ``host``
884 ``host``
884 Host name and (optional) port of the proxy server, for example
885 Host name and (optional) port of the proxy server, for example
885 "myproxy:8000".
886 "myproxy:8000".
886
887
887 ``no``
888 ``no``
888 Optional. Comma-separated list of host names that should bypass
889 Optional. Comma-separated list of host names that should bypass
889 the proxy.
890 the proxy.
890
891
891 ``passwd``
892 ``passwd``
892 Optional. Password to authenticate with at the proxy server.
893 Optional. Password to authenticate with at the proxy server.
893
894
894 ``user``
895 ``user``
895 Optional. User name to authenticate with at the proxy server.
896 Optional. User name to authenticate with at the proxy server.
896
897
897 ``always``
898 ``always``
898 Optional. Always use the proxy, even for localhost and any entries
899 Optional. Always use the proxy, even for localhost and any entries
899 in ``http_proxy.no``. True or False. Default: False.
900 in ``http_proxy.no``. True or False. Default: False.
900
901
901 ``merge-patterns``
902 ``merge-patterns``
902 ------------------
903 ------------------
903
904
904 This section specifies merge tools to associate with particular file
905 This section specifies merge tools to associate with particular file
905 patterns. Tools matched here will take precedence over the default
906 patterns. Tools matched here will take precedence over the default
906 merge tool. Patterns are globs by default, rooted at the repository
907 merge tool. Patterns are globs by default, rooted at the repository
907 root.
908 root.
908
909
909 Example::
910 Example::
910
911
911 [merge-patterns]
912 [merge-patterns]
912 **.c = kdiff3
913 **.c = kdiff3
913 **.jpg = myimgmerge
914 **.jpg = myimgmerge
914
915
915 ``merge-tools``
916 ``merge-tools``
916 ---------------
917 ---------------
917
918
918 This section configures external merge tools to use for file-level
919 This section configures external merge tools to use for file-level
919 merges. This section has likely been preconfigured at install time.
920 merges. This section has likely been preconfigured at install time.
920 Use :hg:`config merge-tools` to check the existing configuration.
921 Use :hg:`config merge-tools` to check the existing configuration.
921 Also see :hg:`help merge-tools` for more details.
922 Also see :hg:`help merge-tools` for more details.
922
923
923 Example ``~/.hgrc``::
924 Example ``~/.hgrc``::
924
925
925 [merge-tools]
926 [merge-tools]
926 # Override stock tool location
927 # Override stock tool location
927 kdiff3.executable = ~/bin/kdiff3
928 kdiff3.executable = ~/bin/kdiff3
928 # Specify command line
929 # Specify command line
929 kdiff3.args = $base $local $other -o $output
930 kdiff3.args = $base $local $other -o $output
930 # Give higher priority
931 # Give higher priority
931 kdiff3.priority = 1
932 kdiff3.priority = 1
932
933
933 # Changing the priority of preconfigured tool
934 # Changing the priority of preconfigured tool
934 vimdiff.priority = 0
935 vimdiff.priority = 0
935
936
936 # Define new tool
937 # Define new tool
937 myHtmlTool.args = -m $local $other $base $output
938 myHtmlTool.args = -m $local $other $base $output
938 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
939 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
939 myHtmlTool.priority = 1
940 myHtmlTool.priority = 1
940
941
941 Supported arguments:
942 Supported arguments:
942
943
943 ``priority``
944 ``priority``
944 The priority in which to evaluate this tool.
945 The priority in which to evaluate this tool.
945 Default: 0.
946 Default: 0.
946
947
947 ``executable``
948 ``executable``
948 Either just the name of the executable or its pathname. On Windows,
949 Either just the name of the executable or its pathname. On Windows,
949 the path can use environment variables with ${ProgramFiles} syntax.
950 the path can use environment variables with ${ProgramFiles} syntax.
950 Default: the tool name.
951 Default: the tool name.
951
952
952 ``args``
953 ``args``
953 The arguments to pass to the tool executable. You can refer to the
954 The arguments to pass to the tool executable. You can refer to the
954 files being merged as well as the output file through these
955 files being merged as well as the output file through these
955 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
956 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
956 of ``$local`` and ``$other`` can vary depending on which action is being
957 of ``$local`` and ``$other`` can vary depending on which action is being
957 performed. During and update or merge, ``$local`` represents the original
958 performed. During and update or merge, ``$local`` represents the original
958 state of the file, while ``$other`` represents the commit you are updating
959 state of the file, while ``$other`` represents the commit you are updating
959 to or the commit you are merging with. During a rebase ``$local``
960 to or the commit you are merging with. During a rebase ``$local``
960 represents the destination of the rebase, and ``$other`` represents the
961 represents the destination of the rebase, and ``$other`` represents the
961 commit being rebased.
962 commit being rebased.
962 Default: ``$local $base $other``
963 Default: ``$local $base $other``
963
964
964 ``premerge``
965 ``premerge``
965 Attempt to run internal non-interactive 3-way merge tool before
966 Attempt to run internal non-interactive 3-way merge tool before
966 launching external tool. Options are ``true``, ``false``, ``keep`` or
967 launching external tool. Options are ``true``, ``false``, ``keep`` or
967 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
968 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
968 premerge fails. The ``keep-merge3`` will do the same but include information
969 premerge fails. The ``keep-merge3`` will do the same but include information
969 about the base of the merge in the marker (see internal:merge3).
970 about the base of the merge in the marker (see internal:merge3).
970 Default: True
971 Default: True
971
972
972 ``binary``
973 ``binary``
973 This tool can merge binary files. Defaults to False, unless tool
974 This tool can merge binary files. Defaults to False, unless tool
974 was selected by file pattern match.
975 was selected by file pattern match.
975
976
976 ``symlink``
977 ``symlink``
977 This tool can merge symlinks. Defaults to False, even if tool was
978 This tool can merge symlinks. Defaults to False, even if tool was
978 selected by file pattern match.
979 selected by file pattern match.
979
980
980 ``check``
981 ``check``
981 A list of merge success-checking options:
982 A list of merge success-checking options:
982
983
983 ``changed``
984 ``changed``
984 Ask whether merge was successful when the merged file shows no changes.
985 Ask whether merge was successful when the merged file shows no changes.
985 ``conflicts``
986 ``conflicts``
986 Check whether there are conflicts even though the tool reported success.
987 Check whether there are conflicts even though the tool reported success.
987 ``prompt``
988 ``prompt``
988 Always prompt for merge success, regardless of success reported by tool.
989 Always prompt for merge success, regardless of success reported by tool.
989
990
990 ``fixeol``
991 ``fixeol``
991 Attempt to fix up EOL changes caused by the merge tool.
992 Attempt to fix up EOL changes caused by the merge tool.
992 Default: False
993 Default: False
993
994
994 ``gui``
995 ``gui``
995 This tool requires a graphical interface to run. Default: False
996 This tool requires a graphical interface to run. Default: False
996
997
997 ``regkey``
998 ``regkey``
998 Windows registry key which describes install location of this
999 Windows registry key which describes install location of this
999 tool. Mercurial will search for this key first under
1000 tool. Mercurial will search for this key first under
1000 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1001 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1001 Default: None
1002 Default: None
1002
1003
1003 ``regkeyalt``
1004 ``regkeyalt``
1004 An alternate Windows registry key to try if the first key is not
1005 An alternate Windows registry key to try if the first key is not
1005 found. The alternate key uses the same ``regname`` and ``regappend``
1006 found. The alternate key uses the same ``regname`` and ``regappend``
1006 semantics of the primary key. The most common use for this key
1007 semantics of the primary key. The most common use for this key
1007 is to search for 32bit applications on 64bit operating systems.
1008 is to search for 32bit applications on 64bit operating systems.
1008 Default: None
1009 Default: None
1009
1010
1010 ``regname``
1011 ``regname``
1011 Name of value to read from specified registry key. Defaults to the
1012 Name of value to read from specified registry key. Defaults to the
1012 unnamed (default) value.
1013 unnamed (default) value.
1013
1014
1014 ``regappend``
1015 ``regappend``
1015 String to append to the value read from the registry, typically
1016 String to append to the value read from the registry, typically
1016 the executable name of the tool.
1017 the executable name of the tool.
1017 Default: None
1018 Default: None
1018
1019
1019
1020
1020 ``patch``
1021 ``patch``
1021 ---------
1022 ---------
1022
1023
1023 Settings used when applying patches, for instance through the 'import'
1024 Settings used when applying patches, for instance through the 'import'
1024 command or with Mercurial Queues extension.
1025 command or with Mercurial Queues extension.
1025
1026
1026 ``eol``
1027 ``eol``
1027 When set to 'strict' patch content and patched files end of lines
1028 When set to 'strict' patch content and patched files end of lines
1028 are preserved. When set to ``lf`` or ``crlf``, both files end of
1029 are preserved. When set to ``lf`` or ``crlf``, both files end of
1029 lines are ignored when patching and the result line endings are
1030 lines are ignored when patching and the result line endings are
1030 normalized to either LF (Unix) or CRLF (Windows). When set to
1031 normalized to either LF (Unix) or CRLF (Windows). When set to
1031 ``auto``, end of lines are again ignored while patching but line
1032 ``auto``, end of lines are again ignored while patching but line
1032 endings in patched files are normalized to their original setting
1033 endings in patched files are normalized to their original setting
1033 on a per-file basis. If target file does not exist or has no end
1034 on a per-file basis. If target file does not exist or has no end
1034 of line, patch line endings are preserved.
1035 of line, patch line endings are preserved.
1035 Default: strict.
1036 Default: strict.
1036
1037
1037
1038
1038 ``paths``
1039 ``paths``
1039 ---------
1040 ---------
1040
1041
1041 Assigns symbolic names to repositories. The left side is the
1042 Assigns symbolic names to repositories. The left side is the
1042 symbolic name, and the right gives the directory or URL that is the
1043 symbolic name, and the right gives the directory or URL that is the
1043 location of the repository. Default paths can be declared by setting
1044 location of the repository. Default paths can be declared by setting
1044 the following entries.
1045 the following entries.
1045
1046
1046 ``default``
1047 ``default``
1047 Directory or URL to use when pulling if no source is specified.
1048 Directory or URL to use when pulling if no source is specified.
1048 Default is set to repository from which the current repository was
1049 Default is set to repository from which the current repository was
1049 cloned.
1050 cloned.
1050
1051
1051 ``default-push``
1052 ``default-push``
1052 Optional. Directory or URL to use when pushing if no destination
1053 Optional. Directory or URL to use when pushing if no destination
1053 is specified.
1054 is specified.
1054
1055
1055 Custom paths can be defined by assigning the path to a name that later can be
1056 Custom paths can be defined by assigning the path to a name that later can be
1056 used from the command line. Example::
1057 used from the command line. Example::
1057
1058
1058 [paths]
1059 [paths]
1059 my_path = http://example.com/path
1060 my_path = http://example.com/path
1060
1061
1061 To push to the path defined in ``my_path`` run the command::
1062 To push to the path defined in ``my_path`` run the command::
1062
1063
1063 hg push my_path
1064 hg push my_path
1064
1065
1065
1066
1066 ``phases``
1067 ``phases``
1067 ----------
1068 ----------
1068
1069
1069 Specifies default handling of phases. See :hg:`help phases` for more
1070 Specifies default handling of phases. See :hg:`help phases` for more
1070 information about working with phases.
1071 information about working with phases.
1071
1072
1072 ``publish``
1073 ``publish``
1073 Controls draft phase behavior when working as a server. When true,
1074 Controls draft phase behavior when working as a server. When true,
1074 pushed changesets are set to public in both client and server and
1075 pushed changesets are set to public in both client and server and
1075 pulled or cloned changesets are set to public in the client.
1076 pulled or cloned changesets are set to public in the client.
1076 Default: True
1077 Default: True
1077
1078
1078 ``new-commit``
1079 ``new-commit``
1079 Phase of newly-created commits.
1080 Phase of newly-created commits.
1080 Default: draft
1081 Default: draft
1081
1082
1082 ``checksubrepos``
1083 ``checksubrepos``
1083 Check the phase of the current revision of each subrepository. Allowed
1084 Check the phase of the current revision of each subrepository. Allowed
1084 values are "ignore", "follow" and "abort". For settings other than
1085 values are "ignore", "follow" and "abort". For settings other than
1085 "ignore", the phase of the current revision of each subrepository is
1086 "ignore", the phase of the current revision of each subrepository is
1086 checked before committing the parent repository. If any of those phases is
1087 checked before committing the parent repository. If any of those phases is
1087 greater than the phase of the parent repository (e.g. if a subrepo is in a
1088 greater than the phase of the parent repository (e.g. if a subrepo is in a
1088 "secret" phase while the parent repo is in "draft" phase), the commit is
1089 "secret" phase while the parent repo is in "draft" phase), the commit is
1089 either aborted (if checksubrepos is set to "abort") or the higher phase is
1090 either aborted (if checksubrepos is set to "abort") or the higher phase is
1090 used for the parent repository commit (if set to "follow").
1091 used for the parent repository commit (if set to "follow").
1091 Default: "follow"
1092 Default: "follow"
1092
1093
1093
1094
1094 ``profiling``
1095 ``profiling``
1095 -------------
1096 -------------
1096
1097
1097 Specifies profiling type, format, and file output. Two profilers are
1098 Specifies profiling type, format, and file output. Two profilers are
1098 supported: an instrumenting profiler (named ``ls``), and a sampling
1099 supported: an instrumenting profiler (named ``ls``), and a sampling
1099 profiler (named ``stat``).
1100 profiler (named ``stat``).
1100
1101
1101 In this section description, 'profiling data' stands for the raw data
1102 In this section description, 'profiling data' stands for the raw data
1102 collected during profiling, while 'profiling report' stands for a
1103 collected during profiling, while 'profiling report' stands for a
1103 statistical text report generated from the profiling data. The
1104 statistical text report generated from the profiling data. The
1104 profiling is done using lsprof.
1105 profiling is done using lsprof.
1105
1106
1106 ``type``
1107 ``type``
1107 The type of profiler to use.
1108 The type of profiler to use.
1108 Default: ls.
1109 Default: ls.
1109
1110
1110 ``ls``
1111 ``ls``
1111 Use Python's built-in instrumenting profiler. This profiler
1112 Use Python's built-in instrumenting profiler. This profiler
1112 works on all platforms, but each line number it reports is the
1113 works on all platforms, but each line number it reports is the
1113 first line of a function. This restriction makes it difficult to
1114 first line of a function. This restriction makes it difficult to
1114 identify the expensive parts of a non-trivial function.
1115 identify the expensive parts of a non-trivial function.
1115 ``stat``
1116 ``stat``
1116 Use a third-party statistical profiler, statprof. This profiler
1117 Use a third-party statistical profiler, statprof. This profiler
1117 currently runs only on Unix systems, and is most useful for
1118 currently runs only on Unix systems, and is most useful for
1118 profiling commands that run for longer than about 0.1 seconds.
1119 profiling commands that run for longer than about 0.1 seconds.
1119
1120
1120 ``format``
1121 ``format``
1121 Profiling format. Specific to the ``ls`` instrumenting profiler.
1122 Profiling format. Specific to the ``ls`` instrumenting profiler.
1122 Default: text.
1123 Default: text.
1123
1124
1124 ``text``
1125 ``text``
1125 Generate a profiling report. When saving to a file, it should be
1126 Generate a profiling report. When saving to a file, it should be
1126 noted that only the report is saved, and the profiling data is
1127 noted that only the report is saved, and the profiling data is
1127 not kept.
1128 not kept.
1128 ``kcachegrind``
1129 ``kcachegrind``
1129 Format profiling data for kcachegrind use: when saving to a
1130 Format profiling data for kcachegrind use: when saving to a
1130 file, the generated file can directly be loaded into
1131 file, the generated file can directly be loaded into
1131 kcachegrind.
1132 kcachegrind.
1132
1133
1133 ``frequency``
1134 ``frequency``
1134 Sampling frequency. Specific to the ``stat`` sampling profiler.
1135 Sampling frequency. Specific to the ``stat`` sampling profiler.
1135 Default: 1000.
1136 Default: 1000.
1136
1137
1137 ``output``
1138 ``output``
1138 File path where profiling data or report should be saved. If the
1139 File path where profiling data or report should be saved. If the
1139 file exists, it is replaced. Default: None, data is printed on
1140 file exists, it is replaced. Default: None, data is printed on
1140 stderr
1141 stderr
1141
1142
1142 ``sort``
1143 ``sort``
1143 Sort field. Specific to the ``ls`` instrumenting profiler.
1144 Sort field. Specific to the ``ls`` instrumenting profiler.
1144 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1145 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1145 ``inlinetime``.
1146 ``inlinetime``.
1146 Default: inlinetime.
1147 Default: inlinetime.
1147
1148
1148 ``limit``
1149 ``limit``
1149 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1150 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1150 Default: 30.
1151 Default: 30.
1151
1152
1152 ``nested``
1153 ``nested``
1153 Show at most this number of lines of drill-down info after each main entry.
1154 Show at most this number of lines of drill-down info after each main entry.
1154 This can help explain the difference between Total and Inline.
1155 This can help explain the difference between Total and Inline.
1155 Specific to the ``ls`` instrumenting profiler.
1156 Specific to the ``ls`` instrumenting profiler.
1156 Default: 5.
1157 Default: 5.
1157
1158
1158 ``revsetalias``
1159 ``revsetalias``
1159 ---------------
1160 ---------------
1160
1161
1161 Alias definitions for revsets. See :hg:`help revsets` for details.
1162 Alias definitions for revsets. See :hg:`help revsets` for details.
1162
1163
1163 ``server``
1164 ``server``
1164 ----------
1165 ----------
1165
1166
1166 Controls generic server settings.
1167 Controls generic server settings.
1167
1168
1168 ``uncompressed``
1169 ``uncompressed``
1169 Whether to allow clients to clone a repository using the
1170 Whether to allow clients to clone a repository using the
1170 uncompressed streaming protocol. This transfers about 40% more
1171 uncompressed streaming protocol. This transfers about 40% more
1171 data than a regular clone, but uses less memory and CPU on both
1172 data than a regular clone, but uses less memory and CPU on both
1172 server and client. Over a LAN (100 Mbps or better) or a very fast
1173 server and client. Over a LAN (100 Mbps or better) or a very fast
1173 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1174 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1174 regular clone. Over most WAN connections (anything slower than
1175 regular clone. Over most WAN connections (anything slower than
1175 about 6 Mbps), uncompressed streaming is slower, because of the
1176 about 6 Mbps), uncompressed streaming is slower, because of the
1176 extra data transfer overhead. This mode will also temporarily hold
1177 extra data transfer overhead. This mode will also temporarily hold
1177 the write lock while determining what data to transfer.
1178 the write lock while determining what data to transfer.
1178 Default is True.
1179 Default is True.
1179
1180
1180 ``preferuncompressed``
1181 ``preferuncompressed``
1181 When set, clients will try to use the uncompressed streaming
1182 When set, clients will try to use the uncompressed streaming
1182 protocol. Default is False.
1183 protocol. Default is False.
1183
1184
1184 ``validate``
1185 ``validate``
1185 Whether to validate the completeness of pushed changesets by
1186 Whether to validate the completeness of pushed changesets by
1186 checking that all new file revisions specified in manifests are
1187 checking that all new file revisions specified in manifests are
1187 present. Default is False.
1188 present. Default is False.
1188
1189
1189 ``smtp``
1190 ``smtp``
1190 --------
1191 --------
1191
1192
1192 Configuration for extensions that need to send email messages.
1193 Configuration for extensions that need to send email messages.
1193
1194
1194 ``host``
1195 ``host``
1195 Host name of mail server, e.g. "mail.example.com".
1196 Host name of mail server, e.g. "mail.example.com".
1196
1197
1197 ``port``
1198 ``port``
1198 Optional. Port to connect to on mail server. Default: 465 (if
1199 Optional. Port to connect to on mail server. Default: 465 (if
1199 ``tls`` is smtps) or 25 (otherwise).
1200 ``tls`` is smtps) or 25 (otherwise).
1200
1201
1201 ``tls``
1202 ``tls``
1202 Optional. Method to enable TLS when connecting to mail server: starttls,
1203 Optional. Method to enable TLS when connecting to mail server: starttls,
1203 smtps or none. Default: none.
1204 smtps or none. Default: none.
1204
1205
1205 ``verifycert``
1206 ``verifycert``
1206 Optional. Verification for the certificate of mail server, when
1207 Optional. Verification for the certificate of mail server, when
1207 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1208 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1208 "strict" or "loose", the certificate is verified as same as the
1209 "strict" or "loose", the certificate is verified as same as the
1209 verification for HTTPS connections (see ``[hostfingerprints]`` and
1210 verification for HTTPS connections (see ``[hostfingerprints]`` and
1210 ``[web] cacerts`` also). For "strict", sending email is also
1211 ``[web] cacerts`` also). For "strict", sending email is also
1211 aborted, if there is no configuration for mail server in
1212 aborted, if there is no configuration for mail server in
1212 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1213 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1213 :hg:`email` overwrites this as "loose". Default: "strict".
1214 :hg:`email` overwrites this as "loose". Default: "strict".
1214
1215
1215 ``username``
1216 ``username``
1216 Optional. User name for authenticating with the SMTP server.
1217 Optional. User name for authenticating with the SMTP server.
1217 Default: none.
1218 Default: none.
1218
1219
1219 ``password``
1220 ``password``
1220 Optional. Password for authenticating with the SMTP server. If not
1221 Optional. Password for authenticating with the SMTP server. If not
1221 specified, interactive sessions will prompt the user for a
1222 specified, interactive sessions will prompt the user for a
1222 password; non-interactive sessions will fail. Default: none.
1223 password; non-interactive sessions will fail. Default: none.
1223
1224
1224 ``local_hostname``
1225 ``local_hostname``
1225 Optional. It's the hostname that the sender can use to identify
1226 Optional. It's the hostname that the sender can use to identify
1226 itself to the MTA.
1227 itself to the MTA.
1227
1228
1228
1229
1229 ``subpaths``
1230 ``subpaths``
1230 ------------
1231 ------------
1231
1232
1232 Subrepository source URLs can go stale if a remote server changes name
1233 Subrepository source URLs can go stale if a remote server changes name
1233 or becomes temporarily unavailable. This section lets you define
1234 or becomes temporarily unavailable. This section lets you define
1234 rewrite rules of the form::
1235 rewrite rules of the form::
1235
1236
1236 <pattern> = <replacement>
1237 <pattern> = <replacement>
1237
1238
1238 where ``pattern`` is a regular expression matching a subrepository
1239 where ``pattern`` is a regular expression matching a subrepository
1239 source URL and ``replacement`` is the replacement string used to
1240 source URL and ``replacement`` is the replacement string used to
1240 rewrite it. Groups can be matched in ``pattern`` and referenced in
1241 rewrite it. Groups can be matched in ``pattern`` and referenced in
1241 ``replacements``. For instance::
1242 ``replacements``. For instance::
1242
1243
1243 http://server/(.*)-hg/ = http://hg.server/\1/
1244 http://server/(.*)-hg/ = http://hg.server/\1/
1244
1245
1245 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1246 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1246
1247
1247 Relative subrepository paths are first made absolute, and the
1248 Relative subrepository paths are first made absolute, and the
1248 rewrite rules are then applied on the full (absolute) path. The rules
1249 rewrite rules are then applied on the full (absolute) path. The rules
1249 are applied in definition order.
1250 are applied in definition order.
1250
1251
1251 ``trusted``
1252 ``trusted``
1252 -----------
1253 -----------
1253
1254
1254 Mercurial will not use the settings in the
1255 Mercurial will not use the settings in the
1255 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1256 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1256 user or to a trusted group, as various hgrc features allow arbitrary
1257 user or to a trusted group, as various hgrc features allow arbitrary
1257 commands to be run. This issue is often encountered when configuring
1258 commands to be run. This issue is often encountered when configuring
1258 hooks or extensions for shared repositories or servers. However,
1259 hooks or extensions for shared repositories or servers. However,
1259 the web interface will use some safe settings from the ``[web]``
1260 the web interface will use some safe settings from the ``[web]``
1260 section.
1261 section.
1261
1262
1262 This section specifies what users and groups are trusted. The
1263 This section specifies what users and groups are trusted. The
1263 current user is always trusted. To trust everybody, list a user or a
1264 current user is always trusted. To trust everybody, list a user or a
1264 group with name ``*``. These settings must be placed in an
1265 group with name ``*``. These settings must be placed in an
1265 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1266 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1266 user or service running Mercurial.
1267 user or service running Mercurial.
1267
1268
1268 ``users``
1269 ``users``
1269 Comma-separated list of trusted users.
1270 Comma-separated list of trusted users.
1270
1271
1271 ``groups``
1272 ``groups``
1272 Comma-separated list of trusted groups.
1273 Comma-separated list of trusted groups.
1273
1274
1274
1275
1275 ``ui``
1276 ``ui``
1276 ------
1277 ------
1277
1278
1278 User interface controls.
1279 User interface controls.
1279
1280
1280 ``archivemeta``
1281 ``archivemeta``
1281 Whether to include the .hg_archival.txt file containing meta data
1282 Whether to include the .hg_archival.txt file containing meta data
1282 (hashes for the repository base and for tip) in archives created
1283 (hashes for the repository base and for tip) in archives created
1283 by the :hg:`archive` command or downloaded via hgweb.
1284 by the :hg:`archive` command or downloaded via hgweb.
1284 Default is True.
1285 Default is True.
1285
1286
1286 ``askusername``
1287 ``askusername``
1287 Whether to prompt for a username when committing. If True, and
1288 Whether to prompt for a username when committing. If True, and
1288 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1289 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1289 be prompted to enter a username. If no username is entered, the
1290 be prompted to enter a username. If no username is entered, the
1290 default ``USER@HOST`` is used instead.
1291 default ``USER@HOST`` is used instead.
1291 Default is False.
1292 Default is False.
1292
1293
1293 ``commitsubrepos``
1294 ``commitsubrepos``
1294 Whether to commit modified subrepositories when committing the
1295 Whether to commit modified subrepositories when committing the
1295 parent repository. If False and one subrepository has uncommitted
1296 parent repository. If False and one subrepository has uncommitted
1296 changes, abort the commit.
1297 changes, abort the commit.
1297 Default is False.
1298 Default is False.
1298
1299
1299 ``debug``
1300 ``debug``
1300 Print debugging information. True or False. Default is False.
1301 Print debugging information. True or False. Default is False.
1301
1302
1302 ``editor``
1303 ``editor``
1303 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
1304 The editor to use during a commit. Default is ``$EDITOR`` or ``vi``.
1304
1305
1305 ``fallbackencoding``
1306 ``fallbackencoding``
1306 Encoding to try if it's not possible to decode the changelog using
1307 Encoding to try if it's not possible to decode the changelog using
1307 UTF-8. Default is ISO-8859-1.
1308 UTF-8. Default is ISO-8859-1.
1308
1309
1309 ``ignore``
1310 ``ignore``
1310 A file to read per-user ignore patterns from. This file should be
1311 A file to read per-user ignore patterns from. This file should be
1311 in the same format as a repository-wide .hgignore file. This
1312 in the same format as a repository-wide .hgignore file. This
1312 option supports hook syntax, so if you want to specify multiple
1313 option supports hook syntax, so if you want to specify multiple
1313 ignore files, you can do so by setting something like
1314 ignore files, you can do so by setting something like
1314 ``ignore.other = ~/.hgignore2``. For details of the ignore file
1315 ``ignore.other = ~/.hgignore2``. For details of the ignore file
1315 format, see the ``hgignore(5)`` man page.
1316 format, see the ``hgignore(5)`` man page.
1316
1317
1317 ``interactive``
1318 ``interactive``
1318 Allow to prompt the user. True or False. Default is True.
1319 Allow to prompt the user. True or False. Default is True.
1319
1320
1320 ``logtemplate``
1321 ``logtemplate``
1321 Template string for commands that print changesets.
1322 Template string for commands that print changesets.
1322
1323
1323 ``merge``
1324 ``merge``
1324 The conflict resolution program to use during a manual merge.
1325 The conflict resolution program to use during a manual merge.
1325 For more information on merge tools see :hg:`help merge-tools`.
1326 For more information on merge tools see :hg:`help merge-tools`.
1326 For configuring merge tools see the ``[merge-tools]`` section.
1327 For configuring merge tools see the ``[merge-tools]`` section.
1327
1328
1328 ``mergemarkers``
1329 ``mergemarkers``
1329 Sets the merge conflict marker label styling. The ``detailed``
1330 Sets the merge conflict marker label styling. The ``detailed``
1330 style uses the ``mergemarkertemplate`` setting to style the labels.
1331 style uses the ``mergemarkertemplate`` setting to style the labels.
1331 The ``basic`` style just uses 'local' and 'other' as the marker label.
1332 The ``basic`` style just uses 'local' and 'other' as the marker label.
1332 One of ``basic`` or ``detailed``.
1333 One of ``basic`` or ``detailed``.
1333 Default is ``basic``.
1334 Default is ``basic``.
1334
1335
1335 ``mergemarkertemplate``
1336 ``mergemarkertemplate``
1336 The template used to print the commit description next to each conflict
1337 The template used to print the commit description next to each conflict
1337 marker during merge conflicts. See :hg:`help templates` for the template
1338 marker during merge conflicts. See :hg:`help templates` for the template
1338 format.
1339 format.
1339 Defaults to showing the hash, tags, branches, bookmarks, author, and
1340 Defaults to showing the hash, tags, branches, bookmarks, author, and
1340 the first line of the commit description.
1341 the first line of the commit description.
1341 You have to pay attention to encodings of managed files, if you
1342 You have to pay attention to encodings of managed files, if you
1342 use non-ASCII characters in tags, branches, bookmarks, author
1343 use non-ASCII characters in tags, branches, bookmarks, author
1343 and/or commit descriptions. At template expansion, non-ASCII
1344 and/or commit descriptions. At template expansion, non-ASCII
1344 characters use the encoding specified by ``--encoding`` global
1345 characters use the encoding specified by ``--encoding`` global
1345 option, ``HGENCODING`` or other locale setting environment
1346 option, ``HGENCODING`` or other locale setting environment
1346 variables. The difference of encoding between merged file and
1347 variables. The difference of encoding between merged file and
1347 conflict markers causes serious problem.
1348 conflict markers causes serious problem.
1348
1349
1349 ``portablefilenames``
1350 ``portablefilenames``
1350 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1351 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1351 Default is ``warn``.
1352 Default is ``warn``.
1352 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1353 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1353 platforms, if a file with a non-portable filename is added (e.g. a file
1354 platforms, if a file with a non-portable filename is added (e.g. a file
1354 with a name that can't be created on Windows because it contains reserved
1355 with a name that can't be created on Windows because it contains reserved
1355 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1356 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1356 collision with an existing file).
1357 collision with an existing file).
1357 If set to ``ignore`` (or ``false``), no warning is printed.
1358 If set to ``ignore`` (or ``false``), no warning is printed.
1358 If set to ``abort``, the command is aborted.
1359 If set to ``abort``, the command is aborted.
1359 On Windows, this configuration option is ignored and the command aborted.
1360 On Windows, this configuration option is ignored and the command aborted.
1360
1361
1361 ``quiet``
1362 ``quiet``
1362 Reduce the amount of output printed. True or False. Default is False.
1363 Reduce the amount of output printed. True or False. Default is False.
1363
1364
1364 ``remotecmd``
1365 ``remotecmd``
1365 remote command to use for clone/push/pull operations. Default is ``hg``.
1366 remote command to use for clone/push/pull operations. Default is ``hg``.
1366
1367
1367 ``reportoldssl``
1368 ``reportoldssl``
1368 Warn if an SSL certificate is unable to be due to using Python
1369 Warn if an SSL certificate is unable to be due to using Python
1369 2.5 or earlier. True or False. Default is True.
1370 2.5 or earlier. True or False. Default is True.
1370
1371
1371 ``report_untrusted``
1372 ``report_untrusted``
1372 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1373 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1373 trusted user or group. True or False. Default is True.
1374 trusted user or group. True or False. Default is True.
1374
1375
1375 ``slash``
1376 ``slash``
1376 Display paths using a slash (``/``) as the path separator. This
1377 Display paths using a slash (``/``) as the path separator. This
1377 only makes a difference on systems where the default path
1378 only makes a difference on systems where the default path
1378 separator is not the slash character (e.g. Windows uses the
1379 separator is not the slash character (e.g. Windows uses the
1379 backslash character (``\``)).
1380 backslash character (``\``)).
1380 Default is False.
1381 Default is False.
1381
1382
1382 ``ssh``
1383 ``ssh``
1383 command to use for SSH connections. Default is ``ssh``.
1384 command to use for SSH connections. Default is ``ssh``.
1384
1385
1385 ``strict``
1386 ``strict``
1386 Require exact command names, instead of allowing unambiguous
1387 Require exact command names, instead of allowing unambiguous
1387 abbreviations. True or False. Default is False.
1388 abbreviations. True or False. Default is False.
1388
1389
1389 ``style``
1390 ``style``
1390 Name of style to use for command output.
1391 Name of style to use for command output.
1391
1392
1392 ``timeout``
1393 ``timeout``
1393 The timeout used when a lock is held (in seconds), a negative value
1394 The timeout used when a lock is held (in seconds), a negative value
1394 means no timeout. Default is 600.
1395 means no timeout. Default is 600.
1395
1396
1396 ``traceback``
1397 ``traceback``
1397 Mercurial always prints a traceback when an unknown exception
1398 Mercurial always prints a traceback when an unknown exception
1398 occurs. Setting this to True will make Mercurial print a traceback
1399 occurs. Setting this to True will make Mercurial print a traceback
1399 on all exceptions, even those recognized by Mercurial (such as
1400 on all exceptions, even those recognized by Mercurial (such as
1400 IOError or MemoryError). Default is False.
1401 IOError or MemoryError). Default is False.
1401
1402
1402 ``username``
1403 ``username``
1403 The committer of a changeset created when running "commit".
1404 The committer of a changeset created when running "commit".
1404 Typically a person's name and email address, e.g. ``Fred Widget
1405 Typically a person's name and email address, e.g. ``Fred Widget
1405 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
1406 <fred@example.com>``. Default is ``$EMAIL`` or ``username@hostname``. If
1406 the username in hgrc is empty, it has to be specified manually or
1407 the username in hgrc is empty, it has to be specified manually or
1407 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
1408 in a different hgrc file (e.g. ``$HOME/.hgrc``, if the admin set
1408 ``username =`` in the system hgrc). Environment variables in the
1409 ``username =`` in the system hgrc). Environment variables in the
1409 username are expanded.
1410 username are expanded.
1410
1411
1411 ``verbose``
1412 ``verbose``
1412 Increase the amount of output printed. True or False. Default is False.
1413 Increase the amount of output printed. True or False. Default is False.
1413
1414
1414
1415
1415 ``web``
1416 ``web``
1416 -------
1417 -------
1417
1418
1418 Web interface configuration. The settings in this section apply to
1419 Web interface configuration. The settings in this section apply to
1419 both the builtin webserver (started by :hg:`serve`) and the script you
1420 both the builtin webserver (started by :hg:`serve`) and the script you
1420 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1421 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1421 and WSGI).
1422 and WSGI).
1422
1423
1423 The Mercurial webserver does no authentication (it does not prompt for
1424 The Mercurial webserver does no authentication (it does not prompt for
1424 usernames and passwords to validate *who* users are), but it does do
1425 usernames and passwords to validate *who* users are), but it does do
1425 authorization (it grants or denies access for *authenticated users*
1426 authorization (it grants or denies access for *authenticated users*
1426 based on settings in this section). You must either configure your
1427 based on settings in this section). You must either configure your
1427 webserver to do authentication for you, or disable the authorization
1428 webserver to do authentication for you, or disable the authorization
1428 checks.
1429 checks.
1429
1430
1430 For a quick setup in a trusted environment, e.g., a private LAN, where
1431 For a quick setup in a trusted environment, e.g., a private LAN, where
1431 you want it to accept pushes from anybody, you can use the following
1432 you want it to accept pushes from anybody, you can use the following
1432 command line::
1433 command line::
1433
1434
1434 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1435 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1435
1436
1436 Note that this will allow anybody to push anything to the server and
1437 Note that this will allow anybody to push anything to the server and
1437 that this should not be used for public servers.
1438 that this should not be used for public servers.
1438
1439
1439 The full set of options is:
1440 The full set of options is:
1440
1441
1441 ``accesslog``
1442 ``accesslog``
1442 Where to output the access log. Default is stdout.
1443 Where to output the access log. Default is stdout.
1443
1444
1444 ``address``
1445 ``address``
1445 Interface address to bind to. Default is all.
1446 Interface address to bind to. Default is all.
1446
1447
1447 ``allow_archive``
1448 ``allow_archive``
1448 List of archive format (bz2, gz, zip) allowed for downloading.
1449 List of archive format (bz2, gz, zip) allowed for downloading.
1449 Default is empty.
1450 Default is empty.
1450
1451
1451 ``allowbz2``
1452 ``allowbz2``
1452 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1453 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1453 revisions.
1454 revisions.
1454 Default is False.
1455 Default is False.
1455
1456
1456 ``allowgz``
1457 ``allowgz``
1457 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1458 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1458 revisions.
1459 revisions.
1459 Default is False.
1460 Default is False.
1460
1461
1461 ``allowpull``
1462 ``allowpull``
1462 Whether to allow pulling from the repository. Default is True.
1463 Whether to allow pulling from the repository. Default is True.
1463
1464
1464 ``allow_push``
1465 ``allow_push``
1465 Whether to allow pushing to the repository. If empty or not set,
1466 Whether to allow pushing to the repository. If empty or not set,
1466 push is not allowed. If the special value ``*``, any remote user can
1467 push is not allowed. If the special value ``*``, any remote user can
1467 push, including unauthenticated users. Otherwise, the remote user
1468 push, including unauthenticated users. Otherwise, the remote user
1468 must have been authenticated, and the authenticated user name must
1469 must have been authenticated, and the authenticated user name must
1469 be present in this list. The contents of the allow_push list are
1470 be present in this list. The contents of the allow_push list are
1470 examined after the deny_push list.
1471 examined after the deny_push list.
1471
1472
1472 ``allow_read``
1473 ``allow_read``
1473 If the user has not already been denied repository access due to
1474 If the user has not already been denied repository access due to
1474 the contents of deny_read, this list determines whether to grant
1475 the contents of deny_read, this list determines whether to grant
1475 repository access to the user. If this list is not empty, and the
1476 repository access to the user. If this list is not empty, and the
1476 user is unauthenticated or not present in the list, then access is
1477 user is unauthenticated or not present in the list, then access is
1477 denied for the user. If the list is empty or not set, then access
1478 denied for the user. If the list is empty or not set, then access
1478 is permitted to all users by default. Setting allow_read to the
1479 is permitted to all users by default. Setting allow_read to the
1479 special value ``*`` is equivalent to it not being set (i.e. access
1480 special value ``*`` is equivalent to it not being set (i.e. access
1480 is permitted to all users). The contents of the allow_read list are
1481 is permitted to all users). The contents of the allow_read list are
1481 examined after the deny_read list.
1482 examined after the deny_read list.
1482
1483
1483 ``allowzip``
1484 ``allowzip``
1484 (DEPRECATED) Whether to allow .zip downloading of repository
1485 (DEPRECATED) Whether to allow .zip downloading of repository
1485 revisions. Default is False. This feature creates temporary files.
1486 revisions. Default is False. This feature creates temporary files.
1486
1487
1487 ``archivesubrepos``
1488 ``archivesubrepos``
1488 Whether to recurse into subrepositories when archiving. Default is
1489 Whether to recurse into subrepositories when archiving. Default is
1489 False.
1490 False.
1490
1491
1491 ``baseurl``
1492 ``baseurl``
1492 Base URL to use when publishing URLs in other locations, so
1493 Base URL to use when publishing URLs in other locations, so
1493 third-party tools like email notification hooks can construct
1494 third-party tools like email notification hooks can construct
1494 URLs. Example: ``http://hgserver/repos/``.
1495 URLs. Example: ``http://hgserver/repos/``.
1495
1496
1496 ``cacerts``
1497 ``cacerts``
1497 Path to file containing a list of PEM encoded certificate
1498 Path to file containing a list of PEM encoded certificate
1498 authority certificates. Environment variables and ``~user``
1499 authority certificates. Environment variables and ``~user``
1499 constructs are expanded in the filename. If specified on the
1500 constructs are expanded in the filename. If specified on the
1500 client, then it will verify the identity of remote HTTPS servers
1501 client, then it will verify the identity of remote HTTPS servers
1501 with these certificates.
1502 with these certificates.
1502
1503
1503 This feature is only supported when using Python 2.6 or later. If you wish
1504 This feature is only supported when using Python 2.6 or later. If you wish
1504 to use it with earlier versions of Python, install the backported
1505 to use it with earlier versions of Python, install the backported
1505 version of the ssl library that is available from
1506 version of the ssl library that is available from
1506 ``http://pypi.python.org``.
1507 ``http://pypi.python.org``.
1507
1508
1508 To disable SSL verification temporarily, specify ``--insecure`` from
1509 To disable SSL verification temporarily, specify ``--insecure`` from
1509 command line.
1510 command line.
1510
1511
1511 You can use OpenSSL's CA certificate file if your platform has
1512 You can use OpenSSL's CA certificate file if your platform has
1512 one. On most Linux systems this will be
1513 one. On most Linux systems this will be
1513 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1514 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1514 generate this file manually. The form must be as follows::
1515 generate this file manually. The form must be as follows::
1515
1516
1516 -----BEGIN CERTIFICATE-----
1517 -----BEGIN CERTIFICATE-----
1517 ... (certificate in base64 PEM encoding) ...
1518 ... (certificate in base64 PEM encoding) ...
1518 -----END CERTIFICATE-----
1519 -----END CERTIFICATE-----
1519 -----BEGIN CERTIFICATE-----
1520 -----BEGIN CERTIFICATE-----
1520 ... (certificate in base64 PEM encoding) ...
1521 ... (certificate in base64 PEM encoding) ...
1521 -----END CERTIFICATE-----
1522 -----END CERTIFICATE-----
1522
1523
1523 ``cache``
1524 ``cache``
1524 Whether to support caching in hgweb. Defaults to True.
1525 Whether to support caching in hgweb. Defaults to True.
1525
1526
1526 ``collapse``
1527 ``collapse``
1527 With ``descend`` enabled, repositories in subdirectories are shown at
1528 With ``descend`` enabled, repositories in subdirectories are shown at
1528 a single level alongside repositories in the current path. With
1529 a single level alongside repositories in the current path. With
1529 ``collapse`` also enabled, repositories residing at a deeper level than
1530 ``collapse`` also enabled, repositories residing at a deeper level than
1530 the current path are grouped behind navigable directory entries that
1531 the current path are grouped behind navigable directory entries that
1531 lead to the locations of these repositories. In effect, this setting
1532 lead to the locations of these repositories. In effect, this setting
1532 collapses each collection of repositories found within a subdirectory
1533 collapses each collection of repositories found within a subdirectory
1533 into a single entry for that subdirectory. Default is False.
1534 into a single entry for that subdirectory. Default is False.
1534
1535
1535 ``comparisoncontext``
1536 ``comparisoncontext``
1536 Number of lines of context to show in side-by-side file comparison. If
1537 Number of lines of context to show in side-by-side file comparison. If
1537 negative or the value ``full``, whole files are shown. Default is 5.
1538 negative or the value ``full``, whole files are shown. Default is 5.
1538 This setting can be overridden by a ``context`` request parameter to the
1539 This setting can be overridden by a ``context`` request parameter to the
1539 ``comparison`` command, taking the same values.
1540 ``comparison`` command, taking the same values.
1540
1541
1541 ``contact``
1542 ``contact``
1542 Name or email address of the person in charge of the repository.
1543 Name or email address of the person in charge of the repository.
1543 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1544 Defaults to ui.username or ``$EMAIL`` or "unknown" if unset or empty.
1544
1545
1545 ``deny_push``
1546 ``deny_push``
1546 Whether to deny pushing to the repository. If empty or not set,
1547 Whether to deny pushing to the repository. If empty or not set,
1547 push is not denied. If the special value ``*``, all remote users are
1548 push is not denied. If the special value ``*``, all remote users are
1548 denied push. Otherwise, unauthenticated users are all denied, and
1549 denied push. Otherwise, unauthenticated users are all denied, and
1549 any authenticated user name present in this list is also denied. The
1550 any authenticated user name present in this list is also denied. The
1550 contents of the deny_push list are examined before the allow_push list.
1551 contents of the deny_push list are examined before the allow_push list.
1551
1552
1552 ``deny_read``
1553 ``deny_read``
1553 Whether to deny reading/viewing of the repository. If this list is
1554 Whether to deny reading/viewing of the repository. If this list is
1554 not empty, unauthenticated users are all denied, and any
1555 not empty, unauthenticated users are all denied, and any
1555 authenticated user name present in this list is also denied access to
1556 authenticated user name present in this list is also denied access to
1556 the repository. If set to the special value ``*``, all remote users
1557 the repository. If set to the special value ``*``, all remote users
1557 are denied access (rarely needed ;). If deny_read is empty or not set,
1558 are denied access (rarely needed ;). If deny_read is empty or not set,
1558 the determination of repository access depends on the presence and
1559 the determination of repository access depends on the presence and
1559 content of the allow_read list (see description). If both
1560 content of the allow_read list (see description). If both
1560 deny_read and allow_read are empty or not set, then access is
1561 deny_read and allow_read are empty or not set, then access is
1561 permitted to all users by default. If the repository is being
1562 permitted to all users by default. If the repository is being
1562 served via hgwebdir, denied users will not be able to see it in
1563 served via hgwebdir, denied users will not be able to see it in
1563 the list of repositories. The contents of the deny_read list have
1564 the list of repositories. The contents of the deny_read list have
1564 priority over (are examined before) the contents of the allow_read
1565 priority over (are examined before) the contents of the allow_read
1565 list.
1566 list.
1566
1567
1567 ``descend``
1568 ``descend``
1568 hgwebdir indexes will not descend into subdirectories. Only repositories
1569 hgwebdir indexes will not descend into subdirectories. Only repositories
1569 directly in the current path will be shown (other repositories are still
1570 directly in the current path will be shown (other repositories are still
1570 available from the index corresponding to their containing path).
1571 available from the index corresponding to their containing path).
1571
1572
1572 ``description``
1573 ``description``
1573 Textual description of the repository's purpose or contents.
1574 Textual description of the repository's purpose or contents.
1574 Default is "unknown".
1575 Default is "unknown".
1575
1576
1576 ``encoding``
1577 ``encoding``
1577 Character encoding name. Default is the current locale charset.
1578 Character encoding name. Default is the current locale charset.
1578 Example: "UTF-8"
1579 Example: "UTF-8"
1579
1580
1580 ``errorlog``
1581 ``errorlog``
1581 Where to output the error log. Default is stderr.
1582 Where to output the error log. Default is stderr.
1582
1583
1583 ``guessmime``
1584 ``guessmime``
1584 Control MIME types for raw download of file content.
1585 Control MIME types for raw download of file content.
1585 Set to True to let hgweb guess the content type from the file
1586 Set to True to let hgweb guess the content type from the file
1586 extension. This will serve HTML files as ``text/html`` and might
1587 extension. This will serve HTML files as ``text/html`` and might
1587 allow cross-site scripting attacks when serving untrusted
1588 allow cross-site scripting attacks when serving untrusted
1588 repositories. Default is False.
1589 repositories. Default is False.
1589
1590
1590 ``hidden``
1591 ``hidden``
1591 Whether to hide the repository in the hgwebdir index.
1592 Whether to hide the repository in the hgwebdir index.
1592 Default is False.
1593 Default is False.
1593
1594
1594 ``ipv6``
1595 ``ipv6``
1595 Whether to use IPv6. Default is False.
1596 Whether to use IPv6. Default is False.
1596
1597
1597 ``logoimg``
1598 ``logoimg``
1598 File name of the logo image that some templates display on each page.
1599 File name of the logo image that some templates display on each page.
1599 The file name is relative to ``staticurl``. That is, the full path to
1600 The file name is relative to ``staticurl``. That is, the full path to
1600 the logo image is "staticurl/logoimg".
1601 the logo image is "staticurl/logoimg".
1601 If unset, ``hglogo.png`` will be used.
1602 If unset, ``hglogo.png`` will be used.
1602
1603
1603 ``logourl``
1604 ``logourl``
1604 Base URL to use for logos. If unset, ``http://mercurial.selenic.com/``
1605 Base URL to use for logos. If unset, ``http://mercurial.selenic.com/``
1605 will be used.
1606 will be used.
1606
1607
1607 ``maxchanges``
1608 ``maxchanges``
1608 Maximum number of changes to list on the changelog. Default is 10.
1609 Maximum number of changes to list on the changelog. Default is 10.
1609
1610
1610 ``maxfiles``
1611 ``maxfiles``
1611 Maximum number of files to list per changeset. Default is 10.
1612 Maximum number of files to list per changeset. Default is 10.
1612
1613
1613 ``maxshortchanges``
1614 ``maxshortchanges``
1614 Maximum number of changes to list on the shortlog, graph or filelog
1615 Maximum number of changes to list on the shortlog, graph or filelog
1615 pages. Default is 60.
1616 pages. Default is 60.
1616
1617
1617 ``name``
1618 ``name``
1618 Repository name to use in the web interface. Default is current
1619 Repository name to use in the web interface. Default is current
1619 working directory.
1620 working directory.
1620
1621
1621 ``port``
1622 ``port``
1622 Port to listen on. Default is 8000.
1623 Port to listen on. Default is 8000.
1623
1624
1624 ``prefix``
1625 ``prefix``
1625 Prefix path to serve from. Default is '' (server root).
1626 Prefix path to serve from. Default is '' (server root).
1626
1627
1627 ``push_ssl``
1628 ``push_ssl``
1628 Whether to require that inbound pushes be transported over SSL to
1629 Whether to require that inbound pushes be transported over SSL to
1629 prevent password sniffing. Default is True.
1630 prevent password sniffing. Default is True.
1630
1631
1631 ``staticurl``
1632 ``staticurl``
1632 Base URL to use for static files. If unset, static files (e.g. the
1633 Base URL to use for static files. If unset, static files (e.g. the
1633 hgicon.png favicon) will be served by the CGI script itself. Use
1634 hgicon.png favicon) will be served by the CGI script itself. Use
1634 this setting to serve them directly with the HTTP server.
1635 this setting to serve them directly with the HTTP server.
1635 Example: ``http://hgserver/static/``.
1636 Example: ``http://hgserver/static/``.
1636
1637
1637 ``stripes``
1638 ``stripes``
1638 How many lines a "zebra stripe" should span in multi-line output.
1639 How many lines a "zebra stripe" should span in multi-line output.
1639 Default is 1; set to 0 to disable.
1640 Default is 1; set to 0 to disable.
1640
1641
1641 ``style``
1642 ``style``
1642 Which template map style to use.
1643 Which template map style to use.
1643
1644
1644 ``templates``
1645 ``templates``
1645 Where to find the HTML templates. Default is install path.
1646 Where to find the HTML templates. Default is install path.
1646
1647
1647 ``websub``
1648 ``websub``
1648 ----------
1649 ----------
1649
1650
1650 Web substitution filter definition. You can use this section to
1651 Web substitution filter definition. You can use this section to
1651 define a set of regular expression substitution patterns which
1652 define a set of regular expression substitution patterns which
1652 let you automatically modify the hgweb server output.
1653 let you automatically modify the hgweb server output.
1653
1654
1654 The default hgweb templates only apply these substitution patterns
1655 The default hgweb templates only apply these substitution patterns
1655 on the revision description fields. You can apply them anywhere
1656 on the revision description fields. You can apply them anywhere
1656 you want when you create your own templates by adding calls to the
1657 you want when you create your own templates by adding calls to the
1657 "websub" filter (usually after calling the "escape" filter).
1658 "websub" filter (usually after calling the "escape" filter).
1658
1659
1659 This can be used, for example, to convert issue references to links
1660 This can be used, for example, to convert issue references to links
1660 to your issue tracker, or to convert "markdown-like" syntax into
1661 to your issue tracker, or to convert "markdown-like" syntax into
1661 HTML (see the examples below).
1662 HTML (see the examples below).
1662
1663
1663 Each entry in this section names a substitution filter.
1664 Each entry in this section names a substitution filter.
1664 The value of each entry defines the substitution expression itself.
1665 The value of each entry defines the substitution expression itself.
1665 The websub expressions follow the old interhg extension syntax,
1666 The websub expressions follow the old interhg extension syntax,
1666 which in turn imitates the Unix sed replacement syntax::
1667 which in turn imitates the Unix sed replacement syntax::
1667
1668
1668 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
1669 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
1669
1670
1670 You can use any separator other than "/". The final "i" is optional
1671 You can use any separator other than "/". The final "i" is optional
1671 and indicates that the search must be case insensitive.
1672 and indicates that the search must be case insensitive.
1672
1673
1673 Examples::
1674 Examples::
1674
1675
1675 [websub]
1676 [websub]
1676 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
1677 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
1677 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
1678 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
1678 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
1679 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
1679
1680
1680 ``worker``
1681 ``worker``
1681 ----------
1682 ----------
1682
1683
1683 Parallel master/worker configuration. We currently perform working
1684 Parallel master/worker configuration. We currently perform working
1684 directory updates in parallel on Unix-like systems, which greatly
1685 directory updates in parallel on Unix-like systems, which greatly
1685 helps performance.
1686 helps performance.
1686
1687
1687 ``numcpus``
1688 ``numcpus``
1688 Number of CPUs to use for parallel operations. Default is 4 or the
1689 Number of CPUs to use for parallel operations. Default is 4 or the
1689 number of CPUs on the system, whichever is larger. A zero or
1690 number of CPUs on the system, whichever is larger. A zero or
1690 negative value is treated as ``use the default``.
1691 negative value is treated as ``use the default``.
@@ -1,736 +1,763
1 #require killdaemons
1 #require killdaemons
2
2
3 $ cat <<EOF >> $HGRCPATH
3 $ cat <<EOF >> $HGRCPATH
4 > [extensions]
4 > [extensions]
5 > transplant=
5 > transplant=
6 > EOF
6 > EOF
7
7
8 $ hg init t
8 $ hg init t
9 $ cd t
9 $ cd t
10 $ echo r1 > r1
10 $ echo r1 > r1
11 $ hg ci -Amr1 -d'0 0'
11 $ hg ci -Amr1 -d'0 0'
12 adding r1
12 adding r1
13 $ echo r2 > r2
13 $ echo r2 > r2
14 $ hg ci -Amr2 -d'1 0'
14 $ hg ci -Amr2 -d'1 0'
15 adding r2
15 adding r2
16 $ hg up 0
16 $ hg up 0
17 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
17 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
18
18
19 $ echo b1 > b1
19 $ echo b1 > b1
20 $ hg ci -Amb1 -d '0 0'
20 $ hg ci -Amb1 -d '0 0'
21 adding b1
21 adding b1
22 created new head
22 created new head
23 $ echo b2 > b2
23 $ echo b2 > b2
24 $ hg ci -Amb2 -d '1 0'
24 $ hg ci -Amb2 -d '1 0'
25 adding b2
25 adding b2
26 $ echo b3 > b3
26 $ echo b3 > b3
27 $ hg ci -Amb3 -d '2 0'
27 $ hg ci -Amb3 -d '2 0'
28 adding b3
28 adding b3
29
29
30 $ hg log --template '{rev} {parents} {desc}\n'
30 $ hg log --template '{rev} {parents} {desc}\n'
31 4 b3
31 4 b3
32 3 b2
32 3 b2
33 2 0:17ab29e464c6 b1
33 2 0:17ab29e464c6 b1
34 1 r2
34 1 r2
35 0 r1
35 0 r1
36
36
37 $ hg clone . ../rebase
37 $ hg clone . ../rebase
38 updating to branch default
38 updating to branch default
39 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
39 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
40 $ cd ../rebase
40 $ cd ../rebase
41
41
42 $ hg up -C 1
42 $ hg up -C 1
43 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
43 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
44
44
45 rebase b onto r1
45 rebase b onto r1
46 (this also tests that editor is not invoked if '--edit' is not specified)
46 (this also tests that editor is not invoked if '--edit' is not specified)
47
47
48 $ HGEDITOR=cat hg transplant -a -b tip
48 $ HGEDITOR=cat hg transplant -a -b tip
49 applying 37a1297eb21b
49 applying 37a1297eb21b
50 37a1297eb21b transplanted to e234d668f844
50 37a1297eb21b transplanted to e234d668f844
51 applying 722f4667af76
51 applying 722f4667af76
52 722f4667af76 transplanted to 539f377d78df
52 722f4667af76 transplanted to 539f377d78df
53 applying a53251cdf717
53 applying a53251cdf717
54 a53251cdf717 transplanted to ffd6818a3975
54 a53251cdf717 transplanted to ffd6818a3975
55 $ hg log --template '{rev} {parents} {desc}\n'
55 $ hg log --template '{rev} {parents} {desc}\n'
56 7 b3
56 7 b3
57 6 b2
57 6 b2
58 5 1:d11e3596cc1a b1
58 5 1:d11e3596cc1a b1
59 4 b3
59 4 b3
60 3 b2
60 3 b2
61 2 0:17ab29e464c6 b1
61 2 0:17ab29e464c6 b1
62 1 r2
62 1 r2
63 0 r1
63 0 r1
64
64
65 test transplanted revset
65 test transplanted revset
66
66
67 $ hg log -r 'transplanted()' --template '{rev} {parents} {desc}\n'
67 $ hg log -r 'transplanted()' --template '{rev} {parents} {desc}\n'
68 5 1:d11e3596cc1a b1
68 5 1:d11e3596cc1a b1
69 6 b2
69 6 b2
70 7 b3
70 7 b3
71 $ hg help revsets | grep transplanted
71 $ hg help revsets | grep transplanted
72 "transplanted([set])"
72 "transplanted([set])"
73 Transplanted changesets in set, or all transplanted changesets.
73 Transplanted changesets in set, or all transplanted changesets.
74
74
75 test transplanted keyword
75 test transplanted keyword
76
76
77 $ hg log --template '{rev} {transplanted}\n'
77 $ hg log --template '{rev} {transplanted}\n'
78 7 a53251cdf717679d1907b289f991534be05c997a
78 7 a53251cdf717679d1907b289f991534be05c997a
79 6 722f4667af767100cb15b6a79324bf8abbfe1ef4
79 6 722f4667af767100cb15b6a79324bf8abbfe1ef4
80 5 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21
80 5 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21
81 4
81 4
82 3
82 3
83 2
83 2
84 1
84 1
85 0
85 0
86
86
87 test destination() revset predicate with a transplant of a transplant; new
87 test destination() revset predicate with a transplant of a transplant; new
88 clone so subsequent rollback isn't affected
88 clone so subsequent rollback isn't affected
89 (this also tests that editor is invoked if '--edit' is specified)
89 (this also tests that editor is invoked if '--edit' is specified)
90
90
91 $ hg clone -q . ../destination
91 $ hg clone -q . ../destination
92 $ cd ../destination
92 $ cd ../destination
93 $ hg up -Cq 0
93 $ hg up -Cq 0
94 $ hg branch -q b4
94 $ hg branch -q b4
95 $ hg ci -qm "b4"
95 $ hg ci -qm "b4"
96 $ hg status --rev "7^1" --rev 7
96 $ hg status --rev "7^1" --rev 7
97 A b3
97 A b3
98 $ HGEDITOR=cat hg transplant --edit 7
98 $ cat > $TESTTMP/checkeditform.sh <<EOF
99 > env | grep HGEDITFORM
100 > true
101 > EOF
102 $ HGEDITOR="sh $TESTTMP/checkeditform.sh; cat" hg transplant --edit 7
99 applying ffd6818a3975
103 applying ffd6818a3975
104 HGEDITFORM=transplant.normal
100 b3
105 b3
101
106
102
107
103 HG: Enter commit message. Lines beginning with 'HG:' are removed.
108 HG: Enter commit message. Lines beginning with 'HG:' are removed.
104 HG: Leave message empty to abort commit.
109 HG: Leave message empty to abort commit.
105 HG: --
110 HG: --
106 HG: user: test
111 HG: user: test
107 HG: branch 'b4'
112 HG: branch 'b4'
108 HG: added b3
113 HG: added b3
109 ffd6818a3975 transplanted to 502236fa76bb
114 ffd6818a3975 transplanted to 502236fa76bb
110
115
111
116
112 $ hg log -r 'destination()'
117 $ hg log -r 'destination()'
113 changeset: 5:e234d668f844
118 changeset: 5:e234d668f844
114 parent: 1:d11e3596cc1a
119 parent: 1:d11e3596cc1a
115 user: test
120 user: test
116 date: Thu Jan 01 00:00:00 1970 +0000
121 date: Thu Jan 01 00:00:00 1970 +0000
117 summary: b1
122 summary: b1
118
123
119 changeset: 6:539f377d78df
124 changeset: 6:539f377d78df
120 user: test
125 user: test
121 date: Thu Jan 01 00:00:01 1970 +0000
126 date: Thu Jan 01 00:00:01 1970 +0000
122 summary: b2
127 summary: b2
123
128
124 changeset: 7:ffd6818a3975
129 changeset: 7:ffd6818a3975
125 user: test
130 user: test
126 date: Thu Jan 01 00:00:02 1970 +0000
131 date: Thu Jan 01 00:00:02 1970 +0000
127 summary: b3
132 summary: b3
128
133
129 changeset: 9:502236fa76bb
134 changeset: 9:502236fa76bb
130 branch: b4
135 branch: b4
131 tag: tip
136 tag: tip
132 user: test
137 user: test
133 date: Thu Jan 01 00:00:02 1970 +0000
138 date: Thu Jan 01 00:00:02 1970 +0000
134 summary: b3
139 summary: b3
135
140
136 $ hg log -r 'destination(a53251cdf717)'
141 $ hg log -r 'destination(a53251cdf717)'
137 changeset: 7:ffd6818a3975
142 changeset: 7:ffd6818a3975
138 user: test
143 user: test
139 date: Thu Jan 01 00:00:02 1970 +0000
144 date: Thu Jan 01 00:00:02 1970 +0000
140 summary: b3
145 summary: b3
141
146
142 changeset: 9:502236fa76bb
147 changeset: 9:502236fa76bb
143 branch: b4
148 branch: b4
144 tag: tip
149 tag: tip
145 user: test
150 user: test
146 date: Thu Jan 01 00:00:02 1970 +0000
151 date: Thu Jan 01 00:00:02 1970 +0000
147 summary: b3
152 summary: b3
148
153
149
154
150 test subset parameter in reverse order
155 test subset parameter in reverse order
151 $ hg log -r 'reverse(all()) and destination(a53251cdf717)'
156 $ hg log -r 'reverse(all()) and destination(a53251cdf717)'
152 changeset: 9:502236fa76bb
157 changeset: 9:502236fa76bb
153 branch: b4
158 branch: b4
154 tag: tip
159 tag: tip
155 user: test
160 user: test
156 date: Thu Jan 01 00:00:02 1970 +0000
161 date: Thu Jan 01 00:00:02 1970 +0000
157 summary: b3
162 summary: b3
158
163
159 changeset: 7:ffd6818a3975
164 changeset: 7:ffd6818a3975
160 user: test
165 user: test
161 date: Thu Jan 01 00:00:02 1970 +0000
166 date: Thu Jan 01 00:00:02 1970 +0000
162 summary: b3
167 summary: b3
163
168
164
169
165 back to the original dir
170 back to the original dir
166 $ cd ../rebase
171 $ cd ../rebase
167
172
168 rollback the transplant
173 rollback the transplant
169 $ hg rollback
174 $ hg rollback
170 repository tip rolled back to revision 4 (undo transplant)
175 repository tip rolled back to revision 4 (undo transplant)
171 working directory now based on revision 1
176 working directory now based on revision 1
172 $ hg tip -q
177 $ hg tip -q
173 4:a53251cdf717
178 4:a53251cdf717
174 $ hg parents -q
179 $ hg parents -q
175 1:d11e3596cc1a
180 1:d11e3596cc1a
176 $ hg status
181 $ hg status
177 ? b1
182 ? b1
178 ? b2
183 ? b2
179 ? b3
184 ? b3
180
185
181 $ hg clone ../t ../prune
186 $ hg clone ../t ../prune
182 updating to branch default
187 updating to branch default
183 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
188 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
184 $ cd ../prune
189 $ cd ../prune
185
190
186 $ hg up -C 1
191 $ hg up -C 1
187 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
192 1 files updated, 0 files merged, 3 files removed, 0 files unresolved
188
193
189 rebase b onto r1, skipping b2
194 rebase b onto r1, skipping b2
190
195
191 $ hg transplant -a -b tip -p 3
196 $ hg transplant -a -b tip -p 3
192 applying 37a1297eb21b
197 applying 37a1297eb21b
193 37a1297eb21b transplanted to e234d668f844
198 37a1297eb21b transplanted to e234d668f844
194 applying a53251cdf717
199 applying a53251cdf717
195 a53251cdf717 transplanted to 7275fda4d04f
200 a53251cdf717 transplanted to 7275fda4d04f
196 $ hg log --template '{rev} {parents} {desc}\n'
201 $ hg log --template '{rev} {parents} {desc}\n'
197 6 b3
202 6 b3
198 5 1:d11e3596cc1a b1
203 5 1:d11e3596cc1a b1
199 4 b3
204 4 b3
200 3 b2
205 3 b2
201 2 0:17ab29e464c6 b1
206 2 0:17ab29e464c6 b1
202 1 r2
207 1 r2
203 0 r1
208 0 r1
204
209
205 test same-parent transplant with --log
210 test same-parent transplant with --log
206
211
207 $ hg clone -r 1 ../t ../sameparent
212 $ hg clone -r 1 ../t ../sameparent
208 adding changesets
213 adding changesets
209 adding manifests
214 adding manifests
210 adding file changes
215 adding file changes
211 added 2 changesets with 2 changes to 2 files
216 added 2 changesets with 2 changes to 2 files
212 updating to branch default
217 updating to branch default
213 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
218 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
214 $ cd ../sameparent
219 $ cd ../sameparent
215 $ hg transplant --log -s ../prune 5
220 $ hg transplant --log -s ../prune 5
216 searching for changes
221 searching for changes
217 applying e234d668f844
222 applying e234d668f844
218 e234d668f844 transplanted to e07aea8ecf9c
223 e234d668f844 transplanted to e07aea8ecf9c
219 $ hg log --template '{rev} {parents} {desc}\n'
224 $ hg log --template '{rev} {parents} {desc}\n'
220 2 b1
225 2 b1
221 (transplanted from e234d668f844e1b1a765f01db83a32c0c7bfa170)
226 (transplanted from e234d668f844e1b1a765f01db83a32c0c7bfa170)
222 1 r2
227 1 r2
223 0 r1
228 0 r1
224 remote transplant
229 remote transplant
225
230
226 $ hg clone -r 1 ../t ../remote
231 $ hg clone -r 1 ../t ../remote
227 adding changesets
232 adding changesets
228 adding manifests
233 adding manifests
229 adding file changes
234 adding file changes
230 added 2 changesets with 2 changes to 2 files
235 added 2 changesets with 2 changes to 2 files
231 updating to branch default
236 updating to branch default
232 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
237 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
233 $ cd ../remote
238 $ cd ../remote
234 $ hg transplant --log -s ../t 2 4
239 $ hg transplant --log -s ../t 2 4
235 searching for changes
240 searching for changes
236 applying 37a1297eb21b
241 applying 37a1297eb21b
237 37a1297eb21b transplanted to c19cf0ccb069
242 37a1297eb21b transplanted to c19cf0ccb069
238 applying a53251cdf717
243 applying a53251cdf717
239 a53251cdf717 transplanted to f7fe5bf98525
244 a53251cdf717 transplanted to f7fe5bf98525
240 $ hg log --template '{rev} {parents} {desc}\n'
245 $ hg log --template '{rev} {parents} {desc}\n'
241 3 b3
246 3 b3
242 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
247 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
243 2 b1
248 2 b1
244 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
249 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
245 1 r2
250 1 r2
246 0 r1
251 0 r1
247
252
248 skip previous transplants
253 skip previous transplants
249
254
250 $ hg transplant -s ../t -a -b 4
255 $ hg transplant -s ../t -a -b 4
251 searching for changes
256 searching for changes
252 applying 722f4667af76
257 applying 722f4667af76
253 722f4667af76 transplanted to 47156cd86c0b
258 722f4667af76 transplanted to 47156cd86c0b
254 $ hg log --template '{rev} {parents} {desc}\n'
259 $ hg log --template '{rev} {parents} {desc}\n'
255 4 b2
260 4 b2
256 3 b3
261 3 b3
257 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
262 (transplanted from a53251cdf717679d1907b289f991534be05c997a)
258 2 b1
263 2 b1
259 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
264 (transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
260 1 r2
265 1 r2
261 0 r1
266 0 r1
262
267
263 skip local changes transplanted to the source
268 skip local changes transplanted to the source
264
269
265 $ echo b4 > b4
270 $ echo b4 > b4
266 $ hg ci -Amb4 -d '3 0'
271 $ hg ci -Amb4 -d '3 0'
267 adding b4
272 adding b4
268 $ hg clone ../t ../pullback
273 $ hg clone ../t ../pullback
269 updating to branch default
274 updating to branch default
270 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
275 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 $ cd ../pullback
276 $ cd ../pullback
272 $ hg transplant -s ../remote -a -b tip
277 $ hg transplant -s ../remote -a -b tip
273 searching for changes
278 searching for changes
274 applying 4333daefcb15
279 applying 4333daefcb15
275 4333daefcb15 transplanted to 5f42c04e07cc
280 4333daefcb15 transplanted to 5f42c04e07cc
276
281
277
282
278 remote transplant with pull
283 remote transplant with pull
279
284
280 $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
285 $ hg -R ../t serve -p $HGPORT -d --pid-file=../t.pid
281 $ cat ../t.pid >> $DAEMON_PIDS
286 $ cat ../t.pid >> $DAEMON_PIDS
282
287
283 $ hg clone -r 0 ../t ../rp
288 $ hg clone -r 0 ../t ../rp
284 adding changesets
289 adding changesets
285 adding manifests
290 adding manifests
286 adding file changes
291 adding file changes
287 added 1 changesets with 1 changes to 1 files
292 added 1 changesets with 1 changes to 1 files
288 updating to branch default
293 updating to branch default
289 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
294 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
290 $ cd ../rp
295 $ cd ../rp
291 $ hg transplant -s http://localhost:$HGPORT/ 2 4
296 $ hg transplant -s http://localhost:$HGPORT/ 2 4
292 searching for changes
297 searching for changes
293 searching for changes
298 searching for changes
294 adding changesets
299 adding changesets
295 adding manifests
300 adding manifests
296 adding file changes
301 adding file changes
297 added 1 changesets with 1 changes to 1 files
302 added 1 changesets with 1 changes to 1 files
298 applying a53251cdf717
303 applying a53251cdf717
299 a53251cdf717 transplanted to 8d9279348abb
304 a53251cdf717 transplanted to 8d9279348abb
300 $ hg log --template '{rev} {parents} {desc}\n'
305 $ hg log --template '{rev} {parents} {desc}\n'
301 2 b3
306 2 b3
302 1 b1
307 1 b1
303 0 r1
308 0 r1
304
309
305 remote transplant without pull
310 remote transplant without pull
306
311
307 $ hg pull -q http://localhost:$HGPORT/
312 $ hg pull -q http://localhost:$HGPORT/
308 $ hg transplant -s http://localhost:$HGPORT/ 2 4
313 $ hg transplant -s http://localhost:$HGPORT/ 2 4
309 searching for changes
314 searching for changes
310 skipping already applied revision 2:8d9279348abb
315 skipping already applied revision 2:8d9279348abb
311 applying 722f4667af76
316 applying 722f4667af76
312 722f4667af76 transplanted to 76e321915884
317 722f4667af76 transplanted to 76e321915884
313
318
314 transplant --continue
319 transplant --continue
315
320
316 $ hg init ../tc
321 $ hg init ../tc
317 $ cd ../tc
322 $ cd ../tc
318 $ cat <<EOF > foo
323 $ cat <<EOF > foo
319 > foo
324 > foo
320 > bar
325 > bar
321 > baz
326 > baz
322 > EOF
327 > EOF
323 $ echo toremove > toremove
328 $ echo toremove > toremove
324 $ echo baz > baz
329 $ echo baz > baz
325 $ hg ci -Amfoo
330 $ hg ci -Amfoo
326 adding baz
331 adding baz
327 adding foo
332 adding foo
328 adding toremove
333 adding toremove
329 $ cat <<EOF > foo
334 $ cat <<EOF > foo
330 > foo2
335 > foo2
331 > bar2
336 > bar2
332 > baz2
337 > baz2
333 > EOF
338 > EOF
334 $ rm toremove
339 $ rm toremove
335 $ echo added > added
340 $ echo added > added
336 $ hg ci -Amfoo2
341 $ hg ci -Amfoo2
337 adding added
342 adding added
338 removing toremove
343 removing toremove
339 $ echo bar > bar
344 $ echo bar > bar
340 $ cat > baz <<EOF
345 $ cat > baz <<EOF
341 > before baz
346 > before baz
342 > baz
347 > baz
343 > after baz
348 > after baz
344 > EOF
349 > EOF
345 $ hg ci -Ambar
350 $ hg ci -Ambar
346 adding bar
351 adding bar
347 $ echo bar2 >> bar
352 $ echo bar2 >> bar
348 $ hg ci -mbar2
353 $ hg ci -mbar2
349 $ hg up 0
354 $ hg up 0
350 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
355 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
351 $ echo foobar > foo
356 $ echo foobar > foo
352 $ hg ci -mfoobar
357 $ hg ci -mfoobar
353 created new head
358 created new head
354 $ hg transplant 1:3
359 $ hg transplant 1:3
355 applying 46ae92138f3c
360 applying 46ae92138f3c
356 patching file foo
361 patching file foo
357 Hunk #1 FAILED at 0
362 Hunk #1 FAILED at 0
358 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
363 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
359 patch failed to apply
364 patch failed to apply
360 abort: fix up the merge and run hg transplant --continue
365 abort: fix up the merge and run hg transplant --continue
361 [255]
366 [255]
362
367
363 transplant -c shouldn't use an old changeset
368 transplant -c shouldn't use an old changeset
364
369
365 $ hg up -C
370 $ hg up -C
366 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
371 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 $ rm added
372 $ rm added
368 $ hg transplant 1
373 $ hg transplant 1
369 applying 46ae92138f3c
374 applying 46ae92138f3c
370 patching file foo
375 patching file foo
371 Hunk #1 FAILED at 0
376 Hunk #1 FAILED at 0
372 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
377 1 out of 1 hunks FAILED -- saving rejects to file foo.rej
373 patch failed to apply
378 patch failed to apply
374 abort: fix up the merge and run hg transplant --continue
379 abort: fix up the merge and run hg transplant --continue
375 [255]
380 [255]
376 $ hg transplant --continue
381 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
382 HGEDITFORM=transplant.normal
377 46ae92138f3c transplanted as 9159dada197d
383 46ae92138f3c transplanted as 9159dada197d
378 $ hg transplant 1:3
384 $ hg transplant 1:3
379 skipping already applied revision 1:46ae92138f3c
385 skipping already applied revision 1:46ae92138f3c
380 applying 9d6d6b5a8275
386 applying 9d6d6b5a8275
381 9d6d6b5a8275 transplanted to 2d17a10c922f
387 9d6d6b5a8275 transplanted to 2d17a10c922f
382 applying 1dab759070cf
388 applying 1dab759070cf
383 1dab759070cf transplanted to e06a69927eb0
389 1dab759070cf transplanted to e06a69927eb0
384 $ hg locate
390 $ hg locate
385 added
391 added
386 bar
392 bar
387 baz
393 baz
388 foo
394 foo
389
395
390 test multiple revisions and --continue
396 test multiple revisions and --continue
391
397
392 $ hg up -qC 0
398 $ hg up -qC 0
393 $ echo bazbaz > baz
399 $ echo bazbaz > baz
394 $ hg ci -Am anotherbaz baz
400 $ hg ci -Am anotherbaz baz
395 created new head
401 created new head
396 $ hg transplant 1:3
402 $ hg transplant 1:3
397 applying 46ae92138f3c
403 applying 46ae92138f3c
398 46ae92138f3c transplanted to 1024233ea0ba
404 46ae92138f3c transplanted to 1024233ea0ba
399 applying 9d6d6b5a8275
405 applying 9d6d6b5a8275
400 patching file baz
406 patching file baz
401 Hunk #1 FAILED at 0
407 Hunk #1 FAILED at 0
402 1 out of 1 hunks FAILED -- saving rejects to file baz.rej
408 1 out of 1 hunks FAILED -- saving rejects to file baz.rej
403 patch failed to apply
409 patch failed to apply
404 abort: fix up the merge and run hg transplant --continue
410 abort: fix up the merge and run hg transplant --continue
405 [255]
411 [255]
406 $ echo fixed > baz
412 $ echo fixed > baz
407 $ hg transplant --continue
413 $ hg transplant --continue
408 9d6d6b5a8275 transplanted as d80c49962290
414 9d6d6b5a8275 transplanted as d80c49962290
409 applying 1dab759070cf
415 applying 1dab759070cf
410 1dab759070cf transplanted to aa0ffe6bd5ae
416 1dab759070cf transplanted to aa0ffe6bd5ae
411
417
412 $ cd ..
418 $ cd ..
413
419
414 Issue1111: Test transplant --merge
420 Issue1111: Test transplant --merge
415
421
416 $ hg init t1111
422 $ hg init t1111
417 $ cd t1111
423 $ cd t1111
418 $ echo a > a
424 $ echo a > a
419 $ hg ci -Am adda
425 $ hg ci -Am adda
420 adding a
426 adding a
421 $ echo b >> a
427 $ echo b >> a
422 $ hg ci -m appendb
428 $ hg ci -m appendb
423 $ echo c >> a
429 $ echo c >> a
424 $ hg ci -m appendc
430 $ hg ci -m appendc
425 $ hg up -C 0
431 $ hg up -C 0
426 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
432 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
427 $ echo d >> a
433 $ echo d >> a
428 $ hg ci -m appendd
434 $ hg ci -m appendd
429 created new head
435 created new head
430
436
431 transplant
437 transplant
432
438
433 $ hg transplant -m 1
439 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant -m 1 -e
434 applying 42dc4432fd35
440 applying 42dc4432fd35
441 HGEDITFORM=transplant.merge
435 1:42dc4432fd35 merged at a9f4acbac129
442 1:42dc4432fd35 merged at a9f4acbac129
443 $ hg update -q -C 2
444 $ cat > a <<EOF
445 > x
446 > y
447 > z
448 > EOF
449 $ hg commit -m replace
450 $ hg update -q -C 4
451 $ hg transplant -m 5
452 applying 600a3cdcb41d
453 patching file a
454 Hunk #1 FAILED at 0
455 1 out of 1 hunks FAILED -- saving rejects to file a.rej
456 patch failed to apply
457 abort: fix up the merge and run hg transplant --continue
458 [255]
459 $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
460 HGEDITFORM=transplant.merge
461 600a3cdcb41d transplanted as a3f88be652e0
462
436 $ cd ..
463 $ cd ..
437
464
438 test transplant into empty repository
465 test transplant into empty repository
439
466
440 $ hg init empty
467 $ hg init empty
441 $ cd empty
468 $ cd empty
442 $ hg transplant -s ../t -b tip -a
469 $ hg transplant -s ../t -b tip -a
443 adding changesets
470 adding changesets
444 adding manifests
471 adding manifests
445 adding file changes
472 adding file changes
446 added 4 changesets with 4 changes to 4 files
473 added 4 changesets with 4 changes to 4 files
447
474
448 test "--merge" causing pull from source repository on local host
475 test "--merge" causing pull from source repository on local host
449
476
450 $ hg --config extensions.mq= -q strip 2
477 $ hg --config extensions.mq= -q strip 2
451 $ hg transplant -s ../t --merge tip
478 $ hg transplant -s ../t --merge tip
452 searching for changes
479 searching for changes
453 searching for changes
480 searching for changes
454 adding changesets
481 adding changesets
455 adding manifests
482 adding manifests
456 adding file changes
483 adding file changes
457 added 2 changesets with 2 changes to 2 files
484 added 2 changesets with 2 changes to 2 files
458 applying a53251cdf717
485 applying a53251cdf717
459 4:a53251cdf717 merged at 4831f4dc831a
486 4:a53251cdf717 merged at 4831f4dc831a
460
487
461 test interactive transplant
488 test interactive transplant
462
489
463 $ hg --config extensions.strip= -q strip 0
490 $ hg --config extensions.strip= -q strip 0
464 $ hg -R ../t log -G --template "{rev}:{node|short}"
491 $ hg -R ../t log -G --template "{rev}:{node|short}"
465 @ 4:a53251cdf717
492 @ 4:a53251cdf717
466 |
493 |
467 o 3:722f4667af76
494 o 3:722f4667af76
468 |
495 |
469 o 2:37a1297eb21b
496 o 2:37a1297eb21b
470 |
497 |
471 | o 1:d11e3596cc1a
498 | o 1:d11e3596cc1a
472 |/
499 |/
473 o 0:17ab29e464c6
500 o 0:17ab29e464c6
474
501
475 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
502 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
476 > p
503 > p
477 > y
504 > y
478 > n
505 > n
479 > n
506 > n
480 > m
507 > m
481 > c
508 > c
482 > EOF
509 > EOF
483 0:17ab29e464c6
510 0:17ab29e464c6
484 apply changeset? [ynmpcq?]: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
511 apply changeset? [ynmpcq?]: --- /dev/null Thu Jan 01 00:00:00 1970 +0000
485 +++ b/r1 Thu Jan 01 00:00:00 1970 +0000
512 +++ b/r1 Thu Jan 01 00:00:00 1970 +0000
486 @@ -0,0 +1,1 @@
513 @@ -0,0 +1,1 @@
487 +r1
514 +r1
488 apply changeset? [ynmpcq?]: 1:d11e3596cc1a
515 apply changeset? [ynmpcq?]: 1:d11e3596cc1a
489 apply changeset? [ynmpcq?]: 2:37a1297eb21b
516 apply changeset? [ynmpcq?]: 2:37a1297eb21b
490 apply changeset? [ynmpcq?]: 3:722f4667af76
517 apply changeset? [ynmpcq?]: 3:722f4667af76
491 apply changeset? [ynmpcq?]: 4:a53251cdf717
518 apply changeset? [ynmpcq?]: 4:a53251cdf717
492 apply changeset? [ynmpcq?]: (no-eol)
519 apply changeset? [ynmpcq?]: (no-eol)
493 $ hg log -G --template "{node|short}"
520 $ hg log -G --template "{node|short}"
494 @ 88be5dde5260
521 @ 88be5dde5260
495 |\
522 |\
496 | o 722f4667af76
523 | o 722f4667af76
497 | |
524 | |
498 | o 37a1297eb21b
525 | o 37a1297eb21b
499 |/
526 |/
500 o 17ab29e464c6
527 o 17ab29e464c6
501
528
502 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
529 $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
503 > x
530 > x
504 > ?
531 > ?
505 > y
532 > y
506 > q
533 > q
507 > EOF
534 > EOF
508 1:d11e3596cc1a
535 1:d11e3596cc1a
509 apply changeset? [ynmpcq?]: unrecognized response
536 apply changeset? [ynmpcq?]: unrecognized response
510 apply changeset? [ynmpcq?]: y: yes, transplant this changeset
537 apply changeset? [ynmpcq?]: y: yes, transplant this changeset
511 n: no, skip this changeset
538 n: no, skip this changeset
512 m: merge at this changeset
539 m: merge at this changeset
513 p: show patch
540 p: show patch
514 c: commit selected changesets
541 c: commit selected changesets
515 q: quit and cancel transplant
542 q: quit and cancel transplant
516 ?: ? (show this help)
543 ?: ? (show this help)
517 apply changeset? [ynmpcq?]: 4:a53251cdf717
544 apply changeset? [ynmpcq?]: 4:a53251cdf717
518 apply changeset? [ynmpcq?]: (no-eol)
545 apply changeset? [ynmpcq?]: (no-eol)
519 $ hg heads --template "{node|short}\n"
546 $ hg heads --template "{node|short}\n"
520 88be5dde5260
547 88be5dde5260
521
548
522 $ cd ..
549 $ cd ..
523
550
524
551
525 #if unix-permissions system-sh
552 #if unix-permissions system-sh
526
553
527 test filter
554 test filter
528
555
529 $ hg init filter
556 $ hg init filter
530 $ cd filter
557 $ cd filter
531 $ cat <<'EOF' >test-filter
558 $ cat <<'EOF' >test-filter
532 > #!/bin/sh
559 > #!/bin/sh
533 > sed 's/r1/r2/' $1 > $1.new
560 > sed 's/r1/r2/' $1 > $1.new
534 > mv $1.new $1
561 > mv $1.new $1
535 > EOF
562 > EOF
536 $ chmod +x test-filter
563 $ chmod +x test-filter
537 $ hg transplant -s ../t -b tip -a --filter ./test-filter
564 $ hg transplant -s ../t -b tip -a --filter ./test-filter
538 filtering * (glob)
565 filtering * (glob)
539 applying 17ab29e464c6
566 applying 17ab29e464c6
540 17ab29e464c6 transplanted to e9ffc54ea104
567 17ab29e464c6 transplanted to e9ffc54ea104
541 filtering * (glob)
568 filtering * (glob)
542 applying 37a1297eb21b
569 applying 37a1297eb21b
543 37a1297eb21b transplanted to 348b36d0b6a5
570 37a1297eb21b transplanted to 348b36d0b6a5
544 filtering * (glob)
571 filtering * (glob)
545 applying 722f4667af76
572 applying 722f4667af76
546 722f4667af76 transplanted to 0aa6979afb95
573 722f4667af76 transplanted to 0aa6979afb95
547 filtering * (glob)
574 filtering * (glob)
548 applying a53251cdf717
575 applying a53251cdf717
549 a53251cdf717 transplanted to 14f8512272b5
576 a53251cdf717 transplanted to 14f8512272b5
550 $ hg log --template '{rev} {parents} {desc}\n'
577 $ hg log --template '{rev} {parents} {desc}\n'
551 3 b3
578 3 b3
552 2 b2
579 2 b2
553 1 b1
580 1 b1
554 0 r2
581 0 r2
555 $ cd ..
582 $ cd ..
556
583
557
584
558 test filter with failed patch
585 test filter with failed patch
559
586
560 $ cd filter
587 $ cd filter
561 $ hg up 0
588 $ hg up 0
562 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
589 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
563 $ echo foo > b1
590 $ echo foo > b1
564 $ hg ci -Am foo
591 $ hg ci -Am foo
565 adding b1
592 adding b1
566 adding test-filter
593 adding test-filter
567 created new head
594 created new head
568 $ hg transplant 1 --filter ./test-filter
595 $ hg transplant 1 --filter ./test-filter
569 filtering * (glob)
596 filtering * (glob)
570 applying 348b36d0b6a5
597 applying 348b36d0b6a5
571 file b1 already exists
598 file b1 already exists
572 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
599 1 out of 1 hunks FAILED -- saving rejects to file b1.rej
573 patch failed to apply
600 patch failed to apply
574 abort: fix up the merge and run hg transplant --continue
601 abort: fix up the merge and run hg transplant --continue
575 [255]
602 [255]
576 $ cd ..
603 $ cd ..
577
604
578 test environment passed to filter
605 test environment passed to filter
579
606
580 $ hg init filter-environment
607 $ hg init filter-environment
581 $ cd filter-environment
608 $ cd filter-environment
582 $ cat <<'EOF' >test-filter-environment
609 $ cat <<'EOF' >test-filter-environment
583 > #!/bin/sh
610 > #!/bin/sh
584 > echo "Transplant by $HGUSER" >> $1
611 > echo "Transplant by $HGUSER" >> $1
585 > echo "Transplant from rev $HGREVISION" >> $1
612 > echo "Transplant from rev $HGREVISION" >> $1
586 > EOF
613 > EOF
587 $ chmod +x test-filter-environment
614 $ chmod +x test-filter-environment
588 $ hg transplant -s ../t --filter ./test-filter-environment 0
615 $ hg transplant -s ../t --filter ./test-filter-environment 0
589 filtering * (glob)
616 filtering * (glob)
590 applying 17ab29e464c6
617 applying 17ab29e464c6
591 17ab29e464c6 transplanted to 5190e68026a0
618 17ab29e464c6 transplanted to 5190e68026a0
592
619
593 $ hg log --template '{rev} {parents} {desc}\n'
620 $ hg log --template '{rev} {parents} {desc}\n'
594 0 r1
621 0 r1
595 Transplant by test
622 Transplant by test
596 Transplant from rev 17ab29e464c6ca53e329470efe2a9918ac617a6f
623 Transplant from rev 17ab29e464c6ca53e329470efe2a9918ac617a6f
597 $ cd ..
624 $ cd ..
598
625
599 test transplant with filter handles invalid changelog
626 test transplant with filter handles invalid changelog
600
627
601 $ hg init filter-invalid-log
628 $ hg init filter-invalid-log
602 $ cd filter-invalid-log
629 $ cd filter-invalid-log
603 $ cat <<'EOF' >test-filter-invalid-log
630 $ cat <<'EOF' >test-filter-invalid-log
604 > #!/bin/sh
631 > #!/bin/sh
605 > echo "" > $1
632 > echo "" > $1
606 > EOF
633 > EOF
607 $ chmod +x test-filter-invalid-log
634 $ chmod +x test-filter-invalid-log
608 $ hg transplant -s ../t --filter ./test-filter-invalid-log 0
635 $ hg transplant -s ../t --filter ./test-filter-invalid-log 0
609 filtering * (glob)
636 filtering * (glob)
610 abort: filter corrupted changeset (no user or date)
637 abort: filter corrupted changeset (no user or date)
611 [255]
638 [255]
612 $ cd ..
639 $ cd ..
613
640
614 #endif
641 #endif
615
642
616
643
617 test with a win32ext like setup (differing EOLs)
644 test with a win32ext like setup (differing EOLs)
618
645
619 $ hg init twin1
646 $ hg init twin1
620 $ cd twin1
647 $ cd twin1
621 $ echo a > a
648 $ echo a > a
622 $ echo b > b
649 $ echo b > b
623 $ echo b >> b
650 $ echo b >> b
624 $ hg ci -Am t
651 $ hg ci -Am t
625 adding a
652 adding a
626 adding b
653 adding b
627 $ echo a > b
654 $ echo a > b
628 $ echo b >> b
655 $ echo b >> b
629 $ hg ci -m changeb
656 $ hg ci -m changeb
630 $ cd ..
657 $ cd ..
631
658
632 $ hg init twin2
659 $ hg init twin2
633 $ cd twin2
660 $ cd twin2
634 $ echo '[patch]' >> .hg/hgrc
661 $ echo '[patch]' >> .hg/hgrc
635 $ echo 'eol = crlf' >> .hg/hgrc
662 $ echo 'eol = crlf' >> .hg/hgrc
636 $ python -c "file('b', 'wb').write('b\r\nb\r\n')"
663 $ python -c "file('b', 'wb').write('b\r\nb\r\n')"
637 $ hg ci -Am addb
664 $ hg ci -Am addb
638 adding b
665 adding b
639 $ hg transplant -s ../twin1 tip
666 $ hg transplant -s ../twin1 tip
640 searching for changes
667 searching for changes
641 warning: repository is unrelated
668 warning: repository is unrelated
642 applying 2e849d776c17
669 applying 2e849d776c17
643 2e849d776c17 transplanted to 8e65bebc063e
670 2e849d776c17 transplanted to 8e65bebc063e
644 $ cat b
671 $ cat b
645 a\r (esc)
672 a\r (esc)
646 b\r (esc)
673 b\r (esc)
647 $ cd ..
674 $ cd ..
648
675
649 test transplant with merge changeset is skipped
676 test transplant with merge changeset is skipped
650
677
651 $ hg init merge1a
678 $ hg init merge1a
652 $ cd merge1a
679 $ cd merge1a
653 $ echo a > a
680 $ echo a > a
654 $ hg ci -Am a
681 $ hg ci -Am a
655 adding a
682 adding a
656 $ hg branch b
683 $ hg branch b
657 marked working directory as branch b
684 marked working directory as branch b
658 (branches are permanent and global, did you want a bookmark?)
685 (branches are permanent and global, did you want a bookmark?)
659 $ hg ci -m branchb
686 $ hg ci -m branchb
660 $ echo b > b
687 $ echo b > b
661 $ hg ci -Am b
688 $ hg ci -Am b
662 adding b
689 adding b
663 $ hg update default
690 $ hg update default
664 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
691 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
665 $ hg merge b
692 $ hg merge b
666 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
693 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
667 (branch merge, don't forget to commit)
694 (branch merge, don't forget to commit)
668 $ hg ci -m mergeb
695 $ hg ci -m mergeb
669 $ cd ..
696 $ cd ..
670
697
671 $ hg init merge1b
698 $ hg init merge1b
672 $ cd merge1b
699 $ cd merge1b
673 $ hg transplant -s ../merge1a tip
700 $ hg transplant -s ../merge1a tip
674 $ cd ..
701 $ cd ..
675
702
676 test transplant with merge changeset accepts --parent
703 test transplant with merge changeset accepts --parent
677
704
678 $ hg init merge2a
705 $ hg init merge2a
679 $ cd merge2a
706 $ cd merge2a
680 $ echo a > a
707 $ echo a > a
681 $ hg ci -Am a
708 $ hg ci -Am a
682 adding a
709 adding a
683 $ hg branch b
710 $ hg branch b
684 marked working directory as branch b
711 marked working directory as branch b
685 (branches are permanent and global, did you want a bookmark?)
712 (branches are permanent and global, did you want a bookmark?)
686 $ hg ci -m branchb
713 $ hg ci -m branchb
687 $ echo b > b
714 $ echo b > b
688 $ hg ci -Am b
715 $ hg ci -Am b
689 adding b
716 adding b
690 $ hg update default
717 $ hg update default
691 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
718 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
692 $ hg merge b
719 $ hg merge b
693 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
720 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
694 (branch merge, don't forget to commit)
721 (branch merge, don't forget to commit)
695 $ hg ci -m mergeb
722 $ hg ci -m mergeb
696 $ cd ..
723 $ cd ..
697
724
698 $ hg init merge2b
725 $ hg init merge2b
699 $ cd merge2b
726 $ cd merge2b
700 $ hg transplant -s ../merge2a --parent 0 tip
727 $ hg transplant -s ../merge2a --parent 0 tip
701 applying be9f9b39483f
728 applying be9f9b39483f
702 be9f9b39483f transplanted to 9959e51f94d1
729 be9f9b39483f transplanted to 9959e51f94d1
703 $ cd ..
730 $ cd ..
704
731
705 test transplanting a patch turning into a no-op
732 test transplanting a patch turning into a no-op
706
733
707 $ hg init binarysource
734 $ hg init binarysource
708 $ cd binarysource
735 $ cd binarysource
709 $ echo a > a
736 $ echo a > a
710 $ hg ci -Am adda a
737 $ hg ci -Am adda a
711 >>> file('b', 'wb').write('\0b1')
738 >>> file('b', 'wb').write('\0b1')
712 $ hg ci -Am addb b
739 $ hg ci -Am addb b
713 >>> file('b', 'wb').write('\0b2')
740 >>> file('b', 'wb').write('\0b2')
714 $ hg ci -m changeb b
741 $ hg ci -m changeb b
715 $ cd ..
742 $ cd ..
716
743
717 $ hg clone -r0 binarysource binarydest
744 $ hg clone -r0 binarysource binarydest
718 adding changesets
745 adding changesets
719 adding manifests
746 adding manifests
720 adding file changes
747 adding file changes
721 added 1 changesets with 1 changes to 1 files
748 added 1 changesets with 1 changes to 1 files
722 updating to branch default
749 updating to branch default
723 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
750 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
724 $ cd binarydest
751 $ cd binarydest
725 $ cp ../binarysource/b b
752 $ cp ../binarysource/b b
726 $ hg ci -Am addb2 b
753 $ hg ci -Am addb2 b
727 $ hg transplant -s ../binarysource 2
754 $ hg transplant -s ../binarysource 2
728 searching for changes
755 searching for changes
729 applying 7a7d57e15850
756 applying 7a7d57e15850
730 skipping emptied changeset 7a7d57e15850
757 skipping emptied changeset 7a7d57e15850
731 $ cd ..
758 $ cd ..
732
759
733 Explicitly kill daemons to let the test exit on Windows
760 Explicitly kill daemons to let the test exit on Windows
734
761
735 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
762 $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS
736
763
General Comments 0
You need to be logged in to leave comments. Login now