D2409: graft: add no-commit mode (issue5631)
khanchi97 updated this revision to Diff 6538. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2409?vs=6325&id=6538 REVISION DETAIL https://phab.mercurial-scm.org/D2409 AFFECTED FILES mercurial/commands.py 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 @@ -1373,3 +1373,104 @@ note: graft of 7:d3c3f2b38ecc created no changes to commit $ cd .. + +Graft a change from a branch without making any commit using --no-commit option: + + $ hg init dirtochecknocommit + $ cd dirtochecknocommit + $ echo a > a + $ hg ci -qAm0 + $ echo b > b + $ hg ci -qAm1 + $ hg up -q 0 + $ echo c > c + $ hg ci -qAm2 +Check --no-commit do not work with those options which are used for making a commit +like -e/-D/-U/-d/-u: + $ hg graft 1 --no-commit -e + abort: can't specify --no-commit and --edit + [255] + $ hg graft 1 --no-commit + grafting 1:925d80f479bb "1" + + $ hg tip -T "rev: {rev}\n" + rev: 2 + + $ hg diff + diff -r db815d6d32e6 b + --- /dev/nullThu Jan 01 00:00:00 1970 + + +++ b/b Thu Jan 01 00:00:00 1970 + + @@ -0,0 +1,1 @@ + +b + + $ hg ci -qm3 + +Make a conflict between two heads and check --no-commit is resepected after --continue: + + $ echo A>a + $ hg ci -qm4 + $ hg up -q 1 + $ echo B>a + $ hg ci -qm5 + $ hg graft 4 --no-commit + grafting 4:a08bb3910e7c "4" + merging a + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + +Resolving conflict: + + $ echo A>a + $ hg resolve --mark + (no more unresolved files) + continue: hg graft --continue + +Continue: + + $ hg graft --continue + grafting 4:a08bb3910e7c "4" + + $ hg tip -T "rev: {rev}\n" + rev: 5 + + $ hg diff + diff -r b1d5b5056844 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,1 +1,1 @@ + -B + +A + +For checking --continue and --no-commit, again make the same conflict: + $ echo B>a + $ hg graft 4 + grafting 4:a08bb3910e7c "4" + merging a + warning: conflicts while merging a! (edit, then use 'hg resolve --mark') + abort: unresolved conflicts, can't continue + (use 'hg resolve' and 'hg graft --continue') + [255] + +Resolving conflict: + + $ echo A>a + $ hg resolve --mark + (no more unresolved files) + continue: hg graft --continue + +Continue with --no-commit: + $ hg graft --continue --no-commit + grafting 4:a08bb3910e7c "4" + $ hg diff + diff -r b1d5b5056844 a + --- a/a Thu Jan 01 00:00:00 1970 + + +++ b/a Thu Jan 01 00:00:00 1970 + + @@ -1,1 +1,1 @@ + -B + +A + $ hg tip -T "rev: {rev}\n" + rev: 5 + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2074,6 +2074,8 @@ ('c', 'continue', False, _('resume interrupted graft')), ('e', 'edit', False, _('invoke editor on commit messages')), ('', 'log', None, _('append graft info to log message')), + ('', 'no-commit', None, + _("don't commit, just apply the changes in working directory")), ('f', 'force', False, _('force graft')), ('D', 'currentdate', False, _('record the current date as commit date')), @@ -2110,7 +2112,7 @@ .. note:: The -c/--continue option does not reapply earlier options, except - for --force. + for --force and --no-commit. .. container:: verbose @@ -2162,13 +2164,31 @@ **pycompat.strkwargs(opts)) cont = False +if opts.get('no_commit'): +if opts.get('edit'): +raise error.Abort(_("can't specify --no-commit and --edit")) +elif opts.get('currentdate'): +raise error.Abort(_("can't specify --no-commit and --currentdate")) +elif opts.get('currentuser'): +raise error.Abort(_("can't specify --no-commit and --currentuser")) +elif opts.get('date'): +raise error.Abort(_("can't specify --no-commit and --date")) +elif opts.get('user'): +raise error.Abort(_("can't specify --no-commit and --user")) + if opts.get('continue'): +if opts.get('no_commit'): +lines = repo.vfs.read('graftstate').splitlines(True) +nodelines = [line for line in lines[1:]] +repo.vfs.write('graftstate', 'True\n') +repo.vfs.append('graftstate', ''.join(nodelines)) cont = True if revs: raise error.Abort(_("can't specify --continue and revisions")) # read in unfinished revisions try: -nodes = repo.vfs.read('graftstate').splitlines() +lines = repo.vfs.read('graftstate').splitlines() +nodes = lines[1:] revs = [repo[node].rev() for node in nodes] except IO
D2409: graft: add no-commit mode (issue5631)
khanchi97 added a comment. I have added tests to show the behavior of --no-commit with other flags. INLINE COMMENTS > pulkit wrote in commands.py:2309 > To be honest I am not fan of storing data in such format, but that's how we > store data right now. I have finally a series in review where we can use cbor > to serialize data while writing to state files. Look at > https://phab.mercurial-scm.org/D2591. I think if that goes in, we should use > that format to store about `no-commit` flag. okay, when your series will be pushed in, I will use cbor to write in statefile. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2409 To: khanchi97, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] bdiff: avoid pointer arithmetic on void*
On Sat, 03 Mar 2018 23:31:12 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison > # Date 1520137780 18000 > # Sat Mar 03 23:29:40 2018 -0500 > # Node ID 8b9334b59784246d5a09bad537d6e15a0f190c97 > # Parent 3f829cbdfe3a89c28c8807d3a933159fb2d93992 > bdiff: avoid pointer arithmetic on void* Queued, thanks. > diff --git a/mercurial/cext/bdiff.c b/mercurial/cext/bdiff.c > --- a/mercurial/cext/bdiff.c > +++ b/mercurial/cext/bdiff.c > @@ -103,8 +103,8 @@ > } > /* we can almost add: if (li == lmax) lcommon = li; */ > > - an = bdiff_splitlines(ba.buf + lcommon, la - lcommon, &al); > - bn = bdiff_splitlines(bb.buf + lcommon, lb - lcommon, &bl); > + an = bdiff_splitlines(((char *)ba.buf) + lcommon, la - lcommon, &al); > + bn = bdiff_splitlines(((char *)ba.buf) + lcommon, lb - lcommon, &bl); ^ Fixed typo. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] profile: colorize output on Windows
On Sat, 03 Mar 2018 00:50:46 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison > # Date 1520055359 18000 > # Sat Mar 03 00:35:59 2018 -0500 > # Node ID 57af2e6a832eabb2e584977a11cc34c97092cfcd > # Parent ed77050177498aff4ff4db94f30d5bdeefd8f76e > profile: colorize output on Windows Queued, thanks. > diff --git a/mercurial/profiling.py b/mercurial/profiling.py > --- a/mercurial/profiling.py > +++ b/mercurial/profiling.py > @@ -14,6 +14,7 @@ > encoding, > error, > extensions, > +pycompat, > util, > ) > > @@ -200,6 +201,16 @@ > elif self._output: > path = self._ui.expandpath(self._output) > self._fp = open(path, 'wb') > +elif pycompat.iswindows: Added inline comment "parse escape sequence by win32print()" here because it seems unclear why we need this only for Windows. > +class uifp(object): > +def __init__(self, ui): > +self._ui = ui > +def write(self, data): > +self._ui.write_err(data) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH STABLE] annotate: do not poorly split lines at CR (issue5798)
On Sat, 03 Mar 2018 22:45:52 -0500, Matt Harbison wrote: > On Wed, 21 Feb 2018 07:49:41 -0500, Yuya Nishihara wrote: > > > # HG changeset patch > > # User Yuya Nishihara > > # Date 1519215245 -32400 > > # Wed Feb 21 21:14:05 2018 +0900 > > # Branch stable > > # Node ID 24b17a714a92c8fe860db5f6d0d49c23293deec6 > > # Parent c19e66dacaa184feba31136c18a369ba995ddfe4 > > annotate: do not poorly split lines at CR (issue5798) > > Should this difference be conditionalized away, or is it > important/unexpected? > $ hg annotate -r0 a | substcr > - 0: 0a[CR]0b[CR] > - 0: 0c[CR]0d[CR] > + 0: 0a[CR]0b > + 0: 0c[CR]0d It's kinda important. Is the last CR eaten by Windows sed? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] dispatch: don't clamp the range of the exit code twice
On Sat, 03 Mar 2018 19:09:40 -0500, Kevin Bullock wrote: > # HG changeset patch > # User Kevin Bullock > # Date 1520121770 18000 > # Sat Mar 03 19:02:50 2018 -0500 > # Node ID 53daf5db6dada7eade4de6d4c328b78feb0425cf > # Parent c1af0dc644d4c109efee03786aca819a8ac7775c > dispatch: don't clamp the range of the exit code twice Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1945: tests: refactor common bundle2 capabilities
yuja requested changes to this revision. yuja added a comment. This revision now requires changes to proceed. This can't be applied to the current tip. Can you rebase? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1945 To: joerg.sonnenberger, #hg-reviewers, lothiraldan, yuja Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2619: revsetlang: add a hint for more useful parse errors
yuja added a comment. Queued, thanks. INLINE COMMENTS > test-revset.t:2796 > + > + $ hg log -r ' > + > . + Rewritten this as mulitple `echo`s to silence check-code. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2619 To: ryanmce, #hg-reviewers, lothiraldan Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2589: setup: ignore extension load failures when finding working hg
This revision was automatically updated to reflect the committed changes. Closed by commit rHG5f41e3418407: setup: ignore extension load failures when finding working hg (authored by ryanmce, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2589?vs=6440&id=6539 REVISION DETAIL https://phab.mercurial-scm.org/D2589 AFFECTED FILES setup.py CHANGE DETAILS diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -255,6 +255,7 @@ if (not e.startswith(b'not trusting file') and not e.startswith(b'warning: Not importing') and not e.startswith(b'obsolete feature not enabled') + and not e.startswith(b'*** failed to import extension') and not e.startswith(b'devel-warn:'))] return b'\n'.join(b' ' + e for e in err) To: ryanmce, #hg-reviewers, lothiraldan Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2619: revsetlang: add a hint for more useful parse errors
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2a258985ffeb: revsetlang: add a hint for more useful parse errors (authored by ryanmce, committed by ). CHANGED PRIOR TO COMMIT https://phab.mercurial-scm.org/D2619?vs=6507&id=6540#toc REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2619?vs=6507&id=6540 REVISION DETAIL https://phab.mercurial-scm.org/D2619 AFFECTED FILES mercurial/revsetlang.py tests/test-annotate.t tests/test-default-push.t tests/test-fileset.t tests/test-revset.t 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 @@ -690,6 +690,8 @@ $ log '1 OR 2' hg: parse error at 2: invalid token + (1 OR 2 + ^ here) [255] or operator should preserve ordering: @@ -1562,6 +1564,8 @@ test error message of bad revset $ hg log -r 'foo\\' hg: parse error at 3: syntax error in revset 'foo\\' + (foo\\ + ^ here) [255] $ cd .. diff --git a/tests/test-revset.t b/tests/test-revset.t --- a/tests/test-revset.t +++ b/tests/test-revset.t @@ -399,6 +399,8 @@ 4 $ log 'date(this is a test)' hg: parse error at 10: unexpected token: symbol + (date(this is a test) + ^ here) [255] $ log 'date()' hg: parse error: date requires a string @@ -408,6 +410,8 @@ [255] $ log 'date(' hg: parse error at 5: not a prefix: end + (date( +^ here) [255] $ log 'date("\xy")' hg: parse error: invalid \x escape* (glob) @@ -614,18 +618,28 @@ $ hg debugrevspec '[0]' hg: parse error at 0: not a prefix: [ + ([0] + ^ here) [255] $ hg debugrevspec '.#' hg: parse error at 2: not a prefix: end + (.# + ^ here) [255] $ hg debugrevspec '#rel' hg: parse error at 0: not a prefix: # + (#rel + ^ here) [255] $ hg debugrevspec '.#rel[0' hg: parse error at 7: unexpected token: end + (.#rel[0 + ^ here) [255] $ hg debugrevspec '.]' hg: parse error at 1: invalid token + (.] +^ here) [255] $ hg debugrevspec '.#generations[a]' @@ -1330,6 +1344,8 @@ 6 $ try 'grep(r"\")' hg: parse error at 7: unterminated string + (grep(r"\") + ^ here) [255] $ log 'head()' 0 @@ -2774,3 +2790,14 @@ $ cd .. $ cd repo + +test multiline revset with errors + + $ echo > multiline-revset + $ echo '. +' >> multiline-revset + $ echo '.^ +' >> multiline-revset + $ hg log -r "`cat multiline-revset`" + hg: parse error at 9: not a prefix: end + ( . + .^ + +^ here) + [255] diff --git a/tests/test-fileset.t b/tests/test-fileset.t --- a/tests/test-fileset.t +++ b/tests/test-fileset.t @@ -666,7 +666,11 @@ $ fileset "status(' ', '4', added())" hg: parse error at 1: not a prefix: end + ( +^ here) [255] $ fileset "status('2', ' ', added())" hg: parse error at 1: not a prefix: end + ( +^ here) [255] diff --git a/tests/test-default-push.t b/tests/test-default-push.t --- a/tests/test-default-push.t +++ b/tests/test-default-push.t @@ -142,6 +142,8 @@ $ hg --config 'paths.default:pushrev=(' push pushing to file:/*/$TESTTMP/pushurlsource/../pushurldest (glob) hg: parse error at 1: not a prefix: end + (( +^ here) [255] $ cd .. diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -814,6 +814,8 @@ [255] $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=[1])' hg: parse error at 43: not a prefix: [ + (followlines(baz, 2:4, startrev=20, descend=[1]) + ^ here) [255] $ hg log -r 'followlines(baz, 2:4, startrev=20, descend=a)' hg: parse error: descend argument must be a boolean diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py --- a/mercurial/revsetlang.py +++ b/mercurial/revsetlang.py @@ -539,7 +539,21 @@ return tuple(foldconcat(t) for t in tree) def parse(spec, lookup=None): -return _parsewith(spec, lookup=lookup) +try: +return _parsewith(spec, lookup=lookup) +except error.ParseError as inst: +if len(inst.args) > 1: # has location +# Add 1 to location because unlike templates, revset parse errors +# point to the char where the error happened, not the char after. +loc = inst.args[1] + 1 +# Remove newlines -- spaces are equivalent whitespace. +spec = spec.replace('\n', ' ') +# We want the caret to point to the place in the template that +# failed to parse, but in a hint we get a open paren at the +# start. Therefore, we print "loc + 1" spaces (instead of "loc") +# to line up the caret with the location of the error. +inst.hint = spec + '\n' + ' ' * loc + '^ ' + _('here') +raise def _quote(s): r"""Quote a value in order to ma
D2611: scmutil: avoid using basestring and add explicit handling of unicodes
yuja added inline comments. INLINE COMMENTS > scmutil.py:191 > +if isinstance(msg, type(u'')): > +msg = pycompat.sysbytes(msg) > +elif not isinstance(inst.args[1], bytes): `msg` is unused REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2611 To: durin42, #hg-reviewers, indygreg Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@36660: 2 new changesets
2 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/dc11f257ad1d changeset: 36659:dc11f257ad1d user:Augie Fackler date:Sat Mar 03 16:38:17 2018 -0500 summary: hghave: fix up clang-libfuzzer regex to be bytes https://www.mercurial-scm.org/repo/hg/rev/11b279a75bf1 changeset: 36660:11b279a75bf1 bookmark:@ tag: tip user:Augie Fackler date:Sat Mar 03 17:07:18 2018 -0500 summary: tests: fix inline extension bytes in test-ssh-proto-unbundle.t -- 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
Re: [PATCH 1 of 4 STABLE] test-subrepo: demonstrate problems with subrepo sharing and absolute paths
On Sat, 03 Mar 2018 23:03:25 -0500, Matt Harbison wrote: > # HG changeset patch > # User Matt Harbison > # Date 1519795767 18000 > # Wed Feb 28 00:29:27 2018 -0500 > # Branch stable > # Node ID eca5075fdd5ec15e1a4917c0cadeb23e00feb2fe > # Parent 0a7c59a4c8352b9277a9676708cf6a30d3e2e306 > test-subrepo: demonstrate problems with subrepo sharing and absolute paths Queued for stable, many thanks. ___ 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
yuja requested changes to this revision. yuja added a subscriber: dploch. yuja added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > dispatch.py:624 > +# parse the new default as the same type as the original. > +newdefault = ui.configtyped("commands", cfgitem, defaulttype, > olddefault) > +if olddefault != newdefault: Maybe this type conversion can be a `fancyopt.customopt` method since we've refactored the default handling by https://phab.mercurial-scm.org/D2090? # no idea if _defaultopt() should be made public or the whole commands.default handling # should be moved to fancyopts x = fancyopts._defaultopt(olddefault) newdefault = x.configdefault(ui, cmd, optname, ...) @dploch, any suggestions? > ui.py:390 > +if '.default.' in k: > +del cfg['commands'][k] > if self.plain('revsetalias'): Perhaps this is noop since `[commands]` is removed at all if `ui.plain()` returns True. 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
[PATCH] templater: fix position of terminator character in error message
# HG changeset patch # User Yuya Nishihara # Date 1520165030 18000 # Sun Mar 04 07:03:50 2018 -0500 # Node ID dad68a609114750b5963a8e46563a0b73620156f # Parent 2a258985ffeb5ccdef17f437a6dc50cce68f6f8e templater: fix position of terminator character in error message Since a template expression starts after the '{' character, the expression should be considered to end immediately before the terminator '{'. diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py --- a/mercurial/revsetlang.py +++ b/mercurial/revsetlang.py @@ -543,16 +543,14 @@ def parse(spec, lookup=None): return _parsewith(spec, lookup=lookup) except error.ParseError as inst: if len(inst.args) > 1: # has location -# Add 1 to location because unlike templates, revset parse errors -# point to the char where the error happened, not the char after. -loc = inst.args[1] + 1 +loc = inst.args[1] # Remove newlines -- spaces are equivalent whitespace. spec = spec.replace('\n', ' ') # We want the caret to point to the place in the template that # failed to parse, but in a hint we get a open paren at the # start. Therefore, we print "loc + 1" spaces (instead of "loc") # to line up the caret with the location of the error. -inst.hint = spec + '\n' + ' ' * loc + '^ ' + _('here') +inst.hint = spec + '\n' + ' ' * (loc + 1) + '^ ' + _('here') raise def _quote(s): diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -145,7 +145,7 @@ def tokenize(program, start, end, term=N yield ('symbol', sym, s) pos -= 1 elif c == term: -yield ('end', None, pos + 1) +yield ('end', None, pos) return else: raise error.ParseError(_("syntax error"), pos) @@ -237,9 +237,10 @@ def _scantemplate(tmpl, start, stop, quo return parseres, pos = p.parse(tokenize(tmpl, n + 1, stop, '}')) -if not tmpl.endswith('}', n + 1, pos): +if not tmpl.startswith('}', pos): raise error.ParseError(_("invalid token"), pos) yield ('template', parseres, n) +pos += 1 if quote: raise error.ParseError(_("unterminated string"), start) @@ -253,9 +254,10 @@ def _scantemplate(tmpl, start, stop, quo tmpl = tmpl.replace('\n', br'\n') # We want the caret to point to the place in the template that # failed to parse, but in a hint we get a open paren at the -# start. Therefore, we print "loc" spaces (instead of "loc - 1") +# start. Therefore, we print "loc + 1" spaces (instead of "loc") # to line up the caret with the location of the error. -inst.hint = tmpl + '\n' + ' ' * (loc + offset) + '^ ' + _('here') +inst.hint = (tmpl + '\n' + + ' ' * (loc + 1 + offset) + '^ ' + _('here')) raise yield ('end', None, pos) 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 @@ -2767,26 +2767,26 @@ Error on syntax: $ hg log -T '{date' hg: parse error at 1: unterminated template expansion ({date - ^ here) +^ here) [255] $ hg log -T '{date(}' - hg: parse error at 7: not a prefix: end + hg: parse error at 6: not a prefix: end ({date(} ^ here) [255] $ hg log -T '{date)}' hg: parse error at 5: invalid token ({date)} - ^ here) +^ here) [255] $ hg log -T '{date date}' hg: parse error at 6: invalid token ({date date} -^ here) + ^ here) [255] $ hg log -T '{}' - hg: parse error at 2: not a prefix: end + hg: parse error at 1: not a prefix: end ({} ^ here) [255] @@ -2838,13 +2838,13 @@ Error in nested template: $ hg log -T '{"date' hg: parse error at 2: unterminated string ({"date -^ here) + ^ here) [255] $ hg log -T '{"foo{date|?}"}' hg: parse error at 11: syntax error ({"foo{date|?}"} - ^ here) + ^ here) [255] Thrown an error if a template function doesn't exist @@ -3377,7 +3377,7 @@ Test integer literal: $ hg debugtemplate '{(-)}\n' hg: parse error at 3: not a prefix: ) ({(-)}\n - ^ here) + ^ here) [255] $ hg debugtemplate '{(-a)}\n' hg: parse error: negation needs an integer argument @@ -3544,7 +3544,7 @@ escaped single quotes and errors: $ hg log -r 2 -T '{if(rev, "{if(rev, \")}")}\n' hg: parse error at 21: unterminated string ({if(rev, "{if(rev, \")}")}\n - ^ here) +^ here) [255] $ hg log -r 2 -T '{if(rev, \"\\"")}\n' hg: parse error: trailing \ in string diff --git a/
D2635: fuzz: add some more docs about building/running fuzzers
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/D2635 AFFECTED FILES contrib/fuzz/README.rst CHANGE DETAILS diff --git a/contrib/fuzz/README.rst b/contrib/fuzz/README.rst --- a/contrib/fuzz/README.rst +++ b/contrib/fuzz/README.rst @@ -10,5 +10,17 @@ 7) ln -s /hg-new mercurial 8) cd mercurial 9) compile + 10) ls $OUT + +Step 9 is literally running the command "compile", which is part of +the docker container. Once you have that working, you can build the +fuzzers like this (in the oss-fuzz repo): + +python infra/helper.py build_fuzzers --sanitizer address mercurial $HG_REPO_PATH + +(you can also say "memory", "undefined" or "coverage" for +sanitizer). Then run the built fuzzers like this: + +python infra/helper.py run_fuzzer mercurial -- $FUZZER 0: https://github.com/google/oss-fuzz/blob/master/docs/new_project_guide.md 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
mercurial@36664: 4 new changesets
4 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/b76248e51605 changeset: 36661:b76248e51605 user:Augie Fackler date:Sat Mar 03 17:08:05 2018 -0500 summary: scmutil: avoid using basestring and add explicit handling of unicodes https://www.mercurial-scm.org/repo/hg/rev/3715a5ffcf92 changeset: 36662:3715a5ffcf92 user:Augie Fackler date:Sat Mar 03 17:08:41 2018 -0500 summary: tests: fix bytes literals in test-fncache.t https://www.mercurial-scm.org/repo/hg/rev/2dce0049176c changeset: 36663:2dce0049176c user:Augie Fackler date:Sat Mar 03 17:09:26 2018 -0500 summary: cmdutil: ensure PatchError messages are coerded to bytes, not str https://www.mercurial-scm.org/repo/hg/rev/6f9442c6b404 changeset: 36664:6f9442c6b404 bookmark:@ tag: tip user:Augie Fackler date:Sat Mar 03 17:53:32 2018 -0500 summary: py3: whitelist another 15 passing tests -- 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
D2636: scmutil: fix oversight in b76248e51605c6 where I forgot to use msg
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Thanks to Yuya for spotting my mistake. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2636 AFFECTED FILES mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -189,12 +189,12 @@ msg = inst.args[1] if isinstance(msg, type(u'')): msg = pycompat.sysbytes(msg) -elif not isinstance(inst.args[1], bytes): -ui.warn(" %r\n" % (inst.args[1],)) -elif not inst.args[1]: +if not isinstance(msg, bytes): +ui.warn(" %r\n" % (msg,)) +elif not msg: ui.warn(_(" empty string\n")) else: -ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) +ui.warn("\n%r\n" % util.ellipsis(msg)) except error.CensoredNodeError as inst: ui.warn(_("abort: file censored %s!\n") % inst) except error.RevlogError as inst: 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
D2637: hghave: remove unused "as ex" in exception block
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I overlooked this when removing a debug print in another change. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2637 AFFECTED FILES tests/hghave.py CHANGE DETAILS diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -715,5 +715,5 @@ from mercurial import policy bdiff = policy.importmod('bdiff') return bdiff.xdiffblocks('', '') == [(0, 0, 0, 0)] -except (ImportError, AttributeError) as ex: +except (ImportError, AttributeError): return 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
D2638: tests: fix indentation width in run-tests
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Caught by check-code. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2638 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 @@ -2318,13 +2318,13 @@ if previoustimes: def sortkey(f): - f = f['path'] - if f in previoustimes: -# Use most recent time as estimate -return -previoustimes[f][-1] - else: -# Default to a rather arbitrary value of 1 second for new tests -return -1.0 +f = f['path'] +if f in previoustimes: +# Use most recent time as estimate +return -previoustimes[f][-1] +else: +# Default to a rather arbitrary value of 1 second for new tests +return -1.0 else: # keywords for slow tests slow = {b'svn': 10, @@ -2447,7 +2447,7 @@ self._outputdir = os.path.join(self._outputdir, pathname) previoustimes = {} if self.options.order_by_runtime: - previoustimes = dict(loadtimes(self._outputdir)) +previoustimes = dict(loadtimes(self._outputdir)) sorttests(testdescs, previoustimes, shuffle=self.options.random) if 'PYTHONHASHSEED' not in os.environ: 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: [PATCH] py3: make gettext domain a system string
On Sat, Mar 03, 2018 at 07:15:38PM -0500, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1520122367 18000 > # Sat Mar 03 19:12:47 2018 -0500 > # Node ID de317419d5babc9b88aa17664eed96e8d7f8dbe8 > # Parent 1880fc2cbfc27c8b2fb0073f8aa9c0fa54937969 > py3: make gettext domain a system string queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2 RFC] lfs: add support for serving blob files
On Thu, Feb 22, 2018 at 01:34:08AM -0500, Matt Harbison wrote: > On Wed, 21 Feb 2018 01:10:50 -0500, Gregory Szorc > wrote: > > > On Sat, Feb 17, 2018 at 11:15 PM, Matt Harbison > > wrote: > > > > > # HG changeset patch > > > # User Matt Harbison > > > # Date 1518937155 18000 > > > # Sun Feb 18 01:59:15 2018 -0500 > > > # Node ID ba2e8627d87cfaca00931fe2dcee738c3c9a4f9d > > > # Parent 868bb2821e292cdda6050f229ade1af42d52c9e6 > > > lfs: add support for serving blob files > > > > > > There's a ton more to do, especially on the LFS side of things. But for > > > now, > > > I'm looking for a sanity check that this is the correct approach. The > > > protocol > > > is tied to http, and Gregory's recent refactoring at least gave me a > > > clue > > > where > > > to start. But it doesn't quite fit, because the POST requests end > > > up with > > > a > > > 'query' string, so HTTP_NOT_FOUND is returned. I thought maybe I could > > > just > > > wrap hgweb._runwsgi() to slurp the requests and bypass the core > > > completely. But > > > that's an instance method, and I didn't see a way to ensure every > > > instance > > > could > > > be subclassed. That function also does a bit of work to populate the > > > request > > > object. So I went back to the new protocolhandler, and hacked the > > > core to > > > not > > > fail on an LFS handler. (Assuming that this is generally OK, maybe core > > > could > > > check an attribute on it to see if it's a native protocol before > > > doing the > > > query > > > and permission checks?) > > > > > > The core hasn't been handling PUT requests, which are needed to upload > > > files. I > > > tried, but failed subclass the handler from the LFS extension, so I just > > > added > > > it in core for now. (I think I know what I did wrong, but it's > > > trivial to > > > add > > > to core, so IDK how much effort it's worth trying to wrap more stuff to > > > keep it > > > out of there.) > > > > > > The code is pretty well marked with TODOs. I know very little about the > > > underlying python framework, or how this code fits into `hg serve` and a > > > normal > > > webserver, so this is the result of a fair amount of trial and > > > error. On > > > the > > > plus side, test-lfs-test-server.t can have test-lfs-serve swapped for > > > `hg serve`, and the test runs, modulo one point where corruption was > > > introduced. > > > The server should be kicking back an error indicating the > > > corruption, but > > > it > > > aborts instead (this is already flagged as a TODO). > > > > > > > I really wish we had a proper HTTP server / dispatching framework in play > > to make stuff like this easier to implement. > > > > Anyway, I think teaching core about the LFS URL space is fine. We can > > provide a dummy function that 404s on access to those URLs by default. If > > the LFS extension is enabled, it can wrap the default handlers to > > implement > > needed functionality. > > > > It would also be rad if we could fix the request object so it is sane. > > Having to read from CGI/WSGI environment variables is a pain and prone to > > errors. Also, the main dispatch function conflates the query string and > > the > > POSTed URL encoded request body IIRC. It's a lot of horrible code that > > needs some refactoring love. It might be easier to vendor something like > > WebOb... > > That looks interesting. It looks like there's a file descriptor for the > body, so maybe we won't need to read in the whole file before sending it. > But all of this is well outside my area of knowledge, so I'll leave that for > someone else to figure out. > > > FWIW, I suspect I may be doing some refactoring here as part of > > implementing version 2 of the HTTP wire protocol. I'm slowly making > > progress... > > Cool. I think there's still plenty of time this cycle to get all of this > landed. Hopefully with the hook points I just submitted, there's no other > stuff I need to change in the core. Figuring out the lfs behavior is the > tricky part. I'm not too worried about changes to the http code. > > > If you want to start sending non-RFC patches, I'd start with landing the > > URL routing pieces in core. Make it so requests to the LFS URL space are > > recognized and dispatched accordingly. The rest will sort itself out over > > time. +1 > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] templater: fix position of terminator character in error message
On Sun, Mar 04, 2018 at 09:22:29AM -0500, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1520165030 18000 > # Sun Mar 04 07:03:50 2018 -0500 > # Node ID dad68a609114750b5963a8e46563a0b73620156f > # Parent 2a258985ffeb5ccdef17f437a6dc50cce68f6f8e > templater: fix position of terminator character in error message queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2621: tests: port test-log to Python 3
durin42 updated this revision to Diff 6545. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2621?vs=6513&id=6545 REVISION DETAIL https://phab.mercurial-scm.org/D2621 AFFECTED FILES contrib/python3-whitelist tests/test-log.t CHANGE DETAILS diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -2016,33 +2016,31 @@ $ hg init problematicencoding $ cd problematicencoding - $ $PYTHON > setup.sh < print(u''' - > echo a > text - > hg add text - > hg --encoding utf-8 commit -u '\u30A2' -m none - > echo b > text - > hg --encoding utf-8 commit -u '\u30C2' -m none - > echo c > text - > hg --encoding utf-8 commit -u none -m '\u30A2' - > echo d > text - > hg --encoding utf-8 commit -u none -m '\u30C2' - > '''.encode('utf-8')) - > EOF + >>> with open('setup.sh', 'wb') as f: + ... f.write(u''' + ... echo a > text + ... hg add text + ... hg --encoding utf-8 commit -u '\u30A2' -m none + ... echo b > text + ... hg --encoding utf-8 commit -u '\u30C2' -m none + ... echo c > text + ... hg --encoding utf-8 commit -u none -m '\u30A2' + ... echo d > text + ... hg --encoding utf-8 commit -u none -m '\u30C2' + ... '''.encode('utf-8')) and None $ sh < setup.sh test in problematic encoding - $ $PYTHON > test.sh < print(u''' - > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2' - > echo - > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2' - > echo - > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2' - > echo - > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2' - > '''.encode('cp932')) - > EOF + >>> with open('test.sh', 'wb') as f: + ... f.write(u''' + ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2' + ... echo + ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2' + ... echo + ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2' + ... echo + ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2' + ... '''.encode('cp932')) and None $ sh < test.sh 0 @@ -2255,14 +2253,14 @@ > from mercurial import namespaces > > def reposetup(ui, repo): - > foo = {'foo': repo[0].node()} + > foo = {b'foo': repo[0].node()} > names = lambda r: foo.keys() > namemap = lambda r, name: foo.get(name) > nodemap = lambda r, node: [name for name, n in foo.items() >if n == node] > ns = namespaces.namespace( - > "bars", templatename="bar", logname="barlog", - > colorname="barcolor", listnames=names, namemap=namemap, + > b"bars", templatename=b"bar", logname=b"barlog", + > colorname=b"barcolor", listnames=names, namemap=namemap, > nodemap=nodemap) > > repo.names.addnamespace(ns) diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -172,6 +172,7 @@ test-largefiles-small-disk.t test-locate.t test-lock-badness.t +test-log.t test-logexchange.t test-lrucachedict.py test-mactext.t 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
D2394: histedit: make histedit's commands accept revsets (issue5746)
durin42 added a comment. Nice! I've got one suggested edit to the code that should still pass tests. INLINE COMMENTS > histedit.py:428-432 > try: > -rev = node.bin(rulehash) > +rev = node.bin(ruleid) > except TypeError: > -raise error.ParseError("invalid changeset %s" % rulehash) > +try: > +_ctx = scmutil.revsingle(state.repo, ruleid) I think you can replace this outer try with a revsingle call, something like this: try: ruleid = rule.strip().split(' ', 1)[0] _ctx = scmutil.revsingle(state.repo, ruleid) rulehash = _ctx.hex() rev = node.bin(rulehash) except error.RepoLookupError: REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2394 To: sangeet259, durin42, #hg-reviewers Cc: tom.prince, krbullock, rishabhmadan96, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2473: py3: use pycompat.strurl to convert url to str
durin42 commandeered this revision. durin42 added a reviewer: pulkit. durin42 added a comment. This was landed as https://phab.mercurial-scm.org/D2474 AFAICT REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2473 To: durin42, #hg-reviewers, pulkit Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2255: releasenotes: replace abort with warning while parsing
durin42 added a comment. Friendly ping - should I expect an updated version of this series? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2255 To: rishabhmadan96, #hg-reviewers Cc: durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2590: cbor: add a __init__.py to top level cbor module
durin42 added a comment. I feel like we're missing a precursor for this change that actually imports cbor? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2590 To: pulkit, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2640: cbor: remove tests files and fix core's test-check*
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This patch fixes test-check* failures because of the new thirdparty cbor which is moved to core. Also this patch deletes the test files of cbor. Next patch will reorder the files so we can use them inside mercurial/ REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2640 AFFECTED FILES mercurial/thirdparty/cbor/cbor/__init__.py mercurial/thirdparty/cbor/cbor/cbor.py mercurial/thirdparty/cbor/cbor/tests/__init__.py mercurial/thirdparty/cbor/cbor/tests/test_cbor.py mercurial/thirdparty/cbor/cbor/tests/test_objects.py mercurial/thirdparty/cbor/cbor/tests/test_usage.py mercurial/thirdparty/cbor/cbor/tests/test_vectors.py mercurial/thirdparty/cbor/setup.py mercurial/thirdparty/cbor/utest.sh tests/test-check-py3-compat.t tests/test-check-pyflakes.t CHANGE DETAILS diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t --- a/tests/test-check-pyflakes.t +++ b/tests/test-check-pyflakes.t @@ -16,6 +16,7 @@ $ testrepohg locate 'set:**.py or grep("^#!.*python")' \ > -X hgext/fsmonitor/pywatchman \ > -X mercurial/pycompat.py -X contrib/python-zstandard \ + > -X mercurial/thirdparty/cbor \ > 2>/dev/null \ > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py" diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -5,6 +5,7 @@ $ testrepohg files 'set:(**.py)' \ > -X hgdemandimport/demandimportpy2.py \ + > -X mercurial/thirdparty/cbor \ > | sed 's|\\|/|g' | xargs $PYTHON contrib/check-py3-compat.py contrib/python-zstandard/setup.py not using absolute_import contrib/python-zstandard/setup_zstd.py not using absolute_import diff --git a/mercurial/thirdparty/cbor/utest.sh b/mercurial/thirdparty/cbor/utest.sh deleted file mode 100755 --- a/mercurial/thirdparty/cbor/utest.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -x - -python -m cbor.tests.test_cbor -python -m cbor.tests.test_objects -python -m cbor.tests.test_usage -python -m cbor.tests.test_vectors - -#python cbor/tests/test_cbor.py -#python cbor/tests/test_objects.py -#python cbor/tests/test_usage.py -#python cbor/tests/test_vectors.py diff --git a/mercurial/thirdparty/cbor/setup.py b/mercurial/thirdparty/cbor/setup.py --- a/mercurial/thirdparty/cbor/setup.py +++ b/mercurial/thirdparty/cbor/setup.py @@ -1,4 +1,3 @@ -#! /usr/bin/env python # Copyright 2014 Brian Olson # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/mercurial/thirdparty/cbor/cbor/tests/test_vectors.py b/mercurial/thirdparty/cbor/cbor/tests/test_vectors.py deleted file mode 100644 --- a/mercurial/thirdparty/cbor/cbor/tests/test_vectors.py +++ /dev/null @@ -1,142 +0,0 @@ -#!/usr/bin/env python - -""" -Test CBOR implementation against common "test vectors" set from -https://github.com/cbor/test-vectors/ -""" - -import base64 -import json -import logging -import math -import os -import sys -import unittest - - -_IS_PY3 = sys.version_info[0] >= 3 - - -logger = logging.getLogger(__name__) - - -#from cbor.cbor import dumps as pydumps -from cbor.cbor import loads as pyloads -try: -#from cbor._cbor import dumps as cdumps -from cbor._cbor import loads as cloads -except ImportError: -# still test what we can without C fast mode -logger.warn('testing without C accelerated CBOR', exc_info=True) -#cdumps, cloads = None, None -cloads = None -from cbor import Tag - - -# Accomodate several test vectors that have diagnostic descriptors but not JSON -_DIAGNOSTIC_TESTS = { -'Infinity': lambda x: x == float('Inf'), -'-Infinity': lambda x: x == float('-Inf'), -'NaN': math.isnan, -'undefined': lambda x: x is None, - -# TODO: parse into datetime.datetime() -'0("2013-03-21T20:04:00Z")': lambda x: isinstance(x, Tag) and (x.tag == 0) and (x.value == '2013-03-21T20:04:00Z'), - -"h''": lambda x: x == b'', -"(_ h'0102', h'030405')": lambda x: x == b'\x01\x02\x03\x04\x05', -'{1: 2, 3: 4}': lambda x: x == {1: 2, 3: 4}, -"h'01020304'": lambda x: x == b'\x01\x02\x03\x04', -} - - -# We expect these to raise exception because they encode reserved/unused codes in the spec. -# ['hex'] values of tests we expect to raise -_EXPECT_EXCEPTION = set(['f0', 'f818', 'f8ff']) - - -def _check(row, decoded): -cbdata = base64.b64decode(row['cbor']) -if cloads is not None: -cb = cloads(cbdata) -if cb != decoded: -anyerr = True -sys.stderr.write('expected {0!r} got {1!r} c failed to decode cbor {2}\n'.format(decoded, cb, base64.b16encode(cbdata))) - -cb = pyloads(cbdata) -if cb != decoded: -anyerr = True -sys.stderr.write('expected {0!r} got {1!r} py failed to decode cbor {2}\n'.format(decoded, cb, base64.b16encode(cbdata))) - - -def _check
D2593: state: add logic to parse the state file in old way if cbor fails
durin42 added inline comments. INLINE COMMENTS > pulkit wrote in state.py:84 > I am not confident about this part. Like to have some suggestions here. Probably treat not-a-dict as corrupt and fall back to the other format? > pulkit wrote in state.py:86 > Should I change thirdparty/cbor/ to raise specific errors? Ugh. Yeah, maybe see if they'd take a patch upstream to raise a more explicit exception type. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2593 To: pulkit, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2590: cbor: add a __init__.py to top level cbor module
pulkit added a comment. In https://phab.mercurial-scm.org/D2590#42648, @durin42 wrote: > I feel like we're missing a precursor for this change that actually imports cbor? sorry, my bad. Send then parent changesets also. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2590 To: pulkit, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2597: graft: add test for reading old format state files with new mechanism
durin42 added a comment. Overall I think I like where this is headed. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2597 To: pulkit, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2596: state: raise ProgrammingError if an invalid key is being accessed
durin42 added a comment. Hmm, really? Do any states have optional entries that would make this awkward? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2596 To: pulkit, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2640: cbor: remove tests files and fix core's test-check*
durin42 added inline comments. INLINE COMMENTS > __init__.py:1 > -#!python > - These #! lines shouldn't hurt anyone - we should fix the test to exclude the thirdparty directory. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2640 To: pulkit, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@36689: 25 new changesets (4 on stable)
25 new changesets (4 on stable) in mercurial: https://www.mercurial-scm.org/repo/hg/rev/6276cbc704a6 changeset: 36665:6276cbc704a6 user:Martin von Zweigbergk date:Wed Jan 31 22:21:33 2018 -0800 summary: testrunner: add option to sort tests by previous run time https://www.mercurial-scm.org/repo/hg/rev/d79d68bb9f7c changeset: 3:d79d68bb9f7c user:Pulkit Goyal <7895pul...@gmail.com> date:Fri Mar 02 07:15:54 2018 +0530 summary: py3: replace __str__ to __bytes__ in hgext/journal.py https://www.mercurial-scm.org/repo/hg/rev/bcfc4e3b6548 changeset: 36667:bcfc4e3b6548 user:Pulkit Goyal <7895pul...@gmail.com> date:Fri Mar 02 07:16:33 2018 +0530 summary: py3: use bytes() instead of str() https://www.mercurial-scm.org/repo/hg/rev/e77cee5de1c7 changeset: 36668:e77cee5de1c7 user:Pulkit Goyal <7895pul...@gmail.com> date:Fri Mar 02 07:17:06 2018 +0530 summary: py3: use b"%d" to covert integer to bytes instead of str https://www.mercurial-scm.org/repo/hg/rev/80d7fb6c2dec changeset: 36669:80d7fb6c2dec user:Ryan McElroy date:Sat Mar 03 14:23:40 2018 -0800 summary: templater: add hint to template parse errors to help locate issues https://www.mercurial-scm.org/repo/hg/rev/44048f1bcee5 changeset: 36670:44048f1bcee5 user:Ryan McElroy date:Sat Mar 03 14:30:21 2018 -0800 summary: templater: provide hint for multi-line templates with parse errors https://www.mercurial-scm.org/repo/hg/rev/34e2ff1f9cd8 changeset: 36671:34e2ff1f9cd8 user:Jun Wu date:Sat Mar 03 10:39:43 2018 -0800 summary: xdiff: vendor xdiff library from git https://www.mercurial-scm.org/repo/hg/rev/9e7b14caf67f changeset: 36672:9e7b14caf67f user:Jun Wu date:Sat Mar 03 10:39:55 2018 -0800 summary: xdiff: remove patience and histogram diff algorithms https://www.mercurial-scm.org/repo/hg/rev/b3c9c483cac9 changeset: 36673:b3c9c483cac9 user:Jun Wu date:Sat Mar 03 12:38:41 2018 -0800 summary: xdiff: add a bdiff hunk mode https://www.mercurial-scm.org/repo/hg/rev/c420792217c8 changeset: 36674:c420792217c8 user:Jun Wu date:Sat Mar 03 12:39:11 2018 -0800 summary: xdiff: reduce indent heuristic overhead https://www.mercurial-scm.org/repo/hg/rev/430fdb717549 changeset: 36675:430fdb717549 user:Jun Wu date:Sat Mar 03 12:39:14 2018 -0800 summary: bdiff: add a xdiffblocks method https://www.mercurial-scm.org/repo/hg/rev/c6a61298ac32 changeset: 36676:c6a61298ac32 user:Jun Wu date:Sat Mar 03 12:39:14 2018 -0800 summary: mdiff: add a config option to use xdiff algorithm https://www.mercurial-scm.org/repo/hg/rev/a247a0e82e7d changeset: 36677:a247a0e82e7d user:Jun Wu date:Sat Mar 03 12:39:14 2018 -0800 summary: run-tests: allow #require inside #if https://www.mercurial-scm.org/repo/hg/rev/7834927f0243 changeset: 36678:7834927f0243 user:Jun Wu date:Sat Mar 03 12:39:15 2018 -0800 summary: tests: add tests about diff quality https://www.mercurial-scm.org/repo/hg/rev/624cbd1477a6 changeset: 36679:624cbd1477a6 user:Augie Fackler date:Sat Mar 03 18:58:13 2018 -0500 summary: fuzz: add a fuzzer for xdiff https://www.mercurial-scm.org/repo/hg/rev/66f2e622a2ed changeset: 36680:66f2e622a2ed user:Augie Fackler date:Sat Mar 03 19:26:30 2018 -0500 summary: fuzz: add a quick README to try and document how to test new fuzzers https://www.mercurial-scm.org/repo/hg/rev/340e4b711df7 changeset: 36681:340e4b711df7 user:Matt Harbison date:Sat Mar 03 23:29:40 2018 -0500 summary: bdiff: avoid pointer arithmetic on void* https://www.mercurial-scm.org/repo/hg/rev/68328202f270 changeset: 36682:68328202f270 user:Kevin Bullock date:Sat Mar 03 19:02:50 2018 -0500 summary: dispatch: don't clamp the range of the exit code twice https://www.mercurial-scm.org/repo/hg/rev/e39953fdd924 changeset: 36683:e39953fdd924 user:Matt Harbison date:Sat Mar 03 00:35:59 2018 -0500 summary: profile: colorize output on Windows https://www.mercurial-scm.org/repo/hg/rev/5f41e3418407 changeset: 36684:5f41e3418407 user:Ryan McElroy date:Sat Mar 03 11:07:46 2018 -0800 summary: setup: ignore extension load failures when finding working hg https://www.mercurial-scm.org/repo/hg/rev/2a258985ffeb changeset: 36685:2a258985ffeb bookmark:@ user:Ryan McElroy date:Sat Mar 03 15:31:37 2018 -0800 summary: revsetlang: add a hint for more useful parse errors https://www.mercurial-scm.org/repo/hg/rev/0c14b3f23294 changeset: 36686:0c14b3f23294 branch: stable parent: 36510:0a7c59a4c835 user:Matt Harbison date:Wed Feb 28 00:29:27 2018 -0500 summary: test-subrepo: demonstrate problems with subrepo sharing and absolute pat
D2596: state: raise ProgrammingError if an invalid key is being accessed
pulkit added a comment. In https://phab.mercurial-scm.org/D2596#42672, @durin42 wrote: > Hmm, really? Do any states have optional entries that would make this awkward? Nope, but I wanted to be safe here raising a ProgrammingError instead of KeyError. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2596 To: pulkit, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2638: tests: fix indentation width in run-tests
pulkit added a comment. This looks like fixed at tip of hg-committed. Not required anymore. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2638 To: durin42, #hg-reviewers, pulkit Cc: 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 > yuja wrote in dispatch.py:624 > Maybe this type conversion can be a `fancyopt.customopt` method since we've > refactored the default handling by https://phab.mercurial-scm.org/D2090? > > # no idea if _defaultopt() should be made public or the whole > commands.default handling > # should be moved to fancyopts > x = fancyopts._defaultopt(olddefault) > newdefault = x.configdefault(ui, cmd, optname, ...) > > @dploch, any suggestions? The issue is that customopt (and all its children) assume the value type is already the correct one, and thus do not perform any conversion. Since we're parsing values from the config file, the conversion is desired to ensure they don't all end up as text - the config{bool,int,etc} methods called by configtyped perform the proper conversion. In most cases (all commands that declare default values) no conversio is needed since those already have the correct type. > yuja wrote in ui.py:390 > Perhaps this is noop since `[commands]` is removed at all if `ui.plain()` > returns True. You're right, I had the plain logic inverted in my head. Removed. 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
D2623: dispatch: adding config items for overriding flag defaults
rdamazio updated this revision to Diff 6548. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2623?vs=6523&id=6548 REVISION DETAIL https://phab.mercurial-scm.org/D2623 AFFECTED FILES mercurial/configitems.py mercurial/dispatch.py tests/test-dispatch.t CHANGE DETAILS diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t --- a/tests/test-dispatch.t +++ b/tests/test-dispatch.t @@ -8,8 +8,10 @@ $ hg -v log -v x $ echo a > a + $ echo b > b $ hg ci -Ama adding a + adding b Missing arg: @@ -52,10 +54,10 @@ Parsing of early options should stop at "--": $ hg cat -- --config=hooks.pre-cat=false - --config=hooks.pre-cat=false: no such file in rev cb9a9f314b8b + --config=hooks.pre-cat=false: no such file in rev 0cd96de13884 [1] $ hg cat -- --debugger - --debugger: no such file in rev cb9a9f314b8b + --debugger: no such file in rev 0cd96de13884 [1] Unparsable form of early options: @@ -155,31 +157,75 @@ abort: pre-log hook exited with status 1 [255] $ HGPLAIN=+strictflags hg --cwd .. -q -Ra log -b default - 0:cb9a9f314b8b + 0:0cd96de13884 $ HGPLAIN=+strictflags hg --cwd .. -q --repository a log -b default - 0:cb9a9f314b8b + 0:0cd96de13884 $ HGPLAIN=+strictflags hg --cwd .. -q --repo a log -b default - 0:cb9a9f314b8b + 0:0cd96de13884 For compatibility reasons, HGPLAIN=+strictflags is not enabled by plain HGPLAIN: $ HGPLAIN= hg log --config='hooks.pre-log=false' -b default abort: pre-log hook exited with status 1 [255] $ HGPLAINEXCEPT= hg log --cwd .. -q -Ra -b default - 0:cb9a9f314b8b + 0:0cd96de13884 [defaults] $ hg cat a a + $ cp $HGRCPATH hgrc.bak $ cat >> $HGRCPATH < [defaults] > cat = -r null > EOF $ hg cat a a: no such file in rev [1] + $ cp -f hgrc.bak $HGRCPATH + +new-style [commands] defaults and overrides + + $ hg cat a + a + $ cat >> $HGRCPATH < [commands] + > cat.default.rev = null + > EOF + $ hg cat a + a: no such file in rev + [1] + + $ mv -f hgrc.bak $HGRCPATH + $ echo foo >> a + $ hg rm b + $ echo bar > c + $ hg add c + $ hg status + M a + A c + R b + ? bad.py + ? bad.pyc + $ cat >> $HGRCPATH < [commands] + > status.default.removed = 1 + > EOF + $ hg status + R b + $ hg status --modified + M a + R b + $ hg status --modified --no-removed + M a + $ hg status --no-removed + M a + A c + R b + ? bad.py + ? bad.pyc + $ hg revert a b c $ cd "$TESTTMP" diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -611,6 +611,21 @@ args = pycompat.maplist( util.expandpath, pycompat.shlexsplit(defaults)) + args c = list(entry[1]) + +# Apply new-style defaults from config file by actually changing the +# option defaults. We still let old-style defaults trump these (since +# those are added to the command line). +for idx, opt in enumerate(c): +optname = opt[1] +olddefault = opt[2] +defaulttype = type(olddefault) +cfgitem = "%s.default.%s" % (cmd, optname) +# parse the new default as the same type as the original. +newdefault = ui.configtyped("commands", cfgitem, defaulttype, olddefault) +if olddefault != newdefault: +# override the default in the flag declaration. +c[idx] = (opt[0], opt[1], newdefault, opt[3]) + else: cmd = None c = [] diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -184,6 +184,10 @@ coreconfigitem('color', 'pagermode', default=dynamicdefault, ) +coreconfigitem('commands', '.*\.default\..*', +generic=True, +default=dynamicdefault, +) coreconfigitem('commands', 'show.aliasprefix', default=list, ) 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
D2638: tests: fix indentation width in run-tests
durin42 abandoned this revision. durin42 added a comment. Oh nice. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2638 To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2637: hghave: remove unused "as ex" in exception block
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1d06407d0ee9: hghave: remove unused "as ex" in exception block (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2637?vs=6543&id=6550 REVISION DETAIL https://phab.mercurial-scm.org/D2637 AFFECTED FILES tests/hghave.py CHANGE DETAILS diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -715,5 +715,5 @@ from mercurial import policy bdiff = policy.importmod('bdiff') return bdiff.xdiffblocks('', '') == [(0, 0, 0, 0)] -except (ImportError, AttributeError) as ex: +except (ImportError, AttributeError): return False To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2636: scmutil: fix oversight in b76248e51605c6 where I forgot to use msg
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc442c4a92ae8: scmutil: fix oversight in b76248e51605c6 where I forgot to use msg (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2636?vs=6542&id=6551 REVISION DETAIL https://phab.mercurial-scm.org/D2636 AFFECTED FILES mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -189,12 +189,12 @@ msg = inst.args[1] if isinstance(msg, type(u'')): msg = pycompat.sysbytes(msg) -elif not isinstance(inst.args[1], bytes): -ui.warn(" %r\n" % (inst.args[1],)) -elif not inst.args[1]: +if not isinstance(msg, bytes): +ui.warn(" %r\n" % (msg,)) +elif not msg: ui.warn(_(" empty string\n")) else: -ui.warn("\n%r\n" % util.ellipsis(inst.args[1])) +ui.warn("\n%r\n" % util.ellipsis(msg)) except error.CensoredNodeError as inst: ui.warn(_("abort: file censored %s!\n") % inst) except error.RevlogError as inst: To: durin42, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2621: tests: port test-log to Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHG19e859cad54c: tests: port test-log to Python 3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2621?vs=6545&id=6549 REVISION DETAIL https://phab.mercurial-scm.org/D2621 AFFECTED FILES contrib/python3-whitelist tests/test-log.t CHANGE DETAILS diff --git a/tests/test-log.t b/tests/test-log.t --- a/tests/test-log.t +++ b/tests/test-log.t @@ -2016,33 +2016,31 @@ $ hg init problematicencoding $ cd problematicencoding - $ $PYTHON > setup.sh < print(u''' - > echo a > text - > hg add text - > hg --encoding utf-8 commit -u '\u30A2' -m none - > echo b > text - > hg --encoding utf-8 commit -u '\u30C2' -m none - > echo c > text - > hg --encoding utf-8 commit -u none -m '\u30A2' - > echo d > text - > hg --encoding utf-8 commit -u none -m '\u30C2' - > '''.encode('utf-8')) - > EOF + >>> with open('setup.sh', 'wb') as f: + ... f.write(u''' + ... echo a > text + ... hg add text + ... hg --encoding utf-8 commit -u '\u30A2' -m none + ... echo b > text + ... hg --encoding utf-8 commit -u '\u30C2' -m none + ... echo c > text + ... hg --encoding utf-8 commit -u none -m '\u30A2' + ... echo d > text + ... hg --encoding utf-8 commit -u none -m '\u30C2' + ... '''.encode('utf-8')) and None $ sh < setup.sh test in problematic encoding - $ $PYTHON > test.sh < print(u''' - > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2' - > echo - > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2' - > echo - > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2' - > echo - > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2' - > '''.encode('cp932')) - > EOF + >>> with open('test.sh', 'wb') as f: + ... f.write(u''' + ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2' + ... echo + ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2' + ... echo + ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2' + ... echo + ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2' + ... '''.encode('cp932')) and None $ sh < test.sh 0 @@ -2255,14 +2253,14 @@ > from mercurial import namespaces > > def reposetup(ui, repo): - > foo = {'foo': repo[0].node()} + > foo = {b'foo': repo[0].node()} > names = lambda r: foo.keys() > namemap = lambda r, name: foo.get(name) > nodemap = lambda r, node: [name for name, n in foo.items() >if n == node] > ns = namespaces.namespace( - > "bars", templatename="bar", logname="barlog", - > colorname="barcolor", listnames=names, namemap=namemap, + > b"bars", templatename=b"bar", logname=b"barlog", + > colorname=b"barcolor", listnames=names, namemap=namemap, > nodemap=nodemap) > > repo.names.addnamespace(ns) diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -172,6 +172,7 @@ test-largefiles-small-disk.t test-locate.t test-lock-badness.t +test-log.t test-logexchange.t test-lrucachedict.py test-mactext.t 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
D2641: docs: small fixes for profiling.nested and the overall description
spectral created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY - profiling.nested defaults to 0, not 5 - profiling is not always done with lsprof REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2641 AFFECTED FILES mercurial/help/config.txt CHANGE DETAILS diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1584,8 +1584,7 @@ In this section description, 'profiling data' stands for the raw data collected during profiling, while 'profiling report' stands for a -statistical text report generated from the profiling data. The -profiling is done using lsprof. +statistical text report generated from the profiling data. ``enabled`` Enable the profiler. @@ -1657,7 +1656,7 @@ Show at most this number of lines of drill-down info after each main entry. This can help explain the difference between Total and Inline. Specific to the ``ls`` instrumenting profiler. -(default: 5) +(default: 0) ``showmin`` Minimum fraction of samples an entry must have for it to be displayed. To: spectral, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1919: phabricator: specify API tokens per host, rather than per repo
durin42 added a comment. Coming back to this. How about we do this: diff --git a/contrib/phabricator.py b/contrib/phabricator.py --- a/contrib/phabricator.py +++ b/contrib/phabricator.py @@ -99,6 +99,17 @@ def urlencodenested(params): process('', params) return util.urlreq.urlencode(flatparams) +def readlegacytoken(repo): +"""Transitional support for old phabricator tokens. + +Remove before the 4.6 release. +""" +token = ui.config('phabricator', 'token') +if token: +repo.ui.warn(_('phabricator.token is deprecated - please ' + 'migrate to the phabricator.auth section.\n')) +return token + def readurltoken(repo): """return conduit url, token and make sure they exist @@ -128,8 +139,10 @@ def readurltoken(repo): break if not token: -raise error.Abort(_('Can\'t find conduit token associated to %s') - % (url,)) +token = readlegacytoken(repo) +if not token: +raise error.Abort(_('Can\'t find conduit token associated to %s') + % (url,)) return url, token for a few weeks to give people a migration path? Can we live with that? I'm happy to do that as a follow-up. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1919 To: tom.prince, #hg-reviewers, durin42 Cc: quark, indygreg, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2588: commit: adds multiline commit message support(issue5616)
pulkit added inline comments. INLINE COMMENTS > fancyopts.py:365 > _('invalid value %r for option %s, %s') % (val, opt, s)) > -state[name] = defmap[name].newstate(state[name], val, abort) > +if name == 'message': > +if state[name] != '': I think this is not the right place to have this hack. We should have this as a part of `hg commit` code rather. > test-commit.t:847 > + files: a > + description: > + This is the first line starting with a newline seems awkward. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2588 To: sangeet259, #hg-reviewers Cc: pulkit, jeffpc, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D1919: phabricator: specify API tokens per host, rather than per repo
durin42 added a comment. (If people are happy enough with that, I'll plan to mail my follow-up as a patch stacked on this one so they can be landed as a pair.) REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D1919 To: tom.prince, #hg-reviewers, durin42 Cc: quark, indygreg, durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] lock: block signal interrupt while making a lock file
# HG changeset patch # User Yuya Nishihara # Date 1520138979 18000 # Sat Mar 03 23:49:39 2018 -0500 # Node ID 8ff5f6277e204df49b3426a144375db11b41b38d # Parent dad68a609114750b5963a8e46563a0b73620156f lock: block signal interrupt while making a lock file On Windows where symlink isn't supported, util.makelock() could leave an empty file if interrupted immediately after os.open(). This empty lock never dies as it has no process id recorded. ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL) # an interrupt may occur here os.write(ld, info) os.close(ld) This was a long-standing bug of TortoiseHg which runs a command-server and kills it by CTRL_C_EVENT, reported by random Windows users. https://bitbucket.org/tortoisehg/thg/issues/4873/#comment-43591129 At first, I tried to fix makelock() to clean up a stale lock file, which turned out to be hard because any instructions may be interrupted by a signal. ld = None try: # CALL_FUNCTION # os.open(...) # an interrupt may occur here # STORE_FAST # ld = ... ld = os.open(pathname, os.O_CREAT | os.O_WRONLY | os.O_EXCL) os.write(ld, info) ... return True except: if ld: ... os.unlink(pathname) return False So I decided to block signals by temporarily replacing the signal handlers so makelcok() and held = 1 will never be interrupted. Many thanks to Fernando Najera for investigating the issue. diff --git a/mercurial/lock.py b/mercurial/lock.py --- a/mercurial/lock.py +++ b/mercurial/lock.py @@ -10,6 +10,7 @@ from __future__ import absolute_import import contextlib import errno import os +import signal import socket import time import warnings @@ -39,6 +40,64 @@ def _getlockprefix(): raise return result +@contextlib.contextmanager +def _delayedinterrupt(): +"""Block signal interrupt while doing something critical + +This makes sure that the code block wrapped by this context manager won't +be interrupted. + +For Windows developers: It appears not possible to guard time.sleep() +from CTRL_C_EVENT, so please don't use time.sleep() to test if this is +working. +""" +assertedsigs = [] +blocked = False +orighandlers = {} + +def raiseinterrupt(num): +if (num == getattr(signal, 'SIGINT', None) or +num == getattr(signal, 'CTRL_C_EVENT', None)): +raise KeyboardInterrupt +else: +raise error.SignalInterrupt +def catchterm(num, frame): +if blocked: +assertedsigs.append(num) +else: +raiseinterrupt(num) + +try: +# save handlers first so they can be restored even if a setup is +# interrupted between signal.signal() and orighandlers[] =. +for name in ['CTRL_C_EVENT', 'SIGINT', 'SIGBREAK', 'SIGHUP', 'SIGTERM']: +num = getattr(signal, name, None) +if num and num not in orighandlers: +orighandlers[num] = signal.getsignal(num) +try: +for num in orighandlers: +signal.signal(num, catchterm) +except ValueError: +pass # in a thread? no luck + +blocked = True +yield +finally: +# no simple way to reliably restore all signal handlers because +# any loops, recursive function calls, except blocks, etc. can be +# interrupted. so instead, make catchterm() raise interrupt. +blocked = False +try: +for num, handler in orighandlers.items(): +signal.signal(num, handler) +except ValueError: +pass # in a thread? + +# re-raise interrupt exception if any, which may be shadowed by a new +# interrupt occurred while re-raising the first one +if assertedsigs: +raiseinterrupt(assertedsigs[0]) + def trylock(ui, vfs, lockname, timeout, warntimeout, *args, **kwargs): """return an acquired lock or raise an a LockHeld exception @@ -182,8 +241,9 @@ class lock(object): while not self.held and retry: retry -= 1 try: -self.vfs.makelock(lockname, self.f) -self.held = 1 +with _delayedinterrupt(): +self.vfs.makelock(lockname, self.f) +self.held = 1 except (OSError, IOError) as why: if why.errno == errno.EEXIST: locker = self._readlock() diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1674,6 +1674,11 @@ if safehasattr(time, "perf_counter"): timer = time.perf_counter def makelock(info, pathname): +"""Create a lock file atomically if possible + +This may leave a stale lock file if symlink isn't supported and signal +interrupt is enabled. +""" try: return os.symlink(info, pathname) except OSEr
D2641: docs: small fixes for profiling.nested and the overall description
This revision was automatically updated to reflect the committed changes. Closed by commit rHG0c431d3129c4: docs: small fixes for profiling.nested and the overall description (authored by spectral, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2641?vs=6552&id=6553 REVISION DETAIL https://phab.mercurial-scm.org/D2641 AFFECTED FILES mercurial/help/config.txt CHANGE DETAILS diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt --- a/mercurial/help/config.txt +++ b/mercurial/help/config.txt @@ -1584,8 +1584,7 @@ In this section description, 'profiling data' stands for the raw data collected during profiling, while 'profiling report' stands for a -statistical text report generated from the profiling data. The -profiling is done using lsprof. +statistical text report generated from the profiling data. ``enabled`` Enable the profiler. @@ -1657,7 +1656,7 @@ Show at most this number of lines of drill-down info after each main entry. This can help explain the difference between Total and Inline. Specific to the ``ls`` instrumenting profiler. -(default: 5) +(default: 0) ``showmin`` Minimum fraction of samples an entry must have for it to be displayed. To: spectral, #hg-reviewers, pulkit Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2642: util: also silence py3 warnings from codec module
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Fixes warnings like this: + mercurial/util.py:2446: DeprecationWarning: invalid escape sequence '\d' +return codecs.escape_decode(s)[0] REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2642 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -249,6 +249,8 @@ # silence warning emitted by passing user string to re.sub() warnings.filterwarnings(r'ignore', r'bad escape', DeprecationWarning, r'mercurial') +warnings.filterwarnings(r'ignore', r'invalid escape sequence', +DeprecationWarning, r'mercurial') def nouideprecwarn(msg, version, stacklevel=1): """Issue an python native deprecation warning 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
D2645: setdiscovery: remove unnecessary sample size limiting
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Both _takequicksample() and _takefullsample() already limit their result to the request size, so there's no need to let the caller do that again. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2645 AFFECTED FILES mercurial/setdiscovery.py CHANGE DETAILS diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -221,7 +221,6 @@ sample = list(undecided) else: sample = samplefunc(dag, undecided, targetsize) -sample = _limitsample(sample, targetsize) roundtrips += 1 ui.progress(_('searching'), roundtrips, unit=_('queries')) 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
D2646: setdiscovery: avoid a Yoda condition
martinvonz 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/D2646 AFFECTED FILES mercurial/setdiscovery.py CHANGE DETAILS diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -106,7 +106,7 @@ :nodes: set of nodes to discover :size: the maximum size of the sample""" sample = dag.headsetofconnecteds(nodes) -if size <= len(sample): +if len(sample) >= size: return _limitsample(sample, size) _updatesample(dag, None, sample, quicksamplesize=size) return sample 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
D2644: setdiscovery: remove initialsamplesize from a condition
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY It seems more direct to compare the actual sample size. That way we can change the sample taken earlier in the code without breaking the condition. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2644 AFFECTED FILES mercurial/setdiscovery.py CHANGE DETAILS diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -175,7 +175,7 @@ ui.debug("all remote heads known locally\n") return (srvheadhashes, False, srvheadhashes,) -if sample and len(ownheads) <= initialsamplesize and all(yesno): +if len(sample) == len(ownheads) and all(yesno): ui.note(_("all local heads known remotely\n")) ownheadhashes = dag.externalizeall(ownheads) return (ownheadhashes, True, srvheadhashes,) 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
D2647: setdiscovery: include all local heads in second "known" request (issue5809)
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY During discovery, when figuring out which of the local commits the remote has, we start by sending a random sample of REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2647 AFFECTED FILES mercurial/setdiscovery.py CHANGE DETAILS diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -107,12 +107,16 @@ :size: the maximum size of the sample""" sample = dag.headsetofconnecteds(nodes) if len(sample) >= size: -return _limitsample(sample, size) +# Return full set of heads, without limiting +return sample _updatesample(dag, None, sample, quicksamplesize=size) return sample def _takefullsample(dag, nodes, size): sample = dag.headsetofconnecteds(nodes) +if len(sample) >= size: +# Return full set of heads, without limiting +return sample # update from heads _updatesample(dag, nodes, sample) # update from roots 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
D2643: setdiscovery: back out changeset 5cfdf6137af8 (issue5809)
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY As explained in the bug report, this commit caused a performance regression. The problem occurs when the local repo has very many heads. Before https://phab.mercurial-scm.org/rHG5cfdf6137af87e52063a5a11a697bab805e4b03d, we used to get the remote's list of heads and if these heads mostly overlapped with the local repo's heads, we would mark these common heads as common, which would greatly reduce the size of the set of undecided nodes. Note that a similar problem existed before https://phab.mercurial-scm.org/rHG5cfdf6137af87e52063a5a11a697bab805e4b03d: If the local repo had very many heads and the server just had a few (or many heads from a disjoint set), we would do the same kind of slow discovery as we would with https://phab.mercurial-scm.org/rHG5cfdf6137af87e52063a5a11a697bab805e4b03d in the case where local and remote repos share a large set of common nodes. For now, we just back out https://phab.mercurial-scm.org/rHG5cfdf6137af87e52063a5a11a697bab805e4b03d. We should improve the discovery in the "local has many heads, remote has few heads" case, but let's do that after backing this out. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2643 AFFECTED FILES mercurial/discovery.py mercurial/setdiscovery.py CHANGE DETAILS diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -130,7 +130,7 @@ sample = set(random.sample(sample, desiredlen)) return sample -def findcommonheads(ui, local, remote, heads=None, +def findcommonheads(ui, local, remote, initialsamplesize=100, fullsamplesize=200, abortwhenunrelated=True, @@ -155,15 +155,11 @@ sample = _limitsample(ownheads, initialsamplesize) # indices between sample and externalized version must match sample = list(sample) -if heads: -srvheadhashes = heads -yesno = remote.known(dag.externalizeall(sample)) -else: -batch = remote.iterbatch() -batch.heads() -batch.known(dag.externalizeall(sample)) -batch.submit() -srvheadhashes, yesno = batch.results() +batch = remote.iterbatch() +batch.heads() +batch.known(dag.externalizeall(sample)) +batch.submit() +srvheadhashes, yesno = batch.results() if cl.tip() == nullid: if srvheadhashes != [nullid]: diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -57,7 +57,7 @@ if all(knownnode(h) for h in heads): return (heads, False, heads) -res = setdiscovery.findcommonheads(repo.ui, repo, remote, heads, +res = setdiscovery.findcommonheads(repo.ui, repo, remote, abortwhenunrelated=not force, ancestorsof=ancestorsof) common, anyinc, srvheads = res 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
D2642: util: also silence py3 warnings from codec module
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaa9c5d447980: util: also silence py3 warnings from codec module (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2642?vs=6554&id=6560 REVISION DETAIL https://phab.mercurial-scm.org/D2642 AFFECTED FILES mercurial/util.py CHANGE DETAILS diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -249,6 +249,8 @@ # silence warning emitted by passing user string to re.sub() warnings.filterwarnings(r'ignore', r'bad escape', DeprecationWarning, r'mercurial') +warnings.filterwarnings(r'ignore', r'invalid escape sequence', +DeprecationWarning, r'mercurial') def nouideprecwarn(msg, version, stacklevel=1): """Issue an python native deprecation warning To: durin42, #hg-reviewers, yuja Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2635: fuzz: add some more docs about building/running fuzzers
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe437de3881c1: fuzz: add some more docs about building/running fuzzers (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2635?vs=6541&id=6561 REVISION DETAIL https://phab.mercurial-scm.org/D2635 AFFECTED FILES contrib/fuzz/README.rst CHANGE DETAILS diff --git a/contrib/fuzz/README.rst b/contrib/fuzz/README.rst --- a/contrib/fuzz/README.rst +++ b/contrib/fuzz/README.rst @@ -10,5 +10,17 @@ 7) ln -s /hg-new mercurial 8) cd mercurial 9) compile + 10) ls $OUT + +Step 9 is literally running the command "compile", which is part of +the docker container. Once you have that working, you can build the +fuzzers like this (in the oss-fuzz repo): + +python infra/helper.py build_fuzzers --sanitizer address mercurial $HG_REPO_PATH + +(you can also say "memory", "undefined" or "coverage" for +sanitizer). Then run the built fuzzers like this: + +python infra/helper.py run_fuzzer mercurial -- $FUZZER 0: https://github.com/google/oss-fuzz/blob/master/docs/new_project_guide.md To: durin42, #hg-reviewers, yuja Cc: 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
yuja added inline comments. INLINE COMMENTS > rdamazio wrote in dispatch.py:624 > The issue is that customopt (and all its children) assume the value type is > already the correct one, and thus do not perform any conversion. Since we're > parsing values from the config file, the conversion is desired to ensure they > don't all end up as text - the config{bool,int,etc} methods called by > configtyped perform the proper conversion. In most cases (all commands that > declare default values) no conversio is needed since those already have the > correct type. IIUC, an extension author may implement its own customopt subclasses, and put them into the command table, so we can't make ui.configtyped to support all of them. 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
mercurial@36696: 7 new changesets
7 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/b529e640015d changeset: 36690:b529e640015d parent: 36685:2a258985ffeb parent: 36689:b394778b1a50 user:Augie Fackler date:Sun Mar 04 10:42:51 2018 -0500 summary: merge with stable https://www.mercurial-scm.org/repo/hg/rev/1b179d151578 changeset: 36691:1b179d151578 user:Yuya Nishihara date:Sun Mar 04 07:03:50 2018 -0500 summary: templater: fix position of terminator character in error message https://www.mercurial-scm.org/repo/hg/rev/aeaf9c7f7528 changeset: 36692:aeaf9c7f7528 user:Yuya Nishihara date:Sat Mar 03 19:12:47 2018 -0500 summary: py3: make gettext domain a system string https://www.mercurial-scm.org/repo/hg/rev/19e859cad54c changeset: 36693:19e859cad54c user:Augie Fackler date:Sat Mar 03 18:33:10 2018 -0500 summary: tests: port test-log to Python 3 https://www.mercurial-scm.org/repo/hg/rev/1d06407d0ee9 changeset: 36694:1d06407d0ee9 user:Augie Fackler date:Sun Mar 04 10:23:07 2018 -0500 summary: hghave: remove unused "as ex" in exception block https://www.mercurial-scm.org/repo/hg/rev/c442c4a92ae8 changeset: 36695:c442c4a92ae8 user:Augie Fackler date:Sun Mar 04 10:20:41 2018 -0500 summary: scmutil: fix oversight in b76248e51605c6 where I forgot to use msg https://www.mercurial-scm.org/repo/hg/rev/0c431d3129c4 changeset: 36696:0c431d3129c4 bookmark:@ tag: tip user:Kyle Lippincott date:Thu Feb 15 18:05:58 2018 -0800 summary: docs: small fixes for profiling.nested and the overall description -- 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
D2588: commit: adds multiline commit message support(issue5616)
yuja added inline comments. INLINE COMMENTS > pulkit wrote in fancyopts.py:365 > I think this is not the right place to have this hack. We should have this as > a part of `hg commit` code rather. Right. Alternatively, we could add a subclass of customopt, but I don't know which would be nicer. FWIW, I'm kinda -1 on this feature, but I have no strong opinion and Git is the current standard. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2588 To: sangeet259, #hg-reviewers Cc: yuja, pulkit, jeffpc, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2652: py3: make sure __repr__ returns a str
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because just r'' prefix REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2652 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -748,7 +748,7 @@ __str__ = encoding.strmethod(__bytes__) def __repr__(self): -return "<%s %s>" % (type(self).__name__, str(self)) +return r"<%s %s>" % (type(self).__name__, str(self)) def __hash__(self): try: 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
D2649: py3: use util.forcebytestr instead of str to convert error messages
pulkit created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2649 AFFECTED FILES mercurial/hg.py mercurial/repair.py mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1996,7 +1996,8 @@ try: return _zlibdecompress(data) except zlib.error as e: -raise RevlogError(_('revlog decompress error: %s') % str(e)) +raise RevlogError(_('revlog decompress error: %s') % + util.forcebytestr(e)) # '\0' is more common than 'u' so it goes first. elif t == '\0': return data diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -235,7 +235,7 @@ except OSError as e: if e.errno != errno.ENOENT: ui.warn(_('error removing %s: %s\n') % -(undovfs.join(undofile), str(e))) +(undovfs.join(undofile), util.forcebytestr(e))) except: # re-raises if backupfile: diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -269,7 +269,7 @@ # ValueError is raised on Windows if the drive letters differ on # each path raise error.Abort(_('cannot calculate relative path'), - hint=str(e)) + hint=util.forcebytestr(e)) else: requirements += 'shared\n' To: pulkit, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2650: py3: use bytes instead of str to make sure we use bytes internally
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/D2650 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 @@ -3782,7 +3782,7 @@ if fm.isplain(): hidepassword = util.hidepassword else: -hidepassword = str +hidepassword = bytes if ui.quiet: namefmt = '%s\n' else: 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
D2651: py3: make sure regular expressions are bytes
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because just b'' prefix REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2651 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -53,7 +53,7 @@ propertycache = util.propertycache -nonascii = re.compile(r'[^\x21-\x7f]').search +nonascii = re.compile(br'[^\x21-\x7f]').search class basectx(object): """A basectx object represents the common logic for its children: 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
D2648: py3: use pycompat.bytestr instead of str
pulkit created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2648 AFFECTED FILES mercurial/cmdutil.py mercurial/commands.py mercurial/context.py mercurial/debugcommands.py mercurial/dispatch.py mercurial/revlog.py mercurial/subrepo.py mercurial/wireproto.py CHANGE DETAILS diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py --- a/mercurial/wireproto.py +++ b/mercurial/wireproto.py @@ -1043,7 +1043,7 @@ util.stderr.write("(%s)\n" % exc.hint) return pushres(0, output.getvalue() if output else '') except error.PushRaced: -return pusherr(str(exc), +return pusherr(pycompat.bytestr(exc), output.getvalue() if output else '') bundler = bundle2.bundle20(repo.ui) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1123,7 +1123,7 @@ doc = xml.dom.minidom.parseString(output) paths = [] for e in doc.getElementsByTagName('entry'): -kind = str(e.getAttribute('kind')) +kind = pycompat.bytestr(e.getAttribute('kind')) if kind != 'file': continue name = ''.join(c.data for c diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -2467,7 +2467,7 @@ if populatecachedelta: dp = self.deltaparent(rev) if dp != nullrev: -cachedelta = (dp, str(self._chunk(rev))) +cachedelta = (dp, pycompat.bytestr(self._chunk(rev))) if not cachedelta: rawtext = self.revision(rev, raw=True) diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -990,7 +990,7 @@ if worst[0] is not None: name, testedwith, report = worst if not isinstance(testedwith, (bytes, str)): -testedwith = '.'.join([str(c) for c in testedwith]) +testedwith = '.'.join([pycompat.bytestr(c) for c in testedwith]) warning = (_('** Unknown exception encountered with ' 'possibly-broken third-party extension %s\n' '** which supports versions %s of Mercurial.\n' diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1811,7 +1811,7 @@ if keyinfo: key, old, new = keyinfo r = target.pushkey(namespace, key, old, new) -ui.status(str(r) + '\n') +ui.status(pycompat.bytestr(r) + '\n') return not r else: for k, v in sorted(target.listkeys(namespace).iteritems()): diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -433,7 +433,7 @@ self._rev = changeid return if not pycompat.ispy3 and isinstance(changeid, long): -changeid = str(changeid) +changeid = pycompat.bytestr(changeid) if changeid == 'null': self._node = nullid self._rev = nullrev diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1197,7 +1197,7 @@ bcompression, cgversion, params = exchange.parsebundlespec( repo, bundletype, strict=False) except error.UnsupportedBundleSpecification as e: -raise error.Abort(str(e), +raise error.Abort(pycompat.bytestr(e), hint=_("see 'hg help bundlespec' for supported " "values for --type")) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -362,7 +362,7 @@ ui.debug(fp.getvalue()) patch.internalpatch(ui, repo, fp, 1, eolmode=None) except error.PatchError as err: -raise error.Abort(str(err)) +raise error.Abort(pycompat.bytestr(err)) del fp # 4. We prepared working directory according to filtered @@ -1432,7 +1432,7 @@ files=files, eolmode=None, similarity=sim / 100.0) except error.PatchError as e: if not partial: -raise error.Abort(str(e)) +raise error.Abort(pycompat.bytestr(e)) if partial: rejects = True @@ -3043,7 +3043,7 @@ try: patch.internalpatch(repo.ui, repo, fp, 1, eolmode=None) except
Re: [PATCH] lock: block signal interrupt while making a lock file
> On Mar 4, 2018, at 11:48, Yuya Nishihara wrote: > > # HG changeset patch > # User Yuya Nishihara > # Date 1520138979 18000 > # Sat Mar 03 23:49:39 2018 -0500 > # Node ID 8ff5f6277e204df49b3426a144375db11b41b38d > # Parent dad68a609114750b5963a8e46563a0b73620156f > lock: block signal interrupt while making a lock file Seems okay, queued, thanks. pacem in terris / мир / शान्ति / سَلاَم / 平和 Kevin R. Bullock ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2596: state: raise ProgrammingError if an invalid key is being accessed
yuja added a comment. In https://phab.mercurial-scm.org/D2596#42678, @pulkit wrote: > In https://phab.mercurial-scm.org/D2596#42672, @durin42 wrote: > > > Hmm, really? Do any states have optional entries that would make this awkward? > > > Nope, but I wanted to be safe here raising a ProgrammingError instead of KeyError. I don't follow, but what if the state file was written by old hg client where some new keys were missing, and read by new client? Perhaps we'll have to support that scenario. INLINE COMMENTS > state.py:61 > +except KeyError: > +raise error.ProgrammingError(_("key '%s' not found in state" > + " file %s") % (key, self.path)) Nit: no need to make a ProgrammingError translatable. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2596 To: pulkit, #hg-reviewers Cc: yuja, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2653: py3: add b'' prefixes in tests/test-minirst.py
pulkit created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY 1. skip-blame because just b'' prefixes REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2653 AFFECTED FILES tests/test-minirst.py CHANGE DETAILS diff --git a/tests/test-minirst.py b/tests/test-minirst.py --- a/tests/test-minirst.py +++ b/tests/test-minirst.py @@ -28,18 +28,18 @@ debugformat(text, 30, **kwargs) debugformat(text, 'html', **kwargs) -paragraphs = """ +paragraphs = b""" This is some text in the first paragraph. A small indented paragraph. It is followed by some lines containing random whitespace. \n \n \nThe third and final paragraph. """ -debugformats('paragraphs', paragraphs) +debugformats(b'paragraphs', paragraphs) -definitions = """ +definitions = b""" A Term Definition. The indented lines make up the definition. @@ -52,9 +52,9 @@ Definition. """ -debugformats('definitions', definitions) +debugformats(b'definitions', definitions) -literals = r""" +literals = br""" The fully minimized form is the most convenient form:: @@ -76,9 +76,9 @@ with '::' disappears in the final output. """ -debugformats('literals', literals) +debugformats(b'literals', literals) -lists = """ +lists = b""" - This is the first list item. Second paragraph in the first list item. @@ -127,9 +127,9 @@ * This is the third bullet """ -debugformats('lists', lists) +debugformats(b'lists', lists) -options = """ +options = b""" There is support for simple option lists, but only with long options: @@ -153,9 +153,9 @@ --foo bar baz """ -debugformats('options', options) +debugformats(b'options', options) -fields = """ +fields = b""" :a: First item. :ab: Second item. Indentation and wrapping is handled automatically. @@ -166,9 +166,9 @@ :much too large: This key is big enough to get its own line. """ -debugformats('fields', fields) +debugformats(b'fields', fields) -containers = """ +containers = b""" Normal output. .. container:: debug @@ -184,17 +184,17 @@ Debug output. """ -debugformats('containers (normal)', containers) -debugformats('containers (verbose)', containers, keep=['verbose']) -debugformats('containers (debug)', containers, keep=['debug']) -debugformats('containers (verbose debug)', containers, +debugformats(b'containers (normal)', containers) +debugformats(b'containers (verbose)', containers, keep=['verbose']) +debugformats(b'containers (debug)', containers, keep=['debug']) +debugformats(b'containers (verbose debug)', containers, keep=['verbose', 'debug']) -roles = """Please see :hg:`add`.""" -debugformats('roles', roles) +roles = b"""Please see :hg:`add`.""" +debugformats(b'roles', roles) -sections = """ +sections = b""" Title = @@ -207,10 +207,10 @@ Markup: ``foo`` and :hg:`help` -- """ -debugformats('sections', sections) +debugformats(b'sections', sections) -admonitions = """ +admonitions = b""" .. note:: This is a note @@ -225,9 +225,9 @@ This is danger """ -debugformats('admonitions', admonitions) +debugformats(b'admonitions', admonitions) -comments = """ +comments = b""" Some text. .. A comment @@ -241,27 +241,27 @@ Empty comment above """ -debugformats('comments', comments) +debugformats(b'comments', comments) -data = [['a', 'b', 'c'], - ['1', '2', '3'], - ['foo', 'bar', 'baz this list is very very very long man']] +data = [[b'a', b'b', b'c'], + [b'1', b'2', b'3'], + [b'foo', b'bar', b'baz this list is very very very long man']] rst = minirst.maketable(data, 2, True) -table = ''.join(rst) +table = b''.join(rst) print(table) -debugformats('table', table) +debugformats(b'table', table) -data = [['s', 'long', 'line\ngoes on here'], -['', 'xy', 'tried to fix here\nby indenting']] +data = [[b's', b'long', b'line\ngoes on here'], +[b'', b'xy', b'tried to fix here\nby indenting']] rst = minirst.maketable(data, 1, False) -table = ''.join(rst) +table = b''.join(rst) print(table) -debugformats('table+nl', table) +debugformats(b'table+nl', table) 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
D2649: py3: use util.forcebytestr instead of str to convert error messages
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf659a407e5ee: py3: use util.forcebytestr instead of str to convert error messages (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2649?vs=6563&id=6568 REVISION DETAIL https://phab.mercurial-scm.org/D2649 AFFECTED FILES mercurial/hg.py mercurial/repair.py mercurial/revlog.py CHANGE DETAILS diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -1996,7 +1996,8 @@ try: return _zlibdecompress(data) except zlib.error as e: -raise RevlogError(_('revlog decompress error: %s') % str(e)) +raise RevlogError(_('revlog decompress error: %s') % + util.forcebytestr(e)) # '\0' is more common than 'u' so it goes first. elif t == '\0': return data diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -235,7 +235,7 @@ except OSError as e: if e.errno != errno.ENOENT: ui.warn(_('error removing %s: %s\n') % -(undovfs.join(undofile), str(e))) +(undovfs.join(undofile), util.forcebytestr(e))) except: # re-raises if backupfile: diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -269,7 +269,7 @@ # ValueError is raised on Windows if the drive letters differ on # each path raise error.Abort(_('cannot calculate relative path'), - hint=str(e)) + hint=util.forcebytestr(e)) else: requirements += 'shared\n' To: pulkit, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2651: py3: make sure regular expressions are bytes
This revision was automatically updated to reflect the committed changes. Closed by commit rHG470df8c5b781: py3: make sure regular expressions are bytes (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2651?vs=6565&id=6570 REVISION DETAIL https://phab.mercurial-scm.org/D2651 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -53,7 +53,7 @@ propertycache = util.propertycache -nonascii = re.compile(r'[^\x21-\x7f]').search +nonascii = re.compile(br'[^\x21-\x7f]').search class basectx(object): """A basectx object represents the common logic for its children: 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
D2650: py3: use bytes instead of str to make sure we use bytes internally
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7dc1a21d57cc: py3: use bytes instead of str to make sure we use bytes internally (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2650?vs=6564&id=6569 REVISION DETAIL https://phab.mercurial-scm.org/D2650 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 @@ -3782,7 +3782,7 @@ if fm.isplain(): hidepassword = util.hidepassword else: -hidepassword = str +hidepassword = bytes if ui.quiet: namefmt = '%s\n' else: 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
D2652: py3: make sure __repr__ returns a str
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc6901665cd5b: py3: make sure __repr__ returns a str (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2652?vs=6566&id=6571 REVISION DETAIL https://phab.mercurial-scm.org/D2652 AFFECTED FILES mercurial/context.py CHANGE DETAILS diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -748,7 +748,7 @@ __str__ = encoding.strmethod(__bytes__) def __repr__(self): -return "<%s %s>" % (type(self).__name__, str(self)) +return r"<%s %s>" % (type(self).__name__, str(self)) def __hash__(self): try: 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
D2648: py3: use pycompat.bytestr instead of str
yuja requested changes to this revision. yuja added inline comments. This revision now requires changes to proceed. INLINE COMMENTS > context.py:436 > if not pycompat.ispy3 and isinstance(changeid, long): > -changeid = str(changeid) > +changeid = pycompat.bytestr(changeid) > if changeid == 'null': Nit: could be %d. > dispatch.py:993 > if not isinstance(testedwith, (bytes, str)): > -testedwith = '.'.join([str(c) for c in testedwith]) > +testedwith = '.'.join([pycompat.bytestr(c) for c in testedwith]) > warning = (_('** Unknown exception encountered with ' Better to use forcebytestr() here because we are blaming a bad extension which may put anything into `testedwith`. > revlog.py:2470 > if dp != nullrev: > -cachedelta = (dp, str(self._chunk(rev))) > +cachedelta = (dp, pycompat.bytestr(self._chunk(rev))) > Perhaps bytes() is more appropriate here. I think this is just making a sort of bytes immutable. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2648 To: pulkit, indygreg, #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
D2653: py3: add b'' prefixes in tests/test-minirst.py
This revision was automatically updated to reflect the committed changes. Closed by commit rHG87b8fc4533ca: py3: add b'' prefixes in tests/test-minirst.py (authored by pulkit, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2653?vs=6567&id=6572 REVISION DETAIL https://phab.mercurial-scm.org/D2653 AFFECTED FILES tests/test-minirst.py CHANGE DETAILS diff --git a/tests/test-minirst.py b/tests/test-minirst.py --- a/tests/test-minirst.py +++ b/tests/test-minirst.py @@ -28,18 +28,18 @@ debugformat(text, 30, **kwargs) debugformat(text, 'html', **kwargs) -paragraphs = """ +paragraphs = b""" This is some text in the first paragraph. A small indented paragraph. It is followed by some lines containing random whitespace. \n \n \nThe third and final paragraph. """ -debugformats('paragraphs', paragraphs) +debugformats(b'paragraphs', paragraphs) -definitions = """ +definitions = b""" A Term Definition. The indented lines make up the definition. @@ -52,9 +52,9 @@ Definition. """ -debugformats('definitions', definitions) +debugformats(b'definitions', definitions) -literals = r""" +literals = br""" The fully minimized form is the most convenient form:: @@ -76,9 +76,9 @@ with '::' disappears in the final output. """ -debugformats('literals', literals) +debugformats(b'literals', literals) -lists = """ +lists = b""" - This is the first list item. Second paragraph in the first list item. @@ -127,9 +127,9 @@ * This is the third bullet """ -debugformats('lists', lists) +debugformats(b'lists', lists) -options = """ +options = b""" There is support for simple option lists, but only with long options: @@ -153,9 +153,9 @@ --foo bar baz """ -debugformats('options', options) +debugformats(b'options', options) -fields = """ +fields = b""" :a: First item. :ab: Second item. Indentation and wrapping is handled automatically. @@ -166,9 +166,9 @@ :much too large: This key is big enough to get its own line. """ -debugformats('fields', fields) +debugformats(b'fields', fields) -containers = """ +containers = b""" Normal output. .. container:: debug @@ -184,17 +184,17 @@ Debug output. """ -debugformats('containers (normal)', containers) -debugformats('containers (verbose)', containers, keep=['verbose']) -debugformats('containers (debug)', containers, keep=['debug']) -debugformats('containers (verbose debug)', containers, +debugformats(b'containers (normal)', containers) +debugformats(b'containers (verbose)', containers, keep=['verbose']) +debugformats(b'containers (debug)', containers, keep=['debug']) +debugformats(b'containers (verbose debug)', containers, keep=['verbose', 'debug']) -roles = """Please see :hg:`add`.""" -debugformats('roles', roles) +roles = b"""Please see :hg:`add`.""" +debugformats(b'roles', roles) -sections = """ +sections = b""" Title = @@ -207,10 +207,10 @@ Markup: ``foo`` and :hg:`help` -- """ -debugformats('sections', sections) +debugformats(b'sections', sections) -admonitions = """ +admonitions = b""" .. note:: This is a note @@ -225,9 +225,9 @@ This is danger """ -debugformats('admonitions', admonitions) +debugformats(b'admonitions', admonitions) -comments = """ +comments = b""" Some text. .. A comment @@ -241,27 +241,27 @@ Empty comment above """ -debugformats('comments', comments) +debugformats(b'comments', comments) -data = [['a', 'b', 'c'], - ['1', '2', '3'], - ['foo', 'bar', 'baz this list is very very very long man']] +data = [[b'a', b'b', b'c'], + [b'1', b'2', b'3'], + [b'foo', b'bar', b'baz this list is very very very long man']] rst = minirst.maketable(data, 2, True) -table = ''.join(rst) +table = b''.join(rst) print(table) -debugformats('table', table) +debugformats(b'table', table) -data = [['s', 'long', 'line\ngoes on here'], -['', 'xy', 'tried to fix here\nby indenting']] +data = [[b's', b'long', b'line\ngoes on here'], +[b'', b'xy', b'tried to fix here\nby indenting']] rst = minirst.maketable(data, 1, False) -table = ''.join(rst) +table = b''.join(rst) print(table) -debugformats('table+nl', table) +debugformats(b'table+nl', table) 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
D2658: webutil: some %d instead of %s love on ints
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/D2658 AFFECTED FILES mercurial/hgweb/webutil.py CHANGE DETAILS diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -516,16 +516,18 @@ '''Generator function that provides side-by-side comparison data.''' def compline(type, leftlineno, leftline, rightlineno, rightline): -lineid = leftlineno and ("l%s" % leftlineno) or '' -lineid += rightlineno and ("r%s" % rightlineno) or '' +lineid = leftlineno and ("l%d" % leftlineno) or '' +lineid += rightlineno and ("r%d" % rightlineno) or '' +llno = '%d' % leftlineno if leftlineno else '' +rlno = '%d' % rightlineno if rightlineno else '' return tmpl('comparisonline', type=type, lineid=lineid, leftlineno=leftlineno, -leftlinenumber="% 6s" % (leftlineno or ''), +leftlinenumber="% 6s" % llno, leftline=leftline or '', rightlineno=rightlineno, -rightlinenumber="% 6s" % (rightlineno or ''), +rightlinenumber="% 6s" % rlno, rightline=rightline or '') def getblock(opcodes): 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
D2657: py3: whitelist three more cases
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/D2657 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 @@ -6,6 +6,7 @@ test-ancestor.py test-annotate.py test-annotate.t +test-archive-symlinks.t test-atomictempfile.py test-audit-path.t test-audit-subrepo.t @@ -88,6 +89,7 @@ test-encoding.t test-eol-add.t test-eol-clone.t +test-eol-hook.t test-eol-tag.t test-eol-update.t test-excessive-merge.t @@ -332,6 +334,7 @@ test-revset-dirstate-parents.t test-revset-outgoing.t test-run-tests.py +test-schemes.t test-serve.t test-share.t test-show-stack.t 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
D2659: templater: show repr of string we're rejecting
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I feel like this should make it a little easier to hunt down problems. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2659 AFFECTED FILES mercurial/templater.py CHANGE DETAILS diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -1326,7 +1326,7 @@ # We can only hit this on Python 3, and it's here to guard # against infinite recursion. raise error.ProgrammingError('Mercurial IO including templates is done' - ' with bytes, not strings') + ' with bytes, not strings, got %r' % thing) elif thing is None: pass elif not util.safehasattr(thing, '__iter__'): 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
D2656: archival: our filenames are bytes, not strs
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/D2656 AFFECTED FILES mercurial/archival.py CHANGE DETAILS diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -168,7 +168,7 @@ return tarfile.open( name, pycompat.sysstr(mode + kind), fileobj) -if isinstance(dest, str): +if isinstance(dest, bytes): self.z = taropen('w:', name=dest) else: self.z = taropen('w|', fileobj=dest) @@ -217,7 +217,7 @@ or compressed with deflate.''' def __init__(self, dest, mtime, compress=True): -if not isinstance(dest, str): +if not isinstance(dest, bytes): try: dest.tell() except (AttributeError, IOError): 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
D2661: hgweb: fix up trailing slash detection on Python 3
durin42 created this revision. Herald added a reviewer: pulkit. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Fixes a couple of hgweb tests. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2661 AFFECTED FILES contrib/python3-whitelist mercurial/hgweb/webcommands.py mercurial/hgweb/webutil.py CHANGE DETAILS diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -38,9 +38,9 @@ ) def up(p): -if p[0] != "/": +if p[0:1] != "/": p = "/" + p -if p[-1] == "/": +if p[-1:] == "/": p = p[:-1] up = os.path.dirname(p) if up == "/": diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -495,7 +495,7 @@ dirs = {} parity = paritygen(web.stripecount) -if path and path[-1] != "/": +if path and path[-1:] != "/": path += "/" l = len(path) abspath = "/" + path diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -130,6 +130,8 @@ test-hghave.t test-hgignore.t test-hgk.t +test-hgweb-bundle.t +test-hgweb-descend-empties.t test-hgweb-removed.t test-histedit-arguments.t test-histedit-base.t 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
D2660: hgweb: convert req.form to bytes for all keys and values
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY This is just going to be a lot cleaner for our internals. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2660 AFFECTED FILES mercurial/hgweb/hgweb_mod.py mercurial/hgweb/request.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -159,10 +159,10 @@ # HTTP version 1 wire protocol requests are denoted by a "cmd" query # string parameter. If it isn't present, this isn't a wire protocol # request. -if r'cmd' not in req.form: +if 'cmd' not in req.form: return None -cmd = pycompat.sysbytes(req.form[r'cmd'][0]) +cmd = req.form['cmd'][0] # The "cmd" request parameter is used by both the wire protocol and hgweb. # While not all wire protocol commands are available for all transports, diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -48,9 +48,11 @@ form[name] = value del form[k] # And strip the values +bytesform = {} for k, v in form.iteritems(): -form[k] = [i.strip() for i in v] -return form +bytesform[pycompat.bytesurl(k)] = [ +pycompat.bytesurl(i.strip()) for i in v] +return bytesform class wsgirequest(object): """Higher-level API for a WSGI request. diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -377,16 +377,16 @@ # translate user-visible url structure to internal structure args = query.split('/', 2) -if r'cmd' not in req.form and args and args[0]: +if 'cmd' not in req.form and args and args[0]: cmd = args.pop(0) style = cmd.rfind('-') if style != -1: req.form['style'] = [cmd[:style]] cmd = cmd[style + 1:] # avoid accepting e.g. style parameter as command if util.safehasattr(webcommands, cmd): -req.form[r'cmd'] = [cmd] +req.form['cmd'] = [cmd] if cmd == 'static': req.form['file'] = ['/'.join(args)] @@ -409,7 +409,7 @@ req.form['node'] = [fn[:-len(ext)]] req.form['type'] = [type_] else: -cmd = pycompat.sysbytes(req.form.get(r'cmd', [r''])[0]) +cmd = req.form.get('cmd', [''])[0] # process the web interface request @@ -423,17 +423,17 @@ self.check_perm(rctx, req, None) if cmd == '': -req.form[r'cmd'] = [tmpl.cache['default']] -cmd = req.form[r'cmd'][0] +req.form['cmd'] = [tmpl.cache['default']] +cmd = req.form['cmd'][0] # Don't enable caching if using a CSP nonce because then it wouldn't # be a nonce. if rctx.configbool('web', 'cache') and not rctx.nonce: caching(self, req) # sets ETag header or raises NOT_MODIFIED if cmd not in webcommands.__all__: msg = 'no such method: %s' % cmd raise ErrorResponse(HTTP_BAD_REQUEST, msg) -elif cmd == 'file' and r'raw' in req.form.get(r'style', []): +elif cmd == 'file' and 'raw' in req.form.get('style', []): rctx.ctype = ctype content = webcommands.rawfile(rctx, req, tmpl) else: 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
D2654: archival: fsdecode paths before passing to tar or zip objects
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Both of these traffic in unicodes for filenames on Python 3, and inspection of the tarfile module shows that it uses the filesystem encoding, so fsdecode is the right choice. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2654 AFFECTED FILES mercurial/archival.py CHANGE DETAILS diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -21,6 +21,7 @@ error, formatter, match as matchmod, +pycompat, scmutil, util, vfs as vfsmod, @@ -171,13 +172,14 @@ self.z = taropen('w|', fileobj=dest) def addfile(self, name, mode, islink, data): +name = pycompat.fsdecode(name) i = tarfile.TarInfo(name) i.mtime = self.mtime i.size = len(data) if islink: i.type = tarfile.SYMTYPE i.mode = 0o777 -i.linkname = data +i.linkname = pycompat.fsdecode(data) data = None i.size = 0 else: @@ -218,7 +220,7 @@ dest.tell() except (AttributeError, IOError): dest = tellable(dest) -self.z = zipfile.ZipFile(dest, r'w', +self.z = zipfile.ZipFile(pycompat.fsdecode(dest), r'w', compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED) @@ -232,7 +234,7 @@ self.date_time = time.gmtime(mtime)[:6] def addfile(self, name, mode, islink, data): -i = zipfile.ZipInfo(name, self.date_time) +i = zipfile.ZipInfo(pycompat.fsdecode(name), self.date_time) i.compress_type = self.z.compression # unzip will not honor unix file modes unless file creator is # set to unix (id 3). 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
D2655: archival: tar file modes need to be sysstrs
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/D2655 AFFECTED FILES mercurial/archival.py CHANGE DETAILS diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -162,9 +162,11 @@ zlib.Z_BEST_COMPRESSION, fileobj, timestamp=mtime) self.fileobj = gzfileobj -return tarfile.TarFile.taropen(name, mode, gzfileobj) +return tarfile.TarFile.taropen( +name, pycompat.sysstr(mode), gzfileobj) else: -return tarfile.open(name, mode + kind, fileobj) +return tarfile.open( +name, pycompat.sysstr(mode + kind), fileobj) if isinstance(dest, str): self.z = taropen('w:', name=dest) 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
D2662: hghave: do not assign "ex" to a variable (pyflakes)
spectral 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/D2662 AFFECTED FILES tests/hghave.py CHANGE DETAILS diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -715,5 +715,5 @@ from mercurial import policy bdiff = policy.importmod('bdiff') return bdiff.xdiffblocks('', '') == [(0, 0, 0, 0)] -except (ImportError, AttributeError) as ex: -return False +except (ImportError, AttributeError): +return False To: spectral, #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] test-annotate: rewrite sed with some python
# HG changeset patch # User Yuya Nishihara # Date 1520187545 18000 # Sun Mar 04 13:19:05 2018 -0500 # Branch stable # Node ID 0c042b499ba989d193783a5cd64cca866ce01ae8 # Parent b394778b1a5042ca5799f5bae43620dd3324c797 test-annotate: rewrite sed with some python I hope this will fix the test failure seen on FreeBSD and Windows. diff --git a/tests/test-annotate.t b/tests/test-annotate.t --- a/tests/test-annotate.t +++ b/tests/test-annotate.t @@ -901,9 +901,12 @@ Annotate with orphaned CR (issue5798) $ hg init repo-cr $ cd repo-cr - $ substcr() { - > sed 's/\r/[CR]/g' - > } + $ cat <<'EOF' >> "$TESTTMP/substcr.py" + > import sys + > stdin = getattr(sys.stdin, 'buffer', sys.stdin) + > stdout = getattr(sys.stdout, 'buffer', sys.stdout) + > stdout.write(stdin.read().replace(b'\r', b'[CR]')) + > EOF >>> with open('a', 'wb') as f: ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') @@ -912,13 +915,13 @@ Annotate with orphaned CR (issue5798) ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') $ hg ci -m1 - $ hg annotate -r0 a | substcr + $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py" 0: 0a[CR]0b[CR] 0: 0c[CR]0d[CR] 0: 0e 0: 0f 0: 0g - $ hg annotate -r1 a | substcr + $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py" 0: 0a[CR]0b[CR] 1: 1c[CR]1d[CR] 0: 0e ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2662: hghave: do not assign "ex" to a variable (pyflakes)
pulkit added subscribers: durin42, pulkit. pulkit added a comment. @durin42 already did this as https://phab.mercurial-scm.org/D2637. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2662 To: spectral, #hg-reviewers Cc: pulkit, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH STABLE] test-annotate: rewrite sed with some python
> On Mar 4, 2018, at 13:24, Yuya Nishihara wrote: > > # HG changeset patch > # User Yuya Nishihara > # Date 1520187545 18000 > # Sun Mar 04 13:19:05 2018 -0500 > # Branch stable > # Node ID 0c042b499ba989d193783a5cd64cca866ce01ae8 > # Parent b394778b1a5042ca5799f5bae43620dd3324c797 > test-annotate: rewrite sed with some python queued, thanks > > I hope this will fix the test failure seen on FreeBSD and Windows. > > diff --git a/tests/test-annotate.t b/tests/test-annotate.t > --- a/tests/test-annotate.t > +++ b/tests/test-annotate.t > @@ -901,9 +901,12 @@ Annotate with orphaned CR (issue5798) > $ hg init repo-cr > $ cd repo-cr > > - $ substcr() { > - > sed 's/\r/[CR]/g' > - > } > + $ cat <<'EOF' >> "$TESTTMP/substcr.py" > + > import sys > + > stdin = getattr(sys.stdin, 'buffer', sys.stdin) > + > stdout = getattr(sys.stdout, 'buffer', sys.stdout) > + > stdout.write(stdin.read().replace(b'\r', b'[CR]')) > + > EOF > with open('a', 'wb') as f: > ... f.write(b'0a\r0b\r\n0c\r0d\r\n0e\n0f\n0g') > @@ -912,13 +915,13 @@ Annotate with orphaned CR (issue5798) > ... f.write(b'0a\r0b\r\n1c\r1d\r\n0e\n1f\n0g') > $ hg ci -m1 > > - $ hg annotate -r0 a | substcr > + $ hg annotate -r0 a | $PYTHON "$TESTTMP/substcr.py" > 0: 0a[CR]0b[CR] > 0: 0c[CR]0d[CR] > 0: 0e > 0: 0f > 0: 0g > - $ hg annotate -r1 a | substcr > + $ hg annotate -r1 a | $PYTHON "$TESTTMP/substcr.py" > 0: 0a[CR]0b[CR] > 1: 1c[CR]1d[CR] > 0: 0e > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2255: releasenotes: replace abort with warning while parsing
rishabhmadan96 added a comment. I totally forgot about this. I'll send them right away. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2255 To: rishabhmadan96, #hg-reviewers Cc: durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2654: archival: fsdecode paths before passing to tar or zip objects
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbfe23afea361: archival: fsdecode paths before passing to tar or zip objects (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2654?vs=6573&id=6582 REVISION DETAIL https://phab.mercurial-scm.org/D2654 AFFECTED FILES mercurial/archival.py CHANGE DETAILS diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -21,6 +21,7 @@ error, formatter, match as matchmod, +pycompat, scmutil, util, vfs as vfsmod, @@ -171,13 +172,14 @@ self.z = taropen('w|', fileobj=dest) def addfile(self, name, mode, islink, data): +name = pycompat.fsdecode(name) i = tarfile.TarInfo(name) i.mtime = self.mtime i.size = len(data) if islink: i.type = tarfile.SYMTYPE i.mode = 0o777 -i.linkname = data +i.linkname = pycompat.fsdecode(data) data = None i.size = 0 else: @@ -218,7 +220,7 @@ dest.tell() except (AttributeError, IOError): dest = tellable(dest) -self.z = zipfile.ZipFile(dest, r'w', +self.z = zipfile.ZipFile(pycompat.fsdecode(dest), r'w', compress and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED) @@ -232,7 +234,7 @@ self.date_time = time.gmtime(mtime)[:6] def addfile(self, name, mode, islink, data): -i = zipfile.ZipInfo(name, self.date_time) +i = zipfile.ZipInfo(pycompat.fsdecode(name), self.date_time) i.compress_type = self.z.compression # unzip will not honor unix file modes unless file creator is # set to unix (id 3). To: durin42, #hg-reviewers, pulkit, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2655: archival: tar file modes need to be sysstrs
This revision was automatically updated to reflect the committed changes. Closed by commit rHGabf252a1c938: archival: tar file modes need to be sysstrs (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2655?vs=6574&id=6583 REVISION DETAIL https://phab.mercurial-scm.org/D2655 AFFECTED FILES mercurial/archival.py CHANGE DETAILS diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -162,9 +162,11 @@ zlib.Z_BEST_COMPRESSION, fileobj, timestamp=mtime) self.fileobj = gzfileobj -return tarfile.TarFile.taropen(name, mode, gzfileobj) +return tarfile.TarFile.taropen( +name, pycompat.sysstr(mode), gzfileobj) else: -return tarfile.open(name, mode + kind, fileobj) +return tarfile.open( +name, pycompat.sysstr(mode + kind), fileobj) if isinstance(dest, str): self.z = taropen('w:', name=dest) To: durin42, #hg-reviewers, pulkit, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] lock: block signal interrupt while making a lock file
On Sun, 04 Mar 2018 12:35:52 -0500, Kevin Bullock wrote: On Mar 4, 2018, at 11:48, Yuya Nishihara wrote: # HG changeset patch # User Yuya Nishihara # Date 1520138979 18000 # Sat Mar 03 23:49:39 2018 -0500 # Node ID 8ff5f6277e204df49b3426a144375db11b41b38d # Parent dad68a609114750b5963a8e46563a0b73620156f lock: block signal interrupt while making a lock file Seems okay, queued, thanks. Any chance of getting this on stable, so it can go into the next thg build? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2657: py3: whitelist three more cases
This revision was automatically updated to reflect the committed changes. Closed by commit rHGf3591e687202: py3: whitelist three more cases (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2657?vs=6576&id=6585 REVISION DETAIL https://phab.mercurial-scm.org/D2657 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 @@ -6,6 +6,7 @@ test-ancestor.py test-annotate.py test-annotate.t +test-archive-symlinks.t test-atomictempfile.py test-audit-path.t test-audit-subrepo.t @@ -88,6 +89,7 @@ test-encoding.t test-eol-add.t test-eol-clone.t +test-eol-hook.t test-eol-tag.t test-eol-update.t test-excessive-merge.t @@ -332,6 +334,7 @@ test-revset-dirstate-parents.t test-revset-outgoing.t test-run-tests.py +test-schemes.t test-serve.t test-share.t test-show-stack.t To: durin42, pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2660: hgweb: convert req.form to bytes for all keys and values
This revision was automatically updated to reflect the committed changes. Closed by commit rHG2442927cdd96: hgweb: convert req.form to bytes for all keys and values (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2660?vs=6579&id=6588 REVISION DETAIL https://phab.mercurial-scm.org/D2660 AFFECTED FILES mercurial/hgweb/hgweb_mod.py mercurial/hgweb/request.py mercurial/wireprotoserver.py CHANGE DETAILS diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -159,10 +159,10 @@ # HTTP version 1 wire protocol requests are denoted by a "cmd" query # string parameter. If it isn't present, this isn't a wire protocol # request. -if r'cmd' not in req.form: +if 'cmd' not in req.form: return None -cmd = pycompat.sysbytes(req.form[r'cmd'][0]) +cmd = req.form['cmd'][0] # The "cmd" request parameter is used by both the wire protocol and hgweb. # While not all wire protocol commands are available for all transports, diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -48,9 +48,11 @@ form[name] = value del form[k] # And strip the values +bytesform = {} for k, v in form.iteritems(): -form[k] = [i.strip() for i in v] -return form +bytesform[pycompat.bytesurl(k)] = [ +pycompat.bytesurl(i.strip()) for i in v] +return bytesform class wsgirequest(object): """Higher-level API for a WSGI request. diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -377,16 +377,16 @@ # translate user-visible url structure to internal structure args = query.split('/', 2) -if r'cmd' not in req.form and args and args[0]: +if 'cmd' not in req.form and args and args[0]: cmd = args.pop(0) style = cmd.rfind('-') if style != -1: req.form['style'] = [cmd[:style]] cmd = cmd[style + 1:] # avoid accepting e.g. style parameter as command if util.safehasattr(webcommands, cmd): -req.form[r'cmd'] = [cmd] +req.form['cmd'] = [cmd] if cmd == 'static': req.form['file'] = ['/'.join(args)] @@ -409,7 +409,7 @@ req.form['node'] = [fn[:-len(ext)]] req.form['type'] = [type_] else: -cmd = pycompat.sysbytes(req.form.get(r'cmd', [r''])[0]) +cmd = req.form.get('cmd', [''])[0] # process the web interface request @@ -423,17 +423,17 @@ self.check_perm(rctx, req, None) if cmd == '': -req.form[r'cmd'] = [tmpl.cache['default']] -cmd = req.form[r'cmd'][0] +req.form['cmd'] = [tmpl.cache['default']] +cmd = req.form['cmd'][0] # Don't enable caching if using a CSP nonce because then it wouldn't # be a nonce. if rctx.configbool('web', 'cache') and not rctx.nonce: caching(self, req) # sets ETag header or raises NOT_MODIFIED if cmd not in webcommands.__all__: msg = 'no such method: %s' % cmd raise ErrorResponse(HTTP_BAD_REQUEST, msg) -elif cmd == 'file' and r'raw' in req.form.get(r'style', []): +elif cmd == 'file' and 'raw' in req.form.get('style', []): rctx.ctype = ctype content = webcommands.rawfile(rctx, req, tmpl) else: To: durin42, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2661: hgweb: fix up trailing slash detection on Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHG250f3168d907: hgweb: fix up trailing slash detection on Python 3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2661?vs=6580&id=6589 REVISION DETAIL https://phab.mercurial-scm.org/D2661 AFFECTED FILES contrib/python3-whitelist mercurial/hgweb/webcommands.py mercurial/hgweb/webutil.py CHANGE DETAILS diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -38,9 +38,9 @@ ) def up(p): -if p[0] != "/": +if p[0:1] != "/": p = "/" + p -if p[-1] == "/": +if p[-1:] == "/": p = p[:-1] up = os.path.dirname(p) if up == "/": diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -495,7 +495,7 @@ dirs = {} parity = paritygen(web.stripecount) -if path and path[-1] != "/": +if path and path[-1:] != "/": path += "/" l = len(path) abspath = "/" + path diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -130,6 +130,8 @@ test-hghave.t test-hgignore.t test-hgk.t +test-hgweb-bundle.t +test-hgweb-descend-empties.t test-hgweb-removed.t test-histedit-arguments.t test-histedit-base.t To: durin42, pulkit, #hg-reviewers, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2659: templater: show repr of string we're rejecting
This revision was automatically updated to reflect the committed changes. Closed by commit rHGe79adc12cde3: templater: show repr of string we're rejecting (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2659?vs=6578&id=6587 REVISION DETAIL https://phab.mercurial-scm.org/D2659 AFFECTED FILES mercurial/templater.py CHANGE DETAILS diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -1326,7 +1326,7 @@ # We can only hit this on Python 3, and it's here to guard # against infinite recursion. raise error.ProgrammingError('Mercurial IO including templates is done' - ' with bytes, not strings') + ' with bytes, not strings, got %r' % thing) elif thing is None: pass elif not util.safehasattr(thing, '__iter__'): To: durin42, #hg-reviewers, pulkit, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2656: archival: our filenames are bytes, not strs
This revision was automatically updated to reflect the committed changes. Closed by commit rHG7f9a6f5f7612: archival: our filenames are bytes, not strs (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2656?vs=6575&id=6584 REVISION DETAIL https://phab.mercurial-scm.org/D2656 AFFECTED FILES mercurial/archival.py CHANGE DETAILS diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -168,7 +168,7 @@ return tarfile.open( name, pycompat.sysstr(mode + kind), fileobj) -if isinstance(dest, str): +if isinstance(dest, bytes): self.z = taropen('w:', name=dest) else: self.z = taropen('w|', fileobj=dest) @@ -217,7 +217,7 @@ or compressed with deflate.''' def __init__(self, dest, mtime, compress=True): -if not isinstance(dest, str): +if not isinstance(dest, bytes): try: dest.tell() except (AttributeError, IOError): To: durin42, #hg-reviewers, pulkit, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2658: webutil: some %d instead of %s love on ints
This revision was automatically updated to reflect the committed changes. Closed by commit rHGa2fa51415ddc: webutil: some %d instead of %s love on ints (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2658?vs=6577&id=6586 REVISION DETAIL https://phab.mercurial-scm.org/D2658 AFFECTED FILES mercurial/hgweb/webutil.py CHANGE DETAILS diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -516,16 +516,18 @@ '''Generator function that provides side-by-side comparison data.''' def compline(type, leftlineno, leftline, rightlineno, rightline): -lineid = leftlineno and ("l%s" % leftlineno) or '' -lineid += rightlineno and ("r%s" % rightlineno) or '' +lineid = leftlineno and ("l%d" % leftlineno) or '' +lineid += rightlineno and ("r%d" % rightlineno) or '' +llno = '%d' % leftlineno if leftlineno else '' +rlno = '%d' % rightlineno if rightlineno else '' return tmpl('comparisonline', type=type, lineid=lineid, leftlineno=leftlineno, -leftlinenumber="% 6s" % (leftlineno or ''), +leftlinenumber="% 6s" % llno, leftline=leftline or '', rightlineno=rightlineno, -rightlinenumber="% 6s" % (rightlineno or ''), +rightlinenumber="% 6s" % rlno, rightline=rightline or '') def getblock(opcodes): To: durin42, #hg-reviewers, pulkit, indygreg Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2255: releasenotes: replace abort with warning while parsing (issue5775)
rishabhmadan96 updated this revision to Diff 6590. rishabhmadan96 edited the summary of this revision. rishabhmadan96 retitled this revision from "releasenotes: replace abort with warning while parsing" to "releasenotes: replace abort with warning while parsing (issue5775)". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2255?vs=5695&id=6590 REVISION DETAIL https://phab.mercurial-scm.org/D2255 AFFECTED FILES hgext/releasenotes.py tests/test-releasenotes-parsing.t CHANGE DETAILS diff --git a/tests/test-releasenotes-parsing.t b/tests/test-releasenotes-parsing.t --- a/tests/test-releasenotes-parsing.t +++ b/tests/test-releasenotes-parsing.t @@ -177,3 +177,26 @@ paragraph: Bullet item 1 bullet point: paragraph: Bullet item 2 + +Warn user in case of unexpected block while parsing + + $ hg init relnotes-warn + $ cd relnotes-warn + $ touch feature1 + $ hg -q commit -A -l - << EOF + > commit 1 + > + > .. feature:: + > + >new feature added. + > some words about the feature. + > EOF + + $ hg releasenote -r . + unexpected block in release notes directive feature + New Features + + + * new feature added. some words about the feature. + + $ cd .. diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -325,8 +325,8 @@ continue if pblock['type'] != 'paragraph': -raise error.Abort(_('unexpected block in release notes ' -'directive %s') % directive) +repo.ui.warn(_('unexpected block in release notes ' +'directive %s\n') % directive) if pblock['indent'] > 0: paragraphs.append(pblock['lines']) To: rishabhmadan96, #hg-reviewers Cc: durin42, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2253: releasenotes: mention changeset with warning and abort
rishabhmadan96 updated this revision to Diff 6591. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2253?vs=5693&id=6591 REVISION DETAIL https://phab.mercurial-scm.org/D2253 AFFECTED FILES hgext/releasenotes.py tests/test-releasenotes-parsing.t CHANGE DETAILS diff --git a/tests/test-releasenotes-parsing.t b/tests/test-releasenotes-parsing.t --- a/tests/test-releasenotes-parsing.t +++ b/tests/test-releasenotes-parsing.t @@ -193,7 +193,7 @@ > EOF $ hg releasenote -r . - unexpected block in release notes directive feature + changeset a4251905c440: unexpected block in release notes directive feature New Features diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -311,8 +311,8 @@ title = block['lines'][0].strip() if block['lines'] else None if i + 1 == len(blocks): -raise error.Abort(_('release notes directive %s lacks content') - % directive) +raise error.Abort(_('changeset %s: release notes directive %s ' +'lacks content') % (ctx, directive)) # Now search ahead and find all paragraphs attached to this # admonition. @@ -325,8 +325,8 @@ continue if pblock['type'] != 'paragraph': -repo.ui.warn(_('unexpected block in release notes ' -'directive %s\n') % directive) +repo.ui.warn(_('changeset %s: unexpected block in release ' +'notes directive %s\n') % (ctx, directive)) if pblock['indent'] > 0: paragraphs.append(pblock['lines']) To: rishabhmadan96, #hg-reviewers Cc: av6, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2254: releasenotes: allow notes for multiple directives in a single changeset
rishabhmadan96 updated this revision to Diff 6592. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2254?vs=5694&id=6592 REVISION DETAIL https://phab.mercurial-scm.org/D2254 AFFECTED FILES hgext/releasenotes.py tests/test-releasenotes-formatting.t CHANGE DETAILS diff --git a/tests/test-releasenotes-formatting.t b/tests/test-releasenotes-formatting.t --- a/tests/test-releasenotes-formatting.t +++ b/tests/test-releasenotes-formatting.t @@ -457,3 +457,35 @@ -- First paragraph of fix 1. + + $ cd .. + +Using multiple admonitions in same changeset + + $ hg init relnotes-multiadmon + $ cd relnotes-multiadmon + + $ touch file1 + $ hg -q commit -A -l - << EOF + > commit 1 + > + > .. feature:: + > + >Details about new feature. + > + > .. perf:: + > + >Improves the execution by 2x + > EOF + + $ hg releasenotes -r . $TESTTMP/relnotes-multiple-admonitions + $ cat $TESTTMP/relnotes-multiple-admonitions + New Features + + + * Details about new feature. + + Performance Improvements + + + * Improves the execution by 2x diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -324,6 +324,9 @@ if pblock['type'] == 'margin': continue +if pblock['type'] == 'admonition': +break + if pblock['type'] != 'paragraph': repo.ui.warn(_('changeset %s: unexpected block in release ' 'notes directive %s\n') % (ctx, directive)) To: rishabhmadan96, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] lock: block signal interrupt while making a lock file
On Sun, 04 Mar 2018 13:55:40 -0500, Matt Harbison wrote: > On Sun, 04 Mar 2018 12:35:52 -0500, Kevin Bullock > wrote: > > >> On Mar 4, 2018, at 11:48, Yuya Nishihara wrote: > >> > >> # HG changeset patch > >> # User Yuya Nishihara > >> # Date 1520138979 18000 > >> # Sat Mar 03 23:49:39 2018 -0500 > >> # Node ID 8ff5f6277e204df49b3426a144375db11b41b38d > >> # Parent dad68a609114750b5963a8e46563a0b73620156f > >> lock: block signal interrupt while making a lock file > > > > Seems okay, queued, thanks. > > Any chance of getting this on stable, so it can go into the next thg build? I thought about that, but this patch seemed a bit scary for pushing into stable. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel