mercurial@37101: 38 new changesets
38 new changesets in mercurial: https://www.mercurial-scm.org/repo/hg/rev/434e520adb8c changeset: 37064:434e520adb8c user:Yuya Nishiharadate:Mon Mar 12 20:45:10 2018 +0900 summary: annotate: do not construct attr.s object per line while computing history https://www.mercurial-scm.org/repo/hg/rev/b235bde38a83 changeset: 37065:b235bde38a83 user:Yuya Nishihara date:Tue Mar 13 22:18:06 2018 +0900 summary: annotate: drop linenumber flag from fctx.annotate() (API) https://www.mercurial-scm.org/repo/hg/rev/b33b91ca2ec2 changeset: 37066:b33b91ca2ec2 user:Yuya Nishihara date:Sun Mar 18 12:28:19 2018 +0900 summary: annotate: pack line content into annotateline object (API) https://www.mercurial-scm.org/repo/hg/rev/04aafcec00b9 changeset: 37067:04aafcec00b9 user:Yuya Nishihara date:Fri Mar 16 22:36:40 2018 +0900 summary: templater: add context.preload(t) to test if the specified template exists https://www.mercurial-scm.org/repo/hg/rev/aa97e06a1912 changeset: 37068:aa97e06a1912 user:Yuya Nishihara date:Fri Mar 16 22:47:15 2018 +0900 summary: templater: use template context to render old-style list template https://www.mercurial-scm.org/repo/hg/rev/724f2e21d870 changeset: 37069:724f2e21d870 user:Yuya Nishihara date:Fri Mar 16 23:01:51 2018 +0900 summary: templatekw: stop using _showlist() which is about to be deprecated https://www.mercurial-scm.org/repo/hg/rev/1101d6747d2d changeset: 37070:1101d6747d2d user:Yuya Nishihara date:Fri Mar 16 23:09:21 2018 +0900 summary: templater: drop 'templ' from resources dict https://www.mercurial-scm.org/repo/hg/rev/d3f7930a9563 changeset: 37071:d3f7930a9563 user:Yuya Nishihara date:Fri Mar 16 23:11:55 2018 +0900 summary: templatekw: mark _showlist() as deprecated (API) https://www.mercurial-scm.org/repo/hg/rev/d64ae4fef471 changeset: 37072:d64ae4fef471 user:Yuya Nishihara date:Thu Mar 15 20:27:38 2018 +0900 summary: log: do no expect templateresources() returning a dict https://www.mercurial-scm.org/repo/hg/rev/44757e6dad93 changeset: 37073:44757e6dad93 user:Yuya Nishihara date:Thu Mar 15 20:43:39 2018 +0900 summary: templater: introduce resourcemapper class https://www.mercurial-scm.org/repo/hg/rev/2891079fb0c0 changeset: 37074:2891079fb0c0 user:Yuya Nishihara date:Thu Mar 15 21:22:52 2018 +0900 summary: templater: factor out function to create mapping dict for nested evaluation https://www.mercurial-scm.org/repo/hg/rev/46859b437697 changeset: 37075:46859b437697 user:Yuya Nishihara date:Thu Mar 15 21:38:57 2018 +0900 summary: templater: drop symbols which should be overridden by new 'ctx' (issue5612) https://www.mercurial-scm.org/repo/hg/rev/66d478064d5f changeset: 37076:66d478064d5f user:Matt Harbison date:Wed Mar 21 22:36:26 2018 -0400 summary: test-strip-narrow: adjust bundle removal for Windows test stability https://www.mercurial-scm.org/repo/hg/rev/1e30a26a65d0 changeset: 37077:1e30a26a65d0 user:Kyle Lippincott date:Wed Mar 21 12:36:29 2018 -0700 summary: filemerge: make the 'local' path match the format that 'base' and 'other' use https://www.mercurial-scm.org/repo/hg/rev/b3079fea3838 changeset: 37078:b3079fea3838 user:Yuya Nishihara date:Thu Mar 22 21:10:42 2018 +0900 summary: util: add helper to define proxy functions to utils.* https://www.mercurial-scm.org/repo/hg/rev/736024df4498 changeset: 37079:736024df4498 user:Yuya Nishihara date:Thu Mar 22 21:13:31 2018 +0900 summary: util: mark MBTextWrapper as private https://www.mercurial-scm.org/repo/hg/rev/bad90b80b315 changeset: 37080:bad90b80b315 user:Yuya Nishihara date:Thu Mar 22 21:14:12 2018 +0900 summary: util: adjust indent level in wrap() https://www.mercurial-scm.org/repo/hg/rev/191cba70fe27 changeset: 37081:191cba70fe27 user:Yuya Nishihara date:Thu Mar 22 21:20:47 2018 +0900 summary: util: mark internal constants of escapedata() as private https://www.mercurial-scm.org/repo/hg/rev/1a1d1c44b570 changeset: 37082:1a1d1c44b570 user:Yuya Nishihara date:Thu Mar 22 21:32:19 2018 +0900 summary: util: remove unused private constant '_hextochr' https://www.mercurial-scm.org/repo/hg/rev/f99d64e8a4e4 changeset: 37083:f99d64e8a4e4 user:Yuya Nishihara date:Thu Mar 22 21:19:31 2018 +0900 summary: stringutil: move generic string helpers to new
bugzilla weekly report (2018-03-26)
Bug activity report, between 2018-03-19 and 2018-03-26 * urgent+: 3 bugs * unconfirmed: 21 bugs (2 added) * new: 2 bugs * closed: 4 bugs * need example: 0 bugs * new details: 0 bugs * active: 21 bugs * long inactive: 8 bugs urgent+ --- Open of urgent or critical bugs. Found 3 bugs with our query. id summary --- (#5748) Unknown exception during commit (#5801) pure-python manifest code produces corrupt unsorted manifests (#5811) fsmonitor returns bogus stat tuples, breaking after cleanup in f unconfirmed --- Bugs with status 'unconfirmed'. Found 21 bugs with our query (2 added). id summary --- (#5592) Obsolete markers for root changes are not exchanged (#5747) Rebase should detect patch that has already been applied. (#5753) Support for inline clone bundles when cloning via ssh (#5766) pull --rebase aborts if working dir not clean even if nothing to (#5772) hg fold doesn't move bookmarks (#5773) evolve extension should specify progress units (#5774) Very slow performance when running commands and fsmonitor instal (#5776) Disabled path conflict checking for unknown files behavior is di (#5785) hg up -C should always fail. (#5792) include bookmarks in bundle2 file generation (#5807) Convert throws "ValueError: I/O operation on closed file" (#5808) `hg next` and `hg prev` do not respect commands.update.check (#5810) warning about overridden commands when both evolve and serveronl (#5813) pull --rebase via hgnested's npull doesn't rebase correctly (#5814) 4.5.2: test hang on NetBSD (#5817) fold should respect experimental.evolve.allowdivergence (#5820) hg push fails with ValueError: 20-byte hash required (#5821) conflict between evolve and notify, cannot push hidden extension (#5823) hg evolve should return 0 status code when it doesn't find any p (#5825) histedit --no-backup feature request (#5826) after re-ordering removes a directory, histedit aborts and canno new --- Bugs opened during the reporting period. Found 2 bugs with our query. id summary --- (#5825) histedit --no-backup feature request (#5826) after re-ordering removes a directory, histedit aborts and canno closed -- Bugs closed during the reporting period. Found 4 bugs with our query. id summary --- (#5165) can't push long bookmark names with bundle2 (#5535) [request] an option like ui.traceback, but which doesn't print o (#5720) Interrupted evolve loses phase (#5805) Amend doesn't check for outstanding merge conflicts need example Bugs with 'need_example' status and at least a new comment. Found 0 bugs with our query. id summary --- new details --- Bugs moved out of 'need_example' during the reporting period. Found 0 bugs with our query. id summary --- active -- All bugs with any activity during the reporting period. Found 21 bugs with our query. id summary --- (#3332) Too few arguments to an alias causes a stacktrace (#3432) copy detection for add and addremove (#5165) can't push long bookmark names with bundle2 (#5422) rebase shows "nothing to rebase" even in cases where the rebases (#5449) Search for changesets by partial node ID (#5457) rebase could be smarter reading obs graph to avoid merge conflic (#5480) Manifest grows out of control in large repository with hundreds (#5535) [request] an option like ui.traceback, but which doesn't print o (#5550) During merge, the message when a file was deleted on one side bu (#5596) histedit should explain where it is on conflicts (#5631) Add no-commit mode to hg graft (#5712) hg status --rev shows modified file when it's been reverted to
Re: [PATCH 1 of 5] commandserver: rewrite protectio/restoreio to not depend on ui
On Sun, Mar 25, 2018 at 6:24 PM, Yuya Nishiharawrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1521945059 -32400 > # Sun Mar 25 11:30:59 2018 +0900 > # Node ID a32a2b99f0627a6acdee3e6e9ff5b677a1cac18d > # Parent 24ab3381bf159f386fec5c205076b67b4ae5a5f6 > commandserver: rewrite protectio/restoreio to not depend on ui Queued the first three patches. Many thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 5] procutil: redirect ui.fout to stderr while stdio is protected
# HG changeset patch # User Yuya Nishihara# Date 1521947733 -32400 # Sun Mar 25 12:15:33 2018 +0900 # Node ID 99a4d6e5ec271d80b05004827b9f7483ac2ae3cd # Parent 768b03c733d00da88fa99a698c0274ec5aa2cf5a procutil: redirect ui.fout to stderr while stdio is protected The new behavior seems slightly nicer as we can at least read the output. And this is similar to what the sshserver is doing, so we can probably reuse protectstdio() instead of the weird hook.redirect(True) hack. diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -213,25 +213,27 @@ def isstdout(f): return _testfileno(f, sys.__stdout__) def protectstdio(uin, uout): -"""Duplicate streams and redirect original to null if (uin, uout) are -stdio +"""Duplicate streams and redirect original if (uin, uout) are stdio + +If uin is stdin, it's redirected to /dev/null. If uout is stdout, it's +redirected to stderr so the output is still readable. Returns (fin, fout) which point to the original (uin, uout) fds, but may be copy of (uin, uout). The returned streams can be considered "owned" in that print(), exec(), etc. never reach to them. """ uout.flush() -nullfd = os.open(os.devnull, os.O_RDWR) fin, fout = uin, uout if uin is stdin: newfd = os.dup(uin.fileno()) +nullfd = os.open(os.devnull, os.O_RDONLY) os.dup2(nullfd, uin.fileno()) +os.close(nullfd) fin = os.fdopen(newfd, r'rb') if uout is stdout: newfd = os.dup(uout.fileno()) -os.dup2(nullfd, uout.fileno()) +os.dup2(stderr.fileno(), uout.fileno()) fout = os.fdopen(newfd, r'wb') -os.close(nullfd) return fin, fout def restorestdio(uin, uout, fin, fout): diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t --- a/tests/test-commandserver.t +++ b/tests/test-commandserver.t @@ -249,6 +249,8 @@ check that local configs for the cached ...input=stringio('some input')) *** runcommand --config hooks.pre-identify=python:hook.hook id eff892de26ec tip + hook talking + now try to read something: '' Clean hook cached version $ rm hook.py* @@ -619,7 +621,7 @@ changelog and manifest would have invali > @command(b"debugwritestdout", norepo=True) > def debugwritestdout(ui): > os.write(1, "low-level stdout fd and\n") - > sys.stdout.write("stdout should be redirected to /dev/null\n") + > sys.stdout.write("stdout should be redirected to stderr\n") > sys.stdout.flush() > EOF $ cat <> .hg/hgrc @@ -657,6 +659,8 @@ changelog and manifest would have invali *** runcommand debugreadstdin read: '' *** runcommand debugwritestdout + low-level stdout fd and + stdout should be redirected to stderr run commandserver in commandserver, which is silly but should work: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 5] procutil: unroll uin/uout loop in protectstdio()
# HG changeset patch # User Yuya Nishihara# Date 1521947238 -32400 # Sun Mar 25 12:07:18 2018 +0900 # Node ID 768b03c733d00da88fa99a698c0274ec5aa2cf5a # Parent a315bc2695f7faff23e71acea37d2c4a13961b14 procutil: unroll uin/uout loop in protectstdio() I'll change uout to be redirected to stderr. diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -221,17 +221,18 @@ def protectstdio(uin, uout): "owned" in that print(), exec(), etc. never reach to them. """ uout.flush() -newfiles = [] nullfd = os.open(os.devnull, os.O_RDWR) -for f, sysf, mode in [(uin, stdin, r'rb'), - (uout, stdout, r'wb')]: -if f is sysf: -newfd = os.dup(f.fileno()) -os.dup2(nullfd, f.fileno()) -f = os.fdopen(newfd, mode) -newfiles.append(f) +fin, fout = uin, uout +if uin is stdin: +newfd = os.dup(uin.fileno()) +os.dup2(nullfd, uin.fileno()) +fin = os.fdopen(newfd, r'rb') +if uout is stdout: +newfd = os.dup(uout.fileno()) +os.dup2(nullfd, uout.fileno()) +fout = os.fdopen(newfd, r'wb') os.close(nullfd) -return tuple(newfiles) +return fin, fout def restorestdio(uin, uout, fin, fout): """Restore (uin, uout) streams from possibly duplicated (fin, fout)""" ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 5] procutil: introduce context-manager interface for protect/restorestdio
# HG changeset patch # User Yuya Nishihara# Date 1521946685 -32400 # Sun Mar 25 11:58:05 2018 +0900 # Node ID a315bc2695f7faff23e71acea37d2c4a13961b14 # Parent d3c212ea1f34ecff5ae12beceea0f61c6302416f procutil: introduce context-manager interface for protect/restorestdio The code looks slightly cleaner since it was pretty easy to pass arguments in wrong order. diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -318,13 +318,12 @@ class pipeservice(object): ui = self.ui # redirect stdio to null device so that broken extensions or in-process # hooks will never cause corruption of channel protocol. -fin, fout = procutil.protectstdio(ui.fin, ui.fout) -try: -sv = server(ui, self.repo, fin, fout) -return sv.serve() -finally: -sv.cleanup() -procutil.restorestdio(ui.fin, ui.fout, fin, fout) +with procutil.protectedstdio(ui.fin, ui.fout) as (fin, fout): +try: +sv = server(ui, self.repo, fin, fout) +return sv.serve() +finally: +sv.cleanup() def _initworkerprocess(): # use a different process group from the master process, in order to: diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -9,6 +9,7 @@ from __future__ import absolute_import +import contextlib import imp import io import os @@ -240,6 +241,15 @@ def restorestdio(uin, uout, fin, fout): os.dup2(f.fileno(), uif.fileno()) f.close() +@contextlib.contextmanager +def protectedstdio(uin, uout): +"""Run code block with protected standard streams""" +fin, fout = protectstdio(uin, uout) +try: +yield fin, fout +finally: +restorestdio(uin, uout, fin, fout) + def shellenviron(environ=None): """return environ with optional override, useful for shelling out""" def py2shell(val): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 5] procutil: move protectio/restoreio from commandserver
# HG changeset patch # User Yuya Nishihara# Date 1521945630 -32400 # Sun Mar 25 11:40:30 2018 +0900 # Node ID d3c212ea1f34ecff5ae12beceea0f61c6302416f # Parent a32a2b99f0627a6acdee3e6e9ff5b677a1cac18d procutil: move protectio/restoreio from commandserver Some variants of this will be useful for stdio-based servers such as sshserver. diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -306,35 +306,6 @@ class server(object): return 0 -def _protectio(uin, uout): -"""Duplicate streams and redirect original to null if (uin, uout) are -stdio - -Returns (fin, fout) which point to the original (uin, uout) fds, but -may be copy of (uin, uout). The returned streams can be considered -"owned" in that print(), exec(), etc. never reach to them. -""" -uout.flush() -newfiles = [] -nullfd = os.open(os.devnull, os.O_RDWR) -for f, sysf, mode in [(uin, procutil.stdin, r'rb'), - (uout, procutil.stdout, r'wb')]: -if f is sysf: -newfd = os.dup(f.fileno()) -os.dup2(nullfd, f.fileno()) -f = os.fdopen(newfd, mode) -newfiles.append(f) -os.close(nullfd) -return tuple(newfiles) - -def _restoreio(uin, uout, fin, fout): -"""Restore (uin, uout) streams from possibly duplicated (fin, fout)""" -uout.flush() -for f, uif in [(fin, uin), (fout, uout)]: -if f is not uif: -os.dup2(f.fileno(), uif.fileno()) -f.close() - class pipeservice(object): def __init__(self, ui, repo, opts): self.ui = ui @@ -347,13 +318,13 @@ class pipeservice(object): ui = self.ui # redirect stdio to null device so that broken extensions or in-process # hooks will never cause corruption of channel protocol. -fin, fout = _protectio(ui.fin, ui.fout) +fin, fout = procutil.protectstdio(ui.fin, ui.fout) try: sv = server(ui, self.repo, fin, fout) return sv.serve() finally: sv.cleanup() -_restoreio(ui.fin, ui.fout, fin, fout) +procutil.restorestdio(ui.fin, ui.fout, fin, fout) def _initworkerprocess(): # use a different process group from the master process, in order to: diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -211,6 +211,35 @@ def isstdin(f): def isstdout(f): return _testfileno(f, sys.__stdout__) +def protectstdio(uin, uout): +"""Duplicate streams and redirect original to null if (uin, uout) are +stdio + +Returns (fin, fout) which point to the original (uin, uout) fds, but +may be copy of (uin, uout). The returned streams can be considered +"owned" in that print(), exec(), etc. never reach to them. +""" +uout.flush() +newfiles = [] +nullfd = os.open(os.devnull, os.O_RDWR) +for f, sysf, mode in [(uin, stdin, r'rb'), + (uout, stdout, r'wb')]: +if f is sysf: +newfd = os.dup(f.fileno()) +os.dup2(nullfd, f.fileno()) +f = os.fdopen(newfd, mode) +newfiles.append(f) +os.close(nullfd) +return tuple(newfiles) + +def restorestdio(uin, uout, fin, fout): +"""Restore (uin, uout) streams from possibly duplicated (fin, fout)""" +uout.flush() +for f, uif in [(fin, uin), (fout, uout)]: +if f is not uif: +os.dup2(f.fileno(), uif.fileno()) +f.close() + def shellenviron(environ=None): """return environ with optional override, useful for shelling out""" def py2shell(val): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 5] commandserver: rewrite protectio/restoreio to not depend on ui
# HG changeset patch # User Yuya Nishihara# Date 1521945059 -32400 # Sun Mar 25 11:30:59 2018 +0900 # Node ID a32a2b99f0627a6acdee3e6e9ff5b677a1cac18d # Parent 24ab3381bf159f386fec5c205076b67b4ae5a5f6 commandserver: rewrite protectio/restoreio to not depend on ui Prepares for porting to utils.procutil, in which ui shouldn't be known. ui.flush() is replaced with ui.fout.flush() since ui.ferr wasn't involved. diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -306,13 +306,19 @@ class server(object): return 0 -def _protectio(ui): -""" duplicates streams and redirect original to null if ui uses stdio """ -ui.flush() +def _protectio(uin, uout): +"""Duplicate streams and redirect original to null if (uin, uout) are +stdio + +Returns (fin, fout) which point to the original (uin, uout) fds, but +may be copy of (uin, uout). The returned streams can be considered +"owned" in that print(), exec(), etc. never reach to them. +""" +uout.flush() newfiles = [] nullfd = os.open(os.devnull, os.O_RDWR) -for f, sysf, mode in [(ui.fin, procutil.stdin, r'rb'), - (ui.fout, procutil.stdout, r'wb')]: +for f, sysf, mode in [(uin, procutil.stdin, r'rb'), + (uout, procutil.stdout, r'wb')]: if f is sysf: newfd = os.dup(f.fileno()) os.dup2(nullfd, f.fileno()) @@ -321,10 +327,10 @@ def _protectio(ui): os.close(nullfd) return tuple(newfiles) -def _restoreio(ui, fin, fout): -""" restores streams from duplicated ones """ -ui.flush() -for f, uif in [(fin, ui.fin), (fout, ui.fout)]: +def _restoreio(uin, uout, fin, fout): +"""Restore (uin, uout) streams from possibly duplicated (fin, fout)""" +uout.flush() +for f, uif in [(fin, uin), (fout, uout)]: if f is not uif: os.dup2(f.fileno(), uif.fileno()) f.close() @@ -341,13 +347,13 @@ class pipeservice(object): ui = self.ui # redirect stdio to null device so that broken extensions or in-process # hooks will never cause corruption of channel protocol. -fin, fout = _protectio(ui) +fin, fout = _protectio(ui.fin, ui.fout) try: sv = server(ui, self.repo, fin, fout) return sv.serve() finally: sv.cleanup() -_restoreio(ui, fin, fout) +_restoreio(ui.fin, ui.fout, fin, fout) def _initworkerprocess(): # use a different process group from the master process, in order to: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2938: grep: make grep search on working directory by default
yuja added inline comments. INLINE COMMENTS > yuja wrote in commands.py:2474 > > Shall I change that to returning wdirid? > > That isn't easy to answer because `wctx.filenode()` can return > another pseudo > hash (e.g. 000added) if `wctx._manifest` is preloaded. > > > highlight the slowpath part > > It's quite old, so I have no concrete idea. But maybe reusing filelog objects > is the key. I did try that. https://phab.mercurial-scm.org/D2940 .. https://phab.mercurial-scm.org/D2942 No idea if they are good or bad. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc: av6, yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2940: workingctx: build _manifest on filenode() or flags() request
yuja created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY I'm not sure if this is the best workaround, but this fixes the following exception: AttributeError: 'workingctx' object has no attribute '_manifestdelta' The short hash '303030303030' seen in the test is node.modifiednodeid. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2940 AFFECTED FILES mercurial/context.py tests/test-grep.t CHANGE DETAILS diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -237,6 +237,17 @@ $ hg grep -f port [1] +Test wdir +(at least, this shouldn't crash) + + $ hg up -q + $ echo wport >> port2 + $ hg stat + M port2 + $ hg grep -r 'wdir()' port + abort: data/port2.i@303030303030: no node! + [255] + $ cd .. $ hg init t2 $ cd t2 diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1378,6 +1378,11 @@ p = p[:-1] return [changectx(self._repo, x) for x in p] +def _fileinfo(self, path): +# populate __dict__['_manifest'] as workingctx has no _manifestdelta +self._manifest +return super(workingctx, self)._fileinfo(path) + def filectx(self, path, filelog=None): """get a file context from the working directory""" return workingfilectx(self._repo, path, workingctx=self, To: yuja, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2942: revlog: detect pseudo file nodeids to raise WdirUnsupported exception
yuja created this revision. Herald added a reviewer: indygreg. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Again, I'm not sure if this is the right thing, but adding a few more pseudo hashes wouldn't be any worse than the current state. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2942 AFFECTED FILES mercurial/revlog.py tests/test-grep.t CHANGE DETAILS diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -245,7 +245,7 @@ $ hg stat M port2 $ hg grep -r 'wdir()' port - abort: data/port2.i@303030303030: no node! + abort: working directory revision cannot be specified [255] $ cd .. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -28,6 +28,7 @@ hex, nullid, nullrev, +wdirfilenodeids, wdirhex, wdirid, wdirrev, @@ -780,7 +781,7 @@ raise except RevlogError: # parsers.c radix tree lookup failed -if node == wdirid: +if node == wdirid or node in wdirfilenodeids: raise error.WdirUnsupported raise LookupError(node, self.indexfile, _('no node')) except KeyError: @@ -796,7 +797,7 @@ if v == node: self._nodepos = r - 1 return r -if node == wdirid: +if node == wdirid or node in wdirfilenodeids: raise error.WdirUnsupported raise LookupError(node, self.indexfile, _('no node')) @@ -1409,6 +1410,7 @@ pass def _partialmatch(self, id): +# we don't care wdirfilenodeids as they should be always full hash maybewdir = wdirhex.startswith(id) try: partial = self.index.partialmatch(id) @@ -2082,7 +2084,7 @@ if node == nullid: raise RevlogError(_("%s: attempt to add null revision") % (self.indexfile)) -if node == wdirid: +if node == wdirid or node in wdirfilenodeids: raise RevlogError(_("%s: attempt to add wdir revision") % (self.indexfile)) To: yuja, indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2941: node: rename wdirnodes to clarify they are for manifest/filelogs
yuja 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/D2941 AFFECTED FILES mercurial/context.py mercurial/copies.py mercurial/node.py CHANGE DETAILS diff --git a/mercurial/node.py b/mercurial/node.py --- a/mercurial/node.py +++ b/mercurial/node.py @@ -30,7 +30,7 @@ addednodeid = ('0' * 15) + 'added' modifiednodeid = ('0' * 12) + 'modified' -wdirnodes = {newnodeid, addednodeid, modifiednodeid} +wdirfilenodeids = {newnodeid, addednodeid, modifiednodeid} # pseudo identifiers for working directory # (they are experimental, so don't add too many dependencies on them) diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -280,7 +280,7 @@ ac = repo.changelog.ancestors(revs, inclusive=True) ctx._ancestrycontext = ac def makectx(f, n): -if n in node.wdirnodes: # in a working context? +if n in node.wdirfilenodeids: # in a working context? if ctx.rev() is None: return ctx.filectx(f) return repo[None][f] diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -22,8 +22,8 @@ nullid, nullrev, short, +wdirfilenodeids, wdirid, -wdirnodes, wdirrev, ) from . import ( @@ -147,7 +147,7 @@ removed.append(fn) elif flag1 != flag2: modified.append(fn) -elif node2 not in wdirnodes: +elif node2 not in wdirfilenodeids: # When comparing files between two commits, we save time by # not comparing the file contents when the nodeids differ. # Note that this means we incorrectly report a reverted change To: yuja, #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 1 of 7] util: mark platform-specific gethgcmd() as private
On Sun, Mar 25, 2018 at 9:06 AM, Yuya Nishiharawrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1521878683 -32400 > # Sat Mar 24 17:04:43 2018 +0900 > # Node ID 348e7462944f36f0fbea25bcf407c78d68aeaa1f > # Parent 704932ef8913f9a4d0aaeca0ef1bdb1bda0ad87e > util: mark platform-specific gethgcmd() as private > > util.hgcmd() is the public interface for gethgcmd(). Queued the series. Many thanks! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2938: grep: make grep search on working directory by default
yuja added a comment. In https://phab.mercurial-scm.org/D2938#47514, @sangeet259 wrote: > @yuja Can you please clarify this a bit more? > > > Perhaps we can start with adding an experimental option to grep files > > including unchanged ones?" This patch appears to do 3 separate things by adding a big "if" branch. - fix `grep -r 'wdir()'` - add mode to include unmodified files - change the default It's probably better to write one (or more) patches for each change, in a way not duplicating code for each combination of possible options. INLINE COMMENTS > sangeet259 wrote in commands.py:2474 > Sure, pushing the first approach now. > But, I think the second approach fits the "Easier to ask for forgiveness than > permission" philosophy of python. > > Currently the filenode of workingctx returns this: `return > self._fileinfo(path)[0]` . Shall I change that to returning wdirid? > > Also can you please highlight the slowpath part? Any reference or links to > mailing lists, where I can learn more about it. > Shall I change that to returning wdirid? That isn't easy to answer because `wctx.filenode()` can return another pseudo hash (e.g. 000added) if `wctx._manifest` is preloaded. > highlight the slowpath part It's quite old, so I have no concrete idea. But maybe reusing filelog objects is the key. > sangeet259 wrote in commands.py:2475 > Done. Any reason why that is better? Extensions may override it to provide a faster implementation. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc: av6, yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2938: grep: make grep search on working directory by default
sangeet259 added a comment. @yuja Can you please clarify this a bit more? > Perhaps we can start with adding an experimental option to grep files > including unchanged ones?" INLINE COMMENTS > yuja wrote in commands.py:2474 > Better to test if ctx is a workingctx (i.e. `ctx.rev() is None`). > > Another idea is to make `wctx.filenode()` return wdirid and catch > WdirUnsupported exception > to fall back to the slow path. Sure, pushing the first approach now. But, I think the second approach fits the "Easier to ask for forgiveness than permission" philosophy of python. Currently the filenode of workingctx returns this: `return self._fileinfo(path)[0]` . Shall I change that to returning wdirid? Also can you please highlight the slowpath part? Any reference or links to mailing lists, where I can learn more about it. > yuja wrote in commands.py:2475 > Nit: `fctx.isbinary()` is preferred. Done. Any reason why that is better? > av6 wrote in commands.py:2494 > Since the difference in both branches for this if-else block seems to be only > in this line, and just one value, it probably makes sense to store said value > in a variable and use it in place of False/True and reduce duplication. Great. Thanks ! > pulkit wrote in commands.py:2584 > The above if condition wants opts['rev'] to be empty and here you are using > it's value. I could have made the call by simply passing `''` instead of `opts.get('rev')` but I chose this because I am planning to build upon this to handle revisions as well. > pulkit wrote in test-grep.t:357 > what's this None here? The None was a result of displaying revision in the ui.write. Removed that. I had forgotten to update this result. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2938 To: sangeet259, #hg-reviewers Cc: av6, yuja, pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2938: grep: make grep search on working directory by default
sangeet259 updated this revision to Diff 7280. sangeet259 marked 7 inline comments as done. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2938?vs=7267=7280 REVISION DETAIL https://phab.mercurial-scm.org/D2938 AFFECTED FILES mercurial/commands.py tests/test-grep.t CHANGE DETAILS diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -24,74 +24,74 @@ simple $ hg grep '.*' - port:4:export - port:4:vaportight - port:4:import/export + port:export + port:vaportight + port:import/export $ hg grep port port - port:4:export - port:4:vaportight - port:4:import/export + port:export + port:vaportight + port:import/export simple with color $ hg --config extensions.color= grep --config color.mode=ansi \ > --color=always port port - \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc) - \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc) - \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0m\x1b[0;32m4\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc) + \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0mex\x1b[0;31;1mport\x1b[0m (esc) + \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0mva\x1b[0;31;1mport\x1b[0might (esc) + \x1b[0;35mport\x1b[0m\x1b[0;36m:\x1b[0mim\x1b[0;31;1mport\x1b[0m/ex\x1b[0;31;1mport\x1b[0m (esc) simple templated $ hg grep port \ > -T '{file}:{rev}:{node|short}:{texts % "{if(matched, text|upper, text)}"}\n' - port:4:914fa752cdea:exPORT - port:4:914fa752cdea:vaPORTight - port:4:914fa752cdea:imPORT/exPORT + port:::exPORT + port:::vaPORTight + port:::imPORT/exPORT simple JSON (no "change" field) $ hg grep -Tjson port [ { -"date": [4.0, 0], -"file": "port", -"line_number": 1, -"node": "914fa752cdea8ac1a8d5c858b0c736218f6c", -"rev": 4, +"date": [0, 0], +"file": "port", +"line_number": 1, +"node": "", +"rev": null, "texts": [{"matched": false, "text": "ex"}, {"matched": true, "text": "port"}], -"user": "spam" - }, - { -"date": [4.0, 0], +"user": "test" + }, + { +"date": [0, 0], "file": "port", "line_number": 2, -"node": "914fa752cdea8ac1a8d5c858b0c736218f6c", -"rev": 4, +"node": "", +"rev": null, "texts": [{"matched": false, "text": "va"}, {"matched": true, "text": "port"}, {"matched": false, "text": "ight"}], -"user": "spam" - }, - { -"date": [4.0, 0], +"user": "test" + }, + { +"date": [0, 0], "file": "port", "line_number": 3, -"node": "914fa752cdea8ac1a8d5c858b0c736218f6c", -"rev": 4, +"node": "", +"rev": null, "texts": [{"matched": false, "text": "im"}, {"matched": true, "text": "port"}, {"matched": false, "text": "/ex"}, {"matched": true, "text": "port"}], -"user": "spam" +"user": "test" } ] simple JSON without matching lines $ hg grep -Tjson -l port [ { -"date": [4.0, 0], -"file": "port", -"line_number": 1, -"node": "914fa752cdea8ac1a8d5c858b0c736218f6c", -"rev": 4, -"user": "spam" +"date": [0, 0], +"file": "port", +"line_number": 1, +"node": "", +"rev": null, +"user": "test" } ] @@ -207,18 +207,17 @@ other $ hg grep -l port port - port:4 + port $ hg grep import port - port:4:import/export + port:import/export $ hg cp port port2 $ hg commit -m 4 -u spam -d '5 0' follow $ hg grep --traceback -f 'import\n\Z' port2 - port:0:import - + [1] $ echo deport >> port2 $ hg commit -m 5 -u eggs -d '6 0' $ hg grep -f --all -nu port port2 @@ -256,26 +255,26 @@ $ echo blue >> color $ hg ci -m 3 $ hg grep orange - color:3:orange + color:orange $ hg grep --all orange color:3:+:orange color:2:-:orange color:1:+:orange test substring match: '^' should only match at the beginning $ hg grep '^.' --config extensions.color= --color debug - [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lack - [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|o]range - [grep.filename|color][grep.sep|:][grep.rev|3][grep.sep|:][grep.match|b]lue + [grep.filename|color][grep.sep|:][grep.match|b]lack + [grep.filename|color][grep.sep|:][grep.match|o]range + [grep.filename|color][grep.sep|:][grep.match|b]lue match in last "line" without newline $ $PYTHON -c 'fp = open("noeol", "wb"); fp.write(b"no infinite loop"); fp.close();' $ hg ci -Amnoeol adding noeol $ hg grep loop - noeol:4:no infinite loop + noeol:no infinite loop $ cd .. @@ -292,8 +291,7 @@ $ hg rename
D2593: state: add logic to parse the state file in old way if cbor fails
martinvonz added a comment. In https://phab.mercurial-scm.org/D2593#44291, @indygreg wrote: > Not sure where to record this comment in this series. So I'll pick this commit. > > I think we want an explicit version header in the state files so clients know when they may be reading a file in an old format. For example, if I start a merge in one terminal window, I sometimes move to another terminal window to resolve parts of it. The multiple windows may be running different Mercurial versions. For example, sometimes one of the shells has a virtualenv activated and that virtualenv is running an older Mercurial. We don't want the older Mercurial trampling on state needed by the new Mercurial. Also, it doesn't seem like CBOR defines any magic bytes to start the top-level object with, so it's not obvious to me that an old state file (e.g. on containing just a nodeid) could not be parsed as a valid CBOR file. Perhaps cmdstate should help with that? We could make it always add a first item that's just "CBOR" or something (it seem very unlikely that we'd have that in an old state file), and we could fail when reading a state file that doesn't have that. Or would could require any new state files to have a new name than the old ones? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2593 To: pulkit, #hg-reviewers Cc: martinvonz, indygreg, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2594: graft: move logic to read current graft state file in state.py
martinvonz added inline comments. INLINE COMMENTS > state.py:117-120 > +@readoldstatefile('graftstate') > +def oldgraftstate(fp): > +nodes = fp.read().splitlines() > +return {'nodes': nodes} Shouldn't this code be in commands.py? I don't think we should centralize the code for parsing all old formats in state.py. That will not happen with third-party extensions anyway, of course. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2594 To: pulkit, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2593: state: add logic to parse the state file in old way if cbor fails
martinvonz added a comment. INLINE COMMENTS > durin42 wrote in state.py:84 > Probably treat not-a-dict as corrupt and fall back to the other format? How about not requiring it to be a dict? I imagine practically all callers will want to pass a dict, but why does this class have to enforce it? I think the API would be simpler if it was an opaque object. In the simple case of graft, the state is simply a list of nodes. However, for more complex states, we could have nested structures. I don't see why cmdstate should be involved in lookups into the top-level structure. The difference is subtle, but here's an example: # With dict-aware cmdstate cmdstate = ... cmdstate.load() version = cmdstate['version'] for car in cmdstate['cars']: for wheel in car['wheels']: # whatever # With agnostic cmdstate cmdstate = ... parking = cmdstate.load() version = parking['version'] for car in parking['cars']: for wheel in car['wheels']: # whatever > state.py:82 > +with self._repo.vfs(self.fname, 'rb') as fp: > +ret = cbor.load(fp) > +if not isinstance(ret, dict): bad ident REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2593 To: pulkit, #hg-reviewers Cc: martinvonz, indygreg, durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2592: state: add registrar to register function to read old state files
martinvonz added inline comments. INLINE COMMENTS > state.py:104 > +should return a dict of data stored in state file.""" > +assert path not in oldstatefilefns > +oldstatefilefns[path] = func I think we're used ProgrammingError elsewhere for this kind of thing REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2592 To: pulkit, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2591: state: import the file to write state files from evolve extension
martinvonz added a comment. > This patch moves the file which is used to write state files easily in a good way using the cbor format. Is "moves the file" referring to "import from the evolve extension"? It would also be good to be more concrete about what "easily in a good way" means. I get the feeling that there's a not-so-good way you have in mind that you want to prevent. INLINE COMMENTS > state.py:61 > +def load(self): > +"""load the existing evolvestate file into the class object""" > +op = self._read() drop "evolve" here and a few other places REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2591 To: pulkit, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel