mirror of
https://github.com/facebook/sapling.git
synced 2024-12-26 22:47:26 +03:00
treemanifest: delete upstream treemanifest implementation
Summary: These classes were used for upstream's treemanifest implementation. At one point we partially used it for our server side tree logic, but these days we don't use any of it except for the revlog layer. Let's delete the context and treemanifest layers and tests. Reviewed By: sfilipco Differential Revision: D20953163 fbshipit-source-id: 952063e4e0cf74e2da740bf91a70e1714a9ad9b5
This commit is contained in:
parent
6678f088c8
commit
f5c2b60756
@ -397,467 +397,6 @@ def _splittopdir(f):
|
||||
_noop = lambda s: None
|
||||
|
||||
|
||||
class treemanifest(object):
|
||||
def __init__(self, dir="", text=b""):
|
||||
self._dir = dir
|
||||
self._node = revlog.nullid
|
||||
self._loadfunc = _noop
|
||||
self._copyfunc = _noop
|
||||
self._dirty = False
|
||||
self._dirs = {}
|
||||
# Using _lazymanifest here is a little slower than plain old dicts
|
||||
self._files = {}
|
||||
self._flags = {}
|
||||
if text:
|
||||
|
||||
def readsubtree(subdir, subm):
|
||||
raise AssertionError(
|
||||
"treemanifest constructor only accepts " "flat manifests"
|
||||
)
|
||||
|
||||
self.parse(text, readsubtree)
|
||||
self._dirty = True # Mark flat manifest dirty after parsing
|
||||
|
||||
def _subpath(self, path):
|
||||
return self._dir + path
|
||||
|
||||
def __len__(self):
|
||||
self._load()
|
||||
size = len(self._files)
|
||||
for m in self._dirs.values():
|
||||
size += m.__len__()
|
||||
return size
|
||||
|
||||
def _isempty(self):
|
||||
self._load() # for consistency; already loaded by all callers
|
||||
return not self._files and (
|
||||
not self._dirs or all(m._isempty() for m in self._dirs.values())
|
||||
)
|
||||
|
||||
def __repr__(self):
|
||||
return "<treemanifest dir=%s, node=%s, loaded=%s, dirty=%s at 0x%x>" % (
|
||||
self._dir,
|
||||
revlog.hex(self._node),
|
||||
bool(self._loadfunc is _noop),
|
||||
self._dirty,
|
||||
id(self),
|
||||
)
|
||||
|
||||
def dir(self):
|
||||
"""The directory that this tree manifest represents, including a
|
||||
trailing '/'. Empty string for the repo root directory."""
|
||||
return self._dir
|
||||
|
||||
def node(self):
|
||||
"""This node of this instance. nullid for unsaved instances. Should
|
||||
be updated when the instance is read or written from a revlog.
|
||||
"""
|
||||
assert not self._dirty
|
||||
return self._node
|
||||
|
||||
def setnode(self, node):
|
||||
self._node = node
|
||||
self._dirty = False
|
||||
|
||||
def iterentries(self):
|
||||
self._load()
|
||||
for p, n in sorted(itertools.chain(self._dirs.items(), self._files.items())):
|
||||
if p in self._files:
|
||||
yield self._subpath(p), n, self._flags.get(p, "")
|
||||
else:
|
||||
for x in n.iterentries():
|
||||
yield x
|
||||
|
||||
def items(self):
|
||||
self._load()
|
||||
for p, n in sorted(itertools.chain(self._dirs.items(), self._files.items())):
|
||||
if p in self._files:
|
||||
yield self._subpath(p), n
|
||||
else:
|
||||
for f, sn in pycompat.iteritems(n):
|
||||
yield f, sn
|
||||
|
||||
iteritems = items
|
||||
|
||||
def iterkeys(self):
|
||||
self._load()
|
||||
for p in sorted(itertools.chain(self._dirs, self._files)):
|
||||
if p in self._files:
|
||||
yield self._subpath(p)
|
||||
else:
|
||||
for f in pycompat.iterkeys(self._dirs[p]):
|
||||
yield f
|
||||
|
||||
def keys(self):
|
||||
return list(self.iterkeys())
|
||||
|
||||
def __iter__(self):
|
||||
return self.iterkeys()
|
||||
|
||||
def __contains__(self, f):
|
||||
if f is None:
|
||||
return False
|
||||
self._load()
|
||||
dir, subpath = _splittopdir(f)
|
||||
if dir:
|
||||
if dir not in self._dirs:
|
||||
return False
|
||||
return self._dirs[dir].__contains__(subpath)
|
||||
else:
|
||||
return f in self._files
|
||||
|
||||
def get(self, f, default=None):
|
||||
self._load()
|
||||
dir, subpath = _splittopdir(f)
|
||||
if dir:
|
||||
if dir not in self._dirs:
|
||||
return default
|
||||
return self._dirs[dir].get(subpath, default)
|
||||
else:
|
||||
return self._files.get(f, default)
|
||||
|
||||
def __getitem__(self, f):
|
||||
self._load()
|
||||
dir, subpath = _splittopdir(f)
|
||||
if dir:
|
||||
return self._dirs[dir].__getitem__(subpath)
|
||||
else:
|
||||
return self._files[f]
|
||||
|
||||
def flags(self, f):
|
||||
self._load()
|
||||
dir, subpath = _splittopdir(f)
|
||||
if dir:
|
||||
if dir not in self._dirs:
|
||||
return ""
|
||||
return self._dirs[dir].flags(subpath)
|
||||
else:
|
||||
if f in self._dirs:
|
||||
return ""
|
||||
return self._flags.get(f, "")
|
||||
|
||||
def find(self, f):
|
||||
self._load()
|
||||
dir, subpath = _splittopdir(f)
|
||||
if dir:
|
||||
return self._dirs[dir].find(subpath)
|
||||
else:
|
||||
return self._files[f], self._flags.get(f, "")
|
||||
|
||||
def __delitem__(self, f):
|
||||
self._load()
|
||||
dir, subpath = _splittopdir(f)
|
||||
if dir:
|
||||
self._dirs[dir].__delitem__(subpath)
|
||||
# If the directory is now empty, remove it
|
||||
if self._dirs[dir]._isempty():
|
||||
del self._dirs[dir]
|
||||
else:
|
||||
del self._files[f]
|
||||
if f in self._flags:
|
||||
del self._flags[f]
|
||||
self._dirty = True
|
||||
|
||||
def __setitem__(self, f, n):
|
||||
assert n is not None
|
||||
self._load()
|
||||
dir, subpath = _splittopdir(f)
|
||||
if dir:
|
||||
if dir not in self._dirs:
|
||||
self._dirs[dir] = treemanifest(self._subpath(dir))
|
||||
self._dirs[dir].__setitem__(subpath, n)
|
||||
else:
|
||||
self._files[f] = n[:21] # to match manifestdict's behavior
|
||||
self._dirty = True
|
||||
|
||||
def _load(self):
|
||||
if self._loadfunc is not _noop:
|
||||
lf, self._loadfunc = self._loadfunc, _noop
|
||||
lf(self)
|
||||
elif self._copyfunc is not _noop:
|
||||
cf, self._copyfunc = self._copyfunc, _noop
|
||||
cf(self)
|
||||
|
||||
def setflag(self, f, flags):
|
||||
"""Set the flags (symlink, executable) for path f."""
|
||||
self._load()
|
||||
dir, subpath = _splittopdir(f)
|
||||
if dir:
|
||||
if dir not in self._dirs:
|
||||
self._dirs[dir] = treemanifest(self._subpath(dir))
|
||||
self._dirs[dir].setflag(subpath, flags)
|
||||
else:
|
||||
self._flags[f] = flags
|
||||
self._dirty = True
|
||||
|
||||
def copy(self):
|
||||
copy = treemanifest(self._dir)
|
||||
copy._node = self._node
|
||||
copy._dirty = self._dirty
|
||||
if self._copyfunc is _noop:
|
||||
|
||||
def _copyfunc(s):
|
||||
self._load()
|
||||
for d in self._dirs:
|
||||
s._dirs[d] = self._dirs[d].copy()
|
||||
s._files = dict.copy(self._files)
|
||||
s._flags = dict.copy(self._flags)
|
||||
|
||||
if self._loadfunc is _noop:
|
||||
_copyfunc(copy)
|
||||
else:
|
||||
copy._copyfunc = _copyfunc
|
||||
else:
|
||||
copy._copyfunc = self._copyfunc
|
||||
return copy
|
||||
|
||||
def filesnotin(self, m2, matcher=None):
|
||||
"""Set of files in this manifest that are not in the other"""
|
||||
if matcher:
|
||||
m1 = self.matches(matcher)
|
||||
m2 = m2.matches(matcher)
|
||||
return m1.filesnotin(m2)
|
||||
|
||||
files = set()
|
||||
|
||||
def _filesnotin(t1, t2):
|
||||
if t1._node == t2._node and not t1._dirty and not t2._dirty:
|
||||
return
|
||||
t1._load()
|
||||
t2._load()
|
||||
for d, m1 in pycompat.iteritems(t1._dirs):
|
||||
if d in t2._dirs:
|
||||
m2 = t2._dirs[d]
|
||||
_filesnotin(m1, m2)
|
||||
else:
|
||||
files.update(pycompat.iterkeys(m1))
|
||||
|
||||
for fn in pycompat.iterkeys(t1._files):
|
||||
if fn not in t2._files:
|
||||
files.add(t1._subpath(fn))
|
||||
|
||||
_filesnotin(self, m2)
|
||||
return files
|
||||
|
||||
@propertycache
|
||||
def _alldirs(self):
|
||||
return util.dirs(self)
|
||||
|
||||
def dirs(self):
|
||||
return self._alldirs
|
||||
|
||||
def hasdir(self, dir):
|
||||
self._load()
|
||||
topdir, subdir = _splittopdir(dir)
|
||||
if topdir:
|
||||
if topdir in self._dirs:
|
||||
return self._dirs[topdir].hasdir(subdir)
|
||||
return False
|
||||
return (dir + "/") in self._dirs
|
||||
|
||||
def walk(self, match):
|
||||
"""Generates matching file names.
|
||||
|
||||
Equivalent to manifest.matches(match).iterkeys(), but without creating
|
||||
an entirely new manifest.
|
||||
|
||||
It also reports nonexistent files by marking them bad with match.bad().
|
||||
"""
|
||||
if match.always():
|
||||
for f in iter(self):
|
||||
yield f
|
||||
return
|
||||
|
||||
fset = set(match.files())
|
||||
|
||||
for fn in self._walk(match):
|
||||
if fn in fset:
|
||||
# specified pattern is the exact name
|
||||
fset.remove(fn)
|
||||
yield fn
|
||||
|
||||
# for dirstate.walk, files=[''] means "walk the whole tree".
|
||||
# follow that here, too
|
||||
fset.discard("")
|
||||
|
||||
for fn in sorted(fset):
|
||||
if not self.hasdir(fn):
|
||||
match.bad(fn, None)
|
||||
|
||||
def _walk(self, match):
|
||||
"""Recursively generates matching file names for walk()."""
|
||||
if not match.visitdir(self._dir[:-1]):
|
||||
return
|
||||
|
||||
# yield this dir's files and walk its submanifests
|
||||
self._load()
|
||||
for p in sorted(list(self._dirs.keys()) + list(self._files.keys())):
|
||||
if p in self._files:
|
||||
fullp = self._subpath(p)
|
||||
if match(fullp):
|
||||
yield fullp
|
||||
else:
|
||||
for f in self._dirs[p]._walk(match):
|
||||
yield f
|
||||
|
||||
def matches(self, match):
|
||||
"""generate a new manifest filtered by the match argument"""
|
||||
if match.always():
|
||||
return self.copy()
|
||||
|
||||
return self._matches(match)
|
||||
|
||||
def _matches(self, match):
|
||||
"""recursively generate a new manifest filtered by the match argument.
|
||||
"""
|
||||
|
||||
visit = match.visitdir(self._dir[:-1])
|
||||
if visit == "all":
|
||||
return self.copy()
|
||||
ret = treemanifest(self._dir)
|
||||
if not visit:
|
||||
return ret
|
||||
|
||||
self._load()
|
||||
for fn in self._files:
|
||||
fullp = self._subpath(fn)
|
||||
if not match(fullp):
|
||||
continue
|
||||
ret._files[fn] = self._files[fn]
|
||||
if fn in self._flags:
|
||||
ret._flags[fn] = self._flags[fn]
|
||||
|
||||
for dir, subm in pycompat.iteritems(self._dirs):
|
||||
m = subm._matches(match)
|
||||
if not m._isempty():
|
||||
ret._dirs[dir] = m
|
||||
|
||||
if not ret._isempty():
|
||||
ret._dirty = True
|
||||
return ret
|
||||
|
||||
def diff(self, m2, matcher=None):
|
||||
"""Finds changes between the current manifest and m2.
|
||||
|
||||
Args:
|
||||
m2: the manifest to which this manifest should be compared.
|
||||
|
||||
The result is returned as a dict with filename as key and
|
||||
values of the form ((n1,fl1),(n2,fl2)), where n1/n2 is the
|
||||
nodeid in the current/other manifest and fl1/fl2 is the flag
|
||||
in the current/other manifest. Where the file does not exist,
|
||||
the nodeid will be None and the flags will be the empty
|
||||
string.
|
||||
"""
|
||||
if matcher:
|
||||
m1 = self.matches(matcher)
|
||||
m2 = m2.matches(matcher)
|
||||
return m1.diff(m2)
|
||||
result = {}
|
||||
emptytree = treemanifest()
|
||||
|
||||
def _diff(t1, t2):
|
||||
if t1._node == t2._node and not t1._dirty and not t2._dirty:
|
||||
return
|
||||
t1._load()
|
||||
t2._load()
|
||||
for d, m1 in pycompat.iteritems(t1._dirs):
|
||||
m2 = t2._dirs.get(d, emptytree)
|
||||
_diff(m1, m2)
|
||||
|
||||
for d, m2 in pycompat.iteritems(t2._dirs):
|
||||
if d not in t1._dirs:
|
||||
_diff(emptytree, m2)
|
||||
|
||||
for fn, n1 in pycompat.iteritems(t1._files):
|
||||
fl1 = t1._flags.get(fn, "")
|
||||
n2 = t2._files.get(fn, None)
|
||||
fl2 = t2._flags.get(fn, "")
|
||||
if n1 != n2 or fl1 != fl2:
|
||||
result[t1._subpath(fn)] = ((n1, fl1), (n2, fl2))
|
||||
|
||||
for fn, n2 in pycompat.iteritems(t2._files):
|
||||
if fn not in t1._files:
|
||||
fl2 = t2._flags.get(fn, "")
|
||||
result[t2._subpath(fn)] = ((None, ""), (n2, fl2))
|
||||
|
||||
_diff(self, m2)
|
||||
return result
|
||||
|
||||
def unmodifiedsince(self, m2):
|
||||
return not self._dirty and not m2._dirty and self._node == m2._node
|
||||
|
||||
def parse(self, text, readsubtree):
|
||||
for f, n, fl in _parse(text):
|
||||
if fl == "t":
|
||||
f = f + "/"
|
||||
self._dirs[f] = readsubtree(self._subpath(f), n)
|
||||
elif "/" in f:
|
||||
# This is a flat manifest, so use __setitem__ and setflag rather
|
||||
# than assigning directly to _files and _flags, so we can
|
||||
# assign a path in a subdirectory, and to mark dirty (compared
|
||||
# to nullid).
|
||||
self[f] = n
|
||||
if fl:
|
||||
self.setflag(f, fl)
|
||||
else:
|
||||
# Assigning to _files and _flags avoids marking as dirty,
|
||||
# and should be a little faster.
|
||||
self._files[f] = n
|
||||
if fl:
|
||||
self._flags[f] = fl
|
||||
|
||||
def text(self):
|
||||
"""Get the full data of this manifest as a bytestring."""
|
||||
self._load()
|
||||
return _text(self.iterentries())
|
||||
|
||||
def dirtext(self):
|
||||
"""Get the full data of this directory as a bytestring. Make sure that
|
||||
any submanifests have been written first, so their nodeids are correct.
|
||||
"""
|
||||
self._load()
|
||||
flags = self.flags
|
||||
dirs = [(d[:-1], self._dirs[d]._node, "t") for d in self._dirs]
|
||||
files = [(f, self._files[f], flags(f)) for f in self._files]
|
||||
return _text(sorted(dirs + files))
|
||||
|
||||
def read(self, gettext, readsubtree):
|
||||
def _load_for_read(s):
|
||||
s.parse(gettext(), readsubtree)
|
||||
s._dirty = False
|
||||
|
||||
self._loadfunc = _load_for_read
|
||||
|
||||
def writesubtrees(self, m1, m2, writesubtree):
|
||||
self._load() # for consistency; should never have any effect here
|
||||
m1._load()
|
||||
m2._load()
|
||||
emptytree = treemanifest()
|
||||
for d, subm in pycompat.iteritems(self._dirs):
|
||||
subp1 = m1._dirs.get(d, emptytree)._node
|
||||
subp2 = m2._dirs.get(d, emptytree)._node
|
||||
if subp1 == revlog.nullid:
|
||||
subp1, subp2 = subp2, subp1
|
||||
writesubtree(subm, subp1, subp2)
|
||||
|
||||
def walksubtrees(self, matcher=None):
|
||||
"""Returns an iterator of the subtrees of this manifest, including this
|
||||
manifest itself.
|
||||
|
||||
If `matcher` is provided, it only returns subtrees that match.
|
||||
"""
|
||||
if matcher and not matcher.visitdir(self._dir[:-1]):
|
||||
return
|
||||
if not matcher or matcher(self._dir[:-1]):
|
||||
yield self
|
||||
|
||||
self._load()
|
||||
for d, subm in pycompat.iteritems(self._dirs):
|
||||
for subtree in subm.walksubtrees(matcher=matcher):
|
||||
yield subtree
|
||||
|
||||
|
||||
class manifestrevlog(revlog.revlog):
|
||||
"""A revlog that stores manifest texts. This is responsible for caching the
|
||||
full-text manifest contents.
|
||||
@ -1069,23 +608,16 @@ class manifestlog(object):
|
||||
return self._dirmancache[dir][node]
|
||||
|
||||
if dir:
|
||||
if self._revlog._treeondisk:
|
||||
if verify:
|
||||
dirlog = self._revlog.dirlog(dir)
|
||||
if node not in dirlog.nodemap:
|
||||
raise LookupError(node, dirlog.indexfile, _("no node"))
|
||||
m = treemanifestctx(self, dir, node)
|
||||
else:
|
||||
raise error.Abort(
|
||||
_("cannot ask for manifest directory '%s' in a flat " "manifest")
|
||||
% dir
|
||||
)
|
||||
raise error.Abort(
|
||||
_("cannot ask for manifest directory '%s' in a flat " "manifest")
|
||||
% dir
|
||||
)
|
||||
else:
|
||||
if verify:
|
||||
if node not in self._revlog.nodemap:
|
||||
raise LookupError(node, self._revlog.indexfile, _("no node"))
|
||||
if self._treeinmem:
|
||||
m = treemanifestctx(self, "", node)
|
||||
raise error.Abort("legacy upstream treemanifest no longer supported")
|
||||
else:
|
||||
m = manifestctx(self, node)
|
||||
|
||||
@ -1234,126 +766,3 @@ class manifestctx(object):
|
||||
|
||||
def find(self, key):
|
||||
return self.read().find(key)
|
||||
|
||||
|
||||
class memtreemanifestctx(object):
|
||||
def __init__(self, manifestlog, dir=""):
|
||||
self._manifestlog = manifestlog
|
||||
self._dir = dir
|
||||
self._treemanifest = treemanifest()
|
||||
|
||||
def _revlog(self):
|
||||
return self._manifestlog._revlog
|
||||
|
||||
def new(self, dir=""):
|
||||
return memtreemanifestctx(self._manifestlog, dir=dir)
|
||||
|
||||
def copy(self):
|
||||
memmf = memtreemanifestctx(self._manifestlog, dir=self._dir)
|
||||
memmf._treemanifest = self._treemanifest.copy()
|
||||
return memmf
|
||||
|
||||
def read(self):
|
||||
return self._treemanifest
|
||||
|
||||
def write(self, transaction, link, p1, p2, added, removed):
|
||||
def readtree(dir, node):
|
||||
return self._manifestlog.get(dir, node).read()
|
||||
|
||||
return self._revlog().add(
|
||||
self._treemanifest,
|
||||
transaction,
|
||||
link,
|
||||
p1,
|
||||
p2,
|
||||
added,
|
||||
removed,
|
||||
readtree=readtree,
|
||||
)
|
||||
|
||||
|
||||
class treemanifestctx(object):
|
||||
def __init__(self, manifestlog, dir, node):
|
||||
self._manifestlog = manifestlog
|
||||
self._dir = dir
|
||||
self._data = None
|
||||
|
||||
self._node = node
|
||||
|
||||
# TODO: Load p1/p2/linkrev lazily. They need to be lazily loaded so that
|
||||
# we can instantiate treemanifestctx objects for directories we don't
|
||||
# have on disk.
|
||||
# self.p1, self.p2 = revlog.parents(node)
|
||||
# rev = revlog.rev(node)
|
||||
# self.linkrev = revlog.linkrev(rev)
|
||||
|
||||
def _revlog(self):
|
||||
return self._manifestlog._revlog.dirlog(self._dir)
|
||||
|
||||
def read(self):
|
||||
if self._data is None:
|
||||
rl = self._revlog()
|
||||
if self._node == revlog.nullid:
|
||||
self._data = treemanifest()
|
||||
elif rl._treeondisk:
|
||||
m = treemanifest(dir=self._dir)
|
||||
|
||||
def gettext():
|
||||
return rl.revision(self._node)
|
||||
|
||||
def readsubtree(dir, subm):
|
||||
# Set verify to False since we need to be able to create
|
||||
# subtrees for trees that don't exist on disk.
|
||||
return self._manifestlog.get(dir, subm, verify=False).read()
|
||||
|
||||
m.read(gettext, readsubtree)
|
||||
m.setnode(self._node)
|
||||
self._data = m
|
||||
else:
|
||||
text = rl.revision(self._node)
|
||||
arraytext = bytearray(text)
|
||||
rl.fulltextcache[self._node] = arraytext
|
||||
self._data = treemanifest(dir=self._dir, text=text)
|
||||
|
||||
return self._data
|
||||
|
||||
def node(self):
|
||||
return self._node
|
||||
|
||||
def new(self, dir=""):
|
||||
return memtreemanifestctx(self._manifestlog, dir=dir)
|
||||
|
||||
def copy(self):
|
||||
memmf = memtreemanifestctx(self._manifestlog, dir=self._dir)
|
||||
memmf._treemanifest = self.read().copy()
|
||||
return memmf
|
||||
|
||||
@propertycache
|
||||
def parents(self):
|
||||
return self._revlog().parents(self._node)
|
||||
|
||||
def readnew(self, shallow=False):
|
||||
"""Returns the entries that were introduced by this manifest revision.
|
||||
|
||||
If `shallow` is True, it returns only the immediate children in a tree.
|
||||
"""
|
||||
revlog = self._revlog()
|
||||
if shallow:
|
||||
r = revlog.rev(self._node)
|
||||
d = mdiff.patchtext(revlog.revdiff(revlog.parentrevs(r)[0], r))
|
||||
return manifestdict(d)
|
||||
else:
|
||||
# Need to perform a slow delta
|
||||
r0 = revlog.parentrevs(revlog.rev(self._node))[0]
|
||||
m0 = self._manifestlog.get(self._dir, revlog.node(r0)).read()
|
||||
m1 = self.read()
|
||||
md = treemanifest(dir=self._dir)
|
||||
for f, ((n0, fl0), (n1, fl1)) in pycompat.iteritems(m0.diff(m1)):
|
||||
if n1:
|
||||
md[f] = n1
|
||||
if fl1:
|
||||
md.setflag(f, fl1)
|
||||
return md
|
||||
|
||||
def find(self, key):
|
||||
return self.read().find(key)
|
||||
|
@ -1,117 +0,0 @@
|
||||
#chg-compatible
|
||||
|
||||
$ disable treemanifest
|
||||
|
||||
$ . "$TESTDIR/library.sh"
|
||||
|
||||
$ hginit master
|
||||
$ cd master
|
||||
$ echo treemanifest >> .hg/requires
|
||||
$ cat >> .hg/hgrc <<EOF
|
||||
> [remotefilelog]
|
||||
> server=True
|
||||
> EOF
|
||||
# uppercase directory name to test encoding
|
||||
$ mkdir -p A/B
|
||||
$ echo x > A/B/x
|
||||
$ hg commit -qAm x
|
||||
|
||||
$ cd ..
|
||||
|
||||
# shallow clone from full
|
||||
|
||||
$ hgcloneshallow ssh://user@dummy/master shallow --noupdate
|
||||
streaming all changes
|
||||
5 files to transfer, * of data (glob)
|
||||
transferred 449 bytes in * seconds (*/sec) (glob)
|
||||
searching for changes
|
||||
no changes found
|
||||
$ cd shallow
|
||||
$ cat .hg/requires
|
||||
dotencode
|
||||
fncache
|
||||
generaldelta
|
||||
remotefilelog
|
||||
revlogv1
|
||||
store
|
||||
treemanifest
|
||||
treestate
|
||||
$ find .hg/store/meta | sort
|
||||
.hg/store/meta
|
||||
.hg/store/meta/_a
|
||||
.hg/store/meta/_a/00manifest.i
|
||||
.hg/store/meta/_a/_b
|
||||
.hg/store/meta/_a/_b/00manifest.i
|
||||
|
||||
$ hg update
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
1 files fetched over 1 fetches - (1 misses, 0.00% hit ratio) over *s (glob) (?)
|
||||
|
||||
$ cat A/B/x
|
||||
x
|
||||
|
||||
$ echo foo > A/B/F
|
||||
$ hg add A/B/F
|
||||
$ hg ci -m 'local content'
|
||||
|
||||
$ cd ..
|
||||
|
||||
# shallow clone from shallow
|
||||
|
||||
$ hgcloneshallow ssh://user@dummy/shallow shallow2 --noupdate
|
||||
streaming all changes
|
||||
9 files to transfer, * of data (glob)
|
||||
transferred 3.20 KB in * seconds (*/sec) (glob)
|
||||
searching for changes
|
||||
no changes found
|
||||
$ cd shallow2
|
||||
$ cat .hg/requires
|
||||
dotencode
|
||||
fncache
|
||||
generaldelta
|
||||
remotefilelog
|
||||
revlogv1
|
||||
store
|
||||
treemanifest
|
||||
treestate
|
||||
$ [ -d .hg/store/data ]
|
||||
[1]
|
||||
|
||||
$ hg update
|
||||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
|
||||
$ cat A/B/x
|
||||
x
|
||||
|
||||
$ cd ..
|
||||
|
||||
# full clone from shallow
|
||||
# - send stderr to /dev/null because the order of stdout/err causes
|
||||
# flakiness here
|
||||
$ hg clone --noupdate ssh://user@dummy/shallow full 2>err
|
||||
streaming all changes
|
||||
[255]
|
||||
$ grep '^remote' err
|
||||
remote: abort: Cannot clone from a shallow repo to a full repo.
|
||||
|
||||
# getbundle full clone
|
||||
|
||||
$ printf '[server]\npreferuncompressed=False\n' >> master/.hg/hgrc
|
||||
$ hgcloneshallow ssh://user@dummy/master shallow3
|
||||
requesting all changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 0 changes to 0 files
|
||||
updating to branch default
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
|
||||
$ cat shallow3/.hg/requires
|
||||
dotencode
|
||||
fncache
|
||||
generaldelta
|
||||
remotefilelog
|
||||
revlogv1
|
||||
store
|
||||
treemanifest
|
||||
treestate
|
@ -427,22 +427,5 @@ class testmanifestdict(unittest.TestCase, basemanifesttests):
|
||||
return manifestmod.manifestdict(text)
|
||||
|
||||
|
||||
class testtreemanifest(unittest.TestCase, basemanifesttests):
|
||||
def parsemanifest(self, text):
|
||||
return manifestmod.treemanifest("", text)
|
||||
|
||||
def testWalkSubtrees(self):
|
||||
m = self.parsemanifest(A_DEEPER_MANIFEST)
|
||||
|
||||
dirs = [s._dir for s in m.walksubtrees()]
|
||||
self.assertEqual(
|
||||
sorted(["", "a/", "a/c/", "a/d/", "a/b/", "a/b/c/", "a/b/d/"]), sorted(dirs)
|
||||
)
|
||||
|
||||
match = matchmod.match("/", "", ["path:a/b/"])
|
||||
dirs = [s._dir for s in m.walksubtrees(matcher=match)]
|
||||
self.assertEqual(sorted(["a/b/", "a/b/c/", "a/b/d/"]), sorted(dirs))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
silenttestrunner.main(__name__)
|
||||
|
@ -1,867 +0,0 @@
|
||||
#chg-compatible
|
||||
|
||||
$ configure evolution dummyssh
|
||||
$ disable treemanifest
|
||||
#require killdaemons
|
||||
$ setconfig format.usegeneraldelta=yes
|
||||
|
||||
Set up repo
|
||||
|
||||
$ hg --config experimental.treemanifest=True init repo
|
||||
$ cd repo
|
||||
|
||||
Requirements get set on init
|
||||
|
||||
$ grep treemanifest .hg/requires
|
||||
treemanifest
|
||||
|
||||
Without directories, looks like any other repo
|
||||
|
||||
$ echo 0 > a
|
||||
$ echo 0 > b
|
||||
$ hg ci -Aqm initial
|
||||
$ hg debugdata -m 0
|
||||
a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
|
||||
b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
|
||||
|
||||
Submanifest is stored in separate revlog
|
||||
|
||||
$ mkdir dir1
|
||||
$ echo 1 > dir1/a
|
||||
$ echo 1 > dir1/b
|
||||
$ echo 1 > e
|
||||
$ hg ci -Aqm 'add dir1'
|
||||
$ hg debugdata -m 1
|
||||
a\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
|
||||
b\x00362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (esc)
|
||||
dir1\x008b3ffd73f901e83304c83d33132c8e774ceac44et (esc)
|
||||
e\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
|
||||
$ hg debugdata --dir dir1 0
|
||||
a\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
|
||||
b\x00b8e02f6433738021a065f94175c7cd23db5f05be (esc)
|
||||
|
||||
Can add nested directories
|
||||
|
||||
$ mkdir dir1/dir1
|
||||
$ echo 2 > dir1/dir1/a
|
||||
$ echo 2 > dir1/dir1/b
|
||||
$ mkdir dir1/dir2
|
||||
$ echo 2 > dir1/dir2/a
|
||||
$ echo 2 > dir1/dir2/b
|
||||
$ hg ci -Aqm 'add dir1/dir1'
|
||||
$ hg files -r .
|
||||
a
|
||||
b
|
||||
dir1/a
|
||||
dir1/b
|
||||
dir1/dir1/a
|
||||
dir1/dir1/b
|
||||
dir1/dir2/a
|
||||
dir1/dir2/b
|
||||
e
|
||||
|
||||
The manifest command works
|
||||
|
||||
$ hg manifest
|
||||
a
|
||||
b
|
||||
dir1/a
|
||||
dir1/b
|
||||
dir1/dir1/a
|
||||
dir1/dir1/b
|
||||
dir1/dir2/a
|
||||
dir1/dir2/b
|
||||
e
|
||||
|
||||
Revision is not created for unchanged directory
|
||||
|
||||
$ mkdir dir2
|
||||
$ echo 3 > dir2/a
|
||||
$ hg add dir2
|
||||
adding dir2/a
|
||||
$ hg debugindex --dir dir1 > before
|
||||
$ hg ci -qm 'add dir2'
|
||||
$ hg debugindex --dir dir1 > after
|
||||
$ diff before after
|
||||
$ rm before after
|
||||
|
||||
Removing directory does not create an revlog entry
|
||||
|
||||
$ hg rm dir1/dir1
|
||||
removing dir1/dir1/a
|
||||
removing dir1/dir1/b
|
||||
$ hg debugindex --dir dir1/dir1 > before
|
||||
$ hg ci -qm 'remove dir1/dir1'
|
||||
$ hg debugindex --dir dir1/dir1 > after
|
||||
$ diff before after
|
||||
$ rm before after
|
||||
|
||||
Check that hg files (calls treemanifest.walk()) works
|
||||
without loading all directory revlogs
|
||||
|
||||
$ hg co 'desc("add dir2")'
|
||||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ mv .hg/store/meta/dir2 .hg/store/meta/dir2-backup
|
||||
$ hg files -r . dir1
|
||||
dir1/a
|
||||
dir1/b
|
||||
dir1/dir1/a
|
||||
dir1/dir1/b
|
||||
dir1/dir2/a
|
||||
dir1/dir2/b
|
||||
|
||||
Check that status between revisions works (calls treemanifest.matches())
|
||||
without loading all directory revlogs
|
||||
|
||||
$ hg status --rev 'desc("add dir1")' --rev . dir1
|
||||
A dir1/dir1/a
|
||||
A dir1/dir1/b
|
||||
A dir1/dir2/a
|
||||
A dir1/dir2/b
|
||||
$ mv .hg/store/meta/dir2-backup .hg/store/meta/dir2
|
||||
|
||||
Merge creates 2-parent revision of directory revlog
|
||||
|
||||
$ echo 5 > dir1/a
|
||||
$ hg ci -Aqm 'modify dir1/a'
|
||||
$ hg co '.^'
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ echo 6 > dir1/b
|
||||
$ hg ci -Aqm 'modify dir1/b'
|
||||
$ hg merge 'desc("modify dir1/a")'
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
(branch merge, don't forget to commit)
|
||||
$ hg ci -m 'conflict-free merge involving dir1/'
|
||||
$ cat dir1/a
|
||||
5
|
||||
$ cat dir1/b
|
||||
6
|
||||
#if common-zlib
|
||||
$ hg debugindex --dir dir1
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 54 -1 1 8b3ffd73f901 000000000000 000000000000
|
||||
1 54 68 0 2 68e9d057c5a8 8b3ffd73f901 000000000000
|
||||
2 122 12 1 4 4698198d2624 68e9d057c5a8 000000000000
|
||||
3 134 55 1 5 44844058ccce 68e9d057c5a8 000000000000
|
||||
4 189 55 1 6 bf3d9b744927 68e9d057c5a8 000000000000
|
||||
5 244 55 4 7 dde7c0af2a03 bf3d9b744927 44844058ccce
|
||||
#endif
|
||||
|
||||
Merge keeping directory from parent 1 does not create revlog entry. (Note that
|
||||
dir1's manifest does change, but only because dir1/a's filelog changes.)
|
||||
|
||||
$ hg co 'desc("add dir2")'
|
||||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ echo 8 > dir2/a
|
||||
$ hg ci -m 'modify dir2/a'
|
||||
|
||||
$ hg debugindex --dir dir2 > before
|
||||
$ hg merge 'desc("modify dir1/a")'
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
(branch merge, don't forget to commit)
|
||||
$ hg revert -r 'desc("modify dir2/a")' .
|
||||
reverting dir1/a
|
||||
$ hg ci -m 'merge, keeping parent 1'
|
||||
$ hg debugindex --dir dir2 > after
|
||||
$ diff before after
|
||||
$ rm before after
|
||||
|
||||
Merge keeping directory from parent 2 does not create revlog entry. (Note that
|
||||
dir2's manifest does change, but only because dir2/a's filelog changes.)
|
||||
|
||||
$ hg co 'desc("modify dir2/a")'
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ hg debugindex --dir dir1 > before
|
||||
$ hg merge 'desc("modify dir1/a")'
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
(branch merge, don't forget to commit)
|
||||
$ hg revert -r 'desc("modify dir1/a")' .
|
||||
reverting dir2/a
|
||||
$ hg ci -m 'merge, keeping parent 2'
|
||||
$ hg debugindex --dir dir1 > after
|
||||
$ diff before after
|
||||
$ rm before after
|
||||
|
||||
Create flat source repo for tests with mixed flat/tree manifests
|
||||
|
||||
$ cd ..
|
||||
$ hg init repo-flat
|
||||
$ cd repo-flat
|
||||
|
||||
Create a few commits with flat manifest
|
||||
|
||||
$ echo 0 > a
|
||||
$ echo 0 > b
|
||||
$ echo 0 > e
|
||||
$ for d in dir1 dir1/dir1 dir1/dir2 dir2
|
||||
> do
|
||||
> mkdir $d
|
||||
> echo 0 > $d/a
|
||||
> echo 0 > $d/b
|
||||
> done
|
||||
$ hg ci -Aqm initial
|
||||
|
||||
$ echo 1 > a
|
||||
$ echo 1 > dir1/a
|
||||
$ echo 1 > dir1/dir1/a
|
||||
$ hg ci -Aqm 'modify on branch 1'
|
||||
|
||||
$ hg co 0
|
||||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ echo 2 > b
|
||||
$ echo 2 > dir1/b
|
||||
$ echo 2 > dir1/dir1/b
|
||||
$ hg ci -Aqm 'modify on branch 2'
|
||||
|
||||
$ hg merge 1
|
||||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
(branch merge, don't forget to commit)
|
||||
$ hg ci -m 'merge of flat manifests to new flat manifest'
|
||||
|
||||
Create clone with tree manifests enabled
|
||||
|
||||
$ cd ..
|
||||
$ hg clone --config experimental.treemanifest=1 \
|
||||
> ssh://user@dummy/repo-flat repo-mixed -r 1
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 2 changesets with 14 changes to 11 files
|
||||
updating to branch default
|
||||
11 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ cd repo-mixed
|
||||
$ test -d .hg/store/meta
|
||||
[1]
|
||||
$ grep treemanifest .hg/requires
|
||||
treemanifest
|
||||
|
||||
Should be possible to push updates from flat to tree manifest repo
|
||||
|
||||
$ hg -R ../repo-flat push ssh://user@dummy/repo-mixed
|
||||
pushing to ssh://user@dummy/repo-mixed
|
||||
searching for changes
|
||||
remote: adding changesets
|
||||
remote: adding manifests
|
||||
remote: adding file changes
|
||||
remote: added 2 changesets with 3 changes to 3 files
|
||||
|
||||
Commit should store revlog per directory
|
||||
|
||||
$ hg co 1
|
||||
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ echo 3 > a
|
||||
$ echo 3 > dir1/a
|
||||
$ echo 3 > dir1/dir1/a
|
||||
$ hg ci -m 'first tree'
|
||||
$ find .hg/store/meta | sort
|
||||
.hg/store/meta
|
||||
.hg/store/meta/dir1
|
||||
.hg/store/meta/dir1/00manifest.i
|
||||
.hg/store/meta/dir1/dir1
|
||||
.hg/store/meta/dir1/dir1/00manifest.i
|
||||
.hg/store/meta/dir1/dir2
|
||||
.hg/store/meta/dir1/dir2/00manifest.i
|
||||
.hg/store/meta/dir2
|
||||
.hg/store/meta/dir2/00manifest.i
|
||||
|
||||
Merge of two trees
|
||||
|
||||
$ hg co 2
|
||||
6 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ hg merge 1
|
||||
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
(branch merge, don't forget to commit)
|
||||
$ hg ci -m 'merge of flat manifests to new tree manifest'
|
||||
$ hg diff -r 3
|
||||
|
||||
Parent of tree root manifest should be flat manifest, and two for merge
|
||||
|
||||
#if common-zlib
|
||||
$ hg debugindex -m
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 80 -1 0 40536115ed9e 000000000000 000000000000
|
||||
1 80 83 0 1 f3376063c255 40536115ed9e 000000000000
|
||||
2 163 89 0 2 5d9b9da231a2 40536115ed9e 000000000000
|
||||
3 252 83 2 3 d17d663cbd8a 5d9b9da231a2 f3376063c255
|
||||
4 335 124 1 4 51e32a8c60ee f3376063c255 000000000000
|
||||
5 459 126 2 5 cc5baa78b230 5d9b9da231a2 f3376063c255
|
||||
#endif
|
||||
|
||||
Status across flat/tree boundary should work
|
||||
|
||||
$ hg status --rev '.^' --rev .
|
||||
M a
|
||||
M dir1/a
|
||||
M dir1/dir1/a
|
||||
|
||||
|
||||
Turning off treemanifest config has no effect
|
||||
|
||||
#if common-zlib
|
||||
$ hg debugindex --dir dir1
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 127 -1 4 064927a0648a 000000000000 000000000000
|
||||
1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
|
||||
#endif
|
||||
$ echo 2 > dir1/a
|
||||
$ hg --config experimental.treemanifest=False ci -qm 'modify dir1/a'
|
||||
#if common-zlib
|
||||
$ hg debugindex --dir dir1
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 127 -1 4 064927a0648a 000000000000 000000000000
|
||||
1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
|
||||
2 238 55 1 6 5b16163a30c6 25ecb8cb8618 000000000000
|
||||
#endif
|
||||
|
||||
Stripping and recovering changes should work
|
||||
|
||||
$ hg st --change tip
|
||||
M dir1/a
|
||||
$ hg debugstrip tip
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg
|
||||
#if common-zlib
|
||||
$ hg debugindex --dir dir1
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 127 -1 4 064927a0648a 000000000000 000000000000
|
||||
1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
|
||||
#endif
|
||||
$ hg incoming .hg/strip-backup/*
|
||||
comparing with .hg/strip-backup/*-backup.hg (glob)
|
||||
searching for changes
|
||||
changeset: 6:51cfd7b1e13b
|
||||
user: test
|
||||
date: Thu Jan 01 00:00:00 1970 +0000
|
||||
summary: modify dir1/a
|
||||
|
||||
$ hg pull .hg/strip-backup/*
|
||||
pulling from .hg/strip-backup/51cfd7b1e13b-78a2f3ed-backup.hg
|
||||
searching for changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 1 changes to 1 files
|
||||
$ hg debugstrip tip
|
||||
saved backup bundle to $TESTTMP/repo-mixed/.hg/strip-backup/*-backup.hg (glob)
|
||||
$ hg unbundle -q .hg/strip-backup/*
|
||||
#if common-zlib
|
||||
$ hg debugindex --dir dir1
|
||||
rev offset length delta linkrev nodeid p1 p2
|
||||
0 0 127 -1 4 064927a0648a 000000000000 000000000000
|
||||
1 127 111 0 5 25ecb8cb8618 000000000000 000000000000
|
||||
2 238 55 1 6 5b16163a30c6 25ecb8cb8618 000000000000
|
||||
#endif
|
||||
$ hg st --change tip
|
||||
M dir1/a
|
||||
|
||||
Shelving and unshelving should work
|
||||
|
||||
$ echo foo >> dir1/a
|
||||
$ hg --config extensions.shelve= shelve
|
||||
shelved as default
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ hg --config extensions.shelve= unshelve
|
||||
unshelving change 'default'
|
||||
$ hg diff --nodates
|
||||
diff -r 708a273da119 dir1/a
|
||||
--- a/dir1/a
|
||||
+++ b/dir1/a
|
||||
@@ -1,1 +1,2 @@
|
||||
1
|
||||
+foo
|
||||
|
||||
Pushing from treemanifest repo to an empty repo makes that a treemanifest repo
|
||||
|
||||
$ cd ..
|
||||
$ hg init empty-repo
|
||||
$ cat << EOF >> empty-repo/.hg/hgrc
|
||||
> [experimental]
|
||||
> changegroup3=yes
|
||||
> EOF
|
||||
$ grep treemanifest empty-repo/.hg/requires
|
||||
[1]
|
||||
$ hg push -R repo -r 0 empty-repo
|
||||
pushing to empty-repo
|
||||
searching for changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 2 changes to 2 files
|
||||
$ grep treemanifest empty-repo/.hg/requires
|
||||
treemanifest
|
||||
|
||||
Pushing to an empty repo works
|
||||
|
||||
$ hg --config experimental.treemanifest=1 init clone
|
||||
$ grep treemanifest clone/.hg/requires
|
||||
treemanifest
|
||||
$ hg push -R repo clone
|
||||
pushing to clone
|
||||
searching for changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 11 changesets with 15 changes to 10 files
|
||||
$ grep treemanifest clone/.hg/requires
|
||||
treemanifest
|
||||
$ hg -R clone verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
10 files, 11 changesets, 15 total revisions
|
||||
|
||||
Create deeper repo with tree manifests.
|
||||
|
||||
$ hg --config experimental.treemanifest=True init deeprepo
|
||||
$ cd deeprepo
|
||||
|
||||
$ mkdir .A
|
||||
$ mkdir b
|
||||
$ mkdir b/bar
|
||||
$ mkdir b/bar/orange
|
||||
$ mkdir b/bar/orange/fly
|
||||
$ mkdir b/foo
|
||||
$ mkdir b/foo/apple
|
||||
$ mkdir b/foo/apple/bees
|
||||
|
||||
$ touch .A/one.txt
|
||||
$ touch .A/two.txt
|
||||
$ touch b/bar/fruits.txt
|
||||
$ touch b/bar/orange/fly/gnat.py
|
||||
$ touch b/bar/orange/fly/housefly.txt
|
||||
$ touch b/foo/apple/bees/flower.py
|
||||
$ touch c.txt
|
||||
$ touch d.py
|
||||
|
||||
$ hg ci -Aqm 'initial'
|
||||
|
||||
$ echo >> .A/one.txt
|
||||
$ echo >> .A/two.txt
|
||||
$ echo >> b/bar/fruits.txt
|
||||
$ echo >> b/bar/orange/fly/gnat.py
|
||||
$ echo >> b/bar/orange/fly/housefly.txt
|
||||
$ echo >> b/foo/apple/bees/flower.py
|
||||
$ echo >> c.txt
|
||||
$ echo >> d.py
|
||||
$ hg ci -Aqm 'second'
|
||||
|
||||
We'll see that visitdir works by removing some treemanifest revlogs and running
|
||||
the files command with various parameters.
|
||||
|
||||
Test files from the root.
|
||||
|
||||
$ hg files -r .
|
||||
.A/one.txt
|
||||
.A/two.txt
|
||||
b/bar/fruits.txt
|
||||
b/bar/orange/fly/gnat.py
|
||||
b/bar/orange/fly/housefly.txt
|
||||
b/foo/apple/bees/flower.py
|
||||
c.txt
|
||||
d.py
|
||||
|
||||
Excludes with a glob should not exclude everything from the glob's root
|
||||
|
||||
$ hg files -r . -X 'b/fo?' b
|
||||
b/bar/fruits.txt
|
||||
b/bar/orange/fly/gnat.py
|
||||
b/bar/orange/fly/housefly.txt
|
||||
$ cp -R .hg/store .hg/store-copy
|
||||
|
||||
Test files for a subdirectory.
|
||||
|
||||
$ rm -r .hg/store/meta/~2e_a
|
||||
$ hg files -r . b
|
||||
b/bar/fruits.txt
|
||||
b/bar/orange/fly/gnat.py
|
||||
b/bar/orange/fly/housefly.txt
|
||||
b/foo/apple/bees/flower.py
|
||||
$ hg diff -r '.^' -r . --stat b
|
||||
b/bar/fruits.txt | 1 +
|
||||
b/bar/orange/fly/gnat.py | 1 +
|
||||
b/bar/orange/fly/housefly.txt | 1 +
|
||||
b/foo/apple/bees/flower.py | 1 +
|
||||
4 files changed, 4 insertions(+), 0 deletions(-)
|
||||
$ cp -R .hg/store-copy/. .hg/store
|
||||
|
||||
Test files with just includes and excludes.
|
||||
|
||||
$ rm -r .hg/store/meta/~2e_a
|
||||
$ rm -r .hg/store/meta/b/bar/orange/fly
|
||||
$ rm -r .hg/store/meta/b/foo/apple/bees
|
||||
$ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
|
||||
b/bar/fruits.txt
|
||||
$ hg diff -r '.^' -r . --stat -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
|
||||
b/bar/fruits.txt | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
$ cp -R .hg/store-copy/. .hg/store
|
||||
|
||||
Test files for a subdirectory, excluding a directory within it.
|
||||
|
||||
$ rm -r .hg/store/meta/~2e_a
|
||||
$ rm -r .hg/store/meta/b/foo
|
||||
$ hg files -r . -X path:b/foo b
|
||||
b/bar/fruits.txt
|
||||
b/bar/orange/fly/gnat.py
|
||||
b/bar/orange/fly/housefly.txt
|
||||
$ hg diff -r '.^' -r . --stat -X path:b/foo b
|
||||
b/bar/fruits.txt | 1 +
|
||||
b/bar/orange/fly/gnat.py | 1 +
|
||||
b/bar/orange/fly/housefly.txt | 1 +
|
||||
3 files changed, 3 insertions(+), 0 deletions(-)
|
||||
$ cp -R .hg/store-copy/. .hg/store
|
||||
|
||||
Test files for a sub directory, including only a directory within it, and
|
||||
including an unrelated directory.
|
||||
|
||||
$ rm -r .hg/store/meta/~2e_a
|
||||
$ rm -r .hg/store/meta/b/foo
|
||||
$ hg files -r . -I path:b/bar/orange -I path:a b
|
||||
b/bar/orange/fly/gnat.py
|
||||
b/bar/orange/fly/housefly.txt
|
||||
$ hg diff -r '.^' -r . --stat -I path:b/bar/orange -I path:a b
|
||||
b/bar/orange/fly/gnat.py | 1 +
|
||||
b/bar/orange/fly/housefly.txt | 1 +
|
||||
2 files changed, 2 insertions(+), 0 deletions(-)
|
||||
$ cp -R .hg/store-copy/. .hg/store
|
||||
|
||||
Test files for a pattern, including a directory, and excluding a directory
|
||||
within that.
|
||||
|
||||
$ rm -r .hg/store/meta/~2e_a
|
||||
$ rm -r .hg/store/meta/b/foo
|
||||
$ rm -r .hg/store/meta/b/bar/orange
|
||||
$ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange
|
||||
b/bar/fruits.txt
|
||||
$ hg diff -r '.^' -r . --stat glob:**.txt -I path:b/bar -X path:b/bar/orange
|
||||
b/bar/fruits.txt | 1 +
|
||||
1 files changed, 1 insertions(+), 0 deletions(-)
|
||||
$ cp -R .hg/store-copy/. .hg/store
|
||||
|
||||
Test files with an unusual pattern
|
||||
|
||||
$ hg files -r . 'rootfilesin:b/bar'
|
||||
b/bar/fruits.txt
|
||||
|
||||
Add some more changes to the deep repo
|
||||
$ echo narf >> b/bar/fruits.txt
|
||||
$ hg ci -m narf
|
||||
$ echo troz >> b/bar/orange/fly/gnat.py
|
||||
$ hg ci -m troz
|
||||
|
||||
Verify works
|
||||
$ hg verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
|
||||
Dirlogs are included in fncache
|
||||
$ grep meta/.A/00manifest.i .hg/store/fncache
|
||||
meta/.A/00manifest.i
|
||||
|
||||
Rebuilt fncache includes dirlogs
|
||||
$ rm .hg/store/fncache
|
||||
$ hg debugrebuildfncache
|
||||
adding data/.A/one.txt.i
|
||||
adding data/.A/two.txt.i
|
||||
adding data/b/bar/fruits.txt.i
|
||||
adding data/b/bar/orange/fly/gnat.py.i
|
||||
adding data/b/bar/orange/fly/housefly.txt.i
|
||||
adding data/b/foo/apple/bees/flower.py.i
|
||||
adding data/c.txt.i
|
||||
adding data/d.py.i
|
||||
adding meta/.A/00manifest.i
|
||||
adding meta/b/00manifest.i
|
||||
adding meta/b/bar/00manifest.i
|
||||
adding meta/b/bar/orange/00manifest.i
|
||||
adding meta/b/bar/orange/fly/00manifest.i
|
||||
adding meta/b/foo/00manifest.i
|
||||
adding meta/b/foo/apple/00manifest.i
|
||||
adding meta/b/foo/apple/bees/00manifest.i
|
||||
16 items added, 0 removed from fncache
|
||||
|
||||
Back up the recently added revlogs
|
||||
$ cp -R .hg/store .hg/store-newcopy
|
||||
|
||||
Verify reports missing dirlog
|
||||
$ rm .hg/store/meta/b/00manifest.*
|
||||
$ hg verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
0: empty or missing b/
|
||||
b/@0: parent-directory manifest refers to unknown revision 67688a370455
|
||||
b/@1: parent-directory manifest refers to unknown revision f065da70369e
|
||||
b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b
|
||||
b/@3: parent-directory manifest refers to unknown revision 367152e6af28
|
||||
warning: orphan revlog 'meta/b/bar/00manifest.i'
|
||||
warning: orphan revlog 'meta/b/bar/orange/00manifest.i'
|
||||
warning: orphan revlog 'meta/b/bar/orange/fly/00manifest.i'
|
||||
warning: orphan revlog 'meta/b/foo/00manifest.i'
|
||||
warning: orphan revlog 'meta/b/foo/apple/00manifest.i'
|
||||
warning: orphan revlog 'meta/b/foo/apple/bees/00manifest.i'
|
||||
crosschecking files in changesets and manifests
|
||||
b/bar/fruits.txt@0: in changeset but not in manifest
|
||||
b/bar/orange/fly/gnat.py@0: in changeset but not in manifest
|
||||
b/bar/orange/fly/housefly.txt@0: in changeset but not in manifest
|
||||
b/foo/apple/bees/flower.py@0: in changeset but not in manifest
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
6 warnings encountered!
|
||||
9 integrity errors encountered!
|
||||
(first damaged changeset appears to be 0)
|
||||
[1]
|
||||
$ cp -R .hg/store-newcopy/. .hg/store
|
||||
|
||||
Verify reports missing dirlog entry
|
||||
$ mv -f .hg/store-copy/meta/b/00manifest.* .hg/store/meta/b/
|
||||
$ hg verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b
|
||||
b/@3: parent-directory manifest refers to unknown revision 367152e6af28
|
||||
b/bar/@?: rev 2 points to unexpected changeset 2
|
||||
b/bar/@?: 44d7e1146e0d not in parent-directory manifest
|
||||
b/bar/@?: rev 3 points to unexpected changeset 3
|
||||
b/bar/@?: 70b10c6b17b7 not in parent-directory manifest
|
||||
b/bar/orange/@?: rev 2 points to unexpected changeset 3
|
||||
(expected None)
|
||||
b/bar/orange/fly/@?: rev 2 points to unexpected changeset 3
|
||||
(expected None)
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
2 warnings encountered!
|
||||
8 integrity errors encountered!
|
||||
(first damaged changeset appears to be 2)
|
||||
[1]
|
||||
$ cp -R .hg/store-newcopy/. .hg/store
|
||||
|
||||
Test cloning a treemanifest repo over ssh.
|
||||
$ cd ..
|
||||
|
||||
We can clone even with the knob turned off and we'll get a treemanifest repo.
|
||||
$ hg clone --config experimental.treemanifest=False \
|
||||
> --config experimental.changegroup3=True \
|
||||
> ssh://user@dummy/deeprepo deepclone
|
||||
requesting all changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 4 changesets with 18 changes to 8 files
|
||||
updating to branch default
|
||||
8 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
requires got updated to include treemanifest
|
||||
$ cat deepclone/.hg/requires | grep treemanifest
|
||||
treemanifest
|
||||
Tree manifest revlogs exist.
|
||||
$ find deepclone/.hg/store/meta | sort
|
||||
deepclone/.hg/store/meta
|
||||
deepclone/.hg/store/meta/b
|
||||
deepclone/.hg/store/meta/b/00manifest.i
|
||||
deepclone/.hg/store/meta/b/bar
|
||||
deepclone/.hg/store/meta/b/bar/00manifest.i
|
||||
deepclone/.hg/store/meta/b/bar/orange
|
||||
deepclone/.hg/store/meta/b/bar/orange/00manifest.i
|
||||
deepclone/.hg/store/meta/b/bar/orange/fly
|
||||
deepclone/.hg/store/meta/b/bar/orange/fly/00manifest.i
|
||||
deepclone/.hg/store/meta/b/foo
|
||||
deepclone/.hg/store/meta/b/foo/00manifest.i
|
||||
deepclone/.hg/store/meta/b/foo/apple
|
||||
deepclone/.hg/store/meta/b/foo/apple/00manifest.i
|
||||
deepclone/.hg/store/meta/b/foo/apple/bees
|
||||
deepclone/.hg/store/meta/b/foo/apple/bees/00manifest.i
|
||||
deepclone/.hg/store/meta/~2e_a
|
||||
deepclone/.hg/store/meta/~2e_a/00manifest.i
|
||||
Verify passes.
|
||||
$ cd deepclone
|
||||
$ hg verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
$ cd ..
|
||||
|
||||
Create clones using old repo formats to use in later tests
|
||||
$ hg clone --config format.usestore=False \
|
||||
> --config experimental.changegroup3=True \
|
||||
> ssh://user@dummy/deeprepo deeprepo-basicstore
|
||||
requesting all changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 4 changesets with 18 changes to 8 files
|
||||
updating to branch default
|
||||
8 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ cd deeprepo-basicstore
|
||||
$ grep store .hg/requires
|
||||
[1]
|
||||
$ cd ..
|
||||
$ hg clone --config format.usefncache=False \
|
||||
> --config experimental.changegroup3=True \
|
||||
> ssh://user@dummy/deeprepo deeprepo-encodedstore
|
||||
requesting all changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 4 changesets with 18 changes to 8 files
|
||||
updating to branch default
|
||||
8 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ cd deeprepo-encodedstore
|
||||
$ grep fncache .hg/requires
|
||||
[1]
|
||||
$ cd ..
|
||||
|
||||
Local clone with basicstore
|
||||
$ hg clone -U deeprepo-basicstore local-clone-basicstore
|
||||
$ hg -R local-clone-basicstore verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
|
||||
Local clone with encodedstore
|
||||
$ hg clone -U deeprepo-encodedstore local-clone-encodedstore
|
||||
$ hg -R local-clone-encodedstore verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
|
||||
Local clone with fncachestore
|
||||
$ hg clone -U deeprepo local-clone-fncachestore
|
||||
$ hg -R local-clone-fncachestore verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
|
||||
Stream clone with basicstore
|
||||
$ hg clone --config experimental.changegroup3=True --stream -U \
|
||||
> ssh://user@dummy/deeprepo-basicstore stream-clone-basicstore
|
||||
streaming all changes
|
||||
19 files to transfer, * of data (glob)
|
||||
transferred * in * seconds (*) (glob)
|
||||
searching for changes
|
||||
no changes found
|
||||
$ hg -R stream-clone-basicstore verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
|
||||
Stream clone with encodedstore
|
||||
$ hg clone --config experimental.changegroup3=True --stream -U \
|
||||
> ssh://user@dummy/deeprepo-encodedstore stream-clone-encodedstore
|
||||
streaming all changes
|
||||
19 files to transfer, * of data (glob)
|
||||
transferred * in * seconds (*) (glob)
|
||||
searching for changes
|
||||
no changes found
|
||||
$ hg -R stream-clone-encodedstore verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
|
||||
Stream clone with fncachestore
|
||||
$ hg clone --config experimental.changegroup3=True --stream -U \
|
||||
> ssh://user@dummy/deeprepo stream-clone-fncachestore
|
||||
streaming all changes
|
||||
19 files to transfer, * of data (glob)
|
||||
transferred * in * seconds (*) (glob)
|
||||
searching for changes
|
||||
no changes found
|
||||
$ hg -R stream-clone-fncachestore verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
checking directory manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
8 files, 4 changesets, 18 total revisions
|
||||
|
||||
Packed bundle
|
||||
$ hg -R deeprepo debugcreatestreamclonebundle repo-packed.hg
|
||||
writing * bytes for 19 files (glob)
|
||||
bundle requirements: generaldelta, revlogv1, treemanifest
|
||||
$ hg debugbundle --spec repo-packed.hg
|
||||
none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Ctreemanifest
|
||||
|
||||
Bundle with changegroup2 is not supported
|
||||
|
||||
$ hg -R deeprepo bundle --all -t v2 deeprepo.bundle
|
||||
abort: repository does not support bundle version 02
|
||||
[255]
|
||||
|
||||
Pull does not include changegroup for manifest the client already has from
|
||||
other branch
|
||||
|
||||
$ mkdir grafted-dir-repo
|
||||
$ cd grafted-dir-repo
|
||||
$ hg --config experimental.treemanifest=1 init
|
||||
$ mkdir dir
|
||||
$ echo a > dir/file
|
||||
$ echo a > file
|
||||
$ hg ci -Am initial
|
||||
adding dir/file
|
||||
adding file
|
||||
$ echo b > dir/file
|
||||
$ hg ci -m updated
|
||||
$ hg co '.^'
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ hg revert -r tip dir/
|
||||
reverting dir/file
|
||||
$ echo b > file # to make sure root manifest is sent
|
||||
$ hg ci -m grafted
|
||||
$ cd ..
|
||||
|
||||
$ hg --config experimental.treemanifest=1 clone --pull -r 1 \
|
||||
> grafted-dir-repo grafted-dir-repo-clone
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 2 changesets with 3 changes to 2 files
|
||||
updating to branch default
|
||||
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
||||
$ cd grafted-dir-repo-clone
|
||||
$ hg pull -r 2
|
||||
pulling from $TESTTMP/grafted-dir-repo
|
||||
searching for changes
|
||||
adding changesets
|
||||
adding manifests
|
||||
adding file changes
|
||||
added 1 changesets with 1 changes to 1 files
|
||||
|
||||
Committing a empty commit does not duplicate root treemanifest
|
||||
$ echo z >> z
|
||||
$ hg commit -Aqm 'pre-empty commit'
|
||||
$ hg rm z
|
||||
$ hg commit --amend -m 'empty commit'
|
||||
$ hg log -r 'tip + tip^' -T '{manifest}\n'
|
||||
1:678d3574b88c
|
||||
1:678d3574b88c
|
||||
$ hg debugstrip -r . -q
|
||||
|
||||
Shelve works with treemanifest
|
||||
$ echo ababagalamaga >> file
|
||||
$ hg shelve --config extensions.shelve= --config experimental.evolution=createmarkers
|
||||
shelved as default
|
||||
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
Loading…
Reference in New Issue
Block a user