D2960: stringutil: move person function from templatefilters
av6 requested changes to this revision. av6 added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > templatefilters.py:293-294 > def person(author): > -"""Any text. Returns the name before an email address, > -interpreting it as per RFC 5322. > - Don't remove this docstring (at least not completely), its first paragraph goes to `hg help templates`. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2960 To: sheehan, #hg-reviewers, av6 Cc: av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2959: stringutil: add isauthorwellformed function
av6 added inline comments. INLINE COMMENTS > stringutil.py:310 > +''' > +return bool(_correctauthorformat.match(author)) Nit: `is not None` is more pythonic. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2959 To: sheehan, #hg-reviewers Cc: av6, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V3] remove: add dry-run functionality
yeah, It's not working with largefiles. I am trying to solve this issue. On Sat, Mar 24, 2018 at 8:19 AM, Yuya Nishiharawrote: > On Sat, 24 Mar 2018 01:32:13 +0530, Sushil khanchi wrote: > > # HG changeset patch > > # User Sushil khanchi > > # Date 1521655571 -19800 > > # Wed Mar 21 23:36:11 2018 +0530 > > # Node ID d63af67f326c7478e062d55fd508012beb164a6e > > # Parent b6a4881cec1937a8d9cd2e9bbbdf5ca31cfa73dd > > remove: add dry-run functionality > > > > diff -r b6a4881cec19 -r d63af67f326c hgext/largefiles/overrides.py > > --- a/hgext/largefiles/overrides.py Sun Mar 18 15:32:49 2018 -0400 > > +++ b/hgext/largefiles/overrides.py Wed Mar 21 23:36:11 2018 +0530 > > @@ -271,9 +271,11 @@ > > bad.extend(f for f in lbad) > > return bad > > > > -def cmdutilremove(orig, ui, repo, matcher, prefix, after, force, > subrepos): > > +def cmdutilremove(orig, ui, repo, matcher, prefix, after, force, > subrepos, > > + dryrun): > > normalmatcher = composenormalfilematcher(matcher, > repo[None].manifest()) > > -result = orig(ui, repo, normalmatcher, prefix, after, force, > subrepos) > > +result = orig(ui, repo, normalmatcher, prefix, after, force, > subrepos, > > + dryrun) > > return removelargefiles(ui, repo, False, matcher, after=after, > > force=force) or result > > Can you add a test for largefiles? > > I think removelargefiles() would have unwanted effect on --dry-run. > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH V2] lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794)
# HG changeset patch # User Matt Harbison# Date 1522117116 14400 # Mon Mar 26 22:18:36 2018 -0400 # Node ID f9c8f2bd9362baaeba828f8d6eb7559a748fcc3f # Parent aaabd709df720e456d7f93a1c790a0dbed051b38 lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794) There's a similar test in lfs.wrapper.convertsink(), but I didn't update that because I don't think that the sink repo in a convert can be narrow. It seems reasonable that a narrow clone of an LFS repo may not necessarily be an LFS repo. The only potential issue is that LFS has a hard requirement for changegroup v3, which that extension enables. The use of treemanifest will enable changegroup v3 in narrow clones, because allsupportedversions() in changegroup.py preserves it when it sees a 'treemanifest' requirement. But I don't see where changegroup v3 is enabled for a flat manifest. diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py --- a/hgext/lfs/__init__.py +++ b/hgext/lfs/__init__.py @@ -226,9 +226,11 @@ def reposetup(ui, repo): s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last)) else: s = repo.set('%n', _bin(kwargs[r'node'])) +match = repo.narrowmatch() for ctx in s: # TODO: is there a way to just walk the files in the commit? -if any(ctx[f].islfs() for f in ctx.files() if f in ctx): +if any(ctx[f].islfs() for f in ctx.files() + if f in ctx and match(f)): repo.requirements.add('lfs') repo._writerequirements() repo.prepushoutgoinghooks.add('lfs', wrapper.prepush) diff --git a/tests/test-narrow-commit.t b/tests/test-narrow-commit.t --- a/tests/test-narrow-commit.t +++ b/tests/test-narrow-commit.t @@ -28,7 +28,11 @@ create full repo $ cd .. - $ hg clone --narrow ssh://user@dummy/master narrow --include inside +(The lfs extension does nothing here, but this test ensures that its hook that +determines whether to add the lfs requirement, respects the narrow boundaries.) + + $ hg --config extensions.lfs= clone --narrow ssh://user@dummy/master narrow \ + >--include inside requesting all changes adding changesets adding manifests ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2678: help: supporting both help and doc for aliases
rdamazio updated this revision to Diff 7346. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2678?vs=7331=7346 REVISION DETAIL https://phab.mercurial-scm.org/D2678 AFFECTED FILES hgext/show.py mercurial/configitems.py mercurial/dispatch.py mercurial/help.py mercurial/ui.py tests/test-alias.t tests/test-help.t CHANGE DETAILS diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -777,9 +777,9 @@ $ hg help shellalias hg shellalias - shell alias for: - -echo hi + shell alias for: echo hi + + (no help text available) defined by: helpext diff --git a/tests/test-alias.t b/tests/test-alias.t --- a/tests/test-alias.t +++ b/tests/test-alias.t @@ -4,9 +4,13 @@ > # should clobber ci but not commit (issue2993) > ci = version > myinit = init + > myinit:doc = This is my documented alias for init. + > myinit:help = [OPTIONS] [BLA] [BLE] > mycommit = commit + > mycommit:doc = This is my alias with only doc. > optionalrepo = showconfig alias.myinit > cleanstatus = status -c + > cleanstatus:help = [ONLYHELPHERE] > unknown = bargle > ambiguous = s > recursive = recursive @@ -20,9 +24,13 @@ > no--config = status --config a.config=1 > mylog = log > lognull = log -r null + > lognull:doc = Logs the null rev + > lognull:help = foo bar baz > shortlog = log --template '{rev} {node|short} | {date|isodate}\n' > positional = log --template '{\$2} {\$1} | {date|isodate}\n' > dln = lognull --debug + > recursivedoc = dln + > recursivedoc:doc = Logs the null rev in debug mode > nousage = rollback > put = export -r 0 -o "\$FOO/%R.diff" > blank = !printf '\n' @@ -53,11 +61,148 @@ > log = -v > EOF - basic $ hg myinit alias +help + + $ hg help -c | grep myinit + myinit This is my documented alias for init. + $ hg help -c | grep mycommit + mycommit This is my alias with only doc. + $ hg help -c | grep cleanstatus + cleanstatusshow changed files in the working directory + $ hg help -c | grep lognull + lognullLogs the null rev + $ hg help -c | grep dln + dlnLogs the null rev + $ hg help -c | grep recursivedoc + recursivedoc Logs the null rev in debug mode + $ hg help myinit + hg myinit [OPTIONS] [BLA] [BLE] + + alias for: hg init + + This is my documented alias for init. + + defined by: * (glob) + */* (glob) (?) + */* (glob) (?) + */* (glob) (?) + + options: + + -e --ssh CMD specify ssh command to use + --remotecmd CMD specify hg command to run on the remote side + --insecure do not verify server certificate (ignoring web.cacerts + config) + + (some details hidden, use --verbose to show complete help) + + $ hg help mycommit + hg mycommit [OPTION]... [FILE]... + + alias for: hg commit + + This is my alias with only doc. + + defined by: * (glob) + */* (glob) (?) + */* (glob) (?) + */* (glob) (?) + + options ([+] can be repeated): + + -A --addremove mark new/missing files as added/removed before +committing + --close-branchmark a branch head as closed + --amend amend the parent of the working directory + -s --secret use the secret phase for committing + -e --editinvoke editor on commit messages + -i --interactive use interactive mode + -I --include PATTERN [+] include names matching the given patterns + -X --exclude PATTERN [+] exclude names matching the given patterns + -m --message TEXTuse text as commit message + -l --logfile FILEread commit message from file + -d --date DATE record the specified date as commit date + -u --user USER record the specified user as committer + -S --subreposrecurse into subrepositories + + (some details hidden, use --verbose to show complete help) + + $ hg help cleanstatus + hg cleanstatus [ONLYHELPHERE] + + alias for: hg status -c + + show changed files in the working directory + + Show status of files in the repository. If names are given, only files + that match are shown. Files that are clean or ignored or the source of a + copy/move operation, are not listed unless -c/--clean, -i/--ignored, + -C/--copies or -A/--all are given. Unless options described with "show + only ..." are given, the options -mardu are used. + + Option -q/--quiet hides untracked (unknown and ignored) files unless + explicitly requested with -u/--unknown or -i/--ignored. + + Note: + 'hg status' may appear to disagree with diff if permissions have + changed or a merge has occurred. The standard diff format does not + report permission changes and diff only reports changes relative to one + merge
D2678: help: supporting both help and doc for aliases
rdamazio added a comment. Sorry about that, I had fixed this one and forgot to re-upload. Try now. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2678 To: rdamazio, #hg-reviewers, durin42, pulkit Cc: mharbison72, spectral, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2904: templatefuncs: add mailmap template function
sheehan updated this revision to Diff 7345. sheehan marked 5 inline comments as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2904?vs=7163=7345 REVISION DETAIL https://phab.mercurial-scm.org/D2904 AFFECTED FILES mercurial/templatefuncs.py mercurial/utils/stringutil.py tests/test-mailmap.t CHANGE DETAILS diff --git a/tests/test-mailmap.t b/tests/test-mailmap.t new file mode 100644 --- /dev/null +++ b/tests/test-mailmap.t @@ -0,0 +1,67 @@ +Create a repo and add some commits + + $ hg init mm + $ cd mm + $ echo "Test content" > testfile1 + $ hg add testfile1 + $ hg commit -m "First commit" -u "Proper" + $ echo "Test content 2" > testfile2 + $ hg add testfile2 + $ hg commit -m "Second commit" -u "Commit Name 2 " + $ echo "Test content 3" > testfile3 + $ hg add testfile3 + $ hg commit -m "Third commit" -u "Commit Name 3 " + $ echo "Test content 4" > testfile4 + $ hg add testfile4 + $ hg commit -m "Fourth commit" -u "Commit Name 4 " + +Add a .mailmap file with each possible entry type plus comments + $ cat > .mailmap << EOF + > # Comment shouldn't break anything + > # Should update email only + > Proper Name 2 # Should update name only + > Proper Name 3 # Should update name, email due to email + > Proper Name 4 Commit Name 4 # Should update name, email due to name, email + > EOF + $ hg add .mailmap + $ hg commit -m "Add mailmap file" -u "Testuser " + +Output of commits should be normal without filter + $ hg log -T "{author}\n" -r "all()" + Proper + Commit Name 2 + Commit Name 3 + Commit Name 4 + Testuser + +Output of commits with filter shows their mailmap values + $ hg log -T "{mailmap(author)}\n" -r "all()" + Proper + Proper Name 2 + Proper Name 3 + Proper Name 4 + Testuser + +Add new mailmap entry for testuser + $ cat >> .mailmap << EOF + > + > EOF + +Output of commits with filter shows their updated mailmap values + $ hg log -T "{mailmap(author)}\n" -r "all()" + Proper + Proper Name 2 + Proper Name 3 + Proper Name 4 + Testuser + +A commit with improperly formatted user field should not break the filter + $ echo "some more test content" > testfile1 + $ hg commit -m "Commit with improper user field" -u "Improper user" + $ hg log -T "{mailmap(author)}\n" -r "all()" + Proper + Proper Name 2 + Proper Name 3 + Proper Name 4 + Testuser + Improper user diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -14,6 +14,7 @@ import textwrap from ..i18n import _ +from ..thirdparty import attr from .. import ( encoding, @@ -312,6 +313,7 @@ def person(author): """Any text. Returns the name before an email address, interpreting it as per RFC 5322. + >>> person(b'foo@bar') 'foo' >>> person(b'Foo Bar ') @@ -334,3 +336,129 @@ return author[:f].strip(' "').replace('\\"', '"') f = author.find('@') return author[:f].replace('.', ' ') + +@attr.s(hash=True) +class mailmapping(object): +'''Represents a username/email key or value in +a mailmap file''' +email = attr.ib() +name = attr.ib(default=None) + +def parsemailmap(mailmapcontent): +"""Parses data in the .mailmap format + +>>> mmdata = "\\n".join([ +... '# Comment', +... 'Name ', +... ' ', +... 'Name ', +... 'Name Commit ', +... ]) +>>> mm = parsemailmap(mmdata) +>>> for key in sorted(mm.keys()): +... print(key) +mailmapping(email='comm...@email.xx', name=None) +mailmapping(email='comm...@email.xx', name=None) +mailmapping(email='comm...@email.xx', name=None) +mailmapping(email='comm...@email.xx', name='Commit') +>>> for val in sorted(mm.values()): +... print(val) +mailmapping(email='comm...@email.xx', name='Name') +mailmapping(email='n...@email.xx', name=None) +mailmapping(email='pro...@email.xx', name='Name') +mailmapping(email='pro...@email.xx', name='Name') +""" +mailmap = {} +for line in mailmapcontent.splitlines(): + +# Don't bother checking the line if it is a comment or +# is an improperly formed author field +if line.lstrip().startswith('#') or any(c not in line for c in '<>@'): +continue + +# name, email hold the parsed emails and names for each line +
D2959: stringutil: add isauthorwellformed function
sheehan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The regular expression for this function formerly lived at https://hg.mozilla.org/hgcustom/version-control-tools/file/tip/hghooks/mozhghooks/author_format.py#l13 REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2959 AFFECTED FILES mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -286,3 +286,25 @@ If s is not a valid boolean, returns None. """ return _booleans.get(s.lower(), None) + +_correctauthorformat = remod.compile('^[^<]+\s\<[^<>]+@[^<>]+\>$') +def isauthorwellformed(author): +'''Return True if the author field is well formed +(ie "Contributor Name") + +>>> isauthorwellformed('Good Author ') +True +>>> isauthorwellformed('Author ') +True +>>> isauthorwellformed('Bad Author') +False +>>> isauthorwellformed('Bad Author >> isauthorwellformed('Bad Author aut...@author.com') +False +>>> isauthorwellformed(' ') +False +>>> isauthorwellformed('Bad Author ') +False +''' +return bool(_correctauthorformat.match(author)) To: sheehan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2960: stringutil: move person function from templatefilters
sheehan created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Move the person function from template filters to the stringutil module, so it can be reused in the mailmap template function. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2960 AFFECTED FILES mercurial/templatefilters.py mercurial/utils/stringutil.py CHANGE DETAILS diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -308,3 +308,29 @@ False ''' return bool(_correctauthorformat.match(author)) + +def person(author): +"""Any text. Returns the name before an email address, +interpreting it as per RFC 5322. +>>> person(b'foo@bar') +'foo' +>>> person(b'Foo Bar') +'Foo Bar' +>>> person(b'"Foo Bar" ') +'Foo Bar' +>>> person(b'"Foo \"buz\" Bar" ') +'Foo "buz" Bar' +>>> # The following are invalid, but do exist in real-life +... +>>> person(b'Foo "buz" Bar ') +'Foo "buz" Bar' +>>> person(b'"Foo Bar ') +'Foo Bar' +""" +if '@' not in author: +return author +f = author.find('<') +if f != -1: +return author[:f].strip(' "').replace('\\"', '"') +f = author.find('@') +return author[:f].replace('.', ' ') diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -290,31 +290,7 @@ @templatefilter('person') def person(author): -"""Any text. Returns the name before an email address, -interpreting it as per RFC 5322. - ->>> person(b'foo@bar') -'foo' ->>> person(b'Foo Bar ') -'Foo Bar' ->>> person(b'"Foo Bar" ') -'Foo Bar' ->>> person(b'"Foo \"buz\" Bar" ') -'Foo "buz" Bar' ->>> # The following are invalid, but do exist in real-life -... ->>> person(b'Foo "buz" Bar ') -'Foo "buz" Bar' ->>> person(b'"Foo Bar ') -'Foo Bar' -""" -if '@' not in author: -return author -f = author.find('<') -if f != -1: -return author[:f].strip(' "').replace('\\"', '"') -f = author.find('@') -return author[:f].replace('.', ' ') +return stringutil.person(author) @templatefilter('revescape') def revescape(text): To: sheehan, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2593: state: add logic to parse the state file in old way if cbor fails
yuja added inline comments. INLINE COMMENTS > martinvonz wrote in state.py:84 > Oh, and I should clarify that I think the root of the problem is that you're > mixing the class for reading with state itself (but only the top-level items > of it). Let's say someone realizes they want to iterate over the items in the > state, would we also add a .items() then? (I don't think that's a likely > scenario, but it shows what I mean.) Sorry if it's already discussed, but what's the benefit of `cmdstate` not being a plain dict? I think plain load/save functions are much simpler than a dict-like object backed by file, i.e. state = statemod.load(repo, fname) state = {'version': 1, 'nodes': nodelines} statemod.save(repo, fname, state) (statemod.load/save could be a class for serialization/deserialization) The state dict would be wrapped anyway depending on application logic. If we can find out a common behavior between "state"s, we can extract it to a state class, but that will still be separated from the storage format. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2593 To: pulkit, #hg-reviewers Cc: yuja, martinvonz, indygreg, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2943: grep: fixes errorneous output of grep in forward order
yuja accepted this revision. yuja added a comment. This revision is now accepted and ready to land. Queued, thanks. Adjusted the commit message to close " (issue3885)". REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2943 To: sangeet259, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2593: state: add logic to parse the state file in old way if cbor fails
martinvonz added inline comments. INLINE COMMENTS > martinvonz wrote in state.py:84 > If it's up to me, I'd definitely say that you should change it. I don't see > any benefits of the current proposal. I'd be happy to hear what other > reviewers think. Oh, and I should clarify that I think the root of the problem is that you're mixing the class for reading with state itself (but only the top-level items of it). Let's say someone realizes they want to iterate over the items in the state, would we also add a .items() then? (I don't think that's a likely scenario, but it shows what I mean.) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2593 To: pulkit, #hg-reviewers Cc: martinvonz, indygreg, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2593: state: add logic to parse the state file in old way if cbor fails
martinvonz added inline comments. INLINE COMMENTS > pulkit wrote in state.py:84 > I don't feel convinced on what can be the benefit of it and my opinion can be > influenced by how I used it in evolve extension. But I can change it the > other way around too, let me know if you want me to change. If it's up to me, I'd definitely say that you should change it. I don't see any benefits of the current proposal. I'd be happy to hear what other reviewers think. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2593 To: pulkit, #hg-reviewers Cc: martinvonz, indygreg, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2943: grep: fixes errorneous output of grep in forward order
sangeet259 updated this revision to Diff 7342. sangeet259 edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2943?vs=7321=7342 REVISION DETAIL https://phab.mercurial-scm.org/D2943 AFFECTED FILES mercurial/commands.py tests/test-grep.t CHANGE DETAILS diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -330,6 +330,18 @@ color:3:-:red color:1:+:red + +Issue3885: test that changing revision order does not alter the +revisions printed, just their order. + + $ hg grep --all red -r "all()" + color:1:+:red + color:3:-:red + + $ hg grep --all red -r "reverse(all())" + color:3:-:red + color:1:+:red + $ cd .. $ hg init a diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2589,8 +2589,11 @@ skip[fn] = True if copy: skip[copy] = True -del matches[rev] del revfiles[rev] +# We will keep the matches dict for the duration of the window +# clear the matches dict once the window is over +if not revfiles: +matches.clear() fm.end() return not found To: sangeet259, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2943: grep: fixes errorneous output of grep in forward order
sangeet259 added a comment. @yuja rebase it on which revision? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2943 To: sangeet259, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2591: state: import the file to write state files from evolve extension
yuja added inline comments. INLINE COMMENTS > state.py:55 > +def __nonzero__(self): > +return self.exists() > + Nit: this seems too clever. I wouldn't expect `if state` issues a system call. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2591 To: pulkit, #hg-reviewers, indygreg Cc: yuja, indygreg, martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2855: graft: add a version number to the state file formats
yuja added a comment. Perhaps the version shouldn't be in the CBOR data structure, because future state file might not be a superset of CBOR. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2855 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
D2945: state: add a magicheader to each state file
yuja added a comment. I think the magic has to vary depending on the current state file format. The state file must be backward/forward compatible with the older/newer formats. If the current magic is `2\n` (and is parsed as `int(f.readline())`) for example, the CBOR preamble would have to be `3\n`. Otherwise, old hg client cant determine whether the state file is corrupted or written by newer client. FWIW, last time I reviewed `simplekeyvaluefile`, I insisted that a parser should take a file stream instead of a filename, so the caller can handle compatibility thingy. with open("statefile", "rb") as fp: try: version = int(fp.readline()) except ValueError: raise some nicer exception if version == 2: return readold(fp) elif version == 3: return readcbor(fp) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2945 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
D2096: infinitepush: move the extension to core from fb-hgext
pulkit added a comment. In https://phab.mercurial-scm.org/D2096#43544, @indygreg wrote: > Per discussion at sprint, Pulkit will follow up by deleting yet more code around workspaces and scratch branches. We're going to focus on the "try server" use case for the initial landing. > > We will land the full code initially. So if we want to land what we have now and delete code later (rather than waiting for all the commits before landing anything), I'm OK with that. The last commit of this 20 patch series get us to the state where we can easily use it for "try server" use case with no client side wrapping required. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2096 To: pulkit, #hg-reviewers, indygreg Cc: indygreg, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2958: infinitepush: introduce server option to route every push to bundlestore
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch introduces a new config option for server `infinitepush.pushtobundlestore` which if sets to True, the server will route each incoming push to the bundlestore and store all the parts i.e. changegroups, phases, obsmarkers in the bundlestore and won't be applied to the revlog. This config option does not need any client side wrapping and does not need any custom bundle2 part or stream level parameter to decide where the push should go. This is very useful for Mozilla CI use case where they have a central server that recieves pushes to trigger code-reviews, trigger a test run of CI, run static analysis etc. The server using the new config option can stash standalone bundles to the bundlestore and server can get access to individual revisions on demand. A new test file which has related tests are added for the config option. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2958 AFFECTED FILES hgext/infinitepush/__init__.py tests/test-infinitepush-ci.t CHANGE DETAILS diff --git a/tests/test-infinitepush-ci.t b/tests/test-infinitepush-ci.t new file mode 100644 --- /dev/null +++ b/tests/test-infinitepush-ci.t @@ -0,0 +1,344 @@ +Testing the case when there is no infinitepush extension present on the client +side and the server routes each push to bundlestore. This case is very much +similar to CI use case. + +Setup +- + + $ . "$TESTDIR/library-infinitepush.sh" + $ cat >> $HGRCPATH < [alias] + > glog = log -GT "{rev}:{node|short} {desc}\n{phase}" + > EOF + $ cp $HGRCPATH $TESTTMP/defaulthgrc + $ hg init repo + $ cd repo + $ setupserver + $ echo "pushtobundlestore = True" >> .hg/hgrc + $ echo "[extensions]" >> .hg/hgrc + $ echo "infinitepush=" >> .hg/hgrc + $ echo initialcommit > initialcommit + $ hg ci -Aqm "initialcommit" + $ hg phase --public . + + $ cd .. + $ hg clone repo client -q + $ cd client + +Pushing a new commit from the client to the server +- + + $ echo foobar > a + $ hg ci -Aqm "added a" + $ hg glog + @ 1:6cb0989601f1 added a + | draft + o 0:67145f466344 initialcommit + public + + $ hg push + pushing to $TESTTMP/repo + searching for changes + storing changesets on the bundlestore + pushing 1 commit: + 6cb0989601f1 added a + + $ scratchnodes + 6cb0989601f1fb5805238edfb16f3606713d9a0b a4c202c147a9c4bb91bbadb56321fc5f3950f7f2 + +Understanding how data is stored on the bundlestore in server +- + +There are two things, filebundlestore and index + $ ls ../repo/.hg/scratchbranches + filebundlestore + index + +filebundlestore stores the bundles + $ ls ../repo/.hg/scratchbranches/filebundlestore/a4/c2/ + a4c202c147a9c4bb91bbadb56321fc5f3950f7f2 + +index/nodemap stores a map of node id and file in which bundle is stored in filebundlestore + $ ls ../repo/.hg/scratchbranches/index/ + nodemap + $ ls ../repo/.hg/scratchbranches/index/nodemap/ + 6cb0989601f1fb5805238edfb16f3606713d9a0b + + $ cd ../repo + +Checking that the commit was not applied to revlog on the server +-- + + $ hg glog + @ 0:67145f466344 initialcommit + public + +Applying the changeset from the bundlestore + + + $ hg unbundle .hg/scratchbranches/filebundlestore/a4/c2/a4c202c147a9c4bb91bbadb56321fc5f3950f7f2 + adding changesets + adding manifests + adding file changes + added 1 changesets with 1 changes to 1 files + new changesets 6cb0989601f1 + (run 'hg update' to get a working copy) + + $ hg glog + o 1:6cb0989601f1 added a + | public + @ 0:67145f466344 initialcommit + public + +Pushing more changesets from the local repo + + + $ cd ../client + $ echo b > b + $ hg ci -Aqm "added b" + $ echo c > c + $ hg ci -Aqm "added c" + $ hg glog + @ 3:bf8a6e3011b3 added c + | draft + o 2:eaba929e866c added b + | draft + o 1:6cb0989601f1 added a + | public + o 0:67145f466344 initialcommit + public + + $ hg push + pushing to $TESTTMP/repo + searching for changes + storing changesets on the bundlestore + pushing 2 commits: + eaba929e866c added b + bf8a6e3011b3 added c + +Checking that changesets are not applied on the server +-- + + $ hg glog -R ../repo + o 1:6cb0989601f1 added a + | public + @ 0:67145f466344 initialcommit + public + +Both of the new changesets are stored in a single bundle-file + $ scratchnodes + 6cb0989601f1fb5805238edfb16f3606713d9a0b a4c202c147a9c4bb91bbadb56321fc5f3950f7f2 + bf8a6e3011b345146bbbedbcb1ebd4837571492a ee41a41cefb7817cbfb235b4f6e9f27dbad6ca1f +
D2957: infinitepush: don't wrap bundle2.processparts while calling `hg unbundle`
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch adds dirty logic to check whether we are processing `hg unbundle` instead of an `hg incoming` to prevent the wrapping of bundle2.processparts function. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2957 AFFECTED FILES hgext/infinitepush/__init__.py CHANGE DETAILS diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -871,6 +871,13 @@ return logger def processparts(orig, repo, op, unbundler): + +# make sure we don't wrap processparts in case of `hg unbundle` +tr = repo.currenttransaction() +if tr: +if tr.names[0].startswith('unbundle'): +return orig(repo, op, unbundler) + if unbundler.params.get('infinitepush') != 'True': return orig(repo, op, unbundler) 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
D2956: inifnitepush: use utils.{stringutil|procutil}.* instead of util.*
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Recently in core, util.py is splitted into various modules in mercurial/utils/. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2956 AFFECTED FILES hgext/infinitepush/__init__.py hgext/infinitepush/fileindexapi.py CHANGE DETAILS diff --git a/hgext/infinitepush/fileindexapi.py b/hgext/infinitepush/fileindexapi.py --- a/hgext/infinitepush/fileindexapi.py +++ b/hgext/infinitepush/fileindexapi.py @@ -15,7 +15,7 @@ import os -from mercurial import util +from mercurial.utils import stringutil from . import indexapi @@ -77,7 +77,7 @@ def _listbookmarks(self, pattern): if pattern.endswith('*'): pattern = 're:^' + pattern[:-1] + '.*' -kind, pat, matcher = util.stringmatcher(pattern) +kind, pat, matcher = stringutil.stringmatcher(pattern) prefixlen = len(self._bookmarkmap) + 1 for dirpath, _, books in self._repo.vfs.walk(self._bookmarkmap): for book in books: diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -101,6 +101,11 @@ from mercurial.i18n import _ +from mercurial.utils import ( +procutil, +stringutil, +) + from mercurial import ( bundle2, changegroup, @@ -272,7 +277,8 @@ scratchbranchpat = ui.config('infinitepush', 'branchpattern') if scratchbranchpat: global _scratchbranchmatcher -kind, pat, _scratchbranchmatcher = util.stringmatcher(scratchbranchpat) +kind, pat, _scratchbranchmatcher = \ +stringutil.stringmatcher(scratchbranchpat) def serverextsetup(ui): origpushkeyhandler = bundle2.parthandlermapping['pushkey'] @@ -333,7 +339,7 @@ results.update(index.getbookmarks(pattern)) if pattern.endswith('*'): pattern = 're:^' + pattern[:-1] + '.*' -kind, pat, matcher = util.stringmatcher(pattern) +kind, pat, matcher = stringutil.stringmatcher(pattern) for bookmark, node in bookmarks.iteritems(): if matcher(bookmark): results[bookmark] = node @@ -845,7 +851,7 @@ if not logger: ui = op.repo.ui try: -username = util.getuser() +username = procutil.getuser() except Exception: username = 'unknown' # Generate random request id to be able to find all logged entries 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
D2954: infinitepush: drop the wrapping of update command on client side
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The extension wraps update command to client side to add functionality to pull and checkout to a revision if it does not present locally. There is a twist to that, only changesets which can resolve to remotenames can be pulled using this. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2954 AFFECTED FILES hgext/infinitepush/__init__.py tests/test-infinitepush.t CHANGE DETAILS diff --git a/tests/test-infinitepush.t b/tests/test-infinitepush.t --- a/tests/test-infinitepush.t +++ b/tests/test-infinitepush.t @@ -165,49 +165,3 @@ (run 'hg heads .' to see heads, 'hg merge' to merge) $ hg log -r scratch/scratchontopofpublic -T '{phase}' draft (no-eol) -Strip scratchontopofpublic commit and do hg update - $ hg log -r tip -T '{node}\n' - c70aee6da07d7cdb9897375473690df3a8563339 - $ echo "[extensions]" >> .hg/hgrc - $ echo "strip=" >> .hg/hgrc - $ hg strip -q tip - $ hg up c70aee6da07d7cdb9897375473690df3a8563339 - 'c70aee6da07d7cdb9897375473690df3a8563339' does not exist locally - looking for it remotely... - pulling from ssh://user@dummy/repo - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 1 files - new changesets c70aee6da07d - (run 'hg update' to get a working copy) - 'c70aee6da07d7cdb9897375473690df3a8563339' found remotely - 2 files updated, 0 files merged, 2 files removed, 0 files unresolved - -Trying to pull from bad path - $ hg strip -q tip - $ hg --config paths.default=badpath up c70aee6da07d7cdb9897375473690df3a8563339 - 'c70aee6da07d7cdb9897375473690df3a8563339' does not exist locally - looking for it remotely... - pulling from $TESTTMP/client2/badpath (glob) - pull failed: repository $TESTTMP/client2/badpath not found - abort: unknown revision 'c70aee6da07d7cdb9897375473690df3a8563339'! - [255] - -Strip commit and pull it using hg update with bookmark name - $ hg strip -q d8fde0ddfc96 - $ hg book -d scratch/mybranch - $ hg up scratch/mybranch - 'scratch/mybranch' does not exist locally - looking for it remotely... - pulling from ssh://user@dummy/repo - searching for changes - adding changesets - adding manifests - adding file changes - added 1 changesets with 1 changes to 2 files - new changesets d8fde0ddfc96 - (run 'hg update' to get a working copy) - 'scratch/mybranch' found remotely - 2 files updated, 0 files merged, 1 files removed, 0 files unresolved - (activating bookmark scratch/mybranch) - $ hg log -r scratch/mybranch -T '{node}' - d8fde0ddfc962183977f92d2bc52d303b8840f9d (no-eol) diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -91,7 +91,6 @@ import re import socket import subprocess -import sys import tempfile import time @@ -314,7 +313,6 @@ _('force push to go to bundle store (EXPERIMENTAL)'))) extensions.wrapcommand(commands.table, 'pull', _pull) -extensions.wrapcommand(commands.table, 'update', _update) extensions.wrapfunction(discovery, 'checkheads', _checkheads) @@ -579,39 +577,6 @@ return "%s %s\n" % (0, r) return _lookup -def _update(orig, ui, repo, node=None, rev=None, **opts): -if rev and node: -raise error.Abort(_("please specify just one revision")) - -if not opts.get('date') and (rev or node) not in repo: -mayberemote = rev or node -mayberemote = _tryhoist(ui, mayberemote) -dopull = False -kwargs = {} -if _scratchbranchmatcher(mayberemote): -dopull = True -kwargs['bookmark'] = [mayberemote] -elif len(mayberemote) == 40 and _maybehash(mayberemote): -dopull = True -kwargs['rev'] = [mayberemote] - -if dopull: -ui.warn( -_("'%s' does not exist locally - looking for it " + - "remotely...\n") % mayberemote) -# Try pulling node from remote repo -try: -cmdname = '^pull' -pullcmd = commands.table[cmdname][0] -pullopts = dict(opt[1:3] for opt in commands.table[cmdname][1]) -pullopts.update(kwargs) -pullcmd(ui, repo, **pullopts) -except Exception: -ui.warn(_('pull failed: %s\n') % sys.exc_info()[1]) -else: -ui.warn(_("'%s' found remotely\n") % mayberemote) -return orig(ui, repo, node, rev, **opts) - def _pull(orig, ui, repo, source="default", **opts): # Copy paste from `pull` command source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) To: pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list
D2955: infinitpush: delete the non-forward-move flag for hg push
pulkit 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/D2955 AFFECTED FILES hgext/infinitepush/__init__.py hgext/infinitepush/bundleparts.py tests/test-infinitepush-bundlestore.t CHANGE DETAILS diff --git a/tests/test-infinitepush-bundlestore.t b/tests/test-infinitepush-bundlestore.t --- a/tests/test-infinitepush-bundlestore.t +++ b/tests/test-infinitepush-bundlestore.t @@ -303,14 +303,6 @@ $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes - remote: non-forward push - remote: (use --non-forward-move to override) - abort: push failed on remote - [255] - - $ hg push -r . -B scratch/mybranch --non-forward-move - pushing to ssh://user@dummy/repo - searching for changes remote: pushing 5 commits: remote: 20759b6926ce scratchcommit remote: 1de1d7d92f89 new scratch commit diff --git a/hgext/infinitepush/bundleparts.py b/hgext/infinitepush/bundleparts.py --- a/hgext/infinitepush/bundleparts.py +++ b/hgext/infinitepush/bundleparts.py @@ -22,8 +22,7 @@ scratchbranchparttype = 'b2x:infinitepush' -def getscratchbranchparts(repo, peer, outgoing, confignonforwardmove, - ui, bookmark): +def getscratchbranchparts(repo, peer, outgoing, ui, bookmark): if not outgoing.missing: raise error.Abort(_('no commits to push')) @@ -49,8 +48,6 @@ params['bookprevnode'] = '' if bookmark in repo: params['bookprevnode'] = repo[bookmark].hex() -if confignonforwardmove: -params['force'] = '1' # Do not send pushback bundle2 part with bookmarks if remotenames extension # is enabled. It will be handled manually in `_push()` diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -165,14 +165,10 @@ configitem('experimental', 'infinitepush-scratchpush', default=False, ) -configitem('experimental', 'non-forward-move', -default=False, -) experimental = 'experimental' configbookmark = 'server-bundlestore-bookmark' configscratchpush = 'infinitepush-scratchpush' -confignonforwardmove = 'non-forward-move' scratchbranchparttype = bundleparts.scratchbranchparttype cmdtable = infinitepushcommands.cmdtable @@ -303,11 +299,6 @@ def clientextsetup(ui): entry = extensions.wrapcommand(commands.table, 'push', _push) -if not any(a for a in entry[1] if a[1] == 'non-forward-move'): -entry[1].append(('', 'non-forward-move', None, - _('allows moving a remote bookmark to an ' - 'arbitrary place'))) - entry[1].append( ('', 'bundle-store', None, _('force push to go to bundle store (EXPERIMENTAL)'))) @@ -712,8 +703,6 @@ # containing `pushkey` part to update bookmarks) ui.setconfig(experimental, 'bundle2.pushback', True) -ui.setconfig(experimental, confignonforwardmove, - opts.get('non_forward_move'), '--non-forward-move') if scratchpush: # this is an infinitepush, we don't want the bookmark to be applied # rather that should be stored in the bundlestore @@ -806,12 +795,9 @@ # code path. bundler.addparam("infinitepush", "True") -nonforwardmove = pushop.force or pushop.ui.configbool(experimental, - confignonforwardmove) scratchparts = bundleparts.getscratchbranchparts(pushop.repo, pushop.remote, pushop.outgoing, - nonforwardmove, pushop.ui, bookmark) @@ -838,12 +824,7 @@ if oldnode in bundle and list(bundle.set('bundle() & %s::', oldnode)): return revs -# Forced non-fast forward update -if force: -return revs -else: -raise error.Abort(_('non-forward push'), - hint=_('use --non-forward-move to override')) +return revs @contextlib.contextmanager def logservicecall(logger, service, **kwargs): 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
D2108: infinitepush: drop the `--to` flag to push and use `-B` instead
pulkit updated this revision to Diff 7334. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2108?vs=5369=7334 REVISION DETAIL https://phab.mercurial-scm.org/D2108 AFFECTED FILES hgext/infinitepush/__init__.py tests/test-infinitepush-bundlestore.t tests/test-infinitepush.t tests/test-issue4074.t CHANGE DETAILS diff --git a/tests/test-issue4074.t b/tests/test-issue4074.t --- a/tests/test-issue4074.t +++ b/tests/test-issue4074.t @@ -26,4 +26,3 @@ Time a check-in, should never take more than 10 seconds user time: $ hg ci --time -m1 - time: real .* secs .user [0-9][.].* sys .* (re) diff --git a/tests/test-infinitepush.t b/tests/test-infinitepush.t --- a/tests/test-infinitepush.t +++ b/tests/test-infinitepush.t @@ -49,7 +49,7 @@ $ hg ci -Am "scratchfirstpart" adding scratchfirstpart created new head - $ hg push -r . --to scratch/firstpart + $ hg push -r . -B scratch/firstpart pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -60,7 +60,7 @@ $ hg ci -Am "scratchsecondpart" adding scratchsecondpart created new head - $ hg push -r . --to scratch/secondpart + $ hg push -r . -B scratch/secondpart pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -96,7 +96,7 @@ $ hg log -r '.' -T '{node}\n' > ../testpullbycommithash1 $ echo testpullbycommithash2 > testpullbycommithash2 $ hg ci -Aqm "testpullbycommithash2" - $ hg push -r . --to scratch/mybranch -q + $ hg push -r . -B scratch/mybranch -q Create third client and pull by commit hash. Make sure testpullbycommithash2 has not fetched @@ -144,7 +144,7 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo scratchontopofpublic > scratchontopofpublic $ hg ci -Aqm "scratchontopofpublic" - $ hg push -r . --to scratch/scratchontopofpublic + $ hg push -r . -B scratch/scratchontopofpublic pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -300,7 +300,7 @@ $ hg ci -Aqm "tofillmetadata" $ hg log -r . -T '{node}\n' d2b0410d4da084bc534b1d90df0de9eb21583496 - $ hg push -r . --to scratch/fillmetadata/fill + $ hg push -r . -B scratch/fillmetadata/fill pushing to ssh://user@dummy/repo searching for changes remote: pushing 6 commits: diff --git a/tests/test-infinitepush-bundlestore.t b/tests/test-infinitepush-bundlestore.t --- a/tests/test-infinitepush-bundlestore.t +++ b/tests/test-infinitepush-bundlestore.t @@ -26,7 +26,7 @@ remote: adding file changes remote: added 1 changesets with 1 changes to 1 files $ mkcommit scratchcommit - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 1 commit: @@ -119,7 +119,7 @@ $ cd ../client2 $ hg up -q scratch/mybranch $ mkcommit 'new scratch commit' - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 2 commits: @@ -140,7 +140,7 @@ scratch/mybranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 Push scratch bookmark with no new revs - $ hg push -r . --to scratch/anotherbranch + $ hg push -r . -B scratch/anotherbranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 2 commits: @@ -216,7 +216,7 @@ Test with pushrebase $ mkcommit scratchcommitwithpushrebase - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 4 commits: @@ -237,7 +237,7 @@ Change the order of pushrebase and infinitepush $ mkcommit scratchcommitwithpushrebase2 - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: pushing 5 commits: @@ -300,15 +300,15 @@ $ scratchbookmarks scratch/anotherbranch 1de1d7d92f8965260391d0513fe8a8d5973d3042 scratch/mybranch 6c10d49fe92751666c40263f96721b918170d3da - $ hg push -r . --to scratch/mybranch + $ hg push -r . -B scratch/mybranch pushing to ssh://user@dummy/repo searching for changes remote: non-forward push remote: (use --non-forward-move to override) abort: push failed on remote [255] - $ hg push -r . --to scratch/mybranch --non-forward-move + $ hg push -r . -B scratch/mybranch --non-forward-move pushing to ssh://user@dummy/repo searching for changes remote: pushing 5 commits: diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -315,9 +315,6 @@ def clientextsetup(ui): entry = extensions.wrapcommand(commands.table, 'push', _push) -# Don't add the 'to' arg if it already exists -if not any(a for a in entry[1] if a[1] == 'to'): -entry[1].append(('',
D2953: infinitepush: delete infinitepushcommands.py and related tests
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch drops infinitepushcommands.py and the tests which were related to the command `debugfillinfinitepushmetadata` introduced in the commit. The patch also drops a config option which was related to debuginfinitepushmetadata command. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2953 AFFECTED FILES hgext/infinitepush/__init__.py hgext/infinitepush/infinitepushcommands.py tests/test-infinitepush.t CHANGE DETAILS diff --git a/tests/test-infinitepush.t b/tests/test-infinitepush.t --- a/tests/test-infinitepush.t +++ b/tests/test-infinitepush.t @@ -211,80 +211,3 @@ (activating bookmark scratch/mybranch) $ hg log -r scratch/mybranch -T '{node}' d8fde0ddfc962183977f92d2bc52d303b8840f9d (no-eol) - -Test debugfillinfinitepushmetadata - $ cd ../repo - $ hg debugfillinfinitepushmetadata - abort: nodes are not specified - [255] - $ hg debugfillinfinitepushmetadata --node randomnode - abort: node randomnode is not found - [255] - $ hg debugfillinfinitepushmetadata --node d8fde0ddfc962183977f92d2bc52d303b8840f9d - $ cat .hg/scratchbranches/index/nodemetadatamap/d8fde0ddfc962183977f92d2bc52d303b8840f9d - {"changed_files": {"testpullbycommithash2": {"adds": 1, "isbinary": false, "removes": 0, "status": "added"}}} (no-eol) - - $ cd ../client - $ hg up d8fde0ddfc962183977f92d2bc52d303b8840f9d - 'd8fde0ddfc962183977f92d2bc52d303b8840f9d' does not exist locally - looking for it remotely... - pulling from ssh://user@dummy/repo - searching for changes - adding changesets - adding manifests - adding file changes - added 2 changesets with 2 changes to 2 files (+1 heads) - new changesets 33910bfe6ffe:d8fde0ddfc96 - (run 'hg heads .' to see heads, 'hg merge' to merge) - 'd8fde0ddfc962183977f92d2bc52d303b8840f9d' found remotely - 2 files updated, 0 files merged, 1 files removed, 0 files unresolved - $ echo file > file - $ hg add file - $ hg rm testpullbycommithash2 - $ hg ci -m 'add and rm files' - $ hg log -r . -T '{node}\n' - 3edfe7e9089ab9f728eb8e0d0c62a5d18cf19239 - $ hg cp file cpfile - $ hg mv file mvfile - $ hg ci -m 'cpfile and mvfile' - $ hg log -r . -T '{node}\n' - c7ac39f638c6b39bcdacf868fa21b6195670f8ae - $ hg push -r . --bundle-store - pushing to ssh://user@dummy/repo - searching for changes - remote: pushing 4 commits: - remote: 33910bfe6ffe testpullbycommithash1 - remote: d8fde0ddfc96 testpullbycommithash2 - remote: 3edfe7e9089a add and rm files - remote: c7ac39f638c6 cpfile and mvfile - $ cd ../repo - $ hg debugfillinfinitepushmetadata --node 3edfe7e9089ab9f728eb8e0d0c62a5d18cf19239 --node c7ac39f638c6b39bcdacf868fa21b6195670f8ae - $ cat .hg/scratchbranches/index/nodemetadatamap/3edfe7e9089ab9f728eb8e0d0c62a5d18cf19239 - {"changed_files": {"file": {"adds": 1, "isbinary": false, "removes": 0, "status": "added"}, "testpullbycommithash2": {"adds": 0, "isbinary": false, "removes": 1, "status": "removed"}}} (no-eol) - $ cat .hg/scratchbranches/index/nodemetadatamap/c7ac39f638c6b39bcdacf868fa21b6195670f8ae - {"changed_files": {"cpfile": {"adds": 1, "copies": "file", "isbinary": false, "removes": 0, "status": "added"}, "file": {"adds": 0, "isbinary": false, "removes": 1, "status": "removed"}, "mvfile": {"adds": 1, "copies": "file", "isbinary": false, "removes": 0, "status": "added"}}} (no-eol) - -Test infinitepush.metadatafilelimit number - $ cd ../client - $ echo file > file - $ hg add file - $ echo file1 > file1 - $ hg add file1 - $ echo file2 > file2 - $ hg add file2 - $ hg ci -m 'add many files' - $ hg log -r . -T '{node}' - 09904fb20c53ff351bd3b1d47681f569a4dab7e5 (no-eol) - $ hg push -r . --bundle-store - pushing to ssh://user@dummy/repo - searching for changes - remote: pushing 5 commits: - remote: 33910bfe6ffe testpullbycommithash1 - remote: d8fde0ddfc96 testpullbycommithash2 - remote: 3edfe7e9089a add and rm files - remote: c7ac39f638c6 cpfile and mvfile - remote: 09904fb20c53 add many files - - $ cd ../repo - $ hg debugfillinfinitepushmetadata --node 09904fb20c53ff351bd3b1d47681f569a4dab7e5 --config infinitepush.metadatafilelimit=2 - $ cat .hg/scratchbranches/index/nodemetadatamap/09904fb20c53ff351bd3b1d47681f569a4dab7e5 - {"changed_files": {"file": {"adds": 1, "isbinary": false, "removes": 0, "status": "added"}, "file1": {"adds": 1, "isbinary": false, "removes": 0, "status": "added"}}, "changed_files_truncated": true} (no-eol) diff --git a/hgext/infinitepush/infinitepushcommands.py b/hgext/infinitepush/infinitepushcommands.py deleted file mode 100644 --- a/hgext/infinitepush/infinitepushcommands.py +++ /dev/null @@ -1,101 +0,0 @@ -# Copyright 2016 Facebook, Inc. -# -# This software may be used and distributed according to the terms of the -# GNU General Public License version 2 or
D2952: infinitepush: delete infinitepush.fillmetadatabranchpattern config option
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch deletes the config option infinitepush.fillmetadatabranchpattern which if set to true sets a background process which will save metadata in infinitepush index. This series is meant to have a state where we can use it for CI purposes. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2952 AFFECTED FILES hgext/infinitepush/__init__.py tests/test-infinitepush.t CHANGE DETAILS diff --git a/tests/test-infinitepush.t b/tests/test-infinitepush.t --- a/tests/test-infinitepush.t +++ b/tests/test-infinitepush.t @@ -288,31 +288,3 @@ $ hg debugfillinfinitepushmetadata --node 09904fb20c53ff351bd3b1d47681f569a4dab7e5 --config infinitepush.metadatafilelimit=2 $ cat .hg/scratchbranches/index/nodemetadatamap/09904fb20c53ff351bd3b1d47681f569a4dab7e5 {"changed_files": {"file": {"adds": 1, "isbinary": false, "removes": 0, "status": "added"}, "file1": {"adds": 1, "isbinary": false, "removes": 0, "status": "added"}}, "changed_files_truncated": true} (no-eol) - -Test infinitepush.fillmetadatabranchpattern - $ cd ../repo - $ cat >> .hg/hgrc << EOF - > [infinitepush] - > fillmetadatabranchpattern=re:scratch/fillmetadata/.* - > EOF - $ cd ../client - $ echo tofillmetadata > tofillmetadata - $ hg ci -Aqm "tofillmetadata" - $ hg log -r . -T '{node}\n' - d2b0410d4da084bc534b1d90df0de9eb21583496 - $ hg push -r . -B scratch/fillmetadata/fill - pushing to ssh://user@dummy/repo - searching for changes - remote: pushing 6 commits: - remote: 33910bfe6ffe testpullbycommithash1 - remote: d8fde0ddfc96 testpullbycommithash2 - remote: 3edfe7e9089a add and rm files - remote: c7ac39f638c6 cpfile and mvfile - remote: 09904fb20c53 add many files - remote: d2b0410d4da0 tofillmetadata - -Make sure background process finished - $ sleep 3 - $ cd ../repo - $ cat .hg/scratchbranches/index/nodemetadatamap/d2b0410d4da084bc534b1d90df0de9eb21583496 - {"changed_files": {"tofillmetadata": {"adds": 1, "isbinary": false, "removes": 0, "status": "added"}}} (no-eol) diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -68,12 +68,6 @@ # patterns to list if no patterns are specified. defaultremotepatterns = ['*'] -# Server-side option. If bookmark that was pushed matches -# `fillmetadatabranchpattern` then background -# `hg debugfillinfinitepushmetadata` process will save metadata -# in infinitepush index for nodes that are ancestor of the bookmark. -fillmetadatabranchpattern = '' - # Instructs infinitepush to forward all received bundle2 parts to the # bundle for storage. Defaults to False. storeallparts = True @@ -154,9 +148,6 @@ configitem('infinitepush', 'indexpath', default='', ) -configitem('infinitepush', 'fillmetadatabranchpattern', -default='', -) configitem('infinitepush', 'storeallparts', default=False, ) @@ -1082,13 +1073,6 @@ log(scratchbranchparttype, eventtype='success', elapsedms=(time.time() - parthandlerstart) * 1000) -fillmetadatabranchpattern = op.repo.ui.config( -'infinitepush', 'fillmetadatabranchpattern', '') -if bookmark and fillmetadatabranchpattern: -__, __, matcher = util.stringmatcher(fillmetadatabranchpattern) -if matcher(bookmark): -_asyncsavemetadata(op.repo.root, - [ctx.hex() for ctx in nodesctx]) except Exception as e: log(scratchbranchparttype, eventtype='failure', elapsedms=(time.time() - parthandlerstart) * 1000, 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
D2943: grep: fixes errorneous output of grep in forward order
yuja requested changes to this revision. yuja added a comment. This revision now requires changes to proceed. > This patch keeps the matches dictionary until > the end of this window and clears it at once when this window ends. This is really helpful while reading the patch. Perhaps it's worth adding an inline comment? The change looks good, but can't be applied on the current tip. Can you rebase? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2943 To: sangeet259, #hg-reviewers, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794)
On Mon, 26 Mar 2018 23:14:05 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1522117116 14400 > # Mon Mar 26 22:18:36 2018 -0400 > # Node ID 19b73408a618666979209b9654182e6fa72364d2 > # Parent aaabd709df720e456d7f93a1c790a0dbed051b38 > lfs: respect narrowmatcher when testing to add 'lfs' requirement (issue5794) > > There's a similar test in lfs.wrapper.convertsink(), but I didn't update that > because I don't think that the sink repo in a convert can be narrow. > > It seems reasonable that a narrow clone of an LFS repo may not necessarily be > an > LFS repo. The only potential issue is that LFS has a hard requirement for > changegroup v3, which that extension enables. The use of treemanifest will > enable changegroup v3 in narrow clones, because allsupportedversions() in > changegroup.py preserves it when it sees a 'treemanifest' requirement. But I > don't see where changegroup v3 is enabled for a flat manifest. > > diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py > --- a/hgext/lfs/__init__.py > +++ b/hgext/lfs/__init__.py > @@ -226,9 +226,10 @@ def reposetup(ui, repo): > s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last)) > else: > s = repo.set('%n', _bin(kwargs[r'node'])) > +match = lambda f: f in ctx and repo.narrowmatch()(f) It's probably better not to call repo.narrowmatcher() in loop. Whether it is filecached or not is implementation detail. > -if any(ctx[f].islfs() for f in ctx.files() if f in ctx): > +if any(ctx[f].islfs() for f in ctx.files() if match(f)): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2] lfs: move the 'supportedoutgoingversions' handling to changegroup.py
On Mon, 26 Mar 2018 23:14:06 -0400, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison> # Date 1522119770 14400 > # Mon Mar 26 23:02:50 2018 -0400 > # Node ID 544761f9f8ee47e6b35b2b3fad0b69914e10341d > # Parent 19b73408a618666979209b9654182e6fa72364d2 > lfs: move the 'supportedoutgoingversions' handling to changegroup.py Queued this, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2593: state: add logic to parse the state file in old way if cbor fails
pulkit added inline comments. INLINE COMMENTS > martinvonz wrote in state.py:84 > > I don't have a strong reason. I just found this an easy way. > > It seems the other way is still slightly easier :) You'd replace this: > > def __getitem__(self, key): > return self.opts[key] > > def __setitem__(self, key, value): > updates = {key: value} > self.opts.update(updates) > > by this: > > def get(self): > return self.state > > def set(self, state): > self.state = state > > I'm not even sure we'd need those two methods. It might be enough to make > load() return the state and make save() accept (and require) a new state. > > The constructor would change from: > > if not opts: > self.opts = {} > else: > self.opts = opts > > to: > > self.state = state > > The graft code for reading would change from: > > cmdstate.load() > if cmdstate['version'] < 2: > nodes = cmdstate['nodes'] > revs = [repo[node].rev() for node in nodes] > else: > # state-file is written by a newer mercurial than what we are > # using > raise error.Abort(_("unable to read to read the state file")) > > to: > > state = cmdstate.load() > if state['version'] < 2: > nodes = state['nodes'] > revs = [repo[node].rev() for node in nodes] > else: > # state-file is written by a newer mercurial than what we are > # using > raise error.Abort(_("unable to read to read the state file")) > > The graft code for writing would change from: > > cmdstate.addopts({'version': 1, 'nodes': nodelines}) > cmdstate.save() > > to: > > cmdstate.set({'version': 1, 'nodes': nodelines}) > cmdstate.save() > > > > > The one benefit is that we can pass the state object everywhere, lookup for > > values and update values on fly. > > We can still pass the "cmdstate" instance around if we wanted to do that. I > think it's a small plus that we can pass *just* the state around, though. > That means we can pass the state into a function and we can look at the call > site and know that it won't be calling .save() on it. I don't feel convinced on what can be the benefit of it and my opinion can be influenced by how I used it in evolve extension. But I can change it the other way around too, let me know if you want me to change. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2593 To: pulkit, #hg-reviewers Cc: martinvonz, indygreg, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2667: obsolete: refactor function for getting obsolete options
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd30810d09d6f: obsolete: refactor function for getting obsolete options (authored by indygreg, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2667?vs=6608=7333#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2667?vs=6608=7333 REVISION DETAIL https://phab.mercurial-scm.org/D2667 AFFECTED FILES mercurial/obsolete.py CHANGE DETAILS diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -133,20 +133,29 @@ return option in result +def getoptions(repo): +"""Returns dicts showing state of obsolescence features.""" + +createmarkersvalue = _getoptionvalue(repo, createmarkersopt) +unstablevalue = _getoptionvalue(repo, allowunstableopt) +exchangevalue = _getoptionvalue(repo, exchangeopt) + +# createmarkers must be enabled if other options are enabled +if ((unstablevalue or exchangevalue) and not createmarkersvalue): +raise error.Abort(_("'createmarkers' obsolete option must be enabled " +"if other obsolete options are enabled")) + +return { +createmarkersopt: createmarkersvalue, +allowunstableopt: unstablevalue, +exchangeopt: exchangevalue, +} + def isenabled(repo, option): """Returns True if the given repository has the given obsolete option enabled. """ -createmarkersvalue = _getoptionvalue(repo, createmarkersopt) -unstabluevalue = _getoptionvalue(repo, allowunstableopt) -exchangevalue = _getoptionvalue(repo, exchangeopt) - -# createmarkers must be enabled if other options are enabled -if ((unstabluevalue or exchangevalue) and not createmarkersvalue): -raise error.Abort(_("'createmarkers' obsolete option must be enabled " -"if other obsolete options are enabled")) - -return _getoptionvalue(repo, option) +return getoptions(repo)[option] # Creating aliases for marker flags because evolve extension looks for # bumpedfix in obsolete.py To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2949: setup: install cbor packages
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa1d2d0420e22: setup: install cbor packages (authored by indygreg, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2949?vs=7322=7332 REVISION DETAIL https://phab.mercurial-scm.org/D2949 AFFECTED FILES setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -810,6 +810,8 @@ 'mercurial.pure', 'mercurial.thirdparty', 'mercurial.thirdparty.attr', +'mercurial.thirdparty.cbor', +'mercurial.thirdparty.cbor.cbor2', 'mercurial.utils', 'hgext', 'hgext.convert', 'hgext.fsmonitor', 'hgext.fsmonitor.pywatchman', 'hgext.highlight', To: indygreg, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2678: help: supporting both help and doc for aliases
pulkit added a comment. :( --- /home/foobar/repo/pushaccess/tests/test-paths.t +++ /home/foobar/repo/pushaccess/tests/test-paths.t.err @@ -132,10 +132,52 @@ zeroconf wraps ui.configitems(), which shouldn't crash at least: $ hg paths --config extensions.zeroconf= - dupe = $TESTTMP/b#tip - dupe:pushurl = https://example.com/dupe - expand = $TESTTMP/a/$SOMETHING/bar - insecure = http://foo:***@example.com/ + ** unknown exception encountered, please report by visiting + ** https://mercurial-scm.org/wiki/BugTracker + ** Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] + ** Mercurial Distributed SCM (version 4.5.2+1280-deb4b1721fe0) + ** Extensions loaded: zeroconf + Traceback (most recent call last): +File "/tmp/hgtests.p14OA8/install/bin/hg", line 41, in + dispatch.run() +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 93, in run + status = (dispatch(req) or 0) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 213, in dispatch + ret = _runcatch(req) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 354, in _runcatch + return _callcatch(ui, _runcatchfunc) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 362, in _callcatch + return scmutil.callcatch(ui, func) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/scmutil.py", line 159, in callcatch + return func() +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 344, in _runcatchfunc + return _dispatch(req) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 958, in _dispatch + cmdpats, cmdoptions) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 715, in runcommand + ret = _runcommand(ui, options, cmd, d) +File "/tmp/hgtests.p14OA8/install/lib/python/hgext/zeroconf/__init__.py", line 205, in cleanupafterdispatch + return orig(ui, options, cmd, cmdfunc) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 966, in _runcommand + return cmdfunc() +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/dispatch.py", line 955, in + d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/util.py", line 1537, in check + return func(*args, **kwargs) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/commands.py", line 3789, in paths + pathitems = sorted(ui.paths.iteritems()) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/util.py", line 1421, in __get__ + result = self.func(obj) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/ui.py", line 848, in paths + return paths(self) +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/ui.py", line 1699, in __init__ + for name, loc in ui.configitems('paths', ignoresub=True): +File "/tmp/hgtests.p14OA8/install/lib/python/mercurial/extensions.py", line 359, in closure + return func(*(args + a), **kw) +File "/tmp/hgtests.p14OA8/install/lib/python/hgext/zeroconf/__init__.py", line 184, in configitems + repos += getzcpaths() + TypeError: unsupported operand type(s) for +=: 'generator' and 'generator' + [1] $ cd .. ERROR: test-paths.t output changed REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2678 To: rdamazio, #hg-reviewers, durin42, pulkit Cc: mharbison72, spectral, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2623: dispatch: adding config items for overriding flag defaults
rdamazio added inline comments. INLINE COMMENTS > dploch wrote in dispatch.py:625-626 > This doesn't handle callables properly. I wonder if the something like the > following would work instead: > > oldopt = fancyopts._defaultopt(olddefault) > newdefault = old.opt.newstate(olddefault, ui.config("commands", cfgitem) > c[idx] = (opt[0], opt[1], fancyopts._withnewdefault(oldopt, newdefault), > opt[3]) > > Where '_withnewdefault' is a wrapper customopt that just changes the default. I thought callables were meant to be used to generate the default default, not with overridden values? > dploch wrote in dispatch.py:639-640 > This makes me nervous. What if someone re-uses a customopt instance in > multiple commands? i.e.: > > DATE_FLAG = mypkg.dateopt() > ... > ('b', 'before', DATE_FLAG, '') > ('a', 'after', 'DATE_FLAG', '') > > Now, setting commands.defaults.before=2018-03-05 also silently changes the > default for 'after'. I suspect we need to introduce a wrapper class like > what I suggest on lines 625-625, that delegates and leaves the original > default unchanged. And either way, we should probably clarify in the docs on > customopts what expected use of the class is (i.e., should we just forbid > reuse, is 'oldstate' safe to mutate, etc.) Nobody should use the same *instance* on multiple flags. Even with the current flags, if you use e.g. the same list on many, that'll cause problems with listopt. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2623 To: rdamazio, #hg-reviewers, yuja Cc: dploch, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel