D7517: filemerge: byteify the open() mode

2019-11-23 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is actually `pycompat.open()`, so it need bytes.  It regressed recently 
on
  default.
  
  VSCode flagged some invalid mode to open() the other day, but I don't remember
  where.  That's what got me searching in this area.  I'm almost certain that it
  was the other way (i.e. saying open doesn't take bytes), but I can't find that
  now.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/filemerge.py

CHANGE DETAILS

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -934,7 +934,7 @@
 name = os.path.join(tmproot, pre)
 if ext:
 name += ext
-f = open(name, "wb")
+f = open(name, b"wb")
 else:
 fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext)
 f = os.fdopen(fd, "wb")



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


D7512: exchange: guard against method invocation on `b2caps=None` args

2019-11-23 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   """add a changegroup part to the requested bundle"""
  >
  > - if not kwargs.get('cg', True):
  >
  > +if not kwargs.get('cg', True) or not b2caps:
  >
  >   return
  
  Is it valid to call these functions with `b2caps=None`? I suspect it would
  be a bug or a data corruption.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7512/new/

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

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


D7511: exchange: eliminate some bytes.format() calls

2019-11-23 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   if invalid_includes:
  >   raise error.Abort(
  >
  > - _(b"The following includes are not accessible for {}: {}").format(
  > - username, invalid_includes
  > - )
  >
  > +_(b"The following includes are not accessible for %s: %s")
  > +% (username, invalid_includes)
  
  Perhaps, `invalid_includes` is a list, and `b'%s' % a_list` is invalid on py3.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7511/new/

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

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


Re: D7512: exchange: guard against method invocation on `b2caps=None` args

2019-11-23 Thread Yuya Nishihara
>  """add a changegroup part to the requested bundle"""
> -if not kwargs.get('cg', True):
> +if not kwargs.get('cg', True) or not b2caps:
>  return

Is it valid to call these functions with `b2caps=None`? I suspect it would
be a bug or a data corruption.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D7511: exchange: eliminate some bytes.format() calls

2019-11-23 Thread Yuya Nishihara
>  if invalid_includes:
>  raise error.Abort(
> -_(b"The following includes are not accessible for {}: 
> {}").format(
> -username, invalid_includes
> -)
> +_(b"The following includes are not accessible for %s: %s")
> +% (username, invalid_includes)

Perhaps, `invalid_includes` is a list, and `b'%s' % a_list` is invalid on py3.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7481: localrepo: recognize trivial "null" queries in `anyrev`

2019-11-23 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > +if specs == [b'null']:
  > +return revset.baseset([nullrev])
  
  This breaks `--config revsetalias.null=`. Nobody would care, but
  I don't know why we're so hard to optimize `-r null` query.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7481/new/

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

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


Re: D7481: localrepo: recognize trivial "null" queries in `anyrev`

2019-11-23 Thread Yuya Nishihara
> +if specs == [b'null']:
> +return revset.baseset([nullrev])

This breaks `--config revsetalias.null=`. Nobody would care, but
I don't know why we're so hard to optimize `-r null` query.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7516: webutil: add missing argument to join()

2019-11-23 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/hgweb/webutil.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -865,7 +865,7 @@
 raise error.ParseError(_(b'not displayable without template'))
 
 def show(self, context, mapping):
-return self.join(context, b'')
+return self.join(context, mapping, b'')
 
 def tobool(self, context, mapping):
 return bool(self._vars)



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


D7512: exchange: guard against method invocation on `b2caps=None` args

2019-11-23 Thread mharbison72 (Matt Harbison)
Closed by commit rHG0dbea180525c: exchange: guard against method invocation on 
`b2caps=None` args (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7512?vs=18337=18379

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7512/new/

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

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2474,7 +2474,7 @@
 **kwargs
 ):
 """add a changegroup part to the requested bundle"""
-if not kwargs.get('cg', True):
+if not kwargs.get('cg', True) or not b2caps:
 return
 
 version = b'01'
@@ -2536,7 +2536,7 @@
 """add a bookmark part to the requested bundle"""
 if not kwargs.get('bookmarks', False):
 return
-if b'bookmarks' not in b2caps:
+if not b2caps or b'bookmarks' not in b2caps:
 raise error.Abort(_(b'no common bookmarks exchange method'))
 books = bookmod.listbinbookmarks(repo)
 data = bookmod.binaryencode(books)
@@ -2577,7 +2577,7 @@
 ):
 """add phase heads part to the requested bundle"""
 if kwargs.get('phases', False):
-if not b'heads' in b2caps.get(b'phases'):
+if not b2caps or not b'heads' in b2caps.get(b'phases'):
 raise error.Abort(_(b'no common phases exchange method'))
 if heads is None:
 heads = repo.heads()
@@ -2641,7 +2641,7 @@
 # Don't send unless:
 # - changeset are being exchanged,
 # - the client supports it.
-if not (kwargs.get('cg', True) and b'hgtagsfnodes' in b2caps):
+if not b2caps or not (kwargs.get('cg', True) and b'hgtagsfnodes' in 
b2caps):
 return
 
 outgoing = _computeoutgoing(repo, heads, common)
@@ -2675,6 +2675,7 @@
 # - narrow bundle isn't in play (not currently compatible).
 if (
 not kwargs.get('cg', True)
+or not b2caps
 or b'rev-branch-cache' not in b2caps
 or kwargs.get('narrow', False)
 or repo.ui.has_section(_NARROWACL_SECTION)



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


D7511: exchange: eliminate some bytes.format() calls

2019-11-23 Thread mharbison72 (Matt Harbison)
Closed by commit rHG76d4bf0a652b: exchange: eliminate some bytes.format() calls 
(authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7511?vs=18336=18378

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7511/new/

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

AFFECTED FILES
  mercurial/exchange.py

CHANGE DETAILS

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -2181,9 +2181,8 @@
 )
 if not user_includes:
 raise error.Abort(
-_(b"{} configuration for user {} is empty").format(
-_NARROWACL_SECTION, username
-)
+_(b"%s configuration for user %s is empty")
+% (_NARROWACL_SECTION, username)
 )
 
 user_includes = [
@@ -2202,9 +2201,8 @@
 
 if invalid_includes:
 raise error.Abort(
-_(b"The following includes are not accessible for {}: {}").format(
-username, invalid_includes
-)
+_(b"The following includes are not accessible for %s: %s")
+% (username, invalid_includes)
 )
 
 new_args = {}



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


D7510: windows: suppress pytype warnings for Windows imports and functions

2019-11-23 Thread mharbison72 (Matt Harbison)
Closed by commit rHGc6060b243163: windows: suppress pytype warnings for Windows 
imports and functions (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7510?vs=18335=18377

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7510/new/

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

AFFECTED FILES
  mercurial/pycompat.py
  mercurial/scmwindows.py
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -26,11 +26,12 @@
 )
 
 try:
-import _winreg as winreg
+import _winreg as winreg  # pytype: disable=import-error
 
 winreg.CloseKey
 except ImportError:
-import winreg
+# py2 only
+import winreg  # pytype: disable=import-error
 
 osutil = policy.importmod('osutil')
 
@@ -282,7 +283,7 @@
 # fileno(), usually set to -1.
 fno = getattr(fd, 'fileno', None)
 if fno is not None and fno() >= 0:
-msvcrt.setmode(fno(), os.O_BINARY)
+msvcrt.setmode(fno(), os.O_BINARY)  # pytype: disable=module-attr
 
 
 def pconvert(path):
diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py
--- a/mercurial/scmwindows.py
+++ b/mercurial/scmwindows.py
@@ -10,11 +10,12 @@
 )
 
 try:
-import _winreg as winreg
+import _winreg as winreg  # pytype: disable=import-error
 
 winreg.CloseKey
 except ImportError:
-import winreg
+# py2 only
+import winreg  # pytype: disable=import-error
 
 # MS-DOS 'more' is the only pager available by default on Windows.
 fallbackpager = b'more'
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -99,7 +99,7 @@
 # Otherwise non-ASCII filenames in existing repositories would be
 # corrupted.
 # This must be set once prior to any fsencode/fsdecode calls.
-sys._enablelegacywindowsfsencoding()
+sys._enablelegacywindowsfsencoding()  # pytype: disable=module-attr
 
 fsencode = os.fsencode
 fsdecode = os.fsdecode



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


D7491: changectx: mark the parents of the working copy as non filtered

2019-11-23 Thread marmoute (Pierre-Yves David)
Closed by commit rHG0e72b2518f0e: changectx: mark the parents of the working 
copy as non filtered (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7491?vs=18364=18376#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7491?vs=18364=18376

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7491/new/

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1518,7 +1518,12 @@
 p = p[:-1]
 # use unfiltered repo to delay/avoid loading obsmarkers
 unfi = self._repo.unfiltered()
-return [changectx(self._repo, unfi.changelog.rev(n), n) for n in p]
+return [
+changectx(
+self._repo, unfi.changelog.rev(n), n, maybe_filtered=False
+)
+for n in p
+]
 
 def _fileinfo(self, path):
 # populate __dict__['_manifest'] as workingctx has no _manifestdelta



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


D7488: localrepo: introduce a `_quick_access_changeid` property

2019-11-23 Thread marmoute (Pierre-Yves David)
Closed by commit rHG82ffb92092de: localrepo: introduce a 
`_quick_access_changeid` property (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7488?vs=18357=18374#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7488?vs=18357=18374

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7488/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1514,6 +1514,19 @@
 narrowspec.save(self, newincludes, newexcludes)
 self.invalidate(clearfilecache=True)
 
+@util.propertycache
+def _quick_access_changeid(self):
+"""an helper dictionnary for __getitem__ calls
+
+This contains a list of symbol we can recognise right away without
+further processing.
+"""
+return {
+b'null': (nullrev, nullid),
+nullrev: (nullrev, nullid),
+nullid: (nullrev, nullid),
+}
+
 def __getitem__(self, changeid):
 # dealing with special cases
 if changeid is None:
@@ -1531,8 +1544,10 @@
 ]
 
 # dealing with some special values
-if changeid == b'null' or changeid == nullrev or changeid == nullid:
-return context.changectx(self, nullrev, nullid, 
maybe_filtered=False)
+quick_access = self._quick_access_changeid.get(changeid)
+if quick_access is not None:
+rev, node = quick_access
+return context.changectx(self, rev, node, maybe_filtered=False)
 if changeid == b'tip':
 node = self.changelog.tip()
 rev = self.changelog.rev(node)



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


D7487: changectx: use unfiltered changelog to access parents of unfiltered revs

2019-11-23 Thread marmoute (Pierre-Yves David)
Closed by commit rHG5ef259b09475: changectx: use unfiltered changelog to access 
parents of unfiltered revs (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7487?vs=18363=18373

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7487/new/

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

AFFECTED FILES
  mercurial/context.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -58,7 +58,6 @@
 Getting status of null
 
   $ hg status --change null
-  debug.filters: computing revision filter for "visible"
 
 Getting status of working copy
 
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -523,7 +523,12 @@
 @propertycache
 def _parents(self):
 repo = self._repo
-p1, p2 = repo.changelog.parentrevs(self._rev)
+if self._maybe_filtered:
+cl = repo.changelog
+else:
+cl = repo.unfiltered().changelog
+
+p1, p2 = cl.parentrevs(self._rev)
 if p2 == nullrev:
 return [repo[p1]]
 return [repo[p1], repo[p2]]



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


D7490: repoview: add an explicit set of all filter that show the wc parents

2019-11-23 Thread marmoute (Pierre-Yves David)
Closed by commit rHGa1cd36171ea1: repoview: add an explicit set of all filter 
that show the wc parents (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7490?vs=18297=18375

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7490/new/

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

AFFECTED FILES
  mercurial/repoview.py

CHANGE DETAILS

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -177,6 +177,9 @@
 b'base': computeimpactable,
 }
 
+# set of filter level that will include the working copy parent no matter what.
+filter_has_wc = {b'visible', b'visible-hidden'}
+
 _basefiltername = list(filtertable)
 
 



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


D7484: localrepo: mark nullrev has never filtered

2019-11-23 Thread marmoute (Pierre-Yves David)
Closed by commit rHGc25885cc6849: localrepo: mark nullrev has never filtered 
(authored by marmoute).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7484?vs=18355=18370#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7484?vs=18355=18370

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7484/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -54,6 +54,5 @@
 Getting basic changeset inforation about `null`
 
   $ hg log -r null -T "{node}\n{date}\n"
-  debug.filters: computing revision filter for "visible"
   
   0.00
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1532,7 +1532,7 @@
 
 # dealing with some special values
 if changeid == b'null' or changeid == nullrev:
-return context.changectx(self, nullrev, nullid)
+return context.changectx(self, nullrev, nullid, 
maybe_filtered=False)
 if changeid == b'tip':
 node = self.changelog.tip()
 rev = self.changelog.rev(node)



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


D7486: locarepo: also fastpath `nullid` lookup in __getitem__

2019-11-23 Thread marmoute (Pierre-Yves David)
Closed by commit rHGc9d1e2ec1e2e: locarepo: also fastpath `nullid` lookup in 
__getitem__ (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7486?vs=18356=18372#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7486?vs=18356=18372

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7486/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1531,7 +1531,7 @@
 ]
 
 # dealing with some special values
-if changeid == b'null' or changeid == nullrev:
+if changeid == b'null' or changeid == nullrev or changeid == nullid:
 return context.changectx(self, nullrev, nullid, 
maybe_filtered=False)
 if changeid == b'tip':
 node = self.changelog.tip()



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


D7483: changectx: add a "maybe filtered" filtered attribute

2019-11-23 Thread marmoute (Pierre-Yves David)
Closed by commit rHG8a37203ab1d5: changectx: add a maybe filtered 
filtered attribute (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7483?vs=18362=18369

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7483/new/

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -477,10 +477,17 @@
 changeset convenient. It represents a read-only context already present in
 the repo."""
 
-def __init__(self, repo, rev, node):
+def __init__(self, repo, rev, node, maybe_filtered=True):
 super(changectx, self).__init__(repo)
 self._rev = rev
 self._node = node
+# When maybe_filtered is True, the revision might be affected by
+# changelog filtering and operation through the filtered changelog 
must be used.
+#
+# When maybe_filtered is False, the revision has already been checked
+# against filtering and is not filtered. Operation through the
+# unfiltered changelog might be used in some case.
+self._maybe_filtered = maybe_filtered
 
 def __hash__(self):
 try:
@@ -495,7 +502,11 @@
 
 @propertycache
 def _changeset(self):
-return self._repo.changelog.changelogrevision(self.rev())
+if self._maybe_filtered:
+repo = self._repo
+else:
+repo = self._repo.unfiltered()
+return repo.changelog.changelogrevision(self.rev())
 
 @propertycache
 def _manifest(self):



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


D7514: repoview: add more tests to track operation not supposed to trigger filtering

2019-11-23 Thread marmoute (Pierre-Yves David)
Closed by commit rHGe3c0f9c2c376: repoview: add more tests to track operation 
not supposed to trigger filtering (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D7514?vs=18354=18371#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7514?vs=18354=18371

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7514/new/

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

AFFECTED FILES
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -46,8 +46,6 @@
 
 Getting the node of `null`
 
-  $ hg init test-repo
-  $ cd test-repo
   $ hg log -r null -T "{node}\n"
   
 
@@ -56,3 +54,101 @@
   $ hg log -r null -T "{node}\n{date}\n"
   
   0.00
+
+Getting status of null
+
+  $ hg status --change null
+  debug.filters: computing revision filter for "visible"
+
+Getting status of working copy
+
+  $ hg status
+  debug.filters: computing revision filter for "visible"
+  M c
+  A d
+  R a
+  ! b
+
+Getting data about the working copy parent
+
+  $ hg log -r '.' -T "{node}\n{date}\n"
+  debug.filters: computing revision filter for "visible"
+  c2932ca7786be30b67154d541a8764fae5532261
+  0.00
+
+Getting working copy diff
+
+  $ hg diff
+  debug.filters: computing revision filter for "visible"
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 a
+  --- a/a  Thu Jan 01 00:00:00 1970 +
+  +++ /dev/nullThu Jan 01 00:00:00 1970 +
+  @@ -1,1 +0,0 @@
+  -a
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 c
+  --- a/c  Thu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -1,1 +1,1 @@
+  -c
+  +c1
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 d
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/d  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +d
+  $ hg diff --change .
+  debug.filters: computing revision filter for "visible"
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +c
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 z
+  --- a/z  Thu Jan 01 00:00:00 1970 +
+  +++ b/z  Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+   some line
+   in a
+  +file
+
+exporting the current changeset
+
+  $ hg export
+  debug.filters: computing revision filter for "visible"
+  exporting patch:
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #  Thu Jan 01 00:00:00 1970 +
+  # Node ID c2932ca7786be30b67154d541a8764fae5532261
+  # Parent  05293e5dd8d1ae4f84a8520a11c6f97cad26deca
+  c
+  
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +c
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 z
+  --- a/z  Thu Jan 01 00:00:00 1970 +
+  +++ b/z  Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+   some line
+   in a
+  +file
+
+using annotate
+
+- file with a single change
+
+  $ hg annotate a
+  debug.filters: computing revision filter for "visible"
+  0: a
+
+- file with multiple change
+
+  $ hg annotate z
+  debug.filters: computing revision filter for "visible"
+  0: some line
+  1: in a
+  2: file



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


D7510: windows: suppress pytype warnings for Windows imports and functions

2019-11-23 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  In D7510#110343 , @mharbison72 
wrote:
  
  > I'm not sure if there are plans to vendor *.pyi files.  Maybe that could be 
used to backfill platform specific modules instead of doing this.  But for now 
is seems better to get the error count and blacklist length reduced.
  
  I think `.pyi` files are a bit annoying. And since Python 2 support isn't 
long for this world, I think we should hold out and just switch to inline type 
annotations as soon as we drop Python 2 support. This assumes we make good on 
our plan to drop Python 2 after the first release in 2020 at latest. If not, we 
should consider vendoring `.pyi` files so we can have nicer things sooner.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7510/new/

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

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


D7491: changectx: mark the parents of the working copy as non filtered

2019-11-23 Thread indygreg (Gregory Szorc)
This revision is now accepted and ready to land.
indygreg added inline comments.
indygreg accepted this revision.

INLINE COMMENTS

> context.py:1522
> +return [
> +changectx(self._repo, unfi.changelog.rev(n), n, False) for n in p
> +]

I'm adding a named argument in flight.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7491/new/

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

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


D7515: pytype: [WIP] suppress various warnings inline to get a clean run

2019-11-23 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.
mharbison72 planned changes to this revision.


  Adjusting this to stay out of the review queue.  While most of the files only 
had a handful of errors (and a few could be removed from the blacklist), the 
few added had a bunch of errors.  I didn't see any obvious fixes, and ran out 
of time Friday to individually suppress them.
  
  I'm assuming we will fix the problems, and then apply the suppressions in 
narrow categories rather than a monolithic commit like this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7515/new/

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

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


D7515: pytype: [WIP] suppress various warnings inline to get a clean run

2019-11-23 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This depends on D7295  and D7384 
, which in turn was applied to 
f612a044a5ab 
.  
It
  contains some things that are currently in flight, and I made no attempt to 
keep
  it under 80 columns or blacken it.  But it seems useful to share now, because 
it
  is so time consuming to get this far, and presumably much of this will entail
  actual fixes.
  
  I wish I had made a better effort to indicate what it was complaining about, 
so
  maybe any actual suppressions that are needed should be documented why?

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundlerepo.py
  mercurial/commands.py
  mercurial/dagparser.py
  mercurial/debugcommands.py
  mercurial/error.py
  mercurial/exchange.py
  mercurial/filemerge.py
  mercurial/hg.py
  mercurial/hgweb/server.py
  mercurial/hgweb/webcommands.py
  mercurial/hgweb/webutil.py
  mercurial/logcmdutil.py
  mercurial/manifest.py
  mercurial/obsutil.py
  mercurial/patch.py
  mercurial/profiling.py
  mercurial/pycompat.py
  mercurial/scmwindows.py
  mercurial/shelve.py
  mercurial/subrepo.py
  mercurial/ui.py
  mercurial/unionrepo.py
  mercurial/upgrade.py
  mercurial/verify.py
  mercurial/windows.py
  mercurial/wireprotoframing.py
  mercurial/wireprotoserver.py
  mercurial/wireprotov1peer.py
  mercurial/wireprotov1server.py
  mercurial/wireprotov2server.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -9,25 +9,16 @@
 endeavor to empty this list out over time, as some of these are
 probably hiding real problems.
 
-
-  $ pytype mercurial \
-  >-x mercurial/bundlerepo.py \
+  $ pytype -k mercurial \
   >-x mercurial/chgserver.py \
   >-x mercurial/context.py \
   >-x mercurial/crecord.py \
   >-x mercurial/encoding.py \
-  >-x mercurial/error.py \
-  >-x mercurial/exchange.py \
   >-x mercurial/lsprof.py \
-  >-x mercurial/policy.py
-  >-x mercurial/pycompat.py \
   >-x mercurial/urllibcompat.py \
   >-x mercurial/i18n.py \
   >-x mercurial/sslutil.py \
-  >-x mercurial/scmwindows.py \
   >-x mercurial/keepalive.py \
-  >-x mercurial/windows.py \
-  >-x mercurial/wireprotoframing.py \
   >-x mercurial/utils/stringutil.py \
   >-x mercurial/hgweb/server.py \
   >-x mercurial/hgweb/wsgicgi.py \
@@ -35,4 +26,10 @@
   >-x mercurial/interfaces \
   >-x mercurial/cffi \
   >-x mercurial/pure \
-  >-x mercurial/thirdparty
+  >-x mercurial/thirdparty \
+  >-x mercurial/httppeer.py \
+  >-x mercurial/repoview.py \
+  >-x mercurial/localrepo.py \
+  >-x mercurial/revlog.py \
+  >-x mercurial/merge.py \
+  >-x mercurial/testing/storage.py
diff --git a/mercurial/wireprotov2server.py b/mercurial/wireprotov2server.py
--- a/mercurial/wireprotov2server.py
+++ b/mercurial/wireprotov2server.py
@@ -88,7 +88,7 @@
 try:
 checkperm(rctx, req, b'pull' if permission == b'ro' else b'push')
 except hgwebcommon.ErrorResponse as e:
-res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))
+res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))  # 
pytype: disable=wrong-arg-types
 for k, v in e.headers:
 res.headers[k] = v
 res.setbodybytes(b'permission denied')
@@ -582,7 +582,7 @@
 
 caps[b'commands'][command] = {
 b'args': args,
-b'permissions': [entry.permission],
+b'permissions': [entry.permission],  # pytype: 
disable=unsupported-operands
 }
 
 if entry.extracapabilitiesfn:
@@ -609,7 +609,7 @@
 if key in target:
 entry[key] = target[key]
 
-caps[b'redirect'][b'targets'].append(entry)
+caps[b'redirect'][b'targets'].append(entry)  # pytype: 
disable=attribute-error
 
 return proto.addcapabilities(repo, caps)
 
diff --git a/mercurial/wireprotov1server.py b/mercurial/wireprotov1server.py
--- a/mercurial/wireprotov1server.py
+++ b/mercurial/wireprotov1server.py
@@ -726,12 +726,13 @@
 part.addparam(b'old', exc.old, mandatory=False)
 if exc.ret is not None:
 part.addparam(b'ret', exc.ret, mandatory=False)
-except error.BundleValueError as exc:
+except error.BundleValueError as exc:  # Should be 
BundleUnknownFeatureError
 errpart = bundler.newpart(b'error:unsupportedcontent')
-if exc.parttype is not None:
-errpart.addparam(b'parttype', exc.parttype)
-   

D7484: localrepo: mark nullrev has never filtered

2019-11-23 Thread indygreg (Gregory Szorc)
This revision is now accepted and ready to land.
indygreg added inline comments.
indygreg accepted this revision.

INLINE COMMENTS

> localrepo.py:1535
>  if changeid == b'null' or changeid == nullrev:
> -return context.changectx(self, nullrev, nullid)
> +return context.changectx(self, nullrev, nullid, False)
>  if changeid == b'tip':

I'm going to add a named argument in flight because I like readability.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7484/new/

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

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


D7483: changectx: add a "maybe filtered" filtered attribute

2019-11-23 Thread indygreg (Gregory Szorc)
This revision is now accepted and ready to land.
indygreg added a comment.
indygreg accepted this revision.


  I'm satisfied with the discussion and will proceed with reviewing this series.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7483/new/

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

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


D7492: localrepo: also fastpath access to working copy parents when possible

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18365.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7492?vs=18358=18365

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7492/new/

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

AFFECTED FILES
  mercurial/context.py
  mercurial/localrepo.py
  mercurial/scmutil.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -62,7 +62,6 @@
 Getting status of working copy
 
   $ hg status
-  debug.filters: computing revision filter for "visible"
   M c
   A d
   R a
@@ -78,7 +77,6 @@
 Getting working copy diff
 
   $ hg diff
-  debug.filters: computing revision filter for "visible"
   diff -r c2932ca7786be30b67154d541a8764fae5532261 a
   --- a/a  Thu Jan 01 00:00:00 1970 +
   +++ /dev/nullThu Jan 01 00:00:00 1970 +
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1463,6 +1463,7 @@
 if src not in newctx or dst in newctx or ds[dst] != b'a':
 src = None
 ds.copy(src, dst)
+repo._quick_access_changeid_invalidate()
 
 
 def writerequires(opener, requirements):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1514,18 +1514,51 @@
 narrowspec.save(self, newincludes, newexcludes)
 self.invalidate(clearfilecache=True)
 
-@util.propertycache
+@unfilteredpropertycache
+def _quick_access_changeid_null(self):
+return {
+b'null': (nullrev, nullid),
+nullrev: (nullrev, nullid),
+nullid: (nullrev, nullid),
+}
+
+@unfilteredpropertycache
+def _quick_access_changeid_wc(self):
+# also fast path access to the working copy parents
+# however, only do it for filter that ensure wc is visible.
+quick = {}
+cl = self.unfiltered().changelog
+for node in self.dirstate.parents():
+if node == nullid:
+continue
+rev = cl.index.get_rev(node)
+if rev is None:
+# unknown working copy parent case:
+#
+#   skip the fast path and let higher code deal with it
+continue
+pair = (rev, node)
+quick[rev] = pair
+quick[node] = pair
+return quick
+
+@unfilteredmethod
+def _quick_access_changeid_invalidate(self):
+if '_quick_access_changeid_wc' in vars(self):
+del self.__dict__['_quick_access_changeid_wc']
+
+@property
 def _quick_access_changeid(self):
 """an helper dictionnary for __getitem__ calls
 
 This contains a list of symbol we can recognise right away without
 further processing.
 """
-return {
-b'null': (nullrev, nullid),
-nullrev: (nullrev, nullid),
-nullid: (nullrev, nullid),
-}
+mapping = self._quick_access_changeid_null
+if self.filtername in repoview.filter_has_wc:
+mapping = mapping.copy()
+mapping.update(self._quick_access_changeid_wc)
+return mapping
 
 def __getitem__(self, changeid):
 # dealing with special cases
@@ -1897,6 +1930,7 @@
 for f, s in sorted(self.dirstate.copies().items()):
 if f not in pctx and s not in pctx:
 self.dirstate.copy(None, f)
+self._quick_access_changeid_invalidate()
 
 def filectx(self, path, changeid=None, fileid=None, changectx=None):
 """changeid must be a changeset revision, if specified.
@@ -2494,6 +2528,7 @@
 def invalidatevolatilesets(self):
 self.filteredrevcache.clear()
 obsolete.clearobscaches(self)
+self._quick_access_changeid_invalidate()
 
 def invalidatedirstate(self):
 '''Invalidates the dirstate, causing the next call to dirstate
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1963,6 +1963,7 @@
 for f in self.removed():
 self._repo.dirstate.drop(f)
 self._repo.dirstate.setparents(node)
+self._repo._quick_access_changeid_invalidate()
 
 # write changes out explicitly, because nesting wlock at
 # runtime may prevent 'wlock.release()' in 'repo.commit()'



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


D7502: changectx: mark parent of changesets as non filtered

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18367.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7502?vs=18309=18367

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7502/new/

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -530,8 +530,11 @@
 
 p1, p2 = cl.parentrevs(self._rev)
 if p2 == nullrev:
-return [repo[p1]]
-return [repo[p1], repo[p2]]
+return [changectx(repo, p1, cl.node(p1), maybe_filtered=False)]
+return [
+changectx(repo, p1, cl.node(p1), maybe_filtered=False),
+changectx(repo, p2, cl.node(p2), maybe_filtered=False),
+]
 
 def changeset(self):
 c = self._changeset



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


D7501: changectx: use unfiltered changelog to walk ancestors in annotate

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18366.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7501?vs=18308=18366

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7501/new/

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

AFFECTED FILES
  mercurial/context.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -136,13 +136,11 @@
 - file with a single change
 
   $ hg annotate a
-  debug.filters: computing revision filter for "visible"
   0: a
 
 - file with multiple change
 
   $ hg annotate z
-  debug.filters: computing revision filter for "visible"
   0: some line
   1: in a
   2: file
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1158,7 +1158,9 @@
 # use linkrev to find the first changeset where self appeared
 base = self.introfilectx()
 if getattr(base, '_ancestrycontext', None) is None:
-cl = self._repo.changelog
+# it is safe to use an unfiltered repository here because we are
+# walking ancestors only.
+cl = self._repo.unfiltered().changelog
 if base.rev() is None:
 # wctx is not inclusive, but works because _ancestrycontext
 # is used to test filelog revisions



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


D7491: changectx: mark the parents of the working copy as non filtered

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18364.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7491?vs=18298=18364

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7491/new/

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1518,7 +1518,9 @@
 p = p[:-1]
 # use unfiltered repo to delay/avoid loading obsmarkers
 unfi = self._repo.unfiltered()
-return [changectx(self._repo, unfi.changelog.rev(n), n) for n in p]
+return [
+changectx(self._repo, unfi.changelog.rev(n), n, False) for n in p
+]
 
 def _fileinfo(self, path):
 # populate __dict__['_manifest'] as workingctx has no _manifestdelta



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


D7487: changectx: use unfiltered changelog to access parents of unfiltered revs

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18363.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7487?vs=18350=18363

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7487/new/

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

AFFECTED FILES
  mercurial/context.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -58,7 +58,6 @@
 Getting status of null
 
   $ hg status --change null
-  debug.filters: computing revision filter for "visible"
 
 Getting status of working copy
 
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -523,7 +523,12 @@
 @propertycache
 def _parents(self):
 repo = self._repo
-p1, p2 = repo.changelog.parentrevs(self._rev)
+if self._maybe_filtered:
+cl = repo.changelog
+else:
+cl = repo.unfiltered().changelog
+
+p1, p2 = cl.parentrevs(self._rev)
 if p2 == nullrev:
 return [repo[p1]]
 return [repo[p1], repo[p2]]



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


D7483: changectx: add a "maybe filtered" filtered attribute

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18362.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7483?vs=18290=18362

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7483/new/

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -477,10 +477,17 @@
 changeset convenient. It represents a read-only context already present in
 the repo."""
 
-def __init__(self, repo, rev, node):
+def __init__(self, repo, rev, node, maybe_filtered=True):
 super(changectx, self).__init__(repo)
 self._rev = rev
 self._node = node
+# When maybe_filtered is True, the revision might be affected by
+# changelog filtering and operation through the filtered changelog 
must be used.
+#
+# When maybe_filtered is False, the revision has already been checked
+# against filtering and is not filtered. Operation through the
+# unfiltered changelog might be used in some case.
+self._maybe_filtered = maybe_filtered
 
 def __hash__(self):
 try:
@@ -495,7 +502,11 @@
 
 @propertycache
 def _changeset(self):
-return self._repo.changelog.changelogrevision(self.rev())
+if self._maybe_filtered:
+repo = self._repo
+else:
+repo = self._repo.unfiltered()
+return repo.changelog.changelogrevision(self.rev())
 
 @propertycache
 def _manifest(self):



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


D7295: pytype: add a (very slow) test that executes pytype

2019-11-23 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In D7295#110254 , @mharbison72 
wrote:
  
  > In D7295#107482 , @indygreg 
wrote:
  >
  >> Since type checking is slow (but there are state files we can reuse to 
speed things up), we'll need to figure out how to make this work in CI. But I 
have no doubt we can figure something out. Out of curiosity, how long does 
pytype take to run in a clean source directory, without any state files?
  >
  > It takes 15-20 minutes on a 2018 Mac mini.  In addition to the disabled 
files here, I've disabled:
  >
  >   mercurial/httppeer.py
  >   mercurial/repoview.py
  >   mercurial/localrepo.py
  >   mercurial/revlog.py
  >   mercurial/merge.py
  >   mercurial/testing/storage.py
  >
  > But I've also added back these, and sprinkled various disable comments 
around:
  >
  >   mercurial/bundlerepo.py
  >   mercurial/error.py
  >   mercurial/exchange.py
  >   mercurial/policy.py
  >   mercurial/pycompat.py
  >   mercurial/scmwindows.py
  >   mercurial/windows.py
  >   mercurial/wireprotoframing.py
  >
  > Even with the state files, it seems to take 10-15 minutes or so.
  
  Ooh, can you send your extra suppressions? For the most part I've been 
tackling this as a side project when I'm waiting on compiles.
  
  As to doing individual files: that's well and good, and might be a viable 
approach for mypy. That said, my sense has been that mypy is faster and 
significantly less useful, since we don't get cross-file analysis of what's 
going on. I _think_ pytype gets faster as we add more annotations, so my rough 
thought thus far as been to try and get some subset of the codebase clean, 
transitively, and then try to start stamping some types on important functions 
and interfaces to constrain things. Where I'd _really_ like to get is to be 
able to migrate the `@command` decorators and friends to use strings instead of 
bytes, and be able to recommend typechecking as a way for extension authors to 
clean things up, but that'll take a while.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7295/new/

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

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


D7483: changectx: add a "maybe filtered" filtered attribute

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added inline comments.

INLINE COMMENTS

> martinvonz wrote in context.py:484
> Add a comment explaining what this attribute means, such as "indicates that 
> this changeset is visible regardless of filtering". Actually, maybe it's 
> better to name the property something like `filter_agnostic`?

I'll add a comment.

filter_agnostic is misleading. the revision might be filtered for another 
filter.  Is is also borderline double negative.

> martinvonz wrote in context.py:503
> That would make `ctx.children()` incorrect, right?
> 
> I still wonder if the "visible" filter should be removed and (so there would 
> be no `--hidden`, and no annoying message telling you use that flag). We 
> would need to figure out what e.g. `hg log -r 'head()'` and `hg log -r x::` 
> should do (to not include extinct heads) and how to make it easy for the user 
> to get either behavior. Perhaps we would let `head()` be the visible heads 
> and add a new `allheads()` to get all? That's obviously a much larger 
> discussion and maybe a topic for the next sprint instead.

The filtering is usefull at many level and removing it means dedicated code in 
many places (eg: discovery). That is error prone. I feel like effort would be 
better put to simply making it go fast (could be O(1) with proper indexing).
Which anoying message are you talking about ?

I agree that this is a larger discussion and I would rather not see the 
discussion around this series derails. +1 to have it independently later.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7483/new/

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

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


D7483: changectx: add a "maybe filtered" filtered attribute

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  (grmlml, realising that I forgot to do the dual "submit" for my comment. It 
is 2019, why is Phabricator still not fixing this…)

INLINE COMMENTS

> indygreg wrote in context.py:503
> Before I accept more of this series, I'd like others to think about the 
> potential alternative solution of passing in or storing a reference to the 
> changelog on `basectx`/`changectx`. The reason is that a lot of methods are 
> calling `repo.changelog` and this can be expensive. I suspect we'd get a 
> handful of random performance wins if we cached the changelog instance on 
> each `basectx`. We also wouldn't need to litter the code with a bunch of 
> conditional `repo.unfiltered()` calls since we'd already have an appropriate 
> changelog instance stored in the instance.
> 
> Thoughts?

We woul still need the conditional instance since the maybe_filtered logic only 
apply to some of the changectx call. (eg: children need to go through 
filtering).

An overall better/more reobust solution to make the filtering lazier at the 
changelog level and to most the fastpath logic there. It would be more 
contained and more robust.

However, I decided I digged the rabbit hole enough for now and this other 
approach can be looked at later.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7483/new/

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

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


D7507: phabricator: add a "phabstatus" template keyword

2019-11-23 Thread dlax (Denis Laxalde)
dlax added a comment.


  >   I only have a superficial understanding about how templates work, but I 
assume that there's no global pre-resolution step where a single query could be 
done and the results stuffed into the context or something, is there?
  
  Not that I am aware. Using this keyword on large revsets is indeed slow.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7507/new/

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

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


D7507: phabricator: add a "phabstatus" template keyword

2019-11-23 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  I only have a superficial understanding about how templates work, but I 
assume that there's no global pre-resolution step where a single query could be 
done and the results stuffed into the context or something, is there?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7507/new/

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

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


D7483: changectx: add a "maybe filtered" filtered attribute

2019-11-23 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> context.py:484
>  self._node = node
> +self._maybe_filtered = maybe_filtered
>  

Add a comment explaining what this attribute means, such as "indicates that 
this changeset is visible regardless of filtering". Actually, maybe it's better 
to name the property something like `filter_agnostic`?

> indygreg wrote in context.py:503
> Before I accept more of this series, I'd like others to think about the 
> potential alternative solution of passing in or storing a reference to the 
> changelog on `basectx`/`changectx`. The reason is that a lot of methods are 
> calling `repo.changelog` and this can be expensive. I suspect we'd get a 
> handful of random performance wins if we cached the changelog instance on 
> each `basectx`. We also wouldn't need to litter the code with a bunch of 
> conditional `repo.unfiltered()` calls since we'd already have an appropriate 
> changelog instance stored in the instance.
> 
> Thoughts?

That would make `ctx.children()` incorrect, right?

I still wonder if the "visible" filter should be removed and (so there would be 
no `--hidden`, and no annoying message telling you use that flag). We would 
need to figure out what e.g. `hg log -r 'head()'` and `hg log -r x::` should do 
(to not include extinct heads) and how to make it easy for the user to get 
either behavior. Perhaps we would let `head()` be the visible heads and add a 
new `allheads()` to get all? That's obviously a much larger discussion and 
maybe a topic for the next sprint instead.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7483/new/

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

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


D7506: phabricator: add a "phabstatus" show view

2019-11-23 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  In D7506#110351 , @dlax wrote:
  
  > The revisions shown by the "phabstatus" view is just a subset of that of 
"work" view (subset of revisions with a differential). Do you see more 
revisions in "phabstatus" than in "work" or am I misunderstanding something?
  
  No, there are 89 entries in work, and 35 in phabstatus.  (I used `../hg show 
phabstatus | egrep '[0-9a-f]{6}' | wc -l` to tame the output.)  My confusion 
was that things that are direct descendants were showing like they were all 
separate heads.  (e.g. the revision marked `@` and the `@` bookmark 3 above it 
in phabstatus //should// be a direct line.)  This latest update made things 
look way more sane.  The remaining old junk in my output is likely because I 
tend to leave anonymous branches laying around, and it's adding upstream 
parents for context.
  
  > Or perhaps this is because of a wrong sorting of the filtered set? I'll 
make sure the final is still topo sorted and send another version in a moment.
  >
  >> Is the goal to limit to the current stack, or all non public commits?  I 
can see a use case for both.
  >
  > I don't use the "stack" view often, so my goal is to map to the "work" view 
which I use more. But perhaps it'd make sense to have "hg show phabwork" and 
"hg show phabstack"? (We can rename the view, and add the other one later on.)
  
  I had forgotten about the extension TBH.  Because I tend to leave junk 
around, I'd probably use the stack view much more.  Narrowing to the stack also 
seems useful now that the author has been removed since the first revision of 
this.  So I think having both is a good idea.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7506/new/

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

To: dlax, #hg-reviewers
Cc: mharbison72, mjpieters, Kwan, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7500: repoview: add a test for changelog filtering trigger for `hg annotate`

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added a comment.
marmoute abandoned this revision.


  This was pruned, but phab apparently does not detect this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7500/new/

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

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


D7499: repoview: test triggering of filter computation for `hg export`

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added a comment.
marmoute abandoned this revision.


  This was pruned, but phab apparently does not detect this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7499/new/

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

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


D7497: repoview: add a test for filtering computation for `hg diff --change`

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added a comment.
marmoute abandoned this revision.


  This was pruned, but phab apparently does not detect this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7497/new/

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

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


D7496: repoview: add a test for filtering computation for `hg diff`

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added a comment.
marmoute abandoned this revision.


  This was pruned, but phab apparently does not detect this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7496/new/

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

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


D7493: repoview: test changelog filtering triggered by a lookup to '.'

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added a comment.
marmoute abandoned this revision.


  This was pruned, but phab apparently does not detect this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7493/new/

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

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


D7489: repoview: add test for filtering computation when running `hg status`

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added a comment.
marmoute abandoned this revision.


  This was pruned, but phab apparently does not detect this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7489/new/

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

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


D7485: repoview: test filtered computation on `hg status --change` call

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute added a comment.
marmoute abandoned this revision.


  This was pruned, but phab apparently does not detect this.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7485/new/

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

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


D7492: localrepo: also fastpath access to working copy parents when possible

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18358.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7492?vs=18351=18358

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7492/new/

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

AFFECTED FILES
  mercurial/context.py
  mercurial/localrepo.py
  mercurial/scmutil.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -62,7 +62,6 @@
 Getting status of working copy
 
   $ hg status
-  debug.filters: computing revision filter for "visible"
   M c
   A d
   R a
@@ -78,7 +77,6 @@
 Getting working copy diff
 
   $ hg diff
-  debug.filters: computing revision filter for "visible"
   diff -r c2932ca7786be30b67154d541a8764fae5532261 a
   --- a/a  Thu Jan 01 00:00:00 1970 +
   +++ /dev/nullThu Jan 01 00:00:00 1970 +
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1463,6 +1463,7 @@
 if src not in newctx or dst in newctx or ds[dst] != b'a':
 src = None
 ds.copy(src, dst)
+repo._quick_access_changeid_invalidate()
 
 
 def writerequires(opener, requirements):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1514,18 +1514,51 @@
 narrowspec.save(self, newincludes, newexcludes)
 self.invalidate(clearfilecache=True)
 
-@util.propertycache
+@unfilteredpropertycache
+def _quick_access_changeid_null(self):
+return {
+b'null': (nullrev, nullid),
+nullrev: (nullrev, nullid),
+nullid: (nullrev, nullid),
+}
+
+@unfilteredpropertycache
+def _quick_access_changeid_wc(self):
+# also fast path access to the working copy parents
+# however, only do it for filter that ensure wc is visible.
+quick = {}
+cl = self.unfiltered().changelog
+for node in self.dirstate.parents():
+if node == nullid:
+continue
+rev = cl.index.get_rev(node)
+if rev is None:
+# unknown working copy parent case:
+#
+#   skip the fast path and let higher code deal with it
+continue
+pair = (rev, node)
+quick[rev] = pair
+quick[node] = pair
+return quick
+
+@unfilteredmethod
+def _quick_access_changeid_invalidate(self):
+if '_quick_access_changeid_wc' in vars(self):
+del self.__dict__['_quick_access_changeid_wc']
+
+@property
 def _quick_access_changeid(self):
 """an helper dictionnary for __getitem__ calls
 
 This contains a list of symbol we can recognise right away without
 further processing.
 """
-return {
-b'null': (nullrev, nullid),
-nullrev: (nullrev, nullid),
-nullid: (nullrev, nullid),
-}
+mapping = self._quick_access_changeid_null
+if self.filtername in repoview.filter_has_wc:
+mapping = mapping.copy()
+mapping.update(self._quick_access_changeid_wc)
+return mapping
 
 def __getitem__(self, changeid):
 # dealing with special cases
@@ -1897,6 +1930,7 @@
 for f, s in sorted(self.dirstate.copies().items()):
 if f not in pctx and s not in pctx:
 self.dirstate.copy(None, f)
+self._quick_access_changeid_invalidate()
 
 def filectx(self, path, changeid=None, fileid=None, changectx=None):
 """changeid must be a changeset revision, if specified.
@@ -2494,6 +2528,7 @@
 def invalidatevolatilesets(self):
 self.filteredrevcache.clear()
 obsolete.clearobscaches(self)
+self._quick_access_changeid_invalidate()
 
 def invalidatedirstate(self):
 '''Invalidates the dirstate, causing the next call to dirstate
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1957,6 +1957,7 @@
 for f in self.removed():
 self._repo.dirstate.drop(f)
 self._repo.dirstate.setparents(node)
+self._repo._quick_access_changeid_invalidate()
 
 # write changes out explicitly, because nesting wlock at
 # runtime may prevent 'wlock.release()' in 'repo.commit()'



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


D7498: localrepo: also fast past the parents of working copies parents

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18361.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7498?vs=18353=18361

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7498/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -93,7 +93,6 @@
   @@ -0,0 +1,1 @@
   +d
   $ hg diff --change .
-  debug.filters: computing revision filter for "visible"
   diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 c
   --- /dev/nullThu Jan 01 00:00:00 1970 +
   +++ b/c  Thu Jan 01 00:00:00 1970 +
@@ -111,7 +110,6 @@
 
   $ hg export
   exporting patch:
-  debug.filters: computing revision filter for "visible"
   # HG changeset patch
   # User test
   # Date 0 0
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1540,6 +1540,14 @@
 pair = (rev, node)
 quick[rev] = pair
 quick[node] = pair
+# also add the parents of the parents
+for r in cl.parentrevs(rev):
+if r == nullrev:
+continue
+n = cl.node(r)
+pair = (r, n)
+quick[r] = pair
+quick[n] = pair
 p1node = self.dirstate.p1()
 if p1node != nullid:
 quick[b'.'] = quick[p1node]



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


D7495: localrepo: recognize trivial request for '.'

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18360.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7495?vs=18352=18360

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7495/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -70,7 +70,6 @@
 Getting data about the working copy parent
 
   $ hg log -r '.' -T "{node}\n{date}\n"
-  debug.filters: computing revision filter for "visible"
   c2932ca7786be30b67154d541a8764fae5532261
   0.00
 
@@ -111,8 +110,8 @@
 exporting the current changeset
 
   $ hg export
+  exporting patch:
   debug.filters: computing revision filter for "visible"
-  exporting patch:
   # HG changeset patch
   # User test
   # Date 0 0
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1705,6 +1705,10 @@
 '''
 if specs == [b'null']:
 return revset.baseset([nullrev])
+if specs == [b'.']:
+quick_data = self._quick_access_changeid.get(b'.')
+if quick_data is not None:
+return revset.baseset([quick_data[0]])
 if user:
 m = revset.matchany(
 self.ui,



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


D7494: localrepo: fastpath access to "."

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18359.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7494?vs=18301=18359

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7494/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1540,6 +1540,9 @@
 pair = (rev, node)
 quick[rev] = pair
 quick[node] = pair
+p1node = self.dirstate.p1()
+if p1node != nullid:
+quick[b'.'] = quick[p1node]
 return quick
 
 @unfilteredmethod



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


D7488: localrepo: introduce a `_quick_access_changeid` property

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18357.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7488?vs=18295=18357

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7488/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1514,6 +1514,19 @@
 narrowspec.save(self, newincludes, newexcludes)
 self.invalidate(clearfilecache=True)
 
+@util.propertycache
+def _quick_access_changeid(self):
+"""an helper dictionnary for __getitem__ calls
+
+This contains a list of symbol we can recognise right away without
+further processing.
+"""
+return {
+b'null': (nullrev, nullid),
+nullrev: (nullrev, nullid),
+nullid: (nullrev, nullid),
+}
+
 def __getitem__(self, changeid):
 # dealing with special cases
 if changeid is None:
@@ -1531,8 +1544,10 @@
 ]
 
 # dealing with some special values
-if changeid == b'null' or changeid == nullrev or changeid == nullid:
-return context.changectx(self, nullrev, nullid, False)
+quick_access = self._quick_access_changeid.get(changeid)
+if quick_access is not None:
+rev, node = quick_access
+return context.changectx(self, rev, node, False)
 if changeid == b'tip':
 node = self.changelog.tip()
 rev = self.changelog.rev(node)



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


D7486: locarepo: also fastpath `nullid` lookup in __getitem__

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18356.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7486?vs=18293=18356

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7486/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1531,7 +1531,7 @@
 ]
 
 # dealing with some special values
-if changeid == b'null' or changeid == nullrev:
+if changeid == b'null' or changeid == nullrev or changeid == nullid:
 return context.changectx(self, nullrev, nullid, False)
 if changeid == b'tip':
 node = self.changelog.tip()



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


D7484: localrepo: mark nullrev has never filtered

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18355.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7484?vs=18349=18355

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7484/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -52,7 +52,6 @@
 Getting basic changeset inforation about `null`
 
   $ hg log -r null -T "{node}\n{date}\n"
-  debug.filters: computing revision filter for "visible"
   
   0.00
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1532,7 +1532,7 @@
 
 # dealing with some special values
 if changeid == b'null' or changeid == nullrev:
-return context.changectx(self, nullrev, nullid)
+return context.changectx(self, nullrev, nullid, False)
 if changeid == b'tip':
 node = self.changelog.tip()
 rev = self.changelog.rev(node)



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


D7514: repoview: add more tests to track operation not supposed to trigger filtering

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This test is useful to confirm we removed filtering trigger and to prevent
  it to come back without us noticing.
  
  The commands tested in the test were initially introduced one by one. However,
  on Martin von Zweigbergk request, we are adding them all at once.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -46,8 +46,6 @@
 
 Getting the node of `null`
 
-  $ hg init test-repo
-  $ cd test-repo
   $ hg log -r null -T "{node}\n"
   
 
@@ -57,3 +55,101 @@
   debug.filters: computing revision filter for "visible"
   
   0.00
+
+Getting status of null
+
+  $ hg status --change null
+  debug.filters: computing revision filter for "visible"
+
+Getting status of working copy
+
+  $ hg status
+  debug.filters: computing revision filter for "visible"
+  M c
+  A d
+  R a
+  ! b
+
+Getting data about the working copy parent
+
+  $ hg log -r '.' -T "{node}\n{date}\n"
+  debug.filters: computing revision filter for "visible"
+  c2932ca7786be30b67154d541a8764fae5532261
+  0.00
+
+Getting working copy diff
+
+  $ hg diff
+  debug.filters: computing revision filter for "visible"
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 a
+  --- a/a  Thu Jan 01 00:00:00 1970 +
+  +++ /dev/nullThu Jan 01 00:00:00 1970 +
+  @@ -1,1 +0,0 @@
+  -a
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 c
+  --- a/c  Thu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -1,1 +1,1 @@
+  -c
+  +c1
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 d
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/d  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +d
+  $ hg diff --change .
+  debug.filters: computing revision filter for "visible"
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +c
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 z
+  --- a/z  Thu Jan 01 00:00:00 1970 +
+  +++ b/z  Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+   some line
+   in a
+  +file
+
+exporting the current changeset
+
+  $ hg export
+  debug.filters: computing revision filter for "visible"
+  exporting patch:
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #  Thu Jan 01 00:00:00 1970 +
+  # Node ID c2932ca7786be30b67154d541a8764fae5532261
+  # Parent  05293e5dd8d1ae4f84a8520a11c6f97cad26deca
+  c
+  
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +c
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 z
+  --- a/z  Thu Jan 01 00:00:00 1970 +
+  +++ b/z  Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+   some line
+   in a
+  +file
+
+using annotate
+
+- file with a single change
+
+  $ hg annotate a
+  debug.filters: computing revision filter for "visible"
+  0: a
+
+- file with multiple change
+
+  $ hg annotate z
+  debug.filters: computing revision filter for "visible"
+  0: some line
+  1: in a
+  2: file



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


D7492: localrepo: also fastpath access to working copy parents when possible

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18351.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7492?vs=18299=18351

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7492/new/

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

AFFECTED FILES
  mercurial/context.py
  mercurial/localrepo.py
  mercurial/scmutil.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -62,7 +62,6 @@
 Getting status of working copy
 
   $ hg status
-  debug.filters: computing revision filter for "visible"
   M c
   A d
   R a
@@ -78,7 +77,6 @@
 Getting working copy diff
 
   $ hg diff
-  debug.filters: computing revision filter for "visible"
   diff -r c2932ca7786be30b67154d541a8764fae5532261 a
   --- a/a  Thu Jan 01 00:00:00 1970 +
   +++ /dev/nullThu Jan 01 00:00:00 1970 +
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1463,6 +1463,7 @@
 if src not in newctx or dst in newctx or ds[dst] != b'a':
 src = None
 ds.copy(src, dst)
+repo._quick_access_changeid_invalidate()
 
 
 def writerequires(opener, requirements):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1514,18 +1514,51 @@
 narrowspec.save(self, newincludes, newexcludes)
 self.invalidate(clearfilecache=True)
 
-@util.propertycache
+@unfilteredpropertycache
+def _quick_access_changeid_null(self):
+return {
+b'null': (nullrev, nullid),
+nullrev: (nullrev, nullid),
+nullid: (nullrev, nullid),
+}
+
+@unfilteredpropertycache
+def _quick_access_changeid_wc(self):
+# also fast path access to the working copy parents
+# however, only do it for filter that ensure wc is visible.
+quick = {}
+cl = self.unfiltered().changelog
+for node in self.dirstate.parents():
+if node == nullid:
+continue
+rev = cl.index.get_rev(node)
+if rev is None:
+# unknown working copy parent case:
+#
+#   skip the fast path and let higher code deal with it
+continue
+pair = (rev, node)
+quick[rev] = pair
+quick[node] = pair
+return quick
+
+@unfilteredmethod
+def _quick_access_changeid_invalidate(self):
+if '_quick_access_changeid_wc' in vars(self):
+del self.__dict__['_quick_access_changeid_wc']
+
+@property
 def _quick_access_changeid(self):
 """an helper dictionnary for __getitem__ calls
 
 This contains a list of symbol we can recognise right away without
 further processing.
 """
-return {
-b'null': (nullrev, nullid),
-nullrev: (nullrev, nullid),
-nullid: (nullrev, nullid),
-}
+mapping = self._quick_access_changeid_null
+if self.filtername in repoview.filter_has_wc:
+mapping = mapping.copy()
+mapping.update(self._quick_access_changeid_wc)
+return mapping
 
 def __getitem__(self, changeid):
 # dealing with special cases
@@ -1897,6 +1930,7 @@
 for f, s in sorted(self.dirstate.copies().items()):
 if f not in pctx and s not in pctx:
 self.dirstate.copy(None, f)
+self._quick_access_changeid_invalidate()
 
 def filectx(self, path, changeid=None, fileid=None, changectx=None):
 """changeid must be a changeset revision, if specified.
@@ -2495,6 +2529,7 @@
 def invalidatevolatilesets(self):
 self.filteredrevcache.clear()
 obsolete.clearobscaches(self)
+self._quick_access_changeid_invalidate()
 
 def invalidatedirstate(self):
 '''Invalidates the dirstate, causing the next call to dirstate
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1957,6 +1957,7 @@
 for f in self.removed():
 self._repo.dirstate.drop(f)
 self._repo.dirstate.setparents(node)
+self._repo._quick_access_changeid_invalidate()
 
 # write changes out explicitly, because nesting wlock at
 # runtime may prevent 'wlock.release()' in 'repo.commit()'



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


D7498: localrepo: also fast past the parents of working copies parents

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18353.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7498?vs=18305=18353

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7498/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -93,7 +93,6 @@
   @@ -0,0 +1,1 @@
   +d
   $ hg diff --change .
-  debug.filters: computing revision filter for "visible"
   diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 c
   --- /dev/nullThu Jan 01 00:00:00 1970 +
   +++ b/c  Thu Jan 01 00:00:00 1970 +
@@ -111,7 +110,6 @@
 
   $ hg export
   exporting patch:
-  debug.filters: computing revision filter for "visible"
   # HG changeset patch
   # User test
   # Date 0 0
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1540,6 +1540,14 @@
 pair = (rev, node)
 quick[rev] = pair
 quick[node] = pair
+# also add the parents of the parents
+for r in cl.parentrevs(rev):
+if r == nullrev:
+continue
+n = cl.node(r)
+pair = (r, n)
+quick[r] = pair
+quick[n] = pair
 p1node = self.dirstate.p1()
 if p1node != nullid:
 quick[b'.'] = quick[p1node]



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


D7495: localrepo: recognize trivial request for '.'

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18352.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7495?vs=18302=18352

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7495/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -70,7 +70,6 @@
 Getting data about the working copy parent
 
   $ hg log -r '.' -T "{node}\n{date}\n"
-  debug.filters: computing revision filter for "visible"
   c2932ca7786be30b67154d541a8764fae5532261
   0.00
 
@@ -111,8 +110,8 @@
 exporting the current changeset
 
   $ hg export
+  exporting patch:
   debug.filters: computing revision filter for "visible"
-  exporting patch:
   # HG changeset patch
   # User test
   # Date 0 0
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1705,6 +1705,10 @@
 '''
 if specs == [b'null']:
 return revset.baseset([nullrev])
+if specs == [b'.']:
+quick_data = self._quick_access_changeid.get(b'.')
+if quick_data is not None:
+return revset.baseset([quick_data[0]])
 if user:
 m = revset.matchany(
 self.ui,



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


D7487: changectx: use unfiltered changelog to access parents of unfiltered revs

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18350.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7487?vs=18294=18350

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7487/new/

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

AFFECTED FILES
  mercurial/context.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -58,7 +58,6 @@
 Getting status of null
 
   $ hg status --change null
-  debug.filters: computing revision filter for "visible"
 
 Getting status of working copy
 
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -517,7 +517,12 @@
 @propertycache
 def _parents(self):
 repo = self._repo
-p1, p2 = repo.changelog.parentrevs(self._rev)
+if self._maybe_filtered:
+cl = repo.changelog
+else:
+cl = repo.unfiltered().changelog
+
+p1, p2 = cl.parentrevs(self._rev)
 if p2 == nullrev:
 return [repo[p1]]
 return [repo[p1], repo[p2]]



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


D7484: localrepo: mark nullrev has never filtered

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18349.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7484?vs=18291=18349

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7484/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -52,7 +52,6 @@
 Getting basic changeset inforation about `null`
 
   $ hg log -r null -T "{node}\n{date}\n"
-  debug.filters: computing revision filter for "visible"
   
   0.00
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1532,7 +1532,7 @@
 
 # dealing with some special values
 if changeid == b'null' or changeid == nullrev:
-return context.changectx(self, nullrev, nullid)
+return context.changectx(self, nullrev, nullid, False)
 if changeid == b'tip':
 node = self.changelog.tip()
 rev = self.changelog.rev(node)



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


D7481: localrepo: recognize trivial "null" queries in `anyrev`

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18348.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7481?vs=18333=18348

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7481/new/

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
--- a/tests/test-repo-filters-tiptoe.t
+++ b/tests/test-repo-filters-tiptoe.t
@@ -47,7 +47,6 @@
 Getting the node of `null`
 
   $ hg log -r null -T "{node}\n"
-  debug.filters: computing revision filter for "visible"
   
 
 Getting basic changeset inforation about `null`
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1652,6 +1652,8 @@
 definitions overriding user aliases, set ``localalias`` to
 ``{name: definitionstring}``.
 '''
+if specs == [b'null']:
+return revset.baseset([nullrev])
 if user:
 m = revset.matchany(
 self.ui,



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


D7480: localrepo: also fastpath `nullrev` in __getitem__

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18347.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7480?vs=18332=18347

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7480/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1531,7 +1531,7 @@
 ]
 
 # dealing with some special values
-if changeid == b'null':
+if changeid == b'null' or changeid == nullrev:
 return context.changectx(self, nullrev, nullid)
 if changeid == b'tip':
 node = self.changelog.tip()



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


D7477: util: add an optional `prefix` argument to debugstacktrace

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18344.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7477?vs=18329=18344

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7477/new/

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -3466,6 +3466,7 @@
 f=procutil.stderr,
 otherf=procutil.stdout,
 depth=0,
+prefix=b'',
 ):
 '''Writes a message to f (stderr) with a nicely formatted stacktrace.
 Skips the 'skip' entries closest to the call, then show 'depth' entries.
@@ -3475,9 +3476,9 @@
 '''
 if otherf:
 otherf.flush()
-f.write(b'%s at:\n' % msg.rstrip())
+f.write(b'%s%s at:\n' % (prefix, msg.rstrip()))
 for line in getstackframes(skip + 1, depth=depth):
-f.write(line)
+f.write(prefix + line)
 f.flush()
 
 



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


D7479: repoview: add a test to track operation not supposed to trigger filtering

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute edited the summary of this revision.
marmoute updated this revision to Diff 18346.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7479?vs=18331=18346

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7479/new/

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

AFFECTED FILES
  tests/test-repo-filters-tiptoe.t

CHANGE DETAILS

diff --git a/tests/test-repo-filters-tiptoe.t b/tests/test-repo-filters-tiptoe.t
new file mode 100644
--- /dev/null
+++ b/tests/test-repo-filters-tiptoe.t
@@ -0,0 +1,156 @@
+===
+Test repository filtering avoidance
+===
+
+This test file is a bit special as he does not check feature, but performance 
related internal code path.
+
+Right now, filtering a repository comes with a cost that might be significant.
+Until this get better, ther are various operation that try hard not to trigger
+a filtering computation. This test file make sure we don't reintroduce code 
that trigger the filtering for these operation:
+
+Setup
+-
+  $ hg init test-repo
+  $ cd test-repo
+  $ echo "some line" > z
+  $ echo a > a
+  $ hg commit -Am a
+  adding a
+  adding z
+  $ echo "in a" >> z
+  $ echo b > b
+  $ hg commit -Am b
+  adding b
+  $ echo "file" >> z
+  $ echo c > c
+  $ hg commit -Am c
+  adding c
+  $ hg rm a
+  $ echo c1 > c
+  $ hg add c
+  c already tracked!
+  $ echo d > d
+  $ hg add d
+  $ rm b
+
+  $ cat << EOF >> $HGRCPATH
+  > [devel]
+  > debug.repo-filters = yes
+  > [ui]
+  > debug = yes
+  > EOF
+
+
+tests
+-
+
+Getting the node of `null`
+
+  $ hg log -r null -T "{node}\n"
+  debug.filters: computing revision filter for "visible"
+  
+
+Getting basic changeset inforation about `null`
+
+  $ hg log -r null -T "{node}\n{date}\n"
+  debug.filters: computing revision filter for "visible"
+  
+  0.00
+
+Getting status of null
+
+  $ hg status --change null
+  debug.filters: computing revision filter for "visible"
+
+Getting status of working copy
+
+  $ hg status
+  debug.filters: computing revision filter for "visible"
+  M c
+  A d
+  R a
+  ! b
+
+Getting data about the working copy parent
+
+  $ hg log -r '.' -T "{node}\n{date}\n"
+  debug.filters: computing revision filter for "visible"
+  c2932ca7786be30b67154d541a8764fae5532261
+  0.00
+
+Getting working copy diff
+
+  $ hg diff
+  debug.filters: computing revision filter for "visible"
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 a
+  --- a/a  Thu Jan 01 00:00:00 1970 +
+  +++ /dev/nullThu Jan 01 00:00:00 1970 +
+  @@ -1,1 +0,0 @@
+  -a
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 c
+  --- a/c  Thu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -1,1 +1,1 @@
+  -c
+  +c1
+  diff -r c2932ca7786be30b67154d541a8764fae5532261 d
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/d  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +d
+  $ hg diff --change .
+  debug.filters: computing revision filter for "visible"
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +c
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 z
+  --- a/z  Thu Jan 01 00:00:00 1970 +
+  +++ b/z  Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+   some line
+   in a
+  +file
+
+exporting the current changeset
+
+  $ hg export
+  debug.filters: computing revision filter for "visible"
+  exporting patch:
+  # HG changeset patch
+  # User test
+  # Date 0 0
+  #  Thu Jan 01 00:00:00 1970 +
+  # Node ID c2932ca7786be30b67154d541a8764fae5532261
+  # Parent  05293e5dd8d1ae4f84a8520a11c6f97cad26deca
+  c
+  
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 c
+  --- /dev/nullThu Jan 01 00:00:00 1970 +
+  +++ b/c  Thu Jan 01 00:00:00 1970 +
+  @@ -0,0 +1,1 @@
+  +c
+  diff -r 05293e5dd8d1ae4f84a8520a11c6f97cad26deca -r 
c2932ca7786be30b67154d541a8764fae5532261 z
+  --- a/z  Thu Jan 01 00:00:00 1970 +
+  +++ b/z  Thu Jan 01 00:00:00 1970 +
+  @@ -1,2 +1,3 @@
+   some line
+   in a
+  +file
+
+using annotate
+
+- file with a single change
+
+  $ hg annotate a
+  debug.filters: computing revision filter for "visible"
+  0: a
+
+- file with multiple change
+
+  $ hg annotate z
+  debug.filters: computing revision filter for "visible"
+  0: some line
+  1: in a
+  2: file



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


D7475: localrepo: extract handling of some special value in __getitem__

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18342.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7475?vs=18327=18342

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7475/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1533,14 +1533,16 @@
 # dealing with some special values
 if changeid == b'null':
 return context.changectx(self, nullrev, nullid)
+if changeid == b'tip':
+node = self.changelog.tip()
+rev = self.changelog.rev(node)
+return context.changectx(self, rev, node)
+
 # dealing with arbitrary values
 try:
 if isinstance(changeid, int):
 node = self.changelog.node(changeid)
 rev = changeid
-elif changeid == b'tip':
-node = self.changelog.tip()
-rev = self.changelog.rev(node)
 elif changeid == b'.':
 # this is a hack to delay/avoid loading obsmarkers
 # when we know that '.' won't be hidden



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


D7478: repoview: display stack trace along side the debug message

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18345.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7478?vs=18330=18345

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7478/new/

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

AFFECTED FILES
  mercurial/repoview.py

CHANGE DETAILS

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -218,8 +218,18 @@
 cache it's result"""
 if filtername not in repo.filteredrevcache:
 if repo.ui.configbool(b'devel', b'debug.repo-filters'):
-msg = b'debug.filters: computing revision filter for "%s"\n'
-repo.ui.debug(msg % filtername)
+msg = b'computing revision filter for "%s"'
+msg %= filtername
+if repo.ui.tracebackflag and repo.ui.debugflag:
+# XXX use ui.write_err
+util.debugstacktrace(
+msg,
+f=repo.ui._fout,
+otherf=repo.ui._ferr,
+prefix=b'debug.filters: ',
+)
+else:
+repo.ui.debug(b'debug.filters: %s\n' % msg)
 func = filtertable[filtername]
 if visibilityexceptions:
 return func(repo.unfiltered, visibilityexceptions)



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


D7476: repoview: add a 'devel.debug.repo-filter' option

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18343.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7476?vs=18328=18343

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7476/new/

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

AFFECTED FILES
  mercurial/configitems.py
  mercurial/repoview.py

CHANGE DETAILS

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -217,6 +217,9 @@
 hidden-state and must be visible. They are dynamic and hence we should not
 cache it's result"""
 if filtername not in repo.filteredrevcache:
+if repo.ui.configbool(b'devel', b'debug.repo-filters'):
+msg = b'debug.filters: computing revision filter for "%s"\n'
+repo.ui.debug(msg % filtername)
 func = filtertable[filtername]
 if visibilityexceptions:
 return func(repo.unfiltered, visibilityexceptions)
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -433,6 +433,9 @@
 b'devel', b'debug.extensions', default=False,
 )
 coreconfigitem(
+b'devel', b'debug.repo-filters', default=False,
+)
+coreconfigitem(
 b'devel', b'debug.peer-request', default=False,
 )
 coreconfigitem(



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


D7474: localrepo: extract handling of some special value in __getitem__

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18341.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7474?vs=18326=18341

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7474/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1530,14 +1530,14 @@
 if i not in self.changelog.filteredrevs
 ]
 
+# dealing with some special values
+if changeid == b'null':
+return context.changectx(self, nullrev, nullid)
 # dealing with arbitrary values
 try:
 if isinstance(changeid, int):
 node = self.changelog.node(changeid)
 rev = changeid
-elif changeid == b'null':
-node = nullid
-rev = nullrev
 elif changeid == b'tip':
 node = self.changelog.tip()
 rev = self.changelog.rev(node)



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


D7473: localrepo: add some basic comment for block in __getitem__

2019-11-23 Thread marmoute (Pierre-Yves David)
marmoute updated this revision to Diff 18340.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7473?vs=18325=18340

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7473/new/

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

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1515,10 +1515,13 @@
 self.invalidate(clearfilecache=True)
 
 def __getitem__(self, changeid):
+# dealing with special cases
 if changeid is None:
 return context.workingctx(self)
 if isinstance(changeid, context.basectx):
 return changeid
+
+# dealing with multiple revisions
 if isinstance(changeid, slice):
 # wdirrev isn't contiguous so the slice shouldn't include it
 return [
@@ -1526,6 +1529,8 @@
 for i in pycompat.xrange(*changeid.indices(len(self)))
 if i not in self.changelog.filteredrevs
 ]
+
+# dealing with arbitrary values
 try:
 if isinstance(changeid, int):
 node = self.changelog.node(changeid)



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


D7513: phabricator: fix processing of tags/desc in getoldnodedrevmap()

2019-11-23 Thread dlax (Denis Laxalde)
dlax created this revision.
Herald added subscribers: mercurial-devel, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It seems that the previous logic was wrong (it essentially comes
  from changeset 3ab0d5767b54 
 
where the result got accumulated instead of
  early returned).
  First of all, the "continue" in first "if m:" is useless because we're
  at the end of the loop. Then, the algorithm seems weird because we will
  process all predecessors of a node and possibly override
  `toconfirm[node]` for each of these having a tag (maybe this doesn't
  happen, but still). Finally, we would also override `toconfirm[node]`
  when the "Differential Revision: " is found in changeset description.
  Maybe this is not a big deal when there is no mix of local tag and
  changeset description update?
  
  The logic is changed so that the loop on predecessors stops upon first
  match of a tag and so that the changeset description is only checked if
  no tag was found. Therefore, `toconfirm[node]` is only set once.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -403,12 +403,15 @@
 m = _differentialrevisiontagre.match(tag)
 if m:
 toconfirm[node] = (0, set(precnodes), int(m.group(1)))
-continue
-
-# Check commit message
-m = _differentialrevisiondescre.search(ctx.description())
-if m:
-toconfirm[node] = (1, set(precnodes), int(m.group('id')))
+break
+else:
+continue  # move to next predecessor
+break  # found a tag, stop
+else:
+# Check commit message
+m = _differentialrevisiondescre.search(ctx.description())
+if m:
+toconfirm[node] = (1, set(precnodes), int(m.group('id')))
 
 # Double check if tags are genuine by collecting all old nodes from
 # Phabricator, and expect precursors overlap with it.



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


D7506: phabricator: add a "phabstatus" show view

2019-11-23 Thread dlax (Denis Laxalde)
dlax edited the summary of this revision.
dlax updated this revision to Diff 18338.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7506?vs=18320=18338

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7506/new/

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -11,6 +11,10 @@
 revisions in a format suitable for :hg:`import`, and a ``phabupdate`` command
 to update statuses in batch.
 
+A "phabstatus" view for :hg:`show` is also provided; it displays status
+information of Phabricator differentials associated with unfinished
+changesets.
+
 By default, Phabricator requires ``Test Plan`` which might prevent some
 changeset from being sent. The requirement could be disabled by changing
 ``differential.require-test-plan-field`` config server side.
@@ -60,9 +64,11 @@
 encoding,
 error,
 exthelper,
+graphmod,
 httpconnection as httpconnectionmod,
 match,
 mdiff,
+logcmdutil,
 obsutil,
 parser,
 patch,
@@ -80,6 +86,11 @@
 procutil,
 stringutil,
 )
+from hgext.show import (
+longestshortest,
+showview,
+)
+
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
@@ -462,6 +473,29 @@
 return result
 
 
+def getdrevmap(repo, revs):
+"""Return a dict mapping each rev in `revs` to their Differential Revision
+ID or None.
+"""
+result = {}
+for rev in revs:
+result[rev] = None
+ctx = repo[rev]
+# Check commit message
+m = _differentialrevisiondescre.search(ctx.description())
+if m:
+result[rev] = int(m.group('id'))
+continue
+# Check tags
+for tag in repo.nodetags(ctx.node()):
+m = _differentialrevisiontagre.match(tag)
+if m:
+result[rev] = int(m.group(1))
+break
+
+return result
+
+
 def getdiff(ctx, diffopts):
 """plain-text diff without header (user, commit message, etc)"""
 output = util.stringio()
@@ -1648,3 +1682,42 @@
 
 return templateutil.hybriddict({b'url': url, b'id': t,})
 return None
+
+
+@showview(b'phabstatus', csettopic=b'work')
+def phabstatusshowview(ui, repo, displayer):
+"""Phabricator differiential status"""
+revs = repo.revs('sort(_underway(), topo)')
+drevmap = getdrevmap(repo, revs)
+unknownrevs, drevids, revsbydrevid = [], set([]), {}
+for rev, drevid in pycompat.iteritems(drevmap):
+if drevid is not None:
+drevids.add(drevid)
+revsbydrevid.setdefault(drevid, set([])).add(rev)
+else:
+unknownrevs.append(rev)
+
+drevs = callconduit(ui, b'differential.query', {b'ids': list(drevids)})
+drevsbyrev = {}
+for drev in drevs:
+for rev in revsbydrevid[int(drev[b'id'])]:
+drevsbyrev[rev] = drev
+
+def phabstatus(ctx):
+drev = drevsbyrev[ctx.rev()]
+ui.write(b"\n%(uri)s %(statusName)s\n" % drev)
+
+revs -= smartset.baseset(unknownrevs)
+revdag = graphmod.dagwalker(repo, revs)
+
+ui.setconfig(b'experimental', b'graphshorten', True)
+displayer._exthook = phabstatus
+nodelen = longestshortest(repo, revs)
+logcmdutil.displaygraph(
+ui,
+repo,
+revdag,
+displayer,
+graphmod.asciiedges,
+props={b'nodelen': nodelen},
+)



To: dlax, #hg-reviewers
Cc: mharbison72, mjpieters, Kwan, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7506: phabricator: add a "phabstatus" show view

2019-11-23 Thread dlax (Denis Laxalde)
dlax added a comment.
dlax planned changes to this revision.


  In D7506#110321 , @mharbison72 
wrote:
  
  > In D7506#110288 , @mharbison72 
wrote:
  >
  >> I'm not sure why, but this version seems to also show obsolete revisions.  
I've got a bunch of `x` and `*` nodes in hg-committed right now.  I didn't see 
that before, although that was on a different clone that I don't have access to 
now.
  >
  > After further review, the obsolete revisions have unstable children going 
way back, so that's why they show.  But I'm super confused by the output.  This 
isn't the whole output, but the middle or so that corresponds to the latest(!) 
commits:
  
  Hm, I don't have this issue. Even with visible obsolete revisions with a phab 
differential, the output seem consistent with "show work".
  The revisions shown by the "phabstatus" view is just a subset of that of 
"work" view (subset of revisions with a differential). Do you see more 
revisions in "phabstatus" than in "work" or am I misunderstanding something?
  Or perhaps this is because of a wrong sorting of the filtered set? I'll make 
sure the final is still topo sorted and send another version in a moment.
  
  > Is the goal to limit to the current stack, or all non public commits?  I 
can see a use case for both.
  
  I don't use the "stack" view often, so my goal is to map to the "work" view 
which I use more. But perhaps it'd make sense to have "hg show phabwork" and 
"hg show phabstack"? (We can rename the view, and add the other one later on.)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7506/new/

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

To: dlax, #hg-reviewers
Cc: mharbison72, mjpieters, Kwan, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel