D6557: relnotes: added description about statemod._statecheck

2019-06-27 Thread taapas1128 (Taapas Agrawal)
taapas1128 added inline comments.

INLINE COMMENTS

> martinvonz wrote in next:65-66
> I'll drop the last sentence in flight since D6583 
>  has landed.

thanks!

REPOSITORY
  rHG Mercurial

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

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

To: taapas1128, #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


D6557: relnotes: added description about statemod._statecheck

2019-06-27 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHGdf5f674050b7: relnotes: added description about 
statemod._statecheck (authored by taapas1128).
This revision was automatically updated to reflect the committed changes.

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6557?vs=15690=15691#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6557?vs=15690=15691

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

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

AFFECTED FILES
  relnotes/next

CHANGE DETAILS

diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -57,3 +57,14 @@
 
  * `util.dirs()` and `util.finddirs()` now include an entry for the
root directory (empty string).
+
+ * New API to manage unfinished operations: Earlier there were distinct APIs
+   which dealt with unfinished states and separate lists maintaining them
+   that are `cmdutil.afterresolvestates`, `cmdutil.unfinishedstates` and
+   `cmdutil.STATES`. Now these have been unified to a single
+   API which handles the various states and their utilities. This API
+   has been added to `state.py`. Now instead of adding to these 3 lists
+   independently a state for a new operation can be registered using
+   `addunfinished()` in `state` module.
+
+ * `cmdutil.checkunfinished()` now includes detection for merge too.



To: taapas1128, #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


D6557: relnotes: added description about statemod._statecheck

2019-06-27 Thread martinvonz (Martin von Zweigbergk)
This revision is now accepted and ready to land.
martinvonz added inline comments.
martinvonz accepted this revision.

INLINE COMMENTS

> next:65-66
> +   independently a state for a new operation can be registered using
> +   `addunfinished()` in `state` module. The description of data needed
> +   to register an operation is stated under it.
> +

I'll drop the last sentence in flight since D6583 
 has landed.

REPOSITORY
  rHG Mercurial

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

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

To: taapas1128, #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


D6557: relnotes: added description about statemod._statecheck

2019-06-27 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 15690.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6557?vs=15620=15690

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

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

AFFECTED FILES
  relnotes/next

CHANGE DETAILS

diff --git a/relnotes/next b/relnotes/next
--- a/relnotes/next
+++ b/relnotes/next
@@ -54,3 +54,15 @@
 
  * `util.dirs()` and `util.finddirs()` now include an entry for the
root directory (empty string).
+
+ * New API to manage unfinished operations: Earlier there were distinct APIs
+   which dealt with unfinished states and separate lists maintaining them
+   that are `cmdutil.afterresolvestates`, `cmdutil.unfinishedstates` and
+   `cmdutil.STATES`. Now these have been unified to a single
+   API which handles the various states and their utilities. This API
+   has been added to `state.py`. Now instead of adding to these 3 lists
+   independently a state for a new operation can be registered using
+   `addunfinished()` in `state` module. The description of data needed
+   to register an operation is stated under it.
+
+ * `cmdutil.checkunfinished()` now includes detection for merge too.



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


D6583: statecheck: shifted defaults to addunfinished()

2019-06-27 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHGfaec09d89435: statecheck: shifted defaults to 
addunfinished() (authored by taapas1128).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6583?vs=15688=15689

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

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -97,42 +97,18 @@
multistep operation or multistep command extension.
 """
 
-def __init__(self, opname, fname, clearable=False, allowcommit=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.
-clearable boolean determines whether or not interrupted states can be
-cleared by running `hg update -C .` which in turn deletes the
-state file.
-allowcommit boolean decides whether commit is allowed during 
interrupted
-state or not.
-reportonly flag is used for operations like bisect where we just
-need to detect the operation using 'hg status --verbose'
-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
-cmdmsg is used to pass a different status message in case standard
-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
-To abort: hg cmdname --abort" is not desired.
-statushint 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
-"""
+def __init__(self, opname, fname, clearable, allowcommit, reportonly,
+ continueflag, stopflag, cmdmsg, cmdhint, statushint):
 self._opname = opname
 self._fname = fname
 self._clearable = clearable
 self._allowcommit = allowcommit
+self._reportonly = reportonly
+self._continueflag = continueflag
+self._stopflag = stopflag
+self._cmdmsg = cmdmsg
 self._cmdhint = cmdhint
 self._statushint = statushint
-self._cmdmsg = cmdmsg
-self._stopflag = stopflag
-self._reportonly = reportonly
-self._continueflag = continueflag
 
 def statusmsg(self):
 """returns the hint message corresponding to the command for
@@ -179,10 +155,36 @@
 # A list of statecheck objects for multistep operations like graft.
 _unfinishedstates = []
 
-def addunfinished(opname, **kwargs):
+def addunfinished(opname, fname, clearable=False, allowcommit=False,
+  reportonly=False, continueflag=False, stopflag=False,
+  cmdmsg="", cmdhint="", statushint=""):
 """this registers a new command or operation to unfinishedstates
+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.
+clearable boolean determines whether or not interrupted states can be
+cleared by running `hg update -C .` which in turn deletes the
+state file.
+allowcommit boolean decides whether commit is allowed during interrupted
+state or not.
+reportonly flag is used for operations like bisect where we just
+need to detect the operation using 'hg status --verbose'
+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
+cmdmsg is used to pass a different status message in case standard
+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
+To abort: hg cmdname --abort" is not desired.
+statushint 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
 """
-statecheckobj = _statecheck(opname, **kwargs)
+statecheckobj = _statecheck(opname, fname, clearable, allowcommit,
+reportonly, continueflag, 

D6551: statecheck: added support for cmdutil.afterresolvedstates

2019-06-27 Thread taapas1128 (Taapas Agrawal)
taapas1128 added inline comments.

INLINE COMMENTS

> taapas1128 wrote in state.py:135
> sure.

resolved in D6583 

REPOSITORY
  rHG Mercurial

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

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

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


D6583: statecheck: shifted defaults to addunfinished()

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

REVISION SUMMARY
  This shifts the definitions and defaults of `_statecheck()`
  class to `addunfinished()` registration method.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -97,42 +97,18 @@
multistep operation or multistep command extension.
 """
 
