##// END OF EJS Templates
rebase: prevent creating divergence...
Laurent Charignon -
r27746:f0e9f38d default
parent child Browse files
Show More
@@ -1,1247 +1,1258 b''
1 # rebase.py - rebasing feature for mercurial
1 # rebase.py - rebasing feature for mercurial
2 #
2 #
3 # Copyright 2008 Stefano Tortarolo <stefano.tortarolo at gmail dot com>
3 # Copyright 2008 Stefano Tortarolo <stefano.tortarolo at gmail dot 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 move sets of revisions to a different ancestor
8 '''command to move sets of revisions to a different ancestor
9
9
10 This extension lets you rebase changesets in an existing Mercurial
10 This extension lets you rebase changesets in an existing Mercurial
11 repository.
11 repository.
12
12
13 For more information:
13 For more information:
14 https://mercurial-scm.org/wiki/RebaseExtension
14 https://mercurial-scm.org/wiki/RebaseExtension
15 '''
15 '''
16
16
17 from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks
17 from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks
18 from mercurial import extensions, patch, scmutil, phases, obsolete, error
18 from mercurial import extensions, patch, scmutil, phases, obsolete, error
19 from mercurial import copies, repoview, revset
19 from mercurial import copies, repoview, revset
20 from mercurial.commands import templateopts
20 from mercurial.commands import templateopts
21 from mercurial.node import nullrev, nullid, hex, short
21 from mercurial.node import nullrev, nullid, hex, short
22 from mercurial.lock import release
22 from mercurial.lock import release
23 from mercurial.i18n import _
23 from mercurial.i18n import _
24 import os, errno
24 import os, errno
25
25
26 # The following constants are used throughout the rebase module. The ordering of
26 # The following constants are used throughout the rebase module. The ordering of
27 # their values must be maintained.
27 # their values must be maintained.
28
28
29 # Indicates that a revision needs to be rebased
29 # Indicates that a revision needs to be rebased
30 revtodo = -1
30 revtodo = -1
31 nullmerge = -2
31 nullmerge = -2
32 revignored = -3
32 revignored = -3
33 # successor in rebase destination
33 # successor in rebase destination
34 revprecursor = -4
34 revprecursor = -4
35 # plain prune (no successor)
35 # plain prune (no successor)
36 revpruned = -5
36 revpruned = -5
37 revskipped = (revignored, revprecursor, revpruned)
37 revskipped = (revignored, revprecursor, revpruned)
38
38
39 cmdtable = {}
39 cmdtable = {}
40 command = cmdutil.command(cmdtable)
40 command = cmdutil.command(cmdtable)
41 # Note for extension authors: ONLY specify testedwith = 'internal' for
41 # Note for extension authors: ONLY specify testedwith = 'internal' for
42 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
42 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
43 # be specifying the version(s) of Mercurial they are tested with, or
43 # be specifying the version(s) of Mercurial they are tested with, or
44 # leave the attribute unspecified.
44 # leave the attribute unspecified.
45 testedwith = 'internal'
45 testedwith = 'internal'
46
46
47 def _nothingtorebase():
47 def _nothingtorebase():
48 return 1
48 return 1
49
49
50 def _makeextrafn(copiers):
50 def _makeextrafn(copiers):
51 """make an extrafn out of the given copy-functions.
51 """make an extrafn out of the given copy-functions.
52
52
53 A copy function takes a context and an extra dict, and mutates the
53 A copy function takes a context and an extra dict, and mutates the
54 extra dict as needed based on the given context.
54 extra dict as needed based on the given context.
55 """
55 """
56 def extrafn(ctx, extra):
56 def extrafn(ctx, extra):
57 for c in copiers:
57 for c in copiers:
58 c(ctx, extra)
58 c(ctx, extra)
59 return extrafn
59 return extrafn
60
60
61 def _destrebase(repo):
61 def _destrebase(repo):
62 # Destination defaults to the latest revision in the
62 # Destination defaults to the latest revision in the
63 # current branch
63 # current branch
64 branch = repo[None].branch()
64 branch = repo[None].branch()
65 return repo[branch].rev()
65 return repo[branch].rev()
66
66
67 revsetpredicate = revset.extpredicate()
67 revsetpredicate = revset.extpredicate()
68
68
69 @revsetpredicate('_destrebase')
69 @revsetpredicate('_destrebase')
70 def _revsetdestrebase(repo, subset, x):
70 def _revsetdestrebase(repo, subset, x):
71 # ``_rebasedefaultdest()``
71 # ``_rebasedefaultdest()``
72
72
73 # default destination for rebase.
73 # default destination for rebase.
74 # # XXX: Currently private because I expect the signature to change.
74 # # XXX: Currently private because I expect the signature to change.
75 # # XXX: - taking rev as arguments,
75 # # XXX: - taking rev as arguments,
76 # # XXX: - bailing out in case of ambiguity vs returning all data.
76 # # XXX: - bailing out in case of ambiguity vs returning all data.
77 # # XXX: - probably merging with the merge destination.
77 # # XXX: - probably merging with the merge destination.
78 # i18n: "_rebasedefaultdest" is a keyword
78 # i18n: "_rebasedefaultdest" is a keyword
79 revset.getargs(x, 0, 0, _("_rebasedefaultdest takes no arguments"))
79 revset.getargs(x, 0, 0, _("_rebasedefaultdest takes no arguments"))
80 return subset & revset.baseset([_destrebase(repo)])
80 return subset & revset.baseset([_destrebase(repo)])
81
81
82 @command('rebase',
82 @command('rebase',
83 [('s', 'source', '',
83 [('s', 'source', '',
84 _('rebase the specified changeset and descendants'), _('REV')),
84 _('rebase the specified changeset and descendants'), _('REV')),
85 ('b', 'base', '',
85 ('b', 'base', '',
86 _('rebase everything from branching point of specified changeset'),
86 _('rebase everything from branching point of specified changeset'),
87 _('REV')),
87 _('REV')),
88 ('r', 'rev', [],
88 ('r', 'rev', [],
89 _('rebase these revisions'),
89 _('rebase these revisions'),
90 _('REV')),
90 _('REV')),
91 ('d', 'dest', '',
91 ('d', 'dest', '',
92 _('rebase onto the specified changeset'), _('REV')),
92 _('rebase onto the specified changeset'), _('REV')),
93 ('', 'collapse', False, _('collapse the rebased changesets')),
93 ('', 'collapse', False, _('collapse the rebased changesets')),
94 ('m', 'message', '',
94 ('m', 'message', '',
95 _('use text as collapse commit message'), _('TEXT')),
95 _('use text as collapse commit message'), _('TEXT')),
96 ('e', 'edit', False, _('invoke editor on commit messages')),
96 ('e', 'edit', False, _('invoke editor on commit messages')),
97 ('l', 'logfile', '',
97 ('l', 'logfile', '',
98 _('read collapse commit message from file'), _('FILE')),
98 _('read collapse commit message from file'), _('FILE')),
99 ('k', 'keep', False, _('keep original changesets')),
99 ('k', 'keep', False, _('keep original changesets')),
100 ('', 'keepbranches', False, _('keep original branch names')),
100 ('', 'keepbranches', False, _('keep original branch names')),
101 ('D', 'detach', False, _('(DEPRECATED)')),
101 ('D', 'detach', False, _('(DEPRECATED)')),
102 ('i', 'interactive', False, _('(DEPRECATED)')),
102 ('i', 'interactive', False, _('(DEPRECATED)')),
103 ('t', 'tool', '', _('specify merge tool')),
103 ('t', 'tool', '', _('specify merge tool')),
104 ('c', 'continue', False, _('continue an interrupted rebase')),
104 ('c', 'continue', False, _('continue an interrupted rebase')),
105 ('a', 'abort', False, _('abort an interrupted rebase'))] +
105 ('a', 'abort', False, _('abort an interrupted rebase'))] +
106 templateopts,
106 templateopts,
107 _('[-s REV | -b REV] [-d REV] [OPTION]'))
107 _('[-s REV | -b REV] [-d REV] [OPTION]'))
108 def rebase(ui, repo, **opts):
108 def rebase(ui, repo, **opts):
109 """move changeset (and descendants) to a different branch
109 """move changeset (and descendants) to a different branch
110
110
111 Rebase uses repeated merging to graft changesets from one part of
111 Rebase uses repeated merging to graft changesets from one part of
112 history (the source) onto another (the destination). This can be
112 history (the source) onto another (the destination). This can be
113 useful for linearizing *local* changes relative to a master
113 useful for linearizing *local* changes relative to a master
114 development tree.
114 development tree.
115
115
116 Published commits cannot be rebased (see :hg:`help phases`).
116 Published commits cannot be rebased (see :hg:`help phases`).
117 To copy commits, see :hg:`help graft`.
117 To copy commits, see :hg:`help graft`.
118
118
119 If you don't specify a destination changeset (``-d/--dest``),
119 If you don't specify a destination changeset (``-d/--dest``),
120 rebase uses the current branch tip as the destination. (The
120 rebase uses the current branch tip as the destination. (The
121 destination changeset is not modified by rebasing, but new
121 destination changeset is not modified by rebasing, but new
122 changesets are added as its descendants.)
122 changesets are added as its descendants.)
123
123
124 There are three ways to select changesets::
124 There are three ways to select changesets::
125
125
126 1. Explicitly select them using ``--rev``.
126 1. Explicitly select them using ``--rev``.
127
127
128 2. Use ``--source`` to select a root changeset and include all of its
128 2. Use ``--source`` to select a root changeset and include all of its
129 descendants.
129 descendants.
130
130
131 3. Use ``--base`` to select a changeset; rebase will find ancestors
131 3. Use ``--base`` to select a changeset; rebase will find ancestors
132 and their descendants which are not also ancestors of the destination.
132 and their descendants which are not also ancestors of the destination.
133
133
134 Rebase will destroy original changesets unless you use ``--keep``.
134 Rebase will destroy original changesets unless you use ``--keep``.
135 It will also move your bookmarks (even if you do).
135 It will also move your bookmarks (even if you do).
136
136
137 Some changesets may be dropped if they do not contribute changes
137 Some changesets may be dropped if they do not contribute changes
138 (e.g. merges from the destination branch).
138 (e.g. merges from the destination branch).
139
139
140 Unlike ``merge``, rebase will do nothing if you are at the branch tip of
140 Unlike ``merge``, rebase will do nothing if you are at the branch tip of
141 a named branch with two heads. You will need to explicitly specify source
141 a named branch with two heads. You will need to explicitly specify source
142 and/or destination.
142 and/or destination.
143
143
144 If a rebase is interrupted to manually resolve a conflict, it can be
144 If a rebase is interrupted to manually resolve a conflict, it can be
145 continued with --continue/-c or aborted with --abort/-a.
145 continued with --continue/-c or aborted with --abort/-a.
146
146
147 .. container:: verbose
147 .. container:: verbose
148
148
149 Examples:
149 Examples:
150
150
151 - move "local changes" (current commit back to branching point)
151 - move "local changes" (current commit back to branching point)
152 to the current branch tip after a pull::
152 to the current branch tip after a pull::
153
153
154 hg rebase
154 hg rebase
155
155
156 - move a single changeset to the stable branch::
156 - move a single changeset to the stable branch::
157
157
158 hg rebase -r 5f493448 -d stable
158 hg rebase -r 5f493448 -d stable
159
159
160 - splice a commit and all its descendants onto another part of history::
160 - splice a commit and all its descendants onto another part of history::
161
161
162 hg rebase --source c0c3 --dest 4cf9
162 hg rebase --source c0c3 --dest 4cf9
163
163
164 - rebase everything on a branch marked by a bookmark onto the
164 - rebase everything on a branch marked by a bookmark onto the
165 default branch::
165 default branch::
166
166
167 hg rebase --base myfeature --dest default
167 hg rebase --base myfeature --dest default
168
168
169 - collapse a sequence of changes into a single commit::
169 - collapse a sequence of changes into a single commit::
170
170
171 hg rebase --collapse -r 1520:1525 -d .
171 hg rebase --collapse -r 1520:1525 -d .
172
172
173 - move a named branch while preserving its name::
173 - move a named branch while preserving its name::
174
174
175 hg rebase -r "branch(featureX)" -d 1.3 --keepbranches
175 hg rebase -r "branch(featureX)" -d 1.3 --keepbranches
176
176
177 Returns 0 on success, 1 if nothing to rebase or there are
177 Returns 0 on success, 1 if nothing to rebase or there are
178 unresolved conflicts.
178 unresolved conflicts.
179
179
180 """
180 """
181 originalwd = target = None
181 originalwd = target = None
182 activebookmark = None
182 activebookmark = None
183 external = nullrev
183 external = nullrev
184 # Mapping between the old revision id and either what is the new rebased
184 # Mapping between the old revision id and either what is the new rebased
185 # revision or what needs to be done with the old revision. The state dict
185 # revision or what needs to be done with the old revision. The state dict
186 # will be what contains most of the rebase progress state.
186 # will be what contains most of the rebase progress state.
187 state = {}
187 state = {}
188 skipped = set()
188 skipped = set()
189 targetancestors = set()
189 targetancestors = set()
190
190
191
191
192 lock = wlock = None
192 lock = wlock = None
193 try:
193 try:
194 wlock = repo.wlock()
194 wlock = repo.wlock()
195 lock = repo.lock()
195 lock = repo.lock()
196
196
197 # Validate input and define rebasing points
197 # Validate input and define rebasing points
198 destf = opts.get('dest', None)
198 destf = opts.get('dest', None)
199 srcf = opts.get('source', None)
199 srcf = opts.get('source', None)
200 basef = opts.get('base', None)
200 basef = opts.get('base', None)
201 revf = opts.get('rev', [])
201 revf = opts.get('rev', [])
202 contf = opts.get('continue')
202 contf = opts.get('continue')
203 abortf = opts.get('abort')
203 abortf = opts.get('abort')
204 collapsef = opts.get('collapse', False)
204 collapsef = opts.get('collapse', False)
205 collapsemsg = cmdutil.logmessage(ui, opts)
205 collapsemsg = cmdutil.logmessage(ui, opts)
206 date = opts.get('date', None)
206 date = opts.get('date', None)
207 e = opts.get('extrafn') # internal, used by e.g. hgsubversion
207 e = opts.get('extrafn') # internal, used by e.g. hgsubversion
208 extrafns = []
208 extrafns = []
209 if e:
209 if e:
210 extrafns = [e]
210 extrafns = [e]
211 keepf = opts.get('keep', False)
211 keepf = opts.get('keep', False)
212 keepbranchesf = opts.get('keepbranches', False)
212 keepbranchesf = opts.get('keepbranches', False)
213 # keepopen is not meant for use on the command line, but by
213 # keepopen is not meant for use on the command line, but by
214 # other extensions
214 # other extensions
215 keepopen = opts.get('keepopen', False)
215 keepopen = opts.get('keepopen', False)
216
216
217 if opts.get('interactive'):
217 if opts.get('interactive'):
218 try:
218 try:
219 if extensions.find('histedit'):
219 if extensions.find('histedit'):
220 enablehistedit = ''
220 enablehistedit = ''
221 except KeyError:
221 except KeyError:
222 enablehistedit = " --config extensions.histedit="
222 enablehistedit = " --config extensions.histedit="
223 help = "hg%s help -e histedit" % enablehistedit
223 help = "hg%s help -e histedit" % enablehistedit
224 msg = _("interactive history editing is supported by the "
224 msg = _("interactive history editing is supported by the "
225 "'histedit' extension (see \"%s\")") % help
225 "'histedit' extension (see \"%s\")") % help
226 raise error.Abort(msg)
226 raise error.Abort(msg)
227
227
228 if collapsemsg and not collapsef:
228 if collapsemsg and not collapsef:
229 raise error.Abort(
229 raise error.Abort(
230 _('message can only be specified with collapse'))
230 _('message can only be specified with collapse'))
231
231
232 if contf or abortf:
232 if contf or abortf:
233 if contf and abortf:
233 if contf and abortf:
234 raise error.Abort(_('cannot use both abort and continue'))
234 raise error.Abort(_('cannot use both abort and continue'))
235 if collapsef:
235 if collapsef:
236 raise error.Abort(
236 raise error.Abort(
237 _('cannot use collapse with continue or abort'))
237 _('cannot use collapse with continue or abort'))
238 if srcf or basef or destf:
238 if srcf or basef or destf:
239 raise error.Abort(
239 raise error.Abort(
240 _('abort and continue do not allow specifying revisions'))
240 _('abort and continue do not allow specifying revisions'))
241 if abortf and opts.get('tool', False):
241 if abortf and opts.get('tool', False):
242 ui.warn(_('tool option will be ignored\n'))
242 ui.warn(_('tool option will be ignored\n'))
243
243
244 try:
244 try:
245 (originalwd, target, state, skipped, collapsef, keepf,
245 (originalwd, target, state, skipped, collapsef, keepf,
246 keepbranchesf, external, activebookmark) = restorestatus(repo)
246 keepbranchesf, external, activebookmark) = restorestatus(repo)
247 except error.RepoLookupError:
247 except error.RepoLookupError:
248 if abortf:
248 if abortf:
249 clearstatus(repo)
249 clearstatus(repo)
250 repo.ui.warn(_('rebase aborted (no revision is removed,'
250 repo.ui.warn(_('rebase aborted (no revision is removed,'
251 ' only broken state is cleared)\n'))
251 ' only broken state is cleared)\n'))
252 return 0
252 return 0
253 else:
253 else:
254 msg = _('cannot continue inconsistent rebase')
254 msg = _('cannot continue inconsistent rebase')
255 hint = _('use "hg rebase --abort" to clear broken state')
255 hint = _('use "hg rebase --abort" to clear broken state')
256 raise error.Abort(msg, hint=hint)
256 raise error.Abort(msg, hint=hint)
257 if abortf:
257 if abortf:
258 return abort(repo, originalwd, target, state,
258 return abort(repo, originalwd, target, state,
259 activebookmark=activebookmark)
259 activebookmark=activebookmark)
260 else:
260 else:
261 if srcf and basef:
261 if srcf and basef:
262 raise error.Abort(_('cannot specify both a '
262 raise error.Abort(_('cannot specify both a '
263 'source and a base'))
263 'source and a base'))
264 if revf and basef:
264 if revf and basef:
265 raise error.Abort(_('cannot specify both a '
265 raise error.Abort(_('cannot specify both a '
266 'revision and a base'))
266 'revision and a base'))
267 if revf and srcf:
267 if revf and srcf:
268 raise error.Abort(_('cannot specify both a '
268 raise error.Abort(_('cannot specify both a '
269 'revision and a source'))
269 'revision and a source'))
270
270
271 cmdutil.checkunfinished(repo)
271 cmdutil.checkunfinished(repo)
272 cmdutil.bailifchanged(repo)
272 cmdutil.bailifchanged(repo)
273
273
274 if destf:
274 if destf:
275 dest = scmutil.revsingle(repo, destf)
275 dest = scmutil.revsingle(repo, destf)
276 else:
276 else:
277 dest = repo[_destrebase(repo)]
277 dest = repo[_destrebase(repo)]
278 destf = str(dest)
278 destf = str(dest)
279
279
280 if revf:
280 if revf:
281 rebaseset = scmutil.revrange(repo, revf)
281 rebaseset = scmutil.revrange(repo, revf)
282 if not rebaseset:
282 if not rebaseset:
283 ui.status(_('empty "rev" revision set - '
283 ui.status(_('empty "rev" revision set - '
284 'nothing to rebase\n'))
284 'nothing to rebase\n'))
285 return _nothingtorebase()
285 return _nothingtorebase()
286 elif srcf:
286 elif srcf:
287 src = scmutil.revrange(repo, [srcf])
287 src = scmutil.revrange(repo, [srcf])
288 if not src:
288 if not src:
289 ui.status(_('empty "source" revision set - '
289 ui.status(_('empty "source" revision set - '
290 'nothing to rebase\n'))
290 'nothing to rebase\n'))
291 return _nothingtorebase()
291 return _nothingtorebase()
292 rebaseset = repo.revs('(%ld)::', src)
292 rebaseset = repo.revs('(%ld)::', src)
293 assert rebaseset
293 assert rebaseset
294 else:
294 else:
295 base = scmutil.revrange(repo, [basef or '.'])
295 base = scmutil.revrange(repo, [basef or '.'])
296 if not base:
296 if not base:
297 ui.status(_('empty "base" revision set - '
297 ui.status(_('empty "base" revision set - '
298 "can't compute rebase set\n"))
298 "can't compute rebase set\n"))
299 return _nothingtorebase()
299 return _nothingtorebase()
300 commonanc = repo.revs('ancestor(%ld, %d)', base, dest).first()
300 commonanc = repo.revs('ancestor(%ld, %d)', base, dest).first()
301 if commonanc is not None:
301 if commonanc is not None:
302 rebaseset = repo.revs('(%d::(%ld) - %d)::',
302 rebaseset = repo.revs('(%d::(%ld) - %d)::',
303 commonanc, base, commonanc)
303 commonanc, base, commonanc)
304 else:
304 else:
305 rebaseset = []
305 rebaseset = []
306
306
307 if not rebaseset:
307 if not rebaseset:
308 # transform to list because smartsets are not comparable to
308 # transform to list because smartsets are not comparable to
309 # lists. This should be improved to honor laziness of
309 # lists. This should be improved to honor laziness of
310 # smartset.
310 # smartset.
311 if list(base) == [dest.rev()]:
311 if list(base) == [dest.rev()]:
312 if basef:
312 if basef:
313 ui.status(_('nothing to rebase - %s is both "base"'
313 ui.status(_('nothing to rebase - %s is both "base"'
314 ' and destination\n') % dest)
314 ' and destination\n') % dest)
315 else:
315 else:
316 ui.status(_('nothing to rebase - working directory '
316 ui.status(_('nothing to rebase - working directory '
317 'parent is also destination\n'))
317 'parent is also destination\n'))
318 elif not repo.revs('%ld - ::%d', base, dest):
318 elif not repo.revs('%ld - ::%d', base, dest):
319 if basef:
319 if basef:
320 ui.status(_('nothing to rebase - "base" %s is '
320 ui.status(_('nothing to rebase - "base" %s is '
321 'already an ancestor of destination '
321 'already an ancestor of destination '
322 '%s\n') %
322 '%s\n') %
323 ('+'.join(str(repo[r]) for r in base),
323 ('+'.join(str(repo[r]) for r in base),
324 dest))
324 dest))
325 else:
325 else:
326 ui.status(_('nothing to rebase - working '
326 ui.status(_('nothing to rebase - working '
327 'directory parent is already an '
327 'directory parent is already an '
328 'ancestor of destination %s\n') % dest)
328 'ancestor of destination %s\n') % dest)
329 else: # can it happen?
329 else: # can it happen?
330 ui.status(_('nothing to rebase from %s to %s\n') %
330 ui.status(_('nothing to rebase from %s to %s\n') %
331 ('+'.join(str(repo[r]) for r in base), dest))
331 ('+'.join(str(repo[r]) for r in base), dest))
332 return _nothingtorebase()
332 return _nothingtorebase()
333
333
334 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
334 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
335 if (not (keepf or allowunstable)
335 if (not (keepf or allowunstable)
336 and repo.revs('first(children(%ld) - %ld)',
336 and repo.revs('first(children(%ld) - %ld)',
337 rebaseset, rebaseset)):
337 rebaseset, rebaseset)):
338 raise error.Abort(
338 raise error.Abort(
339 _("can't remove original changesets with"
339 _("can't remove original changesets with"
340 " unrebased descendants"),
340 " unrebased descendants"),
341 hint=_('use --keep to keep original changesets'))
341 hint=_('use --keep to keep original changesets'))
342
342
343 obsoletenotrebased = {}
343 obsoletenotrebased = {}
344 if ui.configbool('experimental', 'rebaseskipobsolete'):
344 if ui.configbool('experimental', 'rebaseskipobsolete'):
345 rebasesetrevs = set(rebaseset)
345 rebasesetrevs = set(rebaseset)
346 rebaseobsrevs = set(r for r in rebasesetrevs
346 rebaseobsrevs = set(r for r in rebasesetrevs
347 if repo[r].obsolete())
347 if repo[r].obsolete())
348 obsoletenotrebased = _computeobsoletenotrebased(repo,
348 obsoletenotrebased = _computeobsoletenotrebased(repo,
349 rebaseobsrevs,
349 rebaseobsrevs,
350 dest)
350 dest)
351 rebaseobsskipped = set(obsoletenotrebased)
351 rebaseobsskipped = set(obsoletenotrebased)
352
352
353 # Obsolete node with successors not in dest leads to divergence
354 divergenceok = ui.configbool('rebase',
355 'allowdivergence')
356 divergencebasecandidates = rebaseobsrevs - rebaseobsskipped
357
358 if divergencebasecandidates and not divergenceok:
359 msg = _("this rebase will cause divergence")
360 h = _("to force the rebase please set "
361 "rebase.allowdivergence=True")
362 raise error.Abort(msg, hint=h)
363
353 # - plain prune (no successor) changesets are rebased
364 # - plain prune (no successor) changesets are rebased
354 # - split changesets are not rebased if at least one of the
365 # - split changesets are not rebased if at least one of the
355 # changeset resulting from the split is an ancestor of dest
366 # changeset resulting from the split is an ancestor of dest
356 rebaseset = rebasesetrevs - rebaseobsskipped
367 rebaseset = rebasesetrevs - rebaseobsskipped
357 if rebasesetrevs and not rebaseset:
368 if rebasesetrevs and not rebaseset:
358 msg = _('all requested changesets have equivalents '
369 msg = _('all requested changesets have equivalents '
359 'or were marked as obsolete')
370 'or were marked as obsolete')
360 hint = _('to force the rebase, set the config '
371 hint = _('to force the rebase, set the config '
361 'experimental.rebaseskipobsolete to False')
372 'experimental.rebaseskipobsolete to False')
362 raise error.Abort(msg, hint=hint)
373 raise error.Abort(msg, hint=hint)
363
374
364 result = buildstate(repo, dest, rebaseset, collapsef,
375 result = buildstate(repo, dest, rebaseset, collapsef,
365 obsoletenotrebased)
376 obsoletenotrebased)
366
377
367 if not result:
378 if not result:
368 # Empty state built, nothing to rebase
379 # Empty state built, nothing to rebase
369 ui.status(_('nothing to rebase\n'))
380 ui.status(_('nothing to rebase\n'))
370 return _nothingtorebase()
381 return _nothingtorebase()
371
382
372 root = min(rebaseset)
383 root = min(rebaseset)
373 if not keepf and not repo[root].mutable():
384 if not keepf and not repo[root].mutable():
374 raise error.Abort(_("can't rebase public changeset %s")
385 raise error.Abort(_("can't rebase public changeset %s")
375 % repo[root],
386 % repo[root],
376 hint=_('see "hg help phases" for details'))
387 hint=_('see "hg help phases" for details'))
377
388
378 originalwd, target, state = result
389 originalwd, target, state = result
379 if collapsef:
390 if collapsef:
380 targetancestors = repo.changelog.ancestors([target],
391 targetancestors = repo.changelog.ancestors([target],
381 inclusive=True)
392 inclusive=True)
382 external = externalparent(repo, state, targetancestors)
393 external = externalparent(repo, state, targetancestors)
383
394
384 if dest.closesbranch() and not keepbranchesf:
395 if dest.closesbranch() and not keepbranchesf:
385 ui.status(_('reopening closed branch head %s\n') % dest)
396 ui.status(_('reopening closed branch head %s\n') % dest)
386
397
387 if keepbranchesf and collapsef:
398 if keepbranchesf and collapsef:
388 branches = set()
399 branches = set()
389 for rev in state:
400 for rev in state:
390 branches.add(repo[rev].branch())
401 branches.add(repo[rev].branch())
391 if len(branches) > 1:
402 if len(branches) > 1:
392 raise error.Abort(_('cannot collapse multiple named '
403 raise error.Abort(_('cannot collapse multiple named '
393 'branches'))
404 'branches'))
394
405
395 # Rebase
406 # Rebase
396 if not targetancestors:
407 if not targetancestors:
397 targetancestors = repo.changelog.ancestors([target], inclusive=True)
408 targetancestors = repo.changelog.ancestors([target], inclusive=True)
398
409
399 # Keep track of the current bookmarks in order to reset them later
410 # Keep track of the current bookmarks in order to reset them later
400 currentbookmarks = repo._bookmarks.copy()
411 currentbookmarks = repo._bookmarks.copy()
401 activebookmark = activebookmark or repo._activebookmark
412 activebookmark = activebookmark or repo._activebookmark
402 if activebookmark:
413 if activebookmark:
403 bookmarks.deactivate(repo)
414 bookmarks.deactivate(repo)
404
415
405 extrafn = _makeextrafn(extrafns)
416 extrafn = _makeextrafn(extrafns)
406
417
407 sortedstate = sorted(state)
418 sortedstate = sorted(state)
408 total = len(sortedstate)
419 total = len(sortedstate)
409 pos = 0
420 pos = 0
410 for rev in sortedstate:
421 for rev in sortedstate:
411 ctx = repo[rev]
422 ctx = repo[rev]
412 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
423 desc = '%d:%s "%s"' % (ctx.rev(), ctx,
413 ctx.description().split('\n', 1)[0])
424 ctx.description().split('\n', 1)[0])
414 names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
425 names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
415 if names:
426 if names:
416 desc += ' (%s)' % ' '.join(names)
427 desc += ' (%s)' % ' '.join(names)
417 pos += 1
428 pos += 1
418 if state[rev] == revtodo:
429 if state[rev] == revtodo:
419 ui.status(_('rebasing %s\n') % desc)
430 ui.status(_('rebasing %s\n') % desc)
420 ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)),
431 ui.progress(_("rebasing"), pos, ("%d:%s" % (rev, ctx)),
421 _('changesets'), total)
432 _('changesets'), total)
422 p1, p2, base = defineparents(repo, rev, target, state,
433 p1, p2, base = defineparents(repo, rev, target, state,
423 targetancestors)
434 targetancestors)
424 storestatus(repo, originalwd, target, state, collapsef, keepf,
435 storestatus(repo, originalwd, target, state, collapsef, keepf,
425 keepbranchesf, external, activebookmark)
436 keepbranchesf, external, activebookmark)
426 if len(repo[None].parents()) == 2:
437 if len(repo[None].parents()) == 2:
427 repo.ui.debug('resuming interrupted rebase\n')
438 repo.ui.debug('resuming interrupted rebase\n')
428 else:
439 else:
429 try:
440 try:
430 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
441 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
431 'rebase')
442 'rebase')
432 stats = rebasenode(repo, rev, p1, base, state,
443 stats = rebasenode(repo, rev, p1, base, state,
433 collapsef, target)
444 collapsef, target)
434 if stats and stats[3] > 0:
445 if stats and stats[3] > 0:
435 raise error.InterventionRequired(
446 raise error.InterventionRequired(
436 _('unresolved conflicts (see hg '
447 _('unresolved conflicts (see hg '
437 'resolve, then hg rebase --continue)'))
448 'resolve, then hg rebase --continue)'))
438 finally:
449 finally:
439 ui.setconfig('ui', 'forcemerge', '', 'rebase')
450 ui.setconfig('ui', 'forcemerge', '', 'rebase')
440 if not collapsef:
451 if not collapsef:
441 merging = p2 != nullrev
452 merging = p2 != nullrev
442 editform = cmdutil.mergeeditform(merging, 'rebase')
453 editform = cmdutil.mergeeditform(merging, 'rebase')
443 editor = cmdutil.getcommiteditor(editform=editform, **opts)
454 editor = cmdutil.getcommiteditor(editform=editform, **opts)
444 newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
455 newnode = concludenode(repo, rev, p1, p2, extrafn=extrafn,
445 editor=editor,
456 editor=editor,
446 keepbranches=keepbranchesf,
457 keepbranches=keepbranchesf,
447 date=date)
458 date=date)
448 else:
459 else:
449 # Skip commit if we are collapsing
460 # Skip commit if we are collapsing
450 repo.dirstate.beginparentchange()
461 repo.dirstate.beginparentchange()
451 repo.setparents(repo[p1].node())
462 repo.setparents(repo[p1].node())
452 repo.dirstate.endparentchange()
463 repo.dirstate.endparentchange()
453 newnode = None
464 newnode = None
454 # Update the state
465 # Update the state
455 if newnode is not None:
466 if newnode is not None:
456 state[rev] = repo[newnode].rev()
467 state[rev] = repo[newnode].rev()
457 ui.debug('rebased as %s\n' % short(newnode))
468 ui.debug('rebased as %s\n' % short(newnode))
458 else:
469 else:
459 if not collapsef:
470 if not collapsef:
460 ui.warn(_('note: rebase of %d:%s created no changes '
471 ui.warn(_('note: rebase of %d:%s created no changes '
461 'to commit\n') % (rev, ctx))
472 'to commit\n') % (rev, ctx))
462 skipped.add(rev)
473 skipped.add(rev)
463 state[rev] = p1
474 state[rev] = p1
464 ui.debug('next revision set to %s\n' % p1)
475 ui.debug('next revision set to %s\n' % p1)
465 elif state[rev] == nullmerge:
476 elif state[rev] == nullmerge:
466 ui.debug('ignoring null merge rebase of %s\n' % rev)
477 ui.debug('ignoring null merge rebase of %s\n' % rev)
467 elif state[rev] == revignored:
478 elif state[rev] == revignored:
468 ui.status(_('not rebasing ignored %s\n') % desc)
479 ui.status(_('not rebasing ignored %s\n') % desc)
469 elif state[rev] == revprecursor:
480 elif state[rev] == revprecursor:
470 targetctx = repo[obsoletenotrebased[rev]]
481 targetctx = repo[obsoletenotrebased[rev]]
471 desctarget = '%d:%s "%s"' % (targetctx.rev(), targetctx,
482 desctarget = '%d:%s "%s"' % (targetctx.rev(), targetctx,
472 targetctx.description().split('\n', 1)[0])
483 targetctx.description().split('\n', 1)[0])
473 msg = _('note: not rebasing %s, already in destination as %s\n')
484 msg = _('note: not rebasing %s, already in destination as %s\n')
474 ui.status(msg % (desc, desctarget))
485 ui.status(msg % (desc, desctarget))
475 elif state[rev] == revpruned:
486 elif state[rev] == revpruned:
476 msg = _('note: not rebasing %s, it has no successor\n')
487 msg = _('note: not rebasing %s, it has no successor\n')
477 ui.status(msg % desc)
488 ui.status(msg % desc)
478 else:
489 else:
479 ui.status(_('already rebased %s as %s\n') %
490 ui.status(_('already rebased %s as %s\n') %
480 (desc, repo[state[rev]]))
491 (desc, repo[state[rev]]))
481
492
482 ui.progress(_('rebasing'), None)
493 ui.progress(_('rebasing'), None)
483 ui.note(_('rebase merging completed\n'))
494 ui.note(_('rebase merging completed\n'))
484
495
485 if collapsef and not keepopen:
496 if collapsef and not keepopen:
486 p1, p2, _base = defineparents(repo, min(state), target,
497 p1, p2, _base = defineparents(repo, min(state), target,
487 state, targetancestors)
498 state, targetancestors)
488 editopt = opts.get('edit')
499 editopt = opts.get('edit')
489 editform = 'rebase.collapse'
500 editform = 'rebase.collapse'
490 if collapsemsg:
501 if collapsemsg:
491 commitmsg = collapsemsg
502 commitmsg = collapsemsg
492 else:
503 else:
493 commitmsg = 'Collapsed revision'
504 commitmsg = 'Collapsed revision'
494 for rebased in state:
505 for rebased in state:
495 if rebased not in skipped and state[rebased] > nullmerge:
506 if rebased not in skipped and state[rebased] > nullmerge:
496 commitmsg += '\n* %s' % repo[rebased].description()
507 commitmsg += '\n* %s' % repo[rebased].description()
497 editopt = True
508 editopt = True
498 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
509 editor = cmdutil.getcommiteditor(edit=editopt, editform=editform)
499 newnode = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
510 newnode = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
500 extrafn=extrafn, editor=editor,
511 extrafn=extrafn, editor=editor,
501 keepbranches=keepbranchesf,
512 keepbranches=keepbranchesf,
502 date=date)
513 date=date)
503 if newnode is None:
514 if newnode is None:
504 newrev = target
515 newrev = target
505 else:
516 else:
506 newrev = repo[newnode].rev()
517 newrev = repo[newnode].rev()
507 for oldrev in state.iterkeys():
518 for oldrev in state.iterkeys():
508 if state[oldrev] > nullmerge:
519 if state[oldrev] > nullmerge:
509 state[oldrev] = newrev
520 state[oldrev] = newrev
510
521
511 if 'qtip' in repo.tags():
522 if 'qtip' in repo.tags():
512 updatemq(repo, state, skipped, **opts)
523 updatemq(repo, state, skipped, **opts)
513
524
514 if currentbookmarks:
525 if currentbookmarks:
515 # Nodeids are needed to reset bookmarks
526 # Nodeids are needed to reset bookmarks
516 nstate = {}
527 nstate = {}
517 for k, v in state.iteritems():
528 for k, v in state.iteritems():
518 if v > nullmerge:
529 if v > nullmerge:
519 nstate[repo[k].node()] = repo[v].node()
530 nstate[repo[k].node()] = repo[v].node()
520 # XXX this is the same as dest.node() for the non-continue path --
531 # XXX this is the same as dest.node() for the non-continue path --
521 # this should probably be cleaned up
532 # this should probably be cleaned up
522 targetnode = repo[target].node()
533 targetnode = repo[target].node()
523
534
524 # restore original working directory
535 # restore original working directory
525 # (we do this before stripping)
536 # (we do this before stripping)
526 newwd = state.get(originalwd, originalwd)
537 newwd = state.get(originalwd, originalwd)
527 if newwd < 0:
538 if newwd < 0:
528 # original directory is a parent of rebase set root or ignored
539 # original directory is a parent of rebase set root or ignored
529 newwd = originalwd
540 newwd = originalwd
530 if newwd not in [c.rev() for c in repo[None].parents()]:
541 if newwd not in [c.rev() for c in repo[None].parents()]:
531 ui.note(_("update back to initial working directory parent\n"))
542 ui.note(_("update back to initial working directory parent\n"))
532 hg.updaterepo(repo, newwd, False)
543 hg.updaterepo(repo, newwd, False)
533
544
534 if not keepf:
545 if not keepf:
535 collapsedas = None
546 collapsedas = None
536 if collapsef:
547 if collapsef:
537 collapsedas = newnode
548 collapsedas = newnode
538 clearrebased(ui, repo, state, skipped, collapsedas)
549 clearrebased(ui, repo, state, skipped, collapsedas)
539
550
540 tr = None
551 tr = None
541 try:
552 try:
542 tr = repo.transaction('bookmark')
553 tr = repo.transaction('bookmark')
543 if currentbookmarks:
554 if currentbookmarks:
544 updatebookmarks(repo, targetnode, nstate, currentbookmarks, tr)
555 updatebookmarks(repo, targetnode, nstate, currentbookmarks, tr)
545 if activebookmark not in repo._bookmarks:
556 if activebookmark not in repo._bookmarks:
546 # active bookmark was divergent one and has been deleted
557 # active bookmark was divergent one and has been deleted
547 activebookmark = None
558 activebookmark = None
548 tr.close()
559 tr.close()
549 finally:
560 finally:
550 release(tr)
561 release(tr)
551 clearstatus(repo)
562 clearstatus(repo)
552
563
553 ui.note(_("rebase completed\n"))
564 ui.note(_("rebase completed\n"))
554 util.unlinkpath(repo.sjoin('undo'), ignoremissing=True)
565 util.unlinkpath(repo.sjoin('undo'), ignoremissing=True)
555 if skipped:
566 if skipped:
556 ui.note(_("%d revisions have been skipped\n") % len(skipped))
567 ui.note(_("%d revisions have been skipped\n") % len(skipped))
557
568
558 if (activebookmark and
569 if (activebookmark and
559 repo['.'].node() == repo._bookmarks[activebookmark]):
570 repo['.'].node() == repo._bookmarks[activebookmark]):
560 bookmarks.activate(repo, activebookmark)
571 bookmarks.activate(repo, activebookmark)
561
572
562 finally:
573 finally:
563 release(lock, wlock)
574 release(lock, wlock)
564
575
565 def externalparent(repo, state, targetancestors):
576 def externalparent(repo, state, targetancestors):
566 """Return the revision that should be used as the second parent
577 """Return the revision that should be used as the second parent
567 when the revisions in state is collapsed on top of targetancestors.
578 when the revisions in state is collapsed on top of targetancestors.
568 Abort if there is more than one parent.
579 Abort if there is more than one parent.
569 """
580 """
570 parents = set()
581 parents = set()
571 source = min(state)
582 source = min(state)
572 for rev in state:
583 for rev in state:
573 if rev == source:
584 if rev == source:
574 continue
585 continue
575 for p in repo[rev].parents():
586 for p in repo[rev].parents():
576 if (p.rev() not in state
587 if (p.rev() not in state
577 and p.rev() not in targetancestors):
588 and p.rev() not in targetancestors):
578 parents.add(p.rev())
589 parents.add(p.rev())
579 if not parents:
590 if not parents:
580 return nullrev
591 return nullrev
581 if len(parents) == 1:
592 if len(parents) == 1:
582 return parents.pop()
593 return parents.pop()
583 raise error.Abort(_('unable to collapse on top of %s, there is more '
594 raise error.Abort(_('unable to collapse on top of %s, there is more '
584 'than one external parent: %s') %
595 'than one external parent: %s') %
585 (max(targetancestors),
596 (max(targetancestors),
586 ', '.join(str(p) for p in sorted(parents))))
597 ', '.join(str(p) for p in sorted(parents))))
587
598
588 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None,
599 def concludenode(repo, rev, p1, p2, commitmsg=None, editor=None, extrafn=None,
589 keepbranches=False, date=None):
600 keepbranches=False, date=None):
590 '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev
601 '''Commit the wd changes with parents p1 and p2. Reuse commit info from rev
591 but also store useful information in extra.
602 but also store useful information in extra.
592 Return node of committed revision.'''
603 Return node of committed revision.'''
593 dsguard = cmdutil.dirstateguard(repo, 'rebase')
604 dsguard = cmdutil.dirstateguard(repo, 'rebase')
594 try:
605 try:
595 repo.setparents(repo[p1].node(), repo[p2].node())
606 repo.setparents(repo[p1].node(), repo[p2].node())
596 ctx = repo[rev]
607 ctx = repo[rev]
597 if commitmsg is None:
608 if commitmsg is None:
598 commitmsg = ctx.description()
609 commitmsg = ctx.description()
599 keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
610 keepbranch = keepbranches and repo[p1].branch() != ctx.branch()
600 extra = ctx.extra().copy()
611 extra = ctx.extra().copy()
601 if not keepbranches:
612 if not keepbranches:
602 del extra['branch']
613 del extra['branch']
603 extra['rebase_source'] = ctx.hex()
614 extra['rebase_source'] = ctx.hex()
604 if extrafn:
615 if extrafn:
605 extrafn(ctx, extra)
616 extrafn(ctx, extra)
606
617
607 backup = repo.ui.backupconfig('phases', 'new-commit')
618 backup = repo.ui.backupconfig('phases', 'new-commit')
608 try:
619 try:
609 targetphase = max(ctx.phase(), phases.draft)
620 targetphase = max(ctx.phase(), phases.draft)
610 repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase')
621 repo.ui.setconfig('phases', 'new-commit', targetphase, 'rebase')
611 if keepbranch:
622 if keepbranch:
612 repo.ui.setconfig('ui', 'allowemptycommit', True)
623 repo.ui.setconfig('ui', 'allowemptycommit', True)
613 # Commit might fail if unresolved files exist
624 # Commit might fail if unresolved files exist
614 if date is None:
625 if date is None:
615 date = ctx.date()
626 date = ctx.date()
616 newnode = repo.commit(text=commitmsg, user=ctx.user(),
627 newnode = repo.commit(text=commitmsg, user=ctx.user(),
617 date=date, extra=extra, editor=editor)
628 date=date, extra=extra, editor=editor)
618 finally:
629 finally:
619 repo.ui.restoreconfig(backup)
630 repo.ui.restoreconfig(backup)
620
631
621 repo.dirstate.setbranch(repo[newnode].branch())
632 repo.dirstate.setbranch(repo[newnode].branch())
622 dsguard.close()
633 dsguard.close()
623 return newnode
634 return newnode
624 finally:
635 finally:
625 release(dsguard)
636 release(dsguard)
626
637
627 def rebasenode(repo, rev, p1, base, state, collapse, target):
638 def rebasenode(repo, rev, p1, base, state, collapse, target):
628 'Rebase a single revision rev on top of p1 using base as merge ancestor'
639 'Rebase a single revision rev on top of p1 using base as merge ancestor'
629 # Merge phase
640 # Merge phase
630 # Update to target and merge it with local
641 # Update to target and merge it with local
631 if repo['.'].rev() != p1:
642 if repo['.'].rev() != p1:
632 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
643 repo.ui.debug(" update to %d:%s\n" % (p1, repo[p1]))
633 merge.update(repo, p1, False, True)
644 merge.update(repo, p1, False, True)
634 else:
645 else:
635 repo.ui.debug(" already in target\n")
646 repo.ui.debug(" already in target\n")
636 repo.dirstate.write(repo.currenttransaction())
647 repo.dirstate.write(repo.currenttransaction())
637 repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev]))
648 repo.ui.debug(" merge against %d:%s\n" % (rev, repo[rev]))
638 if base is not None:
649 if base is not None:
639 repo.ui.debug(" detach base %d:%s\n" % (base, repo[base]))
650 repo.ui.debug(" detach base %d:%s\n" % (base, repo[base]))
640 # When collapsing in-place, the parent is the common ancestor, we
651 # When collapsing in-place, the parent is the common ancestor, we
641 # have to allow merging with it.
652 # have to allow merging with it.
642 stats = merge.update(repo, rev, True, True, base, collapse,
653 stats = merge.update(repo, rev, True, True, base, collapse,
643 labels=['dest', 'source'])
654 labels=['dest', 'source'])
644 if collapse:
655 if collapse:
645 copies.duplicatecopies(repo, rev, target)
656 copies.duplicatecopies(repo, rev, target)
646 else:
657 else:
647 # If we're not using --collapse, we need to
658 # If we're not using --collapse, we need to
648 # duplicate copies between the revision we're
659 # duplicate copies between the revision we're
649 # rebasing and its first parent, but *not*
660 # rebasing and its first parent, but *not*
650 # duplicate any copies that have already been
661 # duplicate any copies that have already been
651 # performed in the destination.
662 # performed in the destination.
652 p1rev = repo[rev].p1().rev()
663 p1rev = repo[rev].p1().rev()
653 copies.duplicatecopies(repo, rev, p1rev, skiprev=target)
664 copies.duplicatecopies(repo, rev, p1rev, skiprev=target)
654 return stats
665 return stats
655
666
656 def nearestrebased(repo, rev, state):
667 def nearestrebased(repo, rev, state):
657 """return the nearest ancestors of rev in the rebase result"""
668 """return the nearest ancestors of rev in the rebase result"""
658 rebased = [r for r in state if state[r] > nullmerge]
669 rebased = [r for r in state if state[r] > nullmerge]
659 candidates = repo.revs('max(%ld and (::%d))', rebased, rev)
670 candidates = repo.revs('max(%ld and (::%d))', rebased, rev)
660 if candidates:
671 if candidates:
661 return state[candidates.first()]
672 return state[candidates.first()]
662 else:
673 else:
663 return None
674 return None
664
675
665 def defineparents(repo, rev, target, state, targetancestors):
676 def defineparents(repo, rev, target, state, targetancestors):
666 'Return the new parent relationship of the revision that will be rebased'
677 'Return the new parent relationship of the revision that will be rebased'
667 parents = repo[rev].parents()
678 parents = repo[rev].parents()
668 p1 = p2 = nullrev
679 p1 = p2 = nullrev
669
680
670 p1n = parents[0].rev()
681 p1n = parents[0].rev()
671 if p1n in targetancestors:
682 if p1n in targetancestors:
672 p1 = target
683 p1 = target
673 elif p1n in state:
684 elif p1n in state:
674 if state[p1n] == nullmerge:
685 if state[p1n] == nullmerge:
675 p1 = target
686 p1 = target
676 elif state[p1n] in revskipped:
687 elif state[p1n] in revskipped:
677 p1 = nearestrebased(repo, p1n, state)
688 p1 = nearestrebased(repo, p1n, state)
678 if p1 is None:
689 if p1 is None:
679 p1 = target
690 p1 = target
680 else:
691 else:
681 p1 = state[p1n]
692 p1 = state[p1n]
682 else: # p1n external
693 else: # p1n external
683 p1 = target
694 p1 = target
684 p2 = p1n
695 p2 = p1n
685
696
686 if len(parents) == 2 and parents[1].rev() not in targetancestors:
697 if len(parents) == 2 and parents[1].rev() not in targetancestors:
687 p2n = parents[1].rev()
698 p2n = parents[1].rev()
688 # interesting second parent
699 # interesting second parent
689 if p2n in state:
700 if p2n in state:
690 if p1 == target: # p1n in targetancestors or external
701 if p1 == target: # p1n in targetancestors or external
691 p1 = state[p2n]
702 p1 = state[p2n]
692 elif state[p2n] in revskipped:
703 elif state[p2n] in revskipped:
693 p2 = nearestrebased(repo, p2n, state)
704 p2 = nearestrebased(repo, p2n, state)
694 if p2 is None:
705 if p2 is None:
695 # no ancestors rebased yet, detach
706 # no ancestors rebased yet, detach
696 p2 = target
707 p2 = target
697 else:
708 else:
698 p2 = state[p2n]
709 p2 = state[p2n]
699 else: # p2n external
710 else: # p2n external
700 if p2 != nullrev: # p1n external too => rev is a merged revision
711 if p2 != nullrev: # p1n external too => rev is a merged revision
701 raise error.Abort(_('cannot use revision %d as base, result '
712 raise error.Abort(_('cannot use revision %d as base, result '
702 'would have 3 parents') % rev)
713 'would have 3 parents') % rev)
703 p2 = p2n
714 p2 = p2n
704 repo.ui.debug(" future parents are %d and %d\n" %
715 repo.ui.debug(" future parents are %d and %d\n" %
705 (repo[p1].rev(), repo[p2].rev()))
716 (repo[p1].rev(), repo[p2].rev()))
706
717
707 if rev == min(state):
718 if rev == min(state):
708 # Case (1) initial changeset of a non-detaching rebase.
719 # Case (1) initial changeset of a non-detaching rebase.
709 # Let the merge mechanism find the base itself.
720 # Let the merge mechanism find the base itself.
710 base = None
721 base = None
711 elif not repo[rev].p2():
722 elif not repo[rev].p2():
712 # Case (2) detaching the node with a single parent, use this parent
723 # Case (2) detaching the node with a single parent, use this parent
713 base = repo[rev].p1().rev()
724 base = repo[rev].p1().rev()
714 else:
725 else:
715 # Assuming there is a p1, this is the case where there also is a p2.
726 # Assuming there is a p1, this is the case where there also is a p2.
716 # We are thus rebasing a merge and need to pick the right merge base.
727 # We are thus rebasing a merge and need to pick the right merge base.
717 #
728 #
718 # Imagine we have:
729 # Imagine we have:
719 # - M: current rebase revision in this step
730 # - M: current rebase revision in this step
720 # - A: one parent of M
731 # - A: one parent of M
721 # - B: other parent of M
732 # - B: other parent of M
722 # - D: destination of this merge step (p1 var)
733 # - D: destination of this merge step (p1 var)
723 #
734 #
724 # Consider the case where D is a descendant of A or B and the other is
735 # Consider the case where D is a descendant of A or B and the other is
725 # 'outside'. In this case, the right merge base is the D ancestor.
736 # 'outside'. In this case, the right merge base is the D ancestor.
726 #
737 #
727 # An informal proof, assuming A is 'outside' and B is the D ancestor:
738 # An informal proof, assuming A is 'outside' and B is the D ancestor:
728 #
739 #
729 # If we pick B as the base, the merge involves:
740 # If we pick B as the base, the merge involves:
730 # - changes from B to M (actual changeset payload)
741 # - changes from B to M (actual changeset payload)
731 # - changes from B to D (induced by rebase) as D is a rebased
742 # - changes from B to D (induced by rebase) as D is a rebased
732 # version of B)
743 # version of B)
733 # Which exactly represent the rebase operation.
744 # Which exactly represent the rebase operation.
734 #
745 #
735 # If we pick A as the base, the merge involves:
746 # If we pick A as the base, the merge involves:
736 # - changes from A to M (actual changeset payload)
747 # - changes from A to M (actual changeset payload)
737 # - changes from A to D (with include changes between unrelated A and B
748 # - changes from A to D (with include changes between unrelated A and B
738 # plus changes induced by rebase)
749 # plus changes induced by rebase)
739 # Which does not represent anything sensible and creates a lot of
750 # Which does not represent anything sensible and creates a lot of
740 # conflicts. A is thus not the right choice - B is.
751 # conflicts. A is thus not the right choice - B is.
741 #
752 #
742 # Note: The base found in this 'proof' is only correct in the specified
753 # Note: The base found in this 'proof' is only correct in the specified
743 # case. This base does not make sense if is not D a descendant of A or B
754 # case. This base does not make sense if is not D a descendant of A or B
744 # or if the other is not parent 'outside' (especially not if the other
755 # or if the other is not parent 'outside' (especially not if the other
745 # parent has been rebased). The current implementation does not
756 # parent has been rebased). The current implementation does not
746 # make it feasible to consider different cases separately. In these
757 # make it feasible to consider different cases separately. In these
747 # other cases we currently just leave it to the user to correctly
758 # other cases we currently just leave it to the user to correctly
748 # resolve an impossible merge using a wrong ancestor.
759 # resolve an impossible merge using a wrong ancestor.
749 for p in repo[rev].parents():
760 for p in repo[rev].parents():
750 if state.get(p.rev()) == p1:
761 if state.get(p.rev()) == p1:
751 base = p.rev()
762 base = p.rev()
752 break
763 break
753 else: # fallback when base not found
764 else: # fallback when base not found
754 base = None
765 base = None
755
766
756 # Raise because this function is called wrong (see issue 4106)
767 # Raise because this function is called wrong (see issue 4106)
757 raise AssertionError('no base found to rebase on '
768 raise AssertionError('no base found to rebase on '
758 '(defineparents called wrong)')
769 '(defineparents called wrong)')
759 return p1, p2, base
770 return p1, p2, base
760
771
761 def isagitpatch(repo, patchname):
772 def isagitpatch(repo, patchname):
762 'Return true if the given patch is in git format'
773 'Return true if the given patch is in git format'
763 mqpatch = os.path.join(repo.mq.path, patchname)
774 mqpatch = os.path.join(repo.mq.path, patchname)
764 for line in patch.linereader(file(mqpatch, 'rb')):
775 for line in patch.linereader(file(mqpatch, 'rb')):
765 if line.startswith('diff --git'):
776 if line.startswith('diff --git'):
766 return True
777 return True
767 return False
778 return False
768
779
769 def updatemq(repo, state, skipped, **opts):
780 def updatemq(repo, state, skipped, **opts):
770 'Update rebased mq patches - finalize and then import them'
781 'Update rebased mq patches - finalize and then import them'
771 mqrebase = {}
782 mqrebase = {}
772 mq = repo.mq
783 mq = repo.mq
773 original_series = mq.fullseries[:]
784 original_series = mq.fullseries[:]
774 skippedpatches = set()
785 skippedpatches = set()
775
786
776 for p in mq.applied:
787 for p in mq.applied:
777 rev = repo[p.node].rev()
788 rev = repo[p.node].rev()
778 if rev in state:
789 if rev in state:
779 repo.ui.debug('revision %d is an mq patch (%s), finalize it.\n' %
790 repo.ui.debug('revision %d is an mq patch (%s), finalize it.\n' %
780 (rev, p.name))
791 (rev, p.name))
781 mqrebase[rev] = (p.name, isagitpatch(repo, p.name))
792 mqrebase[rev] = (p.name, isagitpatch(repo, p.name))
782 else:
793 else:
783 # Applied but not rebased, not sure this should happen
794 # Applied but not rebased, not sure this should happen
784 skippedpatches.add(p.name)
795 skippedpatches.add(p.name)
785
796
786 if mqrebase:
797 if mqrebase:
787 mq.finish(repo, mqrebase.keys())
798 mq.finish(repo, mqrebase.keys())
788
799
789 # We must start import from the newest revision
800 # We must start import from the newest revision
790 for rev in sorted(mqrebase, reverse=True):
801 for rev in sorted(mqrebase, reverse=True):
791 if rev not in skipped:
802 if rev not in skipped:
792 name, isgit = mqrebase[rev]
803 name, isgit = mqrebase[rev]
793 repo.ui.note(_('updating mq patch %s to %s:%s\n') %
804 repo.ui.note(_('updating mq patch %s to %s:%s\n') %
794 (name, state[rev], repo[state[rev]]))
805 (name, state[rev], repo[state[rev]]))
795 mq.qimport(repo, (), patchname=name, git=isgit,
806 mq.qimport(repo, (), patchname=name, git=isgit,
796 rev=[str(state[rev])])
807 rev=[str(state[rev])])
797 else:
808 else:
798 # Rebased and skipped
809 # Rebased and skipped
799 skippedpatches.add(mqrebase[rev][0])
810 skippedpatches.add(mqrebase[rev][0])
800
811
801 # Patches were either applied and rebased and imported in
812 # Patches were either applied and rebased and imported in
802 # order, applied and removed or unapplied. Discard the removed
813 # order, applied and removed or unapplied. Discard the removed
803 # ones while preserving the original series order and guards.
814 # ones while preserving the original series order and guards.
804 newseries = [s for s in original_series
815 newseries = [s for s in original_series
805 if mq.guard_re.split(s, 1)[0] not in skippedpatches]
816 if mq.guard_re.split(s, 1)[0] not in skippedpatches]
806 mq.fullseries[:] = newseries
817 mq.fullseries[:] = newseries
807 mq.seriesdirty = True
818 mq.seriesdirty = True
808 mq.savedirty()
819 mq.savedirty()
809
820
810 def updatebookmarks(repo, targetnode, nstate, originalbookmarks, tr):
821 def updatebookmarks(repo, targetnode, nstate, originalbookmarks, tr):
811 'Move bookmarks to their correct changesets, and delete divergent ones'
822 'Move bookmarks to their correct changesets, and delete divergent ones'
812 marks = repo._bookmarks
823 marks = repo._bookmarks
813 for k, v in originalbookmarks.iteritems():
824 for k, v in originalbookmarks.iteritems():
814 if v in nstate:
825 if v in nstate:
815 # update the bookmarks for revs that have moved
826 # update the bookmarks for revs that have moved
816 marks[k] = nstate[v]
827 marks[k] = nstate[v]
817 bookmarks.deletedivergent(repo, [targetnode], k)
828 bookmarks.deletedivergent(repo, [targetnode], k)
818 marks.recordchange(tr)
829 marks.recordchange(tr)
819
830
820 def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches,
831 def storestatus(repo, originalwd, target, state, collapse, keep, keepbranches,
821 external, activebookmark):
832 external, activebookmark):
822 'Store the current status to allow recovery'
833 'Store the current status to allow recovery'
823 f = repo.vfs("rebasestate", "w")
834 f = repo.vfs("rebasestate", "w")
824 f.write(repo[originalwd].hex() + '\n')
835 f.write(repo[originalwd].hex() + '\n')
825 f.write(repo[target].hex() + '\n')
836 f.write(repo[target].hex() + '\n')
826 f.write(repo[external].hex() + '\n')
837 f.write(repo[external].hex() + '\n')
827 f.write('%d\n' % int(collapse))
838 f.write('%d\n' % int(collapse))
828 f.write('%d\n' % int(keep))
839 f.write('%d\n' % int(keep))
829 f.write('%d\n' % int(keepbranches))
840 f.write('%d\n' % int(keepbranches))
830 f.write('%s\n' % (activebookmark or ''))
841 f.write('%s\n' % (activebookmark or ''))
831 for d, v in state.iteritems():
842 for d, v in state.iteritems():
832 oldrev = repo[d].hex()
843 oldrev = repo[d].hex()
833 if v >= 0:
844 if v >= 0:
834 newrev = repo[v].hex()
845 newrev = repo[v].hex()
835 elif v == revtodo:
846 elif v == revtodo:
836 # To maintain format compatibility, we have to use nullid.
847 # To maintain format compatibility, we have to use nullid.
837 # Please do remove this special case when upgrading the format.
848 # Please do remove this special case when upgrading the format.
838 newrev = hex(nullid)
849 newrev = hex(nullid)
839 else:
850 else:
840 newrev = v
851 newrev = v
841 f.write("%s:%s\n" % (oldrev, newrev))
852 f.write("%s:%s\n" % (oldrev, newrev))
842 f.close()
853 f.close()
843 repo.ui.debug('rebase status stored\n')
854 repo.ui.debug('rebase status stored\n')
844
855
845 def clearstatus(repo):
856 def clearstatus(repo):
846 'Remove the status files'
857 'Remove the status files'
847 _clearrebasesetvisibiliy(repo)
858 _clearrebasesetvisibiliy(repo)
848 util.unlinkpath(repo.join("rebasestate"), ignoremissing=True)
859 util.unlinkpath(repo.join("rebasestate"), ignoremissing=True)
849
860
850 def restorestatus(repo):
861 def restorestatus(repo):
851 'Restore a previously stored status'
862 'Restore a previously stored status'
852 keepbranches = None
863 keepbranches = None
853 target = None
864 target = None
854 collapse = False
865 collapse = False
855 external = nullrev
866 external = nullrev
856 activebookmark = None
867 activebookmark = None
857 state = {}
868 state = {}
858
869
859 try:
870 try:
860 f = repo.vfs("rebasestate")
871 f = repo.vfs("rebasestate")
861 for i, l in enumerate(f.read().splitlines()):
872 for i, l in enumerate(f.read().splitlines()):
862 if i == 0:
873 if i == 0:
863 originalwd = repo[l].rev()
874 originalwd = repo[l].rev()
864 elif i == 1:
875 elif i == 1:
865 target = repo[l].rev()
876 target = repo[l].rev()
866 elif i == 2:
877 elif i == 2:
867 external = repo[l].rev()
878 external = repo[l].rev()
868 elif i == 3:
879 elif i == 3:
869 collapse = bool(int(l))
880 collapse = bool(int(l))
870 elif i == 4:
881 elif i == 4:
871 keep = bool(int(l))
882 keep = bool(int(l))
872 elif i == 5:
883 elif i == 5:
873 keepbranches = bool(int(l))
884 keepbranches = bool(int(l))
874 elif i == 6 and not (len(l) == 81 and ':' in l):
885 elif i == 6 and not (len(l) == 81 and ':' in l):
875 # line 6 is a recent addition, so for backwards compatibility
886 # line 6 is a recent addition, so for backwards compatibility
876 # check that the line doesn't look like the oldrev:newrev lines
887 # check that the line doesn't look like the oldrev:newrev lines
877 activebookmark = l
888 activebookmark = l
878 else:
889 else:
879 oldrev, newrev = l.split(':')
890 oldrev, newrev = l.split(':')
880 if newrev in (str(nullmerge), str(revignored),
891 if newrev in (str(nullmerge), str(revignored),
881 str(revprecursor), str(revpruned)):
892 str(revprecursor), str(revpruned)):
882 state[repo[oldrev].rev()] = int(newrev)
893 state[repo[oldrev].rev()] = int(newrev)
883 elif newrev == nullid:
894 elif newrev == nullid:
884 state[repo[oldrev].rev()] = revtodo
895 state[repo[oldrev].rev()] = revtodo
885 # Legacy compat special case
896 # Legacy compat special case
886 else:
897 else:
887 state[repo[oldrev].rev()] = repo[newrev].rev()
898 state[repo[oldrev].rev()] = repo[newrev].rev()
888
899
889 except IOError as err:
900 except IOError as err:
890 if err.errno != errno.ENOENT:
901 if err.errno != errno.ENOENT:
891 raise
902 raise
892 raise error.Abort(_('no rebase in progress'))
903 raise error.Abort(_('no rebase in progress'))
893
904
894 if keepbranches is None:
905 if keepbranches is None:
895 raise error.Abort(_('.hg/rebasestate is incomplete'))
906 raise error.Abort(_('.hg/rebasestate is incomplete'))
896
907
897 skipped = set()
908 skipped = set()
898 # recompute the set of skipped revs
909 # recompute the set of skipped revs
899 if not collapse:
910 if not collapse:
900 seen = set([target])
911 seen = set([target])
901 for old, new in sorted(state.items()):
912 for old, new in sorted(state.items()):
902 if new != revtodo and new in seen:
913 if new != revtodo and new in seen:
903 skipped.add(old)
914 skipped.add(old)
904 seen.add(new)
915 seen.add(new)
905 repo.ui.debug('computed skipped revs: %s\n' %
916 repo.ui.debug('computed skipped revs: %s\n' %
906 (' '.join(str(r) for r in sorted(skipped)) or None))
917 (' '.join(str(r) for r in sorted(skipped)) or None))
907 repo.ui.debug('rebase status resumed\n')
918 repo.ui.debug('rebase status resumed\n')
908 _setrebasesetvisibility(repo, state.keys())
919 _setrebasesetvisibility(repo, state.keys())
909 return (originalwd, target, state, skipped,
920 return (originalwd, target, state, skipped,
910 collapse, keep, keepbranches, external, activebookmark)
921 collapse, keep, keepbranches, external, activebookmark)
911
922
912 def needupdate(repo, state):
923 def needupdate(repo, state):
913 '''check whether we should `update --clean` away from a merge, or if
924 '''check whether we should `update --clean` away from a merge, or if
914 somehow the working dir got forcibly updated, e.g. by older hg'''
925 somehow the working dir got forcibly updated, e.g. by older hg'''
915 parents = [p.rev() for p in repo[None].parents()]
926 parents = [p.rev() for p in repo[None].parents()]
916
927
917 # Are we in a merge state at all?
928 # Are we in a merge state at all?
918 if len(parents) < 2:
929 if len(parents) < 2:
919 return False
930 return False
920
931
921 # We should be standing on the first as-of-yet unrebased commit.
932 # We should be standing on the first as-of-yet unrebased commit.
922 firstunrebased = min([old for old, new in state.iteritems()
933 firstunrebased = min([old for old, new in state.iteritems()
923 if new == nullrev])
934 if new == nullrev])
924 if firstunrebased in parents:
935 if firstunrebased in parents:
925 return True
936 return True
926
937
927 return False
938 return False
928
939
929 def abort(repo, originalwd, target, state, activebookmark=None):
940 def abort(repo, originalwd, target, state, activebookmark=None):
930 '''Restore the repository to its original state. Additional args:
941 '''Restore the repository to its original state. Additional args:
931
942
932 activebookmark: the name of the bookmark that should be active after the
943 activebookmark: the name of the bookmark that should be active after the
933 restore'''
944 restore'''
934
945
935 try:
946 try:
936 # If the first commits in the rebased set get skipped during the rebase,
947 # If the first commits in the rebased set get skipped during the rebase,
937 # their values within the state mapping will be the target rev id. The
948 # their values within the state mapping will be the target rev id. The
938 # dstates list must must not contain the target rev (issue4896)
949 # dstates list must must not contain the target rev (issue4896)
939 dstates = [s for s in state.values() if s >= 0 and s != target]
950 dstates = [s for s in state.values() if s >= 0 and s != target]
940 immutable = [d for d in dstates if not repo[d].mutable()]
951 immutable = [d for d in dstates if not repo[d].mutable()]
941 cleanup = True
952 cleanup = True
942 if immutable:
953 if immutable:
943 repo.ui.warn(_("warning: can't clean up public changesets %s\n")
954 repo.ui.warn(_("warning: can't clean up public changesets %s\n")
944 % ', '.join(str(repo[r]) for r in immutable),
955 % ', '.join(str(repo[r]) for r in immutable),
945 hint=_('see "hg help phases" for details'))
956 hint=_('see "hg help phases" for details'))
946 cleanup = False
957 cleanup = False
947
958
948 descendants = set()
959 descendants = set()
949 if dstates:
960 if dstates:
950 descendants = set(repo.changelog.descendants(dstates))
961 descendants = set(repo.changelog.descendants(dstates))
951 if descendants - set(dstates):
962 if descendants - set(dstates):
952 repo.ui.warn(_("warning: new changesets detected on target branch, "
963 repo.ui.warn(_("warning: new changesets detected on target branch, "
953 "can't strip\n"))
964 "can't strip\n"))
954 cleanup = False
965 cleanup = False
955
966
956 if cleanup:
967 if cleanup:
957 # Update away from the rebase if necessary
968 # Update away from the rebase if necessary
958 if needupdate(repo, state):
969 if needupdate(repo, state):
959 merge.update(repo, originalwd, False, True)
970 merge.update(repo, originalwd, False, True)
960
971
961 # Strip from the first rebased revision
972 # Strip from the first rebased revision
962 rebased = filter(lambda x: x >= 0 and x != target, state.values())
973 rebased = filter(lambda x: x >= 0 and x != target, state.values())
963 if rebased:
974 if rebased:
964 strippoints = [
975 strippoints = [
965 c.node() for c in repo.set('roots(%ld)', rebased)]
976 c.node() for c in repo.set('roots(%ld)', rebased)]
966 # no backup of rebased cset versions needed
977 # no backup of rebased cset versions needed
967 repair.strip(repo.ui, repo, strippoints)
978 repair.strip(repo.ui, repo, strippoints)
968
979
969 if activebookmark and activebookmark in repo._bookmarks:
980 if activebookmark and activebookmark in repo._bookmarks:
970 bookmarks.activate(repo, activebookmark)
981 bookmarks.activate(repo, activebookmark)
971
982
972 finally:
983 finally:
973 clearstatus(repo)
984 clearstatus(repo)
974 repo.ui.warn(_('rebase aborted\n'))
985 repo.ui.warn(_('rebase aborted\n'))
975 return 0
986 return 0
976
987
977 def buildstate(repo, dest, rebaseset, collapse, obsoletenotrebased):
988 def buildstate(repo, dest, rebaseset, collapse, obsoletenotrebased):
978 '''Define which revisions are going to be rebased and where
989 '''Define which revisions are going to be rebased and where
979
990
980 repo: repo
991 repo: repo
981 dest: context
992 dest: context
982 rebaseset: set of rev
993 rebaseset: set of rev
983 '''
994 '''
984 _setrebasesetvisibility(repo, rebaseset)
995 _setrebasesetvisibility(repo, rebaseset)
985
996
986 # This check isn't strictly necessary, since mq detects commits over an
997 # This check isn't strictly necessary, since mq detects commits over an
987 # applied patch. But it prevents messing up the working directory when
998 # applied patch. But it prevents messing up the working directory when
988 # a partially completed rebase is blocked by mq.
999 # a partially completed rebase is blocked by mq.
989 if 'qtip' in repo.tags() and (dest.node() in
1000 if 'qtip' in repo.tags() and (dest.node() in
990 [s.node for s in repo.mq.applied]):
1001 [s.node for s in repo.mq.applied]):
991 raise error.Abort(_('cannot rebase onto an applied mq patch'))
1002 raise error.Abort(_('cannot rebase onto an applied mq patch'))
992
1003
993 roots = list(repo.set('roots(%ld)', rebaseset))
1004 roots = list(repo.set('roots(%ld)', rebaseset))
994 if not roots:
1005 if not roots:
995 raise error.Abort(_('no matching revisions'))
1006 raise error.Abort(_('no matching revisions'))
996 roots.sort()
1007 roots.sort()
997 state = {}
1008 state = {}
998 detachset = set()
1009 detachset = set()
999 for root in roots:
1010 for root in roots:
1000 commonbase = root.ancestor(dest)
1011 commonbase = root.ancestor(dest)
1001 if commonbase == root:
1012 if commonbase == root:
1002 raise error.Abort(_('source is ancestor of destination'))
1013 raise error.Abort(_('source is ancestor of destination'))
1003 if commonbase == dest:
1014 if commonbase == dest:
1004 samebranch = root.branch() == dest.branch()
1015 samebranch = root.branch() == dest.branch()
1005 if not collapse and samebranch and root in dest.children():
1016 if not collapse and samebranch and root in dest.children():
1006 repo.ui.debug('source is a child of destination\n')
1017 repo.ui.debug('source is a child of destination\n')
1007 return None
1018 return None
1008
1019
1009 repo.ui.debug('rebase onto %d starting from %s\n' % (dest, root))
1020 repo.ui.debug('rebase onto %d starting from %s\n' % (dest, root))
1010 state.update(dict.fromkeys(rebaseset, revtodo))
1021 state.update(dict.fromkeys(rebaseset, revtodo))
1011 # Rebase tries to turn <dest> into a parent of <root> while
1022 # Rebase tries to turn <dest> into a parent of <root> while
1012 # preserving the number of parents of rebased changesets:
1023 # preserving the number of parents of rebased changesets:
1013 #
1024 #
1014 # - A changeset with a single parent will always be rebased as a
1025 # - A changeset with a single parent will always be rebased as a
1015 # changeset with a single parent.
1026 # changeset with a single parent.
1016 #
1027 #
1017 # - A merge will be rebased as merge unless its parents are both
1028 # - A merge will be rebased as merge unless its parents are both
1018 # ancestors of <dest> or are themselves in the rebased set and
1029 # ancestors of <dest> or are themselves in the rebased set and
1019 # pruned while rebased.
1030 # pruned while rebased.
1020 #
1031 #
1021 # If one parent of <root> is an ancestor of <dest>, the rebased
1032 # If one parent of <root> is an ancestor of <dest>, the rebased
1022 # version of this parent will be <dest>. This is always true with
1033 # version of this parent will be <dest>. This is always true with
1023 # --base option.
1034 # --base option.
1024 #
1035 #
1025 # Otherwise, we need to *replace* the original parents with
1036 # Otherwise, we need to *replace* the original parents with
1026 # <dest>. This "detaches" the rebased set from its former location
1037 # <dest>. This "detaches" the rebased set from its former location
1027 # and rebases it onto <dest>. Changes introduced by ancestors of
1038 # and rebases it onto <dest>. Changes introduced by ancestors of
1028 # <root> not common with <dest> (the detachset, marked as
1039 # <root> not common with <dest> (the detachset, marked as
1029 # nullmerge) are "removed" from the rebased changesets.
1040 # nullmerge) are "removed" from the rebased changesets.
1030 #
1041 #
1031 # - If <root> has a single parent, set it to <dest>.
1042 # - If <root> has a single parent, set it to <dest>.
1032 #
1043 #
1033 # - If <root> is a merge, we cannot decide which parent to
1044 # - If <root> is a merge, we cannot decide which parent to
1034 # replace, the rebase operation is not clearly defined.
1045 # replace, the rebase operation is not clearly defined.
1035 #
1046 #
1036 # The table below sums up this behavior:
1047 # The table below sums up this behavior:
1037 #
1048 #
1038 # +------------------+----------------------+-------------------------+
1049 # +------------------+----------------------+-------------------------+
1039 # | | one parent | merge |
1050 # | | one parent | merge |
1040 # +------------------+----------------------+-------------------------+
1051 # +------------------+----------------------+-------------------------+
1041 # | parent in | new parent is <dest> | parents in ::<dest> are |
1052 # | parent in | new parent is <dest> | parents in ::<dest> are |
1042 # | ::<dest> | | remapped to <dest> |
1053 # | ::<dest> | | remapped to <dest> |
1043 # +------------------+----------------------+-------------------------+
1054 # +------------------+----------------------+-------------------------+
1044 # | unrelated source | new parent is <dest> | ambiguous, abort |
1055 # | unrelated source | new parent is <dest> | ambiguous, abort |
1045 # +------------------+----------------------+-------------------------+
1056 # +------------------+----------------------+-------------------------+
1046 #
1057 #
1047 # The actual abort is handled by `defineparents`
1058 # The actual abort is handled by `defineparents`
1048 if len(root.parents()) <= 1:
1059 if len(root.parents()) <= 1:
1049 # ancestors of <root> not ancestors of <dest>
1060 # ancestors of <root> not ancestors of <dest>
1050 detachset.update(repo.changelog.findmissingrevs([commonbase.rev()],
1061 detachset.update(repo.changelog.findmissingrevs([commonbase.rev()],
1051 [root.rev()]))
1062 [root.rev()]))
1052 for r in detachset:
1063 for r in detachset:
1053 if r not in state:
1064 if r not in state:
1054 state[r] = nullmerge
1065 state[r] = nullmerge
1055 if len(roots) > 1:
1066 if len(roots) > 1:
1056 # If we have multiple roots, we may have "hole" in the rebase set.
1067 # If we have multiple roots, we may have "hole" in the rebase set.
1057 # Rebase roots that descend from those "hole" should not be detached as
1068 # Rebase roots that descend from those "hole" should not be detached as
1058 # other root are. We use the special `revignored` to inform rebase that
1069 # other root are. We use the special `revignored` to inform rebase that
1059 # the revision should be ignored but that `defineparents` should search
1070 # the revision should be ignored but that `defineparents` should search
1060 # a rebase destination that make sense regarding rebased topology.
1071 # a rebase destination that make sense regarding rebased topology.
1061 rebasedomain = set(repo.revs('%ld::%ld', rebaseset, rebaseset))
1072 rebasedomain = set(repo.revs('%ld::%ld', rebaseset, rebaseset))
1062 for ignored in set(rebasedomain) - set(rebaseset):
1073 for ignored in set(rebasedomain) - set(rebaseset):
1063 state[ignored] = revignored
1074 state[ignored] = revignored
1064 for r in obsoletenotrebased:
1075 for r in obsoletenotrebased:
1065 if obsoletenotrebased[r] is None:
1076 if obsoletenotrebased[r] is None:
1066 state[r] = revpruned
1077 state[r] = revpruned
1067 else:
1078 else:
1068 state[r] = revprecursor
1079 state[r] = revprecursor
1069 return repo['.'].rev(), dest.rev(), state
1080 return repo['.'].rev(), dest.rev(), state
1070
1081
1071 def clearrebased(ui, repo, state, skipped, collapsedas=None):
1082 def clearrebased(ui, repo, state, skipped, collapsedas=None):
1072 """dispose of rebased revision at the end of the rebase
1083 """dispose of rebased revision at the end of the rebase
1073
1084
1074 If `collapsedas` is not None, the rebase was a collapse whose result if the
1085 If `collapsedas` is not None, the rebase was a collapse whose result if the
1075 `collapsedas` node."""
1086 `collapsedas` node."""
1076 if obsolete.isenabled(repo, obsolete.createmarkersopt):
1087 if obsolete.isenabled(repo, obsolete.createmarkersopt):
1077 markers = []
1088 markers = []
1078 for rev, newrev in sorted(state.items()):
1089 for rev, newrev in sorted(state.items()):
1079 if newrev >= 0:
1090 if newrev >= 0:
1080 if rev in skipped:
1091 if rev in skipped:
1081 succs = ()
1092 succs = ()
1082 elif collapsedas is not None:
1093 elif collapsedas is not None:
1083 succs = (repo[collapsedas],)
1094 succs = (repo[collapsedas],)
1084 else:
1095 else:
1085 succs = (repo[newrev],)
1096 succs = (repo[newrev],)
1086 markers.append((repo[rev], succs))
1097 markers.append((repo[rev], succs))
1087 if markers:
1098 if markers:
1088 obsolete.createmarkers(repo, markers)
1099 obsolete.createmarkers(repo, markers)
1089 else:
1100 else:
1090 rebased = [rev for rev in state if state[rev] > nullmerge]
1101 rebased = [rev for rev in state if state[rev] > nullmerge]
1091 if rebased:
1102 if rebased:
1092 stripped = []
1103 stripped = []
1093 for root in repo.set('roots(%ld)', rebased):
1104 for root in repo.set('roots(%ld)', rebased):
1094 if set(repo.changelog.descendants([root.rev()])) - set(state):
1105 if set(repo.changelog.descendants([root.rev()])) - set(state):
1095 ui.warn(_("warning: new changesets detected "
1106 ui.warn(_("warning: new changesets detected "
1096 "on source branch, not stripping\n"))
1107 "on source branch, not stripping\n"))
1097 else:
1108 else:
1098 stripped.append(root.node())
1109 stripped.append(root.node())
1099 if stripped:
1110 if stripped:
1100 # backup the old csets by default
1111 # backup the old csets by default
1101 repair.strip(ui, repo, stripped, "all")
1112 repair.strip(ui, repo, stripped, "all")
1102
1113
1103
1114
1104 def pullrebase(orig, ui, repo, *args, **opts):
1115 def pullrebase(orig, ui, repo, *args, **opts):
1105 'Call rebase after pull if the latter has been invoked with --rebase'
1116 'Call rebase after pull if the latter has been invoked with --rebase'
1106 ret = None
1117 ret = None
1107 if opts.get('rebase'):
1118 if opts.get('rebase'):
1108 wlock = lock = None
1119 wlock = lock = None
1109 try:
1120 try:
1110 wlock = repo.wlock()
1121 wlock = repo.wlock()
1111 lock = repo.lock()
1122 lock = repo.lock()
1112 if opts.get('update'):
1123 if opts.get('update'):
1113 del opts['update']
1124 del opts['update']
1114 ui.debug('--update and --rebase are not compatible, ignoring '
1125 ui.debug('--update and --rebase are not compatible, ignoring '
1115 'the update flag\n')
1126 'the update flag\n')
1116
1127
1117 movemarkfrom = repo['.'].node()
1128 movemarkfrom = repo['.'].node()
1118 revsprepull = len(repo)
1129 revsprepull = len(repo)
1119 origpostincoming = commands.postincoming
1130 origpostincoming = commands.postincoming
1120 def _dummy(*args, **kwargs):
1131 def _dummy(*args, **kwargs):
1121 pass
1132 pass
1122 commands.postincoming = _dummy
1133 commands.postincoming = _dummy
1123 try:
1134 try:
1124 ret = orig(ui, repo, *args, **opts)
1135 ret = orig(ui, repo, *args, **opts)
1125 finally:
1136 finally:
1126 commands.postincoming = origpostincoming
1137 commands.postincoming = origpostincoming
1127 revspostpull = len(repo)
1138 revspostpull = len(repo)
1128 if revspostpull > revsprepull:
1139 if revspostpull > revsprepull:
1129 # --rev option from pull conflict with rebase own --rev
1140 # --rev option from pull conflict with rebase own --rev
1130 # dropping it
1141 # dropping it
1131 if 'rev' in opts:
1142 if 'rev' in opts:
1132 del opts['rev']
1143 del opts['rev']
1133 # positional argument from pull conflicts with rebase's own
1144 # positional argument from pull conflicts with rebase's own
1134 # --source.
1145 # --source.
1135 if 'source' in opts:
1146 if 'source' in opts:
1136 del opts['source']
1147 del opts['source']
1137 rebase(ui, repo, **opts)
1148 rebase(ui, repo, **opts)
1138 branch = repo[None].branch()
1149 branch = repo[None].branch()
1139 dest = repo[branch].rev()
1150 dest = repo[branch].rev()
1140 if dest != repo['.'].rev():
1151 if dest != repo['.'].rev():
1141 # there was nothing to rebase we force an update
1152 # there was nothing to rebase we force an update
1142 hg.update(repo, dest)
1153 hg.update(repo, dest)
1143 if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
1154 if bookmarks.update(repo, [movemarkfrom], repo['.'].node()):
1144 ui.status(_("updating bookmark %s\n")
1155 ui.status(_("updating bookmark %s\n")
1145 % repo._activebookmark)
1156 % repo._activebookmark)
1146 finally:
1157 finally:
1147 release(lock, wlock)
1158 release(lock, wlock)
1148 else:
1159 else:
1149 if opts.get('tool'):
1160 if opts.get('tool'):
1150 raise error.Abort(_('--tool can only be used with --rebase'))
1161 raise error.Abort(_('--tool can only be used with --rebase'))
1151 ret = orig(ui, repo, *args, **opts)
1162 ret = orig(ui, repo, *args, **opts)
1152
1163
1153 return ret
1164 return ret
1154
1165
1155 def _setrebasesetvisibility(repo, revs):
1166 def _setrebasesetvisibility(repo, revs):
1156 """store the currently rebased set on the repo object
1167 """store the currently rebased set on the repo object
1157
1168
1158 This is used by another function to prevent rebased revision to because
1169 This is used by another function to prevent rebased revision to because
1159 hidden (see issue4505)"""
1170 hidden (see issue4505)"""
1160 repo = repo.unfiltered()
1171 repo = repo.unfiltered()
1161 revs = set(revs)
1172 revs = set(revs)
1162 repo._rebaseset = revs
1173 repo._rebaseset = revs
1163 # invalidate cache if visibility changes
1174 # invalidate cache if visibility changes
1164 hiddens = repo.filteredrevcache.get('visible', set())
1175 hiddens = repo.filteredrevcache.get('visible', set())
1165 if revs & hiddens:
1176 if revs & hiddens:
1166 repo.invalidatevolatilesets()
1177 repo.invalidatevolatilesets()
1167
1178
1168 def _clearrebasesetvisibiliy(repo):
1179 def _clearrebasesetvisibiliy(repo):
1169 """remove rebaseset data from the repo"""
1180 """remove rebaseset data from the repo"""
1170 repo = repo.unfiltered()
1181 repo = repo.unfiltered()
1171 if '_rebaseset' in vars(repo):
1182 if '_rebaseset' in vars(repo):
1172 del repo._rebaseset
1183 del repo._rebaseset
1173
1184
1174 def _rebasedvisible(orig, repo):
1185 def _rebasedvisible(orig, repo):
1175 """ensure rebased revs stay visible (see issue4505)"""
1186 """ensure rebased revs stay visible (see issue4505)"""
1176 blockers = orig(repo)
1187 blockers = orig(repo)
1177 blockers.update(getattr(repo, '_rebaseset', ()))
1188 blockers.update(getattr(repo, '_rebaseset', ()))
1178 return blockers
1189 return blockers
1179
1190
1180 def _computeobsoletenotrebased(repo, rebaseobsrevs, dest):
1191 def _computeobsoletenotrebased(repo, rebaseobsrevs, dest):
1181 """return a mapping obsolete => successor for all obsolete nodes to be
1192 """return a mapping obsolete => successor for all obsolete nodes to be
1182 rebased that have a successors in the destination
1193 rebased that have a successors in the destination
1183
1194
1184 obsolete => None entries in the mapping indicate nodes with no succesor"""
1195 obsolete => None entries in the mapping indicate nodes with no succesor"""
1185 obsoletenotrebased = {}
1196 obsoletenotrebased = {}
1186
1197
1187 # Build a mapping successor => obsolete nodes for the obsolete
1198 # Build a mapping successor => obsolete nodes for the obsolete
1188 # nodes to be rebased
1199 # nodes to be rebased
1189 allsuccessors = {}
1200 allsuccessors = {}
1190 cl = repo.changelog
1201 cl = repo.changelog
1191 for r in rebaseobsrevs:
1202 for r in rebaseobsrevs:
1192 node = cl.node(r)
1203 node = cl.node(r)
1193 for s in obsolete.allsuccessors(repo.obsstore, [node]):
1204 for s in obsolete.allsuccessors(repo.obsstore, [node]):
1194 try:
1205 try:
1195 allsuccessors[cl.rev(s)] = cl.rev(node)
1206 allsuccessors[cl.rev(s)] = cl.rev(node)
1196 except LookupError:
1207 except LookupError:
1197 pass
1208 pass
1198
1209
1199 if allsuccessors:
1210 if allsuccessors:
1200 # Look for successors of obsolete nodes to be rebased among
1211 # Look for successors of obsolete nodes to be rebased among
1201 # the ancestors of dest
1212 # the ancestors of dest
1202 ancs = cl.ancestors([repo[dest].rev()],
1213 ancs = cl.ancestors([repo[dest].rev()],
1203 stoprev=min(allsuccessors),
1214 stoprev=min(allsuccessors),
1204 inclusive=True)
1215 inclusive=True)
1205 for s in allsuccessors:
1216 for s in allsuccessors:
1206 if s in ancs:
1217 if s in ancs:
1207 obsoletenotrebased[allsuccessors[s]] = s
1218 obsoletenotrebased[allsuccessors[s]] = s
1208 elif (s == allsuccessors[s] and
1219 elif (s == allsuccessors[s] and
1209 allsuccessors.values().count(s) == 1):
1220 allsuccessors.values().count(s) == 1):
1210 # plain prune
1221 # plain prune
1211 obsoletenotrebased[s] = None
1222 obsoletenotrebased[s] = None
1212
1223
1213 return obsoletenotrebased
1224 return obsoletenotrebased
1214
1225
1215 def summaryhook(ui, repo):
1226 def summaryhook(ui, repo):
1216 if not os.path.exists(repo.join('rebasestate')):
1227 if not os.path.exists(repo.join('rebasestate')):
1217 return
1228 return
1218 try:
1229 try:
1219 state = restorestatus(repo)[2]
1230 state = restorestatus(repo)[2]
1220 except error.RepoLookupError:
1231 except error.RepoLookupError:
1221 # i18n: column positioning for "hg summary"
1232 # i18n: column positioning for "hg summary"
1222 msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n')
1233 msg = _('rebase: (use "hg rebase --abort" to clear broken state)\n')
1223 ui.write(msg)
1234 ui.write(msg)
1224 return
1235 return
1225 numrebased = len([i for i in state.itervalues() if i >= 0])
1236 numrebased = len([i for i in state.itervalues() if i >= 0])
1226 # i18n: column positioning for "hg summary"
1237 # i18n: column positioning for "hg summary"
1227 ui.write(_('rebase: %s, %s (rebase --continue)\n') %
1238 ui.write(_('rebase: %s, %s (rebase --continue)\n') %
1228 (ui.label(_('%d rebased'), 'rebase.rebased') % numrebased,
1239 (ui.label(_('%d rebased'), 'rebase.rebased') % numrebased,
1229 ui.label(_('%d remaining'), 'rebase.remaining') %
1240 ui.label(_('%d remaining'), 'rebase.remaining') %
1230 (len(state) - numrebased)))
1241 (len(state) - numrebased)))
1231
1242
1232 def uisetup(ui):
1243 def uisetup(ui):
1233 #Replace pull with a decorator to provide --rebase option
1244 #Replace pull with a decorator to provide --rebase option
1234 entry = extensions.wrapcommand(commands.table, 'pull', pullrebase)
1245 entry = extensions.wrapcommand(commands.table, 'pull', pullrebase)
1235 entry[1].append(('', 'rebase', None,
1246 entry[1].append(('', 'rebase', None,
1236 _("rebase working directory to branch head")))
1247 _("rebase working directory to branch head")))
1237 entry[1].append(('t', 'tool', '',
1248 entry[1].append(('t', 'tool', '',
1238 _("specify merge tool for rebase")))
1249 _("specify merge tool for rebase")))
1239 cmdutil.summaryhooks.add('rebase', summaryhook)
1250 cmdutil.summaryhooks.add('rebase', summaryhook)
1240 cmdutil.unfinishedstates.append(
1251 cmdutil.unfinishedstates.append(
1241 ['rebasestate', False, False, _('rebase in progress'),
1252 ['rebasestate', False, False, _('rebase in progress'),
1242 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1253 _("use 'hg rebase --continue' or 'hg rebase --abort'")])
1243 cmdutil.afterresolvedstates.append(
1254 cmdutil.afterresolvedstates.append(
1244 ['rebasestate', _('hg rebase --continue')])
1255 ['rebasestate', _('hg rebase --continue')])
1245 # ensure rebased rev are not hidden
1256 # ensure rebased rev are not hidden
1246 extensions.wrapfunction(repoview, '_getdynamicblockers', _rebasedvisible)
1257 extensions.wrapfunction(repoview, '_getdynamicblockers', _rebasedvisible)
1247 revsetpredicate.setup()
1258 revsetpredicate.setup()
@@ -1,1986 +1,1993 b''
1 The Mercurial system uses a set of configuration files to control
1 The Mercurial system uses a set of configuration files to control
2 aspects of its behavior.
2 aspects of its behavior.
3
3
4 Troubleshooting
4 Troubleshooting
5 ===============
5 ===============
6
6
7 If you're having problems with your configuration,
7 If you're having problems with your configuration,
8 :hg:`config --debug` can help you understand what is introducing
8 :hg:`config --debug` can help you understand what is introducing
9 a setting into your environment.
9 a setting into your environment.
10
10
11 See :hg:`help config.syntax` and :hg:`help config.files`
11 See :hg:`help config.syntax` and :hg:`help config.files`
12 for information about how and where to override things.
12 for information about how and where to override things.
13
13
14 Structure
14 Structure
15 =========
15 =========
16
16
17 The configuration files use a simple ini-file format. A configuration
17 The configuration files use a simple ini-file format. A configuration
18 file consists of sections, led by a ``[section]`` header and followed
18 file consists of sections, led by a ``[section]`` header and followed
19 by ``name = value`` entries::
19 by ``name = value`` entries::
20
20
21 [ui]
21 [ui]
22 username = Firstname Lastname <firstname.lastname@example.net>
22 username = Firstname Lastname <firstname.lastname@example.net>
23 verbose = True
23 verbose = True
24
24
25 The above entries will be referred to as ``ui.username`` and
25 The above entries will be referred to as ``ui.username`` and
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
26 ``ui.verbose``, respectively. See :hg:`help config.syntax`.
27
27
28 Files
28 Files
29 =====
29 =====
30
30
31 Mercurial reads configuration data from several files, if they exist.
31 Mercurial reads configuration data from several files, if they exist.
32 These files do not exist by default and you will have to create the
32 These files do not exist by default and you will have to create the
33 appropriate configuration files yourself: global configuration like
33 appropriate configuration files yourself: global configuration like
34 the username setting is typically put into
34 the username setting is typically put into
35 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
35 ``%USERPROFILE%\mercurial.ini`` or ``$HOME/.hgrc`` and local
36 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
36 configuration is put into the per-repository ``<repo>/.hg/hgrc`` file.
37
37
38 The names of these files depend on the system on which Mercurial is
38 The names of these files depend on the system on which Mercurial is
39 installed. ``*.rc`` files from a single directory are read in
39 installed. ``*.rc`` files from a single directory are read in
40 alphabetical order, later ones overriding earlier ones. Where multiple
40 alphabetical order, later ones overriding earlier ones. Where multiple
41 paths are given below, settings from earlier paths override later
41 paths are given below, settings from earlier paths override later
42 ones.
42 ones.
43
43
44 .. container:: verbose.unix
44 .. container:: verbose.unix
45
45
46 On Unix, the following files are consulted:
46 On Unix, the following files are consulted:
47
47
48 - ``<repo>/.hg/hgrc`` (per-repository)
48 - ``<repo>/.hg/hgrc`` (per-repository)
49 - ``$HOME/.hgrc`` (per-user)
49 - ``$HOME/.hgrc`` (per-user)
50 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
50 - ``<install-root>/etc/mercurial/hgrc`` (per-installation)
51 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
51 - ``<install-root>/etc/mercurial/hgrc.d/*.rc`` (per-installation)
52 - ``/etc/mercurial/hgrc`` (per-system)
52 - ``/etc/mercurial/hgrc`` (per-system)
53 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
53 - ``/etc/mercurial/hgrc.d/*.rc`` (per-system)
54 - ``<internal>/default.d/*.rc`` (defaults)
54 - ``<internal>/default.d/*.rc`` (defaults)
55
55
56 .. container:: verbose.windows
56 .. container:: verbose.windows
57
57
58 On Windows, the following files are consulted:
58 On Windows, the following files are consulted:
59
59
60 - ``<repo>/.hg/hgrc`` (per-repository)
60 - ``<repo>/.hg/hgrc`` (per-repository)
61 - ``%USERPROFILE%\.hgrc`` (per-user)
61 - ``%USERPROFILE%\.hgrc`` (per-user)
62 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
62 - ``%USERPROFILE%\Mercurial.ini`` (per-user)
63 - ``%HOME%\.hgrc`` (per-user)
63 - ``%HOME%\.hgrc`` (per-user)
64 - ``%HOME%\Mercurial.ini`` (per-user)
64 - ``%HOME%\Mercurial.ini`` (per-user)
65 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
65 - ``HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial`` (per-installation)
66 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
66 - ``<install-dir>\hgrc.d\*.rc`` (per-installation)
67 - ``<install-dir>\Mercurial.ini`` (per-installation)
67 - ``<install-dir>\Mercurial.ini`` (per-installation)
68 - ``<internal>/default.d/*.rc`` (defaults)
68 - ``<internal>/default.d/*.rc`` (defaults)
69
69
70 .. note::
70 .. note::
71
71
72 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
72 The registry key ``HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Mercurial``
73 is used when running 32-bit Python on 64-bit Windows.
73 is used when running 32-bit Python on 64-bit Windows.
74
74
75 .. container:: verbose.plan9
75 .. container:: verbose.plan9
76
76
77 On Plan9, the following files are consulted:
77 On Plan9, the following files are consulted:
78
78
79 - ``<repo>/.hg/hgrc`` (per-repository)
79 - ``<repo>/.hg/hgrc`` (per-repository)
80 - ``$home/lib/hgrc`` (per-user)
80 - ``$home/lib/hgrc`` (per-user)
81 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
81 - ``<install-root>/lib/mercurial/hgrc`` (per-installation)
82 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
82 - ``<install-root>/lib/mercurial/hgrc.d/*.rc`` (per-installation)
83 - ``/lib/mercurial/hgrc`` (per-system)
83 - ``/lib/mercurial/hgrc`` (per-system)
84 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
84 - ``/lib/mercurial/hgrc.d/*.rc`` (per-system)
85 - ``<internal>/default.d/*.rc`` (defaults)
85 - ``<internal>/default.d/*.rc`` (defaults)
86
86
87 Per-repository configuration options only apply in a
87 Per-repository configuration options only apply in a
88 particular repository. This file is not version-controlled, and
88 particular repository. This file is not version-controlled, and
89 will not get transferred during a "clone" operation. Options in
89 will not get transferred during a "clone" operation. Options in
90 this file override options in all other configuration files. On
90 this file override options in all other configuration files. On
91 Plan 9 and Unix, most of this file will be ignored if it doesn't
91 Plan 9 and Unix, most of this file will be ignored if it doesn't
92 belong to a trusted user or to a trusted group. See
92 belong to a trusted user or to a trusted group. See
93 :hg:`help config.trusted` for more details.
93 :hg:`help config.trusted` for more details.
94
94
95 Per-user configuration file(s) are for the user running Mercurial. On
95 Per-user configuration file(s) are for the user running Mercurial. On
96 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
96 Windows 9x, ``%HOME%`` is replaced by ``%APPDATA%``. Options in these
97 files apply to all Mercurial commands executed by this user in any
97 files apply to all Mercurial commands executed by this user in any
98 directory. Options in these files override per-system and per-installation
98 directory. Options in these files override per-system and per-installation
99 options.
99 options.
100
100
101 Per-installation configuration files are searched for in the
101 Per-installation configuration files are searched for in the
102 directory where Mercurial is installed. ``<install-root>`` is the
102 directory where Mercurial is installed. ``<install-root>`` is the
103 parent directory of the **hg** executable (or symlink) being run. For
103 parent directory of the **hg** executable (or symlink) being run. For
104 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
104 example, if installed in ``/shared/tools/bin/hg``, Mercurial will look
105 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
105 in ``/shared/tools/etc/mercurial/hgrc``. Options in these files apply
106 to all Mercurial commands executed by any user in any directory.
106 to all Mercurial commands executed by any user in any directory.
107
107
108 Per-installation configuration files are for the system on
108 Per-installation configuration files are for the system on
109 which Mercurial is running. Options in these files apply to all
109 which Mercurial is running. Options in these files apply to all
110 Mercurial commands executed by any user in any directory. Registry
110 Mercurial commands executed by any user in any directory. Registry
111 keys contain PATH-like strings, every part of which must reference
111 keys contain PATH-like strings, every part of which must reference
112 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
112 a ``Mercurial.ini`` file or be a directory where ``*.rc`` files will
113 be read. Mercurial checks each of these locations in the specified
113 be read. Mercurial checks each of these locations in the specified
114 order until one or more configuration files are detected.
114 order until one or more configuration files are detected.
115
115
116 Per-system configuration files are for the system on which Mercurial
116 Per-system configuration files are for the system on which Mercurial
117 is running. Options in these files apply to all Mercurial commands
117 is running. Options in these files apply to all Mercurial commands
118 executed by any user in any directory. Options in these files
118 executed by any user in any directory. Options in these files
119 override per-installation options.
119 override per-installation options.
120
120
121 Mercurial comes with some default configuration. The default configuration
121 Mercurial comes with some default configuration. The default configuration
122 files are installed with Mercurial and will be overwritten on upgrades. Default
122 files are installed with Mercurial and will be overwritten on upgrades. Default
123 configuration files should never be edited by users or administrators but can
123 configuration files should never be edited by users or administrators but can
124 be overridden in other configuration files. So far the directory only contains
124 be overridden in other configuration files. So far the directory only contains
125 merge tool configuration but packagers can also put other default configuration
125 merge tool configuration but packagers can also put other default configuration
126 there.
126 there.
127
127
128 Syntax
128 Syntax
129 ======
129 ======
130
130
131 A configuration file consists of sections, led by a ``[section]`` header
131 A configuration file consists of sections, led by a ``[section]`` header
132 and followed by ``name = value`` entries (sometimes called
132 and followed by ``name = value`` entries (sometimes called
133 ``configuration keys``)::
133 ``configuration keys``)::
134
134
135 [spam]
135 [spam]
136 eggs=ham
136 eggs=ham
137 green=
137 green=
138 eggs
138 eggs
139
139
140 Each line contains one entry. If the lines that follow are indented,
140 Each line contains one entry. If the lines that follow are indented,
141 they are treated as continuations of that entry. Leading whitespace is
141 they are treated as continuations of that entry. Leading whitespace is
142 removed from values. Empty lines are skipped. Lines beginning with
142 removed from values. Empty lines are skipped. Lines beginning with
143 ``#`` or ``;`` are ignored and may be used to provide comments.
143 ``#`` or ``;`` are ignored and may be used to provide comments.
144
144
145 Configuration keys can be set multiple times, in which case Mercurial
145 Configuration keys can be set multiple times, in which case Mercurial
146 will use the value that was configured last. As an example::
146 will use the value that was configured last. As an example::
147
147
148 [spam]
148 [spam]
149 eggs=large
149 eggs=large
150 ham=serrano
150 ham=serrano
151 eggs=small
151 eggs=small
152
152
153 This would set the configuration key named ``eggs`` to ``small``.
153 This would set the configuration key named ``eggs`` to ``small``.
154
154
155 It is also possible to define a section multiple times. A section can
155 It is also possible to define a section multiple times. A section can
156 be redefined on the same and/or on different configuration files. For
156 be redefined on the same and/or on different configuration files. For
157 example::
157 example::
158
158
159 [foo]
159 [foo]
160 eggs=large
160 eggs=large
161 ham=serrano
161 ham=serrano
162 eggs=small
162 eggs=small
163
163
164 [bar]
164 [bar]
165 eggs=ham
165 eggs=ham
166 green=
166 green=
167 eggs
167 eggs
168
168
169 [foo]
169 [foo]
170 ham=prosciutto
170 ham=prosciutto
171 eggs=medium
171 eggs=medium
172 bread=toasted
172 bread=toasted
173
173
174 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
174 This would set the ``eggs``, ``ham``, and ``bread`` configuration keys
175 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
175 of the ``foo`` section to ``medium``, ``prosciutto``, and ``toasted``,
176 respectively. As you can see there only thing that matters is the last
176 respectively. As you can see there only thing that matters is the last
177 value that was set for each of the configuration keys.
177 value that was set for each of the configuration keys.
178
178
179 If a configuration key is set multiple times in different
179 If a configuration key is set multiple times in different
180 configuration files the final value will depend on the order in which
180 configuration files the final value will depend on the order in which
181 the different configuration files are read, with settings from earlier
181 the different configuration files are read, with settings from earlier
182 paths overriding later ones as described on the ``Files`` section
182 paths overriding later ones as described on the ``Files`` section
183 above.
183 above.
184
184
185 A line of the form ``%include file`` will include ``file`` into the
185 A line of the form ``%include file`` will include ``file`` into the
186 current configuration file. The inclusion is recursive, which means
186 current configuration file. The inclusion is recursive, which means
187 that included files can include other files. Filenames are relative to
187 that included files can include other files. Filenames are relative to
188 the configuration file in which the ``%include`` directive is found.
188 the configuration file in which the ``%include`` directive is found.
189 Environment variables and ``~user`` constructs are expanded in
189 Environment variables and ``~user`` constructs are expanded in
190 ``file``. This lets you do something like::
190 ``file``. This lets you do something like::
191
191
192 %include ~/.hgrc.d/$HOST.rc
192 %include ~/.hgrc.d/$HOST.rc
193
193
194 to include a different configuration file on each computer you use.
194 to include a different configuration file on each computer you use.
195
195
196 A line with ``%unset name`` will remove ``name`` from the current
196 A line with ``%unset name`` will remove ``name`` from the current
197 section, if it has been set previously.
197 section, if it has been set previously.
198
198
199 The values are either free-form text strings, lists of text strings,
199 The values are either free-form text strings, lists of text strings,
200 or Boolean values. Boolean values can be set to true using any of "1",
200 or Boolean values. Boolean values can be set to true using any of "1",
201 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
201 "yes", "true", or "on" and to false using "0", "no", "false", or "off"
202 (all case insensitive).
202 (all case insensitive).
203
203
204 List values are separated by whitespace or comma, except when values are
204 List values are separated by whitespace or comma, except when values are
205 placed in double quotation marks::
205 placed in double quotation marks::
206
206
207 allow_read = "John Doe, PhD", brian, betty
207 allow_read = "John Doe, PhD", brian, betty
208
208
209 Quotation marks can be escaped by prefixing them with a backslash. Only
209 Quotation marks can be escaped by prefixing them with a backslash. Only
210 quotation marks at the beginning of a word is counted as a quotation
210 quotation marks at the beginning of a word is counted as a quotation
211 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
211 (e.g., ``foo"bar baz`` is the list of ``foo"bar`` and ``baz``).
212
212
213 Sections
213 Sections
214 ========
214 ========
215
215
216 This section describes the different sections that may appear in a
216 This section describes the different sections that may appear in a
217 Mercurial configuration file, the purpose of each section, its possible
217 Mercurial configuration file, the purpose of each section, its possible
218 keys, and their possible values.
218 keys, and their possible values.
219
219
220 ``alias``
220 ``alias``
221 ---------
221 ---------
222
222
223 Defines command aliases.
223 Defines command aliases.
224
224
225 Aliases allow you to define your own commands in terms of other
225 Aliases allow you to define your own commands in terms of other
226 commands (or aliases), optionally including arguments. Positional
226 commands (or aliases), optionally including arguments. Positional
227 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
227 arguments in the form of ``$1``, ``$2``, etc. in the alias definition
228 are expanded by Mercurial before execution. Positional arguments not
228 are expanded by Mercurial before execution. Positional arguments not
229 already used by ``$N`` in the definition are put at the end of the
229 already used by ``$N`` in the definition are put at the end of the
230 command to be executed.
230 command to be executed.
231
231
232 Alias definitions consist of lines of the form::
232 Alias definitions consist of lines of the form::
233
233
234 <alias> = <command> [<argument>]...
234 <alias> = <command> [<argument>]...
235
235
236 For example, this definition::
236 For example, this definition::
237
237
238 latest = log --limit 5
238 latest = log --limit 5
239
239
240 creates a new command ``latest`` that shows only the five most recent
240 creates a new command ``latest`` that shows only the five most recent
241 changesets. You can define subsequent aliases using earlier ones::
241 changesets. You can define subsequent aliases using earlier ones::
242
242
243 stable5 = latest -b stable
243 stable5 = latest -b stable
244
244
245 .. note::
245 .. note::
246
246
247 It is possible to create aliases with the same names as
247 It is possible to create aliases with the same names as
248 existing commands, which will then override the original
248 existing commands, which will then override the original
249 definitions. This is almost always a bad idea!
249 definitions. This is almost always a bad idea!
250
250
251 An alias can start with an exclamation point (``!``) to make it a
251 An alias can start with an exclamation point (``!``) to make it a
252 shell alias. A shell alias is executed with the shell and will let you
252 shell alias. A shell alias is executed with the shell and will let you
253 run arbitrary commands. As an example, ::
253 run arbitrary commands. As an example, ::
254
254
255 echo = !echo $@
255 echo = !echo $@
256
256
257 will let you do ``hg echo foo`` to have ``foo`` printed in your
257 will let you do ``hg echo foo`` to have ``foo`` printed in your
258 terminal. A better example might be::
258 terminal. A better example might be::
259
259
260 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
260 purge = !$HG status --no-status --unknown -0 | xargs -0 rm
261
261
262 which will make ``hg purge`` delete all unknown files in the
262 which will make ``hg purge`` delete all unknown files in the
263 repository in the same manner as the purge extension.
263 repository in the same manner as the purge extension.
264
264
265 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
265 Positional arguments like ``$1``, ``$2``, etc. in the alias definition
266 expand to the command arguments. Unmatched arguments are
266 expand to the command arguments. Unmatched arguments are
267 removed. ``$0`` expands to the alias name and ``$@`` expands to all
267 removed. ``$0`` expands to the alias name and ``$@`` expands to all
268 arguments separated by a space. ``"$@"`` (with quotes) expands to all
268 arguments separated by a space. ``"$@"`` (with quotes) expands to all
269 arguments quoted individually and separated by a space. These expansions
269 arguments quoted individually and separated by a space. These expansions
270 happen before the command is passed to the shell.
270 happen before the command is passed to the shell.
271
271
272 Shell aliases are executed in an environment where ``$HG`` expands to
272 Shell aliases are executed in an environment where ``$HG`` expands to
273 the path of the Mercurial that was used to execute the alias. This is
273 the path of the Mercurial that was used to execute the alias. This is
274 useful when you want to call further Mercurial commands in a shell
274 useful when you want to call further Mercurial commands in a shell
275 alias, as was done above for the purge alias. In addition,
275 alias, as was done above for the purge alias. In addition,
276 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
276 ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg
277 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
277 echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``.
278
278
279 .. note::
279 .. note::
280
280
281 Some global configuration options such as ``-R`` are
281 Some global configuration options such as ``-R`` are
282 processed before shell aliases and will thus not be passed to
282 processed before shell aliases and will thus not be passed to
283 aliases.
283 aliases.
284
284
285
285
286 ``annotate``
286 ``annotate``
287 ------------
287 ------------
288
288
289 Settings used when displaying file annotations. All values are
289 Settings used when displaying file annotations. All values are
290 Booleans and default to False. See :hg:`help config.diff` for
290 Booleans and default to False. See :hg:`help config.diff` for
291 related options for the diff command.
291 related options for the diff command.
292
292
293 ``ignorews``
293 ``ignorews``
294 Ignore white space when comparing lines.
294 Ignore white space when comparing lines.
295
295
296 ``ignorewsamount``
296 ``ignorewsamount``
297 Ignore changes in the amount of white space.
297 Ignore changes in the amount of white space.
298
298
299 ``ignoreblanklines``
299 ``ignoreblanklines``
300 Ignore changes whose lines are all blank.
300 Ignore changes whose lines are all blank.
301
301
302
302
303 ``auth``
303 ``auth``
304 --------
304 --------
305
305
306 Authentication credentials for HTTP authentication. This section
306 Authentication credentials for HTTP authentication. This section
307 allows you to store usernames and passwords for use when logging
307 allows you to store usernames and passwords for use when logging
308 *into* HTTP servers. See :hg:`help config.web` if
308 *into* HTTP servers. See :hg:`help config.web` if
309 you want to configure *who* can login to your HTTP server.
309 you want to configure *who* can login to your HTTP server.
310
310
311 Each line has the following format::
311 Each line has the following format::
312
312
313 <name>.<argument> = <value>
313 <name>.<argument> = <value>
314
314
315 where ``<name>`` is used to group arguments into authentication
315 where ``<name>`` is used to group arguments into authentication
316 entries. Example::
316 entries. Example::
317
317
318 foo.prefix = hg.intevation.org/mercurial
318 foo.prefix = hg.intevation.org/mercurial
319 foo.username = foo
319 foo.username = foo
320 foo.password = bar
320 foo.password = bar
321 foo.schemes = http https
321 foo.schemes = http https
322
322
323 bar.prefix = secure.example.org
323 bar.prefix = secure.example.org
324 bar.key = path/to/file.key
324 bar.key = path/to/file.key
325 bar.cert = path/to/file.cert
325 bar.cert = path/to/file.cert
326 bar.schemes = https
326 bar.schemes = https
327
327
328 Supported arguments:
328 Supported arguments:
329
329
330 ``prefix``
330 ``prefix``
331 Either ``*`` or a URI prefix with or without the scheme part.
331 Either ``*`` or a URI prefix with or without the scheme part.
332 The authentication entry with the longest matching prefix is used
332 The authentication entry with the longest matching prefix is used
333 (where ``*`` matches everything and counts as a match of length
333 (where ``*`` matches everything and counts as a match of length
334 1). If the prefix doesn't include a scheme, the match is performed
334 1). If the prefix doesn't include a scheme, the match is performed
335 against the URI with its scheme stripped as well, and the schemes
335 against the URI with its scheme stripped as well, and the schemes
336 argument, q.v., is then subsequently consulted.
336 argument, q.v., is then subsequently consulted.
337
337
338 ``username``
338 ``username``
339 Optional. Username to authenticate with. If not given, and the
339 Optional. Username to authenticate with. If not given, and the
340 remote site requires basic or digest authentication, the user will
340 remote site requires basic or digest authentication, the user will
341 be prompted for it. Environment variables are expanded in the
341 be prompted for it. Environment variables are expanded in the
342 username letting you do ``foo.username = $USER``. If the URI
342 username letting you do ``foo.username = $USER``. If the URI
343 includes a username, only ``[auth]`` entries with a matching
343 includes a username, only ``[auth]`` entries with a matching
344 username or without a username will be considered.
344 username or without a username will be considered.
345
345
346 ``password``
346 ``password``
347 Optional. Password to authenticate with. If not given, and the
347 Optional. Password to authenticate with. If not given, and the
348 remote site requires basic or digest authentication, the user
348 remote site requires basic or digest authentication, the user
349 will be prompted for it.
349 will be prompted for it.
350
350
351 ``key``
351 ``key``
352 Optional. PEM encoded client certificate key file. Environment
352 Optional. PEM encoded client certificate key file. Environment
353 variables are expanded in the filename.
353 variables are expanded in the filename.
354
354
355 ``cert``
355 ``cert``
356 Optional. PEM encoded client certificate chain file. Environment
356 Optional. PEM encoded client certificate chain file. Environment
357 variables are expanded in the filename.
357 variables are expanded in the filename.
358
358
359 ``schemes``
359 ``schemes``
360 Optional. Space separated list of URI schemes to use this
360 Optional. Space separated list of URI schemes to use this
361 authentication entry with. Only used if the prefix doesn't include
361 authentication entry with. Only used if the prefix doesn't include
362 a scheme. Supported schemes are http and https. They will match
362 a scheme. Supported schemes are http and https. They will match
363 static-http and static-https respectively, as well.
363 static-http and static-https respectively, as well.
364 (default: https)
364 (default: https)
365
365
366 If no suitable authentication entry is found, the user is prompted
366 If no suitable authentication entry is found, the user is prompted
367 for credentials as usual if required by the remote.
367 for credentials as usual if required by the remote.
368
368
369
369
370 ``committemplate``
370 ``committemplate``
371 ------------------
371 ------------------
372
372
373 ``changeset``
373 ``changeset``
374 String: configuration in this section is used as the template to
374 String: configuration in this section is used as the template to
375 customize the text shown in the editor when committing.
375 customize the text shown in the editor when committing.
376
376
377 In addition to pre-defined template keywords, commit log specific one
377 In addition to pre-defined template keywords, commit log specific one
378 below can be used for customization:
378 below can be used for customization:
379
379
380 ``extramsg``
380 ``extramsg``
381 String: Extra message (typically 'Leave message empty to abort
381 String: Extra message (typically 'Leave message empty to abort
382 commit.'). This may be changed by some commands or extensions.
382 commit.'). This may be changed by some commands or extensions.
383
383
384 For example, the template configuration below shows as same text as
384 For example, the template configuration below shows as same text as
385 one shown by default::
385 one shown by default::
386
386
387 [committemplate]
387 [committemplate]
388 changeset = {desc}\n\n
388 changeset = {desc}\n\n
389 HG: Enter commit message. Lines beginning with 'HG:' are removed.
389 HG: Enter commit message. Lines beginning with 'HG:' are removed.
390 HG: {extramsg}
390 HG: {extramsg}
391 HG: --
391 HG: --
392 HG: user: {author}\n{ifeq(p2rev, "-1", "",
392 HG: user: {author}\n{ifeq(p2rev, "-1", "",
393 "HG: branch merge\n")
393 "HG: branch merge\n")
394 }HG: branch '{branch}'\n{if(activebookmark,
394 }HG: branch '{branch}'\n{if(activebookmark,
395 "HG: bookmark '{activebookmark}'\n") }{subrepos %
395 "HG: bookmark '{activebookmark}'\n") }{subrepos %
396 "HG: subrepo {subrepo}\n" }{file_adds %
396 "HG: subrepo {subrepo}\n" }{file_adds %
397 "HG: added {file}\n" }{file_mods %
397 "HG: added {file}\n" }{file_mods %
398 "HG: changed {file}\n" }{file_dels %
398 "HG: changed {file}\n" }{file_dels %
399 "HG: removed {file}\n" }{if(files, "",
399 "HG: removed {file}\n" }{if(files, "",
400 "HG: no files changed\n")}
400 "HG: no files changed\n")}
401
401
402 .. note::
402 .. note::
403
403
404 For some problematic encodings (see :hg:`help win32mbcs` for
404 For some problematic encodings (see :hg:`help win32mbcs` for
405 detail), this customization should be configured carefully, to
405 detail), this customization should be configured carefully, to
406 avoid showing broken characters.
406 avoid showing broken characters.
407
407
408 For example, if a multibyte character ending with backslash (0x5c) is
408 For example, if a multibyte character ending with backslash (0x5c) is
409 followed by the ASCII character 'n' in the customized template,
409 followed by the ASCII character 'n' in the customized template,
410 the sequence of backslash and 'n' is treated as line-feed unexpectedly
410 the sequence of backslash and 'n' is treated as line-feed unexpectedly
411 (and the multibyte character is broken, too).
411 (and the multibyte character is broken, too).
412
412
413 Customized template is used for commands below (``--edit`` may be
413 Customized template is used for commands below (``--edit`` may be
414 required):
414 required):
415
415
416 - :hg:`backout`
416 - :hg:`backout`
417 - :hg:`commit`
417 - :hg:`commit`
418 - :hg:`fetch` (for merge commit only)
418 - :hg:`fetch` (for merge commit only)
419 - :hg:`graft`
419 - :hg:`graft`
420 - :hg:`histedit`
420 - :hg:`histedit`
421 - :hg:`import`
421 - :hg:`import`
422 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
422 - :hg:`qfold`, :hg:`qnew` and :hg:`qrefresh`
423 - :hg:`rebase`
423 - :hg:`rebase`
424 - :hg:`shelve`
424 - :hg:`shelve`
425 - :hg:`sign`
425 - :hg:`sign`
426 - :hg:`tag`
426 - :hg:`tag`
427 - :hg:`transplant`
427 - :hg:`transplant`
428
428
429 Configuring items below instead of ``changeset`` allows showing
429 Configuring items below instead of ``changeset`` allows showing
430 customized message only for specific actions, or showing different
430 customized message only for specific actions, or showing different
431 messages for each action.
431 messages for each action.
432
432
433 - ``changeset.backout`` for :hg:`backout`
433 - ``changeset.backout`` for :hg:`backout`
434 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
434 - ``changeset.commit.amend.merge`` for :hg:`commit --amend` on merges
435 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
435 - ``changeset.commit.amend.normal`` for :hg:`commit --amend` on other
436 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
436 - ``changeset.commit.normal.merge`` for :hg:`commit` on merges
437 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
437 - ``changeset.commit.normal.normal`` for :hg:`commit` on other
438 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
438 - ``changeset.fetch`` for :hg:`fetch` (impling merge commit)
439 - ``changeset.gpg.sign`` for :hg:`sign`
439 - ``changeset.gpg.sign`` for :hg:`sign`
440 - ``changeset.graft`` for :hg:`graft`
440 - ``changeset.graft`` for :hg:`graft`
441 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
441 - ``changeset.histedit.edit`` for ``edit`` of :hg:`histedit`
442 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
442 - ``changeset.histedit.fold`` for ``fold`` of :hg:`histedit`
443 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
443 - ``changeset.histedit.mess`` for ``mess`` of :hg:`histedit`
444 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
444 - ``changeset.histedit.pick`` for ``pick`` of :hg:`histedit`
445 - ``changeset.import.bypass`` for :hg:`import --bypass`
445 - ``changeset.import.bypass`` for :hg:`import --bypass`
446 - ``changeset.import.normal.merge`` for :hg:`import` on merges
446 - ``changeset.import.normal.merge`` for :hg:`import` on merges
447 - ``changeset.import.normal.normal`` for :hg:`import` on other
447 - ``changeset.import.normal.normal`` for :hg:`import` on other
448 - ``changeset.mq.qnew`` for :hg:`qnew`
448 - ``changeset.mq.qnew`` for :hg:`qnew`
449 - ``changeset.mq.qfold`` for :hg:`qfold`
449 - ``changeset.mq.qfold`` for :hg:`qfold`
450 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
450 - ``changeset.mq.qrefresh`` for :hg:`qrefresh`
451 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
451 - ``changeset.rebase.collapse`` for :hg:`rebase --collapse`
452 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
452 - ``changeset.rebase.merge`` for :hg:`rebase` on merges
453 - ``changeset.rebase.normal`` for :hg:`rebase` on other
453 - ``changeset.rebase.normal`` for :hg:`rebase` on other
454 - ``changeset.shelve.shelve`` for :hg:`shelve`
454 - ``changeset.shelve.shelve`` for :hg:`shelve`
455 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
455 - ``changeset.tag.add`` for :hg:`tag` without ``--remove``
456 - ``changeset.tag.remove`` for :hg:`tag --remove`
456 - ``changeset.tag.remove`` for :hg:`tag --remove`
457 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
457 - ``changeset.transplant.merge`` for :hg:`transplant` on merges
458 - ``changeset.transplant.normal`` for :hg:`transplant` on other
458 - ``changeset.transplant.normal`` for :hg:`transplant` on other
459
459
460 These dot-separated lists of names are treated as hierarchical ones.
460 These dot-separated lists of names are treated as hierarchical ones.
461 For example, ``changeset.tag.remove`` customizes the commit message
461 For example, ``changeset.tag.remove`` customizes the commit message
462 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
462 only for :hg:`tag --remove`, but ``changeset.tag`` customizes the
463 commit message for :hg:`tag` regardless of ``--remove`` option.
463 commit message for :hg:`tag` regardless of ``--remove`` option.
464
464
465 When the external editor is invoked for a commit, the corresponding
465 When the external editor is invoked for a commit, the corresponding
466 dot-separated list of names without the ``changeset.`` prefix
466 dot-separated list of names without the ``changeset.`` prefix
467 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
467 (e.g. ``commit.normal.normal``) is in the ``HGEDITFORM`` environment
468 variable.
468 variable.
469
469
470 In this section, items other than ``changeset`` can be referred from
470 In this section, items other than ``changeset`` can be referred from
471 others. For example, the configuration to list committed files up
471 others. For example, the configuration to list committed files up
472 below can be referred as ``{listupfiles}``::
472 below can be referred as ``{listupfiles}``::
473
473
474 [committemplate]
474 [committemplate]
475 listupfiles = {file_adds %
475 listupfiles = {file_adds %
476 "HG: added {file}\n" }{file_mods %
476 "HG: added {file}\n" }{file_mods %
477 "HG: changed {file}\n" }{file_dels %
477 "HG: changed {file}\n" }{file_dels %
478 "HG: removed {file}\n" }{if(files, "",
478 "HG: removed {file}\n" }{if(files, "",
479 "HG: no files changed\n")}
479 "HG: no files changed\n")}
480
480
481 ``decode/encode``
481 ``decode/encode``
482 -----------------
482 -----------------
483
483
484 Filters for transforming files on checkout/checkin. This would
484 Filters for transforming files on checkout/checkin. This would
485 typically be used for newline processing or other
485 typically be used for newline processing or other
486 localization/canonicalization of files.
486 localization/canonicalization of files.
487
487
488 Filters consist of a filter pattern followed by a filter command.
488 Filters consist of a filter pattern followed by a filter command.
489 Filter patterns are globs by default, rooted at the repository root.
489 Filter patterns are globs by default, rooted at the repository root.
490 For example, to match any file ending in ``.txt`` in the root
490 For example, to match any file ending in ``.txt`` in the root
491 directory only, use the pattern ``*.txt``. To match any file ending
491 directory only, use the pattern ``*.txt``. To match any file ending
492 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
492 in ``.c`` anywhere in the repository, use the pattern ``**.c``.
493 For each file only the first matching filter applies.
493 For each file only the first matching filter applies.
494
494
495 The filter command can start with a specifier, either ``pipe:`` or
495 The filter command can start with a specifier, either ``pipe:`` or
496 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
496 ``tempfile:``. If no specifier is given, ``pipe:`` is used by default.
497
497
498 A ``pipe:`` command must accept data on stdin and return the transformed
498 A ``pipe:`` command must accept data on stdin and return the transformed
499 data on stdout.
499 data on stdout.
500
500
501 Pipe example::
501 Pipe example::
502
502
503 [encode]
503 [encode]
504 # uncompress gzip files on checkin to improve delta compression
504 # uncompress gzip files on checkin to improve delta compression
505 # note: not necessarily a good idea, just an example
505 # note: not necessarily a good idea, just an example
506 *.gz = pipe: gunzip
506 *.gz = pipe: gunzip
507
507
508 [decode]
508 [decode]
509 # recompress gzip files when writing them to the working dir (we
509 # recompress gzip files when writing them to the working dir (we
510 # can safely omit "pipe:", because it's the default)
510 # can safely omit "pipe:", because it's the default)
511 *.gz = gzip
511 *.gz = gzip
512
512
513 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
513 A ``tempfile:`` command is a template. The string ``INFILE`` is replaced
514 with the name of a temporary file that contains the data to be
514 with the name of a temporary file that contains the data to be
515 filtered by the command. The string ``OUTFILE`` is replaced with the name
515 filtered by the command. The string ``OUTFILE`` is replaced with the name
516 of an empty temporary file, where the filtered data must be written by
516 of an empty temporary file, where the filtered data must be written by
517 the command.
517 the command.
518
518
519 .. note::
519 .. note::
520
520
521 The tempfile mechanism is recommended for Windows systems,
521 The tempfile mechanism is recommended for Windows systems,
522 where the standard shell I/O redirection operators often have
522 where the standard shell I/O redirection operators often have
523 strange effects and may corrupt the contents of your files.
523 strange effects and may corrupt the contents of your files.
524
524
525 This filter mechanism is used internally by the ``eol`` extension to
525 This filter mechanism is used internally by the ``eol`` extension to
526 translate line ending characters between Windows (CRLF) and Unix (LF)
526 translate line ending characters between Windows (CRLF) and Unix (LF)
527 format. We suggest you use the ``eol`` extension for convenience.
527 format. We suggest you use the ``eol`` extension for convenience.
528
528
529
529
530 ``defaults``
530 ``defaults``
531 ------------
531 ------------
532
532
533 (defaults are deprecated. Don't use them. Use aliases instead.)
533 (defaults are deprecated. Don't use them. Use aliases instead.)
534
534
535 Use the ``[defaults]`` section to define command defaults, i.e. the
535 Use the ``[defaults]`` section to define command defaults, i.e. the
536 default options/arguments to pass to the specified commands.
536 default options/arguments to pass to the specified commands.
537
537
538 The following example makes :hg:`log` run in verbose mode, and
538 The following example makes :hg:`log` run in verbose mode, and
539 :hg:`status` show only the modified files, by default::
539 :hg:`status` show only the modified files, by default::
540
540
541 [defaults]
541 [defaults]
542 log = -v
542 log = -v
543 status = -m
543 status = -m
544
544
545 The actual commands, instead of their aliases, must be used when
545 The actual commands, instead of their aliases, must be used when
546 defining command defaults. The command defaults will also be applied
546 defining command defaults. The command defaults will also be applied
547 to the aliases of the commands defined.
547 to the aliases of the commands defined.
548
548
549
549
550 ``diff``
550 ``diff``
551 --------
551 --------
552
552
553 Settings used when displaying diffs. Everything except for ``unified``
553 Settings used when displaying diffs. Everything except for ``unified``
554 is a Boolean and defaults to False. See :hg:`help config.annotate`
554 is a Boolean and defaults to False. See :hg:`help config.annotate`
555 for related options for the annotate command.
555 for related options for the annotate command.
556
556
557 ``git``
557 ``git``
558 Use git extended diff format.
558 Use git extended diff format.
559
559
560 ``nobinary``
560 ``nobinary``
561 Omit git binary patches.
561 Omit git binary patches.
562
562
563 ``nodates``
563 ``nodates``
564 Don't include dates in diff headers.
564 Don't include dates in diff headers.
565
565
566 ``noprefix``
566 ``noprefix``
567 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
567 Omit 'a/' and 'b/' prefixes from filenames. Ignored in plain mode.
568
568
569 ``showfunc``
569 ``showfunc``
570 Show which function each change is in.
570 Show which function each change is in.
571
571
572 ``ignorews``
572 ``ignorews``
573 Ignore white space when comparing lines.
573 Ignore white space when comparing lines.
574
574
575 ``ignorewsamount``
575 ``ignorewsamount``
576 Ignore changes in the amount of white space.
576 Ignore changes in the amount of white space.
577
577
578 ``ignoreblanklines``
578 ``ignoreblanklines``
579 Ignore changes whose lines are all blank.
579 Ignore changes whose lines are all blank.
580
580
581 ``unified``
581 ``unified``
582 Number of lines of context to show.
582 Number of lines of context to show.
583
583
584 ``email``
584 ``email``
585 ---------
585 ---------
586
586
587 Settings for extensions that send email messages.
587 Settings for extensions that send email messages.
588
588
589 ``from``
589 ``from``
590 Optional. Email address to use in "From" header and SMTP envelope
590 Optional. Email address to use in "From" header and SMTP envelope
591 of outgoing messages.
591 of outgoing messages.
592
592
593 ``to``
593 ``to``
594 Optional. Comma-separated list of recipients' email addresses.
594 Optional. Comma-separated list of recipients' email addresses.
595
595
596 ``cc``
596 ``cc``
597 Optional. Comma-separated list of carbon copy recipients'
597 Optional. Comma-separated list of carbon copy recipients'
598 email addresses.
598 email addresses.
599
599
600 ``bcc``
600 ``bcc``
601 Optional. Comma-separated list of blind carbon copy recipients'
601 Optional. Comma-separated list of blind carbon copy recipients'
602 email addresses.
602 email addresses.
603
603
604 ``method``
604 ``method``
605 Optional. Method to use to send email messages. If value is ``smtp``
605 Optional. Method to use to send email messages. If value is ``smtp``
606 (default), use SMTP (see the ``[smtp]`` section for configuration).
606 (default), use SMTP (see the ``[smtp]`` section for configuration).
607 Otherwise, use as name of program to run that acts like sendmail
607 Otherwise, use as name of program to run that acts like sendmail
608 (takes ``-f`` option for sender, list of recipients on command line,
608 (takes ``-f`` option for sender, list of recipients on command line,
609 message on stdin). Normally, setting this to ``sendmail`` or
609 message on stdin). Normally, setting this to ``sendmail`` or
610 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
610 ``/usr/sbin/sendmail`` is enough to use sendmail to send messages.
611
611
612 ``charsets``
612 ``charsets``
613 Optional. Comma-separated list of character sets considered
613 Optional. Comma-separated list of character sets considered
614 convenient for recipients. Addresses, headers, and parts not
614 convenient for recipients. Addresses, headers, and parts not
615 containing patches of outgoing messages will be encoded in the
615 containing patches of outgoing messages will be encoded in the
616 first character set to which conversion from local encoding
616 first character set to which conversion from local encoding
617 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
617 (``$HGENCODING``, ``ui.fallbackencoding``) succeeds. If correct
618 conversion fails, the text in question is sent as is.
618 conversion fails, the text in question is sent as is.
619 (default: '')
619 (default: '')
620
620
621 Order of outgoing email character sets:
621 Order of outgoing email character sets:
622
622
623 1. ``us-ascii``: always first, regardless of settings
623 1. ``us-ascii``: always first, regardless of settings
624 2. ``email.charsets``: in order given by user
624 2. ``email.charsets``: in order given by user
625 3. ``ui.fallbackencoding``: if not in email.charsets
625 3. ``ui.fallbackencoding``: if not in email.charsets
626 4. ``$HGENCODING``: if not in email.charsets
626 4. ``$HGENCODING``: if not in email.charsets
627 5. ``utf-8``: always last, regardless of settings
627 5. ``utf-8``: always last, regardless of settings
628
628
629 Email example::
629 Email example::
630
630
631 [email]
631 [email]
632 from = Joseph User <joe.user@example.com>
632 from = Joseph User <joe.user@example.com>
633 method = /usr/sbin/sendmail
633 method = /usr/sbin/sendmail
634 # charsets for western Europeans
634 # charsets for western Europeans
635 # us-ascii, utf-8 omitted, as they are tried first and last
635 # us-ascii, utf-8 omitted, as they are tried first and last
636 charsets = iso-8859-1, iso-8859-15, windows-1252
636 charsets = iso-8859-1, iso-8859-15, windows-1252
637
637
638
638
639 ``extensions``
639 ``extensions``
640 --------------
640 --------------
641
641
642 Mercurial has an extension mechanism for adding new features. To
642 Mercurial has an extension mechanism for adding new features. To
643 enable an extension, create an entry for it in this section.
643 enable an extension, create an entry for it in this section.
644
644
645 If you know that the extension is already in Python's search path,
645 If you know that the extension is already in Python's search path,
646 you can give the name of the module, followed by ``=``, with nothing
646 you can give the name of the module, followed by ``=``, with nothing
647 after the ``=``.
647 after the ``=``.
648
648
649 Otherwise, give a name that you choose, followed by ``=``, followed by
649 Otherwise, give a name that you choose, followed by ``=``, followed by
650 the path to the ``.py`` file (including the file name extension) that
650 the path to the ``.py`` file (including the file name extension) that
651 defines the extension.
651 defines the extension.
652
652
653 To explicitly disable an extension that is enabled in an hgrc of
653 To explicitly disable an extension that is enabled in an hgrc of
654 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
654 broader scope, prepend its path with ``!``, as in ``foo = !/ext/path``
655 or ``foo = !`` when path is not supplied.
655 or ``foo = !`` when path is not supplied.
656
656
657 Example for ``~/.hgrc``::
657 Example for ``~/.hgrc``::
658
658
659 [extensions]
659 [extensions]
660 # (the color extension will get loaded from Mercurial's path)
660 # (the color extension will get loaded from Mercurial's path)
661 color =
661 color =
662 # (this extension will get loaded from the file specified)
662 # (this extension will get loaded from the file specified)
663 myfeature = ~/.hgext/myfeature.py
663 myfeature = ~/.hgext/myfeature.py
664
664
665
665
666 ``format``
666 ``format``
667 ----------
667 ----------
668
668
669 ``usegeneraldelta``
669 ``usegeneraldelta``
670 Enable or disable the "generaldelta" repository format which improves
670 Enable or disable the "generaldelta" repository format which improves
671 repository compression by allowing "revlog" to store delta against arbitrary
671 repository compression by allowing "revlog" to store delta against arbitrary
672 revision instead of the previous stored one. This provides significant
672 revision instead of the previous stored one. This provides significant
673 improvement for repositories with branches.
673 improvement for repositories with branches.
674
674
675 Repositories with this on-disk format require Mercurial version 1.9.
675 Repositories with this on-disk format require Mercurial version 1.9.
676
676
677 Enabled by default.
677 Enabled by default.
678
678
679 ``dotencode``
679 ``dotencode``
680 Enable or disable the "dotencode" repository format which enhances
680 Enable or disable the "dotencode" repository format which enhances
681 the "fncache" repository format (which has to be enabled to use
681 the "fncache" repository format (which has to be enabled to use
682 dotencode) to avoid issues with filenames starting with ._ on
682 dotencode) to avoid issues with filenames starting with ._ on
683 Mac OS X and spaces on Windows.
683 Mac OS X and spaces on Windows.
684
684
685 Repositories with this on-disk format require Mercurial version 1.7.
685 Repositories with this on-disk format require Mercurial version 1.7.
686
686
687 Enabled by default.
687 Enabled by default.
688
688
689 ``usefncache``
689 ``usefncache``
690 Enable or disable the "fncache" repository format which enhances
690 Enable or disable the "fncache" repository format which enhances
691 the "store" repository format (which has to be enabled to use
691 the "store" repository format (which has to be enabled to use
692 fncache) to allow longer filenames and avoids using Windows
692 fncache) to allow longer filenames and avoids using Windows
693 reserved names, e.g. "nul".
693 reserved names, e.g. "nul".
694
694
695 Repositories with this on-disk format require Mercurial version 1.1.
695 Repositories with this on-disk format require Mercurial version 1.1.
696
696
697 Enabled by default.
697 Enabled by default.
698
698
699 ``usestore``
699 ``usestore``
700 Enable or disable the "store" repository format which improves
700 Enable or disable the "store" repository format which improves
701 compatibility with systems that fold case or otherwise mangle
701 compatibility with systems that fold case or otherwise mangle
702 filenames. Disabling this option will allow you to store longer filenames
702 filenames. Disabling this option will allow you to store longer filenames
703 in some situations at the expense of compatibility.
703 in some situations at the expense of compatibility.
704
704
705 Repositories with this on-disk format require Mercurial version 0.9.4.
705 Repositories with this on-disk format require Mercurial version 0.9.4.
706
706
707 Enabled by default.
707 Enabled by default.
708
708
709 ``graph``
709 ``graph``
710 ---------
710 ---------
711
711
712 Web graph view configuration. This section let you change graph
712 Web graph view configuration. This section let you change graph
713 elements display properties by branches, for instance to make the
713 elements display properties by branches, for instance to make the
714 ``default`` branch stand out.
714 ``default`` branch stand out.
715
715
716 Each line has the following format::
716 Each line has the following format::
717
717
718 <branch>.<argument> = <value>
718 <branch>.<argument> = <value>
719
719
720 where ``<branch>`` is the name of the branch being
720 where ``<branch>`` is the name of the branch being
721 customized. Example::
721 customized. Example::
722
722
723 [graph]
723 [graph]
724 # 2px width
724 # 2px width
725 default.width = 2
725 default.width = 2
726 # red color
726 # red color
727 default.color = FF0000
727 default.color = FF0000
728
728
729 Supported arguments:
729 Supported arguments:
730
730
731 ``width``
731 ``width``
732 Set branch edges width in pixels.
732 Set branch edges width in pixels.
733
733
734 ``color``
734 ``color``
735 Set branch edges color in hexadecimal RGB notation.
735 Set branch edges color in hexadecimal RGB notation.
736
736
737 ``hooks``
737 ``hooks``
738 ---------
738 ---------
739
739
740 Commands or Python functions that get automatically executed by
740 Commands or Python functions that get automatically executed by
741 various actions such as starting or finishing a commit. Multiple
741 various actions such as starting or finishing a commit. Multiple
742 hooks can be run for the same action by appending a suffix to the
742 hooks can be run for the same action by appending a suffix to the
743 action. Overriding a site-wide hook can be done by changing its
743 action. Overriding a site-wide hook can be done by changing its
744 value or setting it to an empty string. Hooks can be prioritized
744 value or setting it to an empty string. Hooks can be prioritized
745 by adding a prefix of ``priority.`` to the hook name on a new line
745 by adding a prefix of ``priority.`` to the hook name on a new line
746 and setting the priority. The default priority is 0.
746 and setting the priority. The default priority is 0.
747
747
748 Example ``.hg/hgrc``::
748 Example ``.hg/hgrc``::
749
749
750 [hooks]
750 [hooks]
751 # update working directory after adding changesets
751 # update working directory after adding changesets
752 changegroup.update = hg update
752 changegroup.update = hg update
753 # do not use the site-wide hook
753 # do not use the site-wide hook
754 incoming =
754 incoming =
755 incoming.email = /my/email/hook
755 incoming.email = /my/email/hook
756 incoming.autobuild = /my/build/hook
756 incoming.autobuild = /my/build/hook
757 # force autobuild hook to run before other incoming hooks
757 # force autobuild hook to run before other incoming hooks
758 priority.incoming.autobuild = 1
758 priority.incoming.autobuild = 1
759
759
760 Most hooks are run with environment variables set that give useful
760 Most hooks are run with environment variables set that give useful
761 additional information. For each hook below, the environment
761 additional information. For each hook below, the environment
762 variables it is passed are listed with names of the form ``$HG_foo``.
762 variables it is passed are listed with names of the form ``$HG_foo``.
763
763
764 ``changegroup``
764 ``changegroup``
765 Run after a changegroup has been added via push, pull or unbundle. ID of the
765 Run after a changegroup has been added via push, pull or unbundle. ID of the
766 first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL
766 first new changeset is in ``$HG_NODE`` and last in ``$HG_NODE_LAST``. URL
767 from which changes came is in ``$HG_URL``.
767 from which changes came is in ``$HG_URL``.
768
768
769 ``commit``
769 ``commit``
770 Run after a changeset has been created in the local repository. ID
770 Run after a changeset has been created in the local repository. ID
771 of the newly created changeset is in ``$HG_NODE``. Parent changeset
771 of the newly created changeset is in ``$HG_NODE``. Parent changeset
772 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
772 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
773
773
774 ``incoming``
774 ``incoming``
775 Run after a changeset has been pulled, pushed, or unbundled into
775 Run after a changeset has been pulled, pushed, or unbundled into
776 the local repository. The ID of the newly arrived changeset is in
776 the local repository. The ID of the newly arrived changeset is in
777 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
777 ``$HG_NODE``. URL that was source of changes came is in ``$HG_URL``.
778
778
779 ``outgoing``
779 ``outgoing``
780 Run after sending changes from local repository to another. ID of
780 Run after sending changes from local repository to another. ID of
781 first changeset sent is in ``$HG_NODE``. Source of operation is in
781 first changeset sent is in ``$HG_NODE``. Source of operation is in
782 ``$HG_SOURCE``; Also see :hg:`help config.preoutgoing` hook.
782 ``$HG_SOURCE``; Also see :hg:`help config.preoutgoing` hook.
783
783
784 ``post-<command>``
784 ``post-<command>``
785 Run after successful invocations of the associated command. The
785 Run after successful invocations of the associated command. The
786 contents of the command line are passed as ``$HG_ARGS`` and the result
786 contents of the command line are passed as ``$HG_ARGS`` and the result
787 code in ``$HG_RESULT``. Parsed command line arguments are passed as
787 code in ``$HG_RESULT``. Parsed command line arguments are passed as
788 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
788 ``$HG_PATS`` and ``$HG_OPTS``. These contain string representations of
789 the python data internally passed to <command>. ``$HG_OPTS`` is a
789 the python data internally passed to <command>. ``$HG_OPTS`` is a
790 dictionary of options (with unspecified options set to their defaults).
790 dictionary of options (with unspecified options set to their defaults).
791 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
791 ``$HG_PATS`` is a list of arguments. Hook failure is ignored.
792
792
793 ``pre-<command>``
793 ``pre-<command>``
794 Run before executing the associated command. The contents of the
794 Run before executing the associated command. The contents of the
795 command line are passed as ``$HG_ARGS``. Parsed command line arguments
795 command line are passed as ``$HG_ARGS``. Parsed command line arguments
796 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
796 are passed as ``$HG_PATS`` and ``$HG_OPTS``. These contain string
797 representations of the data internally passed to <command>. ``$HG_OPTS``
797 representations of the data internally passed to <command>. ``$HG_OPTS``
798 is a dictionary of options (with unspecified options set to their
798 is a dictionary of options (with unspecified options set to their
799 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
799 defaults). ``$HG_PATS`` is a list of arguments. If the hook returns
800 failure, the command doesn't execute and Mercurial returns the failure
800 failure, the command doesn't execute and Mercurial returns the failure
801 code.
801 code.
802
802
803 ``prechangegroup``
803 ``prechangegroup``
804 Run before a changegroup is added via push, pull or unbundle. Exit
804 Run before a changegroup is added via push, pull or unbundle. Exit
805 status 0 allows the changegroup to proceed. Non-zero status will
805 status 0 allows the changegroup to proceed. Non-zero status will
806 cause the push, pull or unbundle to fail. URL from which changes
806 cause the push, pull or unbundle to fail. URL from which changes
807 will come is in ``$HG_URL``.
807 will come is in ``$HG_URL``.
808
808
809 ``precommit``
809 ``precommit``
810 Run before starting a local commit. Exit status 0 allows the
810 Run before starting a local commit. Exit status 0 allows the
811 commit to proceed. Non-zero status will cause the commit to fail.
811 commit to proceed. Non-zero status will cause the commit to fail.
812 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
812 Parent changeset IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
813
813
814 ``prelistkeys``
814 ``prelistkeys``
815 Run before listing pushkeys (like bookmarks) in the
815 Run before listing pushkeys (like bookmarks) in the
816 repository. Non-zero status will cause failure. The key namespace is
816 repository. Non-zero status will cause failure. The key namespace is
817 in ``$HG_NAMESPACE``.
817 in ``$HG_NAMESPACE``.
818
818
819 ``preoutgoing``
819 ``preoutgoing``
820 Run before collecting changes to send from the local repository to
820 Run before collecting changes to send from the local repository to
821 another. Non-zero status will cause failure. This lets you prevent
821 another. Non-zero status will cause failure. This lets you prevent
822 pull over HTTP or SSH. Also prevents against local pull, push
822 pull over HTTP or SSH. Also prevents against local pull, push
823 (outbound) or bundle commands, but not effective, since you can
823 (outbound) or bundle commands, but not effective, since you can
824 just copy files instead then. Source of operation is in
824 just copy files instead then. Source of operation is in
825 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
825 ``$HG_SOURCE``. If "serve", operation is happening on behalf of remote
826 SSH or HTTP repository. If "push", "pull" or "bundle", operation
826 SSH or HTTP repository. If "push", "pull" or "bundle", operation
827 is happening on behalf of repository on same system.
827 is happening on behalf of repository on same system.
828
828
829 ``prepushkey``
829 ``prepushkey``
830 Run before a pushkey (like a bookmark) is added to the
830 Run before a pushkey (like a bookmark) is added to the
831 repository. Non-zero status will cause the key to be rejected. The
831 repository. Non-zero status will cause the key to be rejected. The
832 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
832 key namespace is in ``$HG_NAMESPACE``, the key is in ``$HG_KEY``,
833 the old value (if any) is in ``$HG_OLD``, and the new value is in
833 the old value (if any) is in ``$HG_OLD``, and the new value is in
834 ``$HG_NEW``.
834 ``$HG_NEW``.
835
835
836 ``pretag``
836 ``pretag``
837 Run before creating a tag. Exit status 0 allows the tag to be
837 Run before creating a tag. Exit status 0 allows the tag to be
838 created. Non-zero status will cause the tag to fail. ID of
838 created. Non-zero status will cause the tag to fail. ID of
839 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
839 changeset to tag is in ``$HG_NODE``. Name of tag is in ``$HG_TAG``. Tag is
840 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
840 local if ``$HG_LOCAL=1``, in repository if ``$HG_LOCAL=0``.
841
841
842 ``pretxnopen``
842 ``pretxnopen``
843 Run before any new repository transaction is open. The reason for the
843 Run before any new repository transaction is open. The reason for the
844 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
844 transaction will be in ``$HG_TXNNAME`` and a unique identifier for the
845 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
845 transaction will be in ``HG_TXNID``. A non-zero status will prevent the
846 transaction from being opened.
846 transaction from being opened.
847
847
848 ``pretxnclose``
848 ``pretxnclose``
849 Run right before the transaction is actually finalized. Any repository change
849 Run right before the transaction is actually finalized. Any repository change
850 will be visible to the hook program. This lets you validate the transaction
850 will be visible to the hook program. This lets you validate the transaction
851 content or change it. Exit status 0 allows the commit to proceed. Non-zero
851 content or change it. Exit status 0 allows the commit to proceed. Non-zero
852 status will cause the transaction to be rolled back. The reason for the
852 status will cause the transaction to be rolled back. The reason for the
853 transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for
853 transaction opening will be in ``$HG_TXNNAME`` and a unique identifier for
854 the transaction will be in ``HG_TXNID``. The rest of the available data will
854 the transaction will be in ``HG_TXNID``. The rest of the available data will
855 vary according the transaction type. New changesets will add ``$HG_NODE`` (id
855 vary according the transaction type. New changesets will add ``$HG_NODE`` (id
856 of the first added changeset), ``$HG_NODE_LAST`` (id of the last added
856 of the first added changeset), ``$HG_NODE_LAST`` (id of the last added
857 changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases
857 changeset), ``$HG_URL`` and ``$HG_SOURCE`` variables, bookmarks and phases
858 changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
858 changes will set ``HG_BOOKMARK_MOVED`` and ``HG_PHASES_MOVED`` to ``1``, etc.
859
859
860 ``txnclose``
860 ``txnclose``
861 Run after any repository transaction has been committed. At this
861 Run after any repository transaction has been committed. At this
862 point, the transaction can no longer be rolled back. The hook will run
862 point, the transaction can no longer be rolled back. The hook will run
863 after the lock is released. See :hg:`help config.pretxnclose` docs for
863 after the lock is released. See :hg:`help config.pretxnclose` docs for
864 details about available variables.
864 details about available variables.
865
865
866 ``txnabort``
866 ``txnabort``
867 Run when a transaction is aborted. See :hg:`help config.pretxnclose`
867 Run when a transaction is aborted. See :hg:`help config.pretxnclose`
868 docs for details about available variables.
868 docs for details about available variables.
869
869
870 ``pretxnchangegroup``
870 ``pretxnchangegroup``
871 Run after a changegroup has been added via push, pull or unbundle, but before
871 Run after a changegroup has been added via push, pull or unbundle, but before
872 the transaction has been committed. Changegroup is visible to hook program.
872 the transaction has been committed. Changegroup is visible to hook program.
873 This lets you validate incoming changes before accepting them. Passed the ID
873 This lets you validate incoming changes before accepting them. Passed the ID
874 of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``.
874 of the first new changeset in ``$HG_NODE`` and last in ``$HG_NODE_LAST``.
875 Exit status 0 allows the transaction to commit. Non-zero status will cause
875 Exit status 0 allows the transaction to commit. Non-zero status will cause
876 the transaction to be rolled back and the push, pull or unbundle will fail.
876 the transaction to be rolled back and the push, pull or unbundle will fail.
877 URL that was source of changes is in ``$HG_URL``.
877 URL that was source of changes is in ``$HG_URL``.
878
878
879 ``pretxncommit``
879 ``pretxncommit``
880 Run after a changeset has been created but the transaction not yet
880 Run after a changeset has been created but the transaction not yet
881 committed. Changeset is visible to hook program. This lets you
881 committed. Changeset is visible to hook program. This lets you
882 validate commit message and changes. Exit status 0 allows the
882 validate commit message and changes. Exit status 0 allows the
883 commit to proceed. Non-zero status will cause the transaction to
883 commit to proceed. Non-zero status will cause the transaction to
884 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
884 be rolled back. ID of changeset is in ``$HG_NODE``. Parent changeset
885 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
885 IDs are in ``$HG_PARENT1`` and ``$HG_PARENT2``.
886
886
887 ``preupdate``
887 ``preupdate``
888 Run before updating the working directory. Exit status 0 allows
888 Run before updating the working directory. Exit status 0 allows
889 the update to proceed. Non-zero status will prevent the update.
889 the update to proceed. Non-zero status will prevent the update.
890 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
890 Changeset ID of first new parent is in ``$HG_PARENT1``. If merge, ID
891 of second new parent is in ``$HG_PARENT2``.
891 of second new parent is in ``$HG_PARENT2``.
892
892
893 ``listkeys``
893 ``listkeys``
894 Run after listing pushkeys (like bookmarks) in the repository. The
894 Run after listing pushkeys (like bookmarks) in the repository. The
895 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
895 key namespace is in ``$HG_NAMESPACE``. ``$HG_VALUES`` is a
896 dictionary containing the keys and values.
896 dictionary containing the keys and values.
897
897
898 ``pushkey``
898 ``pushkey``
899 Run after a pushkey (like a bookmark) is added to the
899 Run after a pushkey (like a bookmark) is added to the
900 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
900 repository. The key namespace is in ``$HG_NAMESPACE``, the key is in
901 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
901 ``$HG_KEY``, the old value (if any) is in ``$HG_OLD``, and the new
902 value is in ``$HG_NEW``.
902 value is in ``$HG_NEW``.
903
903
904 ``tag``
904 ``tag``
905 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
905 Run after a tag is created. ID of tagged changeset is in ``$HG_NODE``.
906 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
906 Name of tag is in ``$HG_TAG``. Tag is local if ``$HG_LOCAL=1``, in
907 repository if ``$HG_LOCAL=0``.
907 repository if ``$HG_LOCAL=0``.
908
908
909 ``update``
909 ``update``
910 Run after updating the working directory. Changeset ID of first
910 Run after updating the working directory. Changeset ID of first
911 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
911 new parent is in ``$HG_PARENT1``. If merge, ID of second new parent is
912 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
912 in ``$HG_PARENT2``. If the update succeeded, ``$HG_ERROR=0``. If the
913 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
913 update failed (e.g. because conflicts not resolved), ``$HG_ERROR=1``.
914
914
915 .. note::
915 .. note::
916
916
917 It is generally better to use standard hooks rather than the
917 It is generally better to use standard hooks rather than the
918 generic pre- and post- command hooks as they are guaranteed to be
918 generic pre- and post- command hooks as they are guaranteed to be
919 called in the appropriate contexts for influencing transactions.
919 called in the appropriate contexts for influencing transactions.
920 Also, hooks like "commit" will be called in all contexts that
920 Also, hooks like "commit" will be called in all contexts that
921 generate a commit (e.g. tag) and not just the commit command.
921 generate a commit (e.g. tag) and not just the commit command.
922
922
923 .. note::
923 .. note::
924
924
925 Environment variables with empty values may not be passed to
925 Environment variables with empty values may not be passed to
926 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
926 hooks on platforms such as Windows. As an example, ``$HG_PARENT2``
927 will have an empty value under Unix-like platforms for non-merge
927 will have an empty value under Unix-like platforms for non-merge
928 changesets, while it will not be available at all under Windows.
928 changesets, while it will not be available at all under Windows.
929
929
930 The syntax for Python hooks is as follows::
930 The syntax for Python hooks is as follows::
931
931
932 hookname = python:modulename.submodule.callable
932 hookname = python:modulename.submodule.callable
933 hookname = python:/path/to/python/module.py:callable
933 hookname = python:/path/to/python/module.py:callable
934
934
935 Python hooks are run within the Mercurial process. Each hook is
935 Python hooks are run within the Mercurial process. Each hook is
936 called with at least three keyword arguments: a ui object (keyword
936 called with at least three keyword arguments: a ui object (keyword
937 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
937 ``ui``), a repository object (keyword ``repo``), and a ``hooktype``
938 keyword that tells what kind of hook is used. Arguments listed as
938 keyword that tells what kind of hook is used. Arguments listed as
939 environment variables above are passed as keyword arguments, with no
939 environment variables above are passed as keyword arguments, with no
940 ``HG_`` prefix, and names in lower case.
940 ``HG_`` prefix, and names in lower case.
941
941
942 If a Python hook returns a "true" value or raises an exception, this
942 If a Python hook returns a "true" value or raises an exception, this
943 is treated as a failure.
943 is treated as a failure.
944
944
945
945
946 ``hostfingerprints``
946 ``hostfingerprints``
947 --------------------
947 --------------------
948
948
949 Fingerprints of the certificates of known HTTPS servers.
949 Fingerprints of the certificates of known HTTPS servers.
950 A HTTPS connection to a server with a fingerprint configured here will
950 A HTTPS connection to a server with a fingerprint configured here will
951 only succeed if the servers certificate matches the fingerprint.
951 only succeed if the servers certificate matches the fingerprint.
952 This is very similar to how ssh known hosts works.
952 This is very similar to how ssh known hosts works.
953 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
953 The fingerprint is the SHA-1 hash value of the DER encoded certificate.
954 The CA chain and web.cacerts is not used for servers with a fingerprint.
954 The CA chain and web.cacerts is not used for servers with a fingerprint.
955
955
956 For example::
956 For example::
957
957
958 [hostfingerprints]
958 [hostfingerprints]
959 hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0
959 hg.intevation.org = fa:1f:d9:48:f1:e7:74:30:38:8d:d8:58:b6:94:b8:58:28:7d:8b:d0
960
960
961 This feature is only supported when using Python 2.6 or later.
961 This feature is only supported when using Python 2.6 or later.
962
962
963
963
964 ``http_proxy``
964 ``http_proxy``
965 --------------
965 --------------
966
966
967 Used to access web-based Mercurial repositories through a HTTP
967 Used to access web-based Mercurial repositories through a HTTP
968 proxy.
968 proxy.
969
969
970 ``host``
970 ``host``
971 Host name and (optional) port of the proxy server, for example
971 Host name and (optional) port of the proxy server, for example
972 "myproxy:8000".
972 "myproxy:8000".
973
973
974 ``no``
974 ``no``
975 Optional. Comma-separated list of host names that should bypass
975 Optional. Comma-separated list of host names that should bypass
976 the proxy.
976 the proxy.
977
977
978 ``passwd``
978 ``passwd``
979 Optional. Password to authenticate with at the proxy server.
979 Optional. Password to authenticate with at the proxy server.
980
980
981 ``user``
981 ``user``
982 Optional. User name to authenticate with at the proxy server.
982 Optional. User name to authenticate with at the proxy server.
983
983
984 ``always``
984 ``always``
985 Optional. Always use the proxy, even for localhost and any entries
985 Optional. Always use the proxy, even for localhost and any entries
986 in ``http_proxy.no``. (default: False)
986 in ``http_proxy.no``. (default: False)
987
987
988 ``merge``
988 ``merge``
989 ---------
989 ---------
990
990
991 This section specifies behavior during merges and updates.
991 This section specifies behavior during merges and updates.
992
992
993 ``checkignored``
993 ``checkignored``
994 Controls behavior when an ignored file on disk has the same name as a tracked
994 Controls behavior when an ignored file on disk has the same name as a tracked
995 file in the changeset being merged or updated to, and has different
995 file in the changeset being merged or updated to, and has different
996 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
996 contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``,
997 abort on such files. With ``warn``, warn on such files and back them up as
997 abort on such files. With ``warn``, warn on such files and back them up as
998 .orig. With ``ignore``, don't print a warning and back them up as
998 .orig. With ``ignore``, don't print a warning and back them up as
999 .orig. (default: ``abort``)
999 .orig. (default: ``abort``)
1000
1000
1001 ``checkunknown``
1001 ``checkunknown``
1002 Controls behavior when an unknown file that isn't ignored has the same name
1002 Controls behavior when an unknown file that isn't ignored has the same name
1003 as a tracked file in the changeset being merged or updated to, and has
1003 as a tracked file in the changeset being merged or updated to, and has
1004 different contents. Similar to ``merge.checkignored``, except for files that
1004 different contents. Similar to ``merge.checkignored``, except for files that
1005 are not ignored. (default: ``abort``)
1005 are not ignored. (default: ``abort``)
1006
1006
1007 ``merge-patterns``
1007 ``merge-patterns``
1008 ------------------
1008 ------------------
1009
1009
1010 This section specifies merge tools to associate with particular file
1010 This section specifies merge tools to associate with particular file
1011 patterns. Tools matched here will take precedence over the default
1011 patterns. Tools matched here will take precedence over the default
1012 merge tool. Patterns are globs by default, rooted at the repository
1012 merge tool. Patterns are globs by default, rooted at the repository
1013 root.
1013 root.
1014
1014
1015 Example::
1015 Example::
1016
1016
1017 [merge-patterns]
1017 [merge-patterns]
1018 **.c = kdiff3
1018 **.c = kdiff3
1019 **.jpg = myimgmerge
1019 **.jpg = myimgmerge
1020
1020
1021 ``merge-tools``
1021 ``merge-tools``
1022 ---------------
1022 ---------------
1023
1023
1024 This section configures external merge tools to use for file-level
1024 This section configures external merge tools to use for file-level
1025 merges. This section has likely been preconfigured at install time.
1025 merges. This section has likely been preconfigured at install time.
1026 Use :hg:`config merge-tools` to check the existing configuration.
1026 Use :hg:`config merge-tools` to check the existing configuration.
1027 Also see :hg:`help merge-tools` for more details.
1027 Also see :hg:`help merge-tools` for more details.
1028
1028
1029 Example ``~/.hgrc``::
1029 Example ``~/.hgrc``::
1030
1030
1031 [merge-tools]
1031 [merge-tools]
1032 # Override stock tool location
1032 # Override stock tool location
1033 kdiff3.executable = ~/bin/kdiff3
1033 kdiff3.executable = ~/bin/kdiff3
1034 # Specify command line
1034 # Specify command line
1035 kdiff3.args = $base $local $other -o $output
1035 kdiff3.args = $base $local $other -o $output
1036 # Give higher priority
1036 # Give higher priority
1037 kdiff3.priority = 1
1037 kdiff3.priority = 1
1038
1038
1039 # Changing the priority of preconfigured tool
1039 # Changing the priority of preconfigured tool
1040 meld.priority = 0
1040 meld.priority = 0
1041
1041
1042 # Disable a preconfigured tool
1042 # Disable a preconfigured tool
1043 vimdiff.disabled = yes
1043 vimdiff.disabled = yes
1044
1044
1045 # Define new tool
1045 # Define new tool
1046 myHtmlTool.args = -m $local $other $base $output
1046 myHtmlTool.args = -m $local $other $base $output
1047 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1047 myHtmlTool.regkey = Software\FooSoftware\HtmlMerge
1048 myHtmlTool.priority = 1
1048 myHtmlTool.priority = 1
1049
1049
1050 Supported arguments:
1050 Supported arguments:
1051
1051
1052 ``priority``
1052 ``priority``
1053 The priority in which to evaluate this tool.
1053 The priority in which to evaluate this tool.
1054 (default: 0)
1054 (default: 0)
1055
1055
1056 ``executable``
1056 ``executable``
1057 Either just the name of the executable or its pathname. On Windows,
1057 Either just the name of the executable or its pathname. On Windows,
1058 the path can use environment variables with ${ProgramFiles} syntax.
1058 the path can use environment variables with ${ProgramFiles} syntax.
1059 (default: the tool name)
1059 (default: the tool name)
1060
1060
1061 ``args``
1061 ``args``
1062 The arguments to pass to the tool executable. You can refer to the
1062 The arguments to pass to the tool executable. You can refer to the
1063 files being merged as well as the output file through these
1063 files being merged as well as the output file through these
1064 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1064 variables: ``$base``, ``$local``, ``$other``, ``$output``. The meaning
1065 of ``$local`` and ``$other`` can vary depending on which action is being
1065 of ``$local`` and ``$other`` can vary depending on which action is being
1066 performed. During and update or merge, ``$local`` represents the original
1066 performed. During and update or merge, ``$local`` represents the original
1067 state of the file, while ``$other`` represents the commit you are updating
1067 state of the file, while ``$other`` represents the commit you are updating
1068 to or the commit you are merging with. During a rebase ``$local``
1068 to or the commit you are merging with. During a rebase ``$local``
1069 represents the destination of the rebase, and ``$other`` represents the
1069 represents the destination of the rebase, and ``$other`` represents the
1070 commit being rebased.
1070 commit being rebased.
1071 (default: ``$local $base $other``)
1071 (default: ``$local $base $other``)
1072
1072
1073 ``premerge``
1073 ``premerge``
1074 Attempt to run internal non-interactive 3-way merge tool before
1074 Attempt to run internal non-interactive 3-way merge tool before
1075 launching external tool. Options are ``true``, ``false``, ``keep`` or
1075 launching external tool. Options are ``true``, ``false``, ``keep`` or
1076 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1076 ``keep-merge3``. The ``keep`` option will leave markers in the file if the
1077 premerge fails. The ``keep-merge3`` will do the same but include information
1077 premerge fails. The ``keep-merge3`` will do the same but include information
1078 about the base of the merge in the marker (see internal :merge3 in
1078 about the base of the merge in the marker (see internal :merge3 in
1079 :hg:`help merge-tools`).
1079 :hg:`help merge-tools`).
1080 (default: True)
1080 (default: True)
1081
1081
1082 ``binary``
1082 ``binary``
1083 This tool can merge binary files. (default: False, unless tool
1083 This tool can merge binary files. (default: False, unless tool
1084 was selected by file pattern match)
1084 was selected by file pattern match)
1085
1085
1086 ``symlink``
1086 ``symlink``
1087 This tool can merge symlinks. (default: False)
1087 This tool can merge symlinks. (default: False)
1088
1088
1089 ``check``
1089 ``check``
1090 A list of merge success-checking options:
1090 A list of merge success-checking options:
1091
1091
1092 ``changed``
1092 ``changed``
1093 Ask whether merge was successful when the merged file shows no changes.
1093 Ask whether merge was successful when the merged file shows no changes.
1094 ``conflicts``
1094 ``conflicts``
1095 Check whether there are conflicts even though the tool reported success.
1095 Check whether there are conflicts even though the tool reported success.
1096 ``prompt``
1096 ``prompt``
1097 Always prompt for merge success, regardless of success reported by tool.
1097 Always prompt for merge success, regardless of success reported by tool.
1098
1098
1099 ``fixeol``
1099 ``fixeol``
1100 Attempt to fix up EOL changes caused by the merge tool.
1100 Attempt to fix up EOL changes caused by the merge tool.
1101 (default: False)
1101 (default: False)
1102
1102
1103 ``gui``
1103 ``gui``
1104 This tool requires a graphical interface to run. (default: False)
1104 This tool requires a graphical interface to run. (default: False)
1105
1105
1106 ``regkey``
1106 ``regkey``
1107 Windows registry key which describes install location of this
1107 Windows registry key which describes install location of this
1108 tool. Mercurial will search for this key first under
1108 tool. Mercurial will search for this key first under
1109 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1109 ``HKEY_CURRENT_USER`` and then under ``HKEY_LOCAL_MACHINE``.
1110 (default: None)
1110 (default: None)
1111
1111
1112 ``regkeyalt``
1112 ``regkeyalt``
1113 An alternate Windows registry key to try if the first key is not
1113 An alternate Windows registry key to try if the first key is not
1114 found. The alternate key uses the same ``regname`` and ``regappend``
1114 found. The alternate key uses the same ``regname`` and ``regappend``
1115 semantics of the primary key. The most common use for this key
1115 semantics of the primary key. The most common use for this key
1116 is to search for 32bit applications on 64bit operating systems.
1116 is to search for 32bit applications on 64bit operating systems.
1117 (default: None)
1117 (default: None)
1118
1118
1119 ``regname``
1119 ``regname``
1120 Name of value to read from specified registry key.
1120 Name of value to read from specified registry key.
1121 (default: the unnamed (default) value)
1121 (default: the unnamed (default) value)
1122
1122
1123 ``regappend``
1123 ``regappend``
1124 String to append to the value read from the registry, typically
1124 String to append to the value read from the registry, typically
1125 the executable name of the tool.
1125 the executable name of the tool.
1126 (default: None)
1126 (default: None)
1127
1127
1128
1128
1129 ``patch``
1129 ``patch``
1130 ---------
1130 ---------
1131
1131
1132 Settings used when applying patches, for instance through the 'import'
1132 Settings used when applying patches, for instance through the 'import'
1133 command or with Mercurial Queues extension.
1133 command or with Mercurial Queues extension.
1134
1134
1135 ``eol``
1135 ``eol``
1136 When set to 'strict' patch content and patched files end of lines
1136 When set to 'strict' patch content and patched files end of lines
1137 are preserved. When set to ``lf`` or ``crlf``, both files end of
1137 are preserved. When set to ``lf`` or ``crlf``, both files end of
1138 lines are ignored when patching and the result line endings are
1138 lines are ignored when patching and the result line endings are
1139 normalized to either LF (Unix) or CRLF (Windows). When set to
1139 normalized to either LF (Unix) or CRLF (Windows). When set to
1140 ``auto``, end of lines are again ignored while patching but line
1140 ``auto``, end of lines are again ignored while patching but line
1141 endings in patched files are normalized to their original setting
1141 endings in patched files are normalized to their original setting
1142 on a per-file basis. If target file does not exist or has no end
1142 on a per-file basis. If target file does not exist or has no end
1143 of line, patch line endings are preserved.
1143 of line, patch line endings are preserved.
1144 (default: strict)
1144 (default: strict)
1145
1145
1146 ``fuzz``
1146 ``fuzz``
1147 The number of lines of 'fuzz' to allow when applying patches. This
1147 The number of lines of 'fuzz' to allow when applying patches. This
1148 controls how much context the patcher is allowed to ignore when
1148 controls how much context the patcher is allowed to ignore when
1149 trying to apply a patch.
1149 trying to apply a patch.
1150 (default: 2)
1150 (default: 2)
1151
1151
1152 ``paths``
1152 ``paths``
1153 ---------
1153 ---------
1154
1154
1155 Assigns symbolic names and behavior to repositories.
1155 Assigns symbolic names and behavior to repositories.
1156
1156
1157 Options are symbolic names defining the URL or directory that is the
1157 Options are symbolic names defining the URL or directory that is the
1158 location of the repository. Example::
1158 location of the repository. Example::
1159
1159
1160 [paths]
1160 [paths]
1161 my_server = https://example.com/my_repo
1161 my_server = https://example.com/my_repo
1162 local_path = /home/me/repo
1162 local_path = /home/me/repo
1163
1163
1164 These symbolic names can be used from the command line. To pull
1164 These symbolic names can be used from the command line. To pull
1165 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1165 from ``my_server``: :hg:`pull my_server`. To push to ``local_path``:
1166 :hg:`push local_path`.
1166 :hg:`push local_path`.
1167
1167
1168 Options containing colons (``:``) denote sub-options that can influence
1168 Options containing colons (``:``) denote sub-options that can influence
1169 behavior for that specific path. Example::
1169 behavior for that specific path. Example::
1170
1170
1171 [paths]
1171 [paths]
1172 my_server = https://example.com/my_path
1172 my_server = https://example.com/my_path
1173 my_server:pushurl = ssh://example.com/my_path
1173 my_server:pushurl = ssh://example.com/my_path
1174
1174
1175 The following sub-options can be defined:
1175 The following sub-options can be defined:
1176
1176
1177 ``pushurl``
1177 ``pushurl``
1178 The URL to use for push operations. If not defined, the location
1178 The URL to use for push operations. If not defined, the location
1179 defined by the path's main entry is used.
1179 defined by the path's main entry is used.
1180
1180
1181 The following special named paths exist:
1181 The following special named paths exist:
1182
1182
1183 ``default``
1183 ``default``
1184 The URL or directory to use when no source or remote is specified.
1184 The URL or directory to use when no source or remote is specified.
1185
1185
1186 :hg:`clone` will automatically define this path to the location the
1186 :hg:`clone` will automatically define this path to the location the
1187 repository was cloned from.
1187 repository was cloned from.
1188
1188
1189 ``default-push``
1189 ``default-push``
1190 (deprecated) The URL or directory for the default :hg:`push` location.
1190 (deprecated) The URL or directory for the default :hg:`push` location.
1191 ``default:pushurl`` should be used instead.
1191 ``default:pushurl`` should be used instead.
1192
1192
1193 ``phases``
1193 ``phases``
1194 ----------
1194 ----------
1195
1195
1196 Specifies default handling of phases. See :hg:`help phases` for more
1196 Specifies default handling of phases. See :hg:`help phases` for more
1197 information about working with phases.
1197 information about working with phases.
1198
1198
1199 ``publish``
1199 ``publish``
1200 Controls draft phase behavior when working as a server. When true,
1200 Controls draft phase behavior when working as a server. When true,
1201 pushed changesets are set to public in both client and server and
1201 pushed changesets are set to public in both client and server and
1202 pulled or cloned changesets are set to public in the client.
1202 pulled or cloned changesets are set to public in the client.
1203 (default: True)
1203 (default: True)
1204
1204
1205 ``new-commit``
1205 ``new-commit``
1206 Phase of newly-created commits.
1206 Phase of newly-created commits.
1207 (default: draft)
1207 (default: draft)
1208
1208
1209 ``checksubrepos``
1209 ``checksubrepos``
1210 Check the phase of the current revision of each subrepository. Allowed
1210 Check the phase of the current revision of each subrepository. Allowed
1211 values are "ignore", "follow" and "abort". For settings other than
1211 values are "ignore", "follow" and "abort". For settings other than
1212 "ignore", the phase of the current revision of each subrepository is
1212 "ignore", the phase of the current revision of each subrepository is
1213 checked before committing the parent repository. If any of those phases is
1213 checked before committing the parent repository. If any of those phases is
1214 greater than the phase of the parent repository (e.g. if a subrepo is in a
1214 greater than the phase of the parent repository (e.g. if a subrepo is in a
1215 "secret" phase while the parent repo is in "draft" phase), the commit is
1215 "secret" phase while the parent repo is in "draft" phase), the commit is
1216 either aborted (if checksubrepos is set to "abort") or the higher phase is
1216 either aborted (if checksubrepos is set to "abort") or the higher phase is
1217 used for the parent repository commit (if set to "follow").
1217 used for the parent repository commit (if set to "follow").
1218 (default: follow)
1218 (default: follow)
1219
1219
1220
1220
1221 ``profiling``
1221 ``profiling``
1222 -------------
1222 -------------
1223
1223
1224 Specifies profiling type, format, and file output. Two profilers are
1224 Specifies profiling type, format, and file output. Two profilers are
1225 supported: an instrumenting profiler (named ``ls``), and a sampling
1225 supported: an instrumenting profiler (named ``ls``), and a sampling
1226 profiler (named ``stat``).
1226 profiler (named ``stat``).
1227
1227
1228 In this section description, 'profiling data' stands for the raw data
1228 In this section description, 'profiling data' stands for the raw data
1229 collected during profiling, while 'profiling report' stands for a
1229 collected during profiling, while 'profiling report' stands for a
1230 statistical text report generated from the profiling data. The
1230 statistical text report generated from the profiling data. The
1231 profiling is done using lsprof.
1231 profiling is done using lsprof.
1232
1232
1233 ``type``
1233 ``type``
1234 The type of profiler to use.
1234 The type of profiler to use.
1235 (default: ls)
1235 (default: ls)
1236
1236
1237 ``ls``
1237 ``ls``
1238 Use Python's built-in instrumenting profiler. This profiler
1238 Use Python's built-in instrumenting profiler. This profiler
1239 works on all platforms, but each line number it reports is the
1239 works on all platforms, but each line number it reports is the
1240 first line of a function. This restriction makes it difficult to
1240 first line of a function. This restriction makes it difficult to
1241 identify the expensive parts of a non-trivial function.
1241 identify the expensive parts of a non-trivial function.
1242 ``stat``
1242 ``stat``
1243 Use a third-party statistical profiler, statprof. This profiler
1243 Use a third-party statistical profiler, statprof. This profiler
1244 currently runs only on Unix systems, and is most useful for
1244 currently runs only on Unix systems, and is most useful for
1245 profiling commands that run for longer than about 0.1 seconds.
1245 profiling commands that run for longer than about 0.1 seconds.
1246
1246
1247 ``format``
1247 ``format``
1248 Profiling format. Specific to the ``ls`` instrumenting profiler.
1248 Profiling format. Specific to the ``ls`` instrumenting profiler.
1249 (default: text)
1249 (default: text)
1250
1250
1251 ``text``
1251 ``text``
1252 Generate a profiling report. When saving to a file, it should be
1252 Generate a profiling report. When saving to a file, it should be
1253 noted that only the report is saved, and the profiling data is
1253 noted that only the report is saved, and the profiling data is
1254 not kept.
1254 not kept.
1255 ``kcachegrind``
1255 ``kcachegrind``
1256 Format profiling data for kcachegrind use: when saving to a
1256 Format profiling data for kcachegrind use: when saving to a
1257 file, the generated file can directly be loaded into
1257 file, the generated file can directly be loaded into
1258 kcachegrind.
1258 kcachegrind.
1259
1259
1260 ``frequency``
1260 ``frequency``
1261 Sampling frequency. Specific to the ``stat`` sampling profiler.
1261 Sampling frequency. Specific to the ``stat`` sampling profiler.
1262 (default: 1000)
1262 (default: 1000)
1263
1263
1264 ``output``
1264 ``output``
1265 File path where profiling data or report should be saved. If the
1265 File path where profiling data or report should be saved. If the
1266 file exists, it is replaced. (default: None, data is printed on
1266 file exists, it is replaced. (default: None, data is printed on
1267 stderr)
1267 stderr)
1268
1268
1269 ``sort``
1269 ``sort``
1270 Sort field. Specific to the ``ls`` instrumenting profiler.
1270 Sort field. Specific to the ``ls`` instrumenting profiler.
1271 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1271 One of ``callcount``, ``reccallcount``, ``totaltime`` and
1272 ``inlinetime``.
1272 ``inlinetime``.
1273 (default: inlinetime)
1273 (default: inlinetime)
1274
1274
1275 ``limit``
1275 ``limit``
1276 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1276 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
1277 (default: 30)
1277 (default: 30)
1278
1278
1279 ``nested``
1279 ``nested``
1280 Show at most this number of lines of drill-down info after each main entry.
1280 Show at most this number of lines of drill-down info after each main entry.
1281 This can help explain the difference between Total and Inline.
1281 This can help explain the difference between Total and Inline.
1282 Specific to the ``ls`` instrumenting profiler.
1282 Specific to the ``ls`` instrumenting profiler.
1283 (default: 5)
1283 (default: 5)
1284
1284
1285 ``progress``
1285 ``progress``
1286 ------------
1286 ------------
1287
1287
1288 Mercurial commands can draw progress bars that are as informative as
1288 Mercurial commands can draw progress bars that are as informative as
1289 possible. Some progress bars only offer indeterminate information, while others
1289 possible. Some progress bars only offer indeterminate information, while others
1290 have a definite end point.
1290 have a definite end point.
1291
1291
1292 ``delay``
1292 ``delay``
1293 Number of seconds (float) before showing the progress bar. (default: 3)
1293 Number of seconds (float) before showing the progress bar. (default: 3)
1294
1294
1295 ``changedelay``
1295 ``changedelay``
1296 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1296 Minimum delay before showing a new topic. When set to less than 3 * refresh,
1297 that value will be used instead. (default: 1)
1297 that value will be used instead. (default: 1)
1298
1298
1299 ``refresh``
1299 ``refresh``
1300 Time in seconds between refreshes of the progress bar. (default: 0.1)
1300 Time in seconds between refreshes of the progress bar. (default: 0.1)
1301
1301
1302 ``format``
1302 ``format``
1303 Format of the progress bar.
1303 Format of the progress bar.
1304
1304
1305 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1305 Valid entries for the format field are ``topic``, ``bar``, ``number``,
1306 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1306 ``unit``, ``estimate``, ``speed``, and ``item``. ``item`` defaults to the
1307 last 20 characters of the item, but this can be changed by adding either
1307 last 20 characters of the item, but this can be changed by adding either
1308 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1308 ``-<num>`` which would take the last num characters, or ``+<num>`` for the
1309 first num characters.
1309 first num characters.
1310
1310
1311 (default: topic bar number estimate)
1311 (default: topic bar number estimate)
1312
1312
1313 ``width``
1313 ``width``
1314 If set, the maximum width of the progress information (that is, min(width,
1314 If set, the maximum width of the progress information (that is, min(width,
1315 term width) will be used).
1315 term width) will be used).
1316
1316
1317 ``clear-complete``
1317 ``clear-complete``
1318 Clear the progress bar after it's done. (default: True)
1318 Clear the progress bar after it's done. (default: True)
1319
1319
1320 ``disable``
1320 ``disable``
1321 If true, don't show a progress bar.
1321 If true, don't show a progress bar.
1322
1322
1323 ``assume-tty``
1323 ``assume-tty``
1324 If true, ALWAYS show a progress bar, unless disable is given.
1324 If true, ALWAYS show a progress bar, unless disable is given.
1325
1325
1326 ``rebase``
1327 ----------
1328
1329 ``allowdivergence``
1330 Default to False, when True allow creating divergence when performing
1331 rebase of obsolete changesets.
1332
1326 ``revsetalias``
1333 ``revsetalias``
1327 ---------------
1334 ---------------
1328
1335
1329 Alias definitions for revsets. See :hg:`help revsets` for details.
1336 Alias definitions for revsets. See :hg:`help revsets` for details.
1330
1337
1331 ``server``
1338 ``server``
1332 ----------
1339 ----------
1333
1340
1334 Controls generic server settings.
1341 Controls generic server settings.
1335
1342
1336 ``uncompressed``
1343 ``uncompressed``
1337 Whether to allow clients to clone a repository using the
1344 Whether to allow clients to clone a repository using the
1338 uncompressed streaming protocol. This transfers about 40% more
1345 uncompressed streaming protocol. This transfers about 40% more
1339 data than a regular clone, but uses less memory and CPU on both
1346 data than a regular clone, but uses less memory and CPU on both
1340 server and client. Over a LAN (100 Mbps or better) or a very fast
1347 server and client. Over a LAN (100 Mbps or better) or a very fast
1341 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1348 WAN, an uncompressed streaming clone is a lot faster (~10x) than a
1342 regular clone. Over most WAN connections (anything slower than
1349 regular clone. Over most WAN connections (anything slower than
1343 about 6 Mbps), uncompressed streaming is slower, because of the
1350 about 6 Mbps), uncompressed streaming is slower, because of the
1344 extra data transfer overhead. This mode will also temporarily hold
1351 extra data transfer overhead. This mode will also temporarily hold
1345 the write lock while determining what data to transfer.
1352 the write lock while determining what data to transfer.
1346 (default: True)
1353 (default: True)
1347
1354
1348 ``preferuncompressed``
1355 ``preferuncompressed``
1349 When set, clients will try to use the uncompressed streaming
1356 When set, clients will try to use the uncompressed streaming
1350 protocol. (default: False)
1357 protocol. (default: False)
1351
1358
1352 ``validate``
1359 ``validate``
1353 Whether to validate the completeness of pushed changesets by
1360 Whether to validate the completeness of pushed changesets by
1354 checking that all new file revisions specified in manifests are
1361 checking that all new file revisions specified in manifests are
1355 present. (default: False)
1362 present. (default: False)
1356
1363
1357 ``maxhttpheaderlen``
1364 ``maxhttpheaderlen``
1358 Instruct HTTP clients not to send request headers longer than this
1365 Instruct HTTP clients not to send request headers longer than this
1359 many bytes. (default: 1024)
1366 many bytes. (default: 1024)
1360
1367
1361 ``bundle1``
1368 ``bundle1``
1362 Whether to allow clients to push and pull using the legacy bundle1
1369 Whether to allow clients to push and pull using the legacy bundle1
1363 exchange format. (default: True)
1370 exchange format. (default: True)
1364
1371
1365 ``bundle1gd``
1372 ``bundle1gd``
1366 Like ``bundle1`` but only used if the repository is using the
1373 Like ``bundle1`` but only used if the repository is using the
1367 *generaldelta* storage format. (default: True)
1374 *generaldelta* storage format. (default: True)
1368
1375
1369 ``bundle1.push``
1376 ``bundle1.push``
1370 Whether to allow clients to push using the legacy bundle1 exchange
1377 Whether to allow clients to push using the legacy bundle1 exchange
1371 format. (default: True)
1378 format. (default: True)
1372
1379
1373 ``bundle1gd.push``
1380 ``bundle1gd.push``
1374 Like ``bundle1.push`` but only used if the repository is using the
1381 Like ``bundle1.push`` but only used if the repository is using the
1375 *generaldelta* storage format. (default: True)
1382 *generaldelta* storage format. (default: True)
1376
1383
1377 ``bundle1.pull``
1384 ``bundle1.pull``
1378 Whether to allow clients to pull using the legacy bundle1 exchange
1385 Whether to allow clients to pull using the legacy bundle1 exchange
1379 format. (default: True)
1386 format. (default: True)
1380
1387
1381 ``bundle1gd.pull``
1388 ``bundle1gd.pull``
1382 Like ``bundle1.pull`` but only used if the repository is using the
1389 Like ``bundle1.pull`` but only used if the repository is using the
1383 *generaldelta* storage format. (default: True)
1390 *generaldelta* storage format. (default: True)
1384
1391
1385 Large repositories using the *generaldelta* storage format should
1392 Large repositories using the *generaldelta* storage format should
1386 consider setting this option because converting *generaldelta*
1393 consider setting this option because converting *generaldelta*
1387 repositories to the exchange format required by the bundle1 data
1394 repositories to the exchange format required by the bundle1 data
1388 format can consume a lot of CPU.
1395 format can consume a lot of CPU.
1389
1396
1390 ``smtp``
1397 ``smtp``
1391 --------
1398 --------
1392
1399
1393 Configuration for extensions that need to send email messages.
1400 Configuration for extensions that need to send email messages.
1394
1401
1395 ``host``
1402 ``host``
1396 Host name of mail server, e.g. "mail.example.com".
1403 Host name of mail server, e.g. "mail.example.com".
1397
1404
1398 ``port``
1405 ``port``
1399 Optional. Port to connect to on mail server. (default: 465 if
1406 Optional. Port to connect to on mail server. (default: 465 if
1400 ``tls`` is smtps; 25 otherwise)
1407 ``tls`` is smtps; 25 otherwise)
1401
1408
1402 ``tls``
1409 ``tls``
1403 Optional. Method to enable TLS when connecting to mail server: starttls,
1410 Optional. Method to enable TLS when connecting to mail server: starttls,
1404 smtps or none. (default: none)
1411 smtps or none. (default: none)
1405
1412
1406 ``verifycert``
1413 ``verifycert``
1407 Optional. Verification for the certificate of mail server, when
1414 Optional. Verification for the certificate of mail server, when
1408 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1415 ``tls`` is starttls or smtps. "strict", "loose" or False. For
1409 "strict" or "loose", the certificate is verified as same as the
1416 "strict" or "loose", the certificate is verified as same as the
1410 verification for HTTPS connections (see ``[hostfingerprints]`` and
1417 verification for HTTPS connections (see ``[hostfingerprints]`` and
1411 ``[web] cacerts`` also). For "strict", sending email is also
1418 ``[web] cacerts`` also). For "strict", sending email is also
1412 aborted, if there is no configuration for mail server in
1419 aborted, if there is no configuration for mail server in
1413 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1420 ``[hostfingerprints]`` and ``[web] cacerts``. --insecure for
1414 :hg:`email` overwrites this as "loose". (default: strict)
1421 :hg:`email` overwrites this as "loose". (default: strict)
1415
1422
1416 ``username``
1423 ``username``
1417 Optional. User name for authenticating with the SMTP server.
1424 Optional. User name for authenticating with the SMTP server.
1418 (default: None)
1425 (default: None)
1419
1426
1420 ``password``
1427 ``password``
1421 Optional. Password for authenticating with the SMTP server. If not
1428 Optional. Password for authenticating with the SMTP server. If not
1422 specified, interactive sessions will prompt the user for a
1429 specified, interactive sessions will prompt the user for a
1423 password; non-interactive sessions will fail. (default: None)
1430 password; non-interactive sessions will fail. (default: None)
1424
1431
1425 ``local_hostname``
1432 ``local_hostname``
1426 Optional. The hostname that the sender can use to identify
1433 Optional. The hostname that the sender can use to identify
1427 itself to the MTA.
1434 itself to the MTA.
1428
1435
1429
1436
1430 ``subpaths``
1437 ``subpaths``
1431 ------------
1438 ------------
1432
1439
1433 Subrepository source URLs can go stale if a remote server changes name
1440 Subrepository source URLs can go stale if a remote server changes name
1434 or becomes temporarily unavailable. This section lets you define
1441 or becomes temporarily unavailable. This section lets you define
1435 rewrite rules of the form::
1442 rewrite rules of the form::
1436
1443
1437 <pattern> = <replacement>
1444 <pattern> = <replacement>
1438
1445
1439 where ``pattern`` is a regular expression matching a subrepository
1446 where ``pattern`` is a regular expression matching a subrepository
1440 source URL and ``replacement`` is the replacement string used to
1447 source URL and ``replacement`` is the replacement string used to
1441 rewrite it. Groups can be matched in ``pattern`` and referenced in
1448 rewrite it. Groups can be matched in ``pattern`` and referenced in
1442 ``replacements``. For instance::
1449 ``replacements``. For instance::
1443
1450
1444 http://server/(.*)-hg/ = http://hg.server/\1/
1451 http://server/(.*)-hg/ = http://hg.server/\1/
1445
1452
1446 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1453 rewrites ``http://server/foo-hg/`` into ``http://hg.server/foo/``.
1447
1454
1448 Relative subrepository paths are first made absolute, and the
1455 Relative subrepository paths are first made absolute, and the
1449 rewrite rules are then applied on the full (absolute) path. The rules
1456 rewrite rules are then applied on the full (absolute) path. The rules
1450 are applied in definition order.
1457 are applied in definition order.
1451
1458
1452 ``trusted``
1459 ``trusted``
1453 -----------
1460 -----------
1454
1461
1455 Mercurial will not use the settings in the
1462 Mercurial will not use the settings in the
1456 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1463 ``.hg/hgrc`` file from a repository if it doesn't belong to a trusted
1457 user or to a trusted group, as various hgrc features allow arbitrary
1464 user or to a trusted group, as various hgrc features allow arbitrary
1458 commands to be run. This issue is often encountered when configuring
1465 commands to be run. This issue is often encountered when configuring
1459 hooks or extensions for shared repositories or servers. However,
1466 hooks or extensions for shared repositories or servers. However,
1460 the web interface will use some safe settings from the ``[web]``
1467 the web interface will use some safe settings from the ``[web]``
1461 section.
1468 section.
1462
1469
1463 This section specifies what users and groups are trusted. The
1470 This section specifies what users and groups are trusted. The
1464 current user is always trusted. To trust everybody, list a user or a
1471 current user is always trusted. To trust everybody, list a user or a
1465 group with name ``*``. These settings must be placed in an
1472 group with name ``*``. These settings must be placed in an
1466 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1473 *already-trusted file* to take effect, such as ``$HOME/.hgrc`` of the
1467 user or service running Mercurial.
1474 user or service running Mercurial.
1468
1475
1469 ``users``
1476 ``users``
1470 Comma-separated list of trusted users.
1477 Comma-separated list of trusted users.
1471
1478
1472 ``groups``
1479 ``groups``
1473 Comma-separated list of trusted groups.
1480 Comma-separated list of trusted groups.
1474
1481
1475
1482
1476 ``ui``
1483 ``ui``
1477 ------
1484 ------
1478
1485
1479 User interface controls.
1486 User interface controls.
1480
1487
1481 ``archivemeta``
1488 ``archivemeta``
1482 Whether to include the .hg_archival.txt file containing meta data
1489 Whether to include the .hg_archival.txt file containing meta data
1483 (hashes for the repository base and for tip) in archives created
1490 (hashes for the repository base and for tip) in archives created
1484 by the :hg:`archive` command or downloaded via hgweb.
1491 by the :hg:`archive` command or downloaded via hgweb.
1485 (default: True)
1492 (default: True)
1486
1493
1487 ``askusername``
1494 ``askusername``
1488 Whether to prompt for a username when committing. If True, and
1495 Whether to prompt for a username when committing. If True, and
1489 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1496 neither ``$HGUSER`` nor ``$EMAIL`` has been specified, then the user will
1490 be prompted to enter a username. If no username is entered, the
1497 be prompted to enter a username. If no username is entered, the
1491 default ``USER@HOST`` is used instead.
1498 default ``USER@HOST`` is used instead.
1492 (default: False)
1499 (default: False)
1493
1500
1494 ``clonebundles``
1501 ``clonebundles``
1495 Whether the "clone bundles" feature is enabled.
1502 Whether the "clone bundles" feature is enabled.
1496
1503
1497 When enabled, :hg:`clone` may download and apply a server-advertised
1504 When enabled, :hg:`clone` may download and apply a server-advertised
1498 bundle file from a URL instead of using the normal exchange mechanism.
1505 bundle file from a URL instead of using the normal exchange mechanism.
1499
1506
1500 This can likely result in faster and more reliable clones.
1507 This can likely result in faster and more reliable clones.
1501
1508
1502 (default: True)
1509 (default: True)
1503
1510
1504 ``clonebundlefallback``
1511 ``clonebundlefallback``
1505 Whether failure to apply an advertised "clone bundle" from a server
1512 Whether failure to apply an advertised "clone bundle" from a server
1506 should result in fallback to a regular clone.
1513 should result in fallback to a regular clone.
1507
1514
1508 This is disabled by default because servers advertising "clone
1515 This is disabled by default because servers advertising "clone
1509 bundles" often do so to reduce server load. If advertised bundles
1516 bundles" often do so to reduce server load. If advertised bundles
1510 start mass failing and clients automatically fall back to a regular
1517 start mass failing and clients automatically fall back to a regular
1511 clone, this would add significant and unexpected load to the server
1518 clone, this would add significant and unexpected load to the server
1512 since the server is expecting clone operations to be offloaded to
1519 since the server is expecting clone operations to be offloaded to
1513 pre-generated bundles. Failing fast (the default behavior) ensures
1520 pre-generated bundles. Failing fast (the default behavior) ensures
1514 clients don't overwhelm the server when "clone bundle" application
1521 clients don't overwhelm the server when "clone bundle" application
1515 fails.
1522 fails.
1516
1523
1517 (default: False)
1524 (default: False)
1518
1525
1519 ``clonebundleprefers``
1526 ``clonebundleprefers``
1520 Defines preferences for which "clone bundles" to use.
1527 Defines preferences for which "clone bundles" to use.
1521
1528
1522 Servers advertising "clone bundles" may advertise multiple available
1529 Servers advertising "clone bundles" may advertise multiple available
1523 bundles. Each bundle may have different attributes, such as the bundle
1530 bundles. Each bundle may have different attributes, such as the bundle
1524 type and compression format. This option is used to prefer a particular
1531 type and compression format. This option is used to prefer a particular
1525 bundle over another.
1532 bundle over another.
1526
1533
1527 The following keys are defined by Mercurial:
1534 The following keys are defined by Mercurial:
1528
1535
1529 BUNDLESPEC
1536 BUNDLESPEC
1530 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
1537 A bundle type specifier. These are strings passed to :hg:`bundle -t`.
1531 e.g. ``gzip-v2`` or ``bzip2-v1``.
1538 e.g. ``gzip-v2`` or ``bzip2-v1``.
1532
1539
1533 COMPRESSION
1540 COMPRESSION
1534 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
1541 The compression format of the bundle. e.g. ``gzip`` and ``bzip2``.
1535
1542
1536 Server operators may define custom keys.
1543 Server operators may define custom keys.
1537
1544
1538 Example values: ``COMPRESSION=bzip2``,
1545 Example values: ``COMPRESSION=bzip2``,
1539 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
1546 ``BUNDLESPEC=gzip-v2, COMPRESSION=gzip``.
1540
1547
1541 By default, the first bundle advertised by the server is used.
1548 By default, the first bundle advertised by the server is used.
1542
1549
1543 ``commitsubrepos``
1550 ``commitsubrepos``
1544 Whether to commit modified subrepositories when committing the
1551 Whether to commit modified subrepositories when committing the
1545 parent repository. If False and one subrepository has uncommitted
1552 parent repository. If False and one subrepository has uncommitted
1546 changes, abort the commit.
1553 changes, abort the commit.
1547 (default: False)
1554 (default: False)
1548
1555
1549 ``debug``
1556 ``debug``
1550 Print debugging information. (default: False)
1557 Print debugging information. (default: False)
1551
1558
1552 ``editor``
1559 ``editor``
1553 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
1560 The editor to use during a commit. (default: ``$EDITOR`` or ``vi``)
1554
1561
1555 ``fallbackencoding``
1562 ``fallbackencoding``
1556 Encoding to try if it's not possible to decode the changelog using
1563 Encoding to try if it's not possible to decode the changelog using
1557 UTF-8. (default: ISO-8859-1)
1564 UTF-8. (default: ISO-8859-1)
1558
1565
1559 ``graphnodetemplate``
1566 ``graphnodetemplate``
1560 The template used to print changeset nodes in an ASCII revision graph.
1567 The template used to print changeset nodes in an ASCII revision graph.
1561 (default: ``{graphnode}``)
1568 (default: ``{graphnode}``)
1562
1569
1563 ``ignore``
1570 ``ignore``
1564 A file to read per-user ignore patterns from. This file should be
1571 A file to read per-user ignore patterns from. This file should be
1565 in the same format as a repository-wide .hgignore file. Filenames
1572 in the same format as a repository-wide .hgignore file. Filenames
1566 are relative to the repository root. This option supports hook syntax,
1573 are relative to the repository root. This option supports hook syntax,
1567 so if you want to specify multiple ignore files, you can do so by
1574 so if you want to specify multiple ignore files, you can do so by
1568 setting something like ``ignore.other = ~/.hgignore2``. For details
1575 setting something like ``ignore.other = ~/.hgignore2``. For details
1569 of the ignore file format, see the ``hgignore(5)`` man page.
1576 of the ignore file format, see the ``hgignore(5)`` man page.
1570
1577
1571 ``interactive``
1578 ``interactive``
1572 Allow to prompt the user. (default: True)
1579 Allow to prompt the user. (default: True)
1573
1580
1574 ``logtemplate``
1581 ``logtemplate``
1575 Template string for commands that print changesets.
1582 Template string for commands that print changesets.
1576
1583
1577 ``merge``
1584 ``merge``
1578 The conflict resolution program to use during a manual merge.
1585 The conflict resolution program to use during a manual merge.
1579 For more information on merge tools see :hg:`help merge-tools`.
1586 For more information on merge tools see :hg:`help merge-tools`.
1580 For configuring merge tools see the ``[merge-tools]`` section.
1587 For configuring merge tools see the ``[merge-tools]`` section.
1581
1588
1582 ``mergemarkers``
1589 ``mergemarkers``
1583 Sets the merge conflict marker label styling. The ``detailed``
1590 Sets the merge conflict marker label styling. The ``detailed``
1584 style uses the ``mergemarkertemplate`` setting to style the labels.
1591 style uses the ``mergemarkertemplate`` setting to style the labels.
1585 The ``basic`` style just uses 'local' and 'other' as the marker label.
1592 The ``basic`` style just uses 'local' and 'other' as the marker label.
1586 One of ``basic`` or ``detailed``.
1593 One of ``basic`` or ``detailed``.
1587 (default: ``basic``)
1594 (default: ``basic``)
1588
1595
1589 ``mergemarkertemplate``
1596 ``mergemarkertemplate``
1590 The template used to print the commit description next to each conflict
1597 The template used to print the commit description next to each conflict
1591 marker during merge conflicts. See :hg:`help templates` for the template
1598 marker during merge conflicts. See :hg:`help templates` for the template
1592 format.
1599 format.
1593
1600
1594 Defaults to showing the hash, tags, branches, bookmarks, author, and
1601 Defaults to showing the hash, tags, branches, bookmarks, author, and
1595 the first line of the commit description.
1602 the first line of the commit description.
1596
1603
1597 If you use non-ASCII characters in names for tags, branches, bookmarks,
1604 If you use non-ASCII characters in names for tags, branches, bookmarks,
1598 authors, and/or commit descriptions, you must pay attention to encodings of
1605 authors, and/or commit descriptions, you must pay attention to encodings of
1599 managed files. At template expansion, non-ASCII characters use the encoding
1606 managed files. At template expansion, non-ASCII characters use the encoding
1600 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1607 specified by the ``--encoding`` global option, ``HGENCODING`` or other
1601 environment variables that govern your locale. If the encoding of the merge
1608 environment variables that govern your locale. If the encoding of the merge
1602 markers is different from the encoding of the merged files,
1609 markers is different from the encoding of the merged files,
1603 serious problems may occur.
1610 serious problems may occur.
1604
1611
1605 ``origbackuppath``
1612 ``origbackuppath``
1606 The path to a directory used to store generated .orig files. If the path is
1613 The path to a directory used to store generated .orig files. If the path is
1607 not a directory, one will be created.
1614 not a directory, one will be created.
1608
1615
1609 ``patch``
1616 ``patch``
1610 An optional external tool that ``hg import`` and some extensions
1617 An optional external tool that ``hg import`` and some extensions
1611 will use for applying patches. By default Mercurial uses an
1618 will use for applying patches. By default Mercurial uses an
1612 internal patch utility. The external tool must work as the common
1619 internal patch utility. The external tool must work as the common
1613 Unix ``patch`` program. In particular, it must accept a ``-p``
1620 Unix ``patch`` program. In particular, it must accept a ``-p``
1614 argument to strip patch headers, a ``-d`` argument to specify the
1621 argument to strip patch headers, a ``-d`` argument to specify the
1615 current directory, a file name to patch, and a patch file to take
1622 current directory, a file name to patch, and a patch file to take
1616 from stdin.
1623 from stdin.
1617
1624
1618 It is possible to specify a patch tool together with extra
1625 It is possible to specify a patch tool together with extra
1619 arguments. For example, setting this option to ``patch --merge``
1626 arguments. For example, setting this option to ``patch --merge``
1620 will use the ``patch`` program with its 2-way merge option.
1627 will use the ``patch`` program with its 2-way merge option.
1621
1628
1622 ``portablefilenames``
1629 ``portablefilenames``
1623 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1630 Check for portable filenames. Can be ``warn``, ``ignore`` or ``abort``.
1624 (default: ``warn``)
1631 (default: ``warn``)
1625 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1632 If set to ``warn`` (or ``true``), a warning message is printed on POSIX
1626 platforms, if a file with a non-portable filename is added (e.g. a file
1633 platforms, if a file with a non-portable filename is added (e.g. a file
1627 with a name that can't be created on Windows because it contains reserved
1634 with a name that can't be created on Windows because it contains reserved
1628 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1635 parts like ``AUX``, reserved characters like ``:``, or would cause a case
1629 collision with an existing file).
1636 collision with an existing file).
1630 If set to ``ignore`` (or ``false``), no warning is printed.
1637 If set to ``ignore`` (or ``false``), no warning is printed.
1631 If set to ``abort``, the command is aborted.
1638 If set to ``abort``, the command is aborted.
1632 On Windows, this configuration option is ignored and the command aborted.
1639 On Windows, this configuration option is ignored and the command aborted.
1633
1640
1634 ``quiet``
1641 ``quiet``
1635 Reduce the amount of output printed. (default: False)
1642 Reduce the amount of output printed. (default: False)
1636
1643
1637 ``remotecmd``
1644 ``remotecmd``
1638 Remote command to use for clone/push/pull operations. (default: ``hg``)
1645 Remote command to use for clone/push/pull operations. (default: ``hg``)
1639
1646
1640 ``report_untrusted``
1647 ``report_untrusted``
1641 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1648 Warn if a ``.hg/hgrc`` file is ignored due to not being owned by a
1642 trusted user or group. (default: True)
1649 trusted user or group. (default: True)
1643
1650
1644 ``slash``
1651 ``slash``
1645 Display paths using a slash (``/``) as the path separator. This
1652 Display paths using a slash (``/``) as the path separator. This
1646 only makes a difference on systems where the default path
1653 only makes a difference on systems where the default path
1647 separator is not the slash character (e.g. Windows uses the
1654 separator is not the slash character (e.g. Windows uses the
1648 backslash character (``\``)).
1655 backslash character (``\``)).
1649 (default: False)
1656 (default: False)
1650
1657
1651 ``statuscopies``
1658 ``statuscopies``
1652 Display copies in the status command.
1659 Display copies in the status command.
1653
1660
1654 ``ssh``
1661 ``ssh``
1655 Command to use for SSH connections. (default: ``ssh``)
1662 Command to use for SSH connections. (default: ``ssh``)
1656
1663
1657 ``strict``
1664 ``strict``
1658 Require exact command names, instead of allowing unambiguous
1665 Require exact command names, instead of allowing unambiguous
1659 abbreviations. (default: False)
1666 abbreviations. (default: False)
1660
1667
1661 ``style``
1668 ``style``
1662 Name of style to use for command output.
1669 Name of style to use for command output.
1663
1670
1664 ``supportcontact``
1671 ``supportcontact``
1665 A URL where users should report a Mercurial traceback. Use this if you are a
1672 A URL where users should report a Mercurial traceback. Use this if you are a
1666 large organisation with its own Mercurial deployment process and crash
1673 large organisation with its own Mercurial deployment process and crash
1667 reports should be addressed to your internal support.
1674 reports should be addressed to your internal support.
1668
1675
1669 ``timeout``
1676 ``timeout``
1670 The timeout used when a lock is held (in seconds), a negative value
1677 The timeout used when a lock is held (in seconds), a negative value
1671 means no timeout. (default: 600)
1678 means no timeout. (default: 600)
1672
1679
1673 ``traceback``
1680 ``traceback``
1674 Mercurial always prints a traceback when an unknown exception
1681 Mercurial always prints a traceback when an unknown exception
1675 occurs. Setting this to True will make Mercurial print a traceback
1682 occurs. Setting this to True will make Mercurial print a traceback
1676 on all exceptions, even those recognized by Mercurial (such as
1683 on all exceptions, even those recognized by Mercurial (such as
1677 IOError or MemoryError). (default: False)
1684 IOError or MemoryError). (default: False)
1678
1685
1679 ``username``
1686 ``username``
1680 The committer of a changeset created when running "commit".
1687 The committer of a changeset created when running "commit".
1681 Typically a person's name and email address, e.g. ``Fred Widget
1688 Typically a person's name and email address, e.g. ``Fred Widget
1682 <fred@example.com>``. Environment variables in the
1689 <fred@example.com>``. Environment variables in the
1683 username are expanded.
1690 username are expanded.
1684
1691
1685 (default: ``$EMAIL`` or ``username@hostname``. If the username in
1692 (default: ``$EMAIL`` or ``username@hostname``. If the username in
1686 hgrc is empty, e.g. if the system admin set ``username =`` in the
1693 hgrc is empty, e.g. if the system admin set ``username =`` in the
1687 system hgrc, it has to be specified manually or in a different
1694 system hgrc, it has to be specified manually or in a different
1688 hgrc file)
1695 hgrc file)
1689
1696
1690 ``verbose``
1697 ``verbose``
1691 Increase the amount of output printed. (default: False)
1698 Increase the amount of output printed. (default: False)
1692
1699
1693
1700
1694 ``web``
1701 ``web``
1695 -------
1702 -------
1696
1703
1697 Web interface configuration. The settings in this section apply to
1704 Web interface configuration. The settings in this section apply to
1698 both the builtin webserver (started by :hg:`serve`) and the script you
1705 both the builtin webserver (started by :hg:`serve`) and the script you
1699 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1706 run through a webserver (``hgweb.cgi`` and the derivatives for FastCGI
1700 and WSGI).
1707 and WSGI).
1701
1708
1702 The Mercurial webserver does no authentication (it does not prompt for
1709 The Mercurial webserver does no authentication (it does not prompt for
1703 usernames and passwords to validate *who* users are), but it does do
1710 usernames and passwords to validate *who* users are), but it does do
1704 authorization (it grants or denies access for *authenticated users*
1711 authorization (it grants or denies access for *authenticated users*
1705 based on settings in this section). You must either configure your
1712 based on settings in this section). You must either configure your
1706 webserver to do authentication for you, or disable the authorization
1713 webserver to do authentication for you, or disable the authorization
1707 checks.
1714 checks.
1708
1715
1709 For a quick setup in a trusted environment, e.g., a private LAN, where
1716 For a quick setup in a trusted environment, e.g., a private LAN, where
1710 you want it to accept pushes from anybody, you can use the following
1717 you want it to accept pushes from anybody, you can use the following
1711 command line::
1718 command line::
1712
1719
1713 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1720 $ hg --config web.allow_push=* --config web.push_ssl=False serve
1714
1721
1715 Note that this will allow anybody to push anything to the server and
1722 Note that this will allow anybody to push anything to the server and
1716 that this should not be used for public servers.
1723 that this should not be used for public servers.
1717
1724
1718 The full set of options is:
1725 The full set of options is:
1719
1726
1720 ``accesslog``
1727 ``accesslog``
1721 Where to output the access log. (default: stdout)
1728 Where to output the access log. (default: stdout)
1722
1729
1723 ``address``
1730 ``address``
1724 Interface address to bind to. (default: all)
1731 Interface address to bind to. (default: all)
1725
1732
1726 ``allow_archive``
1733 ``allow_archive``
1727 List of archive format (bz2, gz, zip) allowed for downloading.
1734 List of archive format (bz2, gz, zip) allowed for downloading.
1728 (default: empty)
1735 (default: empty)
1729
1736
1730 ``allowbz2``
1737 ``allowbz2``
1731 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1738 (DEPRECATED) Whether to allow .tar.bz2 downloading of repository
1732 revisions.
1739 revisions.
1733 (default: False)
1740 (default: False)
1734
1741
1735 ``allowgz``
1742 ``allowgz``
1736 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1743 (DEPRECATED) Whether to allow .tar.gz downloading of repository
1737 revisions.
1744 revisions.
1738 (default: False)
1745 (default: False)
1739
1746
1740 ``allowpull``
1747 ``allowpull``
1741 Whether to allow pulling from the repository. (default: True)
1748 Whether to allow pulling from the repository. (default: True)
1742
1749
1743 ``allow_push``
1750 ``allow_push``
1744 Whether to allow pushing to the repository. If empty or not set,
1751 Whether to allow pushing to the repository. If empty or not set,
1745 pushing is not allowed. If the special value ``*``, any remote
1752 pushing is not allowed. If the special value ``*``, any remote
1746 user can push, including unauthenticated users. Otherwise, the
1753 user can push, including unauthenticated users. Otherwise, the
1747 remote user must have been authenticated, and the authenticated
1754 remote user must have been authenticated, and the authenticated
1748 user name must be present in this list. The contents of the
1755 user name must be present in this list. The contents of the
1749 allow_push list are examined after the deny_push list.
1756 allow_push list are examined after the deny_push list.
1750
1757
1751 ``allow_read``
1758 ``allow_read``
1752 If the user has not already been denied repository access due to
1759 If the user has not already been denied repository access due to
1753 the contents of deny_read, this list determines whether to grant
1760 the contents of deny_read, this list determines whether to grant
1754 repository access to the user. If this list is not empty, and the
1761 repository access to the user. If this list is not empty, and the
1755 user is unauthenticated or not present in the list, then access is
1762 user is unauthenticated or not present in the list, then access is
1756 denied for the user. If the list is empty or not set, then access
1763 denied for the user. If the list is empty or not set, then access
1757 is permitted to all users by default. Setting allow_read to the
1764 is permitted to all users by default. Setting allow_read to the
1758 special value ``*`` is equivalent to it not being set (i.e. access
1765 special value ``*`` is equivalent to it not being set (i.e. access
1759 is permitted to all users). The contents of the allow_read list are
1766 is permitted to all users). The contents of the allow_read list are
1760 examined after the deny_read list.
1767 examined after the deny_read list.
1761
1768
1762 ``allowzip``
1769 ``allowzip``
1763 (DEPRECATED) Whether to allow .zip downloading of repository
1770 (DEPRECATED) Whether to allow .zip downloading of repository
1764 revisions. This feature creates temporary files.
1771 revisions. This feature creates temporary files.
1765 (default: False)
1772 (default: False)
1766
1773
1767 ``archivesubrepos``
1774 ``archivesubrepos``
1768 Whether to recurse into subrepositories when archiving.
1775 Whether to recurse into subrepositories when archiving.
1769 (default: False)
1776 (default: False)
1770
1777
1771 ``baseurl``
1778 ``baseurl``
1772 Base URL to use when publishing URLs in other locations, so
1779 Base URL to use when publishing URLs in other locations, so
1773 third-party tools like email notification hooks can construct
1780 third-party tools like email notification hooks can construct
1774 URLs. Example: ``http://hgserver/repos/``.
1781 URLs. Example: ``http://hgserver/repos/``.
1775
1782
1776 ``cacerts``
1783 ``cacerts``
1777 Path to file containing a list of PEM encoded certificate
1784 Path to file containing a list of PEM encoded certificate
1778 authority certificates. Environment variables and ``~user``
1785 authority certificates. Environment variables and ``~user``
1779 constructs are expanded in the filename. If specified on the
1786 constructs are expanded in the filename. If specified on the
1780 client, then it will verify the identity of remote HTTPS servers
1787 client, then it will verify the identity of remote HTTPS servers
1781 with these certificates.
1788 with these certificates.
1782
1789
1783 This feature is only supported when using Python 2.6 or later. If you wish
1790 This feature is only supported when using Python 2.6 or later. If you wish
1784 to use it with earlier versions of Python, install the backported
1791 to use it with earlier versions of Python, install the backported
1785 version of the ssl library that is available from
1792 version of the ssl library that is available from
1786 ``http://pypi.python.org``.
1793 ``http://pypi.python.org``.
1787
1794
1788 To disable SSL verification temporarily, specify ``--insecure`` from
1795 To disable SSL verification temporarily, specify ``--insecure`` from
1789 command line.
1796 command line.
1790
1797
1791 You can use OpenSSL's CA certificate file if your platform has
1798 You can use OpenSSL's CA certificate file if your platform has
1792 one. On most Linux systems this will be
1799 one. On most Linux systems this will be
1793 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1800 ``/etc/ssl/certs/ca-certificates.crt``. Otherwise you will have to
1794 generate this file manually. The form must be as follows::
1801 generate this file manually. The form must be as follows::
1795
1802
1796 -----BEGIN CERTIFICATE-----
1803 -----BEGIN CERTIFICATE-----
1797 ... (certificate in base64 PEM encoding) ...
1804 ... (certificate in base64 PEM encoding) ...
1798 -----END CERTIFICATE-----
1805 -----END CERTIFICATE-----
1799 -----BEGIN CERTIFICATE-----
1806 -----BEGIN CERTIFICATE-----
1800 ... (certificate in base64 PEM encoding) ...
1807 ... (certificate in base64 PEM encoding) ...
1801 -----END CERTIFICATE-----
1808 -----END CERTIFICATE-----
1802
1809
1803 ``cache``
1810 ``cache``
1804 Whether to support caching in hgweb. (default: True)
1811 Whether to support caching in hgweb. (default: True)
1805
1812
1806 ``certificate``
1813 ``certificate``
1807 Certificate to use when running :hg:`serve`.
1814 Certificate to use when running :hg:`serve`.
1808
1815
1809 ``collapse``
1816 ``collapse``
1810 With ``descend`` enabled, repositories in subdirectories are shown at
1817 With ``descend`` enabled, repositories in subdirectories are shown at
1811 a single level alongside repositories in the current path. With
1818 a single level alongside repositories in the current path. With
1812 ``collapse`` also enabled, repositories residing at a deeper level than
1819 ``collapse`` also enabled, repositories residing at a deeper level than
1813 the current path are grouped behind navigable directory entries that
1820 the current path are grouped behind navigable directory entries that
1814 lead to the locations of these repositories. In effect, this setting
1821 lead to the locations of these repositories. In effect, this setting
1815 collapses each collection of repositories found within a subdirectory
1822 collapses each collection of repositories found within a subdirectory
1816 into a single entry for that subdirectory. (default: False)
1823 into a single entry for that subdirectory. (default: False)
1817
1824
1818 ``comparisoncontext``
1825 ``comparisoncontext``
1819 Number of lines of context to show in side-by-side file comparison. If
1826 Number of lines of context to show in side-by-side file comparison. If
1820 negative or the value ``full``, whole files are shown. (default: 5)
1827 negative or the value ``full``, whole files are shown. (default: 5)
1821
1828
1822 This setting can be overridden by a ``context`` request parameter to the
1829 This setting can be overridden by a ``context`` request parameter to the
1823 ``comparison`` command, taking the same values.
1830 ``comparison`` command, taking the same values.
1824
1831
1825 ``contact``
1832 ``contact``
1826 Name or email address of the person in charge of the repository.
1833 Name or email address of the person in charge of the repository.
1827 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
1834 (default: ui.username or ``$EMAIL`` or "unknown" if unset or empty)
1828
1835
1829 ``deny_push``
1836 ``deny_push``
1830 Whether to deny pushing to the repository. If empty or not set,
1837 Whether to deny pushing to the repository. If empty or not set,
1831 push is not denied. If the special value ``*``, all remote users are
1838 push is not denied. If the special value ``*``, all remote users are
1832 denied push. Otherwise, unauthenticated users are all denied, and
1839 denied push. Otherwise, unauthenticated users are all denied, and
1833 any authenticated user name present in this list is also denied. The
1840 any authenticated user name present in this list is also denied. The
1834 contents of the deny_push list are examined before the allow_push list.
1841 contents of the deny_push list are examined before the allow_push list.
1835
1842
1836 ``deny_read``
1843 ``deny_read``
1837 Whether to deny reading/viewing of the repository. If this list is
1844 Whether to deny reading/viewing of the repository. If this list is
1838 not empty, unauthenticated users are all denied, and any
1845 not empty, unauthenticated users are all denied, and any
1839 authenticated user name present in this list is also denied access to
1846 authenticated user name present in this list is also denied access to
1840 the repository. If set to the special value ``*``, all remote users
1847 the repository. If set to the special value ``*``, all remote users
1841 are denied access (rarely needed ;). If deny_read is empty or not set,
1848 are denied access (rarely needed ;). If deny_read is empty or not set,
1842 the determination of repository access depends on the presence and
1849 the determination of repository access depends on the presence and
1843 content of the allow_read list (see description). If both
1850 content of the allow_read list (see description). If both
1844 deny_read and allow_read are empty or not set, then access is
1851 deny_read and allow_read are empty or not set, then access is
1845 permitted to all users by default. If the repository is being
1852 permitted to all users by default. If the repository is being
1846 served via hgwebdir, denied users will not be able to see it in
1853 served via hgwebdir, denied users will not be able to see it in
1847 the list of repositories. The contents of the deny_read list have
1854 the list of repositories. The contents of the deny_read list have
1848 priority over (are examined before) the contents of the allow_read
1855 priority over (are examined before) the contents of the allow_read
1849 list.
1856 list.
1850
1857
1851 ``descend``
1858 ``descend``
1852 hgwebdir indexes will not descend into subdirectories. Only repositories
1859 hgwebdir indexes will not descend into subdirectories. Only repositories
1853 directly in the current path will be shown (other repositories are still
1860 directly in the current path will be shown (other repositories are still
1854 available from the index corresponding to their containing path).
1861 available from the index corresponding to their containing path).
1855
1862
1856 ``description``
1863 ``description``
1857 Textual description of the repository's purpose or contents.
1864 Textual description of the repository's purpose or contents.
1858 (default: "unknown")
1865 (default: "unknown")
1859
1866
1860 ``encoding``
1867 ``encoding``
1861 Character encoding name. (default: the current locale charset)
1868 Character encoding name. (default: the current locale charset)
1862 Example: "UTF-8".
1869 Example: "UTF-8".
1863
1870
1864 ``errorlog``
1871 ``errorlog``
1865 Where to output the error log. (default: stderr)
1872 Where to output the error log. (default: stderr)
1866
1873
1867 ``guessmime``
1874 ``guessmime``
1868 Control MIME types for raw download of file content.
1875 Control MIME types for raw download of file content.
1869 Set to True to let hgweb guess the content type from the file
1876 Set to True to let hgweb guess the content type from the file
1870 extension. This will serve HTML files as ``text/html`` and might
1877 extension. This will serve HTML files as ``text/html`` and might
1871 allow cross-site scripting attacks when serving untrusted
1878 allow cross-site scripting attacks when serving untrusted
1872 repositories. (default: False)
1879 repositories. (default: False)
1873
1880
1874 ``hidden``
1881 ``hidden``
1875 Whether to hide the repository in the hgwebdir index.
1882 Whether to hide the repository in the hgwebdir index.
1876 (default: False)
1883 (default: False)
1877
1884
1878 ``ipv6``
1885 ``ipv6``
1879 Whether to use IPv6. (default: False)
1886 Whether to use IPv6. (default: False)
1880
1887
1881 ``logoimg``
1888 ``logoimg``
1882 File name of the logo image that some templates display on each page.
1889 File name of the logo image that some templates display on each page.
1883 The file name is relative to ``staticurl``. That is, the full path to
1890 The file name is relative to ``staticurl``. That is, the full path to
1884 the logo image is "staticurl/logoimg".
1891 the logo image is "staticurl/logoimg".
1885 If unset, ``hglogo.png`` will be used.
1892 If unset, ``hglogo.png`` will be used.
1886
1893
1887 ``logourl``
1894 ``logourl``
1888 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
1895 Base URL to use for logos. If unset, ``https://mercurial-scm.org/``
1889 will be used.
1896 will be used.
1890
1897
1891 ``maxchanges``
1898 ``maxchanges``
1892 Maximum number of changes to list on the changelog. (default: 10)
1899 Maximum number of changes to list on the changelog. (default: 10)
1893
1900
1894 ``maxfiles``
1901 ``maxfiles``
1895 Maximum number of files to list per changeset. (default: 10)
1902 Maximum number of files to list per changeset. (default: 10)
1896
1903
1897 ``maxshortchanges``
1904 ``maxshortchanges``
1898 Maximum number of changes to list on the shortlog, graph or filelog
1905 Maximum number of changes to list on the shortlog, graph or filelog
1899 pages. (default: 60)
1906 pages. (default: 60)
1900
1907
1901 ``name``
1908 ``name``
1902 Repository name to use in the web interface.
1909 Repository name to use in the web interface.
1903 (default: current working directory)
1910 (default: current working directory)
1904
1911
1905 ``port``
1912 ``port``
1906 Port to listen on. (default: 8000)
1913 Port to listen on. (default: 8000)
1907
1914
1908 ``prefix``
1915 ``prefix``
1909 Prefix path to serve from. (default: '' (server root))
1916 Prefix path to serve from. (default: '' (server root))
1910
1917
1911 ``push_ssl``
1918 ``push_ssl``
1912 Whether to require that inbound pushes be transported over SSL to
1919 Whether to require that inbound pushes be transported over SSL to
1913 prevent password sniffing. (default: True)
1920 prevent password sniffing. (default: True)
1914
1921
1915 ``refreshinterval``
1922 ``refreshinterval``
1916 How frequently directory listings re-scan the filesystem for new
1923 How frequently directory listings re-scan the filesystem for new
1917 repositories, in seconds. This is relevant when wildcards are used
1924 repositories, in seconds. This is relevant when wildcards are used
1918 to define paths. Depending on how much filesystem traversal is
1925 to define paths. Depending on how much filesystem traversal is
1919 required, refreshing may negatively impact performance.
1926 required, refreshing may negatively impact performance.
1920
1927
1921 Values less than or equal to 0 always refresh.
1928 Values less than or equal to 0 always refresh.
1922 (default: 20)
1929 (default: 20)
1923
1930
1924 ``staticurl``
1931 ``staticurl``
1925 Base URL to use for static files. If unset, static files (e.g. the
1932 Base URL to use for static files. If unset, static files (e.g. the
1926 hgicon.png favicon) will be served by the CGI script itself. Use
1933 hgicon.png favicon) will be served by the CGI script itself. Use
1927 this setting to serve them directly with the HTTP server.
1934 this setting to serve them directly with the HTTP server.
1928 Example: ``http://hgserver/static/``.
1935 Example: ``http://hgserver/static/``.
1929
1936
1930 ``stripes``
1937 ``stripes``
1931 How many lines a "zebra stripe" should span in multi-line output.
1938 How many lines a "zebra stripe" should span in multi-line output.
1932 Set to 0 to disable. (default: 1)
1939 Set to 0 to disable. (default: 1)
1933
1940
1934 ``style``
1941 ``style``
1935 Which template map style to use. The available options are the names of
1942 Which template map style to use. The available options are the names of
1936 subdirectories in the HTML templates path. (default: ``paper``)
1943 subdirectories in the HTML templates path. (default: ``paper``)
1937 Example: ``monoblue``.
1944 Example: ``monoblue``.
1938
1945
1939 ``templates``
1946 ``templates``
1940 Where to find the HTML templates. The default path to the HTML templates
1947 Where to find the HTML templates. The default path to the HTML templates
1941 can be obtained from ``hg debuginstall``.
1948 can be obtained from ``hg debuginstall``.
1942
1949
1943 ``websub``
1950 ``websub``
1944 ----------
1951 ----------
1945
1952
1946 Web substitution filter definition. You can use this section to
1953 Web substitution filter definition. You can use this section to
1947 define a set of regular expression substitution patterns which
1954 define a set of regular expression substitution patterns which
1948 let you automatically modify the hgweb server output.
1955 let you automatically modify the hgweb server output.
1949
1956
1950 The default hgweb templates only apply these substitution patterns
1957 The default hgweb templates only apply these substitution patterns
1951 on the revision description fields. You can apply them anywhere
1958 on the revision description fields. You can apply them anywhere
1952 you want when you create your own templates by adding calls to the
1959 you want when you create your own templates by adding calls to the
1953 "websub" filter (usually after calling the "escape" filter).
1960 "websub" filter (usually after calling the "escape" filter).
1954
1961
1955 This can be used, for example, to convert issue references to links
1962 This can be used, for example, to convert issue references to links
1956 to your issue tracker, or to convert "markdown-like" syntax into
1963 to your issue tracker, or to convert "markdown-like" syntax into
1957 HTML (see the examples below).
1964 HTML (see the examples below).
1958
1965
1959 Each entry in this section names a substitution filter.
1966 Each entry in this section names a substitution filter.
1960 The value of each entry defines the substitution expression itself.
1967 The value of each entry defines the substitution expression itself.
1961 The websub expressions follow the old interhg extension syntax,
1968 The websub expressions follow the old interhg extension syntax,
1962 which in turn imitates the Unix sed replacement syntax::
1969 which in turn imitates the Unix sed replacement syntax::
1963
1970
1964 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
1971 patternname = s/SEARCH_REGEX/REPLACE_EXPRESSION/[i]
1965
1972
1966 You can use any separator other than "/". The final "i" is optional
1973 You can use any separator other than "/". The final "i" is optional
1967 and indicates that the search must be case insensitive.
1974 and indicates that the search must be case insensitive.
1968
1975
1969 Examples::
1976 Examples::
1970
1977
1971 [websub]
1978 [websub]
1972 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
1979 issues = s|issue(\d+)|<a href="http://bts.example.org/issue\1">issue\1</a>|i
1973 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
1980 italic = s/\b_(\S+)_\b/<i>\1<\/i>/
1974 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
1981 bold = s/\*\b(\S+)\b\*/<b>\1<\/b>/
1975
1982
1976 ``worker``
1983 ``worker``
1977 ----------
1984 ----------
1978
1985
1979 Parallel master/worker configuration. We currently perform working
1986 Parallel master/worker configuration. We currently perform working
1980 directory updates in parallel on Unix-like systems, which greatly
1987 directory updates in parallel on Unix-like systems, which greatly
1981 helps performance.
1988 helps performance.
1982
1989
1983 ``numcpus``
1990 ``numcpus``
1984 Number of CPUs to use for parallel operations. A zero or
1991 Number of CPUs to use for parallel operations. A zero or
1985 negative value is treated as ``use the default``.
1992 negative value is treated as ``use the default``.
1986 (default: 4 or the number of CPUs on the system, whichever is larger)
1993 (default: 4 or the number of CPUs on the system, whichever is larger)
@@ -1,714 +1,807 b''
1 ==========================
1 ==========================
2 Test rebase with obsolete
2 Test rebase with obsolete
3 ==========================
3 ==========================
4
4
5 Enable obsolete
5 Enable obsolete
6
6
7 $ cat >> $HGRCPATH << EOF
7 $ cat >> $HGRCPATH << EOF
8 > [ui]
8 > [ui]
9 > logtemplate= {rev}:{node|short} {desc|firstline}
9 > logtemplate= {rev}:{node|short} {desc|firstline}
10 > [experimental]
10 > [experimental]
11 > evolution=createmarkers,allowunstable
11 > evolution=createmarkers,allowunstable
12 > [phases]
12 > [phases]
13 > publish=False
13 > publish=False
14 > [extensions]
14 > [extensions]
15 > rebase=
15 > rebase=
16 > EOF
16 > EOF
17
17
18 Setup rebase canonical repo
18 Setup rebase canonical repo
19
19
20 $ hg init base
20 $ hg init base
21 $ cd base
21 $ cd base
22 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
22 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
23 adding changesets
23 adding changesets
24 adding manifests
24 adding manifests
25 adding file changes
25 adding file changes
26 added 8 changesets with 7 changes to 7 files (+2 heads)
26 added 8 changesets with 7 changes to 7 files (+2 heads)
27 (run 'hg heads' to see heads, 'hg merge' to merge)
27 (run 'hg heads' to see heads, 'hg merge' to merge)
28 $ hg up tip
28 $ hg up tip
29 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
29 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 $ hg log -G
30 $ hg log -G
31 @ 7:02de42196ebe H
31 @ 7:02de42196ebe H
32 |
32 |
33 | o 6:eea13746799a G
33 | o 6:eea13746799a G
34 |/|
34 |/|
35 o | 5:24b6387c8c8c F
35 o | 5:24b6387c8c8c F
36 | |
36 | |
37 | o 4:9520eea781bc E
37 | o 4:9520eea781bc E
38 |/
38 |/
39 | o 3:32af7686d403 D
39 | o 3:32af7686d403 D
40 | |
40 | |
41 | o 2:5fddd98957c8 C
41 | o 2:5fddd98957c8 C
42 | |
42 | |
43 | o 1:42ccdea3bb16 B
43 | o 1:42ccdea3bb16 B
44 |/
44 |/
45 o 0:cd010b8cd998 A
45 o 0:cd010b8cd998 A
46
46
47 $ cd ..
47 $ cd ..
48
48
49 simple rebase
49 simple rebase
50 ---------------------------------
50 ---------------------------------
51
51
52 $ hg clone base simple
52 $ hg clone base simple
53 updating to branch default
53 updating to branch default
54 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
54 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
55 $ cd simple
55 $ cd simple
56 $ hg up 32af7686d403
56 $ hg up 32af7686d403
57 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
57 3 files updated, 0 files merged, 2 files removed, 0 files unresolved
58 $ hg rebase -d eea13746799a
58 $ hg rebase -d eea13746799a
59 rebasing 1:42ccdea3bb16 "B"
59 rebasing 1:42ccdea3bb16 "B"
60 rebasing 2:5fddd98957c8 "C"
60 rebasing 2:5fddd98957c8 "C"
61 rebasing 3:32af7686d403 "D"
61 rebasing 3:32af7686d403 "D"
62 $ hg log -G
62 $ hg log -G
63 @ 10:8eeb3c33ad33 D
63 @ 10:8eeb3c33ad33 D
64 |
64 |
65 o 9:2327fea05063 C
65 o 9:2327fea05063 C
66 |
66 |
67 o 8:e4e5be0395b2 B
67 o 8:e4e5be0395b2 B
68 |
68 |
69 | o 7:02de42196ebe H
69 | o 7:02de42196ebe H
70 | |
70 | |
71 o | 6:eea13746799a G
71 o | 6:eea13746799a G
72 |\|
72 |\|
73 | o 5:24b6387c8c8c F
73 | o 5:24b6387c8c8c F
74 | |
74 | |
75 o | 4:9520eea781bc E
75 o | 4:9520eea781bc E
76 |/
76 |/
77 o 0:cd010b8cd998 A
77 o 0:cd010b8cd998 A
78
78
79 $ hg log --hidden -G
79 $ hg log --hidden -G
80 @ 10:8eeb3c33ad33 D
80 @ 10:8eeb3c33ad33 D
81 |
81 |
82 o 9:2327fea05063 C
82 o 9:2327fea05063 C
83 |
83 |
84 o 8:e4e5be0395b2 B
84 o 8:e4e5be0395b2 B
85 |
85 |
86 | o 7:02de42196ebe H
86 | o 7:02de42196ebe H
87 | |
87 | |
88 o | 6:eea13746799a G
88 o | 6:eea13746799a G
89 |\|
89 |\|
90 | o 5:24b6387c8c8c F
90 | o 5:24b6387c8c8c F
91 | |
91 | |
92 o | 4:9520eea781bc E
92 o | 4:9520eea781bc E
93 |/
93 |/
94 | x 3:32af7686d403 D
94 | x 3:32af7686d403 D
95 | |
95 | |
96 | x 2:5fddd98957c8 C
96 | x 2:5fddd98957c8 C
97 | |
97 | |
98 | x 1:42ccdea3bb16 B
98 | x 1:42ccdea3bb16 B
99 |/
99 |/
100 o 0:cd010b8cd998 A
100 o 0:cd010b8cd998 A
101
101
102 $ hg debugobsolete
102 $ hg debugobsolete
103 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (*) {'user': 'test'} (glob)
103 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 (*) {'user': 'test'} (glob)
104 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (*) {'user': 'test'} (glob)
104 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 (*) {'user': 'test'} (glob)
105 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (*) {'user': 'test'} (glob)
105 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 (*) {'user': 'test'} (glob)
106
106
107
107
108 $ cd ..
108 $ cd ..
109
109
110 empty changeset
110 empty changeset
111 ---------------------------------
111 ---------------------------------
112
112
113 $ hg clone base empty
113 $ hg clone base empty
114 updating to branch default
114 updating to branch default
115 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
115 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
116 $ cd empty
116 $ cd empty
117 $ hg up eea13746799a
117 $ hg up eea13746799a
118 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
118 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
119
119
120 We make a copy of both the first changeset in the rebased and some other in the
120 We make a copy of both the first changeset in the rebased and some other in the
121 set.
121 set.
122
122
123 $ hg graft 42ccdea3bb16 32af7686d403
123 $ hg graft 42ccdea3bb16 32af7686d403
124 grafting 1:42ccdea3bb16 "B"
124 grafting 1:42ccdea3bb16 "B"
125 grafting 3:32af7686d403 "D"
125 grafting 3:32af7686d403 "D"
126 $ hg rebase -s 42ccdea3bb16 -d .
126 $ hg rebase -s 42ccdea3bb16 -d .
127 rebasing 1:42ccdea3bb16 "B"
127 rebasing 1:42ccdea3bb16 "B"
128 note: rebase of 1:42ccdea3bb16 created no changes to commit
128 note: rebase of 1:42ccdea3bb16 created no changes to commit
129 rebasing 2:5fddd98957c8 "C"
129 rebasing 2:5fddd98957c8 "C"
130 rebasing 3:32af7686d403 "D"
130 rebasing 3:32af7686d403 "D"
131 note: rebase of 3:32af7686d403 created no changes to commit
131 note: rebase of 3:32af7686d403 created no changes to commit
132 $ hg log -G
132 $ hg log -G
133 o 10:5ae4c968c6ac C
133 o 10:5ae4c968c6ac C
134 |
134 |
135 @ 9:08483444fef9 D
135 @ 9:08483444fef9 D
136 |
136 |
137 o 8:8877864f1edb B
137 o 8:8877864f1edb B
138 |
138 |
139 | o 7:02de42196ebe H
139 | o 7:02de42196ebe H
140 | |
140 | |
141 o | 6:eea13746799a G
141 o | 6:eea13746799a G
142 |\|
142 |\|
143 | o 5:24b6387c8c8c F
143 | o 5:24b6387c8c8c F
144 | |
144 | |
145 o | 4:9520eea781bc E
145 o | 4:9520eea781bc E
146 |/
146 |/
147 o 0:cd010b8cd998 A
147 o 0:cd010b8cd998 A
148
148
149 $ hg log --hidden -G
149 $ hg log --hidden -G
150 o 10:5ae4c968c6ac C
150 o 10:5ae4c968c6ac C
151 |
151 |
152 @ 9:08483444fef9 D
152 @ 9:08483444fef9 D
153 |
153 |
154 o 8:8877864f1edb B
154 o 8:8877864f1edb B
155 |
155 |
156 | o 7:02de42196ebe H
156 | o 7:02de42196ebe H
157 | |
157 | |
158 o | 6:eea13746799a G
158 o | 6:eea13746799a G
159 |\|
159 |\|
160 | o 5:24b6387c8c8c F
160 | o 5:24b6387c8c8c F
161 | |
161 | |
162 o | 4:9520eea781bc E
162 o | 4:9520eea781bc E
163 |/
163 |/
164 | x 3:32af7686d403 D
164 | x 3:32af7686d403 D
165 | |
165 | |
166 | x 2:5fddd98957c8 C
166 | x 2:5fddd98957c8 C
167 | |
167 | |
168 | x 1:42ccdea3bb16 B
168 | x 1:42ccdea3bb16 B
169 |/
169 |/
170 o 0:cd010b8cd998 A
170 o 0:cd010b8cd998 A
171
171
172 $ hg debugobsolete
172 $ hg debugobsolete
173 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
173 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
174 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
174 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
175 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
175 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
176
176
177
177
178 More complex case were part of the rebase set were already rebased
178 More complex case were part of the rebase set were already rebased
179
179
180 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
180 $ hg rebase --rev 'desc(D)' --dest 'desc(H)'
181 rebasing 9:08483444fef9 "D"
181 rebasing 9:08483444fef9 "D"
182 $ hg debugobsolete
182 $ hg debugobsolete
183 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
183 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
184 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
184 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
185 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
185 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
186 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
186 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
187 $ hg log -G
187 $ hg log -G
188 @ 11:4596109a6a43 D
188 @ 11:4596109a6a43 D
189 |
189 |
190 | o 10:5ae4c968c6ac C
190 | o 10:5ae4c968c6ac C
191 | |
191 | |
192 | x 9:08483444fef9 D
192 | x 9:08483444fef9 D
193 | |
193 | |
194 | o 8:8877864f1edb B
194 | o 8:8877864f1edb B
195 | |
195 | |
196 o | 7:02de42196ebe H
196 o | 7:02de42196ebe H
197 | |
197 | |
198 | o 6:eea13746799a G
198 | o 6:eea13746799a G
199 |/|
199 |/|
200 o | 5:24b6387c8c8c F
200 o | 5:24b6387c8c8c F
201 | |
201 | |
202 | o 4:9520eea781bc E
202 | o 4:9520eea781bc E
203 |/
203 |/
204 o 0:cd010b8cd998 A
204 o 0:cd010b8cd998 A
205
205
206 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
206 $ hg rebase --source 'desc(B)' --dest 'tip' --config experimental.rebaseskipobsolete=True
207 rebasing 8:8877864f1edb "B"
207 rebasing 8:8877864f1edb "B"
208 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D"
208 note: not rebasing 9:08483444fef9 "D", already in destination as 11:4596109a6a43 "D"
209 rebasing 10:5ae4c968c6ac "C"
209 rebasing 10:5ae4c968c6ac "C"
210 $ hg debugobsolete
210 $ hg debugobsolete
211 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
211 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 0 {cd010b8cd998f3981a5a8115f94f8da4ab506089} (*) {'user': 'test'} (glob)
212 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
212 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 (*) {'user': 'test'} (glob)
213 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
213 32af7686d403cf45b5d95f2d70cebea587ac806a 0 {5fddd98957c8a54a4d436dfe1da9d87f21a1b97b} (*) {'user': 'test'} (glob)
214 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
214 08483444fef91d6224f6655ee586a65d263ad34c 4596109a6a4328c398bde3a4a3b6737cfade3003 0 (*) {'user': 'test'} (glob)
215 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob)
215 8877864f1edb05d0e07dc4ba77b67a80a7b86672 462a34d07e599b87ea08676a449373fe4e2e1347 0 (*) {'user': 'test'} (glob)
216 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob)
216 5ae4c968c6aca831df823664e706c9d4aa34473d 98f6af4ee9539e14da4465128f894c274900b6e5 0 (*) {'user': 'test'} (glob)
217 $ hg log --rev 'divergent()'
217 $ hg log --rev 'divergent()'
218 $ hg log -G
218 $ hg log -G
219 o 13:98f6af4ee953 C
219 o 13:98f6af4ee953 C
220 |
220 |
221 o 12:462a34d07e59 B
221 o 12:462a34d07e59 B
222 |
222 |
223 @ 11:4596109a6a43 D
223 @ 11:4596109a6a43 D
224 |
224 |
225 o 7:02de42196ebe H
225 o 7:02de42196ebe H
226 |
226 |
227 | o 6:eea13746799a G
227 | o 6:eea13746799a G
228 |/|
228 |/|
229 o | 5:24b6387c8c8c F
229 o | 5:24b6387c8c8c F
230 | |
230 | |
231 | o 4:9520eea781bc E
231 | o 4:9520eea781bc E
232 |/
232 |/
233 o 0:cd010b8cd998 A
233 o 0:cd010b8cd998 A
234
234
235 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
235 $ hg log --style default --debug -r 4596109a6a4328c398bde3a4a3b6737cfade3003
236 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
236 changeset: 11:4596109a6a4328c398bde3a4a3b6737cfade3003
237 phase: draft
237 phase: draft
238 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
238 parent: 7:02de42196ebee42ef284b6780a87cdc96e8eaab6
239 parent: -1:0000000000000000000000000000000000000000
239 parent: -1:0000000000000000000000000000000000000000
240 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
240 manifest: 11:a91006e3a02f1edf631f7018e6e5684cf27dd905
241 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
241 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
242 date: Sat Apr 30 15:24:48 2011 +0200
242 date: Sat Apr 30 15:24:48 2011 +0200
243 files+: D
243 files+: D
244 extra: branch=default
244 extra: branch=default
245 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
245 extra: rebase_source=08483444fef91d6224f6655ee586a65d263ad34c
246 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
246 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
247 description:
247 description:
248 D
248 D
249
249
250
250
251 $ hg up -qr 'desc(G)'
251 $ hg up -qr 'desc(G)'
252 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
252 $ hg graft 4596109a6a4328c398bde3a4a3b6737cfade3003
253 grafting 11:4596109a6a43 "D"
253 grafting 11:4596109a6a43 "D"
254 $ hg up -qr 'desc(E)'
254 $ hg up -qr 'desc(E)'
255 $ hg rebase -s tip -d .
255 $ hg rebase -s tip -d .
256 rebasing 14:0f4c66d0b70f "D" (tip)
256 rebasing 14:0f4c66d0b70f "D" (tip)
257 $ hg log --style default --debug -r tip
257 $ hg log --style default --debug -r tip
258 changeset: 15:884f358981b4d32069bb539e0e95d49a35eb81d0
258 changeset: 15:884f358981b4d32069bb539e0e95d49a35eb81d0
259 tag: tip
259 tag: tip
260 phase: draft
260 phase: draft
261 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
261 parent: 4:9520eea781bcca16c1e15acc0ba14335a0e8e5ba
262 parent: -1:0000000000000000000000000000000000000000
262 parent: -1:0000000000000000000000000000000000000000
263 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
263 manifest: 15:648e8ede73ae3e497d093d3a4c8fcc2daa864f42
264 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
264 user: Nicolas Dumazet <nicdumz.commits@gmail.com>
265 date: Sat Apr 30 15:24:48 2011 +0200
265 date: Sat Apr 30 15:24:48 2011 +0200
266 files+: D
266 files+: D
267 extra: branch=default
267 extra: branch=default
268 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
268 extra: intermediate-source=4596109a6a4328c398bde3a4a3b6737cfade3003
269 extra: rebase_source=0f4c66d0b70f8e1ce4aec01f8e95cf24ee923afa
269 extra: rebase_source=0f4c66d0b70f8e1ce4aec01f8e95cf24ee923afa
270 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
270 extra: source=32af7686d403cf45b5d95f2d70cebea587ac806a
271 description:
271 description:
272 D
272 D
273
273
274
274
275 $ cd ..
275 $ cd ..
276
276
277 collapse rebase
277 collapse rebase
278 ---------------------------------
278 ---------------------------------
279
279
280 $ hg clone base collapse
280 $ hg clone base collapse
281 updating to branch default
281 updating to branch default
282 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
282 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
283 $ cd collapse
283 $ cd collapse
284 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
284 $ hg rebase -s 42ccdea3bb16 -d eea13746799a --collapse
285 rebasing 1:42ccdea3bb16 "B"
285 rebasing 1:42ccdea3bb16 "B"
286 rebasing 2:5fddd98957c8 "C"
286 rebasing 2:5fddd98957c8 "C"
287 rebasing 3:32af7686d403 "D"
287 rebasing 3:32af7686d403 "D"
288 $ hg log -G
288 $ hg log -G
289 o 8:4dc2197e807b Collapsed revision
289 o 8:4dc2197e807b Collapsed revision
290 |
290 |
291 | @ 7:02de42196ebe H
291 | @ 7:02de42196ebe H
292 | |
292 | |
293 o | 6:eea13746799a G
293 o | 6:eea13746799a G
294 |\|
294 |\|
295 | o 5:24b6387c8c8c F
295 | o 5:24b6387c8c8c F
296 | |
296 | |
297 o | 4:9520eea781bc E
297 o | 4:9520eea781bc E
298 |/
298 |/
299 o 0:cd010b8cd998 A
299 o 0:cd010b8cd998 A
300
300
301 $ hg log --hidden -G
301 $ hg log --hidden -G
302 o 8:4dc2197e807b Collapsed revision
302 o 8:4dc2197e807b Collapsed revision
303 |
303 |
304 | @ 7:02de42196ebe H
304 | @ 7:02de42196ebe H
305 | |
305 | |
306 o | 6:eea13746799a G
306 o | 6:eea13746799a G
307 |\|
307 |\|
308 | o 5:24b6387c8c8c F
308 | o 5:24b6387c8c8c F
309 | |
309 | |
310 o | 4:9520eea781bc E
310 o | 4:9520eea781bc E
311 |/
311 |/
312 | x 3:32af7686d403 D
312 | x 3:32af7686d403 D
313 | |
313 | |
314 | x 2:5fddd98957c8 C
314 | x 2:5fddd98957c8 C
315 | |
315 | |
316 | x 1:42ccdea3bb16 B
316 | x 1:42ccdea3bb16 B
317 |/
317 |/
318 o 0:cd010b8cd998 A
318 o 0:cd010b8cd998 A
319
319
320 $ hg id --debug -r tip
320 $ hg id --debug -r tip
321 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
321 4dc2197e807bae9817f09905b50ab288be2dbbcf tip
322 $ hg debugobsolete
322 $ hg debugobsolete
323 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
323 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
324 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
324 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
325 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
325 32af7686d403cf45b5d95f2d70cebea587ac806a 4dc2197e807bae9817f09905b50ab288be2dbbcf 0 (*) {'user': 'test'} (glob)
326
326
327 $ cd ..
327 $ cd ..
328
328
329 Rebase set has hidden descendants
329 Rebase set has hidden descendants
330 ---------------------------------
330 ---------------------------------
331
331
332 We rebase a changeset which has a hidden changeset. The hidden changeset must
332 We rebase a changeset which has a hidden changeset. The hidden changeset must
333 not be rebased.
333 not be rebased.
334
334
335 $ hg clone base hidden
335 $ hg clone base hidden
336 updating to branch default
336 updating to branch default
337 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
337 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
338 $ cd hidden
338 $ cd hidden
339 $ hg rebase -s 5fddd98957c8 -d eea13746799a
339 $ hg rebase -s 5fddd98957c8 -d eea13746799a
340 rebasing 2:5fddd98957c8 "C"
340 rebasing 2:5fddd98957c8 "C"
341 rebasing 3:32af7686d403 "D"
341 rebasing 3:32af7686d403 "D"
342 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
342 $ hg rebase -s 42ccdea3bb16 -d 02de42196ebe
343 rebasing 1:42ccdea3bb16 "B"
343 rebasing 1:42ccdea3bb16 "B"
344 $ hg log -G
344 $ hg log -G
345 o 10:7c6027df6a99 B
345 o 10:7c6027df6a99 B
346 |
346 |
347 | o 9:cf44d2f5a9f4 D
347 | o 9:cf44d2f5a9f4 D
348 | |
348 | |
349 | o 8:e273c5e7d2d2 C
349 | o 8:e273c5e7d2d2 C
350 | |
350 | |
351 @ | 7:02de42196ebe H
351 @ | 7:02de42196ebe H
352 | |
352 | |
353 | o 6:eea13746799a G
353 | o 6:eea13746799a G
354 |/|
354 |/|
355 o | 5:24b6387c8c8c F
355 o | 5:24b6387c8c8c F
356 | |
356 | |
357 | o 4:9520eea781bc E
357 | o 4:9520eea781bc E
358 |/
358 |/
359 o 0:cd010b8cd998 A
359 o 0:cd010b8cd998 A
360
360
361 $ hg log --hidden -G
361 $ hg log --hidden -G
362 o 10:7c6027df6a99 B
362 o 10:7c6027df6a99 B
363 |
363 |
364 | o 9:cf44d2f5a9f4 D
364 | o 9:cf44d2f5a9f4 D
365 | |
365 | |
366 | o 8:e273c5e7d2d2 C
366 | o 8:e273c5e7d2d2 C
367 | |
367 | |
368 @ | 7:02de42196ebe H
368 @ | 7:02de42196ebe H
369 | |
369 | |
370 | o 6:eea13746799a G
370 | o 6:eea13746799a G
371 |/|
371 |/|
372 o | 5:24b6387c8c8c F
372 o | 5:24b6387c8c8c F
373 | |
373 | |
374 | o 4:9520eea781bc E
374 | o 4:9520eea781bc E
375 |/
375 |/
376 | x 3:32af7686d403 D
376 | x 3:32af7686d403 D
377 | |
377 | |
378 | x 2:5fddd98957c8 C
378 | x 2:5fddd98957c8 C
379 | |
379 | |
380 | x 1:42ccdea3bb16 B
380 | x 1:42ccdea3bb16 B
381 |/
381 |/
382 o 0:cd010b8cd998 A
382 o 0:cd010b8cd998 A
383
383
384 $ hg debugobsolete
384 $ hg debugobsolete
385 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (*) {'user': 'test'} (glob)
385 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b e273c5e7d2d29df783dce9f9eaa3ac4adc69c15d 0 (*) {'user': 'test'} (glob)
386 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (*) {'user': 'test'} (glob)
386 32af7686d403cf45b5d95f2d70cebea587ac806a cf44d2f5a9f4297a62be94cbdd3dff7c7dc54258 0 (*) {'user': 'test'} (glob)
387 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (*) {'user': 'test'} (glob)
387 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 7c6027df6a99d93f461868e5433f63bde20b6dfb 0 (*) {'user': 'test'} (glob)
388
388
389 Test that rewriting leaving instability behind is allowed
389 Test that rewriting leaving instability behind is allowed
390 ---------------------------------------------------------------------
390 ---------------------------------------------------------------------
391
391
392 $ hg log -r 'children(8)'
392 $ hg log -r 'children(8)'
393 9:cf44d2f5a9f4 D (no-eol)
393 9:cf44d2f5a9f4 D (no-eol)
394 $ hg rebase -r 8
394 $ hg rebase -r 8
395 rebasing 8:e273c5e7d2d2 "C"
395 rebasing 8:e273c5e7d2d2 "C"
396 $ hg log -G
396 $ hg log -G
397 o 11:0d8f238b634c C
397 o 11:0d8f238b634c C
398 |
398 |
399 o 10:7c6027df6a99 B
399 o 10:7c6027df6a99 B
400 |
400 |
401 | o 9:cf44d2f5a9f4 D
401 | o 9:cf44d2f5a9f4 D
402 | |
402 | |
403 | x 8:e273c5e7d2d2 C
403 | x 8:e273c5e7d2d2 C
404 | |
404 | |
405 @ | 7:02de42196ebe H
405 @ | 7:02de42196ebe H
406 | |
406 | |
407 | o 6:eea13746799a G
407 | o 6:eea13746799a G
408 |/|
408 |/|
409 o | 5:24b6387c8c8c F
409 o | 5:24b6387c8c8c F
410 | |
410 | |
411 | o 4:9520eea781bc E
411 | o 4:9520eea781bc E
412 |/
412 |/
413 o 0:cd010b8cd998 A
413 o 0:cd010b8cd998 A
414
414
415
415
416
416
417 Test multiple root handling
417 Test multiple root handling
418 ------------------------------------
418 ------------------------------------
419
419
420 $ hg rebase --dest 4 --rev '7+11+9'
420 $ hg rebase --dest 4 --rev '7+11+9'
421 rebasing 7:02de42196ebe "H"
421 rebasing 7:02de42196ebe "H"
422 rebasing 9:cf44d2f5a9f4 "D"
422 rebasing 9:cf44d2f5a9f4 "D"
423 not rebasing ignored 10:7c6027df6a99 "B"
423 not rebasing ignored 10:7c6027df6a99 "B"
424 rebasing 11:0d8f238b634c "C" (tip)
424 rebasing 11:0d8f238b634c "C" (tip)
425 $ hg log -G
425 $ hg log -G
426 o 14:1e8370e38cca C
426 o 14:1e8370e38cca C
427 |
427 |
428 | o 13:102b4c1d889b D
428 | o 13:102b4c1d889b D
429 | |
429 | |
430 @ | 12:bfe264faf697 H
430 @ | 12:bfe264faf697 H
431 |/
431 |/
432 | o 10:7c6027df6a99 B
432 | o 10:7c6027df6a99 B
433 | |
433 | |
434 | x 7:02de42196ebe H
434 | x 7:02de42196ebe H
435 | |
435 | |
436 +---o 6:eea13746799a G
436 +---o 6:eea13746799a G
437 | |/
437 | |/
438 | o 5:24b6387c8c8c F
438 | o 5:24b6387c8c8c F
439 | |
439 | |
440 o | 4:9520eea781bc E
440 o | 4:9520eea781bc E
441 |/
441 |/
442 o 0:cd010b8cd998 A
442 o 0:cd010b8cd998 A
443
443
444 $ cd ..
444 $ cd ..
445
445
446 test on rebase dropping a merge
446 test on rebase dropping a merge
447
447
448 (setup)
448 (setup)
449
449
450 $ hg init dropmerge
450 $ hg init dropmerge
451 $ cd dropmerge
451 $ cd dropmerge
452 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
452 $ hg unbundle "$TESTDIR/bundles/rebase.hg"
453 adding changesets
453 adding changesets
454 adding manifests
454 adding manifests
455 adding file changes
455 adding file changes
456 added 8 changesets with 7 changes to 7 files (+2 heads)
456 added 8 changesets with 7 changes to 7 files (+2 heads)
457 (run 'hg heads' to see heads, 'hg merge' to merge)
457 (run 'hg heads' to see heads, 'hg merge' to merge)
458 $ hg up 3
458 $ hg up 3
459 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
459 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
460 $ hg merge 7
460 $ hg merge 7
461 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
461 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
462 (branch merge, don't forget to commit)
462 (branch merge, don't forget to commit)
463 $ hg ci -m 'M'
463 $ hg ci -m 'M'
464 $ echo I > I
464 $ echo I > I
465 $ hg add I
465 $ hg add I
466 $ hg ci -m I
466 $ hg ci -m I
467 $ hg log -G
467 $ hg log -G
468 @ 9:4bde274eefcf I
468 @ 9:4bde274eefcf I
469 |
469 |
470 o 8:53a6a128b2b7 M
470 o 8:53a6a128b2b7 M
471 |\
471 |\
472 | o 7:02de42196ebe H
472 | o 7:02de42196ebe H
473 | |
473 | |
474 | | o 6:eea13746799a G
474 | | o 6:eea13746799a G
475 | |/|
475 | |/|
476 | o | 5:24b6387c8c8c F
476 | o | 5:24b6387c8c8c F
477 | | |
477 | | |
478 | | o 4:9520eea781bc E
478 | | o 4:9520eea781bc E
479 | |/
479 | |/
480 o | 3:32af7686d403 D
480 o | 3:32af7686d403 D
481 | |
481 | |
482 o | 2:5fddd98957c8 C
482 o | 2:5fddd98957c8 C
483 | |
483 | |
484 o | 1:42ccdea3bb16 B
484 o | 1:42ccdea3bb16 B
485 |/
485 |/
486 o 0:cd010b8cd998 A
486 o 0:cd010b8cd998 A
487
487
488 (actual test)
488 (actual test)
489
489
490 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
490 $ hg rebase --dest 6 --rev '((desc(H) + desc(D))::) - desc(M)'
491 rebasing 3:32af7686d403 "D"
491 rebasing 3:32af7686d403 "D"
492 rebasing 7:02de42196ebe "H"
492 rebasing 7:02de42196ebe "H"
493 not rebasing ignored 8:53a6a128b2b7 "M"
493 not rebasing ignored 8:53a6a128b2b7 "M"
494 rebasing 9:4bde274eefcf "I" (tip)
494 rebasing 9:4bde274eefcf "I" (tip)
495 $ hg log -G
495 $ hg log -G
496 @ 12:acd174b7ab39 I
496 @ 12:acd174b7ab39 I
497 |
497 |
498 o 11:6c11a6218c97 H
498 o 11:6c11a6218c97 H
499 |
499 |
500 | o 10:b5313c85b22e D
500 | o 10:b5313c85b22e D
501 |/
501 |/
502 | o 8:53a6a128b2b7 M
502 | o 8:53a6a128b2b7 M
503 | |\
503 | |\
504 | | x 7:02de42196ebe H
504 | | x 7:02de42196ebe H
505 | | |
505 | | |
506 o---+ 6:eea13746799a G
506 o---+ 6:eea13746799a G
507 | | |
507 | | |
508 | | o 5:24b6387c8c8c F
508 | | o 5:24b6387c8c8c F
509 | | |
509 | | |
510 o---+ 4:9520eea781bc E
510 o---+ 4:9520eea781bc E
511 / /
511 / /
512 x | 3:32af7686d403 D
512 x | 3:32af7686d403 D
513 | |
513 | |
514 o | 2:5fddd98957c8 C
514 o | 2:5fddd98957c8 C
515 | |
515 | |
516 o | 1:42ccdea3bb16 B
516 o | 1:42ccdea3bb16 B
517 |/
517 |/
518 o 0:cd010b8cd998 A
518 o 0:cd010b8cd998 A
519
519
520
520
521 Test hidden changesets in the rebase set (issue4504)
521 Test hidden changesets in the rebase set (issue4504)
522
522
523 $ hg up --hidden 9
523 $ hg up --hidden 9
524 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
524 3 files updated, 0 files merged, 1 files removed, 0 files unresolved
525 $ echo J > J
525 $ echo J > J
526 $ hg add J
526 $ hg add J
527 $ hg commit -m J
527 $ hg commit -m J
528 $ hg debugobsolete `hg log --rev . -T '{node}'`
528 $ hg debugobsolete `hg log --rev . -T '{node}'`
529
529
530 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback
530 $ hg rebase --rev .~1::. --dest 'max(desc(D))' --traceback
531 rebasing 9:4bde274eefcf "I"
531 rebasing 9:4bde274eefcf "I"
532 rebasing 13:06edfc82198f "J" (tip)
532 rebasing 13:06edfc82198f "J" (tip)
533 $ hg log -G
533 $ hg log -G
534 @ 15:5ae8a643467b J
534 @ 15:5ae8a643467b J
535 |
535 |
536 o 14:9ad579b4a5de I
536 o 14:9ad579b4a5de I
537 |
537 |
538 | o 12:acd174b7ab39 I
538 | o 12:acd174b7ab39 I
539 | |
539 | |
540 | o 11:6c11a6218c97 H
540 | o 11:6c11a6218c97 H
541 | |
541 | |
542 o | 10:b5313c85b22e D
542 o | 10:b5313c85b22e D
543 |/
543 |/
544 | o 8:53a6a128b2b7 M
544 | o 8:53a6a128b2b7 M
545 | |\
545 | |\
546 | | x 7:02de42196ebe H
546 | | x 7:02de42196ebe H
547 | | |
547 | | |
548 o---+ 6:eea13746799a G
548 o---+ 6:eea13746799a G
549 | | |
549 | | |
550 | | o 5:24b6387c8c8c F
550 | | o 5:24b6387c8c8c F
551 | | |
551 | | |
552 o---+ 4:9520eea781bc E
552 o---+ 4:9520eea781bc E
553 / /
553 / /
554 x | 3:32af7686d403 D
554 x | 3:32af7686d403 D
555 | |
555 | |
556 o | 2:5fddd98957c8 C
556 o | 2:5fddd98957c8 C
557 | |
557 | |
558 o | 1:42ccdea3bb16 B
558 o | 1:42ccdea3bb16 B
559 |/
559 |/
560 o 0:cd010b8cd998 A
560 o 0:cd010b8cd998 A
561
561
562 $ hg up 14 -C
562 $ hg up 14 -C
563 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
563 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
564 $ echo "K" > K
564 $ echo "K" > K
565 $ hg add K
565 $ hg add K
566 $ hg commit --amend -m "K"
566 $ hg commit --amend -m "K"
567 $ echo "L" > L
567 $ echo "L" > L
568 $ hg add L
568 $ hg add L
569 $ hg commit -m "L"
569 $ hg commit -m "L"
570 $ hg up '.^'
570 $ hg up '.^'
571 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
571 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
572 $ echo "M" > M
572 $ echo "M" > M
573 $ hg add M
573 $ hg add M
574 $ hg commit --amend -m "M"
574 $ hg commit --amend -m "M"
575 $ hg log -G
575 $ hg log -G
576 @ 20:bfaedf8eb73b M
576 @ 20:bfaedf8eb73b M
577 |
577 |
578 | o 18:97219452e4bd L
578 | o 18:97219452e4bd L
579 | |
579 | |
580 | x 17:fc37a630c901 K
580 | x 17:fc37a630c901 K
581 |/
581 |/
582 | o 15:5ae8a643467b J
582 | o 15:5ae8a643467b J
583 | |
583 | |
584 | x 14:9ad579b4a5de I
584 | x 14:9ad579b4a5de I
585 |/
585 |/
586 | o 12:acd174b7ab39 I
586 | o 12:acd174b7ab39 I
587 | |
587 | |
588 | o 11:6c11a6218c97 H
588 | o 11:6c11a6218c97 H
589 | |
589 | |
590 o | 10:b5313c85b22e D
590 o | 10:b5313c85b22e D
591 |/
591 |/
592 | o 8:53a6a128b2b7 M
592 | o 8:53a6a128b2b7 M
593 | |\
593 | |\
594 | | x 7:02de42196ebe H
594 | | x 7:02de42196ebe H
595 | | |
595 | | |
596 o---+ 6:eea13746799a G
596 o---+ 6:eea13746799a G
597 | | |
597 | | |
598 | | o 5:24b6387c8c8c F
598 | | o 5:24b6387c8c8c F
599 | | |
599 | | |
600 o---+ 4:9520eea781bc E
600 o---+ 4:9520eea781bc E
601 / /
601 / /
602 x | 3:32af7686d403 D
602 x | 3:32af7686d403 D
603 | |
603 | |
604 o | 2:5fddd98957c8 C
604 o | 2:5fddd98957c8 C
605 | |
605 | |
606 o | 1:42ccdea3bb16 B
606 o | 1:42ccdea3bb16 B
607 |/
607 |/
608 o 0:cd010b8cd998 A
608 o 0:cd010b8cd998 A
609
609
610 $ hg rebase -s 14 -d 18 --config experimental.rebaseskipobsolete=True
610 $ hg rebase -s 14 -d 18 --config experimental.rebaseskipobsolete=True
611 note: not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K"
611 note: not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K"
612 rebasing 15:5ae8a643467b "J"
612 rebasing 15:5ae8a643467b "J"
613
613
614 $ cd ..
614 $ cd ..
615
615
616 Skip obsolete changeset even with multiple hops
616 Skip obsolete changeset even with multiple hops
617 -----------------------------------------------
617 -----------------------------------------------
618
618
619 setup
619 setup
620
620
621 $ hg init obsskip
621 $ hg init obsskip
622 $ cd obsskip
622 $ cd obsskip
623 $ cat << EOF >> .hg/hgrc
623 $ cat << EOF >> .hg/hgrc
624 > [experimental]
624 > [experimental]
625 > rebaseskipobsolete = True
625 > rebaseskipobsolete = True
626 > [extensions]
626 > [extensions]
627 > strip =
627 > strip =
628 > EOF
628 > EOF
629 $ echo A > A
629 $ echo A > A
630 $ hg add A
630 $ hg add A
631 $ hg commit -m A
631 $ hg commit -m A
632 $ echo B > B
632 $ echo B > B
633 $ hg add B
633 $ hg add B
634 $ hg commit -m B0
634 $ hg commit -m B0
635 $ hg commit --amend -m B1
635 $ hg commit --amend -m B1
636 $ hg commit --amend -m B2
636 $ hg commit --amend -m B2
637 $ hg up --hidden 'desc(B0)'
637 $ hg up --hidden 'desc(B0)'
638 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
638 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
639 $ echo C > C
639 $ echo C > C
640 $ hg add C
640 $ hg add C
641 $ hg commit -m C
641 $ hg commit -m C
642
642
643 Rebase finds its way in a chain of marker
643 Rebase finds its way in a chain of marker
644
644
645 $ hg rebase -d 'desc(B2)'
645 $ hg rebase -d 'desc(B2)'
646 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
646 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 3:261e70097290 "B2"
647 rebasing 4:212cb178bcbb "C" (tip)
647 rebasing 4:212cb178bcbb "C" (tip)
648
648
649 Even when the chain include missing node
649 Even when the chain include missing node
650
650
651 $ hg up --hidden 'desc(B0)'
651 $ hg up --hidden 'desc(B0)'
652 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
652 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
653 $ echo D > D
653 $ echo D > D
654 $ hg add D
654 $ hg add D
655 $ hg commit -m D
655 $ hg commit -m D
656 $ hg --hidden strip -r 'desc(B1)'
656 $ hg --hidden strip -r 'desc(B1)'
657 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg (glob)
657 saved backup bundle to $TESTTMP/obsskip/.hg/strip-backup/86f6414ccda7-b1c452ee-backup.hg (glob)
658
658
659 $ hg rebase -d 'desc(B2)'
659 $ hg rebase -d 'desc(B2)'
660 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
660 note: not rebasing 1:a8b11f55fb19 "B0", already in destination as 2:261e70097290 "B2"
661 rebasing 5:1a79b7535141 "D" (tip)
661 rebasing 5:1a79b7535141 "D" (tip)
662 $ hg up 4
662 $ hg up 4
663 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
663 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
664 $ echo "O" > O
664 $ echo "O" > O
665 $ hg add O
665 $ hg add O
666 $ hg commit -m O
666 $ hg commit -m O
667 $ echo "P" > P
667 $ echo "P" > P
668 $ hg add P
668 $ hg add P
669 $ hg commit -m P
669 $ hg commit -m P
670 $ hg log -G
670 $ hg log -G
671 @ 8:8d47583e023f P
671 @ 8:8d47583e023f P
672 |
672 |
673 o 7:360bbaa7d3ce O
673 o 7:360bbaa7d3ce O
674 |
674 |
675 | o 6:9c48361117de D
675 | o 6:9c48361117de D
676 | |
676 | |
677 o | 4:ff2c4d47b71d C
677 o | 4:ff2c4d47b71d C
678 |/
678 |/
679 o 2:261e70097290 B2
679 o 2:261e70097290 B2
680 |
680 |
681 o 0:4a2df7238c3b A
681 o 0:4a2df7238c3b A
682
682
683 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=all
683 $ hg debugobsolete `hg log -r 7 -T '{node}\n'` --config experimental.evolution=all
684 $ hg rebase -d 6 -r "4::"
684 $ hg rebase -d 6 -r "4::"
685 rebasing 4:ff2c4d47b71d "C"
685 rebasing 4:ff2c4d47b71d "C"
686 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
686 note: not rebasing 7:360bbaa7d3ce "O", it has no successor
687 rebasing 8:8d47583e023f "P" (tip)
687 rebasing 8:8d47583e023f "P" (tip)
688
688
689 If all the changeset to be rebased are obsolete and present in the destination, we
689 If all the changeset to be rebased are obsolete and present in the destination, we
690 should display a friendly error message
690 should display a friendly error message
691
691
692 $ hg log -G
692 $ hg log -G
693 @ 10:121d9e3bc4c6 P
693 @ 10:121d9e3bc4c6 P
694 |
694 |
695 o 9:4be60e099a77 C
695 o 9:4be60e099a77 C
696 |
696 |
697 o 6:9c48361117de D
697 o 6:9c48361117de D
698 |
698 |
699 o 2:261e70097290 B2
699 o 2:261e70097290 B2
700 |
700 |
701 o 0:4a2df7238c3b A
701 o 0:4a2df7238c3b A
702
702
703
703
704 $ hg up 9
704 $ hg up 9
705 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
705 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
706 $ echo "non-relevant change" > nonrelevant
706 $ echo "non-relevant change" > nonrelevant
707 $ hg add nonrelevant
707 $ hg add nonrelevant
708 $ hg commit -m nonrelevant
708 $ hg commit -m nonrelevant
709 created new head
709 created new head
710 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=all
710 $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=all
711 $ hg rebase -r . -d 10
711 $ hg rebase -r . -d 10
712 abort: all requested changesets have equivalents or were marked as obsolete
712 abort: all requested changesets have equivalents or were marked as obsolete
713 (to force the rebase, set the config experimental.rebaseskipobsolete to False)
713 (to force the rebase, set the config experimental.rebaseskipobsolete to False)
714 [255]
714 [255]
715
716 If a rebase is going to create divergence, it should abort
717
718 $ hg log -G
719 @ 11:f44da1f4954c nonrelevant
720 |
721 | o 10:121d9e3bc4c6 P
722 |/
723 o 9:4be60e099a77 C
724 |
725 o 6:9c48361117de D
726 |
727 o 2:261e70097290 B2
728 |
729 o 0:4a2df7238c3b A
730
731
732 $ hg up 9
733 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
734 $ echo "john" > doe
735 $ hg add doe
736 $ hg commit -m "john doe"
737 created new head
738 $ hg up 10
739 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
740 $ echo "foo" > bar
741 $ hg add bar
742 $ hg commit --amend -m "10'"
743 $ hg up 10 --hidden
744 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
745 $ echo "bar" > foo
746 $ hg add foo
747 $ hg commit -m "bar foo"
748 $ hg log -G
749 @ 15:73568ab6879d bar foo
750 |
751 | o 14:77d874d096a2 10'
752 | |
753 | | o 12:3eb461388009 john doe
754 | |/
755 x | 10:121d9e3bc4c6 P
756 |/
757 o 9:4be60e099a77 C
758 |
759 o 6:9c48361117de D
760 |
761 o 2:261e70097290 B2
762 |
763 o 0:4a2df7238c3b A
764
765 $ hg summary
766 parent: 15:73568ab6879d tip
767 bar foo
768 branch: default
769 commit: (clean)
770 update: 2 new changesets, 3 branch heads (merge)
771 phases: 8 draft
772 unstable: 1 changesets
773 $ hg rebase -s 10 -d 12
774 abort: this rebase will cause divergence
775 (to force the rebase please set rebase.allowdivergence=True)
776 [255]
777 $ hg log -G
778 @ 15:73568ab6879d bar foo
779 |
780 | o 14:77d874d096a2 10'
781 | |
782 | | o 12:3eb461388009 john doe
783 | |/
784 x | 10:121d9e3bc4c6 P
785 |/
786 o 9:4be60e099a77 C
787 |
788 o 6:9c48361117de D
789 |
790 o 2:261e70097290 B2
791 |
792 o 0:4a2df7238c3b A
793
794 With rebase.allowdivergence=True, rebase can create divergence
795
796 $ hg rebase -s 10 -d 12 --config rebase.allowdivergence=True
797 rebasing 10:121d9e3bc4c6 "P"
798 rebasing 15:73568ab6879d "bar foo" (tip)
799 $ hg summary
800 parent: 17:61bd55f69bc4 tip
801 bar foo
802 branch: default
803 commit: (clean)
804 update: 1 new changesets, 2 branch heads (merge)
805 phases: 8 draft
806 divergent: 2 changesets
807
General Comments 0
You need to be logged in to leave comments. Login now