Mercurial > hg
changeset 9656:2ae3758526d8
Merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 27 Oct 2009 17:14:19 -0500 |
parents | 6d7d3f849062 (current diff) bd3af545c7c6 (diff) |
children | 96c803e9018f |
files | mercurial/cmdutil.py mercurial/commands.py |
diffstat | 21 files changed, 174 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/mercurial.spec Tue Oct 27 17:01:32 2009 -0500 +++ b/contrib/mercurial.spec Tue Oct 27 17:14:19 2009 -0500 @@ -17,7 +17,7 @@ # python-devel provides an adequate python-dev. The merge tool is a # run-time dependency. # -BuildRequires: python >= 2.4, python-devel, make, gcc, asciidoc, xmlto +BuildRequires: python >= 2.4, python-devel, make, gcc, docutils >= 0.5 Provides: hg = %{version}-%{release} %define pythonver %(python -c 'import sys;print ".".join(map(str, sys.version_info[:2]))')
--- a/contrib/tcsh_completion Tue Oct 27 17:01:32 2009 -0500 +++ b/contrib/tcsh_completion Tue Oct 27 17:14:19 2009 -0500 @@ -2,7 +2,7 @@ # tcsh completion for Mercurial # # This file has been auto-generated by tcsh_completion_build.sh for -# Mercurial Distributed SCM (version 1.1.2) +# Mercurial Distributed SCM (version 1.3.1+269-5d8125bbbbf4) # # Copyright (C) 2005 TK Soh. # @@ -24,7 +24,6 @@ --debugger \ --encoding \ --encodingmode \ - --lsprof \ --traceback \ --time \ --profile \ @@ -33,17 +32,18 @@ 'p/1/(add addremove annotate blame archive \ backout bisect branch branches bundle \ cat clone commit ci copy \ - cp debugancestor debugcheckstate debugcomplete debugdata \ - debugdate debugfsinfo debugindex debugindexdot debuginstall \ - debugrawcommit rawcommit debugrebuildstate debugrename debugsetparents \ - debugstate debugwalk diff export grep \ - heads help identify id import \ - patch incoming in init locate \ - log history manifest merge outgoing \ - out parents paths pull push \ - recover remove rm rename mv \ - resolve revert rollback root serve \ - showconfig debugconfig status st tag \ - tags tip unbundle update up \ - checkout co verify version)/' + cp debugancestor debugcheckstate debugcommands debugcomplete \ + debugdata debugdate debugfsinfo debugindex debugindexdot \ + debuginstall debugrebuildstate debugrename debugsetparents debugstate \ + debugsub debugwalk diff export forget \ + grep heads help identify id \ + import patch incoming in init \ + locate log history manifest merge \ + outgoing out parents paths pull \ + push recover remove rm rename \ + mv resolve revert rollback root \ + serve showconfig debugconfig status st \ + summary sum tag tags tip \ + unbundle update up checkout co \ + verify version)/'
--- a/contrib/win32/mercurial.iss Tue Oct 27 17:01:32 2009 -0500 +++ b/contrib/win32/mercurial.iss Tue Oct 27 17:14:19 2009 -0500 @@ -61,6 +61,7 @@ Source: dist\w9xpopen.exe; DestDir: {app} Source: dist\add_path.exe; DestDir: {app} Source: doc\*.html; DestDir: {app}\Docs +Source: doc\style.css; DestDir: {app}\Docs Source: locale\*.*; DestDir: {app}\locale; Flags: recursesubdirs createallsubdirs Source: templates\*.*; DestDir: {app}\Templates; Flags: recursesubdirs createallsubdirs Source: CONTRIBUTORS; DestDir: {app}; DestName: Contributors.txt
--- a/help/urls.txt Tue Oct 27 17:01:32 2009 -0500 +++ b/help/urls.txt Tue Oct 27 17:14:19 2009 -0500 @@ -47,7 +47,7 @@ ... You can then use the alias for any command that uses a URL (for -example 'hg pull alias1' would pull from the 'alias1' path). +example 'hg pull alias1' will be treated as 'hg pull URL1'). Two path aliases are special because they are used as defaults when you do not provide the URL to a command:
--- a/hgext/bookmarks.py Tue Oct 27 17:01:32 2009 -0500 +++ b/hgext/bookmarks.py Tue Oct 27 17:14:19 2009 -0500 @@ -231,7 +231,7 @@ write(repo, marks) def reposetup(ui, repo): - if not isinstance(repo, localrepo.localrepository): + if not repo.local(): return # init a bookmark cache as otherwise we would get a infinite reading
--- a/hgext/color.py Tue Oct 27 17:01:32 2009 -0500 +++ b/hgext/color.py Tue Oct 27 17:14:19 2009 -0500 @@ -189,9 +189,25 @@ finally: self.ui.write = oldwrite +def colordiffstat(orig, s): + lines = s.split('\n') + for i, line in enumerate(lines): + if line and line[-1] in '+-': + name, graph = line.rsplit(' ', 1) + graph = graph.replace('-', + render_effects('-', _diff_effects['deleted'])) + graph = graph.replace('+', + render_effects('+', _diff_effects['inserted'])) + lines[i] = ' '.join([name, graph]) + orig('\n'.join(lines)) + def colordiff(orig, ui, repo, *pats, **opts): '''run the diff command with colored output''' - oldwrite = extensions.wrapfunction(ui, 'write', colorwrap) + if opts.get('stat'): + wrapper = colordiffstat + else: + wrapper = colorwrap + oldwrite = extensions.wrapfunction(ui, 'write', wrapper) try: orig(ui, repo, *pats, **opts) finally:
--- a/hgext/convert/__init__.py Tue Oct 27 17:01:32 2009 -0500 +++ b/hgext/convert/__init__.py Tue Oct 27 17:14:19 2009 -0500 @@ -103,7 +103,10 @@ revision control system whose parents should be modified (same format as a key in .hg/shamap). The values are the revision IDs (in either the source or destination revision control system) that - should be used as the new parents for that node. + should be used as the new parents for that node. For example, if + you have merged "release-1.0" into "trunk", then you should + specify the revision on "trunk" as the first parent and the one on + the "release-1.0" branch as the second. The branchmap is a file that allows you to rename a branch when it is being brought in from whatever external repository. When used in
--- a/hgext/mq.py Tue Oct 27 17:01:32 2009 -0500 +++ b/hgext/mq.py Tue Oct 27 17:14:19 2009 -0500 @@ -420,11 +420,20 @@ def printdiff(self, repo, node1, node2=None, files=None, fp=None, changes=None, opts={}): + stat = opts.get('stat') + if stat: + opts['unified'] = '0' + m = cmdutil.match(repo, files, opts) chunks = patch.diff(repo, node1, node2, m, changes, self.diffopts()) write = fp is None and repo.ui.write or fp.write - for chunk in chunks: - write(chunk) + if stat: + width = self.ui.interactive() and util.termwidth() or 80 + write(patch.diffstat(util.iterlines(chunks), width=width, + git=self.diffopts().git)) + else: + for chunk in chunks: + write(chunk) def mergeone(self, repo, mergeq, head, patch, rev): # first try just applying the patch
--- a/hgext/patchbomb.py Tue Oct 27 17:01:32 2009 -0500 +++ b/hgext/patchbomb.py Tue Oct 27 17:14:19 2009 -0500 @@ -76,11 +76,11 @@ from mercurial.i18n import _ from mercurial.node import bin -def prompt(ui, prompt, default='', rest=': ', empty_ok=False): +def prompt(ui, prompt, default=None, rest=':'): if not ui.interactive(): - if default or empty_ok: + if default is not None: return default - raise util.Abort(_("%sPlease enter a valid value" % (prompt+rest))) + raise util.Abort(_("%s Please enter a valid value" % (prompt+rest))) if default: prompt += ' [%s]' % default prompt += rest @@ -90,8 +90,6 @@ return r if default is not None: return default - if empty_ok: - return r ui.warn(_('Please enter a valid value.\n')) def cdiffstat(ui, summary, patchlines): @@ -99,7 +97,7 @@ if summary: ui.write(summary, '\n') ui.write(s, '\n') - ans = prompt(ui, _('does the diffstat above look okay? '), 'y') + ans = prompt(ui, _('does the diffstat above look okay?'), 'y') if not ans.lower().startswith('y'): raise util.Abort(_('diffstat rejected')) return s @@ -330,10 +328,11 @@ flag = ' '.join(opts.get('flag')) if flag: - subj = '[PATCH %0*d of %d %s] ' % (tlen, 0, len(patches), flag) + subj = '[PATCH %0*d of %d %s]' % (tlen, 0, len(patches), flag) else: - subj = '[PATCH %0*d of %d] ' % (tlen, 0, len(patches)) - subj += opts.get('subject') or prompt(ui, 'Subject:', rest=subj) + subj = '[PATCH %0*d of %d]' % (tlen, 0, len(patches)) + subj += ' ' + (opts.get('subject') or + prompt(ui, 'Subject: ', rest=subj)) body = '' if opts.get('diffstat'):
--- a/mercurial/bundlerepo.py Tue Oct 27 17:01:32 2009 -0500 +++ b/mercurial/bundlerepo.py Tue Oct 27 17:14:19 2009 -0500 @@ -50,7 +50,7 @@ continue for p in (p1, p2): if not p in self.nodemap: - raise error.LookupError(p1, self.indexfile, + raise error.LookupError(p, self.indexfile, _("unknown parent")) if linkmapper is None: link = n
--- a/mercurial/cmdutil.py Tue Oct 27 17:01:32 2009 -0500 +++ b/mercurial/cmdutil.py Tue Oct 27 17:14:19 2009 -0500 @@ -653,8 +653,6 @@ log = self.repo.changelog date = util.datestr(ctx.date()) - extra = ctx.extra() - branch = extra.get("branch") hexfunc = self.ui.debugflag and hex or short @@ -663,6 +661,7 @@ self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode))) + branch = ctx.branch() # don't show the default branch name if branch != 'default': branch = encoding.tolocal(branch) @@ -691,6 +690,7 @@ copies = ['%s (%s)' % c for c in copies] self.ui.write(_("copies: %s\n") % ' '.join(copies)) + extra = ctx.extra() if extra and self.ui.debugflag: for key, value in sorted(extra.items()): self.ui.write(_("extra: %s=%s\n")
--- a/mercurial/commands.py Tue Oct 27 17:01:32 2009 -0500 +++ b/mercurial/commands.py Tue Oct 27 17:14:19 2009 -0500 @@ -1085,6 +1085,7 @@ revs = opts.get('rev') change = opts.get('change') + stat = opts.get('stat') if revs and change: msg = _('cannot specify --rev and --change at the same time') @@ -1095,10 +1096,19 @@ else: node1, node2 = cmdutil.revpair(repo, revs) + if stat: + opts['unified'] = '0' + diffopts = patch.diffopts(ui, opts) + m = cmdutil.match(repo, pats, opts) - it = patch.diff(repo, node1, node2, match=m, opts=patch.diffopts(ui, opts)) - for chunk in it: - ui.write(chunk) + it = patch.diff(repo, node1, node2, match=m, opts=diffopts) + if stat: + width = ui.interactive() and util.termwidth() or 80 + ui.write(patch.diffstat(util.iterlines(it), width=width, + git=diffopts.git)) + else: + for chunk in it: + ui.write(chunk) def export(ui, repo, *changesets, **opts): """dump the header and diffs for one or more changesets @@ -1604,7 +1614,7 @@ for title, options in option_lists: opt_output.append(("\n%s" % title, None)) for shortopt, longopt, default, desc in options: - if "DEPRECATED" in desc and not ui.verbose: continue + if _("DEPRECATED") in desc and not ui.verbose: continue opt_output.append(("%2s%s" % (shortopt and "-%s" % shortopt, longopt and " --%s" % longopt), "%s%s" % (desc, @@ -1708,7 +1718,8 @@ def import_(ui, repo, patch1, *patches, **opts): """import an ordered set of patches - Import a list of patches and commit them individually. + Import a list of patches and commit them individually (unless + --no-commit is specified). If there are outstanding changes in the working directory, import will abort unless given the -f/--force flag. @@ -2297,6 +2308,8 @@ raise util.Abort(err) modheads = repo.pull(other, heads=revs, force=opts.get('force')) + if checkout: + checkout = str(repo.changelog.rev(other.lookup(checkout))) return postincoming(ui, repo, modheads, opts.get('update'), checkout) def push(ui, repo, dest=None, **opts): @@ -2432,7 +2445,7 @@ def resolve(ui, repo, *pats, **opts): """retry file merges from a merge or update - This command will cleanly retry unresolved file merges using file + This command can cleanly retry unresolved file merges using file revisions preserved from the last update or merge. To attempt to resolve all unresolved files, use the -a/--all switch. @@ -2450,7 +2463,8 @@ R = resolved """ - all, mark, unmark, show = [opts.get(o) for o in 'all mark unmark list'.split()] + all, mark, unmark, show, nostatus = \ + [opts.get(o) for o in 'all mark unmark list no_status'.split()] if (show and (mark or unmark)) or (mark and unmark): raise util.Abort(_("too many options specified")) @@ -2466,7 +2480,10 @@ for f in ms: if m(f): if show: - ui.write("%s %s\n" % (ms[f].upper(), f)) + if nostatus: + ui.write("%s\n" % f) + else: + ui.write("%s %s\n" % (ms[f].upper(), f)) elif mark: ms.mark(f, "r") elif unmark: @@ -3259,7 +3276,8 @@ _('ignore changes in the amount of white space')), ('B', 'ignore-blank-lines', None, _('ignore changes whose lines are all blank')), - ('U', 'unified', '', _('number of lines of context to show')) + ('U', 'unified', '', _('number of lines of context to show')), + ('', 'stat', None, _('output diffstat-style summary of changes')), ] similarityopts = [ @@ -3474,7 +3492,7 @@ ('n', 'newest-first', None, _('show newest record first')), ('', 'bundle', '', _('file to store the bundles into')), ('r', 'rev', [], - _('a specific revision up to which you would like to pull')), + _('a specific remote revision up to which you would like to pull')), ] + logopts + remoteopts, _('[-p] [-n] [-M] [-f] [-r REV]...' ' [--bundle FILENAME] [SOURCE]')), @@ -3542,7 +3560,7 @@ ('f', 'force', None, _('run even when remote repository is unrelated')), ('r', 'rev', [], - _('a specific revision up to which you would like to pull')), + _('a specific remote revision up to which you would like to pull')), ] + remoteopts, _('[-u] [-f] [-r REV]... [-e CMD] [--remotecmd CMD] [SOURCE]')), "^push": @@ -3572,7 +3590,8 @@ [('a', 'all', None, _('remerge all unresolved files')), ('l', 'list', None, _('list state of files needing merge')), ('m', 'mark', None, _('mark files as resolved')), - ('u', 'unmark', None, _('unmark files as resolved'))] + ('u', 'unmark', None, _('unmark files as resolved')), + ('n', 'no-status', None, _('hide status prefix'))] + walkopts, _('[OPTION]... [FILE]...')), "revert":
--- a/mercurial/patch.py Tue Oct 27 17:01:32 2009 -0500 +++ b/mercurial/patch.py Tue Oct 27 17:14:19 2009 -0500 @@ -1364,7 +1364,8 @@ for line in lines: if line.startswith('diff'): if filename: - yield (filename, adds, removes) + isbinary = adds == 0 and removes == 0 + yield (filename, adds, removes, isbinary) # set numbers to 0 anyway when starting new file adds, removes = 0, 0 if line.startswith('diff --git'): @@ -1377,21 +1378,27 @@ elif line.startswith('-') and not line.startswith('---'): removes += 1 if filename: - yield (filename, adds, removes) + isbinary = adds == 0 and removes == 0 + yield (filename, adds, removes, isbinary) -def diffstat(lines, width=80): +def diffstat(lines, width=80, git=False): output = [] stats = list(diffstatdata(lines)) maxtotal, maxname = 0, 0 totaladds, totalremoves = 0, 0 - for filename, adds, removes in stats: + hasbinary = False + for filename, adds, removes, isbinary in stats: totaladds += adds totalremoves += removes maxname = max(maxname, len(filename)) maxtotal = max(maxtotal, adds+removes) + if isbinary: + hasbinary = True countwidth = len(str(maxtotal)) + if hasbinary and countwidth < 3: + countwidth = 3 graphwidth = width - countwidth - maxname - 6 if graphwidth < 10: graphwidth = 10 @@ -1404,11 +1411,15 @@ # if there were at least some changes. return max(i * graphwidth // maxtotal, int(bool(i))) - for filename, adds, removes in stats: + for filename, adds, removes, isbinary in stats: + if git and isbinary: + count = 'Bin' + else: + count = adds + removes pluses = '+' * scale(adds) minuses = '-' * scale(removes) - output.append(' %-*s | %*.d %s%s\n' % (maxname, filename, countwidth, - adds+removes, pluses, minuses)) + output.append(' %-*s | %*s %s%s\n' % (maxname, filename, countwidth, + count, pluses, minuses)) if stats: output.append(_(' %d files changed, %d insertions(+), %d deletions(-)\n')
--- a/tests/test-convert.out Tue Oct 27 17:01:32 2009 -0500 +++ b/tests/test-convert.out Tue Oct 27 17:14:19 2009 -0500 @@ -81,7 +81,10 @@ revision ID in the source revision control system whose parents should be modified (same format as a key in .hg/shamap). The values are the revision IDs (in either the source or destination revision control system) that - should be used as the new parents for that node. + should be used as the new parents for that node. For example, if you have + merged "release-1.0" into "trunk", then you should specify the revision on + "trunk" as the first parent and the one on the "release-1.0" branch as the + second. The branchmap is a file that allows you to rename a branch when it is being brought in from whatever external repository. When used in
--- a/tests/test-debugcomplete.out Tue Oct 27 17:01:32 2009 -0500 +++ b/tests/test-debugcomplete.out Tue Oct 27 17:14:19 2009 -0500 @@ -167,7 +167,7 @@ annotate: rev, follow, text, user, date, number, changeset, line-number, include, exclude clone: noupdate, rev, pull, uncompressed, ssh, remotecmd commit: addremove, close-branch, include, exclude, message, logfile, date, user -diff: rev, change, text, git, nodates, show-function, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, include, exclude +diff: rev, change, text, git, nodates, show-function, ignore-all-space, ignore-space-change, ignore-blank-lines, unified, stat, include, exclude export: output, switch-parent, text, git, nodates forget: include, exclude init: ssh, remotecmd @@ -218,7 +218,7 @@ paths: recover: rename: after, force, include, exclude, dry-run -resolve: all, list, mark, unmark, include, exclude +resolve: all, list, mark, unmark, no-status, include, exclude revert: all, date, rev, no-backup, include, exclude, dry-run rollback: root:
--- a/tests/test-diff-color Tue Oct 27 17:01:32 2009 -0500 +++ b/tests/test-diff-color Tue Oct 27 17:14:19 2009 -0500 @@ -35,6 +35,9 @@ echo '% --unified=2' hg diff --nodates -U 2 --color=always +echo '% diffstat' +hg diff --stat --color=always + echo "record=" >> $HGRCPATH echo "[ui]" >> $HGRCPATH echo "interactive=true" >> $HGRCPATH
--- a/tests/test-diff-color.out Tue Oct 27 17:01:32 2009 -0500 +++ b/tests/test-diff-color.out Tue Oct 27 17:14:19 2009 -0500 @@ -23,6 +23,9 @@ [0;32m+dd[0m a a +% diffstat + a | 2 [0;32m+[0m[0;31m-[0m + 1 files changed, 1 insertions(+), 1 deletions(-) % record [0;1mdiff --git a/a b/a[0m [0;36;1mold mode 100644[0m
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-diffstat Tue Oct 27 17:14:19 2009 -0500 @@ -0,0 +1,34 @@ +#!/bin/sh + +hg init repo +cd repo +i=0; while [ "$i" -lt 213 ]; do echo a >> a; i=$(($i + 1)); done +hg add a + +echo '% wide diffstat' +hg diff --stat + +echo '% diffstat width' +COLUMNS=24 hg diff --config ui.interactive=true --stat + +hg ci -m adda + +cat >> a <<EOF +a +a +a +EOF + +echo '% narrow diffstat' +hg diff --stat + +hg ci -m appenda + +printf '\0' > b +hg add b + +echo '% binary diffstat' +hg diff --stat + +echo '% binary git diffstat' +hg diff --stat --git
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-diffstat.out Tue Oct 27 17:14:19 2009 -0500 @@ -0,0 +1,15 @@ +% wide diffstat + a | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 213 insertions(+), 0 deletions(-) +% diffstat width + a | 213 ++++++++++++++ + 1 files changed, 213 insertions(+), 0 deletions(-) +% narrow diffstat + a | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) +% binary diffstat + b | 0 + 1 files changed, 0 insertions(+), 0 deletions(-) +% binary git diffstat + b | Bin + 1 files changed, 0 insertions(+), 0 deletions(-)
--- a/tests/test-help.out Tue Oct 27 17:01:32 2009 -0500 +++ b/tests/test-help.out Tue Oct 27 17:14:19 2009 -0500 @@ -241,6 +241,7 @@ -b --ignore-space-change ignore changes in the amount of white space -B --ignore-blank-lines ignore changes whose lines are all blank -U --unified number of lines of context to show + --stat output diffstat-style summary of changes -I --include include names matching the given patterns -X --exclude exclude names matching the given patterns
--- a/tests/test-patchbomb.out Tue Oct 27 17:01:32 2009 -0500 +++ b/tests/test-patchbomb.out Tue Oct 27 17:14:19 2009 -0500 @@ -1177,7 +1177,7 @@ +ff2c9fa2018b15fa74b33363bda9527323e2a99f two +ff2c9fa2018b15fa74b33363bda9527323e2a99f two.diff -abort: Subject:[PATCH 0 of 2] Please enter a valid value +abort: Subject: [PATCH 0 of 2] Please enter a valid value This patch series consists of 2 patches. This patch series consists of 2 patches.