D3728: grep: adds unmodified mode
mharbison72 added inline comments. INLINE COMMENTS > commands.py:2411 > _('only search files changed within revision range'), _('REV')), > +('', 'unmodified', False, > + _('include all files in the changeset while grepping')), I wonder if `--allfiles` is a better name. `--unmodified` makes me think unmodified files exclusively. It's too bad `--all` is already used, because that would be consistent with the all files meaning in `status` and `revert`. (Maybe others?) The plan page mentions BCing plain grep into oblivion, and deprecating `--all`. Is it worth a BC on this too, for consistency going forward? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3728 To: sangeet259, #hg-reviewers Cc: mharbison72, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 5917] New: record (e.g. `hg ci -i` and `hg split`) crashes with "bad hunk #1" if diff makes a file empty
https://bz.mercurial-scm.org/show_bug.cgi?id=5917 Bug ID: 5917 Summary: record (e.g. `hg ci -i` and `hg split`) crashes with "bad hunk #1" if diff makes a file empty Product: Mercurial Version: 4.6 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: feature Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: martinv...@google.com CC: mercurial-devel@mercurial-scm.org Here's a patch showing a test case that passes: diff --git a/tests/test-commit-interactive-curses.t b/tests/test-commit-interactive-curses.t --- a/tests/test-commit-interactive-curses.t +++ b/tests/test-commit-interactive-curses.t @@ -214,6 +214,16 @@ Amend option works @@ -0,0 +1,1 @@ +hello world +Make file empty + $ echo -n > x + $ catX + > EOF + $ hg ci -i -m emptify -d "0 0" + abort: bad hunk #1 + [255] + $ hg revert x + Editing a hunk puts you back on that hunk when done editing (issue5041) To do that, we change two lines in a file, pretend to edit the second line, exit, toggle the line selected at the end of the edit and commit. -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3731: templatefilters: rename commonprefix to commondir
martinvonz created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY Two reasons: - It makes it clearer that it's not a generic common string prefix (e.g. commonprefix(["bar", "baz"]) is not "ba", but "") - If we ever want a filter for generic common string prefix, then the name is now available for that. "commondir" does not describe the prefix-ness, however. I'm happy to rename it "commondirprefix" or "commonprefixdir" if others prefer. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3731 AFFECTED FILES mercurial/templatefilters.py tests/test-template-filters.t CHANGE DETAILS diff --git a/tests/test-template-filters.t b/tests/test-template-filters.t --- a/tests/test-template-filters.t +++ b/tests/test-template-filters.t @@ -1,23 +1,23 @@ - $ hg debugtemplate '{""|splitlines|commonprefix}\n' + $ hg debugtemplate '{""|splitlines|commondir}\n' - $ hg debugtemplate '{"foo/bar\nfoo/baz\nfoo/foobar\n"|splitlines|commonprefix}\n' + $ hg debugtemplate '{"foo/bar\nfoo/baz\nfoo/foobar\n"|splitlines|commondir}\n' foo - $ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commonprefix}\n' + $ hg debugtemplate '{"foo/bar\nfoo/bar\n"|splitlines|commondir}\n' foo - $ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commonprefix}\n' + $ hg debugtemplate '{"/foo/bar\n/foo/bar\n"|splitlines|commondir}\n' foo - $ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commonprefix}\n' + $ hg debugtemplate '{"/foo\n/foo\n"|splitlines|commondir}\n' - $ hg debugtemplate '{"foo/bar\nbar/baz"|splitlines|commonprefix}\n' + $ hg debugtemplate '{"foo/bar\nbar/baz"|splitlines|commondir}\n' - $ hg debugtemplate '{"foo/bar\nbar/baz\nbar/foo\n"|splitlines|commonprefix}\n' + $ hg debugtemplate '{"foo/bar\nbar/baz\nbar/foo\n"|splitlines|commondir}\n' - $ hg debugtemplate '{"foo/../bar\nfoo/bar"|splitlines|commonprefix}\n' + $ hg debugtemplate '{"foo/../bar\nfoo/bar"|splitlines|commondir}\n' foo - $ hg debugtemplate '{"foo\n/foo"|splitlines|commonprefix}\n' + $ hg debugtemplate '{"foo\n/foo"|splitlines|commondir}\n' $ hg init - $ hg log -r null -T '{rev|commonprefix}' + $ hg log -r null -T '{rev|commondir}' hg: parse error: argument is not a list of text - (template filter 'commonprefix' is not compatible with keyword 'rev') + (template filter 'commondir' is not compatible with keyword 'rev') [255] diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -99,8 +99,8 @@ """ return os.path.basename(path) -@templatefilter('commonprefix') -def commonprefix(filelist): +@templatefilter('commondir') +def commondir(filelist): """List of text. Treats each list item as file name with / as path separator and returns the longest common directory prefix shared by all list items. 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
Re: [PATCH 7 of 7] templater: abstract truth testing to fix {if(list_of_empty_strings)}
> On Jun 12, 2018, at 17:24, Augie Fackler wrote: > > On Tue, Jun 12, 2018 at 11:49:09PM +0900, Yuya Nishihara wrote: >> # HG changeset patch >> # User Yuya Nishihara >> # Date 1528518887 -32400 >> # Sat Jun 09 13:34:47 2018 +0900 >> # Node ID 4eb2c19f741f50389c3de234654510deede597e2 >> # Parent 0bf2bc3ec4f89f4a847b68d00011968732aacd7a >> templater: abstract truth testing to fix {if(list_of_empty_strings)} > > queued, thanks I'm confused: this appears to have regressed test-obsmarker-template.t on Python 3. I'll try and take a look, but if anyone sees anything obvious please let me know. > ___ > 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
D3730: morestatus: remove some extra spaces
pulkit created this revision. Herald added a reviewer: durin42. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY The information about unfinished states in `hg status -v` had a lot of spaces which are not required and feels weird. Let's limit the spacing to four spaces. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3730 AFFECTED FILES mercurial/cmdutil.py tests/test-conflict.t tests/test-graft.t tests/test-histedit-fold.t tests/test-rebase-conflicts.t tests/test-shelve.t CHANGE DETAILS diff --git a/tests/test-shelve.t b/tests/test-shelve.t --- a/tests/test-shelve.t +++ b/tests/test-shelve.t @@ -356,8 +356,8 @@ # # To mark files as resolved: hg resolve --mark FILE - # To continue:hg unshelve --continue - # To abort: hg unshelve --abort + # To continue:hg unshelve --continue + # To abort: hg unshelve --abort ensure that we have a merge with unresolved conflicts diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t --- a/tests/test-rebase-conflicts.t +++ b/tests/test-rebase-conflicts.t @@ -80,8 +80,8 @@ # # To mark files as resolved: hg resolve --mark FILE - # To continue:hg rebase --continue - # To abort: hg rebase --abort + # To continue:hg rebase --continue + # To abort: hg rebase --abort Try to continue without solving the conflict: diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t --- a/tests/test-histedit-fold.t +++ b/tests/test-histedit-fold.t @@ -306,8 +306,8 @@ # # To mark files as resolved: hg resolve --mark FILE - # To continue:hg histedit --continue - # To abort: hg histedit --abort + # To continue:hg histedit --continue + # To abort: hg histedit --abort $ hg resolve -l U file diff --git a/tests/test-graft.t b/tests/test-graft.t --- a/tests/test-graft.t +++ b/tests/test-graft.t @@ -236,8 +236,8 @@ # # To mark files as resolved: hg resolve --mark FILE - # To continue:hg graft --continue - # To abort: hg update --clean .(warning: this will discard uncommitted changes) + # To continue:hg graft --continue + # To abort: hg update --clean . (warning: this will discard uncommitted changes) Commit while interrupted should fail: diff --git a/tests/test-conflict.t b/tests/test-conflict.t --- a/tests/test-conflict.t +++ b/tests/test-conflict.t @@ -57,8 +57,8 @@ # # To mark files as resolved: hg resolve --mark FILE - # To continue:hg commit - # To abort: hg update --clean .(warning: this will discard uncommitted changes) + # To continue:hg commit + # To abort: hg update --clean . (warning: this will discard uncommitted changes) $ cat a diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -588,8 +588,8 @@ return _commentlines(msg) def _helpmessage(continuecmd, abortcmd): -msg = _('To continue:%s\n' -'To abort: %s') % (continuecmd, abortcmd) +msg = _('To continue:%s\n' +'To abort: %s') % (continuecmd, abortcmd) return _commentlines(msg) def _rebasemsg(): @@ -603,7 +603,7 @@ def _updatecleanmsg(dest=None): warning = _('warning: this will discard uncommitted changes') -return 'hg update --clean %s(%s)' % (dest or '.', warning) +return 'hg update --clean %s (%s)' % (dest or '.', warning) def _graftmsg(): # tweakdefaults requires `update` to have a rev hence the `.` To: pulkit, durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3708: py3: replace `unicode` with pycompat.unicode
pulkit updated this revision to Diff 9053. pulkit retitled this revision from "py3: replace `unicode` with `type(u'')` in isinstance() calls" to "py3: replace `unicode` with pycompat.unicode". REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3708?vs=9007=9053 REVISION DETAIL https://phab.mercurial-scm.org/D3708 AFFECTED FILES hgext/convert/common.py hgext/convert/convcmd.py hgext/convert/darcs.py hgext/win32mbcs.py mercurial/i18n.py mercurial/pycompat.py mercurial/scmutil.py CHANGE DETAILS diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -233,7 +233,7 @@ except (AttributeError, IndexError): # it might be anything, for example a string reason = inst.reason -if isinstance(reason, unicode): +if isinstance(reason, pycompat.unicode): # SSLError of Python 2.7.9 contains a unicode reason = encoding.unitolocal(reason) ui.warn(_("abort: error: %s\n") % reason) diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -302,6 +302,7 @@ else: import cStringIO +unicode = unicode bytechr = chr byterepr = repr bytestr = str diff --git a/mercurial/i18n.py b/mercurial/i18n.py --- a/mercurial/i18n.py +++ b/mercurial/i18n.py @@ -23,11 +23,6 @@ else: module = pycompat.fsencode(__file__) -try: -unicode -except NameError: -unicode = str - _languages = None if (pycompat.iswindows and 'LANGUAGE' not in encoding.environ @@ -76,7 +71,7 @@ cache = _msgcache.setdefault(encoding.encoding, {}) if message not in cache: -if type(message) is unicode: +if type(message) is pycompat.unicode: # goofy unicode docstrings in test paragraphs = message.split(u'\n\n') else: diff --git a/hgext/win32mbcs.py b/hgext/win32mbcs.py --- a/hgext/win32mbcs.py +++ b/hgext/win32mbcs.py @@ -90,7 +90,7 @@ return arg def encode(arg): -if isinstance(arg, unicode): +if isinstance(arg, pycompat.unicode): return arg.encode(_encoding) elif isinstance(arg, tuple): return tuple(map(encode, arg)) @@ -127,7 +127,7 @@ " %s encoding\n") % (_encoding)) def wrapper(func, args, kwds): -return basewrapper(func, unicode, encode, decode, args, kwds) +return basewrapper(func, pycompat.unicode, encode, decode, args, kwds) def reversewrapper(func, args, kwds): diff --git a/hgext/convert/darcs.py b/hgext/convert/darcs.py --- a/hgext/convert/darcs.py +++ b/hgext/convert/darcs.py @@ -104,7 +104,7 @@ shutil.rmtree(self.tmppath, ignore_errors=True) def recode(self, s, encoding=None): -if isinstance(s, unicode): +if isinstance(s, pycompat.unicode): # XMLParser returns unicode objects for anything it can't # encode into ASCII. We convert them back to str to get # recode's normal conversion behavior. diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py +++ b/hgext/convert/convcmd.py @@ -55,7 +55,7 @@ orig_encoding = 'ascii' def recode(s): -if isinstance(s, unicode): +if isinstance(s, pycompat.unicode): return s.encode(pycompat.sysstr(orig_encoding), 'replace') else: return s.decode('utf-8').encode( diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -214,7 +214,7 @@ if not encoding: encoding = self.encoding or 'utf-8' -if isinstance(s, unicode): +if isinstance(s, pycompat.unicode): return s.encode("utf-8") try: return s.decode(pycompat.sysstr(encoding)).encode("utf-8") To: pulkit, #hg-reviewers Cc: yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 4] debugwalk: show matcher output only if -v/--verbose
On Wed, Jun 13, 2018 at 5:03 AM Yuya Nishihara wrote: > On Tue, 12 Jun 2018 13:44:17 -0700, Martin von Zweigbergk wrote: > > > --- a/mercurial/debugcommands.py > > > +++ b/mercurial/debugcommands.py > > > @@ -2542,7 +2542,8 @@ def debugwalk(ui, repo, *pats, **opts): > > > """show how files match on given patterns""" > > > opts = pycompat.byteskwargs(opts) > > > m = scmutil.match(repo[None], pats, opts) > > > -ui.write(('matcher: %r\n' % m)) > > > +if ui.verbose: > > > +ui.write(('matcher: %r\n' % m)) > > > > > > > nit: These two lines are equivalent to "ui.note(('matcher: %r\n' % m))", > > except that that also adds a "ui.note" label. Use that method instead? > > Yeah, it could, but I'm not a fan of using note/status for data. At some > point, I want to add a way to separate status/note/debug messages from data > stream so that structured output (e.g. JSON/CBOR) won't be messed up. > Fair enough, I mostly wanted point out that the method existed in case you had forgotten. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3729: bitmanipulation: fix undefined behavior in bit shift in getbe32
This revision was automatically updated to reflect the committed changes. Closed by commit rHG1fb2510cf8c8: bitmanipulation: fix undefined behavior in bit shift in getbe32 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3729?vs=9051=9052 REVISION DETAIL https://phab.mercurial-scm.org/D3729 AFFECTED FILES contrib/fuzz/mpatch_corpus.py mercurial/bitmanipulation.h CHANGE DETAILS diff --git a/mercurial/bitmanipulation.h b/mercurial/bitmanipulation.h --- a/mercurial/bitmanipulation.h +++ b/mercurial/bitmanipulation.h @@ -9,7 +9,8 @@ { const unsigned char *d = (const unsigned char *)c; - return ((d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3])); + return uint32_t)d[0]) << 24) | (((uint32_t)d[1]) << 16) | + (((uint32_t)d[2]) << 8) | (d[3])); } static inline int16_t getbeint16(const char *c) diff --git a/contrib/fuzz/mpatch_corpus.py b/contrib/fuzz/mpatch_corpus.py --- a/contrib/fuzz/mpatch_corpus.py +++ b/contrib/fuzz/mpatch_corpus.py @@ -78,6 +78,10 @@ zf.writestr( "mpatch_decode_old_overread", "\x02\x00\x00\x00\x02\x00\x00\x00" ) +# https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8876 +zf.writestr( +"mpatch_ossfuzz_getbe32_ubsan", +"\x02\x00\x00\x00\x0c\xff\xff\xff\xff") zf.writestr( "mpatch_apply_over_memcpy", '\x13\x01\x00\x05\xd0\x00\x00\x00\x00\x00\x00\x00\x00\n \x00\x00\x00' 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
D3718: narrow: mark the critical chunks of narrowing/widening as unsafe
martinvonz added inline comments. INLINE COMMENTS > narrowcommands.py:248 > +repo.wvfs.unlinkpath(f) > +repo.setnarrowpats(newincludes, newexcludes) > Perhaps for another patch, but we could probably move this to before the transaction that starts on line 238 and then move the transaction outside of the unsafeoperation(). The repo won't be more broken if the user interrupts while we delete or add files from the working copy or dirstate here than it could be if they interrupt while doing the same things because of an `hg update` (right?). I guess it depends on what we consider unsafe. Is it just things that would result in lost commits or errors from `hg verify` that we consider unsafe? That seems like a reasonable definition to me. > narrowcommands.py:250 > > -repo.destroyed() > +repo.destroyed() > nit: the previous patch left this line outside of the block. make consistent? doesn't really matter, though... > narrowcommands.py:284-295 > +actions = {k: [] for k in 'a am f g cd dc r dm dg m e k p > pr'.split()} > +addgaction = actions['g'].append > > -mf = repo['.'].manifest().matches(newmatch) > -for f, fn in mf.iteritems(): > -if f not in repo.dirstate: > -addgaction((f, (mf.flags(f), False), > -"add from widened narrow clone")) > +mf = repo['.'].manifest().matches(newmatch) > +for f, fn in mf.iteritems(): > +if f not in repo.dirstate: > +addgaction((f, (mf.flags(f), False), similar here: i think this could be left outside the unsafeoperation() REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3718 To: durin42, #hg-reviewers Cc: martinvonz, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3715: namespaces: allow namespaces whose symbols resolve to many nodes (API)
martinvonz added a comment. In https://phab.mercurial-scm.org/D3715#58383, @durin42 wrote: > I'm in favor, but feel like I've got enough conflict of interest I shouldn't land the patches. > > @smf @lothiraldan this might be of interest to both of you? In https://phab.mercurial-scm.org/D3715#58507, @lothiraldan wrote: > In https://phab.mercurial-scm.org/D3715#58383, @durin42 wrote: > > > I'm in favor, but feel like I've got enough conflict of interest I shouldn't land the patches. > > > > @smf @lothiraldan this might be of interest to both of you? > > > The proposition of making namespaces behave differently than branches, and potentially making two namespaces behave differently (one with `multinode=True` and the other with `multinode=False`) make my spider sense tickle. But I will take time to see the exact implications of that series. As I said in the commit message, I think branches should have multinode=True, but we can't do that for BC reasons. Bookmarks and tags clearly identify a single commit per name (at least in my mind). How about we introduce the multinode option and default it to False for now, but plan to change the default to True later and then let only branches have the old behavior (i.e. multinode=False) and discourage extensions from setting multinode=False? That would result in consistency between namespaces (except for the legacy case of branches) while giving existing extensions some time to adapt (perhaps by making namemap return at most one node if they view their names as identifying a single commit). Btw, the topics extension was just an example. We have an internal extension that's the reason for this patch. I don't use topics, so I don't care too much if topics decide to have one commit per name or not (but if I did use topics, I think I would definitely view it as having multiple nodes per name). REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3715 To: martinvonz, #hg-reviewers, durin42 Cc: durin42, smf, lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3694: shelve: use more accurate description in conflict marker
lothiraldan added a comment. In https://phab.mercurial-scm.org/D3694#58409, @durin42 wrote: > In https://phab.mercurial-scm.org/D3694#58369, @lothiraldan wrote: > > > > How much work is this, do you have any idea? > > > > The first option (adding "reserved" phase) should be very quick to implement. It might need minor adjustment for performance but I don't expect many. > > > > The second option (changing all algorithm to handle the gap) is more work since about all algorithm touching phases in Core and extensions assume they can be handled as a simple list. > > > > So I would pick the first option. > > > When I was discussing this with spectral the idea of an `archived` phase came up. The fact that we've got two new phases at top of mind in the space of a week convinces me we should reserve *much* more than just one or two slots in the phase numbering space. I'd really like to get this work landed, so I'd be happy to help. > > (I'm off work next week, but could probably offer some time the following week.) I think the internal phase implementation details just need to be ironed out, we mostly agreed about having a certain number of reserved phases, am I right? In the meantime, I think we should land this refactoring series while we finish preparing the internal phase one, does that sounds good to you? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3694 To: lothiraldan, #hg-reviewers Cc: durin42, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3715: namespaces: allow namespaces whose symbols resolve to many nodes (API)
lothiraldan added a comment. In https://phab.mercurial-scm.org/D3715#58383, @durin42 wrote: > I'm in favor, but feel like I've got enough conflict of interest I shouldn't land the patches. > > @smf @lothiraldan this might be of interest to both of you? The proposition of making namespaces behave differently than branches, and potentially making two namespaces behave differently (one with `multinode=True` and the other with `multinode=False`) make my spider sense tickle. But I will take time to see the exact implications of that series. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3715 To: martinvonz, #hg-reviewers, durin42 Cc: durin42, smf, lothiraldan, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2] lazymanifest: don't crash when out of memory (issue5916)
> On Jun 13, 2018, at 10:55, Josef 'Jeff' Sipek wrote: > > # HG changeset patch > # User Josef 'Jeff' Sipek > # Date 1528900880 14400 > # Wed Jun 13 10:41:20 2018 -0400 > # Branch stable > # Node ID d591c80025ee7316b77235b2d71c4b0f01c03123 > # Parent cbb47a946bc0e0346bfc9f9ba505f9475de43606 > lazymanifest: don't crash when out of memory (issue5916) queued for stable, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@38291: new changeset
New changeset in mercurial: https://www.mercurial-scm.org/repo/hg/rev/c07424ec633c changeset: 38291:c07424ec633c bookmark:@ tag: tip user:Jun Wu date:Tue Jun 12 12:41:09 2018 -0700 summary: commandserver: close server's fds explicitly from a worker -- 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
[PATCH 2 of 2] lazymanifest: don't crash when out of memory (issue5916)
# HG changeset patch # User Josef 'Jeff' Sipek # Date 1528900880 14400 # Wed Jun 13 10:41:20 2018 -0400 # Branch stable # Node ID d591c80025ee7316b77235b2d71c4b0f01c03123 # Parent cbb47a946bc0e0346bfc9f9ba505f9475de43606 lazymanifest: don't crash when out of memory (issue5916) self->lines can be NULL if we failed to allocate memory for it. diff --git a/mercurial/cext/manifest.c b/mercurial/cext/manifest.c --- a/mercurial/cext/manifest.c +++ b/mercurial/cext/manifest.c @@ -185,7 +185,7 @@ static void lazymanifest_dealloc(lazyman { /* free any extra lines we had to allocate */ int i; - for (i = 0; i < self->numlines; i++) { + for (i = 0; self->lines && (i < self->numlines); i++) { if (self->lines[i].from_malloc) { free(self->lines[i].start); } ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] cext: stop worrying and love the free(NULL)
# HG changeset patch # User Josef 'Jeff' Sipek # Date 1528900659 14400 # Wed Jun 13 10:37:39 2018 -0400 # Branch stable # Node ID cbb47a946bc0e0346bfc9f9ba505f9475de43606 # Parent 3c84493556db3bffcff2fa2f24bb6738dde9fc58 cext: stop worrying and love the free(NULL) There is no need to check for a NULL pointer before calling free since free(NULL) is defined by C standards as a no-op. Lots of software relies on this behavior so it is completely safe to call even on the most obscure of systems. diff --git a/mercurial/cext/bdiff.c b/mercurial/cext/bdiff.c --- a/mercurial/cext/bdiff.c +++ b/mercurial/cext/bdiff.c @@ -155,12 +155,8 @@ cleanup: PyEval_RestoreThread(_save); PyBuffer_Release(); PyBuffer_Release(); - if (al) { - free(al); - } - if (bl) { - free(bl); - } + free(al); + free(bl); if (l.next) { bdiff_freehunks(l.next); } diff --git a/mercurial/cext/manifest.c b/mercurial/cext/manifest.c --- a/mercurial/cext/manifest.c +++ b/mercurial/cext/manifest.c @@ -190,10 +190,8 @@ static void lazymanifest_dealloc(lazyman free(self->lines[i].start); } } - if (self->lines) { - free(self->lines); - self->lines = NULL; - } + free(self->lines); + self->lines = NULL; if (self->pydata) { Py_DECREF(self->pydata); self->pydata = NULL; diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -319,10 +319,8 @@ static void _index_clearcaches(indexObje PyMem_Free(self->offsets); self->offsets = NULL; } - if (self->nt) { - free(self->nt); - self->nt = NULL; - } + free(self->nt); + self->nt = NULL; Py_CLEAR(self->headrevs); } ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2] templatefilters: undeprecate hgdate
On Wed, Jun 13, 2018 at 11:00:32PM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara > # Date 1528894722 -32400 > # Wed Jun 13 21:58:42 2018 +0900 > # Node ID 74b4a54002ecb2059612d5e69ba204d05c818542 > # Parent 88e7105b5cd927ae0ecbe5dcc21c6125c4af4a6b > templatefilters: undeprecate hgdate queued, thanks ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3729: bitmanipulation: fix undefined behavior in bit shift in getbe32
durin42 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY OSS-Fuzz caught this in its ubsan mode[0]. I'm not worried about a security issue here because in practice this should work out the way we naively expected, we're just making things explicit to the compiler with the casts. 0: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8876 REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3729 AFFECTED FILES contrib/fuzz/mpatch_corpus.py mercurial/bitmanipulation.h CHANGE DETAILS diff --git a/mercurial/bitmanipulation.h b/mercurial/bitmanipulation.h --- a/mercurial/bitmanipulation.h +++ b/mercurial/bitmanipulation.h @@ -9,7 +9,8 @@ { const unsigned char *d = (const unsigned char *)c; - return ((d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3])); + return uint32_t)d[0]) << 24) | (((uint32_t)d[1]) << 16) | + (((uint32_t)d[2]) << 8) | (d[3])); } static inline int16_t getbeint16(const char *c) diff --git a/contrib/fuzz/mpatch_corpus.py b/contrib/fuzz/mpatch_corpus.py --- a/contrib/fuzz/mpatch_corpus.py +++ b/contrib/fuzz/mpatch_corpus.py @@ -78,6 +78,10 @@ zf.writestr( "mpatch_decode_old_overread", "\x02\x00\x00\x00\x02\x00\x00\x00" ) +# https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8876 +zf.writestr( +"mpatch_ossfuzz_getbe32_ubsan", +"\x02\x00\x00\x00\x0c\xff\xff\xff\xff") zf.writestr( "mpatch_apply_over_memcpy", '\x13\x01\x00\x05\xd0\x00\x00\x00\x00\x00\x00\x00\x00\n \x00\x00\x00' To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2] templatefilters: undeprecate hgdate
# HG changeset patch # User Yuya Nishihara # Date 1528894722 -32400 # Wed Jun 13 21:58:42 2018 +0900 # Node ID 74b4a54002ecb2059612d5e69ba204d05c818542 # Parent 88e7105b5cd927ae0ecbe5dcc21c6125c4af4a6b templatefilters: undeprecate hgdate See the previous patch for why. Backed out changeset 0fe65bb7e160 diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py --- a/mercurial/templatefilters.py +++ b/mercurial/templatefilters.py @@ -241,7 +241,7 @@ def hexfilter(text): @templatefilter('hgdate', intype=templateutil.date) def hgdate(text): """Date. Returns the date as a pair of numbers: "1157407993 -25200" (Unix timestamp, timezone offset). (DEPRECATED) +25200" (Unix timestamp, timezone offset). """ return "%d %d" % text ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2] templater: restore the original string format of {date}
# HG changeset patch # User Yuya Nishihara # Date 1528894644 -32400 # Wed Jun 13 21:57:24 2018 +0900 # Node ID 88e7105b5cd927ae0ecbe5dcc21c6125c4af4a6b # Parent af0e88e64ede202ee7a058acf4f2a89ac86ec97d templater: restore the original string format of {date} Unfortunately, python-hglib relies on that. I could fix python-hglib, but there would be other tools that take a decimal separator as the separator of unixtime and tzoffset. The showfmt is set per instance since new code uses '%d %d' format by default. diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -240,7 +240,9 @@ def showactivebookmark(context, mapping) def showdate(context, mapping): """Date information. The date when the changeset was committed.""" ctx = context.resource(mapping, 'ctx') -return templateutil.date(ctx.date()) +# the default string format is '' because +# python-hglib splits date at decimal separator. +return templateutil.date(ctx.date(), showfmt='%d.0%d') @templatekeyword('desc', requires={'ctx'}) def showdescription(context, mapping): diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -190,10 +190,11 @@ class wrappedvalue(wrapped): class date(mappable, wrapped): """Wrapper for date tuple""" -def __init__(self, value): +def __init__(self, value, showfmt='%d %d'): # value may be (float, int), but public interface shouldn't support # floating-point timestamp self._unixtime, self._tzoffset = map(int, value) +self._showfmt = showfmt def contains(self, context, mapping, item): raise error.ParseError(_('date is not iterable')) @@ -211,7 +212,7 @@ class date(mappable, wrapped): raise error.ParseError(_("date is not iterable")) def show(self, context, mapping): -return '%d %d' % (self._unixtime, self._tzoffset) +return self._showfmt % (self._unixtime, self._tzoffset) def tomap(self, context): return {'unixtime': self._unixtime, 'tzoffset': self._tzoffset} diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -107,7 +107,7 @@ Matcher and metadata options $ hg amend -d '2000 1000' -u 'Foo ' -A C D saved backup bundle to $TESTTMP/repo1/.hg/strip-backup/c7ba14d9075b-b3e76daa-amend.hg (obsstore-off !) $ hg log -r . -T '{node|short} {desc} {files} {author} {date}\n' - 14f6c4bcc865 NEWMESSAGE B D Foo 2000 1000 + 14f6c4bcc865 NEWMESSAGE B D Foo 2000.01000 Amend with editor 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 @@ -1548,33 +1548,33 @@ Keys work: branches--debug: branches--debug: branches--debug: - date: 1577872860 0 - date: 100 0 - date: 151 0 - date: 150 0 - date: 140 0 - date: 130 0 - date: 120 0 - date: 110 0 - date: 100 0 - date--verbose: 1577872860 0 - date--verbose: 100 0 - date--verbose: 151 0 - date--verbose: 150 0 - date--verbose: 140 0 - date--verbose: 130 0 - date--verbose: 120 0 - date--verbose: 110 0 - date--verbose: 100 0 - date--debug: 1577872860 0 - date--debug: 100 0 - date--debug: 151 0 - date--debug: 150 0 - date--debug: 140 0 - date--debug: 130 0 - date--debug: 120 0 - date--debug: 110 0 - date--debug: 100 0 + date: 1577872860.00 + date: 100.00 + date: 151.00 + date: 150.00 + date: 140.00 + date: 130.00 + date: 120.00 + date: 110.00 + date: 100.00 + date--verbose: 1577872860.00 + date--verbose: 100.00 + date--verbose: 151.00 + date--verbose: 150.00 + date--verbose: 140.00 + date--verbose: 130.00 + date--verbose: 120.00 + date--verbose: 110.00 + date--verbose: 100.00 + date--debug: 1577872860.00 + date--debug: 100.00 + date--debug: 151.00 + date--debug: 150.00 + date--debug: 140.00 + date--debug: 130.00 + date--debug: 120.00 + date--debug: 110.00 + date--debug: 100.00 desc: third desc: second desc: merge @@ -2291,7 +2291,7 @@ Upper/lower filters: $ hg log -r0 --template '{author|lower}\n' user name $ hg log -r0 --template '{date|upper}\n' - 100 0 + 100.00 Add a commit that does all possible modifications at once @@ -2806,9 +2806,9 @@ Error on syntax: Behind the scenes, this would throw TypeError without intype=bytes $ hg log -l 3 --template '{date|obfuscate}\n' - - - + + + Behind the scenes, this will throw a ValueError @@ -2820,9 +2820,9 @@ Behind the scenes, this will throw a Val Behind the scenes, this would throw AttributeError without intype=bytes $ hg log -l 3 --template 'line: {date|escape}\n' - line: 0 0 - line: 0 0 -
D3728: grep: adds unmodified mode
sangeet259 updated this revision to Diff 9049. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3728?vs=9041=9049 REVISION DETAIL https://phab.mercurial-scm.org/D3728 AFFECTED FILES mercurial/cmdutil.py 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 @@ -368,3 +368,15 @@ binfile.bin:0:+: Binary file matches $ cd .. + +Test for showing working of unmodified flag + + $ hg init sng + $ cd sng + $ echo "unmod" >> um + $ hg ci -A -m "adds unmod to um" + adding um + $ hg grep -r "-1" "unmod" --unmodified + um:0:unmod + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2408,6 +2408,8 @@ ('n', 'line-number', None, _('print matching line numbers')), ('r', 'rev', [], _('only search files changed within revision range'), _('REV')), +('', 'unmodified', False, + _('include all files in the changeset while grepping')), ('u', 'user', None, _('list the author (long with -v)')), ('d', 'date', None, _('list the date (short with -q)')), ] + formatteropts + walkopts, diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1881,6 +1881,7 @@ yielding each context, the iterator will first call the prepare function on each context in the window in forward order.''' +unmodified = opts.get('unmodified') follow = opts.get('follow') or opts.get('follow_first') revs = _walkrevs(repo, opts) if not revs: @@ -1990,7 +1991,11 @@ ctx = change(rev) if not fns: def fns_generator(): -for f in ctx.files(): +if unmodified and len(revs) == 1: +fiter = iter(ctx) +else: +fiter = ctx.files() +for f in fiter: if match(f): yield f fns = fns_generator() To: sangeet259, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3720: commandserver: close server's fds explicitly from a worker
This revision was automatically updated to reflect the committed changes. Closed by commit rHGc07424ec633c: commandserver: close servers fds explicitly from a worker (authored by quark, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3720?vs=9029=9042 REVISION DETAIL https://phab.mercurial-scm.org/D3720 AFFECTED FILES mercurial/commandserver.py CHANGE DETAILS diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -494,6 +494,8 @@ conn.close() # release handle in parent process else: try: +selector.close() +self._sock.close() self._runworker(conn) conn.close() os._exit(0) To: quark, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3726: hgweb: pass a sysstr to low-level _start_response method
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9f499d28efb4: hgweb: pass a sysstr to low-level _start_response method (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3726?vs=9038=9047 REVISION DETAIL https://phab.mercurial-scm.org/D3726 AFFECTED FILES mercurial/hgweb/server.py CHANGE DETAILS diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -125,8 +125,9 @@ # Ensure the slicing of path below is valid if (path != self.server.prefix and not path.startswith(self.server.prefix + b'/')): -self._start_response(common.statusmessage(404), []) -self._write("Not Found") +self._start_response(pycompat.strurl(common.statusmessage(404)), + []) +self._write(b"Not Found") self._done() return To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3722: py3: buildbot informs me we have two new passing tests
This revision was automatically updated to reflect the committed changes. Closed by commit rHG9f56ad50924d: py3: buildbot informs me we have two new passing tests (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3722?vs=9034=9043 REVISION DETAIL https://phab.mercurial-scm.org/D3722 AFFECTED FILES contrib/python3-whitelist CHANGE DETAILS diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -454,6 +454,7 @@ test-status-inprocess.py test-status-rev.t test-status-terse.t +test-strict.t test-strip-cross.t test-strip.t test-subrepo-deep-nested-change.t @@ -468,6 +469,7 @@ test-tag.t test-tags.t test-template-engine.t +test-template-filters.t test-treemanifest.t test-ui-color.py test-ui-config.py To: durin42, pulkit, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3727: hgweb: insist http_status value is a sysstr
This revision was automatically updated to reflect the committed changes. Closed by commit rHGaf0e88e64ede: hgweb: insist http_status value is a sysstr (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3727?vs=9039=9048 REVISION DETAIL https://phab.mercurial-scm.org/D3727 AFFECTED FILES mercurial/hgweb/server.py CHANGE DETAILS diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -215,6 +215,7 @@ self.sent_headers = True def _start_response(self, http_status, headers, exc_info=None): +assert isinstance(http_status, str) code, msg = http_status.split(None, 1) code = int(code) self.saved_status = http_status 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
D3723: cvsps: avoid comparison between None and a tuple in date sorting
This revision was automatically updated to reflect the committed changes. Closed by commit rHG80f6e95fac2d: cvsps: avoid comparison between None and a tuple in date sorting (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3723?vs=9035=9044 REVISION DETAIL https://phab.mercurial-scm.org/D3723 AFFECTED FILES hgext/convert/cvsps.py CHANGE DETAILS diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -567,11 +567,15 @@ mindate = {} for e in log: if e.commitid: -mindate[e.commitid] = min(e.date, mindate.get(e.commitid)) +if e.commitid not in mindate: +mindate[e.commitid] = e.date +else: +mindate[e.commitid] = min(e.date, mindate[e.commitid]) # Merge changesets -log.sort(key=lambda x: (mindate.get(x.commitid), x.commitid, x.comment, -x.author, x.branch, x.date, x.branchpoints)) +log.sort(key=lambda x: (mindate.get(x.commitid, (-1, 0)), +x.commitid or '', x.comment, +x.author, x.branch or '', x.date, x.branchpoints)) changesets = [] files = set() To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3725: tests: fix printenv script on Python 3
This revision was automatically updated to reflect the committed changes. Closed by commit rHG42f3a277c8dc: tests: fix printenv script on Python 3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3725?vs=9037=9046 REVISION DETAIL https://phab.mercurial-scm.org/D3725 AFFECTED FILES tests/printenv.py CHANGE DETAILS diff --git a/tests/printenv.py b/tests/printenv.py --- a/tests/printenv.py +++ b/tests/printenv.py @@ -26,6 +26,7 @@ exitcode = 0 out = sys.stdout +out = getattr(out, 'buffer', out) name = sys.argv[1] if len(sys.argv) > 2: To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3724: cvsps: port changeset __repr__ to py3
This revision was automatically updated to reflect the committed changes. Closed by commit rHGbec815f991b0: cvsps: port changeset __repr__ to py3 (authored by durin42, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D3724?vs=9036=9045 REVISION DETAIL https://phab.mercurial-scm.org/D3724 AFFECTED FILES hgext/convert/cvsps.py CHANGE DETAILS diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -51,8 +51,8 @@ self.__dict__.update(entries) def __repr__(self): -items = ("%s=%r"%(k, self.__dict__[k]) for k in sorted(self.__dict__)) -return "%s(%s)"%(type(self).__name__, ", ".join(items)) +items = (r"%s=%r"%(k, self.__dict__[k]) for k in sorted(self.__dict__)) +return r"%s(%s)"%(type(self).__name__, r", ".join(items)) class logerror(Exception): pass To: durin42, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3439: templatefilters: add commonprefix
yuja added a comment. > > `commondir()` would be fine as well. `commonpath()` doesn't feel better. I'm ambivalent about either nam> > I'd vote for changing it then. Both because I think it might make it clearer that it's the common prefix of "foo/bar" and "food" is not "foo" and because, as I said, we might want such a function later and it would be unfortunate if the name was taken. Btw, I just checked and we already have `dirname()` and `stripdir()` functions that would match `commondir()`. +1 for `commondir()`. It matches the actual behavior, which is the last filename part is always stripped. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3439 To: joerg.sonnenberger, #hg-reviewers Cc: martinvonz, yuja, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: D3439: templatefilters: add commonprefix
> > `commondir()` would be fine as well. `commonpath()` doesn't feel better. > I'm ambivalent about either nam> > I'd vote for changing it then. Both because I think it might make it > clearer that it's the common prefix of "foo/bar" and "food" is not "foo" and > because, as I said, we might want such a function later and it would be > unfortunate if the name was taken. Btw, I just checked and we already have > `dirname()` and `stripdir()` functions that would match `commondir()`. +1 for `commondir()`. It matches the actual behavior, which is the last filename part is always stripped. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@38290: new changeset
New changeset in mercurial: https://www.mercurial-scm.org/repo/hg/rev/b5651ae53127 changeset: 38290:b5651ae53127 bookmark:@ tag: tip user:Boris Feld date:Tue Jun 12 23:04:27 2018 +0200 summary: run-tests: restrict the test cases allowed characters -- 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
D3728: grep: adds unmodified mode
sangeet259 created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY adds an unmodified flag that lets you grep on all files in the revision and not just the one that were modified in that changeset REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3728 AFFECTED FILES mercurial/cmdutil.py 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 @@ -368,3 +368,15 @@ binfile.bin:0:+: Binary file matches $ cd .. + +Test for showing working of unmodified flag + + $ hg init sng + $ cd sng + $ echo "unmod" >> um + $ hg ci -A -m "adds unmod to um" + adding um + $ hg grep -r "-1" "unmod" + um:0:unmod + + $ cd .. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2408,6 +2408,8 @@ ('n', 'line-number', None, _('print matching line numbers')), ('r', 'rev', [], _('only search files changed within revision range'), _('REV')), +('', 'unmodified', False, + _('include all files in the changeset while grepping')), ('u', 'user', None, _('list the author (long with -v)')), ('d', 'date', None, _('list the date (short with -q)')), ] + formatteropts + walkopts, diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1881,6 +1881,7 @@ yielding each context, the iterator will first call the prepare function on each context in the window in forward order.''' +unmodified = opts.get('unmodified') follow = opts.get('follow') or opts.get('follow_first') revs = _walkrevs(repo, opts) if not revs: @@ -1990,7 +1991,11 @@ ctx = change(rev) if not fns: def fns_generator(): -for f in ctx.files(): +if unmodified and len(revs) == 1: +fiter = iter(ctx) +else: +fiter = ctx.files() +for f in fiter: if match(f): yield f fns = fns_generator() To: sangeet259, #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 STABLE] tests: fix test-patch.t on pickier /bin/sh implementations
On Tue, 12 Jun 2018 18:20:39 -0400, Augie Fackler wrote: > # HG changeset patch > # User Augie Fackler > # Date 1526871918 14400 > # Sun May 20 23:05:18 2018 -0400 > # Branch stable > # Node ID 0c4019611293212012b598949832dcb2de6b96b2 > # Parent 3c84493556db3bffcff2fa2f24bb6738dde9fc58 > tests: fix test-patch.t on pickier /bin/sh implementations Queued for stable, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 7] templater: introduce a wrapper for date tuple (BC)
On Tue, 12 Jun 2018 17:49:47 -0400, Augie Fackler wrote: > On Tue, Jun 12, 2018 at 11:49:05PM +0900, Yuya Nishihara wrote: > > # HG changeset patch > > # User Yuya Nishihara > > # Date 1521881642 -32400 > > # Sat Mar 24 17:54:02 2018 +0900 > > # Node ID 61e21a5a89d421909c45718ffc50f72cf83ee4b5 > > # Parent 5eb83a6310845fb61fef9eda799731b90061 > > templater: introduce a wrapper for date tuple (BC) > > This appears to break python-hglib: > > https://buildbot.mercurial-scm.org/builders/python-hglib/builds/1379/steps/default%20%282.6.9%29/logs/stdio > > Any thoughts on how we should proceed? Ugh. I could fix python-hglib to use {date|hgdate}, but we'd better to restore the original output format for compatibility with old versions. I'll send a follow up. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 4] debugwalk: show matcher output only if -v/--verbose
On Tue, 12 Jun 2018 13:44:17 -0700, Martin von Zweigbergk wrote: > > --- a/mercurial/debugcommands.py > > +++ b/mercurial/debugcommands.py > > @@ -2542,7 +2542,8 @@ def debugwalk(ui, repo, *pats, **opts): > > """show how files match on given patterns""" > > opts = pycompat.byteskwargs(opts) > > m = scmutil.match(repo[None], pats, opts) > > -ui.write(('matcher: %r\n' % m)) > > +if ui.verbose: > > +ui.write(('matcher: %r\n' % m)) > > > > nit: These two lines are equivalent to "ui.note(('matcher: %r\n' % m))", > except that that also adds a "ui.note" label. Use that method instead? Yeah, it could, but I'm not a fan of using note/status for data. At some point, I want to add a way to separate status/note/debug messages from data stream so that structured output (e.g. JSON/CBOR) won't be messed up. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D3636: py3: use pycompat.fsencode() to convert user value to bytes
pulkit abandoned this revision. pulkit added inline comments. INLINE COMMENTS > durin42 wrote in debugcommands.py:1403 > Should util.username() instead consistently return bytes? Yes, https://phab.mercurial-scm.org/D3706 did that. Abandoning this one. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D3636 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
[Bug 5915] New: clone --updaterev 'last(tag())' does not work
https://bz.mercurial-scm.org/show_bug.cgi?id=5915 Bug ID: 5915 Summary: clone --updaterev 'last(tag())' does not work Product: Mercurial Version: 4.6.1 Hardware: PC OS: Linux Status: UNCONFIRMED Severity: bug Priority: wish Component: Mercurial Assignee: bugzi...@mercurial-scm.org Reporter: z...@zash.se CC: mercurial-devel@mercurial-scm.org Someone wanted an easy way to get the latest release. Expecting clone --updaterev to work the same as clone + update, however: ~$ hg clone https://www.mercurial-scm.org/repo/hg-stable hg -u 'last(tag())' requesting all changes adding changesets adding manifests adding file changes added 37872 changesets with 71458 changes to 3014 files new changesets 9117c6561b0b:3c84493556db abort: unknown revision 'last(tag())'! ~$ ls hg/.hg/cache/ branch2-base ~$ hg -R hg up 'last(tag())' 1698 files updated, 0 files merged, 0 files removed, 0 files unresolved ~$ ls hg/.hg/cache/ branch2-base checkisexec* checklink@ checklink-target hgtagsfnodes1 tags2-visible -- You are receiving this mail because: You are on the CC list for the bug. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel