[PATCH 3 of 8] Add filesystem path to dirstate.statwalk return value

Paul Moore p.f.moore at gmail.com
Wed May 7 16:57:36 CDT 2008


2008/5/1 Matt Mackall <mpm at selenic.com>:
>  Guess what? I've always thought this pattern of passing a ton of
>  arguments and getting back a ton of results was horrible, so I've been
>  working on changing it. This pattern now looks like this in my repo:
>
>  m = cmdutil.match(repo, pats, opts)
>  for abs in repo.walk(m):
>     if m.exact(abs):
>     ...
>
>  ..so I'm afraid this is an untimely step in the wrong direction.

If I follow this example, repo.walk returns pathnames, and it's these
that are likely in some cases to need to be converted to the
filesystem case on case-folding systems. Assuming that's right, what
sort of paths are involved? Specifically:

- are they always relative pathnames, relative to the repo root?
- can they be absolute paths referring to files under the repo root?
- can they be arbitrary user-supplied pathnames?
- can they be relative pathnames, relative to the cwd rather than to
the repo root?

The reason I ask is that I'm reworking my fspath function, and I want
to know what constraints I can require on the argument (handling
absolute pathnames is messier than relative-only, and handling
arbitrary pathnames harder still; handling relative paths where we're
not sure what they are relative to is of course impossible :-))

Paul.


More information about the Mercurial-devel mailing list