Patchwork D1140: localrepo: add a pinnedrevs attribute

login
register
mail settings
Submitter phabricator
Date Oct. 17, 2017, 12:18 p.m.
Message ID <differential-rev-PHID-DREV-cqwxjf4axmh2hnm6zy4c-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25088/
State Superseded
Headers show

Comments

phabricator - Oct. 17, 2017, 12:18 p.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We have repoview.pinnedrevs() which take a repository object and returns the
  hidden revisions which should not be filtered. To add more hidden revisions to
  prevent them from getting obsoleted, we need to wrap the pinnedrevs function.
  
  This patch adds repo.pinnedrevs which can be updated with the revisions which
  needs to be prevented from being filtered. After this patch
  repoview.pinnedrevs() updates repo.pinnedrevs and returns it.
  
  The functionality to add commits to pinnedrevs without wrapping the function
  will be very helpful is adding support for accessing hidden commits.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/localrepo.py
  mercurial/repoview.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 19, 2017, 5:01 p.m.
krbullock added a comment.


  We're dropping this stack from 4.4 because it caused unexpected behavior changes in python-hglib (https://buildbot.mercurial-scm.org/builders/python-hglib/builds/654) and elsewhere. Seems to stem from recomputing from the same set on repeated calls to `repoview.pinnedrevs()`.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #hg-reviewers, indygreg
Cc: krbullock, dlax, mercurial-devel

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -33,7 +33,7 @@ 
     """
 
     cl = repo.changelog
-    pinned = set()
+    pinned = repo.pinnedrevs
     pinned.update([par.rev() for par in repo[None].parents()])
     pinned.update([cl.rev(bm) for bm in repo._bookmarks.values()])
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -505,6 +505,9 @@ 
         # generic mapping between names and nodes
         self.names = namespaces.namespaces()
 
+        # a set of hidden revisions which should not be filtered
+        self.pinnedrevs = set()
+
         # Key to signature value.
         self._sparsesignaturecache = {}
         # Signature to cached matcher instance.