# HG changeset patch # User Matt Mackall # Date 1259699853 21600 # Node ID ddc899096b7bf1e3ff7843204c1c12e06cbe9cd4 # Parent 2ba40cdaacb2fddd7dda862a9ce0b643ebd62502# Parent 1bf8b870efb44c6620a76749d8dae461388b2c78 Merge with stable diff -r 2ba40cdaacb2 -r ddc899096b7b doc/Makefile --- a/doc/Makefile Tue Dec 01 00:48:25 2009 +0100 +++ b/doc/Makefile Tue Dec 01 14:37:33 2009 -0600 @@ -8,6 +8,8 @@ PYTHON=python RST2HTML=$(shell which rst2html 2> /dev/null || which rst2html.py) +export LC_ALL=C + all: man html man: $(MAN) diff -r 2ba40cdaacb2 -r ddc899096b7b hgext/extdiff.py --- a/hgext/extdiff.py Tue Dec 01 00:48:25 2009 +0100 +++ b/hgext/extdiff.py Tue Dec 01 14:37:33 2009 -0600 @@ -254,7 +254,8 @@ def save(cmd, path, diffopts): '''use closure to save diff command to use''' def mydiff(ui, repo, *pats, **opts): - return dodiff(ui, repo, path, diffopts, pats, opts) + return dodiff(ui, repo, path, diffopts + opts['option'], + pats, opts) doc = _('''\ use %(path)s to diff repository (or selected files) diff -r 2ba40cdaacb2 -r ddc899096b7b hgext/schemes.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgext/schemes.py Tue Dec 01 14:37:33 2009 -0600 @@ -0,0 +1,82 @@ +# Copyright 2009, Alexander Solovyov +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2, incorporated herein by reference. + +"""extend schemes with shortcuts to repository swarms + +This extension allows you to specify shortcuts for parent URLs with a +lot of repositories to act like a scheme, for example:: + + [schemes] + py = http://code.python.org/hg/ + +After that you can use it like:: + + hg clone py://trunk/ + +Additionally there is support for some more complex schemas, for +example used by Google Code:: + + [schemes] + gcode = http://{1}.googlecode.com/hg/ + +The syntax is taken from Mercurial templates, and you have unlimited +number of variables, starting with ``{1}`` and continuing with +``{2}``, ``{3}`` and so on. This variables will receive parts of URL +supplied, split by ``/``. Anything not specified as ``{part}`` will be +just appended to an URL. + +For convenience, the extension adds these schemes by default:: + + [schemes] + py = http://hg.python.org/ + bb = https://bitbucket.org/ + bb+ssh = ssh://hg@bitbucket.org/ + gcode = https://{1}.googlecode.com/hg/ + +You can override a predefined scheme by defining a new scheme with the +same name. +""" + +import re +from mercurial import hg, templater + + +class ShortRepository(object): + def __init__(self, url, scheme, templater): + self.scheme = scheme + self.templater = templater + self.url = url + try: + self.parts = max(map(int, re.findall(r'\{(\d+)\}', self.url))) + except ValueError: + self.parts = 0 + + def __repr__(self): + return '' % self.scheme + + def instance(self, ui, url, create): + url = url.split('://', 1)[1] + parts = url.split('/', self.parts) + if len(parts) > self.parts: + tail = parts[-1] + parts = parts[:-1] + else: + tail = '' + context = dict((str(i), v) for i, v in enumerate(parts)) + url = ''.join(self.templater.process(self.url, context)) + tail + return hg._lookup(url).instance(ui, url, create) + +schemes = { + 'py': 'http://hg.python.org/', + 'bb': 'https://bitbucket.org/', + 'bb+ssh': 'ssh://hg@bitbucket.org/', + 'gcode': 'https://{1}.googlecode.com/hg/' + } + +def extsetup(ui): + schemes.update(dict(ui.configitems('schemes'))) + t = templater.engine(lambda x: x) + for scheme, url in schemes.items(): + hg.schemes[scheme] = ShortRepository(url, scheme, t) diff -r 2ba40cdaacb2 -r ddc899096b7b mercurial/commands.py --- a/mercurial/commands.py Tue Dec 01 00:48:25 2009 +0100 +++ b/mercurial/commands.py Tue Dec 01 14:37:33 2009 -0600 @@ -470,9 +470,9 @@ elif hn not in repo.branchheads(tag, closed=False): if not closed: continue - notice = ' (closed)' + notice = _(' (closed)') else: - notice = ' (inactive)' + notice = _(' (inactive)') rev = str(node).rjust(31 - encoding.colwidth(encodedtag)) data = encodedtag, rev, hexfunc(hn), notice ui.write("%s %s:%s%s\n" % data) @@ -592,9 +592,9 @@ See 'hg help urls' for valid source format details. - It is possible to specify an ssh:// URL as the destination, but no + It is possible to specify an ``ssh://`` URL as the destination, but no .hg/hgrc and working directory will be created on the remote side. - Please see 'hg help urls' for important details about ssh:// URLs. + Please see 'hg help urls' for important details about ``ssh://`` URLs. If the -U/--noupdate option is specified, the new clone will contain only a repository (.hg) and no working copy (the working copy parent @@ -1939,7 +1939,7 @@ If no directory is given, the current directory is used. - It is possible to specify an ssh:// URL as the destination. + It is possible to specify an ``ssh://`` URL as the destination. See 'hg help urls' for more information. """ hg.repository(cmdutil.remoteui(ui, opts), dest, create=1) @@ -2330,7 +2330,7 @@ If -r/--rev is used, the named revision and all its ancestors will be pushed to the remote repository. - Please see 'hg help urls' for important details about ssh:// + Please see 'hg help urls' for important details about ``ssh://`` URLs. If DESTINATION is omitted, a default path will be used. """ dest, revs, checkout = hg.parseurl( @@ -3339,7 +3339,7 @@ ('s', 'skip', False, _('skip testing changeset')), ('c', 'command', '', _('use command to check changeset state')), ('U', 'noupdate', False, _('do not update to target'))], - _("[-gbsr] [-c CMD] [REV]")), + _("[-gbsr] [-U] [-c CMD] [REV]")), "branch": (branch, [('f', 'force', None, @@ -3352,7 +3352,7 @@ _('show only branches that have unmerged heads')), ('c', 'closed', False, _('show normal and closed branches'))], - _('[-a]')), + _('[-ac]')), "bundle": (bundle, [('f', 'force', None, @@ -3364,7 +3364,7 @@ ('a', 'all', None, _('bundle all changesets in the repository')), ('t', 'type', 'bzip2', _('bundle compression type to use')), ] + remoteopts, - _('[-f] [-a] [-r REV]... [--base REV]... FILE [DEST]')), + _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')), "cat": (cat, [('o', 'output', '', _('print output to file with formatted name')), @@ -3474,7 +3474,7 @@ ('c', 'closed', False, _('show normal and closed branch heads')), ] + templateopts, - _('[-r STARTREV] [REV]...')), + _('[-ac] [-r STARTREV] [REV]...')), "help": (help_, [], _('[TOPIC]')), "identify|id": (identify, @@ -3551,7 +3551,7 @@ ('r', 'rev', '', _('revision to merge')), ('P', 'preview', None, _('review revisions to merge (no merge is performed)'))], - _('[-f] [[-r] REV]')), + _('[-P] [-f] [[-r] REV]')), "outgoing|out": (outgoing, [('f', 'force', None, @@ -3671,14 +3671,14 @@ # -l/--local is already there, commitopts cannot be used ('m', 'message', '', _('use as commit message')), ] + commitopts2, - _('[-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')), + _('[-f] [-l] [-m TEXT] [-d DATE] [-u USER] [-r REV] NAME...')), "tags": (tags, [], ''), "tip": (tip, [('p', 'patch', None, _('show patch')), ('g', 'git', None, _('use git extended diff format')), ] + templateopts, - _('[-p]')), + _('[-p] [-g]')), "unbundle": (unbundle, [('u', 'update', None, diff -r 2ba40cdaacb2 -r ddc899096b7b mercurial/localrepo.py --- a/mercurial/localrepo.py Tue Dec 01 00:48:25 2009 +0100 +++ b/mercurial/localrepo.py Tue Dec 01 14:37:33 2009 -0600 @@ -1526,7 +1526,7 @@ if not rheads: # new branch requires --force self.ui.warn(_("abort: push creates new" " remote branch '%s'!\n") % - self[updatelb[0]].branch()) + self[lheads[0]].branch()) else: self.ui.warn(_("abort: push creates new remote heads!\n")) @@ -1569,11 +1569,7 @@ else: rheads = [] lheads = localhds[lh] - updatelb = [upd for upd in update - if self[upd].branch() == lh] - if not updatelb: - continue - if not checkbranch(lheads, rheads, updatelb): + if not checkbranch(lheads, rheads, update): return None, 0 else: if not checkbranch(heads, remote_heads, update): diff -r 2ba40cdaacb2 -r ddc899096b7b tests/test-extdiff --- a/tests/test-extdiff Tue Dec 01 00:48:25 2009 +0100 +++ b/tests/test-extdiff Tue Dec 01 14:37:33 2009 -0600 @@ -65,3 +65,9 @@ hg extdiff -p `pwd`/differ.py # will change to /tmp/extdiff.TMP and populate directories a.TMP and a and start tool echo '% diff in working directory, after' hg diff --git + +echo +echo % test extdiff with --option +hg extdiff -p echo -o this -c 1 +hg falabala -o this -c 1 +echo diff -r 2ba40cdaacb2 -r ddc899096b7b tests/test-extdiff.out --- a/tests/test-extdiff.out Tue Dec 01 00:48:25 2009 +0100 +++ b/tests/test-extdiff.out Tue Dec 01 14:37:33 2009 -0600 @@ -68,3 +68,8 @@ -b +changed +edited + +% test extdiff with --option +this a.8a5febb7f867/a a.34eed99112ab/a +diffing this a.8a5febb7f867/a a.34eed99112ab/a + diff -r 2ba40cdaacb2 -r ddc899096b7b tests/test-push-warn --- a/tests/test-push-warn Tue Dec 01 00:48:25 2009 +0100 +++ b/tests/test-push-warn Tue Dec 01 14:37:33 2009 -0600 @@ -140,4 +140,21 @@ hg -R i push h echo +echo % check prepush logic with merged branches +hg init j +hg -R j branch a +echo init > j/foo +hg -R j ci -Am init +hg clone j k +echo a1 > j/foo +hg -R j ci -m a1 +hg -R k branch b +echo b > k/foo +hg -R k ci -m b +hg -R k up 0 +hg -R k merge b +hg -R k ci -m merge +hg -R k push -r a j +echo + exit 0 diff -r 2ba40cdaacb2 -r ddc899096b7b tests/test-push-warn.out --- a/tests/test-push-warn.out Tue Dec 01 00:48:25 2009 +0100 +++ b/tests/test-push-warn.out Tue Dec 01 14:37:33 2009 -0600 @@ -140,3 +140,17 @@ abort: push creates new remote heads! (did you forget to merge? use push -f to force) +% check prepush logic with merged branches +marked working directory as branch a +adding foo +updating to branch a +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +marked working directory as branch b +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +1 files updated, 0 files merged, 0 files removed, 0 files unresolved +(branch merge, don't forget to commit) +pushing to j +searching for changes +abort: push creates new remote heads! +(did you forget to merge? use push -f to force) + diff -r 2ba40cdaacb2 -r ddc899096b7b tests/test-schemes --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-schemes Tue Dec 01 14:37:33 2009 -0600 @@ -0,0 +1,22 @@ +#!/bin/sh + +cat <> $HGRCPATH +[extensions] +schemes= + +[schemes] +l = http://localhost:$HGPORT/ +EOF + +hg init test +cd test +echo a > a +hg ci -Am initial + +hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log +cat hg.pid >> $DAEMON_PIDS + +hg incoming l:// + +echo % errors +cat errors.log diff -r 2ba40cdaacb2 -r ddc899096b7b tests/test-schemes.out --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-schemes.out Tue Dec 01 14:37:33 2009 -0600 @@ -0,0 +1,5 @@ +adding a +comparing with l:// +searching for changes +no changes found +% errors