Re: [PATCH 1 of 2] windows: add a method to convert Unix style command lines to Windows style

2018-06-28 Thread Matt Harbison

On Thu, 28 Jun 2018 07:49:42 -0400, Yuya Nishihara  wrote:


On Wed, 27 Jun 2018 08:44:26 -0400, Matt Harbison wrote:

# HG changeset patch
# User Matt Harbison 
# Date 1529817189 14400
#  Sun Jun 24 01:13:09 2018 -0400
# Node ID 7ac9de5a8826fc95864ee4ba844eb8b5c9e71332
# Parent  2c2e82469b8915c8153979cd89a970b7317f882d
windows: add a method to convert Unix style command lines to Windows  
style


Queued, thanks.

+elif c == b'\\' and index + 1 < pathlen and path[index + 1] ==  
b'$':

+# Skip '\', but only if it is escaping $
+res += b'$'
+index += 1


\-escape might be confusing since \ is the directory separator on  
Windows, and a hook command is likely to contain backslashes.


Ugh.  I didn't even think about that, though I don't think path components  
starting with '$' are that common.


Thinking about this a bit more...

  - Maybe we should drop $$ -> $ too, since that's not what a Unix shell  
would do, and the point of this is portability.
  - Escaped '$' is a problem for hg -> cmd.exe -> sh.exe.  Consider `hook  
= echo \$var` in the config file.  This gets passed to cmd.exe as `echo  
$var`, but that doesn't change if something other than sh.exe runs.
  - I think translating `'` to `"` is the most useful thing to do, but  
that runs into the same problem.


What do you think?  Do we need an experimental knob to turn this off?  I'm  
assuming sh.exe is rare, and there aren't a whole lot of ways to hit this  
in practice.  I'd prefer it does the sensible thing out of the box.

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


[PATCH] procutil: add a shim for translating shell commands to native commands

2018-06-28 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1530238988 14400
#  Thu Jun 28 22:23:08 2018 -0400
# Node ID 72286f9e324f359d6090ae78883428adc97037cc
# Parent  5d88fd1bc2af0af02129f0ad2b267d778349d95a
procutil: add a shim for translating shell commands to native commands

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -139,9 +139,7 @@ def _exthook(ui, repo, htype, name, cmd,
 v = stringutil.pprint(v)
 env['HG_' + k.upper()] = v
 
-if pycompat.iswindows:
-environ = procutil.shellenviron(env)
-cmd = util.platform.shelltocmdexe(cmd, environ)
+cmd = procutil.shelltonative(cmd, env)
 
 ui.note(_("running hook %s: %s\n") % (name, cmd))
 
diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -317,6 +317,13 @@ def shellenviron(environ=None):
 env['HG'] = hgexecutable()
 return env
 
+if pycompat.iswindows:
+def shelltonative(cmd, env):
+return platform.shelltocmdexe(cmd, shellenviron(env))
+else:
+def shelltonative(cmd, env):
+return cmd
+
 def system(cmd, environ=None, cwd=None, out=None):
 '''enhanced shell command execution.
 run with environment maybe modified, maybe in different dir.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3859: unlinkpath: make empty directory removal optional (issue5901) (issue5826)

2018-06-28 Thread spectral (Kyle Lippincott)
spectral marked an inline comment as done.
spectral added a comment.


  (Tests pass on my mac as well)

REPOSITORY
  rHG Mercurial

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

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


D3859: unlinkpath: make empty directory removal optional (issue5901) (issue5826)

2018-06-28 Thread spectral (Kyle Lippincott)
spectral added inline comments.

INLINE COMMENTS

> test-removeemptydirs.t:125
> +error or no files listed
> +#if linuxormacos
> +  $ isfile foo

I'm rather uncertain about this, but there's no generic 'linux' in hghave at 
the moment; I'm testing on my mac now.

REPOSITORY
  rHG Mercurial

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

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


D3859: unlinkpath: make empty directory removal optional (issue5901) (issue5826)

2018-06-28 Thread spectral (Kyle Lippincott)
spectral updated this revision to Diff 9351.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3859?vs=9350=9351

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/configitems.py
  mercurial/context.py
  mercurial/patch.py
  mercurial/util.py
  mercurial/vfs.py
  tests/test-removeemptydirs.t

CHANGE DETAILS

diff --git a/tests/test-removeemptydirs.t b/tests/test-removeemptydirs.t
new file mode 100644
--- /dev/null
+++ b/tests/test-removeemptydirs.t
@@ -0,0 +1,243 @@
+Tests for experimental.removeemptydirs
+
+  $ NO_RM=--config=experimental.removeemptydirs=0
+  $ isdir() { if [[ -d $1 ]]; then echo yes; else echo no; fi }
+  $ isfile() { if [[ -f $1 ]]; then echo yes; else echo no; fi }
+
+`hg rm` of the last file in a directory:
+  $ hg init hgrm
+  $ cd hgrm
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm foo
+  $ isdir somedir
+  yes
+  $ hg rm somedir/foo
+  $ isdir somedir
+  no
+  $ hg revert -qa
+  $ isdir somedir
+  yes
+  $ hg $NO_RM rm somedir/foo
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+`hg mv` of the last file in a directory:
+  $ hg init hgmv
+  $ cd hgmv
+  $ mkdir somedir
+  $ mkdir destdir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm foo
+  $ isdir somedir
+  yes
+  $ hg mv somedir/foo destdir/foo
+  $ isdir somedir
+  no
+  $ hg revert -qa
+(revert doesn't get rid of destdir/foo?)
+  $ rm destdir/foo
+  $ isdir somedir
+  yes
+  $ hg $NO_RM mv somedir/foo destdir/foo
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+Updating to a commit that doesn't have the directory:
+  $ hg init hgupdate
+  $ cd hgupdate
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm r1
+  $ isdir somedir
+  yes
+  $ hg co -q -r ".^"
+  $ isdir somedir
+  no
+  $ hg co -q tip
+  $ isdir somedir
+  yes
+  $ hg $NO_RM co -q -r ".^"
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+Rebasing across a commit that doesn't have the directory, from inside the
+directory:
+  $ hg init hgrebase
+  $ cd hgrebase
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm first_rebase_source
+  $ hg $NO_RM co -q -r ".^"
+  $ echo hi > somedir/bar
+  $ hg ci -qAm first_rebase_dest
+  $ hg $NO_RM co -q -r ".^"
+  $ echo hi > somedir/baz
+  $ hg ci -qAm second_rebase_dest
+  $ hg co -qr 'desc(first_rebase_source)'
+  $ cd $TESTTMP/hgrebase/somedir
+  $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
+  current directory was removed
+  (consider changing to repo root: $TESTTMP/hgrebase)
+  $ cd $TESTTMP/hgrebase/somedir
+(The current node is the rebased first_rebase_source on top of
+first_rebase_dest)
+This should not output anything about current directory being removed:
+  $ hg $NO_RM --config extensions.rebase= rebase -qr . -d 
'desc(second_rebase_dest)'
+  $ cd $TESTTMP
+
+Histediting across a commit that doesn't have the directory, from inside the
+directory (reordering nodes):
+  $ hg init hghistedit
+  $ cd hghistedit
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ echo hi > r1
+  $ hg ci -qAm r1
+  $ echo hi > r2
+  $ hg ci -qAm r2
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm migrating_revision
+  $ cat > histedit_commands < pick 89079fab8aee 0 r0
+  > pick e6d271df3142 1 r1
+  > pick 89e25aa83f0f 3 migrating_revision
+  > pick b550aa12d873 2 r2
+  > EOF
+  $ cd $TESTTMP/hghistedit/somedir
+  $ hg --config extensions.histedit= histedit -q --commands 
../histedit_commands
+
+histedit doesn't output anything when the current diretory is removed. We rely
+on the tests being commonly run on machines where the current directory
+disappearing from underneath us actually has an observable effect, such as an
+error or no files listed
+#if linuxormacos
+  $ isfile foo
+  no
+#endif
+  $ cd $TESTTMP/hghistedit/somedir
+  $ isfile foo
+  yes
+
+  $ cd $TESTTMP/hghistedit
+  $ cat > histedit_commands < pick 89079fab8aee 0 r0
+  > pick 7c7a22c6009f 3 migrating_revision
+  > pick e6d271df3142 1 r1
+  > pick 40a53c2d4276 2 r2
+  > EOF
+  $ cd $TESTTMP/hghistedit/somedir
+  $ hg $NO_RM --config extensions.histedit= histedit -q --commands 
../histedit_commands
+Regardless of system, we should always get a 'yes' here.
+  $ isfile foo
+  yes
+  $ cd $TESTTMP
+
+This is essentially the exact test from issue5826, just cleaned up a little:
+
+  $ hg init issue5826_withrm
+  $ cd issue5826_withrm
+
+  $ cat >> $HGRCPATH < [extensions]
+  > histedit =
+  > EOF
+Commit three revisions that each create a directory:
+
+  $ mkdir foo
+  $ touch foo/bar
+  $ hg commit -qAm "add foo"
+
+  $ mkdir bar
+  $ touch bar/bar
+  $ hg commit -qAm "add bar"
+
+  $ mkdir baz
+  $ touch baz/bar
+  $ hg commit -qAm "add baz"
+
+Enter the first directory:
+
+  $ cd foo
+
+Histedit doing 'pick, pick, fold':
+
+  $ hg histedit --commands /dev/stdin < pick 6274c77c93c3 1 add bar
+  > pick 

D3858: unlinkpath: make empty directory removal optional (issue5901) (issue5826)

2018-06-28 Thread spectral (Kyle Lippincott)
spectral abandoned this revision.
spectral added a comment.


  (Sorry for the double send)

REPOSITORY
  rHG Mercurial

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

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


D3858: unlinkpath: make empty directory removal optional (issue5901) (issue5826)

2018-06-28 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  There are known cases where performing operations such as rebase from a
  directory that is newly created can fail or at least lead to being in a
  directory handle that no longer exists.
  
  This is even reproducible by just doing something as simple as:
  
cd foo; hg rm *
  
  The behavior is different if you use `hg addremove`, the directory is not
  removed until we attempt to go back to the node after committing it:
  
cd foo; rm *; hg addremove; hg ci -m'bye foo'; hg co .^; hg co tip

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/configitems.py
  mercurial/context.py
  mercurial/patch.py
  mercurial/util.py
  mercurial/vfs.py
  tests/test-removeemptydirs.t

CHANGE DETAILS

diff --git a/tests/test-removeemptydirs.t b/tests/test-removeemptydirs.t
new file mode 100644
--- /dev/null
+++ b/tests/test-removeemptydirs.t
@@ -0,0 +1,145 @@
+Tests for experimental.removeemptydirs
+
+  $ NO_RM=--config=experimental.removeemptydirs=0
+  $ isdir() { if [[ -d $1 ]]; then echo yes; else echo no; fi }
+  $ isfile() { if [[ -f $1 ]]; then echo yes; else echo no; fi }
+
+`hg rm` of the last file in a directory:
+  $ hg init hgrm
+  $ cd hgrm
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm foo
+  $ isdir somedir
+  yes
+  $ hg rm somedir/foo
+  $ isdir somedir
+  no
+  $ hg revert -qa
+  $ isdir somedir
+  yes
+  $ hg $NO_RM rm somedir/foo
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+`hg mv` of the last file in a directory:
+  $ hg init hgmv
+  $ cd hgmv
+  $ mkdir somedir
+  $ mkdir destdir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm foo
+  $ isdir somedir
+  yes
+  $ hg mv somedir/foo destdir/foo
+  $ isdir somedir
+  no
+  $ hg revert -qa
+(revert doesn't get rid of destdir/foo?)
+  $ rm destdir/foo
+  $ isdir somedir
+  yes
+  $ hg $NO_RM mv somedir/foo destdir/foo
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+Updating to a commit that doesn't have the directory:
+  $ hg init hgupdate
+  $ cd hgupdate
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm r1
+  $ isdir somedir
+  yes
+  $ hg co -q -r ".^"
+  $ isdir somedir
+  no
+  $ hg co -q tip
+  $ isdir somedir
+  yes
+  $ hg $NO_RM co -q -r ".^"
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+Rebasing across a commit that doesn't have the directory, from inside the
+directory:
+  $ hg init hgrebase
+  $ cd hgrebase
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm first_rebase_source
+  $ hg $NO_RM co -q -r ".^"
+  $ echo hi > somedir/bar
+  $ hg ci -qAm first_rebase_dest
+  $ hg $NO_RM co -q -r ".^"
+  $ echo hi > somedir/baz
+  $ hg ci -qAm second_rebase_dest
+  $ hg co -qr 'desc(first_rebase_source)'
+  $ cd $TESTTMP/hgrebase/somedir
+  $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
+  current directory was removed
+  (consider changing to repo root: $TESTTMP/hgrebase)
+  $ cd $TESTTMP/hgrebase/somedir
+(The current node is the rebased first_rebase_source on top of
+first_rebase_dest)
+This should not output anything about current directory being removed:
+  $ hg $NO_RM --config extensions.rebase= rebase -qr . -d 
'desc(second_rebase_dest)'
+  $ cd $TESTTMP
+
+Histediting across a commit that doesn't have the directory, from inside the
+directory (reordering nodes):
+  $ hg init hghistedit
+  $ cd hghistedit
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ echo hi > r1
+  $ hg ci -qAm r1
+  $ echo hi > r2
+  $ hg ci -qAm r2
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm migrating_revision
+  $ cat > histedit_commands < pick 89079fab8aee 0 r0
+  > pick e6d271df3142 1 r1
+  > pick 89e25aa83f0f 3 migrating_revision
+  > pick b550aa12d873 2 r2
+  > EOF
+  $ cd $TESTTMP/hghistedit/somedir
+  $ hg --config extensions.histedit= histedit -q --commands 
../histedit_commands
+
+histedit doesn't output anything when the current diretory is removed. We rely
+on the tests being commonly run on machines where the current directory
+disappearing from underneath us actually has an observable effect, such as an
+error or no files listed
+#if linuxormacos
+  $ isfile foo
+  no
+#endif
+  $ cd $TESTTMP/hghistedit/somedir
+  $ isfile foo
+  yes
+
+  $ cd $TESTTMP/hghistedit
+  $ cat > histedit_commands < pick 89079fab8aee 0 r0
+  > pick 7c7a22c6009f 3 migrating_revision
+  > pick e6d271df3142 1 r1
+  > pick 40a53c2d4276 2 r2
+  > EOF
+  $ cd $TESTTMP/hghistedit/somedir
+  $ hg $NO_RM --config extensions.histedit= histedit -q --commands 
../histedit_commands
+Regardless of system, we should always get a 'yes' here.
+  $ isfile foo
+  yes
+  $ cd $TESTTMP
diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -246,8 

D3859: unlinkpath: make empty directory removal optional (issue5901) (issue5826)

2018-06-28 Thread spectral (Kyle Lippincott)
spectral created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  There are known cases where performing operations such as rebase from a
  directory that is newly created can fail or at least lead to being in a
  directory handle that no longer exists.
  
  This is even reproducible by just doing something as simple as:
  
cd foo; hg rm *
  
  The behavior is different if you use `hg addremove`, the directory is not
  removed until we attempt to go back to the node after committing it:
  
cd foo; rm *; hg addremove; hg ci -m'bye foo'; hg co .^; hg co tip

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/configitems.py
  mercurial/context.py
  mercurial/patch.py
  mercurial/util.py
  mercurial/vfs.py
  tests/test-removeemptydirs.t

CHANGE DETAILS

diff --git a/tests/test-removeemptydirs.t b/tests/test-removeemptydirs.t
new file mode 100644
--- /dev/null
+++ b/tests/test-removeemptydirs.t
@@ -0,0 +1,145 @@
+Tests for experimental.removeemptydirs
+
+  $ NO_RM=--config=experimental.removeemptydirs=0
+  $ isdir() { if [[ -d $1 ]]; then echo yes; else echo no; fi }
+  $ isfile() { if [[ -f $1 ]]; then echo yes; else echo no; fi }
+
+`hg rm` of the last file in a directory:
+  $ hg init hgrm
+  $ cd hgrm
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm foo
+  $ isdir somedir
+  yes
+  $ hg rm somedir/foo
+  $ isdir somedir
+  no
+  $ hg revert -qa
+  $ isdir somedir
+  yes
+  $ hg $NO_RM rm somedir/foo
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+`hg mv` of the last file in a directory:
+  $ hg init hgmv
+  $ cd hgmv
+  $ mkdir somedir
+  $ mkdir destdir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm foo
+  $ isdir somedir
+  yes
+  $ hg mv somedir/foo destdir/foo
+  $ isdir somedir
+  no
+  $ hg revert -qa
+(revert doesn't get rid of destdir/foo?)
+  $ rm destdir/foo
+  $ isdir somedir
+  yes
+  $ hg $NO_RM mv somedir/foo destdir/foo
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+Updating to a commit that doesn't have the directory:
+  $ hg init hgupdate
+  $ cd hgupdate
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm r1
+  $ isdir somedir
+  yes
+  $ hg co -q -r ".^"
+  $ isdir somedir
+  no
+  $ hg co -q tip
+  $ isdir somedir
+  yes
+  $ hg $NO_RM co -q -r ".^"
+  $ isdir somedir
+  yes
+  $ ls somedir
+  $ cd $TESTTMP
+
+Rebasing across a commit that doesn't have the directory, from inside the
+directory:
+  $ hg init hgrebase
+  $ cd hgrebase
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm first_rebase_source
+  $ hg $NO_RM co -q -r ".^"
+  $ echo hi > somedir/bar
+  $ hg ci -qAm first_rebase_dest
+  $ hg $NO_RM co -q -r ".^"
+  $ echo hi > somedir/baz
+  $ hg ci -qAm second_rebase_dest
+  $ hg co -qr 'desc(first_rebase_source)'
+  $ cd $TESTTMP/hgrebase/somedir
+  $ hg --config extensions.rebase= rebase -qr . -d 'desc(first_rebase_dest)'
+  current directory was removed
+  (consider changing to repo root: $TESTTMP/hgrebase)
+  $ cd $TESTTMP/hgrebase/somedir
+(The current node is the rebased first_rebase_source on top of
+first_rebase_dest)
+This should not output anything about current directory being removed:
+  $ hg $NO_RM --config extensions.rebase= rebase -qr . -d 
'desc(second_rebase_dest)'
+  $ cd $TESTTMP
+
+Histediting across a commit that doesn't have the directory, from inside the
+directory (reordering nodes):
+  $ hg init hghistedit
+  $ cd hghistedit
+  $ echo hi > r0
+  $ hg ci -qAm r0
+  $ echo hi > r1
+  $ hg ci -qAm r1
+  $ echo hi > r2
+  $ hg ci -qAm r2
+  $ mkdir somedir
+  $ echo hi > somedir/foo
+  $ hg ci -qAm migrating_revision
+  $ cat > histedit_commands < pick 89079fab8aee 0 r0
+  > pick e6d271df3142 1 r1
+  > pick 89e25aa83f0f 3 migrating_revision
+  > pick b550aa12d873 2 r2
+  > EOF
+  $ cd $TESTTMP/hghistedit/somedir
+  $ hg --config extensions.histedit= histedit -q --commands 
../histedit_commands
+
+histedit doesn't output anything when the current diretory is removed. We rely
+on the tests being commonly run on machines where the current directory
+disappearing from underneath us actually has an observable effect, such as an
+error or no files listed
+#if linuxormacos
+  $ isfile foo
+  no
+#endif
+  $ cd $TESTTMP/hghistedit/somedir
+  $ isfile foo
+  yes
+
+  $ cd $TESTTMP/hghistedit
+  $ cat > histedit_commands < pick 89079fab8aee 0 r0
+  > pick 7c7a22c6009f 3 migrating_revision
+  > pick e6d271df3142 1 r1
+  > pick 40a53c2d4276 2 r2
+  > EOF
+  $ cd $TESTTMP/hghistedit/somedir
+  $ hg $NO_RM --config extensions.histedit= histedit -q --commands 
../histedit_commands
+Regardless of system, we should always get a 'yes' here.
+  $ isfile foo
+  yes
+  $ cd $TESTTMP
diff --git a/mercurial/vfs.py b/mercurial/vfs.py
--- a/mercurial/vfs.py
+++ b/mercurial/vfs.py
@@ -246,8 

mercurial@38490: 4 new changesets

2018-06-28 Thread Mercurial Commits
4 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/8d9d0d30cfcc
changeset:   38487:8d9d0d30cfcc
user:Sangeet Kumar Mishra 
date:Thu Jun 28 23:21:55 2018 +0530
summary: grep: deprecates `--all` flag

https://www.mercurial-scm.org/repo/hg/rev/b23ef2f06d98
changeset:   38488:b23ef2f06d98
user:Yuya Nishihara 
date:Sat Jun 16 23:12:41 2018 +0900
summary: revset: remove orphan i18n comment from ancestor()

https://www.mercurial-scm.org/repo/hg/rev/626d29c6e987
changeset:   38489:626d29c6e987
user:Yuya Nishihara 
date:Sat Jun 16 23:21:47 2018 +0900
summary: revset: leverage orset() to flatten ancestor() arguments

https://www.mercurial-scm.org/repo/hg/rev/5d88fd1bc2af
changeset:   38490:5d88fd1bc2af
bookmark:@
tag: tip
user:Yuya Nishihara 
date:Sat Jun 16 23:26:40 2018 +0900
summary: revset: move lookup of first ancestor() candidate out of the loop

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


mercurial@38486: 10 new changesets

2018-06-28 Thread Mercurial Commits
10 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/de275ab362cb
changeset:   38477:de275ab362cb
user:Augie Fackler 
date:Wed Jun 27 10:21:07 2018 -0400
summary: stringutil: update list of re-special characters to include &~

https://www.mercurial-scm.org/repo/hg/rev/b2d5ad03f31a
changeset:   38478:b2d5ad03f31a
user:Yuya Nishihara 
date:Wed Jun 27 23:33:57 2018 +0900
summary: test-revset: show that order of heads() can be wrong

https://www.mercurial-scm.org/repo/hg/rev/72621094505f
changeset:   38479:72621094505f
user:Yuya Nishihara 
date:Wed Jun 27 23:39:41 2018 +0900
summary: revset: fix heads() order to always follow the input set (BC)

https://www.mercurial-scm.org/repo/hg/rev/ecaa0ad4ed4f
changeset:   38480:ecaa0ad4ed4f
user:Martin von Zweigbergk 
date:Wed Jun 27 07:19:30 2018 -0700
summary: tests: pass "rev" argument to commands.update() as string

https://www.mercurial-scm.org/repo/hg/rev/a8872a820242
changeset:   38481:a8872a820242
user:Anton Shestakov 
date:Thu Jun 28 07:41:08 2018 +0800
summary: hgweb: add z-index for search field tooltip

https://www.mercurial-scm.org/repo/hg/rev/5faaa31a6082
changeset:   38482:5faaa31a6082
user:Anton Shestakov 
date:Thu Jun 28 10:50:53 2018 +0800
summary: hgweb: add archive entries to graph page

https://www.mercurial-scm.org/repo/hg/rev/3efadf2317c7
changeset:   38483:3efadf2317c7
user:Matt Harbison 
date:Sun Jun 24 01:13:09 2018 -0400
summary: windows: add a method to convert Unix style command lines to 
Windows style

https://www.mercurial-scm.org/repo/hg/rev/e9e61fbac787
changeset:   38484:e9e61fbac787
user:Matt Harbison 
date:Sun Jul 02 00:32:09 2017 -0400
summary: hooks: allow Unix style environment variables on external Windows 
hooks

https://www.mercurial-scm.org/repo/hg/rev/56b2074114b1
changeset:   38485:56b2074114b1
user:Sushil khanchi 
date:Wed Jun 27 12:24:21 2018 +0530
summary: rebase: refactor dryrun implementation

https://www.mercurial-scm.org/repo/hg/rev/4c0683655599
changeset:   38486:4c0683655599
bookmark:@
tag: tip
user:Martin von Zweigbergk 
date:Tue Jun 26 10:02:01 2018 -0700
summary: namespaces: let namespaces override singlenode() definition

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


Re: [PATCH 3 of 3] revset: move lookup of first ancestor() candidate out of the loop

2018-06-28 Thread Martin von Zweigbergk via Mercurial-devel
On Thu, Jun 28, 2018 at 6:43 AM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1529159200 -32400
> #  Sat Jun 16 23:26:40 2018 +0900
> # Node ID 0005175b53bb3f829578757c1c34eab60c7c42a8
> # Parent  fe4560fa5db2f1ee11cff233c55b7685e891517a
> revset: move lookup of first ancestor() candidate out of the loop
>

Queuing this series, thanks.

What's the motivation for this patch? Does it make some case faster or did
you just not like the condition inside the loop?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3639: remotenames: add paths argument to remotenames revset

2018-06-28 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D3639#60108, @yuja wrote:
  
  > > +@revsetpredicate('remotenames([path, ...])')
  >
  > My proposal was `remotenames([pattern])`, just like bookmark(), tag(),
  >  branch(), etc.
  >  If we want a convenient way to specify path prefix, we can
  >  add it to the stringmatcher (e.g. 'remotenames("path:server2")'.)
  
  
  No, I don't want to specify a path prefix. remotenames() will take a path 
only. Do you want to say that we should allow passing full remotenames instead 
of just path?

REPOSITORY
  rHG Mercurial

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

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


D3764: rebase: improve output of --dry-run

2018-06-28 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9348.
khanchi97 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3764?vs=9268=9348

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

AFFECTED FILES
  hgext/rebase.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
@@ -208,10 +208,11 @@
 
 Check dryrun gives correct results when there is no conflict in rebasing
   $ hg rebase -s 2 -d 6 -n
+  starting dry-run rebase; repository will not bechanged
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
   $ hg diff
   $ hg status
@@ -240,10 +241,11 @@
   
 Check dryrun working with --collapse when there is no conflict
   $ hg rebase -s 2 -d 6 -n --collapse
+  starting dry-run rebase; repository will not bechanged
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
-  there will be no conflict, you can rebase
+  dry-run rebase completed successfully; run without -n/--dry-run to perform 
this rebase
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -276,6 +278,7 @@
  a
   
   $ hg rebase -s 2 -d 7 -n
+  starting dry-run rebase; repository will not bechanged
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
@@ -311,6 +314,7 @@
   
 Check dryrun working with --collapse when there is conflicts
   $ hg rebase -s 2 -d 7 -n --collapse
+  starting dry-run rebase; repository will not bechanged
   rebasing 2:177f92b77385 "c"
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -820,14 +820,18 @@
 
 if dryrun:
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+ui.status(_('starting dry-run rebase; repository will not be'
+'changed\n'))
+
 with repo.wlock(), repo.lock():
 try:
 _dryrunrebase(ui, repo, rbsrt, **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 return 1
 else:
-ui.status(_('there will be no conflict, you can rebase\n'))
+ui.status(_('dry-run rebase completed successfully; run 
without'
+' -n/--dry-run to perform this rebase\n'))
 return 0
 finally:
 # no need to store back in case of dry-run



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


D3830: rebase: suppress transaction warns during dry-run

2018-06-28 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9347.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3830?vs=9269=9347

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

AFFECTED FILES
  hgext/rebase.py
  mercurial/localrepo.py
  mercurial/transaction.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
@@ -280,8 +280,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   merging e
-  transaction abort!
-  rollback completed
   hit a merge conflict
   [1]
   $ hg diff
diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -105,7 +105,7 @@
 class transaction(util.transactional):
 def __init__(self, report, opener, vfsmap, journalname, undoname=None,
  after=None, createmode=None, validator=None, releasefn=None,
- checkambigfiles=None, name=r''):
+ checkambigfiles=None, name=r'', suppwarns=False):
 """Begin a new transaction
 
 Begins a new transaction that allows rolling back writes in the event 
of
@@ -133,6 +133,7 @@
 self.map = {}
 self.journal = journalname
 self.undoname = undoname
+self.suppwarns = suppwarns
 self._queue = []
 # A callback to validate transaction content before closing it.
 # should raise exception is anything is wrong.
@@ -570,7 +571,8 @@
 self.opener.unlink(self.journal)
 return
 
-self.report(_("transaction abort!\n"))
+if not self.suppwarns:
+self.report(_("transaction abort!\n"))
 
 try:
 for cat in sorted(self._abortcallback):
@@ -580,7 +582,8 @@
 _playback(self.journal, self.report, self.opener, self._vfsmap,
   self.entries, self._backupentries, False,
   checkambigfiles=self.checkambigfiles)
-self.report(_("rollback completed\n"))
+if not self.suppwarns:
+self.report(_("rollback completed\n"))
 except BaseException:
 self.report(_("rollback failed - please run hg recover\n"))
 finally:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -1224,7 +1224,7 @@
 return tr
 return None
 
-def transaction(self, desc, report=None):
+def transaction(self, desc, report=None, supptrwarns=False):
 if (self.ui.configbool('devel', 'all-warnings')
 or self.ui.configbool('devel', 'check-locks')):
 if self._currentlock(self._lockref) is None:
@@ -1371,7 +1371,8 @@
  validator=validate,
  releasefn=releasefn,
  checkambigfiles=_cachedfiles,
- name=desc)
+ name=desc,
+ suppwarns=supptrwarns)
 tr.changes['revs'] = xrange(0, 0)
 tr.changes['obsmarkers'] = set()
 tr.changes['phases'] = {}
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -852,14 +852,15 @@
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
 return _origrebase(ui, repo, rbsrt, inmemory=True, 
leaveunfinished=True,
-   **opts)
+   supptrwarns=True, **opts)
 
 def _dorebase(ui, repo, inmemory=False, **opts):
 opts = pycompat.byteskwargs(opts)
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 return _origrebase(ui, repo, rbsrt, inmemory=inmemory, **opts)
 
-def _origrebase(ui, repo, rbsrt, inmemory=False, leaveunfinished=False, 
**opts):
+def _origrebase(ui, repo, rbsrt, inmemory=False, leaveunfinished=False,
+supptrwarns=False, **opts):
 with repo.wlock(), repo.lock():
 # Validate input and define rebasing points
 destf = opts.get('dest', None)
@@ -916,7 +917,7 @@
 
 singletr = ui.configbool('rebase', 'singletransaction')
 if singletr:
-tr = repo.transaction('rebase')
+tr = repo.transaction('rebase', supptrwarns=supptrwarns)
 
 # If `rebase.singletransaction` is enabled, wrap the entire operation 
in
 # one transaction here. Otherwise, transactions are obtained when



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


D3857: rebase: suppress warning thrown when aborting rebase in case of dryrun

2018-06-28 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch dryrun output contained "rebase aborted" every
  time we run rebase in dryrun mode and this warning does not sound
  safe from a user prespective.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.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
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  rebase aborted
 
   $ hg diff
   $ hg status
@@ -245,7 +244,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  rebase aborted
 
 Check dryrun gives correct results when there is conflict in rebasing
 Make a conflict:
@@ -285,7 +283,6 @@
   transaction abort!
   rollback completed
   hit a merge conflict
-  rebase aborted
   [1]
   $ hg diff
   $ hg status
@@ -321,5 +318,4 @@
   rebasing 4:e860deea161a "e"
   merging e
   hit a merge conflict
-  rebase aborted
   [1]
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort, backup=True):
+def _prepareabortorcontinue(self, isabort, backup=True, suppwarns=False):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -342,7 +342,8 @@
 raise error.Abort(msg, hint=hint)
 if isabort:
 return abort(self.repo, self.originalwd, self.destmap, self.state,
- activebookmark=self.activebookmark, backup=backup)
+ activebookmark=self.activebookmark, backup=backup,
+ suppwarns=suppwarns)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -830,7 +831,8 @@
 return 0
 finally:
 # no need to store back in case of dry-run
-rbsrt._prepareabortorcontinue(isabort=True, backup=False)
+rbsrt._prepareabortorcontinue(isabort=True, backup=False,
+  suppwarns=True)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -1553,7 +1555,8 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True,
+  suppwarns=False):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1606,7 +1609,8 @@
 finally:
 clearstatus(repo)
 clearcollapsemsg(repo)
-repo.ui.warn(_('rebase aborted\n'))
+if not suppwarns:
+repo.ui.warn(_('rebase aborted\n'))
 return 0
 
 def sortsource(destmap):



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


D3827: rebase: no need to store backup in case of dryrun

2018-06-28 Thread khanchi97 (Sushil khanchi)
khanchi97 updated this revision to Diff 9345.
khanchi97 edited the summary of this revision.
khanchi97 retitled this revision from "rebase: no need to store backup during 
dry-run while aborting" to "rebase: no need to store backup in case of dryrun".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3827?vs=9265=9345

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

AFFECTED FILES
  hgext/rebase.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
@@ -212,7 +212,6 @@
   rebasing 3:055a42cdd887 "d"
   rebasing 4:e860deea161a "e"
   there will be no conflict, you can rebase
-  saved backup bundle to 
$TESTTMP/repo1/repo2/skrepo/.hg/strip-backup/c83b1da5b1ae-f1e0beb9-backup.hg
   rebase aborted
 
   $ hg diff
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -325,7 +325,7 @@
 skippedset.update(obsoleteextinctsuccessors)
 _checkobsrebase(self.repo, self.ui, obsoleteset, skippedset)
 
-def _prepareabortorcontinue(self, isabort):
+def _prepareabortorcontinue(self, isabort, backup=True):
 try:
 self.restorestatus()
 self.collapsemsg = restorecollapsemsg(self.repo, isabort)
@@ -341,8 +341,8 @@
 hint = _('use "hg rebase --abort" to clear broken state')
 raise error.Abort(msg, hint=hint)
 if isabort:
-return abort(self.repo, self.originalwd, self.destmap,
- self.state, activebookmark=self.activebookmark)
+return abort(self.repo, self.originalwd, self.destmap, self.state,
+ activebookmark=self.activebookmark, backup=backup)
 
 def _preparenewrebase(self, destmap):
 if not destmap:
@@ -829,7 +829,8 @@
 ui.status(_('there will be no conflict, you can rebase\n'))
 return 0
 finally:
-rbsrt._prepareabortorcontinue(isabort=True)
+# no need to store back in case of dry-run
+rbsrt._prepareabortorcontinue(isabort=True, backup=False)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -1552,7 +1553,7 @@
 
 return False
 
-def abort(repo, originalwd, destmap, state, activebookmark=None):
+def abort(repo, originalwd, destmap, state, activebookmark=None, backup=True):
 '''Restore the repository to its original state.  Additional args:
 
 activebookmark: the name of the bookmark that should be active after the
@@ -1597,7 +1598,7 @@
 
 # Strip from the first rebased revision
 if rebased:
-repair.strip(repo.ui, repo, strippoints)
+repair.strip(repo.ui, repo, strippoints, backup=backup)
 
 if activebookmark and activebookmark in repo._bookmarks:
 bookmarks.activate(repo, activebookmark)



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


D3856: rebase: split _origrebase() for conveniece in dryrun

2018-06-28 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch split _origrebase() method by extracting rbsrt part
  from that to make it easy to implement dryrun in more elegant way
  than before.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -836,27 +836,27 @@
 # and re-run as an on-disk merge.
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
-return _origrebase(ui, repo, inmemory=inmemory, **opts)
+return _dorebase(ui, repo, inmemory=inmemory, **opts)
 except error.InMemoryMergeConflictsError:
 ui.warn(_('hit merge conflicts; re-running rebase without 
in-memory'
   ' merge\n'))
-_origrebase(ui, repo, abort=True)
-return _origrebase(ui, repo, inmemory=False, **opts)
+_dorebase(ui, repo, abort=True)
+return _dorebase(ui, repo, inmemory=False, **opts)
 else:
-return _origrebase(ui, repo, **opts)
+return _dorebase(ui, repo, **opts)
 
 def _dryrunrebase(ui, repo, rbsrt, **opts):
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
-return _origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
-   leaveunfinished=True, **opts)
-
-def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
-**opts):
+return _origrebase(ui, repo, rbsrt, inmemory=True, 
leaveunfinished=True,
+   **opts)
+
+def _dorebase(ui, repo, inmemory=False, **opts):
 opts = pycompat.byteskwargs(opts)
