D5634: narrow: fix crash when restoring backup in legacy repo

2019-01-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  This is meant for the stable branch

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5634

To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5634: narrow: fix crash when restoring backup in legacy repo

2019-01-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Using --addremove when committing in an old repo (before we started
  keeping .hg/narrowspec.dirstate) results in a crash. The test
  case modified in this patch would crash like this:
  
abort: $ENOENT$
  
  The issue is that when the dirstateguard is aborted, it tries to
  restore the backup of .hg/narrowspec.dirstate. However, since we were
  in an old repo, that file did not get created when the dirstateguard
  was created. Note that the dirstateguard is not used unless
  --addremove is passed.
  
  This patch fixes the bug by making restorewcbackup() not fail if the
  backup doesn't exist. I also made clearwcbackup() safe, just in case.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5634

AFFECTED FILES
  mercurial/narrowspec.py
  tests/test-narrow-share.t

CHANGE DETAILS

diff --git a/tests/test-narrow-share.t b/tests/test-narrow-share.t
--- a/tests/test-narrow-share.t
+++ b/tests/test-narrow-share.t
@@ -166,7 +166,7 @@
   R d7/f
 Make it look like a repo from before narrow+share was supported
   $ rm .hg/narrowspec.dirstate
-  $ hg st
+  $ hg ci -Am test
   abort: working copy's narrowspec is stale
   (run 'hg tracked --update-working-copy')
   [255]
diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -190,12 +190,14 @@
 def restorewcbackup(repo, backupname):
 if repository.NARROW_REQUIREMENT not in repo.requirements:
 return
-util.rename(repo.vfs.join(backupname), repo.vfs.join(DIRSTATE_FILENAME))
+# It may not exist in old repos
+if repo.vfs.exists(backupname):
+util.rename(repo.vfs.join(backupname), 
repo.vfs.join(DIRSTATE_FILENAME))
 
 def clearwcbackup(repo, backupname):
 if repository.NARROW_REQUIREMENT not in repo.requirements:
 return
-repo.vfs.unlink(backupname)
+repo.vfs.tryunlink(backupname)
 
 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
 r""" Restricts the patterns according to repo settings,



To: martinvonz, 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 1 of 2 STABLE] help: modernize the example for command registration

2019-01-18 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1547871184 18000
#  Fri Jan 18 23:13:04 2019 -0500
# Branch stable
# Node ID 9b57d98e8fe910d033575fadeac91be1eae59f6f
# Parent  74525c3e9476db425024f1a8573e66f0473f7a81
help: modernize the example for command registration

diff --git a/mercurial/help/internals/extensions.txt 
b/mercurial/help/internals/extensions.txt
--- a/mercurial/help/internals/extensions.txt
+++ b/mercurial/help/internals/extensions.txt
@@ -28,11 +28,16 @@ registered to the ``cmdtable`` by ``@com
 
 Example using ``@command`` decorator (requires Mercurial 1.9)::
 
-from mercurial import cmdutil
 from mercurial.i18n import _
 
 cmdtable = {}
-command = cmdutil.command(cmdtable)
+try:
+from mercurial import registrar
+command = registrar.command(cmdtable)
+except (AttributeError, ImportError):
+# Fallback to hg < 4.3 support
+from mercurial import cmdutil
+command = cmdutil.command(cmdtable)
 
 @command('print-parents',
 [('s', 'short', None, _('print short form')),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2 STABLE] help: document the minimumhgversion variable for extensions

2019-01-18 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1547871776 18000
#  Fri Jan 18 23:22:56 2019 -0500
# Branch stable
# Node ID 60b24e6f514beb0552d8a979c882f2861ec84e49
# Parent  9b57d98e8fe910d033575fadeac91be1eae59f6f
help: document the minimumhgversion variable for extensions

diff --git a/mercurial/help/internals/extensions.txt 
b/mercurial/help/internals/extensions.txt
--- a/mercurial/help/internals/extensions.txt
+++ b/mercurial/help/internals/extensions.txt
@@ -313,6 +313,14 @@ error message if the extension produces 
 
 buglink = 'https://bitbucket.org/USER/REPO/issues'
 
+If an extension requires a minimum version of Mercurial, it can be declared
+with the ``minimumhgversion`` variable::
+
+minimumhgversion = '4.6'
+
+Older clients will print a warning that the extension requires a new version,
+instead of attempting to load it.
+
 Wrap up: what belongs where?
 
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5633: grep: use set instead of dict with dummy value

2019-01-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5633

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2926,7 +2926,7 @@
 fm.data(matched=False)
 fm.end()
 
-skip = {}
+skip = set()
 revfiles = {}
 match = scmutil.match(repo[None], pats, opts)
 found = False
@@ -2955,7 +2955,7 @@
 if copy:
 copies.setdefault(rev, {})[fn] = copy
 if fn in skip:
-skip[copy] = True
+skip.add(copy)
 continue
 files.append(fn)
 
@@ -2984,16 +2984,16 @@
 copy = copies.get(rev, {}).get(fn)
 if fn in skip:
 if copy:
-skip[copy] = True
+skip.add(copy)
 continue
 pstates = matches.get(parent, {}).get(copy or fn, [])
 if pstates or states:
 r = display(fm, fn, ctx, pstates, states)
 found = found or r
 if r and not diff and not all_files:
-skip[fn] = True
+skip.add(fn)
 if copy:
-skip[copy] = True
+skip.add(copy)
 del revfiles[rev]
 # We will keep the matches dict for the duration of the window
 # clear the matches dict once the window is over



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


mercurial@41292: 6 new changesets (3 on stable)

2019-01-18 Thread Mercurial Commits
6 new changesets (3 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/c0221d929eb9
changeset:   41287:c0221d929eb9
user:Martin von Zweigbergk 
date:Wed Jan 16 21:32:15 2019 -0800
summary: tests: suppress "Checked out 1 paths of " from modern git

https://www.mercurial-scm.org/repo/hg/rev/17941fc53ae9
changeset:   41288:17941fc53ae9
user:Martin von Zweigbergk 
date:Wed Jan 16 16:49:15 2019 -0800
summary: scmutil: drop unreachable except clause

https://www.mercurial-scm.org/repo/hg/rev/593f6359681d
changeset:   41289:593f6359681d
user:Boris Feld 
date:Thu Jan 10 14:57:01 2019 +0100
summary: update: fix edge-case with update.atomic-file and read-only files

https://www.mercurial-scm.org/repo/hg/rev/593718ff5844
changeset:   41290:593718ff5844
branch:  stable
tag: 4.9rc0
parent:  41146:fbd168455b26
parent:  41289:593f6359681d
user:Augie Fackler 
date:Fri Jan 18 13:28:22 2019 -0500
summary: merge default into stable for 4.9 release

https://www.mercurial-scm.org/repo/hg/rev/9c290711e175
changeset:   41291:9c290711e175
branch:  stable
user:Augie Fackler 
date:Fri Jan 18 13:32:00 2019 -0500
summary: Added tag 4.9rc0 for changeset 593718ff5844

https://www.mercurial-scm.org/repo/hg/rev/74525c3e9476
changeset:   41292:74525c3e9476
branch:  stable
bookmark:@
tag: tip
user:Augie Fackler 
date:Fri Jan 18 13:32:02 2019 -0500
summary: Added signature for changeset 593718ff5844

-- 
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


D5620: grep: don't look up copy info unless --follow is given

2019-01-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 13325.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5620?vs=13317=13325

REVISION DETAIL
  https://phab.mercurial-scm.org/D5620

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2945,17 +2945,18 @@
 fnode = ctx.filenode(fn)
 except error.LookupError:
 continue
-try:
-copied = flog.renamed(fnode)
-except error.WdirUnsupported:
-copied = ctx[fn].renamed()
-copy = follow and copied and copied[0]
-if copy:
-copies.setdefault(rev, {})[fn] = copy
-if fn in skip:
+copy = None
+if follow:
+try:
+copied = flog.renamed(fnode)
+except error.WdirUnsupported:
+copied = ctx[fn].renamed()
+copy = copied and copied[0]
 if copy:
-skip[copy] = True
-continue
+copies.setdefault(rev, {})[fn] = copy
+if fn in skip:
+skip[copy] = True
+continue
 files.append(fn)
 
 if fn not in matches[rev]:



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


D5632: setdiscovery: pass srvheads into partialdiscovery constructor

2019-01-18 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I found it hard to follow how disco._undecided was initialized (the
  call to disco.addbases(srvheads) caused the disco.undecided property
  to be access, which initialized disco._undecided). I think this patch
  makes it easier.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5632

AFFECTED FILES
  mercurial/setdiscovery.py

CHANGE DETAILS

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -173,11 +173,11 @@
 (all tracked revisions are known locally)
 """
 
-def __init__(self, repo, targetheads):
+def __init__(self, repo, targetheads, srvheads):
 self._repo = repo
 self._targetheads = targetheads
-self._common = repo.changelog.incrementalmissingrevs()
-self._undecided = None
+self._common = repo.changelog.incrementalmissingrevs(srvheads)
+self.undecided = set(self._common.missingancestors(self._targetheads))
 self.missing = set()
 
 def addcommons(self, commons):
@@ -212,14 +212,7 @@
 
 def iscomplete(self):
 """True if all the necessary data have been gathered"""
