[PATCH v2] treemanifest: allow setting flag to 't'

Martin von Zweigbergk martinvonz at google.com
Mon Feb 22 06:45:17 UTC 2016


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1455078153 28800
#      Tue Feb 09 20:22:33 2016 -0800
# Node ID 3408edeb530fba97130a9541b50d0e3fe0fdd50d
# Parent  3db70405779e6da52bd6fd45ced2e3cc669fce4d
treemanifest: allow setting flag to 't'

When using treemanifests, an on-disk manifest entry with the 't' flag
set means that that entry is a directory and not a file. When read
into memory, these become instances of the treemanifest class. The 't'
flag should therefore never be visible to outside of manifest.py, so
setflag() checks that it is not called with the 't' flag. However, it
turns out that it will be useful for the narrowhg extension to expose
the 't' flag to the user (see below), so let's drop the assertion.

The narrowhg extension allows cloning only a given set of files and
directories. Filelogs and dirlogs that don't match that set will not
be included in the clone. The extension currently doesn't work with
treemanifests. I plan on changing it so directories outside the narrow
clone appear in the manifest. For example, if a directory 'outside/'
is not part of the narrow clone, it will look like a file 'outside'
with the 't' flag set. That will make e.g. manifestmerge() just work
in most cases (and make it well prepared to handle the other
cases).

diff -r 3db70405779e -r 3408edeb530f mercurial/manifest.py
--- a/mercurial/manifest.py     Fri Feb 12 18:39:48 2016 +0900
+++ b/mercurial/manifest.py     Tue Feb 09 20:22:33 2016 -0800
@@ -627,7 +627,6 @@

     def setflag(self, f, flags):
         """Set the flags (symlink, executable) for path f."""
-        assert 't' not in flags
         self._load()
         dir, subpath = _splittopdir(f)
         if dir:


More information about the Mercurial-devel mailing list