Patchwork D7806: graft: use revset for intersecting with ancestor set

login
register
mail settings
Submitter phabricator
Date Jan. 9, 2020, 2:58 p.m.
Message ID <10049856b736a2f1f1c53102aa3e6e41@localhost.localdomain>
Download mbox | patch
Permalink /patch/44234/
State Not Applicable
Headers show

Comments

phabricator - Jan. 9, 2020, 2:58 p.m.
Closed by commit rHG4322de8f7016: graft: use revset for intersecting with ancestor set (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7806?vs=19058&id=19130

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7806/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7806

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3079,14 +3079,10 @@ 
     # already, they'd have been in the graftstate.
     if not (cont or opts.get(b'force')) and basectx is None:
         # check for ancestors of dest branch
-        crev = repo[b'.'].rev()
-        ancestors = repo.changelog.ancestors([crev], inclusive=True)
-        # XXX make this lazy in the future
-        for rev in revs:
-            if rev in ancestors:
-                ui.warn(
-                    _(b'skipping ancestor revision %d:%s\n') % (rev, repo[rev])
-                )
+        ancestors = repo.revs(b'%ld & (::.)', revs)
+        for rev in ancestors:
+            ui.warn(_(b'skipping ancestor revision %d:%s\n') % (rev, repo[rev]))
+
         revs = [r for r in revs if r not in ancestors]
 
         if not revs:
@@ -3105,7 +3101,7 @@ 
 
         # The only changesets we can be sure doesn't contain grafts of any
         # revs, are the ones that are common ancestors of *all* revs:
-        for rev in repo.revs(b'only(%d,ancestor(%ld))', crev, revs):
+        for rev in repo.revs(b'only(%d,ancestor(%ld))', repo[b'.'].rev(), revs):
             ctx = repo[rev]
             n = ctx.extra().get(b'source')
             if n in ids: