D4849: store: introduce a function to get tracked path from a fncache entry

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Oct 3 15:02:19 UTC 2018


pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch introduces a function to get the trakced path from a fncache entry.
  This will be used to filter out files to streamclone using a narrowmatcher.
  
  The function decodes the entries, and then returns the part after omitting the
  ending .d, .i and starting meta/ and data/.
  
  I am not sure if this is correct.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/store.py

CHANGE DETAILS

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -24,6 +24,21 @@
 
 parsers = policy.importmod(r'parsers')
 
+def _gettrackedpath(path):
+    """parses a fncahe entry and returns the path which that
+    entry is tracking.
+
+    If None is returned, it means it does not track any path.
+    """
+    path = decodefilename(path)
+    if path.startswith('data/'):
+        return path[5:-2]
+    elif path.startswith('dh/'):
+        return path[3:-2]
+    elif path.startswith('meta/'):
+        return path[5:-2]
+    return None
+
 # This avoids a collision between a file named foo and a dir named
 # foo.i or foo.d
 def _encodedir(path):



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


More information about the Mercurial-devel mailing list