Submitter | Yuya Nishihara |
---|---|
Date | March 16, 2015, 2:04 p.m. |
Message ID | <3e97838d4eaa3f4f5131.1426514671@mimosa> |
Download | mbox | patch |
Permalink | /patch/8093/ |
State | Changes Requested |
Headers | show |
Comments
On Mon, 2015-03-16 at 23:04 +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara <yuya@tcha.org> > # Date 1408247327 -32400 > # Sun Aug 17 12:48:47 2014 +0900 > # Node ID 3e97838d4eaa3f4f5131f1f1997ead72acc81aad > # Parent 193f5a309da2beea925fd22a6e039bb2dcee7a81 > localrepo: add "wc" symbol to specify workingctx by command (BC) I really like where this is going... but introducing more syntax...? > Pros and cons: > > "wc" symbol: > - is easy to type > - can be used as a first-class symbol to specify wctx by string > (would avoid problems such as caff3675cba5) > "wc()" function: > - has no behavior change Big contra: it is short enough to conflict with existing bookmarks, tags, or revset aliases the user has defined. Smaller contra: "wc" means "toilet" or "bathroom" in several European languages. Since "." is used for p1, how about making "./" refer to your proposed "wc"? This does not conflict with existing syntax, is short, and I believe cannot be the name of a revset alias. It also looks like "current directory" in Unix-speak. It can, however, be a bookmark name or a tag. I think it's unlikely enough for this to have happened with "./", though.
On Mon, 16 Mar 2015 10:50:08 -0400, Jordi Gutiérrez Hermoso wrote: > On Mon, 2015-03-16 at 23:04 +0900, Yuya Nishihara wrote: > > # HG changeset patch > > # User Yuya Nishihara <yuya@tcha.org> > > # Date 1408247327 -32400 > > # Sun Aug 17 12:48:47 2014 +0900 > > # Node ID 3e97838d4eaa3f4f5131f1f1997ead72acc81aad > > # Parent 193f5a309da2beea925fd22a6e039bb2dcee7a81 > > localrepo: add "wc" symbol to specify workingctx by command (BC) > > I really like where this is going... but introducing more syntax...? > > > Pros and cons: > > > > "wc" symbol: > > - is easy to type > > - can be used as a first-class symbol to specify wctx by string > > (would avoid problems such as caff3675cba5) > > "wc()" function: > > - has no behavior change > > Big contra: it is short enough to conflict with existing bookmarks, > tags, or revset aliases the user has defined. Smaller contra: "wc" > means "toilet" or "bathroom" in several European languages. And in Japanese, yes, it means toilet. I just picked "wc" from subrepo.py. Other possible words: wdir, wdir(), workingdir(), ... > Since "." is used for p1, how about making "./" refer to your proposed > "wc"? This does not conflict with existing syntax, is short, and I > believe cannot be the name of a revset alias. It also looks like > "current directory" in Unix-speak. "./" sounds too magical for me. It doesn't look like a single symbol. Regards,
On Tue, Mar 17, 2015 at 12:16:49AM +0900, Yuya Nishihara wrote: > On Mon, 16 Mar 2015 10:50:08 -0400, Jordi Gutiérrez Hermoso wrote: > > On Mon, 2015-03-16 at 23:04 +0900, Yuya Nishihara wrote: > > > # HG changeset patch > > > # User Yuya Nishihara <yuya@tcha.org> > > > # Date 1408247327 -32400 > > > # Sun Aug 17 12:48:47 2014 +0900 > > > # Node ID 3e97838d4eaa3f4f5131f1f1997ead72acc81aad > > > # Parent 193f5a309da2beea925fd22a6e039bb2dcee7a81 > > > localrepo: add "wc" symbol to specify workingctx by command (BC) > > > > I really like where this is going... but introducing more syntax...? > > > > > Pros and cons: > > > > > > "wc" symbol: > > > - is easy to type > > > - can be used as a first-class symbol to specify wctx by string > > > (would avoid problems such as caff3675cba5) > > > "wc()" function: > > > - has no behavior change > > > > Big contra: it is short enough to conflict with existing bookmarks, > > tags, or revset aliases the user has defined. Smaller contra: "wc" > > means "toilet" or "bathroom" in several European languages. > > And in Japanese, yes, it means toilet. I just picked "wc" from subrepo.py. > Other possible words: wdir, wdir(), workingdir(), ... > > > Since "." is used for p1, how about making "./" refer to your proposed > > "wc"? This does not conflict with existing syntax, is short, and I > > believe cannot be the name of a revset alias. It also looks like > > "current directory" in Unix-speak. > > "./" sounds too magical for me. It doesn't look like a single symbol. Agreed. Also, in filesystems . and ./ mean the same thing, so that'd be confusing too. > > Regards, > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On Mon, 2015-03-16 at 13:29 -0400, Augie Fackler wrote: > On Tue, Mar 17, 2015 at 12:16:49AM +0900, Yuya Nishihara wrote: > > On Mon, 16 Mar 2015 10:50:08 -0400, Jordi Gutiérrez Hermoso wrote: > > > On Mon, 2015-03-16 at 23:04 +0900, Yuya Nishihara wrote: > > > > # HG changeset patch > > > > # User Yuya Nishihara <yuya@tcha.org> > > > > # Date 1408247327 -32400 > > > > # Sun Aug 17 12:48:47 2014 +0900 > > > > # Node ID 3e97838d4eaa3f4f5131f1f1997ead72acc81aad > > > > # Parent 193f5a309da2beea925fd22a6e039bb2dcee7a81 > > > > localrepo: add "wc" symbol to specify workingctx by command (BC) > > > > > > I really like where this is going... but introducing more syntax...? > > > > > > > Pros and cons: > > > > > > > > "wc" symbol: > > > > - is easy to type > > > > - can be used as a first-class symbol to specify wctx by string > > > > (would avoid problems such as caff3675cba5) > > > > "wc()" function: > > > > - has no behavior change > > > > > > Big contra: it is short enough to conflict with existing bookmarks, > > > tags, or revset aliases the user has defined. Smaller contra: "wc" > > > means "toilet" or "bathroom" in several European languages. > > > > And in Japanese, yes, it means toilet. I just picked "wc" from subrepo.py. > > Other possible words: wdir, wdir(), workingdir(), ... > > > > > Since "." is used for p1, how about making "./" refer to your proposed > > > "wc"? This does not conflict with existing syntax, is short, and I > > > believe cannot be the name of a revset alias. It also looks like > > > "current directory" in Unix-speak. > > > > "./" sounds too magical for me. It doesn't look like a single symbol. > > Agreed. Also, in filesystems . and ./ mean the same thing, so that'd > be confusing too. We had actually planned to use '@' for this, but somehow ended up using it to mean a) '.' in graphlog b) default bookmark. Sad. Anyway, I think the term we should standardize on is "working directory". It doesn't have any other unfortunate uses, it's what in "hg help glossary" and it's also the most common in our messages: $ hgrep "working copy" | grep ui hgext/convert/subversion.py: ui.status(_('initializing svn working copy %r\n') mercurial/cmdutil.py: ui.warn(_('%s: deleted in working copy\n') % relsrc) mercurial/commands.py: ui.status(_("(run 'hg update' to get a working copy)\n")) $ hgrep "working directory" | grep ui hgext/extdiff.py: ui.note(_('making snapshot of %d files from working directory\n') % hgext/mq.py: self.ui.status(_("(working directory not at a head)\n")) hgext/mq.py: self.ui.warn(_('cleaning up working directory...')) hgext/mq.py: ui.warn(_('warning: uncommitted changes in the working directory\n')) hgext/patchbomb.py: ui.warn(_('warning: working directory has ' hgext/rebase.py: ui.status(_('nothing to rebase - working directory ' hgext/rebase.py: ui.note(_("update back to initial working directory parent\n")) mercurial/commands.py: ui.status(_('reset working directory to branch %s\n') % label) mercurial/commands.py: ui.status(_('marked working directory as branch %s\n') % label) mercurial/commands.py: - generate a build identifier for the working directory:: mercurial/context.py: building a new manifest if self (working directory) is not comparing mercurial/hg.py: r.ui.status(_("updating working directory\n")) mercurial/localrepo.py: ui.status(_('working directory now based on ' mercurial/localrepo.py: ui.status(_('working directory now based on ' mercurial/patch.py: """use builtin patch to apply <patchobj> to the working directory.
On Mar 16, 2015, at 3:09 PM, Matt Mackall <mpm@selenic.com> wrote: > On Mon, 2015-03-16 at 13:29 -0400, Augie Fackler wrote: >> On Tue, Mar 17, 2015 at 12:16:49AM +0900, Yuya Nishihara wrote: >>> On Mon, 16 Mar 2015 10:50:08 -0400, Jordi Gutiérrez Hermoso wrote: >>>> On Mon, 2015-03-16 at 23:04 +0900, Yuya Nishihara wrote: >>>>> # HG changeset patch >>>>> # User Yuya Nishihara <yuya@tcha.org> >>>>> # Date 1408247327 -32400 >>>>> # Sun Aug 17 12:48:47 2014 +0900 >>>>> # Node ID 3e97838d4eaa3f4f5131f1f1997ead72acc81aad >>>>> # Parent 193f5a309da2beea925fd22a6e039bb2dcee7a81 >>>>> localrepo: add "wc" symbol to specify workingctx by command (BC) >>>> >>>> I really like where this is going... but introducing more syntax...? >>>> >>>>> Pros and cons: >>>>> >>>>> "wc" symbol: >>>>> - is easy to type >>>>> - can be used as a first-class symbol to specify wctx by string >>>>> (would avoid problems such as caff3675cba5) >>>>> "wc()" function: >>>>> - has no behavior change >>>> >>>> Big contra: it is short enough to conflict with existing bookmarks, >>>> tags, or revset aliases the user has defined. Smaller contra: "wc" >>>> means "toilet" or "bathroom" in several European languages. >>> >>> And in Japanese, yes, it means toilet. I just picked "wc" from subrepo.py. >>> Other possible words: wdir, wdir(), workingdir(), ... >>> >>>> Since "." is used for p1, how about making "./" refer to your proposed >>>> "wc"? This does not conflict with existing syntax, is short, and I >>>> believe cannot be the name of a revset alias. It also looks like >>>> "current directory" in Unix-speak. >>> >>> "./" sounds too magical for me. It doesn't look like a single symbol. >> >> Agreed. Also, in filesystems . and ./ mean the same thing, so that'd >> be confusing too. > > We had actually planned to use '@' for this, but somehow ended up using > it to mean a) '.' in graphlog b) default bookmark. Sad. > > Anyway, I think the term we should standardize on is "working > directory". It doesn't have any other unfortunate uses, it's what in "hg > help glossary" and it's also the most common in our messages: > > $ hgrep "working copy" | grep ui > hgext/convert/subversion.py: ui.status(_('initializing svn working copy %r\n') > mercurial/cmdutil.py: ui.warn(_('%s: deleted in working copy\n') % relsrc) > mercurial/commands.py: ui.status(_("(run 'hg update' to get a working copy)\n")) +1 to working directory. I probably introduced the two working copy cases that aren't talking about svn, because that's svn jargon. Are both of these cases fair game to change to working directory? The second one looks like it's in a hint, so that seems okay. > > $ hgrep "working directory" | grep ui > hgext/extdiff.py: ui.note(_('making snapshot of %d files from working directory\n') % > hgext/mq.py: self.ui.status(_("(working directory not at a head)\n")) > hgext/mq.py: self.ui.warn(_('cleaning up working directory...')) > hgext/mq.py: ui.warn(_('warning: uncommitted changes in the working directory\n')) > hgext/patchbomb.py: ui.warn(_('warning: working directory has ' > hgext/rebase.py: ui.status(_('nothing to rebase - working directory ' > hgext/rebase.py: ui.note(_("update back to initial working directory parent\n")) > mercurial/commands.py: ui.status(_('reset working directory to branch %s\n') % label) > mercurial/commands.py: ui.status(_('marked working directory as branch %s\n') % label) > mercurial/commands.py: - generate a build identifier for the working directory:: > mercurial/context.py: building a new manifest if self (working directory) is not comparing > mercurial/hg.py: r.ui.status(_("updating working directory\n")) > mercurial/localrepo.py: ui.status(_('working directory now based on ' > mercurial/localrepo.py: ui.status(_('working directory now based on ' > mercurial/patch.py: """use builtin patch to apply <patchobj> to the working directory. > > -- > Mathematics is the supreme nostalgia of our time.
On Mon, 2015-03-16 at 15:24 -0400, Augie Fackler wrote: > > $ hgrep "working copy" | grep ui > > hgext/convert/subversion.py: ui.status(_('initializing svn working copy %r\n') > > mercurial/cmdutil.py: ui.warn(_('%s: deleted in working copy\n') % relsrc) > > mercurial/commands.py: ui.status(_("(run 'hg update' to get a working copy)\n")) > > +1 to working directory. I probably introduced the two working copy cases that aren't talking about svn, because that's svn jargon. > > Are both of these cases fair game to change to working directory? The second one looks like it's in a hint, so that seems okay. Yep.
Patch
diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -366,7 +366,7 @@ class changelog(revlog.revlog): branch = extra.get("branch") if branch in ("default", ""): del extra["branch"] - elif branch in (".", "null", "tip"): + elif branch in (".", "null", "tip", "wc"): raise error.RevlogError(_('the name \'%s\' is reserved') % branch) if extra: diff --git a/mercurial/help/revisions.txt b/mercurial/help/revisions.txt --- a/mercurial/help/revisions.txt +++ b/mercurial/help/revisions.txt @@ -27,3 +27,6 @@ The reserved name "." indicates the work working directory is checked out, it is equivalent to null. If an uncommitted merge is in progress, "." is the revision of the first parent. + +The reserved name "wc" indicates the files in the working directory, that +will be recorded in the next commit. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -455,7 +455,7 @@ class localrepository(object): return dirstate.dirstate(self.vfs, self.ui, self.root, validate) def __getitem__(self, changeid): - if changeid is None: + if changeid is None or changeid == 'wc': return context.workingctx(self) if isinstance(changeid, slice): return [context.changectx(self, i) diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -107,7 +107,7 @@ def nochangesfound(ui, repo, excluded=No def checknewlabel(repo, lbl, kind): # Do not use the "kind" parameter in ui output. # It makes strings difficult to translate. - if lbl in ['tip', '.', 'null']: + if lbl in ['tip', '.', 'null', 'wc']: raise util.Abort(_("the name '%s' is reserved") % lbl) for c in (':', '\0', '\n', '\r'): if c in lbl: diff --git a/tests/test-branches.t b/tests/test-branches.t --- a/tests/test-branches.t +++ b/tests/test-branches.t @@ -56,6 +56,9 @@ reserved names $ hg branch . abort: the name '.' is reserved [255] + $ hg branch wc + abort: the name 'wc' is reserved + [255] invalid characters diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -892,6 +892,9 @@ Test a help topic The reserved name "." indicates the working directory parent. If no working directory is checked out, it is equivalent to null. If an uncommitted merge is in progress, "." is the revision of the first parent. + + The reserved name "wc" indicates the files in the working directory, that + will be recorded in the next commit. Test templating help @@ -2223,6 +2226,10 @@ Dish up an empty repo; serve it cold. uncommitted merge is in progress, "." is the revision of the first parent. </p> + <p> + The reserved name "wc" indicates the files in the working directory, that + will be recorded in the next commit. + </p> </div> </div> diff --git a/tests/test-status.t b/tests/test-status.t --- a/tests/test-status.t +++ b/tests/test-status.t @@ -240,6 +240,17 @@ Check 'status -q' and some combinations $ rm deleted $ hg copy modified copied +Specify working directory revision explicitly, that should be the same as +"hg status" + + $ hg status --change wc + M modified + A added + A copied + R removed + ! deleted + ? unknown + Run status with 2 different flags. Check if result is the same or different. If result is not as expected, raise error diff --git a/tests/test-tag.t b/tests/test-tag.t --- a/tests/test-tag.t +++ b/tests/test-tag.t @@ -53,6 +53,9 @@ specified) $ hg tag null abort: the name 'null' is reserved [255] + $ hg tag wc + abort: the name 'wc' is reserved + [255] $ hg tag "bleah" abort: tag 'bleah' already exists (use -f to force) [255]