[PATCH 3 of 8] match: add the abs() method
Matt Mackall
mpm at selenic.com
Wed Dec 24 12:54:36 CST 2014
On Tue, 2014-12-23 at 19:55 -0500, Matt Harbison wrote:
> On Tue, 23 Dec 2014 17:01:25 -0500, Matt Mackall <mpm at selenic.com> wrote:
>
> > On Tue, 2014-12-23 at 15:56 -0500, Matt Harbison wrote:
> >> # HG changeset patch
> >> # User Matt Harbison <matt_harbison at yahoo.com>
> >> # Date 1417223746 18000
> >> # Fri Nov 28 20:15:46 2014 -0500
> >> # Node ID aa5998c14c5c8407869cc728e41940130e390ba3
> >> # Parent 04de3b9ae56e98740c83ee342b68d735b7e9ec73
> >> match: add the abs() method
> >>
> >> This is a utility to make it easier for subrepos to convert a file name
> >> to the
> >> full path rooted at the top repository. It can replace the various
> >> path joining
> >> lambdas, and doesn't require the prefix to be passed into the method
> >> that wishes
> >> to build such a path. It will also allow making the manner in which
> >> absolute
> >> subrepo paths are displayed on Windows consistent with the way absolute
> >> repo
> >> paths are- i.e. with '/' as the separator, instead of the current mix
> >> of '\'
> >> and '/'.
> >
> > This is not ideal. First, we _really_ need to stop using os methods in
> > core code, especially in furtherance of anything related to Windows:
> >
> > http://mercurial.selenic.com/wiki/WindowsUTF8Plan
> >
> > Second, the matcher currently doesn't use os at all, which should be an
> > alarm bell: it's intentionally completely OS-agnostic at present. This
> > is important because it's used against both working copy and in-history
> > paths.
> >
> > I like the idea of this abs() method, but trying to solve cross-OS slash
> > issues at the same time as you introduce it is tying a very heavy boat
> > anchor to it.
> >
> > Also, queuebot sends its regards.
> >
>
> I cooked up something that uses vfs, but there is a new import cycle with
> match -> scmutil -> match. Obviously it isn't desirable, but I don't know
> if it is acceptable. We can probably move most of the match wrapper
> methods to the match module (e.g. matchandpats(), etc). But
> scmutil.expandpats() also uses a match module method, and I'm not sure it
> fits in the match module.
>
> Thoughts?
I think you should just use naive prefix + "/" + path internal to match
and use util.localpath for display purposes.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list