##// END OF EJS Templates
patchbomb: rewrite getoutgoing() with revsets...
Patrick Mezard -
r17178:8308f628 default
parent child Browse files
Show More
@@ -48,7 +48,7 b' hgrc(5) for details.'
48 import os, errno, socket, tempfile, cStringIO
48 import os, errno, socket, tempfile, cStringIO
49 import email.MIMEMultipart, email.MIMEBase
49 import email.MIMEMultipart, email.MIMEBase
50 import email.Utils, email.Encoders, email.Generator
50 import email.Utils, email.Encoders, email.Generator
51 from mercurial import cmdutil, commands, hg, mail, patch, util, discovery
51 from mercurial import cmdutil, commands, hg, mail, patch, util
52 from mercurial import scmutil
52 from mercurial import scmutil
53 from mercurial.i18n import _
53 from mercurial.i18n import _
54 from mercurial.node import bin
54 from mercurial.node import bin
@@ -273,20 +273,18 b' def patchbomb(ui, repo, *revs, **opts):'
273
273
274 def getoutgoing(dest, revs):
274 def getoutgoing(dest, revs):
275 '''Return the revisions present locally but not in dest'''
275 '''Return the revisions present locally but not in dest'''
276 dest = ui.expandpath(dest or 'default-push', dest or 'default')
276 url = ui.expandpath(dest or 'default-push', dest or 'default')
277 dest, branches = hg.parseurl(dest)
277 url = hg.parseurl(url)[0]
278 revs, checkout = hg.addbranchrevs(repo, repo, branches, revs)
278 ui.status(_('comparing with %s\n') % util.hidepassword(url))
279 if revs:
279
280 revs = [repo.lookup(r) for r in scmutil.revrange(repo, revs)]
280 revs = [r for r in scmutil.revrange(repo, revs) if r >= 0]
281 other = hg.peer(repo, opts, dest)
281 if not revs:
282 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
282 revs = [len(repo) - 1]
283 repo.ui.pushbuffer()
283 revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs)
284 outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs)
284 if not revs:
285 repo.ui.popbuffer()
286 if not outgoing.missing:
287 ui.status(_("no changes found\n"))
285 ui.status(_("no changes found\n"))
288 return []
286 return []
289 return [str(repo.changelog.rev(r)) for r in outgoing.missing]
287 return [str(r) for r in revs]
290
288
291 def getpatches(revs):
289 def getpatches(revs):
292 for r in scmutil.revrange(repo, revs):
290 for r in scmutil.revrange(repo, revs):
General Comments 0
You need to be logged in to leave comments. Login now