-def __init__(self, opname, fname, clearable=False, allowcommit=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.
-clearable boolean determines whether or not interrupted states can be
-cleared by running `hg update -C .` which in turn deletes the
-state file.
-allowcommit boolean decides whether commit is allowed during 
interrupted
-state or not.
-reportonly flag is used for operations like bisect where we just
-need to detect the operation using 'hg status --verbose'
-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
-cmdmsg is used to pass a different status message in case standard
-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
-To abort: hg cmdname --abort" is not desired.
-statushint 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
-"""
+def __init__(self, opname, fname, clearable, allowcommit, reportonly,
+ continueflag, stopflag, cmdmsg, cmdhint, statushint):
 self._opname = opname
 self._fname = fname
 self._clearable = clearable
 self._allowcommit = allowcommit
+self._reportonly = reportonly
+self._continueflag = continueflag
+self._stopflag = stopflag
+self._cmdmsg = cmdmsg
 self._cmdhint = cmdhint
 self._statushint = statushint
-self._cmdmsg = cmdmsg
-self._stopflag = stopflag
-self._reportonly = reportonly
-self._continueflag = continueflag
 
 def statusmsg(self):
 """returns the hint message corresponding to the command for
@@ -179,10 +155,36 @@
 # A list of statecheck objects for multistep operations like graft.
 _unfinishedstates = []
 
-def addunfinished(opname, **kwargs):
+def addunfinished(opname, fname, clearable=False, allowcommit=False,
+  reportonly=False, continueflag=False, stopflag=False,
+  cmdmsg="", cmdhint="", statushint=""):
 """this registers a new command or operation to unfinishedstates
+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.
+clearable boolean determines whether or not interrupted states can be
+cleared by running `hg update -C .` which in turn deletes the
+state file.
+allowcommit boolean decides whether commit is allowed during interrupted
+state or not.
+reportonly flag is used for operations like bisect where we just
+need to detect the operation using 'hg status --verbose'
+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
+cmdmsg is used to pass a different status message in case standard
+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
+To abort: hg cmdname --abort" is not desired.
+statushint 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
 """
-statecheckobj = _statecheck(opname, **kwargs)
+statecheckobj = _statecheck(opname, fname, clearable, allowcommit,
+reportonly, continueflag, stopflag, cmdmsg,
+cmdhint, statushint)
 if opname == 'merge':
 _unfinishedstates.append(statecheckobj)
 else:



To: 

mercurial@42533: 11 new changesets

2019-06-27 Thread Mercurial Commits
11 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/49998d5ba66a
changeset:   42523:49998d5ba66a
user:Rodrigo Damazio Bovendorp 
date:Tue Jun 25 19:28:41 2019 -0700
summary: pycompat: make fewer assumptions about sys.executable

https://www.mercurial-scm.org/repo/hg/rev/f3fa10a5877d
changeset:   42524:f3fa10a5877d
user:Rodrigo Damazio Bovendorp 
date:Tue Jun 25 19:30:24 2019 -0700
summary: py3: use integer division for the value passed to xrange

https://www.mercurial-scm.org/repo/hg/rev/9913fffd744b
changeset:   42525:9913fffd744b
user:Rodrigo Damazio Bovendorp 
date:Tue Jun 25 19:32:08 2019 -0700
summary: py3: make catapult usable from the test runner in py3

https://www.mercurial-scm.org/repo/hg/rev/0c0e54bcea9b
changeset:   42526:0c0e54bcea9b
user:Kyle Lippincott 
date:Tue Jun 25 14:23:02 2019 -0700
summary: zsh: enable completion support for chg as well

https://www.mercurial-scm.org/repo/hg/rev/4a6826868625
changeset:   42527:4a6826868625
user:Martin von Zweigbergk 
date:Mon Jun 24 16:07:59 2019 -0700
summary: tests: demonstrate broken in-memory rebase of copy to empty file

https://www.mercurial-scm.org/repo/hg/rev/e079e001d536
changeset:   42528:e079e001d536
user:Martin von Zweigbergk 
date:Mon Jun 24 16:01:22 2019 -0700
summary: rebase: fix in-memory rebasing of copy of empty file

https://www.mercurial-scm.org/repo/hg/rev/5f2f6912c9e6
changeset:   42529:5f2f6912c9e6
user:Taapas Agrawal 
date:Sat Jun 08 23:43:53 2019 +0530
summary: states: moved cmdutil.unfinishedstates to state.py

https://www.mercurial-scm.org/repo/hg/rev/dc3fdd1b5af4
changeset:   42530:dc3fdd1b5af4
user:Taapas Agrawal 
date:Sun Jun 09 00:43:36 2019 +0530
summary: state: created new class statecheck to handle unfinishedstates

https://www.mercurial-scm.org/repo/hg/rev/5bddd2244814
changeset:   42531:5bddd2244814
user:Taapas Agrawal 
date:Sun Jun 09 01:13:13 2019 +0530
summary: state: moved cmdutil.STATES and utilities to state.py

https://www.mercurial-scm.org/repo/hg/rev/12243f15d53e
changeset:   42532:12243f15d53e
user:Taapas Agrawal 
date:Sun Jun 09 02:12:58 2019 +0530
summary: statecheck: added support for STATES

https://www.mercurial-scm.org/repo/hg/rev/0231032729c4
changeset:   42533:0231032729c4
bookmark:@
tag: tip
user:Taapas Agrawal 
date:Thu Jun 20 11:40:08 2019 +0530
summary: statecheck: added support for cmdutil.afterresolvedstates

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


[Bug 6165] New: Mercurial 5.0.1 does not have Windows wheels

2019-06-27 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6165

Bug ID: 6165
   Summary: Mercurial 5.0.1 does not have Windows wheels
   Product: Mercurial
   Version: 5.0
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: packaging
  Assignee: bugzi...@mercurial-scm.org
  Reporter: shee...@mozilla.com
CC: duri...@gmail.com, mercurial-devel@mercurial-scm.org

Looking at the following pages:

https://pypi.org/project/mercurial/5.0/#files
https://pypi.org/project/mercurial/5.0.1/#files

Version 5.0 has Windows wheels available, while version 5.0.1 does not. This is
likely just an oversight but it is causing issues with Mozilla's Windows
development environment, which attempts to install the latest version of
Mercurial when possible.

As an aside, version 5.0.1 is not available for selection in Bugzilla. Other
point release versions (like 4.8.1, 4.7.2) are available, so I think this may
have been overlooked as well.

Thanks in advance!

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


D6551: statecheck: added support for cmdutil.afterresolvedstates

2019-06-27 Thread taapas1128 (Taapas Agrawal)
taapas1128 added inline comments.

INLINE COMMENTS

> martinvonz wrote in state.py:135
> Oh, it still won't be consistent... Can you send a follow-up to reorder these 
> assignments to be consistent?

sure.

REPOSITORY
  rHG Mercurial

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

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

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


D6547: shelve: removed redundant merge detection method

2019-06-27 Thread taapas1128 (Taapas Agrawal)
taapas1128 updated this revision to Diff 15687.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6547?vs=15642=15687

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

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

AFFECTED FILES
  hgext/shelve.py

CHANGE DETAILS

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -452,8 +452,6 @@
 def _docreatecmd(ui, repo, pats, opts):
 wctx = repo[None]
 parents = wctx.parents()
-if len(parents) > 1:
-raise error.Abort(_('cannot shelve while merging'))
 parent = parents[0]
 origbranch = wctx.branch()
 
@@ -979,12 +977,6 @@
 return unshelvecontinue(ui, repo, state, opts)
 elif len(shelved) > 1:
 raise error.Abort(_('can only unshelve one change at a time'))
-
-# abort unshelve while merging (issue5123)
-parents = repo[None].parents()
-if len(parents) > 1:
-raise error.Abort(_('cannot unshelve while merging'))
-
 elif not shelved:
 shelved = listshelves(repo)
 if not shelved:



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


D6557: relnotes: added description about statemod._statecheck

2019-06-27 Thread taapas1128 (Taapas Agrawal)
taapas1128 added inline comments.

INLINE COMMENTS

> martinvonz wrote in next:63-69
> The "private" (underscore-prefixed) members should not be mentioned here. 
> Extension developers should not be accessing them, so they don't need to know 
> about them. What they need to know is that if they had been adding operations 
> to `cmdutil.unfinishedstates`, `cmdutil.afterresolvestates`, or 
> `cmdutil.STATES` before, they now need to use `state.addunfinished()`.
> 
> I now see that `state.addunfinished()` has `**kwargs`, which means they will 
> have to look at the `_statecheck` class after all. Perhaps we should copy the 
> arguments over from the class to the function (and remove the defaults from 
> the class) so it's easier to find them?

@martinvonz But that would destroy the integrity of `statecheck` class and 
`addunfinished` is just below `statecheck` class so one can easily look at 
`statecheck` if definitions for various flags are to be known. Still if you 
want I can do that.

REPOSITORY
  rHG Mercurial

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

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

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


D6582: abort: added support for histedit

2019-06-27 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.

REVISION SUMMARY
  This patch adds the support for histedit in `hg abort` plan.
  `_aborthistedit()` has been modified for independent calls.
  
  Results are shown as tests.

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-abort.t b/tests/test-abort.t
--- a/tests/test-abort.t
+++ b/tests/test-abort.t
@@ -3,9 +3,12 @@
   > rebase=
   > shelve=
   > mq =
+  > histedit =
   > [phases]
   > publish=False
-  > 
+  > [experimental]
+  > evolution.createmarkers=True
+  > evolution.allowunstable=True
   > [alias]
   > tglog = log -G --template "{rev}:{phase} '{desc}' {branches}\n"
   > EOF
@@ -669,5 +672,233 @@
   unshelve of 'default' aborted
   $ cd ..
 
-
-
+TEST `hg abort` operation histedit
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n
+  > EOF
+  $ hg init base
+  $ cd base
+
+  $ for x in a b c d e f ; do
+  > echo $x > $x
+  > hg add $x
+  > hg ci -m $x
+  > done
+
+  $ hg log --graph
+  @  5:652413bf663e (draft) f
+  |
+  o  4:e860deea161a (draft) e
+  |
+  o  3:055a42cdd887 (draft) d
+  |
+  o  2:177f92b77385 (draft) c
+  |
+  o  1:d2ae7f538514 (draft) b
+  |
+  o  0:cb9a9f314b8b (draft) a
+  
+
+  $ HGEDITOR=cat hg histedit 1
+  pick d2ae7f538514 1 b
+  pick 177f92b77385 2 c
+  pick 055a42cdd887 3 d
+  pick e860deea161a 4 e
+  pick 652413bf663e 5 f
+  
+  # Edit history between d2ae7f538514 and 652413bf663e
+  #
+  # Commits are listed from least to most recent
+  #
+  # You can reorder changesets by reordering the lines
+  #
+  # Commands:
+  #
+  #  e, edit = use commit, but stop for amending
+  #  m, mess = edit commit message without changing commit content
+  #  p, pick = use commit
+  #  b, base = checkout changeset and apply further changesets from there
+  #  d, drop = remove commit from history
+  #  f, fold = use commit, but combine it with the one above
+  #  r, roll = like fold, but discard this commit's description and date
+  #
+  $ hg histedit 1 --commands - --verbose < pick 177f92b77385 2 c
+  > drop d2ae7f538514 1 b
+  > pick 055a42cdd887 3 d
+  > fold e860deea161a 4 e
+  > pick 652413bf663e 5 f
+  > EOF
+  [1]
+  $ hg log --graph --hidden
+  @  10:cacdfd884a93 (draft) f
+  |
+  o  9:59d9f330561f (draft) d
+  |
+  | x  8:b558abc46d09 (draft) fold-temp-revision e860deea161a
+  | |
+  | x  7:96e494a2d553 (draft) d
+  |/
+  o  6:b346ab9a313d (draft) c
+  |
+  | x  5:652413bf663e (draft) f
+  | |
+  | x  4:e860deea161a (draft) e
+  | |
+  | x  3:055a42cdd887 (draft) d
+  | |
+  | x  2:177f92b77385 (draft) c
+  | |
+  | x  1:d2ae7f538514 (draft) b
+  |/
+  o  0:cb9a9f314b8b (draft) a
+  
+  $ hg debugobsolete
+  d2ae7f538514cd87c17547b0de4cea71fe1af9fb 0 
{cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  177f92b773850b59254aa5e923436f921b55483b 
b346ab9a313db8537ecf96fca3ca3ca984ef3bd7 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  055a42cdd88768532f9cf79daa407fc8d138de9b 
59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  e860deea161a2f77de56603b340ebbb4536308ae 
59d9f330561fd6c88b1a6b32f0e45034d88db784 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '13', 'operation': 'histedit', 'user': 'test'}
+  652413bf663ef2a641cab26574e46d5f5a64a55a 
cacdfd884a9321ec4e1de275ef3949fa953a1f83 0 (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '4', 'operation': 'histedit', 'user': 'test'}
+  96e494a2d553dd05902ba1cee1d94d4cb7b8faed 0 
{b346ab9a313db8537ecf96fca3ca3ca984ef3bd7} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+  b558abc46d09c30f57ac31e85a8a3d64d2e906e4 0 
{96e494a2d553dd05902ba1cee1d94d4cb7b8faed} (Thu Jan 01 00:00:00 1970 +) 
{'ef1': '0', 'operation': 'histedit', 'user': 'test'}
+
+Ensure hidden revision does not prevent histedit
+-
+
+create an hidden revision
+
+  $ hg histedit 6 --commands - << EOF
+  > pick b346ab9a313d 6 c
+  > drop 59d9f330561f 7 d
+  > pick cacdfd884a93 8 f
+  > EOF
+  $ hg log --graph
+  @  11:c13eb81022ca (draft) f
+  |
+  o  6:b346ab9a313d (draft) c
+  |
+  o  0:cb9a9f314b8b (draft) a
+  
+check hidden revision are ignored (6 have hidden children 7 and 8)
+
+  $ hg histedit 6 --commands - << EOF
+  > pick b346ab9a313d 6 c
+  > pick c13eb81022ca 8 f
+  > EOF
+
+Test phases support
+===
+
+Check that histedit respect immutability
+---
+
+  $ cat >> $HGRCPATH << EOF
+  > [ui]
+  > logtemplate= {rev}:{node|short} ({phase}) {desc|firstline}\n

D6557: relnotes: added description about statemod._statecheck

2019-06-27 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> next:63-69
> +   has been added to `state.py` and is form of class called `_statecheck`.
> +   To register a new state for an operation you need to add a `_statecheck`
> +   object with necessary information to `_unfinishedstates` list.
> +   The method of registration of a `_statecheck` object into 
> `_unfinishedstates`
> +   is not direct but through `addunfinished()`. The data needed for various
> +   operations to be registered under `_unfinishedstates` list is stated in
> +   `_statecheck` class.

The "private" (underscore-prefixed) members should not be mentioned here. 
Extension developers should not be accessing them, so they don't need to know 
about them. What they need to know is that if they had been adding operations 
to `cmdutil.unfinishedstates`, `cmdutil.afterresolvestates`, or 
`cmdutil.STATES` before, they now need to use `state.addunfinished()`.

I now see that `state.addunfinished()` has `**kwargs`, which means they will 
have to look at the `_statecheck` class after all. Perhaps we should copy the 
arguments over from the class to the function (and remove the defaults from the 
class) so it's easier to find them?

REPOSITORY
  rHG Mercurial

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

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

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


D6551: statecheck: added support for cmdutil.afterresolvedstates

2019-06-27 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHG0231032729c4: statecheck: added support for 
cmdutil.afterresolvedstates (authored by taapas1128).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6551?vs=15645=15685

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

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

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  hgext/shelve.py
  mercurial/cmdutil.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, stopflag=False, cmdmsg="", cmdhint="",
- statushint=""):
+ 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.
@@ -110,6 +110,8 @@
 state or not.
 reportonly flag is used for operations like bisect where we just
 need to detect the operation using 'hg status --verbose'
