##// END OF EJS Templates
rebase: drop unnecessary parentchange call...
r32589:51784176 default
Show More
commands.py
5500 lines | 197.5 KiB | text/x-python | PythonLexer
mpm@selenic.com
import and startup cleanups...
r249 # commands.py - command processing for mercurial
#
Thomas Arendsen Hein
Updated copyright notices and add "and others" to "hg version"
r4635 # Copyright 2005-2007 Matt Mackall <mpm@selenic.com>
mpm@selenic.com
import and startup cleanups...
r249 #
Martin Geisler
updated license to be explicit about GPL version 2
r8225 # This software may be used and distributed according to the terms of the
Matt Mackall
Update license to GPLv2+
r10263 # GNU General Public License version 2 or any later version.
mpm@selenic.com
import and startup cleanups...
r249
Gregory Szorc
commands: use absolute_import...
r28323 from __future__ import absolute_import
import difflib
import errno
import os
import re
Yuya Nishihara
help: pass commands module by argument...
r32567 import sys
Gregory Szorc
commands: use absolute_import...
r28323
from .i18n import _
from .node import (
hex,
nullid,
nullrev,
short,
)
from . import (
archival,
bookmarks,
bundle2,
changegroup,
cmdutil,
copies,
Yuya Nishihara
debugcommands: use temporary dict for its command table...
r32377 debugcommands as debugcommandsmod,
Gregory Szorc
commands: use absolute_import...
r28323 destutil,
Augie Fackler
commands: refer to dirstateguard by its new name
r30491 dirstateguard,
Gregory Szorc
commands: use absolute_import...
r28323 discovery,
encoding,
error,
exchange,
extensions,
Yuya Nishihara
cat: add formatter support...
r32578 formatter,
Gregory Szorc
commands: use absolute_import...
r28323 graphmod,
hbisect,
help,
hg,
lock as lockmod,
merge as mergemod,
obsolete,
patch,
phases,
Pulkit Goyal
py3: use pycompat.ossep at certain places...
r30304 pycompat,
Jun Wu
rcutil: move scmutil.*rcpath to rcutil (API)...
r31679 rcutil,
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 registrar,
Yuya Nishihara
revset: split language services to revsetlang module (API)...
r31024 revsetlang,
Gregory Szorc
commands: use absolute_import...
r28323 scmutil,
Yuya Nishihara
server: move cmdutil.service() to new module (API)...
r30506 server,
Gregory Szorc
commands: use absolute_import...
r28323 sshserver,
streamclone,
Pierre-Yves David
tags: use the 'tag' function from the 'tags' module in the 'tag' command...
r31670 tags as tagsmod,
Gregory Szorc
commands: use absolute_import...
r28323 templatekw,
ui as uimod,
util,
)
release = lockmod.release
Matt Mackall
Kill ui.setconfig_remoteopts...
r2731
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 table = {}
Yuya Nishihara
debugcommands: use temporary dict for its command table...
r32377 table.update(debugcommandsmod.command._table)
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 command = registrar.command(table)
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297
Ryan McElroy
bookmarks: name label for active bookmark correctly...
r25347 # label constants
# until 3.5, bookmarks.current was the advertised name, not
# bookmarks.active, so we must use both to avoid breaking old
# custom styles
activebookmarklabel = 'bookmarks.active bookmarks.current'
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 # common command options
globalopts = [
('R', 'repository', '',
_('repository root directory or name of overlay bundle file'),
_('REPO')),
('', 'cwd', '',
_('change working directory'), _('DIR')),
('y', 'noninteractive', None,
Martin Geisler
commands: improve help for -y/--noninteractive...
r14849 _('do not prompt, automatically pick the first choice for all prompts')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('q', 'quiet', None, _('suppress output')),
('v', 'verbose', None, _('enable additional output')),
Pierre-Yves David
color: add a 'ui.color' option to control color behavior...
r31110 ('', 'color', '',
Pierre-Yves David
color: add the definition of '--color' in core...
r31104 # i18n: 'always', 'auto', 'never', and 'debug' are keywords
# and should not be translated
Pierre-Yves David
color: update main documentation...
r31123 _("when to colorize (boolean, always, auto, never, or debug)"),
Pierre-Yves David
color: add the definition of '--color' in core...
r31104 _('TYPE')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('', 'config', [],
_('set/override config option (use \'section.name=value\')'),
_('CONFIG')),
('', 'debug', None, _('enable debugging output')),
('', 'debugger', None, _('start debugger')),
('', 'encoding', encoding.encoding, _('set the charset encoding'),
_('ENCODE')),
('', 'encodingmode', encoding.encodingmode,
_('set the charset encoding mode'), _('MODE')),
('', 'traceback', None, _('always print a traceback on exception')),
('', 'time', None, _('time how long the command takes')),
('', 'profile', None, _('print command execution profile')),
('', 'version', None, _('output version information and exit')),
('h', 'help', None, _('display help and exit')),
Pierre-Yves David
clfilter: enforce hidden changeset globally...
r18267 ('', 'hidden', False, _('consider hidden changesets')),
Augie Fackler
pager: move more behavior into core...
r30993 ('', 'pager', 'auto',
_("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ]
Yuya Nishihara
commands: move templates of common command options to cmdutil (API)...
r32375 dryrunopts = cmdutil.dryrunopts
remoteopts = cmdutil.remoteopts
walkopts = cmdutil.walkopts
commitopts = cmdutil.commitopts
commitopts2 = cmdutil.commitopts2
formatteropts = cmdutil.formatteropts
templateopts = cmdutil.templateopts
logopts = cmdutil.logopts
diffopts = cmdutil.diffopts
diffwsopts = cmdutil.diffwsopts
diffopts2 = cmdutil.diffopts2
mergetoolopts = cmdutil.mergetoolopts
similarityopts = cmdutil.similarityopts
subrepoopts = cmdutil.subrepoopts
debugrevlogopts = cmdutil.debugrevlogopts
Gregory Szorc
commands: unify argument handling for revlog debug commands...
r27255
mpm@selenic.com
hg help: use docstrings only...
r255 # Commands start here, listed alphabetically
mpm@selenic.com
Beginning of new command parsing interface...
r209
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^add',
walkopts + subrepoopts + dryrunopts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... [FILE]...'),
inferrepo=True)
Bryan O'Sullivan
Get add and locate to use new repo and dirstate walk code....
r724 def add(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """add the specified files on the next commit
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Schedule files to be version controlled and added to the
repository.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Matt Mackall
Add doc notes about revert and hg status vs diff
r3829 The files will be added to the repository at the next commit. To
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 undo an add before that, see :hg:`forget`.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
timeless
add: mention .hgignore in help
r27424 If no names are given, add all files to the repository (except
files matching ``.hgignore``).
Martin Geisler
commands: add verbose example to help text for add
r10446
.. container:: verbose
Mathias De Maré
commands: add example for 'hg add'
r27143 Examples:
- New (unknown) files are added
automatically by :hg:`add`::
$ ls
foo.c
$ hg status
? foo.c
$ hg add
adding foo.c
$ hg status
A foo.c
- Specific files to be added can be specified::
$ ls
bar.c foo.c
$ hg status
? bar.c
? foo.c
$ hg add bar.c
$ hg status
A bar.c
? foo.c
Nicolas Dumazet
commands: document return values of add and paths commands
r11507
Returns 0 if all files are successfully added.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts correctly for `hg add`...
r32147 m = scmutil.match(repo[None], pats, pycompat.byteskwargs(opts))
Matt Harbison
add: pass options via keyword args...
r23885 rejected = cmdutil.add(ui, repo, m, "", False, **opts)
Martin Geisler
add: move main part to cmdutil to make it easier to reuse
r12269 return rejected and 1 or 0
mpm@selenic.com
commands: migrate status and branch...
r213
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('addremove',
Matt Harbison
addremove: add support for the -S flag...
r23538 similarityopts + subrepoopts + walkopts + dryrunopts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... [FILE]...'),
inferrepo=True)
Bryan O'Sullivan
Get addremove to use new walk code....
r766 def addremove(ui, repo, *pats, **opts):
Thomas Arendsen Hein
Documentation fixes for addremove....
r3181 """add all new files, delete all missing files
Vadim Gelfer
deprecate addremove command.
r2181
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Add all new files and remove all missing files from the
repository.
timeless
addremove: make help match add
r27425 Unless names are given, new files are ignored if they match any of
the patterns in ``.hgignore``. As with add, these changes take
effect at the next commit.
Vadim Gelfer
addremove: add -s/--similarity option...
r2958
Patrick Mezard
addremove: mention --similarity defaults to 100 (issue3430)
r17266 Use the -s/--similarity option to detect renamed files. This
Martin Geisler
commands: wrap docstrings at 70 characters...
r9249 option takes a percentage between 0 (disabled) and 100 (files must
Patrick Mezard
addremove: mention --similarity defaults to 100 (issue3430)
r17266 be identical) as its parameter. With a parameter greater than 0,
this compares every removed file with every added file and records
those similar enough as renames. Detecting renamed files this way
Arnab Bose
commands: mention "hg status -C" in addremove help
r11518 can be expensive. After using this option, :hg:`status -C` can be
Patrick Mezard
addremove: mention --similarity defaults to 100 (issue3430)
r17266 used to check which files were identified as moved or renamed. If
not specified, -s/--similarity defaults to 100 and only renames of
identical files are detected.
Matt Mackall
commands: initial audit of exit codes...
r11177
Mathias De Maré
commands: add examples for 'addremove'
r27144 .. container:: verbose
Examples:
- A number of files (bar.c and foo.c) are new,
while foobar.c has been removed (without using :hg:`remove`)
from the repository::
$ ls
bar.c foo.c
$ hg status
! foobar.c
? bar.c
? foo.c
$ hg addremove
adding bar.c
adding foo.c
removing foobar.c
$ hg status
A bar.c
A foo.c
R foobar.c
- A file foobar.c was moved to foo.c without using :hg:`rename`.
Afterwards, it was edited slightly::
$ ls
foo.c
$ hg status
! foobar.c
? foo.c
$ hg addremove --similarity 90
removing foobar.c
adding foo.c
recording removal of foobar.c as rename to foo.c (94% similar)
$ hg status -C
A foo.c
foobar.c
R foobar.c
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 if all files are successfully added.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Bryan O'Sullivan
addremove: print meaningful error message if --similar not numeric
r4966 try:
Dirkjan Ochtman
commands: addremove does similarity 100 by default
r11551 sim = float(opts.get('similarity') or 100)
Bryan O'Sullivan
addremove: print meaningful error message if --similar not numeric
r4966 except ValueError:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('similarity must be a number'))
Vadim Gelfer
addremove: add -s/--similarity option...
r2958 if sim < 0 or sim > 100:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('similarity must be between 0 and 100'))
Matt Harbison
scmutil: pass a matcher to scmutil.addremove() instead of a list of patterns...
r23533 matcher = scmutil.match(repo[None], pats, opts)
Matt Harbison
commit: propagate --addremove to subrepos if -S is specified (issue3759)...
r23537 return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0)
mpm@selenic.com
hg checkout: refuse to checkout if there are outstanding changes...
r219
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^annotate|blame',
[('r', 'rev', '', _('annotate the specified revision'), _('REV')),
('', 'follow', None,
_('follow copies/renames and list the filename (DEPRECATED)')),
('', 'no-follow', None, _("don't follow copies and renames")),
('a', 'text', None, _('treat all files as text')),
('u', 'user', None, _('list the author (long with -v)')),
('f', 'file', None, _('list the filename')),
('d', 'date', None, _('list the date (short with -q)')),
('n', 'number', None, _('list the revision number (default)')),
('c', 'changeset', None, _('list the changeset')),
Siddharth Agarwal
annotate: add a new experimental --skip option to skip revs...
r32486 ('l', 'line-number', None, _('show line number at the first appearance')),
('', 'skip', [], _('revision to not display (EXPERIMENTAL)'), _('REV')),
Yuya Nishihara
annotate: port to generic templater enabled by hidden -T option...
r22480 ] + diffwsopts + walkopts + formatteropts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[-r REV] [-f] [-a] [-u] [-d] [-n] [-c] [-l] FILE...'),
inferrepo=True)
Bryan O'Sullivan
Convert annotate over to walk interface....
r733 def annotate(ui, repo, *pats, **opts):
timeless
Improve English for help text of many core hg commands....
r8779 """show changeset information by line for each file
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 List changes in files, showing the revision id responsible for
timeless
annotate: add missing period to help
r27426 each line.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004
timeless
Improve English for help text of many core hg commands....
r8779 This command is useful for discovering when a change was made and
by whom.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
timeless
annotate: mention that -n is suppressed in help
r27540 If you include --file, --user, or --date, the revision number is
suppressed unless you also include --number.
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Without the -a/--text option, annotate will avoid processing files
timeless
Improve English for help text of many core hg commands....
r8779 it detects as binary. With -a, annotate will annotate the file
anyway, although the results will probably be neither useful
nor desirable.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Yuya Nishihara
annotate: abort early if no file is specified...
r22266 if not pats:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('at least one filename or pattern is required'))
Yuya Nishihara
annotate: abort early if no file is specified...
r22266
Thomas Arendsen Hein
Make annotate --follow an alias for -f/--file to behave like in older versions...
r10579 if opts.get('follow'):
# --follow is deprecated and now just an alias for -f/--file
# to mimic the behavior of Mercurial before version 1.5
Martin Geisler
annotate: use real Booleans instead of 0/1
r14216 opts['file'] = True
Thomas Arendsen Hein
Make annotate --follow an alias for -f/--file to behave like in older versions...
r10579
Yuya Nishihara
annotate: add option to annotate working-directory files...
r24421 ctx = scmutil.revsingle(repo, opts.get('rev'))
Yuya Nishihara
annotate: port to generic templater enabled by hidden -T option...
r22480 fm = ui.formatter('annotate', opts)
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 if ui.quiet:
datefunc = util.shortdate
else:
datefunc = util.datestr
Yuya Nishihara
annotate: add option to annotate working-directory files...
r24421 if ctx.rev() is None:
def hexfn(node):
if node is None:
return None
else:
return fm.hexfunc(node)
if opts.get('changeset'):
# omit "+" suffix which is appended to node hex
def formatrev(rev):
if rev is None:
return '%d' % ctx.p1().rev()
else:
return '%d' % rev
else:
def formatrev(rev):
if rev is None:
return '%d+' % ctx.p1().rev()
else:
return '%d ' % rev
def formathex(hex):
if hex is None:
return '%s+' % fm.hexfunc(ctx.p1().node())
else:
return '%s ' % hex
else:
hexfn = fm.hexfunc
formatrev = formathex = str
Ion Savin
annotate: show full changeset hash when invoked with --debug and -c
r15631
Yuya Nishihara
annotate: split functions to get data without applying text formatting...
r22479 opmap = [('user', ' ', lambda x: x[0].user(), ui.shortuser),
Yuya Nishihara
annotate: add option to annotate working-directory files...
r24421 ('number', ' ', lambda x: x[0].rev(), formatrev),
('changeset', ' ', lambda x: hexfn(x[0].node()), formathex),
Yuya Nishihara
annotate: split functions to get data without applying text formatting...
r22479 ('date', ' ', lambda x: x[0].date(), util.cachefunc(datefunc)),
('file', ' ', lambda x: x[0].path(), str),
('line_number', ':', lambda x: x[1], str),
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 ]
Yuya Nishihara
annotate: port to generic templater enabled by hidden -T option...
r22480 fieldnamemap = {'number': 'rev', 'changeset': 'node'}
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857
Matt Mackall
many, many trivial check-code fixups
r10282 if (not opts.get('user') and not opts.get('changeset')
Dirkjan Ochtman
commands: annotate follows by default, separate -f/--file option
r10369 and not opts.get('date') and not opts.get('file')):
Martin Geisler
annotate: use real Booleans instead of 0/1
r14216 opts['number'] = True
mpm@selenic.com
Beginning of new command parsing interface...
r209
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 linenumber = opts.get('line_number') is not None
Benoit Boissinot
fix coding style (reported by pylint)
r10394 if linenumber and (not opts.get('changeset')) and (not opts.get('number')):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('at least one of -n/-c is required for -l'))
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857
Augie Fackler
annotate: start pager after we're sure we wont abort...
r31028 ui.pager('annotate')
Mathias De Maré
formatter: introduce isplain() to replace (the inverse of) __nonzero__() (API)...
r29949 if fm.isplain():
def makefunc(get, fmt):
return lambda x: fmt(get(x))
else:
Yuya Nishihara
annotate: port to generic templater enabled by hidden -T option...
r22480 def makefunc(get, fmt):
return get
Yuya Nishihara
annotate: split functions to get data without applying text formatting...
r22479 funcmap = [(makefunc(get, fmt), sep) for op, sep, get, fmt in opmap
if opts.get(op)]
Thomas Arendsen Hein
annotate: fix alignment of columns in front of line numbers (issue2807)
r14358 funcmap[0] = (funcmap[0][0], '') # no separator in front of first column
Yuya Nishihara
annotate: port to generic templater enabled by hidden -T option...
r22480 fields = ' '.join(fieldnamemap.get(op, op) for op, sep, get, fmt in opmap
if opts.get(op))
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857
Matt Mackall
annotate: catch nonexistent files using match.bad callback (issue1590)
r13697 def bad(x, y):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort("%s: %s" % (x, y))
Matt Mackall
annotate: catch nonexistent files using match.bad callback (issue1590)
r13697
Matt Harbison
commands: use the optional badfn argument when building a matcher
r25468 m = scmutil.match(ctx, pats, opts, badfn=bad)
Dirkjan Ochtman
commands: annotate follows by default, separate -f/--file option
r10369 follow = not opts.get('no_follow')
Siddharth Agarwal
annotate: explicitly only honor whitespace diffopts...
r23455 diffopts = patch.difffeatureopts(ui, opts, section='annotate',
whitespace=True)
Siddharth Agarwal
annotate: add a new experimental --skip option to skip revs...
r32486 skiprevs = opts.get('skip')
if skiprevs:
skiprevs = scmutil.revrange(repo, skiprevs)
Matt Mackall
context: add walk method
r6764 for abs in ctx.walk(m):
fctx = ctx[abs]
Jun Wu
annotate: use fctx.isbinary
r32135 if not opts.get('text') and fctx.isbinary():
Yuya Nishihara
annotate: port to generic templater enabled by hidden -T option...
r22480 fm.plain(_("%s: binary file\n") % ((pats and m.rel(abs)) or abs))
mpm@selenic.com
Teach annotate about binary files
r1016 continue
Patrick Mezard
annotate: support diff whitespace filtering flags (issue3030)...
r15528 lines = fctx.annotate(follow=follow, linenumber=linenumber,
Siddharth Agarwal
annotate: add a new experimental --skip option to skip revs...
r32486 skiprevs=skiprevs, diffopts=diffopts)
Denis Laxalde
annotate: handle empty files earlier...
r29528 if not lines:
continue
Yuya Nishihara
annotate: build format string separately from annotation data...
r22477 formats = []
mpm@selenic.com
Beginning of new command parsing interface...
r209 pieces = []
Thomas Arendsen Hein
annotate: fix alignment of columns in front of line numbers (issue2807)
r14358 for f, sep in funcmap:
Thomas Arendsen Hein
Add --line-number option to hg annotate (issue506)...
r4857 l = [f(n) for n, dummy in lines]
Mathias De Maré
formatter: introduce isplain() to replace (the inverse of) __nonzero__() (API)...
r29949 if fm.isplain():
Denis Laxalde
annotate: handle empty files earlier...
r29528 sizes = [encoding.colwidth(x) for x in l]
ml = max(sizes)
formats.append([sep + ' ' * (ml - w) + '%s' for w in sizes])
Mathias De Maré
formatter: introduce isplain() to replace (the inverse of) __nonzero__() (API)...
r29949 else:
formats.append(['%s' for x in l])
Denis Laxalde
annotate: handle empty files earlier...
r29528 pieces.append(l)
Yuya Nishihara
annotate: build format string separately from annotation data...
r22477
for f, p, l in zip(zip(*formats), zip(*pieces), lines):
Yuya Nishihara
annotate: port to generic templater enabled by hidden -T option...
r22480 fm.startitem()
fm.write(fields, "".join(f), *p)
fm.write('line', ": %s", l[1])
Yuya Nishihara
annotate: remove redundant check for empty list of annotation data...
r22452
Denis Laxalde
annotate: handle empty files earlier...
r29528 if not lines[-1][1].endswith('\n'):
Yuya Nishihara
annotate: port to generic templater enabled by hidden -T option...
r22480 fm.plain('\n')
fm.end()
Ion Savin
annotate: append newline after non newline-terminated file listings...
r15829
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('archive',
[('', 'no-decode', None, _('do not pass files through decoders')),
('p', 'prefix', '', _('directory prefix for files in archive'),
_('PREFIX')),
('r', 'rev', '', _('revision to distribute'), _('REV')),
('t', 'type', '', _('type of distribution to create'), _('TYPE')),
] + subrepoopts + walkopts,
_('[OPTION]... DEST'))
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 def archive(ui, repo, dest, **opts):
timeless
Improve English for help text of many core hg commands....
r8779 '''create an unversioned archive of a repository revision
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112
By default, the revision used is the parent of the working
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 directory; use -r/--rev to specify a different revision.
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650 The archive type is automatically detected based on file
timeless
archive: adjust help text
r27427 extension (to override, use -t/--type).
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650
Matt Mackall
archive: add help examples
r15109 .. container:: verbose
Examples:
- create a zip file containing the 1.0 release::
hg archive -r 1.0 project-1.0.zip
- create a tarball excluding .hg files::
hg archive project.tar.gz -X ".hg*"
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650 Valid types are:
Martin Geisler
commands: use field lists instead of literal blocks in docstrings...
r9892
:``files``: a directory full of files (default)
:``tar``: tar archive, uncompressed
:``tbz2``: tar archive, compressed using bzip2
:``tgz``: tar archive, compressed using gzip
:``uzip``: zip archive, uncompressed
:``zip``: zip archive, compressed using deflate
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112
The exact name of the destination archive or directory is given
Martin Geisler
Use hg role in help strings
r10973 using a format string; see :hg:`help export` for details.
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112
Each member added to an archive file has a directory prefix
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 prepended. Use -p/--prefix to specify a format string for the
prefix. The default is the basename of the archive, with suffixes
removed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112 '''
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 ctx = scmutil.revsingle(repo, opts.get('rev'))
Brendan Cully
archive: abort on empty repository. Fixes #624.
r5061 if not ctx:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no working directory: please specify a revision'))
Brendan Cully
archive: abort on empty repository. Fixes #624.
r5061 node = ctx.node()
Matt Mackall
cmdutil: make_filename -> makefilename
r14290 dest = cmdutil.makefilename(repo, dest, node)
Matt Mackall
backout dbdb777502dc (issue3077) (issue3071)...
r15381 if os.path.realpath(dest) == repo.root:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('repository root cannot be destination'))
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650
Martin Geisler
archival: move commands.archive.guess_type to archival.guesskind...
r11557 kind = opts.get('type') or archival.guesskind(dest) or 'files'
Alexander Solovyov
commands: optional options where possible...
r7131 prefix = opts.get('prefix')
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650
Vadim Gelfer
archive: make "hg archive -t XXX -" to write to stdout
r2476 if dest == '-':
if kind == 'files':
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot archive plain files to stdout'))
Idan Kamara
archive: wrap the ui descriptor so it doesn't get closed...
r14742 dest = cmdutil.makefileobj(repo, dest)
Matt Mackall
many, many trivial check-code fixups
r10282 if not prefix:
prefix = os.path.basename(repo.root) + '-%h'
David Wolever
archive: autodetect archive type by extension (issue2058)
r10650
Matt Mackall
cmdutil: make_filename -> makefilename
r14290 prefix = cmdutil.makefilename(repo, prefix, node)
Matt Mackall
scmutil: switch match users to supplying contexts...
r14671 matchfn = scmutil.match(ctx, [], opts)
Alexander Solovyov
commands: optional options where possible...
r7131 archival.archive(repo, dest, node, kind, not opts.get('no_decode'),
Martin Geisler
subrepo: add support for 'hg archive'
r12323 matchfn, prefix, subrepos=opts.get('subrepos'))
Vadim Gelfer
add "archive" command, like "cvs export" only better....
r2112
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('backout',
[('', 'merge', None, _('merge with old dirstate parent after backout')),
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890 ('', 'commit', None,
_('commit if no conflicts were encountered (DEPRECATED)')),
('', 'no-commit', None, _('do not commit')),
Matt Mackall
backout: deprecate/hide support for backing out merges...
r15211 ('', 'parent', '',
_('parent to choose when backing out merge (DEPRECATED)'), _('REV')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('r', 'rev', '', _('revision to backout'), _('REV')),
FUJIWARA Katsunori
backout: accept '--edit' like other commands creating new changeset...
r21712 ('e', 'edit', False, _('invoke editor on commit messages')),
Martin Geisler
commands: use mergetoolopts when a command supports --tool
r14852 ] + mergetoolopts + walkopts + commitopts + commitopts2,
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 _('[OPTION]... [-r] REV'))
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890 def backout(ui, repo, node=None, rev=None, **opts):
Vadim Gelfer
add backout command....
r2158 '''reverse effect of earlier changeset
Jonathan Nieder
backout: make help more explicit about what backout does...
r13340 Prepare a new changeset with the effect of REV undone in the
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890 current working directory. If no conflicts were encountered,
it will be committed immediately.
Jonathan Nieder
backout: make help more explicit about what backout does...
r13340
Jonathan Nieder
backout: clarify which changesets are new in help text...
r13473 If REV is the parent of the working directory, then this new changeset
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890 is committed automatically (unless --no-commit is specified).
Jonathan Nieder
backout: make help more explicit about what backout does...
r13340
Matt Mackall
backout: add a note about not working on merges
r15210 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
timeless
commands: the first word of each note should be capital or `hg`
r27476 :hg:`backout` cannot be used to fix either an unwanted or
timeless
commands: consistently indent notes 3 spaces...
r27471 incorrect merge.
Matt Mackall
backout: add a note about not working on merges
r15210
Matt Mackall
backout: mark some help verbose
r15209 .. container:: verbose
Mathias De Maré
backout: add examples to clarify basic usage
r27118 Examples:
- Reverse the effect of the parent of the working directory.
This backout will be committed immediately::
hg backout -r .
- Reverse the effect of previous bad revision 23::
hg backout -r 23
- Reverse the effect of previous bad revision 23 and
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890 leave changes uncommitted::
hg backout -r 23 --no-commit
hg commit -m "Backout revision 23"
Mathias De Maré
backout: add examples to clarify basic usage
r27118
Matt Mackall
backout: mark some help verbose
r15209 By default, the pending changeset will have one parent,
maintaining a linear history. With --merge, the pending
changeset will instead have two parents: the old parent of the
working directory and a new child of REV that simply undoes REV.
Before version 1.7, the behavior without --merge was equivalent
to specifying --merge followed by :hg:`update --clean .` to
cancel the merge and leave the child of REV as a head to be
merged separately.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Matt Mackall
commands: initial audit of exit codes...
r11177
Mathias De Maré
backout: add reference to revert
r26476 See :hg:`help revert` for a way to restore files to the state
of another revision.
Yuya Nishihara
backout: correct commit status of no changes made (BC) (issue4190)...
r20872 Returns 0 on success, 1 if nothing to backout or there are unresolved
files.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163 '''
FUJIWARA Katsunori
commands: make backout acquire locks before processing...
r27193 wlock = lock = None
try:
wlock = repo.wlock()
lock = repo.lock()
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890 return _dobackout(ui, repo, node, rev, **opts)
FUJIWARA Katsunori
commands: make backout acquire locks before processing...
r27193 finally:
release(lock, wlock)
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890 def _dobackout(ui, repo, node=None, rev=None, **opts):
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890 if opts.get('commit') and opts.get('no_commit'):
raise error.Abort(_("cannot use --commit with --no-commit"))
Yuya Nishihara
backout: disable --merge with --no-commit (issue4874)...
r27954 if opts.get('merge') and opts.get('no_commit'):
raise error.Abort(_("cannot use --merge with --no-commit"))
Ruslan Sayfutdinov
backout: commit changeset by default (BC)...
r27890
Daniel Holth
accept -r REV in more places...
r4450 if rev and node:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("please specify just one revision"))
Daniel Holth
accept -r REV in more places...
r4450
if not rev:
rev = node
Vadim Gelfer
add backout command....
r2158
Thomas Arendsen Hein
Fix and test 'hg backout' without or with too many revisions.
r4726 if not rev:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("please specify a revision to backout"))
Thomas Arendsen Hein
Fix and test 'hg backout' without or with too many revisions.
r4726
Thomas Arendsen Hein
Fix bad behaviour when specifying an invalid date (issue700)...
r6139 date = opts.get('date')
if date:
opts['date'] = util.parsedate(date)
Matt Mackall
commands: add checks for unfinished operations (issue3955)...
r19476 cmdutil.checkunfinished(repo)
Matt Mackall
cmdutil: bail_if_changed to bailifchanged
r14289 cmdutil.bailifchanged(repo)
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 node = scmutil.revsingle(repo, rev).node()
Matt Mackall
cmdutil: make bail_if_changed bail on uncommitted merge
r5716
Vadim Gelfer
add backout command....
r2158 op1, op2 = repo.dirstate.parents()
Mads Kiilerich
revlog: introduce isancestor method for efficiently determining node lineage...
r22381 if not repo.changelog.isancestor(node, op1):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot backout change that is not an ancestor'))
Matt Mackall
backout: disallow across branches (issue655)
r5568
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 p1, p2 = repo.changelog.parents(node)
if p1 == nullid:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot backout a change with no parents'))
Vadim Gelfer
add backout command....
r2158 if p2 != nullid:
Alexander Solovyov
commands: optional options where possible...
r7131 if not opts.get('parent'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot backout a merge changeset'))
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 p = repo.lookup(opts['parent'])
if p not in (p1, p2):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('%s is not a parent of %s') %
Thomas Arendsen Hein
Indentation cleanups for 2956948b81f3.
r3680 (short(p), short(node)))
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 parent = p
else:
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('parent'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot use --parent on non-merge changeset'))
Vadim Gelfer
backout: allow backout of merge changeset with --parent option....
r2614 parent = p1
Matt Mackall
backout: disallow across branches (issue655)
r5568
Matt Mackall
backout: reverse changeset belongs on current branch...
r6423 # the backout should appear on the same branch
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dobackout...
r27709 branch = repo.dirstate.branch()
bheads = repo.branchheads(branch)
rctx = scmutil.revsingle(repo, hex(parent))
if not opts.get('merge') and op1 != node:
Augie Fackler
commands: refer to dirstateguard by its new name
r30491 dsguard = dirstateguard.dirstateguard(repo, 'backout')
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dobackout...
r27709 try:
ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
'backout')
stats = mergemod.update(repo, parent, True, True, node, False)
repo.setparents(op1, op2)
dsguard.close()
hg._showstats(repo, stats)
if stats[3]:
repo.ui.status(_("use 'hg resolve' to retry unresolved "
"file merges\n"))
return 1
finally:
ui.setconfig('ui', 'forcemerge', '', '')
lockmod.release(dsguard)
else:
hg.clean(repo, node, show_stats=False)
repo.dirstate.setbranch(branch)
cmdutil.revert(ui, repo, rctx, repo.dirstate.parents())
Ruslan Sayfutdinov
backout: fix --no-commit option (issue5054)
r27912 if opts.get('no_commit'):
msg = _("changeset %s backed out, "
"don't forget to commit.\n")
ui.status(msg % short(node))
return 0
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dobackout...
r27709
def commitfunc(ui, repo, message, match, opts):
editform = 'backout'
Pulkit Goyal
py3: convert kwargs' keys to str before passing in cmdutil.getcommiteditor
r32192 e = cmdutil.getcommiteditor(editform=editform,
**pycompat.strkwargs(opts))
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dobackout...
r27709 if not message:
# we don't translate commit messages
message = "Backed out changeset %s" % short(node)
e = cmdutil.getcommiteditor(edit=True, editform=editform)
return repo.commit(message, opts.get('user'), opts.get('date'),
match, editor=e)
newnode = cmdutil.commit(ui, repo, commitfunc, [], opts)
if not newnode:
ui.status(_("nothing changed\n"))
return 1
cmdutil.commitstatus(repo, newnode, branch, bheads)
def nice(node):
return '%d:%s' % (repo.changelog.rev(node), short(node))
ui.status(_('changeset %s backs out changeset %s\n') %
(nice(repo.changelog.tip()), nice(node)))
if opts.get('merge') and op1 != node:
hg.clean(repo, op1, show_stats=False)
ui.status(_('merging with changeset %s\n')
% nice(repo.changelog.tip()))
try:
ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
'backout')
return hg.merge(repo, hex(repo.changelog.tip()))
finally:
ui.setconfig('ui', 'forcemerge', '', '')
Gilles Moris
backout: provide linear backout as a default (without --merge option)...
r12727 return 0
Vadim Gelfer
add backout command....
r2158
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('bisect',
[('r', 'reset', False, _('reset bisect state')),
('g', 'good', False, _('mark changeset good')),
('b', 'bad', False, _('mark changeset bad')),
('s', 'skip', False, _('skip testing changeset')),
('e', 'extend', False, _('extend the bisect range')),
('c', 'command', '', _('use command to check changeset state'), _('CMD')),
('U', 'noupdate', False, _('do not update to target'))],
_("[-gbsr] [-U] [-c CMD] [REV]"))
Alexander Solovyov
bisect: ability to check revision with command
r7227 def bisect(ui, repo, rev=None, extra=None, command=None,
Benoit Boissinot
bisect: new command to extend the bisect range (issue2690)...
r13601 reset=None, good=None, bad=None, skip=None, extend=None,
noupdate=None):
Matt Mackall
bisect: make bisect a built-in command
r5775 """subdivision search of changesets
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 This command helps to find changesets which introduce problems. To
use, mark the earliest changeset you know exhibits the problem as
bad, then mark the latest changeset which is free from the problem
as good. Bisect will update your working directory to a revision
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 for testing (unless the -U/--noupdate option is specified). Once
timeless
Improve English for help text of many core hg commands....
r8779 you have performed tests, mark the working directory as good or
bad, and bisect will either update to another candidate changeset
Dirkjan Ochtman
bisect: expand help text to explain REV argument and --noupdate
r6928 or announce that it has found the bad revision.
Dirkjan Ochtman
clean up trailing spaces
r7184
Dirkjan Ochtman
bisect: expand help text to explain REV argument and --noupdate
r6928 As a shortcut, you can also use the revision argument to mark a
revision as good or bad without checking it out first.
Alexander Solovyov
bisect: ability to check revision with command
r7227
timeless
Improve English for help text of many core hg commands....
r8779 If you supply a command, it will be used for automatic bisection.
Bryan O'Sullivan
bisect: set HG_NODE when runing a command...
r16648 The environment variable HG_NODE will contain the ID of the
changeset being tested. The exit status of the command will be
used to mark revisions as good or bad: status 0 means good, 125
means to skip the revision, 127 (command not found) will abort the
bisection, and any other non-zero exit status means the revision
is bad.
Matt Mackall
commands: initial audit of exit codes...
r11177
"Yann E. MORIN"
bisect: add some bisection examples, and some log revset.bisect() examples...
r15139 .. container:: verbose
Some examples:
Santiago Pay=C3=A0 i Miralta
help: fix backwards bisect help example
r20151 - start a bisection with known bad revision 34, and good revision 12::
"Yann E. MORIN"
bisect: add some bisection examples, and some log revset.bisect() examples...
r15139
hg bisect --bad 34
hg bisect --good 12
- advance the current bisection by marking current revision as good or
bad::
hg bisect --good
hg bisect --bad
Mads Kiilerich
fix trivial spelling errors
r17424 - mark the current revision, or a known revision, to be skipped (e.g. if
"Yann E. MORIN"
bisect: add some bisection examples, and some log revset.bisect() examples...
r15139 that revision is not usable because of another issue)::
hg bisect --skip
hg bisect --skip 23
FUJIWARA Katsunori
doc: end line preceding command line example with double colon
r19958 - skip all revisions that do not touch directories ``foo`` or ``bar``::
Jordi Gutiérrez Hermoso
bisect: add example for limiting bisection to specified directories...
r17969
FUJIWARA Katsunori
doc: use double quotation mark to quote arguments in examples for Windows users...
r19959 hg bisect --skip "!( file('path:foo') & file('path:bar') )"
Jordi Gutiérrez Hermoso
bisect: add example for limiting bisection to specified directories...
r17969
"Yann E. MORIN"
bisect: add some bisection examples, and some log revset.bisect() examples...
r15139 - forget the current bisection::
hg bisect --reset
- use 'make && make tests' to automatically find the first broken
revision::
hg bisect --reset
hg bisect --bad 34
hg bisect --good 12
FUJIWARA Katsunori
doc: use double quotation mark to quote arguments in examples for Windows users...
r19959 hg bisect --command "make && make tests"
"Yann E. MORIN"
bisect: add some bisection examples, and some log revset.bisect() examples...
r15139
- see all changesets whose states are already known in the current
bisection::
hg log -r "bisect(pruned)"
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 - see the changeset currently being bisected (especially useful
if running with -U/--noupdate)::
hg log -r "bisect(current)"
"Yann E. MORIN"
bisect: add some bisection examples, and some log revset.bisect() examples...
r15139 - see all changesets that took part in the current bisection::
hg log -r "bisect(range)"
Martin Geisler
bisect: don't mention obsolete graphlog extension in help
r20146 - you can even get a nice graph::
"Yann E. MORIN"
bisect: add some bisection examples, and some log revset.bisect() examples...
r15139
hg log --graph -r "bisect(range)"
Martin von Zweigbergk
bisect: refer directly to bisect() revset predicate in help...
r30787 See :hg:`help revisions.bisect` for more about the `bisect()` predicate.
"Yann E. MORIN"
revset.bisect: add 'ignored' set to the bisect keyword...
r15147
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Matt Mackall
bisect: make bisect a built-in command
r5775 """
Alexander Solovyov
bisect: ability to check revision with command
r7227 # backward compatibility
if rev in "good bad reset init".split():
ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n"))
cmd, rev, extra = rev, extra, None
if cmd == "good":
good = True
elif cmd == "bad":
bad = True
else:
reset = True
Benoit Boissinot
bisect: new command to extend the bisect range (issue2690)...
r13601 elif extra or good + bad + skip + reset + extend + bool(command) > 1:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('incompatible arguments'))
Alexander Solovyov
bisect: ability to check revision with command
r7227
if reset:
Pierre-Yves David
bisect: extract the 'reset' logic into its own function...
r30065 hbisect.resetstate(repo)
Alexander Solovyov
bisect: ability to check revision with command
r7227 return
state = hbisect.load_state(repo)
Pierre-Yves David
bisect: minor movement of code handle flag updating state...
r30122 # update state
if good or bad or skip:
if rev:
nodes = [repo.lookup(i) for i in scmutil.revrange(repo, [rev])]
else:
nodes = [repo.lookup('.')]
if good:
state['good'] += nodes
elif bad:
state['bad'] += nodes
elif skip:
state['skip'] += nodes
hbisect.save_state(repo, state)
Pierre-Yves David
bisect: remove code about "update-flag" in check_state...
r30124 if not (state['good'] and state['bad']):
return
Pierre-Yves David
bisect: minor movement of code handle flag updating state...
r30122
Pierre-Yves David
bisect: factor commonly update sequence...
r30127 def mayupdate(repo, node, show_stats=True):
"""common used update sequence"""
if noupdate:
return
Martin von Zweigbergk
bisect: allow resetting with unfinished graft/rebase/etc...
r32131 cmdutil.checkunfinished(repo)
Pierre-Yves David
bisect: factor commonly update sequence...
r30127 cmdutil.bailifchanged(repo)
return hg.clean(repo, node, show_stats=show_stats)
Pierre-Yves David
bisect: build a displayer only once...
r30128 displayer = cmdutil.show_changeset(ui, repo, {})
Alexander Solovyov
bisect: ability to check revision with command
r7227 if command:
changesets = 1
Mads Kiilerich
bisect: --command without --noupdate should flag the parent rev it tested...
r20237 if noupdate:
try:
node = state['current'][0]
except LookupError:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('current bisect revision is unknown - '
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 'start a new bisect to fix'))
Mads Kiilerich
bisect: --command without --noupdate should flag the parent rev it tested...
r20237 else:
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 node, p2 = repo.dirstate.parents()
if p2 != nullid:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('current bisect revision is a merge'))
Pierre-Yves David
bisect: extra a small initialisation outside of a loop...
r30134 if rev:
node = repo[scmutil.revsingle(repo, rev, node)].node()
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 try:
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 while changesets:
# update state
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 state['current'] = [node]
Bryan O'Sullivan
bisect: save current state before running a command...
r16593 hbisect.save_state(repo, state)
Simon Farnsworth
bisect: set a blockedtag when running the check command...
r31200 status = ui.system(command, environ={'HG_NODE': hex(node)},
blockedtag='bisect_check')
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 if status == 125:
transition = "skip"
elif status == 0:
transition = "good"
# status < 0 means process was killed
elif status == 127:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("failed to execute %s") % command)
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 elif status < 0:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("%s killed") % command)
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 else:
transition = "bad"
Pierre-Yves David
bisect: extra a small initialisation outside of a loop...
r30134 state[transition].append(node)
ctx = repo[node]
Martin Geisler
bisect: lowercase status message
r16936 ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition))
Pierre-Yves David
bisect: move check_state into the bisect module...
r30126 hbisect.checkstate(state)
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 # bisect
Mads Kiilerich
bisect: avoid confusing use of variables with same names in nested local scopes
r20052 nodes, changesets, bgood = hbisect.bisect(repo.changelog, state)
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 # update to next check
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 node = nodes[0]
Pierre-Yves David
bisect: factor commonly update sequence...
r30127 mayupdate(repo, node, show_stats=False)
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 finally:
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 state['current'] = [node]
Benoit Boissinot
bisect: improve hg bisect -c (relative paths, error handling)...
r7590 hbisect.save_state(repo, state)
Pierre-Yves David
bisect: move 'printresult' in the 'hbisect' module...
r30067 hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
Matt Mackall
commands: initial audit of exit codes...
r11177 return
Alexander Solovyov
bisect: ability to check revision with command
r7227
Pierre-Yves David
bisect: move check_state into the bisect module...
r30126 hbisect.checkstate(state)
Alexander Solovyov
bisect: ability to check revision with command
r7227
# actually bisect
nodes, changesets, good = hbisect.bisect(repo.changelog, state)
Benoit Boissinot
bisect: new command to extend the bisect range (issue2690)...
r13601 if extend:
if not changesets:
Pierre-Yves David
bisect: move the 'extendrange' to the 'hbisect' module...
r30066 extendnode = hbisect.extendrange(repo, state, nodes, good)
Benoit Boissinot
bisect: new command to extend the bisect range (issue2690)...
r13601 if extendnode is not None:
FUJIWARA Katsunori
i18n: fix "% inside _()" problems...
r20868 ui.write(_("Extending search to changeset %d:%s\n")
% (extendnode.rev(), extendnode))
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 state['current'] = [extendnode.node()]
hbisect.save_state(repo, state)
Pierre-Yves David
bisect: factor commonly update sequence...
r30127 return mayupdate(repo, extendnode.node())
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("nothing to extend"))
Benoit Boissinot
bisect: new command to extend the bisect range (issue2690)...
r13601
Alexander Solovyov
bisect: ability to check revision with command
r7227 if changesets == 0:
Pierre-Yves David
bisect: move 'printresult' in the 'hbisect' module...
r30067 hbisect.printresult(ui, repo, state, displayer, nodes, good)
Bernhard Leiner
Add support for multiple possible bisect results (issue1228, issue1182)...
r6858 else:
assert len(nodes) == 1 # only a single node can be tested next
node = nodes[0]
Matt Mackall
bisect: make bisect a built-in command
r5775 # compute the approximate number of remaining tests
tests, size = 0, 2
while size <= changesets:
tests, size = tests + 1, size * 2
rev = repo.changelog.rev(node)
Cédric Duval
bisect: fix format specifiers for integers
r9012 ui.write(_("Testing changeset %d:%s "
"(%d changesets remaining, ~%d tests)\n")
Joel Rosdahl
Avoid importing mercurial.node/mercurial.repo stuff from mercurial.hg
r6217 % (rev, short(node), changesets, tests))
Bryan O'Sullivan
bisect: track the current changeset (issue3382)...
r16647 state['current'] = [node]
hbisect.save_state(repo, state)
Pierre-Yves David
bisect: factor commonly update sequence...
r30127 return mayupdate(repo, node)
Matt Mackall
bisect: make bisect a built-in command
r5775
Kevin Bullock
commands: 'hg bookmark NAME' should work even with ui.strict=True...
r18075 @command('bookmarks|bookmark',
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 [('f', 'force', False, _('force')),
Nathan Goldbaum
bookmarks: improve documentation for --rev option
r27950 ('r', 'rev', '', _('revision for bookmark action'), _('REV')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('d', 'delete', False, _('delete a given bookmark')),
timeless@mozdev.org
bookmark: improve ambiguous documentation for rename
r26190 ('m', 'rename', '', _('rename a given bookmark'), _('OLD')),
Yuya Nishihara
bookmarks: port to generic templater
r22776 ('i', 'inactive', False, _('mark a bookmark inactive')),
] + formatteropts,
Kevin Bullock
bookmarks: allow bookmark command to take multiple arguments...
r19147 _('hg bookmarks [OPTIONS]... [NAME]...'))
def bookmark(ui, repo, *names, **opts):
Matt Mackall
bookmarks: improve the bookmark help (issue4244)
r21762 '''create a new bookmark or list existing bookmarks
Bookmarks are labels on changesets to help track lines of development.
Bookmarks are unversioned and can be moved, renamed and deleted.
Deleting or moving a bookmark has no effect on the associated changesets.
Creating or updating to a bookmark causes it to be marked as 'active'.
Kevin Bullock
bookmarks: refer to "the" active bookmark to clarify that there's only one...
r22314 The active bookmark is indicated with a '*'.
When a commit is made, the active bookmark will advance to the new commit.
Matt Mackall
bookmarks: improve the bookmark help (issue4244)
r21762 A plain :hg:`update` will also advance an active bookmark, if possible.
Updating away from a bookmark will cause it to be deactivated.
Bookmarks can be pushed and pulled between repositories (see
:hg:`help push` and :hg:`help pull`). If a shared bookmark has
diverged, a new 'divergent bookmark' of the form 'name@path' will
FUJIWARA Katsunori
help: use ":hg:`command`" instead of incorrect ":hg:'command'" notation
r23114 be created. Using :hg:`merge` will resolve the divergence.
Matt Mackall
bookmarks: improve the bookmark help (issue4244)
r21762
A bookmark named '@' has the special property that :hg:`clone` will
check it out by default if it exists.
.. container:: verbose
Examples:
- create an active bookmark for a new line of development::
hg book new-feature
- create an inactive bookmark as a place marker::
hg book -i reviewed
- create an inactive bookmark on another changeset::
hg book -r .^ tested
timeless@mozdev.org
bookmark: improve ambiguous documentation for rename
r26190 - rename bookmark turkey to dinner::
hg book -m turkey dinner
Matt Mackall
bookmarks: improve the bookmark help (issue4244)
r21762 - move the '@' bookmark from another branch::
hg book -f @
Matt Mackall
bookmarks: move push/pull command features to core
r13368 '''
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Kevin Bullock
bookmarks: allow bookmark command to take multiple arguments...
r19147 force = opts.get('force')
rev = opts.get('rev')
delete = opts.get('delete')
rename = opts.get('rename')
inactive = opts.get('inactive')
David Soria Parra
bookmarks: check bookmark format during rename (issue3662)
r17789 def checkformat(mark):
mark = mark.strip()
if not mark:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("bookmark names cannot consist entirely of "
David Soria Parra
bookmarks: check bookmark format during rename (issue3662)
r17789 "whitespace"))
Kevin Bullock
scmutil: add bad character checking to checknewlabel...
r17821 scmutil.checknewlabel(repo, mark, 'bookmark')
David Soria Parra
bookmarks: check bookmark format during rename (issue3662)
r17789 return mark
Siddharth Agarwal
commands.bookmarks: pass cur in explicitly to checkconflict...
r20233 def checkconflict(repo, mark, cur, force=False, target=None):
David Soria Parra
bookmarks: check bookmark format during rename (issue3662)
r17789 if mark in marks and not force:
Kevin Bullock
bookmarks: allow moving a bookmark forward to a descendant...
r18773 if target:
Kevin Bullock
bookmarks: allow (re-)activating a bookmark on the current changeset...
r18781 if marks[mark] == target and target == cur:
# re-activating a bookmark
return
Kevin Bullock
bookmarks: allow moving a bookmark forward to a descendant...
r18773 anc = repo.changelog.ancestors([repo[target].rev()])
bmctx = repo[marks[mark]]
Sean Farley
bookmarks: resolve divergent bookmarks when fowarding bookmark to descendant...
r19109 divs = [repo[b].node() for b in marks
if b.split('@', 1)[0] == mark.split('@', 1)[0]]
Sean Farley
bookmarks: resolve divergent bookmark when moving across a branch...
r19111
# allow resolving a single divergent bookmark even if moving
# the bookmark across branches when a revision is specified
# that contains a divergent bookmark
if bmctx.rev() not in anc and target in divs:
bookmarks.deletedivergent(repo, [target], mark)
return
Sean Farley
bookmarks: resolve divergent bookmarks when fowarding bookmark to descendant...
r19109 deletefrom = [b for b in divs
if repo[b].rev() in anc or b == target]
bookmarks.deletedivergent(repo, deletefrom, mark)
Sean Farley
commands: use bookmarks.validdest instead of duplicating logic...
r20282 if bookmarks.validdest(repo, bmctx, repo[target]):
Kevin Bullock
bookmarks: allow moving a bookmark forward to a descendant...
r18773 ui.status(_("moving bookmark '%s' forward from %s\n") %
(mark, short(bmctx.node())))
return
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("bookmark '%s' already exists "
David Soria Parra
bookmarks: check bookmark format during rename (issue3662)
r17789 "(use -f to force)") % mark)
if ((mark in repo.branchmap() or mark == repo.dirstate.branch())
and not force):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(
David Soria Parra
bookmarks: check bookmark format during rename (issue3662)
r17789 _("a bookmark cannot have the name of an existing branch"))
Yuya Nishihara
bookmarks: fix check of hash-like name to not abort by ambiguous identifier...
r32482 if len(mark) > 3 and not force:
try:
shadowhash = (mark in repo)
except error.LookupError: # ambiguous identifier
shadowhash = False
if shadowhash:
repo.ui.warn(
_("bookmark %s matches a changeset hash\n"
"(did you leave a -r out of an 'hg bookmark' command?)\n")
% mark)
David Soria Parra
bookmarks: check bookmark format during rename (issue3662)
r17789
David Soria Parra
bookmarks: abort when incompatible options are used (issue3663)...
r17790 if delete and rename:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("--delete and --rename are incompatible"))
David Soria Parra
bookmarks: abort when incompatible options are used (issue3663)...
r17790 if delete and rev:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("--rev is incompatible with --delete"))
David Soria Parra
bookmarks: abort when incompatible options are used (issue3663)...
r17790 if rename and rev:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("--rev is incompatible with --rename"))
Kevin Bullock
bookmarks: allow bookmark command to take multiple arguments...
r19147 if not names and (delete or rev):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("bookmark name required"))
David Soria Parra
bookmarks: abort when incompatible options are used (issue3663)...
r17790
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 if delete or rename or names or inactive:
Pierre-Yves David
bookmarks: change bookmark within a transaction...
r25744 wlock = lock = tr = None
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 try:
Pierre-Yves David
bookmarks: change bookmark within a transaction...
r25744 wlock = repo.wlock()
lock = repo.lock()
Siddharth Agarwal
commands.bookmarks: move cur initialization to inside wlock...
r20234 cur = repo.changectx('.').node()
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 marks = repo._bookmarks
if delete:
Pierre-Yves David
bookmarks: change bookmark within a transaction...
r25744 tr = repo.transaction('bookmark')
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 for mark in names:
if mark not in marks:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("bookmark '%s' does not exist") %
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 mark)
Ryan McElroy
bookmarks: rename bookmarkcurrent to activebookmark (API)...
r24947 if mark == repo._activebookmark:
Ryan McElroy
bookmarks: rename unsetcurrent to deactivate (API)...
r24944 bookmarks.deactivate(repo)
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 del marks[mark]
elif rename:
Pierre-Yves David
bookmarks: change bookmark within a transaction...
r25744 tr = repo.transaction('bookmark')
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 if not names:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("new bookmark name required"))
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 elif len(names) > 1:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("only one new bookmark name allowed"))
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 mark = checkformat(names[0])
if rename not in marks:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("bookmark '%s' does not exist")
% rename)
Siddharth Agarwal
commands.bookmarks: pass cur in explicitly to checkconflict...
r20233 checkconflict(repo, mark, cur, force)
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 marks[mark] = marks[rename]
Ryan McElroy
bookmarks: rename bookmarkcurrent to activebookmark (API)...
r24947 if repo._activebookmark == rename and not inactive:
Ryan McElroy
bookmarks: rename setcurrent to activate (API)...
r24945 bookmarks.activate(repo, mark)
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 del marks[rename]
elif names:
Pierre-Yves David
bookmarks: change bookmark within a transaction...
r25744 tr = repo.transaction('bookmark')
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 newact = None
for mark in names:
mark = checkformat(mark)
if newact is None:
newact = mark
Ryan McElroy
bookmarks: rename bookmarkcurrent to activebookmark (API)...
r24947 if inactive and mark == repo._activebookmark:
Ryan McElroy
bookmarks: rename unsetcurrent to deactivate (API)...
r24944 bookmarks.deactivate(repo)
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 return
tgt = cur
if rev:
tgt = scmutil.revsingle(repo, rev).node()
Siddharth Agarwal
commands.bookmarks: pass cur in explicitly to checkconflict...
r20233 checkconflict(repo, mark, cur, force, tgt)
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 marks[mark] = tgt
if not inactive and cur == marks[newact] and not rev:
Ryan McElroy
bookmarks: rename setcurrent to activate (API)...
r24945 bookmarks.activate(repo, newact)
Ryan McElroy
bookmarks: rename bookmarkcurrent to activebookmark (API)...
r24947 elif cur != tgt and newact == repo._activebookmark:
Ryan McElroy
bookmarks: rename unsetcurrent to deactivate (API)...
r24944 bookmarks.deactivate(repo)
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 elif inactive:
if len(marks) == 0:
ui.status(_("no bookmarks set\n"))
Ryan McElroy
bookmarks: rename bookmarkcurrent to activebookmark (API)...
r24947 elif not repo._activebookmark:
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 ui.status(_("no active bookmark\n"))
else:
Ryan McElroy
bookmarks: rename unsetcurrent to deactivate (API)...
r24944 bookmarks.deactivate(repo)
Pierre-Yves David
bookmarks: change bookmark within a transaction...
r25744 if tr is not None:
marks.recordchange(tr)
tr.close()
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 finally:
Pierre-Yves David
bookmarks: change bookmark within a transaction...
r25744 lockmod.release(tr, lock, wlock)
Kevin Bullock
bookmarks: further flatten code...
r17822 else: # show bookmarks
Yuya Nishihara
bookmarks: port to generic templater
r22776 fm = ui.formatter('bookmarks', opts)
hexfn = fm.hexfunc
Siddharth Agarwal
commands.bookmarks: hold wlock for write operations...
r20232 marks = repo._bookmarks
Mathias De Maré
formatter: introduce isplain() to replace (the inverse of) __nonzero__() (API)...
r29949 if len(marks) == 0 and fm.isplain():
Siddharth Agarwal
commands.bookmarks: separate out 'no bookmarks set' status messages...
r20231 ui.status(_("no bookmarks set\n"))
Yuya Nishihara
bookmarks: iterate bookmarks list even if it is known to be empty...
r22774 for bmark, n in sorted(marks.iteritems()):
Ryan McElroy
commands: rename current to active in variables and comments...
r25349 active = repo._activebookmark
if bmark == active:
Ryan McElroy
bookmarks: name label for active bookmark correctly...
r25347 prefix, label = '*', activebookmarklabel
Yuya Nishihara
bookmarks: iterate bookmarks list even if it is known to be empty...
r22774 else:
prefix, label = ' ', ''
Yuya Nishihara
bookmarks: port to generic templater
r22776 fm.startitem()
Yuya Nishihara
bookmarks: split ui.write() so that it can be easily ported to formatter api...
r22775 if not ui.quiet:
Yuya Nishihara
bookmarks: port to generic templater
r22776 fm.plain(' %s ' % prefix, label=label)
fm.write('bookmark', '%s', bmark, label=label)
pad = " " * (25 - encoding.colwidth(bmark))
fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s',
repo.changelog.rev(n), hexfn(n), label=label)
Ryan McElroy
commands: rename current to active in variables and comments...
r25349 fm.data(active=(bmark == active))
Yuya Nishihara
bookmarks: port to generic templater
r22776 fm.plain('\n')
fm.end()
Matt Mackall
bookmarks: move push/pull command features to core
r13368
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('branch',
[('f', 'force', None,
_('set branch name even if it shadows an existing branch')),
('C', 'clean', None, _('reset branch name to parent branch name'))],
_('[-fC] [NAME]'))
Brendan Cully
branch: require --force to shadow existing branches
r4202 def branch(ui, repo, label=None, **opts):
Matt Mackall
add branch and branches commands
r3502 """set or show the current branch name
Matt Mackall
branch: move note about permanence to the top, add 'global'
r15610 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
Matt Mackall
branch: move note about permanence to the top, add 'global'
r15610 Branch names are permanent and global. Use :hg:`bookmark` to create a
light-weight bookmark instead. See :hg:`help glossary` for more
information about named branches and bookmarks.
Brendan Cully
Notify the user that hg branch does not create a branch until commit
r4601 With no argument, show the current branch name. With one argument,
timeless
Improve English for help text of many core hg commands....
r8779 set the working directory branch name (the branch will not exist
in the repository until the next commit). Standard practice
recommends that primary development take place on the 'default'
branch.
Brendan Cully
branch: require --force to shadow existing branches
r4202
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Unless -f/--force is specified, branch will not let you set a
Matt Mackall
branches: deprecate -a
r23620 branch name that already exists.
Thomas Arendsen Hein
Mention 'hg update' to switch branches in help for branch and branches.
r5999
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Use -C/--clean to reset the working directory branch to that of
the parent of the working directory, negating a previous branch
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 change.
Sune Foldager
branch: added more support for named branches...
r7006
Martin Geisler
Use hg role in help strings
r10973 Use the command :hg:`update` to switch to an existing branch. Use
Matt Mackall
commit: improve --close-branch documentation...
r25304 :hg:`commit --close-branch` to mark this branch head as closed.
timeless
branch: reword help text...
r27428 When all heads of a branch are closed, the branch will be
Matt Mackall
commit: improve --close-branch documentation...
r25304 considered closed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Matt Mackall
add branch and branches commands
r3502 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Yuya Nishihara
branch: strip whitespace before testing known branch name...
r19180 if label:
label = label.strip()
Idan Kamara
commands: add missing wlock to branch
r16471 if not opts.get('clean') and not label:
Matt Mackall
branch: operate on branch names in local string space where possible...
r13047 ui.write("%s\n" % repo.dirstate.branch())
Idan Kamara
commands: add missing wlock to branch
r16471 return
Bryan O'Sullivan
with: use context manager for wlock in branch
r27804 with repo.wlock():
Idan Kamara
commands: add missing wlock to branch
r16471 if opts.get('clean'):
label = repo[None].p1().branch()
repo.dirstate.setbranch(label)
ui.status(_('reset working directory to branch %s\n') % label)
elif label:
Brodie Rao
localrepo: add branchtip() method for faster single-branch lookups...
r16719 if not opts.get('force') and label in repo.branchmap():
Augie Fackler
commands: inline definition of localrepo.parents() and drop the method (API)...
r27167 if label not in [p.branch() for p in repo[None].parents()]:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('a branch of the same name already'
Idan Kamara
commands: add missing wlock to branch
r16471 ' exists'),
# i18n: "it" refers to an existing branch
hint=_("use 'hg update' to switch to it"))
Tim Henigan
branch: add missing repo argument to checknewlabel...
r17990 scmutil.checknewlabel(repo, label, 'branch')
Idan Kamara
commands: add missing wlock to branch
r16471 repo.dirstate.setbranch(label)
ui.status(_('marked working directory as branch %s\n') % label)
Matt Mackall
branch: don't warn about branches if repository has multiple branches already...
r25295
# find any open named branches aside from default
others = [n for n, h, t, c in repo.branchmap().iterbranches()
if n != "default" and not c]
if not others:
ui.status(_('(branches are permanent and global, '
'did you want a bookmark?)\n'))
Matt Mackall
add branch and branches commands
r3502
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('branches',
Matt Mackall
branches: deprecate -a
r23620 [('a', 'active', False,
_('show only branches that have unmerged heads (DEPRECATED)')),
Yuya Nishihara
branches: port to generic templater
r22703 ('c', 'closed', False, _('show normal and closed branches')),
] + formatteropts,
FUJIWARA Katsunori
doc: remove deprecated option from synopsis of command help...
r28288 _('[-c]'))
Yuya Nishihara
branches: port to generic templater
r22703 def branches(ui, repo, active=False, closed=False, **opts):
Matt Mackall
add branch and branches commands
r3502 """list repository named branches
Eric Hopper
Change branches to sort 'active' branches first, and add an option to show only active branches.
r4675 List the repository's named branches, indicating which ones are
Matt Mackall
branches: add --closed flag for consistency with heads
r8991 inactive. If -c/--closed is specified, also list branches which have
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 been marked closed (see :hg:`commit --close-branch`).
Matt Mackall
branches: add --closed flag for consistency with heads
r8991
Martin Geisler
Use hg role in help strings
r10973 Use the command :hg:`update` to switch to an existing branch.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0.
Matt Mackall
add branch and branches commands
r3502 """
Matt Mackall
branches: add --closed flag for consistency with heads
r8991
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Martin von Zweigbergk
branches: enable pager
r31386 ui.pager('branches')
Yuya Nishihara
branches: port to generic templater
r22703 fm = ui.formatter('branches', opts)
hexfunc = fm.hexfunc
Brodie Rao
branches: improve performance by removing redundant operations...
r16721
Brodie Rao
branches: avoid unnecessary changectx.branch() calls...
r20182 allheads = set(repo.heads())
Brodie Rao
branches: improve performance by removing redundant operations...
r16721 branches = []
Brodie Rao
branches: simplify with repo.branchmap().iterbranches()...
r20192 for tag, heads, tip, isclosed in repo.branchmap().iterbranches():
isactive = not isclosed and bool(set(heads) & allheads)
branches.append((tag, repo[tip], isactive, not isclosed))
Brodie Rao
branches: avoid unnecessary changectx.branch() calls...
r20182 branches.sort(key=lambda i: (i[2], i[1].rev(), i[0], i[3]),
Brodie Rao
branches: improve performance by removing redundant operations...
r16721 reverse=True)
Brodie Rao
branches: avoid unnecessary changectx.branch() calls...
r20182 for tag, ctx, isactive, isopen in branches:
Yuya Nishihara
branches: reduce nesting in for loop
r22639 if active and not isactive:
continue
if isactive:
label = 'branches.active'
notice = ''
elif not isopen:
if not closed:
continue
label = 'branches.closed'
notice = _(' (closed)')
else:
label = 'branches.inactive'
notice = _(' (inactive)')
Yuya Nishihara
branches: include active, closed and current flags in template output
r22705 current = (tag == repo.dirstate.branch())
if current:
Yuya Nishihara
branches: reduce nesting in for loop
r22639 label = 'branches.current'
Yuya Nishihara
branches: port to generic templater
r22703
fm.startitem()
fm.write('branch', '%s', tag, label=label)
Yuya Nishihara
branches: format rev as integer that is necessary for generic templater
r22702 rev = ctx.rev()
padsize = max(31 - len(str(rev)) - encoding.colwidth(tag), 0)
Yuya Nishihara
branches: merge white space to format string...
r22704 fmt = ' ' * padsize + ' %d:%s'
Yuya Nishihara
branches: port to generic templater
r22703 fm.condwrite(not ui.quiet, 'rev node', fmt, rev, hexfunc(ctx.node()),
label='log.changeset changeset.%s' % ctx.phasestr())
Yuya Nishihara
branches: populate all template keywords in formatter...
r31173 fm.context(ctx=ctx)
Yuya Nishihara
branches: include active, closed and current flags in template output
r22705 fm.data(active=isactive, closed=not isopen, current=current)
Yuya Nishihara
branches: port to generic templater
r22703 if not ui.quiet:
fm.plain(notice)
fm.plain('\n')
fm.end()
Matt Mackall
add branch and branches commands
r3502
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('bundle',
[('f', 'force', None, _('run even when the destination is unrelated')),
('r', 'rev', [], _('a changeset intended to be added to the destination'),
_('REV')),
('b', 'branch', [], _('a specific branch you would like to bundle'),
_('BRANCH')),
('', 'base', [],
_('a base changeset assumed to be available at the destination'),
_('REV')),
('a', 'all', None, _('bundle all changesets in the repository')),
('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE')),
] + remoteopts,
Gregory Szorc
commands: update help for "bundle"...
r31794 _('[-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]'))
Vadim Gelfer
push, outgoing, bundle: fall back to "default" if "default-push" not defined
r2494 def bundle(ui, repo, fname, dest=None, **opts):
Gregory Szorc
commands: update help for "bundle"...
r31794 """create a bundle file
Generate a bundle file containing data to be added to a repository.
timeless
bundle: clarify help text...
r27420
To create a bundle containing all changesets, use -a/--all
(or --base null). Otherwise, hg assumes the destination will have
all the nodes you specify with --base parameters. Otherwise, hg
will assume the repository has all the nodes in destination, or
default-push/default if no destination is specified.
Henrik Stuart
help: describe bundle compression methods (issue1523)
r8903
Gregory Szorc
commands: update help for "bundle"...
r31794 You can change bundle format with the -t/--type option. See
:hg:`help bundlespec` for documentation on this format. By default,
the most appropriate format is used and compression defaults to
bzip2.
Thomas Arendsen Hein
Corrected help text for bundle.
r3511
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 The bundle file can then be transferred using conventional means
and applied to another repository with the unbundle or pull
command. This is useful when direct push and pull are not
available or when exporting an entire repository is undesirable.
Thomas Arendsen Hein
Corrected help text for bundle.
r3511
Applying bundles preserves all changeset contents including
permissions, copy/rename information, and revision history.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if no changes found.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
commands: add revset support to most commands
r12925 revs = None
if 'rev' in opts:
Durham Goode
bundle: exit early when there are no commits to bundle...
r27911 revstrings = opts['rev']
revs = scmutil.revrange(repo, revstrings)
if revstrings and not revs:
raise error.Abort(_('no commits to bundle'))
Matt Mackall
commands: add revset support to most commands
r12925
Bryan O'Sullivan
commands: move bundle type validation earlier...
r16427 bundletype = opts.get('type', 'bzip2').lower()
Gregory Szorc
exchange: refactor bundle specification parsing...
r26640 try:
Gregory Szorc
exchange: support parameters in bundle specification strings...
r26759 bcompression, cgversion, params = exchange.parsebundlespec(
Gregory Szorc
exchange: refactor bundle specification parsing...
r26640 repo, bundletype, strict=False)
except error.UnsupportedBundleSpecification as e:
raise error.Abort(str(e),
Gregory Szorc
commands: update help for "bundle"...
r31794 hint=_("see 'hg help bundlespec' for supported "
timeless
bundle: use single quotes in use warning
r29971 "values for --type"))
Bryan O'Sullivan
commands: move bundle type validation earlier...
r16427
Gregory Szorc
commands: support creating stream clone bundles...
r26757 # Packed bundles are a pseudo bundle format for now.
if cgversion == 's1':
raise error.Abort(_('packed bundles cannot be produced by "hg bundle"'),
timeless
debugcreatestreamclonebundle: use single quotes around command hint...
r28961 hint=_("use 'hg debugcreatestreamclonebundle'"))
Gregory Szorc
commands: support creating stream clone bundles...
r26757
John Mulligan
Add --all option to bundle command
r6171 if opts.get('all'):
timeless
bundle: fix error for --all with destination...
r27422 if dest:
raise error.Abort(_("--all is incompatible with specifying "
"a destination"))
timeless
bundle: warn for --base with --all
r27423 if opts.get('base'):
ui.warn(_("ignoring --base because --all was specified\n"))
John Mulligan
Add --all option to bundle command
r6171 base = ['null']
else:
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 base = scmutil.revrange(repo, opts.get('base'))
Martin von Zweigbergk
bundle: avoid crash when no good changegroup version found...
r28669 if cgversion not in changegroup.supportedoutgoingversions(repo):
raise error.Abort(_("repository does not support bundle version %s") %
cgversion)
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 if base:
if dest:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("--base is incompatible with specifying "
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 "a destination"))
Peter Arrenbrecht
discovery: drop findoutgoing and simplify findcommonincoming's api...
r14073 common = [repo.lookup(rev) for rev in base]
Ryan McElroy
discovery: explicitly check for None in outgoing init...
r29901 heads = revs and map(repo.lookup, revs) or None
Pierre-Yves David
getchangegroup: take an 'outgoing' object as argument (API)...
r29807 outgoing = discovery.outgoing(repo, common, heads)
Benoit Boissinot
add -r/--rev and --base option to bundle...
r3284 else:
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 dest = ui.expandpath(dest or 'default-push', dest or 'default')
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 dest, branches = hg.parseurl(dest, opts.get('branch'))
Matt Mackall
hg: change various repository() users to use peer() where appropriate...
r14556 other = hg.peer(repo, opts, dest)
FUJIWARA Katsunori
bundle: treat branches created newly on the local correctly (issue3828)...
r18701 revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
Peter Arrenbrecht
discovery: resurrect findoutgoing as findcommonoutgoing for extension hooks...
r14213 heads = revs and map(repo.lookup, revs) or revs
Pierre-Yves David
discovery: introduce outgoing object for result of findcommonoutgoing...
r15837 outgoing = discovery.findcommonoutgoing(repo, other,
onlyheads=heads,
Sune Foldager
bundle: make bundles more portable (isue3441)...
r16736 force=opts.get('force'),
portable=True)
bundle: check lack of revs to bundle before generating the changegroup...
r32213
if not outgoing.missing:
bundle: avoid reset of the 'outgoing' variable...
r32169 scmutil.nochangesfound(ui, repo, not base and outgoing.excluded)
Matt Mackall
commands: initial audit of exit codes...
r11177 return 1
Benoit Boissinot
bundle: fix bundle generation for empty changegroup
r10616
Pierre-Yves David
bundle: extend the format of --type to support version and compression...
r26531 if cgversion == '01': #bundle1
if bcompression is None:
bcompression = 'UN'
bversion = 'HG10' + bcompression
bcompression = None
Jun Wu
bundle: allow bundle command to use changegroup3 in tests...
r31831 elif cgversion in ('02', '03'):
bversion = 'HG20'
Pierre-Yves David
bundle: extend the format of --type to support version and compression...
r26531 else:
Jun Wu
bundle: allow bundle command to use changegroup3 in tests...
r31831 raise error.ProgrammingError(
'bundle: unexpected changegroup version %s' % cgversion)
Pierre-Yves David
bundle: extend the format of --type to support version and compression...
r26531
Gregory Szorc
commands: config option to control bundle compression level...
r30758 # TODO compression options should be derived from bundlespec parsing.
# This is a temporary hack to allow adjusting bundle compression
# level without a) formalizing the bundlespec changes to declare it
# b) introducing a command flag.
compopts = {}
complevel = ui.configint('experimental', 'bundlecomplevel')
if complevel is not None:
compopts['level'] = complevel
bundle: introduce an higher level function to write bundle on disk...
r32216
contentopts = {'cg.version': cgversion}
bundle: add an experimental knob to include obsmarkers in bundle...
r32516 if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker', False):
contentopts['obsolescence'] = True
bundle: introduce an higher level function to write bundle on disk...
r32216 bundle2.writenewbundle(ui, repo, 'bundle', fname, bversion, outgoing,
contentopts, compression=bcompression,
compopts=compopts)
mpm@selenic.com
Add preliminary support for the bundle and unbundle commands
r1218
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('cat',
[('o', 'output', '',
_('print output to file with formatted name'), _('FORMAT')),
('r', 'rev', '', _('print the given revision'), _('REV')),
('', 'decode', None, _('apply any matching decode filter')),
Yuya Nishihara
cat: add formatter support...
r32578 ] + walkopts + formatteropts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... FILE...'),
inferrepo=True)
Bryan O'Sullivan
Switch cat command to use walk code....
r1254 def cat(ui, repo, file1, *pats, **opts):
Thomas Arendsen Hein
doc string fix: hg cat and manifest default to current parent revision.
r3914 """output the current or given revision of files
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Print the specified files as they were at the given revision. If
Matt Mackall
cat: remove incorrect reference to tip
r19400 no revision is given, the parent of the working directory is used.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Output may be to a file, in which case the name of the file is
Matt Harbison
cat: explicitly document the supported formatter rules...
r21078 given using a format string. The formatting rules as follows:
:``%%``: literal "%" character
Martin Geisler
commands: use field lists instead of literal blocks in docstrings...
r9892 :``%s``: basename of file being printed
:``%d``: dirname of file being printed, or '.' if in repository root
:``%p``: root-relative path name of file being printed
Matt Harbison
cat: explicitly document the supported formatter rules...
r21078 :``%H``: changeset hash (40 hexadecimal digits)
:``%R``: changeset revision number
:``%h``: short-form changeset hash (12 hexadecimal digits)
:``%r``: zero-padded changeset revision number
:``%b``: basename of the exporting repository
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 ctx = scmutil.revsingle(repo, opts.get('rev'))
Matt Mackall
scmutil: switch match users to supplying contexts...
r14671 m = scmutil.match(ctx, (file1,) + pats, opts)
Yuya Nishihara
cat: pass filename template as explicit argument...
r32540 fntemplate = opts.pop('output', '')
Yuya Nishihara
cat: do not start pager if output will be written to file
r32541 if cmdutil.isstdiofilename(fntemplate):
fntemplate = ''
Yuya Nishihara
cat: add formatter support...
r32578 if fntemplate:
fm = formatter.nullformatter(ui, 'cat')
else:
Yuya Nishihara
cat: do not start pager if output will be written to file
r32541 ui.pager('cat')
Yuya Nishihara
cat: add formatter support...
r32578 fm = ui.formatter('cat', opts)
with fm:
return cmdutil.cat(ui, repo, ctx, m, fm, fntemplate, '', **opts)
mpm@selenic.com
migrate remaining commands...
r248
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^clone',
Yuya Nishihara
commands: replace "working copy" with "working directory" in help/messages...
r24364 [('U', 'noupdate', None, _('the clone will include an empty working '
'directory (only a repository)')),
timeless
commands: use Oxford comma (help clone)
r27292 ('u', 'updaterev', '', _('revision, tag, or branch to check out'),
_('REV')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('r', 'rev', [], _('include the specified changeset'), _('REV')),
('b', 'branch', [], _('clone only the specified branch'), _('BRANCH')),
('', 'pull', None, _('use pull protocol to copy metadata')),
('', 'uncompressed', None, _('use uncompressed transfer (fast over LAN)')),
] + remoteopts,
Gregory Szorc
commands: define norepo in command decorator
r21768 _('[OPTION]... SOURCE [DEST]'),
norepo=True)
Thomas Arendsen Hein
Use python function instead of external 'cp' command when cloning repos....
r698 def clone(ui, source, dest=None, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """make a copy of an existing repository
Create a copy of an existing repository in a new directory.
If no destination directory name is specified, it defaults to the
basename of the source.
The location of the source is added to the new repository's
Javi Merino
doc: Add back quotes around filenames...
r13344 ``.hg/hgrc`` file, as the default to be used for future pulls.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Matt Mackall
clone: move portions of help into the verbose section
r15177 Only local paths and ``ssh://`` URLs are supported as
destinations. For ``ssh://`` destinations, no working directory or
``.hg/hgrc`` will be created on the remote side.
Matt Mackall
mention default branch in branch and clone help
r7942
timeless
clone: move bookmarks and checkouts before pull help...
r27669 If the source repository has a bookmark called '@' set, that
revision will be checked out in the new repository by default.
To check out a particular version, use -u/--update, or
-U/--noupdate to create a clone with no working directory.
Matt Mackall
clone: improve help on -r/-b and tags
r15174 To pull only a subset of changesets, specify one or more revisions
identifiers with -r/--rev or branches with -b/--branch. The
resulting clone will contain only the specified changesets and
their ancestors. These options (or 'clone src#rev dest') imply
timeless
commands: split notes into note containers
r27490 --pull, even for local source repositories.
.. note::
Specifying a tag will include the tagged changeset but not the
changeset containing the tag.
Adrian Buehlmann
clone: add option -u/--updaterev
r9714
Matt Mackall
clone: move portions of help into the verbose section
r15177 .. container:: verbose
For efficiency, hardlinks are used for cloning whenever the
source and destination are on the same filesystem (note this
applies only to the repository data, not to the working
directory). Some filesystems, such as AFS, implement hardlinking
incorrectly, but do not report errors. In these cases, use the
--pull option to avoid hardlinking.
In some cases, you can clone repositories and the working
directory using full hardlinks with ::
$ cp -al REPO REPOCLONE
This is the fastest way to clone, but it is not always safe. The
operation is not atomic (making sure REPO is not modified during
the operation is up to you) and you have to make sure your
editor breaks hardlinks (Emacs and most Linux Kernel tools do
so). Also, this is not compatible with certain extensions that
place their metadata under the .hg directory, such as mq.
Mercurial will update the working directory to the first applicable
revision from this list:
a) null if -U or the source repository has no changesets
b) if -u . and the source repository is local, the first parent of
the source repository's working directory
c) the changeset specified with -u (if a branch name, this means the
latest head of that branch)
d) the changeset specified with -r
e) the tipmost head specified with -b
f) the tipmost head specified with the url#branch source syntax
Kevin Bullock
help: update verbose 'clone' help to include '@' bookmark
r18476 g) the revision marked with the '@' bookmark, if present
h) the tipmost head of the default branch
i) tip
Matt Mackall
commands: initial audit of exit codes...
r11177
Gregory Szorc
commands: document clone bundles hooks and rollback behavior...
r27887 When cloning from servers that support it, Mercurial may fetch
pre-generated data from a server-advertised URL. When this is done,
hooks operating on incoming changesets and changegroups may fire twice,
once for the bundle fetched from the URL and another for any additional
data not fetched from this URL. In addition, if an error occurs, the
repository may be rolled back to a partial clone. This behavior may
change in future releases. See :hg:`help -e clonebundles` for more.
Matt Mackall
clone: add help examples
r15179 Examples:
- clone a remote repository to a new directory named hg/::
FUJIWARA Katsunori
help: replace selenic.com by mercurial-scm.org in command examples...
r30243 hg clone https://www.mercurial-scm.org/repo/hg/
Matt Mackall
clone: add help examples
r15179
- create a lightweight local clone::
hg clone project/ project-feature/
- clone from an absolute path on an ssh server (note double-slash)::
hg clone ssh://user@server//home/projects/alpha/
- do a high-speed clone over a LAN while checking out a
specified version::
hg clone --uncompressed http://server/repo -u 1.5
- create a repository without changesets after a particular revision::
hg clone -r 04e544 experimental/ good/
- clone (and track) a particular named branch::
FUJIWARA Katsunori
help: replace selenic.com by mercurial-scm.org in command examples...
r30243 hg clone https://www.mercurial-scm.org/repo/hg/#stable
Matt Mackall
clone: add help examples
r15179
Matt Mackall
clone: move url crossref to bottom
r15175 See :hg:`help urls` for details on specifying URLs.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Adrian Buehlmann
clone: add option -u/--updaterev
r9714 if opts.get('noupdate') and opts.get('updaterev'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("cannot specify both --noupdate and --updaterev"))
Adrian Buehlmann
clone: add option -u/--updaterev
r9714
Peter Arrenbrecht
hg: add opts argument to clone for internal remoteui
r14553 r = hg.clone(ui, opts, source, dest,
Matt Mackall
commands: initial audit of exit codes...
r11177 pull=opts.get('pull'),
stream=opts.get('uncompressed'),
rev=opts.get('rev'),
update=opts.get('updaterev') or not opts.get('noupdate'),
Gregory Szorc
hg: support for auto sharing stores when cloning...
r25761 branch=opts.get('branch'),
shareopts=opts.get('shareopts'))
Matt Mackall
commands: initial audit of exit codes...
r11177
return r is None
mpm@selenic.com
Whitespace cleanups...
r515
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^commit|ci',
[('A', 'addremove', None,
_('mark new/missing files as added/removed before committing')),
('', 'close-branch', None,
Matt Mackall
commit: improve --close-branch documentation...
r25304 _('mark a branch head as closed')),
Yuya Nishihara
commands: say "working directory" in full spelling
r24365 ('', 'amend', None, _('amend the parent of the working directory')),
Jordi Gutiérrez Hermoso
commit: enable --secret option...
r19440 ('s', 'secret', None, _('use the secret phase for committing')),
FUJIWARA Katsunori
doc: unify help text for "--edit" option...
r21952 ('e', 'edit', None, _('invoke editor on commit messages')),
Laurent Charignon
record: add interactive option to the commit command
r24278 ('i', 'interactive', None, _('use interactive mode')),
Martin Geisler
subrepos: abort commit by default if a subrepo is dirty (BC)...
r15321 ] + walkopts + commitopts + commitopts2 + subrepoopts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... [FILE]...'),
inferrepo=True)
Bryan O'Sullivan
Adapt commit to use file matching code....
r813 def commit(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """commit the specified files or all outstanding changes
Martin Geisler
Change double spaces to single spaces in help texts.
r7983 Commit changes to the given files into the repository. Unlike a
Adrian Buehlmann
commit: use the term SCM instead of RCS...
r13303 centralized SCM, this operation is a local operation. See
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 :hg:`push` for a way to actively distribute your changes.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
Use hg role in help strings
r10973 If a list of files is omitted, all changes reported by :hg:`status`
mcmillen@cs.cmu.edu
Spelling fix: "commited" -> "committed"
r1995 will be committed.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Bryan O'Sullivan
commit: when committing the results of a merge, it's all or nothing...
r6385 If you are committing the result of a merge, do not provide any
timeless
Generally replace "file name" with "filename" in help and comments.
r8761 filenames or -I/-X filters.
Bryan O'Sullivan
commit: when committing the results of a merge, it's all or nothing...
r6385
Greg Ward
commit: explicitly document the existence of "last-message.txt"
r11877 If no commit message is specified, Mercurial starts your
configured editor where you can enter a message. In case your
commit fails, you will find a backup of your message in
``.hg/last-message.txt``.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
Matt Mackall
commit: improve --close-branch documentation...
r25304 The --close-branch flag can be used to mark the current branch
head closed. When all heads of a branch are closed, the branch
will be considered closed and no longer listed.
Idan Kamara
commit: add option to amend the working dir parent...
r16458 The --amend flag can be used to amend the parent of the
working directory with a new commit that contains the changes
in the parent in addition to those currently reported by :hg:`status`,
if there are any. The old commit is stored in a backup bundle in
``.hg/strip-backup`` (see :hg:`help bundle` and :hg:`help unbundle`
on how to restore it).
Message, user and date are taken from the amended commit unless
specified. When a message isn't specified on the command line,
the editor will open with the message of the amended commit.
It is not possible to amend public changesets (see :hg:`help phases`)
or changesets that have children.
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if nothing changed.
Augie Fackler
commit: add some help examples (issue4963)...
r27242
.. container:: verbose
Examples:
Yuya Nishihara
commit: fix rest syntax of examples...
r27254 - commit all files ending in .py::
Augie Fackler
commit: add some help examples (issue4963)...
r27242
Matt Harbison
commit: adjust the quoting in the examples to be Windows friendly...
r27247 hg commit --include "set:**.py"
Augie Fackler
commit: add some help examples (issue4963)...
r27242
Yuya Nishihara
commit: fix rest syntax of examples...
r27254 - commit all non-binary files::
Augie Fackler
commit: add some help examples (issue4963)...
r27242
Matt Harbison
commit: adjust the quoting in the examples to be Windows friendly...
r27247 hg commit --exclude "set:binary()"
Augie Fackler
commit: add some help examples (issue4963)...
r27242
Yuya Nishihara
commit: fix rest syntax of examples...
r27254 - amend the current commit and set the date to now::
Augie Fackler
commit: add some help examples (issue4963)...
r27242
hg commit --amend --date now
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
FUJIWARA Katsunori
commands: make commit acquire locks before processing (issue4368)...
r27192 wlock = lock = None
try:
wlock = repo.wlock()
lock = repo.lock()
return _docommit(ui, repo, *pats, **opts)
finally:
release(lock, wlock)
def _docommit(ui, repo, *pats, **opts):
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 if opts.get(r'interactive'):
opts.pop(r'interactive')
Philippe Pepiot
commit: return 1 for interactive commit with no changes (issue5397)...
r30157 ret = cmdutil.dorecord(ui, repo, commit, None, False,
Augie Fackler
commit: keep opts as byteskwargs as much as possible...
r31534 cmdutil.recordfilter, *pats,
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 **opts)
Philippe Pepiot
commit: return 1 for interactive commit with no changes (issue5397)...
r30157 # ret can be 0 (no changes to record) or the value returned by
# commit(), 1 if nothing changed or None on success.
return 1 if ret == 0 else ret
Laurent Charignon
record: add interactive option to the commit command
r24278
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Martin Geisler
subrepos: abort commit by default if a subrepo is dirty (BC)...
r15321 if opts.get('subrepos'):
Matt Mackall
amend: complain more comprehensibly about subrepos
r19232 if opts.get('amend'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot amend with --subrepos'))
timeless@mozdev.org
spelling: override
r17504 # Let --subrepos on the command line override config setting.
Mads Kiilerich
config: set a 'source' in most cases where config don't come from file but code...
r20790 ui.setconfig('ui', 'commitsubrepos', True, 'commit')
Martin Geisler
subrepos: abort commit by default if a subrepo is dirty (BC)...
r15321
Matt Mackall
checkunfinished: accommodate histedit quirk...
r19496 cmdutil.checkunfinished(repo, commit=True)
Simon King
graft: refuse to commit an interrupted graft (issue3667)
r19253
Iulian Stana
commit: amending with --close-branch (issue3445)...
r19305 branch = repo[None].branch()
bheads = repo.branchheads(branch)
John Mulligan
branch closing: mark closed branches with a 'close' extra...
r7655 extra = {}
if opts.get('close_branch'):
extra['close'] = 1
Dirkjan Ochtman
warn about new heads on commit (issue842)
r6336
Iulian Stana
commit: amending with --close-branch (issue3445)...
r19305 if not bheads:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('can only close branch heads'))
Iulian Stana
commit: amending with --close-branch (issue3445)...
r19305 elif opts.get('amend'):
Augie Fackler
commands: inline definition of localrepo.parents() and drop the method (API)...
r27167 if repo[None].parents()[0].p1().branch() != branch and \
repo[None].parents()[0].p2().branch() != branch:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('can only close branch heads'))
Matt Mackall
commit: note new branch heads rather than topological heads...
r11173
Idan Kamara
commit: add option to amend the working dir parent...
r16458 if opts.get('amend'):
Adrian Buehlmann
commit: use ui.configbool when checking 'commitsubrepos' setting on --amend...
r16505 if ui.configbool('ui', 'commitsubrepos'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot amend with ui.commitsubrepos enabled'))
Idan Kamara
commit: add option to amend the working dir parent...
r16458
old = repo['.']
Augie Fackler
commit: correctly check commit mutability during commit --amend...
r22417 if not old.mutable():
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot amend public changesets'))
Idan Kamara
commit: add option to amend the working dir parent...
r16458 if len(repo[None].parents()) > 1:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot amend while merging'))
Durham Goode
obsolete: add allowunstable option...
r22952 allowunstable = obsolete.isenabled(repo, obsolete.allowunstableopt)
if not allowunstable and old.children():
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot amend changeset with children'))
Idan Kamara
commit: add option to amend the working dir parent...
r16458
timeless
commit: block amend while histedit is in progress (issue4800)
r28359 # Currently histedit gets confused if an amend happens while histedit
# is in progress. Since we have a checkunfinished command, we are
# temporarily honoring it.
#
# Note: eventually this guard will be removed. Please do not expect
# this behavior to remain.
if not obsolete.isenabled(repo, obsolete.createmarkersopt):
cmdutil.checkunfinished(repo)
FUJIWARA Katsunori
commit: create new amend changeset as secret correctly for "--secret" option...
r20700 # commitfunc is used only for temporary amend commit by cmdutil.amend
Idan Kamara
commit: add option to amend the working dir parent...
r16458 def commitfunc(ui, repo, message, match, opts):
FUJIWARA Katsunori
commit: create new amend changeset as secret correctly for "--secret" option...
r20700 return repo.commit(message,
opts.get('user') or old.user(),
opts.get('date') or old.date(),
match,
extra=extra)
Idan Kamara
commit: add option to amend the working dir parent...
r16458
node = cmdutil.amend(ui, repo, commitfunc, old, extra, pats, opts)
if node == old.node():
Martin Geisler
commit: note when files are missing...
r13899 ui.status(_("nothing changed\n"))
Idan Kamara
commit: add option to amend the working dir parent...
r16458 return 1
else:
def commitfunc(ui, repo, message, match, opts):
Jun Wu
commit: get rid of ui.backupconfig
r31455 overrides = {}
if opts.get('secret'):
overrides[('phases', 'new-commit')] = 'secret'
Pierre-Yves David
commit: update the --secret code to use backupconfig and restoreconfig...
r22039 baseui = repo.baseui
Jun Wu
commit: get rid of ui.backupconfig
r31455 with baseui.configoverride(overrides, 'commit'):
with ui.configoverride(overrides, 'commit'):
editform = cmdutil.mergeeditform(repo[None],
'commit.normal')
Augie Fackler
commit: keep opts as byteskwargs as much as possible...
r31534 editor = cmdutil.getcommiteditor(
editform=editform, **pycompat.strkwargs(opts))
Jun Wu
commit: get rid of ui.backupconfig
r31455 return repo.commit(message,
opts.get('user'),
opts.get('date'),
match,
editor=editor,
extra=extra)
Idan Kamara
commit: add option to amend the working dir parent...
r16458
node = cmdutil.commit(ui, repo, commitfunc, pats, opts)
if not node:
Matt Harbison
commit: factor the post commit status check into a cmdutil method...
r27943 stat = cmdutil.postcommitstatus(repo, pats, opts)
Idan Kamara
commit: add option to amend the working dir parent...
r16458 if stat[3]:
ui.status(_("nothing changed (%d missing files, see "
"'hg status')\n") % len(stat[3]))
else:
ui.status(_("nothing changed\n"))
return 1
Matt Mackall
commit: note new branch heads rather than topological heads...
r11173
Kevin Bullock
commit: factor out status printing into a helper function...
r18688 cmdutil.commitstatus(repo, node, branch, bheads, opts)
Gilles Moris
Have verbose and debug flag print the changeset rev and hash when committing....
r6935
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570 @command('config|showconfig|debugconfig',
Matt Mackall
config: add initial implementation of --edit...
r20572 [('u', 'untrusted', None, _('show untrusted configuration options')),
Matt Mackall
config: add --global and --local flags...
r20782 ('e', 'edit', None, _('edit user config')),
('l', 'local', None, _('edit repository config')),
Mathias De Maré
config: add template support...
r29950 ('g', 'global', None, _('edit global config'))] + formatteropts,
Gregory Szorc
commands: define optionalrepo in command decorator
r21775 _('[-u] [NAME]...'),
optionalrepo=True)
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570 def config(ui, repo, *values, **opts):
"""show combined config settings from all hgrc files
With no arguments, print names and values of all config items.
With one argument of the form section.name, print just the value
of that config item.
With multiple arguments, print names and values of all config
items with matching section names.
Matt Mackall
config: mention edit options and config topic in help
r20783 With --edit, start an editor on the user-level config file. With
--global, edit the system-wide config file. With --local, edit the
repository-level config file.
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570 With --debug, the source (filename and line number) is printed
for each config item.
Matt Mackall
config: mention edit options and config topic in help
r20783 See :hg:`help config` for more information about config files.
Aaron Kushner
config: exit non zero on non-existent config option (issue4247)...
r22316 Returns 0 on success, 1 if NAME does not exist.
Matt Mackall
config: mention edit options and config topic in help
r20783
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
config: add --global and --local flags...
r20782 if opts.get('edit') or opts.get('local') or opts.get('global'):
if opts.get('local') and opts.get('global'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("can't use --local and --global together"))
Matt Mackall
config: add --global and --local flags...
r20782
if opts.get('local'):
if not repo:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("can't use --local outside a repository"))
Pierre-Yves David
commands: directly use repo.vfs.join...
r31321 paths = [repo.vfs.join('hgrc')]
Matt Mackall
config: add --global and --local flags...
r20782 elif opts.get('global'):
Jun Wu
rcutil: move scmutil.*rcpath to rcutil (API)...
r31679 paths = rcutil.systemrcpath()
Matt Mackall
config: add --global and --local flags...
r20782 else:
Jun Wu
rcutil: move scmutil.*rcpath to rcutil (API)...
r31679 paths = rcutil.userrcpath()
Matt Mackall
config: add --global and --local flags...
r20782
Matt Mackall
config: add initial implementation of --edit...
r20572 for f in paths:
if os.path.exists(f):
break
else:
Jordi Gutiérrez Hermoso
config: give more fine-tuned sample hgrcs to this command...
r22383 if opts.get('global'):
Jordi Gutiérrez Hermoso
config: use the same hgrc for a cloned repo as for an uninitted repo...
r22837 samplehgrc = uimod.samplehgrcs['global']
Jordi Gutiérrez Hermoso
config: give more fine-tuned sample hgrcs to this command...
r22383 elif opts.get('local'):
Jordi Gutiérrez Hermoso
config: use the same hgrc for a cloned repo as for an uninitted repo...
r22837 samplehgrc = uimod.samplehgrcs['local']
Jordi Gutiérrez Hermoso
config: give more fine-tuned sample hgrcs to this command...
r22383 else:
Jordi Gutiérrez Hermoso
config: use the same hgrc for a cloned repo as for an uninitted repo...
r22837 samplehgrc = uimod.samplehgrcs['user']
Jordi Gutiérrez Hermoso
config: give more fine-tuned sample hgrcs to this command...
r22383
Matt Mackall
config: add initial implementation of --edit...
r20572 f = paths[0]
Matt Mackall
config: add example config file when -e called with no config
r20573 fp = open(f, "w")
Jordi Gutiérrez Hermoso
config: give more fine-tuned sample hgrcs to this command...
r22383 fp.write(samplehgrc)
Matt Mackall
config: add example config file when -e called with no config
r20573 fp.close()
Matt Mackall
config: add initial implementation of --edit...
r20572 editor = ui.geteditor()
Yuya Nishihara
util.system: use ui.system() in place of optional ui.fout parameter
r23270 ui.system("%s \"%s\"" % (editor, f),
Simon Farnsworth
config: set blockedtag when invoking configuration edit
r31201 onerr=error.Abort, errprefix=_("edit failed"),
blockedtag='config_edit')
Matt Mackall
config: add initial implementation of --edit...
r20572 return
Augie Fackler
config: activate pager if not starting an editor...
r31034 ui.pager('config')
Mathias De Maré
config: add template support...
r29950 fm = ui.formatter('config', opts)
Jun Wu
rcutil: let rccomponents return different types of configs (API)...
r31683 for t, f in rcutil.rccomponents():
if t == 'path':
ui.debug('read config from: %s\n' % f)
Jun Wu
rcutil: let environ override system configs (BC)...
r31685 elif t == 'items':
Jun Wu
debugconfig: list environment variables in debug output...
r31686 for section, name, value, source in f:
ui.debug('set config by: %s\n' % source)
Jun Wu
rcutil: let rccomponents return different types of configs (API)...
r31683 else:
raise error.ProgrammingError('unknown rctype: %s' % t)
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570 untrusted = bool(opts.get('untrusted'))
if values:
sections = [v for v in values if '.' not in v]
items = [v for v in values if '.' in v]
if len(items) > 1 or items and sections:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('only one config item permitted'))
Aaron Kushner
config: exit non zero on non-existent config option (issue4247)...
r22316 matched = False
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570 for section, name, value in ui.walkconfig(untrusted=untrusted):
Yuya Nishihara
ui: do not translate empty configsource() to 'none' (API)...
r30618 source = ui.configsource(section, name, untrusted)
Rishabh Madan
py3: change explicit conversion of config value from str to pycompat.bytestr
r31477 value = pycompat.bytestr(value)
Mathias De Maré
config: add template support...
r29950 if fm.isplain():
Yuya Nishihara
ui: do not translate empty configsource() to 'none' (API)...
r30618 source = source or 'none'
Mathias De Maré
config: add template support...
r29950 value = value.replace('\n', '\\n')
entryname = section + '.' + name
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570 if values:
for v in values:
if v == section:
Mathias De Maré
config: add template support...
r29950 fm.startitem()
Yuya Nishihara
ui: do not translate empty configsource() to 'none' (API)...
r30618 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
Mathias De Maré
config: add template support...
r29950 fm.write('name value', '%s=%s\n', entryname, value)
Aaron Kushner
config: exit non zero on non-existent config option (issue4247)...
r22316 matched = True
Mathias De Maré
config: add template support...
r29950 elif v == entryname:
fm.startitem()
Yuya Nishihara
ui: do not translate empty configsource() to 'none' (API)...
r30618 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
Mathias De Maré
config: add template support...
r29950 fm.write('value', '%s\n', value)
fm.data(name=entryname)
Aaron Kushner
config: exit non zero on non-existent config option (issue4247)...
r22316 matched = True
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570 else:
Mathias De Maré
config: add template support...
r29950 fm.startitem()
Yuya Nishihara
ui: do not translate empty configsource() to 'none' (API)...
r30618 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
Mathias De Maré
config: add template support...
r29950 fm.write('name value', '%s=%s\n', entryname, value)
Aaron Kushner
config: exit non zero on non-existent config option (issue4247)...
r22316 matched = True
Mathias De Maré
config: add template support...
r29950 fm.end()
Aaron Kushner
config: exit non zero on non-existent config option (issue4247)...
r22316 if matched:
return 0
return 1
Matt Mackall
config: move showconfig code and add config as primary alias...
r20570
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('copy|cp',
[('A', 'after', None, _('record a copy that has already occurred')),
('f', 'force', None, _('forcibly copy over an existing managed file')),
] + walkopts + dryrunopts,
_('[OPTION]... [SOURCE]... DEST'))
Bryan O'Sullivan
Add rename/mv command....
r1253 def copy(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """mark files as copied for the next commit
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Mark dest as having copies of source files. If dest is a
directory, copies are put in that directory. If dest is a file,
timeless
help: miscellaneous language fixes
r7807 the source must be a single file.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
By default, this command copies the contents of files as they
timeless
Improve English for help text of many core hg commands....
r8779 exist in the working directory. If invoked with -A/--after, the
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 operation is recorded, but no copying is performed.
timeless
help: miscellaneous language fixes
r7807 This command takes effect with the next commit. To undo a copy
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 before that, see :hg:`revert`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if errors are encountered.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Bryan O'Sullivan
with: use context manager for wlock in copy
r27805 with repo.wlock(False):
Matt Mackall
copy: handle rename internally...
r5610 return cmdutil.copy(ui, repo, pats, opts)
mpm@selenic.com
Add hg copy...
r363
Yuya Nishihara
commands: move debugcommands and debugcomplete back to commands module...
r32376 @command('debugcommands', [], _('[COMMAND]'), norepo=True)
def debugcommands(ui, cmd='', *args):
"""list all available commands and options"""
for cmd, vals in sorted(table.iteritems()):
cmd = cmd.split('|')[0].strip('^')
opts = ', '.join([i[1] for i in vals[1]])
ui.write('%s: %s\n' % (cmd, opts))
@command('debugcomplete',
[('o', 'options', None, _('show the command options'))],
_('[-o] CMD'),
norepo=True)
def debugcomplete(ui, cmd='', **opts):
"""returns the completion list associated with the given command"""
if opts.get('options'):
options = []
otables = [globalopts]
if cmd:
aliases, entry = cmdutil.findcmd(cmd, table, False)
otables.append(entry[1])
for t in otables:
for o in t:
if "(DEPRECATED)" in o[3]:
continue
if o[0]:
options.append('-%s' % o[0])
options.append('--%s' % o[1])
ui.write("%s\n" % "\n".join(options))
return
cmdlist, unused_allcmds = cmdutil.findpossible(cmd, table)
if ui.verbose:
cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
ui.write("%s\n" % "\n".join(sorted(cmdlist)))
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^diff',
[('r', 'rev', [], _('revision'), _('REV')),
('c', 'change', '', _('change made by revision'), _('REV'))
] + diffopts + diffopts2 + walkopts + subrepoopts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... ([-c REV] | [-r REV1 [-r REV2]]) [FILE]...'),
inferrepo=True)
Bryan O'Sullivan
Convert diff command over to using walk code.
r732 def diff(ui, repo, *pats, **opts):
Benoit Boissinot
make all commands be repo-wide by default...
r1568 """diff repository (or selected files)
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Show differences between revisions for the specified files.
Differences between files are shown using the unified diff format.
Erik Zielke
Use note admonition
r12389 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
timeless
commands: the first word of each note should be capital or `hg`
r27476 :hg:`diff` may generate unexpected results for merges, as it will
Erik Zielke
Use note admonition
r12389 default to comparing against the working directory's first
parent changeset if no revisions are specified.
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 When two revision arguments are given, then changes are shown
between those revisions. If only one revision is specified then
that revision is compared to the working directory, and, when no
revisions are specified, the working directory files are compared
timeless
diff: clarify comparison as first parent
r27452 to its first parent.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
timeless
commands: correct diff -c explanation
r10527 Alternatively you can specify -c/--change with a revision to see
the changes in that changeset relative to its first parent.
timeless
commands: mention diff -c
r10520
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Without the -a/--text option, diff will avoid generating diffs of
files it detects as binary. With -a, diff will generate a diff
anyway, probably with undesirable results.
Use the -g/--git option to generate diffs in the git extended diff
Martin Geisler
Use hg role in help strings
r10973 format. For more information, read :hg:`help diffs`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
diff: add help examples
r15110 .. container:: verbose
Examples:
- compare a file in the current working directory to its parent::
hg diff foo.c
- compare two historical versions of a directory, with rename info::
hg diff --git -r 1.0:1.2 lib/
- get change stats relative to the last change on some date::
hg diff --stat -r "date('may 2')"
- diff all newly-added files that contain a keyword::
hg diff "set:added() and grep(GNU)"
- compare a revision and its parents::
hg diff -c 9353 # compare against first parent
hg diff -r 9353^:9353 # same using revset syntax
hg diff -r 9353^2:9353 # compare against the second parent
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Stepan Koltsov
diff: add --change option to display single changeset diff (issue1420)
r7628
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Stepan Koltsov
diff: add --change option to display single changeset diff (issue1420)
r7628 revs = opts.get('rev')
change = opts.get('change')
Brodie Rao
diff: add --stat for diffstat output...
r9640 stat = opts.get('stat')
Martin Geisler
diff: change --inverse to --reverse...
r9857 reverse = opts.get('reverse')
Stepan Koltsov
diff: add --change option to display single changeset diff (issue1420)
r7628
if revs and change:
msg = _('cannot specify --rev and --change at the same time')
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(msg)
Stepan Koltsov
diff: add --change option to display single changeset diff (issue1420)
r7628 elif change:
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 node2 = scmutil.revsingle(repo, change, None).node()
Matt Mackall
misc: replace .parents()[0] with p1()
r13878 node1 = repo[node2].p1().node()
Stepan Koltsov
diff: add --change option to display single changeset diff (issue1420)
r7628 else:
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 node1, node2 = scmutil.revpair(repo, revs)
mpm@selenic.com
big heap of command clean-up work...
r245
Martin Geisler
diff: change --inverse to --reverse...
r9857 if reverse:
Yannick Gingras
diff: add --inverse option...
r9725 node1, node2 = node2, node1
Siddharth Agarwal
diff: explicitly honor all diffopts...
r23456 diffopts = patch.diffallopts(ui, opts)
Matt Mackall
scmutil: switch match users to supplying contexts...
r14671 m = scmutil.match(repo[node2], pats, opts)
Augie Fackler
diff: migrate to modern pager API
r31030 ui.pager('diff')
Martin Geisler
diff: recurse into subrepositories with --subrepos/-S flag
r12167 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
Siddharth Agarwal
commands.diff: add support for diffs relative to a subdirectory...
r24432 listsubrepos=opts.get('subrepos'),
Sean Farley
diff: rename --relative option to --root...
r24455 root=opts.get('root'))
Thomas Arendsen Hein
Show revisions in diffs like CVS, based on a patch from Goffredo Baroncelli....
r396
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^export',
[('o', 'output', '',
_('print output to file with formatted name'), _('FORMAT')),
('', 'switch-parent', None, _('diff against the second parent')),
('r', 'rev', [], _('revisions to export'), _('REV')),
] + diffopts,
Mads Kiilerich
export: export working directory parent by default...
r18956 _('[OPTION]... [-o OUTFILESPEC] [-r] [REV]...'))
mpm@selenic.com
[PATCH] New export patch...
r580 def export(ui, repo, *changesets, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """dump the header and diffs for one or more changesets
Print the changeset header and diffs for one or more revisions.
Mads Kiilerich
export: export working directory parent by default...
r18956 If no revision is given, the parent of the working directory is used.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Steve Losh
commands: fix the list of changeset header information in 'hg help export'
r10334 The information shown in the changeset header is: author, date,
Steve Losh
commands: fix more changeset header information in 'hg help export'
r10335 branch name (if non-default), changeset hash, parent(s) and commit
comment.
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822
Christian Ebert
Use more note admonitions in help texts
r12390 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
timeless
commands: the first word of each note should be capital or `hg`
r27476 :hg:`export` may generate unexpected diff output for merge
Christian Ebert
Use more note admonitions in help texts
r12390 changesets, as it will compare the merge changeset against its
first parent only.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Output may be to a file, in which case the name of the file is
Martin Geisler
commands: use field lists instead of literal blocks in docstrings...
r9892 given using a format string. The formatting rules are as follows:
:``%%``: literal "%" character
Matt Mackall
help: fix bytes/digit confusion for hashes...
r11718 :``%H``: changeset hash (40 hexadecimal digits)
Martin Geisler
commands: use field lists instead of literal blocks in docstrings...
r9892 :``%N``: number of patches being generated
:``%R``: changeset revision number
:``%b``: basename of the exporting repository
Matt Mackall
help: fix bytes/digit confusion for hashes...
r11718 :``%h``: short-form changeset hash (12 hexadecimal digits)
Andrzej Bieniek
export: add %m to file format string (first line of the commit message)...
r14986 :``%m``: first line of the commit message (only alphanumeric characters)
Martin Geisler
commands: use field lists instead of literal blocks in docstrings...
r9892 :``%n``: zero-padded sequence number, starting at 1
:``%r``: zero-padded changeset revision number
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 Without the -a/--text option, export will avoid generating diffs
of files it detects as binary. With -a, export will generate a
diff anyway, probably with undesirable results.
Use the -g/--git option to generate diffs in the git extended diff
Martin Geisler
Use hg role in help strings
r10973 format. See :hg:`help diffs` for more information.
Dirkjan Ochtman
help: commands supporting --git point to the gitdiffs topic (issue1352)
r7307
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 With the --switch-parent option, the diff will be against the
second parent. It can be useful to review a merge.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
export: add help examples
r15111 .. container:: verbose
Examples:
- use export and import to transplant a bugfix to the current
branch::
hg export -r 9353 | hg import -
- export all the changesets between two revisions to a file with
rename information::
hg export --git -r 123:150 > changes.txt
- split outgoing changes into a series of patches with
descriptive names::
hg export -r "outgoing()" -o "%n-%m.patch"
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: use pycompat.byteskwargs() to convert opts to bytes...
r31826 opts = pycompat.byteskwargs(opts)
Alexander Solovyov
commands.export: accept -r option as revision specification...
r10015 changesets += tuple(opts.get('rev', []))
Mads Kiilerich
export: export working directory parent by default...
r18956 if not changesets:
changesets = ['.']
Thomas Arendsen Hein
export: catch exporting empty revsets (issue3353)...
r16357 revs = scmutil.revrange(repo, changesets)
if not revs:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("export requires at least one changeset"))
Vadim Gelfer
refactor text diff/patch code....
r2874 if len(revs) > 1:
ui.note(_('exporting patches:\n'))
else:
ui.note(_('exporting patch:\n'))
Augie Fackler
export: migrate to modern pager API
r31031 ui.pager('export')
Augie Fackler
cmdutil: rename template param to export to fntemplate...
r32431 cmdutil.export(repo, revs, fntemplate=opts.get('output'),
Alexander Solovyov
commands: optional options where possible...
r7131 switch_parent=opts.get('switch_parent'),
Siddharth Agarwal
export: explicitly honor all diffopts...
r23690 opts=patch.diffallopts(ui, opts))
mpm@selenic.com
Migrate rawcommit, import, export, history, and merge...
r246
Matt Mackall
files: add new command unifying locate and manifest functionality
r22423 @command('files',
[('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
Matt Harbison
subrepo: add basic support to hgsubrepo for the files command...
r24413 ] + walkopts + formatteropts + subrepoopts,
liscju
files: change documentation to match its behaviour (issue5276)...
r29849 _('[OPTION]... [FILE]...'))
Matt Mackall
files: add new command unifying locate and manifest functionality
r22423 def files(ui, repo, *pats, **opts):
"""list tracked files
Print files under Mercurial control in the working directory or
liscju
files: change documentation to match its behaviour (issue5276)...
r29849 specified revision for given files (excluding removed files).
Files can be specified as filenames or filesets.
If no files are given to match, this command prints the names
of all files under Mercurial control.
Matt Mackall
files: add new command unifying locate and manifest functionality
r22423
.. container:: verbose
Examples:
- list all files under the current directory::
hg files .
- shows sizes and flags for current revision::
hg files -vr .
- list all files named README::
hg files -I "**/README"
- list all binary files::
hg files "set:binary()"
Wagner Bruna
files: fix example list syntax
r23074 - find files containing a regular expression::
Matt Mackall
files: add new command unifying locate and manifest functionality
r22423
hg files "set:grep('bob')"
- search tracked file contents with xargs and grep::
hg files -0 | xargs -0 grep foo
Matt Mackall
help: fix typo in files help
r23414 See :hg:`help patterns` and :hg:`help filesets` for more information
Matt Mackall
files: add new command unifying locate and manifest functionality
r22423 on specifying file patterns.
Returns 0 if a match is found, 1 otherwise.
"""
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142
opts = pycompat.byteskwargs(opts)
ctx = scmutil.revsingle(repo, opts.get('rev'), None)
Matt Mackall
files: add new command unifying locate and manifest functionality
r22423
end = '\n'
if opts.get('print0'):
end = '\0'
fmt = '%s' + end
m = scmutil.match(ctx, pats, opts)
Augie Fackler
files: enable pager
r31035 ui.pager('files')
Yuya Nishihara
formatter: add context manager interface for convenience...
r29882 with ui.formatter('files', opts) as fm:
return cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos'))
Matt Mackall
files: add new command unifying locate and manifest functionality
r22423
Gregory Szorc
commands: define inferrepo in command decorator
r21778 @command('^forget', walkopts, _('[OPTION]... FILE...'), inferrepo=True)
Steve Losh
Add a forget command for easily untracking files....
r8902 def forget(ui, repo, *pats, **opts):
"""forget the specified files on the next commit
Mark the specified files so they will no longer be tracked
after the next commit.
This only removes files from the current branch, not from the
entire project history, and it does not delete them from the
working directory.
Nathan Goldbaum
forget: add a note to the command help about remove
r25714 To delete the file from the working directory, see :hg:`remove`.
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 To undo a forget before the next commit, see :hg:`add`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
forget: add help examples
r15118 .. container:: verbose
Examples:
- forget newly-added binary files::
hg forget "set:added() and binary()"
- forget files that would be excluded by .hgignore::
hg forget "set:hgignore()"
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Steve Losh
Add a forget command for easily untracking files....
r8902 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Steve Losh
Add a forget command for easily untracking files....
r8902 if not pats:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no files specified'))
Steve Losh
Add a forget command for easily untracking files....
r8902
David M. Carr
forget: fix subrepo recursion for explicit path handling...
r15912 m = scmutil.match(repo[None], pats, opts)
rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False)[0]
return rejected and 1 or 0
Steve Losh
Add a forget command for easily untracking files....
r8902
Matt Mackall
graft: add user, date, and tool options
r15240 @command(
'graft',
Thomas Arendsen Hein
graft: allow -r to specify revisions
r16992 [('r', 'rev', [], _('revisions to graft'), _('REV')),
('c', 'continue', False, _('resume interrupted graft')),
Matt Mackall
graft: add --continue support
r15241 ('e', 'edit', False, _('invoke editor on commit messages')),
Levi Bard
graft: implement --log (issue3438)
r16660 ('', 'log', None, _('append graft info to log message')),
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 ('f', 'force', False, _('force graft')),
Matt Mackall
graft: add --continue support
r15241 ('D', 'currentdate', False,
_('record the current date as commit date')),
('U', 'currentuser', False,
_('record the current user as committer'), _('DATE'))]
Matt Mackall
graft: add --dry-run support (issue3362)
r16389 + commitopts2 + mergetoolopts + dryrunopts,
Mads Kiilerich
graft: clarify in help that `-r` is not just optional...
r27898 _('[OPTION]... [-r REV]... REV...'))
Matt Mackall
graft: add --continue support
r15241 def graft(ui, repo, *revs, **opts):
Matt Mackall
graft: add initial implementation
r15238 '''copy changes from other branches onto the current branch
This command uses Mercurial's merge logic to copy individual
changes from other branches without merging branches in the
history graph. This is sometimes known as 'backporting' or
Matt Mackall
graft: add examples and information about copied metadata
r15242 'cherry-picking'. By default, graft will copy user, date, and
description from the source changesets.
Matt Mackall
graft: add initial implementation
r15238
Changesets that are ancestors of the current revision, that have
already been grafted, or that are merges will be skipped.
Levi Bard
graft: implement --log (issue3438)
r16660 If --log is specified, log messages will have a comment appended
of the form::
(grafted from CHANGESETHASH)
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 If --force is specified, revisions will be grafted even if they
are already ancestors of or have been grafted to the destination.
This is useful when the revisions have since been backed out.
Matt Mackall
graft: add --continue support
r15241 If a graft merge results in conflicts, the graft process is
Kevin Bullock
graft: use consistent language in help...
r15701 interrupted so that the current merge can be manually resolved.
Once all conflicts are addressed, the graft process can be
continued with the -c/--continue option.
Matt Mackall
graft: add --continue support
r15241
.. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
timeless
commands: consistently indent notes 3 spaces...
r27471 The -c/--continue option does not reapply earlier options, except
for --force.
Matt Mackall
graft: add --continue support
r15241
Matt Mackall
graft: add examples and information about copied metadata
r15242 .. container:: verbose
Examples:
- copy a single change to the stable branch and edit its description::
hg update stable
hg graft --edit 9393
- graft a range of changesets with one exception, updating dates::
hg graft -D "2085::2093 and not 2091"
- continue a graft after resolving conflicts::
hg graft -c
- show the source of a grafted changeset::
Matt Mackall
log: remove tip from example
r19401 hg log --debug -r .
Matt Mackall
graft: add examples and information about copied metadata
r15242
timeless
log: help provide sort by date example
r27664 - show revisions sorted by date::
timeless
graft: use double quotes for arguments...
r28797 hg log -r "sort(all(), date)"
timeless
log: help provide sort by date example
r27664
Martin von Zweigbergk
help: remove now-redundant pointer to revsets help...
r30785 See :hg:`help revisions` for more about specifying revisions.
Alexander Becher
graft: add a reference to revsets to the help text (issue3362)
r21949
Matt Mackall
graft: add initial implementation
r15238 Returns 0 on successful completion.
'''
Bryan O'Sullivan
with: use context manager for wlock in graft
r27808 with repo.wlock():
FUJIWARA Katsunori
commands: widen wlock scope of graft for consitency while processing...
r27194 return _dograft(ui, repo, *revs, **opts)
def _dograft(ui, repo, *revs, **opts):
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Gábor Stefanik
graft: use opts.get() consistently...
r29632 if revs and opts.get('rev'):
Mads Kiilerich
graft: warn when -r is combined with revisions as positional arguments...
r27899 ui.warn(_('warning: inconsistent use of --rev might give unexpected '
'revision ordering!\n'))
Thomas Arendsen Hein
graft: allow -r to specify revisions
r16992 revs = list(revs)
Gábor Stefanik
graft: use opts.get() consistently...
r29632 revs.extend(opts.get('rev'))
Thomas Arendsen Hein
graft: allow -r to specify revisions
r16992
Matt Mackall
graft: add user, date, and tool options
r15240 if not opts.get('user') and opts.get('currentuser'):
opts['user'] = ui.username()
if not opts.get('date') and opts.get('currentdate'):
opts['date'] = "%d %d" % util.makedate()
Pulkit Goyal
py3: convert kwargs' keys to str before passing in cmdutil.getcommiteditor
r32192 editor = cmdutil.getcommiteditor(editform='graft',
**pycompat.strkwargs(opts))
Matt Mackall
graft: add --edit
r15239
Matt Mackall
graft: add --continue support
r15241 cont = False
Gábor Stefanik
graft: use opts.get() consistently...
r29632 if opts.get('continue'):
Matt Mackall
graft: add --continue support
r15241 cont = True
if revs:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("can't specify --continue and revisions"))
Matt Mackall
graft: add --continue support
r15241 # read in unfinished revisions
try:
Angel Ezquerra
localrepo: remove all external users of localrepo.opener...
r23877 nodes = repo.vfs.read('graftstate').splitlines()
Matt Mackall
graft: add --continue support
r15241 revs = [repo[node].rev() for node in nodes]
Gregory Szorc
global: mass rewrite to use modern exception syntax...
r25660 except IOError as inst:
Matt Mackall
graft: add --continue support
r15241 if inst.errno != errno.ENOENT:
raise
timeless
graft: suggest the correct tool to continue (not graft)...
r28121 cmdutil.wrongtooltocontinue(repo, _('graft'))
Matt Mackall
graft: add --continue support
r15241 else:
Matt Mackall
commands: add checks for unfinished operations (issue3955)...
r19476 cmdutil.checkunfinished(repo)
Matt Mackall
graft: add --continue support
r15241 cmdutil.bailifchanged(repo)
if not revs:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no revisions specified'))
Matt Mackall
graft: add --continue support
r15241 revs = scmutil.revrange(repo, revs)
Matt Mackall
graft: add initial implementation
r15238
Pierre-Yves David
strip: stop calling `remove` on smartset...
r22824 skipped = set()
Matt Mackall
graft: add initial implementation
r15238 # check for merges
Matt Mackall
localrepo: convert various repo.set() users to repo.revs()
r15404 for rev in repo.revs('%ld and merge()', revs):
ui.warn(_('skipping ungraftable merge revision %s\n') % rev)
Pierre-Yves David
strip: stop calling `remove` on smartset...
r22824 skipped.add(rev)
revs = [r for r in revs if r not in skipped]
Matt Mackall
graft: add initial implementation
r15238 if not revs:
return -1
Siddharth Agarwal
graft: make --force apply across continues (issue3220)...
r21980 # Don't check in the --continue case, in effect retaining --force across
# --continues. That's because without --force, any revisions we decided to
# skip would have been filtered out here, so they wouldn't have made their
# way to the graftstate. With --force, any revisions we would have otherwise
# skipped would not have been filtered out, and if they hadn't been applied
# already, they'd have been in the graftstate.
if not (cont or opts.get('force')):
# check for ancestors of dest branch
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 crev = repo['.'].rev()
ancestors = repo.changelog.ancestors([crev], inclusive=True)
# XXX make this lazy in the future
# don't mutate while iterating, create a copy
for rev in list(revs):
if rev in ancestors:
Mads Kiilerich
graft: show hashes in user-facing messages...
r23507 ui.warn(_('skipping ancestor revision %d:%s\n') %
(rev, repo[rev]))
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 # XXX remove on list is slow
revs.remove(rev)
if not revs:
return -1
# analyze revs for earlier grafts
ids = {}
for ctx in repo.set("%ld", revs):
ids[ctx.hex()] = ctx.rev()
n = ctx.extra().get('source')
if n:
ids[n] = ctx.rev()
# check ancestors for earlier grafts
ui.debug('scanning for duplicate grafts\n')
Mads Kiilerich
graft: fix graft across merges of duplicates of grafted changes...
r32242 # The only changesets we can be sure doesn't contain grafts of any
# revs, are the ones that are common ancestors of *all* revs:
for rev in repo.revs('only(%d,ancestor(%ld))', crev, revs):
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 ctx = repo[rev]
n = ctx.extra().get('source')
if n in ids:
Matt Mackall
merge with stable
r22305 try:
r = repo[n].rev()
except error.RepoLookupError:
r = None
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 if r in revs:
Mads Kiilerich
graft: show hashes in user-facing messages...
r23507 ui.warn(_('skipping revision %d:%s '
'(already grafted to %d:%s)\n')
% (r, repo[r], rev, ctx))
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 revs.remove(r)
elif ids[n] in revs:
Matt Mackall
merge with stable
r22305 if r is None:
Mads Kiilerich
graft: show hashes in user-facing messages...
r23507 ui.warn(_('skipping already grafted revision %d:%s '
'(%d:%s also has unknown origin %s)\n')
% (ids[n], repo[ids[n]], rev, ctx, n[:12]))
Matt Mackall
merge with stable
r22305 else:
Mads Kiilerich
graft: show hashes in user-facing messages...
r23507 ui.warn(_('skipping already grafted revision %d:%s '
'(%d:%s also has origin %d:%s)\n')
% (ids[n], repo[ids[n]], rev, ctx, r, n[:12]))
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 revs.remove(ids[n])
elif ctx.hex() in ids:
r = ids[ctx.hex()]
Mads Kiilerich
graft: show hashes in user-facing messages...
r23507 ui.warn(_('skipping already grafted revision %d:%s '
'(was grafted from %d:%s)\n') %
(r, repo[r], rev, ctx))
Matt Mackall
graft: fix duplicate filter logic
r15360 revs.remove(r)
Siddharth Agarwal
graft: allow regrafting ancestors with --force (issue3220)
r21979 if not revs:
return -1
Matt Mackall
graft: add initial implementation
r15238
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dograft...
r27710 for pos, ctx in enumerate(repo.set("%ld", revs)):
desc = '%d:%s "%s"' % (ctx.rev(), ctx,
ctx.description().split('\n', 1)[0])
names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node())
if names:
desc += ' (%s)' % ' '.join(names)
ui.status(_('grafting %s\n') % desc)
if opts.get('dry_run'):
continue
Siddharth Agarwal
graft: don't preserve most extra fields...
r27974 source = ctx.extra().get('source')
extra = {}
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dograft...
r27710 if source:
Siddharth Agarwal
graft: don't preserve most extra fields...
r27974 extra['source'] = source
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dograft...
r27710 extra['intermediate-source'] = ctx.hex()
else:
extra['source'] = ctx.hex()
user = ctx.user()
if opts.get('user'):
user = opts['user']
date = ctx.date()
if opts.get('date'):
date = opts['date']
message = ctx.description()
if opts.get('log'):
message += '\n(grafted from %s)' % ctx.hex()
# we don't merge the first commit when continuing
if not cont:
# perform the graft merge with p1(rev) as 'ancestor'
try:
# ui.forcemerge is an internal variable, do not document
repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
'graft')
stats = mergemod.graft(repo, ctx, ctx.p1(),
['local', 'graft'])
finally:
repo.ui.setconfig('ui', 'forcemerge', '', 'graft')
# report any conflicts
if stats and stats[3] > 0:
# write out state for --continue
nodelines = [repo[rev].hex() + "\n" for rev in revs[pos:]]
repo.vfs.write('graftstate', ''.join(nodelines))
extra = ''
if opts.get('user'):
Adam Simpkins
graft: fix printing of --continue command...
r29029 extra += ' --user %s' % util.shellquote(opts['user'])
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dograft...
r27710 if opts.get('date'):
Adam Simpkins
graft: fix printing of --continue command...
r29029 extra += ' --date %s' % util.shellquote(opts['date'])
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dograft...
r27710 if opts.get('log'):
extra += ' --log'
timeless
debugcreatestreamclonebundle: use single quotes around command hint...
r28961 hint=_("use 'hg resolve' and 'hg graft --continue%s'") % extra
Bryan O'Sullivan
commands: get rid of empty try/finally block from _dograft...
r27710 raise error.Abort(
_("unresolved conflicts, can't continue"),
hint=hint)
else:
cont = False
# commit
node = repo.commit(text=message, user=user,
date=date, extra=extra, editor=editor)
if node is None:
ui.warn(
_('note: graft of %d:%s created no changes to commit\n') %
(ctx.rev(), ctx))
Matt Mackall
graft: add initial implementation
r15238
Matt Mackall
graft: add --continue support
r15241 # remove state when we complete successfully
Mads Kiilerich
refactoring: use unlinkpath with ignoremissing
r18386 if not opts.get('dry_run'):
Mads Kiilerich
vfs: use repo.vfs.unlinkpath
r31311 repo.vfs.unlinkpath('graftstate', ignoremissing=True)
Matt Mackall
graft: add --continue support
r15241
Matt Mackall
graft: add initial implementation
r15238 return 0
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('grep',
[('0', 'print0', None, _('end fields with NUL')),
('', 'all', None, _('print all revisions that match')),
('a', 'text', None, _('treat all files as text')),
('f', 'follow', None,
_('follow changeset history,'
' or file history across copies and renames')),
('i', 'ignore-case', None, _('ignore case when matching')),
('l', 'files-with-matches', None,
_('print only filenames and revisions that match')),
('n', 'line-number', None, _('print matching line numbers')),
('r', 'rev', [],
_('only search files changed within revision range'), _('REV')),
('u', 'user', None, _('list the author (long with -v)')),
('d', 'date', None, _('list the date (short with -q)')),
Yuya Nishihara
grep: add formatter support...
r29858 ] + formatteropts + walkopts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... PATTERN [FILE]...'),
inferrepo=True)
Thomas Arendsen Hein
Remove some options from 'hg grep':...
r1108 def grep(ui, repo, pattern, *pats, **opts):
Kevin Bullock
grep: rewrite help to better document current (confusing) behavior
r30009 """search revision history for a pattern in specified files
Search revision history for a regular expression in the specified
files or the entire project.
By default, grep prints the most recent revision number for each
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 file in which it finds a match. To get it to print every revision
Kevin Bullock
grep: rewrite help to better document current (confusing) behavior
r30009 that contains a change in match status ("-" for a match that becomes
a non-match, or "+" for a non-match that becomes a match), use the
--all flag.
PATTERN can be any Python (roughly Perl-compatible) regular
expression.
If no FILEs are specified (and -f/--follow isn't set), all files in
the repository are searched, including those that don't exist in the
current branch or have been deleted in a prior changeset.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if a match is found, 1 otherwise.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
grep: make multiline mode the default (BC)...
r15765 reflags = re.M
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('ignore_case'):
Thomas Arendsen Hein
Cleanups to commands.py
r1065 reflags |= re.I
Giorgos Keramidas
hg grep: handle re.compile errors & update tests/test-grep
r4877 try:
Siddharth Agarwal
commands: use util.re.compile instead of util.compilere
r21911 regexp = util.re.compile(pattern, reflags)
Gregory Szorc
global: mass rewrite to use modern exception syntax...
r25660 except re.error as inst:
Thomas Arendsen Hein
Remove trailing ! from two error messages as this was confusing.
r6057 ui.warn(_("grep: invalid match pattern: %s\n") % inst)
Matt Mackall
commands: initial audit of exit codes...
r11177 return 1
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 sep, eol = ':', '\n'
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('print0'):
bos@serpentine.internal.keyresearch.com
grep: extend functionality, add man page entry, add unit test....
r1146 sep = eol = '\0'
Bryan O'Sullivan
Add grep command....
r1057
Matt Mackall
fix memory usage of revlog caches by limiting cache size [issue1639]
r9097 getfile = util.lrucachefunc(repo.file)
Bryan O'Sullivan
Add grep command....
r1057
def matchlines(body):
bos@serpentine.internal.keyresearch.com
grep: speed up matching, and only return one match per line.
r1059 begin = 0
linenum = 0
Kevin Bullock
grep: remove useless while condition...
r17949 while begin < len(body):
bos@serpentine.internal.keyresearch.com
grep: speed up matching, and only return one match per line.
r1059 match = regexp.search(body, begin)
Thomas Arendsen Hein
Cleanups to commands.py
r1065 if not match:
break
bos@serpentine.internal.keyresearch.com
grep: speed up matching, and only return one match per line.
r1059 mstart, mend = match.span()
linenum += body.count('\n', begin, mstart) + 1
lstart = body.rfind('\n', begin, mstart) + 1 or begin
Mads Kiilerich
grep: correct handling of matching lines without line ending (issue3050)...
r15293 begin = body.find('\n', mend) + 1 or len(body) + 1
Matt Mackall
grep: avoid infinite loop when trailing newline is missing
r7230 lend = begin - 1
bos@serpentine.internal.keyresearch.com
grep: speed up matching, and only return one match per line.
r1059 yield linenum, mstart - lstart, mend - lstart, body[lstart:lend]
Bryan O'Sullivan
Add grep command....
r1057
Eric Hopper
Convert all classes to new-style classes by deriving them from object.
r1559 class linestate(object):
Bryan O'Sullivan
Add grep command....
r1057 def __init__(self, line, linenum, colstart, colend):
self.line = line
self.linenum = linenum
self.colstart = colstart
self.colend = colend
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869
Paul Moore
python 2.6 compatibility: add __hash__ to classes that have __eq__
r6469 def __hash__(self):
return hash((self.linenum, self.line))
Thomas Arendsen Hein
Cleanups to commands.py
r1065 def __eq__(self, other):
return self.line == other.line
Bryan O'Sullivan
Add grep command....
r1057
Yuya Nishihara
grep: refactor loop that yields matched text with label...
r29854 def findpos(self):
"""Iterate all (start, end) indices of matches"""
yield self.colstart, self.colend
p = self.colend
while p < len(self.line):
m = regexp.search(self.line, p)
if not m:
Takumi IINO
grep: highlight all matched words...
r21011 break
Yuya Nishihara
grep: refactor loop that yields matched text with label...
r29854 yield m.span()
p = m.end()
Takumi IINO
grep: highlight all matched words...
r21011
Bryan O'Sullivan
Add grep command....
r1057 matches = {}
Brendan Cully
grep: add --follow support.
r2870 copies = {}
Bryan O'Sullivan
Add grep command....
r1057 def grepbody(fn, rev, body):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 matches[rev].setdefault(fn, [])
Bryan O'Sullivan
Add grep command....
r1057 m = matches[rev][fn]
for lnum, cstart, cend, line in matchlines(body):
s = linestate(line, lnum, cstart, cend)
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 m.append(s)
def difflinestates(a, b):
sm = difflib.SequenceMatcher(None, a, b)
for tag, alo, ahi, blo, bhi in sm.get_opcodes():
if tag == 'insert':
Benoit Boissinot
use xrange instead of range
r3472 for i in xrange(blo, bhi):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 yield ('+', b[i])
elif tag == 'delete':
Benoit Boissinot
use xrange instead of range
r3472 for i in xrange(alo, ahi):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 yield ('-', a[i])
elif tag == 'replace':
Benoit Boissinot
use xrange instead of range
r3472 for i in xrange(alo, ahi):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 yield ('-', a[i])
Benoit Boissinot
use xrange instead of range
r3472 for i in xrange(blo, bhi):
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 yield ('+', b[i])
Yuya Nishihara
grep: add formatter support...
r29858 def display(fm, fn, ctx, pstates, states):
Matt Mackall
walkchangerevs: internalize ctx caching
r9655 rev = ctx.rev()
Mathias De Maré
formatter: introduce isplain() to replace (the inverse of) __nonzero__() (API)...
r29949 if fm.isplain():
formatuser = ui.shortuser
else:
Yuya Nishihara
grep: add formatter support...
r29858 formatuser = str
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 if ui.quiet:
Yuya Nishihara
grep: add formatter support...
r29858 datefmt = '%Y-%m-%d'
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 else:
Yuya Nishihara
grep: add formatter support...
r29858 datefmt = '%a %b %d %H:%M:%S %Y %1%2'
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = False
FUJIWARA Katsunori
grep: reuse the first "util.binary()" result for efficiency...
r20836 @util.cachefunc
Md. O. Shayan
grep: don't print data from binary files for matches (issue2614)
r13920 def binary():
flog = getfile(fn)
return util.binary(flog.read(ctx.filenode(fn)))
Yuya Nishihara
grep: add formatter support...
r29858 fieldnamemap = {'filename': 'file', 'linenumber': 'line_number'}
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('all'):
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 iter = difflinestates(pstates, states)
Brendan Cully
grep: display correct user/revision for --all in reverse....
r2869 else:
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 iter = [('', l) for l in states]
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 for change, l in iter:
Yuya Nishihara
grep: add formatter support...
r29858 fm.startitem()
fm.data(node=fm.hexfunc(ctx.node()))
Yuya Nishihara
grep: build list of all columns regardless of display options...
r29857 cols = [
('filename', fn, True),
Yuya Nishihara
grep: add formatter support...
r29858 ('rev', rev, True),
('linenumber', l.linenum, opts.get('line_number')),
Yuya Nishihara
grep: build list of all columns regardless of display options...
r29857 ]
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('all'):
Yuya Nishihara
grep: build list of all columns regardless of display options...
r29857 cols.append(('change', change, True))
cols.extend([
Yuya Nishihara
grep: add formatter support...
r29858 ('user', formatuser(ctx.user()), opts.get('user')),
('date', fm.formatdate(ctx.date(), datefmt), opts.get('date')),
Yuya Nishihara
grep: build list of all columns regardless of display options...
r29857 ])
lastcol = next(name for name, data, cond in reversed(cols) if cond)
for name, data, cond in cols:
Yuya Nishihara
grep: add formatter support...
r29858 field = fieldnamemap.get(name, name)
fm.condwrite(cond, field, '%s', data, label='grep.%s' % name)
Yuya Nishihara
grep: build list of all columns regardless of display options...
r29857 if cond and name != lastcol:
Yuya Nishihara
grep: add formatter support...
r29858 fm.plain(sep, label='grep.sep')
Takumi IINO
grep: highlight all matched words...
r21011 if not opts.get('files_with_matches'):
Yuya Nishihara
grep: add formatter support...
r29858 fm.plain(sep, label='grep.sep')
Md. O. Shayan
grep: don't print data from binary files for matches (issue2614)
r13920 if not opts.get('text') and binary():
Yuya Nishihara
grep: add formatter support...
r29858 fm.plain(_(" Binary file matches"))
Md. O. Shayan
grep: don't print data from binary files for matches (issue2614)
r13920 else:
Yuya Nishihara
grep: add formatter support...
r29858 displaymatches(fm.nested('texts'), l)
fm.plain(eol)
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = True
Takumi IINO
grep: highlight all matched words...
r21011 if opts.get('files_with_matches'):
FUJIWARA Katsunori
grep: exit loop immediately, if matching is found in the file for "hg grep -l"...
r20838 break
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 return found
Bryan O'Sullivan
Add grep command....
r1057
Yuya Nishihara
grep: add formatter support...
r29858 def displaymatches(fm, l):
Yuya Nishihara
grep: factor out function that prints matched line with labels...
r29855 p = 0
for s, e in l.findpos():
Yuya Nishihara
grep: add formatter support...
r29858 if p < s:
fm.startitem()
fm.write('text', '%s', l.line[p:s])
fm.data(matched=False)
fm.startitem()
fm.write('text', '%s', l.line[s:e], label='grep.match')
fm.data(matched=True)
Yuya Nishihara
grep: factor out function that prints matched line with labels...
r29855 p = e
Yuya Nishihara
grep: add formatter support...
r29858 if p < len(l.line):
fm.startitem()
fm.write('text', '%s', l.line[p:])
fm.data(matched=False)
fm.end()
Yuya Nishihara
grep: factor out function that prints matched line with labels...
r29855
Bryan O'Sullivan
grep: change default to printing first matching rev....
r1145 skip = {}
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 revfiles = {}
Matt Mackall
scmutil: switch match users to supplying contexts...
r14671 matchfn = scmutil.match(repo[None], pats, opts)
Benoit Boissinot
grep: remove count handling, simplify, fix issue337
r3951 found = False
Brendan Cully
grep: add --follow support.
r2870 follow = opts.get('follow')
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662
def prep(ctx, fns):
rev = ctx.rev()
Matt Mackall
misc: replace .parents()[0] with p1()
r13878 pctx = ctx.p1()
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 parent = pctx.rev()
matches.setdefault(rev, {})
matches.setdefault(parent, {})
files = revfiles.setdefault(rev, [])
for fn in fns:
flog = getfile(fn)
try:
fnode = ctx.filenode(fn)
except error.LookupError:
continue
copied = flog.renamed(fnode)
copy = follow and copied and copied[0]
if copy:
copies.setdefault(rev, {})[fn] = copy
if fn in skip:
if copy:
skip[copy] = True
continue
files.append(fn)
if fn not in matches[rev]:
grepbody(fn, rev, flog.read(fnode))
pfn = copy or fn
if pfn not in matches[parent]:
Bryan O'Sullivan
Add grep command....
r1057 try:
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 fnode = pctx.filenode(pfn)
grepbody(pfn, parent, flog.read(fnode))
Matt Mackall
errors: move revlog errors...
r7633 except error.LookupError:
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 pass
Augie Fackler
grep: enable pager
r31036 ui.pager('grep')
Yuya Nishihara
grep: add formatter support...
r29858 fm = ui.formatter('grep', opts)
Matt Mackall
walkchangerevs: drop ui arg
r9665 for ctx in cmdutil.walkchangerevs(repo, matchfn, opts, prep):
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 rev = ctx.rev()
Matt Mackall
misc: replace .parents()[0] with p1()
r13878 parent = ctx.p1().rev()
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 for fn in sorted(revfiles.get(rev, [])):
states = matches[rev][fn]
copy = copies.get(rev, {}).get(fn)
if fn in skip:
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 if copy:
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 skip[copy] = True
continue
pstates = matches.get(parent, {}).get(copy or fn, [])
if pstates or states:
Yuya Nishihara
grep: add formatter support...
r29858 r = display(fm, fn, ctx, pstates, states)
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 found = found or r
if r and not opts.get('all'):
skip[fn] = True
FUJIWARA Katsunori
compare grep result between target and its parent...
r8849 if copy:
skip[copy] = True
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 del matches[rev]
del revfiles[rev]
Yuya Nishihara
grep: add formatter support...
r29858 fm.end()
Bryan O'Sullivan
Add grep command....
r1057
Matt Mackall
commands: initial audit of exit codes...
r11177 return not found
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('heads',
[('r', 'rev', '',
_('show only heads which are descendants of STARTREV'), _('STARTREV')),
('t', 'topo', False, _('show topological heads only')),
('a', 'active', False, _('show active branchheads only (DEPRECATED)')),
('c', 'closed', False, _('show normal and closed branch heads')),
] + templateopts,
Matt Mackall
help: drop -a from heads syntax summary (issue3483)
r16869 _('[-ct] [-r STARTREV] [REV]...'))
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 def heads(ui, repo, *branchrevs, **opts):
Matt Mackall
heads: modernize documentation (issue3992)...
r19469 """show branch heads
With no arguments, show all open branch heads in the repository.
Matt Mackall
heads: fix children/descendants in doc (issue3992)
r19493 Branch heads are changesets that have no descendants on the
Matt Mackall
heads: modernize documentation (issue3992)...
r19469 same branch. They are where development generally takes place and
are the usual targets for update and merge operations.
If one or more REVs are given, only open branch heads on the
branches associated with the specified changesets are shown. This
means that you can use :hg:`heads .` to see the heads on the
currently checked-out branch.
Greg Ward
commands: tweak help for 'heads'....
r9502
If -c/--closed is specified, also show branch heads marked closed
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 (see :hg:`commit --close-branch`).
Greg Ward
commands: tweak help for 'heads'....
r9502
If STARTREV is specified, only those heads that are descendants of
STARTREV will be displayed.
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350
If -t/--topo is specified, named branch mechanics will be ignored and only
Matt Mackall
heads: modernize documentation (issue3992)...
r19469 topological heads (changesets with no children) will be shown.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if matching heads are found, 1 if not.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Dirkjan Ochtman
commands: simplify heads a little bit before I start hacking it up
r10328
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
commands: add revset support to most commands
r12925 start = None
if 'rev' in opts:
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 start = scmutil.revsingle(repo, opts['rev'], None).node()
Dirkjan Ochtman
commands: simplify heads a little bit before I start hacking it up
r10328
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 if opts.get('topo'):
heads = [repo[h] for h in repo.heads(start)]
Benoit Boissinot
add a -r/--rev option to heads to show only heads descendant from rev
r1550 else:
Dirkjan Ochtman
commands: externalize branchheads so we can do it for all branches at once
r10348 heads = []
Martin Geisler
commands: use repo.branchheads in heads command
r14466 for branch in repo.branchmap():
heads += repo.branchheads(branch, start, opts.get('closed'))
heads = [repo[h] for h in heads]
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350
if branchrevs:
Matt Mackall
branch: operate on branch names in local string space where possible...
r13047 branches = set(repo[br].branch() for br in branchrevs)
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 heads = [h for h in heads if h.branch() in branches]
Dirkjan Ochtman
commands: simplify heads a little bit before I start hacking it up
r10328
Dirkjan Ochtman
commands: actually implement --closed for topological heads
r10349 if opts.get('active') and branchrevs:
dagheads = repo.heads(start)
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 heads = [h for h in heads if h.node() in dagheads]
Dirkjan Ochtman
commands: actually implement --closed for topological heads
r10349
if branchrevs:
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 haveheads = set(h.branch() for h in heads)
Dirkjan Ochtman
commands: don't do too much work for error messages
r10346 if branches - haveheads:
Matt Mackall
branch: operate on branch names in local string space where possible...
r13047 headless = ', '.join(b for b in branches - haveheads)
Dirkjan Ochtman
commands: don't do too much work for error messages
r10346 msg = _('no open branch heads found on branches %s')
if opts.get('rev'):
Matt Mackall
i18n: fix all remaining uses of % inside _()
r16231 msg += _(' (started at %s)') % opts['rev']
Dirkjan Ochtman
commands: don't do too much work for error messages
r10346 ui.warn((msg + '\n') % headless)
Eric Hopper
Add option to heads to show only heads for current branch.
r4648 if not heads:
return 1
Dirkjan Ochtman
commands: simplify heads a little bit before I start hacking it up
r10328
Martin von Zweigbergk
heads: enable pager
r31387 ui.pager('heads')
Dirkjan Ochtman
commands: do all branch heads by default, demote topological to -t/--topo
r10350 heads = sorted(heads, key=lambda x: -x.rev())
Matt Mackall
templates: move changeset templating bits to cmdutils
r3643 displayer = cmdutil.show_changeset(ui, repo, opts)
Dirkjan Ochtman
commands: always order heads recent to oldest
r10331 for ctx in heads:
displayer.show(ctx)
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
mpm@selenic.com
Beginning of multi-head support...
r221
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('help',
[('e', 'extension', None, _('show only help for extensions')),
Augie Fackler
help: add --keyword (-k) for searching help
r16711 ('c', 'command', None, _('show only help for commands')),
timeless@mozdev.org
help: fix help argument parsing and documentation...
r26238 ('k', 'keyword', None, _('show topics matching keyword')),
timeless
help: add --system flag to get help for various platform(s)
r27763 ('s', 'system', [], _('show help for specific platform(s)')),
Augie Fackler
help: add --keyword (-k) for searching help
r16711 ],
timeless
help: add --system flag to get help for various platform(s)
r27763 _('[-ecks] [TOPIC]'),
Gregory Szorc
commands: define norepo in command decorator
r21768 norepo=True)
Dan Villiom Podlaski Christiansen
help: move the majority of the help command to the help module...
r18746 def help_(ui, name=None, **opts):
Matt Mackall
help: update help...
r7210 """show help for a given topic or a help overview
Matt Mackall
alphabetize help_ in commands
r3655
timeless
Improve English for help text of many core hg commands....
r8779 With no arguments, print a list of commands with short help messages.
Matt Mackall
alphabetize help_ in commands
r3655
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Given a topic, extension, or command name, print help for that
Matt Mackall
commands: initial audit of exit codes...
r11177 topic.
Returns 0 if successful.
"""
Matt Mackall
alphabetize help_ in commands
r3655
Pulkit Goyal
py3: make sure opts are passed and used correctly in help command...
r32143 keep = opts.get(r'system') or []
timeless
help: add --system flag to get help for various platform(s)
r27763 if len(keep) == 0:
Pulkit Goyal
py3: replace sys.platform with pycompat.sysplatform (part 1 of 2)...
r30641 if pycompat.sysplatform.startswith('win'):
timeless
help: add --system flag to get help for various platform(s)
r27763 keep.append('windows')
Pulkit Goyal
py3: replace sys.platform with pycompat.sysplatform (part 1 of 2)...
r30641 elif pycompat.sysplatform == 'OpenVMS':
timeless
help: add --system flag to get help for various platform(s)
r27763 keep.append('vms')
Pulkit Goyal
py3: replace sys.platform with pycompat.sysplatform (part 1 of 2)...
r30641 elif pycompat.sysplatform == 'plan9':
timeless
help: add --system flag to get help for various platform(s)
r27763 keep.append('plan9')
else:
keep.append('unix')
Pulkit Goyal
py3: replace sys.platform with pycompat.sysplatform (part 1 of 2)...
r30641 keep.append(pycompat.sysplatform.lower())
Matt Mackall
help: support OS-specific help sections...
r22585 if ui.verbose:
keep.append('verbose')
Yuya Nishihara
help: pass commands module by argument...
r32567 commands = sys.modules[__name__]
formatted = help.formattedhelp(ui, commands, name, keep=keep, **opts)
Augie Fackler
help: enable pager
r31037 ui.pager('help')
Olav Reinert
help: format all output using RST...
r16854 ui.write(formatted)
Johannes Stezenbach
help: list special help topics with -v
r6653
mpm@selenic.com
Beginning of multi-head support...
r221
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('identify|id',
[('r', 'rev', '',
_('identify the specified revision'), _('REV')),
('n', 'num', None, _('show local revision number')),
('i', 'id', None, _('show global revision id')),
('b', 'branch', None, _('show branch')),
('t', 'tags', None, _('show tags')),
Mads Kiilerich
id: add command line options for handling ssh and https urls
r15580 ('B', 'bookmarks', None, _('show bookmarks')),
] + remoteopts,
Gregory Szorc
commands: define optionalrepo in command decorator
r21775 _('[-nibtB] [-r REV] [SOURCE]'),
optionalrepo=True)
Kevin Bullock
id: add bookmarks to id...
r13477 def identify(ui, repo, source=None, rev=None,
Mads Kiilerich
id: add command line options for handling ssh and https urls
r15580 num=None, id=None, branch=None, tags=None, bookmarks=None, **opts):
Yuya Nishihara
commands: replace "working copy" with "working directory" in help/messages...
r24364 """identify the working directory or specified revision
Matt Mackall
identify: accept a revision argument
r4665
Kevin Bullock
identify: further clarification of help...
r13963 Print a summary identifying the repository state at REV using one or
two parent hash identifiers, followed by a "+" if the working
directory has uncommitted changes, the branch name (if not default),
a list of tags, and a list of bookmarks.
Idan Kamara
identify/help: say what the command does first, mention bookmarks
r13952
When REV is not given, print a summary of the current state of the
Martin Geisler
expand "repo" to "repository" in help texts
r8027 repository.
Matt Mackall
identify: take a path to a remote repo...
r4671
timeless
Improve English for help text of many core hg commands....
r8779 Specifying a path to a repository root or Mercurial bundle will
cause lookup to operate on that repository/bundle.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Matt Mackall
id: add some help examples
r15112 .. container:: verbose
Examples:
- generate a build identifier for the working directory::
hg id --id > build-id.dat
- find the revision corresponding to a tag::
hg id -n -r 1.3
- check the most recent revision of a remote repository::
FUJIWARA Katsunori
help: replace selenic.com by mercurial-scm.org in command examples...
r30243 hg id -r tip https://www.mercurial-scm.org/repo/hg/
Matt Mackall
id: add some help examples
r15112
Mathias De Maré
identify: refer to log to be able to view full hashes
r27120 See :hg:`log` for generating more information about specific revisions,
including full hash identifiers.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 if successful.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
identify: show nullid for empty repo
r4662
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Alexis S. L. Carvalho
make identify an optionalrepo command...
r5330 if not repo and not source:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("there is no Mercurial repository here "
Alexis S. L. Carvalho
make identify an optionalrepo command...
r5330 "(.hg not found)"))
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 if ui.debugflag:
hexfunc = hex
else:
hexfunc = short
Kevin Bullock
id: add bookmarks to id...
r13477 default = not (num or id or branch or tags or bookmarks)
Matt Mackall
identify: add support for output flags
r4666 output = []
Dirkjan Ochtman
identify: have consistent output for local repositories...
r7757 revs = []
Idan Kamara
identify: restructure code to make it more readable
r13953
Matt Mackall
identify: take a path to a remote repo...
r4671 if source:
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 source, branches = hg.parseurl(ui.expandpath(source))
Simon Heimberg
subrepo: more isolation, only use ui for hg.peer when there is no repo...
r17875 peer = hg.peer(repo or ui, opts, source) # only pass ui when no repo
Sune Foldager
peer: introduce peer methods to prepare for peer classes...
r17191 repo = peer.local()
revs, checkout = hg.addbranchrevs(repo, peer, branches, None)
if not repo:
Idan Kamara
identify: restructure code to make it more readable
r13953 if num or branch or tags:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(
Idan Kamara
identify: restructure code to make it more readable
r13953 _("can't query remote revision number, branch, or tags"))
Matt Mackall
identify: take a path to a remote repo...
r4671 if not rev and revs:
rev = revs[0]
Matt Mackall
identify: work with remote repos
r4667 if not rev:
rev = "tip"
Nils Adermann
identify: list bookmarks for remote repositories
r13644
Sune Foldager
peer: introduce peer methods to prepare for peer classes...
r17191 remoterev = peer.lookup(rev)
Matt Mackall
identify: add support for output flags
r4666 if default or id:
Nils Adermann
identify: list bookmarks for remote repositories
r13644 output = [hexfunc(remoterev)]
Idan Kamara
identify: restructure code to make it more readable
r13953 def getbms():
bms = []
Sune Foldager
peer: introduce peer methods to prepare for peer classes...
r17191 if 'bookmarks' in peer.listkeys('namespaces'):
Idan Kamara
identify: restructure code to make it more readable
r13953 hexremoterev = hex(remoterev)
Sune Foldager
peer: introduce peer methods to prepare for peer classes...
r17191 bms = [bm for bm, bmr in peer.listkeys('bookmarks').iteritems()
Idan Kamara
identify: restructure code to make it more readable
r13953 if bmr == hexremoterev]
Mads Kiilerich
identity: report bookmarks sorted
r18366 return sorted(bms)
Idan Kamara
identify: restructure code to make it more readable
r13953
if bookmarks:
output.extend(getbms())
elif default and not ui.quiet:
# multiple bookmarks for a single parent separated by '/'
bm = '/'.join(getbms())
if bm:
output.append(bm)
Matt Mackall
identify: accept a revision argument
r4665 else:
Matt Harbison
identify: avoid a crash when given '-r wdir()'...
r25683 ctx = scmutil.revsingle(repo, rev, None)
if ctx.rev() is None:
Idan Kamara
identify: restructure code to make it more readable
r13953 ctx = repo[None]
parents = ctx.parents()
Matt Harbison
identify: build the tag list directly instead of using wctx.tags()...
r25684 taglist = []
for p in parents:
taglist.extend(p.tags())
Idan Kamara
identify: restructure code to make it more readable
r13953 changed = ""
if default or id or num:
Augie Fackler
cleanup: use __builtins__.any instead of util.any...
r25149 if (any(repo.status())
or any(ctx.sub(s).dirty() for s in ctx.substate)):
Patrick Mezard
identity: show trailing '+' for dirty subrepos (issue2839)
r17255 changed = '+'
Idan Kamara
identify: restructure code to make it more readable
r13953 if default or id:
output = ["%s%s" %
('+'.join([hexfunc(p.node()) for p in parents]), changed)]
if num:
output.append("%s%s" %
('+'.join([str(p.rev()) for p in parents]), changed))
else:
if default or id:
output = [hexfunc(ctx.node())]
if num:
output.append(str(ctx.rev()))
Matt Harbison
identify: build the tag list directly instead of using wctx.tags()...
r25684 taglist = ctx.tags()
Idan Kamara
identify: restructure code to make it more readable
r13953
if default and not ui.quiet:
b = ctx.branch()
if b != 'default':
output.append("(%s)" % b)
# multiple tags for a single parent separated by '/'
Matt Harbison
identify: build the tag list directly instead of using wctx.tags()...
r25684 t = '/'.join(taglist)
Idan Kamara
identify: restructure code to make it more readable
r13953 if t:
output.append(t)
# multiple bookmarks for a single parent separated by '/'
bm = '/'.join(ctx.bookmarks())
if bm:
output.append(bm)
else:
if branch:
output.append(ctx.branch())
if tags:
Matt Harbison
identify: build the tag list directly instead of using wctx.tags()...
r25684 output.extend(taglist)
Idan Kamara
identify: restructure code to make it more readable
r13953
if bookmarks:
output.extend(ctx.bookmarks())
Kevin Bullock
id: add bookmarks to id...
r13477
Thomas Arendsen Hein
Improvements for hg identify:...
r386 ui.write("%s\n" % ' '.join(output))
Thomas Arendsen Hein
added hg identify|id (based on a patch from Andrew Thompson)...
r339
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('import|patch',
[('p', 'strip', 1,
_('directory strip option for patch. This has the same '
'meaning as the corresponding patch option'), _('NUM')),
Patrick Mezard
import: deprecate --base...
r14532 ('b', 'base', '', _('base path (DEPRECATED)'), _('PATH')),
Matt Mackall
import: add --edit switch
r15221 ('e', 'edit', False, _('invoke editor on commit messages')),
Matt Mackall
rollback: mark as deprecated
r19409 ('f', 'force', None,
_('skip check for outstanding uncommitted changes (DEPRECATED)')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('', 'no-commit', None,
_("don't commit, just update the working directory")),
Patrick Mezard
import: add --bypass option...
r14611 ('', 'bypass', None,
_("apply patch without touching the working directory")),
Pierre-Yves David
import: add --partial flag to create a changeset despite failed hunks...
r21553 ('', 'partial', None,
_('commit even if some hunks fail')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('', 'exact', None,
Matt Mackall
import: document --exact behavior in more detail
r28866 _('abort if patch would apply lossily')),
Siddharth Agarwal
commands.import: accept a prefix option...
r24258 ('', 'prefix', '',
Siddharth Agarwal
patch._applydiff: resolve prefix with respect to the cwd...
r24390 _('apply patch to subdirectory'), _('DIR')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('', 'import-branch', None,
_('use any branch information in patch (implied by --exact)'))] +
commitopts + commitopts2 + similarityopts,
_('[OPTION]... PATCH...'))
Kevin Bullock
import: abort usefully if no patch name given
r15327 def import_(ui, repo, patch1=None, *patches, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """import an ordered set of patches
timeless@mozdev.org
minor documentation improvements
r9649 Import a list of patches and commit them individually (unless
--no-commit is specified).
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin von Zweigbergk
import: mention "stdin" (abbreviated) and add example...
r30899 To read a patch from standard input (stdin), use "-" as the patch
name. If a URL is specified, the patch will be downloaded from
there.
timeless
import: reorder help text...
r27390
Import first applies changes to the working directory (unless
--bypass is specified), import will abort if there are outstanding
changes.
Use --bypass to apply and commit patches directly to the
repository, without affecting the working directory. Without
--exact, patches will be applied on top of the working directory
parent revision.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 You can import a patch straight from a mail message. Even patches
timeless
Improve English for help text of many core hg commands....
r8779 as attachments work (to use the body part, it must have type
text/plain or text/x-patch). From and Subject headers of email
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 message are used as default committer and commit message. All
timeless
import: add word to help text
r27389 text/plain body parts before first diff are added to the commit
Vadim Gelfer
import: make help clearer. suggested by asak.
r2515 message.
Vadim Gelfer
import: parse email messages
r2504
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 If the imported patch was generated by :hg:`export`, user and
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 description from patch override values from message headers and
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 body. Values given on command line with -m/--message and -u/--user
override these.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004
If --exact is specified, import will set the working directory to
the parent of each patch before applying it, and will abort if the
resulting changeset has a different ID than the one recorded in
Matt Mackall
import: document --exact behavior in more detail
r28866 the patch. This will guard against various ways that portable
patch formats and mail systems might fail to transfer Mercurial
FUJIWARA Katsunori
doc: fix incorrect use of rst hg role in help text
r29648 data or metadata. See :hg:`bundle` for lossless transmission.
Brendan Cully
Add import --exact....
r4263
Pierre-Yves David
import: add --partial flag to create a changeset despite failed hunks...
r21553 Use --partial to ensure a changeset will be created from the patch
even if some hunks fail to apply. Hunks that fail to apply will be
written to a <target-file>.rej file. Conflicts can then be resolved
by hand before :hg:`commit --amend` is run to update the created
changeset. This flag exists to let people import patches that
partially apply without losing the associated metadata (author,
timeless
import: reword no hunks partial note...
r27488 date, description, ...).
.. note::
When no hunks apply cleanly, :hg:`import --partial` will create
an empty changeset, importing only the patch metadata.
Pierre-Yves David
import: add --partial flag to create a changeset despite failed hunks...
r21553
timeless
import: reorder help text...
r27390 With -s/--similarity, hg will attempt to discover renames and
copies in the patch in the same way as :hg:`addremove`.
Pierre-Yves David
import: add --partial flag to create a changeset despite failed hunks...
r21553
Jordi Gutiérrez Hermoso
import: cross-reference ui.patch option from `hg help import`...
r25650 It is possible to use external patch programs to perform the patch
Jordi Gutiérrez Hermoso
import: cross-reference patch.fuzz option from `hg help import`
r25651 by setting the ``ui.patch`` configuration option. For the default
internal tool, the fuzz can also be configured via ``patch.fuzz``.
Jordi Gutiérrez Hermoso
import: cross-reference ui.patch option from `hg help import`...
r25650 See :hg:`help config` for more information about configuration
Jordi Gutiérrez Hermoso
import: cross-reference patch.fuzz option from `hg help import`
r25651 files and how to use these options.
Jordi Gutiérrez Hermoso
import: cross-reference ui.patch option from `hg help import`...
r25650
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
import: add help examples
r15113 .. container:: verbose
Examples:
- import a traditional patch from a website and detect renames::
hg import -s 80 http://example.com/bugfix.patch
- import a changeset from an hgweb server::
FUJIWARA Katsunori
help: replace selenic.com by mercurial-scm.org in command examples...
r30243 hg import https://www.mercurial-scm.org/repo/hg/rev/5ca8c111e9aa
Matt Mackall
import: add help examples
r15113
- import all the patches in an Unix-style mbox::
hg import incoming-patches.mbox
Martin von Zweigbergk
import: mention "stdin" (abbreviated) and add example...
r30899 - import patches from stdin::
hg import -
Matt Mackall
import: add help examples
r15113 - attempt to exactly restore an exported changeset (not always
possible)::
hg import --exact proposed-fix.patch
Jordi Gutiérrez Hermoso
import: cross-reference ui.patch option from `hg help import`...
r25650 - use an external tool to apply a patch which is too fuzzy for
the default internal tool.
hg import --config ui.patch="patch --merge" fuzzy.patch
Jordi Gutiérrez Hermoso
import: cross-reference patch.fuzz option from `hg help import`
r25651 - change the default fuzzing from 2 to a less strict 7
hg import --config ui.fuzz=7 fuzz.patch
Pierre-Yves David
import: add --partial flag to create a changeset despite failed hunks...
r21553 Returns 0 on success, 1 on partial success (see --partial).
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Kevin Bullock
import: abort usefully if no patch name given
r15327
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Kevin Bullock
import: abort usefully if no patch name given
r15327 if not patch1:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('need at least one patch to import'))
Kevin Bullock
import: abort usefully if no patch name given
r15327
mpm@selenic.com
Commands cleanup...
r437 patches = (patch1,) + patches
mpm@selenic.com
[PATCH] Clean up destination directory if a clone fails....
r500
Thomas Arendsen Hein
Fix bad behaviour when specifying an invalid date (issue700)...
r6139 date = opts.get('date')
if date:
opts['date'] = util.parsedate(date)
timeless
import: refactor exact flag
r27388 exact = opts.get('exact')
Patrick Mezard
import: add --bypass option...
r14611 update = not opts.get('bypass')
if not update and opts.get('no_commit'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot use --no-commit with --bypass'))
Brendan Cully
import: add similarity option (issue295)
r7402 try:
sim = float(opts.get('similarity') or 0)
except ValueError:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('similarity must be a number'))
Brendan Cully
import: add similarity option (issue295)
r7402 if sim < 0 or sim > 100:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('similarity must be between 0 and 100'))
Patrick Mezard
import: add --bypass option...
r14611 if sim and not update:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot use --similarity with --bypass'))
timeless
import: refactor exact flag
r27388 if exact:
if opts.get('edit'):
raise error.Abort(_('cannot use --exact with --edit'))
if opts.get('prefix'):
raise error.Abort(_('cannot use --exact with --prefix'))
mpm@selenic.com
hg import: abort with uncommitted changes, override with --force
r966
Greg Ward
import: rename some local variables
r15195 base = opts["base"]
FUJIWARA Katsunori
import: use dirstateguard instead of dirstate.invalidate...
r24994 wlock = dsguard = lock = tr = None
Steve Borho
import: --no-commit should update .hg/last-message.txt...
r12913 msgs = []
Pierre-Yves David
import: add --partial flag to create a changeset despite failed hunks...
r21553 ret = 0
Brendan Cully
import: import each patch in a file or stream as a separate change...
r10384
Peter Arrenbrecht
whitespace cleanup
r10405
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 try:
Bryan O'Sullivan
commands: get rid of empty try/finally block from import_...
r27708 wlock = repo.wlock()
if update:
cmdutil.checkunfinished(repo)
if (exact or not opts.get('force')):
cmdutil.bailifchanged(repo)
if not opts.get('no_commit'):
lock = repo.lock()
tr = repo.transaction('import')
else:
Augie Fackler
commands: refer to dirstateguard by its new name
r30491 dsguard = dirstateguard.dirstateguard(repo, 'import')
Bryan O'Sullivan
commands: get rid of empty try/finally block from import_...
r27708 parents = repo[None].parents()
for patchurl in patches:
if patchurl == '-':
ui.status(_('applying patch from stdin\n'))
patchfile = ui.fin
patchurl = 'stdin' # for error message
FUJIWARA Katsunori
commands: make "hg import" use dirstateguard only for --no-commit...
r26580 else:
Bryan O'Sullivan
commands: get rid of empty try/finally block from import_...
r27708 patchurl = os.path.join(base, patchurl)
ui.status(_('applying %s\n') % patchurl)
patchfile = hg.openpath(ui, patchurl)
haspatch = False
for hunk in patch.split(patchfile):
(msg, node, rej) = cmdutil.tryimportone(ui, repo, hunk,
parents, opts,
msgs, hg.clean)
if msg:
haspatch = True
ui.note(msg + '\n')
if update or exact:
parents = repo[None].parents()
Patrick Mezard
import: add --bypass option...
r14611 else:
Bryan O'Sullivan
commands: get rid of empty try/finally block from import_...
r27708 parents = [repo[node]]
if rej:
ui.write_err(_("patch applied partially\n"))
ui.write_err(_("(fix the .rej files and run "
"`hg commit --amend`)\n"))
ret = 1
break
if not haspatch:
raise error.Abort(_('%s: no diffs found') % patchurl)
if tr:
tr.close()
if msgs:
repo.savecommitmessage('\n* * *\n'.join(msgs))
if dsguard:
dsguard.close()
return ret
Matt Mackall
Use try/finally pattern to cleanup locks and transactions
r4915 finally:
Greg Ward
import: wrap a transaction around the whole command...
r15198 if tr:
tr.release()
FUJIWARA Katsunori
import: use dirstateguard instead of dirstate.invalidate...
r24994 release(lock, dsguard, wlock)
mpm@selenic.com
Commands cleanup...
r437
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('incoming|in',
[('f', 'force', None,
_('run even if remote repository is unrelated')),
('n', 'newest-first', None, _('show newest record first')),
('', 'bundle', '',
_('file to store the bundles into'), _('FILE')),
('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
('B', 'bookmarks', False, _("compare bookmarks")),
('b', 'branch', [],
_('a specific branch you would like to pull'), _('BRANCH')),
] + logopts + remoteopts + subrepoopts,
_('[-p] [-n] [-M] [-f] [-r REV]... [--bundle FILENAME] [SOURCE]'))
TK Soh
Add -p to incoming and outgoing commands to show patch
r1192 def incoming(ui, repo, source="default", **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show new changesets found in source
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 Show new changesets found in the specified path/URL or the default
timeless
Improve English for help text of many core hg commands....
r8779 pull location. These are the changesets that would have been pulled
if a pull at the time you issued this command.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004
Thomas Arendsen Hein
More detailed documentation about ssh:// URLs; fixes issue170.
r1979 See pull for valid source format details.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
help: add examples to incoming
r20834 .. container:: verbose
FUJIWARA Katsunori
bookmarks: show detailed status about incoming bookmarks...
r24660 With -B/--bookmarks, the result of bookmark comparison between
local and remote repositories is displayed. With -v/--verbose,
status is also displayed for each bookmark like below::
BM1 01234567890a added
BM2 1234567890ab advanced
BM3 234567890abc diverged
BM4 34567890abcd changed
The action taken locally when pulling depends on the
status of each bookmark:
:``added``: pull will create it
:``advanced``: pull will update it
:``diverged``: pull will create a divergent bookmark
:``changed``: result depends on remote changesets
From the point of view of pulling behavior, bookmark
existing only in the remote repository are treated as ``added``,
even if it is in fact locally deleted.
.. container:: verbose
Yuya Nishihara
incoming: hide help about use of --bundle option by default...
r24248 For remote repository, using --bundle avoids downloading the
changesets twice if the incoming is followed by a pull.
Matt Mackall
help: add examples to incoming
r20834 Examples:
- show incoming changes with patches and full description::
hg incoming -vp
- show incoming changes excluding merges, store a bundle::
hg in -vpM --bundle incoming.hg
hg pull incoming.hg
- briefly list changes inside a bundle::
hg in changes.hg -T "{desc|firstline}\\n"
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 if there are incoming changes, 1 otherwise.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: use pycompat.byteskwargs() to convert opts to bytes...
r31826 opts = pycompat.byteskwargs(opts)
Patrick Mezard
incoming/outgoing: handle --graph in core
r17182 if opts.get('graph'):
cmdutil.checkunsupportedgraphflags([], opts)
def display(other, chlist, displayer):
revdag = cmdutil.graphrevs(other, chlist, opts)
Yuya Nishihara
graphlog: move creation of workingdir-parent nodes to displaygraph()...
r27213 cmdutil.displaygraph(ui, repo, revdag, displayer,
Patrick Mezard
incoming/outgoing: handle --graph in core
r17182 graphmod.asciiedges)
hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True)
return 0
Martin Geisler
incoming: recurse into subrepositories with --subrepos/-S flag...
r12274 if opts.get('bundle') and opts.get('subrepos'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('cannot combine --bundle and --subrepos'))
Martin Geisler
incoming: recurse into subrepositories with --subrepos/-S flag...
r12274
Matt Mackall
bookmarks: merge incoming/outgoing into core
r13366 if opts.get('bookmarks'):
source, branches = hg.parseurl(ui.expandpath(source),
opts.get('branch'))
Matt Mackall
hg: change various repository() users to use peer() where appropriate...
r14556 other = hg.peer(repo, opts, source)
David Soria Parra
bookmarks: issue a warning if remote doesn't support comparing bookmarks...
r13453 if 'bookmarks' not in other.listkeys('namespaces'):
ui.warn(_("remote doesn't support bookmarks\n"))
return 0
Augie Fackler
incoming: enable pager...
r31038 ui.pager('incoming')
Brodie Rao
url: move URL parsing functions into util to improve startup time...
r14076 ui.status(_('comparing with %s\n') % util.hidepassword(source))
FUJIWARA Katsunori
bookmarks: add incoming() to replace diff() for incoming bookmarks...
r24397 return bookmarks.incoming(ui, repo, other)
Matt Mackall
bookmarks: merge incoming/outgoing into core
r13366
Martin Geisler
subrepo: respect non-default path for incoming/outgoing...
r14360 repo._subtoppath = ui.expandpath(source)
try:
Martin Geisler
commands: replace 'x = f(); return x' with 'return f()'
r14362 return hg.incoming(ui, repo, source, opts)
Martin Geisler
subrepo: respect non-default path for incoming/outgoing...
r14360 finally:
del repo._subtoppath
Benoit Boissinot
incoming: add support for remote repo using bundlerepo
r1944
Gregory Szorc
commands: define norepo in command decorator
r21768 @command('^init', remoteopts, _('[-e CMD] [--remotecmd CMD] [DEST]'),
norepo=True)
Thomas Arendsen Hein
Add ui method to set --ssh/--remotecmd, use it in init/clone/pull/push/in/out....
r2598 def init(ui, dest=".", **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """create a new repository in the given directory
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Initialize a new repository in the given directory. If the given
timeless
Improve English for help text of many core hg commands....
r8779 directory does not exist, it will be created.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
If no directory is given, the current directory is used.
Thomas Arendsen Hein
Additional information about URLs in pull/push/clone/init:...
r2590
Martin Geisler
commands: mark "ssh://" as inline literals in help texts
r9970 It is possible to specify an ``ssh://`` URL as the destination.
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help urls` for more information.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
hg: change various repository() users to use peer() where appropriate...
r14556 hg.peer(ui, opts, ui.expandpath(dest), create=True)
mpm@selenic.com
default path support with .hg/hgrc...
r338
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('locate',
[('r', 'rev', '', _('search the repository as it is in REV'), _('REV')),
('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
('f', 'fullpath', None, _('print complete paths from the filesystem root')),
] + walkopts,
_('[OPTION]... [PATTERN]...'))
Bryan O'Sullivan
Add locate command....
r627 def locate(ui, repo, *pats, **opts):
Matt Mackall
locate: deprecate in favor of files
r22431 """locate files matching specific patterns (DEPRECATED)
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
timeless
Improve English for help text of many core hg commands....
r8779 Print files under Mercurial control in the working directory whose
names match the given patterns.
By default, this command searches all directories in the working
directory. To search just the current directory and its
subdirectories, use "--include .".
If no patterns are given to match, this command prints the names
of all files under Mercurial control in the working directory.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
If you want to feed the output of this command into the "xargs"
Martin Geisler
commands: use double quotes consistently in help texts
r8032 command, use the -0 option to both this command and "xargs". This
will avoid the problem of "xargs" treating single filenames that
timeless
Improve English for help text of many core hg commands....
r8779 contain whitespace as multiple filenames.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
locate: add pointer to files command in help
r22433 See :hg:`help files` for a more versatile command.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 if a match is found, 1 otherwise.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 if opts.get('print0'):
end = '\0'
else:
end = '\n'
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 rev = scmutil.revsingle(repo, opts.get('rev'), None).node()
mpm@selenic.com
Refactor matchpats and walk...
r742
Alexis S. L. Carvalho
locate: exit(1) if we didn't print any file
r4196 ret = 1
Siddharth Agarwal
locate: use ctx.matches instead of ctx.walk...
r21986 ctx = repo[rev]
Matt Harbison
commands: use the optional badfn argument when building a matcher
r25468 m = scmutil.match(ctx, pats, opts, default='relglob',
badfn=lambda x, y: False)
Siddharth Agarwal
locate: use ctx.matches instead of ctx.walk...
r21986
Augie Fackler
locate: enable pager
r31039 ui.pager('locate')
Siddharth Agarwal
locate: use ctx.matches instead of ctx.walk...
r21986 for abs in ctx.matches(m):
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('fullpath'):
Martin Geisler
use repo.wjoin(f) instead of os.path.join(repo.root, f)
r7570 ui.write(repo.wjoin(abs), end)
Bryan O'Sullivan
Get add and locate to use new repo and dirstate walk code....
r724 else:
Matt Mackall
walk: remove rel and exact returns
r6584 ui.write(((pats and m.rel(abs)) or abs), end)
Alexis S. L. Carvalho
locate: exit(1) if we didn't print any file
r4196 ret = 0
return ret
Bryan O'Sullivan
Add locate command....
r627
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^log|history',
[('f', 'follow', None,
_('follow changeset history, or file history across copies and renames')),
('', 'follow-first', None,
Matt Mackall
log: hide some low-utility options
r15405 _('only follow the first parent of merge changesets (DEPRECATED)')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('d', 'date', '', _('show revisions matching date spec'), _('DATE')),
('C', 'copies', None, _('show copied files')),
('k', 'keyword', [],
_('do case-insensitive search for a given text'), _('TEXT')),
Jordi Gutiérrez Hermoso
doc: change 'revision or range' to 'revision or revset'...
r23091 ('r', 'rev', [], _('show the specified revision or revset'), _('REV')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('', 'removed', None, _('include revisions where files were removed')),
Matt Mackall
log: hide some low-utility options
r15405 ('m', 'only-merges', None, _('show only merges (DEPRECATED)')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('u', 'user', [], _('revisions committed by user'), _('USER')),
('', 'only-branch', [],
_('show only changesets within the given named branch (DEPRECATED)'),
_('BRANCH')),
('b', 'branch', [],
_('show changesets within the given named branch'), _('BRANCH')),
('P', 'prune', [],
_('do not display revision or any of its ancestors'), _('REV')),
] + logopts + walkopts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... [FILE]'),
inferrepo=True)
Bryan O'Sullivan
Rewrite log command. New version is faster and more featureful....
r1031 def log(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show revision history of entire repository or files
Vadim Gelfer
log: add -f/--follow option, to follow rename/copy
r2741 Print the revision history of the specified files or the entire
project.
Matt Mackall
log: rearrange the help text a bit
r15104 If no revision range is specified, the default is ``tip:0`` unless
--follow is set, in which case the working directory parent is
used as the starting revision.
Vadim Gelfer
log: add -f/--follow option, to follow rename/copy
r2741 File history is shown without following rename or copy history of
timeless
Generally replace "file name" with "filename" in help and comments.
r8761 files. Use -f/--follow with a filename to follow history across
renames and copies. --follow without a filename will only show
Matt Mackall
log: rearrange the help text a bit
r15104 ancestors or descendants of the starting revision.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
timeless
Improve English for help text of many core hg commands....
r8779 By default this command prints revision number and changeset id,
tags, non-trivial parents, user, date and time, and a summary for
each commit. When the -v/--verbose switch is used, the list of
changed files and full commit message are shown.
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822
Mads Kiilerich
log: describe graph symbols in the help...
r20544 With --graph the revisions are shown as an ASCII art DAG with the most
recent changeset at the top.
'o' is a changeset, '@' is a working directory parent, 'x' is obsolete,
and '+' represents a fork where the changeset from the lines below is a
Wagner Bruna
commands: fix typo in --graph description
r21174 parent of the 'o' merge on the same line.
Matt DeVore
log: document the characters ---graph uses to draw...
r32075 Paths in the DAG are represented with '|', '/' and so forth. ':' in place
of a '|' indicates one or more revisions in a path are omitted.
Mads Kiilerich
log: describe graph symbols in the help...
r20544
Christian Ebert
Use more note admonitions in help texts
r12390 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
timeless
commands: the first word of each note should be capital or `hg`
r27476 :hg:`log --patch` may generate unexpected diff output for merge
Christian Ebert
Use more note admonitions in help texts
r12390 changesets, as it will only compare the merge changeset against
its first parent. Also, only files different from BOTH parents
will appear in files:.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
log: add a usage note about --removed
r15105 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
timeless
commands: the first word of each note should be capital or `hg`
r27476 For performance reasons, :hg:`log FILE` may omit duplicate changes
Matt Mackall
help: mention mode in hg log --removed help (issue4381)
r22493 made on branches and will not show removals or mode changes. To
see all such changes, use the --removed switch.
Matt Mackall
log: add a usage note about --removed
r15105
Matt Mackall
log: add some usage examples to verbose help
r15103 .. container:: verbose
Some examples:
- changesets with full descriptions and file lists::
hg log -v
- changesets ancestral to the working directory::
hg log -f
- last 10 commits on the current branch::
hg log -l 10 -b .
- changesets showing all modifications of a file, including removals::
hg log --removed file.c
- all changesets that touch a directory, with diffs, excluding merges::
hg log -Mp lib/
- all revision numbers that match a keyword::
hg log -k bug --template "{rev}\\n"
Mathias De Maré
log: add 'hg log' example for full hashes
r27119 - the full hash identifier of the working directory parent::
hg log -r . --template "{node}\\n"
Matt Mackall
templates: re-add template listing support...
r21944 - list available log templates::
hg log -T list
Matt Mackall
help: fix typo in log examples
r22576 - check if a given changeset is included in a tagged release::
Matt Mackall
log: add some usage examples to verbose help
r15103
hg log -r "a21ccf and ancestor(1.9)"
- find all changesets by some user in a date range::
hg log -k alice -d "may 2008 to jul 2008"
- summary of all changesets after the last tag::
hg log -r "last(tagged())::" --template "{desc|firstline}\\n"
Matt Mackall
log: rearrange the help text a bit
r15104 See :hg:`help dates` for a list of formats valid for -d/--date.
Martin von Zweigbergk
help: remove now-redundant pointer to revsets help...
r30785 See :hg:`help revisions` for more about specifying and ordering
revisions.
Matt Mackall
log: rearrange the help text a bit
r15104
A. S. Budden
help: add reference to template help (issue3413)...
r16568 See :hg:`help templates` for more about pre-packaged styles and
specifying custom templates.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Matt Mackall
help: mention mode in hg log --removed help (issue4381)
r22493
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Yuya Nishihara
py3: convert log opts to bytes-key dict...
r31487 opts = pycompat.byteskwargs(opts)
Durham Goode
log: make -fr show complete history from the given revs...
r24189 if opts.get('follow') and opts.get('rev'):
Yuya Nishihara
revset: split language services to revsetlang module (API)...
r31024 opts['rev'] = [revsetlang.formatspec('reverse(::%lr)', opts.get('rev'))]
Durham Goode
log: make -fr show complete history from the given revs...
r24189 del opts['follow']
Patrick Mezard
log: support --graph without graphlog extension...
r17181 if opts.get('graph'):
Yuya Nishihara
graphlog: pass function arguments without expansion...
r31486 return cmdutil.graphlog(ui, repo, pats, opts)
Vadim Gelfer
add -l,--limit to log command.
r1756
Lucas Moscovicz
log: changed implementation to use graphlog code...
r21127 revs, expr, filematcher = cmdutil.getlogrevs(repo, pats, opts)
Thomas Arendsen Hein
Move finding/checking the log limit to cmdutil
r6190 limit = cmdutil.loglimit(opts)
Vadim Gelfer
add -l,--limit to log command.
r1756 count = 0
Lucas Moscovicz
log: changed implementation to use graphlog code...
r21127 getrenamed = None
Patrick Mezard
log: restore cache used by --copies...
r16175 if opts.get('copies'):
Lucas Moscovicz
log: changed implementation to use graphlog code...
r21127 endrev = None
Patrick Mezard
log: restore cache used by --copies...
r16175 if opts.get('rev'):
Lucas Moscovicz
log: changed implementation to use graphlog code...
r21127 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
Patrick Mezard
log: restore cache used by --copies...
r16175 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
Brendan Cully
Show copies in hg log....
r3197
Augie Fackler
log: migrate to modern pager API
r31032 ui.pager('log')
Lucas Moscovicz
log: changed implementation to use graphlog code...
r21127 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
for rev in revs:
if count == limit:
break
ctx = repo[rev]
Patrick Mezard
templatekw: change {file_copies} behaviour, add {file_copies_switch}...
r10060 copies = None
Patrick Mezard
log: restore cache used by --copies...
r16175 if getrenamed is not None and rev:
Patrick Mezard
templatekw: change {file_copies} behaviour, add {file_copies_switch}...
r10060 copies = []
Matt Mackall
walkchangerevs: move 'add' to callback...
r9662 for fn in ctx.files():
rename = getrenamed(fn, rev)
if rename:
copies.append((fn, rename[0]))
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 if filematcher:
revmatchfn = filematcher(ctx.rev())
else:
revmatchfn = None
Mads Kiilerich
log: follow filenames through renames (issue647)...
r11488 displayer.show(ctx, copies=copies, matchfn=revmatchfn)
Yuya Nishihara
changeset_printer: change flush() to accept ctx instead of rev...
r25763 if displayer.flush(ctx):
Bryan O'Sullivan
commands: exit from the log loop at the right time...
r18711 count += 1
Lucas Moscovicz
log: changed implementation to use graphlog code...
r21127
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
mpm@selenic.com
hg help: use docstrings only...
r255
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('manifest',
Adrian Buehlmann
add new option --all to manifest command...
r14399 [('r', 'rev', '', _('revision to display'), _('REV')),
Matt Mackall
commands: add hidden -T option for files/manifest/status/tags...
r22429 ('', 'all', False, _("list files from all revisions"))]
+ formatteropts,
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 _('[-r REV]'))
Adrian Buehlmann
add new option --all to manifest command...
r14399 def manifest(ui, repo, node=None, rev=None, **opts):
Thomas Arendsen Hein
doc string fix: hg cat and manifest default to current parent revision.
r3914 """output the current or given revision of the project manifest
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Print a list of version controlled files for the given revision.
Patrick Mezard
Fix manifest default rev doc when no rev is checked out (issue1603)
r8041 If no revision is given, the first parent of the working directory
timeless
Improve English for help text of many core hg commands....
r8779 is used, or the null revision if no revision is checked out.
With -v, print file permissions, symlink and executable bits.
With --debug, print file revision hashes.
Matt Mackall
commands: initial audit of exit codes...
r11177
Adrian Buehlmann
add new option --all to manifest command...
r14399 If option --all is specified, the list of all files from all revisions
is printed. This includes deleted and renamed files.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
manifest: add formatter support
r17911 fm = ui.formatter('manifest', opts)
Adrian Buehlmann
add new option --all to manifest command...
r14399 if opts.get('all'):
if rev or node:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("can't specify a revision with --all"))
Adrian Buehlmann
add new option --all to manifest command...
r14399
res = []
prefix = "data/"
suffix = ".i"
plen = len(prefix)
slen = len(suffix)
Bryan O'Sullivan
with: use context manager in manifest
r27858 with repo.lock():
Adrian Buehlmann
add new option --all to manifest command...
r14399 for fn, b, size in repo.store.datafiles():
if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix:
res.append(fn[plen:-slen])
Augie Fackler
manifest: enable pager
r31040 ui.pager('manifest')
Adrian Buehlmann
manifest: remove redundant sorted() call for --all...
r17376 for f in res:
Matt Mackall
manifest: add formatter support
r17911 fm.startitem()
fm.write("path", '%s\n', f)
fm.end()
Adrian Buehlmann
add new option --all to manifest command...
r14399 return
Matt Mackall
make manifest friendlier...
r3736
Bryan O'Sullivan
manifest: accept -r for rev specification
r5155 if rev and node:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("please specify just one revision"))
Bryan O'Sullivan
manifest: accept -r for rev specification
r5155
if not node:
node = rev
Matt Mackall
manifest: add formatter support
r17911 char = {'l': '@', 'x': '*', '': ''}
mode = {'l': '644', 'x': '755', '': '644'}
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 ctx = scmutil.revsingle(repo, node)
Matt Mackall
manifest: add formatter support
r17911 mf = ctx.manifest()
Augie Fackler
manifest: enable pager
r31040 ui.pager('manifest')
Matt Mackall
manifest: remove execf/linkf methods
r6749 for f in ctx:
Matt Mackall
manifest: add formatter support
r17911 fm.startitem()
fl = ctx[f].flags()
fm.condwrite(ui.debugflag, 'hash', '%s ', hex(mf[f]))
fm.condwrite(ui.verbose, 'mode type', '%s %1s ', mode[fl], char[fl])
fm.write('path', '%s\n', f)
fm.end()
mpm@selenic.com
hg help: use docstrings only...
r255
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^merge',
Florence Laguzet
merge: deprecate the --force option...
r19439 [('f', 'force', None,
_('force a merge including outstanding changes (DEPRECATED)')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('r', 'rev', '', _('revision to merge'), _('REV')),
('P', 'preview', None,
Martin Geisler
commands: use mergetoolopts when a command supports --tool
r14852 _('review revisions to merge (no merge is performed)'))
] + mergetoolopts,
FUJIWARA Katsunori
doc: remove deprecated option from synopsis of command help...
r28288 _('[-P] [[-r] REV]'))
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 def merge(ui, repo, node=None, **opts):
anatoly techtonik
merge: be precise about what merged into what in short desc
r23400 """merge another revision into working directory
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019
timeless
Improve English for help text of many core hg commands....
r8779 The current working directory is updated with all changes made in
the requested revision since the last common predecessor revision.
Martin Geisler
commands: better merge help text
r7977
Files that changed between either parent are marked as changed for
the next commit and a commit must be performed before any further
timeless
Improve English for help text of many core hg commands....
r8779 updates to the repository are allowed. The next commit will have
two parents.
Vadim Gelfer
merge with other head by default, not tip....
r2915
Steve Borho
merge: add --tool argument to merge and resolve...
r12750 ``--tool`` can be used to specify the merge tool used for file
merges. It overrides the HGMERGE environment variable and your
Arne Babenhauserheide
merge: added info that hg help merge-tools shows the options for --tool
r13891 configuration files. See :hg:`help merge-tools` for options.
Steve Borho
merge: add --tool argument to merge and resolve...
r12750
Vadim Gelfer
merge with other head by default, not tip....
r2915 If no revision is specified, the working directory's parent is a
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 head revision, and the current branch contains exactly one other
head, the other head is merged with by default. Otherwise, an
timeless
Improve English for help text of many core hg commands....
r8779 explicit revision with which to merge with must be provided.
Matt Mackall
commands: initial audit of exit codes...
r11177
timeless
merge: reword help to use See help resolve
r27487 See :hg:`help resolve` for information on handling file conflicts.
Steve Borho
merge: add --tool argument to merge and resolve...
r12750
Matt Mackall
merge: document how to 'undo' a merge
r11452 To undo an uncommitted merge, use :hg:`update --clean .` which
will check out a clean copy of the original merge parent, losing
all changes.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success, 1 if there are unresolved files.
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 """
Matt Mackall
Factor doupdate into _lookup + hg.update
r2806
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 if opts.get('rev') and node:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("please specify just one revision"))
Daniel Holth
accept -r REV in more places...
r4450 if not node:
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 node = opts.get('rev')
Daniel Holth
accept -r REV in more places...
r4450
David Soria Parra
merge: respect bookmarks during merge...
r16708 if node:
node = scmutil.revsingle(repo, node).node()
Pierre-Yves David
merge: move default destination computation in a revset...
r26303 if not node:
Pierre-Yves David
merge: directly get destination from destutil...
r26715 node = repo[destutil.destmerge(repo)].node()
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387
Dirkjan Ochtman
merge: rename -S/--show option to -P/--preview
r8834 if opts.get('preview'):
Greg Ward
merge: fix --preview to show all nodes that will be merged (issue2043)....
r10505 # find nodes that are ancestors of p2 but not of p1
p1 = repo.lookup('.')
p2 = repo.lookup(node)
nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 displayer = cmdutil.show_changeset(ui, repo, opts)
Greg Ward
merge: fix --preview to show all nodes that will be merged (issue2043)....
r10505 for node in nodes:
displayer.show(repo[node])
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
Dirkjan Ochtman
merge: add -S/--show option to review revisions without merging
r8387 return 0
Steve Borho
merge: implement --tool arguments using new ui.forcemerge configurable...
r12788 try:
# ui.forcemerge is an internal variable, do not document
Mads Kiilerich
config: set a 'source' in most cases where config don't come from file but code...
r20790 repo.ui.setconfig('ui', 'forcemerge', opts.get('tool', ''), 'merge')
Siddharth Agarwal
merge: tell _checkunknownfiles about whether this was merge --force...
r28020 force = opts.get('force')
Simon Farnsworth
merge: add conflict labels to merge command...
r30062 labels = ['working copy', 'merge rev']
return hg.merge(repo, node, force=force, mergeforce=force,
labels=labels)
Steve Borho
merge: implement --tool arguments using new ui.forcemerge configurable...
r12788 finally:
Mads Kiilerich
config: set a 'source' in most cases where config don't come from file but code...
r20790 ui.setconfig('ui', 'forcemerge', '', 'merge')
Vadim Gelfer
rewrite revert command. fix issues 93, 123, 147....
r2029
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('outgoing|out',
[('f', 'force', None, _('run even when the destination is unrelated')),
('r', 'rev', [],
_('a changeset intended to be included in the destination'), _('REV')),
('n', 'newest-first', None, _('show newest record first')),
('B', 'bookmarks', False, _('compare bookmarks')),
('b', 'branch', [], _('a specific branch you would like to push'),
_('BRANCH')),
] + logopts + remoteopts + subrepoopts,
_('[-M] [-p] [-n] [-f] [-r REV]... [DEST]'))
Vadim Gelfer
push, outgoing, bundle: fall back to "default" if "default-push" not defined
r2494 def outgoing(ui, repo, dest=None, **opts):
timeless
help: Improved body text
r10376 """show changesets not found in the destination
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Show changesets not found in the specified destination repository
or the default push location. These are the changesets that would
be pushed if a push was requested.
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
timeless
help: Improved body text
r10376 See pull for details of valid destination formats.
Matt Mackall
commands: initial audit of exit codes...
r11177
FUJIWARA Katsunori
bookmarks: show detailed status about outgoing bookmarks...
r24661 .. container:: verbose
With -B/--bookmarks, the result of bookmark comparison between
local and remote repositories is displayed. With -v/--verbose,
status is also displayed for each bookmark like below::
BM1 01234567890a added
BM2 deleted
BM3 234567890abc advanced
BM4 34567890abcd diverged
BM5 4567890abcde changed
The action taken when pushing depends on the
status of each bookmark:
:``added``: push with ``-B`` will create it
:``deleted``: push with ``-B`` will delete it
:``advanced``: push will update it
:``diverged``: push with ``-B`` will update it
:``changed``: push with ``-B`` will update it
From the point of view of pushing behavior, bookmarks
existing only in the remote repository are treated as
``deleted``, even if it is in fact added remotely.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 if there are outgoing changes, 1 otherwise.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Patrick Mezard
incoming/outgoing: handle --graph in core
r17182 if opts.get('graph'):
cmdutil.checkunsupportedgraphflags([], opts)
FUJIWARA Katsunori
hg: make "_outgoing()" return peer object for remote repository...
r21050 o, other = hg._outgoing(ui, repo, dest, opts)
FUJIWARA Katsunori
hg: make "_outgoing()" return empty list instead of "None"...
r21049 if not o:
FUJIWARA Katsunori
outgoing: introduce "outgoinghooks" to avoid redundant outgoing check...
r21051 cmdutil.outgoinghooks(ui, repo, other, opts, o)
Patrick Mezard
incoming/outgoing: handle --graph in core
r17182 return
revdag = cmdutil.graphrevs(repo, o, opts)
Augie Fackler
outgoing: avoid running pager until we're actually showing changes...
r31058 ui.pager('outgoing')
Patrick Mezard
incoming/outgoing: handle --graph in core
r17182 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
Yuya Nishihara
graphlog: move creation of workingdir-parent nodes to displaygraph()...
r27213 cmdutil.displaygraph(ui, repo, revdag, displayer, graphmod.asciiedges)
FUJIWARA Katsunori
outgoing: introduce "outgoinghooks" to avoid redundant outgoing check...
r21051 cmdutil.outgoinghooks(ui, repo, other, opts, o)
Patrick Mezard
incoming/outgoing: handle --graph in core
r17182 return 0
Matt Mackall
bookmarks: merge incoming/outgoing into core
r13366
if opts.get('bookmarks'):
dest = ui.expandpath(dest or 'default-push', dest or 'default')
dest, branches = hg.parseurl(dest, opts.get('branch'))
Matt Mackall
hg: change various repository() users to use peer() where appropriate...
r14556 other = hg.peer(repo, opts, dest)
David Soria Parra
bookmarks: issue a warning if remote doesn't support comparing bookmarks...
r13453 if 'bookmarks' not in other.listkeys('namespaces'):
ui.warn(_("remote doesn't support bookmarks\n"))
return 0
Augie Fackler
outgoing: avoid running pager until we're actually showing changes...
r31058 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
Augie Fackler
outgoing: enable pager...
r31041 ui.pager('outgoing')
FUJIWARA Katsunori
bookmarks: add outgoing() to replace diff() for outgoing bookmarks...
r24398 return bookmarks.outgoing(ui, repo, other)
Matt Mackall
bookmarks: merge incoming/outgoing into core
r13366
Martin Geisler
subrepo: respect non-default path for incoming/outgoing...
r14360 repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default')
try:
Martin Geisler
commands: replace 'x = f(); return x' with 'return f()'
r14362 return hg.outgoing(ui, repo, dest, opts)
Martin Geisler
subrepo: respect non-default path for incoming/outgoing...
r14360 finally:
del repo._subtoppath
mpm@selenic.com
Add hg outgoing command
r920
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('parents',
[('r', 'rev', '', _('show parents of the specified revision'), _('REV')),
] + templateopts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[-r REV] [FILE]'),
inferrepo=True)
Matt Mackall
remove legacy hg parents REV syntax
r3658 def parents(ui, repo, file_=None, **opts):
Matt Mackall
commands: deprecate the parents commands...
r22501 """show the parents of the working directory or revision (DEPRECATED)
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Print the working directory's parent revisions. If a revision is
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 given via -r/--rev, the parent of that revision will be printed.
timeless
Improve English for help text of many core hg commands....
r8779 If a file argument is given, the revision in which the file was
last changed (before the working directory revision or the
argument to --rev if given) is printed.
Matt Mackall
commands: initial audit of exit codes...
r11177
timeless
parents: provide equivalent revsets in help
r27317 This command is equivalent to::
timeless
parents: correct help revset replacements...
r27568 hg log -r "p1()+p2()" or
hg log -r "p1(REV)+p2(REV)" or
hg log -r "max(::p1() and file(FILE))+max(::p2() and file(FILE))" or
hg log -r "max(::p1(REV) and file(FILE))+max(::p2(REV) and file(FILE))"
timeless
parents: provide equivalent revsets in help
r27317
Matt Mackall
commands: deprecate the parents commands...
r22501 See :hg:`summary` and :hg:`help revsets` for related information.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
commands: add revset support to most commands
r12925
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 ctx = scmutil.revsingle(repo, opts.get('rev'), None)
Patrick Mezard
parents: make it match the doc when called on a file...
r5298
Brendan Cully
Make parents with a file but not a revision use working directory revision.
r4586 if file_:
Matt Mackall
scmutil: switch match users to supplying contexts...
r14671 m = scmutil.match(ctx, (file_,), opts)
Matt Mackall
walk: remove remaining users of cmdutils.matchpats
r6582 if m.anypats() or len(m.files()) != 1:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('can only specify an explicit filename'))
Matt Mackall
walk: remove remaining users of cmdutils.matchpats
r6582 file_ = m.files()[0]
Patrick Mezard
parents: make it match the doc when called on a file...
r5298 filenodes = []
for cp in ctx.parents():
if not cp:
continue
try:
filenodes.append(cp.filenode(file_))
Matt Mackall
errors: move revlog errors...
r7633 except error.LookupError:
Patrick Mezard
parents: make it match the doc when called on a file...
r5298 pass
if not filenodes:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("'%s' not found in manifest!") % file_)
Durham Goode
parents: change parents command to use filectx...
r19333 p = []
for fn in filenodes:
fctx = repo.filectx(file_, fileid=fn)
p.append(fctx.node())
mpm@selenic.com
hg help: use docstrings only...
r255 else:
Patrick Mezard
parents: make it match the doc when called on a file...
r5298 p = [cp.node() for cp in ctx.parents()]
mpm@selenic.com
hg help: use docstrings only...
r255
Matt Mackall
templates: move changeset templating bits to cmdutils
r3643 displayer = cmdutil.show_changeset(ui, repo, opts)
mpm@selenic.com
hg help: use docstrings only...
r255 for n in p:
mpm@selenic.com
commands: use node functions directly
r1092 if n != nullid:
Martin Geisler
commands: fix paths command docstring indention
r7743 displayer.show(repo[n])
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
mpm@selenic.com
hg help: use docstrings only...
r255
Yuya Nishihara
paths: port to generic templater...
r27728 @command('paths', formatteropts, _('[NAME]'), optionalrepo=True)
def paths(ui, repo, search=None, **opts):
Bill Barry
Clarified 'hg paths' command help
r7691 """show aliases for remote repositories
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Show definition of symbolic path name NAME. If no name is given,
timeless
Improve English for help text of many core hg commands....
r8779 show definition of all available names.
Martin Geisler
commands: fix paths command docstring indention
r7743
Thomas Arendsen Hein
paths: Add support for -q/--quiet...
r14331 Option -q/--quiet suppresses all output when searching for NAME
and shows only the path names when listing all definitions.
Brodie Rao
help: refer to user configuration file more consistently...
r12083 Path names are defined in the [paths] section of your
configuration file and in ``/etc/mercurial/hgrc``. If run inside a
Martin Geisler
commands: better markup in "hg help paths"
r11009 repository, ``.hg/hgrc`` is used, too.
Bill Barry
consolidated url help into urls help topic and added information about path aliases
r7693
Faheem Mitha
commands: revised documentation of 'default' and 'default-push'...
r11007 The path names ``default`` and ``default-push`` have a special
meaning. When performing a push or pull operation, they are used
as fallbacks if no location is specified on the command-line.
When ``default-push`` is set, it will be used for push and
``default`` will be used for pull; otherwise ``default`` is used
as the fallback for both. When cloning a repository, the clone
timeless
commands: split notes into note containers
r27490 source is written as ``default`` in ``.hg/hgrc``.
.. note::
``default`` and ``default-push`` apply to all inbound (e.g.
:hg:`incoming`) and outbound (e.g. :hg:`outgoing`, :hg:`email`
and :hg:`bundle`) operations.
Faheem Mitha
Document 'default' and 'default-push' in paths docstring
r10933
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help urls` for more information.
Nicolas Dumazet
commands: document return values of add and paths commands
r11507
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142
opts = pycompat.byteskwargs(opts)
Augie Fackler
paths: enable pager
r31042 ui.pager('paths')
TK Soh
Add paths command...
r779 if search:
Yuya Nishihara
paths: use single loop for both search=None|pattern cases...
r27726 pathitems = [(name, path) for name, path in ui.paths.iteritems()
if name == search]
TK Soh
Add paths command...
r779 else:
Yuya Nishihara
paths: reorder else clause for readability of subsequent patches...
r27725 pathitems = sorted(ui.paths.iteritems())
Yuya Nishihara
paths: port to generic templater...
r27728 fm = ui.formatter('paths', opts)
Mathias De Maré
formatter: introduce isplain() to replace (the inverse of) __nonzero__() (API)...
r29949 if fm.isplain():
hidepassword = util.hidepassword
else:
Yuya Nishihara
paths: port to generic templater...
r27728 hidepassword = str
Yuya Nishihara
paths: merge conditions that select visibility of fields...
r27727 if ui.quiet:
namefmt = '%s\n'
else:
namefmt = '%s = '
showsubopts = not search and not ui.quiet
Yuya Nishihara
paths: reorder else clause for readability of subsequent patches...
r27725 for name, path in pathitems:
Yuya Nishihara
paths: port to generic templater...
r27728 fm.startitem()
fm.condwrite(not search, 'name', namefmt, name)
fm.condwrite(not ui.quiet, 'url', '%s\n', hidepassword(path.rawloc))
Yuya Nishihara
paths: merge conditions that select visibility of fields...
r27727 for subopt, value in sorted(path.suboptions.items()):
Yuya Nishihara
paths: port to generic templater...
r27728 assert subopt not in ('name', 'url')
Yuya Nishihara
paths: merge conditions that select visibility of fields...
r27727 if showsubopts:
Yuya Nishihara
paths: port to generic templater...
r27728 fm.plain('%s:%s = ' % (name, subopt))
fm.condwrite(showsubopts, subopt, '%s\n', value)
fm.end()
TK Soh
Add paths command...
r779
Yuya Nishihara
paths: use single loop for both search=None|pattern cases...
r27726 if search and not pathitems:
if not ui.quiet:
ui.warn(_("not found!\n"))
return 1
else:
return 0
Pierre-Yves David
command: remove phase from the list of basic command...
r17981 @command('phase',
Martin Geisler
phase: lowercase option help, rephrase slightly
r15849 [('p', 'public', False, _('set changeset phase to public')),
('d', 'draft', False, _('set changeset phase to draft')),
('s', 'secret', False, _('set changeset phase to secret')),
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 ('f', 'force', False, _('allow to move boundary backward')),
Martin Geisler
phase: add metavar to -r help text
r15855 ('r', 'rev', [], _('target revision'), _('REV')),
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 ],
Gilles Moris
phase: default to current revision if no rev is provided (issue4666)
r25120 _('[-p|-d|-s] [-f] [-r] [REV...]'))
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 def phase(ui, repo, *revs, **opts):
"""set or show the current phase name
Gilles Moris
phase: default to current revision if no rev is provided (issue4666)
r25120 With no argument, show the phase name of the current revision(s).
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830
Martin Geisler
phase: use standard syntax for command line flags...
r15851 With one of -p/--public, -d/--draft or -s/--secret, change the
Martin Geisler
phase: fix RST markup (use ``...`` for literal text)
r15850 phase value of the specified revisions.
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830
Unless -f/--force is specified, :hg:`phase` won't move changeset from a
Martin Geisler
phase: fix RST markup (use ``...`` for literal text)
r15850 lower phase to an higher phase. Phases are ordered as follows::
Matt Mackall
phase: fix up help string
r15832
public < draft < secret
Pierre-Yves David
phase: report phase movement...
r15906
Jordi Gutiérrez Hermoso
phases: return zero for no-op operations (issue4751) (BC)...
r26366 Returns 0 on success, 1 if some phases could not be changed.
Pierre-Yves David
phase: add a pointer to 'hg help phases' in the 'phase' help...
r25626
(For more information about the phases concept, see :hg:`help phases`.)
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 # search for a unique phase argument
targetphase = None
Martin Geisler
commands: no need to rename merge and phases on import
r15853 for idx, name in enumerate(phases.phasenames):
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 if opts[name]:
if targetphase is not None:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('only one phase can be specified'))
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 targetphase = idx
# look for specified revision
revs = list(revs)
revs.extend(opts['rev'])
if not revs:
Gilles Moris
phase: default to current revision if no rev is provided (issue4666)
r25120 # display both parents as the second parent phase can influence
# the phase of a merge commit
revs = [c.rev() for c in repo[None].parents()]
Matt Mackall
phase: drop reference to working directory phase
r15831
Pierre-Yves David
phase: accept old style revision specification
r16024 revs = scmutil.revrange(repo, revs)
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 lock = None
Pierre-Yves David
phase: report phase movement...
r15906 ret = 0
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 if targetphase is None:
# display
Pierre-Yves David
phase: accept old style revision specification
r16024 for r in revs:
ctx = repo[r]
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 ui.write('%i: %s\n' % (ctx.rev(), ctx.phasestr()))
else:
Pierre-Yves David
phase: wrap `hg phases` phase movement in a transaction...
r22050 tr = None
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 lock = repo.lock()
try:
Pierre-Yves David
phase: wrap `hg phases` phase movement in a transaction...
r22050 tr = repo.transaction("phase")
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 # set phase
Patrick Mezard
phase: make if abort on nullid for the good reason...
r16659 if not revs:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('empty revision set'))
Patrick Mezard
phase: make if abort on nullid for the good reason...
r16659 nodes = [repo[r].node() for r in revs]
Durham Goode
phases: change phase command change detection...
r22892 # moving revision from public to draft may hide them
# We have to check result on an unfiltered repository
unfi = repo.unfiltered()
getphase = unfi._phasecache.phase
olddata = [getphase(unfi, r) for r in unfi]
Pierre-Yves David
phase: add a transaction argument to advanceboundary...
r22069 phases.advanceboundary(repo, tr, targetphase, nodes)
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 if opts['force']:
Pierre-Yves David
phase: add a transaction argument to retractboundary...
r22070 phases.retractboundary(repo, tr, targetphase, nodes)
Pierre-Yves David
phase: wrap `hg phases` phase movement in a transaction...
r22050 tr.close()
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 finally:
Pierre-Yves David
phase: wrap `hg phases` phase movement in a transaction...
r22050 if tr is not None:
tr.release()
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830 lock.release()
Durham Goode
phases: change phase command change detection...
r22892 getphase = unfi._phasecache.phase
newdata = [getphase(unfi, r) for r in unfi]
changes = sum(newdata[r] != olddata[r] for r in unfi)
Pierre-Yves David
phases: prepare phase command for filtering...
r18210 cl = unfi.changelog
Patrick Mezard
phase: remove useless test, olddata is never None
r16715 rejected = [n for n in nodes
Pierre-Yves David
phases: avoid changectx creation while checking command result...
r18209 if newdata[cl.rev(n)] < targetphase]
Patrick Mezard
phase: remove useless test, olddata is never None
r16715 if rejected:
Martin Geisler
phase: better error message when --force is needed...
r20093 ui.warn(_('cannot move %i changesets to a higher '
Patrick Mezard
phase: remove useless test, olddata is never None
r16715 'phase, use --force\n') % len(rejected))
ret = 1
if changes:
msg = _('phase changed for %i changesets\n') % changes
if ret:
ui.status(msg)
Pierre-Yves David
phase: report phase movement...
r15906 else:
Patrick Mezard
phase: remove useless test, olddata is never None
r16715 ui.note(msg)
else:
ui.warn(_('no phases changed\n'))
Pierre-Yves David
phase: alway return a value...
r15968 return ret
Pierre-Yves David
phases: add a phases command to display and manipulate phases
r15830
FUJIWARA Katsunori
commands: add postincoming explicit brev argument (API)...
r28269 def postincoming(ui, repo, modheads, optupdate, checkout, brev):
FUJIWARA Katsunori
commands: add postincoming docstring for explanation of arguments
r28502 """Run after a changegroup has been added via pull/unbundle
This takes arguments below:
:modheads: change of heads by pull/unbundle
:optupdate: updating working directory is needed or not
:checkout: update destination revision (or None to default destination)
:brev: a name, which might be a bookmark to be activated after updating
"""
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 if modheads == 0:
Matt Mackall
pull: backout change to return code...
r16107 return
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 if optupdate:
Brendan Cully
Make pull -u behave like pull && update...
r14485 try:
FUJIWARA Katsunori
commands: centralize code to update with extra care for non-file components...
r28501 return hg.updatetotally(ui, repo, checkout, brev)
Pierre-Yves David
update: introduce a 'UpdateAbort' exception...
r26683 except error.UpdateAbort as inst:
liscju
pull: return 255 value on update failure (issue4948) (BC)...
r26968 msg = _("not updating: %s") % str(inst)
hint = inst.hint
raise error.UpdateAbort(msg, hint=hint)
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 if modheads > 1:
Kevin Berridge
pull: new output message when there are multiple branches...
r13804 currentbranchheads = len(repo.branchheads())
if currentbranchheads == modheads:
Kevin Berridge
pull: don't suggest running hg merge when new heads are on different branches...
r13803 ui.status(_("(run 'hg heads' to see heads, 'hg merge' to merge)\n"))
Kevin Berridge
pull: new output message when there are multiple branches...
r13804 elif currentbranchheads > 1:
Brodie Rao
cleanup: eradicate long lines
r16683 ui.status(_("(run 'hg heads .' to see heads, 'hg merge' to "
"merge)\n"))
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 else:
Kevin Berridge
pull: don't suggest running hg merge when new heads are on different branches...
r13803 ui.status(_("(run 'hg heads' to see heads)\n"))
Vadim Gelfer
add merge command. means same thing as "update -m"....
r2019 else:
ui.status(_("(run 'hg update' to get a working copy)\n"))
Vadim Gelfer
rewrite revert command. fix issues 93, 123, 147....
r2029
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^pull',
[('u', 'update', None,
_('update to new branch head if changesets were pulled')),
('f', 'force', None, _('run even when remote repository is unrelated')),
('r', 'rev', [], _('a remote changeset intended to be added'), _('REV')),
('B', 'bookmark', [], _("bookmark to pull"), _('BOOKMARK')),
('b', 'branch', [], _('a specific branch you would like to pull'),
_('BRANCH')),
] + remoteopts,
_('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]'))
mpm@selenic.com
[PATCH] Unintuive use...
r404 def pull(ui, repo, source="default", **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """pull changes from the specified source
timeless
Improve English for help text of many core hg commands....
r8779 Pull changes from a remote repository to a local one.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
This finds all changes from the repository at the specified path
timeless
Improve English for help text of many core hg commands....
r8779 or URL and adds them to a local repository (the current one unless
-R is specified). By default, this does not update the copy of the
project in the working directory.
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 Use :hg:`incoming` if you want to see what would have been added
by a pull at the time you issued this command. If you then decide
to add those changes to the repository, you should use :hg:`pull
-r X` where ``X`` is the last changeset listed by :hg:`incoming`.
Martin Geisler
commands: make pull help point to the incoming command
r7980
Bill Barry
consolidated url help into urls help topic and added information about path aliases
r7693 If SOURCE is omitted, the 'default' path will be used.
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help urls` for more information.
Matt Mackall
commands: initial audit of exit codes...
r11177
liscju
pull: add help information about pulling active bookmark
r29384 Specifying bookmark as ``.`` is equivalent to specifying the active
bookmark's name.
Matt Mackall
pull: backout change to return code...
r16107 Returns 0 on success, 1 if an update had unresolved files.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Ryan McElroy
pull: abort pull --update if config requires destination (issue5528)
r31845
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Ryan McElroy
pull: abort pull --update if config requires destination (issue5528)
r31845 if ui.configbool('commands', 'update.requiredest') and opts.get('update'):
msg = _('update destination required by configuration')
hint = _('use hg pull followed by hg update DEST')
raise error.Abort(msg, hint=hint)
Sune Foldager
add -b/--branch option to clone, bundle, incoming, outgoing, pull, push
r10379 source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch'))
Thomas Arendsen Hein
pull: print "pulling from foo" before accessing the other repo...
r24138 ui.status(_('pulling from %s\n') % util.hidepassword(source))
Matt Mackall
hg: change various repository() users to use peer() where appropriate...
r14556 other = hg.peer(repo, opts, source)
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 try:
revs, checkout = hg.addbranchrevs(repo, other, branches,
opts.get('rev'))
Pierre-Yves David
pull: allow a generic way to pass parameters to the pull operation...
r25445 pullopargs = {}
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 if opts.get('bookmark'):
if not revs:
revs = []
Pierre-Yves David
pull: document the race condition with bookmark name...
r25368 # The list of bookmark used here is not the one used to actually
# update the bookmark name. This can result in the revision pulled
# not ending up with the name of the bookmark because of a race
# condition on the server. (See issue 4689 for details)
Pierre-Yves David
pull: only list remote bookmarks if -B is used to populate pulled heads...
r25367 remotebookmarks = other.listkeys('bookmarks')
Pierre-Yves David
pull: prevent race condition in bookmark update when using -B (issue4689)...
r25446 pullopargs['remotebookmarks'] = remotebookmarks
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 for b in opts['bookmark']:
liscju
bookmarks: add 'hg pull -B .' for pulling the active bookmark (issue5258)
r29376 b = repo._bookmarks.expandname(b)
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 if b not in remotebookmarks:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('remote bookmark %s not found!') % b)
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 revs.append(remotebookmarks[b])
if revs:
try:
Pierre-Yves David
pull: document the race condition with bookmark name...
r25368 # When 'rev' is a bookmark name, we cannot guarantee that it
# will be updated with that name because of a race condition
# server side. (See issue 4689 for details)
Pierre-Yves David
pull: avoid race condition with 'hg pull --rev name --update' (issue4706)...
r25425 oldrevs = revs
revs = [] # actually, nodes
for r in oldrevs:
node = other.lookup(r)
revs.append(node)
if r == checkout:
checkout = node
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 except error.CapabilityError:
err = _("other repository doesn't support revision lookup, "
"so a rev cannot be specified.")
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(err)
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576
Sean Farley
pull: all pass along extra opargs...
r26810 pullopargs.update(opts.get('opargs', {}))
Pierre-Yves David
commands: directly use exchange.pull...
r22694 modheads = exchange.pull(repo, other, heads=revs,
force=opts.get('force'),
Pierre-Yves David
pull: allow a generic way to pass parameters to the pull operation...
r25445 bookmarks=opts.get('bookmark', ()),
opargs=pullopargs).cgresult
FUJIWARA Katsunori
commands: add postincoming explicit brev argument (API)...
r28269
# brev is a name, which might be a bookmark to be activated at
# the end of the update. In other words, it is an explicit
# destination of the update
brev = None
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 if checkout:
Pierre-Yves David
pull: avoid race condition with 'hg pull --rev name --update' (issue4706)...
r25425 checkout = str(repo.changelog.rev(checkout))
FUJIWARA Katsunori
commands: add postincoming explicit brev argument (API)...
r28269
# order below depends on implementation of
# hg.addbranchrevs(). opts['bookmark'] is ignored,
# because 'checkout' is determined without it.
if opts.get('rev'):
brev = opts['rev'][0]
elif opts.get('branch'):
brev = opts['branch'][0]
else:
brev = branches[0]
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 repo._subtoppath = source
Bryan O'Sullivan
Push capability checking into protocol-level code.
r5259 try:
FUJIWARA Katsunori
commands: add postincoming explicit brev argument (API)...
r28269 ret = postincoming(ui, repo, modheads, opts.get('update'),
checkout, brev)
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576
finally:
del repo._subtoppath
Mads Kiilerich
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
r12852 finally:
Piotr Klecha
pull: close peer repo on completion (issue2491) (issue2797)...
r20576 other.close()
Matt Mackall
bookmarks: move push/pull command features to core
r13368 return ret
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^push',
[('f', 'force', None, _('force push')),
('r', 'rev', [],
_('a changeset intended to be included in the destination'),
_('REV')),
('B', 'bookmark', [], _("bookmark to push"), _('BOOKMARK')),
('b', 'branch', [],
_('a specific branch you would like to push'), _('BRANCH')),
('', 'new-branch', False, _('allow pushing a new branch')),
] + remoteopts,
_('[-f] [-r REV]... [-e CMD] [--remotecmd CMD] [DEST]'))
Vadim Gelfer
push, outgoing, bundle: fall back to "default" if "default-push" not defined
r2494 def push(ui, repo, dest=None, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """push changes to the specified destination
Faheem Mitha
commands: updates to push docstring....
r11217 Push changesets from the local repository to the specified
destination.
This operation is symmetrical to pull: it is identical to a pull
in the destination repository from the current one.
By default, push will not allow creation of new heads at the
destination, since multiple heads would make it unclear which head
to use. In this situation, it is recommended to pull and merge
before pushing.
Martin Geisler
commands: document --new-branch flag for push
r11219 Use --new-branch if you want to allow push to create a new named
branch that is not present at the destination. This allows you to
only create a new branch without forcing other changes.
FUJIWARA Katsunori
push: add more detailed explanation about "--force" to online help document...
r19935 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
timeless
commands: consistently indent notes 3 spaces...
r27471 Extra care should be taken with the -f/--force option,
which will push all new heads on all branches, an action which will
almost always cause confusion for collaborators.
Faheem Mitha
commands: updates to push docstring....
r11217
If -r/--rev is used, the specified revision and all its ancestors
will be pushed to the remote repository.
Bill Barry
consolidated url help into urls help topic and added information about path aliases
r7693
Augie Fackler
bookmarks: document behavior of -B/--bookmark in help
r17190 If -B/--bookmark is used, the specified bookmarked revision, its
ancestors, and the bookmark will be pushed to the remote
liscju
bookmarks: add 'hg push -B .' for pushing the active bookmark (issue4917)
r28182 repository. Specifying ``.`` is equivalent to specifying the active
bookmark's name.
Augie Fackler
bookmarks: document behavior of -B/--bookmark in help
r17190
Martin Geisler
Use hg role in help strings
r10973 Please see :hg:`help urls` for important details about ``ssh://``
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 URLs. If DESTINATION is omitted, a default path will be used.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if push was successful, 1 if nothing to push.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
bookmarks: move push/pull command features to core
r13368
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Matt Mackall
bookmarks: move push/pull command features to core
r13368 if opts.get('bookmark'):
Mads Kiilerich
config: set a 'source' in most cases where config don't come from file but code...
r20790 ui.setconfig('bookmarks', 'pushing', opts['bookmark'], 'push')
Matt Mackall
bookmarks: move push/pull command features to core
r13368 for b in opts['bookmark']:
# translate -B options to -r so changesets get pushed
liscju
bookmarks: add 'hg push -B .' for pushing the active bookmark (issue4917)
r28182 b = repo._bookmarks.expandname(b)
Matt Mackall
bookmarks: move push/pull command features to core
r13368 if b in repo._bookmarks:
opts.setdefault('rev', []).append(b)
else:
# if we try to push a deleted bookmark, translate it to null
# this lets simultaneous -r, -b options continue working
opts.setdefault('rev', []).append("null")
Yuya Nishihara
push: specify default-push and default as fallback paths...
r27562 path = ui.paths.getpath(dest, default=('default-push', 'default'))
Gregory Szorc
commands.push: use paths API...
r26057 if not path:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('default repository not configured!'),
timeless
push: update help hint to point to config.paths section
r29965 hint=_("see 'hg help config.paths'"))
Gregory Szorc
ui: store pushloc as separate attribute...
r27264 dest = path.pushloc or path.loc
branches = (path.branch, opts.get('branch') or [])
Brodie Rao
url: move URL parsing functions into util to improve startup time...
r14076 ui.status(_('pushing to %s\n') % util.hidepassword(dest))
Sune Foldager
interpret repo#name url syntax as branch instead of revision...
r10365 revs, checkout = hg.addbranchrevs(repo, repo, branches, opts.get('rev'))
Gregory Szorc
commands.push: use paths API...
r26057 other = hg.peer(repo, opts, dest)
anuraggoel
push: provide a hint when no paths in configured (issue3692)...
r20558
Matt Mackall
Add support for url#id syntax...
r4478 if revs:
Pierre-Yves David
push: accept revset argument for --rev
r17168 revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
Gregory Szorc
commands.push: abort when revisions evaluate to empty set (BC)...
r24429 if not revs:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("specified revisions evaluate to an empty set"),
Gregory Szorc
commands.push: abort when revisions evaluate to empty set (BC)...
r24429 hint=_("use different revision arguments"))
Gregory Szorc
ui: path option to declare which revisions to push by default...
r29413 elif path.pushrev:
# It doesn't make any sense to specify ancestor revisions. So limit
# to DAG heads to make discovery simpler.
Yuya Nishihara
revset: split language services to revsetlang module (API)...
r31024 expr = revsetlang.formatspec('heads(%r)', path.pushrev)
Gregory Szorc
ui: path option to declare which revisions to push by default...
r29413 revs = scmutil.revrange(repo, [expr])
revs = [repo[rev].node() for rev in revs]
if not revs:
raise error.Abort(_('default push revset for path evaluates to an '
'empty set'))
Matt Mackall
subrepo: basic push support
r8815
Mads Kiilerich
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
r12852 repo._subtoppath = dest
try:
# push subrepos depth-first for coherent ordering
c = repo['']
subs = c.substate # only repos that are committed
for s in sorted(subs):
Matt Mackall
subrepo: return non-zero exit code when a subrepo push doesn't succeed
r21034 result = c.sub(s).push(opts)
if result == 0:
return not result
Mads Kiilerich
subrepo: propagate non-default pull/push path to relative subrepos (issue1852)
r12852 finally:
del repo._subtoppath
Pierre-Yves David
push: use `exchange.push` in `commands.push`...
r22617 pushop = exchange.push(repo, other, opts.get('force'), revs=revs,
Pierre-Yves David
push: pass list of bookmark to `exchange.push`...
r22623 newbranch=opts.get('new_branch'),
Sean Farley
push: all pass along opargs...
r26809 bookmarks=opts.get('bookmark', ()),
opargs=opts.get('opargs'))
Pierre-Yves David
push: use `exchange.push` in `commands.push`...
r22617
result = not pushop.cgresult
Matt Mackall
bookmarks: move push/pull command features to core
r13368
Pierre-Yves David
push: perform bookmark export in the push function...
r22625 if pushop.bkresult is not None:
if pushop.bkresult == 2:
Pierre-Yves David
push: sanitize handling of bookmark push return value...
r22621 result = 2
Pierre-Yves David
push: perform bookmark export in the push function...
r22625 elif not result and pushop.bkresult:
FUJIWARA Katsunori
bookmarks: rewrite pushing local bookmarks in "commands.push()" by "compare()"...
r20026 result = 2
Matt Mackall
bookmarks: move push/pull command features to core
r13368
return result
mpm@selenic.com
stopgap hg push support...
r319
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('recover', [])
mpm@selenic.com
big heap of command clean-up work...
r245 def recover(ui, repo):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """roll back an interrupted transaction
Recover from an interrupted commit or pull.
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 This command tries to fix the repository status after an
interrupted operation. It should only be necessary when Mercurial
suggests it.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 if successful, 1 if nothing to recover or verify fails.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
Automatically run "verify" whenever we run "recover"
r1516 if repo.recover():
Matt Mackall
Move repo.verify
r2778 return hg.verify(repo)
Thomas Arendsen Hein
Never exit directly from commands.dispatch(), but pass return code to caller....
r2057 return 1
mpm@selenic.com
big heap of command clean-up work...
r245
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^remove|rm',
[('A', 'after', None, _('record delete for missing files')),
('f', 'force', None,
liscju
remove: fix --force option help description (issue5177)...
r28902 _('forget added files, delete modified files')),
Matt Harbison
remove: recurse into subrepositories with --subrepos/-S flag...
r23325 ] + subrepoopts + walkopts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... FILE...'),
inferrepo=True)
Vadim Gelfer
add --after option to remove command.
r2179 def remove(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """remove the specified files on the next commit
Matt Mackall
remove: simplify help...
r15114 Schedule the indicated files for removal from the current branch.
This command schedules the files to be removed at the next commit.
To undo a remove before that, see :hg:`revert`. To undo added
files, see :hg:`forget`.
.. container:: verbose
-A/--after can be used to remove only files that have already
been deleted, -f/--force can be used to force deletion, and -Af
can be used to remove files from the next revision without
deleting them from the working directory.
The following table details the behavior of remove for different
file states (columns) and option combinations (rows). The file
states are Added [A], Clean [C], Modified [M] and Missing [!]
(as reported by :hg:`status`). The actions are Warn, Remove
(from branch) and Delete (from disk):
Matt Mackall
minirst: add simple table support...
r15037
FUJIWARA Katsunori
doc: put text into header of 1st column in table to generate page correctly...
r19960 ========= == == == ==
opt/state A C M !
========= == == == ==
none W RD W R
-f R RD RD R
-A W W W R
-Af R R R R
========= == == == ==
Vadim Gelfer
remove: rewrite to be ~400x faster, bit more friendly...
r2309
timeless
remove: quote --force in never deletes note...
r27489 .. note::
:hg:`remove` never deletes files in Added [A] state from the
working directory, not even if ``--force`` is specified.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if any warnings encountered.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346 after, force = opts.get('after'), opts.get('force')
if not pats and not after:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no files specified'))
Dirkjan Ochtman
improved semantics for remove (issue438)...
r6346
Matt Mackall
scmutil: switch match users to supplying contexts...
r14671 m = scmutil.match(repo[None], pats, opts)
Matt Harbison
remove: recurse into subrepositories with --subrepos/-S flag...
r23325 subrepos = opts.get('subrepos')
return cmdutil.remove(ui, repo, m, "", after, force, subrepos)
mpm@selenic.com
big heap of command clean-up work...
r245
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('rename|move|mv',
[('A', 'after', None, _('record a rename that has already occurred')),
('f', 'force', None, _('forcibly copy over an existing managed file')),
] + walkopts + dryrunopts,
_('[OPTION]... SOURCE... DEST'))
Bryan O'Sullivan
Add rename/mv command....
r1253 def rename(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """rename files; equivalent of copy + remove
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Mark dest as copies of sources; mark sources for deletion. If dest
is a directory, copies are put in that directory. If dest is a
file, there can only be one source.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
By default, this command copies the contents of files as they
Martin Geisler
commands: consistently write switches as -a/--abc
r8033 exist in the working directory. If invoked with -A/--after, the
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 operation is recorded, but no copying is performed.
timeless
help: miscellaneous language fixes
r7807 This command takes effect at the next commit. To undo a rename
Martin Geisler
Use our custom hg reStructuredText role some more...
r11193 before that, see :hg:`revert`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if errors are encountered.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Bryan O'Sullivan
with: use context manager in rename
r27857 with repo.wlock(False):
Matt Mackall
copy: handle rename internally...
r5610 return cmdutil.copy(ui, repo, pats, opts, rename=True)
Bryan O'Sullivan
Add rename/mv command....
r1253
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('resolve',
[('a', 'all', None, _('select all unresolved files')),
('l', 'list', None, _('list state of files needing merge')),
('m', 'mark', None, _('mark files as resolved')),
('u', 'unmark', None, _('mark files as unresolved')),
('n', 'no-status', None, _('hide status prefix'))]
Yuya Nishihara
resolve: port to generic templater...
r24127 + mergetoolopts + walkopts + formatteropts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... [FILE]...'),
inferrepo=True)
Matt Mackall
resolve: new command...
r6518 def resolve(ui, repo, *pats, **opts):
Mark Edgington
resolve: updated help documentation for improved clarity
r11836 """redo merges or set/view the merge status of files
Merges with unresolved conflicts are often the result of
Brodie Rao
help: refer to user configuration file more consistently...
r12083 non-interactive merging using the ``internal:merge`` configuration
setting, or a command-line merge tool like ``diff3``. The resolve
command is used to manage the files involved in a merge, after
:hg:`merge` has been run, and before :hg:`commit` is run (i.e. the
Augie Fackler
resolve: mention merge-tools topic in help
r16009 working directory must have two parents). See :hg:`help
merge-tools` for information on configuring merge tools.
Mark Edgington
resolve: updated help documentation for improved clarity
r11836
The resolve command can be used in the following ways:
Mads Kiilerich
help: improve merge-tools topic, describe --tool and clarify details...
r12809 - :hg:`resolve [--tool TOOL] FILE...`: attempt to re-merge the specified
Steve Borho
merge: add --tool argument to merge and resolve...
r12750 files, discarding any previous merge attempts. Re-merging is not
Mark Edgington
resolve: updated help documentation for improved clarity
r11836 performed for files already marked as resolved. Use ``--all/-a``
Pang Yan Han
commands: fix grammar in resolve help text
r15042 to select all unresolved files. ``--tool`` can be used to specify
Steve Borho
merge: add --tool argument to merge and resolve...
r12750 the merge tool used for the given files. It overrides the HGMERGE
Pierre-Yves David
resolve: update documentation to mention the .orig backup
r15232 environment variable and your configuration files. Previous file
contents are saved with a ``.orig`` suffix.
Mark Edgington
resolve: updated help documentation for improved clarity
r11836
- :hg:`resolve -m [FILE]`: mark a file as having been resolved
(e.g. after having manually fixed-up the files). The default is
to mark all unresolved files.
- :hg:`resolve -u [FILE]...`: mark a file as unresolved. The
default is to mark all resolved files.
- :hg:`resolve -l`: list files which had or still have conflicts.
In the printed list, ``U`` = unresolved and ``R`` = resolved.
Yuya Nishihara
help: add pointer how to narrow list of resolved/unresolved files (issue5469)
r31022 You can use ``set:unresolved()`` or ``set:resolved()`` to filter
the list. See :hg:`help filesets` for details.
Mark Edgington
resolve: updated help documentation for improved clarity
r11836
timeless
commands: split notes into note containers
r27490 .. note::
Mercurial will not let you commit files with unresolved merge
conflicts. You must use :hg:`resolve -m ...` before you can
commit after a conflicting merge.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if any files fail a resolve attempt.
Matt Mackall
resolve: new command...
r6518 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
timeless
resolve: when pats do not match, hint about path:...
r28402 flaglist = 'all mark unmark list no_status'.split()
timeless
commands: adding --no-status to resolve to match status
r9646 all, mark, unmark, show, nostatus = \
timeless
resolve: when pats do not match, hint about path:...
r28402 [opts.get(o) for o in flaglist]
Matt Mackall
resolve: require -a switch to resolve all files...
r7527
if (show and (mark or unmark)) or (mark and unmark):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("too many options specified"))
Matt Mackall
resolve: require -a switch to resolve all files...
r7527 if pats and all:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("can't specify --all and patterns"))
Matt Mackall
resolve: require -a switch to resolve all files...
r7527 if not (all or pats or show or mark or unmark):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('no files or directories specified'),
timeless@mozdev.org
resolve: consistently describe re-merge + unresolved
r26352 hint=('use --all to re-merge all unresolved files'))
Matt Mackall
resolve: new command...
r6518
Yuya Nishihara
resolve: extract -l/--list operation from big loop...
r24126 if show:
Augie Fackler
resolve: enable pager
r31043 ui.pager('resolve')
Yuya Nishihara
resolve: port to generic templater...
r24127 fm = ui.formatter('resolve', opts)
Siddharth Agarwal
commands.resolve: switch to mergestate.read()...
r26993 ms = mergemod.mergestate.read(repo)
Yuya Nishihara
resolve: extract -l/--list operation from big loop...
r24126 m = scmutil.match(repo[None], pats, opts)
for f in ms:
if not m(f):
continue
Siddharth Agarwal
commands.resolve: support printing out driver-resolved files...
r26764 l = 'resolve.' + {'u': 'unresolved', 'r': 'resolved',
'd': 'driverresolved'}[ms[f]]
Yuya Nishihara
resolve: port to generic templater...
r24127 fm.startitem()
fm.condwrite(not nostatus, 'status', '%s ', ms[f].upper(), label=l)
fm.write('path', '%s\n', f, label=l)
fm.end()
Yuya Nishihara
resolve: extract -l/--list operation from big loop...
r24126 return 0
Bryan O'Sullivan
with: use context manager in resolve
r27856 with repo.wlock():
Siddharth Agarwal
commands.resolve: switch to mergestate.read()...
r26993 ms = mergemod.mergestate.read(repo)
Matt Mackall
merge with stable
r21720
Yuya Nishihara
resolve: extract -l/--list operation from big loop...
r24126 if not (ms.active() or repo.dirstate.p2() != nullid):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(
Matt Mackall
merge with stable
r21720 _('resolve command not applicable when not merging'))
Siddharth Agarwal
resolve: only create wctx once...
r26783 wctx = repo[None]
Siddharth Agarwal
commands.resolve: call driverpreprocess if we haven't run it yet...
r26788 if ms.mergedriver and ms.mdstate() == 'u':
proceed = mergemod.driverpreprocess(repo, ms, wctx)
ms.commit()
# allow mark and unmark to go through
if not mark and not unmark and not proceed:
return 1
Siddharth Agarwal
resolve: only create wctx once...
r26783 m = scmutil.match(wctx, pats, opts)
Mads Kiilerich <madski at unity3d.com>
resolve: keep wlock while resolving...
r21709 ret = 0
Matt Mackall
merge with stable
r21720 didwork = False
Siddharth Agarwal
commands.resolve: conclude merge driver if no unresolved files are left...
r26789 runconclude = False
Mads Kiilerich <madski at unity3d.com>
resolve: keep wlock while resolving...
r21709
Siddharth Agarwal
resolve: perform all premerges before performing any file merges (BC)...
r26621 tocomplete = []
Mads Kiilerich <madski at unity3d.com>
resolve: keep wlock while resolving...
r21709 for f in ms:
Matt Mackall
merge with stable
r21720 if not m(f):
continue
didwork = True
Siddharth Agarwal
commands.resolve: conclude merge driver if no unresolved files are left...
r26789 # don't let driver-resolved files be marked, and run the conclude
# step if asked to resolve
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 if ms[f] == "d":
exact = m.exact(f)
if mark:
if exact:
ui.warn(_('not marking %s as it is driver-resolved\n')
% f)
elif unmark:
if exact:
ui.warn(_('not unmarking %s as it is driver-resolved\n')
% f)
Siddharth Agarwal
commands.resolve: conclude merge driver if no unresolved files are left...
r26789 else:
runconclude = True
Siddharth Agarwal
commands.resolve: don't allow users to mark or unmark driver-resolved files...
r26784 continue
Yuya Nishihara
resolve: extract -l/--list operation from big loop...
r24126 if mark:
Matt Mackall
merge with stable
r21720 ms.mark(f, "r")
elif unmark:
ms.mark(f, "u")
Matt Mackall
resolve: new command...
r6518 else:
Matt Mackall
merge with stable
r21720 # backup pre-resolve (merge uses .orig for its own purposes)
a = repo.wjoin(f)
Siddharth Agarwal
resolve: don't abort when file is missing...
r26899 try:
util.copyfile(a, a + ".resolve")
except (IOError, OSError) as inst:
if inst.errno != errno.ENOENT:
raise
Matt Mackall
merge with stable
r21720
try:
Siddharth Agarwal
resolve: perform all premerges before performing any file merges (BC)...
r26621 # preresolve file
Matt Mackall
merge with stable
r21720 ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
'resolve')
Siddharth Agarwal
merge: introduce a preresolve function...
r26617 complete, r = ms.preresolve(f, wctx)
if not complete:
Siddharth Agarwal
resolve: perform all premerges before performing any file merges (BC)...
r26621 tocomplete.append(f)
elif r:
Matt Mackall
merge with stable
r21720 ret = 1
finally:
ui.setconfig('ui', 'forcemerge', '', 'resolve')
ms.commit()
Siddharth Agarwal
resolve: restore .orig only after merge is fully complete (issue4952)...
r26959 # replace filemerge's .orig file with our resolve file, but only
# for merges that are complete
if complete:
Matt Mackall
merge with stable
r27010 try:
util.rename(a + ".resolve",
Siddharth Agarwal
origpath: move from cmdutil to scmutil...
r27651 scmutil.origpath(ui, repo, a))
Matt Mackall
merge with stable
r27010 except OSError as inst:
if inst.errno != errno.ENOENT:
raise
Mads Kiilerich <madski at unity3d.com>
resolve: keep wlock while resolving...
r21709
Siddharth Agarwal
resolve: perform all premerges before performing any file merges (BC)...
r26621 for f in tocomplete:
try:
# resolve file
ui.setconfig('ui', 'forcemerge', opts.get('tool', ''),
'resolve')
r = ms.resolve(f, wctx)
if r:
ret = 1
finally:
ui.setconfig('ui', 'forcemerge', '', 'resolve')
ms.commit()
Siddharth Agarwal
resolve: restore .orig only after merge is fully complete (issue4952)...
r26959 # replace filemerge's .orig file with our resolve file
a = repo.wjoin(f)
Siddharth Agarwal
resolve: fix incorrect merge...
r27025 try:
Siddharth Agarwal
origpath: move from cmdutil to scmutil...
r27651 util.rename(a + ".resolve", scmutil.origpath(ui, repo, a))
Siddharth Agarwal
resolve: fix incorrect merge...
r27025 except OSError as inst:
if inst.errno != errno.ENOENT:
raise
Siddharth Agarwal
resolve: restore .orig only after merge is fully complete (issue4952)...
r26959
Mads Kiilerich <madski at unity3d.com>
resolve: keep wlock while resolving...
r21709 ms.commit()
Siddharth Agarwal
resolve: record dirstate actions after performing resolutions...
r27089 ms.recordactions()
Matt Mackall
merge with stable
r21720
Yuya Nishihara
resolve: extract -l/--list operation from big loop...
r24126 if not didwork and pats:
timeless
resolve: when pats do not match, hint about path:...
r28402 hint = None
if not any([p for p in pats if p.find(':') >= 0]):
pats = ['path:%s' % p for p in pats]
m = scmutil.match(wctx, pats, opts)
for f in ms:
if not m(f):
continue
flags = ''.join(['-%s ' % o[0] for o in flaglist
if opts.get(o)])
hint = _("(try: hg resolve %s%s)\n") % (
flags,
' '.join(pats))
break
Matt Mackall
resolve: fix grammar of no matching files message
r21721 ui.warn(_("arguments do not match paths that need resolving\n"))
timeless
resolve: when pats do not match, hint about path:...
r28402 if hint:
ui.warn(hint)
Siddharth Agarwal
commands.resolve: conclude merge driver if no unresolved files are left...
r26789 elif ms.mergedriver and ms.mdstate() != 's':
# run conclude step when either a driver-resolved file is requested
# or there are no driver-resolved files
# we can't use 'ret' to determine whether any files are unresolved
# because we might not have tried to resolve some
if ((runconclude or not list(ms.driverresolved()))
and not list(ms.unresolved())):
proceed = mergemod.driverconclude(repo, ms, wctx)
ms.commit()
if not proceed:
return 1
Matt Mackall
merge with stable
r21720
Yuya Nishihara
resolve: extract -l/--list operation from big loop...
r24126 # Nudge users into finishing an unfinished operation
Siddharth Agarwal
commands.resolve: print out warning when only driver-resolved files remain...
r26770 unresolvedf = list(ms.unresolved())
driverresolvedf = list(ms.driverresolved())
if not unresolvedf and not driverresolvedf:
Pierre-Yves David
resolve: add parenthesis around "no more unresolved files" message...
r21947 ui.status(_('(no more unresolved files)\n'))
timeless
resolve: suggest the next action...
r27624 cmdutil.checkafterresolved(repo)
Siddharth Agarwal
commands.resolve: print out warning when only driver-resolved files remain...
r26770 elif not unresolvedf:
ui.status(_('(no more unresolved files -- '
'run "hg resolve --all" to conclude)\n'))
Gregory Szorc
resolve: print message when no unresolved files remain (issue4214)...
r21266
Matt Mackall
commands: initial audit of exit codes...
r11177 return ret
Matt Mackall
resolve: keep .orig files
r7847
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('revert',
[('a', 'all', None, _('revert all changes when no arguments given')),
('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
('r', 'rev', '', _('revert to the specified revision'), _('REV')),
Adrian Buehlmann
revert: introduce short option -C for --no-backup...
r15009 ('C', 'no-backup', None, _('do not save backup copies of files')),
Laurent Charignon
revert: make the interactive mode experimental...
r24873 ('i', 'interactive', None,
_('interactively select the changes (EXPERIMENTAL)')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ] + walkopts + dryrunopts,
_('[OPTION]... [-r REV] [NAME]...'))
Benoit Boissinot
make revert use standard matcher
r1472 def revert(ui, repo, *pats, **opts):
Matt Mackall
revert: rewrite help summary...
r14540 """restore files to their checkout state
Matt Mackall
imported patch rev-help
r5574
Christian Ebert
Use more note admonitions in help texts
r12390 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
Matt Mackall
revert: simplify usage note...
r14541 To check out earlier revisions, you should use :hg:`update REV`.
Matt Mackall
help: fix role/option confusion in RST...
r19217 To cancel an uncommitted merge (and lose your changes),
use :hg:`update --clean .`.
Vadim Gelfer
fix doc comments for revert command. people found them confusing.
r2204
Matt Mackall
revert: rearrange the date help
r14544 With no revision specified, revert the specified files or directories
Matt Mackall
revert: restore check for uncommitted merge (issue2915) (BC)...
r14903 to the contents they had in the parent of the working directory.
Matt Mackall
revert: rearrange the date help
r14544 This restores the contents of files to an unmodified
Matt Mackall
revert: restore check for uncommitted merge (issue2915) (BC)...
r14903 state and unschedules adds, removes, copies, and renames. If the
working directory has two parents, you must explicitly specify a
revision.
Benoit Boissinot
resync commands.py docstrings with hg.1.txt
r1811
Matt Mackall
revert: rearrange the date help
r14544 Using the -r/--rev or -d/--date options, revert the given files or
Adrian Buehlmann
revert: is reverting file states, not just file contents...
r14557 directories to their states as of a specific revision. Because
Matt Mackall
revert: replace mention of 'roll back' with pointer to 'backout'
r14546 revert does not change the working directory parents, this will
cause these files to appear modified. This can be helpful to "back
Matt Mackall
revert: actually add pointer to backout
r14547 out" some or all of an earlier change. See :hg:`backout` for a
related method.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Matt Mackall
imported patch rev-help
r5574 Modified files are saved with a .orig suffix before reverting.
Nathan Goldbaum
revert: mention ui.origbackuppath in the command help
r29061 To disable these backups, use --no-backup. It is possible to store
the backup files in a custom directory relative to the root of the
repository by setting the ``ui.origbackuppath`` configuration
option.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
revert: rearrange the date help
r14544 See :hg:`help dates` for a list of formats valid for -d/--date.
Mathias De Maré
revert: add reference to backout
r26477 See :hg:`help backout` for a way to reverse the effect of an
earlier changeset.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Vadim Gelfer
revert: require --all to revert all files.
r2982
Xavier Snelgrove
revert: use opts.get...
r11941 if opts.get("date"):
if opts.get("rev"):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("you can't specify a revision and a date"))
Matt Mackall
Add --date support to update and revert...
r3814 opts["rev"] = cmdutil.finddate(ui, repo, opts["date"])
timeless
revert: improve merge advice and favor its error over all
r13022 parent, p2 = repo.dirstate.parents()
Matt Mackall
revert: restore check for uncommitted merge (issue2915) (BC)...
r14903 if not opts.get('rev') and p2 != nullid:
# revert after merge is a trap for new users (issue2915)
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('uncommitted merge with no revision specified'),
timeless
debugcreatestreamclonebundle: use single quotes around command hint...
r28961 hint=_("use 'hg update' or see 'hg help revert'"))
Matt Mackall
revert: restore check for uncommitted merge (issue2915) (BC)...
r14903
Adrian Buehlmann
revert: mention update in hint of abort when reverting to non-parent...
r14726 ctx = scmutil.revsingle(repo, opts.get('rev'))
timeless
revert: improve merge advice and favor its error over all
r13022
Martin von Zweigbergk
revert: accept just -I/-X without paths or -a/-i (issue4592)...
r24841 if (not (pats or opts.get('include') or opts.get('exclude') or
opts.get('all') or opts.get('interactive'))):
Adrian Buehlmann
revert: be more helpful on uncommitted merges...
r14721 msg = _("no files or directories specified")
if p2 != nullid:
hint = _("uncommitted merge, use --all to discard all changes,"
" or 'hg update -C .' to abort the merge")
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(msg, hint=hint)
Augie Fackler
cleanup: use __builtins__.any instead of util.any...
r25149 dirty = any(repo.status())
Angel Ezquerra
revert: move bulk of revert command from commands to cmdutil...
r16304 node = ctx.node()
Adrian Buehlmann
revert: improve hints on abort when reverting to parent without --all...
r14755 if node != parent:
if dirty:
Adrian Buehlmann
revert: mention update in hint of abort when reverting to non-parent...
r14726 hint = _("uncommitted changes, use --all to discard all"
" changes, or 'hg update %s' to update") % ctx.rev()
else:
hint = _("use --all to revert all files,"
" or 'hg update %s' to update") % ctx.rev()
Adrian Buehlmann
revert: improve hints on abort when reverting to parent without --all...
r14755 elif dirty:
hint = _("uncommitted changes, use --all to discard all changes")
else:
hint = _("use --all to revert all files")
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(msg, hint=hint)
Vadim Gelfer
revert: require --all to revert all files.
r2982
Angel Ezquerra
revert: move bulk of revert command from commands to cmdutil...
r16304 return cmdutil.revert(ui, repo, ctx, (parent, p2), *pats, **opts)
mpm@selenic.com
[PATCH] hg revert...
r588
Greg Ward
rollback: avoid unsafe rollback when not at tip (issue2998)...
r15183 @command('rollback', dryrunopts +
[('f', 'force', False, _('ignore safety measures'))])
Steve Borho
rollback: add dry-run argument, emit transaction description
r10882 def rollback(ui, repo, **opts):
Matt Mackall
rollback: mark as deprecated
r19409 """roll back the last transaction (DANGEROUS) (DEPRECATED)
Matt Mackall
imported patch rollback-help
r5575
Martin Geisler
rollback: add reference to "hg commit --amend"...
r19421 Please use :hg:`commit --amend` instead of rollback to correct
mistakes in the last commit.
Matt Mackall
imported patch rollback-help
r5575 This command should be used with care. There is only one level of
rollback, and there is no way to undo a rollback. It will also
restore the dirstate at the time of the last transaction, losing
Matt Mackall
rollback: minor clarification (issue828)
r8856 any dirstate changes since that time. This command does not alter
the working directory.
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227
Transactions are used to encapsulate the effects of all commands
that create new changesets or propagate existing changesets into a
Adrian Buehlmann
rollback: split off command example paragraph in help
r17141 repository.
Adrian Buehlmann
rollback: move examples and --force note in help into verbose section...
r17142 .. container:: verbose
For example, the following commands are transactional, and their
effects can be rolled back:
- commit
- import
- pull
- push (with this repository as the destination)
- unbundle
To avoid permanent data loss, rollback will refuse to rollback a
commit transaction if it isn't checked out. Use --force to
override this protection.
Greg Ward
rollback: avoid unsafe rollback when not at tip (issue2998)...
r15183
Augie Fackler
rollback: add a config knob for entirely disabling the command...
r29086 The rollback command can be entirely disabled by setting the
``ui.rollback`` configuration setting to false. If you're here
because you want to use rollback and it's disabled, you can
re-enable the command by setting ``ui.rollback`` to true.
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227 This command is not intended for use on public repositories. Once
changes are visible for pull by other users, rolling a transaction
back locally is ineffective (someone else may already have pulled
the changes). Furthermore, a race is possible with readers of the
repository; for example an in-progress pull from the repository
may fail if a rollback is performed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if no rollback data is available.
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227 """
Augie Fackler
rollback: add a config knob for entirely disabling the command...
r29086 if not ui.configbool('ui', 'rollback', True):
raise error.Abort(_('rollback is disabled because it is unsafe'),
hint=('see `hg help -v rollback` for information'))
Pulkit Goyal
py3: handle opts correctly for rollback...
r32146 return repo.rollback(dryrun=opts.get(r'dry_run'),
force=opts.get(r'force'))
Vadim Gelfer
deprecate undo command, replace with rollback command.
r2227
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('root', [])
mpm@selenic.com
[PATCH] add "root" command...
r468 def root(ui, repo):
Martin Geisler
expand "dir" to "directory" in help texts
r8026 """print the root (top) of the current working directory
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Print the root directory of the current repository.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
mpm@selenic.com
[PATCH] add "root" command...
r468 ui.write(repo.root + "\n")
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^serve',
[('A', 'accesslog', '', _('name of access log file to write to'),
_('FILE')),
('d', 'daemon', None, _('run server in background')),
Jun Wu
serve: accept multiple values for --daemon-postexec...
r28451 ('', 'daemon-postexec', [], _('used internally by daemon mode')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
# use string type, then we can check if something was passed
('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
('a', 'address', '', _('address to listen on (default: all interfaces)'),
_('ADDR')),
('', 'prefix', '', _('prefix path to serve from (default: server root)'),
_('PREFIX')),
('n', 'name', '',
_('name to show in web pages (default: working directory)'), _('NAME')),
('', 'web-conf', '',
timeless
serve: use single quotes in use warning
r29972 _("name of the hgweb config file (see 'hg help hgweb')"), _('FILE')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('', 'webdir-conf', '', _('name of the hgweb config file (DEPRECATED)'),
_('FILE')),
('', 'pid-file', '', _('name of file to write process ID to'), _('FILE')),
Jun Wu
serve: mark --stdio and --cmdserver as "(ADVANCED)" flags...
r31081 ('', 'stdio', None, _('for remote clients (ADVANCED)')),
('', 'cmdserver', '', _('for remote clients (ADVANCED)'), _('MODE')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('t', 'templates', '', _('web templates to use'), _('TEMPLATE')),
('', 'style', '', _('template style to use'), _('STYLE')),
('6', 'ipv6', None, _('use IPv6 in addition to IPv4')),
Matt Harbison
serve: add support for Mercurial subrepositories...
r32005 ('', 'certificate', '', _('SSL certificate file'), _('FILE'))]
+ subrepoopts,
Gregory Szorc
commands: define optionalrepo in command decorator
r21775 _('[OPTION]...'),
optionalrepo=True)
mpm@selenic.com
big heap of command clean-up work...
r245 def serve(ui, repo, **opts):
Matt Mackall
commands: improve some command summaries
r10889 """start stand-alone webserver
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: explain that "hg serve" is mostly for ad-hoc sharing
r11102 Start a local HTTP repository browser and pull server. You can use
Adrian Buehlmann
serve: fix doc typo
r13065 this for ad-hoc sharing and browsing of repositories. It is
Martin Geisler
commands: explain that "hg serve" is mostly for ad-hoc sharing
r11102 recommended to use a real web server to serve a repository for
longer periods of time.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: explain that "hg serve" does not do authentication
r11103 Please note that the server does not implement access control.
This means that, by default, anybody can read from the server and
nobody can write to it by default. Set the ``web.allow_push``
option to ``*`` to allow everybody to push to the server. You
should use a real web server if you need to authenticate users.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 By default, the server logs accesses to stdout and errors to
Martin Geisler
write options in "-r/--rev" style in help texts
r8277 stderr. Use the -A/--accesslog and -E/--errorlog options to log to
files.
Bryan O'Sullivan
serve: allow --port=0 to specify "server chooses the port number"
r10629
To have the server choose a free port number to listen on, specify
a port number of 0; in this case, the server will print the port
number it uses.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
Add an sshrepository class and hg serve --stdio
r624
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Idan Kamara
serve: add --cmdserver option to communicate with hg over a pipe
r14647 if opts["stdio"] and opts["cmdserver"]:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("cannot use --stdio with --cmdserver"))
Idan Kamara
serve: add --cmdserver option to communicate with hg over a pipe
r14647
Yuya Nishihara
serve: inline checkrepo() that is used only when --stdio is specified...
r21818 if opts["stdio"]:
Thomas Arendsen Hein
Allow 'hg serve --webdir-conf foo' to be run outside a repository.
r2127 if repo is None:
Martin Geisler
serve: lowercase "no repo here" message
r16935 raise error.RepoError(_("there is no Mercurial repository here"
Yuya Nishihara
serve: tidy up indent level of repository not found message
r21819 " (.hg not found)"))
Vadim Gelfer
refactor ssh server.
r2396 s = sshserver.sshserver(ui, repo)
s.serve_forever()
Matt Mackall
Give a response to unknown SSH commands
r2363
Yuya Nishihara
server: add public function to select either cmdserver or hgweb
r30510 service = server.createservice(ui, repo, opts)
Yuya Nishihara
server: move cmdutil.service() to new module (API)...
r30506 return server.runservice(opts, initfn=service.init, runfn=service.run)
Mads Kiilerich
commands: refactor 'serve', extract the http service class
r19919
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^status|st',
[('A', 'all', None, _('show status of all files')),
('m', 'modified', None, _('show only modified files')),
('a', 'added', None, _('show only added files')),
('r', 'removed', None, _('show only removed files')),
('d', 'deleted', None, _('show only deleted (but tracked) files')),
('c', 'clean', None, _('show only files without changes')),
('u', 'unknown', None, _('show only unknown (not tracked) files')),
('i', 'ignored', None, _('show only ignored files')),
('n', 'no-status', None, _('hide status prefix')),
('C', 'copies', None, _('show source of copied files')),
('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
('', 'rev', [], _('show difference from revision'), _('REV')),
('', 'change', '', _('list the changed files of a revision'), _('REV')),
Matt Mackall
commands: add hidden -T option for files/manifest/status/tags...
r22429 ] + walkopts + subrepoopts + formatteropts,
Gregory Szorc
commands: define inferrepo in command decorator
r21778 _('[OPTION]... [FILE]...'),
inferrepo=True)
Bryan O'Sullivan
Add name matching to status command.
r731 def status(ui, repo, *pats, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """show changed files in the working directory
mpm@selenic.com
commands: migrate status and branch...
r213
Christian Ebert
Consistently 1 space after full stops in command doc strings...
r6448 Show status of files in the repository. If names are given, only
files that match are shown. Files that are clean or ignored or
timeless
Improve English for help text of many core hg commands....
r8779 the source of a copy/move operation, are not listed unless
-c/--clean, -i/--ignored, -C/--copies or -A/--all are given.
Unless options described with "show only ..." are given, the
options -mardu are used.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Thomas Arendsen Hein
Extend/correct acc40572da5b regarding -qA and ignored files....
r6201 Option -q/--quiet hides untracked (unknown and ignored) files
Wagner Bruna
commands: fix typo on flag description
r8009 unless explicitly requested with -u/--unknown or -i/--ignored.
Zoran Bosnjak
'hg status -q' output skips non-tracked files....
r6200
Christian Ebert
Use more note admonitions in help texts
r12390 .. note::
Simon Heimberg
documentation: add an extra newline after note directive...
r19997
timeless
commands: the first word of each note should be capital or `hg`
r27476 :hg:`status` may appear to disagree with diff if permissions have
Christian Ebert
Use more note admonitions in help texts
r12390 changed or a merge has occurred. The standard diff format does
not report permission changes and diff only reports changes
relative to one merge parent.
Matt Mackall
Add notes about diff/merge asymmetry to export, diff, and log
r3822
Brendan Cully
Add --rev option to status
r3467 If one revision is given, it is used as the base revision.
timeless
Improve English for help text of many core hg commands....
r8779 If two revisions are given, the differences between them are
Gilles Moris
status: add the --change option to display files changed in a revision...
r10014 shown. The --change option can also be used as a shortcut to list
the changed files of a revision from its first parent.
Brendan Cully
Add --rev option to status
r3467
Martin Geisler
commands: use minirst parser when displaying help
r9157 The codes used to show the status of files are::
M = modified
A = added
R = removed
C = clean
! = missing (deleted by non-hg command, but still tracked)
? = not tracked
I = ignored
Matt Mackall
status: improve explanation of ' ' status...
r20660 = origin of the previous file (with --copies)
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
status: add some help examples
r15119 .. container:: verbose
Examples:
Martin Geisler
status: add missing ":" to help text
r15633 - show changes in the working directory relative to a
changeset::
Matt Mackall
status: add some help examples
r15119
hg status --rev 9353
Yung-Jin (Joey) Hu
status: add relative directory help text (issue3835)...
r24456 - show changes in the working directory relative to the
current directory (see :hg:`help patterns` for more information)::
hg status re:
Matt Mackall
status: add some help examples
r15119 - show all changes including copies in an existing changeset::
hg status --copies --change 9353
- get a NUL separated list of added files, suitable for xargs::
hg status -an0
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
mpm@selenic.com
Optimize diff and status in subdirectories...
r312
Pulkit Goyal
py3: convert opts back to bytes for status
r31427 opts = pycompat.byteskwargs(opts)
Gilles Moris
status: add the --change option to display files changed in a revision...
r10014 revs = opts.get('rev')
change = opts.get('change')
if revs and change:
msg = _('cannot specify --rev and --change at the same time')
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(msg)
Gilles Moris
status: add the --change option to display files changed in a revision...
r10014 elif change:
Patrick Mezard
status: support revsets with --change
r15578 node2 = scmutil.revsingle(repo, change, None).node()
Matt Mackall
misc: replace .parents()[0] with p1()
r13878 node1 = repo[node2].p1().node()
Gilles Moris
status: add the --change option to display files changed in a revision...
r10014 else:
Matt Mackall
scmutil: move revsingle/pair/range from cmdutil...
r14319 node1, node2 = scmutil.revpair(repo, revs)
Gilles Moris
status: add the --change option to display files changed in a revision...
r10014
Martin von Zweigbergk
status: support commands.status.relative config...
r31589 if pats or ui.configbool('commands', 'status.relative'):
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 cwd = repo.getcwd()
else:
cwd = ''
if opts.get('print0'):
end = '\0'
else:
end = '\n'
Matt Mackall
status: find copies and renames beyond the working directory
r6276 copy = {}
Matt Mackall
status: refactor status command...
r6605 states = 'modified added removed deleted unknown ignored clean'.split()
Alexander Solovyov
status: make options optional (issue1481)
r7684 show = [k for k in states if opts.get(k)]
Alexander Solovyov
commands: optional options where possible...
r7131 if opts.get('all'):
Matt Mackall
status: refactor status command...
r6605 show += ui.quiet and (states[:4] + ['clean']) or states
if not show:
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 if ui.quiet:
show = states[:4]
else:
show = states[:5]
Matt Mackall
status: refactor status command...
r6605
Martin von Zweigbergk
status: pass matcher to pathcopies()...
r24819 m = scmutil.match(repo[node2], pats, opts)
stat = repo.status(node1, node2, m,
Martin Geisler
status: recurse into subrepositories with --subrepos/-S flag
r12166 'ignored' in show, 'clean' in show, 'unknown' in show,
opts.get('subrepos'))
Pulkit Goyal
py3: make sure using bytes status char rather than ascii values...
r31463 changestates = zip(states, pycompat.iterbytestr('MAR!?IC'), stat)
Matt Mackall
status: refactor status command...
r6605
Mathias De Maré
commands: add ui.statuscopies config knob...
r24663 if (opts.get('all') or opts.get('copies')
or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'):
Martin von Zweigbergk
status: pass matcher to pathcopies()...
r24819 copy = copies.pathcopies(repo[node1], repo[node2], m)
Matt Mackall
status: find copies and renames beyond the working directory
r6276
Augie Fackler
status: enable pager
r31044 ui.pager('status')
Matt Mackall
formatter: convert status command
r16136 fm = ui.formatter('status', opts)
Matt Mackall
status: use condwrite to avoid zero-width format string hack
r17910 fmt = '%s' + end
showchar = not opts.get('no_status')
Matt Mackall
formatter: convert status command
r16136
Matt Mackall
status: refactor status command...
r6605 for state, char, files in changestates:
if state in show:
Matt Mackall
formatter: convert status command
r16136 label = 'status.' + state
Matt Mackall
status: refactor status command...
r6605 for f in files:
Matt Mackall
formatter: convert status command
r16136 fm.startitem()
Matt Mackall
status: use condwrite to avoid zero-width format string hack
r17910 fm.condwrite(showchar, 'status', '%s ', char, label=label)
fm.write('path', fmt, repo.pathto(f, cwd), label=label)
Matt Mackall
status: refactor status command...
r6605 if f in copy:
Matt Mackall
formatter: convert status command
r16136 fm.write("copy", ' %s' + end, repo.pathto(copy[f], cwd),
Brodie Rao
status: make use of output labeling
r10817 label='status.copied')
Matt Mackall
formatter: convert status command
r16136 fm.end()
mpm@selenic.com
commands: migrate status and branch...
r213
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^summary|sum',
[('', 'remote', None, _('check for push and pull'))], '[--remote]')
Matt Mackall
summary: add --remote
r9620 def summary(ui, repo, **opts):
Matt Mackall
Introduce summary command
r9603 """summarize working directory state
This generates a brief summary of the working directory state,
Gilles Moris
summary: add a phase line (draft, secret) to the output...
r25111 including parents, branch, commit status, phase and available updates.
Matt Mackall
summary: add --remote
r9620
With the --remote option, this will check the default paths for
incoming and outgoing changes. This can be time-consuming.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Matt Mackall
Introduce summary command
r9603 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Augie Fackler
summary: enable pager
r31045 ui.pager('summary')
Matt Mackall
Introduce summary command
r9603 ctx = repo[None]
parents = ctx.parents()
pnode = parents[0].node()
Augie Fackler
summary: show bookmarks separate from tags and note active mark (issue2892)
r14906 marks = []
Matt Mackall
Introduce summary command
r9603
timeless
summary: move mergemod before parents to give access to ms
r28641 ms = None
try:
ms = mergemod.mergestate.read(repo)
except error.UnsupportedMergeRecords as e:
s = ' '.join(e.recordtypes)
ui.warn(
_('warning: merge state has unsupported record types: %s\n') % s)
unresolved = 0
else:
unresolved = [f for f in ms if ms[f] == 'u']
Matt Mackall
Introduce summary command
r9603 for p in parents:
Eric Eisner
summary: make use of output labeling...
r10832 # label with log.changeset (instead of log.parent) since this
# shows a working directory parent *changeset*:
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Augie Fackler
summary: don't explicitly str() something we're about to %s...
r31345 ui.write(_('parent: %d:%s ') % (p.rev(), p),
Denis Laxalde
summary: use the same labels as log command in "parent: " line...
r30714 label=cmdutil._changesetlabels(p))
Martin Geisler
commands: retrieve tags from context object
r10833 ui.write(' '.join(p.tags()), label='log.tag')
David Soria Parra
summary: add bookmarks to summary
r13454 if p.bookmarks():
Augie Fackler
summary: show bookmarks separate from tags and note active mark (issue2892)
r14906 marks.extend(p.bookmarks())
Matt Mackall
summary: add empty repository and no revision checked out hints
r9618 if p.rev() == -1:
if not len(repo):
Martin Geisler
commands: small refactoring in summary
r10834 ui.write(_(' (empty repository)'))
Matt Mackall
summary: add empty repository and no revision checked out hints
r9618 else:
Martin Geisler
commands: small refactoring in summary
r10834 ui.write(_(' (no revision checked out)'))
Denis Laxalde
summary: display obsolete state of parents...
r31703 if p.obsolete():
ui.write(_(' (obsolete)'))
Denis Laxalde
summary: add evolution "troubles" information to summary output...
r30715 if p.troubled():
Denis Laxalde
summary: use ui.label and join to write evolution troubles...
r30721 ui.write(' ('
+ ', '.join(ui.label(trouble, 'trouble.%s' % trouble)
for trouble in p.troubles())
+ ')')
Eric Eisner
summary: make use of output labeling...
r10832 ui.write('\n')
Matt Mackall
summary: add empty repository and no revision checked out hints
r9618 if p.description():
Eric Eisner
summary: make use of output labeling...
r10832 ui.status(' ' + p.description().splitlines()[0].strip() + '\n',
label='log.summary')
Matt Mackall
Introduce summary command
r9603
branch = ctx.branch()
bheads = repo.branchheads(branch)
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Matt Mackall
summary: note non-default branches with -q
r9873 m = _('branch: %s\n') % branch
if branch != 'default':
Eric Eisner
summary: make use of output labeling...
r10832 ui.write(m, label='log.branch')
Matt Mackall
summary: note non-default branches with -q
r9873 else:
Eric Eisner
summary: make use of output labeling...
r10832 ui.status(m, label='log.branch')
Matt Mackall
Introduce summary command
r9603
Augie Fackler
summary: show bookmarks separate from tags and note active mark (issue2892)
r14906 if marks:
Ryan McElroy
commands: rename current to active in variables and comments...
r25349 active = repo._activebookmark
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Augie Fackler
summary: allow color to highlight active bookmark
r14907 ui.write(_('bookmarks:'), label='log.bookmark')
Ryan McElroy
commands: rename current to active in variables and comments...
r25349 if active is not None:
if active in marks:
ui.write(' *' + active, label=activebookmarklabel)
marks.remove(active)
Kevin Bullock
summary: show active bookmark even if not at current changeset...
r18622 else:
Ryan McElroy
commands: rename current to active in variables and comments...
r25349 ui.write(' [%s]' % active, label=activebookmarklabel)
Augie Fackler
summary: allow color to highlight active bookmark
r14907 for m in marks:
Mads Kiilerich
check-code: indent 4 spaces in py files
r17299 ui.write(' ' + m, label='log.bookmark')
Augie Fackler
summary: allow color to highlight active bookmark
r14907 ui.write('\n', label='log.bookmark')
Augie Fackler
summary: show bookmarks separate from tags and note active mark (issue2892)
r14906
Martin von Zweigbergk
summary: make status code more readable...
r22926 status = repo.status(unknown=True)
Matt Mackall
summary: add subrepo status
r11088
Matt Mackall
summary: report copies and renames
r11331 c = repo.dirstate.copies()
copied, renamed = [], []
for d, s in c.iteritems():
Martin von Zweigbergk
summary: make status code more readable...
r22926 if s in status.removed:
status.removed.remove(s)
Matt Mackall
summary: report copies and renames
r11331 renamed.append(d)
else:
copied.append(d)
Martin von Zweigbergk
summary: make status code more readable...
r22926 if d in status.added:
status.added.remove(d)
Matt Mackall
summary: report copies and renames
r11331
Matt Mackall
summary: add subrepo status
r11088 subs = [s for s in ctx.substate if ctx.sub(s).dirty()]
Martin von Zweigbergk
summary: make status code more readable...
r22926
labels = [(ui.label(_('%d modified'), 'status.modified'), status.modified),
(ui.label(_('%d added'), 'status.added'), status.added),
(ui.label(_('%d removed'), 'status.removed'), status.removed),
(ui.label(_('%d renamed'), 'status.copied'), renamed),
(ui.label(_('%d copied'), 'status.copied'), copied),
(ui.label(_('%d deleted'), 'status.deleted'), status.deleted),
(ui.label(_('%d unknown'), 'status.unknown'), status.unknown),
(ui.label(_('%d unresolved'), 'resolve.unresolved'), unresolved),
(ui.label(_('%d subrepos'), 'status.modified'), subs)]
Matt Mackall
Introduce summary command
r9603 t = []
Martin von Zweigbergk
summary: make status code more readable...
r22926 for l, s in labels:
Martin Geisler
commands: do not split a translated string...
r9607 if s:
t.append(l % len(s))
Matt Mackall
Introduce summary command
r9603
t = ', '.join(t)
FUJIWARA Katsunori
summary: L10N messages hide clean-ness of workdir from 'hg summary'...
r10269 cleanworkdir = False
Matt Mackall
Introduce summary command
r9603
timeless
summary: mention graft
r27172 if repo.vfs.exists('graftstate'):
t += _(' (graft in progress)')
Matt Mackall
update: add tracking of interrupted updates (issue3113)...
r19482 if repo.vfs.exists('updatestate'):
t += _(' (interrupted update)')
elif len(parents) > 1:
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (merge)')
Matt Mackall
Introduce summary command
r9603 elif branch != parents[0].branch():
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (new branch)')
Brodie Rao
context: add changectx.closesbranch() method...
r16720 elif (parents[0].closesbranch() and
Gilles Moris
summary: show if commit will be from a closed head
r11165 pnode in repo.branchheads(branch, closed=True)):
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (head closed)')
Martin von Zweigbergk
summary: make status code more readable...
r22926 elif not (status.modified or status.added or status.removed or renamed or
copied or subs):
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (clean)')
FUJIWARA Katsunori
summary: L10N messages hide clean-ness of workdir from 'hg summary'...
r10269 cleanworkdir = True
Matt Mackall
Introduce summary command
r9603 elif pnode not in bheads:
Steve Borho
Backed out changeset: e1dde7363601
r11310 t += _(' (new branch head)')
Matt Mackall
Introduce summary command
r9603
Gilles Moris
summary: move the parents phase marker to commit line (issue4688)...
r25382 if parents:
pendingphase = max(p.phase() for p in parents)
else:
pendingphase = phases.public
if pendingphase > phases.newcommitphase(ui):
t += ' (%s)' % phases.phasenames[pendingphase]
FUJIWARA Katsunori
summary: L10N messages hide clean-ness of workdir from 'hg summary'...
r10269 if cleanworkdir:
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Steve Borho
Backed out changeset: e1dde7363601
r11310 ui.status(_('commit: %s\n') % t.strip())
Matt Mackall
summary: quieter with -q
r9605 else:
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Steve Borho
Backed out changeset: e1dde7363601
r11310 ui.write(_('commit: %s\n') % t.strip())
Matt Mackall
Introduce summary command
r9603
# all ancestors of branch heads - all ancestors of parent = new csets
Mads Kiilerich
cleanup: fix some list comprehension redefinitions of existing vars...
r22201 new = len(repo.changelog.findmissing([pctx.node() for pctx in parents],
Siddharth Agarwal
summary: use missing ancestors algorithm to find new commits...
r19394 bheads))
Matt Mackall
Introduce summary command
r9603
if new == 0:
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Matt Mackall
summary: quieter with -q
r9605 ui.status(_('update: (current)\n'))
Matt Mackall
Introduce summary command
r9603 elif pnode not in bheads:
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Matt Mackall
Introduce summary command
r9603 ui.write(_('update: %d new changesets (update)\n') % new)
else:
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Matt Mackall
Introduce summary command
r9603 ui.write(_('update: %d new changesets, %d branch heads (merge)\n') %
(new, len(bheads)))
Gilles Moris
summary: add a phase line (draft, secret) to the output...
r25111 t = []
draft = len(repo.revs('draft()'))
if draft:
t.append(_('%d draft') % draft)
secret = len(repo.revs('secret()'))
if secret:
t.append(_('%d secret') % secret)
if draft or secret:
Gilles Moris
summary: move the parents phase marker to commit line (issue4688)...
r25382 ui.status(_('phases: %s\n') % ', '.join(t))
Gilles Moris
summary: add a phase line (draft, secret) to the output...
r25111
Laurent Charignon
summary: add troubles list to the output of hg summary...
r27385 if obsolete.isenabled(repo, obsolete.createmarkersopt):
for trouble in ("unstable", "divergent", "bumped"):
numtrouble = len(repo.revs(trouble + "()"))
# We write all the possibilities to ease translation
troublemsg = {
Matt Harbison
summary: print unstable, bumped and divergent as unconditionally plural...
r27722 "unstable": _("unstable: %d changesets"),
"divergent": _("divergent: %d changesets"),
"bumped": _("bumped: %d changesets"),
Laurent Charignon
summary: add troubles list to the output of hg summary...
r27385 }
if numtrouble > 0:
ui.status(troublemsg[trouble] % numtrouble + "\n")
Bryan O'Sullivan
summary: augment output with info from extensions
r19211 cmdutil.summaryhooks(ui, repo)
Matt Mackall
summary: add --remote
r9620 if opts.get('remote'):
FUJIWARA Katsunori
summary: separate checking incoming/outgoing and showing remote summary...
r21045 needsincoming, needsoutgoing = True, True
else:
needsincoming, needsoutgoing = False, False
FUJIWARA Katsunori
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check...
r21047 for i, o in cmdutil.summaryremotehooks(ui, repo, opts, None):
if i:
needsincoming = True
if o:
needsoutgoing = True
if not needsincoming and not needsoutgoing:
return
FUJIWARA Katsunori
summary: separate checking incoming/outgoing and showing remote summary...
r21045
def getincoming():
Sune Foldager
fix remaining hg.parseurl uses
r10389 source, branches = hg.parseurl(ui.expandpath('default'))
FUJIWARA Katsunori
summary: clear "commonincoming" also if branches are different...
r18997 sbranch = branches[0]
FUJIWARA Katsunori
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check...
r21047 try:
other = hg.peer(repo, {}, source)
except error.RepoError:
if opts.get('remote'):
raise
return source, sbranch, None, None, None
Simon Heimberg
summary: remove passing of rev because summary does not have this...
r19379 revs, checkout = hg.addbranchrevs(repo, other, branches, None)
FUJIWARA Katsunori
summary: make "incoming" information sensitive to branch in URL (issue3830)...
r18996 if revs:
revs = [other.lookup(rev) for rev in revs]
Brodie Rao
url: move URL parsing functions into util to improve startup time...
r14076 ui.debug('comparing with %s\n' % util.hidepassword(source))
Matt Mackall
summary: add --remote
r9620 repo.ui.pushbuffer()
FUJIWARA Katsunori
summary: make "incoming" information sensitive to branch in URL (issue3830)...
r18996 commoninc = discovery.findcommonincoming(repo, other, heads=revs)
Matt Mackall
summary: add --remote
r9620 repo.ui.popbuffer()
FUJIWARA Katsunori
summary: separate checking incoming/outgoing and showing remote summary...
r21045 return source, sbranch, other, commoninc, commoninc[1]
if needsincoming:
source, sbranch, sother, commoninc, incoming = getincoming()
else:
source = sbranch = sother = commoninc = incoming = None
def getoutgoing():
Sune Foldager
fix remaining hg.parseurl uses
r10389 dest, branches = hg.parseurl(ui.expandpath('default-push', 'default'))
FUJIWARA Katsunori
summary: clear "commonincoming" also if branches are different...
r18997 dbranch = branches[0]
Sune Foldager
fix remaining hg.parseurl uses
r10389 revs, checkout = hg.addbranchrevs(repo, repo, branches, None)
Peter Arrenbrecht
summary: run discovery only once for in/out against same repo...
r14214 if source != dest:
FUJIWARA Katsunori
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check...
r21047 try:
dother = hg.peer(repo, {}, dest)
except error.RepoError:
if opts.get('remote'):
raise
return dest, dbranch, None, None
FUJIWARA Katsunori
summary: clear "commonincoming" also if branches are different...
r18997 ui.debug('comparing with %s\n' % util.hidepassword(dest))
FUJIWARA Katsunori
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check...
r21047 elif sother is None:
# there is no explicit destination peer, but source one is invalid
return dest, dbranch, None, None
FUJIWARA Katsunori
summary: separate checking incoming/outgoing and showing remote summary...
r21045 else:
dother = sother
FUJIWARA Katsunori
summary: clear "commonincoming" also if branches are different...
r18997 if (source != dest or (sbranch is not None and sbranch != dbranch)):
FUJIWARA Katsunori
summary: separate checking incoming/outgoing and showing remote summary...
r21045 common = None
else:
common = commoninc
FUJIWARA Katsunori
summary: make "outgoing" information sensitive to branch in URL (issue3829)...
r18994 if revs:
revs = [repo.lookup(rev) for rev in revs]
Matt Mackall
summary: add --remote
r9620 repo.ui.pushbuffer()
FUJIWARA Katsunori
summary: separate checking incoming/outgoing and showing remote summary...
r21045 outgoing = discovery.findcommonoutgoing(repo, dother, onlyheads=revs,
commoninc=common)
Matt Mackall
summary: add --remote
r9620 repo.ui.popbuffer()
FUJIWARA Katsunori
summary: separate checking incoming/outgoing and showing remote summary...
r21045 return dest, dbranch, dother, outgoing
if needsoutgoing:
dest, dbranch, dother, outgoing = getoutgoing()
else:
dest = dbranch = dother = outgoing = None
if opts.get('remote'):
t = []
if incoming:
t.append(_('1 or more incoming'))
Pierre-Yves David
discovery: introduce outgoing object for result of findcommonoutgoing...
r15837 o = outgoing.missing
Matt Mackall
summary: add --remote
r9620 if o:
t.append(_('%d outgoing') % len(o))
FUJIWARA Katsunori
summary: separate checking incoming/outgoing and showing remote summary...
r21045 other = dother or sother
David Soria Parra
summary: add bookmarks to summary
r13454 if 'bookmarks' in other.listkeys('namespaces'):
FUJIWARA Katsunori
bookmarks: rewrite comparing bookmarks in commands.summary() by compare()...
r24400 counts = bookmarks.summary(repo, other)
if counts[0] > 0:
t.append(_('%d incoming bookmarks') % counts[0])
if counts[1] > 0:
t.append(_('%d outgoing bookmarks') % counts[1])
Matt Mackall
summary: add --remote
r9620
if t:
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Matt Mackall
summary: add --remote
r9620 ui.write(_('remote: %s\n') % (', '.join(t)))
else:
FUJIWARA Katsunori
i18n: add "i18n" comment to column positioning messages of "hg summary"...
r17892 # i18n: column positioning for "hg summary"
Matt Mackall
summary: add --remote
r9620 ui.status(_('remote: (synced)\n'))
FUJIWARA Katsunori
summary: introduce "summaryremotehooks" to avoid redundant incoming/outgoing check...
r21047 cmdutil.summaryremotehooks(ui, repo, opts,
((source, sbranch, sother, commoninc),
(dest, dbranch, dother, outgoing)))
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('tag',
[('f', 'force', None, _('force tag')),
('l', 'local', None, _('make the tag local')),
('r', 'rev', '', _('revision to tag'), _('REV')),
('', 'remove', None, _('remove a tag')),
# -l/--local is already there, commitopts cannot be used
FUJIWARA Katsunori
doc: unify help text for "--edit" option...
r21952 ('e', 'edit', None, _('invoke editor on commit messages')),
FUJIWARA Katsunori
doc: unify help text for "--message" option...
r21951 ('m', 'message', '', _('use text as commit message'), _('TEXT')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ] + commitopts2,
_('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...'))
John Coomes
tag: allow multiple tags to be added or removed...
r6321 def tag(ui, repo, name1, *names, **opts):
"""add one or more tags for the current or given revision
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Name a particular revision using <name>.
Tags are used to name particular revisions of the repository and are
Thomas Arendsen Hein
Fixed typo in tag help, found by John Coomes
r6220 very useful to compare different revisions, to go back to significant
Kevin Bullock
tag: abort if not at a branch head (issue2552)...
r13135 earlier versions or to mark branch points as releases, etc. Changing
an existing tag is normally disallowed; use -f/--force to override.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 If no revision is given, the parent of the working directory is
Matt Mackall
tag: remove incorrect reference to tip
r19402 used.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
To facilitate version control, distribution, and merging of tags,
Kevin Bullock
tag: abort if not at a branch head (issue2552)...
r13135 they are stored as a file named ".hgtags" which is managed similarly
to other project files and can be hand-edited if necessary. This
also means that tagging creates a new commit. The file
".hg/localtags" is used for local tags (not shared among
repositories).
Tag commits are usually made at the head of a branch. If the parent
of the working directory is not a branch head, :hg:`tag` aborts; use
-f/--force to force the tag commit to be based on a non-head
changeset.
Thomas Arendsen Hein
Document log date ranges and mention 'hg help dates' for all commands (issue998)
r6163
Martin Geisler
Use hg role in help strings
r10973 See :hg:`help dates` for a list of formats valid for -d/--date.
Nicolas Dumazet
tag: warn users about tag/branch possible name conflicts...
r11063
Since tag names have priority over branch names during revision
lookup, using an existing branch name as a tag name is discouraged.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Mads Kiilerich
tag: lock before tagging
r15877 wlock = lock = None
try:
wlock = repo.wlock()
lock = repo.lock()
rev_ = "."
names = [t.strip() for t in (name1,) + names]
if len(names) != len(set(names)):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('tag names must be unique'))
John Coomes
tag: allow multiple tags to be added or removed...
r6321 for n in names:
Kevin Bullock
scmutil: add bad character checking to checknewlabel...
r17821 scmutil.checknewlabel(repo, n, 'tag')
Mads Kiilerich
tag: lock before tagging
r15877 if not n:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('tag names cannot consist entirely of '
Mads Kiilerich
tag: lock before tagging
r15877 'whitespace'))
if opts.get('rev') and opts.get('remove'):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("--rev and --remove are incompatible"))
Mads Kiilerich
tag: lock before tagging
r15877 if opts.get('rev'):
rev_ = opts['rev']
message = opts.get('message')
if opts.get('remove'):
Jordi Gutiérrez Hermoso
style: kill ersatz if-else ternary operators...
r24306 if opts.get('local'):
expectedtype = 'local'
else:
expectedtype = 'global'
Mads Kiilerich
tag: lock before tagging
r15877 for n in names:
if not repo.tagtype(n):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("tag '%s' does not exist") % n)
Mads Kiilerich
tag: lock before tagging
r15877 if repo.tagtype(n) != expectedtype:
if expectedtype == 'global':
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("tag '%s' is not a global tag") % n)
Mads Kiilerich
tag: lock before tagging
r15877 else:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("tag '%s' is not a local tag") % n)
Yuya Nishihara
tag: do not pass binary nullid to scmutil.revsingle()...
r25903 rev_ = 'null'
Mads Kiilerich
tag: lock before tagging
r15877 if not message:
# we don't translate commit messages
message = 'Removed tag %s' % ', '.join(names)
elif not opts.get('force'):
for n in names:
if n in repo.tags():
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("tag '%s' already exists "
Mads Kiilerich
tag: lock before tagging
r15877 "(use -f to force)") % n)
if not opts.get('local'):
p1, p2 = repo.dirstate.parents()
if p2 != nullid:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('uncommitted merge'))
Mads Kiilerich
tag: lock before tagging
r15877 bheads = repo.branchheads()
if not opts.get('force') and bheads and p1 not in bheads:
Nathan Goldbaum
tag: clarify warning about making a tag on a branch head...
r30247 raise error.Abort(_('working directory is not at a branch head '
'(use -f to force)'))
Mads Kiilerich
tag: lock before tagging
r15877 r = scmutil.revsingle(repo, rev_).node()
Matt Mackall
tags: add --remove
r4213 if not message:
Martin Geisler
do not translate commit messages...
r9183 # we don't translate commit messages
Mads Kiilerich
tag: lock before tagging
r15877 message = ('Added tag %s for changeset %s' %
(', '.join(names), short(r)))
date = opts.get('date')
if date:
date = util.parsedate(date)
FUJIWARA Katsunori
tag: pass 'editform' argument to 'cmdutil.getcommiteditor'...
r22009 if opts.get('remove'):
editform = 'tag.remove'
else:
editform = 'tag.add'
Pulkit Goyal
py3: convert kwargs' keys to str before passing in cmdutil.getcommiteditor
r32192 editor = cmdutil.getcommiteditor(editform=editform,
**pycompat.strkwargs(opts))
Mads Kiilerich
tag: lock before tagging
r15877
Brad Hall
tag: don't allow tagging the null revision (issue1915)...
r17260 # don't allow tagging the null rev
if (not opts.get('remove') and
scmutil.revsingle(repo, rev_).rev() == nullrev):
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("cannot tag null revision"))
Brad Hall
tag: don't allow tagging the null revision (issue1915)...
r17260
Pierre-Yves David
tags: use the 'tag' function from the 'tags' module in the 'tag' command...
r31670 tagsmod.tag(repo, names, r, message, opts.get('local'),
opts.get('user'), date, editor=editor)
Mads Kiilerich
tag: lock before tagging
r15877 finally:
release(lock, wlock)
mpm@selenic.com
From: Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl>...
r401
Matt Mackall
commands: add hidden -T option for files/manifest/status/tags...
r22429 @command('tags', formatteropts, '')
Matt Mackall
tags: add formatter support
r17912 def tags(ui, repo, **opts):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """list repository tags
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 This lists both regular and local tags. When the -v/--verbose
switch is used, a third column "local" is printed for local tags.
Thu Trang Pham
tags: mention --quiet switch in help (issue4920)
r27409 When the -q/--quiet switch is used, only the tag name is printed.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Thomas Arendsen Hein
Handle errors in .hgtags or hgrc [tags] section more gracefully....
r477
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Augie Fackler
tags: enable pager
r31046 ui.pager('tags')
Matt Mackall
tags: add formatter support
r17912 fm = ui.formatter('tags', opts)
Yuya Nishihara
formatter: add general way to switch hex/short functions...
r22701 hexfunc = fm.hexfunc
Osku Salerma
Add --verbose support to tags command.
r5658 tagtype = ""
Matt Mackall
replace various uses of list.reverse()
r8210 for t, n in reversed(repo.tagslist()):
Idan Kamara
tags: no need to check for valid nodes...
r13893 hn = hexfunc(n)
Matt Mackall
tags: add formatter support
r17912 label = 'tags.normal'
tagtype = ''
if repo.tagtype(t) == 'local':
label = 'tags.local'
tagtype = 'local'
fm.startitem()
fm.write('tag', '%s', t, label=label)
fmt = " " * (30 - encoding.colwidth(t)) + ' %5d:%s'
Yuya Nishihara
tags: change field name of formatter output to be the same as log command...
r22553 fm.condwrite(not ui.quiet, 'rev node', fmt,
Matt Mackall
tags: add formatter support
r17912 repo.changelog.rev(n), hn, label=label)
fm.condwrite(ui.verbose and tagtype, 'type', ' %s',
tagtype, label=label)
fm.plain('\n')
fm.end()
mpm@selenic.com
migrate remaining commands...
r248
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('tip',
[('p', 'patch', None, _('show patch')),
('g', 'git', None, _('use git extended diff format')),
] + templateopts,
_('[-p] [-g]'))
Vadim Gelfer
add -p option to tip. for issue 64.
r1731 def tip(ui, repo, **opts):
Matt Mackall
tip: deprecate the tip command
r19403 """show the tip revision (DEPRECATED)
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
timeless
Improve English for help text of many core hg commands....
r8779 The tip revision (usually just called the tip) is the changeset
most recently added to the repository (and therefore the most
recently changed head).
Patrick Mezard
Make tip help more helpful
r6364
Patrick Mezard
Remove unexpected "Alternately" word from tip help.
r6367 If you have just made a commit, that commit will be the tip. If
you have just pulled changes from another repository, the tip of
that repository becomes the current tip. The "tip" tag is special
and cannot be renamed or assigned to a different changeset.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
tip: deprecate the tip command
r19403 This command is deprecated, please use :hg:`heads` instead.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer = cmdutil.show_changeset(ui, repo, opts)
Pierre-Yves David
changectx: fix the handling of `tip`...
r18464 displayer.show(repo['tip'])
Robert Bachmann
Added support for templatevar "footer" to cmdutil.py
r10152 displayer.close()
mpm@selenic.com
big heap of command clean-up work...
r245
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('unbundle',
[('u', 'update', None,
_('update to new branch head if changesets were unbundled'))],
_('[-u] FILE...'))
Giorgos Keramidas
unbundle: accept multiple file arguments...
r4699 def unbundle(ui, repo, fname1, *fnames, **opts):
Gregory Szorc
commands: update help for "unbundle"...
r31795 """apply one or more bundle files
Apply one or more bundle files generated by :hg:`bundle`.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if an update has unresolved files.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Giorgos Keramidas
unbundle: accept multiple file arguments...
r4699 fnames = (fname1,) + fnames
Patrick Mezard
commands: lock() the repo while unbundling (issue1004)
r6180
Bryan O'Sullivan
with: use context manager in unbundle
r27855 with repo.lock():
Patrick Mezard
commands: lock() the repo while unbundling (issue1004)
r6180 for fname in fnames:
Siddharth Agarwal
url: use open and not url.open for local files (issue3624)
r17887 f = hg.openpath(ui, fname)
Pierre-Yves David
bundle2: add a ui argument to readbundle...
r21064 gen = exchange.readbundle(ui, f, fname)
Eric Sumner
unbundle: support bundle2 files...
r23891 if isinstance(gen, bundle2.unbundle20):
tr = repo.transaction('unbundle')
try:
Pierre-Yves David
unbundle: use 'url' argument with applybundle...
r26796 op = bundle2.applybundle(repo, gen, tr, source='unbundle',
url='bundle:' + fname)
Eric Sumner
unbundle: support bundle2 files...
r23891 tr.close()
Pierre-Yves David
unbundle: test and fix for clean abort on unknown bundle2 feature...
r26410 except error.BundleUnknownFeatureError as exc:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_('%s: unknown bundle feature, %s')
Pierre-Yves David
unbundle: gratuitous fix white spacing "issue"...
r26874 % (fname, exc),
hint=_("see https://mercurial-scm.org/"
"wiki/BundleFeature for more "
"information"))
Eric Sumner
unbundle: support bundle2 files...
r23891 finally:
if tr:
tr.release()
Pierre-Yves David
unbundle: properly read head modification result from bundle2...
r26539 changes = [r.get('return', 0)
Eric Sumner
unbundle: support bundle2 files...
r23891 for r in op.records['changegroup']]
modheads = changegroup.combineresults(changes)
Gregory Szorc
commands: support consuming stream clone bundles...
r26758 elif isinstance(gen, streamclone.streamcloneapplier):
raise error.Abort(
_('packed bundles cannot be applied with '
'"hg unbundle"'),
hint=_('use "hg debugapplystreamclonebundle"'))
Eric Sumner
unbundle: support bundle2 files...
r23891 else:
Augie Fackler
commands: use cg?unpacker.apply() instead of changegroup.addchangegroup()
r26699 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname)
Matt Mackall
unbundle: don't advance bookmarks (issue4322) (BC)...
r22091
Pulkit Goyal
py3: handle opts correctly for unbundle...
r32145 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None)
mpm@selenic.com
Add preliminary support for the bundle and unbundle commands
r1218
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('^update|up|checkout|co',
[('C', 'clean', None, _('discard uncommitted changes (no backup)')),
Martin von Zweigbergk
update: correct description of --check option...
r29018 ('c', 'check', None, _('require clean working directory')),
Martin von Zweigbergk
update: accept --merge to allow merging across topo branches (issue5125)
r31166 ('m', 'merge', None, _('merge uncommitted changes')),
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 ('d', 'date', '', _('tipmost revision matching date'), _('DATE')),
Mads Kiilerich
update: introduce --tool for controlling the merge tool...
r21552 ('r', 'rev', '', _('revision'), _('REV'))
] + mergetoolopts,
Martin von Zweigbergk
update: accept --merge to allow merging across topo branches (issue5125)
r31166 _('[-C|-c|-m] [-d DATE] [[-r] REV]'))
Mads Kiilerich
update: introduce --tool for controlling the merge tool...
r21552 def update(ui, repo, node=None, rev=None, clean=False, date=None, check=False,
Martin von Zweigbergk
update: accept --merge to allow merging across topo branches (issue5125)
r31166 merge=None, tool=None):
Matt Mackall
commands: improve some command summaries
r10889 """update working directory (or switch revisions)
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437
Martin Geisler
commands: word-wrap help texts at 70 characters
r8004 Update the repository's working directory to the specified
Kevin Bullock
help: improve description of update --check
r12688 changeset. If no changeset is specified, update to the tip of the
Ryan McElroy
commands: rename current to active in variables and comments...
r25349 current named branch and move the active bookmark (see :hg:`help
Kevin Bullock
update: note ways to avoid moving bookmark
r15957 bookmarks`).
Kevin Bullock
help: improve description of update --check
r12688
Adrian Buehlmann
update: fix typo in help text...
r17343 Update sets the working directory's parent revision to the specified
Adrian Buehlmann
update: move help text about parent revision higher up...
r17143 changeset (see :hg:`help parents`).
Kevin Bullock
update: fix help regarding update to ancestor...
r16877 If the changeset is not a descendant or ancestor of the working
Pulkit Goyal
help: update help for `hg update` which was misleading (issue5427)
r30834 directory's parent and there are uncommitted changes, the update is
aborted. With the -c/--check option, the working directory is checked
for uncommitted changes; if none are found, the working directory is
updated to the specified changeset.
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718
Adrian Buehlmann
update: put rules for uncommitted changes into verbose help section
r17218 .. container:: verbose
Martin von Zweigbergk
update: accept --merge to allow merging across topo branches (issue5125)
r31166 The -C/--clean, -c/--check, and -m/--merge options control what
happens if the working directory contains uncommitted changes.
Martin von Zweigbergk
update: clarify that -C and -c are mutually exclusive...
r30964 At most of one of them can be specified.
1. If no option is specified, and if
Adrian Buehlmann
update: put rules for uncommitted changes into verbose help section
r17218 the requested changeset is an ancestor or descendant of
the working directory's parent, the uncommitted changes
are merged into the requested changeset and the merged
result is left uncommitted. If the requested changeset is
not an ancestor or descendant (that is, it is on another
branch), the update is aborted and the uncommitted changes
are preserved.
Martin von Zweigbergk
update: accept --merge to allow merging across topo branches (issue5125)
r31166 2. With the -m/--merge option, the update is allowed even if the
requested changeset is not an ancestor or descendant of
the working directory's parent.
3. With the -c/--check option, the update is aborted and the
Adrian Buehlmann
update: put rules for uncommitted changes into verbose help section
r17218 uncommitted changes are preserved.
Martin von Zweigbergk
update: accept --merge to allow merging across topo branches (issue5125)
r31166 4. With the -C/--clean option, uncommitted changes are discarded and
Adrian Buehlmann
update: put rules for uncommitted changes into verbose help section
r17218 the working directory is updated to the requested changeset.
Stuart W Marks
help: describe new cross-branch behavior in update help text, plus cleanups
r9718
Adrian Buehlmann
update: mention how update can be used to cancel an uncommitted merge
r17144 To cancel an uncommitted merge (and lose your changes), use
:hg:`update --clean .`.
Martin Geisler
Use hg role in help strings
r10973 Use null as the changeset to remove the working directory (like
:hg:`clone -U`).
Adrian Buehlmann
update: do not use the term 'update' when mentioning reverting one file...
r14729 If you want to revert just one file to an older revision, use
:hg:`revert [-r REV] NAME`.
Martin Geisler
Use hg role in help strings
r10973
See :hg:`help dates` for a list of formats valid for -d/--date.
Matt Mackall
commands: initial audit of exit codes...
r11177
Returns 0 on success, 1 if there are unresolved files.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Daniel Holth
accept -r REV in more places...
r4450 if rev and node:
Pierre-Yves David
error: get Abort from 'error' instead of 'util'...
r26587 raise error.Abort(_("please specify just one revision"))
Daniel Holth
accept -r REV in more places...
r4450
Martin von Zweigbergk
plain: ignore [commands] config...
r31588 if ui.configbool('commands', 'update.requiredest'):
Ryan McElroy
update: add flag to require update destination...
r31557 if not node and not rev and not date:
raise error.Abort(_('you must specify a destination'),
hint=_('for example: hg update ".::"'))
Mark Drago
commands.update() now works properly with a revision of 0...
r13568 if rev is None or rev == '':
Daniel Holth
accept -r REV in more places...
r4450 rev = node
Martin von Zweigbergk
update: check command line before modifying repo...
r28032 if date and rev is not None:
raise error.Abort(_("you can't specify a revision and a date"))
Martin von Zweigbergk
update: accept --merge to allow merging across topo branches (issue5125)
r31166 if len([x for x in (clean, check, merge) if x]) > 1:
raise error.Abort(_("can only specify one of -C/--clean, -c/--check, "
"or -m/merge"))
updatecheck = None
if check:
updatecheck = 'abort'
elif merge:
updatecheck = 'none'
Martin von Zweigbergk
update: check command line before modifying repo...
r28032
Bryan O'Sullivan
with: use context manager in update
r27854 with repo.wlock():
Pierre-Yves David
update: wlock the repo for the whole 'hg update' command...
r26028 cmdutil.clearunfinished(repo)
Pierre-Yves David
bookmark: do not crash when active bookmark is forward and --date is used...
r26286 if date:
rev = cmdutil.finddate(ui, repo, date)
Pierre-Yves David
update: wlock the repo for the whole 'hg update' command...
r26028 # if we defined a bookmark, we have to remember the original name
brev = rev
rev = scmutil.revsingle(repo, rev, rev).rev()
repo.ui.setconfig('ui', 'forcemerge', tool, 'update')
Martin von Zweigbergk
update: accept --merge to allow merging across topo branches (issue5125)
r31166 return hg.updatetotally(ui, repo, rev, brev, clean=clean,
updatecheck=updatecheck)
mpm@selenic.com
unify checkout and resolve into update...
r254
Adrian Buehlmann
commands: use a decorator to build table incrementally...
r14297 @command('verify', [])
mpm@selenic.com
migrate verify...
r247 def verify(ui, repo):
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """verify the integrity of the repository
Verify the integrity of the current repository.
This will perform an extensive check of the repository's
integrity, validating the hashes and checksums of each entry in
the changelog, manifest, and tracked files, as well as the
integrity of their crosslinks and indices.
Matt Mackall
commands: initial audit of exit codes...
r11177
Matt Mackall
urls: bulk-change primary website URLs
r26421 Please see https://mercurial-scm.org/wiki/RepositoryCorruption
FUJIWARA Katsunori
help: add information about recovery from corruption to help of "verify"...
r17717 for more information about recovery from corruption of the
repository.
Matt Mackall
commands: initial audit of exit codes...
r11177 Returns 0 on success, 1 if errors are encountered.
Benoit Boissinot
import docstring from doc/hg.1.txt
r1437 """
Matt Mackall
Move repo.verify
r2778 return hg.verify(repo)
mpm@selenic.com
migrate verify...
r247
Yuya Nishihara
version: add formatter support...
r29840 @command('version', [] + formatteropts, norepo=True)
def version_(ui, **opts):
Matt Mackall
move show_version to version_
r3651 """output version and copyright information"""
Pulkit Goyal
py3: handle opts uniformly in commands.py...
r32142 opts = pycompat.byteskwargs(opts)
Augie Fackler
version: enable pager if --verbose is specified...
r31047 if ui.verbose:
ui.pager('version')
Yuya Nishihara
version: add formatter support...
r29840 fm = ui.formatter("version", opts)
fm.startitem()
fm.write("ver", _("Mercurial Distributed SCM (version %s)\n"),
util.version())
license = _(
Matt Mackall
urls: bulk-change primary website URLs
r26421 "(see https://mercurial-scm.org for more information)\n"
FUJIWARA Katsunori
misc: update year in copyright lines...
r30907 "\nCopyright (C) 2005-2017 Matt Mackall and others\n"
Matt Mackall
move show_version to version_
r3651 "This is free software; see the source for copying conditions. "
"There is NO\nwarranty; "
"not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
Yuya Nishihara
version: add formatter support...
r29840 )
if not ui.quiet:
fm.plain(license)
anatoly techtonik
version: show enabled extensions (issue4209)...
r21848 if ui.verbose:
Yuya Nishihara
version: add formatter support...
r29840 fm.plain(_("\nEnabled extensions:\n\n"))
Yuya Nishihara
version: always build list of extension versions...
r29838 # format names and versions into columns
names = []
vers = []
Yuya Nishihara
version: factor out mapping of internal/external labels...
r29839 isinternals = []
Yuya Nishihara
version: always build list of extension versions...
r29838 for name, module in extensions.extensions():
names.append(name)
Yuya Nishihara
version: add formatter support...
r29840 vers.append(extensions.moduleversion(module) or None)
Yuya Nishihara
version: factor out mapping of internal/external labels...
r29839 isinternals.append(extensions.ismoduleinternal(module))
Yuya Nishihara
version: add formatter support...
r29840 fn = fm.nested("extensions")
Yuya Nishihara
version: always build list of extension versions...
r29838 if names:
Yuya Nishihara
version: add formatter support...
r29840 namefmt = " %%-%ds " % max(len(n) for n in names)
Yuya Nishihara
version: change "place" field of extension to "bundled" flag...
r29885 places = [_("external"), _("internal")]
Yuya Nishihara
version: add formatter support...
r29840 for n, v, p in zip(names, vers, isinternals):
fn.startitem()
fn.condwrite(ui.verbose, "name", namefmt, n)
Yuya Nishihara
version: change "place" field of extension to "bundled" flag...
r29885 if ui.verbose:
fn.plain("%s " % places[p])
fn.data(bundled=p)
Yuya Nishihara
version: add formatter support...
r29840 fn.condwrite(ui.verbose and v, "ver", "%s", v)
Yuya Nishihara
version: always build list of extension versions...
r29838 if ui.verbose:
Yuya Nishihara
version: add formatter support...
r29840 fn.plain("\n")
fn.end()
fm.end()
FUJIWARA Katsunori
dispatch: make loading extra information from extension extensible...
r28391
def loadcmdtable(ui, name, cmdtable):
"""Load command functions from specified cmdtable
"""
overrides = [cmd for cmd in cmdtable if cmd in table]
if overrides:
ui.warn(_("extension '%s' overrides commands: %s\n")
% (name, " ".join(overrides)))
table.update(cmdtable)