D1140: localrepo: add a pinnedrevs attribute

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue Oct 17 12:18:59 UTC 2017


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

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.



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


More information about the Mercurial-devel mailing list