+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
 cmdmsg is used to pass a different status message in case standard
@@ -130,6 +132,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
@@ -160,6 +163,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
@@ -183,7 +190,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,
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3296,11 +3296,6 @@
 if s._clearable and s.isunfinished(repo):
 util.unlink(repo.vfs.join(s._fname))
 
-afterresolvedstates = [
-('graftstate',
- _('hg graft --continue')),
-]
-
 def howtocontinue(repo):
 '''Check for an unfinished operation and return the command to finish
 it.
@@ -3312,9 +3307,11 @@
 a boolean.
 '''
 contmsg = _("continue: %s")
-for f, msg in afterresolvedstates:
-if repo.vfs.exists(f):
-return contmsg % msg, True
+for state in statemod._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
@@ -1141,8 +1141,7 @@
 
 def extsetup(ui):
 statemod.addunfinished(
-'unshelve', fname=shelvedstate._filename,
+'unshelve', fname=shelvedstate._filename, continueflag=True,
 cmdmsg=_('unshelve already in progress')
 )
-cmdutil.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)
-cmdutil.afterresolvedstates.append(
-['rebasestate', _('hg rebase --continue')])
+statemod.addunfinished('rebase', fname='rebasestate', stopflag=True,
+continueflag=True)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -2313,6 +2313,6 @@
 
 def extsetup(ui):
 cmdutil.summaryhooks.add('histedit', summaryhook)
-statemod.addunfinished('histedit', fname='histedit-state', 
allowcommit=True)
-

D6551: statecheck: added support for cmdutil.afterresolvedstates

2019-06-27 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> martinvonz wrote in state.py:135
> I'll move this up two lines in flight so it's consistent with the order above

Oh, it still won't be consistent... Can you send a follow-up to reorder these 
assignments to be consistent?

REPOSITORY
  rHG Mercurial

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

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

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


D6551: statecheck: added support for cmdutil.afterresolvedstates

2019-06-27 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> state.py:135
>  self._reportonly = reportonly
> +self._continueflag = continueflag
>  

I'll move this up two lines in flight so it's consistent with the order above

REPOSITORY
  rHG Mercurial

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

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

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


D6484: states: moved cmdutil.unfinishedstates to state.py

2019-06-27 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHG5f2f6912c9e6: states: moved cmdutil.unfinishedstates to 
state.py (authored by taapas1128).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6484?vs=15638=15681

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

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

AFFECTED FILES
  hgext/histedit.py
  hgext/rebase.py
  hgext/shelve.py
  hgext/transplant.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -19,6 +19,8 @@
 
 from __future__ import absolute_import
 
+from .i18n import _
+
 from . import (
 error,
 util,
@@ -85,3 +87,14 @@
 def exists(self):
 """check whether the state file exists or not"""
 return self._repo.vfs.exists(self.fname)
+
+# A list of state files kept by multistep operations like graft.
+# Since graft cannot be aborted, it is considered 'clearable' by update.
+# note: bisect is intentionally excluded
+# (state file, clearable, allowcommit, error, hint)
+unfinishedstates = [
+('graftstate', True, False, _('graft in progress'),
+ _("use 'hg graft --continue' or 'hg graft --stop' to stop")),
+('updatestate', True, False, _('last update was interrupted'),
+ _("use 'hg update' to get a consistent checkout"))
+]
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -6148,7 +6148,6 @@
 
 with repo.wlock():
 cmdutil.clearunfinished(repo)
-
 if date:
 rev = cmdutil.finddate(ui, repo, date)
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -42,6 +42,7 @@
 rewriteutil,
 scmutil,
 smartset,
+state as statemod,
 subrepoutil,
 templatekw,
 templater,
@@ -3313,17 +3314,6 @@
 #  - (desturl,   destbranch,   destpeer,   outgoing)
 summaryremotehooks = util.hooks()
 
-# A list of state files kept by multistep operations like graft.
-# Since graft cannot be aborted, it is considered 'clearable' by update.
-# note: bisect is intentionally excluded
-# (state file, clearable, allowcommit, error, hint)
-unfinishedstates = [
-('graftstate', True, False, _('graft in progress'),
- _("use 'hg graft --continue' or 'hg graft --stop' to stop")),
-('updatestate', True, False, _('last update was interrupted'),
- _("use 'hg update' to get a consistent checkout"))
-]
-
 def checkunfinished(repo, commit=False):
 '''Look for an unfinished multistep operation, like graft, and abort
 if found. It's probably good to check this right before
@@ -3331,13 +3321,13 @@
 '''
 # Check for non-clearable states first, so things like rebase will take
 # precedence over update.
-for f, clearable, allowcommit, msg, hint in unfinishedstates:
+for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
 if clearable or (commit and allowcommit):
 continue
 if repo.vfs.exists(f):
 raise error.Abort(msg, hint=hint)
 
-for f, clearable, allowcommit, msg, hint in unfinishedstates:
+for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
 if not clearable or (commit and allowcommit):
 continue
 if repo.vfs.exists(f):
@@ -3347,10 +3337,10 @@
 '''Check for unfinished operations (as above), and clear the ones
 that are clearable.
 '''
-for f, clearable, allowcommit, msg, hint in unfinishedstates:
+for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
 if not clearable and repo.vfs.exists(f):
 raise error.Abort(msg, hint=hint)
-for f, clearable, allowcommit, msg, hint in unfinishedstates:
+for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
 if clearable and repo.vfs.exists(f):
 util.unlink(repo.vfs.join(f))
 
diff --git a/hgext/transplant.py b/hgext/transplant.py
--- a/hgext/transplant.py
+++ b/hgext/transplant.py
@@ -35,6 +35,7 @@
 revset,
 scmutil,
 smartset,
+state as statemod,
 util,
 vfs as vfsmod,
 )
@@ -757,7 +758,7 @@
 return n and nodemod.hex(n) or ''
 
 def extsetup(ui):
