[Bug 6052] New: Merge with large number of changes corrupts repository

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

Bug ID: 6052
   Summary: Merge with large number of changes corrupts repository
   Product: Mercurial
   Version: 4.8.1
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: rnaga...@gmail.com
CC: mercurial-devel@mercurial-scm.org

I performed a merge from a parent branch to a child branch. There was a major
refactor in the parent branch including moving files around. The child merge
had 1490 files update. After the commit the repository was permanently
corrupted (i.e. I couldn't do anything with it, even verify it).

Command sequence:

hg merge release_10_1
hg commit -m "Merge from release_10_1"
hg status

** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64
bit (AMD64)]
** Mercurial Distributed SCM (version 4.7+11-cee9043c7dba)
** Extensions loaded: eol
Traceback (most recent call last):
  File "hg", line 50, in 
  File "mercurial\dispatch.pyo", line 90, in run
  File "mercurial\dispatch.pyo", line 213, in dispatch
  File "mercurial\dispatch.pyo", line 354, in _runcatch
  File "mercurial\dispatch.pyo", line 362, in _callcatch
  File "mercurial\scmutil.pyo", line 161, in callcatch
  File "mercurial\dispatch.pyo", line 344, in _runcatchfunc
  File "mercurial\dispatch.pyo", line 945, in _dispatch
  File "mercurial\hg.pyo", line 179, in repository
  File "mercurial\hg.pyo", line 170, in _peerorrepo
  File "hgext\eol.pyo", line 421, in reposetup
  File "hgext\eol.pyo", line 339, in _hgcleardirstate
  File "hgext\eol.pyo", line 332, in loadeol
  File "hgext\eol.pyo", line 242, in parseeol
  File "mercurial\context.pyo", line 85, in __getitem__
  File "mercurial\context.pyo", line 553, in filectx
  File "mercurial\context.pyo", line 268, in filenode
  File "mercurial\context.pyo", line 260, in _fileinfo
  File "mercurial\manifest.pyo", line 1457, in find
  File "mercurial\manifest.pyo", line 1427, in read
  File "mercurial\manifest.pyo", line 373, in __init__
  File "mercurial\manifest.pyo", line 126, in __init__
  File "mercurial\manifest.pyo", line 148, in findlines
ValueError: Manifest lines not in sorted order.

I've seen a similar bug in the TortoiseHg bug tracker, but for some reason it
was closed:
https://bitbucket.org/tortoisehg/thg/issues/5262/valueerror-manifest-lines-not-in-sorted

The resolution to this was to revert back to Mercurial 4.7.1, as mentioned in
the tortoise hg bug.

FYI the mercurial version on our server is 4.2.1.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2 V2] extdiff: add --mode option

2019-01-10 Thread Ludovic Chabant
# HG changeset patch
# User Ludovic Chabant 
# Date 1547180577 28800
#  Thu Jan 10 20:22:57 2019 -0800
# Node ID dfda7867497e5609a03727508dc0da2cab3218a3
# Parent  ef0e2f7224358c32b0f62b13e83e89ba2399c8cf
extdiff: add --mode option

The new option lets the user control how the external program is run.
By default, Mercurial passes the 2 snapshot directories as usual, but
it can also run the program repeatedly on each file's snapshot pair,
and optionally prompt the user each time.

The option can be passed via the CLI or be set in the 'extdiff' tool
config.

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -71,6 +71,7 @@
 import re
 import shutil
 import stat
+import subprocess
 
 from mercurial.i18n import _
 from mercurial.node import (
@@ -80,6 +81,7 @@
 from mercurial import (
 archival,
 cmdutil,
+encoding,
 error,
 filemerge,
 formatter,
@@ -104,6 +106,11 @@
 generic=True,
 )
 
+configitem('extdiff', br'mode\..*',
+default='',
+generic=True,
+)
+
 configitem('diff-tools', br'.*\.diffargs$',
 default=None,
 generic=True,
@@ -175,6 +182,91 @@
 cmdline += ' $parent1 $child'
 return re.sub(regex, quote, cmdline)
 
+def _systemdetached(cmd, environ=None, cwd=None):
+''' like 'procutil.system', but returns the Popen object directly
+so we don't have to wait on it.
+'''
+cmd = procutil.quotecommand(cmd)
+env = procutil.shellenviron(environ)
+proc = subprocess.Popen(procutil.tonativestr(cmd),
+shell=True, close_fds=procutil.closefds,
+env=procutil.tonativeenv(env),
+cwd=pycompat.rapply(procutil.tonativestr, cwd))
+return proc
+
+def _runperfilediff(cmdline, repo_root, ui, do3way, diffmode,
+commonfiles, tmproot, dir1a, dir1b,
+dir2root, dir2,
+rev1a, rev1b, rev2):
+# Note that we need to sort the list of files because it was
+# built in an "unstable" way and it's annoying to get files in a
+# random order, especially for the "prompt" mode.
+waitprocs = []
+totalfiles = len(commonfiles)
+for idx, commonfile in enumerate(sorted(commonfiles)):
+path1a = os.path.join(tmproot, dir1a, commonfile)
+label1a = commonfile + rev1a
+if not os.path.isfile(path1a):
+path1a = os.devnull
+
+path1b = ''
+label1b = ''
+if do3way:
+path1b = os.path.join(tmproot, dir1b, commonfile)
+label1b = commonfile + rev1b
+if not os.path.isfile(path1b):
+path1b = os.devnull
+
+path2 = os.path.join(dir2root, dir2, commonfile)
+label2 = commonfile + rev2
+
+if 'p' in diffmode:
+# Prompt before showing this diff
+difffiles = _('diff %s (%d of %d)') % (commonfile, idx + 1,
+   totalfiles)
+responses = _('[Yns?]'
+  '$$ &Yes, show diff'
+  '$$ &No, skip this diff'
+  '$$ &Skip remaining diffs'
+  '$$ &? (display help)')
+r = ui.promptchoice('%s %s' % (difffiles, responses))
+if r == 3: # ?
+while r == 3:
+for c, t in ui.extractchoices(responses)[1]:
+ui.write('%s - %s\n' % (c, encoding.lower(t)))
+r = ui.promptchoice('%s %s' %
+(difffiles, responses))
+if r == 0: # yes
+pass
+elif r == 1: # no
+continue
+elif r == 2: # skip
+break
+
+curcmdline = formatcmdline(
+cmdline, repo_root, do3way=do3way,
+parent1=path1a, plabel1=label1a,
+parent2=path1b, plabel2=label1b,
+child=path2, clabel=label2)
+ui.debug('running %r in %s\n' % (pycompat.bytestr(curcmdline),
+ tmproot))
+
+if 'p' in diffmode:
+# Run the comparison program and wait for it to exit
+# before we show the next file.
+ui.system(curcmdline, cwd=tmproot, blockedtag='extdiff')
+else:
+# Run the comparison program but don't wait, as we're
+# going to rapid-fire each file diff and then wait on
+# the whole group.
+proc = _systemdetached(curcmdline, cwd=tmproot)
+waitprocs.append(proc)
+
+if waitprocs:
+with ui.timeblockedsection('extdiff'):
+for proc in waitprocs:
+proc.wait()
+
 def dodiff(ui, repo, cmdline, pats, opts):
 '''Do the actual diff:
 
@@ -201,6 +293,8 @@
 else:
 ctx1b = repo[nullid]
 
+diffmode = opts.get('mode')
+
 node1a = ctx1a.node()
 node1b = ctx1b.node

[PATCH 1 of 2 V2] extdiff: move external tool command line building into separate function

2019-01-10 Thread Ludovic Chabant
# HG changeset patch
# User Ludovic Chabant 
# Date 1547180523 28800
#  Thu Jan 10 20:22:03 2019 -0800
# Node ID ef0e2f7224358c32b0f62b13e83e89ba2399c8cf
# Parent  e546c124217485f54b897d050a9573fc4ab97ab7
extdiff: move external tool command line building into separate function

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -152,6 +152,29 @@
 fnsandstat.append((dest, repo.wjoin(fn), os.lstat(dest)))
 return dirname, fnsandstat
 
+def formatcmdline(cmdline, repo_root, do3way,
+  parent1, plabel1, parent2, plabel2, child, clabel):
+# Function to quote file/dir names in the argument string.
+# When not operating in 3-way mode, an empty string is
+# returned for parent2
+replace = {'parent': parent1, 'parent1': parent1, 'parent2': parent2,
+   'plabel1': plabel1, 'plabel2': plabel2,
+   'child': child, 'clabel': clabel,
+   'root': repo_root}
+def quote(match):
+pre = match.group(2)
+key = match.group(3)
+if not do3way and key == 'parent2':
+return pre
+return pre + procutil.shellquote(replace[key])
+
+# Match parent2 first, so 'parent1?' will match both parent1 and parent
+regex = (br'''(['"]?)([^\s'"$]*)'''
+ br'\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)\1')
+if not do3way and not re.search(regex, cmdline):
+cmdline += ' $parent1 $child'
+return re.sub(regex, quote, cmdline)
+
 def dodiff(ui, repo, cmdline, pats, opts):
 '''Do the actual diff:
 
@@ -281,28 +304,14 @@
 label1b = None
 fnsandstat = []
 
-# Function to quote file/dir names in the argument string.
-# When not operating in 3-way mode, an empty string is
-# returned for parent2
-replace = {'parent': dir1a, 'parent1': dir1a, 'parent2': dir1b,
-   'plabel1': label1a, 'plabel2': label1b,
-   'clabel': label2, 'child': dir2,
-   'root': repo.root}
-def quote(match):
-pre = match.group(2)
-key = match.group(3)
-if not do3way and key == 'parent2':
-return pre
-return pre + procutil.shellquote(replace[key])
-
-# Match parent2 first, so 'parent1?' will match both parent1 and parent
-regex = (br'''(['"]?)([^\s'"$]*)'''
- br'\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)\1')
-if not do3way and not re.search(regex, cmdline):
-cmdline += ' $parent1 $child'
-cmdline = re.sub(regex, quote, cmdline)
-
-ui.debug('running %r in %s\n' % (pycompat.bytestr(cmdline), tmproot))
+# Run the external tool on the 2 temp directories or the patches
+cmdline = formatcmdline(
+cmdline, repo.root, do3way=do3way,
+parent1=dir1a, plabel1=label1a,
+parent2=dir1b, plabel2=label1b,
+child=dir2, clabel=label2)
+ui.debug('running %r in %s\n' % (pycompat.bytestr(cmdline),
+ tmproot))
 ui.system(cmdline, cwd=tmproot, blockedtag='extdiff')
 
 for copy_fn, working_fn, st in fnsandstat:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: Auto-formatting with yapf (was: Re: Auto-formatting code with black - object now if you have a strong opinion)

2019-01-10 Thread Matt Harbison

On Thu, 10 Jan 2019 13:51:12 -0500, Augie Fackler  wrote:





On Jan 10, 2019, at 00:14, Matt Harbison  wrote:

On Wed, 09 Jan 2019 15:30:19 -0500, Augie Fackler   
wrote:






On Dec 6, 2018, at 23:21, Matt Harbison  wrote:

On Wed, 05 Dec 2018 08:23:17 -0500, Yuya Nishihara   
wrote:



On Tue, 4 Dec 2018 10:06:24 -0500, Augie Fackler wrote:


So, options to move forward:
1) blacken everything (controversial for good reasons)
2) try black only on a subset
3) explore yapf
4) Give up and keep manually formatting files (I'd rather not do  
this, but I understand if it's where we end up)


My vote: 3 > 4 > 2 > 1

I'm not super enthusiastic about 100%-machine-forced formatting. I  
like
consistency level provided by e.g. astyle command. clang-format is  
pretty

good IMHO, but the black seems to sacrifice the code readability.


+1.

That said, I got used to longnamesthataresmooshedtogether, so I can  
probably adjust to anything after awhile.


I think I'd still prefer black overall (yapf is less opinionated and  
requires me to think more), but here's a yapf RFC:  
https://phab.mercurial-scm.org/D5539


This would at least help _most_ cases of line-too-long, which I think  
would be good. What do people think?


I think there's less that I dislike with yapf, but I'm not adamant  
about it.


Should I pursue fixing any bugs in yapf, or is this a lukewarm "I'd  
rather we not bother" sort of feeling?


It's lukewarm.  I probably focus too much on what I don't like, knowing it  
can't be fixed.  But in fairness, I think it made some things better,  
which means human formatting isn't great either.


I'm not sure how much time it would require to pursue fixing yapf.  If  
it's not a lot, maybe it's a reasonable middle ground between nothing and  
black?  I like the idea in theory, but don't look forward to retraining my  
mind to read some of these things.  But don't let me dump all over it-  
like I said, I've never seriously tried to use one.  Maybe it won't take  
that long to get used to.

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


D5490: commit: remove ignore whitespace option on --interactive (issue6042)

2019-01-10 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  @durin42 I've added test for the current revision. Unfortunately, I'm unable 
to write a test for the wrong behaviour.  I'll try writing it again. Any hints 
from your side?

REPOSITORY
  rHG Mercurial

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

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


D5490: commit: remove ignore whitespace option on --interactive (issue6042)

2019-01-10 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 13166.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5490?vs=13003&id=13166

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-commit-interactive.t

CHANGE DETAILS

diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t
--- a/tests/test-commit-interactive.t
+++ b/tests/test-commit-interactive.t
@@ -1807,3 +1807,30 @@
   n   0 -1 unset   subdir/f1
   $ hg status -A subdir/f1
   M subdir/f1
+
+making --interactive not ignore whitespaces with the following hgrc:
+[diff]
+ignorews=True
+  $ hg init issue6042
+  $ cd issue6042
+  $ echo '[diff]' >> $HGRCPATH
+  $ echo 'ignorews=True' >> $HGRCPATH
+  $ echo a > a
+  $ hg ci -Am 'add a'
+  adding a
+  $ echo 'a ' > a
+  $ hg diff
+  $ hg commit -i -m 'add ws to a' < y
+  > y
+  > n
+  > EOF
+  diff --git a/a b/a
+  1 hunks, 1 lines changed
+  examine changes to 'a'? [Ynesfdaq?] y
+  
+  @@ -1,1 +1,1 @@
+  -a
+  +a 
+  record this change to 'a'? [Ynesfdaq?] y
+  
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -282,7 +282,7 @@
 status = repo.status(match=match)
 if not force:
 repo.checkcommitpatterns(wctx, vdirs, match, status, fail)
-diffopts = patch.difffeatureopts(ui, opts=opts, whitespace=True)
+diffopts = patch.difffeatureopts(ui, opts=opts)
 diffopts.nodates = True
 diffopts.git = True
 diffopts.showfunc = True



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


D5569: tests: make HGCATAPULTSERVERPIPE imply HGTESTCATAPULTSERVERPIPE

2019-01-10 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I had attempted to do this before, but missed this case. This makes it so that
  one can do the following to get catapult traces that include both the .t test
  name (and non-hg commands run by that .t test) *and* the hg-internal tracing, 
in
  one trace:
  
HGCATAPULTSERVERPIPE=/tmp/catapult.pipe run-tests.py 
  
  Without this change, we need to specify both `HG{,TEST}CATAPULTSERVERPIPE`; if
  we specify just the TEST one, we only get the .t tests (no hg-internals), 
which
  is working as intended. If we specify the non-TEST one, we only get the
  hg-internals (not the rest of the .t test), which was not intended.
  
  If you want to restore the previous behavior (just hg internals, not the stuff
  from the .t tests), run like:
  
HGTESTCATAPULTSERVERPIPE=/dev/null \
  HGCATAPULTSERVERPIPE=/tmp/catapult.pipe \
  run-tests.py 

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1409,7 +1409,8 @@
 session = str(uuid.uuid4())
 if PYTHON3:
 session = session.encode('ascii')
-hgcatapult = os.getenv('HGTESTCATAPULTSERVERPIPE')
+hgcatapult = os.getenv('HGTESTCATAPULTSERVERPIPE') or \
+os.getenv('HGCATAPULTSERVERPIPE')
 def toggletrace(cmd=None):
 if not hgcatapult or hgcatapult == os.devnull:
 return



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


[Bug 6051] New: Color on stderr falls back to ANSI on Windows with stdout redirected to N

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

Bug ID: 6051
   Summary: Color on stderr falls back to ANSI on Windows with
stdout redirected to N
   Product: Mercurial
   Version: 4.8.1
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: bug
  Priority: normal
 Component: color
  Assignee: bugzi...@mercurial-scm.org
  Reporter: matt_harbi...@yahoo.com
CC: mercurial-devel@mercurial-scm.org

$ hg log -r 1
abort: unknown revision '1'!   <-- text in red

