Patchwork D1615: transaction: build changes['revs'] as range instead of a set

login
register
mail settings
Submitter phabricator
Date Dec. 8, 2017, 3:29 p.m.
Message ID <e0d3c5a0f43bc26285b80918c672d7ef@localhost.localdomain>
Download mbox | patch
Permalink /patch/26106/
State Not Applicable
Headers show

Comments

phabricator - Dec. 8, 2017, 3:29 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG137a08d82232: transaction: build changes[&#039;revs&#039;] as range instead of a set (authored by joerg.sonnenberger, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1615?vs=4229&id=4253

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/localrepo.py
  mercurial/obsutil.py
  mercurial/scmutil.py

CHANGE DETAILS




To: joerg.sonnenberger, #hg-reviewers, quark, yuja
Cc: quark, mercurial-devel

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1262,7 +1262,7 @@ 
         @reportsummary
         def reportnewcs(repo, tr):
             """Report the range of new revisions pulled/unbundled."""
-            newrevs = list(tr.changes.get('revs', set()))
+            newrevs = tr.changes.get('revs', xrange(0, 0))
             if not newrevs:
                 return
 
diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -441,12 +441,12 @@ 
     public = phases.public
     addedmarkers = tr.changes.get('obsmarkers')
     addedrevs = tr.changes.get('revs')
-    seenrevs = set(addedrevs)
+    seenrevs = set()
     obsoleted = set()
     for mark in addedmarkers:
         node = mark[0]
         rev = torev(node)
-        if rev is None or rev in seenrevs:
+        if rev is None or rev in seenrevs or rev in addedrevs:
             continue
         seenrevs.add(rev)
         if phase(repo, rev) == public:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1275,7 +1275,7 @@ 
                                      validator=validate,
                                      releasefn=releasefn,
                                      checkambigfiles=_cachedfiles)
-        tr.changes['revs'] = set()
+        tr.changes['revs'] = xrange(0, 0)
         tr.changes['obsmarkers'] = set()
         tr.changes['phases'] = {}
         tr.changes['bookmarks'] = {}
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -541,5 +541,10 @@ 
                                                    *args, **kwargs)
         revs = transaction.changes.get('revs')
         if revs is not None:
-            revs.add(rev)
+            if revs:
+                assert revs[-1] + 1 == rev
+                revs = xrange(revs[0], rev + 1)
+            else:
+                revs = xrange(rev, rev + 1)
+            transaction.changes['revs'] = revs
         return node