Mercurial > hg
changeset 9981:1bf8b870efb4 stable
Merge with i18n
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 01 Dec 2009 14:36:47 -0600 |
parents | 6e8f39982306 (current diff) fa99480d5135 (diff) |
children | ddc899096b7b 439d7ea6fe3a |
files | |
diffstat | 11 files changed, 170 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/Makefile Tue Dec 01 00:47:25 2009 +0100 +++ b/doc/Makefile Tue Dec 01 14:36:47 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)
--- a/hgext/extdiff.py Tue Dec 01 00:47:25 2009 +0100 +++ b/hgext/extdiff.py Tue Dec 01 14:36:47 2009 -0600 @@ -253,7 +253,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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgext/schemes.py Tue Dec 01 14:36:47 2009 -0600 @@ -0,0 +1,82 @@ +# Copyright 2009, Alexander Solovyov <piranha@piranha.org.ua> +# +# 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 '<ShortRepository: %s>' % 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)
--- a/mercurial/commands.py Tue Dec 01 00:47:25 2009 +0100 +++ b/mercurial/commands.py Tue Dec 01 14:36:47 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) @@ -2337,7 +2337,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( @@ -3346,7 +3346,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, @@ -3359,7 +3359,7 @@ _('show only branches that have unmerged heads')), ('c', 'closed', False, _('show normal and closed branches'))], - _('[-a]')), + _('[-ac]')), "bundle": (bundle, [('f', 'force', None, @@ -3371,7 +3371,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')), @@ -3481,7 +3481,7 @@ ('c', 'closed', False, _('show normal and closed branch heads')), ] + templateopts, - _('[-r STARTREV] [REV]...')), + _('[-ac] [-r STARTREV] [REV]...')), "help": (help_, [], _('[TOPIC]')), "identify|id": (identify, @@ -3558,7 +3558,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, @@ -3678,14 +3678,14 @@ # -l/--local is already there, commitopts cannot be used ('m', 'message', '', _('use <text> 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,
--- a/mercurial/localrepo.py Tue Dec 01 00:47:25 2009 +0100 +++ b/mercurial/localrepo.py Tue Dec 01 14:36:47 2009 -0600 @@ -1505,7 +1505,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")) @@ -1548,11 +1548,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):
--- a/tests/test-extdiff Tue Dec 01 00:47:25 2009 +0100 +++ b/tests/test-extdiff Tue Dec 01 14:36:47 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
--- a/tests/test-extdiff.out Tue Dec 01 00:47:25 2009 +0100 +++ b/tests/test-extdiff.out Tue Dec 01 14:36:47 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 +
--- a/tests/test-push-warn Tue Dec 01 00:47:25 2009 +0100 +++ b/tests/test-push-warn Tue Dec 01 14:36:47 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
--- a/tests/test-push-warn.out Tue Dec 01 00:47:25 2009 +0100 +++ b/tests/test-push-warn.out Tue Dec 01 14:36:47 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) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-schemes Tue Dec 01 14:36:47 2009 -0600 @@ -0,0 +1,22 @@ +#!/bin/sh + +cat <<EOF >> $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