--- a/mercurial/commands.py Wed Dec 28 07:13:52 2005 -0800
+++ b/mercurial/commands.py Wed Dec 28 07:22:26 2005 -0800
@@ -463,7 +463,8 @@
opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt,
longopt and " --%s" % longopt),
"%s%s" % (desc,
- default and _(" (default: %s)") % default
+ default
+ and _(" (default: %s)") % default
or "")))
if opt_output:
@@ -730,7 +731,8 @@
revs = None
if opts['rev']:
if not other.local():
- raise util.Abort("clone -r not supported yet for remote repositories.")
+ error = "clone -r not supported yet for remote repositories."
+ raise util.Abort(error)
else:
revs = [other.lookup(rev) for rev in opts['rev']]
repo = hg.repository(ui, dest, create=1)
@@ -985,7 +987,8 @@
ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
errors += 1
if errors:
- raise util.Abort(_(".hg/dirstate inconsistent with current parent's manifest"))
+ error = _(".hg/dirstate inconsistent with current parent's manifest")
+ raise util.Abort(error)
def debugconfig(ui):
"""show combined config settings from all hgrc files"""
@@ -1176,7 +1179,8 @@
revs = list(revrange(ui, repo, changesets))
total = len(revs)
revwidth = max(map(len, revs))
- ui.note(len(revs) > 1 and _("Exporting patches:\n") or _("Exporting patch:\n"))
+ msg = len(revs) > 1 and _("Exporting patches:\n") or _("Exporting patch:\n")
+ ui.note(msg)
for cset in revs:
seqno += 1
doexport(ui, repo, cset, seqno, total, revwidth, opts)
@@ -2019,7 +2023,7 @@
for f in changes:
ui.write(format % f)
-def tag(ui, repo, name, rev=None, **opts):
+def tag(ui, repo, name, rev_=None, **opts):
"""add a tag for the current tip or a given revision
Name a particular revision using <name>.
@@ -2037,10 +2041,10 @@
"""
if name == "tip":
raise util.Abort(_("the name 'tip' is reserved"))
- if 'rev' in opts:
- rev = opts['rev']
- if rev:
- r = hex(repo.lookup(rev))
+ if opts['rev']:
+ rev_ = opts['rev']
+ if rev_:
+ r = hex(repo.lookup(rev_))
else:
r = hex(repo.changelog.tip())
@@ -2095,7 +2099,7 @@
n = repo.changelog.tip()
show_changeset(ui, repo, changenode=n)
-def unbundle(ui, repo, fname):
+def unbundle(ui, repo, fname, **opts):
"""apply a changegroup file
Apply a compressed changegroup file generated by the bundle
@@ -2112,7 +2116,13 @@
yield zd.decompress(chunk)
bzgen = bzgenerator(util.filechunkiter(f, 4096))
- repo.addchangegroup(util.chunkbuffer(bzgen))
+ if repo.addchangegroup(util.chunkbuffer(bzgen)):
+ return 1
+
+ if opts['update']:
+ return update(ui, repo)
+ else:
+ ui.status(_("(run 'hg update' to get a working copy)\n"))
def undo(ui, repo):
"""undo the last commit or pull
@@ -2221,8 +2231,10 @@
[('U', 'noupdate', None, _('do not update the new working directory')),
('e', 'ssh', "", _('specify ssh command to use')),
('', 'pull', None, _('use pull protocol to copy metadata')),
- ('r', 'rev', [], _('a changeset you would like to have after cloning')),
- ('', 'remotecmd', "", _('specify hg command to run on the remote side'))],
+ ('r', 'rev', [],
+ _('a changeset you would like to have after cloning')),
+ ('', 'remotecmd', "",
+ _('specify hg command to run on the remote side'))],
_('hg clone [OPTION]... SOURCE [DEST]')),
"^commit|ci":
(commit,
@@ -2235,10 +2247,14 @@
('u', 'user', "", _('record user as commiter'))],
_('hg commit [OPTION]... [FILE]...')),
"copy|cp": (copy,
- [('I', 'include', [], _('include names matching the given patterns')),
- ('X', 'exclude', [], _('exclude names matching the given patterns')),
- ('A', 'after', None, _('record a copy that has already occurred')),
- ('f', 'force', None, _('forcibly copy over an existing managed file'))],
+ [('I', 'include', [],
+ _('include names matching the given patterns')),
+ ('X', 'exclude', [],
+ _('exclude names matching the given patterns')),
+ ('A', 'after', None,
+ _('record a copy that has already occurred')),
+ ('f', 'force', None,
+ _('forcibly copy over an existing managed file'))],
_('hg copy [OPTION]... [SOURCE]... DEST')),
"debugancestor": (debugancestor, [], _('debugancestor INDEX REV1 REV2')),
"debugcheckstate": (debugcheckstate, [], _('debugcheckstate')),
@@ -2279,7 +2295,8 @@
('X', 'exclude', [], _('exclude names matching the given patterns')),
('', 'all', None, _('print all revisions that match')),
('i', 'ignore-case', None, _('ignore case when matching')),
- ('l', 'files-with-matches', None, _('print only filenames and revs that match')),
+ ('l', 'files-with-matches', None,
+ _('print only filenames and revs that match')),
('n', 'line-number', None, _('print matching line numbers')),
('r', 'rev', [], _('search in given revision range')),
('u', 'user', None, _('print user who committed change'))],
@@ -2293,9 +2310,11 @@
"identify|id": (identify, [], _('hg identify')),
"import|patch":
(import_,
- [('p', 'strip', 1, _('directory strip option for patch. This has the same\n') +
- _('meaning as the corresponding patch option')),
- ('f', 'force', None, _('skip check for outstanding uncommitted changes')),
+ [('p', 'strip', 1,
+ _('directory strip option for patch. This has the same\n') +
+ _('meaning as the corresponding patch option')),
+ ('f', 'force', None,
+ _('skip check for outstanding uncommitted changes')),
('b', 'base', "", _('base path'))],
"hg import [-f] [-p NUM] [-b BASE] PATCH..."),
"incoming|in": (incoming,
@@ -2307,8 +2326,10 @@
"locate":
(locate,
[('r', 'rev', '', _('search the repository as it stood at rev')),
- ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
- ('f', 'fullpath', None, _('print complete paths from the filesystem root')),
+ ('0', 'print0', None,
+ _('end filenames with NUL, for use with xargs')),
+ ('f', 'fullpath', None,
+ _('print complete paths from the filesystem root')),
('I', 'include', [], _('include names matching the given patterns')),
('X', 'exclude', [], _('exclude names matching the given patterns'))],
_('hg locate [OPTION]... [PATTERN]...')),
@@ -2333,16 +2354,19 @@
"paths": (paths, [], _('hg paths [NAME]')),
"^pull":
(pull,
- [('u', 'update', None, _('update the working directory to tip after pull')),
+ [('u', 'update', None,
+ _('update the working directory to tip after pull')),
('e', 'ssh', "", _('specify ssh command to use')),
('r', 'rev', [], _('a specific revision you would like to pull')),
- ('', 'remotecmd', "", _('specify hg command to run on the remote side'))],
+ ('', 'remotecmd', "",
+ _('specify hg command to run on the remote side'))],
_('hg pull [-u] [-e FILE] [-r rev] [--remotecmd FILE] [SOURCE]')),
"^push":
(push,
[('f', 'force', None, _('force push')),
('e', 'ssh', "", _('specify ssh command to use')),
- ('', 'remotecmd', "", _('specify hg command to run on the remote side'))],
+ ('', 'remotecmd', "",
+ _('specify hg command to run on the remote side'))],
_('hg push [-f] [-e FILE] [--remotecmd FILE] [DEST]')),
"rawcommit":
(rawcommit,
@@ -2355,14 +2379,20 @@
_('hg rawcommit [OPTION]... [FILE]...')),
"recover": (recover, [], _("hg recover")),
"^remove|rm": (remove,
- [('I', 'include', [], _('include names matching the given patterns')),
- ('X', 'exclude', [], _('exclude names matching the given patterns'))],
+ [('I', 'include', [],
+ _('include names matching the given patterns')),
+ ('X', 'exclude', [],
+ _('exclude names matching the given patterns'))],
_("hg remove [OPTION]... FILE...")),
"rename|mv": (rename,
- [('I', 'include', [], _('include names matching the given patterns')),
- ('X', 'exclude', [], _('exclude names matching the given patterns')),
- ('A', 'after', None, _('record a rename that has already occurred')),
- ('f', 'force', None, _('forcibly copy over an existing managed file'))],
+ [('I', 'include', [],
+ _('include names matching the given patterns')),
+ ('X', 'exclude', [],
+ _('exclude names matching the given patterns')),
+ ('A', 'after', None,
+ _('record a rename that has already occurred')),
+ ('f', 'force', None,
+ _('forcibly copy over an existing managed file'))],
_('hg rename [OPTION]... [SOURCE]... DEST')),
"^revert":
(revert,
@@ -2377,7 +2407,8 @@
('E', 'errorlog', '', _('name of error log file to write to')),
('p', 'port', 0, _('port to use (default: 8000)')),
('a', 'address', '', _('address to use')),
- ('n', 'name', "", _('name to show in web pages (default: working dir)')),
+ ('n', 'name', "",
+ _('name to show in web pages (default: working dir)')),
('', 'stdio', None, _('for remote clients')),
('t', 'templates', "", _('web templates to use')),
('', 'style', "", _('template style to use')),
@@ -2390,7 +2421,8 @@
('r', 'removed', None, _('show only removed files')),
('u', 'unknown', None, _('show only unknown (not tracked) files')),
('n', 'no-status', None, _('hide status prefix')),
- ('0', 'print0', None, _('end filenames with NUL, for use with xargs')),
+ ('0', 'print0', None,
+ _('end filenames with NUL, for use with xargs')),
('I', 'include', [], _('include names matching the given patterns')),
('X', 'exclude', [], _('exclude names matching the given patterns'))],
_("hg status [OPTION]... [FILE]...")),
@@ -2406,8 +2438,9 @@
"tip": (tip, [], _('hg tip')),
"unbundle":
(unbundle,
- [],
- _('hg unbundle FILE')),
+ [('u', 'update', None,
+ _('update the working directory to tip after unbundle'))],
+ _('hg unbundle [-u] FILE')),
"undo": (undo, [], _('hg undo')),
"^update|up|checkout|co":
(update,
@@ -2423,7 +2456,8 @@
globalopts = [
('R', 'repository', "", _("repository root directory")),
('', 'cwd', '', _("change working directory")),
- ('y', 'noninteractive', None, _("do not prompt, assume 'yes' for any required answers")),
+ ('y', 'noninteractive', None,
+ _("do not prompt, assume 'yes' for any required answers")),
('q', 'quiet', None, _("suppress output")),
('v', 'verbose', None, _("enable additional output")),
('', 'debug', None, _("enable debugging output")),