-cmdutil.unfinishedstates.append(
+statemod.unfinishedstates.append(
 ['transplant/journal', True, False, _('transplant in progress'),
  _("use 'hg transplant --continue' or 'hg update' to abort")])
 
diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -48,6 +48,7 @@
 registrar,
 repair,
 scmutil,
+state as statemod,
 templatefilters,
 util,
 vfs as vfsmod,
@@ -1139,9 +1140,10 @@
 return createcmd(ui, repo, pats, opts)
 
 def extsetup(ui):
-

D6503: statecheck: added support for STATES

2019-06-27 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHG12243f15d53e: statecheck: added support for STATES 
(authored by taapas1128).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6503?vs=15641=15684

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

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

AFFECTED FILES
  hgext/rebase.py
  hgext/strip.py
  hgext/transplant.py
  mercurial/cmdutil.py
  mercurial/state.py
  tests/test-graft.t
  tests/test-merge1.t
  tests/test-mq-qnew.t
  tests/test-rebase-conflicts.t
  tests/test-shelve.t
  tests/test-strip.t
  tests/test-transplant.t

CHANGE DETAILS

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -40,6 +40,7 @@
   (branch merge, don't forget to commit)
   $ hg transplant 1
   abort: outstanding uncommitted merge
+  (use 'hg commit' or 'hg merge --abort')
   [255]
   $ hg up -qC tip
   $ echo b0 > b1
@@ -461,7 +462,7 @@
   baz
   foo
 
-test multiple revisions and --continue
+test multiple revisions, --continue and hg status --verbose
 
   $ hg up -qC 0
   $ echo bazbaz > baz
@@ -481,6 +482,15 @@
   abort: transplant in progress
   (use 'hg transplant --continue' or 'hg update' to abort)
   [255]
+  $ hg status -v
+  A bar
+  ? baz.rej
+  ? foo.rej
+  # The repository is in an unfinished *transplant* state.
+  
+  # To continue:hg transplant --continue
+  # To abort:   hg update
+  
   $ echo fixed > baz
   $ hg transplant --continue
   9d6d6b5a8275 transplanted as d80c49962290
diff --git a/tests/test-strip.t b/tests/test-strip.t
--- a/tests/test-strip.t
+++ b/tests/test-strip.t
@@ -275,6 +275,7 @@
 ##strip not allowed with merge in progress
   $ hg strip 4
   abort: outstanding uncommitted merge
+  (use 'hg commit' or 'hg merge --abort')
   [255]
 ##strip allowed --force with merge in progress
   $ hg strip 4 --force
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1153,7 +1153,8 @@
 -- trying to pull in the shelve bits
 -- unshelve should abort otherwise, it'll eat my second parent.
   $ hg unshelve
-  abort: cannot unshelve while merging
+  abort: outstanding uncommitted merge
+  (use 'hg commit' or 'hg merge --abort')
   [255]
 
   $ cd ..
diff --git a/tests/test-rebase-conflicts.t b/tests/test-rebase-conflicts.t
--- a/tests/test-rebase-conflicts.t
+++ b/tests/test-rebase-conflicts.t
@@ -82,6 +82,7 @@
   
   # To continue:hg rebase --continue
   # To abort:   hg rebase --abort
+  # To stop:hg rebase --stop
   
 
 Try to continue without solving the conflict:
diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t
+++ b/tests/test-mq-qnew.t
@@ -164,7 +164,8 @@
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to 
abandon
   (no more unresolved files)
-  abort: cannot manage merge changesets
+  abort: outstanding uncommitted merge
+  (use 'hg commit' or 'hg merge --abort')
   $ rm -r sandbox
 
 hg headers
@@ -243,7 +244,8 @@
   0 files updated, 0 files merged, 0 files removed, 1 files unresolved
   use 'hg resolve' to retry unresolved file merges or 'hg merge --abort' to 
abandon
   (no more unresolved files)
-  abort: cannot manage merge changesets
+  abort: outstanding uncommitted merge
+  (use 'hg commit' or 'hg merge --abort')
   $ rm -r sandbox
 
 Test saving last-message.txt
diff --git a/tests/test-merge1.t b/tests/test-merge1.t
--- a/tests/test-merge1.t
+++ b/tests/test-merge1.t
@@ -44,6 +44,13 @@
   commit: 1 unknown (interrupted update)
   update: 1 new changesets (update)
   phases: 2 draft
+Detect interrupted update by hg status --verbose
+  $ hg status -v
+  ? b/nonempty
+  # The repository is in an unfinished *update* state.
+  
+  # To continue:hg update
+  
 
   $ rm b/nonempty
 
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -281,6 +281,7 @@
   
   # To continue:hg graft --continue
   # To abort:   hg graft --abort
+  # To stop:hg graft --stop
   
 
 Commit while interrupted should fail:
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -98,7 +98,8 @@
 """
 
 def __init__(self, opname, fname, clearable=False, allowcommit=False,
- cmdmsg="", cmdhint=""):
+ reportonly=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.
@@ -107,21 +108,47 @@
 state file.
 allowcommit boolean decides whether commit is allowed during 
interrupted
 state or not.
+reportonly 

D6501: state: created new class statecheck to handle unfinishedstates

2019-06-27 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHGdc3fdd1b5af4: state: created new class statecheck to handle 
unfinishedstates (authored by taapas1128).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6501?vs=15639=15682

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

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

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

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -88,13 +88,70 @@
 """check whether the state file exists or not"""
 return self._repo.vfs.exists(self.fname)
 
-# A list of state files kept by multistep operations like graft.
-# Since graft cannot be aborted, it is considered 'clearable' by update.
-# note: bisect is intentionally excluded
-# (state file, clearable, allowcommit, error, hint)
-unfinishedstates = [
-('graftstate', True, False, _('graft in progress'),
- _("use 'hg graft --continue' or 'hg graft --stop' to stop")),
-('updatestate', True, False, _('last update was interrupted'),
- _("use 'hg update' to get a consistent checkout"))
-]
+class _statecheck(object):
+"""a utility class that deals with multistep operations like graft,
+   histedit, bisect, update etc and check whether such commands
+   are in an unfinished conditition or not and return appropriate message
+   and hint.
+   It also has the ability to register and determine the states of any new
+   multistep operation or multistep command extension.
+"""
+
+def __init__(self, opname, fname, clearable=False, allowcommit=False,
+ cmdmsg="", cmdhint=""):
+"""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.
+clearable boolean determines whether or not interrupted states can be
+cleared by running `hg update -C .` which in turn deletes the
+state file.
+allowcommit boolean decides whether commit is allowed during 
interrupted
+state or not.
+cmdmsg is used to pass a different status message in case standard
+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 use 'hg cmdname --continue' or
+'hg cmdname --abort'" is not desired.
+"""
+self._opname = opname
+self._fname = fname
+self._clearable = clearable
+self._allowcommit = allowcommit
+self._cmdhint = cmdhint
+self._cmdmsg = cmdmsg
+
+def hint(self):
+"""returns the hint message corresponding to the command"""
+if not self._cmdhint:
+return (_("use 'hg %s --continue' or 'hg %s --abort'") %
+(self._opname, self._opname))
+return self._cmdhint
+
+def msg(self):
+"""returns the status message corresponding to the command"""
+if not self._cmdmsg:
+return _('%s in progress') % (self._opname)
+return self._cmdmsg
+
+def isunfinished(self, repo):
+"""determines whether a multi-step operation is in progress or not"""
+return repo.vfs.exists(self._fname)
+
+# A list of statecheck objects for multistep operations like graft.
+_unfinishedstates = []
+
+def addunfinished(opname, **kwargs):
+"""this registers a new command or operation to unfinishedstates
+"""
+statecheckobj = _statecheck(opname, **kwargs)
+_unfinishedstates.append(statecheckobj)
+
+addunfinished(
+'graft', fname='graftstate', clearable=True,
+cmdhint=_("use 'hg graft --continue' or 'hg graft --stop' to stop")
+)
+addunfinished(
+'update', fname='updatestate', clearable=True,
+cmdmsg=_('last update was interrupted'),
+cmdhint=_("use 'hg update' to get a consistent checkout")
+)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3314,6 +3314,7 @@
 #  - (desturl,   destbranch,   destpeer,   outgoing)
 summaryremotehooks = util.hooks()
 
+
 def checkunfinished(repo, commit=False):
 '''Look for an unfinished multistep operation, like graft, and abort
 if found. It's probably good to check this right before
@@ -3321,28 +3322,29 @@
 '''
 # Check for non-clearable states first, so things like rebase will take
 # precedence over update.
-for f, clearable, allowcommit, msg, hint in statemod.unfinishedstates:
-if clearable or (commit and allowcommit):
+for state in statemod._unfinishedstates:
+if state._clearable or (commit and state._allowcommit):
 continue
-if repo.vfs.exists(f):
- 

D6502: state: moved cmdutil.STATES and utilities to state.py

2019-06-27 Thread taapas1128 (Taapas Agrawal)
Closed by commit rHG5bddd2244814: state: moved cmdutil.STATES and utilities to 
state.py (authored by taapas1128).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6502?vs=15640=15683

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

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -155,3 +155,64 @@
 cmdmsg=_('last update was interrupted'),
 cmdhint=_("use 'hg update' to get a consistent checkout")
 )
+
+def _commentlines(raw):
+'''Surround lineswith a comment char and a new line'''
+lines = raw.splitlines()
+commentedlines = ['# %s' % line for line in lines]
+return '\n'.join(commentedlines) + '\n'
+
+def _helpmessage(continuecmd, abortcmd):
+msg = _('To continue:%s\n'
+'To abort:   %s') % (continuecmd, abortcmd)
+return _commentlines(msg)
+
+def _rebasemsg():
+return _helpmessage('hg rebase --continue', 'hg rebase --abort')
+
+def _histeditmsg():
+return _helpmessage('hg histedit --continue', 'hg histedit --abort')
+
+def _unshelvemsg():
+return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
+
+def _graftmsg():
+return _helpmessage('hg graft --continue', 'hg graft --abort')
+
+def _mergemsg():
+return _helpmessage('hg commit', 'hg merge --abort')
+
+def _bisectmsg():
+msg = _('To mark the changeset good:hg bisect --good\n'
+'To mark the changeset bad: hg bisect --bad\n'
+'To abort:  hg bisect --reset\n')
+return _commentlines(msg)
+
+def fileexistspredicate(filename):
+return lambda repo: repo.vfs.exists(filename)
+
+def _mergepredicate(repo):
+return len(repo[None].parents()) > 1
+
+STATES = (
+# (state, predicate to detect states, helpful message function)
+('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
+('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
+('graft', fileexistspredicate('graftstate'), _graftmsg),
+('unshelve', fileexistspredicate('shelvedstate'), _unshelvemsg),
+('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
+# The merge state is part of a list that will be iterated over.
+# They need to be last because some of the other unfinished states may also
+# be in a merge or update state (eg. rebase, histedit, graft, etc).
+# We want those to have priority.
+('merge', _mergepredicate, _mergemsg),
+)
+
+def getrepostate(repo):
+# experimental config: commands.status.skipstates
+skip = set(repo.ui.configlist('commands', 'status.skipstates'))
+for state, statedetectionpredicate, msgfn in STATES:
+if state in skip:
+continue
+if statedetectionpredicate(repo):
+return (state, statedetectionpredicate, msgfn)
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -619,63 +619,8 @@
 
 return _commentlines(msg)
 
-def _helpmessage(continuecmd, abortcmd):
-msg = _('To continue:%s\n'
-'To abort:   %s') % (continuecmd, abortcmd)
-return _commentlines(msg)
-
-def _rebasemsg():
-return _helpmessage('hg rebase --continue', 'hg rebase --abort')
-
-def _histeditmsg():
-return _helpmessage('hg histedit --continue', 'hg histedit --abort')
-
-def _unshelvemsg():
-return _helpmessage('hg unshelve --continue', 'hg unshelve --abort')
-
-def _graftmsg():
-return _helpmessage('hg graft --continue', 'hg graft --abort')
-
-def _mergemsg():
-return _helpmessage('hg commit', 'hg merge --abort')
-
-def _bisectmsg():
-msg = _('To mark the changeset good:hg bisect --good\n'
-'To mark the changeset bad: hg bisect --bad\n'
-'To abort:  hg bisect --reset\n')
-return _commentlines(msg)
-
-def fileexistspredicate(filename):
-return lambda repo: repo.vfs.exists(filename)
-
-def _mergepredicate(repo):
-return len(repo[None].parents()) > 1
-
-STATES = (
-# (state, predicate to detect states, helpful message function)
-('histedit', fileexistspredicate('histedit-state'), _histeditmsg),
-('bisect', fileexistspredicate('bisect.state'), _bisectmsg),
-('graft', fileexistspredicate('graftstate'), _graftmsg),
-('unshelve', fileexistspredicate('shelvedstate'), _unshelvemsg),
-('rebase', fileexistspredicate('rebasestate'), _rebasemsg),
-# The merge state is part of a list that will be iterated over.
-# They need to be last because some of the other unfinished states may also
-# be in a merge or update state (eg. rebase, histedit, graft, etc).
-# We want those to have priority.
-('merge', _mergepredicate, _mergemsg),

D6393: rust-dirstate: add "dirs" Rust implementation

2019-06-27 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> Alphare wrote in dirs_multiset.rs:43
> Unless I'm missing something, this would render the `if` statement useless.

Maybe Kevin meant something like this?

  if skip_state == None | skip_state == Some(state) {
  multiset.add_path(filename);
  }

REPOSITORY
  rHG Mercurial

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

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

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


D6575: pycompat: make fewer assumptions about sys.executable

2019-06-27 Thread rdamazio (Rodrigo Damazio Bovendorp)
Closed by commit rHG49998d5ba66a: pycompat: make fewer assumptions about 
sys.executable (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6575?vs=15663=15675

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

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

AFFECTED FILES
  mercurial/chgserver.py
  mercurial/debugcommands.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
@@ -282,7 +282,16 @@
 
 return p
 
-PYTHON = _bytespath(sys.executable.replace('\\', '/'))
+if sys.executable:
+sysexecutable = sys.executable
+elif os.environ.get('PYTHONEXECUTABLE'):
+sysexecutable = os.environ['PYTHONEXECUTABLE']
+elif os.environ.get('PYTHON'):
+sysexecutable = os.environ['PYTHON']
+else:
+raise AssertionError('Could not find Python interpreter')
+
+PYTHON = _bytespath(sysexecutable.replace('\\', '/'))
 IMPL_PATH = b'PYTHONPATH'
 if 'java' in sys.platform:
 IMPL_PATH = b'JYTHONPATH'
@@ -1094,7 +1103,7 @@
 env["HGRCPATH"] = _strpath(os.path.join(self._threadtmp, b'.hgrc'))
 env["DAEMON_PIDS"] = _strpath(os.path.join(self._threadtmp,
b'daemon.pids'))
-env["HGEDITOR"] = ('"' + sys.executable + '"'
+env["HGEDITOR"] = ('"' + sysexecutable + '"'
+ ' -c "import sys; sys.exit(0)"')
 env["HGUSER"]   = "test"
 env["HGENCODING"] = "ascii"
@@ -2349,7 +2358,7 @@
 withhg = self._runner.options.with_hg
 if withhg:
 opts += ' --with-hg=%s ' % shellquote(_strpath(withhg))
-rtc = '%s %s %s %s' % (sys.executable, sys.argv[0], opts,
+rtc = '%s %s %s %s' % (sysexecutable, sys.argv[0], opts,
test)
 data = pread(bisectcmd + ['--command', rtc])
 m = re.search(
@@ -3003,25 +3012,25 @@
 # Administrator rights.
 if getattr(os, 'symlink', None) and os.name != 'nt':
 vlog("# Making python executable in test path a symlink to '%s'" %
- sys.executable)
+ sysexecutable)
 mypython = os.path.join(self._tmpbindir, pyexename)
 try:
-if os.readlink(mypython) == sys.executable:
+if os.readlink(mypython) == sysexecutable:
 return
 os.unlink(mypython)
 except OSError as err:
 if err.errno != errno.ENOENT:
 raise
-if self._findprogram(pyexename) != sys.executable:
+if self._findprogram(pyexename) != sysexecutable:
 try:
-os.symlink(sys.executable, mypython)
+os.symlink(sysexecutable, mypython)
 self._createdfiles.append(mypython)
 except OSError as err:
 # child processes may race, which is harmless
 if err.errno != errno.EEXIST:
 raise
 else:
-exedir, exename = os.path.split(sys.executable)
+exedir, exename = os.path.split(sysexecutable)
 vlog("# Modifying search path to find %s as %s in '%s'" %
  (exename, pyexename, exedir))
 path = os.environ['PATH'].split(os.pathsep)
@@ -3048,7 +3057,7 @@
 
 # Run installer in hg root
 script = os.path.realpath(sys.argv[0])
-exe = sys.executable
+exe = sysexecutable
 if PYTHON3:
 compiler = _bytespath(compiler)
 script = _bytespath(script)
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1240,7 +1240,7 @@
 
 # Python
 fm.write('pythonexe', _("checking Python executable (%s)\n"),
- pycompat.sysexecutable)
+ pycompat.sysexecutable or _("unknown"))
 fm.write('pythonver', _("checking Python version (%s)\n"),
  ("%d.%d.%d" % sys.version_info[:3]))
 fm.write('pythonlib', _("checking Python lib (%s)...\n"),
diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -138,7 +138,9 @@
 modules.append(__version__)
 except ImportError:
 pass
-files = [pycompat.sysexecutable]
+files = []
+if pycompat.sysexecutable:
+files.append(pycompat.sysexecutable)
 for m in modules:
 try:
 files.append(pycompat.fsencode(inspect.getabsfile(m)))



To: rdamazio, #hg-reviewers, pulkit
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org

D6570: rebase: fix in-memory rebasing of copy of empty file

2019-06-27 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGe079e001d536: rebase: fix in-memory rebasing of copy of 
empty file (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6570?vs=15653=15680

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

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

AFFECTED FILES
  mercurial/context.py
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -795,12 +795,10 @@
   $ hg co -q 0
   $ hg mv a b
   $ hg ci -qm 'rename a to b'
-BROKEN: shouldn't crash
   $ hg rebase -d 1
   rebasing 2:b977edf6f839 "rename a to b" (tip)
   merging a and b to b
-  abort: b@c71e275f666f: not found in manifest!
-  [255]
+  saved backup bundle to 
$TESTTMP/rebase-rename-empty/.hg/strip-backup/b977edf6f839-0864f570-rebase.hg
   $ hg st --copies --change .
   A b
 a
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2159,7 +2159,9 @@
 # the file is marked as existing.
 if exists and data is None:
 oldentry = self._cache.get(path) or {}
-data = oldentry.get('data') or self._wrappedctx[path].data()
+data = oldentry.get('data')
+if data is None:
+data = self._wrappedctx[path].data()
 
 self._cache[path] = {
 'exists': exists,



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


D6577: py3: make catapult usable from the test runner in py3

2019-06-27 Thread rdamazio (Rodrigo Damazio Bovendorp)
Closed by commit rHG9913fffd744b: py3: make catapult usable from the test 
runner in py3 (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6577?vs=15662=15677

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

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

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
@@ -1474,6 +1474,12 @@
 script.append(b'alias pwd="pwd -W"\n')
 
 if hgcatapult and hgcatapult != os.devnull:
+if PYTHON3:
+hgcatapult = hgcatapult.encode('utf8')
+cataname = self.name.encode('utf8')
+else:
+cataname = self.name
+
 # Kludge: use a while loop to keep the pipe from getting
 # closed by our echo commands. The still-running file gets
 # reaped at the end of the script, which causes the while
@@ -1490,9 +1496,9 @@
 b'HGCATAPULTSESSION=%(session)s ; export HGCATAPULTSESSION\n'
 b'echo START %(session)s %(name)s >> %(catapult)s\n'
 % {
-'name': self.name,
-'session': session,
-'catapult': hgcatapult,
+b'name': cataname,
+b'session': session,
+b'catapult': hgcatapult,
 }
 )
 



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


D6569: tests: demonstrate broken in-memory rebase of copy to empty file

2019-06-27 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG4a6826868625: tests: demonstrate broken in-memory rebase of 
copy to empty file (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6569?vs=15652=15679

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

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

AFFECTED FILES
  tests/test-rebase-inmemory.t

CHANGE DETAILS

diff --git a/tests/test-rebase-inmemory.t b/tests/test-rebase-inmemory.t
--- a/tests/test-rebase-inmemory.t
+++ b/tests/test-rebase-inmemory.t
@@ -784,6 +784,28 @@
   R a
   $ cd ..
 
+Test rebasing a commit with copy information, where the target is empty
+
+  $ hg init rebase-rename-empty
+  $ cd rebase-rename-empty
+  $ echo a > a
+  $ hg ci -Aqm 'add a'
+  $ cat > a
+  $ hg ci -m 'make a empty'
+  $ hg co -q 0
+  $ hg mv a b
+  $ hg ci -qm 'rename a to b'
+BROKEN: shouldn't crash
+  $ hg rebase -d 1
+  rebasing 2:b977edf6f839 "rename a to b" (tip)
+  merging a and b to b
+  abort: b@c71e275f666f: not found in manifest!
+  [255]
+  $ hg st --copies --change .
+  A b
+a
+  R a
+  $ cd ..
 Rebase across a copy with --collapse
 
   $ hg init rebase-rename-collapse



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


D6574: zsh: enable completion support for chg as well

2019-06-27 Thread spectral (Kyle Lippincott)
Closed by commit rHG0c0e54bcea9b: zsh: enable completion support for chg as 
well (authored by spectral).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6574?vs=15657=15678

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

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

AFFECTED FILES
  contrib/zsh_completion

CHANGE DETAILS

diff --git a/contrib/zsh_completion b/contrib/zsh_completion
--- a/contrib/zsh_completion
+++ b/contrib/zsh_completion
@@ -1,4 +1,4 @@
-#compdef hg
+#compdef hg chg
 
 # Zsh completion script for mercurial.  Rename this file to _hg and copy
 # it into your zsh function path (/usr/share/zsh/site-functions for



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


D6576: py3: use integer division for the value passed to xrange

2019-06-27 Thread rdamazio (Rodrigo Damazio Bovendorp)
Closed by commit rHGf3fa10a5877d: py3: use integer division for the value 
passed to xrange (authored by rdamazio).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6576?vs=15659=15676

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

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

AFFECTED FILES
  mercurial/pure/osutil.py

CHANGE DETAILS

diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-from __future__ import absolute_import
+from __future__ import absolute_import, division
 
 import ctypes
 import ctypes.util
@@ -149,7 +149,7 @@
 cmsg.cmsg_type != _SCM_RIGHTS):
 return []
 rfds = ctypes.cast(cmsg.cmsg_data, ctypes.POINTER(ctypes.c_int))
-rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) /
+rfdscount = ((cmsg.cmsg_len - _cmsghdr.cmsg_data.offset) //
  ctypes.sizeof(ctypes.c_int))
 return [rfds[i] for i in pycompat.xrange(rfdscount)]
 



To: rdamazio, #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@42522: 3 new changesets

2019-06-27 Thread Mercurial Commits
3 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/898b36f74f75
changeset:   42520:898b36f74f75
user:Martin von Zweigbergk 
date:Wed Jun 26 05:20:02 2019 -0700
summary: copies: document how 'copies' dict instances are reused

https://www.mercurial-scm.org/repo/hg/rev/64a873ca7135
changeset:   42521:64a873ca7135
user:Valentin Gatien-Baron 
date:Thu Jun 27 11:09:09 2019 +0200
summary: tests: show bug in update introduced in 87a34c767384

https://www.mercurial-scm.org/repo/hg/rev/d29db0a0c4eb
changeset:   42522:d29db0a0c4eb
bookmark:@
tag: tip
user:Valentin Gatien-Baron 
date:Thu Jun 27 11:39:35 2019 +0200
summary: update: fix spurious unclean status bug shown by previous commit

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


D6581: update: fix spurious unclean status bug shown by previous commit

2019-06-27 Thread valentin.gatienbaron (Valentin Gatien-Baron)
Closed by commit rHGd29db0a0c4eb: update: fix spurious unclean status bug shown 
by previous commit (authored by valentin.gatienbaron).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6581?vs=15669=15674

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

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

AFFECTED FILES
  mercurial/merge.py
  mercurial/worker.py
  tests/test-simple-update.t

CHANGE DETAILS

diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t
--- a/tests/test-simple-update.t
+++ b/tests/test-simple-update.t
@@ -110,24 +110,6 @@
   getting 100
   100 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status
-  M 100
-  M 11
-  M 2
-  M 21
-  M 3
-  M 4
-  M 41
-  M 5
-  M 51
-  M 54
-  M 6
-  M 61
-  M 7
-  M 71
-  M 8
-  M 81
-  M 9
-  M 91
 
   $ cd ..
 
diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -100,8 +100,9 @@
 workers
 
 hasretval - when True, func and the current function return an progress
-iterator then a list (encoded as an iterator that yield many (False, ..)
-then a (True, list)). The resulting list is in the natural order.
+iterator then a dict (encoded as an iterator that yield many (False, ..)
+then a (True, dict)). The dicts are joined in some arbitrary order, so
+overlapping keys are a bad idea.
 
 threadsafe - whether work items are thread safe and can be executed using
 a thread-based worker. Should be disabled for CPU heavy tasks that don't
@@ -162,8 +163,8 @@
 ui.flush()
 parentpid = os.getpid()
 pipes = []
-retvals = []
-for i, pargs in enumerate(partition(args, workers)):
+retval = {}
+for pargs in partition(args, workers):
 # Every worker gets its own pipe to send results on, so we don't have 
to
 # implement atomic writes larger than PIPE_BUF. Each forked process has
 # its own pipe's descriptors in the local variables, and the parent
@@ -171,7 +172,6 @@
 # care what order they're in).
 rfd, wfd = os.pipe()
 pipes.append((rfd, wfd))
-retvals.append(None)
 # make sure we use os._exit in all worker code paths. otherwise the
 # worker may do some clean-ups which could cause surprises like
 # deadlock. see sshpeer.cleanup for example.
@@ -192,7 +192,7 @@
 os.close(w)
 os.close(rfd)
 for result in func(*(staticargs + (pargs,))):
-os.write(wfd, util.pickle.dumps((i, result)))
+os.write(wfd, util.pickle.dumps(result))
 return 0
 
 ret = scmutil.callcatch(ui, workerfunc)
@@ -226,9 +226,9 @@
 while openpipes > 0:
 for key, events in selector.select():
 try:
-i, res = util.pickle.load(key.fileobj)
+res = util.pickle.load(key.fileobj)
 if hasretval and res[0]:
-retvals[i] = res[1]
+retval.update(res[1])
 else:
 yield res
 except EOFError:
@@ -249,7 +249,7 @@
 os.kill(os.getpid(), -status)
 sys.exit(status)
 if hasretval:
-yield True, sum(retvals, [])
+yield True, retval
 
 def _posixexitstatus(code):
 '''convert a posix exit status into the same form returned by
@@ -281,9 +281,9 @@
 try:
 while not self._taskqueue.empty():
 try:
-i, args = self._taskqueue.get_nowait()
+args = self._taskqueue.get_nowait()
 for res in self._func(*self._staticargs + (args,)):
-self._resultqueue.put((i, res))
+self._resultqueue.put(res)
 # threading doesn't provide a native way to
 # interrupt execution. handle it manually at every
 # iteration.
@@ -318,11 +318,10 @@
 workers = _numworkers(ui)
 resultqueue = pycompat.queue.Queue()
 taskqueue = pycompat.queue.Queue()
-retvals = []
+retval = {}
 # partition work to more pieces than workers to minimize the chance
 # of uneven distribution of large tasks between the workers
-for pargs in enumerate(partition(args, workers * 20)):
-retvals.append(None)
+for pargs in partition(args, workers * 20):
 taskqueue.put(pargs)
 for _i in range(workers):
 t = Worker(taskqueue, resultqueue, func, staticargs)
@@ -331,9 +330,9 @@
 try:
 while len(threads) > 0:
 while not resultqueue.empty():
-(i, res) = resultqueue.get()
+   

D6580: tests: show bug in update introduced in 87a34c767384

2019-06-27 Thread valentin.gatienbaron (Valentin Gatien-Baron)
Closed by commit rHG64a873ca7135: tests: show bug in update introduced in 
87a34c767384 (authored by valentin.gatienbaron).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6580?vs=15668=15673

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

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

AFFECTED FILES
  tests/test-simple-update.t

CHANGE DETAILS

diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t
--- a/tests/test-simple-update.t
+++ b/tests/test-simple-update.t
@@ -109,6 +109,25 @@
   $ hg update -v | grep 100
   getting 100
   100 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg status
+  M 100
+  M 11
+  M 2
+  M 21
+  M 3
+  M 4
+  M 41
+  M 5
+  M 51
+  M 54
+  M 6
+  M 61
+  M 7
+  M 71
+  M 8
+  M 81
+  M 9
+  M 91
 
   $ cd ..
 



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


D6581: update: fix spurious unclean status bug shown by previous commit

2019-06-27 Thread martinvonz (Martin von Zweigbergk)
This revision is now accepted and ready to land.
martinvonz added a comment.
martinvonz accepted this revision.


  Thanks for fixing this quickly! The fix looks very straight-forward too.

REPOSITORY
  rHG Mercurial

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

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

To: valentin.gatienbaron, #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


Re: [PATCH evolve-ext] py3: broad pass for python3 compatibility

2019-06-27 Thread Ludovic Chabant

> We definitely want this patch, but we equally want a way to test (not
> just locally) that it keeps working. Maybe we can better coordinate the
> efforts in #hg-evolve.

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


D6395: rust-dirstate: call new "dirs" rust implementation from Python

2019-06-27 Thread Raphaël Gomès
Alphare updated this revision to Diff 15672.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6395?vs=15509=15672

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

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

AFFECTED FILES
  mercurial/util.py
  rust/hg-core/src/dirstate/dirs_multiset.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs 
b/rust/hg-core/src/dirstate/dirs_multiset.rs
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -118,7 +118,9 @@
 entry.remove();
 }
 Entry::Vacant(_) => {
-return Err(DirstateMapError::PathNotFound(path.to_owned()))
+return Err(DirstateMapError::PathNotFound(
+path.to_owned(),
+))
 }
 };
 
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -53,6 +53,8 @@
 stringutil,
 )
 
+rustdirs = policy.importrust('dirstate', 'Dirs')
+
 base85 = policy.importmod(r'base85')
 osutil = policy.importmod(r'osutil')
 parsers = policy.importmod(r'parsers')
@@ -3204,6 +3206,9 @@
 if safehasattr(parsers, 'dirs'):
 dirs = parsers.dirs
 
+if rustdirs is not None:
+dirs = rustdirs
+
 def finddirs(path):
 pos = path.rfind('/')
 while pos != -1:



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


D6393: rust-dirstate: add "dirs" Rust implementation

2019-06-27 Thread Raphaël Gomès
Alphare added a comment.


  In D6393#95768 , @kevincox wrote:
  
  > Sorry. I was busy. In general don't worry about blocking on me, I can't 
promise any sort of reasonable response time. Worst case I can review the 
changes after submission and changes can be made afterwards.
  
  Sure, no problem, thanks.
  I've also sneaked some `&[u8]` instead of `Vec` in my last update.

INLINE COMMENTS

> kevincox wrote in dirs_multiset.rs:43
> You can replate the nested if with:
> 
>   if skip_state == Some(state) {

Unless I'm missing something, this would render the `if` statement useless.

REPOSITORY
  rHG Mercurial

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

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

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


D6393: rust-dirstate: add "dirs" Rust implementation

2019-06-27 Thread Raphaël Gomès
Alphare marked an inline comment as done.
Alphare updated this revision to Diff 15670.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6393?vs=15508=15670

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

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

AFFECTED FILES
  rust/hg-core/src/dirstate/dirs_multiset.rs
  rust/hg-core/src/dirstate/mod.rs
  rust/hg-core/src/lib.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/lib.rs b/rust/hg-core/src/lib.rs
--- a/rust/hg-core/src/lib.rs
+++ b/rust/hg-core/src/lib.rs
@@ -15,8 +15,10 @@
 pub mod discovery;
 pub mod testing; // unconditionally built, for use from integration tests
 pub use dirstate::{
+dirs_multiset::DirsMultiset,
 parsers::{pack_dirstate, parse_dirstate},
-CopyVec, CopyVecEntry, DirstateEntry, DirstateParents, DirstateVec,
+CopyVec, CopyVecEntry, DirsIterable, DirstateEntry, DirstateParents,
+DirstateVec,
 };
 mod filepatterns;
 mod utils;
@@ -73,6 +75,12 @@
 BadSize(usize, usize),
 }
 
+#[derive(Debug, PartialEq)]
+pub enum DirstateMapError {
+PathNotFound(Vec),
+EmptyPath,
+}
+
 impl From for DirstatePackError {
 fn from(e: std::io::Error) -> Self {
 DirstatePackError::CorruptedEntry(e.to_string())
diff --git a/rust/hg-core/src/dirstate/mod.rs b/rust/hg-core/src/dirstate/mod.rs
--- a/rust/hg-core/src/dirstate/mod.rs
+++ b/rust/hg-core/src/dirstate/mod.rs
@@ -1,3 +1,4 @@
+pub mod dirs_multiset;
 pub mod parsers;
 
 #[derive(Debug, PartialEq, Copy, Clone)]
@@ -26,3 +27,10 @@
 }
 
 pub type CopyVec<'a> = Vec>;
+
+/// The Python implementation passes either a mapping (dirstate) or a flat
+/// iterable (manifest)
+pub enum DirsIterable {
+Dirstate(DirstateVec),
+Manifest(Vec>),
+}
diff --git a/rust/hg-core/src/dirstate/dirs_multiset.rs 
b/rust/hg-core/src/dirstate/dirs_multiset.rs
new file mode 100644
--- /dev/null
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs
@@ -0,0 +1,355 @@
+// dirs_multiset.rs
+//
+// Copyright 2019 Raphaël Gomès 
+//
+// This software may be used and distributed according to the terms of the
+// GNU General Public License version 2 or any later version.
+
+//! A multiset of directory names.
+//!
+//! Used to counts the references to directories in a manifest or dirstate.
+use std::collections::hash_map::Entry;
+use std::collections::HashMap;
+use std::ops::Deref;
+use {DirsIterable, DirstateEntry, DirstateMapError};
+
+#[derive(PartialEq, Debug)]
+pub struct DirsMultiset {
+inner: HashMap, u32>,
+}
+
+impl Deref for DirsMultiset {
+type Target = HashMap, u32>;
+
+fn deref() -> ::Target {
+
+}
+}
+
+impl DirsMultiset {
+/// Initializes the multiset from a dirstate or a manifest.
+///
+/// If `skip_state` is provided, skips dirstate entries with equal state.
+pub fn new(iterable: DirsIterable, skip_state: Option) -> Self {
+let mut multiset = DirsMultiset {
+inner: HashMap::new(),
+};
+
+match iterable {
+DirsIterable::Dirstate(vec) => {
+for (ref filename, DirstateEntry { state, .. }) in vec {
+// This `if` is optimized out of the loop
+if let Some(skip) = skip_state {
+if skip != state {
+multiset.add_path(filename);
+}
+} else {
+multiset.add_path(filename);
+}
+}
+}
+DirsIterable::Manifest(vec) => {
+for ref filename in vec {
+multiset.add_path(filename);
+}
+}
+}
+
+multiset
+}
+
+/// Returns the slice up to the next directory name from right to left,
+/// without trailing slash
+fn find_dir(path: &[u8]) -> &[u8] {
+let mut path = path;
+loop {
+if let Some(new_pos) = path.len().checked_sub(1) {
+if path[new_pos] == b'/' {
+break [..new_pos];
+}
+path = [..new_pos];
+} else {
+break &[];
+}
+}
+}
+
+/// Increases the count of deepest directory contained in the path.
+///
+/// If the directory is not yet in the map, adds its parents.
+pub fn add_path( self, path: &[u8]) {
+let mut pos = path.len();
+
+loop {
+let subpath = Self::find_dir([..pos]);
+if let Some(val) = self.inner.get_mut(subpath) {
+*val += 1;
+break;
+}
+self.inner.insert(subpath.to_owned(), 1);
+
+pos = subpath.len();
+if pos == 0 {
+break;
+}
+}
+}
+
+/// Decreases the count of deepest directory contained in the path.
+///
+/// If it is the only reference, decreases all parents until one is
+   

D6394: rust-dirstate: add "dirs" rust-cpython binding

2019-06-27 Thread Raphaël Gomès
Alphare updated this revision to Diff 15671.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6394?vs=15342=15671

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

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

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

CHANGE DETAILS

diff --git a/rust/hg-cpython/src/dirstate.rs b/rust/hg-cpython/src/dirstate.rs
--- a/rust/hg-cpython/src/dirstate.rs
+++ b/rust/hg-cpython/src/dirstate.rs
@@ -11,21 +11,25 @@
 //! From Python, this will be seen as `mercurial.rustext.dirstate`
 
 use cpython::{
-exc, PyBytes, PyDict, PyErr, PyInt, PyModule, PyObject, PyResult,
-PySequence, PythonObject, PyTuple, Python, ToPyObject,
+exc, ObjectProtocol, PyBytes, PyDict, PyErr, PyInt, PyModule, PyObject,
+PyResult, PySequence, PyTuple, Python, PythonObject, ToPyObject,
 };
 use hg::{
-pack_dirstate, parse_dirstate, CopyVecEntry, DirstateEntry,
-DirstatePackError, DirstateParents, DirstateParseError, DirstateVec,
+pack_dirstate, parse_dirstate, CopyVecEntry, DirsIterable, DirsMultiset,
+DirstateEntry, DirstateMapError, DirstatePackError, DirstateParents,
+DirstateParseError, DirstateVec,
 };
 use std::collections::HashMap;
 use std::ffi::CStr;
+
 #[cfg(feature = "python27")]
 extern crate python27_sys as python_sys;
 #[cfg(feature = "python3")]
 extern crate python3_sys as python_sys;
+
 use self::python_sys::PyCapsule_Import;
 use libc::{c_char, c_int};
+use std::cell::RefCell;
 use std::mem::transmute;
 
 /// C code uses a custom `dirstate_tuple` type, checks in multiple instances
@@ -102,20 +106,11 @@
 }
 }
 
-fn pack_dirstate_wrapper(
+fn extract_dirstate_vec(
 py: Python,
-dmap: PyDict,
-copymap: PyDict,
-pl: PyTuple,
-now: PyInt,
-) -> PyResult {
-let p1 = pl.get_item(py, 0).extract::(py)?;
-let p1: &[u8] = p1.data(py);
-let p2 = pl.get_item(py, 1).extract::(py)?;
-let p2: &[u8] = p2.data(py);
-
-let dirstate_vec: Result = dmap
-.items(py)
+dmap: ,
+) -> Result {
+dmap.items(py)
 .iter()
 .map(|(filename, stats)| {
 let stats = stats.extract::(py)?;
@@ -136,7 +131,22 @@
 },
 ))
 })
-.collect();
+.collect()
+}
+
+fn pack_dirstate_wrapper(
+py: Python,
+dmap: PyDict,
+copymap: PyDict,
+pl: PyTuple,
+now: PyInt,
+) -> PyResult {
+let p1 = pl.get_item(py, 0).extract::(py)?;
+let p1: &[u8] = p1.data(py);
+let p2 = pl.get_item(py, 1).extract::(py)?;
+let p2: &[u8] = p2.data(py);
+
+let dirstate_vec = extract_dirstate_vec(py, )?;
 
 let copies: Result, Vec>, PyErr> = copymap
 .items(py)
@@ -150,7 +160,7 @@
 .collect();
 
 match pack_dirstate(
-_vec?,
+_vec,
 ?,
 DirstateParents { p1, p2 },
 now.as_object().extract::(py)?,
@@ -170,7 +180,10 @@
 py,
 PyBytes::new(py, [..]),
 decapsule_make_dirstate_tuple(py)?(
-state as c_char, mode, size, mtime,
+state as c_char,
+mode,
+size,
+mtime,
 ),
 )?;
 }
@@ -191,10 +204,103 @@
 }
 }
 
+py_class!(pub class Dirs |py| {
+data dirs_map: RefCell;
+
+// `map` is either a `dict` or a flat iterator (usually a `set`, sometimes
+// a `list`)
+def __new__(
+_cls,
+map: PyObject,
+skip: Option = None
+) -> PyResult {
+let mut skip_state: Option = None;
+if let Some(skip) = skip {
+skip_state = Some(skip.extract::(py)?.data(py)[0] as i8);
+}
+let dirs_map;
+
+if let Ok(map) = map.cast_as::(py) {
+let dirstate_vec = extract_dirstate_vec(py, )?;
+dirs_map = DirsMultiset::new(
+DirsIterable::Dirstate(dirstate_vec),
+skip_state,
+)
+} else {
+let map: Result>, PyErr> = map
+.iter(py)?
+.map(|o| Ok(o?.extract::(py)?.data(py).to_owned()))
+.collect();
+dirs_map = DirsMultiset::new(
+DirsIterable::Manifest(map?),
+skip_state,
+)
+}
+
+Self::create_instance(py, RefCell::new(dirs_map))
+}
+
+def addpath(, path: PyObject) -> PyResult {
+self.dirs_map(py).borrow_mut().add_path(
+path.extract::(py)?.data(py),
+);
+Ok(py.None())
+}
+
+def delpath(, path: PyObject) -> PyResult {
+self.dirs_map(py).borrow_mut().delete_path(
+path.extract::(py)?.data(py),
+)
+.and(Ok(py.None()))
+.or_else(|e| {
+match e {
+DirstateMapError::PathNotFound(_p) => {
+  

D6581: update: fix spurious unclean status bug shown by previous commit

2019-06-27 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The crux of the problem is:
  
  - the dirstate is corrupted (the sizes/dates are assigned to the wrong files)
  - because when worker.worker is used with a return value (batchget in 
merge.py here), the return value when worker.worker effectively parallelizes is 
permuted
  - this is because worker.worker's partition of input and combination of 
output values are not inverses of one another: it split [1,2,3,4,5,6] into 
[[1,3,5],[2,4,6]], but combines that into [1,3,5,2,4,6].
  
  Given that worker.worker doesn't call its function argument on contiguous
  chunks on the input arguments, sticking with lists means we'd need to
  know the relation between the inputs of worker.worker function argument
  (for instance, requiring that every input element is mapped to exactly
  one output element). It seems better to instead switch return values to
  dicts, which can combined reliably with a straighforward restriction.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/merge.py
  mercurial/worker.py
  tests/test-simple-update.t

CHANGE DETAILS

diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t
--- a/tests/test-simple-update.t
+++ b/tests/test-simple-update.t
@@ -110,24 +110,6 @@
   getting 100
   100 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg status
-  M 100
-  M 11
-  M 2
-  M 21
-  M 3
-  M 4
-  M 41
-  M 5
-  M 51
-  M 54
-  M 6
-  M 61
-  M 7
-  M 71
-  M 8
-  M 81
-  M 9
-  M 91
 
   $ cd ..
 
diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -100,8 +100,9 @@
 workers
 
 hasretval - when True, func and the current function return an progress
-iterator then a list (encoded as an iterator that yield many (False, ..)
-then a (True, list)). The resulting list is in the natural order.
+iterator then a dict (encoded as an iterator that yield many (False, ..)
+then a (True, dict)). The dicts are joined in some arbitrary order, so
+overlapping keys are a bad idea.
 
 threadsafe - whether work items are thread safe and can be executed using
 a thread-based worker. Should be disabled for CPU heavy tasks that don't
@@ -162,8 +163,8 @@
 ui.flush()
 parentpid = os.getpid()
 pipes = []
-retvals = []
-for i, pargs in enumerate(partition(args, workers)):
+retval = {}
+for pargs in partition(args, workers):
 # Every worker gets its own pipe to send results on, so we don't have 
to
 # implement atomic writes larger than PIPE_BUF. Each forked process has
 # its own pipe's descriptors in the local variables, and the parent
@@ -171,7 +172,6 @@
 # care what order they're in).
 rfd, wfd = os.pipe()
 pipes.append((rfd, wfd))
-retvals.append(None)
 # make sure we use os._exit in all worker code paths. otherwise the
 # worker may do some clean-ups which could cause surprises like
 # deadlock. see sshpeer.cleanup for example.
@@ -192,7 +192,7 @@
 os.close(w)
 os.close(rfd)
 for result in func(*(staticargs + (pargs,))):
-os.write(wfd, util.pickle.dumps((i, result)))
+os.write(wfd, util.pickle.dumps(result))
 return 0
 
 ret = scmutil.callcatch(ui, workerfunc)
@@ -226,9 +226,9 @@
 while openpipes > 0:
 for key, events in selector.select():
 try:
-i, res = util.pickle.load(key.fileobj)
+res = util.pickle.load(key.fileobj)
 if hasretval and res[0]:
-retvals[i] = res[1]
+retval.update(res[1])
 else:
 yield res
 except EOFError:
@@ -249,7 +249,7 @@
 os.kill(os.getpid(), -status)
 sys.exit(status)
 if hasretval:
-yield True, sum(retvals, [])
+yield True, retval
 
 def _posixexitstatus(code):
 '''convert a posix exit status into the same form returned by
@@ -281,9 +281,9 @@
 try:
 while not self._taskqueue.empty():
 try:
-i, args = self._taskqueue.get_nowait()
+args = self._taskqueue.get_nowait()
 for res in self._func(*self._staticargs + (args,)):
-self._resultqueue.put((i, res))
+self._resultqueue.put(res)
 # threading doesn't provide a native way to
 # interrupt execution. handle it manually at every
 # iteration.
@@ -318,11 +318,10 @@
 

D6580: tests: show bug in update introduced in 87a34c767384

2019-06-27 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As reported by Martin at https://phab.mercurial-scm.org/D6475.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-simple-update.t

CHANGE DETAILS

diff --git a/tests/test-simple-update.t b/tests/test-simple-update.t
--- a/tests/test-simple-update.t
+++ b/tests/test-simple-update.t
@@ -109,6 +109,25 @@
   $ hg update -v | grep 100
   getting 100
   100 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg status
+  M 100
+  M 11
+  M 2
+  M 21
+  M 3
+  M 4
+  M 41
+  M 5
+  M 51
+  M 54
+  M 6
+  M 61
+  M 7
+  M 71
+  M 8
+  M 81
+  M 9
+  M 91
 
   $ cd ..
 



To: valentin.gatienbaron, #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 evolve-ext] py3: broad pass for python3 compatibility

2019-06-27 Thread Anton Shestakov
On Wed, 26 Jun 2019 15:55:50 -0700
"Ludovic Chabant"  wrote:

> Should I re-create the patch on the latest evolve stable now? Or will someone 
> else do it? 
> I'm asking because py3 support is blocking a few things for sourcehut.
> Thanks!

Personally, I thought you all would discuss py3 efforts and testing
plan for evolve on the conference in Paris. Not sure if any of that took
place, but if not, you need to, indeed, redo this patch and then nag
Pierre-Yves to queue it and set up evolve-py3 on octobus-ci jenkins,
preferably all at the same time.

We definitely want this patch, but we equally want a way to test (not
just locally) that it keeps working. Maybe we can better coordinate the
efforts in #hg-evolve.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6475: merge: fix race that could cause wrong size in dirstate

2019-06-27 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron added a comment.


  In D6475#95879 , @martinvonz 
wrote:
  
  > In D6475#95878 , @martinvonz 
wrote:
  >
  >> Try this:
  >> `hg co -C 4.9; hg debugrebuilddirstate; hg co 5.0; hg st`
  >> Before this patch, that produced an empty output as it should. After this 
patch, it lists hundreds of modified files (536 to be specific). A workaround 
is to add `--config worker.enabled=no`. Can you look into it? It's obviously a 
pretty serious bug that needs to be fixed before we release a new version.
  >
  > I forgot to say that what seems wrong in the dirstate is the size (probably 
other fields too, but size is probably the important one).
  
  Oops. I looked and the problem is clearly that the size/lstat for the 
dirstate are getting swapped between files, when over the parallelism 
threshold. I thought worker.py would split input arguments [0,1,2,3,4,5] into 
[[0,1,2], [3,4,5]] but it's actually [[0,2,4], [1,3,5]], so the lists of 
results are jumbled with parallelization.

REPOSITORY
  rHG Mercurial

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

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

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