Re: [PATCH 3 of 5] extdata: add basic caching
On Fri, Sep 23, 2016 at 3:23 PM, Pierre-Yves David < pierre-yves.da...@ens-lyon.org> wrote: > > > On 09/22/2016 08:21 PM, Matt Mackall wrote: > >> # HG changeset patch >> # User Matt Mackall>> # Date 1474294391 18000 >> # Mon Sep 19 09:13:11 2016 -0500 >> # Node ID 133b35066bef5d9c31d13c4f0b2e4a50d1ceae87 >> # Parent 9c8847df32a0c5045e60aded2e03a9c97507f909 >> extdata: add basic caching >> >> Sources used for log templating will be queried for every changeset >> printed. So we need a cache. We attach the cache to the repo object to >> give it a bounded lifetime. >> >> diff -r 9c8847df32a0 -r 133b35066bef mercurial/scmutil.py >> --- a/mercurial/scmutil.py Mon Sep 19 09:05:00 2016 -0500 >> +++ b/mercurial/scmutil.py Mon Sep 19 09:13:11 2016 -0500 >> @@ -1453,6 +1453,14 @@ >> raise error.Abort(_("extdata doesn't support parameters yet"), >>hint=_("use double % for escaping")) >> >> +# we cache external data sources for the lifetime of a repo object >> +# users like log templates may consult a data source very frequently >> +if not util.safehasattr(repo, "_extdatacache"): >> +repo._extdatacache = {} >> +cache = repo._extdatacache >> +if spec in cache: >> +return cache[spec] >> + >> > > While caching is obviously necessary, repo-life caching is likely to > provide bogus result with long lived process like chg or the command > server. We probably needs more aggressive invalidation. What about caching > the data for each "commands" as a start. > > (that cache question is vast, because in some case we probably want to > have a very strong caching with on disk version, but that is adventure for > another castle imho) > > We definitely need a more robust caching mechanism because this definitely breaks hgweb, which uses hg.cachedlocalrepo to represent cached repos between HTTP requests and currently only knows to invalidate if {changelog, phaseroots, obsstore, bookmarks} files change. In the current state of this patch, a repo._extdatacache entry will persist for the lifetime of a hgweb process until the repo is written to. That could be hours. At the very least you'll probably want to teach cachedlocalrepo.fetch() to clear repo._extdatacache. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: update test expectation on stable
On 09/23/2016 08:41 PM, Augie Fackler wrote: # HG changeset patch # User Augie Fackler# Date 1474655835 14400 # Fri Sep 23 14:37:15 2016 -0400 # Branch stable # Node ID 10239d136214ae5581f9122514b3004682a6d771 # Parent e7766022a61a66a7c4218526b647f96bd442a4ce py3: update test expectation on stable Pushed, thanks. We really should get a buildbot for this. -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V2] templates: add built-in files() function
On Fri, 23 Sep 2016 14:35:32 +, Hannes Oldenburg wrote: > # HG changeset patch > # User Hannes Oldenburg> # Date 1474618505 0 > # Fri Sep 23 08:15:05 2016 + > # Node ID 5be94ae732b1391c0d0a06fe898d3c4eae69cb38 > # Parent 5271ae66615207f39cc41d78f4541bc6f8ca6ff6 > templates: add built-in files() function > --- a/mercurial/templater.py Wed Sep 21 17:05:27 2016 -0400 > +++ b/mercurial/templater.py Fri Sep 23 08:15:05 2016 + > @@ -699,6 +699,20 @@ > tzoffset = util.makedate()[1] > return (date[0], tzoffset) > > +@templatefunc('files(pattern)') > +def files(context, mapping, args): > +"""All files of the current changeset matching the pattern. See > +:hg:`help patterns`.""" Nit: template functions are sorted alphabetically. > +if not len(args) == 1: > +# i18n: "revset" is a keyword s/revset/files/ > +raise error.ParseError(_("files expects one argument")) > + > +raw = evalstring(context, mapping, args[0]) > +ctx = mapping['ctx'] > +m = ctx.match(raw) match() expects a list of patterns. It should be [raw]. > --- a/tests/test-command-template.t Wed Sep 21 17:05:27 2016 -0400 > +++ b/tests/test-command-template.t Fri Sep 23 08:15:05 2016 + > @@ -3501,6 +3501,18 @@ >5:13207e5a10d9fd28ec424934298e176197f2c67f, >4:bbe44766e73d5f11ed2177f1838de10c53ef3e74 > > +Test files function > + > + $ hg log -T "{rev}\n{join(files('*'), '\n')}\n" > + 2 > + a > + aa > + b > + 1 > + a > + 0 > + a Can you add tests to catch the bug in this patch? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] revset: add topo.revsonly argument for topo sort
On 09/24/2016 12:28 AM, Xidorn Quan wrote: On Sat, Sep 24, 2016, at 08:16 AM, Pierre-Yves David wrote: On 09/24/2016 12:10 AM, Xidorn Quan wrote: On Sat, Sep 24, 2016, at 08:07 AM, Pierre-Yves David wrote: On 09/24/2016 12:01 AM, Xidorn Quan wrote: On Sat, Sep 24, 2016, at 05:47 AM, Pierre-Yves David wrote: On 09/23/2016 03:26 PM, Xidorn Quan wrote: # HG changeset patch # User Xidorn Quan# Date 1474636628 -36000 # Fri Sep 23 23:17:08 2016 +1000 # Node ID 9e8aeaf3bf6e61b351a738f5cadbbf4815f3 # Parent 285a8c3e53f2183438f0cdbc238e4ab851d0d110 revset: add topo.revsonly argument for topo sort This argument is used when we want an order which is not affected by revisions other than given ones. It helps the next patch (rebase in topo order) to keep sensible order when multiple separate revisions are specified. I do not understand why this is necessary. How is the current code misbehaving in your case? I did this for fixing "Test multiple root handling" in test-rebase-obsolete.t. But rejudging that testcase, it seems to me I probably should not do this, but instead, just update the result of that test with my second patch. What is the failure about? Please see the latest patch I sent to the list. Can you explain that change to me ? (and then add this explanation in the commit description) That test is trying to rebase three different commits 7+11+9 on to 4. None of them are directly connected, but 11 is a descendant of 7. With the old behavior, the three commits would be rebased in 7,9,11 order, and after my change, 7 and 11 would be grouped together, so the order would be 9,7,11. I thought that all three commits would become immediate children of 4 given they are not connected, and we should use revision order rather than topo order for separate subgraph. But it seems I was wrong. After the rebase, rebased 7 and 11 are still in the same branch, which means they really should be grouped together. Okay, thanks for the explanation, It makes a lot of sense and I'm happy that asking the question helped to clarify the situation I appreciate your enthousiasm to get this improved (and this is definitely valuable to do so), but please avoid sending new version of the patch when the previous one is still discussed. This get confusing on the reviewers side. Oops, sorry about that. Nothing too terrible either. Can you send a V4 with a small explanation about this change to an existing tests in the changeset description ? Please also update the first line of the description to contains "(BC)" (to flag the small behavior change) and "(issue5370)" (to automatically close your issue on the tracker. Cheers, -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 5] extdata: add basic template support
On 09/22/2016 08:21 PM, Matt Mackall wrote: # HG changeset patch # User Matt Mackall# Date 1474294560 18000 # Mon Sep 19 09:16:00 2016 -0500 # Node ID 6db1b2e7d19ed317404c1275db46780d40ececb8 # Parent 133b35066bef5d9c31d13c4f0b2e4a50d1ceae87 extdata: add basic template support This lets us expose the per-entry "freeform data". I guess the same feedback apply here. Maybe we should go for a single generic template name (with argument) and let user create alias if they really needs to. What do you think? Again, the registrar framework isn't a good fit I think the registrar framework is mostly intended for extensions. Where the module is loaded for sure and adding new template/revset requires to access with the internal data structure. diff -r 133b35066bef -r 6db1b2e7d19e mercurial/templater.py --- a/mercurial/templater.pyMon Sep 19 09:13:11 2016 -0500 +++ b/mercurial/templater.pyMon Sep 19 09:16:00 2016 -0500 @@ -19,6 +19,7 @@ parser, registrar, revset as revsetmod, +scmutil, templatefilters, templatekw, util, @@ -352,6 +353,13 @@ try: v = context.process(key, safemapping) except TemplateNotFound: +# check for extdata last +if 'ctx' in mapping: +ctx = mapping['ctx'] Could we use 'get' here: ctx = mapping.get('ctx') if ctx is not None: Cheers, -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 5] extdata: add basic caching
On 09/22/2016 08:21 PM, Matt Mackall wrote: # HG changeset patch # User Matt Mackall# Date 1474294391 18000 # Mon Sep 19 09:13:11 2016 -0500 # Node ID 133b35066bef5d9c31d13c4f0b2e4a50d1ceae87 # Parent 9c8847df32a0c5045e60aded2e03a9c97507f909 extdata: add basic caching Sources used for log templating will be queried for every changeset printed. So we need a cache. We attach the cache to the repo object to give it a bounded lifetime. diff -r 9c8847df32a0 -r 133b35066bef mercurial/scmutil.py --- a/mercurial/scmutil.py Mon Sep 19 09:05:00 2016 -0500 +++ b/mercurial/scmutil.py Mon Sep 19 09:13:11 2016 -0500 @@ -1453,6 +1453,14 @@ raise error.Abort(_("extdata doesn't support parameters yet"), hint=_("use double % for escaping")) +# we cache external data sources for the lifetime of a repo object +# users like log templates may consult a data source very frequently +if not util.safehasattr(repo, "_extdatacache"): +repo._extdatacache = {} +cache = repo._extdatacache +if spec in cache: +return cache[spec] + While caching is obviously necessary, repo-life caching is likely to provide bogus result with long lived process like chg or the command server. We probably needs more aggressive invalidation. What about caching the data for each "commands" as a start. (that cache question is vast, because in some case we probably want to have a very strong caching with on disk version, but that is adventure for another castle imho) Cheers, -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 5] extdata: add revset support for extdata
On 09/23/2016 07:34 PM, Matt Mackall wrote: On Fri, 2016-09-23 at 19:49 +0900, FUJIWARA Katsunori wrote: At Thu, 22 Sep 2016 13:21:36 -0500, Matt Mackall wrote: # HG changeset patch # User Matt Mackall# Date 1474293900 18000 # Mon Sep 19 09:05:00 2016 -0500 # Node ID 9c8847df32a0c5045e60aded2e03a9c97507f909 # Parent 19bf2776dfe39befdc479253e1e7d030b41c08f9 extdata: add revset support for extdata This inserts extdata into the revset function support. Planned extensions of extdata support arguments, so this is the most appropriate place for it. Unfortunately, the registrar framework is not a good fit here. First, setting an appropriate load point is still an unsolved problem (we want the code to live in revset.py, but that module may never be loaded). Second, registered methods become global and the data sources are likely to be repo-specific. This won't work well in a context like hgwebdir. Is there any reason not to define extdata() revset predicate (or template function), which requires external data source name like as extdata('filedata') ? (for convenience ?) It's mostly convenience. But I also plan to add support for arguments. I think I really like foozy idea about using a generic 'extdata("key")' predicate. That will probably be okay for many case and prevent unexpected collision with other revsets. If needed, the user can easily define a revset alias for the sources in needs easy access to. As configuration of the source is needed anyway, this does seems like a bearable burden. If I remember correctly, it does not seems to have limitation in the current implementation of revset that would prevent use to do 'extdata("key", arg1, arg2)' -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] revset: add topo.revsonly argument for topo sort
On Sat, Sep 24, 2016, at 08:07 AM, Pierre-Yves David wrote: > On 09/24/2016 12:01 AM, Xidorn Quan wrote: > > On Sat, Sep 24, 2016, at 05:47 AM, Pierre-Yves David wrote: > >> On 09/23/2016 03:26 PM, Xidorn Quan wrote: > >>> # HG changeset patch > >>> # User Xidorn Quan> >>> # Date 1474636628 -36000 > >>> # Fri Sep 23 23:17:08 2016 +1000 > >>> # Node ID 9e8aeaf3bf6e61b351a738f5cadbbf4815f3 > >>> # Parent 285a8c3e53f2183438f0cdbc238e4ab851d0d110 > >>> revset: add topo.revsonly argument for topo sort > >>> > >>> This argument is used when we want an order which is not affected by > >>> revisions other than given ones. It helps the next patch (rebase in > >>> topo order) to keep sensible order when multiple separate revisions > >>> are specified. > >> > >> I do not understand why this is necessary. How is the current code > >> misbehaving in your case? > > > > I did this for fixing "Test multiple root handling" in > > test-rebase-obsolete.t. But rejudging that testcase, it seems to me I > > probably should not do this, but instead, just update the result of that > > test with my second patch. > > What is the failure about? Please see the latest patch I sent to the list. - Xidorn ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH v3] rebase: rebase changesets in topo order (issue5370) (BC)
# HG changeset patch # User Xidorn Quan# Date 1474095776 -36000 # Sat Sep 17 17:02:56 2016 +1000 # Node ID de707994f27b9046bb91d7463967eb9300fdc765 # Parent 285a8c3e53f2183438f0cdbc238e4ab851d0d110 rebase: rebase changesets in topo order (issue5370) (BC) There are two reasons that rebase should be done this way: 1. This would make rebasing faster because it would minimize the total number of files to be checked out in the process, as it don't need to switch back and forth between branches. 2. It makes resolving conflicts easier as user has a better context. diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -330,17 +330,17 @@ class rebaseruntime(object): inclusive=True) # Keep track of the current bookmarks in order to reset them later self.currentbookmarks = repo._bookmarks.copy() self.activebookmark = self.activebookmark or repo._activebookmark if self.activebookmark: bookmarks.deactivate(repo) -sortedrevs = sorted(self.state) +sortedrevs = repo.revs('sort(%ld, -topo)', self.state) cands = [k for k, v in self.state.iteritems() if v == revtodo] total = len(cands) pos = 0 for rev in sortedrevs: ctx = repo[rev] desc = '%d:%s "%s"' % (ctx.rev(), ctx, ctx.description().split('\n', 1)[0]) names = repo.nodetags(ctx.node()) + repo.nodebookmarks(ctx.node()) diff --git a/tests/test-rebase-obsolete.t b/tests/test-rebase-obsolete.t --- a/tests/test-rebase-obsolete.t +++ b/tests/test-rebase-obsolete.t @@ -413,26 +413,26 @@ Test that rewriting leaving instability o 0:cd010b8cd998 A Test multiple root handling $ hg rebase --dest 4 --rev '7+11+9' + rebasing 9:cf44d2f5a9f4 "D" rebasing 7:02de42196ebe "H" - rebasing 9:cf44d2f5a9f4 "D" not rebasing ignored 10:7c6027df6a99 "B" rebasing 11:0d8f238b634c "C" (tip) $ hg log -G o 14:1e8370e38cca C | - | o 13:102b4c1d889b D - | | - @ | 12:bfe264faf697 H + @ 13:bfe264faf697 H + | + | o 12:102b4c1d889b D |/ | o 10:7c6027df6a99 B | | | x 7:02de42196ebe H | | +---o 6:eea13746799a G | |/ | o 5:24b6387c8c8c F diff --git a/tests/test-rebase-scenario-global.t b/tests/test-rebase-scenario-global.t --- a/tests/test-rebase-scenario-global.t +++ b/tests/test-rebase-scenario-global.t @@ -756,16 +756,79 @@ Test that rebase is not confused by $CWD $ touch subfile $ hg add subfile $ hg commit -m 'second source with subdir' $ hg rebase -b . -d 1 --traceback rebasing 2:779a07b1b7a0 "first source commit" rebasing 3:a7d6f3a00bf3 "second source with subdir" (tip) saved backup bundle to $TESTTMP/cwd-vanish/.hg/strip-backup/779a07b1b7a0-853e0073-backup.hg (glob) +Test that rebase is done in topo order (issue5370) + + $ cd .. + $ hg init order + $ cd order + $ touch a && hg add a && hg ci -m A + $ touch b && hg add b && hg ci -m B + $ touch c && hg add c && hg ci -m C + $ hg up 1 + 0 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ touch d && hg add d && hg ci -m D + created new head + $ hg up 2 + 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ touch e && hg add e && hg ci -m E + $ hg up 3 + 1 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ touch f && hg add f && hg ci -m F + $ hg up 0 + 0 files updated, 0 files merged, 3 files removed, 0 files unresolved + $ touch g && hg add g && hg ci -m G + created new head + + $ hg tglog + @ 6: 'G' + | + | o 5: 'F' + | | + | | o 4: 'E' + | | | + | o | 3: 'D' + | | | + | | o 2: 'C' + | |/ + | o 1: 'B' + |/ + o 0: 'A' + + + $ hg rebase -s 1 -d 6 + rebasing 1:76035bbd54bd "B" + rebasing 2:d84f5cfaaf14 "C" + rebasing 4:82ae8dc7a9b7 "E" + rebasing 3:ab709c9f7171 "D" + rebasing 5:412b391de760 "F" + saved backup bundle to $TESTTMP/cwd-vanish/order/.hg/strip-backup/76035bbd54bd-e341bc99-backup.hg (glob) + + $ hg tglog + o 6: 'F' + | + o 5: 'D' + | + | o 4: 'E' + | | + | o 3: 'C' + |/ + o 2: 'B' + | + @ 1: 'G' + | + o 0: 'A' + + Test experimental revset $ cd .. Make the repo a bit more interresting $ hg up 1 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] revset: add topo.revsonly argument for topo sort
On 09/24/2016 12:01 AM, Xidorn Quan wrote: On Sat, Sep 24, 2016, at 05:47 AM, Pierre-Yves David wrote: On 09/23/2016 03:26 PM, Xidorn Quan wrote: # HG changeset patch # User Xidorn Quan# Date 1474636628 -36000 # Fri Sep 23 23:17:08 2016 +1000 # Node ID 9e8aeaf3bf6e61b351a738f5cadbbf4815f3 # Parent 285a8c3e53f2183438f0cdbc238e4ab851d0d110 revset: add topo.revsonly argument for topo sort This argument is used when we want an order which is not affected by revisions other than given ones. It helps the next patch (rebase in topo order) to keep sensible order when multiple separate revisions are specified. I do not understand why this is necessary. How is the current code misbehaving in your case? I did this for fixing "Test multiple root handling" in test-rebase-obsolete.t. But rejudging that testcase, it seems to me I probably should not do this, but instead, just update the result of that test with my second patch. What is the failure about? -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] revset: add topo.revsonly argument for topo sort
On Sat, Sep 24, 2016, at 05:47 AM, Pierre-Yves David wrote: > On 09/23/2016 03:26 PM, Xidorn Quan wrote: > > # HG changeset patch > > # User Xidorn Quan> > # Date 1474636628 -36000 > > # Fri Sep 23 23:17:08 2016 +1000 > > # Node ID 9e8aeaf3bf6e61b351a738f5cadbbf4815f3 > > # Parent 285a8c3e53f2183438f0cdbc238e4ab851d0d110 > > revset: add topo.revsonly argument for topo sort > > > > This argument is used when we want an order which is not affected by > > revisions other than given ones. It helps the next patch (rebase in > > topo order) to keep sensible order when multiple separate revisions > > are specified. > > I do not understand why this is necessary. How is the current code > misbehaving in your case? I did this for fixing "Test multiple root handling" in test-rebase-obsolete.t. But rejudging that testcase, it seems to me I probably should not do this, but instead, just update the result of that test with my second patch. - Xidorn ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: news from the topic experiment
On 09/23/2016 06:08 PM, Long Vu wrote: On Fri, Sep 23, 2016 at 11:50 AM, Long Vuwrote: I emulate git lightweight branching by basically using named branch with evolve and working on the fork of the "master" repo. We only enable evolve and non-publishing on the fork repo to make sure we can not alter history on the master repo where the releases are coming from. You could enable evolution on the main (publishing) repository. It will allow people pushing changeset on the non-publishing one to get proper obs-markers when they directly pull from the publishing one. We have one bug/feature per branch on the fork repo so it's very easy to manage when we have many concurrent bugs/projects to juggle. From your explanation in the previous email. It sounds like you are using named-branch in a way close to what topic would provide you. Maybe you should try topic for a bit and tell use how it feels. Since we push often to this fork repo, it's like having backup of the work on our machine and taking last minute day off is easy because the other person have all the latest code to continue the work without having to hunt where we store that ongoing work on our machine. I'm happy to see people using evolution for some of its intended usage ☺ Cheers, -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] revset: add topo.revsonly argument for topo sort
On 09/23/2016 03:26 PM, Xidorn Quan wrote: # HG changeset patch # User Xidorn Quan# Date 1474636628 -36000 # Fri Sep 23 23:17:08 2016 +1000 # Node ID 9e8aeaf3bf6e61b351a738f5cadbbf4815f3 # Parent 285a8c3e53f2183438f0cdbc238e4ab851d0d110 revset: add topo.revsonly argument for topo sort This argument is used when we want an order which is not affected by revisions other than given ones. It helps the next patch (rebase in topo order) to keep sensible order when multiple separate revisions are specified. I do not understand why this is necessary. How is the current code misbehaving in your case? -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@30006: 13 new changesets
13 new changesets in mercurial: http://selenic.com/repo/hg//rev/0c40e64d6154 changeset: 29994:0c40e64d6154 user:FUJIWARA Katsunoridate:Thu Sep 22 21:51:56 2016 +0900 summary: scmutil: factor out common logic of delayclosedfile to reuse it http://selenic.com/repo/hg//rev/57830bd0e787 changeset: 29995:57830bd0e787 user:FUJIWARA Katsunori date:Thu Sep 22 21:51:57 2016 +0900 summary: scmutil: add file object wrapper class to check ambiguity at closing http://selenic.com/repo/hg//rev/9766d88c2465 changeset: 29996:9766d88c2465 user:FUJIWARA Katsunori date:Thu Sep 22 21:51:57 2016 +0900 summary: vfs: use checkambigatclosing in checkambig=True but atomictemp=False case http://selenic.com/repo/hg//rev/b5e5ddf48bd2 changeset: 29997:b5e5ddf48bd2 user:FUJIWARA Katsunori date:Thu Sep 22 21:51:58 2016 +0900 summary: revlog: specify checkambig at writing to avoid file stat ambiguity http://selenic.com/repo/hg//rev/14ad8e2a4abe changeset: 29998:14ad8e2a4abe user:FUJIWARA Katsunori date:Thu Sep 22 21:51:58 2016 +0900 summary: manifest: specify checkambig=True to revlog.__init__, to avoid ambiguity http://selenic.com/repo/hg//rev/003c41edc5f5 changeset: 2:003c41edc5f5 user:FUJIWARA Katsunori date:Thu Sep 22 21:51:59 2016 +0900 summary: changelog: specify checkambig=True to avoid ambiguity around truncation http://selenic.com/repo/hg//rev/557454ce854a changeset: 3:557454ce854a user:FUJIWARA Katsunori date:Thu Sep 22 21:51:59 2016 +0900 summary: changelog: specify checkambig=True to revlog.__init__, to avoid ambiguity http://selenic.com/repo/hg//rev/e38d85be978f changeset: 30001:e38d85be978f user:FUJIWARA Katsunori date:Thu Sep 22 21:52:00 2016 +0900 summary: repair: open a file with checkambig=True to avoid file stat ambiguity http://selenic.com/repo/hg//rev/599912a62ff6 changeset: 30002:599912a62ff6 user:FUJIWARA Katsunori date:Thu Sep 22 21:52:00 2016 +0900 summary: transaction: open a file with checkambig=True to avoid file stat ambiguity http://selenic.com/repo/hg//rev/46825334f270 changeset: 30003:46825334f270 user:Yuya Nishihara date:Thu Sep 22 20:53:53 2016 +0900 summary: graphlog: preserve topo sort even if additional filter options specified http://selenic.com/repo/hg//rev/5aaa3d6b7e92 changeset: 30004:5aaa3d6b7e92 user:Yuya Nishihara date:Thu Sep 22 20:59:24 2016 +0900 summary: log: drop outdated optimization to walk revisions in reverse order http://selenic.com/repo/hg//rev/dfd97e60044c changeset: 30005:dfd97e60044c user:Arun Kulshreshtha date:Thu Sep 22 12:19:48 2016 -0700 summary: dispatch: change indentation level in _dispatch() http://selenic.com/repo/hg//rev/b19c2679289c changeset: 30006:b19c2679289c bookmark:@ tag: tip user:Arun Kulshreshtha date:Thu Sep 22 12:36:30 2016 -0700 summary: dispatch: make hg --profile wrap reposetup -- Repository URL: http://selenic.com/repo/hg/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] py3: update test expectation on stable
# HG changeset patch # User Augie Fackler# Date 1474655835 14400 # Fri Sep 23 14:37:15 2016 -0400 # Branch stable # Node ID 10239d136214ae5581f9122514b3004682a6d771 # Parent e7766022a61a66a7c4218526b647f96bd442a4ce py3: update test expectation on stable diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -137,6 +137,7 @@ mercurial/pathutil.py: error importing: '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) mercurial/peer.py: error importing: '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) mercurial/pure/mpatch.py: error importing module: 'VendorImporter' object has no attribute 'find_spec' (line *) (glob) + mercurial/pure/osutil.py: error importing module: 'VendorImporter' object has no attribute 'find_spec' (line *) (glob) mercurial/pure/parsers.py: error importing module: 'VendorImporter' object has no attribute 'find_spec' (line *) (glob) mercurial/pushkey.py: error importing: '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) mercurial/pvec.py: error importing: '_fields_' must be a sequence of (name, C type) pairs (error at osutil.py:*) (glob) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 5] extdata: add extdatasource reader
On Thu, Sep 22, 2016 at 06:20:03PM -0500, Kevin Bullock wrote: > > On Sep 22, 2016, at 13:21, Matt Mackallwrote: > > > > # HG changeset patch > > # User Matt Mackall > > # Date 1473794045 18000 > > # Tue Sep 13 14:14:05 2016 -0500 > > # Node ID 19bf2776dfe39befdc479253e1e7d030b41c08f9 > > # Parent 5271ae66615207f39cc41d78f4541bc6f8ca6ff6 > > extdata: add extdatasource reader > > [...] > > +""" > > + > > +spec = repo.ui.config("extdata", source) > > +if not spec: > > +raise util.Abourt(_("unknown extdata source '%s'") % source) > > Typo here. I suppose there's no great way to test against this. Actually something like pytype or mypy should let us catch stuff like this. I want to carve out some time to try and find a way to get one of those tools running on our code regularly. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH stable] grep: rewrite help to better document current (confusing) behavior
On Fri, Sep 23, 2016 at 12:46:01PM -0500, Kevin Bullock wrote: > # HG changeset patch > # User Kevin Bullock> # Date 1474652710 18000 > # Fri Sep 23 12:45:10 2016 -0500 > # Branch stable > # Node ID 081544f94cd76301a5d678b96f57baa2a1544df1 > # Parent e7766022a61a66a7c4218526b647f96bd442a4ce > grep: rewrite help to better document current (confusing) behavior Queued per both my review and Jordi's review on IRC. Thanks. > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -4288,20 +4288,23 @@ def _dograft(ui, repo, *revs, **opts): > _('[OPTION]... PATTERN [FILE]...'), > inferrepo=True) > def grep(ui, repo, pattern, *pats, **opts): > -"""search for a pattern in specified files and revisions > - > -Search revisions of files for a regular expression. > - > -This command behaves differently than Unix grep. It only accepts > -Python/Perl regexps. It searches repository history, not the > -working directory. It always prints the revision number in which a > -match appears. > - > -By default, grep only prints output for the first revision of a > +"""search revision history for a pattern in specified files > + > +Search revision history for a regular expression in the specified > +files or the entire project. > + > +By default, grep prints the most recent revision number for each > file in which it finds a match. To get it to print every revision > -that contains a change in match status ("-" for a match that > -becomes a non-match, or "+" for a non-match that becomes a match), > -use the --all flag. > +that contains a change in match status ("-" for a match that becomes > +a non-match, or "+" for a non-match that becomes a match), use the > +--all flag. > + > +PATTERN can be any Python (roughly Perl-compatible) regular > +expression. > + > +If no FILEs are specified (and -f/--follow isn't set), all files in > +the repository are searched, including those that don't exist in the > +current branch or have been deleted in a prior changeset. > > Returns 0 if a match is found, 1 otherwise. > """ > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 5] extdata: add extdatasource reader
> On Sep 23, 2016, at 12:47, Matt Mackallwrote: > > On Thu, 2016-09-22 at 18:20 -0500, Kevin Bullock wrote: >>> >>> On Sep 22, 2016, at 13:21, Matt Mackall wrote: [...] >>> +try: >>> +src = util.popen(cmd) >> Erm, don't we want to use util.popen2 or one of the other variants that use >> subprocess instead? > > The universal advantages of subprocess are overstated. For the simple task of > reading stdout from a subprocess, util.popen is perfectly suited. If it > wasn't.. > we'd fix util.popen. Related to my reply below: if we use popen, does stderr not get captured? I.e. will the user see the stderr output in their terminal? >> ...and maybe handle ENOENT gracefully? > > We can't, because cmd is an arbitrary shell expression. I mean that it would be nice to inform a user somehow that their arbitrary shell expression failed and what the error was (ENOENT meaning "command not found" in this case). pacem in terris / мир / शान्ति / سَلاَم / 平和 Kevin R. Bullock ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 5] extdata: add extdatasource reader
On Thu, 2016-09-22 at 18:20 -0500, Kevin Bullock wrote: > > > > On Sep 22, 2016, at 13:21, Matt Mackallwrote: > > > > # HG changeset patch > > # User Matt Mackall > > # Date 1473794045 18000 > > # Tue Sep 13 14:14:05 2016 -0500 > > # Node ID 19bf2776dfe39befdc479253e1e7d030b41c08f9 > > # Parent 5271ae66615207f39cc41d78f4541bc6f8ca6ff6 > > extdata: add extdatasource reader > > > > This adds basic support for extdata, a way to add external data > > sources for revsets and templates. An extdata data source is simply a > > list of lines of the form: > > > > []\n > > > > An extdata source is configured thusly: > > > > [extdata] > > name = > > > > urls of the form shell: are launch shell commands to generate data. > > > > diff -r 5271ae666152 -r 19bf2776dfe3 mercurial/scmutil.py > > --- a/mercurial/scmutil.py Wed Sep 21 17:05:27 2016 -0400 > > +++ b/mercurial/scmutil.py Tue Sep 13 14:14:05 2016 -0500 > > @@ -29,6 +29,7 @@ > > phases, > > revset, > > similar, > > +url, > > util, > > ) > > > > @@ -1418,3 +1419,66 @@ > > return > > > > self._queue.put(fh, block=True, timeout=None) > > + > > +def extdatasources(repo): > > +sources = set() > > +for k, v in repo.ui.configitems("extdata"): > > +sources.add(k) > > +return sources > > + > > +def extdatasource(repo, source): > > +"""gather a map of rev -> value dict from the specified source > > + > > +A source spec is treated as a URL, with a special case shell: type > > +for parsing the output from a shell command. > > + > > +The data is parsed as a series of newline-separated records where > > +each record is a revision specifier optionally followed by a space > > +and a freeform string value. If the revision is known locally, it > > +is converted to a rev, otherwise the record is skipped. > > + > > +Note that both key and value are treated as UTF-8 and converted to > > +the local encoding. This allows uniformity between local and > > +remote data sources. > That's a bit unfortunate. If we're expecting them to be read as UTF-8, can't > we just keep them in UTF-8 all the way thru? We always work internally in the local encoding. Sane local encodings include: utf-8. We've normally got two strategies: files owned by users and stored in local encoding (hgrc) and files owned by Mercurial and stored in utf-8 (bookmarks). So this note is to point out that this is different from the usual case.. because URLs might (or might not) be remote, shared resources that need to be in utf-8 for portability. > > > > +""" > > + > > +spec = repo.ui.config("extdata", source) > > +if not spec: > > +raise util.Abourt(_("unknown extdata source '%s'") % source) > Typo here. I suppose there's no great way to test against this. Indeed, both of the current callers prevent this code from being reached. > > > > + > > +try: > > +# prepare for future expansion > > +expand = spec % () > > +except TypeError: > > +raise error.Abort(_("extdata doesn't support parameters yet"), > > + hint=_("use double % for escaping")) > > + > > +data = {} > > +if spec.startswith("shell:"): > > +# external commands should be run relative to the repo root > > +cmd = spec[6:] > > +cwd = os.getcwd() > > +os.chdir(repo.root) > > +try: > > +src = util.popen(cmd) > Erm, don't we want to use util.popen2 or one of the other variants that use > subprocess instead? The universal advantages of subprocess are overstated. For the simple task of reading stdout from a subprocess, util.popen is perfectly suited. If it wasn't.. we'd fix util.popen. > ...and maybe handle ENOENT gracefully? We can't, because cmd is an arbitrary shell expression. > pacem in terris / мир / शान्ति / سَلاَم / 平和 > Kevin R. Bullock -- Mathematics is the supreme nostalgia of our time. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH stable] grep: rewrite help to better document current (confusing) behavior
# HG changeset patch # User Kevin Bullock# Date 1474652710 18000 # Fri Sep 23 12:45:10 2016 -0500 # Branch stable # Node ID 081544f94cd76301a5d678b96f57baa2a1544df1 # Parent e7766022a61a66a7c4218526b647f96bd442a4ce grep: rewrite help to better document current (confusing) behavior diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4288,20 +4288,23 @@ def _dograft(ui, repo, *revs, **opts): _('[OPTION]... PATTERN [FILE]...'), inferrepo=True) def grep(ui, repo, pattern, *pats, **opts): -"""search for a pattern in specified files and revisions - -Search revisions of files for a regular expression. - -This command behaves differently than Unix grep. It only accepts -Python/Perl regexps. It searches repository history, not the -working directory. It always prints the revision number in which a -match appears. - -By default, grep only prints output for the first revision of a +"""search revision history for a pattern in specified files + +Search revision history for a regular expression in the specified +files or the entire project. + +By default, grep prints the most recent revision number for each file in which it finds a match. To get it to print every revision -that contains a change in match status ("-" for a match that -becomes a non-match, or "+" for a non-match that becomes a match), -use the --all flag. +that contains a change in match status ("-" for a match that becomes +a non-match, or "+" for a non-match that becomes a match), use the +--all flag. + +PATTERN can be any Python (roughly Perl-compatible) regular +expression. + +If no FILEs are specified (and -f/--follow isn't set), all files in +the repository are searched, including those that don't exist in the +current branch or have been deleted in a prior changeset. Returns 0 if a match is found, 1 otherwise. """ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: news from the topic experiment
On Wed, Sep 14, 2016 at 3:14 PM, Pierre-Yves Davidwrote: > > https://www.mercurial-scm.org/repo/topic-experiment/ > Sorry for jumping late to the discussion. I am a very happy Evolve user and so far I manage to basically replicate the lightweight branching of git with just evolve. Just sharing my experience in case it sparks other ideas. I emulate git lightweight branching by basically using named branch with evolve and working on the fork of the "master" repo. Disclaimer: we are only 2 using this workflow so far to collaborate so we probably not hitting any rough edge yet. user1: hg branch, modify code, hg commit, hg commit ... push to the fork repo user2: pull update to that branch, more commits, push to the fork repo user1: pull, evolve --all, more commits, push to the fork repo rince and repeat for both users until the bug/feature is complete when ready to "release": hg rebase -d default -s roots(branchname), push to master repo This way: * only the fork repo is polluted with all the temporary branches and intermediate revisions * hg log -r 'branch(name)' gives me all the commits of that branch, a feature that is harder to replicate with bookmarks * in that "temporary branch that only exist on the fork repo" we can do all kind of surgery (fold, split, rebase, evolve, prune, ...) and all history is kept until the project is over and is all tracked with the branch name: hg log -r 'branch(name)' --hidden I feel like this even gives me more than just git lightweight branching as I have full old history all neatly organized in the "temporary branch" and I can "push changes to the other user's checkout via evolve" the features that native git lightweight branching do not even provide. So very happy camper so far. -- Long Vu | Build Controller | Intelerad | +1-514-931-6222 ext. 7743 -- This email or any attachments may contain confidential or legally privileged information intended for the sole use of the addressees. Any use, redistribution, disclosure, or reproduction of this information, except as intended, is prohibited. If you received this email in error, please notify the sender and remove all copies of the message, including any attachments. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@29993: 4 new changesets
4 new changesets in mercurial: http://selenic.com/repo/hg//rev/266c2195651e changeset: 29990:266c2195651e user:Anton Shestakovdate:Thu Sep 22 13:18:59 2016 +0800 summary: paper: remove unused templates http://selenic.com/repo/hg//rev/a816857b88b9 changeset: 29991:a816857b88b9 user:Anton Shestakov date:Thu Sep 22 13:19:25 2016 +0800 summary: gitweb: remove unused templates http://selenic.com/repo/hg//rev/9ed9b12d150c changeset: 29992:9ed9b12d150c user:Anton Shestakov date:Thu Sep 22 13:19:44 2016 +0800 summary: monoblue: remove unused templates http://selenic.com/repo/hg//rev/041a77a223ca changeset: 29993:041a77a223ca bookmark:@ tag: tip user:Anton Shestakov date:Thu Sep 22 13:20:06 2016 +0800 summary: spartan: remove unused templates -- Repository URL: http://selenic.com/repo/hg/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] revset: add topo.revsonly argument for topo sort
# HG changeset patch # User Xidorn Quan# Date 1474636628 -36000 # Fri Sep 23 23:17:08 2016 +1000 # Node ID 9e8aeaf3bf6e61b351a738f5cadbbf4815f3 # Parent 285a8c3e53f2183438f0cdbc238e4ab851d0d110 revset: add topo.revsonly argument for topo sort This argument is used when we want an order which is not affected by revisions other than given ones. It helps the next patch (rebase in topo order) to keep sensible order when multiple separate revisions are specified. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1861,17 +1861,17 @@ def roots(repo, subset, x): 'desc': lambda c: c.description(), 'user': lambda c: c.user(), 'author': lambda c: c.user(), 'date': lambda c: c.date()[0], } def _getsortargs(x): """Parse sort options into (set, [(key, reverse)], opts)""" -args = getargsdict(x, 'sort', 'set keys topo.firstbranch') +args = getargsdict(x, 'sort', 'set keys topo.firstbranch topo.revsonly') if 'set' not in args: # i18n: "sort" is a keyword raise error.ParseError(_('sort requires one or two arguments')) keys = "rev" if 'keys' in args: # i18n: "sort" is a keyword keys = getstring(args['keys'], _("sort spec must be a string")) @@ -1880,29 +1880,28 @@ def _getsortargs(x): fk = k reverse = (k[0] == '-') if reverse: k = k[1:] if k not in _sortkeyfuncs and k != 'topo': raise error.ParseError(_("unknown sort key %r") % fk) keyflags.append((k, reverse)) -if len(keyflags) > 1 and any(k == 'topo' for k, reverse in keyflags): +istopo = any(k == 'topo' for k, reverse in keyflags) +if istopo and len(keyflags) > 1: # i18n: "topo" is a keyword raise error.ParseError(_('topo sort order cannot be combined ' 'with other sort keys')) opts = {} -if 'topo.firstbranch' in args: -if any(k == 'topo' for k, reverse in keyflags): -opts['topo.firstbranch'] = args['topo.firstbranch'] -else: -# i18n: "topo" and "topo.firstbranch" are keywords -raise error.ParseError(_('topo.firstbranch can only be used ' - 'when using the topo sort key')) +if not istopo and any(o.startswith('topo.') for o in args): +# i18n: "topo" and "topo.*" are keywords +raise error.ParseError(_('topo.* can only be used ' + 'when using the topo sort key')) +opts.update((k, v) for k, v in args.iteritems() if k.startswith('topo.')) return args['set'], keyflags, opts @predicate('sort(set[, [-]key... [, ...]])', safe=True, takeorder=True) def sort(repo, subset, x, order): """Sort set by keys. The default sort order is ascending, specify a key as ``-key`` to sort in descending order. @@ -1911,45 +1910,51 @@ def sort(repo, subset, x, order): - ``rev`` for the revision number, - ``branch`` for the branch name, - ``desc`` for the commit message (description), - ``user`` for user name (``author`` can be used as an alias), - ``date`` for the commit date - ``topo`` for a reverse topographical sort The ``topo`` sort order cannot be combined with other sort keys. This sort -takes one optional argument, ``topo.firstbranch``, which takes a revset that -specifies what topographical branches to prioritize in the sort. +takes two optional arguments: +```topo.firstbranch``` takes a revset that specifies what topographical +branches to prioritize in the sort. +```topo.revsonly``` makes the sort not consider the relationship outside the +given revisions, and unconnected subgraphs would be sorted based on largest +revision number in it. Its value doesn't matter, and it takes effect as soon +as it presents in arguments. """ s, keyflags, opts = _getsortargs(x) revs = getset(repo, subset, s) if not keyflags or order != defineorder: return revs if len(keyflags) == 1 and keyflags[0][0] == "rev": revs.sort(reverse=keyflags[0][1]) return revs elif keyflags[0][0] == "topo": firstbranch = () if 'topo.firstbranch' in opts: firstbranch = getset(repo, subset, opts['topo.firstbranch']) -revs = baseset(_toposort(revs, repo.changelog.parentrevs, firstbranch), +revs = baseset(_toposort(revs, repo.changelog.parentrevs, + firstbranch, 'topo.revsonly' in opts), istopo=True) if keyflags[0][1]: revs.reverse() return revs # sort() is guaranteed to be stable ctxs = [repo[r] for r in revs] for k, reverse in reversed(keyflags): ctxs.sort(key=_sortkeyfuncs[k], reverse=reverse) return baseset([c.rev() for c in ctxs]) -def
[PATCH V2] templates: add built-in files() function
# HG changeset patch # User Hannes Oldenburg# Date 1474618505 0 # Fri Sep 23 08:15:05 2016 + # Node ID 5be94ae732b1391c0d0a06fe898d3c4eae69cb38 # Parent 5271ae66615207f39cc41d78f4541bc6f8ca6ff6 templates: add built-in files() function We already support multiple primitive for listing files, which were affected by the current changeset. This patch adds files() which returns files of the current changeset matching a given pattern or fileset query via the "set:" prefix. diff -r 5271ae666152 -r 5be94ae732b1 mercurial/help/templates.txt --- a/mercurial/help/templates.txt Wed Sep 21 17:05:27 2016 -0400 +++ b/mercurial/help/templates.txt Fri Sep 23 08:15:05 2016 + @@ -95,6 +95,10 @@ $ hg log -r 0 --template "files: {join(files, ', ')}\n" +- Join the list of files ending with ".py" with a ", ":: + + $ hg log -r 0 --template "pythonfiles: {join(files('**.py'), ', ')}\n" + - Separate non-empty arguments by a " ":: $ hg log -r 0 --template "{separate(' ', node, bookmarks, tags}\n" diff -r 5271ae666152 -r 5be94ae732b1 mercurial/templater.py --- a/mercurial/templater.pyWed Sep 21 17:05:27 2016 -0400 +++ b/mercurial/templater.pyFri Sep 23 08:15:05 2016 + @@ -699,6 +699,20 @@ tzoffset = util.makedate()[1] return (date[0], tzoffset) +@templatefunc('files(pattern)') +def files(context, mapping, args): +"""All files of the current changeset matching the pattern. See +:hg:`help patterns`.""" +if not len(args) == 1: +# i18n: "revset" is a keyword +raise error.ParseError(_("files expects one argument")) + +raw = evalstring(context, mapping, args[0]) +ctx = mapping['ctx'] +m = ctx.match(raw) +files = list(ctx.matches(m)) +return templatekw.showlist("file", files, **mapping) + @templatefunc('revset(query[, formatargs...])') def revset(context, mapping, args): """Execute a revision set query. See diff -r 5271ae666152 -r 5be94ae732b1 tests/test-command-template.t --- a/tests/test-command-template.t Wed Sep 21 17:05:27 2016 -0400 +++ b/tests/test-command-template.t Fri Sep 23 08:15:05 2016 + @@ -3501,6 +3501,18 @@ 5:13207e5a10d9fd28ec424934298e176197f2c67f, 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74 +Test files function + + $ hg log -T "{rev}\n{join(files('*'), '\n')}\n" + 2 + a + aa + b + 1 + a + 0 + a + Test active bookmark templating $ hg book foo diff -r 5271ae666152 -r 5be94ae732b1 tests/test-help.t --- a/tests/test-help.t Wed Sep 21 17:05:27 2016 -0400 +++ b/tests/test-help.t Fri Sep 23 08:15:05 2016 + @@ -1551,6 +1551,9 @@ $ hg help template.files files List of strings. All files modified, added, or removed by this changeset. + files(pattern) +All files of the current changeset matching the pattern. See +'hg help patterns'. Test section lookup by translated message ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: handle os.environ() and os.environb() case
On Fri, 23 Sep 2016 12:23:36 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1474613335 -19800 > # Fri Sep 23 12:18:55 2016 +0530 > # Node ID 73e8bbaae1e350f6aa7b621cf29fcaba5d6508b5 > # Parent 85bd31515225e7fdf9bd88edde054db2c74a33f8 > py3: handle os.environ() and os.environb() case > +class osenviron(object): > +def __init__(self): > +self.__dict__ = {} > + > +def __getattr__(self, name): > +if sys.version_info[0] < 3: > +return getattr(os.environ, name) > +else: > +try: > +return getattr(os.environb, name) > +except AttributeError: #Windows case > +pass #TODO: add windows case here Why do we need a class just to forward attributes? I think the osenviron wrapper is necessary only on Windows. if py2: osenviron = os.environ else: try: osenviron = os.environb except AttributeError: osenviron = wrapper(os.environ) FWIW, the wrapper would need the encoding module, so we'll have to work around import cycle in some way. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2 v4] dispatch: make hg --profile wrap reposetup
On Thu, 22 Sep 2016 12:45:26 -0700, Arun Kulshreshtha wrote: > # HG changeset patch > # User Arun Kulshreshtha> # Date 1474572990 25200 > # Thu Sep 22 12:36:30 2016 -0700 > # Node ID 921577f5e9bfc3c059a8eb357796736f9edbdcd0 > # Parent 75b224273359ed924528491efb88c612f3caa4ca > dispatch: make hg --profile wrap reposetup > @@ -844,7 +845,7 @@ > elif not cmd: > return commands.help_(ui, 'shortlist') > > -if True: > +with profiling.maybeprofile(lui): > repo = None > cmdpats = args[:] > if not _cmdattr(ui, cmd, func, 'norepo'): As a follow-up patch, maybe we should move --version and --help to maybeprofile() block. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2 v4] dispatch: change indentation level in _dispatch()
On Thu, 22 Sep 2016 12:45:25 -0700, Arun Kulshreshtha wrote: > # HG changeset patch > # User Arun Kulshreshtha> # Date 1474571988 25200 > # Thu Sep 22 12:19:48 2016 -0700 > # Node ID 75b224273359ed924528491efb88c612f3caa4ca > # Parent 5271ae66615207f39cc41d78f4541bc6f8ca6ff6 > dispatch: change indentation level in _dispatch() Queued the series, thanks. > --- a/mercurial/dispatch.py > +++ b/mercurial/dispatch.py > @@ -844,60 +844,63 @@ > elif not cmd: > return commands.help_(ui, 'shortlist') > > -repo = None > -cmdpats = args[:] > -if not _cmdattr(ui, cmd, func, 'norepo'): > -# use the repo from the request only if we don't have -R > -if not rpath and not cwd: > -repo = req.repo > +if True: > +repo = None > +cmdpats = args[:] > +if not _cmdattr(ui, cmd, func, 'norepo'): > +# use the repo from the request only if we don't have -R > +if not rpath and not cwd: > +repo = req.repo I prefer splitting inner function than indenting large code block, but in this case, that would be impractical because there are many variables to be passed around. So this change looks good. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 5] extdata: add revset support for extdata
At Thu, 22 Sep 2016 13:21:36 -0500, Matt Mackall wrote: > > # HG changeset patch > # User Matt Mackall> # Date 1474293900 18000 > # Mon Sep 19 09:05:00 2016 -0500 > # Node ID 9c8847df32a0c5045e60aded2e03a9c97507f909 > # Parent 19bf2776dfe39befdc479253e1e7d030b41c08f9 > extdata: add revset support for extdata > > This inserts extdata into the revset function support. Planned > extensions of extdata support arguments, so this is the most > appropriate place for it. > > Unfortunately, the registrar framework is not a good fit here. First, > setting an appropriate load point is still an unsolved problem (we > want the code to live in revset.py, but that module may never be loaded). > Second, registered methods become global and the data sources are likely to be > repo-specific. This won't work well in a context like hgwebdir. Is there any reason not to define extdata() revset predicate (or template function), which requires external data source name like as extdata('filedata') ? (for convenience ?) > diff -r 19bf2776dfe3 -r 9c8847df32a0 mercurial/revset.py > --- a/mercurial/revset.py Tue Sep 13 14:14:05 2016 -0500 > +++ b/mercurial/revset.py Mon Sep 19 09:05:00 2016 -0500 > @@ -432,6 +432,14 @@ > return fn(repo, subset, b, order) > return fn(repo, subset, b) > > +# avoid import cycle > +from . import scmutil > + > +# check external data sources (can't override built-ins) > +if f in scmutil.extdatasources(repo): > +extdata = scmutil.extdatasource(repo, f) > +return baseset([r for r in subset if r in extdata]) > + > keep = lambda fn: getattr(fn, '__doc__', None) is not None > > syms = [s for (s, fn) in symbols.items() if keep(fn)] > diff -r 19bf2776dfe3 -r 9c8847df32a0 tests/test-revset.t > --- a/tests/test-revset.t Tue Sep 13 14:14:05 2016 -0500 > +++ b/tests/test-revset.t Mon Sep 19 09:05:00 2016 -0500 > @@ -3540,6 +3540,31 @@ >1 >3 > > +test extdata revset support > + > + $ echo "[extdata]" >> .hg/hgrc > + $ echo "filedata = file:extdata.txt" >> .hg/hgrc > + $ echo "shelldata = shell:cat extdata.txt | grep 2" >> .hg/hgrc > + $ echo "2" > extdata.txt > + $ echo "3" >> extdata.txt > + > + $ hg log -qr "filedata()" > + 2:842c8a27ccf2 > + 3:b7e1eaa35f23 > + $ hg log -qr "shelldata()" > + 2:842c8a27ccf2 > + > +we don't fix up relative file URLs, but we do run shell commands in repo root > + > + $ mkdir sub > + $ cd sub > + $ hg log -qr "filedata()" > + abort: error: No such file or directory > + [255] > + $ hg log -qr "shelldata()" > + 2:842c8a27ccf2 > + $ cd .. > + > test error message of bad revset >$ hg log -r 'foo\\' >hg: parse error at 3: syntax error in revset 'foo\\' > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel -- [FUJIWARA Katsunori] fo...@lares.dti.ne.jp ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2] log: drop outdated optimization to walk revisions in reverse order
On 09/22/2016 04:24 PM, Yuya Nishihara wrote: # HG changeset patch # User Yuya Nishihara# Date 1474545564 -32400 # Thu Sep 22 20:59:24 2016 +0900 # Node ID ffd93984937821bf449e2596acdb15a2c4ee88af # Parent 63cfb37603c39abe9e7ef58462c39dd1bb83c2df log: drop outdated optimization to walk revisions in reverse order Since revset is computed lazily, there would be no (or little) benefit to reverse 'revs' temporarily. I've pushed these two. Thanks. -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: news from the topic experiment
Excerpts from Pierre-Yves David's message of 2016-09-23 02:43:37 +0200: > In the same way large organisation will probably want to define and > enforce naming scheme for topics. But they already need to do so today > for named-branch of git-branch. So nothing specific to topic here. For git, IIUC, Bob can create a "tidy" branch that tracks "alice/smartfixup". He can also rename "master" to "@", tracking "origin/master". So people can name local branches whatever they like. No need to have a naming scheme to avoid name collisions. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] py3: handle os.environ() and os.environb() case
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1474613335 -19800 # Fri Sep 23 12:18:55 2016 +0530 # Node ID 73e8bbaae1e350f6aa7b621cf29fcaba5d6508b5 # Parent 85bd31515225e7fdf9bd88edde054db2c74a33f8 py3: handle os.environ() and os.environb() case os.environ() on python3 accepts bytes, we need to use os.environb(). Wrote a class named osenviron which will deal with this. A todo is left to handle the windows case. diff -r 85bd31515225 -r 73e8bbaae1e3 mercurial/encoding.py --- a/mercurial/encoding.py Sun Aug 21 13:16:21 2016 +0900 +++ b/mercurial/encoding.py Fri Sep 23 12:18:55 2016 +0530 @@ -9,14 +9,16 @@ import array import locale -import os import sys import unicodedata from . import ( error, +pycompat, ) +environ = pycompat.osenviron() + if sys.version_info[0] >= 3: unichr = chr @@ -76,13 +78,13 @@ } try: -encoding = os.environ.get("HGENCODING") +encoding = environ.get("HGENCODING") if not encoding: encoding = locale.getpreferredencoding() or 'ascii' encoding = _encodingfixers.get(encoding, lambda: encoding)() except locale.Error: encoding = 'ascii' -encodingmode = os.environ.get("HGENCODINGMODE", "strict") +encodingmode = environ.get("HGENCODINGMODE", "strict") fallbackencoding = 'ISO-8859-1' class localstr(str): @@ -180,7 +182,7 @@ raise error.Abort(k, hint="please check your locale settings") # How to treat ambiguous-width characters. Set to 'wide' to treat as wide. -wide = (os.environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide" +wide = (environ.get("HGENCODINGAMBIGUOUS", "narrow") == "wide" and "WFA" or "WF") def colwidth(s): diff -r 85bd31515225 -r 73e8bbaae1e3 mercurial/pycompat.py --- a/mercurial/pycompat.py Sun Aug 21 13:16:21 2016 +0900 +++ b/mercurial/pycompat.py Fri Sep 23 12:18:55 2016 +0530 @@ -69,6 +69,19 @@ self.__dict__[name] = obj = getattr(origin, item) return obj +class osenviron(object): +def __init__(self): +self.__dict__ = {} + +def __getattr__(self, name): +if sys.version_info[0] < 3: +return getattr(os.environ, name) +else: +try: +return getattr(os.environb, name) +except AttributeError: #Windows case +pass #TODO: add windows case here + httpserver = _pycompatstub() urlreq = _pycompatstub() urlerr = _pycompatstub() diff -r 85bd31515225 -r 73e8bbaae1e3 tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t Sun Aug 21 13:16:21 2016 +0900 +++ b/tests/test-check-py3-compat.t Fri Sep 23 12:18:55 2016 +0530 @@ -17,89 +17,90 @@ > | xargs $PYTHON3 contrib/check-py3-compat.py \ > | sed 's/[0-9][0-9]*)$/*)/' doc/hgmanpage.py: invalid syntax: invalid syntax (, line *) - hgext/acl.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/automv.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/blackbox.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/bugzilla.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/censor.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/chgserver.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/children.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/churn.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/clonebundles.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/color.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/bzr.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/common.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/convcmd.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/cvs.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/cvsps.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/darcs.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/filemap.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/git.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/gnuarch.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/hg.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/monotone.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/p4.py: error importing: str expected, not bytes (error at encoding.py:*) - hgext/convert/subversion.py: error importing: str expected, not bytes (error at encoding.py:*) + hgext/acl.py: error importing: str