$ ../hg log -r 1 >/dev/null
←[0;31mabort: unknown revision '1'!←[0m

Interestingly, the error text is also mangled on Windows 10.  There must be
more to it than only checking stdout in win32.enablevtmode(), because changing
that to stderr has no effect.

If the redirect is to a file, there are no ANSI codes in the output, but no
color either (on either Win7 or Win10).  Maybe it's related to NUL being
reported as a tty?  But I'm not sure why it wouldn't stick with win32 color
mode.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5568: tests: de-flake test-narrow-share.t by making dirstate predictable

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

REVISION SUMMARY
  test-narrow-share.t was sometimes (~0.5% on my machine) failing like this:
  
@@ -61,7 +61,7 @@
   A d3/g
   $ hg -R main debugdirstate --no-dates
   n 644  2 set d1/f
-  n 644  2 unset   d3/f
+  n 644  2 set d3/f
   a   0 -1 unset   d3/g
   n 644  2 set d5/f
   n 644  2 set d7/f
  
  The timestamp for d3/f would get set if it was determined at some
  point that it was clean. That check is usually done when the user runs
  `hg st`. We don't do that before the failure in the test case, but it
  happens at the end of the `hg clone` call. So if the file system's
  time happens to roll over after the clone's working copy has been
  written, but before its (final) dirstate has been written, we can end
  up with a set timestamp there.
  
  This patch makes it consistent by sleeping for 2 seconds so the
  timestamp gets reliably set.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-narrow-share.t

CHANGE DETAILS

diff --git a/tests/test-narrow-share.t b/tests/test-narrow-share.t
--- a/tests/test-narrow-share.t
+++ b/tests/test-narrow-share.t
@@ -44,6 +44,14 @@
 
 Narrow the share and check that the main repo's working copy gets updated
 
+# Make sure the files that are supposed to be known-clean get their timestamps 
set in the dirstate
+  $ sleep 2
+  $ hg -R main st
+  $ hg -R main debugdirstate --no-dates
+  n 644  2 set d1/f
+  n 644  2 set d3/f
+  n 644  2 set d5/f
+  n 644  2 set d7/f
 # Make d3/f dirty
   $ echo x >> main/d3/f
   $ echo y >> main/d3/g
@@ -58,7 +66,7 @@
   A d3/g
   $ hg -R main debugdirstate --no-dates
   n 644  2 set d1/f
-  n 644  2 unset   d3/f
+  n 644  2 set d3/f
   a   0 -1 unset   d3/g
   n 644  2 set d5/f
   n 644  2 set d7/f



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


D5565: revlog: add version 2 format flag to control sparse

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Revlog behavior should live as close to the revlog as possible.
  In version 1 revlogs, we engaged sparse semantics by using a
  repository requirement. This constituted action at a distance
  and wasn't optimal.
  
  This commit introduces a feature flag on version 2 revlogs that
  explicitly denotes whether sparse reading semantics are enabled.
  
  The flag is enabled by default for version 2 revlogs.
  
  In order to get the flag enabled by default, we had to tweak
  localrepo's logic for populating opener options to only set
  "sparse-revlog" if the requirement was present. This lets the
  revlog initializer use sane defaults depending on the revlog
  version. (The interaction between opener options and the revlog
  class is kinda wonky and could use a re-think. But my little
  brain isn't prepared to handle that at this time.)
  
  I'm also a bit unsure why we have 2 attributes controlling
  sparse behavior (revlog._sparserevlog and revlog._withsparseread).
  I *think* they can be consolidated. But I'm not sure. The new
  revlog feature flag implies both, which seems reasonable.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/help/internals/revlogs.txt
  mercurial/localrepo.py
  mercurial/revlog.py
  mercurial/revlogutils/constants.py
  tests/test-revlog-v2.t

CHANGE DETAILS

diff --git a/tests/test-revlog-v2.t b/tests/test-revlog-v2.t
--- a/tests/test-revlog-v2.t
+++ b/tests/test-revlog-v2.t
@@ -22,7 +22,7 @@
   $ cd empty-repo
   $ cat .hg/requires
   dotencode
-  exp-revlogv2.1
+  exp-revlogv2.2
   fncache
   sparserevlog
   store
@@ -58,8 +58,8 @@
 
   $ f --hexdump --bytes 4 .hg/store/00changelog.i
   .hg/store/00changelog.i:
-  : 00 01 de ad ||
+  : 00 03 de ad ||
 
   $ f --hexdump --bytes 4 .hg/store/data/foo.i
   .hg/store/data/foo.i:
-  : 00 01 de ad ||
+  : 00 03 de ad ||
diff --git a/mercurial/revlogutils/constants.py 
b/mercurial/revlogutils/constants.py
--- a/mercurial/revlogutils/constants.py
+++ b/mercurial/revlogutils/constants.py
@@ -24,11 +24,13 @@
 FLAG_INLINE_DATA = (1 << 16)
 # Only used by v1, implied by v2.
 FLAG_GENERALDELTA = (1 << 17)
+# Only used by v2.
+FLAG_SPARSE_DELTA_CHAINS = (1 << 17)
 REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
 REVLOG_DEFAULT_FORMAT = REVLOGV1
 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
 REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
-REVLOGV2_FLAGS = FLAG_INLINE_DATA
+REVLOGV2_FLAGS = FLAG_INLINE_DATA | FLAG_SPARSE_DELTA_CHAINS
 
 # revlog index flags
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -37,6 +37,7 @@
 from .revlogutils.constants import (
 FLAG_GENERALDELTA,
 FLAG_INLINE_DATA,
+FLAG_SPARSE_DELTA_CHAINS,
 REVIDX_DEFAULT_FLAGS,
 REVIDX_ELLIPSIS,
 REVIDX_EXTSTORED,
@@ -83,6 +84,7 @@
 REVLOGV2
 FLAG_INLINE_DATA
 FLAG_GENERALDELTA
+FLAG_SPARSE_DELTA_CHAINS
 REVLOG_DEFAULT_FLAGS
 REVLOG_DEFAULT_FORMAT
 REVLOG_DEFAULT_VERSION
@@ -392,6 +394,10 @@
 
 if 'revlogv2' in opts:
 newversionflags = REVLOGV2 | FLAG_INLINE_DATA
+
+if 'sparse-revlog' not in opts or opts.get('sparse-revlog'):
+newversionflags |= FLAG_SPARSE_DELTA_CHAINS
+
 elif 'revlogv1' in opts:
 newversionflags = REVLOGV1 | FLAG_INLINE_DATA
 if 'generaldelta' in opts:
@@ -412,10 +418,6 @@
 self._maxdeltachainspan = opts['maxdeltachainspan']
 if self._mmaplargeindex and 'mmapindexthreshold' in opts:
 mmapindexthreshold = opts['mmapindexthreshold']
-self._sparserevlog = bool(opts.get('sparse-revlog', False))
-withsparseread = bool(opts.get('with-sparse-read', False))
-# sparse-revlog forces sparse-read
-self._withsparseread = self._sparserevlog or withsparseread
 if 'sparse-read-density-threshold' in opts:
 self._srdensitythreshold = opts['sparse-read-density-threshold']
 if 'sparse-read-min-gap-size' in opts:
@@ -467,6 +469,8 @@
 
 self._inline = False
 self._generaldelta = False
+self._sparserevlog = False
+self._withsparseread = False
 
 elif fmt == REVLOGV1:
 if flags & ~REVLOGV1_FLAGS:
@@ -477,6 +481,11 @@
 self._inline = versionflags & FLAG_INLINE_DATA
 self._generaldelta = versionflags & FLAG_GENERALDELTA
 
+self._sparserevlog = bool(opts.get('sparse-revlog', False))
+withsparseread = bool(opts.get('with-sparse-read', False))
+# sparse-revlog forces sparse-read
+self._withsparseread = self.

D5566: revlog: rename revlog I/O classes to reflect version (API)

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I never liked these names. They imply the existence of exactly
  2 revlog versions. We're hacking on version 2. So let's
  introduce better names.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/perf.py
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -240,7 +240,7 @@
 return (0, 0, 0, -1, -1, -1, -1, nullid)
 return list.__getitem__(self, i)
 
-class revlogoldio(object):
+class revlogv0io(object):
 def __init__(self):
 self.size = indexformatv0.size
 
@@ -291,7 +291,7 @@
 # signed integer)
 _maxentrysize = 0x7fff
 
-class revlogio(object):
+class revlogv1io(object):
 def __init__(self):
 self.size = indexformatng.size
 
@@ -505,9 +505,9 @@
 
 self._storedeltachains = True
 
-self._io = revlogio()
+self._io = revlogv1io()
 if self.version == REVLOGV0:
-self._io = revlogoldio()
+self._io = revlogv0io()
 try:
 d = self._io.parseindex(indexdata, self._inline)
 except (ValueError, IndexError):
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1576,7 +1576,11 @@
 header = struct.unpack(b'>I', data[0:4])[0]
 version = header & 0x
 if version == 1:
-revlogio = revlog.revlogio()
+# Renamed to revlogv1io in Mercurial 4.9.
+try:
+revlogio = revlog.revlogv1io()
+except AttributeError:
+revlogio = revlog.revlogio()
 inline = header & (1 << 16)
 else:
 raise error.Abort((b'unsupported revlog version: %d') % version)



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


D5567: revlog: assign revlog._io in version lookup conditional

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  A single version lookup is desirable.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -472,6 +472,8 @@
 self._sparserevlog = False
 self._withsparseread = False
 
+self._io = revlogv0io()
+
 elif fmt == REVLOGV1:
 if flags & ~REVLOGV1_FLAGS:
 raise error.RevlogError(_('unknown flags (%#04x) in version %d 
'
@@ -486,6 +488,8 @@
 # sparse-revlog forces sparse-read
 self._withsparseread = self._sparserevlog or withsparseread
 
+self._io = revlogv1io()
+
 elif fmt == REVLOGV2:
 if flags & ~REVLOGV2_FLAGS:
 raise error.RevlogError(_('unknown flags (%#04x) in version %d 
'
@@ -499,15 +503,14 @@
 self._sparserevlog = versionflags & FLAG_SPARSE_DELTA_CHAINS
 self._withsparseread = versionflags & FLAG_SPARSE_DELTA_CHAINS
 
+self._io = revlogv1io()
+
 else:
 raise error.RevlogError(_('unknown version (%d) in revlog %s') %
 (fmt, self.indexfile))
 
 self._storedeltachains = True
 
-self._io = revlogv1io()
-if self.version == REVLOGV0:
-self._io = revlogv0io()
 try:
 d = self._io.parseindex(indexdata, self._inline)
 except (ValueError, IndexError):



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


D5561: revlog: always enable generaldelta on version 2 revlogs

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This commit starts the process of diverging version 2 revlogs
  from version 1 revlogs.
  
  generaldelta is a useful feature and has been enabled by
  default for ages. I can't think of a good reason why the
  feature should be disabled. Yes, it is true changelogs
  today don't have generaldelta enabled. But that's because
  they don't have delta chains enabled, so generaldelta makes
  no sense there.
  
  This commit makes generaldelta always enabled on version 2
  revlogs.
  
  As part of this, one-off code in changelog.py mucking with
  revlog.version had to be made conditional on the revlog
  version, as we don't want to change revlog feature
  flags on version 2 revlogs. The fact this code exists
  is horrible and stems from revlog options being shared by
  the opener. We probably want a better API here. But that can
  wait for another patch.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/help/internals/revlogs.txt
  mercurial/localrepo.py
  mercurial/revlog.py
  mercurial/revlogutils/constants.py
  tests/test-revlog-v2.t

CHANGE DETAILS

diff --git a/tests/test-revlog-v2.t b/tests/test-revlog-v2.t
--- a/tests/test-revlog-v2.t
+++ b/tests/test-revlog-v2.t
@@ -22,7 +22,7 @@
   $ cd empty-repo
   $ cat .hg/requires
   dotencode
-  exp-revlogv2.0
+  exp-revlogv2.1
   fncache
   sparserevlog
   store
@@ -54,12 +54,12 @@
   date:Thu Jan 01 00:00:00 1970 +
   summary: initial
   
-Header written as expected (changelog always disables generaldelta)
+Header written as expected
 
   $ f --hexdump --bytes 4 .hg/store/00changelog.i
   .hg/store/00changelog.i:
   : 00 01 de ad ||
 
   $ f --hexdump --bytes 4 .hg/store/data/foo.i
   .hg/store/data/foo.i:
-  : 00 03 de ad ||
+  : 00 01 de ad ||
diff --git a/mercurial/revlogutils/constants.py 
b/mercurial/revlogutils/constants.py
--- a/mercurial/revlogutils/constants.py
+++ b/mercurial/revlogutils/constants.py
@@ -20,13 +20,15 @@
 # Dummy value until file format is finalized.
 # Reminder: change the bounds check in revlog.__init__ when this is changed.
 REVLOGV2 = 0xDEAD
+# Shared across v1 and v2.
 FLAG_INLINE_DATA = (1 << 16)
+# Only used by v1, implied by v2.
 FLAG_GENERALDELTA = (1 << 17)
 REVLOG_DEFAULT_FLAGS = FLAG_INLINE_DATA
 REVLOG_DEFAULT_FORMAT = REVLOGV1
 REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_FORMAT | REVLOG_DEFAULT_FLAGS
 REVLOGV1_FLAGS = FLAG_INLINE_DATA | FLAG_GENERALDELTA
-REVLOGV2_FLAGS = REVLOGV1_FLAGS
+REVLOGV2_FLAGS = FLAG_INLINE_DATA
 
 # revlog index flags
 
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -387,8 +387,7 @@
 opts = getattr(opener, 'options', {}) or {}
 
 if 'revlogv2' in opts:
-# version 2 revlogs always use generaldelta.
-versionflags = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
+versionflags = REVLOGV2 | FLAG_INLINE_DATA
 elif 'revlogv1' in opts:
 versionflags = REVLOGV1 | FLAG_INLINE_DATA
 if 'generaldelta' in opts:
@@ -451,25 +450,38 @@
 raise
 
 self.version = versionflags
-self._inline = versionflags & FLAG_INLINE_DATA
-self._generaldelta = versionflags & FLAG_GENERALDELTA
+
 flags = versionflags & ~0x
 fmt = versionflags & 0x
+
 if fmt == REVLOGV0:
 if flags:
 raise error.RevlogError(_('unknown flags (%#04x) in version %d 
'
   'revlog %s') %
 (flags >> 16, fmt, self.indexfile))
+
+self._inline = False
+self._generaldelta = False
+
 elif fmt == REVLOGV1:
 if flags & ~REVLOGV1_FLAGS:
 raise error.RevlogError(_('unknown flags (%#04x) in version %d 
'
   'revlog %s') %
 (flags >> 16, fmt, self.indexfile))
+
+self._inline = versionflags & FLAG_INLINE_DATA
+self._generaldelta = versionflags & FLAG_GENERALDELTA
+
 elif fmt == REVLOGV2:
 if flags & ~REVLOGV2_FLAGS:
 raise error.RevlogError(_('unknown flags (%#04x) in version %d 
'
   'revlog %s') %
 (flags >> 16, fmt, self.indexfile))
+
+self._inline = versionflags & FLAG_INLINE_DATA
+# generaldelta implied by version 2 revlogs.
+self._generaldelta = True
+
 else:
 raise error.RevlogError(_('unknown version (%d) in revlog %s') %

D5564: revlog: use separate variables to track version flags

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It wasn't obvious to me that "versionflags" is used both to
  define the default version+features value for new revlogs and
  to track the value read from a revlog.
  
  We rename the former use and add explicit assignment of
  "versionflags" later to differentiate between the two.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -391,13 +391,13 @@
 opts = getattr(self.opener, 'options', {}) or {}
 
 if 'revlogv2' in opts:
-versionflags = REVLOGV2 | FLAG_INLINE_DATA
+newversionflags = REVLOGV2 | FLAG_INLINE_DATA
 elif 'revlogv1' in opts:
-versionflags = REVLOGV1 | FLAG_INLINE_DATA
+newversionflags = REVLOGV1 | FLAG_INLINE_DATA
 if 'generaldelta' in opts:
-versionflags |= FLAG_GENERALDELTA
+newversionflags |= FLAG_GENERALDELTA
 else:
-versionflags = REVLOG_DEFAULT_VERSION
+newversionflags = REVLOG_DEFAULT_VERSION
 
 if 'chunkcachesize' in opts:
 self._chunkcachesize = opts['chunkcachesize']
@@ -446,10 +446,14 @@
 if len(indexdata) > 0:
 versionflags = versionformat_unpack(indexdata[:4])[0]
 self._initempty = False
+else:
+versionflags = newversionflags
 except IOError as inst:
 if inst.errno != errno.ENOENT:
 raise
 
+versionflags = newversionflags
+
 self.version = versionflags
 
 flags = versionflags & ~0x



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


D5563: revlog: inline opener options logic into _loadindex()

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We always call _loadindex() during __init__. But we also call
  _loadindex() as part of censorrevision(). Before, when reloading
  the index during censorrevision(), we would lose the configured
  mmapindexthreshold setting from the opener. By inlining the
  logic in _loadindex(), we ensure that opener options are always
  respected when loading the index.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -384,8 +384,11 @@
 # 2-tuple of file handles being used for active writing.
 self._writinghandles = None
 
+self._loadindex()
+
+def _loadindex(self):
 mmapindexthreshold = None
-opts = getattr(opener, 'options', {}) or {}
+opts = getattr(self.opener, 'options', {}) or {}
 
 if 'revlogv2' in opts:
 versionflags = REVLOGV2 | FLAG_INLINE_DATA
@@ -431,9 +434,6 @@
 raise error.RevlogError(_('revlog chunk cache size %r is not a '
   'power of 2') % self._chunkcachesize)
 
-self._loadindex(versionflags, mmapindexthreshold)
-
-def _loadindex(self, versionflags, mmapindexthreshold):
 indexdata = ''
 self._initempty = True
 try:
@@ -2499,7 +2499,7 @@
 self.opener.rename(newrl.datafile, self.datafile)
 
 self.clearcaches()
-self._loadindex(self.version, None)
+self._loadindex()
 
 def verifyintegrity(self, state):
 """Verifies the integrity of the revlog.



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


D5562: revlog: store mmaplargeindex as an instance attribute

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This makes it more consistent with everything else. It also
  makes it possible to move the opener/features processing
  into _loadindex().

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -352,6 +352,7 @@
 #  When True, indexfile is opened with checkambig=True at writing, to
 #  avoid file stat ambiguity.
 self._checkambig = checkambig
+self._mmaplargeindex = mmaplargeindex
 self._censorable = censorable
 # 3-tuple of (node, rev, text) for a raw revision.
 self._revisioncache = None
@@ -406,7 +407,7 @@
 self._compengine = opts['compengine']
 if 'maxdeltachainspan' in opts:
 self._maxdeltachainspan = opts['maxdeltachainspan']
-if mmaplargeindex and 'mmapindexthreshold' in opts:
+if self._mmaplargeindex and 'mmapindexthreshold' in opts:
 mmapindexthreshold = opts['mmapindexthreshold']
 self._sparserevlog = bool(opts.get('sparse-revlog', False))
 withsparseread = bool(opts.get('with-sparse-read', False))



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


D5560: revlog: rename v to versionflags

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Single letter variables are harder to read.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -388,13 +388,13 @@
 
 if 'revlogv2' in opts:
 # version 2 revlogs always use generaldelta.
-v = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
+versionflags = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
 elif 'revlogv1' in opts:
-v = REVLOGV1 | FLAG_INLINE_DATA
+versionflags = REVLOGV1 | FLAG_INLINE_DATA
 if 'generaldelta' in opts:
-v |= FLAG_GENERALDELTA
+versionflags |= FLAG_GENERALDELTA
 else:
-v = REVLOG_DEFAULT_VERSION
+versionflags = REVLOG_DEFAULT_VERSION
 
 if 'chunkcachesize' in opts:
 self._chunkcachesize = opts['chunkcachesize']
@@ -431,9 +431,9 @@
 raise error.RevlogError(_('revlog chunk cache size %r is not a '
   'power of 2') % self._chunkcachesize)
 
-self._loadindex(v, mmapindexthreshold)
-
-def _loadindex(self, v, mmapindexthreshold):
+self._loadindex(versionflags, mmapindexthreshold)
+
+def _loadindex(self, versionflags, mmapindexthreshold):
 indexdata = ''
 self._initempty = True
 try:
@@ -444,17 +444,17 @@
 else:
 indexdata = f.read()
 if len(indexdata) > 0:
-v = versionformat_unpack(indexdata[:4])[0]
+versionflags = versionformat_unpack(indexdata[:4])[0]
 self._initempty = False
 except IOError as inst:
 if inst.errno != errno.ENOENT:
 raise
 
-self.version = v
-self._inline = v & FLAG_INLINE_DATA
-self._generaldelta = v & FLAG_GENERALDELTA
-flags = v & ~0x
-fmt = v & 0x
+self.version = versionflags
+self._inline = versionflags & FLAG_INLINE_DATA
+self._generaldelta = versionflags & FLAG_GENERALDELTA
+flags = versionflags & ~0x
+fmt = versionflags & 0x
 if fmt == REVLOGV0:
 if flags:
 raise error.RevlogError(_('unknown flags (%#04x) in version %d 
'



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


D5559: revlog: always process opener options

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I'm not sure when ``opener.options`` would ever be explicitly
  set to None. It is definitely not possible to construct a repo
  this way because ``localrepo.resolvestorevfsoptions()`` always
  returns a dict and ``localrepo.makelocalrepository()`` always
  sets ``opener.options`` to this value.
  
  Because we always execute this code now, if options are empty
  we defaulted to creating version 0 revlogs. So we had to change
  the code slightly to fall back to the default revlog version
  and flags.
  
  As astute reader will note that it is not possible to create
  version 0 revlogs now. However, I don't think it was possible
  before, as this required ``opener.options`` being unset, which
  I don't think was possible. I suspect this means our test
  coverage for version 0 revlog repositories is possibly
  non-existent! Since I don't see a config option to disable
  revlog v1, I'm not even sure if we had a way to create new
  repos with version 0 revlogs! Who knows.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -384,44 +384,45 @@
 self._writinghandles = None
 
 mmapindexthreshold = None
-v = REVLOG_DEFAULT_VERSION
-opts = getattr(opener, 'options', None)
-if opts is not None:
-if 'revlogv2' in opts:
-# version 2 revlogs always use generaldelta.
-v = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
-elif 'revlogv1' in opts:
-if 'generaldelta' in opts:
-v |= FLAG_GENERALDELTA
-else:
-v = 0
-if 'chunkcachesize' in opts:
-self._chunkcachesize = opts['chunkcachesize']
-if 'maxchainlen' in opts:
-self._maxchainlen = opts['maxchainlen']
-if 'deltabothparents' in opts:
-self._deltabothparents = opts['deltabothparents']
-self._lazydeltabase = bool(opts.get('lazydeltabase', False))
-if 'compengine' in opts:
-self._compengine = opts['compengine']
-if 'maxdeltachainspan' in opts:
-self._maxdeltachainspan = opts['maxdeltachainspan']
-if mmaplargeindex and 'mmapindexthreshold' in opts:
-mmapindexthreshold = opts['mmapindexthreshold']
-self._sparserevlog = bool(opts.get('sparse-revlog', False))
-withsparseread = bool(opts.get('with-sparse-read', False))
-# sparse-revlog forces sparse-read
-self._withsparseread = self._sparserevlog or withsparseread
-if 'sparse-read-density-threshold' in opts:
-self._srdensitythreshold = 
opts['sparse-read-density-threshold']
-if 'sparse-read-min-gap-size' in opts:
-self._srmingapsize = opts['sparse-read-min-gap-size']
-if opts.get('enableellipsis'):
-self._flagprocessors[REVIDX_ELLIPSIS] = ellipsisprocessor
-
-# revlog v0 doesn't have flag processors
-for flag, processor in opts.get(b'flagprocessors', {}).iteritems():
-_insertflagprocessor(flag, processor, self._flagprocessors)
+opts = getattr(opener, 'options', {}) or {}
+
+if 'revlogv2' in opts:
+# version 2 revlogs always use generaldelta.
+v = REVLOGV2 | FLAG_GENERALDELTA | FLAG_INLINE_DATA
+elif 'revlogv1' in opts:
+v = REVLOGV1 | FLAG_INLINE_DATA
+if 'generaldelta' in opts:
+v |= FLAG_GENERALDELTA
+else:
+v = REVLOG_DEFAULT_VERSION
+
+if 'chunkcachesize' in opts:
+self._chunkcachesize = opts['chunkcachesize']
+if 'maxchainlen' in opts:
+self._maxchainlen = opts['maxchainlen']
+if 'deltabothparents' in opts:
+self._deltabothparents = opts['deltabothparents']
+self._lazydeltabase = bool(opts.get('lazydeltabase', False))
+if 'compengine' in opts:
+self._compengine = opts['compengine']
+if 'maxdeltachainspan' in opts:
+self._maxdeltachainspan = opts['maxdeltachainspan']
+if mmaplargeindex and 'mmapindexthreshold' in opts:
+mmapindexthreshold = opts['mmapindexthreshold']
+self._sparserevlog = bool(opts.get('sparse-revlog', False))
+withsparseread = bool(opts.get('with-sparse-read', False))
+# sparse-revlog forces sparse-read
+self._withsparseread = self._sparserevlog or withsparseread
+if 'sparse-read-density-threshold' in opts:
+self._srdensitythreshold = opts['sparse-read-density-threshold']
+if 'sparse-read-m

D5558: internals: minor rewriting of revlogs documentation

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In preparation for formalizing revlog version 2.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/help/internals/revlogs.txt

CHANGE DETAILS

diff --git a/mercurial/help/internals/revlogs.txt 
b/mercurial/help/internals/revlogs.txt
--- a/mercurial/help/internals/revlogs.txt
+++ b/mercurial/help/internals/revlogs.txt
@@ -11,8 +11,8 @@
 links to its *parent* entries. The collective metadata is referred
 to as the *index* and the revision data is the *data*.
 
-Revision data is stored as a series of compressed deltas against previous
-revisions.
+Revision data is stored as a series of compressed deltas against
+ancestor revisions.
 
 Revlogs are written in an append-only fashion. We never need to rewrite
 a file to insert nor do we need to remove data. Rolling back in-progress
@@ -35,9 +35,6 @@
 significant half of the integer is the format/version short. The other
 short holds feature flags that dictate behavior of the revlog.
 
-Only 1 bit of the format/version short is currently used. Remaining
-bits are reserved for future use.
-
 The following values for the format/version short are defined:
 
 0
@@ -53,15 +50,24 @@
beyond 32-bit header.
 
 The feature flags short consists of bit flags. Where 0 is the least
-significant bit, the following bit offsets define flags:
+significant bit. The bit flags vary by revlog version.
+
+Version 0 revlogs have no defined flags and the presence of a flag
+is considered an error.
+
+Version 1 revlogs have the following flags at the specified bit offsets:
 
 0
Store revision data inline.
 1
Generaldelta encoding.
 
-2-15
-   Reserved for future use.
+Version 2 revlogs have the following flags at the specified bit offsets:
+
+0
+   Store revision data inline.
+1
+   Generaldelta encoding.
 
 The following header values are common:
 



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


D5557: testrunner: make `-j100 --runs-per-test=100 test-foo.t` use 100 jobs

2019-01-10 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  For the record, I enjoyed @martinvonz conversing with himself on this review!

REPOSITORY
  rHG Mercurial

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

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


D5557: testrunner: make `-j100 --runs-per-test=100 test-foo.t` use 100 jobs

2019-01-10 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG53327bfbf35d: testrunner: make `-j100 --runs-per-test=100 
test-foo.t` use 100 jobs (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5557?vs=13152&id=13153

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

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.t

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -716,6 +716,12 @@
 (delete the duplicated test file)
   $ rm test-failure-copy.t
 
+multiple runs per test should be parallelized
+
+  $ rt --jobs 2 --runs-per-test 2 test-success.t
+  running 2 tests using 2 parallel processes 
+  ..
+  # Ran 2 tests, 0 skipped, 0 failed.
 
 Interactive run
 ===
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2859,8 +2859,9 @@
 testdescs = orig
 
 tests = [self._gettest(d, i) for i, d in enumerate(testdescs)]
-
-jobs = min(len(tests), self.options.jobs)
+num_tests = len(tests) * self.options.runs_per_test
+
+jobs = min(num_tests, self.options.jobs)
 
 failed = False
 kws = self.options.keywords
@@ -2897,7 +2898,7 @@
 self._installchg()
 
 log('running %d tests using %d parallel processes' % (
-len(tests), jobs))
+num_tests, jobs))
 
 result = runner.run(suite)
 



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


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

2019-01-10 Thread Gregory Szorc
On Thu, Jan 10, 2019 at 9:03 AM Boris FELD  wrote:

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

We're introducing a new repo requirement in 4.9 for sparse revlogs. I
believe this strip problem (along with a ton of other problems) goes away
if we have reader locks on repos.

Since we are already introducing a new repo requirement for new repos, we
can introduce yet more repo requirements without any additional significant
user inconvenience.

I know it is a stretch since we only have a few days left before the 4.9
RC, but is anybody will to implement reader locks (or some other repo
mutual exclusion mechanism that could mitigate the strip problem)? Of
course, reader locks break the ability to open a repository on a read-only
filesystem. So, we shouldn't use them lightly! But we could do something
like write a repo/transaction "generation number" into .hg/store and read
it to detect repo mutations before certain operations. We could potentially
also have "mmap mode" require writing a file, socket file, etc into
.hg/store and have any writer refuse to strip if there is an active reader
doing mmap.

That's a lot of random ideas, I know. But I think that in order to enable
mmap by default, we need to lock out mutations on mmap'd file segments in
order to prevent crashes. This seemingly requires a reader lock or
transaction changes of some form.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] extdiff: add --mode option

2019-01-10 Thread Ludovic Chabant
> Sorry for late review. Almost all devs were inactive while holidays.

No worries! Between the holidays and the 4.8.2 release, I figured unsolicited 
new features were a low priority.


> First, can you break this into a series of a few patches?
> 
> https://www.mercurial-scm.org/wiki/ContributingChanges#Organizing_patches
> 
> I expect the first patch will probably reorder or extract the current behavior
> to function such that new modes can be added.

Sure! I wasn't sure exactly what qualifies as multi vs single patch changes.


> I don't think "--mode " is good ui. I don't have nice idea, but maybe
> it can be split into two flags (e.g. --per-file and --confirm/--interactive)?
> 
> And the config option can specify if the tool support directory diff, for
> example. If the tool doesn't support directory diff, and if it's gui, spawn
> processes per file by default.

I was actually debating with myself between the 2 ways of specifying the diff 
mode, and eventually I settled on the --mode option. Here's the rationale 
(although I can be easily convinced to use the alternative):

- A --mode option is easier to later extend to more ways to diff things, like 
for example a mode where, when you pass a revision range, it will diff each 
revision one by one (invoking the external program N times if there are N 
revisions in the range). Different flags that may or may not be compatible 
between each other are more confusing IMHO.

- The --confirm option doesn't do anything if you don't also pass --per-file... 
I don't know if there are other aspects of the hg cli that have this? Now I 
realize that I also fell short of that downside since "--mode p" doesn't do 
anything either, but the point is that if we want something to represent "per 
file" and "per file with prompt", 2 modes do that better than 2 flags (and I 
could change my patch to have "p" be a mode of its own instead of modifying the 
"f" mode).

But like I was saying, I'm open to changing it. I figured this would probably 
be the main debate with this patch.


> Unrelated changes?

Woops, yes. Sorry, I didn't correctly check my cmdline arguments when sending 
the patch.

-- 
 l u d o .
 . 8 0 17 80
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2] convert: don't drop commits that are empty in the source when using --filemap

2019-01-10 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1547067725 18000
#  Wed Jan 09 16:02:05 2019 -0500
# Branch stable
# Node ID 1f267b001e4588edd3873a9039be7679f08c7560
# Parent  60e7f0c9b572f995b0d196f6b946001f148d576f
convert: don't drop commits that are empty in the source when using --filemap

I ran into this when using `hg lfconvert --to-normal` (which uses the filemap
class internally), and saw that commits with nothing but a branch change were
dropped.  We could put in an option that only lfconvert uses internally.  But
silently dropping anything other than a commit where all changes were excluded
seems unintended.  For example, there's a message in mercurial_sink.putcommit()
if it drops an empty commit.  (And the reason that isn't kicking in here is
because lfconvert isn't passing --filemap, so the self.filemapmode conditional
there is always False.)

The naive change of `return not files` broke test-convert-filemap.t, so this is
a little more elaborate than needed for converting from largefiles.

diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py
--- a/hgext/convert/filemap.py
+++ b/hgext/convert/filemap.py
@@ -305,7 +305,18 @@ class filemap_source(common.converter_so
 for f in files:
 if self.filemapper(f):
 return True
-return False
+
+# The include directive is documented to include nothing else (though
+# valid branch closes are included).
+if self.filemapper.include:
+return False
+
+# Allow empty commits in the source revision through.  The getchanges()
+# method doesn't even bother calling this if it determines that the
+# close marker is significant (i.e. all of the branch ancestors weren't
+# eliminated).  Therefore if there *is* a close marker, getchanges()
+# doesn't consider it significant, and this revision should be dropped.
+return not files and 'close' not in self.commits[rev].extra
 
 def mark_not_wanted(self, rev, p):
 # Mark rev as not interesting and update data structures.
diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t
--- a/tests/test-convert-filemap.t
+++ b/tests/test-convert-filemap.t
@@ -435,6 +435,32 @@ exercise incremental conversion at the s
   |
   o  0 "addb" files: b
   
+Include directives dropped empty commits, but other directives don't
+
+  $ cat > branchpruning/exclude_filemap < exclude a
+  > EOF
+  $ hg convert --filemap branchpruning/exclude_filemap branchpruning 
branchpruning-hg-exclude
+  initializing destination branchpruning-hg-exclude repository
+  scanning source...
+  sorting...
+  converting...
+  5 adda
+  4 closefoo
+  3 emptybranch
+  2 closeempty
+  1 addb
+  0 closedefault
+
+  $ glog -R branchpruning-hg-exclude
+  _  3 "closedefault" files:
+  |
+  o  2 "addb" files: b
+  
+  _  1 "closeempty" files:
+  |
+  o  0 "emptybranch" files:
+  
 
 Test rebuilding of map with unknown revisions in shamap - it used to crash
 
diff --git a/tests/test-lfconvert.t b/tests/test-lfconvert.t
--- a/tests/test-lfconvert.t
+++ b/tests/test-lfconvert.t
@@ -356,20 +356,27 @@ Avoid a traceback if a largefile isn't a
 Ensure the largefile can be cached in the source if necessary
   $ hg clone -U largefiles-repo issue3519
   $ rm -f "${USERCACHE}"/*
+  $ hg -R issue3519 branch -q mybranch
+  $ hg -R issue3519 ci -m 'change branch name only'
   $ hg lfconvert --to-normal issue3519 normalized3519
   initializing destination normalized3519
   4 additional largefiles cached
   scanning source...
   sorting...
   converting...
-  7 add large, normal1
-  6 add sub/*
-  5 rename sub/ to stuff/
-  4 add normal3, modify sub/*
-  3 remove large, normal3
-  2 merge
-  1 add anotherlarge (should be a largefile)
-  0 Added tag mytag for changeset abacddda7028
+  8 add large, normal1
+  7 add sub/*
+  6 rename sub/ to stuff/
+  5 add normal3, modify sub/*
+  4 remove large, normal3
+  3 merge
+  2 add anotherlarge (should be a largefile)
+  1 Added tag mytag for changeset abacddda7028
+  0 change branch name only
+
+Ensure empty commits aren't lost in the conversion
+  $ hg -R normalized3519 log -r tip -T '{desc}\n'
+  change branch name only
 
 Ensure the abort message is useful if a largefile is entirely unavailable
   $ rm -rf normalized3519
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] convert: add missing numcommits() override to hg sources

2019-01-10 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1547062386 18000
#  Wed Jan 09 14:33:06 2019 -0500
# Branch stable
# Node ID 60e7f0c9b572f995b0d196f6b946001f148d576f
# Parent  fbd5e2f0bba7661f6f09e6cfd2bc2ffd07559a41
convert: add missing numcommits() override to hg sources

Otherwise, the progressbar in converter.walktree() gets None as its total during
the initial scan.  (Though that seems harmless, and there are other foreign vcs
sources without this.)

diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py
--- a/hgext/convert/filemap.py
+++ b/hgext/convert/filemap.py
@@ -270,6 +270,9 @@ class filemap_source(common.converter_so
 self.children[p] = self.children.get(p, 0) + 1
 return c
 
+def numcommits(self):
+return self.base.numcommits()
+
 def _cachedcommit(self, rev):
 if rev in self.commits:
 return self.commits[rev]
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -597,6 +597,9 @@ class mercurial_source(common.converter_
  saverev=self.saverev,
  phase=ctx.phase())
 
+def numcommits(self):
+return len(self.repo)
+
 def gettags(self):
 # This will get written to .hgtags, filter non global tags out.
 tags = [t for t in self.repo.tagslist()
diff --git a/tests/test-convert-filemap.t b/tests/test-convert-filemap.t
--- a/tests/test-convert-filemap.t
+++ b/tests/test-convert-filemap.t
@@ -451,7 +451,7 @@ Test rebuilding of map with unknown revi
   run hg source pre-conversion action
   run hg sink pre-conversion action
   scanning source...
-  scanning: 1 revisions
+  scanning: 1/7 revisions (14.29%)
   sorting...
   converting...
   0 merging something
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5557: testrunner: make `-j100 --runs-per-test=100 test-foo.t` use 100 jobs

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


  In https://phab.mercurial-scm.org/D5557#82106, @martinvonz wrote:
  
  > Could you please include a test case?
  
  
  Done. Also made it print the number of test runs, not number of distinct 
tests.

REPOSITORY
  rHG Mercurial

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

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


D5557: testrunner: make `-j100 --runs-per-test=100 test-foo.t` use 100 jobs

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5557?vs=13151&id=13152

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

AFFECTED FILES
  tests/run-tests.py
  tests/test-run-tests.t

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -716,6 +716,12 @@
 (delete the duplicated test file)
   $ rm test-failure-copy.t
 
+multiple runs per test should be parallelized
+
+  $ rt --jobs 2 --runs-per-test 2 test-success.t
+  running 2 tests using 2 parallel processes 
+  ..
+  # Ran 2 tests, 0 skipped, 0 failed.
 
 Interactive run
 ===
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2859,8 +2859,9 @@
 testdescs = orig
 
 tests = [self._gettest(d, i) for i, d in enumerate(testdescs)]
-
-jobs = min(len(tests), self.options.jobs)
+num_tests = len(tests) * self.options.runs_per_test
+
+jobs = min(num_tests, self.options.jobs)
 
 failed = False
 kws = self.options.keywords
@@ -2897,7 +2898,7 @@
 self._installchg()
 
 log('running %d tests using %d parallel processes' % (
-len(tests), jobs))
+num_tests, jobs))
 
 result = runner.run(suite)
 



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


D5557: testrunner: make `-j100 --runs-per-test=100 test-foo.t` use 100 jobs

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


  Could you please include a test case?

REPOSITORY
  rHG Mercurial

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

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


D5557: testrunner: make `-j100 --runs-per-test=100 test-foo.t` use 100 jobs

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

REVISION SUMMARY
  It would use only 1 job since 
https://phab.mercurial-scm.org/rHG1039404c5e1d12f7ee3b09eedde803f52f8b369a 
(run-tests: print number of
  tests and parallel process count, 2018-10-13), but I'm pretty sure
  that was unintentional.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2860,7 +2860,8 @@
 
 tests = [self._gettest(d, i) for i, d in enumerate(testdescs)]
 
-jobs = min(len(tests), self.options.jobs)
+jobs = min(len(tests) * self.options.runs_per_test,
+   self.options.jobs)
 
 failed = False
 kws = self.options.keywords



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


D5509: narrow: move copytonarrowspec() out of setnarrowpats()

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5509?vs=13058&id=13149

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

AFFECTED FILES
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowcommands.py
  mercurial/hg.py
  mercurial/localrepo.py
  tests/test-narrow-expanddirstate.t

CHANGE DETAILS

diff --git a/tests/test-narrow-expanddirstate.t 
b/tests/test-narrow-expanddirstate.t
--- a/tests/test-narrow-expanddirstate.t
+++ b/tests/test-narrow-expanddirstate.t
@@ -71,6 +71,7 @@
   >   if not repo.currenttransaction():
   > ui.develwarn(b'expandnarrowspec called outside of transaction!')
   >   repo.setnarrowpats(includes, excludes)
+  >   narrowspec.copytoworkingcopy(repo)
   >   newmatcher = narrowspec.match(repo.root, includes, excludes)
   >   added = matchmod.differencematcher(newmatcher, currentmatcher)
   >   for f in repo[b'.'].manifest().walk(added):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1259,7 +1259,6 @@
 
 def setnarrowpats(self, newincludes, newexcludes):
 narrowspec.save(self, newincludes, newexcludes)
-narrowspec.copytoworkingcopy(self)
 self.invalidate(clearfilecache=True)
 
 def __getitem__(self, changeid):
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -737,6 +737,7 @@
 if narrow:
 with local.wlock(), local.lock():
 local.setnarrowpats(storeincludepats, storeexcludepats)
+narrowspec.copytoworkingcopy(local)
 
 u = util.url(abspath)
 defaulturl = bytes(u)
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -245,6 +245,7 @@
 # Update narrowspec before removing revlogs, so repo won't be
 # corrupt in case of crash
 repo.setnarrowpats(newincludes, newexcludes)
+narrowspec.copytoworkingcopy(repo)
 
 for f in todelete:
 ui.status(_('deleting %s\n') % f)
@@ -316,6 +317,7 @@
 transactiongetter=tgetter)
 
 repo.setnewnarrowpats()
+narrowspec.copytoworkingcopy(repo)
 actions = merge.emptyactions()
 addgaction = actions['g'].append
 
diff --git a/hgext/narrow/narrowbundle2.py b/hgext/narrow/narrowbundle2.py
--- a/hgext/narrow/narrowbundle2.py
+++ b/hgext/narrow/narrowbundle2.py
@@ -151,6 +151,7 @@
 op.repo.requirements.add(repository.NARROW_REQUIREMENT)
 op.repo._writerequirements()
 op.repo.setnarrowpats(includepats, excludepats)
+narrowspec.copytoworkingcopy(op.repo)
 
 @bundle2.parthandler(_CHANGESPECPART)
 def _handlechangespec(op, inpart):



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


D5505: narrow: include working copy narrowspec in transaction journal

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


  Addressed comment

REPOSITORY
  rHG Mercurial

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

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


D5506: narrow: copy store narrowspec to working copy immediately

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5506?vs=13055&id=13146

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

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  mercurial/hg.py
  mercurial/localrepo.py
  mercurial/narrowspec.py

CHANGE DETAILS

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -161,17 +161,9 @@
 spec = format(includepats, excludepats)
 repo.svfs.write(FILENAME, spec)
 
-def copytoworkingcopy(repo, tr):
-if tr:
-def write(file):
-spec = repo.svfs.read(FILENAME)
-file.write(spec)
-file.close()
-tr.addfilegenerator('narrowspec', (DIRSTATE_FILENAME,), write,
-location='plain')
-else:
-spec = repo.svfs.read(FILENAME)
-repo.vfs.write(DIRSTATE_FILENAME, spec)
+def copytoworkingcopy(repo):
+spec = repo.svfs.read(FILENAME)
+repo.vfs.write(DIRSTATE_FILENAME, spec)
 
 def savebackup(repo, backupname):
 if repository.NARROW_REQUIREMENT not in repo.requirements:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1252,7 +1252,7 @@
 
 def setnarrowpats(self, newincludes, newexcludes):
 narrowspec.save(self, newincludes, newexcludes)
-narrowspec.copytoworkingcopy(self, self.currenttransaction())
+narrowspec.copytoworkingcopy(self)
 self.invalidate(clearfilecache=True)
 # So the next access won't be considered a conflict
 # TODO: It seems like there should be a way of doing this that
diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -334,7 +334,7 @@
 destrepo.vfs.write('hgrc', util.tonativeeol(template % default))
 if repositorymod.NARROW_REQUIREMENT in sourcerepo.requirements:
 with destrepo.wlock():
-narrowspec.copytoworkingcopy(destrepo, None)
+narrowspec.copytoworkingcopy(destrepo)
 
 def _postshareupdate(repo, update, checkout=None):
 """Maybe perform a working directory update after a shared repo is created.
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -432,9 +432,9 @@
 return 0
 
 if update_working_copy:
-with repo.wlock(), repo.lock(), repo.transaction('narrow-wc') as tr:
+with repo.wlock(), repo.lock(), repo.transaction('narrow-wc'):
 narrowspec.updateworkingcopy(repo)
-narrowspec.copytoworkingcopy(repo, tr)
+narrowspec.copytoworkingcopy(repo)
 return 0
 
 if not widening and not narrowing:



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


D5511: narrow: reuse narrowspec.updateworkingcopy() when narrowing

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5511?vs=13060&id=13150

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

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  mercurial/narrowspec.py

CHANGE DETAILS

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -273,7 +273,12 @@
 raise error.Abort(_("working copy's narrowspec is stale"),
   hint=_("run 'hg tracked --update-working-copy'"))
 
-def updateworkingcopy(repo):
+def updateworkingcopy(repo, assumeclean=False):
+"""updates the working copy and dirstate from the store narrowspec
+
+When assumeclean=True, files that are not known to be clean will also
+be deleted. It is then up to the caller to make sure they are clean.
+"""
 oldspec = repo.vfs.tryread(DIRSTATE_FILENAME)
 newspec = repo.svfs.tryread(FILENAME)
 
@@ -287,11 +292,17 @@
 ds = repo.dirstate
 lookup, status = ds.status(removedmatch, subrepos=[], ignored=False,
clean=True, unknown=False)
-_deletecleanfiles(repo, status.clean)
-trackeddirty = lookup + status.modified + status.added
+trackeddirty = status.modified + status.added
+clean = status.clean
+if assumeclean:
+assert not trackeddirty
+clean.extend(lookup)
+else:
+trackeddirty.extend(lookup)
+_deletecleanfiles(repo, clean)
 for f in sorted(trackeddirty):
 repo.ui.status(_('not deleting possibly dirty file %s\n') % f)
-for f in status.clean + trackeddirty:
+for f in clean + trackeddirty:
 ds.drop(f)
 
 repo.narrowpats = newincludes, newexcludes
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -160,16 +160,6 @@
 extensions.wrapfunction(exchange,'_pullbundle2extraprepare',
 pullbundle2extraprepare)
 
-# This is an extension point for filesystems that need to do something other
-# than just blindly unlink the files. It's not clear what arguments would be
-# useful, so we're passing in a fair number of them, some of them redundant.
-def _narrowcleanupwdir(repo, oldincludes, oldexcludes, newincludes, 
newexcludes,
-   oldmatch, newmatch):
-for f in repo.dirstate:
-if not newmatch(f):
-repo.dirstate.drop(f)
-repo.wvfs.unlinkpath(f)
-
 def _narrow(ui, repo, remote, commoninc, oldincludes, oldexcludes,
 newincludes, newexcludes, force):
 oldmatch = narrowspec.match(repo.root, oldincludes, oldexcludes)
@@ -241,19 +231,18 @@
 
 repo.destroying()
 
-with repo.transaction("narrowing"):
+with repo.transaction('narrowing'):
 # Update narrowspec before removing revlogs, so repo won't be
 # corrupt in case of crash
 repo.setnarrowpats(newincludes, newexcludes)
-narrowspec.copytoworkingcopy(repo)
 
 for f in todelete:
 ui.status(_('deleting %s\n') % f)
 util.unlinkpath(repo.svfs.join(f))
 repo.store.markremoved(f)
 
-_narrowcleanupwdir(repo, oldincludes, oldexcludes, newincludes,
-   newexcludes, oldmatch, newmatch)
+narrowspec.updateworkingcopy(repo, assumeclean=True)
+narrowspec.copytoworkingcopy(repo)
 
 repo.destroyed()
 



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


D5508: narrow: extract repo property for store narrowmatcher

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5508?vs=13057&id=13148

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

AFFECTED FILES
  hgext/lfs/__init__.py
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -815,7 +815,7 @@
 if path[0] == b'/':
 path = path[1:]
 
-return filelog.narrowfilelog(self.svfs, path, self.narrowmatch())
+return filelog.narrowfilelog(self.svfs, path, self._storenarrowmatch)
 
 def makefilestorage(requirements, features, **kwargs):
 """Produce a type conforming to ``ilocalrepositoryfilestorage``."""
@@ -1191,7 +1191,7 @@
 def manifestlog(self):
 rootstore = manifest.manifestrevlog(self.svfs)
 return manifest.manifestlog(self.svfs, self, rootstore,
-self.narrowmatch())
+self._storenarrowmatch)
 
 @repofilecache('dirstate')
 def dirstate(self):
@@ -1224,6 +1224,13 @@
 return narrowspec.load(self)
 
 @storecache(narrowspec.FILENAME)
+def _storenarrowmatch(self):
+if repository.NARROW_REQUIREMENT not in self.requirements:
+return matchmod.always(self.root, '')
+include, exclude = self.narrowpats
+return narrowspec.match(self.root, include=include, exclude=exclude)
+
+@storecache(narrowspec.FILENAME)
 def _narrowmatch(self):
 if repository.NARROW_REQUIREMENT not in self.requirements:
 return matchmod.always(self.root, '')
diff --git a/hgext/lfs/__init__.py b/hgext/lfs/__init__.py
--- a/hgext/lfs/__init__.py
+++ b/hgext/lfs/__init__.py
@@ -243,7 +243,7 @@
 s = repo.set('%n:%n', _bin(kwargs[r'node']), _bin(last))
 else:
 s = repo.set('%n', _bin(kwargs[r'node']))
-match = repo.narrowmatch()
+match = repo._storenarrowmatch
 for ctx in s:
 # TODO: is there a way to just walk the files in the commit?
 if any(ctx[f].islfs() for f in ctx.files()



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


D5507: narrow: drop now-unnecessary reassignment of repo attributes

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5507?vs=13056&id=13147

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

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
@@ -1254,12 +1254,6 @@
 narrowspec.save(self, newincludes, newexcludes)
 narrowspec.copytoworkingcopy(self)
 self.invalidate(clearfilecache=True)
-# So the next access won't be considered a conflict
-# TODO: It seems like there should be a way of doing this that
-# doesn't involve replacing these attributes.
-self.narrowpats = newincludes, newexcludes
-self._narrowmatch = narrowspec.match(self.root, include=newincludes,
- exclude=newexcludes)
 
 def __getitem__(self, changeid):
 if changeid is None:



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


D5505: narrow: include working copy narrowspec in transaction journal

2019-01-10 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 13145.
martinvonz marked an inline comment as done.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5505?vs=13054&id=13145

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

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
@@ -1837,6 +1837,7 @@
 # discard all changes (including ones already written
 # out) in this transaction
 narrowspec.restorebackup(self, 'journal.narrowspec')
+narrowspec.restorewcbackup(self, 'journal.narrowspec.dirstate')
 repo.dirstate.restorebackup(None, 'journal.dirstate')
 
 repo.invalidate(clearfilecache=True)
@@ -1914,6 +1915,7 @@
 def _journalfiles(self):
 return ((self.svfs, 'journal'),
 (self.svfs, 'journal.narrowspec'),
+(self.vfs, 'journal.narrowspec.dirstate'),
 (self.vfs, 'journal.dirstate'),
 (self.vfs, 'journal.branch'),
 (self.vfs, 'journal.desc'),
@@ -1926,6 +1928,7 @@
 @unfilteredmethod
 def _writejournal(self, desc):
 self.dirstate.savebackup(None, 'journal.dirstate')
+narrowspec.savewcbackup(self, 'journal.narrowspec.dirstate')
 narrowspec.savebackup(self, 'journal.narrowspec')
 self.vfs.write("journal.branch",
   encoding.fromlocal(self.dirstate.branch()))
@@ -2015,6 +2018,7 @@
 dsguard.close()
 
 narrowspec.restorebackup(self, 'undo.narrowspec')
+narrowspec.restorewcbackup(self, 'undo.narrowspec.dirstate')
 self.dirstate.restorebackup(None, 'undo.dirstate')
 try:
 branch = self.vfs.read('undo.branch')



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


D5504: narrow: make dirstateguard back up and restore working copy narrowspec instead

2019-01-10 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 13144.
martinvonz edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5504?vs=13053&id=13144

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

AFFECTED FILES
  mercurial/dirstateguard.py
  mercurial/narrowspec.py

CHANGE DETAILS

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -185,10 +185,25 @@
 return
 util.rename(repo.svfs.join(backupname), repo.svfs.join(FILENAME))
 
-def clearbackup(repo, backupname):
+def savewcbackup(repo, backupname):
 if repository.NARROW_REQUIREMENT not in repo.requirements:
 return
-repo.svfs.unlink(backupname)
+vfs = repo.vfs
+vfs.tryunlink(backupname)
+# It may not exist in old repos
+if vfs.exists(DIRSTATE_FILENAME):
+util.copyfile(vfs.join(DIRSTATE_FILENAME), vfs.join(backupname),
+  hardlink=True)
+
+def restorewcbackup(repo, backupname):
+if repository.NARROW_REQUIREMENT not in repo.requirements:
+return
+util.rename(repo.vfs.join(backupname), repo.vfs.join(DIRSTATE_FILENAME))
+
+def clearwcbackup(repo, backupname):
+if repository.NARROW_REQUIREMENT not in repo.requirements:
+return
+repo.vfs.unlink(backupname)
 
 def restrictpatterns(req_includes, req_excludes, repo_includes, repo_excludes):
 r""" Restricts the patterns according to repo settings,
diff --git a/mercurial/dirstateguard.py b/mercurial/dirstateguard.py
--- a/mercurial/dirstateguard.py
+++ b/mercurial/dirstateguard.py
@@ -37,7 +37,7 @@
 self._narrowspecbackupname = ('narrowspec.backup.%s.%d' %
   (name, id(self)))
 repo.dirstate.savebackup(repo.currenttransaction(), self._backupname)
-narrowspec.savebackup(repo, self._narrowspecbackupname)
+narrowspec.savewcbackup(repo, self._narrowspecbackupname)
 self._active = True
 
 def __del__(self):
@@ -56,12 +56,12 @@
 
 self._repo.dirstate.clearbackup(self._repo.currenttransaction(),
  self._backupname)
-narrowspec.clearbackup(self._repo, self._narrowspecbackupname)
+narrowspec.clearwcbackup(self._repo, self._narrowspecbackupname)
 self._active = False
 self._closed = True
 
 def _abort(self):
-narrowspec.restorebackup(self._repo, self._narrowspecbackupname)
+narrowspec.restorewcbackup(self._repo, self._narrowspecbackupname)
 self._repo.dirstate.restorebackup(self._repo.currenttransaction(),
self._backupname)
 self._active = False



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


D5556: narrow: include journal.narrowspec in transaction journal

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

REVISION SUMMARY
  We had missed this file before, which led to it lying around after the
  transaction completed.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/localrepo.py
  tests/test-narrow-clone-stream.t

CHANGE DETAILS

diff --git a/tests/test-narrow-clone-stream.t b/tests/test-narrow-clone-stream.t
--- a/tests/test-narrow-clone-stream.t
+++ b/tests/test-narrow-clone-stream.t
@@ -77,11 +77,11 @@
   00manifest.i
   data (tree flat-fncache !)
   fncache (tree flat-fncache !)
-  journal.narrowspec
   meta (tree !)
   narrowspec
   undo
   undo.backupfiles
+  undo.narrowspec
   undo.phaseroots
 
 Checking that repository has all the required data and not broken
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1913,6 +1913,7 @@
 
 def _journalfiles(self):
 return ((self.svfs, 'journal'),
+(self.svfs, 'journal.narrowspec'),
 (self.vfs, 'journal.dirstate'),
 (self.vfs, 'journal.branch'),
 (self.vfs, 'journal.desc'),



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


D5504: narrow: make dirstateguard back up and restore working copy narrowspec instead

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


  In https://phab.mercurial-scm.org/D5504#82068, @pulkit wrote:
  
  > This one removes clearbackup() while restorebackup() and savebackup() are 
still there. Does that means that we are sure that we won't need to manually 
clear the backup from store?
  
  
  Good question. It just meant that `clearbackup()` is no longer called and I 
didn't think further :P I think this patch is still correct, but I'll insert a 
patch that adds `journal.narrowspec` to `localrepository._journalfiles()`.

REPOSITORY
  rHG Mercurial

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

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


D5512: narrow: use merge.ACTION_GET instead of duplicating 'g' constant

2019-01-10 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5838afea8213: narrow: use merge.ACTION_GET instead of 
duplicating 'g' constant (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5512?vs=13061&id=13142

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

AFFECTED FILES
  mercurial/narrowspec.py

CHANGE DETAILS

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -251,7 +251,7 @@
 
 def _writeaddedfiles(repo, pctx, files):
 actions = merge.emptyactions()
-addgaction = actions['g'].append
+addgaction = actions[merge.ACTION_GET].append
 mf = repo['.'].manifest()
 for f in files:
 if not repo.wvfs.exists(f):



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


mercurial@41146: new changeset (1 on stable)

2019-01-10 Thread Mercurial Commits
New changeset (1 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/fbd168455b26
changeset:   41146:fbd168455b26
branch:  stable
tag: tip
parent:  41128:f467c353298c
user:rdama...@google.com
date:Wed Jan 09 20:00:35 2019 -0800
summary: histedit: crashing with a more useful error message on empty 
defaultrev

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


Re: [PATCH 05 of 10 V3] discovery: move undecided set on the partialdiscovery

2019-01-10 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Jan 4, 2019 at 2:54 PM Boris Feld  wrote:

> # HG changeset patch
> # User Boris Feld 
> # Date 1545963817 -3600
> #  Fri Dec 28 03:23:37 2018 +0100
> # Node ID 944c2173a32073584a22f8de8c0e348245065c1e
> # Parent  f3c439000eb772272745c344f5257f3ecce369c0
> # EXP-Topic discovery-refactor
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 944c2173a320
> discovery: move undecided set on the partialdiscovery
>
> To initialize it, we need to know the discovery target. This commit only
> move
> the set on the `partialdiscovery` object, later changeset will take
> advantage of
> it.
>
> diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
> --- a/mercurial/setdiscovery.py
> +++ b/mercurial/setdiscovery.py
> @@ -182,6 +185,13 @@ class partialdiscovery(object):
>  """return True is we have any clue about the remote state"""
>  return self._common.hasbases()
>
> +@property
> +def undecided(self):
> +if self._undecided is not None:
> +return self._undecided
> +self._undecided =
> set(self._common.missingancestors(self._targetheads))
> +return self._undecided
>

Why is this is a @property? It seems confusing to me to use a property for
something that changes over time and this does change over time, right?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5515: narrow: drop explicit dirstate write

2019-01-10 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4475322b7533: narrow: drop explicit dirstate write 
(authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5515?vs=13052&id=13141

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

AFFECTED FILES
  hgext/narrow/narrowcommands.py
  mercurial/narrowspec.py

CHANGE DETAILS

diff --git a/mercurial/narrowspec.py b/mercurial/narrowspec.py
--- a/mercurial/narrowspec.py
+++ b/mercurial/narrowspec.py
@@ -266,7 +266,7 @@
 raise error.Abort(_("working copy's narrowspec is stale"),
   hint=_("run 'hg tracked --update-working-copy'"))
 
-def updateworkingcopy(repo, tr):
+def updateworkingcopy(repo):
 oldspec = repo.vfs.tryread(DIRSTATE_FILENAME)
 newspec = repo.svfs.tryread(FILENAME)
 
@@ -294,5 +294,3 @@
 for f in newfiles:
 ds.normallookup(f)
 _writeaddedfiles(repo, pctx, newfiles)
-
-ds.write(tr)
diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -433,7 +433,7 @@
 
 if update_working_copy:
 with repo.wlock(), repo.lock(), repo.transaction('narrow-wc') as tr:
-narrowspec.updateworkingcopy(repo, tr)
+narrowspec.updateworkingcopy(repo)
 narrowspec.copytoworkingcopy(repo, tr)
 return 0
 



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


D5505: narrow: include working copy narrowspec in transaction journal

2019-01-10 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> narrowspec.py:193
>  vfs.tryunlink(backupname)
> -util.copyfile(vfs.join(DIRSTATE_FILENAME), vfs.join(backupname),
> -  hardlink=True)
> +# It may not exist in old repos
> +if vfs.exists(DIRSTATE_FILENAME):

This change should be moved to previous patch or a separate patch.

REPOSITORY
  rHG Mercurial

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

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


D5504: narrow: make dirstateguard back up and restore working copy narrowspec instead

2019-01-10 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  This one removes clearbackup() while restorebackup() and savebackup() are 
still there. Does that means that we are sure that we won't need to manually 
clear the backup from store?

REPOSITORY
  rHG Mercurial

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

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


Re: Auto-formatting with yapf (was: Re: Auto-formatting code with black - object now if you have a strong opinion)

2019-01-10 Thread Augie Fackler


> On Jan 10, 2019, at 00:14, Matt Harbison  wrote:
> 
> On Wed, 09 Jan 2019 15:30:19 -0500, Augie Fackler  wrote:
> 
>> 
>> 
>>> On Dec 6, 2018, at 23:21, Matt Harbison  wrote:
>>> 
>>> On Wed, 05 Dec 2018 08:23:17 -0500, Yuya Nishihara  wrote:
>>> 
 On Tue, 4 Dec 2018 10:06:24 -0500, Augie Fackler wrote:
> 
> So, options to move forward:
> 1) blacken everything (controversial for good reasons)
> 2) try black only on a subset
> 3) explore yapf
> 4) Give up and keep manually formatting files (I'd rather not do this, 
> but I understand if it's where we end up)
 
 My vote: 3 > 4 > 2 > 1
 
 I'm not super enthusiastic about 100%-machine-forced formatting. I like
 consistency level provided by e.g. astyle command. clang-format is pretty
 good IMHO, but the black seems to sacrifice the code readability.
>>> 
>>> +1.
>>> 
>>> That said, I got used to longnamesthataresmooshedtogether, so I can 
>>> probably adjust to anything after awhile.
>> 
>> I think I'd still prefer black overall (yapf is less opinionated and 
>> requires me to think more), but here's a yapf RFC: 
>> https://phab.mercurial-scm.org/D5539
>> 
>> This would at least help _most_ cases of line-too-long, which I think would 
>> be good. What do people think?
> 
> I think there's less that I dislike with yapf, but I'm not adamant about it.

Should I pursue fixing any bugs in yapf, or is this a lukewarm "I'd rather we 
not bother" sort of feeling?

(if others have opinions I'd like to hear those too)

> 
> Since I've never used auto formatting, I'm assuming the general procedure is 
> to:
> 
>  1) code something the approximates the style

Once I'm on a formatter, I typically write "literally anything that's 
syntactically valid" and then an editor save hook fixes the formatting to be 
pretty/correct. yapf isn't picky enough to make that workflow quite reliable, 
but in practice it's probably fine...

>  2) run fix
>  3) submit
> 
> If that's true, what's there to think about?

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


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

2019-01-10 Thread Augie Fackler


> On Jan 10, 2019, at 12:24, Boris FELD  wrote:
> 
> 
> 
> On 07/01/2019 22:19, Augie Fackler wrote:
>> 
>> 
>>> On Jan 4, 2019, at 08:09, Pulkit Goyal <7895pul...@gmail.com> wrote:
>>> 
>>> 
>>> 
>>> On Fri, Jan 4, 2019 at 4:31 AM Augie Fackler  wrote:
>>> 
>>> 
>>> > On Jan 3, 2019, at 10:23 AM, Pulkit Goyal <7895pul...@gmail.com> wrote:
>>> > 
>>> > 
>>> > 
>>> > On Thu, Jan 3, 2019 at 4:14 AM Boris Feld  wrote:
>>> > # HG changeset patch
>>> > # User Boris Feld 
>>> > # Date 1539697680 -7200
>>> > #  Tue Oct 16 15:48:00 2018 +0200
>>> > # Node ID a82909c0da7cc07ea1a46690ffc08e45ebc14af6
>>> > # Parent  65488c7d2e933cdb2ab1c36b3887a8a67a24fc60
>>> > # EXP-Topic archived-phase-UX
>>> > # Available At https://bitbucket.org/octobus/mercurial-devel/
>>> > #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
>>> > a82909c0da7c
>>> > strip: introduce a soft strip option
>>> > 
>>> > This is the first user-accessible way to use the archived phase 
>>> > introduced in
>>> > 4.8. This implements a feature implemented during the Stockholm sprint. 
>>> > The
>>> > archived phase behave as stripping, changesets are no longer accessible, 
>>> > but
>>> > pulling/unbundling them will make then reappear. The only notable 
>>> > difference
>>> > is that unlike hard stripping, soft stripping does not affect obsmarkers.
>>> 
>>> I’m not thrilled with this: I had envisioned the archived state as not full 
>>> of garbage, but full of things that might merit revisiting some day. When I 
>>> strip (or prune it) it’s usually a dead end, whereas I’d like a way to say 
>>> “this isn’t interesting now, but it might be again some day”.
>>> 
>>> I have no idea if I’m in the minority, and I know this is very late 
>>> feedback (because of the holidays I haven’t been at a computer much) but 
>>> hopefully it’s useful.
>>> 
>>> Interesting idea.
>>> 
>>> According to my understanding of discussion happened during sprint, we want 
>>> to use phases to make strip command and stripping less bad. I like that 
>>> goal and very much want us to move in that direction.
>>> 
>>> Talking about your idea, we might need a phase for things which merit 
>>> revisiting someday. Do you mean that archived phase should be used for that 
>>> and we should use some other phase for stripping?
>> 
>> Yes, STRIPPED would be more like INTERNAL (all garbage, fine to delete), 
>> whereas ARCHIVED would be "please don't delete this, but hide it by 
>> default". Does that make sense?
>> 
>> (I fully acknowledge I kind of am asking for a pony here.)
> The INTERNAL phase is for internal use only to hide the byproducts commits of 
> hg commands (eg shelve). No user-created commit should end up in the INTERNAL 
> phase.
> 
> Using the ARCHIVED phase now is a nice trick to make history rewriting 
> commands faster until obsolescence is activated by default. Once obsolescence 
> is activated by default, the pony you described should be yours. In the 
> mean-time, I would prefer not to introduce a third phase that we would have 
> around forever.

I guess I was confused by the placement of this functionality in the `strip` 
command then. I'm not sure where else to put it (given that we already burned 
the `archive` name for making zipfiles etc.) but maybe strip (-> destroy this 
change please) is a suboptimal place.

I guess if we mark it as experimental so we can move it later, that seems fine.

(Do I have a more correct understanding now? I think I was talking past the 
intent here...)

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

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


D5540: histedit: fix --continue and --abort when curses is enabled

2019-01-10 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9bc7ec924234: histedit: fix --continue and --abort when 
curses is enabled (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5540?vs=13136&id=13140

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-non-commute.t

CHANGE DETAILS

diff --git a/tests/test-histedit-non-commute.t 
b/tests/test-histedit-non-commute.t
--- a/tests/test-histedit-non-commute.t
+++ b/tests/test-histedit-non-commute.t
@@ -161,7 +161,10 @@
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
   Fix up the change (pick 7b4e2f4b7bcd)
   (hg histedit --continue to resume)
-  $ hg histedit --continue 2>&1 | fixbundle
+We forcibly enable curses here so we can verify that continuing works
+with curses enabled.
+  $ hg histedit --continue --config ui.interactive=true \
+  >   --config ui.interface=curses 2>&1 | fixbundle
   abort: unresolved merge conflicts (see 'hg help resolve')
 
 This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1593,7 +1593,10 @@
 for intentional "edit" command, but also for resolving unexpected
 conflicts).
 """
-if ui.interface('histedit') == 'curses':
+# kludge: _chistedit only works for starting an edit, not aborting
+# or continuing, so fall back to regular _texthistedit for those
+# operations.
+if ui.interface('histedit') == 'curses' and  _getgoal(opts) == goalnew:
 return _chistedit(ui, repo, *freeargs, **opts)
 return _texthistedit(ui, repo, *freeargs, **opts)
 



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


D5555: py3: add a test to whitelist caught by buildbot

2019-01-10 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -408,6 +408,7 @@
 test-narrow-shallow-merges.t
 test-narrow-shallow.t
 test-narrow-share.t
+test-narrow-sparse.t
 test-narrow-strip.t
 test-narrow-trackedcmd.t
 test-narrow-update.t



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


Re: 4.9-rc0 coming up - prepare accordingly

2019-01-10 Thread Pulkit Goyal
On Thu, Jan 10, 2019 at 10:41 PM Boris FELD  wrote:

> Hello, there is a couple of things we would like to conclude before the
> 4.9 freeze.
>
> We have a few series about the performance of computation in discovery (a
> refactoring, a %ld revset performance fix, some better written revsets and
> some Rust code).
>
> We have also the mmap feature discussion that we would like to comes to a
> final plan.
>
> We have a small fix on the atomic update when there are some read-only
> files.
>

Awesome! thanks for doing all these work.

Please send patches as soon as possible. I am not sure whether we can get
all of that work pushed in before the freeze, but I will help reviewing
with things I know about.

On 08/01/2019 19:53, Pulkit Goyal wrote:
>
> Hey everyone!
>
> As per our time based release plan, we have a major release i.e. hg-4.9
> coming 1st Feb. 4.9rc0 will be released on upcoming 16th or 17th. So if you
> want something to be included in upcoming major release, now is a good time
> to send patches.
>
> If you need help getting something landed between now and the 17th, please
> coordinate with a reviewer /now/ or reply to this email and we can discuss
> further.
>
> Also, last cycle we tried something new by accepting new functionality on
> default branch which we will like to continue this cycle too. Bugfixes in
> the rc should go on stable as usual.
>
> Thanks!
>
> Regards
> Pulkit
>
>
>
> ___
> Mercurial-devel mailing 
> listMercurial-devel@mercurial-scm.orghttps://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2019-01-10 Thread Boris FELD

On 07/01/2019 22:19, Augie Fackler wrote:
>
>
>> On Jan 4, 2019, at 08:09, Pulkit Goyal <7895pul...@gmail.com
>> > wrote:
>>
>>
>>
>> On Fri, Jan 4, 2019 at 4:31 AM Augie Fackler > > wrote:
>>
>>
>>
>> > On Jan 3, 2019, at 10:23 AM, Pulkit Goyal <7895pul...@gmail.com
>> > wrote:
>> >
>> >
>> >
>> > On Thu, Jan 3, 2019 at 4:14 AM Boris Feld
>> mailto:boris.f...@octobus.net>> wrote:
>> > # HG changeset patch
>> > # User Boris Feld > >
>> > # Date 1539697680 -7200
>> > #      Tue Oct 16 15:48:00 2018 +0200
>> > # Node ID a82909c0da7cc07ea1a46690ffc08e45ebc14af6
>> > # Parent  65488c7d2e933cdb2ab1c36b3887a8a67a24fc60
>> > # EXP-Topic archived-phase-UX
>> > # Available At https://bitbucket.org/octobus/mercurial-devel/
>> > #              hg pull
>> https://bitbucket.org/octobus/mercurial-devel/ -r a82909c0da7c
>> > strip: introduce a soft strip option
>> >
>> > This is the first user-accessible way to use the archived phase
>> introduced in
>> > 4.8. This implements a feature implemented during the Stockholm
>> sprint. The
>> > archived phase behave as stripping, changesets are no longer
>> accessible, but
>> > pulling/unbundling them will make then reappear. The only
>> notable difference
>> > is that unlike hard stripping, soft stripping does not affect
>> obsmarkers.
>>
>> I’m not thrilled with this: I had envisioned the archived state
>> as not full of garbage, but full of things that might merit
>> revisiting some day. When I strip (or prune it) it’s usually a
>> dead end, whereas I’d like a way to say “this isn’t interesting
>> now, but it might be again some day”.
>>
>> I have no idea if I’m in the minority, and I know this is very
>> late feedback (because of the holidays I haven’t been at a
>> computer much) but hopefully it’s useful.
>>
>>
>> Interesting idea.
>>
>> According to my understanding of discussion happened during sprint,
>> we want to use phases to make strip command and stripping less bad. I
>> like that goal and very much want us to move in that direction.
>>
>> Talking about your idea, we might need a phase for things which merit
>> revisiting someday. Do you mean that archived phase should be used
>> for that and we should use some other phase for stripping?
>
> Yes, STRIPPED would be more like INTERNAL (all garbage, fine to
> delete), whereas ARCHIVED would be "please don't delete this, but hide
> it by default". Does that make sense?
>
> (I fully acknowledge I kind of am asking for a pony here.)
The INTERNAL phase is for internal use only to hide the byproducts
commits of hg commands (eg shelve). No user-created commit should end up
in the INTERNAL phase.

Using the ARCHIVED phase now is a nice trick to make history rewriting
commands faster until obsolescence is activated by default. Once
obsolescence is activated by default, the pony you described should be
yours. In the mean-time, I would prefer not to introduce a third phase
that we would have around forever.
>
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: 4.9-rc0 coming up - prepare accordingly

2019-01-10 Thread Boris FELD
Hello, there is a couple of things we would like to conclude before the
4.9 freeze.

We have a few series about the performance of computation in discovery
(a refactoring, a %ld revset performance fix, some better written
revsets and some Rust code).

We have also the mmap feature discussion that we would like to comes to
a final plan.

We have a small fix on the atomic update when there are some read-only
files.

On 08/01/2019 19:53, Pulkit Goyal wrote:
> Hey everyone!
>
> As per our time based release plan, we have a major release i.e.
> hg-4.9 coming 1st Feb. 4.9rc0 will be released on upcoming 16th or
> 17th. So if you want something to be included in upcoming major
> release, now is a good time to send patches.
>
> If you need help getting something landed between now and the 17th,
> please coordinate with a reviewer /now/ or reply to this email and we
> can discuss further.
>
> Also, last cycle we tried something new by accepting new functionality
> on default branch which we will like to continue this cycle too.
> Bugfixes in the rc should go on stable as usual.
>
> Thanks!
>
> Regards
> Pulkit
>
>
>
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

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

Ok, what do you think we should do for 4.9?


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


D5554: histedit: added rewrite.update-timestamp to fold and mess

2019-01-10 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 13138.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5554?vs=13137&id=13138

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-edit.t
  tests/test-histedit-fold.t

CHANGE DETAILS

diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -597,3 +597,131 @@
   o  8f0162e483d0 aa
   
 
+
+-==
+Test update-timestamp config option|
+==
+  $ cat >> testmocks.py << EOF
+  > # mock out util.makedate() to supply testable values
+  > import os
+  > from mercurial import pycompat, util
+  > from mercurial.utils import dateutil
+  > 
+  > def mockmakedate():
+  > filename = os.path.join(os.environ['TESTTMP'], 'testtime')
+  > try:
+  > with open(filename, 'rb') as timef:
+  > time = float(timef.read()) + 1
+  > except IOError:
+  > time = 0.0
+  > with open(filename, 'wb') as timef:
+  > timef.write(pycompat.bytestr(time))
+  > return (time, 0)
+  > 
+  > dateutil.makedate = mockmakedate
+  > EOF
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > histedit=
+  > testmocks=`pwd`/testmocks.py
+  > EOF
+
+  $ addwithdate ()
+  > {
+  > echo $1 > $1
+  > hg add $1
+  > hg ci -m $1 -d "$2 0"
+  > }
+
+  $ initrepo ()
+  > {
+  > hg init r
+  > cd r
+  > addwithdate a 1
+  > addwithdate b 2
+  > addwithdate c 3
+  > addwithdate d 4
+  > addwithdate e 5
+  > addwithdate f 6
+  > }
+
+  $ initrepo
+
+log before edit
+  $ hg log
+  changeset:   5:178e35e0ce73
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:06 1970 +
+  summary: f
+  
+  changeset:   4:1ddb6c90f2ee
+  user:test
+  date:Thu Jan 01 00:00:05 1970 +
+  summary: e
+  
+  changeset:   3:532247a8969b
+  user:test
+  date:Thu Jan 01 00:00:04 1970 +
+  summary: d
+  
+  changeset:   2:ff2c9fa2018b
+  user:test
+  date:Thu Jan 01 00:00:03 1970 +
+  summary: c
+  
+  changeset:   1:97d72e5f12c7
+  user:test
+  date:Thu Jan 01 00:00:02 1970 +
+  summary: b
+  
+  changeset:   0:8580ff50825a
+  user:test
+  date:Thu Jan 01 00:00:01 1970 +
+  summary: a
+  
+
+  $ hg histedit 1ddb6c90f2ee --commands - 2>&1 --config 
rewrite.update-timestamp=True < pick 178e35e0ce73 f
+  > fold 1ddb6c90f2ee e
+  > EOF
+
+log after edit
+#observe time from f is updated
+  $ hg log
+  changeset:   4:f7909b1863a2
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:01 1970 +
+  summary: f
+  
+  changeset:   3:532247a8969b
+  user:test
+  date:Thu Jan 01 00:00:04 1970 +
+  summary: d
+  
+  changeset:   2:ff2c9fa2018b
+  user:test
+  date:Thu Jan 01 00:00:03 1970 +
+  summary: c
+  
+  changeset:   1:97d72e5f12c7
+  user:test
+  date:Thu Jan 01 00:00:02 1970 +
+  summary: b
+  
+  changeset:   0:8580ff50825a
+  user:test
+  date:Thu Jan 01 00:00:01 1970 +
+  summary: a
+  
+post-fold manifest
+  $ hg manifest
+  a
+  b
+  c
+  d
+  e
+  f
+
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -481,3 +481,74 @@
   #  f, fold = use commit, but combine it with the one above
   #  r, roll = like fold, but discard this commit's description and date
   #
+
+
+
+Test update-timestamp config option in mess|
+
+  $ cat >> testmocks.py << EOF
+  > # mock out util.makedate() to supply testable values
+  > import os
+  > from mercurial import pycompat, util
+  > from mercurial.utils import dateutil
+  > 
+  > def mockmakedate():
+  > filename = os.path.join(os.environ['TESTTMP'], 'testtime')
+  > try:
+  > with open(filename, 'rb') as timef:
+  > time = float(timef.read()) + 1
+  > except IOError:
+  > time = 0.0
+  > with open(filename, 'wb') as timef:
+  > timef.write(pycompat.bytestr(time))
+  > return (time, 0)
+  > 
+  > dateutil.makedate = mockmakedate
+  > EOF
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > histedit=
+  > testmocks=`pwd`/testmocks.py
+  > EOF
+
+  $ addwithdate ()
+  > {
+  > echo $1 > $1
+  > hg add $1
+  > hg ci -m $1 -d "$2 0"
+  > }
+
+  $ initrepo ()
+  > {
+  > hg init r
+  > cd r
+  > addwithdate a 1
+  > addwithdate b 2
+  > addwithdate c 3
+  > addwithdate d 4
+  > addwithdate e 5
+  > addwithdate f 6
+  > }
+
+  $ initrepo
+
+log before edit
+  $ hg log --limit 1
+  changeset:   5:178e35e0ce73
+  tag: tip
+  user:   

D5554: histedit: added rewrite.update-timestamp to fold and mess

2019-01-10 Thread taapas1128 (Taapas Agrawal)
taapas1128 added a subscriber: pulkit.
taapas1128 added a comment.


  @pulkit please review. I will add a `test-histedit-mess.t` if required.

REPOSITORY
  rHG Mercurial

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

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


D5554: histedit: added rewrite.update-timestamp to fold and mess

2019-01-10 Thread taapas1128 (Taapas Agrawal)
taapas1128 created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-fold.t

CHANGE DETAILS

diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -597,3 +597,131 @@
   o  8f0162e483d0 aa
   
 
+
+-==
+Test update-timestamp config option|
+==
+  $ cat >> testmocks.py << EOF
+  > # mock out util.makedate() to supply testable values
+  > import os
+  > from mercurial import pycompat, util
+  > from mercurial.utils import dateutil
+  > 
+  > def mockmakedate():
+  > filename = os.path.join(os.environ['TESTTMP'], 'testtime')
+  > try:
+  > with open(filename, 'rb') as timef:
+  > time = float(timef.read()) + 1
+  > except IOError:
+  > time = 0.0
+  > with open(filename, 'wb') as timef:
+  > timef.write(pycompat.bytestr(time))
+  > return (time, 0)
+  > 
+  > dateutil.makedate = mockmakedate
+  > EOF
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > histedit=
+  > testmocks=`pwd`/testmocks.py
+  > EOF
+
+  $ addwithdate ()
+  > {
+  > echo $1 > $1
+  > hg add $1
+  > hg ci -m $1 -d "$2 0"
+  > }
+
+  $ initrepo ()
+  > {
+  > hg init r
+  > cd r
+  > addwithdate a 1
+  > addwithdate b 2
+  > addwithdate c 3
+  > addwithdate d 4
+  > addwithdate e 5
+  > addwithdate f 6
+  > }
+
+  $ initrepo
+
+log before edit
+  $ hg log
+  changeset:   5:178e35e0ce73
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:06 1970 +
+  summary: f
+  
+  changeset:   4:1ddb6c90f2ee
+  user:test
+  date:Thu Jan 01 00:00:05 1970 +
+  summary: e
+  
+  changeset:   3:532247a8969b
+  user:test
+  date:Thu Jan 01 00:00:04 1970 +
+  summary: d
+  
+  changeset:   2:ff2c9fa2018b
+  user:test
+  date:Thu Jan 01 00:00:03 1970 +
+  summary: c
+  
+  changeset:   1:97d72e5f12c7
+  user:test
+  date:Thu Jan 01 00:00:02 1970 +
+  summary: b
+  
+  changeset:   0:8580ff50825a
+  user:test
+  date:Thu Jan 01 00:00:01 1970 +
+  summary: a
+  
+
+  $ hg histedit 1ddb6c90f2ee --commands - 2>&1 --config 
rewrite.update-timestamp=True < pick 178e35e0ce73 f
+  > fold 1ddb6c90f2ee e
+  > EOF
+
+log after edit
+#observe time from f is updated
+  $ hg log
+  changeset:   4:f7909b1863a2
+  tag: tip
+  user:test
+  date:Thu Jan 01 00:00:01 1970 +
+  summary: f
+  
+  changeset:   3:532247a8969b
+  user:test
+  date:Thu Jan 01 00:00:04 1970 +
+  summary: d
+  
+  changeset:   2:ff2c9fa2018b
+  user:test
+  date:Thu Jan 01 00:00:03 1970 +
+  summary: c
+  
+  changeset:   1:97d72e5f12c7
+  user:test
+  date:Thu Jan 01 00:00:02 1970 +
+  summary: b
+  
+  changeset:   0:8580ff50825a
+  user:test
+  date:Thu Jan 01 00:00:01 1970 +
+  summary: a
+  
+post-fold manifest
+  $ hg manifest
+  a
+  b
+  c
+  d
+  e
+  f
+
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -210,6 +210,7 @@
 util,
 )
 from mercurial.utils import (
+dateutil,
 stringutil,
 )
 
@@ -519,9 +520,12 @@
 
 editor = self.commiteditor()
 commit = commitfuncfor(repo, rulectx)
-
+if repo.ui.configbool('rewrite','update-timestamp'):
+date = dateutil.makedate()
+else :
+date = rulectx.date()
 commit(text=rulectx.description(), user=rulectx.user(),
-   date=rulectx.date(), extra=rulectx.extra(), editor=editor)
+   date=date, extra=rulectx.extra(), editor=editor)
 
 def commiteditor(self):
 """The editor to be used to edit the commit message."""
@@ -800,6 +804,8 @@
 # date
 if self.firstdate():
 commitopts['date'] = ctx.date()
+elif ui.configbool('rewrite','update-timestamp'):
+commitopts['date'] = dateutil.makedate()
 else:
 commitopts['date'] = max(ctx.date(), oldctx.date())
 extra = ctx.extra().copy()



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


D5540: histedit: fix --continue and --abort when curses is enabled

2019-01-10 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 13136.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5540?vs=13112&id=13136

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-non-commute.t

CHANGE DETAILS

diff --git a/tests/test-histedit-non-commute.t 
b/tests/test-histedit-non-commute.t
--- a/tests/test-histedit-non-commute.t
+++ b/tests/test-histedit-non-commute.t
@@ -161,7 +161,10 @@
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
   Fix up the change (pick 7b4e2f4b7bcd)
   (hg histedit --continue to resume)
-  $ hg histedit --continue 2>&1 | fixbundle
+We forcibly enable curses here so we can verify that continuing works
+with curses enabled.
+  $ hg histedit --continue --config ui.interactive=true \
+  >   --config ui.interface=curses 2>&1 | fixbundle
   abort: unresolved merge conflicts (see 'hg help resolve')
 
 This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1599,7 +1599,10 @@
 for intentional "edit" command, but also for resolving unexpected
 conflicts).
 """
-if ui.interface('histedit') == 'curses':
+# kludge: _chistedit only works for starting an edit, not aborting
+# or continuing, so fall back to regular _texthistedit for those
+# operations.
+if ui.interface('histedit') == 'curses' and  _getgoal(opts) == goalnew:
 return _chistedit(ui, repo, *freeargs, **opts)
 return _texthistedit(ui, repo, *freeargs, **opts)
 



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


D5553: fuzz: stop building Python in the Makefile

2019-01-10 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  $OUT/sanpy is now built by the build.sh in oss-fuzz, which simplifies
  the setup here considerably.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/fuzz/Makefile

CHANGE DETAILS

diff --git a/contrib/fuzz/Makefile b/contrib/fuzz/Makefile
--- a/contrib/fuzz/Makefile
+++ b/contrib/fuzz/Makefile
@@ -75,45 +75,37 @@
  fuzz-xdiffi.o fuzz-xprepare.o fuzz-xutils.o fuzzutil-oss-fuzz.o \
  -lFuzzingEngine -o $$OUT/xdiff_fuzzer
 
-# TODO use the $OUT env var instead of hardcoding /out
-/out/sanpy/bin/python:
-   cd /Python-2.7.15/ ; ASAN_OPTIONS=detect_leaks=0 ./configure 
--without-pymalloc --prefix=$$OUT/sanpy CFLAGS="$(CFLAGS)" LINKCC="$($CXX)" 
LDFLAGS="$(CXXFLAGS)"
-   cd /Python-2.7.15/ ; grep -v HAVE_GETC_UNLOCKED < pyconfig.h > tmp && 
mv tmp pyconfig.h
-   cd /Python-2.7.15/ ; ASAN_OPTIONS=detect_leaks=0 make && make install
-
-sanpy: /out/sanpy/bin/python
-
-manifest.o: sanpy ../../mercurial/cext/manifest.c
+manifest.o: ../../mercurial/cext/manifest.c
$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -I../../mercurial \
  -c -o manifest.o ../../mercurial/cext/manifest.c
 
-charencode.o: sanpy ../../mercurial/cext/charencode.c
+charencode.o: ../../mercurial/cext/charencode.c
$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -I../../mercurial \
  -c -o charencode.o ../../mercurial/cext/charencode.c
 
-parsers.o: sanpy ../../mercurial/cext/parsers.c
+parsers.o: ../../mercurial/cext/parsers.c
$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -I../../mercurial \
  -c -o parsers.o ../../mercurial/cext/parsers.c
 
-dirs.o: sanpy ../../mercurial/cext/dirs.c
+dirs.o: ../../mercurial/cext/dirs.c
$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -I../../mercurial \
  -c -o dirs.o ../../mercurial/cext/dirs.c
 
-pathencode.o: sanpy ../../mercurial/cext/pathencode.c
+pathencode.o: ../../mercurial/cext/pathencode.c
$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -I../../mercurial \
  -c -o pathencode.o ../../mercurial/cext/pathencode.c
 
-revlog.o: sanpy ../../mercurial/cext/revlog.c
+revlog.o: ../../mercurial/cext/revlog.c
$(CC) $(CFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -I../../mercurial \
  -c -o revlog.o ../../mercurial/cext/revlog.c
 
-manifest_fuzzer: sanpy manifest.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
+manifest_fuzzer: manifest.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial manifest.cc \
@@ -124,7 +116,7 @@
 manifest_corpus.zip:
python manifest_corpus.py $$OUT/manifest_fuzzer_seed_corpus.zip
 
-revlog_fuzzer: sanpy revlog.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
+revlog_fuzzer: revlog.cc manifest.o charencode.o parsers.o dirs.o pathencode.o 
revlog.o pyutil.o
$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial revlog.cc \
@@ -135,7 +127,7 @@
 revlog_corpus.zip:
python revlog_corpus.py $$OUT/revlog_fuzzer_seed_corpus.zip
 
-dirstate_fuzzer: sanpy dirstate.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
+dirstate_fuzzer: dirstate.cc manifest.o charencode.o parsers.o dirs.o 
pathencode.o revlog.o pyutil.o
$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial dirstate.cc \
@@ -146,7 +138,7 @@
 dirstate_corpus.zip:
python dirstate_corpus.py $$OUT/dirstate_fuzzer_seed_corpus.zip
 
-fm1readmarkers_fuzzer: sanpy fm1readmarkers.cc manifest.o charencode.o 
parsers.o dirs.o pathencode.o revlog.o pyutil.o
+fm1readmarkers_fuzzer: fm1readmarkers.cc manifest.o charencode.o parsers.o 
dirs.o pathencode.o revlog.o pyutil.o
$(CXX) $(CXXFLAGS) `$$OUT/sanpy/bin/python-config --cflags` \
  -Wno-register -Wno-macro-redefined \
  -I../../mercurial fm1readmarkers.cc \
@@ -165,4 +157,4 @@
 
 oss-fuzz: bdiff_fuzzer mpatch_fuzzer mpatch_corpus.zip xdiff_fuzzer 
manifest_fuzzer manifest_corpus.zip revlog_fuzzer revlog_corpus.zip 
dirstate_fuzzer dirstate_corpus.zip fm1readmarkers_fuzzer 
fm1readmarkers_corpus.zip
 
-.PHONY: all clean oss-fuzz sanpy
+.PHONY: all clean oss-fuzz



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


D5514: test: change test's diff generation to use mdiff for nicer output

2019-01-10 Thread durin42 (Augie Fackler)
durin42 added inline comments.

INLINE COMMENTS

> mdiff.py:554
> +
> +def new_diff(expected, output, ref, err):
> +exp, date1, out, date2, opts = prepare_mdiff(expected, output)

At least add a docstring taht explains this is designed to be a similar API to 
`difflib.unified_diff`?

> run-tests.py:50
>  import collections
> +import datetime
>  import difflib

unused?

> run-tests.py:54
>  import errno
> +import itertools
>  import json

unused?

> run-tests.py:81
> +_diff = mdiff.new_diff
> +except Exception:
> +print("Falling back to unified_diff")

Nit: `except (ImportError, AttributeError):` instead of just catching 
`Exception`.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 1 of 2] amend: turn currentdate into tri-state bool so config option can be negated

2019-01-10 Thread Pulkit Goyal
On Thu, Jan 10, 2019 at 7:43 PM Pulkit Goyal <7895pul...@gmail.com> wrote:

>
>
> On Thu, Jan 10, 2019 at 7:24 PM Yuya Nishihara  wrote:
>
>> # HG changeset patch
>> # User Yuya Nishihara 
>> # Date 1547123557 -32400
>> #  Thu Jan 10 21:32:37 2019 +0900
>> # Node ID d954358f5b9e810fadf9171d9724d99950b3358a
>> # Parent  33b5a23d3b3b5a8fed27e34987bbef9749e84dd7
>> amend: turn currentdate into tri-state bool so config option can be
>> negated
>>
>> Otherwise, rewrite.update-timestap couldn't be overridden by
>> --no-currentdate.
>>
>
> Nice one! Queued the series, many thanks!
>
>>
>> FWIW, which do we like? --no-currentdate vs --no-current-date. If the
>> latter
>> is preferred, maybe we can add "graft --current-date" and deprecate
>> "--currentdate".
>>
>
> I will be happy with both.
>

I mean I will be happy with any of them!
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] amend: turn currentdate into tri-state bool so config option can be negated

2019-01-10 Thread Pulkit Goyal
On Thu, Jan 10, 2019 at 7:24 PM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1547123557 -32400
> #  Thu Jan 10 21:32:37 2019 +0900
> # Node ID d954358f5b9e810fadf9171d9724d99950b3358a
> # Parent  33b5a23d3b3b5a8fed27e34987bbef9749e84dd7
> amend: turn currentdate into tri-state bool so config option can be negated
>
> Otherwise, rewrite.update-timestap couldn't be overridden by
> --no-currentdate.
>

Nice one! Queued the series, many thanks!

>
> FWIW, which do we like? --no-currentdate vs --no-current-date. If the
> latter
> is preferred, maybe we can add "graft --current-date" and deprecate
> "--currentdate".
>

I will be happy with both.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2] graft: abort if --date/user specified with --currentdate/currentuser (BC)

2019-01-10 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1547125041 -32400
#  Thu Jan 10 21:57:21 2019 +0900
# Node ID 25fbe864cf9e28de2c9c52cb9d7aa22c327be3ec
# Parent  d954358f5b9e810fadf9171d9724d99950b3358a
graft: abort if --date/user specified with --currentdate/currentuser (BC)

They are conflicting options. Let's explicitly ban such combination.

Note that this means you need "--no-currentdate --date" to override
--currentdate specified in aliases/defaults.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2393,6 +2393,10 @@ def _dograft(ui, repo, *revs, **opts):
 # list of new nodes created by ongoing graft
 statedata['newnodes'] = []
 
+if opts.get('user') and opts.get('currentuser'):
+raise error.Abort(_('--user and --currentuser are mutually exclusive'))
+if opts.get('date') and opts.get('currentdate'):
+raise error.Abort(_('--date and --currentdate are mutually exclusive'))
 if not opts.get('user') and opts.get('currentuser'):
 opts['user'] = ui.username()
 if not opts.get('date') and opts.get('currentdate'):
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -112,6 +112,16 @@ Specify revisions with -r:
   skipping ancestor revision 1:5d205f8b35b6
   [255]
 
+Conflicting date/user options:
+
+  $ hg up -q 0
+  $ hg graft -U --user foo 2
+  abort: --user and --currentuser are mutually exclusive
+  [255]
+  $ hg graft -D --date '0 0' 2
+  abort: --date and --currentdate are mutually exclusive
+  [255]
+
 Can't graft with dirty wd:
 
   $ hg up -q 0
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] amend: turn currentdate into tri-state bool so config option can be negated

2019-01-10 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1547123557 -32400
#  Thu Jan 10 21:32:37 2019 +0900
# Node ID d954358f5b9e810fadf9171d9724d99950b3358a
# Parent  33b5a23d3b3b5a8fed27e34987bbef9749e84dd7
amend: turn currentdate into tri-state bool so config option can be negated

Otherwise, rewrite.update-timestap couldn't be overridden by --no-currentdate.

FWIW, which do we like? --no-currentdate vs --no-current-date. If the latter
is preferred, maybe we can add "graft --current-date" and deprecate
"--currentdate".

diff --git a/hgext/amend.py b/hgext/amend.py
--- a/hgext/amend.py
+++ b/hgext/amend.py
@@ -36,7 +36,7 @@ command = registrar.command(cmdtable)
  ('e', 'edit', None, _('invoke editor on commit messages')),
  ('i', 'interactive', None, _('use interactive mode')),
  ('n', 'note', '', _('store a note on the amend')),
- ('D', 'currentdate', False,
+ ('D', 'currentdate', None,
   _('record the current date as commit date')),
 ] + cmdutil.walkopts + cmdutil.commitopts + cmdutil.commitopts2,
 _('[OPTION]... [FILE]...'),
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2450,7 +2450,8 @@ def amend(ui, repo, old, extra, pats, op
 date = dateutil.parsedate(opts.get('date'))
 elif opts.get('currentdate'):
 date = dateutil.makedate()
-elif ui.configbool('rewrite', 'update-timestamp'):
+elif (ui.configbool('rewrite', 'update-timestamp')
+  and opts.get('currentdate') is None):
 date = dateutil.makedate()
 datemaydiffer = True
 else:
diff --git a/tests/test-amend.t b/tests/test-amend.t
--- a/tests/test-amend.t
+++ b/tests/test-amend.t
@@ -453,6 +453,14 @@ Unlike rewrite.update-timestamp, -D/--cu
   date:Thu Jan 01 00:00:05 1970 +
   summary: commit 1
 
+rewrite.update-timestamp can be negated by --no-currentdate
+
+  $ hg amend --config rewrite.update-timestamp=True --no-currentdate -u baz
+  $ hg log --limit 1
+  user:baz
+  date:Thu Jan 01 00:00:05 1970 +
+  summary: commit 1
+
 Bad combination of date options:
 
   $ hg amend -D --date '0 0'
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


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

2019-01-10 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1547123364 -32400
#  Thu Jan 10 21:29:24 2019 +0900
# Node ID 33b5a23d3b3b5a8fed27e34987bbef9749e84dd7
# Parent  3dcc96582627ac701b730cf09a3bc967768a5dbe
cext: clang-format new code coming from stable branch

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -995,8 +995,8 @@ static inline int index_baserev(indexObj
if (result < -1) {
PyErr_Format(
PyExc_ValueError,
-   "corrupted revlog, revision base out of range: %d, %d",
-   rev, result);
+   "corrupted revlog, revision base out of range: %d, %d", rev,
+   result);
return -2;
}
return result;
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5495: revset: add "branch" positional arguments to the merge revset

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


  >   I think it would be a good idea to make the "branch" arguments more 
flexible. One option could be to use a stringmatcher to add support for regular 
expressions as you suggest. I can look into that. However there may be some 
other options worth exploring. The one you suggest is very interesting although 
I find the syntax a bit complicated for the common use cases that I want to 
enable which are:
  >   
  >   1. Ignore merges from the same branch, which in a named-branch based 
branching strategy are usually irrelevant
  >   2. Look into merges with a specific branch (e.g. which branches have been 
merged with the default branch)?
  >   
  >   In my experience those two are the ones that are the most common and I 
think we should try to make the easy to use. That is, I think that even if 
mercurial had a filter function like the one you propose I would still want to 
be able to express those 2 common merge properties in a simple way.
  
  Yep, I agree with that.
  
  >   That being said, I really like your idea since I often find myself being 
unable to express what I want with a revset (as powerful as those are) because 
of the lack of a filtering mechanism. Adding a generic filter function would be 
very useful indeed. I'm not sure if the syntax you propose would work as is 
though. It seems that it would need a new "&" operator? In any case I believe 
that it is out of the scope of this particular set of patches. Do you agree?
  
  Yes. Actually I have a PoC-level implementation of generic filtering 
predicate,
  which can be reviewed separately.
  
  > If so I can focus on improving this patch by adding the stringmatcher as 
you suggest (as it seems I'm not the only one who thinks this would be useful). 
Is that ok?
  
  Sounds good to me. To be clear, I want `'withbranch'` instead of
  `'*withbranch'`, because the withbranch option doesn't look like a first-class
  parameter of the `merge()` predicate.

REPOSITORY
  rHG Mercurial

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

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


Re: D5495: revset: add "branch" positional arguments to the merge revset

2019-01-10 Thread Yuya Nishihara
>   I think it would be a good idea to make the "branch" arguments more 
> flexible. One option could be to use a stringmatcher to add support for 
> regular expressions as you suggest. I can look into that. However there may 
> be some other options worth exploring. The one you suggest is very 
> interesting although I find the syntax a bit complicated for the common use 
> cases that I want to enable which are:
>   
>   1. Ignore merges from the same branch, which in a named-branch based 
> branching strategy are usually irrelevant
>   2. Look into merges with a specific branch (e.g. which branches have been 
> merged with the default branch)?
>   
>   In my experience those two are the ones that are the most common and I 
> think we should try to make the easy to use. That is, I think that even if 
> mercurial had a filter function like the one you propose I would still want 
> to be able to express those 2 common merge properties in a simple way.

Yep, I agree with that.

>   That being said, I really like your idea since I often find myself being 
> unable to express what I want with a revset (as powerful as those are) 
> because of the lack of a filtering mechanism. Adding a generic filter 
> function would be very useful indeed. I'm not sure if the syntax you propose 
> would work as is though. It seems that it would need a new "&" operator? In 
> any case I believe that it is out of the scope of this particular set of 
> patches. Do you agree?

Yes. Actually I have a PoC-level implementation of generic filtering predicate,
which can be reviewed separately.

> If so I can focus on improving this patch by adding the stringmatcher as you 
> suggest (as it seems I'm not the only one who thinks this would be useful). 
> Is that ok?

Sounds good to me. To be clear, I want `'withbranch'` instead of
`'*withbranch'`, because the withbranch option doesn't look like a first-class
parameter of the `merge()` predicate.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5490: commit: remove ignore whitespace option on --interactive (issue6042)

2019-01-10 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  > Could you add a test?
  > 
  > (Bonus points if you add a test that shows the wrong behavior and then fix 
it in this change.)
  
  Sure. Will do.

REPOSITORY
  rHG Mercurial

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

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


D5552: tests: add test for warning on histedit with tagged commits

2019-01-10 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is a follow-up patch to https://phab.mercurial-scm.org/D5494.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-histedit-edit.t

CHANGE DETAILS

diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -481,3 +481,21 @@
   #  f, fold = use commit, but combine it with the one above
   #  r, roll = like fold, but discard this commit's description and date
   #
+warn the user on editing tagged commits
+  $ hg init issue4017
+  $ cd issue4017
+  $ echo > a
+  $ hg ci -Am 'add a'
+  adding a
+  $ hg tag a
+  $ hg tags
+  tip1:bd7ee4f3939b
+  a  0:a8a82d372bb3
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo 'histedit =' >> $HGRCPATH
+  $ hg histedit
+  warning: tags associated with the given changeset will be lost after 
histedit. 
+  do you want to continue (yN)?  n
+  abort: histedit cancelled
+  
+  [255]



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


Re: [PATCH] extdiff: add --mode option

2019-01-10 Thread Yuya Nishihara
On Thu, 03 Jan 2019 13:03:49 -0800, Ludovic Chabant wrote:
> # HG changeset patch
> # User Ludovic Chabant 
> # Date 1546539395 28800
> #  Thu Jan 03 10:16:35 2019 -0800
> # Node ID cc964d5d3e3faca1bbbc680732c38cf785754fc2
> # Parent  5a2a6ab7bc37af9294b58edfd4d224706940ff19
> extdiff: add --mode option

Sorry for late review. Almost all devs were inactive while holidays.

First, can you break this into a series of a few patches?

https://www.mercurial-scm.org/wiki/ContributingChanges#Organizing_patches

I expect the first patch will probably reorder or extract the current behavior
to function such that new modes can be added.

> +The -m/--mode option controls how the external program is executed:
> +
> +:d (or nothing):Runs the external program once and passes the
> +names of two directories to compare. Each
> +directory contains snapshots of the files before
> +and after the given revisions. This is the
> +default mode.
> +:f: Runs the external program once for each file,
> +passing the path to the snapshots.
> +:p: Modifies the 'f' mode by prompting the user
> +before running the external program for each
> +file.

I don't think "--mode " is good ui. I don't have nice idea, but maybe
it can be split into two flags (e.g. --per-file and --confirm/--interactive)?

And the config option can specify if the tool support directory diff, for
example. If the tool doesn't support directory diff, and if it's gui, spawn
processes per file by default.

> diff --git a/mercurial/extensions.py b/mercurial/extensions.py
> --- a/mercurial/extensions.py
> +++ b/mercurial/extensions.py
> @@ -45,6 +45,9 @@
>  'inotify',
>  'hgcia'
>  }
> +_aliases = {
> +'email': 'patchbomb'
> +}

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


Re: [PATCH 07 of 10 V3] discovery: add a `iscomplete` method to the `partialdiscovery` object

2019-01-10 Thread Yuya Nishihara
On Fri, 04 Jan 2019 23:45:26 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1545964783 -3600
> #  Fri Dec 28 03:39:43 2018 +0100
> # Node ID 337d8bcf6807c2e0c21771851fe960218c1a9fd2
> # Parent  b9f78a736cf666a008de914ab30ff84c4a9c973e
> # EXP-Topic discovery-refactor
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 337d8bcf6807
> discovery: add a `iscomplete` method to the `partialdiscovery` object

Queued the remainder patches, thanks.

> +def iscomplete(self):
> +"""True is all the necessary data have been gathered"""

s/True is/True if/. Fixed in flight.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5543: histedit: crashing with a more useful error message on empty defaultrev

2019-01-10 Thread rdamazio (Rodrigo Damazio Bovendorp)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfbd168455b26: histedit: crashing with a more useful error 
message on empty defaultrev (authored by rdamazio, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5543?vs=13120&id=13132#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5543?vs=13120&id=13132

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

AFFECTED FILES
  mercurial/destutil.py
  tests/test-histedit-arguments.t

CHANGE DETAILS

diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -112,6 +112,13 @@
   > pick 08d98a8350f3 4 five
   > EOF
 
+Test invalid config default
+---
+
+  $ hg histedit --config "histedit.defaultrev="
+  abort: config option histedit.defaultrev can't be empty
+  [255]
+
 Run on a revision not descendants of the initial parent
 
 
diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -381,6 +381,8 @@
 revs = stack.getstack(repo)
 elif default:
 revs = scmutil.revrange(repo, [default])
+else:
+raise error.Abort(_("config option histedit.defaultrev can't be 
empty"))
 
 if revs:
 # Take the first revision of the revset as the root



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


D5542: histedit: use context manager for locks

2019-01-10 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9365b8cb90e0: histedit: use context manager for locks 
(authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5542?vs=13119&id=13131

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -207,7 +207,6 @@
 exchange,
 extensions,
 hg,
-lock,
 logcmdutil,
 merge as mergemod,
 mergeutil,
@@ -225,7 +224,6 @@
 )
 
 pickle = util.pickle
-release = lock.release
 cmdtable = {}
 command = registrar.command(cmdtable)
 
@@ -1601,12 +1599,10 @@
 
 def _texthistedit(ui, repo, *freeargs, **opts):
 state = histeditstate(repo)
-try:
-state.wlock = repo.wlock()
-state.lock = repo.lock()
+with repo.wlock() as wlock, repo.lock() as lock:
+state.wlock = wlock
+state.lock = lock
 _histedit(ui, repo, state, *freeargs, **opts)
-finally:
-release(state.lock, state.wlock)
 
 goalcontinue = 'continue'
 goalabort = 'abort'



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


D5541: histedit: drop unused constructor arguments (API)

2019-01-10 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa3a24ad10efb: histedit: drop unused constructor arguments 
(API) (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5541?vs=13118&id=13130

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -308,21 +308,17 @@
 return ''.join(['# %s\n' % l if l else '#\n' for l in lines])
 
 class histeditstate(object):
-def __init__(self, repo, parentctxnode=None, actions=None, keep=None,
-topmost=None, replacements=None, lock=None, wlock=None):
+def __init__(self, repo):
 self.repo = repo
-self.actions = actions
-self.keep = keep
-self.topmost = topmost
-self.parentctxnode = parentctxnode
-self.lock = lock
-self.wlock = wlock
+self.actions = None
+self.keep = None
+self.topmost = None
+self.parentctxnode = None
+self.lock = None
+self.wlock = None
 self.backupfile = None
 self.stateobj = statemod.cmdstate(repo, 'histedit-state')
-if replacements is None:
-self.replacements = []
-else:
-self.replacements = replacements
+self.replacements = []
 
 def read(self):
 """Load histedit state from disk and set fields appropriately."""



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


D5543: histedit: crashing with a more useful error message on empty defaultrev

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


  Queued for stable, thanks.
  
  > +else:
  >  +raise error.Abort('config option histedit.defaultrev can\'t be 
empty')
  
  Wrapped the message with `_()`.

REPOSITORY
  rHG Mercurial

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

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


Re: D5543: histedit: crashing with a more useful error message on empty defaultrev

2019-01-10 Thread Yuya Nishihara
Queued for stable, thanks.

> +else:
> +raise error.Abort('config option histedit.defaultrev can\'t be 
> empty')

Wrapped the message with `_()`.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] phabricator: warn if unable to amend, instead of aborting after posting

2019-01-10 Thread Yuya Nishihara
On Wed, 09 Jan 2019 23:28:38 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1546719633 18000
> #  Sat Jan 05 15:20:33 2019 -0500
> # Node ID 0b7c3a31e42b075b5fc1d90c85f10239d87f9e33
> # Parent  98ce494e104dca5200af6ed53d3f4ff6547962a8
> phabricator: warn if unable to amend, instead of aborting after posting

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


Re: [PATCH FOLLOW-UP] discovery: re-adjust a conditional wrongly changed

2019-01-10 Thread Yuya Nishihara
On Thu, 10 Jan 2019 09:54:36 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1547091348 -3600
> #  Thu Jan 10 04:35:48 2019 +0100
> # Node ID 1914c8346174a7c204e5623684cbff5188a3e847
> # Parent  17a1956764728e8c9dd1101573dca12523e482bb
> # EXP-Topic discovery-followup
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 1914c8346174
> discovery: re-adjust a conditional wrongly changed

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


D5551: rust-cpython: using MissingAncestors from Python code

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As precedently done with LazyAncestors on cpython.rs, we test for the
  presence of the 'rustext' module.
  
  For now, on MissingAncestors instances, the 'bases' attribute is a method
  returning a tuple, so we adapt that in the only current caller.
  
  We don't have a hg perf command for MissingAncestors, and it's not very
  clear how to generate relevant `bases` attributes and `revs` argument to
  create one. Nevertheless, our preliminary observations within discovery
  indicate a x5 speedup for the missingancestors methods themselves with the
  Rust version on the pypy and mozilla-central repos.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py
  mercurial/setdiscovery.py

CHANGE DETAILS

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -186,9 +186,15 @@
 """the heads of the known common set"""
 # heads(common) == heads(common.bases) since common represents
 # common.bases and all its ancestors
+bases = self._common.bases
+if callable(bases):
+# This happens for Rust exported object, and we don't know
+# at the moment how to make an equivalent of property for them
+bases = bases()
+
 # The presence of nullrev will confuse heads(). So filter it out.
 return set(self._repo.revs('heads(%ld)',
-   self._common.bases - {nullrev}))
+   (r for r in bases if r != nullrev)))
 
 def findcommonheads(ui, local, remote,
 initialsamplesize=100,
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -875,6 +875,8 @@
 if common is None:
 common = [nullrev]
 
+if rustext is not None:
+return rustext.ancestor.MissingAncestors(self.index, common)
 return ancestor.incrementalmissingancestors(self.parentrevs, common)
 
 def findmissingrevs(self, common=None, heads=None):



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


D5550: rust-cpython: bindings for MissingAncestors

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision.
Herald added subscribers: mercurial-devel, kevincox, durin42.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The exposition is rather straightforward, except for the
  remove_ancestors_from() method, which forces us to an inefficient
  conversion between Python sets and Rust HashSets.
  
  Two alternatives are proposed in comments:
  
  - changing the inner API to "emit" the revision numbers to discard this would 
be a substantial change, and it would be better only in the cases where there 
are more to retain than to discard
  - mutating the Python set directly: this would force us to define an abstract 
`RevisionSet` trait, and implement it both for plain `HashSet` and for a struct 
enclosing a Python set with the GIL marker `Python<'p>`, also a non trivial 
effort.
  
  The main (and seemingly only) caller of this method being
  `mercurial.setdiscovery`, which is currently undergoing serious refactoring,
  it's not clear whether these improvements would be worth the effort right now,
  so we're leaving it as-is.
  
  Also, in `get_bases()` (will also be used by `setdiscovery`), we'd prefer
  to build a Python set directly, but we resort to returning a tuple, waiting
  to hear back from our PR onto rust-cpython about that

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  rust/hg-cpython/src/ancestors.rs
  tests/test-rust-ancestor.py

CHANGE DETAILS

diff --git a/tests/test-rust-ancestor.py b/tests/test-rust-ancestor.py
--- a/tests/test-rust-ancestor.py
+++ b/tests/test-rust-ancestor.py
@@ -11,7 +11,8 @@
 # this would fail already without appropriate ancestor.__package__
 from mercurial.rustext.ancestor import (
 AncestorsIterator,
-LazyAncestors
+LazyAncestors,
+MissingAncestors,
 )
 
 try:
@@ -105,6 +106,22 @@
 # let's check bool for an empty one
 self.assertFalse(LazyAncestors(idx, [0], 0, False))
 
+def testmissingancestors(self):
+idx = self.parseindex()
+missanc = MissingAncestors(idx, [1])
+self.assertTrue(missanc.hasbases())
+self.assertEqual(missanc.missingancestors([3]), [2, 3])
+missanc.addbases({2})
+self.assertEqual(set(missanc.bases()), {1, 2})
+self.assertEqual(missanc.missingancestors([3]), [3])
+
+def testmissingancestorsremove(self):
+idx = self.parseindex()
+missanc = MissingAncestors(idx, [1])
+revs = {0, 1, 2, 3}
+missanc.removeancestorsfrom(revs)
+self.assertEqual(revs, {2, 3})
+
 def testrefcount(self):
 idx = self.parseindex()
 start_count = sys.getrefcount(idx)
diff --git a/rust/hg-cpython/src/ancestors.rs b/rust/hg-cpython/src/ancestors.rs
--- a/rust/hg-cpython/src/ancestors.rs
+++ b/rust/hg-cpython/src/ancestors.rs
@@ -15,22 +15,39 @@
 //!   The only difference is that it is instantiated with a C `parsers.index`
 //!   instance instead of a parents function.
 //!
+//! - [`MissingAncestors`] is the Rust implementation of
+//!   `mercurial.ancestor.incrementalmissingancestors`.
+//!
+//!   API differences:
+//!+ it is instantiated with a C `parsers.index`
+//!  instance instead of a parents function.
+//!+ `MissingAncestors.bases` is a method returning a tuple instead of
+//!  a set-valued attribute. We could return a Python set easily if our
+//!  [PySet PR](https://github.com/dgrunwald/rust-cpython/pull/165)
+//!  is accepted.
+//!
 //! - [`AncestorsIterator`] is the Rust counterpart of the
 //!   `ancestor._lazyancestorsiter` Python generator.
 //!   From Python, instances of this should be mainly obtained by calling
 //!   `iter()` on a [`LazyAncestors`] instance.
 //!
 //! [`LazyAncestors`]: struct.LazyAncestors.html
+//! [`MissingAncestors`]: struct.MissingAncestors.html
 //! [`AncestorsIterator`]: struct.AncestorsIterator.html
 use cindex::Index;
 use cpython::{
-ObjectProtocol, PyClone, PyDict, PyModule, PyObject, PyResult, Python,
+ObjectProtocol, PyClone, PyDict, PyList, PyModule, PyObject,
+PyResult, PyTuple, Python, PythonObject, ToPyObject,
 };
 use exceptions::GraphError;
 use hg::Revision;
-use hg::{AncestorsIterator as CoreIterator, LazyAncestors as CoreLazy};
+use hg::{
+AncestorsIterator as CoreIterator, LazyAncestors as CoreLazy,
+MissingAncestors as CoreMissing,
+};
 use std::cell::RefCell;
 use std::iter::FromIterator;
+use std::collections::HashSet;
 
 /// Utility function to convert a Python iterable into various collections
 ///
@@ -119,7 +136,85 @@
 
 });
 
-/// Create the module, with `__package__` given from parent
+py_class!(pub class MissingAncestors |py| {
+data inner: RefCell>>;
+
+def __new__(_cls, index: PyObject, bases: PyObject) -> 
PyResult {
+let bases_vec: Vec = rev_pyiter_collect(py, &bases)?;
+let inner = CoreMissing::new(Index::new(py, index)?, bases_vec);
+MissingAncestors::create_instance(

D5549: rust-cpython: generalised conversion function

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision.
Herald added subscribers: mercurial-devel, kevincox, durin42.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Because `hg::ancestors::MissingAncestors` has methods taking
  some `HashSet` besides `impl IntoIterator`
  as parameters we'll need the more generic `rev_pyiter_collect()` function
  to also build these

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  rust/hg-cpython/src/ancestors.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/ancestors.rs b/rust/hg-cpython/src/ancestors.rs
--- a/rust/hg-cpython/src/ancestors.rs
+++ b/rust/hg-cpython/src/ancestors.rs
@@ -30,13 +30,18 @@
 use hg::Revision;
 use hg::{AncestorsIterator as CoreIterator, LazyAncestors as CoreLazy};
 use std::cell::RefCell;
+use std::iter::FromIterator;
 
-/// Utility function to convert a Python iterable into a Vec
+/// Utility function to convert a Python iterable into various collections
 ///
-/// We need this to feed to `AncestorIterators` constructors because
-/// a `PyErr` can arise at each step of iteration, whereas our inner objects
+/// We need this in particular to feed to various methods of inner objects
+/// with `impl IntoIterator` arguments, because
+/// a `PyErr` can arise at each step of iteration, whereas these methods
 /// expect iterables over `Revision`, not over some `Result`
-fn reviter_to_revvec(py: Python, revs: PyObject) -> PyResult> {
+fn rev_pyiter_collect(py: Python, revs: &PyObject) -> PyResult
+where
+C: FromIterator,
+{
 revs.iter(py)?
 .map(|r| r.and_then(|o| o.extract::(py)))
 .collect()
@@ -64,7 +69,7 @@
 
 def __new__(_cls, index: PyObject, initrevs: PyObject, stoprev: Revision,
 inclusive: bool) -> PyResult {
-let initvec = reviter_to_revvec(py, initrevs)?;
+let initvec: Vec = rev_pyiter_collect(py, &initrevs)?;
 let ait = CoreIterator::new(
 Index::new(py, index)?,
 initvec,
@@ -103,7 +108,7 @@
 
 def __new__(_cls, index: PyObject, initrevs: PyObject, stoprev: Revision,
 inclusive: bool) -> PyResult {
-let initvec = reviter_to_revvec(py, initrevs)?;
+let initvec: Vec = rev_pyiter_collect(py, &initrevs)?;
 
 let lazy =
 CoreLazy::new(Index::new(py, index)?, initvec, stoprev, inclusive)



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


D5548: rust-cpython: style consistency leftovers

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision.
Herald added subscribers: mercurial-devel, kevincox, durin42.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  In particular, during review of `LazyAncestors` bindings,
  most `match` statements for error conversion
  have been replaced by higher level methods of `Result` and most
  personal insecurity comments have been removed.
  
  This makes it more systematic.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  rust/hg-cpython/src/ancestors.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/ancestors.rs b/rust/hg-cpython/src/ancestors.rs
--- a/rust/hg-cpython/src/ancestors.rs
+++ b/rust/hg-cpython/src/ancestors.rs
@@ -43,7 +43,6 @@
 }
 
 py_class!(pub class AncestorsIterator |py| {
-// TODO RW lock ?
 data inner: RefCell>>;
 
 def __next__(&self) -> PyResult> {
@@ -55,7 +54,8 @@
 }
 
 def __contains__(&self, rev: Revision) -> PyResult {
-self.inner(py).borrow_mut().contains(rev).map_err(|e| 
GraphError::pynew(py, e))
+self.inner(py).borrow_mut().contains(rev)
+.map_err(|e| GraphError::pynew(py, e))
 }
 
 def __iter__(&self) -> PyResult {
@@ -65,14 +65,13 @@
 def __new__(_cls, index: PyObject, initrevs: PyObject, stoprev: Revision,
 inclusive: bool) -> PyResult {
 let initvec = reviter_to_revvec(py, initrevs)?;
-let ait = match CoreIterator::new(Index::new(py, index)?,
-  initvec, stoprev,
-  inclusive) {
-Ok(ait) => ait,
-Err(e) => {
-return Err(GraphError::pynew(py, e));
-}
-};
+let ait = CoreIterator::new(
+Index::new(py, index)?,
+initvec,
+stoprev,
+inclusive,
+)
+.map_err(|e| GraphError::pynew(py, e))?;
 AncestorsIterator::from_inner(py, ait)
 }
 



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


D5546: rust-cpython: rustdoc improvements

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision.
Herald added subscribers: mercurial-devel, kevincox, durin42.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  By default, `cargo doc` builds the documentation for public
  constructs only, so we make public those that can. Since `cindex`
  is not safe, we keep it private.
  
  Unfortunately, the macro syntax of rust-cpython doesn't allow us
  to document the classes directly, so we resort to do that at
  the module level.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  rust/hg-cpython/src/ancestors.rs
  rust/hg-cpython/src/exceptions.rs
  rust/hg-cpython/src/lib.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs
--- a/rust/hg-cpython/src/lib.rs
+++ b/rust/hg-cpython/src/lib.rs
@@ -12,7 +12,8 @@
 //! it behaves as the `cext` package.
 //!
 //! Example:
-//! ```
+//!
+//! ```text
 //! >>> from mercurial.rustext import ancestor
 //! >>> ancestor.__doc__
 //! 'Generic DAG ancestor algorithms - Rust implementation'
@@ -23,9 +24,9 @@
 extern crate hg;
 extern crate libc;
 
-mod ancestors;
+pub mod ancestors;
 mod cindex;
-mod exceptions;
+pub mod exceptions;
 
 py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| {
 m.add(
diff --git a/rust/hg-cpython/src/exceptions.rs 
b/rust/hg-cpython/src/exceptions.rs
--- a/rust/hg-cpython/src/exceptions.rs
+++ b/rust/hg-cpython/src/exceptions.rs
@@ -1,3 +1,15 @@
+// ancestors.rs
+//
+// Copyright 2018 Georges Racinet 
+//
+// This software may be used and distributed according to the terms of the
+// GNU General Public License version 2 or any later version.
+
+//! Bindings for Rust errors
+//!
+//! [`GraphError`] exposes `hg::GraphError` as a subclass of `ValueError`
+//!
+//! [`GraphError`]: struct.GraphError.html
 use cpython::exc::ValueError;
 use cpython::{PyErr, Python};
 use hg;
diff --git a/rust/hg-cpython/src/ancestors.rs b/rust/hg-cpython/src/ancestors.rs
--- a/rust/hg-cpython/src/ancestors.rs
+++ b/rust/hg-cpython/src/ancestors.rs
@@ -5,8 +5,23 @@
 // This software may be used and distributed according to the terms of the
 // GNU General Public License version 2 or any later version.
 
-//! Bindings for the hg::ancestors module provided by the
+//! Bindings for the `hg::ancestors` module provided by the
 //! `hg-core` crate. From Python, this will be seen as `rustext.ancestor`
+//! and can be used as replacement for the the pure `ancestor` Python module.
+//!
+//! # Classes visible from Python:
+//! - [`LazyAncestors`] is the Rust implementation of
+//!   `mercurial.ancestor.lazyancestors`.
+//!   The only difference is that it is instantiated with a C `parsers.index`
+//!   instance instead of a parents function.
+//!
+//! - [`AncestorsIterator`] is the Rust counterpart of the
+//!   `ancestor._lazyancestorsiter` Python generator.
+//!   From Python, instances of this should be mainly obtained by calling
+//!   `iter()` on a [`LazyAncestors`] instance.
+//!
+//! [`LazyAncestors`]: struct.LazyAncestors.html
+//! [`AncestorsIterator`]: struct.AncestorsIterator.html
 use cindex::Index;
 use cpython::{
 ObjectProtocol, PyClone, PyDict, PyModule, PyObject, PyResult, Python,
@@ -19,16 +34,16 @@
 
 /// Utility function to convert a Python iterable into a Vec
 ///
-/// We need this to feed to AncestorIterators constructors because
-/// a PyErr can arise at each step of iteration, whereas our inner objects
-/// expect iterables over Revision, not over some Result
+/// We need this to feed to `AncestorIterators` constructors because
+/// a `PyErr` can arise at each step of iteration, whereas our inner objects
+/// expect iterables over `Revision`, not over some `Result`
 fn reviter_to_revvec(py: Python, revs: PyObject) -> PyResult> {
 revs.iter(py)?
 .map(|r| r.and_then(|o| o.extract::(py)))
 .collect()
 }
 
-py_class!(class AncestorsIterator |py| {
+py_class!(pub class AncestorsIterator |py| {
 // TODO RW lock ?
 data inner: RefCell>>;
 
@@ -70,7 +85,7 @@
 }
 }
 
-py_class!(class LazyAncestors |py| {
+py_class!(pub class LazyAncestors |py| {
 data inner: RefCell>>;
 
 def __contains__(&self, rev: Revision) -> PyResult {
@@ -101,7 +116,7 @@
 
 });
 
-/// Create the module, with __package__ given from parent
+/// Create the module, with `__package__` given from parent
 pub fn init_module(py: Python, package: &str) -> PyResult {
 let dotted_name = &format!("{}.ancestor", package);
 let m = PyModule::new(py, dotted_name)?;



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


D5547: rust-cpython: consistency in use of hg-core constructs

2019-01-10 Thread gracinet (Georges Racinet)
gracinet created this revision.
Herald added subscribers: mercurial-devel, kevincox, durin42.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  While not everybody likes the `CoreLazy` and `CoreIterator`
  aliases, it's better not to mix them with direct references.
  Note: it's quite possible in the future that these would stop
  being exposed at the top of the `hg` crate

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  rust/hg-cpython/src/ancestors.rs

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/ancestors.rs b/rust/hg-cpython/src/ancestors.rs
--- a/rust/hg-cpython/src/ancestors.rs
+++ b/rust/hg-cpython/src/ancestors.rs
@@ -27,7 +27,6 @@
 ObjectProtocol, PyClone, PyDict, PyModule, PyObject, PyResult, Python,
 };
 use exceptions::GraphError;
-use hg;
 use hg::Revision;
 use hg::{AncestorsIterator as CoreIterator, LazyAncestors as CoreLazy};
 use std::cell::RefCell;
@@ -66,9 +65,9 @@
 def __new__(_cls, index: PyObject, initrevs: PyObject, stoprev: Revision,
 inclusive: bool) -> PyResult {
 let initvec = reviter_to_revvec(py, initrevs)?;
-let ait = match hg::AncestorsIterator::new(Index::new(py, index)?,
-   initvec, stoprev,
-   inclusive) {
+let ait = match CoreIterator::new(Index::new(py, index)?,
+  initvec, stoprev,
+  inclusive) {
 Ok(ait) => ait,
 Err(e) => {
 return Err(GraphError::pynew(py, e));



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


Re: [PATCH 01 of 10 V3] discovery: minor fix to some conditionals

2019-01-10 Thread Boris FELD
On 06/01/2019 03:04, Yuya Nishihara wrote:
> On Fri, 04 Jan 2019 23:45:20 +0100, Boris Feld wrote:
>> # HG changeset patch
>> # User Boris Feld 
>> # Date 1546620599 -3600
>> #  Fri Jan 04 17:49:59 2019 +0100
>> # Node ID 562198ca3bb37b9764dfe93d56cbbf70c2bb093d
>> # Parent  5c68b617ba2463eb6f1372a24b139a376c6bf6bd
>> # EXP-Topic discovery-refactor
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
>> 562198ca3bb3
>> discovery: minor fix to some conditionals
>>
>> Since `size` is the upper limit of the sample, we should include it in the
>> check. Otherwize the `more` variable will be zero and the sampling will be
>> useless
>>
>> diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
>> --- a/mercurial/setdiscovery.py
>> +++ b/mercurial/setdiscovery.py
>> @@ -146,7 +146,7 @@ def _takefullsample(repo, headrevs, revs
>>  _updatesample(revs, revsroots, sample, children.__getitem__)
>>  assert sample
>>  sample = _limitsample(sample, size)
>> -if len(sample) < size:
>> +if len(sample) <= size:
>>  more = size - len(sample)
>>  sample.update(random.sample(list(revs - sample), more))
> The original condition looks more correct since there's no reason to pick
> 0 more revision if len(sample) == size.

Indeed, sending a followup. What happened to changeset 5+ in this
series? I see them neither queued nor with change requests.

Cheers,

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


D5514: test: change test's diff generation to use mdiff for nicer output

2019-01-10 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 updated this revision to Diff 13123.
sangeet259 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5514?vs=13051&id=13123

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

AFFECTED FILES
  mercurial/mdiff.py
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -47,9 +47,11 @@
 
 import argparse
 import collections
+import datetime
 import difflib
 import distutils.version as version
 import errno
+import itertools
 import json
 import multiprocessing
 import os
@@ -68,6 +70,18 @@
 import uuid
 import xml.dom.minidom as minidom
 
+_unified_diff = difflib.unified_diff
+if PYTHON3:
+import functools
+_unified_diff = functools.partial(difflib.diff_bytes, difflib.unified_diff)
+
+try:
+from mercurial import mdiff, patch
+_diff = mdiff.new_diff
+except Exception:
+print("Falling back to unified_diff")
+_diff = _unified_diff
+
 try:
 import Queue as queue
 except ImportError:
@@ -598,15 +612,10 @@
 except OSError:
 pass
 
-_unified_diff = difflib.unified_diff
-if PYTHON3:
-import functools
-_unified_diff = functools.partial(difflib.diff_bytes, difflib.unified_diff)
-
 def getdiff(expected, output, ref, err):
 servefail = False
 lines = []
-for line in _unified_diff(expected, output, ref, err):
+for line in _diff(expected, output, ref, err):
 if line.startswith(b'+++') or line.startswith(b'---'):
 line = line.replace(b'\\', b'/')
 if line.endswith(b' \n'):
diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -7,6 +7,8 @@
 
 from __future__ import absolute_import
 
+import datetime
+import itertools
 import re
 import struct
 import zlib
@@ -525,3 +527,33 @@
 
 def replacediffheader(oldlen, newlen):
 return struct.pack(">lll", 0, oldlen, newlen)
+
+def prepare_mdiff(expected, output):
+"""Prepare the inputs for the mdiff.unidiff function"""
+date1 = datetime.datetime.now().strftime("%a %b %d %y %H:%M:%S %Y %z")
+date2 = date1
+# join all the different elements into a single string
+# to regenerate that file
+exp = "".join(expected)
+out = "".join(output)
+opts = diffopts(noprefix=True)
+return exp, date1, out, date2, opts
+
+def process_mdiff(uheaders, hunks):
+"""Process the output of mdiff into a list of lines,
+to be used by getdiff"""
+# the hunklines are in the hunks generator
+# get the hunklines from the (hunkrange,hunklines) tuple
+hunklines = [x[1] for x in hunks]
+# extract and insert the headers at the beginnng of the hunklines list
+headers = [uheaders[0].split("\t")[0]+"\n", 
uheaders[1].split("\t")[0]+"\n"]
+hunklines.insert(0, headers)
+difflines = itertools.chain.from_iterable(hunklines)
+return difflines
+
+def new_diff(expected, output, ref, err):
+exp, date1, out, date2, opts = prepare_mdiff(expected, output)
+uheaders, hunks = unidiff(exp, date1, out, date2,
+ref, err, binary=False, opts=opts)
+difflines = process_mdiff(uheaders, hunks)
+return difflines



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


[PATCH FOLLOW-UP] discovery: re-adjust a conditional wrongly changed

2019-01-10 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1547091348 -3600
#  Thu Jan 10 04:35:48 2019 +0100
# Node ID 1914c8346174a7c204e5623684cbff5188a3e847
# Parent  17a1956764728e8c9dd1101573dca12523e482bb
# EXP-Topic discovery-followup
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
1914c8346174
discovery: re-adjust a conditional wrongly changed

In 71b0db4fa027 we updated this conditional to `<=`. As Yuya Nishihara pointed
out, this was wrong.

diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py
--- a/mercurial/setdiscovery.py
+++ b/mercurial/setdiscovery.py
@@ -150,7 +150,7 @@ def _takefullsample(repo, headrevs, revs
 _updatesample(revs, revsroots, sample, children.__getitem__)
 assert sample
 sample = _limitsample(sample, size)
-if len(sample) <= size:
+if len(sample) < size:
 more = size - len(sample)
 sample.update(random.sample(list(revs - sample), more))
 return sample
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5494: histedit: add user input to warning message on editing tagged commits

2019-01-10 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  In https://phab.mercurial-scm.org/D5494#81855, @pulkit wrote:
  
  > Sorry for bumping on this now, can you add tests for this as follow-up?
  
  
  My bad. Doing that right away!

REPOSITORY
  rHG Mercurial

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

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