-if not rbsrt:
-rbsrt = rebaseruntime(repo, ui, inmemory, opts)
-
+rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+return _origrebase(ui, repo, rbsrt, inmemory=inmemory, **opts)
+
+def _origrebase(ui, repo, rbsrt, inmemory=False, leaveunfinished=False, 
**opts):
 with repo.wlock(), repo.lock():
 # Validate input and define rebasing points
 destf = opts.get('dest', None)



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


D3855: rebase: extract dryrun as a function

2018-06-28 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  To avoid more number of indented blocks and make it easier to add
  additional functionality in dryrun, extracted as a function.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -821,10 +821,7 @@
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 with repo.wlock(), repo.lock():
 try:
-overrides = {('rebase', 'singletransaction'): True}
-with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
-leaveunfinished=True, **opts)
+_dryrunrebase(ui, repo, rbsrt, **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 return 1
@@ -848,6 +845,12 @@
 else:
 return _origrebase(ui, repo, **opts)
 
+def _dryrunrebase(ui, repo, rbsrt, **opts):
+overrides = {('rebase', 'singletransaction'): True}
+with ui.configoverride(overrides, 'rebase'):
+return _origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+   leaveunfinished=True, **opts)
+
 def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
 **opts):
 opts = pycompat.byteskwargs(opts)



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


D3854: rebase: add lock to cover whole dryrun process

2018-06-28 Thread khanchi97 (Sushil khanchi)
khanchi97 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this patch it is easy for another hg to interrupt
  the dryrun. This patch make sure that dryrun will complete
  without any interruption.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -818,22 +818,20 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
-leaveunfinished = True
-inmemory = True
 rbsrt = rebaseruntime(repo, ui, inmemory, opts)
-try:
-overrides = {('rebase', 'singletransaction'): True}
-with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
-leaveunfinished=leaveunfinished, **opts)
-except error.InMemoryMergeConflictsError:
-ui.status(_('hit a merge conflict\n'))
-return 1
-else:
-ui.status(_('there will be no conflict, you can rebase\n'))
-return 0
-finally:
-with repo.wlock(), repo.lock():
+with repo.wlock(), repo.lock():
+try:
+overrides = {('rebase', 'singletransaction'): True}
+with ui.configoverride(overrides, 'rebase'):
+_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+leaveunfinished=True, **opts)
+except error.InMemoryMergeConflictsError:
+ui.status(_('hit a merge conflict\n'))
+return 1
+else:
+ui.status(_('there will be no conflict, you can rebase\n'))
+return 0
+finally:
 rbsrt._prepareabortorcontinue(isabort=True)
 elif inmemory:
 try:



To: khanchi97, #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 2 of 3 gca-revset V2] revset: add optimization for heads(commonancestors())

2018-06-28 Thread Sean Farley

Yuya Nishihara  writes:

> On Tue, 26 Jun 2018 15:40:38 -0700, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley 
>> # Date 1530051981 25200
>> #  Tue Jun 26 15:26:21 2018 -0700
>> # Branch gca-revset
>> # Node ID 0bab83973dbaecf03167801ddc4550c4b8b581f1
>> # Parent  6034db436af9b15237bb87f82405eb039dfb
>> revset: add optimization for heads(commonancestors())
>
>> +from .ancestor import commonancestorsheads
>
> symbol import isn't allowed.

Argh, a bad habit I picked up from other python projects.

>> +# for internal use
>> +@predicate('_commonancestorheads(set)', safe=True)
>> +def _commonancestorheads(repo, subset, x):
>> +"""Returns all greatest common ancestors of the changesets.
>> +
>> +This is an internal method is for quickly calculating "heads(::x and 
>> ::y)"
>> +
>> +These greatest common ancestors are the same ones that the consesus bid
>> +merge will find.
>> +"""
>
> This has to be a comment. All docstrings are visible in the revset help.

Oops.

>> +h = heads(repo, subset, x)
>^^
>fullreposet(repo)
>
> heads may be out of the subset.

Yeah, agreed.


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


Re: [PATCH 1 of 3 gca-revset V2] revsets: add commonancestors revset

2018-06-28 Thread Sean Farley

Yuya Nishihara  writes:

> On Tue, 26 Jun 2018 15:40:37 -0700, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley 
>> # Date 1529376114 25200
>> #  Mon Jun 18 19:41:54 2018 -0700
>> # Branch gca-revset
>> # Node ID 6034db436af9b15237bb87f82405eb039dfb
>> # Parent  2f5c622fcb739aed795c9ab51ea69c3b46436054
>> revsets: add commonancestors revset
>
>> +@predicate('commonancestors(set)', safe=True)
>> +def commonancestors(repo, subset, x):
>> +"""Returns all common ancestors of the set.
>> +
>> +This method is for calculating "::x and ::y" (i.e. all the ancestors 
>> that
>> +are common to both x and y) in an easy and optimized way. We can't quite
>> +use "::head()" but that revset returns "::x + ::y + ..." for each head 
>> in
>> +the repo (whereas we want "::x *and* ::y").
>> +
>> +"""
>> +# only wants the heads of the set passed in
>> +h = heads(repo, subset, x)
>^^
> Perhaps it should be fullreposet(repo) since the subset has to be filtered by
> any heads which may be out of the subset.

It took me a bit to understand the problem at hand but I see it now. I
had misread how 'subset' was calculated and didn't realize it was
distributed into the function args like this. For anyone else that had
trouble, the problem is that as this patch is currently written, it will
fail to calculate this:

hg log -r '2 & heads(commonancestors(4 + 5))'

because the '2 & ...' will act on the subset too soon. I'll add a test
for this in the next version.

>> +commonrevs = repo.revs(" and ".join(["::%s"] * len(h), *h))
>^^^
> Bad parens. And this wouldn't work if h is empty. Instead, we can chain
> ancestor revisions.
>
> for r in heads(...):
> subset &= dagop.revancestors(repo, baseset([r]))

Ah, that's much better, thanks!


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


D3825: grep: deprecates `--all` flag

2018-06-28 Thread sangeet259 (Sangeet Kumar Mishra)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8d9d0d30cfcc: grep: deprecates `--all` flag (authored by 
sangeet259, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3825?vs=9340=9341

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2488,7 +2488,7 @@
 
 @command('grep',
 [('0', 'print0', None, _('end fields with NUL')),
-('', 'all', None, _('print all revisions that match')),
+('', 'all', None, _('print all revisions that match (DEPRECATED) ')),
 ('', 'diff', None, _('print all revisions when the term was introduced '
  'or removed')),
 ('a', 'text', None, _('treat all files as text')),
@@ -2519,7 +2519,7 @@
 file in which it finds a match. To get it to print every revision
 that contains a change in match status ("-" for a match that becomes
 a non-match, or "+" for a non-match that becomes a match), use the
---diff/--all flag.
+--diff flag.
 
 PATTERN can be any Python (roughly Perl-compatible) regular
 expression.



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


D3825: grep: deprecates `--all` flag

2018-06-28 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 updated this revision to Diff 9340.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3825?vs=9339=9340

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2488,7 +2488,7 @@
 
 @command('grep',
 [('0', 'print0', None, _('end fields with NUL')),
-('', 'all', None, _('print all revisions that match')),
+('', 'all', None, _('print all revisions that match (DEPRECATED) ')),
 ('', 'diff', None, _('print all revisions when the term was introduced '
  'or removed')),
 ('a', 'text', None, _('treat all files as text')),
@@ -2519,7 +2519,7 @@
 file in which it finds a match. To get it to print every revision
 that contains a change in match status ("-" for a match that becomes
 a non-match, or "+" for a non-match that becomes a match), use the
---diff/--all flag.
+--diff flag.
 
 PATTERN can be any Python (roughly Perl-compatible) regular
 expression.



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


D3825: grep: deprecates `--all` flag

2018-06-28 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 updated this revision to Diff 9339.
sangeet259 edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3825?vs=9250=9339

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

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2488,8 +2488,8 @@
 
 @command('grep',
 [('0', 'print0', None, _('end fields with NUL')),
-('', 'all', None, _('print all revisions that match')),
-('', 'diff', None, _('print all revisions when the term was introduced '
+('', 'all', None, _('print all revisions that match (DEPRECATED) ')),
+('', 'diff', None, _('print all revisions when the term was introduced() '
  'or removed')),
 ('a', 'text', None, _('treat all files as text')),
 ('f', 'follow', None,
@@ -2519,7 +2519,7 @@
 file in which it finds a match. To get it to print every revision
 that contains a change in match status ("-" for a match that becomes
 a non-match, or "+" for a non-match that becomes a match), use the
---diff/--all flag.
+--diff flag.
 
 PATTERN can be any Python (roughly Perl-compatible) regular
 expression.



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


D3853: py3: convert opts keys to bytes using pycompat.byteskwargs()

2018-06-28 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This fixes the py3 build broken due to
  https://phab.mercurial-scm.org/rHG56b2074114b19e12abd9cd4c378d58b702232705.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -820,7 +820,7 @@
 if dryrun:
 leaveunfinished = True
 inmemory = True
-rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+rbsrt = rebaseruntime(repo, ui, inmemory, pycompat.byteskwargs(opts))
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):



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


D3852: namespaces: let namespaces override singlenode() definition

2018-06-28 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG4c0683655599: namespaces: let namespaces override 
singlenode() definition (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3852?vs=9336=9337

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

AFFECTED FILES
  mercurial/namespaces.py

CHANGE DETAILS

diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -95,21 +95,16 @@
 
 def singlenode(self, repo, name):
 """
-Return the 'best' node for the given name. Best means the first node
-in the first nonempty list returned by a name-to-nodes mapping function
-in the defined precedence order.
+Return the 'best' node for the given name. What's best is defined
+by the namespace's singlenode() function. The first match returned by
+a namespace in the defined precedence order is used.
 
 Raises a KeyError if there is no such node.
 """
 for ns, v in self._names.iteritems():
-n = v.namemap(repo, name)
+n = v.singlenode(repo, name)
 if n:
-# return max revision number
-if len(n) > 1:
-cl = repo.changelog
-maxrev = max(cl.rev(node) for node in n)
-return cl.node(maxrev)
-return n[0]
+return n
 raise KeyError(_('no such name: %s') % name)
 
 class namespace(object):
@@ -142,7 +137,7 @@
 
 def __init__(self, name, templatename=None, logname=None, colorname=None,
  logfmt=None, listnames=None, namemap=None, nodemap=None,
- deprecated=None, builtin=False):
+ deprecated=None, builtin=False, singlenode=None):
 """create a namespace
 
 name: the namespace to be registered (in plural form)
@@ -158,6 +153,7 @@
 nodemap: function that inputs a node, output name(s)
 deprecated: set of names to be masked for ordinary use
 builtin: whether namespace is implemented by core Mercurial
+singlenode: function that inputs a name, output best node (or None)
 """
 self.name = name
 self.templatename = templatename
@@ -167,6 +163,8 @@
 self.listnames = listnames
 self.namemap = namemap
 self.nodemap = nodemap
+if singlenode:
+self.singlenode = singlenode
 
 # if logname is not specified, use the template name as backup
 if self.logname is None:
@@ -199,3 +197,18 @@
 
 """
 return sorted(self.namemap(repo, name))
+
+def singlenode(self, repo, name):
+"""returns the best node for the given name
+
+By default, the best node is the node from nodes() with the highest
+revision number. It can be overriden by the namespace."""
+n = self.namemap(repo, name)
+if n:
+# return max revision number
+if len(n) > 1:
+cl = repo.changelog
+maxrev = max(cl.rev(node) for node in n)
+return cl.node(maxrev)
+return n[0]
+return None



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


D3852: namespaces: let namespaces override singlenode() definition

2018-06-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D3852#60160, @yuja wrote:
  
  > Makes sense. One nit.
  >
  > > +if not singlenode:
  > >  +def singlenode(repo, name):
  > >  +n = self.namemap(repo, name)
  > >  +if n:
  > >  +# return max revision number
  > >  +if len(n) > 1:
  > >  +cl = repo.changelog
  > >  +maxrev = max(cl.rev(node) for node in n)
  > >  +return cl.node(maxrev)
  > >  +return n[0]
  > >  +return None
  > >  +self.singlenode = singlenode
  >
  > The default implementation has to be defined as an unbound method to avoid
  >  reference cycle: self.singlenode -> singlenode -> self.
  
  
  Done

REPOSITORY
  rHG Mercurial

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

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


D3852: namespaces: let namespaces override singlenode() definition

2018-06-28 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 9336.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3852?vs=9333=9336

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

AFFECTED FILES
  mercurial/namespaces.py

CHANGE DETAILS

diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py
--- a/mercurial/namespaces.py
+++ b/mercurial/namespaces.py
@@ -95,21 +95,16 @@
 
 def singlenode(self, repo, name):
 """
-Return the 'best' node for the given name. Best means the first node
-in the first nonempty list returned by a name-to-nodes mapping function
-in the defined precedence order.
+Return the 'best' node for the given name. What's best is defined
+by the namespace's singlenode() function. The first match returned by
+a namespace in the defined precedence order is used.
 
 Raises a KeyError if there is no such node.
 """
 for ns, v in self._names.iteritems():
-n = v.namemap(repo, name)
+n = v.singlenode(repo, name)
 if n:
-# return max revision number
-if len(n) > 1:
-cl = repo.changelog
-maxrev = max(cl.rev(node) for node in n)
-return cl.node(maxrev)
-return n[0]
+return n
 raise KeyError(_('no such name: %s') % name)
 
 class namespace(object):
@@ -142,7 +137,7 @@
 
 def __init__(self, name, templatename=None, logname=None, colorname=None,
  logfmt=None, listnames=None, namemap=None, nodemap=None,
- deprecated=None, builtin=False):
+ deprecated=None, builtin=False, singlenode=None):
 """create a namespace
 
 name: the namespace to be registered (in plural form)
@@ -158,6 +153,7 @@
 nodemap: function that inputs a node, output name(s)
 deprecated: set of names to be masked for ordinary use
 builtin: whether namespace is implemented by core Mercurial
+singlenode: function that inputs a name, output best node (or None)
 """
 self.name = name
 self.templatename = templatename
@@ -167,6 +163,8 @@
 self.listnames = listnames
 self.namemap = namemap
 self.nodemap = nodemap
+if singlenode:
+self.singlenode = singlenode
 
 # if logname is not specified, use the template name as backup
 if self.logname is None:
@@ -199,3 +197,18 @@
 
 """
 return sorted(self.namemap(repo, name))
+
+def singlenode(self, repo, name):
+"""returns the best node for the given name
+
+By default, the best node is the node from nodes() with the highest
+revision number. It can be overriden by the namespace."""
+n = self.namemap(repo, name)
+if n:
+# return max revision number
+if len(n) > 1:
+cl = repo.changelog
+maxrev = max(cl.rev(node) for node in n)
+return cl.node(maxrev)
+return n[0]
+return None



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


[PATCH 3 of 3] revset: move lookup of first ancestor() candidate out of the loop

2018-06-28 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529159200 -32400
#  Sat Jun 16 23:26:40 2018 +0900
# Node ID 0005175b53bb3f829578757c1c34eab60c7c42a8
# Parent  fe4560fa5db2f1ee11cff233c55b7685e891517a
revset: move lookup of first ancestor() candidate out of the loop

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -311,14 +311,15 @@ def ancestor(repo, subset, x):
 Will return empty list when passed no args.
 Greatest common ancestor of a single changeset is that changeset.
 """
-anc = None
-for r in orset(repo, fullreposet(repo), x, order=anyorder):
-if anc is None:
-anc = repo[r]
-else:
-anc = anc.ancestor(repo[r])
+reviter = iter(orset(repo, fullreposet(repo), x, order=anyorder))
+try:
+anc = repo[next(reviter)]
+except StopIteration:
+return baseset()
+for r in reviter:
+anc = anc.ancestor(repo[r])
 
-if anc is not None and anc.rev() in subset:
+if anc.rev() in subset:
 return baseset([anc.rev()])
 return baseset()
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3] revset: remove orphan i18n comment from ancestor()

2018-06-28 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529158361 -32400
#  Sat Jun 16 23:12:41 2018 +0900
# Node ID 5e1defd9170e93dea28ea06abc22a2959cd4b707
# Parent  56b2074114b19e12abd9cd4c378d58b702232705
revset: remove orphan i18n comment from ancestor()

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -309,7 +309,6 @@ def ancestor(repo, subset, x):
 Will return empty list when passed no args.
 Greatest common ancestor of a single changeset is that changeset.
 """
-# i18n: "ancestor" is a keyword
 l = getlist(x)
 rl = fullreposet(repo)
 anc = None
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3852: namespaces: let namespaces override singlenode() definition

2018-06-28 Thread Yuya Nishihara
Makes sense. One nit.

> +if not singlenode:
> +def singlenode(repo, name):
> +n = self.namemap(repo, name)
> +if n:
> +# return max revision number
> +if len(n) > 1:
> +cl = repo.changelog
> +maxrev = max(cl.rev(node) for node in n)
> +return cl.node(maxrev)
> +return n[0]
> +return None
> +self.singlenode = singlenode

The default implementation has to be defined as an unbound method to avoid
reference cycle: self.singlenode -> singlenode -> self.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3849: rebase: refactor dryrun implementation

2018-06-28 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Queued, thanks.
  
  I found a couple of nits. Can you send a follow up?
  
  >   if dryrun:
  > 
  > +leaveunfinished = True
  >  +inmemory = True
  >  +rbsrt = rebaseruntime(repo, ui, inmemory, opts)
  > 
  >   try:
  >   overrides = {('rebase', 'singletransaction'): True}
  >   with ui.configoverride(overrides, 'rebase'):
  > 
  > - _origrebase(ui, repo, inmemory=True, leaveunfinished=True,
  > - **opts) +_origrebase(ui, repo, inmemory=True, 
rbsrt=rbsrt, +leaveunfinished=leaveunfinished, 
**opts) except error.InMemoryMergeConflictsError: ui.status(_('hit a merge 
conflict\n')) return 1 else: ui.status(_('there will be no conflict, you can 
rebase\n')) return 0 finally:
  > - _origrebase(ui, repo, abort=True) +with repo.wlock(), 
repo.lock(): +rbsrt._prepareabortorcontinue(isabort=True)
  
  We need a lock covering the whole dryrun process. Otherwise, another hg could
  interrupt the dryrun before aborting.
  
  Since we'll need one more indented block, I think it's time to extract dryrun
  to a function.
  
  > -def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, **opts):
  >  +def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, 
rbsrt=None,
  >  +**opts):
  > 
  >   opts = pycompat.byteskwargs(opts)
  > 
  > - rbsrt = rebaseruntime(repo, ui, inmemory, opts) +if not rbsrt: +  
  rbsrt = rebaseruntime(repo, ui, inmemory, opts)
  
  I think it's slightly better to split function than adding optional `rbsrt`
  argument.
  
  >   with repo.wlock(), repo.lock():
  >   # Validate input and define rebasing points
  
  Perhaps we can extract the post-lock block to new function, and the dryrun
  function will call it in place of `_origrebase()`:
  
rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 with repo.wlock(), repo.lock():
 try:
 do in-memory rebase
 finally:
 rbsrt._prepareabortorcontinue(isabort=True)

REPOSITORY
  rHG Mercurial

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

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


Re: D3849: rebase: refactor dryrun implementation

2018-06-28 Thread Yuya Nishihara
Queued, thanks.

I found a couple of nits. Can you send a follow up?

>  if dryrun:
> +leaveunfinished = True
> +inmemory = True
> +rbsrt = rebaseruntime(repo, ui, inmemory, opts)
>  try:
>  overrides = {('rebase', 'singletransaction'): True}
>  with ui.configoverride(overrides, 'rebase'):
> -_origrebase(ui, repo, inmemory=True, leaveunfinished=True,
> -**opts)
> +_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
> +leaveunfinished=leaveunfinished, **opts)
>  except error.InMemoryMergeConflictsError:
>  ui.status(_('hit a merge conflict\n'))
>  return 1
>  else:
>  ui.status(_('there will be no conflict, you can rebase\n'))
>  return 0
>  finally:
> -_origrebase(ui, repo, abort=True)
> +with repo.wlock(), repo.lock():
> +rbsrt._prepareabortorcontinue(isabort=True)

We need a lock covering the whole dryrun process. Otherwise, another hg could
interrupt the dryrun before aborting.

Since we'll need one more indented block, I think it's time to extract dryrun
to a function.

> -def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, **opts):
> +def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
> +**opts):
>  opts = pycompat.byteskwargs(opts)
> -rbsrt = rebaseruntime(repo, ui, inmemory, opts)
> +if not rbsrt:
> +rbsrt = rebaseruntime(repo, ui, inmemory, opts)

I think it's slightly better to split function than adding optional `rbsrt`
argument.

>  with repo.wlock(), repo.lock():
>  # Validate input and define rebasing points

Perhaps we can extract the post-lock block to new function, and the dryrun
function will call it in place of `_origrebase()`:

```
rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 with repo.wlock(), repo.lock():
 try:
 do in-memory rebase
 finally:
 rbsrt._prepareabortorcontinue(isabort=True)
```
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3849: rebase: refactor dryrun implementation

2018-06-28 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG56b2074114b1: rebase: refactor dryrun implementation 
(authored by khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3849?vs=9324=9335

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

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -818,19 +818,23 @@
 opts[r'dest'] = '_destautoorphanrebase(SRC)'
 
 if dryrun:
+leaveunfinished = True
+inmemory = True
+rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 try:
 overrides = {('rebase', 'singletransaction'): True}
 with ui.configoverride(overrides, 'rebase'):
-_origrebase(ui, repo, inmemory=True, leaveunfinished=True,
-**opts)
+_origrebase(ui, repo, inmemory=True, rbsrt=rbsrt,
+leaveunfinished=leaveunfinished, **opts)
 except error.InMemoryMergeConflictsError:
 ui.status(_('hit a merge conflict\n'))
 return 1
 else:
 ui.status(_('there will be no conflict, you can rebase\n'))
 return 0
 finally:
-_origrebase(ui, repo, abort=True)
+with repo.wlock(), repo.lock():
+rbsrt._prepareabortorcontinue(isabort=True)
 elif inmemory:
 try:
 # in-memory merge doesn't support conflicts, so if we hit any, 
abort
@@ -846,9 +850,11 @@
 else:
 return _origrebase(ui, repo, **opts)
 
-def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, **opts):
+def _origrebase(ui, repo, inmemory=False, leaveunfinished=False, rbsrt=None,
+**opts):
 opts = pycompat.byteskwargs(opts)
-rbsrt = rebaseruntime(repo, ui, inmemory, opts)
+if not rbsrt:
+rbsrt = rebaseruntime(repo, ui, inmemory, opts)
 
 with repo.wlock(), repo.lock():
 # Validate input and define rebasing points



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


D3716: ui: add an uninterruptable context manager that can block SIGINT

2018-06-28 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > +@contextlib.contextmanager
  >  +def uninterruptable(self):
  >  +"""Mark an operation as unsafe.
  >  +
  >  +Most operations on a repository are safe to interrupt, but a
  >  +few are risky (for example repair.strip). This context manager
  >  +lets you advise Mercurial that something risky is happening so
  >  +that control-C etc can be blocked if desired.
  >  +"""
  >  +enabled = self.configbool('experimental', 'nointerrupt')
  >  +if (enabled and
  >  +self.configbool('experimental', 
'nointerrupt-interactiveonly')):
  >  +enabled = self.interactive()
  >  +if self._uninterruptible or not enabled:
  >  +# if nointerrupt support is turned off, the process isn't
  >  +# interactive, or we're already in an uninterruptable
  >  +# block, do nothing.
  >  +yield
  >  +return
  >  +def warn():
  >  +self.warn(_("shutting down cleanly\n"))
  >  +self.warn(
  >  +_("press ^C again to terminate immediately 
(dangerous)\n"))
  
  Missed `return True` ?
  
  Other that that, the patch looks good to me.

REPOSITORY
  rHG Mercurial

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

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


Re: D3716: ui: add an uninterruptable context manager that can block SIGINT

2018-06-28 Thread Yuya Nishihara
> +@contextlib.contextmanager
> +def uninterruptable(self):
> +"""Mark an operation as unsafe.
> +
> +Most operations on a repository are safe to interrupt, but a
> +few are risky (for example repair.strip). This context manager
> +lets you advise Mercurial that something risky is happening so
> +that control-C etc can be blocked if desired.
> +"""
> +enabled = self.configbool('experimental', 'nointerrupt')
> +if (enabled and
> +self.configbool('experimental', 'nointerrupt-interactiveonly')):
> +enabled = self.interactive()
> +if self._uninterruptible or not enabled:
> +# if nointerrupt support is turned off, the process isn't
> +# interactive, or we're already in an uninterruptable
> +# block, do nothing.
> +yield
> +return
> +def warn():
> +self.warn(_("shutting down cleanly\n"))
> +self.warn(
> +_("press ^C again to terminate immediately (dangerous)\n"))

Missed `return True` ?

Other that that, the patch looks good to me.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] hooks: allow Unix style environment variables on external Windows hooks

2018-06-28 Thread Yuya Nishihara
On Wed, 27 Jun 2018 08:44:27 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1498969929 14400
> #  Sun Jul 02 00:32:09 2017 -0400
> # Node ID 6d206e4742d6f31246d0e234add03436ac429ebf
> # Parent  7ac9de5a8826fc95864ee4ba844eb8b5c9e71332
> hooks: allow Unix style environment variables on external Windows hooks

> +if pycompat.iswindows:
> +environ = procutil.shellenviron(env)
> +cmd = util.platform.shelltocmdexe(cmd, environ)

util.platform isn't intended to be a re-export of the platform module.
Instead, we can add a wrapper function to procutil:

  if windows:
  def shelltonative(cmd, env):
  return platform.shelltocmdexe(cmd, shellenviron(env))
  else:
  def shelltonative(cmd, env):
  return cmd

Can you send a follow up?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] windows: add a method to convert Unix style command lines to Windows style

2018-06-28 Thread Yuya Nishihara
On Wed, 27 Jun 2018 08:44:26 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1529817189 14400
> #  Sun Jun 24 01:13:09 2018 -0400
> # Node ID 7ac9de5a8826fc95864ee4ba844eb8b5c9e71332
> # Parent  2c2e82469b8915c8153979cd89a970b7317f882d
> windows: add a method to convert Unix style command lines to Windows style

Queued, thanks.

> +elif c == b'\\' and index + 1 < pathlen and path[index + 1] == b'$':
> +# Skip '\', but only if it is escaping $
> +res += b'$'
> +index += 1

\-escape might be confusing since \ is the directory separator on Windows,
and a hook command is likely to contain backslashes.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] hgweb: add z-index for search field tooltip

2018-06-28 Thread Yuya Nishihara
On Thu, 28 Jun 2018 15:13:40 +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov 
> # Date 1530142868 -28800
> #  Thu Jun 28 07:41:08 2018 +0800
> # Node ID 9ddf150b8e266c7e81e018552630994529e54d50
> # Parent  b4cfd803b3f2697928be9b3a96787bcee3447c7e
> hgweb: add z-index for search field tooltip

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


Re: [PATCH STABLE v2] hghave: don't claim we have `tic` if it's NetBSD's binary (issue5698)

2018-06-28 Thread Augie Fackler
On Thu, Jun 28, 2018, 06:30 Thomas Klausner  wrote:

> On Wed, Jun 27, 2018 at 11:50:18AM -0400, Augie Fackler wrote:
> > # HG changeset patch
> > # User Augie Fackler 
> > # Date 1529932907 14400
> > #  Mon Jun 25 09:21:47 2018 -0400
> > # Branch stable
> > # Node ID af7d21e1e44c1bb756af28b5978d3f7ee7d50eda
> > # Parent  0b63a6743010dfdbf8a8154186e119949bdaa1cc
> > hghave: don't claim we have `tic` if it's NetBSD's binary (issue5698)
> >
> > test-status-color.t fails with different output because of mismatches
> > between how `tic` behaves from NetBSD's base system and ncurses'
> > verison (if I understand the bug right). The bug suggested using -V to
> > avoid the issue, so we'll do that.
>
> This looks like it should work, but it doesn't.
>

Nuts.

>
> ---
> /scratch/devel/py-mercurial/work/mercurial-4.6.1/tests/test-status-color.t
> +++
> /scratch/devel/py-mercurial/work/mercurial-4.6.1/tests/test-status-color.t.err
> @@ -243,15 +243,18 @@
>$ mkdir "$TESTTMP/terminfo"
>$ TERMINFO="$TESTTMP/terminfo" tic "$TESTDIR/hgterm.ti"
>$ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config
> color.mode=terminfo -A
> -  \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1madded\x1b[30m
> (esc)
> -  \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1mcopied\x1b[30m
> (esc)
> -  \x1b[30m\x1b[30m  modified\x1b[30m (esc)
> -  \x1b[30m\x1b[31m\x1b[1mR \x1b[30m\x1b[30m\x1b[31m\x1b[1mremoved\x1b[30m
> (esc)
> -  \x1b[30m\x1b[36m\x1b[1m\x1b[4m!
> \x1b[30m\x1b[30m\x1b[36m\x1b[1m\x1b[4mdeleted\x1b[30m (esc)
> -  \x1b[30m\x1b[35m\x1b[1m\x1b[4m?
> \x1b[30m\x1b[30m\x1b[35m\x1b[1m\x1b[4munknown\x1b[30m (esc)
> -  \x1b[30m\x1b[30m\x1b[1mI \x1b[30m\x1b[30m\x1b[30m\x1b[1mignored\x1b[30m
> (esc)
> -  \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30m.hgignore\x1b[30m (esc)
> -  \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30mmodified\x1b[30m (esc)
> +  warning: failed to set color mode to terminfo
> +  warning: failed to set color mode to terminfo
> +  warning: failed to set color mode to terminfo
> +  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
> +  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
> +  \x1b[0;0m  modified\x1b[0m (esc)
> +  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
> +  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
> +  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
> +  \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc)
> +  \x1b[0;0mC \x1b[0m\x1b[0;0m.hgignore\x1b[0m (esc)
> +  \x1b[0;0mC \x1b[0m\x1b[0;0mmodified\x1b[0m (esc)
>
>  The user can define effects with raw terminfo codes:
>
> @@ -262,15 +265,18 @@
>> terminfo.bold = \E[2m
>> EOF
>$ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config
> color.mode=terminfo --config color.status.clean=dim -A
> -  \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2madded\x1b[30m
> (esc)
> -  \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2mcopied\x1b[30m
> (esc)
> -  \x1b[30m\x1b[30m  modified\x1b[30m (esc)
> -  \x1b[30m\x1b[31m\x1b[2mR \x1b[30m\x1b[30m\x1b[31m\x1b[2mremoved\x1b[30m
> (esc)
> -  \x1b[30m\x1b[36m\x1b[2m\x1b[4m!
> \x1b[30m\x1b[30m\x1b[36m\x1b[2m\x1b[4mdeleted\x1b[30m (esc)
> -  \x1b[30m\x1b[35m\x1b[2m\x1b[4m?
> \x1b[30m\x1b[30m\x1b[35m\x1b[2m\x1b[4munknown\x1b[30m (esc)
> -  \x1b[30m\x1b[30m\x1b[2mI \x1b[30m\x1b[30m\x1b[30m\x1b[2mignored\x1b[30m
> (esc)
> -  \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88m.hgignore\x1b[30m (esc)
> -  \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88mmodified\x1b[30m (esc)
> +  warning: failed to set color mode to terminfo
> +  warning: failed to set color mode to terminfo
> +  warning: failed to set color mode to terminfo
> +  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
> +  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
> +  \x1b[0;0m  modified\x1b[0m (esc)
> +  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
> +  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
> +  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
> +  \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc)
> +  \x1b[0;2mC \x1b[0m\x1b[0;2m.hgignore\x1b[0m (esc)
> +  \x1b[0;2mC \x1b[0m\x1b[0;2mmodified\x1b[0m (esc)
>
>  #endif
>
>
> ERROR: test-status-color.t output changed
>
>
> How do I run the single test with the same settings as when it's run
> in the context of the full test suite?
>

`make local` (just once, will speed up the process if you need multiple
runs)
`(cd tests && python run-tests.py --local test-status-color.t)`


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


Re: [PATCH STABLE v2] hghave: don't claim we have `tic` if it's NetBSD's binary (issue5698)

2018-06-28 Thread Thomas Klausner
On Wed, Jun 27, 2018 at 11:50:18AM -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler 
> # Date 1529932907 14400
> #  Mon Jun 25 09:21:47 2018 -0400
> # Branch stable
> # Node ID af7d21e1e44c1bb756af28b5978d3f7ee7d50eda
> # Parent  0b63a6743010dfdbf8a8154186e119949bdaa1cc
> hghave: don't claim we have `tic` if it's NetBSD's binary (issue5698)
> 
> test-status-color.t fails with different output because of mismatches
> between how `tic` behaves from NetBSD's base system and ncurses'
> verison (if I understand the bug right). The bug suggested using -V to
> avoid the issue, so we'll do that.

This looks like it should work, but it doesn't.

--- /scratch/devel/py-mercurial/work/mercurial-4.6.1/tests/test-status-color.t
+++ 
/scratch/devel/py-mercurial/work/mercurial-4.6.1/tests/test-status-color.t.err
@@ -243,15 +243,18 @@
   $ mkdir "$TESTTMP/terminfo"
   $ TERMINFO="$TESTTMP/terminfo" tic "$TESTDIR/hgterm.ti"
   $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config 
color.mode=terminfo -A
-  \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1madded\x1b[30m (esc)
-  \x1b[30m\x1b[32m\x1b[1mA \x1b[30m\x1b[30m\x1b[32m\x1b[1mcopied\x1b[30m (esc)
-  \x1b[30m\x1b[30m  modified\x1b[30m (esc)
-  \x1b[30m\x1b[31m\x1b[1mR \x1b[30m\x1b[30m\x1b[31m\x1b[1mremoved\x1b[30m (esc)
-  \x1b[30m\x1b[36m\x1b[1m\x1b[4m! 
\x1b[30m\x1b[30m\x1b[36m\x1b[1m\x1b[4mdeleted\x1b[30m (esc)
-  \x1b[30m\x1b[35m\x1b[1m\x1b[4m? 
\x1b[30m\x1b[30m\x1b[35m\x1b[1m\x1b[4munknown\x1b[30m (esc)
-  \x1b[30m\x1b[30m\x1b[1mI \x1b[30m\x1b[30m\x1b[30m\x1b[1mignored\x1b[30m (esc)
-  \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30m.hgignore\x1b[30m (esc)
-  \x1b[30m\x1b[30mC \x1b[30m\x1b[30m\x1b[30mmodified\x1b[30m (esc)
+  warning: failed to set color mode to terminfo
+  warning: failed to set color mode to terminfo
+  warning: failed to set color mode to terminfo
+  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
+  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
+  \x1b[0;0m  modified\x1b[0m (esc)
+  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
+  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
+  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
+  \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc)
+  \x1b[0;0mC \x1b[0m\x1b[0;0m.hgignore\x1b[0m (esc)
+  \x1b[0;0mC \x1b[0m\x1b[0;0mmodified\x1b[0m (esc)

 The user can define effects with raw terminfo codes:

@@ -262,15 +265,18 @@
   > terminfo.bold = \E[2m
   > EOF
   $ TERM=hgterm TERMINFO="$TESTTMP/terminfo" hg status --config 
color.mode=terminfo --config color.status.clean=dim -A
-  \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2madded\x1b[30m (esc)
-  \x1b[30m\x1b[32m\x1b[2mA \x1b[30m\x1b[30m\x1b[32m\x1b[2mcopied\x1b[30m (esc)
-  \x1b[30m\x1b[30m  modified\x1b[30m (esc)
-  \x1b[30m\x1b[31m\x1b[2mR \x1b[30m\x1b[30m\x1b[31m\x1b[2mremoved\x1b[30m (esc)
-  \x1b[30m\x1b[36m\x1b[2m\x1b[4m! 
\x1b[30m\x1b[30m\x1b[36m\x1b[2m\x1b[4mdeleted\x1b[30m (esc)
-  \x1b[30m\x1b[35m\x1b[2m\x1b[4m? 
\x1b[30m\x1b[30m\x1b[35m\x1b[2m\x1b[4munknown\x1b[30m (esc)
-  \x1b[30m\x1b[30m\x1b[2mI \x1b[30m\x1b[30m\x1b[30m\x1b[2mignored\x1b[30m (esc)
-  \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88m.hgignore\x1b[30m (esc)
-  \x1b[30m\x1b[88mC \x1b[30m\x1b[30m\x1b[88mmodified\x1b[30m (esc)
+  warning: failed to set color mode to terminfo
+  warning: failed to set color mode to terminfo
+  warning: failed to set color mode to terminfo
+  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1madded\x1b[0m (esc)
+  \x1b[0;32;1mA \x1b[0m\x1b[0;32;1mcopied\x1b[0m (esc)
+  \x1b[0;0m  modified\x1b[0m (esc)
+  \x1b[0;31;1mR \x1b[0m\x1b[0;31;1mremoved\x1b[0m (esc)
+  \x1b[0;36;1;4m! \x1b[0m\x1b[0;36;1;4mdeleted\x1b[0m (esc)
+  \x1b[0;35;1;4m? \x1b[0m\x1b[0;35;1;4munknown\x1b[0m (esc)
+  \x1b[0;30;1mI \x1b[0m\x1b[0;30;1mignored\x1b[0m (esc)
+  \x1b[0;2mC \x1b[0m\x1b[0;2m.hgignore\x1b[0m (esc)
+  \x1b[0;2mC \x1b[0m\x1b[0;2mmodified\x1b[0m (esc)

 #endif


ERROR: test-status-color.t output changed


How do I run the single test with the same settings as when it's run
in the context of the full test suite?
 Thomas
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3851: tests: pass "rev" argument to commands.update() as string

2018-06-28 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGecaa0ad4ed4f: tests: pass rev argument to 
commands.update() as string (authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3851?vs=9332=9334#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3851?vs=9332=9334

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

AFFECTED FILES
  tests/test-basic.t

CHANGE DETAILS

diff --git a/tests/test-basic.t b/tests/test-basic.t
--- a/tests/test-basic.t
+++ b/tests/test-basic.t
@@ -64,7 +64,7 @@
   > from mercurial import ui, hg, commands
   > myui = ui.ui.load()
   > repo = hg.repository(myui, path=b'.')
-  > commands.update(myui, repo, rev=0)
+  > commands.update(myui, repo, rev=b"0")
   > EOF
   $ hg up null
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved



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


D3851: tests: pass "rev" argument to commands.update() as string

2018-06-28 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> test-basic.t:67
>> repo = hg.repository(myui, path=b'.')
> -  > commands.update(myui, repo, rev=0)
> +  > commands.update(myui, repo, rev="0")
>> EOF

Added a b'' prefix in flight for py3.

REPOSITORY
  rHG Mercurial

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

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


[PATCH 2 of 2] hgweb: add archive entries to graph page

2018-06-28 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1530154253 -28800
#  Thu Jun 28 10:50:53 2018 +0800
# Node ID 184556878de102d6c328230ae31b0814be87c729
# Parent  9ddf150b8e266c7e81e018552630994529e54d50
hgweb: add archive entries to graph page

Changelog page has them, so it makes sense to add them to graph page too.

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -1370,6 +1370,7 @@ def graph(web):
 jsdata=templateutil.mappinggenerator(jsdata),
 nodes=templateutil.mappinggenerator(nodes),
 node=ctx.hex(),
+archives=web.archivelist('tip'),
 changenav=changenav)
 
 def _getdoc(e):
diff --git a/mercurial/templates/gitweb/graph.tmpl 
b/mercurial/templates/gitweb/graph.tmpl
--- a/mercurial/templates/gitweb/graph.tmpl
+++ b/mercurial/templates/gitweb/graph.tmpl
@@ -21,7 +21,7 @@ graph |
 tags |
 bookmarks |
 branches |
-files |
+files{archives%archiveentry}
 |
 help
 
 less
diff --git a/mercurial/templates/monoblue/graph.tmpl 
b/mercurial/templates/monoblue/graph.tmpl
--- a/mercurial/templates/monoblue/graph.tmpl
+++ b/mercurial/templates/monoblue/graph.tmpl
@@ -20,6 +20,7 @@
 bookmarks
 branches
 files
+{archives%archiveentry}
 help
 
 
diff --git a/mercurial/templates/paper/graph.tmpl 
b/mercurial/templates/paper/graph.tmpl
--- a/mercurial/templates/paper/graph.tmpl
+++ b/mercurial/templates/paper/graph.tmpl
@@ -25,6 +25,9 @@
 browse
 
 
+{archives%archiveentry}
+
+
  help
 
 
diff --git a/tests/test-hgweb-empty.t b/tests/test-hgweb-empty.t
--- a/tests/test-hgweb-empty.t
+++ b/tests/test-hgweb-empty.t
@@ -263,6 +263,9 @@ Some tests for hgweb in an empty reposit
   browse
   
   
+  
+  
+  
help
   
   
diff --git a/tests/test-hgweb-symrev.t b/tests/test-hgweb-symrev.t
--- a/tests/test-hgweb-symrev.t
+++ b/tests/test-hgweb-symrev.t
@@ -56,6 +56,7 @@ Set up the repo
   log
   changeset
   browse
+  zip
   less
   more
   | rev 2: (0) tip 
@@ -122,6 +123,7 @@ Set up the repo
   log
   changeset
   browse
+  zip
   less
   more
   | rev 1: (0) tip 
@@ -254,6 +256,7 @@ Set up the repo
   log
   changeset
   browse
+  zip
   less
   more
   | rev 2: (0) tip 
@@ -320,6 +323,7 @@ Set up the repo
   log
   changeset
   browse
+  zip
   less
   more
   | rev 1: (0) tip 
@@ -485,7 +489,7 @@ Set up the repo
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph?style=gitweb' | 
egrep $REVLINKS
   shortlog |
   changelog |
-  files |
+  files | zip  |
   less
   more
   | (0) tip 
@@ -577,7 +581,7 @@ Set up the repo
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph/xyzzy?style=gitweb' 
| egrep $REVLINKS
   shortlog |
   changelog |
-  files |
+  files | zip  |
   less
   more
   | (0) tip 
@@ -725,6 +729,7 @@ Set up the repo
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'graph?style=monoblue' | 
egrep $REVLINKS
   files
+  zip
   third
   second
   first
@@ -806,6 +811,7 @@ Set up the repo
 
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 
'graph/xyzzy?style=monoblue' | egrep $REVLINKS
   files
+  zip
   second
   first
   less
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] hgweb: add z-index for search field tooltip

2018-06-28 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1530142868 -28800
#  Thu Jun 28 07:41:08 2018 +0800
# Node ID 9ddf150b8e266c7e81e018552630994529e54d50
# Parent  b4cfd803b3f2697928be9b3a96787bcee3447c7e
hgweb: add z-index for search field tooltip

On graph page, search field tooltip sometimes goes down to the graph area,
where it used to be covered by foreground element of graph entries (.fg)
because they have z-index: 10.

To prevent the tooltip from being covered, z-index: 15 is enough.

diff --git a/mercurial/templates/static/style-gitweb.css 
b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -74,6 +74,7 @@ div#hint {
   background: #ffc;
   border: 1px solid yellow;
   border-radius: 5px;
+  z-index: 15;
 }
 
 #searchform:hover div#hint { display: block; }
diff --git a/mercurial/templates/static/style-paper.css 
b/mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css
+++ b/mercurial/templates/static/style-paper.css
@@ -90,6 +90,7 @@ form.search div#hint {
   font-size: 70%;
   border: 1px solid yellow;
   border-radius: 5px;
+  z-index: 15;
 }
 
 form.search:hover div#hint { display: block; }
diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
--- a/tests/test-hgweb.t
+++ b/tests/test-hgweb.t
@@ -336,7 +336,7 @@ static file
 
   $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - 
date etag server
   200 Script output follows
-  content-length: 9059
+  content-length: 9074
   content-type: text/css
   
   body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; 
border-width:1px; margin:10px; background: white; color: black; }
@@ -415,6 +415,7 @@ static file
 background: #ffc;
 border: 1px solid yellow;
 border-radius: 5px;
+z-index: 15;
   }
   
   #searchform:hover div#hint { display: block; }
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel