mercurial@42511: 7 new changesets (7 on stable)

2019-06-21 Thread Mercurial Commits
7 new changesets (7 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/c1850798f995
changeset:   42505:c1850798f995
branch:  stable
parent:  42480:b6387a65851d
user:Pierre-Yves David 
date:Wed Jun 19 05:37:33 2019 +0200
summary: run-tests: stop matching line for missing feature

https://www.mercurial-scm.org/repo/hg/rev/cd73e51a1f8a
changeset:   42506:cd73e51a1f8a
branch:  stable
user:Pierre-Yves David 
date:Wed Jun 19 05:45:44 2019 +0200
summary: test: remove dead code in the bookrace extension

https://www.mercurial-scm.org/repo/hg/rev/febf5c8215c1
changeset:   42507:febf5c8215c1
branch:  stable
user:Pierre-Yves David 
date:Wed Jun 19 05:46:07 2019 +0200
summary: test: factor out the "wait" logic in bookrace

https://www.mercurial-scm.org/repo/hg/rev/c4d1807b165f
changeset:   42508:c4d1807b165f
branch:  stable
user:Pierre-Yves David 
date:Wed Jun 19 17:26:16 2019 +0200
summary: test: add some assert in the bookrace extension

https://www.mercurial-scm.org/repo/hg/rev/95c2f951e502
changeset:   42509:95c2f951e502
branch:  stable
user:Pierre-Yves David 
date:Wed Jun 19 17:26:19 2019 +0200
summary: bookmarks: actually trigger the race deleting bookmark in the test

https://www.mercurial-scm.org/repo/hg/rev/3472a3f9d785
changeset:   42510:3472a3f9d785
branch:  stable
user:Pierre-Yves David 
date:Fri Jun 21 03:50:06 2019 +0200
summary: localrepo: introduce a `_refreshchangelog` method

https://www.mercurial-scm.org/repo/hg/rev/044045dce23a
changeset:   42511:044045dce23a
branch:  stable
tag: tip
user:Pierre-Yves David 
date:Fri Jun 21 03:50:40 2019 +0200
summary: bookmarks: actual fix for race condition deleting bookmark

-- 
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 6 of 7 STABLE] localrepo: introduce a `_refreshchangelog` method

2019-06-21 Thread Yuya Nishihara
On Fri, 21 Jun 2019 04:04:13 +0200, Pierre-Yves David wrote:
> # HG changeset patch
> # User Pierre-Yves David 
> # Date 1561081806 -7200
> #  Fri Jun 21 03:50:06 2019 +0200
> # Branch stable
> # Node ID ddd62edfa406e3b84483cafcaa93927ca917d0cd
> # Parent  1646be228b7105c3b0148ae1744802502f872fd9
> # EXP-Topic book-del-stable
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> ddd62edfa406
> localrepo: introduce a `_refreshchangelog` method

The series looks good and appears to be ninja queued.

> +def _refreshchangelog(self):
> +"""make sure the in memory changelog match the on-disk one"""
> +if ('changelog' in vars(self) and self.currenttransaction() is None):

r'changelog' for py3.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] cleanup: always `seek(0, io.SEEK_END)` after open in append mode before tell()

