D3721: run-tests: restrict the test cases allowed characters
This revision was automatically updated to reflect the committed changes. Closed by commit rHGb5651ae53127: run-tests: restrict the test cases allowed characters (authored by lothiraldan, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3721?vs=9030=9040#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3721?vs=9030=9040 REVISION DETAIL https://phab.mercurial-scm.org/D3721 AFFECTED FILES tests/run-tests.py tests/test-run-tests.t CHANGE DETAILS diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -1643,40 +1643,40 @@ Support running complex test cases names $ cat > test-cases-advanced-cases.t <<'EOF' - > #testcases simple case-with-dashes casewith!@#$%^&*()chars + > #testcases simple case-with-dashes casewith_-.chars > $ echo $TESTCASE > simple > EOF $ cat test-cases-advanced-cases.t - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE simple $ rt test-cases-advanced-cases.t --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE - simple + case-with-dashes ERROR: test-cases-advanced-cases.t#case-with-dashes output changed ! --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t - +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith_-.chars.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE - simple - + casewith!@#$%^&*()chars + + casewith_-.chars - ERROR: test-cases-advanced-cases.t#casewith!@#$%^&*()chars output changed + ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed !. Failed test-cases-advanced-cases.t#case-with-dashes: output changed - Failed test-cases-advanced-cases.t#casewith!@#$%^&*()chars: output changed + Failed test-cases-advanced-cases.t#casewith_-.chars: output changed # Ran 3 tests, 0 skipped, 2 failed. python hash seed: * (glob) [1] @@ -1686,7 +1686,7 @@ --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE - simple + case-with-dashes @@ -1698,19 +1698,19 @@ python hash seed: * (glob) [1] - $ rt "test-cases-advanced-cases.t#casewith!@#$%^&*()chars" + $ rt "test-cases-advanced-cases.t#casewith_-.chars" --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t - +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith_-.chars.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE - simple - + casewith!@#$%^&*()chars + + casewith_-.chars - ERROR: test-cases-advanced-cases.t#casewith!@#$%^&*()chars output changed + ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed ! - Failed test-cases-advanced-cases.t#casewith!@#$%^&*()chars: output changed + Failed test-cases-advanced-cases.t#casewith_-.chars: output changed # Ran 1 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -120,7 +120,7 @@ } class TestRunnerLexer(lexer.RegexLexer): -testpattern = r'[\w-]+\.(t|py)(#[^\s]+)?' +testpattern = r'[\w-]+\.(t|py)(#[a-zA-Z0-9_\-\.]+)?' tokens = { 'root': [ (r'^Skipped', token.Generic.Skipped, 'skipped'), @@ -2646,7 +2646,7 @@ expanded_args.append(arg) args = expanded_args -testcasepattern = re.compile(br'([\w-]+\.t|py)(#([^\s]+))') +testcasepattern = re.compile(br'([\w-]+\.t|py)(#([a-zA-Z0-9_\-\.]+))') tests = [] for t in args: case = None To: lothiraldan, #hg-reviewers, mharbison72, durin42 Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] tests: don't bother supporting test case names with exotic characters
On Tue, 12 Jun 2018 18:18:48 -0400, Augie Fackler wrote: # HG changeset patch # User Augie Fackler # Date 1528841922 14400 # Tue Jun 12 18:18:42 2018 -0400 # Node ID 05a80f347ad401bdb8c37782d6251a40aaf9cf2a # Parent f9c426385853657be0082f63567a1e78a3d5474b tests: don't bother supporting test case names with exotic characters This also works, thanks. Boris's patch might be better, as it maintains test coverage, and drops the bad characters: https://phab.mercurial-scm.org/D3721 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3723: cvsps: avoid comparison between None and a tuple in date sorting
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Avoids badness on Python 3. I had to figure out which entries in this object *could* be None experimentally, but I think I've got them all now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3723 AFFECTED FILES hgext/convert/cvsps.py CHANGE DETAILS diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -567,11 +567,15 @@ mindate = {} for e in log: if e.commitid: -mindate[e.commitid] = min(e.date, mindate.get(e.commitid)) +if e.commitid not in mindate: +mindate[e.commitid] = e.date +else: +mindate[e.commitid] = min(e.date, mindate[e.commitid]) # Merge changesets -log.sort(key=lambda x: (mindate.get(x.commitid), x.commitid, x.comment, -x.author, x.branch, x.date, x.branchpoints)) +log.sort(key=lambda x: (mindate.get(x.commitid, (-1, 0)), +x.commitid or '', x.comment, +x.author, x.branch or '', x.date, x.branchpoints)) changesets = [] files = set() To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3726: hgweb: pass a sysstr to low-level _start_response method
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This fixes a regression in Python 3 support introduced in https://phab.mercurial-scm.org/rHG7de7bd407251af2bc98e5b809c8598ee95830daf on the stable branch. We're so early in do_hgweb that I don't see any especially better choices than this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3726 AFFECTED FILES mercurial/hgweb/server.py CHANGE DETAILS diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -125,8 +125,9 @@ # Ensure the slicing of path below is valid if (path != self.server.prefix and not path.startswith(self.server.prefix + b'/')): -self._start_response(common.statusmessage(404), []) -self._write("Not Found") +self._start_response(pycompat.strurl(common.statusmessage(404)), + []) +self._write(b"Not Found") self._done() return To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3725: tests: fix printenv script on Python 3
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3725 AFFECTED FILES tests/printenv.py CHANGE DETAILS diff --git a/tests/printenv.py b/tests/printenv.py --- a/tests/printenv.py +++ b/tests/printenv.py @@ -26,6 +26,7 @@ exitcode = 0 out = sys.stdout +out = getattr(out, 'buffer', out) name = sys.argv[1] if len(sys.argv) > 2: To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3724: cvsps: port changeset __repr__ to py3
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This appears to be unused except as a debugging aid, as it didn't break until I added a debug print() in service of the previous fix. Sigh. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3724 AFFECTED FILES hgext/convert/cvsps.py CHANGE DETAILS diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -51,8 +51,8 @@ self.__dict__.update(entries) def __repr__(self): -items = ("%s=%r"%(k, self.__dict__[k]) for k in sorted(self.__dict__)) -return "%s(%s)"%(type(self).__name__, ", ".join(items)) +items = (r"%s=%r"%(k, self.__dict__[k]) for k in sorted(self.__dict__)) +return r"%s(%s)"%(type(self).__name__, r", ".join(items)) class logerror(Exception): pass To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3715: namespaces: allow namespaces whose symbols resolve to many nodes (API)
durin42 (Augie Fackler) writes: > durin42 added subscribers: lothiraldan, smf, durin42. > durin42 accepted this revision as: durin42. > durin42 added a comment. > > > I'm in favor, but feel like I've got enough conflict of interest I > shouldn't land the patches. > > @smf @lothiraldan this might be of interest to both of you? Side note: I keep missing messages that I'm tagged in because I'm not explicitly mentioned in a CC field. Is it possible to add a CC to each person tagged in a message? Side note2: Phabricator emails are really non-trivial to parse and (worse!) search. The raw emails are not simple, raw text so I'm having trouble tagging these for higher priority. Thanks for alerting me of this series! I've had a discussion with Martin about this on IRC but I'm a bit out of time today to respond (but definitely do want to respond). (I'm going to try to spend some time in the mornings to do my email triaging so I can get back on top of this list.) signature.asc Description: PGP signature ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: Discussion about Mercurial 4.8 Sprint
Kyle Lippincott writes: > On Thu, Jun 7, 2018 at 9:16 PM, Sean Farley wrote: > >> >> Kyle Lippincott writes: >> >> > On Thu, Jun 7, 2018 at 9:16 AM, Boris FELD >> wrote: >> > >> >> Hello everyone, >> >> >> >> I have also been in contact with Mercurial contributors, small >> >> contributors and users from Europe. From what we heard, it's both a >> >> question of time involvements and energy cost that is a rebuttal to >> them. >> >> It's not the same time and energy cost to make a 6 hours roundtrip >> travel >> >> to the neighboring country versus doing a 24 hours round trip and 8 >> hours >> >> jetlag travel to Japan. >> >> >> >> I think the sprint is a great way for small contributors to be motivated >> >> to keep being involved and sometimes become core contributors. It is >> also a >> >> great opportunity for wild users to discuss their workflows, ask their >> >> questions and give us their feedback. I've met many of these European >> users >> >> and small contributor and would be sad to skip an opportunity to keep in >> >> touch with them. >> >> >> > >> > These same reasonings can be *for* having a sprint in Asia as well. :) >> We >> > have two regular contributors who regularly attend sprints that are in >> > Japan already, and at least one more on the IRC channel that expressed >> > interest in attending a Japan sprint because they're in Japan; they've >> > never attended a Mercurial sprint before. >> > >> > >> >> >> >> For community members who aren't accustomed to international traveling, >> it >> >> would be even harder for them to travel to a country with a different >> >> money, a different language with more challenge to interact in a common >> >> language and a different culture. This seems one of the core reason why >> >> having sprints on different continents. >> >> >> >> I think start connecting with the Japan contributors and users is a >> great >> >> opportunity, I would just hope it would not be at the expense of the >> >> European community which has been waiting for this sprint for a year. My >> >> preference is to keep the next sprint in Europe and introduce a Japan >> >> sprint with more concertation. >> >> >> > >> > "which has been waiting for this sprint for a year" implies some >> guarantee >> > that we're going to have it in Europe every year >> >> Well, that's been the pattern for over 6 years so I have a bit of >> sympathy for people assuming that. >> > > Sure, but I've been saying since I've been attending them that we should > have one in Japan, so this shouldn't be a huge surprise to anyone that's > been at ones that I've attended (which is every one since Montreal, I > believe) that this was likely to be proposed :) I can see that, for sure, since I too have been requesting this :-) But, for me at least, some of this is just common courtesy to our users in Europe. Enough have spoken out (either to me personally or on this thread) that I'm convinced we should do a full cycle (North America -- Europe) before adding another into the cycle. It's hard to convey tone over text, so I'd like to say that I'm only trying to open and facilitate this discussion and not try to push things too hard. >> [...] >> >> I don't think there's anything incorrect about your reasoning. I am just >> trying to be conscious of the European contributors who have already >> made plans for a European site. It doesn't seem fair to those who have >> already planned based on the previous continent cycle. >> > > Are there already such plans that have been made? Expecting something to > happen and planning for it to happen are slightly different. > > I'd like to find a way forward here that doesn't summarize as "Asia can't > ever happen", because that's not fair to Asia contributors (including Oh, no, I hope that's not the opinion that I've projected. I definitely, definitely think we should enter Asia into the rotation. > [...] > > I will note that my likelihood of planning two sprints in a row is pretty > much null. Since I'm the one pushing for a Japan (or other Asia) sprint in > the first place, this likely means that I'd *not* participate in planning a > Europe one if we decide Europe must happen in the fall for some reason and > Japan will happen in the spring (and then North America in Fall 2019, > presumably), so that I can save my sanity for planning the one in spring. > Someone else will need to plan it if it's going to happen in Europe this > fall :) That's entirely fair! I wouldn't expect nor ask someone to do that at all. At the very least, I can help plan this European one but from my understanding there are multiple people to also help share that burden. > So, how do we move forward with deciding the location for this fall? That is a good question which I do not know. I asked the person at Logilab I spoke with (Marla) to chime in. I'm hoping that will help with concrete ideas and suggestions but am not sure on the overall decision making. signature.asc Description: PGP
D3721: run-tests: restrict the test cases allowed characters
mharbison72 accepted this revision. mharbison72 added a comment. The second hunk in run-test.py doesn't apply for me (it looks like adding `b` to a string has landed, but wasn't applied near the first hunk). But manually applying it, Windows is happy again. Thanks. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3721 To: lothiraldan, #hg-reviewers, mharbison72 Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3699: run-tests: follow-up on the test-case format
mharbison72 added a comment. In https://phab.mercurial-scm.org/D3699#58394, @lothiraldan wrote: > @mharbison72 I was not aware that this patch had been merged, is it breaking the windows build right now? Yes. https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/754/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3699 To: lothiraldan, #hg-reviewers, indygreg Cc: yuja, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@38289: 7 new changesets
7 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/0e0d03d09ecd changeset: 38283:0e0d03d09ecd user:Yuya Nishihara date:Sat Jun 09 12:36:06 2018 +0900 summary: templater: rename mappable to hybriditem as it is the primary use case https://www.mercurial-scm.org/repo/hg/rev/e72697893c93 changeset: 38284:e72697893c93 user:Yuya Nishihara date:Sat Apr 21 19:01:35 2018 +0900 summary: templater: promote tomap() to an interface type https://www.mercurial-scm.org/repo/hg/rev/8d6109b49b31 changeset: 38285:8d6109b49b31 user:Yuya Nishihara date:Sat Mar 24 17:54:02 2018 +0900 summary: templater: introduce a wrapper for date tuple (BC) https://www.mercurial-scm.org/repo/hg/rev/851fc9d42d6d changeset: 38286:851fc9d42d6d user:Yuya Nishihara date:Sat Mar 24 17:59:19 2018 +0900 summary: templater: make date wrapper support dot/map operations https://www.mercurial-scm.org/repo/hg/rev/0fe65bb7e160 changeset: 38287:0fe65bb7e160 user:Yuya Nishihara date:Sat Mar 24 18:03:23 2018 +0900 summary: templatefilters: deprecate hgdate as {date|hgdate} is the default format https://www.mercurial-scm.org/repo/hg/rev/a9de1d28681c changeset: 38288:a9de1d28681c user:Yuya Nishihara date:Tue Jun 12 23:17:38 2018 +0900 summary: show: stringify filtered list of tags before testing emptiness https://www.mercurial-scm.org/repo/hg/rev/f9c426385853 changeset: 38289:f9c426385853 bookmark:@ tag: tip user:Yuya Nishihara date:Sat Jun 09 13:34:47 2018 +0900 summary: templater: abstract truth testing to fix {if(list_of_empty_strings)} -- Repository URL: https://www.mercurial-scm.org/repo/hg ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3722: py3: buildbot informs me we have two new passing tests
durin42 created this revision. Herald added a reviewer: pulkit. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3722 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -454,6 +454,7 @@ test-status-inprocess.py test-status-rev.t test-status-terse.t +test-strict.t test-strip-cross.t test-strip.t test-subrepo-deep-nested-change.t @@ -468,6 +469,7 @@ test-tag.t test-tags.t test-template-engine.t +test-template-filters.t test-treemanifest.t test-ui-color.py test-ui-config.py To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH STABLE] tests: fix test-patch.t on pickier /bin/sh implementations
# HG changeset patch # User Augie Fackler # Date 1526871918 14400 # Sun May 20 23:05:18 2018 -0400 # Branch stable # Node ID 0c4019611293212012b598949832dcb2de6b96b2 # Parent 3c84493556db3bffcff2fa2f24bb6738dde9fc58 tests: fix test-patch.t on pickier /bin/sh implementations This is a graft of 0b39edeff033 and f44306940c94 from default because I'm tired of seeing the FreeBSD build be red on stable. See those revisions for details on what's going on here. diff --git a/tests/test-patch.t b/tests/test-patch.t --- a/tests/test-patch.t +++ b/tests/test-patch.t @@ -92,7 +92,12 @@ Clone and apply patch: Error exit (issue4746) - $ hg import ../c/p --config ui.patch='sh -c "exit 1"' + $ cat >> exit1.py < import sys + > sys.exit(1) + > EOF + + $ hg import ../c/p --config ui.patch="\"$PYTHON\" \"`pwd`/exit1.py\"" applying ../c/p abort: patch command failed: exited with status 1 [255] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] tests: don't bother supporting test case names with exotic characters
# HG changeset patch # User Augie Fackler # Date 1528841922 14400 # Tue Jun 12 18:18:42 2018 -0400 # Node ID 05a80f347ad401bdb8c37782d6251a40aaf9cf2a # Parent f9c426385853657be0082f63567a1e78a3d5474b tests: don't bother supporting test case names with exotic characters [a-z], [0-9] and - seem sufficient per the follow-up on the initial review thread, and this test is busted on Windows because of the illegal filenames it produces. diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -1643,74 +1643,46 @@ Support ignoring invalid test cases Support running complex test cases names $ cat > test-cases-advanced-cases.t <<'EOF' - > #testcases simple case-with-dashes casewith!@#$%^&*()chars + > #testcases simple case-with-dashes-and-digits-1234 > $ echo $TESTCASE > simple > EOF $ cat test-cases-advanced-cases.t - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes-and-digits-1234 $ echo $TESTCASE simple $ rt test-cases-advanced-cases.t --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t - +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes.err + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes-and-digits-1234.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes-and-digits-1234 $ echo $TESTCASE - simple - + case-with-dashes + + case-with-dashes-and-digits-1234 - ERROR: test-cases-advanced-cases.t#case-with-dashes output changed - ! - --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t - +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err - @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars - $ echo $TESTCASE - - simple - + casewith!@#$%^&*()chars - - ERROR: test-cases-advanced-cases.t#casewith!@#$%^&*()chars output changed + ERROR: test-cases-advanced-cases.t#case-with-dashes-and-digits-1234 output changed !. - Failed test-cases-advanced-cases.t#case-with-dashes: output changed - Failed test-cases-advanced-cases.t#casewith!@#$%^&*()chars: output changed - # Ran 3 tests, 0 skipped, 2 failed. - python hash seed: * (glob) - [1] - - $ rt "test-cases-advanced-cases.t#case-with-dashes" - - --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t - +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes.err - @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars - $ echo $TESTCASE - - simple - + case-with-dashes - - ERROR: test-cases-advanced-cases.t#case-with-dashes output changed - ! - Failed test-cases-advanced-cases.t#case-with-dashes: output changed - # Ran 1 tests, 0 skipped, 1 failed. + Failed test-cases-advanced-cases.t#case-with-dashes-and-digits-1234: output changed + # Ran 2 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] - $ rt "test-cases-advanced-cases.t#casewith!@#$%^&*()chars" + $ rt "test-cases-advanced-cases.t#case-with-dashes-and-digits-1234" --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t - +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes-and-digits-1234.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes-and-digits-1234 $ echo $TESTCASE - simple - + casewith!@#$%^&*()chars + + case-with-dashes-and-digits-1234 - ERROR: test-cases-advanced-cases.t#casewith!@#$%^&*()chars output changed + ERROR: test-cases-advanced-cases.t#case-with-dashes-and-digits-1234 output changed ! - Failed test-cases-advanced-cases.t#casewith!@#$%^&*()chars: output changed + Failed test-cases-advanced-cases.t#case-with-dashes-and-digits-1234: output changed # Ran 1 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@38282: 82 new changesets
82 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/56dd15178190 changeset: 38201:56dd15178190 user:Joerg Sonnenberger date:Fri Apr 20 15:21:03 2018 +0200 summary: templatefilters: add commonprefix https://www.mercurial-scm.org/repo/hg/rev/45765264ae3a changeset: 38202:45765264ae3a user:Anton Shestakov date:Thu May 31 16:52:02 2018 +0800 summary: spartan: add missing closing tags https://www.mercurial-scm.org/repo/hg/rev/c2e3bc99fba4 changeset: 38203:c2e3bc99fba4 user:Anton Shestakov date:Thu May 31 18:01:54 2018 +0800 summary: paper: don't show '[up]' in file view when in root directory already https://www.mercurial-scm.org/repo/hg/rev/d6aa1fc8292f changeset: 38204:d6aa1fc8292f user:Anton Shestakov date:Thu May 31 18:33:49 2018 +0800 summary: gitweb: don't show '[up]' in file view when in root directory already https://www.mercurial-scm.org/repo/hg/rev/9ed3527019b5 changeset: 38205:9ed3527019b5 user:Anton Shestakov date:Thu May 31 18:39:35 2018 +0800 summary: monoblue: don't show '[up]' in file view when in root directory already https://www.mercurial-scm.org/repo/hg/rev/273ce823ba5c changeset: 38206:273ce823ba5c user:Anton Shestakov date:Thu May 31 18:53:28 2018 +0800 summary: spartan: don't show '[up]' in file view when in root directory already https://www.mercurial-scm.org/repo/hg/rev/db9d1dd01bf0 changeset: 38207:db9d1dd01bf0 user:Yuya Nishihara date:Fri Jun 01 23:02:36 2018 +0900 summary: setup: write version constant as bytes literal https://www.mercurial-scm.org/repo/hg/rev/b10a9ace2738 changeset: 38208:b10a9ace2738 user:Yuya Nishihara date:Wed Apr 04 20:44:18 2018 +0900 summary: hgweb: wrap {nextentry} of graph with mappinglist https://www.mercurial-scm.org/repo/hg/rev/215021e506e2 changeset: 38209:215021e506e2 user:Yuya Nishihara date:Wed Apr 04 20:46:12 2018 +0900 summary: hgweb: adapt {jsdata} of graph to mappinggenerator https://www.mercurial-scm.org/repo/hg/rev/fb5803f4fb87 changeset: 38210:fb5803f4fb87 user:Yuya Nishihara date:Wed Apr 04 20:48:00 2018 +0900 summary: hgweb: wrap {nodes} of graph with mappinggenerator https://www.mercurial-scm.org/repo/hg/rev/86f980a8cacf changeset: 38211:86f980a8cacf user:Yuya Nishihara date:Wed Apr 04 20:48:37 2018 +0900 summary: hgweb: wrap {edges} of {nodes} of graph with mappinglist https://www.mercurial-scm.org/repo/hg/rev/0b932b43868f changeset: 38212:0b932b43868f user:Yuya Nishihara date:Wed Apr 04 20:51:49 2018 +0900 summary: hgweb: wrap {topics}es of help with mappinggenerator or mappinglist https://www.mercurial-scm.org/repo/hg/rev/c3df415037cd changeset: 38213:c3df415037cd user:Yuya Nishihara date:Wed Apr 04 20:53:16 2018 +0900 summary: hgweb: wrap {earlycommands} and {othercommands} of help with mappinggenerator https://www.mercurial-scm.org/repo/hg/rev/2aa0217bb655 changeset: 38214:2aa0217bb655 user:Yuya Nishihara date:Sat Apr 21 17:31:03 2018 +0900 summary: hgweb: fill {rename} even if ?linerange is specified https://www.mercurial-scm.org/repo/hg/rev/f715faeaceee changeset: 38215:f715faeaceee user:David Demelier date:Mon May 14 12:38:05 2018 +0200 summary: config: rename allow_archive to allow-archive https://www.mercurial-scm.org/repo/hg/rev/22edd5321489 changeset: 38216:22edd5321489 user:Matt Harbison date:Fri Jun 01 23:33:17 2018 -0400 summary: outgoing: drop an extraneous URL parse https://www.mercurial-scm.org/repo/hg/rev/16f93a3b8b05 changeset: 38217:16f93a3b8b05 user:Sangeet Kumar Mishra date:Wed May 30 17:37:17 2018 +0530 summary: grep: enable passing wdir as a revision https://www.mercurial-scm.org/repo/hg/rev/36ba5dba372d changeset: 38218:36ba5dba372d user:Sushil khanchi date:Wed May 30 14:20:09 2018 +0530 summary: advanceboundary: add dryrun parameter https://www.mercurial-scm.org/repo/hg/rev/51e420a7a41a changeset: 38219:51e420a7a41a user:Matt Harbison date:Sat Jun 02 22:18:12 2018 -0400 summary: cmdutil: use internal separators when building the terse list https://www.mercurial-scm.org/repo/hg/rev/ad50f0399e1e changeset: 38220:ad50f0399e1e user:Sushil khanchi date:Sat Jun 02 15:55:28 2018 +0530 summary: graft: correct documentation about options can be reapplied https://www.mercurial-scm.org/repo/hg/rev/ee1f052b45ef changeset: 38221:ee1f052b45ef user:Pulkit Goyal <7895pul...@gmail.com> date:Sun Jun 03 17:02:38 2018 +0530 summary: configitems: drop the deprecated alias for commands.update.check https://www.mercurial-scm.org/repo/hg/rev/507bdc40bb17 changeset: 38222:507bdc40bb17 user:Boris Feld date:
D3439: templatefilters: add commonprefix
martinvonz added a comment. In https://phab.mercurial-scm.org/D3439#58410, @joerg.sonnenberger wrote: > In https://phab.mercurial-scm.org/D3439#58405, @martinvonz wrote: > > > Do you think we should call it `commonpath()` or `commondir()` instead in case we want `commonprefix()` to work for any string in the future (and not care about path separators)? > > > `commondir()` would be fine as well. `commonpath()` doesn't feel better. I'm ambivalent about either name. I'd vote for changing it then. Both because I think it might make it clearer that it's the common prefix of "foo/bar" and "food" is not "foo" and because, as I said, we might want such a function later and it would be unfortunate if the name was taken. Btw, I just checked and we already have `dirname()` and `stripdir()` functions that would match `commondir()`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3439 To: joerg.sonnenberger, #hg-reviewers Cc: martinvonz, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 7] templater: introduce a wrapper for date tuple (BC)
On Tue, Jun 12, 2018 at 11:49:05PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1521881642 -32400 > # Sat Mar 24 17:54:02 2018 +0900 > # Node ID 61e21a5a89d421909c45718ffc50f72cf83ee4b5 > # Parent 5eb83a6310845fb61fef9eda799731b90061 > templater: introduce a wrapper for date tuple (BC) This appears to break python-hglib: https://buildbot.mercurial-scm.org/builders/python-hglib/builds/1379/steps/default%20%282.6.9%29/logs/stdio Any thoughts on how we should proceed? > > Strictly speaking, this is BC, but I believe the original string format > (str(float(unixtime)) + str(int(tzoffset))) was just plain wrong. > > diff --git a/mercurial/formatter.py b/mercurial/formatter.py > --- a/mercurial/formatter.py > +++ b/mercurial/formatter.py > @@ -367,7 +367,7 @@ class _templateconverter(object): > @staticmethod > def formatdate(date, fmt): > '''return date tuple''' > -return date > +return templateutil.date(date) > @staticmethod > def formatdict(data, key, value, fmt, sep): > '''build object that can be evaluated as either plain string or > dict''' > diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py > --- a/mercurial/templatefuncs.py > +++ b/mercurial/templatefuncs.py > @@ -391,7 +391,7 @@ def localdate(context, mapping, args): > raise error.ParseError(_("localdate expects a timezone")) > else: > tzoffset = dateutil.makedate()[1] > -return (date[0], tzoffset) > +return templateutil.date((date[0], tzoffset)) > > @templatefunc('max(iterable)') > def max_(context, mapping, args, **kwargs): > @@ -461,6 +461,7 @@ def obsfatedate(context, mapping, args): > markers = evalfuncarg(context, mapping, args[0]) > > try: > +# TODO: maybe this has to be a wrapped list of date wrappers? > data = obsutil.markersdates(markers) > return templateutil.hybridlist(data, name='date', fmt='%d %d') > except (TypeError, KeyError): > diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py > --- a/mercurial/templatekw.py > +++ b/mercurial/templatekw.py > @@ -240,7 +240,7 @@ def showactivebookmark(context, mapping) > def showdate(context, mapping): > """Date information. The date when the changeset was committed.""" > ctx = context.resource(mapping, 'ctx') > -return ctx.date() > +return templateutil.date(ctx.date()) > > @templatekeyword('desc', requires={'ctx'}) > def showdescription(context, mapping): > diff --git a/mercurial/templater.py b/mercurial/templater.py > --- a/mercurial/templater.py > +++ b/mercurial/templater.py > @@ -35,8 +35,8 @@ True, False, int, float > wrappedbytes, wrappedvalue > a wrapper for the above printable types. > > -date tuple > -a (unixtime, offset) tuple, which produces no meaningful output by > itself. > +date > +represents a (unixtime, offset) tuple. > > hybrid > represents a list/dict of printable values, which can also be converted > diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py > --- a/mercurial/templateutil.py > +++ b/mercurial/templateutil.py > @@ -172,10 +172,37 @@ class wrappedvalue(wrapped): > def tovalue(self, context, mapping): > return self._value > > -# stub for representing a date type; may be a real date type that can > -# provide a readable string value > -class date(object): > -pass > +class date(wrapped): > +"""Wrapper for date tuple""" > + > +def __init__(self, value): > +# value may be (float, int), but public interface shouldn't support > +# floating-point timestamp > +self._unixtime, self._tzoffset = map(int, value) > + > +def contains(self, context, mapping, item): > +raise error.ParseError(_('date is not iterable')) > + > +def getmember(self, context, mapping, key): > +raise error.ParseError(_('date is not a dictionary')) > + > +def getmin(self, context, mapping): > +raise error.ParseError(_('date is not iterable')) > + > +def getmax(self, context, mapping): > +raise error.ParseError(_('date is not iterable')) > + > +def itermaps(self, context): > +raise error.ParseError(_("date is not iterable")) > + > +def join(self, context, mapping, sep): > +raise error.ParseError(_("date is not iterable")) > + > +def show(self, context, mapping): > +return '%d %d' % (self._unixtime, self._tzoffset) > + > +def tovalue(self, context, mapping): > +return (self._unixtime, self._tzoffset) > > class hybrid(wrapped): > """Wrapper for list or dict to support legacy template > @@ -643,6 +670,9 @@ def evaldate(context, mapping, arg, err= > return unwrapdate(context, mapping, thing, err) > > def unwrapdate(context, mapping, thing, err=None): > +if isinstance(thing, date): > +return thing.tovalue(context, mapping) > +# TODO: update hgweb to not return bare tuple; then
D3439: templatefilters: add commonprefix
joerg.sonnenberger added a comment. In https://phab.mercurial-scm.org/D3439#58405, @martinvonz wrote: > Do you think we should call it `commonpath()` or `commondir()` instead in case we want `commonprefix()` to work for any string in the future (and not care about path separators)? `commondir()` would be fine as well. `commonpath()` doesn't feel better. I'm ambivalent about either name. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3439 To: joerg.sonnenberger, #hg-reviewers Cc: martinvonz, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3694: shelve: use more accurate description in conflict marker
durin42 added a comment. In https://phab.mercurial-scm.org/D3694#58369, @lothiraldan wrote: > > How much work is this, do you have any idea? > > The first option (adding "reserved" phase) should be very quick to implement. It might need minor adjustment for performance but I don't expect many. > > The second option (changing all algorithm to handle the gap) is more work since about all algorithm touching phases in Core and extensions assume they can be handled as a simple list. > > So I would pick the first option. When I was discussing this with spectral the idea of an `archived` phase came up. The fact that we've got two new phases at top of mind in the space of a week convinces me we should reserve *much* more than just one or two slots in the phase numbering space. I'd really like to get this work landed, so I'd be happy to help. (I'm off work next week, but could probably offer some time the following week.) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3694 To: lothiraldan, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3716: ui: add an unsafeoperation context manager that can block SIGINT
durin42 added a comment. Good suggestions, integrated them. :) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3716 To: durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3716: ui: add an unsafeoperation context manager that can block SIGINT
durin42 updated this revision to Diff 9033. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3716?vs=9023=9033 REVISION DETAIL https://phab.mercurial-scm.org/D3716 AFFECTED FILES mercurial/configitems.py mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -224,6 +224,7 @@ self._colormode = None self._terminfoparams = {} self._styles = {} +self._oldsiginthandler = None if src: self.fout = src.fout @@ -334,6 +335,40 @@ self._blockedtimes[key + '_blocked'] += \ (util.timer() - starttime) * 1000 +@contextlib.contextmanager +def unsafeoperation(self): +"""Mark an operation as unsafe. + +Most operations on a repository are safe to interrupt, but a +few are risky (for example repair.strip). This context manager +lets you advise Mercurial that something risky is happening so +that control-C etc can be blocked if desired. +""" +enabled = self.configbool('experimental', 'nointerrupt') +if (enabled and +self.configbool('experimental', 'nointerrupt-interactiveonly')): +enabled = self.interactive() +if self._oldsiginthandler is not None or not enabled: +# if nointerrupt support is turned off, the process isn't +# interactive, or we're already in an unsafeoperation +# block, do nothing. +yield +return + +def disabledsiginthandler(*args): +self.warn(self.config('experimental', 'nointerrupt-message') + '\n') +signal.signal(signal.SIGINT, self._oldsiginthandler) +self._oldsiginthandler = None + +try: +self._oldsiginthandler = signal.getsignal(signal.SIGINT) +signal.signal(signal.SIGINT, disabledsiginthandler) +yield +finally: +if self._oldsiginthandler is not None: +signal.signal(signal.SIGINT, self._oldsiginthandler) +self._oldsiginthandler = None + def formatter(self, topic, opts): return formatter.formatter(self, self, topic, opts) diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -560,6 +560,17 @@ coreconfigitem('experimental', 'mergedriver', default=None, ) +coreconfigitem('experimental', 'nointerrupt', default=False) +_nointmsg = """ +== +Interrupting Mercurial may leave your repo in a bad state. +If you really want to interrupt your current command, press +CTRL-C again. +== +""".strip() +coreconfigitem('experimental', 'nointerrupt-message', default=_nointmsg) +coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True) + coreconfigitem('experimental', 'obsmarkers-exchange-debug', default=False, ) To: durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 7 of 7] templater: abstract truth testing to fix {if(list_of_empty_strings)}
On Tue, Jun 12, 2018 at 11:49:09PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1528518887 -32400 > # Sat Jun 09 13:34:47 2018 +0900 > # Node ID 4eb2c19f741f50389c3de234654510deede597e2 > # Parent 0bf2bc3ec4f89f4a847b68d00011968732aacd7a > templater: abstract truth testing to fix {if(list_of_empty_strings)} queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3439: templatefilters: add commonprefix
martinvonz added a comment. Do you think we should call it `commonpath()` or `commondir()` instead in case we want `commonprefix()` to work for any string in the future (and not care about path separators)? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3439 To: joerg.sonnenberger, #hg-reviewers Cc: martinvonz, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3700: run-tests: add support for external test result
durin42 added a comment. In https://phab.mercurial-scm.org/D3700#58403, @lothiraldan wrote: > In https://phab.mercurial-scm.org/D3700#58376, @durin42 wrote: > > > I see some what, but not any why. Why is this useful? > > > I need this changeset to integrate the mercurial test runner with some external tools. I'd still like more information. Why is the json report inadquate? What's your goal? (Remember my perspective: every feature here is a liability, so anything we're not using for development on Mercurial is something I'm hesitant to take on in run-tests) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3700 To: lothiraldan, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3700: run-tests: add support for external test result
lothiraldan added a comment. In https://phab.mercurial-scm.org/D3700#58376, @durin42 wrote: > I see some what, but not any why. Why is this useful? I need this changeset to integrate the mercurial test runner with some external tools. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3700 To: lothiraldan, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3700: run-tests: add support for external test result
lothiraldan updated this revision to Diff 9031. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3700?vs=8992=9031 REVISION DETAIL https://phab.mercurial-scm.org/D3700 AFFECTED FILES tests/basic_test_result.py tests/run-tests.py tests/test-run-tests.t CHANGE DETAILS diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -1202,6 +1202,15 @@ $ echo dead:beef::1 $LOCALIP (glob) +Add support for external test formatter +=== + + $ CUSTOM_TEST_RESULT=basic_test_result $PYTHON $TESTDIR/run-tests.py --with-hg=`which hg` "$@" test-success.t test-failure.t + + # Ran 2 tests, 0 skipped, 0 failed. + FAILURE! test-failure.t output changed + SUCCESS! test-success.t + Test reusability for third party tools == diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1852,6 +1852,16 @@ self.stream.writeln('INTERRUPTED: %s (after %d seconds)' % ( test.name, self.times[-1][3])) +def getTestResult(): +""" +Returns the relevant test result +""" +if "CUSTOM_TEST_RESULT" in os.environ: +testresultmodule = __import__(os.environ["CUSTOM_TEST_RESULT"]) +return testresultmodule.TestResult +else: +return TestResult + class TestSuite(unittest.TestSuite): """Custom unittest TestSuite that knows how to execute Mercurial tests.""" @@ -2091,8 +2101,8 @@ self._runner = runner def listtests(self, test): -result = TestResult(self._runner.options, self.stream, -self.descriptions, 0) +result = getTestResult()(self._runner.options, self.stream, + self.descriptions, 0) test = sorted(test, key=lambda t: t.name) for t in test: print(t.name) @@ -2110,9 +2120,8 @@ return result def run(self, test): -result = TestResult(self._runner.options, self.stream, -self.descriptions, self.verbosity) - +result = getTestResult()(self._runner.options, self.stream, + self.descriptions, self.verbosity) test(result) failed = len(result.failures) diff --git a/tests/basic_test_result.py b/tests/basic_test_result.py new file mode 100644 --- /dev/null +++ b/tests/basic_test_result.py @@ -0,0 +1,46 @@ +from __future__ import print_function + +import unittest + +class TestResult(unittest._TextTestResult): + +def __init__(self, options, *args, **kwargs): +super(TestResult, self).__init__(*args, **kwargs) +self._options = options + +# unittest.TestResult didn't have skipped until 2.7. We need to +# polyfill it. +self.skipped = [] + +# We have a custom "ignored" result that isn't present in any Python +# unittest implementation. It is very similar to skipped. It may make +# sense to map it into skip some day. +self.ignored = [] + +self.times = [] +self._firststarttime = None +# Data stored for the benefit of generating xunit reports. +self.successes = [] +self.faildata = {} + +def addFailure(self, test, reason): +print("FAILURE!", test, reason) + +def addSuccess(self, test): +print("SUCCESS!", test) + +def addError(self, test, err): +print("ERR!", test, err) + +# Polyfill. +def addSkip(self, test, reason): +print("ERR!", test, reason) + +def addIgnore(self, test, reason): +print("IGNORE!", test, reason) + +def addOutputMismatch(self, test, ret, got, expected): +return False + +def stopTest(self, test, interrupted=False): +super(TestResult, self).stopTest(test) To: lothiraldan, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3701: run-tests: extract onStart and onEnd into the test result
lothiraldan updated this revision to Diff 9032. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3701?vs=8993=9032 REVISION DETAIL https://phab.mercurial-scm.org/D3701 AFFECTED FILES tests/run-tests.py CHANGE DETAILS diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -1711,6 +1711,11 @@ else: # 'always', for testing purposes self.color = pygmentspresent +def onStart(self, test): +""" Can be overriden by custom TestResult +""" +pass + def addFailure(self, test, reason): self.failures.append((test, reason)) @@ -2099,71 +2104,73 @@ super(TextTestRunner, self).__init__(*args, **kwargs) self._runner = runner +self._result = getTestResult()(self._runner.options, self.stream, + self.descriptions, 0) def listtests(self, test): -result = getTestResult()(self._runner.options, self.stream, - self.descriptions, 0) test = sorted(test, key=lambda t: t.name) + +self._result.onStart(test) + for t in test: print(t.name) -result.addSuccess(t) +self._result.addSuccess(t) if self._runner.options.xunit: with open(self._runner.options.xunit, "wb") as xuf: -self._writexunit(result, xuf) +self._writexunit(self._result, xuf) if self._runner.options.json: jsonpath = os.path.join(self._runner._outputdir, b'report.json') with open(jsonpath, 'w') as fp: -self._writejson(result, fp) - -return result +self._writejson(self._result, fp) + +return self._result def run(self, test): -result = getTestResult()(self._runner.options, self.stream, - self.descriptions, self.verbosity) -test(result) - -failed = len(result.failures) -skipped = len(result.skipped) -ignored = len(result.ignored) +self._result.onStart(test) +test(self._result) + +failed = len(self._result.failures) +skipped = len(self._result.skipped) +ignored = len(self._result.ignored) with iolock: self.stream.writeln('') if not self._runner.options.noskips: -for test, msg in result.skipped: +for test, msg in self._result.skipped: formatted = 'Skipped %s: %s\n' % (test.name, msg) -self.stream.write(highlightmsg(formatted, result.color)) -for test, msg in result.failures: +self.stream.write(highlightmsg(formatted, self._result.color)) +for test, msg in self._result.failures: formatted = 'Failed %s: %s\n' % (test.name, msg) -self.stream.write(highlightmsg(formatted, result.color)) -for test, msg in result.errors: +self.stream.write(highlightmsg(formatted, self._result.color)) +for test, msg in self._result.errors: self.stream.writeln('Errored %s: %s' % (test.name, msg)) if self._runner.options.xunit: with open(self._runner.options.xunit, "wb") as xuf: -self._writexunit(result, xuf) +self._writexunit(self._result, xuf) if self._runner.options.json: jsonpath = os.path.join(self._runner._outputdir, b'report.json') with open(jsonpath, 'w') as fp: -self._writejson(result, fp) +self._writejson(self._result, fp) self._runner._checkhglib('Tested') -savetimes(self._runner._outputdir, result) +savetimes(self._runner._outputdir, self._result) if failed and self._runner.options.known_good_rev: -self._bisecttests(t for t, m in result.failures) +self._bisecttests(t for t, m in self._result.failures) self.stream.writeln( '# Ran %d tests, %d skipped, %d failed.' -% (result.testsRun, skipped + ignored, failed)) +% (self._result.testsRun, skipped + ignored, failed)) if failed: self.stream.writeln('python hash seed: %s' % os.environ['PYTHONHASHSEED']) if self._runner.options.time: -self.printtimes(result.times) +self.printtimes(self._result.times) if self._runner.options.exceptions: exceptions = aggregateexceptions( @@ -2186,7 +2193,7 @@ self.stream.flush() -return result +return self._result def _bisecttests(self, tests): bisectcmd = ['hg', 'bisect'] @@ -2752,6 +2759,8 @@
D3721: run-tests: restrict the test cases allowed characters
lothiraldan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Most test cases in core and in extension only use `A-Za-z0-9-` but a few tests in extensions also have a `.` in their test cases names. Also add a `_` to allow all kind of case naming format. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3721 AFFECTED FILES tests/run-tests.py tests/test-run-tests.t CHANGE DETAILS diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t --- a/tests/test-run-tests.t +++ b/tests/test-run-tests.t @@ -1643,40 +1643,40 @@ Support running complex test cases names $ cat > test-cases-advanced-cases.t <<'EOF' - > #testcases simple case-with-dashes casewith!@#$%^&*()chars + > #testcases simple case-with-dashes casewith_-.chars > $ echo $TESTCASE > simple > EOF $ cat test-cases-advanced-cases.t - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE simple $ rt test-cases-advanced-cases.t --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE - simple + case-with-dashes ERROR: test-cases-advanced-cases.t#case-with-dashes output changed ! --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t - +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith_-.chars.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE - simple - + casewith!@#$%^&*()chars + + casewith_-.chars - ERROR: test-cases-advanced-cases.t#casewith!@#$%^&*()chars output changed + ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed !. Failed test-cases-advanced-cases.t#case-with-dashes: output changed - Failed test-cases-advanced-cases.t#casewith!@#$%^&*()chars: output changed + Failed test-cases-advanced-cases.t#casewith_-.chars: output changed # Ran 3 tests, 0 skipped, 2 failed. python hash seed: * (glob) [1] @@ -1686,7 +1686,7 @@ --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.case-with-dashes.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE - simple + case-with-dashes @@ -1698,19 +1698,19 @@ python hash seed: * (glob) [1] - $ rt "test-cases-advanced-cases.t#casewith!@#$%^&*()chars" + $ rt "test-cases-advanced-cases.t#casewith_-.chars" --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t - +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith_-.chars.err @@ -1,3 +1,3 @@ - #testcases simple case-with-dashes casewith!@#$%^&*()chars + #testcases simple case-with-dashes casewith_-.chars $ echo $TESTCASE - simple - + casewith!@#$%^&*()chars + + casewith_-.chars - ERROR: test-cases-advanced-cases.t#casewith!@#$%^&*()chars output changed + ERROR: test-cases-advanced-cases.t#casewith_-.chars output changed ! - Failed test-cases-advanced-cases.t#casewith!@#$%^&*()chars: output changed + Failed test-cases-advanced-cases.t#casewith_-.chars: output changed # Ran 1 tests, 0 skipped, 1 failed. python hash seed: * (glob) [1] diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -120,7 +120,7 @@ } class TestRunnerLexer(lexer.RegexLexer): -testpattern = r'[\w-]+\.(t|py)(#[^\s]+)?' +testpattern = r'[\w-]+\.(t|py)(#[a-zA-Z0-9_\-\.]+)?' tokens = { 'root': [ (r'^Skipped', token.Generic.Skipped, 'skipped'), @@ -2646,7 +2646,7 @@ expanded_args.append(arg) args = expanded_args -testcasepattern = re.compile(r'([\w-]+\.t|py)(#([^\s]+))') +testcasepattern = re.compile(r'([\w-]+\.t|py)(#([a-zA-Z0-9_\-\.]+))') tests = [] for t in args: case = None To: lothiraldan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3699: run-tests: follow-up on the test-case format
lothiraldan added a comment. In https://phab.mercurial-scm.org/D3699#58174, @yuja wrote: > >> test-run-tests.t:1669 > > > + --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t > > > + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err > > > + @@ -1,3 +1,3 @@ > > > > Windows can't create the test directory with all of the reserved characters here. Are these necessary? > > Maybe no? I think alphanumerics + '-' should be enough, and allowing shell > meta characters is potentially unsafe. I checked core test files and some extensions test files. Alphanumerics + '-" would works for most of them. Some tests in the hg-experimental repository have a `.` in their test case name. I would also add `_` for allowing all naming cases. Does that sounds good? @mharbison72 I was not aware that this patch had been merged, is it breaking the windows build right now? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3699 To: lothiraldan, #hg-reviewers, indygreg Cc: yuja, mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 4] debugwalk: show matcher output only if -v/--verbose
On Mon, Jun 11, 2018 at 6:07 AM Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1528599236 -32400 > # Sun Jun 10 11:53:56 2018 +0900 > # Node ID ff248c56af342b1e07e1d51bb4760da202111ba3 > # Parent 40a20b62d7cc17999c8e879d62b4d95f1c3bb4cd > debugwalk: show matcher output only if -v/--verbose > > And drop "egrep -v". This matches the behavior of "hg debugrevspec". > > diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py > --- a/mercurial/debugcommands.py > +++ b/mercurial/debugcommands.py > @@ -2542,7 +2542,8 @@ def debugwalk(ui, repo, *pats, **opts): > """show how files match on given patterns""" > opts = pycompat.byteskwargs(opts) > m = scmutil.match(repo[None], pats, opts) > -ui.write(('matcher: %r\n' % m)) > +if ui.verbose: > +ui.write(('matcher: %r\n' % m)) > nit: These two lines are equivalent to "ui.note(('matcher: %r\n' % m))", except that that also adds a "ui.note" label. Use that method instead? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3720: commandserver: close server's fds explicitly from a worker
quark created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The forked worker does not need to accept connections from the server's socket fd. So let's just close them explicitly to avoid surprises. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3720 AFFECTED FILES mercurial/commandserver.py CHANGE DETAILS diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -494,6 +494,8 @@ conn.close() # release handle in parent process else: try: +selector.close() +self._sock.close() self._runworker(conn) conn.close() os._exit(0) To: quark, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3703: serve: do not daemonize by default by --print-url
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1a05e205832a: serve: do not daemonize by default by --print-url (authored by yuja, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3703?vs=8999=9028 REVISION DETAIL https://phab.mercurial-scm.org/D3703 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -4854,8 +4854,6 @@ raise error.Abort(_("cannot use --stdio with --cmdserver")) if opts["print_url"] and ui.verbose: raise error.Abort(_("cannot use --print-url with --verbose")) -if opts["print_url"]: -opts['daemon'] = True if opts["stdio"]: if repo is None: To: yuja, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3715: namespaces: allow namespaces whose symbols resolve to many nodes (API)
durin42 added subscribers: lothiraldan, smf, durin42. durin42 accepted this revision as: durin42. durin42 added a comment. I'm in favor, but feel like I've got enough conflict of interest I shouldn't land the patches. @smf @lothiraldan this might be of interest to both of you? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3715 To: martinvonz, #hg-reviewers, durin42 Cc: durin42, smf, lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3716: ui: add an unsafeoperation context manager that can block SIGINT
martinvonz added inline comments. INLINE COMMENTS > ui.py:347-350 > +enabled = self.configbool('experimental', 'nointerrupt') > +inter = self.interactive() or not self.configbool( > +'experimental', 'nointerrupt-interactiveonly') > +if not (enabled and inter and self._oldsiginthandler is None): it took me a while to parse these conditions. perhaps it's clearer like this? enabled = self.configbool('experimental', 'nointerrupt') if (enabled and self.configbool('experimental', 'nointerrupt-interactiveonly')): enabled = self.interactive() > ui.py:348 > +enabled = self.configbool('experimental', 'nointerrupt') > +inter = self.interactive() or not self.configbool( > +'experimental', 'nointerrupt-interactiveonly') nit: does "inter" mean "interrupt" or "interactive" here? since both make sense in this context, it might be better to spell it out > ui.py:357 > + > +def disablesiginthandler(*args): > +self.warn(self.config('experimental', 'nointerrupt-message') + > '\n') nit: maybe `disable*d*siginthandler()`? (i would suggest `warningsiginthandler()`, but it's too easy to read the "warning" as noun and not as verb that i meant it to be) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3716 To: durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3700: run-tests: add support for external test result
durin42 added a comment. I see some what, but not any why. Why is this useful? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3700 To: lothiraldan, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3702: mercurial: add .t files to .editorconfig
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1d6066336d7b: mercurial: add .t files to .editorconfig (authored by indygreg, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3702?vs=8994=9027#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3702?vs=8994=9027 REVISION DETAIL https://phab.mercurial-scm.org/D3702 AFFECTED FILES .editorconfig CHANGE DETAILS diff --git a/.editorconfig b/.editorconfig --- a/.editorconfig +++ b/.editorconfig @@ -11,3 +11,8 @@ indent_size = 8 indent_style = tab trim_trailing_whitespace = true + +[*.t] +indent_size = 2 +indent_style = space +trim_trailing_whitespace = false To: indygreg, #hg-reviewers Cc: durin42, av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3702: mercurial: add .t files to .editorconfig
durin42 added inline comments. INLINE COMMENTS > av6 wrote in .editorconfig:17 > Nit: I'd sort these two lines for consistency with the two entries above, > otherwise looks good. queued with that fixed REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3702 To: indygreg, #hg-reviewers Cc: durin42, av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3694: shelve: use more accurate description in conflict marker
lothiraldan added a comment. In https://phab.mercurial-scm.org/D3694#58242, @durin42 wrote: > In https://phab.mercurial-scm.org/D3694#58241, @lothiraldan wrote: > > > > Interesting. I think I like this, it's a bummer that it requires a format bump in requires. > > > > > > > > - There are no format changes per-se, older client would preserve the phases for internal changesets, but have them visible, > > > We didn't do a format bump when we introduced draft/secret phases, so maybe we should punt here too. Phases did not introduce any regression in behavior. When draft/secret where introduced, older clients could keep interacting with the repository the same way as before. The new changesets created by new clients were seen just fine (but not the associated behavior). However in the shelve case, if both a new client and an old client access the same local repository, we have a change in behavior: - before: shelve created from the new client are stripped and invisible to the old client - after: shelve created from the new client are visible as changeset to the old client The danger is that users could push those intermediary shelve commits if they are not careful. The new requirements and the error message will make them think about the issue and not push intermediary commits. >> - This is also something we would need for obsshelve (non evolve enabled client complaining about markers), > > I don't think so, because in general shelve isn't being run on a repository that's accessed remotely. (In general - that's not always true, but I think it's "true enough" esp. since we _need_ to ship obsmarkers on by default soon.) We have the same scenario for obsshelve: - before: shelve created from the new client are stripped - after: shelve created from the new client create obsmarkers and trigger related warnings. This is not a theoretical case, we have seen valid situations where new and old client access the same repositories. >> - There are more format bumps coming (when solving issue5480) and to other future series. >> >>> I'm a little anxious about defining the `internal` phase because it might restrict the potential for other phases past secret >> >> I kept things simple in the current series, but I had a similar thinking. One option is to encode the internal phase as "32" instead of "3" to leave us room for other phases. If we this we need to update the implementation with one of the following: >> >> (1) add 29 "reserved" empty phase that will remain empty. >> >> (2) rework the phases touching code to work on non-contiguous numbers. > > How much work is this, do you have any idea? The first option (adding "reserved" phase) should be very quick to implement. It might need minor adjustment for performance but I don't expect many. The second option (changing all algorithm to handle the gap) is more work since about all algorithm touching phases in Core and extensions assume they can be handled as a simple list. So I would pick the first option. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3694 To: lothiraldan, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3716: ui: add an unsafeoperation context manager that can block SIGINT
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The blocking of SIGINT is not done by default, but my hope is that we will one day. This was inspired by Facebook's "nointerrupt" extension, which is a bit more heavy-handed than this (whole commands are treated as unsafe to interrupt). A future patch will enable this for varying bits of Mercurial that are performing unsafe operations. .. api:: New context manager ``ui.unsafeoperation()`` to mark portions of a command as potentially unsafe places to interrupt Mercurial with Control-C or similar. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3716 AFFECTED FILES mercurial/configitems.py mercurial/ui.py CHANGE DETAILS diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -224,6 +224,7 @@ self._colormode = None self._terminfoparams = {} self._styles = {} +self._oldsiginthandler = None if src: self.fout = src.fout @@ -334,6 +335,39 @@ self._blockedtimes[key + '_blocked'] += \ (util.timer() - starttime) * 1000 +@contextlib.contextmanager +def unsafeoperation(self): +"""Mark an operation as unsafe. + +Most operations on a repository are safe to interrupt, but a +few are risky (for example repair.strip). This context manager +lets you advise Mercurial that something risky is happening so +that control-C etc can be blocked if desired. +""" +enabled = self.configbool('experimental', 'nointerrupt') +inter = self.interactive() or not self.configbool( +'experimental', 'nointerrupt-interactiveonly') +if not (enabled and inter and self._oldsiginthandler is None): +# if nointerrupt support is turned off, the process isn't +# interactive, or we're already in an unsafeoperation +# block, do nothing. +yield +return + +def disablesiginthandler(*args): +self.warn(self.config('experimental', 'nointerrupt-message') + '\n') +signal.signal(signal.SIGINT, self._oldsiginthandler) +self._oldsiginthandler = None + +try: +self._oldsiginthandler = signal.getsignal(signal.SIGINT) +signal.signal(signal.SIGINT, disablesiginthandler) +yield +finally: +if self._oldsiginthandler is not None: +signal.signal(signal.SIGINT, self._oldsiginthandler) +self._oldsiginthandler = None + def formatter(self, topic, opts): return formatter.formatter(self, self, topic, opts) diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -560,6 +560,17 @@ coreconfigitem('experimental', 'mergedriver', default=None, ) +coreconfigitem('experimental', 'nointerrupt', default=False) +_nointmsg = """ +== +Interrupting Mercurial may leave your repo in a bad state. +If you really want to interrupt your current command, press +CTRL-C again. +== +""".strip() +coreconfigitem('experimental', 'nointerrupt-message', default=_nointmsg) +coreconfigitem('experimental', 'nointerrupt-interactiveonly', default=True) + coreconfigitem('experimental', 'obsmarkers-exchange-debug', default=False, ) To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3717: repair: mark the critical section of strip() as unsafe
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY When our experimental nointerrupt feature is enabled, this will help prevent users from corrupting their repo during a strip. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3717 AFFECTED FILES mercurial/repair.py CHANGE DETAILS diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -186,76 +186,77 @@ tmpbundlefile = backupbundle(repo, savebases, saveheads, node, 'temp', compress=False, obsolescence=False) -try: -with repo.transaction("strip") as tr: -offset = len(tr.entries) +with ui.unsafeoperation(): +try: +with repo.transaction("strip") as tr: +offset = len(tr.entries) -tr.startgroup() -cl.strip(striprev, tr) -stripmanifest(repo, striprev, tr, files) - -for fn in files: -repo.file(fn).strip(striprev, tr) -tr.endgroup() +tr.startgroup() +cl.strip(striprev, tr) +stripmanifest(repo, striprev, tr, files) -for i in xrange(offset, len(tr.entries)): -file, troffset, ignore = tr.entries[i] -with repo.svfs(file, 'a', checkambig=True) as fp: -fp.truncate(troffset) -if troffset == 0: -repo.store.markremoved(file) +for fn in files: +repo.file(fn).strip(striprev, tr) +tr.endgroup() -deleteobsmarkers(repo.obsstore, stripobsidx) -del repo.obsstore -repo.invalidatevolatilesets() -repo._phasecache.filterunknown(repo) +for i in xrange(offset, len(tr.entries)): +file, troffset, ignore = tr.entries[i] +with repo.svfs(file, 'a', checkambig=True) as fp: +fp.truncate(troffset) +if troffset == 0: +repo.store.markremoved(file) + +deleteobsmarkers(repo.obsstore, stripobsidx) +del repo.obsstore +repo.invalidatevolatilesets() +repo._phasecache.filterunknown(repo) -if tmpbundlefile: -ui.note(_("adding branch\n")) -f = vfs.open(tmpbundlefile, "rb") -gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) -if not repo.ui.verbose: -# silence internal shuffling chatter -repo.ui.pushbuffer() -tmpbundleurl = 'bundle:' + vfs.join(tmpbundlefile) -txnname = 'strip' -if not isinstance(gen, bundle2.unbundle20): -txnname = "strip\n%s" % util.hidepassword(tmpbundleurl) -with repo.transaction(txnname) as tr: -bundle2.applybundle(repo, gen, tr, source='strip', -url=tmpbundleurl) -if not repo.ui.verbose: -repo.ui.popbuffer() -f.close() +if tmpbundlefile: +ui.note(_("adding branch\n")) +f = vfs.open(tmpbundlefile, "rb") +gen = exchange.readbundle(ui, f, tmpbundlefile, vfs) +if not repo.ui.verbose: +# silence internal shuffling chatter +repo.ui.pushbuffer() +tmpbundleurl = 'bundle:' + vfs.join(tmpbundlefile) +txnname = 'strip' +if not isinstance(gen, bundle2.unbundle20): +txnname = "strip\n%s" % util.hidepassword(tmpbundleurl) +with repo.transaction(txnname) as tr: +bundle2.applybundle(repo, gen, tr, source='strip', +url=tmpbundleurl) +if not repo.ui.verbose: +repo.ui.popbuffer() +f.close() -with repo.transaction('repair') as tr: -bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm] -bm.applychanges(repo, tr, bmchanges) +with repo.transaction('repair') as tr: +bmchanges = [(m, repo[newbmtarget].node()) for m in updatebm] +bm.applychanges(repo, tr, bmchanges) -# remove undo files -for undovfs, undofile in repo.undofiles(): -try: -undovfs.unlink(undofile) -except OSError as e: -if e.errno != errno.ENOENT: -ui.warn(_('error removing %s: %s\n') % -(undovfs.join(undofile), - stringutil.forcebytestr(e))) +# remove undo files +for undovfs, undofile in repo.undofiles(): +try: +
D3718: narrow: mark the critical chunks of narrowing/widening as unsafe
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I'm _mostly_ sure these are the only unsafe chunks here. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3718 AFFECTED FILES hgext/narrow/narrowcommands.py CHANGE DETAILS diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py --- a/hgext/narrow/narrowcommands.py +++ b/hgext/narrow/narrowcommands.py @@ -203,50 +203,51 @@ hint=_('use --force-delete-local-changes to ' 'ignore')) -if revstostrip: -tostrip = [unfi.changelog.node(r) for r in revstostrip] -if repo['.'].node() in tostrip: -# stripping working copy, so move to a different commit first -urev = max(repo.revs('(::%n) - %ln + null', - repo['.'].node(), visibletostrip)) -hg.clean(repo, urev) -repair.strip(ui, unfi, tostrip, topic='narrow') +with ui.unsafeoperation(): +if revstostrip: +tostrip = [unfi.changelog.node(r) for r in revstostrip] +if repo['.'].node() in tostrip: +# stripping working copy, so move to a different commit first +urev = max(repo.revs('(::%n) - %ln + null', + repo['.'].node(), visibletostrip)) +hg.clean(repo, urev) +repair.strip(ui, unfi, tostrip, topic='narrow') -todelete = [] -for f, f2, size in repo.store.datafiles(): -if f.startswith('data/'): -file = f[5:-2] -if not newmatch(file): -todelete.append(f) -elif f.startswith('meta/'): -dir = f[5:-13] -dirs = ['.'] + sorted(util.dirs({dir})) + [dir] -include = True -for d in dirs: -visit = newmatch.visitdir(d) -if not visit: -include = False -break -if visit == 'all': -break -if not include: -todelete.append(f) +todelete = [] +for f, f2, size in repo.store.datafiles(): +if f.startswith('data/'): +file = f[5:-2] +if not newmatch(file): +todelete.append(f) +elif f.startswith('meta/'): +dir = f[5:-13] +dirs = ['.'] + sorted(util.dirs({dir})) + [dir] +include = True +for d in dirs: +visit = newmatch.visitdir(d) +if not visit: +include = False +break +if visit == 'all': +break +if not include: +todelete.append(f) -repo.destroying() +repo.destroying() -with repo.transaction("narrowing"): -for f in todelete: -ui.status(_('deleting %s\n') % f) -util.unlinkpath(repo.svfs.join(f)) -repo.store.markremoved(f) +with repo.transaction("narrowing"): +for f in todelete: +ui.status(_('deleting %s\n') % f) +util.unlinkpath(repo.svfs.join(f)) +repo.store.markremoved(f) -for f in repo.dirstate: -if not newmatch(f): -repo.dirstate.drop(f) -repo.wvfs.unlinkpath(f) -repo.setnarrowpats(newincludes, newexcludes) +for f in repo.dirstate: +if not newmatch(f): +repo.dirstate.drop(f) +repo.wvfs.unlinkpath(f) +repo.setnarrowpats(newincludes, newexcludes) -repo.destroyed() +repo.destroyed() def _widen(ui, repo, remote, commoninc, newincludes, newexcludes): newmatch = narrowspec.match(repo.root, newincludes, newexcludes) @@ -269,28 +270,29 @@ repo.setnarrowpats(newincludes, newexcludes) repo.setnewnarrowpats = setnewnarrowpats -ds = repo.dirstate -p1, p2 = ds.p1(), ds.p2() -with ds.parentchange(): -ds.setparents(node.nullid, node.nullid) -common = commoninc[0] -with wrappedextraprepare: -exchange.pull(repo, remote, heads=common) -with ds.parentchange(): -ds.setparents(p1, p2) +with ui.unsafeoperation(): +ds = repo.dirstate +p1, p2 = ds.p1(), ds.p2() +with ds.parentchange(): +ds.setparents(node.nullid, node.nullid) +common = commoninc[0] +with wrappedextraprepare: +exchange.pull(repo, remote, heads=common) +with ds.parentchange(): +ds.setparents(p1, p2) -actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p pr'.split()} -addgaction = actions['g'].append +actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p
D3719: narrowbundle2: when we handle a widen, mark the operation as unsafe
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We have to manually drive the context manager here since the logic is awkwardly split between a couple of places. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3719 AFFECTED FILES hgext/narrow/narrowbundle2.py CHANGE DETAILS diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py --- a/hgext/narrow/narrowbundle2.py +++ b/hgext/narrow/narrowbundle2.py @@ -408,6 +408,8 @@ topic='widen') repo._bookmarks = bmstore if chgrpfile: +op._widen_unsafeop = repo.ui.unsafeoperation() +op._widen_unsafeop.__enter__() # presence of _widen_bundle attribute activates widen handler later op._widen_bundle = chgrpfile # Set the new narrowspec if we're widening. The setnewnarrowpats() method @@ -455,6 +457,7 @@ (undovfs.join(undofile), stringutil.forcebytestr(e))) # Remove partial backup only if there were no exceptions +op._widen_unsafeop.__exit__(None, None, None) vfs.unlink(chgrpfile) def setup(): To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH RFC] fileset: add "tracked()" to explicitly select files in the revision
# HG changeset patch # User Yuya Nishihara # Date 1528636796 -32400 # Sun Jun 10 22:19:56 2018 +0900 # Node ID c7fd574b35c8d7953fce3b5747ed27f23ea1 # Parent 4eb2c19f741f50389c3de234654510deede597e2 fileset: add "tracked()" to explicitly select files in the revision (This is RFC to show the BC I plan to make. I'll include this patch in a later series.) I'm going to rewrite filesets to be matcher predicates, which means basic patterns such as '*' will no longer be "closed" to the subset constructed from the ctx. Good thing is that 'hg status "set:not binary()"' can include unknown files out of the box, and fileset computation will (hopefully) be faster as we won't have to walk dirstate twice, for example. Bad thing is that we can't select files at a certain revision by 'set:revs(REV, **)' since '**' is open to any paths. So, this patch introduces "tracked()" as a replacement for the '**' use in the example above. Some examples of matcher-based filesets: This works as before, but some matcher attributes (e.g. visitdir()) will likely be more accurate. $ hg debugwalk -v 'set:path:mercurial and size(">100k")' * matcher: , m2=100k')>> f mercurial/cmdutil.pymercurial/cmdutil.py f mercurial/commands.py mercurial/commands.py f mercurial/debugcommands.py mercurial/debugcommands.py f mercurial/patch.py mercurial/patch.py f mercurial/util.py mercurial/util.py Since the predicate is open to any paths, it can be applied to ignored files. $ hg status --ignored 'set:path:mercurial and size(">100k")' I mercurial/cext/bdiff.so I mercurial/cext/parsers.so I mercurial/commands.pyc I mercurial/debugcommands.pyc I mercurial/locale/da/LC_MESSAGES/hg.mo I mercurial/locale/de/LC_MESSAGES/hg.mo I mercurial/locale/it/LC_MESSAGES/hg.mo I mercurial/locale/ja/LC_MESSAGES/hg.mo I mercurial/locale/pt_BR/LC_MESSAGES/hg.mo I mercurial/locale/ru/LC_MESSAGES/hg.mo I mercurial/locale/sv/LC_MESSAGES/hg.mo I mercurial/util.pyc I mercurial/zstd.so diff --git a/mercurial/fileset.py b/mercurial/fileset.py --- a/mercurial/fileset.py +++ b/mercurial/fileset.py @@ -253,6 +253,13 @@ def clean(mctx, x): s = set(mctx.status().clean) return [f for f in mctx.subset if f in s] +@predicate('tracked()') +def tracked(mctx, x): +"""File that is under Mercurial control.""" +# i18n: "tracked" is a keyword +getargs(x, 0, 0, _("tracked takes no arguments")) +return [f for f in mctx.subset if f in mctx.ctx] + def func(mctx, a, b): funcname = getsymbol(a) if funcname in symbols: diff --git a/tests/test-fileset.t b/tests/test-fileset.t --- a/tests/test-fileset.t +++ b/tests/test-fileset.t @@ -524,7 +524,7 @@ small reminder of the repository state Test files at -r0 should be filtered by files at wdir - - $ fileset -r0 '* and revs("wdir()", *)' + $ fileset -r0 'tracked() and revs("wdir()", tracked())' a1 b1 b2 @@ -590,12 +590,12 @@ use rev to restrict matched file R a2 $ fileset "status(0, 1, removed())" a2 - $ fileset "* and status(0, 1, removed())" + $ fileset "tracked() and status(0, 1, removed())" $ fileset -r 4 "status(0, 1, removed())" a2 - $ fileset -r 4 "* and status(0, 1, removed())" - $ fileset "revs('4', * and status(0, 1, removed()))" - $ fileset "revs('0', * and status(0, 1, removed()))" + $ fileset -r 4 "tracked() and status(0, 1, removed())" + $ fileset "revs('4', tracked() and status(0, 1, removed()))" + $ fileset "revs('0', tracked() and status(0, 1, removed()))" a2 check wdir() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 7 of 7] templater: abstract truth testing to fix {if(list_of_empty_strings)}
# HG changeset patch # User Yuya Nishihara # Date 1528518887 -32400 # Sat Jun 09 13:34:47 2018 +0900 # Node ID 4eb2c19f741f50389c3de234654510deede597e2 # Parent 0bf2bc3ec4f89f4a847b68d00011968732aacd7a templater: abstract truth testing to fix {if(list_of_empty_strings)} Non-empty list should always be True even if it's stringified to ''. Spotted by Martin von Zweigbergk. diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -743,6 +743,9 @@ class sessionvars(templateutil.wrapped): def show(self, context, mapping): return self.join(context, '') +def tobool(self, context, mapping): +return bool(self._vars) + def tovalue(self, context, mapping): return self._vars diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -85,6 +85,10 @@ class wrapped(object): """ @abc.abstractmethod +def tobool(self, context, mapping): +"""Return a boolean representation of the inner value""" + +@abc.abstractmethod def tovalue(self, context, mapping): """Move the inner value object out or create a value representation @@ -136,6 +140,9 @@ class wrappedbytes(wrapped): def show(self, context, mapping): return self._value +def tobool(self, context, mapping): +return bool(self._value) + def tovalue(self, context, mapping): return self._value @@ -169,6 +176,14 @@ class wrappedvalue(wrapped): return b'' return pycompat.bytestr(self._value) +def tobool(self, context, mapping): +if self._value is None: +return False +if isinstance(self._value, bool): +return self._value +# otherwise evaluate as string, which means 0 is True +return bool(pycompat.bytestr(self._value)) + def tovalue(self, context, mapping): return self._value @@ -201,6 +216,9 @@ class date(mappable, wrapped): def tomap(self, context): return {'unixtime': self._unixtime, 'tzoffset': self._tzoffset} +def tobool(self, context, mapping): +return True + def tovalue(self, context, mapping): return (self._unixtime, self._tzoffset) @@ -272,6 +290,9 @@ class hybrid(wrapped): return gen() return gen +def tobool(self, context, mapping): +return bool(self._values) + def tovalue(self, context, mapping): # TODO: make it non-recursive for trivial lists/dicts xs = self._values @@ -327,6 +348,9 @@ class hybriditem(mappable, wrapped): return gen() return gen +def tobool(self, context, mapping): +return bool(self.tovalue(context, mapping)) + def tovalue(self, context, mapping): return _unthunk(context, mapping, self._value) @@ -396,6 +420,9 @@ class mappinggenerator(_mappingsequence) def itermaps(self, context): return self._make(context, *self._args) +def tobool(self, context, mapping): +return _nonempty(self.itermaps(context)) + class mappinglist(_mappingsequence): """Wrapper for list of template mappings""" @@ -406,6 +433,9 @@ class mappinglist(_mappingsequence): def itermaps(self, context): return iter(self._mappings) +def tobool(self, context, mapping): +return bool(self._mappings) + class mappedgenerator(wrapped): """Wrapper for generator of strings which acts as a list @@ -449,6 +479,9 @@ class mappedgenerator(wrapped): def show(self, context, mapping): return self.join(context, mapping, '') +def tobool(self, context, mapping): +return _nonempty(self._gen(context)) + def tovalue(self, context, mapping): return [stringify(context, mapping, x) for x in self._gen(context)] @@ -607,6 +640,13 @@ def findsymbolicname(arg): else: return None +def _nonempty(xiter): +try: +next(xiter) +return True +except StopIteration: +return False + def _unthunk(context, mapping, thing): """Evaluate a lazy byte string into value""" if not isinstance(thing, types.GeneratorType): @@ -655,13 +695,7 @@ def evalboolean(context, mapping, arg): thing = stringutil.parsebool(data) else: thing = func(context, mapping, data) -if isinstance(thing, wrapped): -thing = thing.tovalue(context, mapping) -if isinstance(thing, bool): -return thing -# other objects are evaluated as strings, which means 0 is True, but -# empty dict/list should be False as they are expected to be '' -return bool(stringify(context, mapping, thing)) +return makewrapped(context, mapping, thing).tobool(context, mapping) def evaldate(context, mapping, arg, err=None): """Evaluate given argument as a date tuple or a date string; returns diff --git
[PATCH 5 of 7] templatefilters: deprecate hgdate as {date|hgdate} is the default format
# HG changeset patch # User Yuya Nishihara # Date 1521882203 -32400 # Sat Mar 24 18:03:23 2018 +0900 # Node ID bc18058428fc50a9da867e9fd8a3c9f15f133851 # Parent cb223b044175c8444053bd55aa6d78992243c30a templatefilters: deprecate hgdate as {date|hgdate} is the default format diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -241,7 +241,7 @@ def hexfilter(text): @templatefilter('hgdate', intype=templateutil.date) def hgdate(text): """Date. Returns the date as a pair of numbers: "1157407993 -25200" (Unix timestamp, timezone offset). +25200" (Unix timestamp, timezone offset). (DEPRECATED) """ return "%d %d" % text ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 6 of 7] show: stringify filtered list of tags before testing emptiness
# HG changeset patch # User Yuya Nishihara # Date 1528813058 -32400 # Tue Jun 12 23:17:38 2018 +0900 # Node ID 0bf2bc3ec4f89f4a847b68d00011968732aacd7a # Parent bc18058428fc50a9da867e9fd8a3c9f15f133851 show: stringify filtered list of tags before testing emptiness `names % "{ifeq(name, 'tip', '', name)}"}"` may return [''], which shouldn't be falsy, but it is thanks to a templater bug. This patch converts [''] to '' before testing truthness. diff --git a/mercurial/templates/map-cmdline.show b/mercurial/templates/map-cmdline.show --- a/mercurial/templates/map-cmdline.show +++ b/mercurial/templates/map-cmdline.show @@ -15,7 +15,8 @@ cset_shortnode = '{labelcset(shortest(no # Treat branch and tags specially so we don't display "default" or "tip" cset_namespace = '{ifeq(namespace, "branches", names_branches, ifeq(namespace, "tags", names_tags, names_others))}' names_branches = '{ifeq(branch, "default", "", " ({label('log.{colorname}', branch)})")}' -names_tags = '{if(names % "{ifeq(name, 'tip', '', name)}", " ({label('log.{colorname}', join(names % "{ifeq(name, 'tip', '', name)}", ' '))})")}' +names_tags = '{if(stringify(names % "{ifeq(name, 'tip', '', name)}"), + " ({label('log.{colorname}', join(names % "{ifeq(name, 'tip', '', name)}", ' '))})")}' names_others = '{if(names, " ({label('log.{colorname}', join(names, ' '))})")}' cset_shortdesc = '{label("log.description", desc|firstline)}' ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 7] templater: introduce a wrapper for date tuple (BC)
# HG changeset patch # User Yuya Nishihara # Date 1521881642 -32400 # Sat Mar 24 17:54:02 2018 +0900 # Node ID 61e21a5a89d421909c45718ffc50f72cf83ee4b5 # Parent 5eb83a6310845fb61fef9eda799731b90061 templater: introduce a wrapper for date tuple (BC) Strictly speaking, this is BC, but I believe the original string format (str(float(unixtime)) + str(int(tzoffset))) was just plain wrong. diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -367,7 +367,7 @@ class _templateconverter(object): @staticmethod def formatdate(date, fmt): '''return date tuple''' -return date +return templateutil.date(date) @staticmethod def formatdict(data, key, value, fmt, sep): '''build object that can be evaluated as either plain string or dict''' diff --git a/mercurial/templatefuncs.py b/mercurial/templatefuncs.py --- a/mercurial/templatefuncs.py +++ b/mercurial/templatefuncs.py @@ -391,7 +391,7 @@ def localdate(context, mapping, args): raise error.ParseError(_("localdate expects a timezone")) else: tzoffset = dateutil.makedate()[1] -return (date[0], tzoffset) +return templateutil.date((date[0], tzoffset)) @templatefunc('max(iterable)') def max_(context, mapping, args, **kwargs): @@ -461,6 +461,7 @@ def obsfatedate(context, mapping, args): markers = evalfuncarg(context, mapping, args[0]) try: +# TODO: maybe this has to be a wrapped list of date wrappers? data = obsutil.markersdates(markers) return templateutil.hybridlist(data, name='date', fmt='%d %d') except (TypeError, KeyError): diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -240,7 +240,7 @@ def showactivebookmark(context, mapping) def showdate(context, mapping): """Date information. The date when the changeset was committed.""" ctx = context.resource(mapping, 'ctx') -return ctx.date() +return templateutil.date(ctx.date()) @templatekeyword('desc', requires={'ctx'}) def showdescription(context, mapping): diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -35,8 +35,8 @@ True, False, int, float wrappedbytes, wrappedvalue a wrapper for the above printable types. -date tuple -a (unixtime, offset) tuple, which produces no meaningful output by itself. +date +represents a (unixtime, offset) tuple. hybrid represents a list/dict of printable values, which can also be converted diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -172,10 +172,37 @@ class wrappedvalue(wrapped): def tovalue(self, context, mapping): return self._value -# stub for representing a date type; may be a real date type that can -# provide a readable string value -class date(object): -pass +class date(wrapped): +"""Wrapper for date tuple""" + +def __init__(self, value): +# value may be (float, int), but public interface shouldn't support +# floating-point timestamp +self._unixtime, self._tzoffset = map(int, value) + +def contains(self, context, mapping, item): +raise error.ParseError(_('date is not iterable')) + +def getmember(self, context, mapping, key): +raise error.ParseError(_('date is not a dictionary')) + +def getmin(self, context, mapping): +raise error.ParseError(_('date is not iterable')) + +def getmax(self, context, mapping): +raise error.ParseError(_('date is not iterable')) + +def itermaps(self, context): +raise error.ParseError(_("date is not iterable")) + +def join(self, context, mapping, sep): +raise error.ParseError(_("date is not iterable")) + +def show(self, context, mapping): +return '%d %d' % (self._unixtime, self._tzoffset) + +def tovalue(self, context, mapping): +return (self._unixtime, self._tzoffset) class hybrid(wrapped): """Wrapper for list or dict to support legacy template @@ -643,6 +670,9 @@ def evaldate(context, mapping, arg, err= return unwrapdate(context, mapping, thing, err) def unwrapdate(context, mapping, thing, err=None): +if isinstance(thing, date): +return thing.tovalue(context, mapping) +# TODO: update hgweb to not return bare tuple; then just stringify 'thing' thing = unwrapvalue(context, mapping, thing) try: return dateutil.parsedate(thing) diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -107,7 +107,7 @@ Matcher and metadata options $ hg amend -d '2000 1000' -u 'Foo ' -A C D saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (obsstore-off !) $ hg log -r . -T '{node|short} {desc} {files}
[PATCH 2 of 7] templater: promote tomap() to an interface type
# HG changeset patch # User Yuya Nishihara # Date 1524304895 -32400 # Sat Apr 21 19:01:35 2018 +0900 # Node ID 5eb83a6310845fb61fef9eda799731b90061 # Parent 9c54939508aa66b09f2384ac37974addbabb90e9 templater: promote tomap() to an interface type I originally considered merging tomap() with itermaps()/getmember(), but decided to not. We might want to add support for chained map operations (e.g. {foo % func() % ...}), where func() will return a mappable object, and 'foo % func()' will be a mappedgenerator of mappable objects. diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -91,6 +91,16 @@ class wrapped(object): A returned value must be serializable by templaterfilters.json(). """ +class mappable(object): +"""Object which can be converted to a single template mapping""" + +def itermaps(self, context): +yield self.tomap(context) + +@abc.abstractmethod +def tomap(self, context): +"""Create a single template mapping representing this""" + class wrappedbytes(wrapped): """Wrapper for byte string""" @@ -243,7 +253,7 @@ class hybrid(wrapped): for k, v in xs.iteritems()} return [unwrapvalue(context, mapping, x) for x in xs] -class hybriditem(wrapped): +class hybriditem(mappable, wrapped): """Wrapper for non-list/dict object to support map operation This class allows us to handle both: @@ -258,7 +268,7 @@ class hybriditem(wrapped): self._value = value # may be generator of strings self._makemap = makemap -def tomap(self): +def tomap(self, context): return self._makemap(self._key) def contains(self, context, mapping, item): @@ -277,9 +287,6 @@ class hybriditem(wrapped): w = makewrapped(context, mapping, self._value) return w.getmax(context, mapping) -def itermaps(self, context): -yield self.tomap() - def join(self, context, mapping, sep): w = makewrapped(context, mapping, self._value) return w.join(context, mapping, sep) @@ -775,8 +782,8 @@ def runmap(context, mapping, data): def runmember(context, mapping, data): darg, memb = data d = evalwrapped(context, mapping, darg) -if util.safehasattr(d, 'tomap'): -lm = context.overlaymap(mapping, d.tomap()) +if isinstance(d, mappable): +lm = context.overlaymap(mapping, d.tomap(context)) return runsymbol(context, lm, memb) try: return d.getmember(context, mapping, memb) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 7] templater: make date wrapper support dot/map operations
# HG changeset patch # User Yuya Nishihara # Date 1521881959 -32400 # Sat Mar 24 17:59:19 2018 +0900 # Node ID cb223b044175c8444053bd55aa6d78992243c30a # Parent 61e21a5a89d421909c45718ffc50f72cf83ee4b5 templater: make date wrapper support dot/map operations No idea if it will be useful, but it just works. diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -172,7 +172,7 @@ class wrappedvalue(wrapped): def tovalue(self, context, mapping): return self._value -class date(wrapped): +class date(mappable, wrapped): """Wrapper for date tuple""" def __init__(self, value): @@ -192,15 +192,15 @@ class date(wrapped): def getmax(self, context, mapping): raise error.ParseError(_('date is not iterable')) -def itermaps(self, context): -raise error.ParseError(_("date is not iterable")) - def join(self, context, mapping, sep): raise error.ParseError(_("date is not iterable")) def show(self, context, mapping): return '%d %d' % (self._unixtime, self._tzoffset) +def tomap(self, context): +return {'unixtime': self._unixtime, 'tzoffset': self._tzoffset} + def tovalue(self, context, mapping): return (self._unixtime, self._tzoffset) diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -3398,6 +3398,8 @@ Test evaluation of dot operator: ce3cec86e6c26bd9bdfc590a6b92abc9680f1796 $ hg log -R latesttag -r0 -T '{extras.branch}\n' default + $ hg log -R latesttag -r0 -T '{date.unixtime} {localdate(date, "+0200").tzoffset}\n' + 0 -7200 $ hg log -R latesttag -l1 -T '{author.invalid}\n' hg: parse error: 'test' is not a dictionary ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 7] templater: rename mappable to hybriditem as it is the primary use case
# HG changeset patch # User Yuya Nishihara # Date 1528515366 -32400 # Sat Jun 09 12:36:06 2018 +0900 # Node ID 9c54939508aa66b09f2384ac37974addbabb90e9 # Parent 94e4a283c6d720f8b13978de9c750a4d0402f209 templater: rename mappable to hybriditem as it is the primary use case This frees up the name 'mappable' for new interface type. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -31,7 +31,6 @@ from .utils import ( ) _hybrid = templateutil.hybrid -_mappable = templateutil.mappable hybriddict = templateutil.hybriddict hybridlist = templateutil.hybridlist compatdict = templateutil.compatdict @@ -469,7 +468,8 @@ def showmanifest(context, mapping): f = context.process('manifest', mapping) # TODO: perhaps 'ctx' should be dropped from mapping because manifest # rev and node are completely different from changeset's. -return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex}) +return templateutil.hybriditem(f, None, f, + lambda x: {'rev': mrev, 'node': mhex}) @templatekeyword('obsfate', requires={'ui', 'repo', 'ctx'}) def showobsfate(context, mapping): diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -42,7 +42,7 @@ hybrid represents a list/dict of printable values, which can also be converted to mappings by % operator. -mappable +hybriditem represents a scalar printable value, also supports % operator. mappinggenerator, mappinglist diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -215,7 +215,7 @@ class hybrid(wrapped): if util.safehasattr(val, '_makemap'): # a nested hybrid list/dict, which has its own way of map operation return val -return mappable(None, key, val, self._makemap) +return hybriditem(None, key, val, self._makemap) def itermaps(self, context): makemap = self._makemap @@ -243,7 +243,7 @@ class hybrid(wrapped): for k, v in xs.iteritems()} return [unwrapvalue(context, mapping, x) for x in xs] -class mappable(wrapped): +class hybriditem(wrapped): """Wrapper for non-list/dict object to support map operation This class allows us to handle both: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D2938: grep: make grep search on working directory by default
> @yuja I am adding an --unmodified flag to change to change the mode to > grep on the unmodified files as well. > What I am trying to do is :: > > def fns_generator(): > if --unmodified: > for f in ctx: > for f in ctx: > if match(f): > yield f > else : > for f in ctx.files(): > for f in ctx: > if match(f): > yield f Nit: `if` can be narrowed to `ctx`/`ctx.files()`. ``` if --unmodified: fiter = iter(ctx) else: fiter = ctx.files() ``` > Currently, this would work for a single revision, so I am modifying the > `prep` function in grep. > Shall I continue and send the patch ? Seems fine. It should be generally encouraged to send patches than discussing for long without a working code. > but @yuja has asked me to break this patch into three patches. So I guess > this is not going to be merged anyway. To be clear, I suggested to split patches because the original code seemed to add a single knob to switch two more features at once. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2938: grep: make grep search on working directory by default
yuja added a comment. > @yuja I am adding an --unmodified flag to change to change the mode to grep on the unmodified files as well. > What I am trying to do is :: > > def fns_generator(): > if --unmodified: > for f in ctx: > for f in ctx: > if match(f): > yield f > else : > for f in ctx.files(): > for f in ctx: > if match(f): > yield f Nit: `if` can be narrowed to `ctx`/`ctx.files()`. if --unmodified: fiter = iter(ctx) else: fiter = ctx.files() > Currently, this would work for a single revision, so I am modifying the `prep` function in grep. > Shall I continue and send the patch ? Seems fine. It should be generally encouraged to send patches than discussing for long without a working code. > but @yuja has asked me to break this patch into three patches. So I guess > this is not going to be merged anyway. To be clear, I suggested to split patches because the original code seemed to add a single knob to switch two more features at once. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc: martinvonz, av6, yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3667: graft: fix the help text to say `graft reapplies previous options`
> > +The -c/--continue option does reapply all the earlier options. > > Minor nit: > > s/does reapply/reapplies/ Fixed, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3667: graft: fix the help text to say `graft reapplies previous options`
On Tue, Jun 12, 2018 at 12:27:04 +, pulkit (Pulkit Goyal) wrote: > This revision was automatically updated to reflect the committed changes. > Closed by commit rHGad4c5c0af6b5: graft: fix the help text to say `graft > reapplies previous options` (authored by pulkit, committed by ). > > REPOSITORY > rHG Mercurial > > CHANGES SINCE LAST UPDATE > https://phab.mercurial-scm.org/D3667?vs=9014=9021 > > REVISION DETAIL > https://phab.mercurial-scm.org/D3667 > > AFFECTED FILES > mercurial/commands.py > > CHANGE DETAILS > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -2161,10 +2161,7 @@ > Once all conflicts are addressed, the graft process can be > continued with the -c/--continue option. > > -.. note:: > - > - The -c/--continue option does not reapply earlier options, except > - for --force, --user and --date. > +The -c/--continue option does reapply all the earlier options. Minor nit: s/does reapply/reapplies/ Jeff. > > .. container:: verbose > > > > > To: pulkit, #hg-reviewers > Cc: mercurial-devel > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel -- Si hoc legere scis nimium eruditionis habes. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3667: graft: fix the help text to say `graft reapplies previous options`
This revision was automatically updated to reflect the committed changes. Closed by commit rHGad4c5c0af6b5: graft: fix the help text to say `graft reapplies previous options` (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3667?vs=9014=9021 REVISION DETAIL https://phab.mercurial-scm.org/D3667 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2161,10 +2161,7 @@ Once all conflicts are addressed, the graft process can be continued with the -c/--continue option. -.. note:: - - The -c/--continue option does not reapply earlier options, except - for --force, --user and --date. +The -c/--continue option does reapply all the earlier options. .. container:: verbose To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3668: graft: add a new `--stop` flag to stop interrupted graft
This revision was automatically updated to reflect the committed changes. Closed by commit rHG94e4a283c6d7: graft: add a new `--stop` flag to stop interrupted graft (authored by pulkit, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D3668?vs=9013=9022#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3668?vs=9013=9022 REVISION DETAIL https://phab.mercurial-scm.org/D3668 AFFECTED FILES mercurial/cmdutil.py mercurial/commands.py tests/test-completion.t tests/test-graft.t CHANGE DETAILS diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -244,7 +244,7 @@ $ hg ci -m 'commit interrupted graft' abort: graft in progress - (use 'hg graft --continue' or 'hg update' to abort) + (use 'hg graft --continue' or 'hg graft --stop' to abort) [255] Abort the graft and try committing: @@ -1565,3 +1565,108 @@ o 3:9e887f7a939c bar to b | ~ + + $ cd .. + +Testing the --stop flag of `hg graft` which stops the interrupted graft + + $ hg init stopgraft + $ cd stopgraft + $ for ch in a b c d; do echo $ch > $ch; hg add $ch; hg ci -Aqm "added "$ch; done; + + $ hg log -G + @ changeset: 3:9150fe93bec6 + | tag: tip + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: added d + | + o changeset: 2:155349b645be + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: added c + | + o changeset: 1:5f6d8a4bf34a + | user:test + | date:Thu Jan 01 00:00:00 1970 + + | summary: added b + | + o changeset: 0:9092f1db7931 + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: added a + + $ hg up '.^^' + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + + $ echo foo > d + $ hg ci -Aqm "added foo to d" + + $ hg graft --stop + abort: no interrupted graft found + [255] + + $ hg graft -r 3 + grafting 3:9150fe93bec6 "added d" + merging d + warning: conflicts while merging d! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + + $ hg graft --stop --continue + abort: cannot use '--continue' and '--stop' together + [255] + + $ hg graft --stop -U + abort: cannot specify any other flag with '--stop' + [255] + $ hg graft --stop --rev 4 + abort: cannot specify any other flag with '--stop' + [255] + $ hg graft --stop --log + abort: cannot specify any other flag with '--stop' + [255] + + $ hg graft --stop + stopped the interrupted graft + working directory is now at a0deacecd59d + + $ hg diff + + $ hg log -Gr '.' + @ changeset: 4:a0deacecd59d + | tag: tip + ~ parent: 1:5f6d8a4bf34a + user:test + date:Thu Jan 01 00:00:00 1970 + + summary: added foo to d + + $ hg graft -r 2 -r 3 + grafting 2:155349b645be "added c" + grafting 3:9150fe93bec6 "added d" + merging d + warning: conflicts while merging d! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + + $ hg graft --stop + stopped the interrupted graft + working directory is now at 75b447541a9e + + $ hg diff + + $ hg log -G -T "{rev}:{node|short} {desc}" + @ 5:75b447541a9e added c + | + o 4:a0deacecd59d added foo to d + | + | o 3:9150fe93bec6 added d + | | + | o 2:155349b645be added c + |/ + o 1:5f6d8a4bf34a added b + | + o 0:9092f1db7931 added a + diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -312,7 +312,7 @@ debugwireargs: three, four, five, ssh, remotecmd, insecure debugwireproto: localssh, peer, noreadstderr, nologhandshake, ssh, remotecmd, insecure files: rev, print0, include, exclude, template, subrepos - graft: rev, continue, edit, log, force, currentdate, currentuser, date, user, tool, dry-run + graft: rev, continue, stop, edit, log, force, currentdate, currentuser, date, user, tool, dry-run grep: print0, all, text, follow, ignore-case, files-with-matches, line-number, rev, user, date, template, include, exclude heads: rev, topo, active, closed, style, template help: extension, command, keyword, system diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2126,6 +2126,7 @@ 'graft', [('r', 'rev', [], _('revisions to graft'), _('REV')), ('c', 'continue', False, _('resume interrupted graft')), + ('', 'stop', False, _('stop interrupted graft')), ('e', 'edit', False, _('invoke editor on commit messages')), ('', 'log', None, _('append graft info to log message')), ('f', 'force', False, _('force graft')), @@ -2216,6 +2217,15 @@ cont = False
D3711: context: make workingctx.matches() filter our removed files (API)
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaaed058a0390: context: make workingctx.matches() filter our removed files (API) (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3711?vs=9010=9019 REVISION DETAIL https://phab.mercurial-scm.org/D3711 AFFECTED FILES mercurial/context.py tests/test-command-template.t CHANGE DETAILS diff --git a/tests/test-command-template.t b/tests/test-command-template.t --- a/tests/test-command-template.t +++ b/tests/test-command-template.t @@ -4344,6 +4344,12 @@ 0 + $ hg rm a + $ hg log -r "wdir()" -T "{rev}\n{join(files('*'), '\n')}\n" + 2147483647 + aa + b + $ hg revert a Test relpath function diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1227,7 +1227,8 @@ unknown=True, ignored=False)) def matches(self, match): -return sorted(self._repo.dirstate.matches(match)) +ds = self._repo.dirstate +return sorted(f for f in ds.matches(match) if ds[f] != 'r') def ancestors(self): for p in self._parents: To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3712: files: drop now-unnecessary filtering of removed dirstate files
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0c7970d4e6b4: files: drop now-unnecessary filtering of removed dirstate files (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3712?vs=9011=9020 REVISION DETAIL https://phab.mercurial-scm.org/D3712 AFFECTED FILES mercurial/cmdutil.py CHANGE DETAILS diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2134,13 +2134,9 @@ return bad, forgot def files(ui, ctx, m, fm, fmt, subrepos): -rev = ctx.rev() ret = 1 -ds = ctx.repo().dirstate for f in ctx.matches(m): -if rev is None and ds[f] == 'r': -continue fm.startitem() if ui.verbose: fc = ctx[f] To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3710: locate: explicitly use dirstate.matches() for working copy
This revision was automatically updated to reflect the committed changes. Closed by commit rHGfa4a286410a5: locate: explicitly use dirstate.matches() for working copy (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3710?vs=9009=9018 REVISION DETAIL https://phab.mercurial-scm.org/D3710 AFFECTED FILES mercurial/commands.py CHANGE DETAILS diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -,7 +,13 @@ badfn=lambda x, y: False) ui.pager('locate') -for abs in ctx.matches(m): +if ctx.rev() is None: +# When run on the working copy, "locate" includes removed files, so +# we get the list of files from the dirstate. +filesgen = sorted(repo.dirstate.matches(m)) +else: +filesgen = ctx.matches(m) +for abs in filesgen: if opts.get('fullpath'): ui.write(repo.wjoin(abs), end) else: To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3713: revsets: define a none() revset
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf1d55ae2c5c8: revsets: define a none() revset (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3713?vs=9012=9017 REVISION DETAIL https://phab.mercurial-scm.org/D3713 AFFECTED FILES mercurial/revset.py tests/test-revset2.t CHANGE DETAILS diff --git a/tests/test-revset2.t b/tests/test-revset2.t --- a/tests/test-revset2.t +++ b/tests/test-revset2.t @@ -584,6 +584,9 @@ hg: parse error: empty string is not a valid revision [255] +test empty revset + $ hg log 'none()' + we can use patterns when searching for tags $ log 'tag("1..*")' diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -1346,6 +1346,14 @@ result = baseset([rn]) return result & subset +@predicate('none()', safe=True) +def none(repo, subset, x): +"""No changesets. +""" +# i18n: "none" is a keyword +getargs(x, 0, 0, _("none takes no arguments")) +return baseset() + @predicate('obsolete()', safe=True) def obsolete(repo, subset, x): """Mutable changeset with a newer version.""" To: martinvonz, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3668: graft: add a new `--stop` flag to stop interrupted graft
yuja added a comment. > In https://phab.mercurial-scm.org/D3668#58070, @yuja wrote: > > > > The `--stop` flag takes back you to the last successful step i.e. it will keep > > > your grafted commits, it will just clear the mergestate and interrupted graft > > > state. > > > > No idea if git is right regarding UI, but they appear to have `--quit` for > > this. > > > > https://git-scm.com/docs/git-cherry-pick > > I asked people on IRC, nbjoerg and one more said '--stop' is better. However I am fine with changing that to `--quit` Good. Since I don't have any preference either, let's just stick to --stop. Replaced some --abort in error message and queued, thanks. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3668 To: pulkit, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3668: graft: add a new `--stop` flag to stop interrupted graft
> In https://phab.mercurial-scm.org/D3668#58070, @yuja wrote: > > > > The `--stop` flag takes back you to the last successful step i.e. it > will keep > > > your grafted commits, it will just clear the mergestate and > interrupted graft > > > state. > > > > No idea if git is right regarding UI, but they appear to have `--quit` for > > this. > > > > https://git-scm.com/docs/git-cherry-pick > > I asked people on IRC, nbjoerg and one more said '--stop' is better. > However I am fine with changing that to `--quit` Good. Since I don't have any preference either, let's just stick to --stop. Replaced some --abort in error message and queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3711: context: make workingctx.matches() filter our removed files (API)
yuja added a comment. > It seems surprising that workingctx.matches() includes files that had > been removed in the working copy. The callers don't want that either > (besides the `hg locate` that was changed in the previous patch). > > The only observable difference that I'm aware of is that `hg log -T > 'wdir()' -r '{files(...)}'` will no longer include removed files (an > improvement, IMO). That matches `hg files` (but does not match the > deprecated `hg locate`). Queued the series, thanks. FWIW, `ctx.matches()` vs `ctx.walk()` is one of the most obscure API I can't say what is the right behavior. :-) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3711 To: martinvonz, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3711: context: make workingctx.matches() filter our removed files (API)
> It seems surprising that workingctx.matches() includes files that had > been removed in the working copy. The callers don't want that either > (besides the `hg locate` that was changed in the previous patch). > > The only observable difference that I'm aware of is that `hg log -T > 'wdir()' -r '{files(...)}'` will no longer include removed files (an > improvement, IMO). That matches `hg files` (but does not match the > deprecated `hg locate`). Queued the series, thanks. FWIW, `ctx.matches()` vs `ctx.walk()` is one of the most obscure API I can't say what is the right behavior. :-) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH follow-up] perftemplating: abort on incompatible version
On Tue, 12 Jun 2018 09:42:42 +0200, Boris Feld wrote: > # HG changeset patch > # User Boris Feld > # Date 1528736741 -7200 > # Mon Jun 11 19:05:41 2018 +0200 > # Node ID 1d1ccc0388cd266b6186be64dafbc46015440fa0 > # Parent a577a199983c5033192660c55db909df83fe65fc > # EXP-Topic perftemplating > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 1d1ccc0388cd > perftemplating: abort on incompatible version Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH follow-up] statprof: fix save and load
On Tue, 12 Jun 2018 09:54:03 +0200, Boris Feld wrote: > # HG changeset patch > # User Boris Feld > # Date 1528737841 -7200 > # Mon Jun 11 19:24:01 2018 +0200 > # Node ID 4e4c30424be81d5eb3748e4b031b61c7622341b6 > # Parent 15a1e37f80bd5af4b8eedd55b0c347c41a974839 > # EXP-Topic walltime-followup > # Available At https://bitbucket.org/octobus/mercurial-devel/ > # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r > 4e4c30424be8 > statprof: fix save and load Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH follow-up] statprof: fix save and load
# HG changeset patch # User Boris Feld # Date 1528737841 -7200 # Mon Jun 11 19:24:01 2018 +0200 # Node ID 4e4c30424be81d5eb3748e4b031b61c7622341b6 # Parent 15a1e37f80bd5af4b8eedd55b0c347c41a974839 # EXP-Topic walltime-followup # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 4e4c30424be8 statprof: fix save and load Fix these functions even if they don't are used at the moment. Thanks to Yuya Nishihara for spotting that. diff --git a/mercurial/statprof.py b/mercurial/statprof.py --- a/mercurial/statprof.py +++ b/mercurial/statprof.py @@ -350,7 +350,7 @@ def stop(): def save_data(path): with open(path, 'w+') as file: -file.write(str(state.accumulated_time) + '\n') +file.write("%f %f\n" % state.accumulated_time) for sample in state.samples: time = str(sample.time) stack = sample.stack @@ -361,7 +361,7 @@ def save_data(path): def load_data(path): lines = open(path, 'r').read().splitlines() -state.accumulated_time = float(lines[0]) +state.accumulated_time = [float(value) for value in lines[0].split()] state.samples = [] for line in lines[1:]: parts = line.split('\0') ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH follow-up] perftemplating: abort on incompatible version
# HG changeset patch # User Boris Feld # Date 1528736741 -7200 # Mon Jun 11 19:05:41 2018 +0200 # Node ID 1d1ccc0388cd266b6186be64dafbc46015440fa0 # Parent a577a199983c5033192660c55db909df83fe65fc # EXP-Topic perftemplating # Available At https://bitbucket.org/octobus/mercurial-devel/ # hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 1d1ccc0388cd perftemplating: abort on incompatible version This is what the other debug commands do. Thanks to Yuya Nishihara for pointing this out. diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -911,8 +911,8 @@ def perfmoonwalk(ui, repo, **opts): ] + formatteropts) def perftemplating(ui, repo, **opts): if makelogtemplater is None: -ui.write_err('incompatible Mercurial version') -return 1 +raise error.Abort(("perftemplating not available with this Mercurial"), + hint="use 4.3 or later") nullui = ui.copy() nullui.fout = open(os.devnull, 'wb') ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2938: grep: make grep search on working directory by default
sangeet259 added a comment. @martinvonz, thanks for the reviews, but @yuja has asked me to break this patch into three patches. So I guess this is not going to be merged anyway. Currently, I am trying to add a flag like `--all_files` or `--unmodified` which will enable one to grep all the files that were tracked by that revision and not just the changed files. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc: martinvonz, av6, yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel