>>>>> "stevel" == Stephen Lau <stevel at sun.com> writes:

Mike> I wonder if symbolic links or lofs paths could give you
Mike> problems.  Test case: the user specifies "/home/kupfer/ws/foo", which
Mike> is really a symbolic link to /net/somehost/export/kupfer/ws/foo.  We
Mike> want this to work on both somehost and on other hosts.  Note that
Mike> localrepo.root is generated using os.path.realpath().

stevel> I *think* that should work; I tried a couple of symlink tests
stevel> (though not with the /net automounter)... it requires it to be
stevel> run out of the root of the repository though, so as long as
stevel> you're in it - it should just work.

Since findunref is not documented, I guess it's only important that
findunref work when invoked by nightly.  I've partially worked through
an example, and I still don't trust the code.  Maybe I just don't
understand the subrepo logic.  (Or maybe my lack of Python experience is
showing.)

Suppose my environment file has CODEMGR_WS="/home/kupfer/ws/6570962",
and that /home/kupfer/ws/6570962 is a symbolic link to where the
workspace actually lives.  (This is typical of how I set up my
workspaces.)  This means that findunref will get invoked with
"/home/kupfer/ws/6570962/usr/src/../.." for the open tree and
"/home/kupfer/ws/6570962/usr/src/../closed" for the closed tree.

In walk_scm_hg, repo.root, which uses os.path.realpath, will be
'/net/athyra/export/kupfer/6570962' for the open tree and
'/net/athyra/export/kupfer/6570962/usr/closed' for the closed tree.

ws, which comes from os.path.abspath, will be 
'/home/kupfer/ws/6570962' for the open tree and
'/home/kupfer/ws/6570962/usr/closed' for the closed tree.

So for both the open and closed trees, repo.root != ws, and we'll enter
the subrepo logic.

For the open tree, prefix will end up '//', and subrepo will end up
'/home/kupfer/ws/6570962/' (ws.replace(prefix, ...) is a no-op).
subtree will be '/home/kupfer/ws/6570962/usr/src'.

For the closed tree, prefix will also end up '//', subrepo will end up
'/home/kupfer/ws/6570962/usr/closed/', and subtree will end up
'/home/kupfer/ws/6570962/usr/closed/'.

Please check my logic: am I misunderstanding what will happen in
walk_scm_hg?  It seems awfully convoluted.  Also, this code seems to
imply that the paths in "files" are relative to the workspace root:

files = repo.changectx(None).manifest().keys()
if subtree:
        files = filter(lambda x: x.startswith(subtree), files)

But subtree has turned into an absolute path.  How can this work?

More generally, what situation is the subrepo logic supposed to be
handling?

Everything else looks okay.

mike

Reply via email to