Mercurial > hg
changeset 14222:474179077ae0
merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 06 May 2011 11:50:58 -0500 |
parents | c5db85676c38 (diff) 680c3c6fcb48 (current diff) |
children | e456084a3ecc |
files | mercurial/commands.py |
diffstat | 8 files changed, 74 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Fri May 06 14:29:53 2011 +0200 +++ b/hgext/mq.py Fri May 06 11:50:58 2011 -0500 @@ -45,7 +45,7 @@ from mercurial.i18n import _ from mercurial.node import bin, hex, short, nullid, nullrev from mercurial.lock import release -from mercurial import commands, cmdutil, hg, patch, scmutil, util +from mercurial import commands, cmdutil, hg, patch, scmutil, util, revset from mercurial import repair, extensions, url, error import os, sys, re, errno, shutil @@ -3096,6 +3096,20 @@ ui.note(_("mq: (empty queue)\n")) return r +def revsetmq(repo, subset, x): + """``mq()`` + Changesets managed by MQ. + """ + revset.getargs(x, 0, 0, _("mq takes no arguments")) + applied = set([repo[r.node].rev() for r in repo.mq.applied]) + return [r for r in subset if r in applied] + +def extsetup(ui): + revset.symbols['mq'] = revsetmq + +# tell hggettext to extract docstrings from these functions: +i18nfunctions = [revsetmq] + def uisetup(ui): mqopt = [('', 'mq', None, _("operate on patch repository"))]
--- a/hgext/transplant.py Fri May 06 14:29:53 2011 +0200 +++ b/hgext/transplant.py Fri May 06 11:50:58 2011 -0500 @@ -602,11 +602,7 @@ s = revset.getset(repo, subset, x) else: s = subset - cs = set() - for r in xrange(0, len(repo)): - if repo[r].extra().get('transplant_source'): - cs.add(r) - return [r for r in s if r in cs] + return [r for r in s if repo[r].extra().get('transplant_source')] def kwtransplanted(repo, ctx, **args): """:transplanted: String. The node identifier of the transplanted
--- a/mercurial/commands.py Fri May 06 14:29:53 2011 +0200 +++ b/mercurial/commands.py Fri May 06 11:50:58 2011 -0500 @@ -702,16 +702,18 @@ raise util.Abort(_("--base is incompatible with specifying " "a destination")) common = [repo.lookup(rev) for rev in base] + heads = revs and map(repo.lookup, revs) or revs else: dest = ui.expandpath(dest or 'default-push', dest or 'default') dest, branches = hg.parseurl(dest, opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), dest) revs, checkout = hg.addbranchrevs(repo, other, branches, revs) - inc = discovery.findcommonincoming(repo, other, force=opts.get('force')) - common, _anyinc, _heads = inc - - nodes = revs and map(repo.lookup, revs) or revs - cg = repo.getbundle('bundle', common=common, heads=nodes) + heads = revs and map(repo.lookup, revs) or revs + common, outheads = discovery.findcommonoutgoing(repo, other, + onlyheads=heads, + force=opts.get('force')) + + cg = repo.getbundle('bundle', common=common, heads=heads) if not cg: ui.status(_("no changes found\n")) return 1 @@ -4014,19 +4016,23 @@ revs, checkout = hg.addbranchrevs(repo, other, branches, opts.get('rev')) ui.debug('comparing with %s\n' % util.hidepassword(source)) repo.ui.pushbuffer() - common, incoming, rheads = discovery.findcommonincoming(repo, other) + commoninc = discovery.findcommonincoming(repo, other) + _common, incoming, _rheads = commoninc repo.ui.popbuffer() if incoming: t.append(_('1 or more incoming')) dest, branches = hg.parseurl(ui.expandpath('default-push', 'default')) revs, checkout = hg.addbranchrevs(repo, repo, branches, None) - other = hg.repository(hg.remoteui(repo, {}), dest) - ui.debug('comparing with %s\n' % util.hidepassword(dest)) + if source != dest: + other = hg.repository(hg.remoteui(repo, {}), dest) + commoninc = None + ui.debug('comparing with %s\n' % util.hidepassword(dest)) repo.ui.pushbuffer() - common, _anyinc, _heads = discovery.findcommonincoming(repo, other) + common, outheads = discovery.findcommonoutgoing(repo, other, + commoninc=commoninc) repo.ui.popbuffer() - o = repo.changelog.findmissing(common=common) + o = repo.changelog.findmissing(common=common, heads=outheads) if o: t.append(_('%d outgoing') % len(o)) if 'bookmarks' in other.listkeys('namespaces'):
--- a/mercurial/discovery.py Fri May 06 14:29:53 2011 +0200 +++ b/mercurial/discovery.py Fri May 06 11:50:58 2011 -0500 @@ -23,6 +23,9 @@ If you pass heads and they are all known locally, the reponse lists justs these heads in "common" and in "heads". + + Please use findcommonoutgoing to compute the set of outgoing nodes to give + extensions a good hook into outgoing. """ if not remote.capable('getbundle'): @@ -43,6 +46,21 @@ common, anyinc, srvheads = res return (list(common), anyinc, heads or list(srvheads)) +def findcommonoutgoing(repo, other, onlyheads=None, force=False, commoninc=None): + '''Return a tuple (common, anyoutgoing, heads) used to identify the set + of nodes present in repo but not in other. + + If onlyheads is given, only nodes ancestral to nodes in onlyheads (inclusive) + are included. If you already know the local repo's heads, passing them in + onlyheads is faster than letting them be recomputed here. + + If commoninc is given, it must the the result of a prior call to + findcommonincoming(repo, other, force) to avoid recomputing it here. + + The returned tuple is meant to be passed to changelog.findmissing.''' + common, _any, _hds = commoninc or findcommonincoming(repo, other, force=force) + return (common, onlyheads or repo.heads()) + def prepush(repo, remote, force, revs, newbranch): '''Analyze the local and remote repositories and determine which changesets need to be pushed to the remote. Return value depends @@ -57,7 +75,10 @@ changegroup is a readable file-like object whose read() returns successive changegroup chunks ready to be sent over the wire and remoteheads is the list of remote heads.''' - common, inc, remoteheads = findcommonincoming(repo, remote, force=force) + commoninc = findcommonincoming(repo, remote, force=force) + common, revs = findcommonoutgoing(repo, remote, onlyheads=revs, + commoninc=commoninc, force=force) + _common, inc, remoteheads = commoninc cl = repo.changelog outg = cl.findmissing(common, revs)
--- a/mercurial/hg.py Fri May 06 14:29:53 2011 +0200 +++ b/mercurial/hg.py Fri May 06 11:50:58 2011 -0500 @@ -480,9 +480,9 @@ revs = [repo.lookup(rev) for rev in revs] other = repository(remoteui(repo, opts), dest) - inc = discovery.findcommonincoming(repo, other, force=opts.get('force')) - common, _anyinc, _heads = inc - o = repo.changelog.findmissing(common, revs) + common, outheads = discovery.findcommonoutgoing(repo, other, revs, + force=opts.get('force')) + o = repo.changelog.findmissing(common, outheads) if not o: ui.status(_("no changes found\n")) return None
--- a/mercurial/revset.py Fri May 06 14:29:53 2011 +0200 +++ b/mercurial/revset.py Fri May 06 11:50:58 2011 -0500 @@ -558,10 +558,10 @@ revs = [repo.lookup(rev) for rev in revs] other = hg.repository(hg.remoteui(repo, {}), dest) repo.ui.pushbuffer() - common, _anyinc, _heads = discovery.findcommonincoming(repo, other) + common, outheads = discovery.findcommonoutgoing(repo, other, onlyheads=revs) repo.ui.popbuffer() cl = repo.changelog - o = set([cl.rev(r) for r in repo.changelog.findmissing(common, revs)]) + o = set([cl.rev(r) for r in repo.changelog.findmissing(common, outheads)]) return [r for r in subset if r in o] def p1(repo, subset, x):
--- a/tests/filterpyflakes.py Fri May 06 14:29:53 2011 +0200 +++ b/tests/filterpyflakes.py Fri May 06 11:50:58 2011 -0500 @@ -2,7 +2,7 @@ # Filter output by pyflakes to control which warnings we check -import sys, re +import sys, re, os def makekey(message): # "path/file:line: message" @@ -25,6 +25,12 @@ ] if not re.search('|'.join(pats), line): continue + fn = line.split(':', 1)[0] + f = open(os.path.join(os.path.dirname(os.path.dirname(__file__)), fn)) + data = f.read() + f.close() + if 'no-check-code' in data: + continue lines.append(line) for line in sorted(lines, key = makekey):
--- a/tests/test-mq.t Fri May 06 14:29:53 2011 +0200 +++ b/tests/test-mq.t Fri May 06 11:50:58 2011 -0500 @@ -843,6 +843,14 @@ 1 foo qbase 2 bar qtip tip +mq revset + + $ hg log -r 'mq()' --template '{rev}\n' + 1 + 2 + $ hg help revsets | grep -i mq + "mq()" + Changesets managed by MQ. bad node in status