2019-06-21 Thread Yuya Nishihara
On Thu, 20 Jun 2019 14:28:58 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler 
> # Date 1561049708 14400
> #  Thu Jun 20 12:55:08 2019 -0400
> # Branch stable
> # Node ID e99fa717419b71a2493fd7211cab5a0de9c86c7c
> # Parent  b6387a65851d4421d5580b1a4db4c55366a94ec8
> cleanup: always `seek(0, io.SEEK_END)` after open in append mode before tell()
> 
> Consider the program:
> 
> #include 
> 
> int main() {
>   FILE *f = fopen("narf", "w");
>   fprintf(f, "narf\n");
>   fclose(f);
> 
>   f = fopen("narf", "a");
>   printf("%ld\n", ftell(f));
>   fprintf(f, "troz\n");
>   printf("%ld\n", ftell(f));
> 
>   return 0;
> }
> 
> on macOS, FreeBSD, and Linux with glibc, this program prints
> 
> 5
> 10
> 
> but on musl libc (Alpine Linux and probably others) this prints
> 
> 0
> 10
> 
> By my reading of
> https://pubs.opengroup.org/onlinepubs/009695399/functions/fopen.html
> this is technically correct, specifically:
> 
> > Opening a file with append mode (a as the first character in the
> > mode argument) shall cause all subsequent writes to the file to be
> > forced to the then current end-of-file, regardless of intervening
> > calls to fseek().
> 
> in other words, the file position doesn't really matter in append-mode
> files, and we can't depend on it being at all meaningful unless we
> perform a seek() before tell() after open(..., 'a'). Experimentally
> after a .write() we can do a .tell() and it'll always be reasonable,
> but I'm unclear from reading the specification if that's a smart thing
> to rely on.
> 
> I audited the callsites matching the regular expression
> `(open|vfs)\([^,]+, ['"]a` manually. It's possible I missed something
> if I overlooked some other idiom for opening files.
> 
> This is a simple fix for the stable branch. We'll do a more
> comprehensive fix on default.
> 
> diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
> --- a/mercurial/branchmap.py
> +++ b/mercurial/branchmap.py
> @@ -7,6 +7,7 @@
>  
>  from __future__ import absolute_import
>  
> +import io
>  import struct
>  
>  from .node import (
> @@ -613,6 +614,7 @@ class revbranchcache(object):
>  wlock = repo.wlock(wait=False)
>  if self._rbcnamescount != 0:
>  f = repo.cachevfs.open(_rbcnames, 'ab')
> +f.seek(0, io.SEEK_END)

Maybe we can do that in posix.posixfile()? IIRC, we had the same issue on
Windows.

I understand that the POSIX doesn't guarantee ftell() result of appending
files, but Python 3, which reimplements the whole I/O stack, appears to handle
such cases. So maybe we can expect that f.tell() should just work in future
Python.

https://github.com/python/cpython/blob/v3.7.3/Modules/_io/fileio.c#L474
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6565: drawdag: don't crash when writing copy info to changesets

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

REVISION SUMMARY
  When writing copies to the changeset, localrepo.commitctx() will call
  ctx.p1copies() and ctx.p2copies(). These crashed on simplecommitctx
  because they ended up trying to access the manifest. drawdag doesn't
  support copies at all, so we can simply override the methods to return
  empty dicts.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/drawdag.py

CHANGE DETAILS

diff --git a/tests/drawdag.py b/tests/drawdag.py
--- a/tests/drawdag.py
+++ b/tests/drawdag.py
@@ -300,6 +300,12 @@
 def commit(self):
 return self._repo.commitctx(self)
 
+def p1copies(self):
+return {}
+
+def p2copies(self):
+return {}
+
 def _walkgraph(edges):
 """yield node, parents in topologically order"""
 visible = set(edges.keys())



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


D6490: commit: add --force flag to close branch from a non-head changeset

2019-06-21 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  In D6490#95686 , @khanchi97 wrote:
  
  > In D6490#95355 , @markand wrote:
  >
  >> In D6490#95328 , @mharbison72 
wrote:
  >>
  >>> In D6490#95305 , @pulkit 
wrote:
  >>>
   I think adding a `--force` flag to `hg commit` is not a nice option. 
force can mean a lot of things and here except in closing the non-head 
changeset, it is no-op. 
   For example, I am in middle of a rebase, tried to commit, it says rebase 
in progress. I see there is a --force flag, I try to use that to force the 
commit.
   We can do one of the following:
  
   1. maybe a more specific flag name like `--allow-close-branch` or 
something like that
   2. a config option instead of a flag name
  >>>
  >>> Fair point.  Specific is better.
  >>> I'd suggest `--force-close-branch` as a standalone flag (i.e. you don't 
need to also use `--close-branch`; it wasn't clear to me if that's what you 
meant).  `--allow-close-branch` and `--close-branch` don't seem different 
enough to remember the difference.
  >>
  >> Just my $0.02.
  >> I think that `hg commit` already has many options that do not even belong 
to committing (such as -A, --close-branch). Let's not add an option that is not 
related to commit. To my opinion closing a branch should be done with `hg 
branch` not commit (unfortunately this was never the case). Anyway if you 
really want to do it with commit, I would suggest that `--close-branch` takes 
an optional argument rather than adding a new option. This makes UX a bit more 
convenient
  >> e.g.
  >>
  >>   hg commit --close-branch --force-close-branch (not that)
  >>   hg commit --close-branch forced (or force or something like that)
  >
  > I think it's a little hard to make user understand (by providing a hint 
like "use `force` arg with `--close-branch`") that you need to provide an 
argument as compared to just providing a standalone flag `--force-close-branch` 
as @mharbison72 suggested. I do agree with you that it would make +1 in the no. 
of flags which don't make sense with `hg commit`. What do you say?
  
  What if you mark it `(ADVANCED)` so that it doesn't show in the help without 
a `-v`?  Then the hint informs the user when it might be needed, otherwise they 
don't need to see it all the time.

REPOSITORY
  rHG Mercurial

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

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

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


D6552: statecheck: added support for cmdutil.afterresolvedstates

2019-06-21 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 15629.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6552?vs=15615=15629

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

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

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  hgext/shelve.py
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -98,8 +98,8 @@
 """
 
 def __init__(self, opname, fname, clearable=False, allowcommit=False,
- reportonly=False, cmdmsg="", cmdhint="", statushint="",
- stopflag=False):
+ reportonly=False, continueflag=False, stopflag=False ,
+ cmdmsg="", cmdhint="", statushint=""):
 """opname is the name the command or operation
 fname is the file name in which data should be stored in .hg directory.
 It is None for merge command.
@@ -111,6 +111,10 @@
 reportonly flag is used for operations like bisect where we just
 need to detect the operation using 'hg status --verbose'
 cmdmsg is used to pass a different status message in case standard
+continueflag is a boolean determines whether or not a command supports
+`--continue` option or not.
+stopflag is a boolean that determines whether or not a command supports
+--stop flag
 message of the format "abort: cmdname in progress" is not desired.
 cmdhint is used to pass a different hint message in case standard
 message of the format "To continue: hg cmdname --continue
@@ -118,8 +122,6 @@
 status hint is used to pass a different status message in case standard
 message of the format ('To continue:hg cmdname --continue'
 'To abort:   hg cmdname --abort') is not desired
-stopflag is a boolean that determines whether or not a command supports
---stop flag
 reportonly flag is used for operations like bisect where we just
 need to detect the operation using 'hg status --verbose'
 """
@@ -132,6 +134,7 @@
 self._cmdmsg = cmdmsg
 self._stopflag = stopflag
 self._reportonly = reportonly
+self._continueflag = continueflag
 
 def statusmsg(self):
 """returns the hint message corresponding to the command for
@@ -162,6 +165,10 @@
 return _('%s in progress') % (self._opname)
 return self._cmdmsg
 
+def continuemsg(self):
+""" returns appropriate continue message corresponding to command"""
+return _('hg %s --continue') % (self._opname)
+
 def isunfinished(self, repo):
 """determines whether a multi-step operation is in progress
 or not
@@ -185,7 +192,8 @@
 
 addunfinished(
 'graft', fname='graftstate', clearable=True, stopflag=True,
-cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop"),
+continueflag=True,
+cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop")
 )
 addunfinished(
 'update', fname='updatestate', clearable=True,
@@ -253,11 +261,6 @@
 if state.isunfinished(repo):
 return (state._opname, state.statusmsg())
 
-afterresolvedstates = [
-('graftstate',
- _('hg graft --continue')),
-]
-
 def howtocontinue(repo):
 '''Check for an unfinished operation and return the command to finish
 it.
@@ -269,9 +272,11 @@
 a boolean.
 '''
 contmsg = _("continue: %s")
-for f, msg in afterresolvedstates:
-if repo.vfs.exists(f):
-return contmsg % msg, True
+for state in _unfinishedstates:
+if not state._continueflag:
+continue
+if state.isunfinished(repo):
+return contmsg % state.continuemsg(), True
 if repo[None].dirty(missing=True, merge=False, branch=False):
 return contmsg % _("hg commit"), False
 return None, None
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -1139,8 +1139,7 @@
 
 def extsetup(ui):
 statemod.addunfinished(
-'unshelve', fname=shelvedstate._filename,
+'unshelve', fname=shelvedstate._filename, continueflag=True,
 cmdmsg=_('unshelve already in progress')
 )
-statemod.afterresolvedstates.append(
-[shelvedstate._filename, _('hg unshelve --continue')])
+
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1950,6 +1950,5 @@
 entry[1].append(('t', 'tool', '',
  _("specify merge tool for rebase")))
 cmdutil.summaryhooks.add('rebase', summaryhook)
-statemod.addunfinished('rebase', fname='rebasestate', stopflag=True)
-statemod.afterresolvedstates.append(
-['rebasestate', _('hg rebase --continue')])
+statemod.addunfinished('rebase', fname='rebasestate', stopflag=True,
+   

D6490: commit: add --force flag to close branch from a non-head changeset

2019-06-21 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In D6490#95383 , @martinvonz 
wrote:
  
  > Could you also update relnotes/next (documenting either the new flag or 
config option, whatever this patch ends up doing)?
  
  Sure

REPOSITORY
  rHG Mercurial

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

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

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


D6490: commit: add --force flag to close branch from a non-head changeset

2019-06-21 Thread khanchi97 (Sushil khanchi)
khanchi97 added a comment.


  In D6490#95355 , @markand wrote:
  
  > In D6490#95328 , @mharbison72 
wrote:
  >
  >> In D6490#95305 , @pulkit wrote:
  >>
  >>> I think adding a `--force` flag to `hg commit` is not a nice option. 
force can mean a lot of things and here except in closing the non-head 
changeset, it is no-op. 
  >>> For example, I am in middle of a rebase, tried to commit, it says rebase 
in progress. I see there is a --force flag, I try to use that to force the 
commit.
  >>> We can do one of the following:
  >>>
  >>> 1. maybe a more specific flag name like `--allow-close-branch` or 
something like that
  >>> 2. a config option instead of a flag name
  >>
  >> Fair point.  Specific is better.
  >> I'd suggest `--force-close-branch` as a standalone flag (i.e. you don't 
need to also use `--close-branch`; it wasn't clear to me if that's what you 
meant).  `--allow-close-branch` and `--close-branch` don't seem different 
enough to remember the difference.
  >
  > Just my $0.02.
  > I think that `hg commit` already has many options that do not even belong 
to committing (such as -A, --close-branch). Let's not add an option that is not 
related to commit. To my opinion closing a branch should be done with `hg 
branch` not commit (unfortunately this was never the case). Anyway if you 
really want to do it with commit, I would suggest that `--close-branch` takes 
an optional argument rather than adding a new option. This makes UX a bit more 
convenient
  > e.g.
  >
  >   hg commit --close-branch --force-close-branch (not that)
  >   hg commit --close-branch forced (or force or something like that)
  
  I think it's a little hard to make user understand (by providing a hint like 
"use `force` arg with `--close-branch`") that you need to provide an argument 
as compared to just providing a standalone flag `--force-close-branch` as 
@mharbison72 suggested. I do agree with you that it would make +1 in the no. of 
flags which don't make sense with `hg commit`. What do you say?

REPOSITORY
  rHG Mercurial

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

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

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


Re: Moving shelve extension to core.

2019-06-21 Thread Navaneeth Suresh
Hi everyone,

I've sent a patch for this. If anyone is interested, please have a look at
https://phab.mercurial-scm.org/D6553.

Thanks and regards,
Navaneeth


On Wed, 19 Jun, 2019, 8:24 PM Pulkit Goyal, <7895pul...@gmail.com> wrote:

> To add, I was also thinking to drop support for old style shelves while
> moving to core.
>
> On Wed, Jun 19, 2019 at 5:33 PM Pulkit Goyal <7895pul...@gmail.com> wrote:
>
>> Hey everyone,
>>
>> I hope you are doing well.
>>
>> Shelve is a very basic and useful functionality in hg. I was thinking
>> that it should be in core and should no longer be an extension. I was
>> unable to find reasons why shelve is still and extension.
>> With the use of new internal/archived phase, shelve is more robust. I
>> tried to find reasons about why it's not a core command and was unable to
>> find any.
>>
>> Navaneeth who is one of our summer of code student working on storing
>> unresolved merge state, doing very good work there was interested in doing
>> more things and helping the community while he waits for review on his
>> existing work. I shared the idea of moving shelve to core and he liked the
>> idea.
>>
>> Let us know what you think. If you have any concerns about shelve moving
>> to core, they are welcomed.
>>
>> Thanks and regards
>> Pulkit
>>
>>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 7 of 7 STABLE] bookmarks: actual fix for race condition deleting bookmark

2019-06-21 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1561081840 -7200
#  Fri Jun 21 03:50:40 2019 +0200
# Branch stable
# Node ID 8611e1183db406463655af0b196cba6fcd2cf8a9
# Parent  ddd62edfa406e3b84483cafcaa93927ca917d0cd
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
8611e1183db4
bookmarks: actual fix for race condition deleting bookmark

This is a simple but efficient fix to prevent the issue tested in
`test-bookmarks-corner-case.t`. It might be worth pursuing a more generic
approach where filecache learn to depend on each other, but that would not be
suitable for stable.

The issue is complicated enough that I documented the race and its current
solution as inline comment. See this comment for details on the fix.

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1222,6 +1222,55 @@ class localrepository(object):
 @mixedrepostorecache(('bookmarks', 'plain'), ('bookmarks.current', 
'plain'),
  ('00changelog.i', ''))
 def _bookmarks(self):
+# Since the multiple files involved in the transaction cannot be
+# written atomically (with current repository format), there is a race
+# condition here.
+#
+# 1) changelog content A is read
+# 2) outside transaction update changelog to content B
+# 3) outside transaction update bookmark file referring to content B
+# 4) bookmarks file content is read and filtered against changelog-A
+#
+# When this happens, bookmarks against nodes missing from A are 
dropped.
+#
+# Having this happening during read is not great, but it become worse
+# when this happen during write because the bookmarks to the "unknown"
+# nodes will be dropped for good. However, writes happen within locks.
+# This locking makes it possible to have a race free consistent read.
+# For this purpose data read from disc before locking  are
+# "invalidated" right after the locks are taken. This invalidations are
+# "light", the `filecache` mechanism keep the data in memory and will
+# reuse them if the underlying files did not changed. Not parsing the
+# same data multiple times helps performances.
+#
+# Unfortunately in the case describe above, the files tracked by the
+# bookmarks file cache might not have changed, but the in-memory
+# content is still "wrong" because we used an older changelog content
+# to process the on-disk data. So after locking, the changelog would be
+# refreshed but `_bookmarks` would be preserved.
+# Adding `00changelog.i` to the list of tracked file is not
+# enough, because at the time we build the content for `_bookmarks` in
+# (4), the changelog file has already diverged from the content used
+# for loading `changelog` in (1)
+#
+# To prevent the issue, we force the changelog to be explicitly
+# reloaded while computing `_bookmarks`. The data race can still happen
+# without the lock (with a narrower window), but it would no longer go
+# undetected during the lock time refresh.
+#
+# The new schedule is as follow
+#
+# 1) filecache logic detect that `_bookmarks` needs to be computed
+# 2) cachestat for `bookmarks` and `changelog` are captured (for book)
+# 3) We force `changelog` filecache to be tested
+# 4) cachestat for `changelog` are captured (for changelog)
+# 5) `_bookmarks` is computed and cached
+#
+# The step in (3) ensure we have a changelog at least as recent as the
+# cache stat computed in (1). As a result at locking time:
+#  * if the changelog did not changed since (1) -> we can reuse the 
data
+#  * otherwise -> the bookmarks get refreshed.
+self._refreshchangelog()
 return bookmarks.bmstore(self)
 
 def _refreshchangelog(self):
diff --git a/tests/test-bookmarks-corner-case.t 
b/tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t
+++ b/tests/test-bookmarks-corner-case.t
@@ -200,6 +200,7 @@ Check raced push output.
   $ cat push-output.txt
   pushing to ssh://user@dummy/bookrace-server
   searching for changes
+  remote has heads on branch 'default' that are not known locally: f26c3b5167d1
   remote: setting raced push up
   remote: adding changesets
   remote: adding manifests
@@ -219,7 +220,7 @@ Check result of the push.
   |  summary: A1
   |
   | o  changeset:   3:f26c3b5167d1
-  | |  bookmark:book-B (false !)
+  | |  bookmark:book-B
   | |  user:test
   | |  date:Thu Jan 01 00:00:00 1970 +
   | |  summary: B1
@@ -242,4 +243,4 @@ Check result of the push.
   
   $ hg -R 

[PATCH 2 of 7 STABLE] test: remove dead code in the bookrace extension

2019-06-21 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1560915944 -7200
#  Wed Jun 19 05:45:44 2019 +0200
# Branch stable
# Node ID c3ee35c586f85011ed7c8afad55a2e7d3ec7027b
# Parent  3d90d0a9501c59c57e3d9bb4f545c10cf1a440f5
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
c3ee35c586f8
test: remove dead code in the bookrace extension

This code is the remain of a previous version of the code. It is never ran, so
we can remove it.

diff --git a/tests/test-bookmarks-corner-case.t 
b/tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t
+++ b/tests/test-bookmarks-corner-case.t
@@ -132,8 +132,6 @@ We build a server side extension for thi
   > raise error.Abort("race scenario timed out")
   > time.sleep(0.1)
   > return orig(self, repo)
-  > 
-  > repo.__class__ = racedrepo
   > def uisetup(ui):
   > extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)
   > def e():
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 6 of 7 STABLE] localrepo: introduce a `_refreshchangelog` method

2019-06-21 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1561081806 -7200
#  Fri Jun 21 03:50:06 2019 +0200
# Branch stable
# Node ID ddd62edfa406e3b84483cafcaa93927ca917d0cd
# Parent  1646be228b7105c3b0148ae1744802502f872fd9
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
ddd62edfa406
localrepo: introduce a `_refreshchangelog` method

See next changeset for usage and documentation for details.

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -365,6 +365,11 @@ class bundlerepository(object):
 self.manstart = self._cgunpacker.tell()
 return c
 
+def _refreshchangelog(self):
+# changelog for bundle repo are not filecache, this method is not
+# applicable.
+pass
+
 @localrepo.unfilteredpropertycache
 def manifestlog(self):
 self._cgunpacker.seek(self.manstart)
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1224,6 +1224,11 @@ class localrepository(object):
 def _bookmarks(self):
 return bookmarks.bmstore(self)
 
+def _refreshchangelog(self):
+"""make sure the in memory changelog match the on-disk one"""
+if ('changelog' in vars(self) and self.currenttransaction() is None):
+del self.changelog
+
 @property
 def _activebookmark(self):
 return self._bookmarks.active
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 7 STABLE] run-tests: stop matching line for missing feature

2019-06-21 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1560915453 -7200
#  Wed Jun 19 05:37:33 2019 +0200
# Branch stable
# Node ID 3d90d0a9501c59c57e3d9bb4f545c10cf1a440f5
# Parent  d532292eff22b095c994ffedcd4bf98f84f873aa
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
3d90d0a9501c
run-tests: stop matching line for missing feature

Before this change, the following unified test input would silently pass

  $ echo foo
  foo (false !)

After this change, the "foo" output is properly detected as unexpected.

The output of an handful of test had to be updated from broken conditional (that
ended up working by chance).

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1748,7 +1748,8 @@ class TTest(Test):
 
 el = m.group(1) + b"\n"
 if not self._iftest(conditions):
-retry = "retry"# Not required by listed features
+# listed feature missing, should not match
+return "retry", False
 
 if el.endswith(b" (esc)\n"):
 if PYTHON3:
diff --git a/tests/test-copies.t b/tests/test-copies.t
--- a/tests/test-copies.t
+++ b/tests/test-copies.t
@@ -498,6 +498,7 @@ Try merging the other direction too
   $ hg debugpathcopies 0 4
   x -> z (filelog !)
   y -> z (compatibility !)
+  y -> z (changeset !)
   $ hg debugpathcopies 1 5
   $ hg debugpathcopies 2 5
   $ hg debugpathcopies 0 5
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -84,8 +84,8 @@ Test basic extension support
   uipopulate called (1 times)
   uipopulate called (1 times) (chg !)
   uipopulate called (1 times) (chg !)
-  uipopulate called (1 times) (chg !)
-  reposetup called for a (chg !)
+  uipopulate called (1 times)
+  reposetup called for a
   ui == repo.ui
   Foo
   $ hg foo --debug
@@ -96,8 +96,8 @@ Test basic extension support
   uipopulate called (1 times)
   uipopulate called (1 times) (chg !)
   uipopulate called (1 times) (chg !)
-  uipopulate called (1 times) (chg !)
-  reposetup called for a (chg !)
+  uipopulate called (1 times)
+  reposetup called for a
   ui == repo.ui
   Foo
 
@@ -107,7 +107,7 @@ Test basic extension support
   uisetup called [status] (no-chg !)
   uipopulate called (1 times)
   uipopulate called (1 times) (chg !)
-  uipopulate called (1 times) (chg !)
+  uipopulate called (1 times)
   reposetup called for a
   ui == repo.ui
   uipopulate called (1 times)
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
@@ -61,8 +61,10 @@ Cloning a specific file when stream clon
 Making sure we have the correct set of requirements
 
   $ cat .hg/requires
-  dotencode (tree flat-fncache !)
-  fncache (tree flat-fncache !)
+  dotencode (tree !)
+  dotencode (flat-fncache !)
+  fncache (tree !)
+  fncache (flat-fncache !)
   generaldelta
   narrowhg-experimental
   revlogv1
@@ -75,8 +77,9 @@ Making sure store has the required files
   $ ls .hg/store/
   00changelog.i
   00manifest.i
-  data (tree flat-fncache !)
-  fncache (tree flat-fncache !)
+  data
+  fncache (tree !)
+  fncache (flat-fncache !)
   meta (tree !)
   narrowspec
   undo
diff --git a/tests/test-narrow-widen-no-ellipsis.t 
b/tests/test-narrow-widen-no-ellipsis.t
--- a/tests/test-narrow-widen-no-ellipsis.t
+++ b/tests/test-narrow-widen-no-ellipsis.t
@@ -124,7 +124,7 @@ added upstream revisions.
   adding manifests
   adding widest/ revisions (tree !)
   adding file changes
-  adding widest/f revisions (tree !)
+  adding widest/f revisions
   added 0 changesets with 1 changes to 1 files
   bundle2-input-part: total payload size * (glob)
   bundle2-input-bundle: 0 parts total
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
@@ -1936,3 +1936,70 @@ Test automatic pattern replacement
   running 1 tests using 1 parallel processes 
   .
   # Ran 1 tests, 0 skipped, 0 failed.
+
+Test conditional output matching
+
+
+  $ cat << EOF >> test-conditional-matching.t
+  > #testcases foo bar
+  >   $ echo richtig
+  >   richtig (true !)
+  >   $ echo falsch
+  >   falsch (false !)
+  > #if foo
+  >   $ echo arthur
+  >   arthur (bar !)
+  > #endif
+  >   $ echo celeste
+  >   celeste (foo !)
+  >   $ echo zephir
+  >   zephir (bar !)
+  > EOF
+
+  $ rt test-conditional-matching.t
+  running 2 tests using 1 parallel processes 
+  
+  --- $TESTTMP/anothertests/cases/test-conditional-matching.t
+  +++ $TESTTMP/anothertests/cases/test-conditional-matching.t#bar.err
+  @@ -3,11 +3,13 @@
+ richtig (true !)
+ $ echo falsch
+ falsch (false !)
+  +  falsch
+   #if foo
+ $ echo arthur
+ arthur \(bar !\) (re)
+   #endif
+   

[PATCH 4 of 7 STABLE] test: add some assert in the bookrace extension

2019-06-21 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1560957976 -7200
#  Wed Jun 19 17:26:16 2019 +0200
# Branch stable
# Node ID 26ed41f211a818da9df24922089054c57e60a7cf
# Parent  62616ebca61fba1039e50832078c24d13918e545
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
26ed41f211a8
test: add some assert in the bookrace extension

This cannot hurt to have a bit more security in the test extension.

diff --git a/tests/test-bookmarks-corner-case.t 
b/tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t
+++ b/tests/test-bookmarks-corner-case.t
@@ -121,8 +121,10 @@ We build a server side extension for thi
   > import atexit
   > from mercurial import error, extensions, bookmarks
   > 
-  > def wait():
+  > def wait(repo):
   > if not os.path.exists('push-A-started'):
+  > assert repo._currentlock(repo._lockref) is None
+  > assert repo._currentlock(repo._wlockref) is None
   > print('setting raced push up')
   > with open('push-A-started', 'w'):
   > pass
@@ -134,7 +136,7 @@ We build a server side extension for thi
   > time.sleep(0.1)
   > 
   > def wrapinit(orig, self, repo):
-  > wait()
+  > wait(repo)
   > return orig(self, repo)
   > def uisetup(ui):
   > extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 7 STABLE] bookmarks: actually trigger the race deleting bookmark in the test

2019-06-21 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1560957979 -7200
#  Wed Jun 19 17:26:19 2019 +0200
# Branch stable
# Node ID 1646be228b7105c3b0148ae1744802502f872fd9
# Parent  26ed41f211a818da9df24922089054c57e60a7cf
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
1646be228b71
bookmarks: actually trigger the race deleting bookmark in the test

The previous committed version of the test did not triggered the race, but this
was hidden by a strange behavior from the test runner.

So we are moving the test to a slightly more complex that actually trigger the
issue.

diff --git a/tests/test-bookmarks-corner-case.t 
b/tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t
+++ b/tests/test-bookmarks-corner-case.t
@@ -135,11 +135,14 @@ We build a server side extension for thi
   > raise error.Abort("race scenario timed out")
   > time.sleep(0.1)
   > 
-  > def wrapinit(orig, self, repo):
-  > wait(repo)
-  > return orig(self, repo)
-  > def uisetup(ui):
-  > extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)
+  > def reposetup(ui, repo):
+  > class racedrepo(repo.__class__):
+  > @property
+  > def _bookmarks(self):
+  > wait(self)
+  > return super(racedrepo, self)._bookmarks
+  > repo.__class__ = racedrepo
+  > 
   > def e():
   > with open('push-A-done', 'w'):
   > pass
@@ -216,7 +219,7 @@ Check result of the push.
   |  summary: A1
   |
   | o  changeset:   3:f26c3b5167d1
-  | |  bookmark:book-B
+  | |  bookmark:book-B (false !)
   | |  user:test
   | |  date:Thu Jan 01 00:00:00 1970 +
   | |  summary: B1
@@ -239,4 +242,4 @@ Check result of the push.
   
   $ hg -R bookrace-server book
  book-A4:9ce3b28c16de
- book-B3:f26c3b5167d1
+ book-B3:f26c3b5167d1 (false !)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 7 STABLE] test: factor out the "wait" logic in bookrace

2019-06-21 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1560915967 -7200
#  Wed Jun 19 05:46:07 2019 +0200
# Branch stable
# Node ID 62616ebca61fba1039e50832078c24d13918e545
# Parent  c3ee35c586f85011ed7c8afad55a2e7d3ec7027b
# EXP-Topic book-del-stable
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
62616ebca61f
test: factor out the "wait" logic in bookrace

The test is currently not testing the race it is supposed to test. The
synchronisation is still valid, but needs to run at a different point.

We start with extracting the synchronisation logic for clarity.

diff --git a/tests/test-bookmarks-corner-case.t 
b/tests/test-bookmarks-corner-case.t
--- a/tests/test-bookmarks-corner-case.t
+++ b/tests/test-bookmarks-corner-case.t
@@ -120,7 +120,8 @@ We build a server side extension for thi
   > import time
   > import atexit
   > from mercurial import error, extensions, bookmarks
-  > def wrapinit(orig, self, repo):
+  > 
+  > def wait():
   > if not os.path.exists('push-A-started'):
   > print('setting raced push up')
   > with open('push-A-started', 'w'):
@@ -131,6 +132,9 @@ We build a server side extension for thi
   > if clock <= 0:
   > raise error.Abort("race scenario timed out")
   > time.sleep(0.1)
+  > 
+  > def wrapinit(orig, self, repo):
+  > wait()
   > return orig(self, repo)
   > def uisetup(ui):
   > extensions.wrapfunction(bookmarks.bmstore, '__init__', wrapinit)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel