[PATCH 1 of 3 RFC V3] revset: add wdir() function to specify workingctx revision by command
Matt Mackall
mpm at selenic.com
Mon Mar 23 14:52:19 CDT 2015
On Fri, 2015-03-20 at 20:11 -0400, Matt Harbison wrote:
> On Fri, 20 Mar 2015 10:11:53 -0400, Yuya Nishihara <yuya at tcha.org> wrote:
>
> > On Thu, 19 Mar 2015 23:43:46 -0400, Matt Harbison wrote:
> >> On Thu, 19 Mar 2015 12:23:12 -0400, Yuya Nishihara <yuya at tcha.org>
> >> wrote:
> >> > # HG changeset patch
> >> > # User Yuya Nishihara <yuya at tcha.org>
> >> > # Date 1408164256 -32400
> >> > # Sat Aug 16 13:44:16 2014 +0900
> >> > # Node ID ac80716bb799448df0181f5a3169b7242bdf8400
> >> > # Parent 5cb459dc32d209653a3e5d77749cf989ab9a51e4
> >> > revset: add wdir() function to specify workingctx revision by command
> >>
> >> I like this. I've wanted to see the uncommitted changes in the thg file
> >> history more than once.
> >>
> >> > List of commands that will potentially support workingctx revision:
> >> >
> >> > command default remarks
> >> > -------- -------
> >> > -----------------------------------------------------
> >> > annotate p1 useful
> >> > archive p1 might be useful
> >>
> >> Could be useful on Windows to get a tree copy that excludes the .hg dir,
> >> and/or in the non zip formats without a 3rd party utility being
> >> installed.
> >>
> >> > cat p1 might be useful on Windows (no cat)
> >> > diff p1:wdir (default)
> >> > export p1 might be useful if wctx can have draft commit
> >> > message
> >> > files wdir (default)
> >> > grep tip:0 might be useful
> >>
> >> Useful on Windows (built in 'find' is not nearly as useful).
> >>
> >> > identify wdir (default)
> >> > locate wdir (default)
> >> > log tip:0 might be useful with -p or -G option
> >> > parents wdir (default)
> >> > status wdir (default)
> >>
> >> Based on this table, largefiles will need some fixes to support archive
> >> and cat (assuming annotate, diff, export and grep aren't useful on a
> >> largefile), but that doesn't look too complicated.
> >
> > Good point.
> >
> >> Not a blocker to adding this revset, but do you have any thoughts on how
> >> to get the workingctx in a subrepo? (Consider something like 'hg cat -r
> >> wdir() subrepo/file.txt'.)
> >
> > I don't have good idea. changectx could have a different function that
> > returns
> > a subrepo at ctx.subrev(), but only workingctx needs such distinction.
> >
> > ctx.wsub(path) -> subrepo at substate[1]
> > wctx.wsub(path) -> subrepo at None
>
> I'll give this a try. I was really hoping to hide it inside
> subrepo.subrepo(), but this might be an easier transition.
>
> >> I wish there was a 1 char symbol too, but 'wdir()' seems fine to me
> >> given
> >> how scarce they are. Is '_' the only symbol left (that won't cause
> >> shell
> >> problems)?
> >
> > I've proposed a nullary operator '+' before, but it's too magical.
>
> FWIW, it doesn't seem magical to me. It seems fairly reasonable given
> that 'hg identify' prints a '+' when there are changes to the working
> directory.
It'd be great.. if "+" wasn't already a revset operator. As it is, I
don't see any sane way to use it. Consider the revset "++.-@^%" and tell
me if you really want to go there.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list