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

login
register
mail settings
Submitter Martin von Zweigbergk
Date Feb. 22, 2016, 6:45 a.m.
Message ID <CAESOdVBigxotf-wL8gExd+rpzpB1X8GnLmJGc9jcZC76LhUhNw@mail.gmail.com>
Download mbox | patch
Permalink /patch/13285/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Feb. 22, 2016, 6:45 a.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@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).
Pierre-Yves David - Feb. 24, 2016, 11:08 a.m.
On 02/22/2016 07:45 AM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1455078153 28800
> #      Tue Feb 09 20:22:33 2016 -0800
> # Node ID 3408edeb530fba97130a9541b50d0e3fe0fdd50d
> # Parent  3db70405779e6da52bd6fd45ced2e3cc669fce4d
> treemanifest: allow setting flag to 't'

Pushed to the clowncopter, thanks.

Patch

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: