[PATCH] improve mobile view with viewport and css media query

2021-04-01 Thread Heddi Nabbisen via Mercurial-devel
# HG changeset patch
# User nabbisen 
# Date 1617325695 -32400
#  Fri Apr 02 10:08:15 2021 +0900
# Node ID f269688339206a9f7c85fb089cd9adb9c8215a92
# Parent  5284da57c604bc5a36ac74b36001ce3d6e0be1d3
improve mobile view with viewport and css media query

diff -r 5284da57c604 -r f26968833920 static/css/styles.css
--- a/static/css/styles.css Mon Oct 26 14:55:33 2020 +0100
+++ b/static/css/styles.css Fri Apr 02 10:08:15 2021 +0900
@@ -205,3 +205,20 @@
 .wrap {
 white-space: pre-wrap;
 }
+
+/** todo: 876px? */
+@media (max-width: 876px) {
+body { width: 100vw; padding: 0; margin: 0; }
+
+.row { padding: 0.3rem 0.7rem; }
+.col { float: unset; display: block; width: 100%; padding: 0.3rem 0.7rem; 
margin: 0; }
+.big { float: unset; width: 100%; }
+
+#nav { position: static; width: 100vw; height: auto; padding: 0.3rem 0; 
line-height: 1.25em; }
+
+#content { padding: 0.4rem 0.2rem; }
+#content .table-of-contents { font-size: 100%; }
+#content .table-of-contents li { line-height: 2.4em; }
+
+pre, .output { overflow-x: auto; }
+}
diff -r 5284da57c604 -r f26968833920 templates/base.html
--- a/templates/base.html   Mon Oct 26 14:55:33 2020 +0100
+++ b/templates/base.html   Fri Apr 02 10:08:15 2021 +0900
@@ -1,8 +1,9 @@
-http://www.w3.org/TR/html4/loose.dtd;>
-
+
+
 
-
+
+
+
 
 
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10295: exthelper: improve docs to indicate what module vars are needed

2021-04-01 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I recently tried creating an extension "from scratch" using exthelper, and it
  wasn't obvious that you needed these. I believe that a careful reading of one 
of
  the comments would tell you that they were required, but it's easy to miss and
  having the examples be "complete" is helpful.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/exthelper.py

CHANGE DETAILS

diff --git a/mercurial/exthelper.py b/mercurial/exthelper.py
--- a/mercurial/exthelper.py
+++ b/mercurial/exthelper.py
@@ -46,13 +46,22 @@
 # ext.py
 eh = exthelper.exthelper()
 
-# As needed:
+# As needed (failure to do this will mean your registration will not
+# happen):
 cmdtable = eh.cmdtable
 configtable = eh.configtable
 filesetpredicate = eh.filesetpredicate
 revsetpredicate = eh.revsetpredicate
 templatekeyword = eh.templatekeyword
 
+# As needed (failure to do this will mean your eh.wrap*-decorated
+# functions will not wrap, and/or your eh.*setup-decorated functions
+# will not execute):
+uisetup = eh.finaluisetup
+extsetup = eh.finalextsetup
+reposetup = eh.finalreposetup
+uipopulate = eh.finaluipopulate
+
 @eh.command(b'mynewcommand',
 [(b'r', b'rev', [], _(b'operate on these revisions'))],
 _(b'-r REV...'),
@@ -155,7 +164,7 @@
 c(ui)
 
 def finalextsetup(self, ui):
-"""Method to be used as a the extension extsetup
+"""Method to be used as the extension extsetup
 
 The following operations belong here:
 
@@ -201,6 +210,9 @@
 
 example::
 
+# Required, otherwise your uisetup function(s) will not execute.
+uisetup = eh.finaluisetup
+
 @eh.uisetup
 def setupbabar(ui):
 print('this is uisetup!')
@@ -213,6 +225,9 @@
 
 example::
 
+# Required, otherwise your uipopulate function(s) will not execute.
+uipopulate = eh.finaluipopulate
+
 @eh.uipopulate
 def setupfoo(ui):
 print('this is uipopulate!')
@@ -225,6 +240,9 @@
 
 example::
 
+# Required, otherwise your extsetup function(s) will not execute.
+extsetup = eh.finalextsetup
+
 @eh.extsetup
 def setupcelestine(ui):
 print('this is extsetup!')
@@ -237,6 +255,9 @@
 
 example::
 
+# Required, otherwise your reposetup function(s) will not execute.
+reposetup = eh.finalreposetup
+
 @eh.reposetup
 def setupzephir(ui, repo):
 print('this is reposetup!')
@@ -258,6 +279,11 @@
 
 example::
 
+# Required if `extension` is not provided
+uisetup = eh.finaluisetup
+# Required if `extension` is provided
+extsetup = eh.finalextsetup
+
 @eh.wrapcommand(b'summary')
 def wrapsummary(orig, ui, repo, *args, **kwargs):
 ui.note(b'Barry!')
@@ -298,8 +324,11 @@
 
 example::
 
-@eh.function(discovery, b'checkheads')
-def wrapfunction(orig, *args, **kwargs):
+# Required, otherwise the function will not be wrapped
+uisetup = eh.finaluisetup
+
+@eh.wrapfunction(discovery, b'checkheads')
+def wrapcheckheads(orig, *args, **kwargs):
 ui.note(b'His head smashed in and his heart cut out')
 return orig(*args, **kwargs)
 """



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


D10294: match: convert O(n) to O(log n) in exactmatcher.visitchildrenset

2021-04-01 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  When using narrow, during rebase this is called (at least) once per directory 
in
  the set of files in the commit being rebased. Every time it's called, we did 
the
  set arithmetic (now extracted and cached), which was probably pretty cheap but
  not necessary to repeat each time, looped over every item in the matcher and
  kept things that started with the directory we were querying.
  
  With very large narrowspecs, and a commit that touched a file in a large 
number
  of directories, this was slow. In a pathological repo, the rebase of a single
  commit (that touched over 17k files, I believe in approximately as many
  directories) with a narrowspec that had >32k entries took 8,246s of profiled
  time, with 5,007s of that spent in visitchildrenset (transitively). With this
  change, the time spent in visitchildrenset is less than 34s (which is where my
  profile cut off). Most of the remaining time was network access due to our
  custom remotefilelog-based setup not properly prefetching.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -7,6 +7,7 @@
 
 from __future__ import absolute_import, print_function
 
+import bisect
 import copy
 import itertools
 import os
@@ -798,14 +799,38 @@
 def visitdir(self, dir):
 return dir in self._dirs
 
+@propertycache
+def _visitchildrenset_candidates(self):
+"""A memoized set of candidates for visitchildrenset."""
+return self._fileset | self._dirs - {b''}
+
+@propertycache
+def _sorted_visitchildrenset_candidates(self):
+"""A memoized sorted list of candidates for visitchildrenset."""
+return sorted(self._visitchildrenset_candidates)
+
 def visitchildrenset(self, dir):
 if not self._fileset or dir not in self._dirs:
 return set()
 
-candidates = self._fileset | self._dirs - {b''}
-if dir != b'':
+if dir == b'':
+candidates = self._visitchildrenset_candidates
+else:
+candidates = self._sorted_visitchildrenset_candidates
 d = dir + b'/'
-candidates = {c[len(d) :] for c in candidates if c.startswith(d)}
+# Use bisect to find the first element potentially starting with d
+# (i.e. >= d). This should always find at least one element (we'll
+# assert later if this is not the case).
+first = bisect.bisect_left(candidates, d)
+# We need a representation of the first element that is > d that
+# does not start with d, so since we added a `/` on the end of dir,
+# we'll add whatever comes after slash (we could probably assume
+# that `0` is after `/`, but let's not) to the end of dir instead.
+dnext = dir + encoding.strtolocal(chr(ord(b'/') + 1))
+# Use bisect to find the first element >= d_next
+last = bisect.bisect_left(candidates, dnext, lo=first)
+dlen = len(d)
+candidates = {c[dlen :] for c in candidates[first:last]}
 # self._dirs includes all of the directories, recursively, so if
 # we're attempting to match foo/bar/baz.txt, it'll have '', 'foo',
 # 'foo/bar' in it. Thus we can safely ignore a candidate that has a



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