-return self._undecided is not None and not self._undecided
-
-@property
-def undecided(self):
-if self._undecided is not None:
-return self._undecided
-self._undecided = set(self._common.missingancestors(self._targetheads))
-return self._undecided
+return not self.undecided
 
 def commonheads(self):
 """the heads of the known common set"""
@@ -293,10 +286,9 @@
 
 # full blown discovery
 
-disco = partialdiscovery(local, ownheads)
 # treat remote heads (and maybe own heads) as a first implicit sample
 # response
-disco.addcommons(srvheads)
+disco = partialdiscovery(local, ownheads, srvheads)
 disco.addinfo(zip(sample, yesno))
 
 full = False



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


mercurial@41286: 15 new changesets

2019-01-18 Thread Mercurial Commits
15 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/71ef4e923886
changeset:   41272:71ef4e923886
user:Boris Feld 
date:Mon Jan 14 16:01:17 2019 +0100
summary: revsetbenchmarks: support revset starting with a "-"

https://www.mercurial-scm.org/repo/hg/rev/5409f7ec7850
changeset:   41273:5409f7ec7850
user:Boris Feld 
date:Sun Jan 13 22:24:11 2019 +0100
summary: revsetbenchmarks: add various examples around the 'heads()' revset

https://www.mercurial-scm.org/repo/hg/rev/4c6fdc7e2e7d
changeset:   41274:4c6fdc7e2e7d
user:Boris Feld 
date:Mon Jan 14 16:53:55 2019 +0100
summary: revset: inline parents computation to reuse the input argument

https://www.mercurial-scm.org/repo/hg/rev/1421d0487a61
changeset:   41275:1421d0487a61
user:Boris Feld 
date:Mon Jan 14 17:06:00 2019 +0100
summary: revlog: accept a revs argument in `headrevs`

https://www.mercurial-scm.org/repo/hg/rev/5affe1583e1d
changeset:   41276:5affe1583e1d
user:Boris Feld 
date:Mon Jan 14 17:10:51 2019 +0100
summary: revset: use changelog's `headrevs` method to compute heads

https://www.mercurial-scm.org/repo/hg/rev/61f9ef23a12f
changeset:   41277:61f9ef23a12f
user:Boris Feld 
date:Mon Jan 14 17:15:21 2019 +0100
summary: dagop: minor python optimization to `headrevs`

https://www.mercurial-scm.org/repo/hg/rev/41f14e8f335f
changeset:   41278:41f14e8f335f
user:Boris Feld 
date:Mon Jan 14 18:19:22 2019 +0100
summary: revsetbenchmark: add more example for roots usages

https://www.mercurial-scm.org/repo/hg/rev/c9e1104e6272
changeset:   41279:c9e1104e6272
user:Matt Harbison 
date:Thu Jan 17 00:16:00 2019 -0500
summary: exthelper: drop the addattr() decorator

https://www.mercurial-scm.org/repo/hg/rev/f4277a35c42c
changeset:   41280:f4277a35c42c
user:Boris Feld 
date:Fri Jan 04 16:04:48 2019 +0100
summary: discovery: compute newly discovered missing in a more efficient way

https://www.mercurial-scm.org/repo/hg/rev/183df3df6031
changeset:   41281:183df3df6031
user:Kyle Lippincott 
date:Wed Nov 07 15:45:09 2018 -0800
summary: resolve: fix mark-check when a file was deleted on one side 
(issue6020)

https://www.mercurial-scm.org/repo/hg/rev/4fab8a7d2d72
changeset:   41282:4fab8a7d2d72
user:Valentin Gatien-Baron 
date:Thu Jan 03 19:02:46 2019 -0500
summary: match: support rooted globs in hgignore

https://www.mercurial-scm.org/repo/hg/rev/4948b327d3b9
changeset:   41283:4948b327d3b9
user:Yuya Nishihara 
date:Thu Jan 10 21:29:24 2019 +0900
summary: cext: clang-format new code coming from stable branch

https://www.mercurial-scm.org/repo/hg/rev/b0e3f2d7c143
changeset:   41284:b0e3f2d7c143
user:Yuya Nishihara 
date:Wed Sep 26 21:29:13 2018 +0900
summary: ui: move protectedstdio() context manager from procutil

https://www.mercurial-scm.org/repo/hg/rev/cf8677cd7286
changeset:   41285:cf8677cd7286
user:Yuya Nishihara 
date:Wed Sep 26 21:41:52 2018 +0900
summary: ui: proxy protect/restorestdio() calls to update internal flag

https://www.mercurial-scm.org/repo/hg/rev/00b314c42094
changeset:   41286:00b314c42094
bookmark:@
tag: tip
user:Yuya Nishihara 
date:Sun Jan 13 14:56:26 2019 +0900
summary: revlog: document that mmap resources are released implicitly by GC

-- 
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 4 of 4] revset: no longer silently filter out invalid revision in _intlist (API) (BC)

2019-01-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1547826690 -3600
#  Fri Jan 18 16:51:30 2019 +0100
# Node ID 43543a826aab4e6495694f84e9197b903a7cbf10
# Parent  aa032edd96aeb34f8d220b11fbdbd08a9497cbc9
# EXP-Topic intlist
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
43543a826aab
revset: no longer silently filter out invalid revision in _intlist (API) (BC)

This change makes the fastpath (fullrepo case) evaluated first, so invalid
revision in the _intlist() entries will be simply forwarded to the lower layer
in this case. This is similar to what 'rawsmartet' does in the case where
"%ld" did not get serialized.

Further processing of the resulting smartset is likely to raise an error
because of the filtering.

It would be possible to strictly check for any invalid entry in the input
revs, but we have not decided on doing this yet.

This series focuses on having a consistent behavior for %d and %ld in all
cases.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2179,7 +2179,7 @@ def _orderedlist(repo, subset, x):
 for r in revs:
 if r in seen:
 continue
-if (r in subset or full and (r == nullrev or r == wdirrev)):
+if (full and (r == nullrev or r == wdirrev)) or r in subset:
 ls.append(r)
 seen.add(r)
 return baseset(ls)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 4] revset: add wdir support to _intlist

2019-01-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1547826678 -3600
#  Fri Jan 18 16:51:18 2019 +0100
# Node ID aa032edd96aeb34f8d220b11fbdbd08a9497cbc9
# Parent  35c9dec1849f6a41f87fdc130798387376bb8345
# EXP-Topic intlist
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
aa032edd96ae
revset: add wdir support to _intlist

The previous changeset made it clear that we did not supported the wdirrev in
_intlist. So we fix it.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2174,11 +2174,12 @@ def _orderedlist(repo, subset, x):
 
 full = isinstance(subset, fullreposet)
 nullrev = node.nullrev
+wdirrev = node.wdirrev
 
 for r in revs:
 if r in seen:
 continue
-if (r in subset or full and r == nullrev):
+if (r in subset or full and (r == nullrev or r == wdirrev)):
 ls.append(r)
 seen.add(r)
 return baseset(ls)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 4] revset: minor preparatory refactor in _orderedlist

2019-01-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1547818460 -3600
#  Fri Jan 18 14:34:20 2019 +0100
# Node ID 35c9dec1849f6a41f87fdc130798387376bb8345
# Parent  52d20e4fe2e3049eec58140fdcadb43528729b3d
# EXP-Topic intlist
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
35c9dec1849f
revset: minor preparatory refactor in _orderedlist

In order to enforce the new %ld behavior in the cases where _intlist
serialization is still used, we will have to update this function. We do first
some small changes that do not alter the semantic. They just introduce lookup
caching and some pre-computation.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2172,11 +2172,13 @@ def _orderedlist(repo, subset, x):
 except ValueError:
 revs = stringset(repo, subset, t, defineorder)
 
+full = isinstance(subset, fullreposet)
+nullrev = node.nullrev
+
 for r in revs:
 if r in seen:
 continue
-if (r in subset
-or r == node.nullrev and isinstance(subset, fullreposet)):
+if (r in subset or full and r == nullrev):
 ls.append(r)
 seen.add(r)
 return baseset(ls)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 6055] New: {latesttags} and friends raise a revspec parse error for uncommitted merges

2019-01-18 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6055

Bug ID: 6055
   Summary: {latesttags} and friends raise a revspec parse error
for uncommitted merges
   Product: Mercurial
   Version: default branch
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: bug
  Priority: normal
 Component: templater
  Assignee: bugzi...@mercurial-scm.org
  Reporter: matt_harbi...@yahoo.com
CC: mercurial-devel@mercurial-scm.org

It works fine for committed merges and normal commits.  But:

$ hg merge
$ hg id -T '{latesttag}+{changessincelatesttag}-{p1node}{dirty}' --traceback
Traceback (most recent call last):
  File "d:\mercurial\mercurial\scmutil.py", line 165, in callcatch
return func()
  File "d:\mercurial\mercurial\dispatch.py", line 367, in _runcatchfunc
return _dispatch(req)
  File "d:\mercurial\mercurial\dispatch.py", line 1021, in _dispatch
cmdpats, cmdoptions)
  File "d:\mercurial\mercurial\dispatch.py", line 756, in runcommand
ret = _runcommand(ui, options, cmd, d)
  File "d:\mercurial\mercurial\dispatch.py", line 1030, in _runcommand
return cmdfunc()
  File "d:\mercurial\mercurial\dispatch.py", line 1018, in 
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "d:\mercurial\mercurial\util.py", line 1670, in check
return func(*args, **kwargs)
  File "d:\mercurial\mercurial\commands.py", line 3311, in identify
fm.end()
  File "d:\mercurial\mercurial\formatter.py", line 435, in end
baseformatter.end(self)
  File "d:\mercurial\mercurial\formatter.py", line 239, in end
self._showitem()
  File "d:\mercurial\mercurial\formatter.py", line 418, in _showitem
self._renderitem(self._tref, item)
  File "d:\mercurial\mercurial\formatter.py", line 424, in _renderitem
self._out.write(self._t.render(ref, item))
  File "d:\mercurial\mercurial\templater.py", line 937, in render
return b''.join(self.generate(t, mapping))
  File "d:\mercurial\mercurial\util.py", line 1581, in increasingchunks
for chunk in source:
  File "d:\mercurial\mercurial\templateutil.py", line 721, in flatten
for i in thing:
  File "d:\mercurial\mercurial\templateutil.py", line 915, in runtemplate
yield evalrawexp(context, mapping, arg)
  File "d:\mercurial\mercurial\templateutil.py", line 769, in evalrawexp
return func(context, mapping, data)
  File "d:\mercurial\mercurial\templateutil.py", line 907, in runsymbol
return v(context, mapping)
  File "d:\mercurial\mercurial\templatekw.py", line 428, in showlatesttag
return showlatesttags(context, mapping, None)
  File "d:\mercurial\mercurial\templatekw.py", line 432, in showlatesttags
latesttags = getlatesttags(context, mapping, pattern)
  File "d:\mercurial\mercurial\templatekw.py", line 89, in getlatesttags
pdate, pdist, ptag = max(ptags, key=key)
  File "d:\mercurial\mercurial\templatekw.py", line 85, in key
ctx.rev(), x[2][0]))
  File "d:\mercurial\mercurial\localrepo.py", line 1365, in revs
tree = revsetlang.spectree(expr, *args)
  File "d:\mercurial\mercurial\revsetlang.py", line 697, in spectree
parsed = _parseargs(expr, args)
  File "d:\mercurial\mercurial\revsetlang.py", line 775, in _parseargs
raise error.ParseError(_('invalid argument for revspec'))
ParseError: invalid argument for revspec
hg: parse error: invalid argument for revspec

This was with 4.8.2+810-593f6359681d.  I didn't go back to see where it broke.

-- 
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


[PATCH 1 of 4] revset: introduce an internal `_rev` predicate for '%d' usage

2019-01-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1547817707 -3600
#  Fri Jan 18 14:21:47 2019 +0100
# Node ID 52d20e4fe2e3049eec58140fdcadb43528729b3d
# Parent  4fab8a7d2d72b4d50d1d647a015d33f64c1e2e4d
# EXP-Topic intlist
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
52d20e4fe2e3
revset: introduce an internal `_rev` predicate for '%d' usage

In 24a1f67bb75a, we aligned "%d" behavior on "%ld" one, invalid revisions got
silently ignored. However, soon after in 8aca89a694d4 and 26b0a7514f01, a side
effect changed the behavior of "%ld" to no longer silently filter invalid
revisions.

After discussion on the mailing list, it was decided to align on the new %ld
behavior:

https://www.mercurial-scm.org/pipermail/mercurial-devel/2019-January/127291.html


This changeset introduce a '_rev()' predicated that keep the benefit from
24a1f67bb75a while enforcing a more strict checking on the inputs.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1765,6 +1765,20 @@ def rev(repo, subset, x):
 return baseset()
 return subset & baseset([l])
 
+@predicate('_rev(number)', safe=True)
+def _rev(repo, subset, x):
+# internal version of "rev(x)" that raise error if "x" is invalid
+# i18n: "rev" is a keyword
+l = getargs(x, 1, 1, _("_rev requires one argument"))
+try:
+# i18n: "rev" is a keyword
+l = int(getstring(l[0], _("rev requires a number")))
+except (TypeError, ValueError):
+# i18n: "rev" is a keyword
+raise error.ParseError(_("rev expects a number"))
+repo.changelog.node(l) # check that the rev exists
+return subset & baseset([l])
+
 @predicate('revset(set)', safe=True, takeorder=True)
 def revsetpredicate(repo, subset, x, order):
 """Strictly interpret the content as a revset.
diff --git a/mercurial/revsetlang.py b/mercurial/revsetlang.py
--- a/mercurial/revsetlang.py
+++ b/mercurial/revsetlang.py
@@ -585,7 +585,7 @@ def _quote(s):
 
 def _formatargtype(c, arg):
 if c == 'd':
-return 'rev(%d)' % int(arg)
+return '_rev(%d)' % int(arg)
 elif c == 's':
 return _quote(arg)
 elif c == 'r':
@@ -663,9 +663,9 @@ def formatspec(expr, *args):
 >>> formatspec(b'%r:: and %lr', b'10 or 11', (b"this()", b"that()"))
 '(10 or 11):: and ((this()) or (that()))'
 >>> formatspec(b'%d:: and not %d::', 10, 20)
-'rev(10):: and not rev(20)::'
+'_rev(10):: and not _rev(20)::'
 >>> formatspec(b'%ld or %ld', [], [1])
-"_list('') or rev(1)"
+"_list('') or _rev(1)"
 >>> formatspec(b'keyword(%s)', b'foo\\xe9')
 "keyword('fooxe9')"
 >>> b = lambda: b'default'
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2 BACKOUT] mmap: backed out changeset 875d2af8cb4e

2019-01-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1547823817 -3600
#  Fri Jan 18 16:03:37 2019 +0100
# Node ID c25539844f6594804423565712959afc190c56d9
# Parent  452fc7c6bf18316b98d50789aef6fd744d04b47f
# EXP-Topic mmap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
c25539844f65
mmap: backed out changeset 875d2af8cb4e

There have been concrete and theoretical issues raised, this will need more
work during the next cycle.

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -556,6 +556,9 @@ coreconfigitem('experimental', 'maxdelta
 coreconfigitem('experimental', 'mergetempdirprefix',
 default=None,
 )
+coreconfigitem('experimental', 'mmapindexthreshold',
+default=None,
+)
 coreconfigitem('experimental', 'narrow',
 default=False,
 )
@@ -987,10 +990,6 @@ coreconfigitem('progress', 'width',
 coreconfigitem('push', 'pushvars.server',
 default=False,
 )
-coreconfigitem('storage', 'mmap-threshold',
-default=None,
-alias=[('experimental', 'mmapindexthreshold')],
-)
 coreconfigitem('rewrite', 'backup-bundle',
 default=True,
 alias=[('ui', 'history-editing-backup')],
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -758,7 +758,8 @@ def resolverevlogstorevfsoptions(ui, req
 if 0 <= chainspan:
 options[b'maxdeltachainspan'] = chainspan
 
-mmapindexthreshold = ui.configbytes(b'storage', b'mmap-threshold')
+mmapindexthreshold = ui.configbytes(b'experimental',
+b'mmapindexthreshold')
 if mmapindexthreshold is not None:
 options[b'mmapindexthreshold'] = mmapindexthreshold
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 BACKOUT] mmap: backed out changeset 74a9f428227e

2019-01-18 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1547823746 -3600
#  Fri Jan 18 16:02:26 2019 +0100
# Node ID 452fc7c6bf18316b98d50789aef6fd744d04b47f
# Parent  593f6359681dd59d5fbea690a203e09da10d7d4a
# EXP-Topic mmap
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
452fc7c6bf18
mmap: backed out changeset 74a9f428227e

There have been concrete and theoretical issues raised, this will need more
work during the next cycle.

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -988,7 +988,7 @@ coreconfigitem('push', 'pushvars.server'
 default=False,
 )
 coreconfigitem('storage', 'mmap-threshold',
-default='1MB',
+default=None,
 alias=[('experimental', 'mmapindexthreshold')],
 )
 coreconfigitem('rewrite', 'backup-bundle',
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@41271: 5 new changesets

2019-01-18 Thread Mercurial Commits
5 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/e30eef62e743
changeset:   41267:e30eef62e743
user:Pulkit Goyal 
date:Wed Jan 16 23:44:08 2019 +0530
summary: py3: add 10 more passing tests caught by ratchet

https://www.mercurial-scm.org/repo/hg/rev/878084a495ef
changeset:   41268:878084a495ef
user:Matt Harbison 
date:Wed Jan 16 21:54:16 2019 -0500
summary: tests: also skip remotefilelog *.py tests on Windows

https://www.mercurial-scm.org/repo/hg/rev/8b7973d40a01
changeset:   41269:8b7973d40a01
user:Martin von Zweigbergk 
date:Wed Jan 16 16:55:52 2019 -0800
summary: bdiff: drop duplicate definition of splitnewlines()

https://www.mercurial-scm.org/repo/hg/rev/10a3e87b
changeset:   41270:10a3e87b
user:Augie Fackler 
date:Wed Jan 16 11:42:50 2019 -0500
summary: py3: test*gendoc*.t passes on Python 3

https://www.mercurial-scm.org/repo/hg/rev/774b5195fac6
changeset:   41271:774b5195fac6
bookmark:@
tag: tip
user:Augie Fackler 
date:Thu Jan 17 04:35:33 2019 -0500
summary: py3: two more passing tests from the ratchet

-- 
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


mercurial@41266: 32 new changesets

2019-01-18 Thread Mercurial Commits
32 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/a2ae27993e16
changeset:   41235:a2ae27993e16
user:Martin von Zweigbergk 
date:Sat Dec 29 23:09:07 2018 -0800
summary: narrow: drop now-unnecessary reassignment of repo attributes

https://www.mercurial-scm.org/repo/hg/rev/44a51c1c8e17
changeset:   41236:44a51c1c8e17
user:Martin von Zweigbergk 
date:Sat Dec 29 23:40:18 2018 -0800
summary: narrow: move copytonarrowspec() out of setnarrowpats()

https://www.mercurial-scm.org/repo/hg/rev/ad9ab2523149
changeset:   41237:ad9ab2523149
user:Martin von Zweigbergk 
date:Fri Dec 21 10:05:37 2018 -0800
summary: narrow: reuse narrowspec.updateworkingcopy() when widening

https://www.mercurial-scm.org/repo/hg/rev/8c366af085f4
changeset:   41238:8c366af085f4
user:Martin von Zweigbergk 
date:Sun Dec 30 00:15:38 2018 -0800
summary: narrow: reuse narrowspec.updateworkingcopy() when narrowing

https://www.mercurial-scm.org/repo/hg/rev/26b0a7514f01
changeset:   41239:26b0a7514f01
user:Boris Feld 
date:Tue Jan 15 20:24:17 2019 +0100
summary: revset: transparently forward _intlist argument in all case

https://www.mercurial-scm.org/repo/hg/rev/ff333620a4cc
changeset:   41240:ff333620a4cc
user:Georges Racinet 
date:Sat Jan 12 16:57:04 2019 +0100
summary: rust-cpython: moved generic conversion fn out of ancestors module

https://www.mercurial-scm.org/repo/hg/rev/168041fa6d5f
changeset:   41241:168041fa6d5f
user:Georges Racinet 
date:Mon Jan 14 20:42:25 2019 +0100
summary: rust: factorized testing Graphs

https://www.mercurial-scm.org/repo/hg/rev/47881d2a9d99
changeset:   41242:47881d2a9d99
user:Georges Racinet on ishtar.racinet.fr 
date:Mon Jan 14 10:07:48 2019 +0100
summary: rust: dagop.headrevs() Rust counterparts

https://www.mercurial-scm.org/repo/hg/rev/5257e6299d4c
changeset:   41243:5257e6299d4c
user:Georges Racinet 
date:Mon Jan 14 17:46:14 2019 +0100
summary: rust-cpython: set conversion for MissingAncestors.bases()

https://www.mercurial-scm.org/repo/hg/rev/4856c9b8cbaf
changeset:   41244:4856c9b8cbaf
user:Georges Racinet 
date:Mon Jan 14 18:36:09 2019 +0100
summary: ancestor: incrementalmissingancestors.basesheads()

https://www.mercurial-scm.org/repo/hg/rev/2a8782cc2e16
changeset:   41245:2a8782cc2e16
user:Georges Racinet 
date:Mon Jan 14 18:52:01 2019 +0100
summary: discovery: using the new basesheads()

https://www.mercurial-scm.org/repo/hg/rev/619ee4039bd4
changeset:   41246:619ee4039bd4
user:Georges Racinet 
date:Mon Jan 14 17:07:39 2019 +0100
summary: rust: MissingAncestors.basesheads()

https://www.mercurial-scm.org/repo/hg/rev/a89b20a49c13
changeset:   41247:a89b20a49c13
user:Georges Racinet 
date:Fri Nov 30 14:35:57 2018 +0100
summary: rust-cpython: using MissingAncestors from Python code

https://www.mercurial-scm.org/repo/hg/rev/312afd164009
changeset:   41248:312afd164009
user:Augie Fackler 
date:Wed Jan 16 10:55:42 2019 -0500
summary: remotefilelog: do file IO in terms of bytes

https://www.mercurial-scm.org/repo/hg/rev/c891a11ffe27
changeset:   41249:c891a11ffe27
user:Augie Fackler 
date:Wed Jan 16 10:56:15 2019 -0500
summary: basepack: avoid 'rbe' mode in Python 3

https://www.mercurial-scm.org/repo/hg/rev/8a6995513d9a
changeset:   41250:8a6995513d9a
user:Augie Fackler 
date:Wed Jan 16 10:57:38 2019 -0500
summary: remotefilelog: fix logging in retry decorator

https://www.mercurial-scm.org/repo/hg/rev/beb0d944a99b
changeset:   41251:beb0d944a99b
user:Augie Fackler 
date:Wed Jan 16 10:58:09 2019 -0500
summary: remotefilelog: implement __bool__ as well as __nonzero__ for py3

https://www.mercurial-scm.org/repo/hg/rev/a495435d980e
changeset:   41252:a495435d980e
user:Augie Fackler 
date:Wed Jan 16 10:58:31 2019 -0500
summary: tests: make python oneliner portable to python 3 in remotefilelog 
test

https://www.mercurial-scm.org/repo/hg/rev/29996f6c2687
changeset:   41253:29996f6c2687
user:Augie Fackler 
date:Wed Jan 16 10:59:09 2019 -0500
summary: tests: add missing b prefixes in remotefilelog-getflogheads.py

https://www.mercurial-scm.org/repo/hg/rev/2888d12b80a6
changeset:   41254:2888d12b80a6
user:Augie Fackler 
date:Wed Jan 16 10:59:32 2019 -0500
summary: tests: fix up uses of xrange in remotefilelog tests for py3

https://www.mercurial-scm.org/repo/hg/rev/60b3edccf2f7
changeset:   41255:60b3edccf2f7
user:Augie Fackler 
date:Wed Jan 16 11:00:10 2019 -0500
summary: remotefilelog: use list comprehension instead of filter for py3 
portability

https://www.mercurial-scm.org/repo/hg/rev/ebda5d4265ec
changeset:   41256:ebda5d4265ec
user:Augie Fackler 
date:

Re: [PATCH 4 of 8] revset: enforce "%d" to be interpreted as literal revision number (API)

2019-01-18 Thread Boris FELD

On 18/01/2019 13:26, Yuya Nishihara wrote:
>> On Thu, Jan 17, 2019, 11:32 Boris FELD  wrote:
>>> On 13/01/2019 10:12, Yuya Nishihara wrote:
 On Sun, 13 Jan 2019 08:37:47 +0100, Boris FELD wrote:
> On 12/01/2019 05:04, Yuya Nishihara wrote:
>> On Fri, 11 Jan 2019 12:29:06 +0100, Boris Feld wrote:
>>> # HG changeset patch
>>> # User Boris Feld 
>>> # Date 1547130238 -3600
>>> #  Thu Jan 10 15:23:58 2019 +0100
>>> # Node ID 38733dd8559578267617514a42f253efabb6
>>> # Parent  427247e84e29c144321d21a825d371458b5d3e1a
>>> # EXP-Topic revs-efficiency
>>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>>> #  hg pull https://bitbucket.org/octobus/mercurial-devel/
>>> -r 38733dd85595
>>> revset: enforce "%d" to be interpreted as literal revision number
>>> (API)
>> New behavior looks saner. Please also flag this as (BC). It's exposed
>>> as
>> revset() template function.
>>
>>>  %r = revset expression, parenthesized
>>> -%d = int(arg), no quoting
>>> +%d = rev(int(arg)), no quoting
>> 'rev(n)' returns an empty set if n is out of range, whereas 'n' aborts.
>> Suppose it's pretty much a coding error to pass in an invalid revision
>>> to
>> repo.revs(), we'll probably want aborts.
>>
>> Maybe we'll need an internal '_rev()' function?
> %ld silently pass on these too, so I would rather have %ld and %d
> consistent here (and align on the silence %ld behavior).
 Indeed. I never thought %ld would behave in such way. Consistent behavior
 should be better.
>>> Through some buggy revset usage in evolve we discovered that the
>>> optimization to passthrough input directly for %ld changed this
>>> behavior. In these cases, the revisions are passed as is and
>>> filtered/out-of-bound revision raise their usual error.
>>>
>>> Reintroducing the silent filtering behavior for %ld seems possible (it
>>> will have a performance impact, but still faster than the previous
>>> serialization).
>>>
>>> However, it is probably more efficient and saner to have these errors
>>> raised. In this case, we should align all %ld case and %d behaviors on
>>> the error raising version. What do you think?
> On Thu, 17 Jan 2019 12:36:50 -0800, Martin von Zweigbergk wrote:
>> Makes sense to me. That's how it would work on the command line too.
> +1

I dunno if we should go the whole way and manually check that every
single input is valid, or if we should just forward the faulty input and
let lower level user crash as expected?

Doing the manual is more thoughtful, but also more expensive and will
defeat revset laziness in multiple cases.

Since this is mostly an internal API, I feel like the "forward and let
other complains" is better.
However as a side effect, it means that invalid inputs might go
unnoticed because they are filtered by the previous subset: For example
→ "1000:2000 and %ld" % [1500, 99], with 999 being invalid will
simply return [1500] as 99 is not included in 1000:2000

In the 5.0 cycle, we could try to have some better tracking of "sane"
inputs that don't need filtering and the one who does. We can also
improve the performance impact of this filtering.

Series coming to implement the "simple" approach. It is anyway a
pre-requires for the more strict approach.
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 4 of 4] mmapindex: set default to 1MB

2019-01-18 Thread Boris FELD

On 18/01/2019 13:32, Yuya Nishihara wrote:
> On Wed, 16 Jan 2019 15:23:57 +0100, Boris FELD wrote:
>> On 11/01/2019 15:46, Yuya Nishihara wrote:
>>> On Fri, 11 Jan 2019 09:59:49 +0100, Boris FELD wrote:
 On 11/01/2019 01:05, Gregory Szorc wrote:
> On Thu, Jan 10, 2019 at 9:03 AM Boris FELD  > wrote:
>
> On 08/01/2019 15:41, Yuya Nishihara wrote:
> > On Mon, 7 Jan 2019 09:45:32 +0100, Boris FELD wrote:
> >> On 03/01/2019 09:58, Yuya Nishihara wrote:
> >>> On Wed, 2 Jan 2019 23:40:11 +0100, Boris FELD wrote:
>  On 04/12/2018 12:09, Yuya Nishihara wrote:
> > On Sun, 02 Dec 2018 17:17:43 +0100, Boris Feld wrote:
> >> # HG changeset patch
> >> # User Boris Feld  >
> >> # Date 1542949784 -3600
> >> #      Fri Nov 23 06:09:44 2018 +0100
> >> # Node ID 9708243274585f9544c70925eb0b0fa0ec7aba4f
> >> # Parent  0fff68dfbe48d87dce8b8736c0347ed5aa79030e
> >> # EXP-Topic mmap
> >> # Available At https://bitbucket.org/octobus/mercurial-devel/
> >> #              hg pull
> https://bitbucket.org/octobus/mercurial-devel/ -r 970824327458
> >> mmapindex: set default to 1MB
> > Can you check if strip/rollback properly copy the revlog
> before truncating it?
> >
> > If a mmapped revlog is truncated by another process, the
> mapped memory could be
> > invalid. The worst case, the process would be killed by SIGBUS.
>  Hum good catch, process reading a repository being stripped
> have always
>  been up for troubles. However, mmap makes it worse by raising
> a signal
>  instead of just having wonky seek. It also introduces new
> cases where
>  this can happen.
> >>> mmap isn't worse because of SIGBUS, but because the index data
> can be updated
> >>> after the index length is determined. Before, a single
> in-memory revlog index
> >>> was at least consistent.
> >>>
>  What shall we do here, I guess our best bet is to intercept
> these SIGBUS
>  when reading revlog index?
> >> Yes, but it would be inconsistent with the data it was pointing to.
> >> Access to this data would result in error too.
> > Correct.
> >
> >> The new thing is that we
> >> can get SIGBUS while accessing the index data themselves, as
> you are
> >> pointing out.
> > Another new thing is that truncated revisions can be seen as
> valid changesets
> > of '000...' hash with 0-length text. If the whole (or maybe
> dozens of)
> > revisions were truncated, SIGBUS would be raised. In other
> cases, the truncated
> > part would probably be read as zeros.
> >
> >>> I don't think it'll be easy to handle SIGBUS properly. And
> SIGBUS won't always
> >>> be raised. Perhaps, the easiest solution is to copy the revlog
> index before
> >>> strip/rollback.
> >> I'm afraid at the performance impact, we are talking of potentially
> >> hundreds of MB of index data to be rolled back.
> >>
> >> Maybe we can keep the current truncation in normal transaction
> rollback
> >> and use the slower copies for the hg strip command itself (and
> rewrite)?
> >>
> >> However, I'm afraid we need to come up with a solution for mmap
> as it
> >> would be useful to use it more and more.
> >>
> >> Maybe we can come up with something catching the SIGBUS? Or
> maybe we
> >> need to never truncate files and keep an alternative way to
> track the
> >> maximum offset? Any other ideas?
> > I've no idea. My point is that catching SIGBUS wouldn't save us
> from many
> > possible failures.
> >
> >>> IIRC, the mmap implementation was highly experimental. I don't
> know if it's
> >>> widely tested other than in FB where strip is never used.
> >> We have been using it internally, and one of our clients
> deployed it
> >> too. It results in significant speed and memory improvement.
> > Yup. I'm just afraid of enabling it by default.
>
> Ok, what do you think we should do for 4.9?
>
>
> We're introducing a new repo requirement in 4.9 for sparse revlogs.
 We are not introducing a new repo requirement in 4.9 for sparse-revlogs.
 The repo-requirements and its guarantees have been introduced in 4.7.
> I believe this strip problem (along with a ton of other problems) goes
> away if we have reader locks on repos.
>

D5594: copies: consider nullrev a common ancestor

2019-01-18 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   There are definitely repositories in the wild where p1 is nullrev (and p2 
is not). It's unusual but expressable so, of course, it happened.
  >   
  >   For that matters, there is also case with nullrev != p1 && p1 == p2.
  
  Well, I think it should be considered a sort of corruption. context.py for
  example would go wrong.
  
  Maybe we can add some check to "hg verify".

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5594

To: martinvonz, #hg-reviewers
Cc: lothiraldan, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5594: copies: consider nullrev a common ancestor

2019-01-18 Thread Yuya Nishihara
>   There are definitely repositories in the wild where p1 is nullrev (and p2 
> is not). It's unusual but expressable so, of course, it happened.
>   
>   For that matters, there is also case with nullrev != p1 && p1 == p2.

Well, I think it should be considered a sort of corruption. context.py for
example would go wrong.

Maybe we can add some check to "hg verify".
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH V6] revset: support ranges in #generations relation

2019-01-18 Thread Yuya Nishihara
On Fri, 18 Jan 2019 17:56:33 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov 
> # Date 1547564229 -28800
> #  Tue Jan 15 22:57:09 2019 +0800
> # Node ID 6069a3fcef9b0f9e80cd884c38f6a9e2a35e757a
> # Parent  8aca89a694d4bd7d25877b3652fb83e187ea1802
> revset: support ranges in #generations relation

> +>>> _splitrange(0, 0)# [0:0]
> +([None, None], [0, 1])

Ancestors should be preferred. Computing descendants is way expensive.
I should pointed out it before, sorry.

> +if a is None or a < 0:
> +if b is None or b >= 0:
> +if b == 0:
> +depths[0][0] = 0
> +else:
> +depths[0][0] = 1
> +else:
> +depths[0][0] = -b
> +if a is None:
> +depths[0][1] = None
> +else:
> +depths[0][1] = -a + 1
> +
> +if b is None or b > 0 or (a == 0 and b == 0):
> +if a is None or a < 0:
> +depths[1][0] = 0
> +else:
> +depths[1][0] = a
> +if b is None:
> +depths[1][1] = None
> +else:
> +depths[1][1] = b + 1
> +
> +return depths

Playing with this for a while, I came to think that we should first replace
None with saner integer value.

if a is None:
a = -(dagop._maxlogdepth - 1)
if b is None:
b = +(dagop._maxlogdepth - 1)

We have to make maxlogdepth public, and fix dagop.revdescendats() to map it
to fast path, but eliminating None will greatly simplify the function:

anc = dec = None
if a == b == 0:
anc = (0, 1)
if a < 0:
anc = (-min(b, 0), -a + 1)
if b > 0:
dec = (max(a, 0), b + 1)
return anc, dec

> +def generationsrel(repo, subset, x, rel, a, b, order):
> +# TODO: rewrite tests, and drop startdepth argument from ancestors() and
> +# descendants() predicates
> +depths = _splitrange(a, b)
> +ancstart, ancstop = depths[0]
> +descstart, descstop = depths[1]
> +
> +if ancstart is not None and descstart is not None:
> +return (_ancestors(repo, subset, x, False, ancstart, ancstop) +
> +_descendants(repo, subset, x, False, descstart, descstop))
> +elif ancstart is not None:
> +return _ancestors(repo, subset, x, False, ancstart, ancstop)
> +elif descstart is not None:
> +return _descendants(repo, subset, x, False, descstart, descstop)
> +
> +return baseset()

As a follow-up, it's better to not evaluate 'x' twice.

  heads = getset(repo, fullreposet(repo), x)
  ...
  anc = dagop.revancestors(...)
  dec = dagop.revdescendats(...)
  return subset & (anc + dec)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5594: copies: consider nullrev a common ancestor

2019-01-18 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  In https://phab.mercurial-scm.org/D5594#83078, @yuja wrote:
  
  > >   I've seen many bugs in the git codebase that were caused by it not
  > >   having a null revision and being forced to treat root commits
  > >   differently. Mercurial has a null revision and I think it's generally
  > >   a bug to treat it differently from other commits in graph algorithms.
  >
  > I agree with that, but I don't think every non-merge revision (p2 = null)
  >  should be considered a direct child of null revision.
  >
  > > @@ -65,8 +63,6 @@
  > > 
  > >   else:
  > >   parents = cl.parentrevs(r)
  >
  > Here `parents[1]` may be `nullrev`. Is that expected?
  >
  > >   for p in parents:
  > > 
  > > - if p < 0:
  > > - continue
  
  
  There are definitely repositories in the wild where p1 is nullrev (and p2 is 
not). It's unusual but expressable so, of course, it happened.
  
  For that matters, there is also case with nullrev != p1 && p1 == p2.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5594

To: martinvonz, #hg-reviewers
Cc: lothiraldan, yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 6 of 7] strip: introduce a soft strip option

2019-01-18 Thread Boris FELD
On 10/01/2019 19:49, Augie Fackler wrote:
>
>> On Jan 10, 2019, at 12:24, Boris FELD  wrote:
>>
>>
>>
>> On 07/01/2019 22:19, Augie Fackler wrote:
>>>
 On Jan 4, 2019, at 08:09, Pulkit Goyal <7895pul...@gmail.com> wrote:



 On Fri, Jan 4, 2019 at 4:31 AM Augie Fackler  wrote:


> On Jan 3, 2019, at 10:23 AM, Pulkit Goyal <7895pul...@gmail.com> wrote:
>
>
>
> On Thu, Jan 3, 2019 at 4:14 AM Boris Feld  wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1539697680 -7200
> #  Tue Oct 16 15:48:00 2018 +0200
> # Node ID a82909c0da7cc07ea1a46690ffc08e45ebc14af6
> # Parent  65488c7d2e933cdb2ab1c36b3887a8a67a24fc60
> # EXP-Topic archived-phase-UX
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> a82909c0da7c
> strip: introduce a soft strip option
>
> This is the first user-accessible way to use the archived phase 
> introduced in
> 4.8. This implements a feature implemented during the Stockholm sprint. 
> The
> archived phase behave as stripping, changesets are no longer accessible, 
> but
> pulling/unbundling them will make then reappear. The only notable 
> difference
> is that unlike hard stripping, soft stripping does not affect obsmarkers.
 I’m not thrilled with this: I had envisioned the archived state as not 
 full of garbage, but full of things that might merit revisiting some day. 
 When I strip (or prune it) it’s usually a dead end, whereas I’d like a way 
 to say “this isn’t interesting now, but it might be again some day”.

 I have no idea if I’m in the minority, and I know this is very late 
 feedback (because of the holidays I haven’t been at a computer much) but 
 hopefully it’s useful.

 Interesting idea.

 According to my understanding of discussion happened during sprint, we 
 want to use phases to make strip command and stripping less bad. I like 
 that goal and very much want us to move in that direction.

 Talking about your idea, we might need a phase for things which merit 
 revisiting someday. Do you mean that archived phase should be used for 
 that and we should use some other phase for stripping?
>>> Yes, STRIPPED would be more like INTERNAL (all garbage, fine to delete), 
>>> whereas ARCHIVED would be "please don't delete this, but hide it by 
>>> default". Does that make sense?
>>>
>>> (I fully acknowledge I kind of am asking for a pony here.)
>> The INTERNAL phase is for internal use only to hide the byproducts commits 
>> of hg commands (eg shelve). No user-created commit should end up in the 
>> INTERNAL phase.
>>
>> Using the ARCHIVED phase now is a nice trick to make history rewriting 
>> commands faster until obsolescence is activated by default. Once 
>> obsolescence is activated by default, the pony you described should be 
>> yours. In the mean-time, I would prefer not to introduce a third phase that 
>> we would have around forever.
> I guess I was confused by the placement of this functionality in the `strip` 
> command then. I'm not sure where else to put it (given that we already burned 
> the `archive` name for making zipfiles etc.) but maybe strip (-> destroy this 
> change please) is a suboptimal place.
>
> I guess if we mark it as experimental so we can move it later, that seems 
> fine.
>
> (Do I have a more correct understanding now? I think I was talking past the 
> intent here...)
Yes you have the correct understanding, the archived phase is designed
to be used in-place of obs-markers when obs-markers are disabled.

When activating the experimental option
`experimental.cleanup-as-archived` it will be transparent for users and
rewriting commands.

All the code and options are experimental so we can modify it as we want
in the future.


>
>>> ___
>>> 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
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] rust-cpython: using rustext.dagop.headrevs in revlog

2019-01-18 Thread Yuya Nishihara
On Fri, 18 Jan 2019 12:33:43 +0100, Georges Racinet wrote:
> On 1/17/19 2:40 PM, Yuya Nishihara wrote:
> > On Wed, 16 Jan 2019 19:15:09 +0100, Georges Racinet wrote:
> >> # HG changeset patch
> >> # User Georges Racinet 
> >> # Date 1547651966 -3600
> >> #  Wed Jan 16 16:19:26 2019 +0100
> >> # Node ID 234c106610004aff294268ccda82238164f91f64
> >> # Parent  f32e7d90db76879096f216f23ebbe75772b0201e
> >> # EXP-Topic revset.predicates
> >> rust-cpython: using rustext.dagop.headrevs in revlog
> >> --- a/mercurial/revlog.py  Thu Jan 10 18:25:18 2019 +0100
> >> +++ b/mercurial/revlog.py  Wed Jan 16 16:19:26 2019 +0100
> >> @@ -1108,6 +1108,8 @@
> >>  return self.index.headrevs()
> >>  except AttributeError:
> >>  return self._headrevs()
> >> +if rustext is not None:
> >> +return rustext.dagop.headrevs(self.index, revs)
> >>  return dagop.headrevs(revs, self.parentrevs)
> > (CC: Boris)
> > Are we sure the given revs are not filtered?
> 
> I just to talked to him directly about that, and the bottom line is that
> no, it isn't.
> 
> I'm working right now on a v2 that will prefilter from changelog on
> input revisions. In order not to take risks with the performance in the
> pure Python case, I may have to pass a flag directly (we'll see).

Let's postpone it for 5.0 cycle. There are many unprocessed patches.

I think we can copy adbf8ca239e4, which filters input revs and uses
unfiltered parentrevs() instead.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 4 of 4] mmapindex: set default to 1MB

2019-01-18 Thread Yuya Nishihara
On Wed, 16 Jan 2019 15:23:57 +0100, Boris FELD wrote:
> On 11/01/2019 15:46, Yuya Nishihara wrote:
> > On Fri, 11 Jan 2019 09:59:49 +0100, Boris FELD wrote:
> >> On 11/01/2019 01:05, Gregory Szorc wrote:
> >>> On Thu, Jan 10, 2019 at 9:03 AM Boris FELD  >>> > wrote:
> >>>
> >>> On 08/01/2019 15:41, Yuya Nishihara wrote:
> >>> > On Mon, 7 Jan 2019 09:45:32 +0100, Boris FELD wrote:
> >>> >> On 03/01/2019 09:58, Yuya Nishihara wrote:
> >>> >>> On Wed, 2 Jan 2019 23:40:11 +0100, Boris FELD wrote:
> >>>  On 04/12/2018 12:09, Yuya Nishihara wrote:
> >>> > On Sun, 02 Dec 2018 17:17:43 +0100, Boris Feld wrote:
> >>> >> # HG changeset patch
> >>> >> # User Boris Feld  >>> >
> >>> >> # Date 1542949784 -3600
> >>> >> #      Fri Nov 23 06:09:44 2018 +0100
> >>> >> # Node ID 9708243274585f9544c70925eb0b0fa0ec7aba4f
> >>> >> # Parent  0fff68dfbe48d87dce8b8736c0347ed5aa79030e
> >>> >> # EXP-Topic mmap
> >>> >> # Available At https://bitbucket.org/octobus/mercurial-devel/
> >>> >> #              hg pull
> >>> https://bitbucket.org/octobus/mercurial-devel/ -r 970824327458
> >>> >> mmapindex: set default to 1MB
> >>> > Can you check if strip/rollback properly copy the revlog
> >>> before truncating it?
> >>> >
> >>> > If a mmapped revlog is truncated by another process, the
> >>> mapped memory could be
> >>> > invalid. The worst case, the process would be killed by SIGBUS.
> >>>  Hum good catch, process reading a repository being stripped
> >>> have always
> >>>  been up for troubles. However, mmap makes it worse by raising
> >>> a signal
> >>>  instead of just having wonky seek. It also introduces new
> >>> cases where
> >>>  this can happen.
> >>> >>> mmap isn't worse because of SIGBUS, but because the index data
> >>> can be updated
> >>> >>> after the index length is determined. Before, a single
> >>> in-memory revlog index
> >>> >>> was at least consistent.
> >>> >>>
> >>>  What shall we do here, I guess our best bet is to intercept
> >>> these SIGBUS
> >>>  when reading revlog index?
> >>> >> Yes, but it would be inconsistent with the data it was pointing to.
> >>> >> Access to this data would result in error too.
> >>> > Correct.
> >>> >
> >>> >> The new thing is that we
> >>> >> can get SIGBUS while accessing the index data themselves, as
> >>> you are
> >>> >> pointing out.
> >>> > Another new thing is that truncated revisions can be seen as
> >>> valid changesets
> >>> > of '000...' hash with 0-length text. If the whole (or maybe
> >>> dozens of)
> >>> > revisions were truncated, SIGBUS would be raised. In other
> >>> cases, the truncated
> >>> > part would probably be read as zeros.
> >>> >
> >>> >>> I don't think it'll be easy to handle SIGBUS properly. And
> >>> SIGBUS won't always
> >>> >>> be raised. Perhaps, the easiest solution is to copy the revlog
> >>> index before
> >>> >>> strip/rollback.
> >>> >> I'm afraid at the performance impact, we are talking of potentially
> >>> >> hundreds of MB of index data to be rolled back.
> >>> >>
> >>> >> Maybe we can keep the current truncation in normal transaction
> >>> rollback
> >>> >> and use the slower copies for the hg strip command itself (and
> >>> rewrite)?
> >>> >>
> >>> >> However, I'm afraid we need to come up with a solution for mmap
> >>> as it
> >>> >> would be useful to use it more and more.
> >>> >>
> >>> >> Maybe we can come up with something catching the SIGBUS? Or
> >>> maybe we
> >>> >> need to never truncate files and keep an alternative way to
> >>> track the
> >>> >> maximum offset? Any other ideas?
> >>> > I've no idea. My point is that catching SIGBUS wouldn't save us
> >>> from many
> >>> > possible failures.
> >>> >
> >>> >>> IIRC, the mmap implementation was highly experimental. I don't
> >>> know if it's
> >>> >>> widely tested other than in FB where strip is never used.
> >>> >> We have been using it internally, and one of our clients
> >>> deployed it
> >>> >> too. It results in significant speed and memory improvement.
> >>> > Yup. I'm just afraid of enabling it by default.
> >>>
> >>> Ok, what do you think we should do for 4.9?
> >>>
> >>>
> >>> We're introducing a new repo requirement in 4.9 for sparse revlogs.
> >> We are not introducing a new repo requirement in 4.9 for sparse-revlogs.
> >> The repo-requirements and its guarantees have been introduced in 4.7.
> >>> I believe this strip problem (along with a ton of other problems) goes
> >>> away if we have reader locks on repos.
> >>>
> >>> Since we are already introducing a new 

D5626: scmutil: drop unreachable except clause

2019-01-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG17941fc53ae9: scmutil: drop unreachable except clause 
(authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5626?vs=13309=13323#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5626?vs=13309=13323

REVISION DETAIL
  https://phab.mercurial-scm.org/D5626

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -12,7 +12,6 @@
 import hashlib
 import os
 import re
-import socket
 import subprocess
 import weakref
 
@@ -270,8 +269,6 @@
 # Commands shouldn't sys.exit directly, but give a return code.
 # Just in case catch this and and pass exit code to caller.
 return inst.code
-except socket.error as inst:
-ui.error(_("abort: %s\n") % stringutil.forcebytestr(inst.args[-1]))
 
 return -1
 



To: martinvonz, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5625: tests: suppress "Checked out 1 paths of " from modern git

2019-01-18 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc0221d929eb9: tests: suppress Checked out 1 paths of 
hash from modern git (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5625?vs=13308=13322

REVISION DETAIL
  https://phab.mercurial-scm.org/D5625

AFFECTED FILES
  tests/test-convert-git.t

CHANGE DETAILS

diff --git a/tests/test-convert-git.t b/tests/test-convert-git.t
--- a/tests/test-convert-git.t
+++ b/tests/test-convert-git.t
@@ -750,7 +750,7 @@
 test missing .gitmodules
 
   $ git submodule add ../git-repo4 >/dev/null 2>/dev/null
-  $ git checkout HEAD .gitmodules
+  $ git checkout HEAD -- .gitmodules
   $ git rm .gitmodules
   rm '.gitmodules'
   $ git commit -q -m "remove .gitmodules" .gitmodules



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 4 of 8] revset: enforce "%d" to be interpreted as literal revision number (API)

2019-01-18 Thread Yuya Nishihara
> On Thu, Jan 17, 2019, 11:32 Boris FELD  wrote:
> > On 13/01/2019 10:12, Yuya Nishihara wrote:
> > > On Sun, 13 Jan 2019 08:37:47 +0100, Boris FELD wrote:
> > >> On 12/01/2019 05:04, Yuya Nishihara wrote:
> > >>> On Fri, 11 Jan 2019 12:29:06 +0100, Boris Feld wrote:
> >  # HG changeset patch
> >  # User Boris Feld 
> >  # Date 1547130238 -3600
> >  #  Thu Jan 10 15:23:58 2019 +0100
> >  # Node ID 38733dd8559578267617514a42f253efabb6
> >  # Parent  427247e84e29c144321d21a825d371458b5d3e1a
> >  # EXP-Topic revs-efficiency
> >  # Available At https://bitbucket.org/octobus/mercurial-devel/
> >  #  hg pull https://bitbucket.org/octobus/mercurial-devel/
> > -r 38733dd85595
> >  revset: enforce "%d" to be interpreted as literal revision number
> > (API)
> > >>> New behavior looks saner. Please also flag this as (BC). It's exposed
> > as
> > >>> revset() template function.
> > >>>
> >   %r = revset expression, parenthesized
> >  -%d = int(arg), no quoting
> >  +%d = rev(int(arg)), no quoting
> > >>> 'rev(n)' returns an empty set if n is out of range, whereas 'n' aborts.
> > >>> Suppose it's pretty much a coding error to pass in an invalid revision
> > to
> > >>> repo.revs(), we'll probably want aborts.
> > >>>
> > >>> Maybe we'll need an internal '_rev()' function?
> > >> %ld silently pass on these too, so I would rather have %ld and %d
> > >> consistent here (and align on the silence %ld behavior).
> > > Indeed. I never thought %ld would behave in such way. Consistent behavior
> > > should be better.
> >
> > Through some buggy revset usage in evolve we discovered that the
> > optimization to passthrough input directly for %ld changed this
> > behavior. In these cases, the revisions are passed as is and
> > filtered/out-of-bound revision raise their usual error.
> >
> > Reintroducing the silent filtering behavior for %ld seems possible (it
> > will have a performance impact, but still faster than the previous
> > serialization).
> >
> > However, it is probably more efficient and saner to have these errors
> > raised. In this case, we should align all %ld case and %d behaviors on
> > the error raising version. What do you think?

On Thu, 17 Jan 2019 12:36:50 -0800, Martin von Zweigbergk wrote:
> Makes sense to me. That's how it would work on the command line too.

+1
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH V4] update: fix edge-case with update.atomic-file and read-only files

2019-01-18 Thread Yuya Nishihara
On Thu, 17 Jan 2019 15:27:15 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1547128621 -3600
> #  Thu Jan 10 14:57:01 2019 +0100
> # Node ID 5a9110c3e1ea31ed26f8bbd1e7f66abcecc26a31
> # Parent  4c0d4bbdc39537d00c764b99e88f22e41303cf42
> # EXP-Topic atomic-update-read-only
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 5a9110c3e1ea
> update: fix edge-case with update.atomic-file and read-only files

Queued, thanks.

> diff --git a/tests/test-update-atomic.t b/tests/test-update-atomic.t
> new file mode 100644
> --- /dev/null
> +++ b/tests/test-update-atomic.t
> @@ -0,0 +1,142 @@
> +#require execbit

Added unix-permissions.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5626: scmutil: drop unreachable except clause

2019-01-18 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Queued, thanks.
  
  >   socket.error is a subclass of IOError, which we catch higher up. It
  
  For the record, it's Python 2.6 feature.
  
  https://docs.python.org/2.7/library/socket.html#socket.error

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5626

To: martinvonz, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5626: scmutil: drop unreachable except clause

2019-01-18 Thread Yuya Nishihara
Queued, thanks.

>   socket.error is a subclass of IOError, which we catch higher up. It

For the record, it's Python 2.6 feature.

https://docs.python.org/2.7/library/socket.html#socket.error
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5594: copies: consider nullrev a common ancestor

2019-01-18 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   I've seen many bugs in the git codebase that were caused by it not
  >   having a null revision and being forced to treat root commits
  >   differently. Mercurial has a null revision and I think it's generally
  >   a bug to treat it differently from other commits in graph algorithms.
  
  I agree with that, but I don't think every non-merge revision (p2 = null)
  should be considered a direct child of null revision.
  
  > @@ -65,8 +63,6 @@
  > 
  >   else:
  >   parents = cl.parentrevs(r)
  
  Here `parents[1]` may be `nullrev`. Is that expected?
  
  >   for p in parents:
  > 
  > - if p < 0:
  > - continue

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D5594

To: martinvonz, #hg-reviewers
Cc: yuja, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D5594: copies: consider nullrev a common ancestor

2019-01-18 Thread Yuya Nishihara
>   I've seen many bugs in the git codebase that were caused by it not
>   having a null revision and being forced to treat root commits
>   differently. Mercurial has a null revision and I think it's generally
>   a bug to treat it differently from other commits in graph algorithms.

I agree with that, but I don't think every non-merge revision (p2 = null)
should be considered a direct child of null revision.

> @@ -65,8 +63,6 @@
>  else:
>  parents = cl.parentrevs(r)

Here `parents[1]` may be `nullrev`. Is that expected?

>  for p in parents:
> -if p < 0:
> -continue
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] rust-cpython: using rustext.dagop.headrevs in revlog

2019-01-18 Thread Georges Racinet
On 1/17/19 2:40 PM, Yuya Nishihara wrote:
> On Wed, 16 Jan 2019 19:15:09 +0100, Georges Racinet wrote:
>> # HG changeset patch
>> # User Georges Racinet 
>> # Date 1547651966 -3600
>> #  Wed Jan 16 16:19:26 2019 +0100
>> # Node ID 234c106610004aff294268ccda82238164f91f64
>> # Parent  f32e7d90db76879096f216f23ebbe75772b0201e
>> # EXP-Topic revset.predicates
>> rust-cpython: using rustext.dagop.headrevs in revlog
>> --- a/mercurial/revlog.pyThu Jan 10 18:25:18 2019 +0100
>> +++ b/mercurial/revlog.pyWed Jan 16 16:19:26 2019 +0100
>> @@ -1108,6 +1108,8 @@
>>  return self.index.headrevs()
>>  except AttributeError:
>>  return self._headrevs()
>> +if rustext is not None:
>> +return rustext.dagop.headrevs(self.index, revs)
>>  return dagop.headrevs(revs, self.parentrevs)
> (CC: Boris)
> Are we sure the given revs are not filtered?

I just to talked to him directly about that, and the bottom line is that
no, it isn't.

I'm working right now on a v2 that will prefilter from changelog on
input revisions. In order not to take risks with the performance in the
pure Python case, I may have to pass a flag directly (we'll see).

Sorry for the hitch,


___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH V5] revset: support ranges in #generations relation

2019-01-18 Thread Anton Shestakov
On Thu, 17 Jan 2019 23:28:22 +0900
Yuya Nishihara  wrote:

> On Thu, 17 Jan 2019 21:17:26 +0800, Anton Shestakov wrote:
> > # HG changeset patch
> > # User Anton Shestakov 
> > # Date 1547564229 -28800
> > #  Tue Jan 15 22:57:09 2019 +0800
> > # Node ID d1e7a57a62ca4dd99a11659148baf672bc9cab38
> > # Parent  8aca89a694d4bd7d25877b3652fb83e187ea1802
> > revset: support ranges in #generations relation
> 
> > +def _splitrange(a, b):
> > +""" Split range with bounds a and b into two ranges at 0 and return two
> > +lists of numbers for use as startdepth and stopdepth arguments of
> > +_ancestors and _descendants.
> > +
> > +If 0 is in the input range, it is included only in the second list.
> > +
> > +>>> _splitrange(None, None)  # [:]
> > +([1, None], [0, None])
> > +>>> _splitrange(-10, None)   # [-10:]
> > +([1, 11], [0, None])
> > +>>> _splitrange(None, 10)# [:10]
> > +([1, None], [0, 11])
> > +>>> _splitrange(-10, -5) # [-10:-5]
> > +([5, 11], [None, None])
> > +>>> _splitrange(5, 10)   # [5:10]
> > +([None, None], [5, 11])
> > +>>> _splitrange(-10, 10) # [-10:10]
> > +([1, 11], [0, 11])
> 
> > +>>> _splitrange(-10, 0)  # [-10:0]
> > +([1, 11], [0, 1])
> 
> So this would result in silly computation 'anc + desc'?
> As I said 'anc{x} + desc{x}' won't yield 'x' twice, so including 0 in both
> sets should be fine.

It would be fine, but we don't want to call both _ancestors() and
_descendants() if we can get the 0 from just one of these functions.
This is improved in V6.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH V6] revset: support ranges in #generations relation

2019-01-18 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1547564229 -28800
#  Tue Jan 15 22:57:09 2019 +0800
# Node ID 6069a3fcef9b0f9e80cd884c38f6a9e2a35e757a
# Parent  8aca89a694d4bd7d25877b3652fb83e187ea1802
revset: support ranges in #generations relation

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -225,24 +225,99 @@ def notset(repo, subset, x, order):
 def relationset(repo, subset, x, y, order):
 raise error.ParseError(_("can't use a relation in this context"))
 
-def generationsrel(repo, subset, x, rel, n, order):
-# TODO: support range, rewrite tests, and drop startdepth argument
-# from ancestors() and descendants() predicates
-if n <= 0:
-n = -n
-return _ancestors(repo, subset, x, startdepth=n, stopdepth=n + 1)
-else:
-return _descendants(repo, subset, x, startdepth=n, stopdepth=n + 1)
+def _splitrange(a, b):
+""" Split range with bounds a and b into two ranges at 0 and return two
+lists of numbers for use as startdepth and stopdepth arguments of
+_ancestors and _descendants.
+
+If 0 is in the input range, it is included only once to avoid calling both
+_ancestors and _descendants if possible.
+
+>>> _splitrange(None, None)  # [:]
+([1, None], [0, None])
+>>> _splitrange(-10, None)   # [-10:]
+([1, 11], [0, None])
+>>> _splitrange(None, 10)# [:10]
+([1, None], [0, 11])
+>>> _splitrange(-10, -5) # [-10:-5]
+([5, 11], [None, None])
+>>> _splitrange(5, 10)   # [5:10]
+([None, None], [5, 11])
+>>> _splitrange(-10, 10) # [-10:10]
+([1, 11], [0, 11])
+>>> _splitrange(-10, 0)  # [-10:0]
+([0, 11], [None, None])
+>>> _splitrange(0, 10)   # [0:10]
+([None, None], [0, 11])
+>>> _splitrange(0, 0)# [0:0]
+([None, None], [0, 1])
+>>> _splitrange(1, -1)   # [1:-1]
+([None, None], [None, None])
+"""
+depths = ([None, None], [None, None])
+
+if a is None or a < 0:
+if b is None or b >= 0:
+if b == 0:
+depths[0][0] = 0
+else:
+depths[0][0] = 1
+else:
+depths[0][0] = -b
+if a is None:
+depths[0][1] = None
+else:
+depths[0][1] = -a + 1
+
+if b is None or b > 0 or (a == 0 and b == 0):
+if a is None or a < 0:
+depths[1][0] = 0
+else:
+depths[1][0] = a
+if b is None:
+depths[1][1] = None
+else:
+depths[1][1] = b + 1
+
+return depths
+
+def generationsrel(repo, subset, x, rel, a, b, order):
+# TODO: rewrite tests, and drop startdepth argument from ancestors() and
+# descendants() predicates
+depths = _splitrange(a, b)
+ancstart, ancstop = depths[0]
+descstart, descstop = depths[1]
+
+if ancstart is not None and descstart is not None:
+return (_ancestors(repo, subset, x, False, ancstart, ancstop) +
+_descendants(repo, subset, x, False, descstart, descstop))
+elif ancstart is not None:
+return _ancestors(repo, subset, x, False, ancstart, ancstop)
+elif descstart is not None:
+return _descendants(repo, subset, x, False, descstart, descstop)
+
+return baseset()
 
 def relsubscriptset(repo, subset, x, y, z, order):
 # this is pretty basic implementation of 'x#y[z]' operator, still
 # experimental so undocumented. see the wiki for further ideas.
 # https://www.mercurial-scm.org/wiki/RevsetOperatorPlan
 rel = getsymbol(y)
-n = getinteger(z, _("relation subscript must be an integer"))
+try:
+a, b = getrange(z, '')
+except error.ParseError:
+a = getinteger(z, _("relation subscript must be an integer"))
+b = a
+else:
+def getbound(i):
+if i is None:
+return None
+msg = _("relation subscript bounds must be integers")
+return getinteger(i, msg)
+a, b = [getbound(i) for i in (a, b)]
 
 if rel in subscriptrelations:
-return subscriptrelations[rel](repo, subset, x, rel, n, order)
+return subscriptrelations[rel](repo, subset, x, rel, a, b, order)
 
 relnames = [r for r in subscriptrelations.keys() if len(r) > 1]
 raise error.UnknownIdentifier(rel, relnames)
diff --git a/tests/test-doctest.py b/tests/test-doctest.py
--- a/tests/test-doctest.py
+++ b/tests/test-doctest.py
@@ -62,6 +62,7 @@ testmod('mercurial.parser')
 testmod('mercurial.pycompat')
 testmod('mercurial.revlog')
 testmod('mercurial.revlogutils.deltas')
+testmod('mercurial.revset')
 testmod('mercurial.revsetlang')
 testmod('mercurial.smartset')
 testmod('mercurial.store')
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -648,6 +648,9 @@ parse errors of relation, subscript and 
   $ hg debugrevspec '.#generations[1-2]'
   hg: parse 

Re: [PATCH] revlog: document that mmap resources are released implicitly by GC

2019-01-18 Thread Augie Fackler
On Sun, Jan 13, 2019 at 03:44:53PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1547358986 -32400
> #  Sun Jan 13 14:56:26 2019 +0900
> # Node ID eb6ba8bc27e0f8cc28268d6601b97f2c2a63c1c3
> # Parent  81fb0d015830b5ddf89b398aa63e0b56501dc6ac
> revlog: document that mmap resources are released implicitly by GC

queued, thanks
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] histedit: remove trailing space from warning message

2019-01-18 Thread Augie Fackler
On Sun, Jan 13, 2019 at 03:43:53PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1547358375 -32400
> #  Sun Jan 13 14:46:15 2019 +0900
> # Node ID 81fb0d015830b5ddf89b398aa63e0b56501dc6ac
> # Parent  9e4ccae74c4793f1e10f2b89991466247eb8e76a
> histedit: remove trailing space from warning message

queued, thanks
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] ui: proxy protect/restorestdio() calls to update internal flag

2019-01-18 Thread Augie Fackler
On Sat, Jan 12, 2019 at 07:50:04PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1537965712 -32400
> #  Wed Sep 26 21:41:52 2018 +0900
> # Node ID 8e956cead2023a3afdfb3f06a08b24290dffc244
> # Parent  c5a71f1cdd3278159500360435863ee01c842cf4
> ui: proxy protect/restorestdio() calls to update internal flag

queued, thanks
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] cext: clang-format new code coming from stable branch

2019-01-18 Thread Augie Fackler
On Thu, Jan 10, 2019 at 10:48:30PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1547123364 -32400
> #  Thu Jan 10 21:29:24 2019 +0900
> # Node ID 33b5a23d3b3b5a8fed27e34987bbef9749e84dd7
> # Parent  3dcc96582627ac701b730cf09a3bc967768a5dbe
> cext: clang-format new code coming from stable branch

queued, thanks
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel