D3728: grep: adds allfiles mode

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3728?vs=9107=9121

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  tests/test-grep.t

CHANGE DETAILS

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -368,3 +368,20 @@
   binfile.bin:0:+: Binary file matches
 
   $ cd ..
+
+Test for showing working of allfiles flag
+
+  $ hg init sng
+  $ cd sng
+  $ echo "unmod" >> um
+  $ hg ci -A -m "adds unmod to um"
+  adding um
+  $ echo "something else" >> new
+  $ hg ci -A -m "second commit"
+  adding new
+  $ hg grep -r "." "unmod"
+  [1]
+  $ hg grep -r "." "unmod" --allfiles
+  um:1:unmod
+
+  $ cd ..
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2408,6 +2408,8 @@
 ('n', 'line-number', None, _('print matching line numbers')),
 ('r', 'rev', [],
  _('only search files changed within revision range'), _('REV')),
+('', 'allfiles', False,
+ _('include all files in the changeset while grepping (EXPERIMENTAL)')),
 ('u', 'user', None, _('list the author (long with -v)')),
 ('d', 'date', None, _('list the date (short with -q)')),
 ] + formatteropts + walkopts,
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1881,10 +1881,14 @@
 yielding each context, the iterator will first call the prepare
 function on each context in the window in forward order.'''
 
+allfiles = opts.get('allfiles')
+
 follow = opts.get('follow') or opts.get('follow_first')
 revs = _walkrevs(repo, opts)
 if not revs:
 return []
+if allfiles and len(revs) > 1:
+raise error.Abort(_("multiple revisions not supported with 
--allfiles"))
 wanted = set()
 slowpath = match.anypats() or (not match.always() and opts.get('removed'))
 fncache = {}
@@ -1990,7 +1994,11 @@
 ctx = change(rev)
 if not fns:
 def fns_generator():
-for f in ctx.files():
+if allfiles and len(revs) == 1:
+fiter = iter(ctx)
+else:
+fiter = ctx.files()
+for f in fiter:
 if match(f):
 yield f
 fns = fns_generator()



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


D3728: grep: adds allfiles mode

2018-06-16 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 added a comment.


  @yuja Sorry I didn't run the tests after this edit .

REPOSITORY
  rHG Mercurial

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

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


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

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


  >   I agree with @yuja that we should move this to `util.py` or one of its
  > 
  > siblings and rename it to `uninterruptable` or some such.
  
  procutil.py would be a better place.
  
  > That being said, signal handlers are process global. And we do need to
  >  maintain persistent state so things don't get out of whack if we have
  >  overlapping calls, potentially from multiple threads (e.g. in the case
  >  of hgweb). So maybe `ui.py` - or even a global variable in that module -
  >  is the proper place for such state.
  
  I think `ui`-level blocking flag is fine. We won't have to care about
  overlapped requests from threads because `signal.signal()` just doesn't
  work in sub threads.
  
  What I had in mind was something like the following:
  
class ui:
@contextmanager
def uninterruptable(self):
if already blocked or not enabled:
yield
return
with procutil.uninterruptable(warn=self.warn, onlysigint=True,
  allowdoublesigint=True):
set blocked
yield
clear blocked

REPOSITORY
  rHG Mercurial

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

To: durin42, #hg-reviewers, indygreg
Cc: 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 unsafeoperation context manager that can block SIGINT

2018-06-16 Thread Yuya Nishihara
>   I agree with @yuja that we should move this to `util.py` or one of its
> siblings and rename it to `uninterruptable` or some such.

procutil.py would be a better place.

> That being said, signal handlers are process global. And we do need to
> maintain persistent state so things don't get out of whack if we have
> overlapping calls, potentially from multiple threads (e.g. in the case
> of hgweb). So maybe `ui.py` - or even a global variable in that module -
> is the proper place for such state.

I think `ui`-level blocking flag is fine. We won't have to care about
overlapped requests from threads because `signal.signal()` just doesn't
work in sub threads.

What I had in mind was something like the following:

```
class ui:
@contextmanager
def uninterruptable(self):
if already blocked or not enabled:
yield
return
with procutil.uninterruptable(warn=self.warn, onlysigint=True,
  allowdoublesigint=True):
set blocked
yield
clear blocked
```
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3757: rebase: add dry-run functionality

2018-06-16 Thread Yuya Nishihara
Just nitpicking. The feature generally looks good to me.

> @@ -798,6 +797,15 @@
>  
>  """
>  inmemory = ui.configbool('rebase', 'experimental.inmemory')
> +dryrun = opts.get(r'dry_run')
> +if dryrun:
> +if (opts.get(r'abort')):
> +raise error.Abort(_('cannot specify both --dry-run '
> +'and --abort'))
> +if (opts.get(r'continue')):
> +raise error.Abort(_('cannot specify both --dry-run '
> +'and --continue'))
   
excessive indent and unnecessary parens.

> -if inmemory:
> +if dryrun:
>  try:
> -# in-memory merge doesn't support conflicts, so if we hit any, 
> abort
> -# and re-run as an on-disk merge.
>  overrides = {('rebase', 'singletransaction'): True}
>  with ui.configoverride(overrides, 'rebase'):
> -return _origrebase(ui, repo, inmemory=inmemory, **opts)
> +_origrebase(ui, repo, inmemory=True, dryrun=dryrun, **opts)
^

Perhaps this flag shouldn't be called a `dryrun` because it would leave
a rebase session unless we do abort.

>  except error.InMemoryMergeConflictsError:
> -ui.warn(_('hit merge conflicts; re-running rebase without 
> in-memory'
> -  ' merge\n'))
> +ui.status(_('Hit a merge conflict\n'))
> +else:
> +ui.status(_('There will be no conflict, you can rebase\n'))
> +finally:
>  _origrebase(ui, repo, **{r'abort': True})
 ^^^

It can be written as just `abort=True`.

> -return _origrebase(ui, repo, inmemory=False, **opts)
> +
>  else:
> -return _origrebase(ui, repo, **opts)
> +if inmemory:

I slightly prefer `elif inmemory` than nesting one more depth.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3757: rebase: add dry-run functionality

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


  Just nitpicking. The feature generally looks good to me.
  
  > @@ -798,6 +797,15 @@
  > 
  >   """
  >   inmemory = ui.configbool('rebase', 'experimental.inmemory')
  > 
  > +dryrun = opts.get(r'dry_run')
  >  +if dryrun:
  >  +if (opts.get(r'abort')):
  >  +raise error.Abort(_('cannot specify both --dry-run '
  >  +'and --abort'))
  >  +if (opts.get(r'continue')):
  >  +raise error.Abort(_('cannot specify both --dry-run '
  >  +'and --continue'))
  

  
  excessive indent and unnecessary parens.
  
  > - if inmemory: +if dryrun: try:
  > - # in-memory merge doesn't support conflicts, so if we hit any, abort
  > - # and re-run as an on-disk merge. overrides = {('rebase', 
'singletransaction'): True} with ui.configoverride(overrides, 'rebase'):
  > - return _origrebase(ui, repo, inmemory=inmemory, **opts) +
_origrebase(ui, repo, inmemory=True, dryrun=dryrun, **opts)
  
^
  
  Perhaps this flag shouldn't be called a `dryrun` because it would leave
  a rebase session unless we do abort.
  
  >   except error.InMemoryMergeConflictsError:
  > 
  > - ui.warn(_('hit merge conflicts; re-running rebase without in-memory'
  > - ' merge\n')) +ui.status(_('Hit a merge conflict\n')) +
else: +ui.status(_('There will be no conflict, you can rebase\n')) 
+finally: _origrebase(ui, repo, **{r'abort': True})
  
^^^
  
  It can be written as just `abort=True`.
  
  > - return _origrebase(ui, repo, inmemory=False, **opts) + else:
  > - return _origrebase(ui, repo, **opts) +if inmemory:
  
  I slightly prefer `elif inmemory` than nesting one more depth.

REPOSITORY
  rHG Mercurial

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

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


D3730: morestatus: remove some extra spaces

2018-06-16 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG50f5fc232c16: morestatus: remove some extra spaces 
(authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3730?vs=9054=9120

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-conflict.t
  tests/test-graft.t
  tests/test-histedit-fold.t
  tests/test-rebase-conflicts.t
  tests/test-shelve.t

CHANGE DETAILS

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -354,8 +354,8 @@
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # To continue:hg unshelve --continue
-  # To abort:   hg unshelve --abort
+  # To continue:hg unshelve --continue
+  # To abort:   hg unshelve --abort
   
 
 ensure that we have a merge with unresolved conflicts
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
@@ -80,8 +80,8 @@
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # To continue:hg rebase --continue
-  # To abort:   hg rebase --abort
+  # To continue:hg rebase --continue
+  # To abort:   hg rebase --abort
   
 
 Try to continue without solving the conflict:
diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -306,8 +306,8 @@
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # To continue:hg histedit --continue
-  # To abort:   hg histedit --abort
+  # To continue:hg histedit --continue
+  # To abort:   hg histedit --abort
   
   $ hg resolve -l
   U file
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -236,8 +236,8 @@
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # To continue:hg graft --continue
-  # To abort:   hg update --clean .(warning: this will 
discard uncommitted changes)
+  # To continue:hg graft --continue
+  # To abort:   hg update --clean . (warning: this will discard 
uncommitted changes)
   
 
 Commit while interrupted should fail:
diff --git a/tests/test-conflict.t b/tests/test-conflict.t
--- a/tests/test-conflict.t
+++ b/tests/test-conflict.t
@@ -57,8 +57,8 @@
   # 
   # To mark files as resolved:  hg resolve --mark FILE
   
-  # To continue:hg commit
-  # To abort:   hg update --clean .(warning: this will 
discard uncommitted changes)
+  # To continue:hg commit
+  # To abort:   hg update --clean . (warning: this will discard 
uncommitted changes)
   
 
   $ cat a
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -588,8 +588,8 @@
 return _commentlines(msg)
 
 def _helpmessage(continuecmd, abortcmd):
-msg = _('To continue:%s\n'
-'To abort:   %s') % (continuecmd, abortcmd)
+msg = _('To continue:%s\n'
+'To abort:   %s') % (continuecmd, abortcmd)
 return _commentlines(msg)
 
 def _rebasemsg():
@@ -603,7 +603,7 @@
 
 def _updatecleanmsg(dest=None):
 warning = _('warning: this will discard uncommitted changes')
-return 'hg update --clean %s(%s)' % (dest or '.', warning)
+return 'hg update --clean %s (%s)' % (dest or '.', warning)
 
 def _graftmsg():
 # tweakdefaults requires `update` to have a rev hence the `.`



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


D3728: grep: adds allfiles mode

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


  > +  $ hg init sng
  >  +  $ cd sng
  >  +  $ echo "unmod" >> um
  >  +  $ hg ci -A -m "adds unmod to um"
  >  +  adding um
  >  +  $ echo "something else" >> new
  >  +  $ hg ci -A -m "second commit"
  >  +  adding new
  >  +  $ hg grep -r "." "unmod"
  >  +  [1]
  >  +  $ hg grep -r "." "unmod" --unmodified
  
  --allfiles ?
  
  > @@ -1881,6 +1881,9 @@
  > 
  >   yielding each context, the iterator will first call the prepare
  >   function on each context in the window in forward order.'''
  > 
  > 
  > +allfiles = opts.get('allfiles')
  >  +if allfiles and len(revs) > 1:
  >  +raise error.Abort(_("multiple revisions not supported with 
--allfiles"))
  
  `revs` isn't defined yet.
  
  >   follow = opts.get('follow') or opts.get('follow_first')
  >   revs = _walkrevs(repo, opts)
  >   if not revs:

REPOSITORY
  rHG Mercurial

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

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


Re: D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread Yuya Nishihara
>   > (a) it's an extension which isn't on by default
>   >  (b) your font choices are your own. That doesn't look like any default 
> font I've ever seen, so this is unlikely to affect many others
>
>   Off topic. But there are many CJK fonts that you probably haven't seen. 
> People using them are not a minority. So it's unfair to say "this is unlikely 
> to affect many others".

For the record, as a person living in emoji country, I understand the
narrow/wide character madness as well as fonts issues. And we're trained to
avoid any 8-bit characters unless necessary because only ASCII (except 0x5c)
is trustworthy.

That's the reason I thought I wasn't the right person to judge the value
of this extension. If some people love this feature, we shouldn't stop it
just because it wouldn't work in many CJK environments.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3728: grep: adds unmodified mode

2018-06-16 Thread Yuya Nishihara
> +  $ hg init sng
> +  $ cd sng
> +  $ echo "unmod" >> um
> +  $ hg ci -A -m "adds unmod to um"
> +  adding um
> +  $ echo "something else" >> new
> +  $ hg ci -A -m "second commit"
> +  adding new
> +  $ hg grep -r "." "unmod"
> +  [1]
> +  $ hg grep -r "." "unmod" --unmodified

--allfiles ?

> @@ -1881,6 +1881,9 @@
>  yielding each context, the iterator will first call the prepare
>  function on each context in the window in forward order.'''
>  
> +allfiles = opts.get('allfiles')
> +if allfiles and len(revs) > 1:
> +raise error.Abort(_("multiple revisions not supported with 
> --allfiles"))

`revs` isn't defined yet.

>  follow = opts.get('follow') or opts.get('follow_first')
>  revs = _walkrevs(repo, opts)
>  if not revs:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

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


  >   > (a) it's an extension which isn't on by default
  >   >  (b) your font choices are your own. That doesn't look like any default 
font I've ever seen, so this is unlikely to affect many others
  >   
  >   Off topic. But there are many CJK fonts that you probably haven't seen. 
People using them are not a minority. So it's unfair to say "this is unlikely 
to affect many others".
  
  For the record, as a person living in emoji country, I understand the
  narrow/wide character madness as well as fonts issues. And we're trained to
  avoid any 8-bit characters unless necessary because only ASCII (except 0x5c)
  is trustworthy.
  
  That's the reason I thought I wasn't the right person to judge the value
  of this extension. If some people love this feature, we shouldn't stop it
  just because it wouldn't work in many CJK environments.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread smf (Sean Farley)
smf added a comment.


  In https://phab.mercurial-scm.org/D3665#58976, @smf wrote:
  
  > In https://phab.mercurial-scm.org/D3665#58973, @johnstiles wrote:
  >
  > > Thanks for the assist, @smf ! I appreciate it.
  >
  >
  > Sure, no problem :-)
  >
  > By the way, here's the diff of what I changed:
  >
  >   diff --git a/hgext/beautifygraph.py b/hgext/beautifygraph.py
  >   index 7ff3c08..254d2cc 100644
  >   --- a/hgext/beautifygraph.py
  >   +++ b/hgext/beautifygraph.py
  >   @@ -4,23 +4,23 @@
  ># Copyright 2018 John Stiles 
  >#
  ># This software may be used and distributed according to the terms of the
  ># GNU General Public License version 2 or any later version.
  >   
  >   -'''This extension beautifies log -G output by using Unicode characters.
  >   +'''beautify log -G output by using Unicode characters (EXPERIMENTAL)
  
  
  In the Mercurial project, we use "EXPERIMENTAL" as a flag to mean "we have 
the option to remove this later." In general, we have a very strong breaking 
change policy (as in, we try to never have one). The only exceptions to that 
rule that I'm aware of are if it's a security problem (e.g. default clone of 
subrepositories changed due to major security flaws) or was broken from day 1.
  
  >  A terminal with UTF-8 support and monospace narrow text are required.
  >   '''
  >   
  >   from __future__ import absolute_import
  >   
  >   from mercurial.i18n import _
  >   from mercurial import (
  >   encoding,
  >   extensions,
  > 
  > +graphmod,
  > 
  >   templatekw,
  > 
  > - graphmod )
  
  I'll go through and briefly explain each hunk (just for reference and if any 
other newcomers find this patch). The `graphmod` import needed to be earlier 
due to our code style checker.
  
  > 1. Note for extension authors: ONLY specify testedwith = 
'ships-with-hg-core' for
  > 2. extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
  > 3. be specifying the version(s) of Mercurial they are tested with, or diff 
--git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py index 
4511a89..397eca4 100644
  >   - a/tests/test-duplicateoptions.py +++ b/tests/test-duplicateoptions.py 
@@ -4,11 +4,11 @@ from mercurial import ( commands, extensions, ui as uimod, )
  > 
  > -ignore = {b'highlight', b'win32text', b'factotum'} +ignore = 
{b'highlight', b'win32text', b'factotum', b'beautifygraph'}
  
  I only found this test breaking on the gcc compile farm with the output 
changing to "beautifygraph: unsupported encoding, UTF-8 required" so I choose 
to skip importing that extension in this test.
  
  >   if os.name != 'nt':
  >   ignore.add(b'win32mbcs')
  >   
  >   disabled = [ext for ext in extensions.disabled().keys() if ext not in 
ignore]
  > 
  > diff --git a/tests/test-glog-beautifygraph.t 
b/tests/test-glog-beautifygraph.t
  >  index c3d1fb7..e62334f 100644
  > 
  > - a/tests/test-glog-beautifygraph.t +++ b/tests/test-glog-beautifygraph.t 
@@ -89,10 +89,14 @@ o  (0) root >   logcmdutil, >   revsetlang, >   smartset, > 
) > +  > from mercurial.utils import ( +  >   stringutil, +  > )
  
  Ah, yes, a classic race condition with another dev changing something that 
you're working on.
  
  >   > def logrevset(repo, pats, opts):
  >   > revs = logcmdutil._initialrevs(repo, opts)
  >   > if not revs:
  >   > return None
  >   > match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, 
opts)
  > 
  > @@ -109,11 +113,11 @@ o  (0) root
  > 
  >   > else:
  >   > tree = []
  >   > ui = repo.ui
  >   > ui.write(b'%r\n' % (opts.get(b'rev', []),))
  >   > ui.write(revsetlang.prettyformat(tree) + b'\n')
  > 
  > - > ui.write(smartset.prettyformat(revs) + b'\n') +  >  
   ui.write(stringutil.prettyrepr(revs) + b'\n')
  
  As I mentioned above, it seems Yuya changed this and it landed before your 
patch.
  
  >   > revs = smartset.baseset()  # display no revisions
  >   > return revs, filematcher
  >   > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset)
  >   > aliases, entry = cmdutil.findcmd(b'log', commands.table)
  >   > entry[1].append((b'', b'print-revset', False,
  > 
  > @@ -324,1003 +328,1001 @@ The extension should not turn on if we'r
  > 
  > 
  >   
  >   The rest of our tests will use the default narrow text UTF-8.
  >   
  > $ hg log -G -q
  > 
  > - \xe2\x8c\xbe  34:fea3ac5810e0 (esc) +  \xe2\x97\x8d  34:fea3ac5810e0 (esc)
  
  Ah, I think you forgot to update the test output when changing some of the 
characters you used (at least I hope that was the problem here). All I did to 
update the whole test at large was run with: `run-tests.py -l 
tests/test-glog-beautifygraph.t -i`. The `-i` meaning "interactively ask the 
user to accept this change" which will automatically change the test file for 
you.
  
  >   \xe2\x94\x82 (esc)
  > 
  > - \xe2\x94\x82 

D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread smf (Sean Farley)
smf added a comment.


  In https://phab.mercurial-scm.org/D3665#58973, @johnstiles wrote:
  
  > Thanks for the assist, @smf ! I appreciate it.
  
  
  Sure, no problem :-)
  
  By the way, here's the diff of what I changed:
  
diff --git a/hgext/beautifygraph.py b/hgext/beautifygraph.py
index 7ff3c08..254d2cc 100644
--- a/hgext/beautifygraph.py
+++ b/hgext/beautifygraph.py
@@ -4,23 +4,23 @@
 # Copyright 2018 John Stiles 
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-'''This extension beautifies log -G output by using Unicode characters.
+'''beautify log -G output by using Unicode characters (EXPERIMENTAL)
 
A terminal with UTF-8 support and monospace narrow text are required.
 '''
 
 from __future__ import absolute_import
 
 from mercurial.i18n import _
 from mercurial import (
 encoding,
 extensions,
+graphmod,
 templatekw,
-graphmod
 )
 
 # Note for extension authors: ONLY specify testedwith = 
'ships-with-hg-core' for
 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
 # be specifying the version(s) of Mercurial they are tested with, or
diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py
index 4511a89..397eca4 100644
--- a/tests/test-duplicateoptions.py
+++ b/tests/test-duplicateoptions.py
@@ -4,11 +4,11 @@ from mercurial import (
 commands,
 extensions,
 ui as uimod,
 )
 
-ignore = {b'highlight', b'win32text', b'factotum'}
+ignore = {b'highlight', b'win32text', b'factotum', b'beautifygraph'}
 
 if os.name != 'nt':
 ignore.add(b'win32mbcs')
 
 disabled = [ext for ext in extensions.disabled().keys() if ext not in 
ignore]
diff --git a/tests/test-glog-beautifygraph.t 
b/tests/test-glog-beautifygraph.t
index c3d1fb7..e62334f 100644
--- a/tests/test-glog-beautifygraph.t
+++ b/tests/test-glog-beautifygraph.t
@@ -89,10 +89,14 @@ o  (0) root
   >   logcmdutil,
   >   revsetlang,
   >   smartset,
   > )
   > 
+  > from mercurial.utils import (
+  >   stringutil,
+  > )
+  > 
   > def logrevset(repo, pats, opts):
   > revs = logcmdutil._initialrevs(repo, opts)
   > if not revs:
   > return None
   > match, pats, slowpath = logcmdutil._makematcher(repo, revs, pats, 
opts)
@@ -109,11 +113,11 @@ o  (0) root
   > else:
   > tree = []
   > ui = repo.ui
   > ui.write(b'%r\n' % (opts.get(b'rev', []),))
   > ui.write(revsetlang.prettyformat(tree) + b'\n')
-  > ui.write(smartset.prettyformat(revs) + b'\n')
+  > ui.write(stringutil.prettyrepr(revs) + b'\n')
   > revs = smartset.baseset()  # display no revisions
   > return revs, filematcher
   > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset)
   > aliases, entry = cmdutil.findcmd(b'log', commands.table)
   > entry[1].append((b'', b'print-revset', False,
@@ -324,1003 +328,1001 @@ The extension should not turn on if we'r
   
 
 The rest of our tests will use the default narrow text UTF-8.
 
   $ hg log -G -q
-  \xe2\x8c\xbe  34:fea3ac5810e0 (esc)
+  \xe2\x97\x8d  34:fea3ac5810e0 (esc)
   \xe2\x94\x82 (esc)
-  \xe2\x94\x82 \xe2\x97\xaf  33:68608f5145f9 (esc)
+  \xe2\x94\x82 \xe2\x97\x8b  33:68608f5145f9 (esc)

[... elided the rest]

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Thanks for the assist, @smf ! I appreciate it.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread smf (Sean Farley)
smf added a comment.


  Greg and Jun,
  
  Before anyone else requests more changes or anything, this is a first time 
contributor and I was trying to be a bit more flexible as a reviewer. I 
actually queued the patch yesterday but due to the test failures, I haven't 
pushed. I'll personally fix up the tests and add the experimental flag.
  
  John,
  
  Don't worry about updating this patch or rebasing. I've already (locally) 
added "EXPERIMENTAL" and am fixing the other test failures, too. I just haven't 
finished yet because I'm trying to also finish my household chores :-P I'll 
post a diff of what I tweaked when I finish this weekend. Thanks for bearing 
with me on this discussion!

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.


  I'm getting a few test errors applying this against the latest revision of 
`hg` repo:
  
--- /Users/gps/src/hg-committed/tests/test-check-commit.t
+++ /Users/gps/src/hg-committed/tests/test-check-commit.t.err
@@ -25,3 +25,10 @@
   > fi
   >   done
   > fi
+  Revision 82a9045ac1a2 does not comply with rules
+  --
+  1225: adds double empty line
+   +
+  1419: adds double empty line
+   +
+
  
  
  
--- /Users/gps/src/hg-committed/tests/test-check-module-imports.t
+++ /Users/gps/src/hg-committed/tests/test-check-module-imports.t.err
@@ -43,3 +43,5 @@
   > -X tests/test-lock.py \
   > -X tests/test-verify-repo-operations.py \
   > | sed 's-\\-/-g' | $PYTHON "$import_checker" -
+  hgext/beautifygraph.py:17: imports from mercurial not lexically sorted: 
graphmod < templatekw
+  [1]
  
  
  
--- /Users/gps/src/hg-committed/tests/test-check-code.t
+++ /Users/gps/src/hg-committed/tests/test-check-code.t.err
@@ -12,9 +12,13 @@
   > -X hgext/fsmonitor/pywatchman \
   > -X mercurial/thirdparty \
   > | sed 's-\\-/-g' | "$check_code" --warnings --per-file=0 - || false
+  hgext/beautifygraph.py:9:
+   > '''beautify log -G output by using Unicode characters (EXPERIMENTAL)
+   trailing whitespace
   Skipping i18n/polib.py it has no-che?k-code (glob)
   Skipping mercurial/statprof.py it has no-che?k-code (glob)
   Skipping tests/badserverext.py it has no-che?k-code (glob)
+  [1]
  
  
  
  File "$TESTTMP/printrevset.py", line 31, in printrevset
ui.write(smartset.prettyformat(revs) + b'\n')
AttributeError: 'module' object has no attribute 'prettyformat'
  
  Please rebase this against the latest Mercurial revision, fix the static 
analysis failures, and resubmit.
  
  You should be able to test via: `cd tests; ./run-tests.py -l -j4 
test-check-commit.t test-check-module-imports.t test-check-code.t 
test-glog-beautifygraph.t`.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  朗
  
  Next patch, emoji!

REPOSITORY
  rHG Mercurial

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

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


D3762: py3: whitelist another 5 passing tests thanks to the ratchet

2018-06-16 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG03aa222ca28e: py3: whitelist another 5 passing tests thanks 
to the ratchet (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3762?vs=9117=9118

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -158,6 +158,7 @@
 test-extensions-afterloaded.t
 test-extensions-wrapfunction.py
 test-extra-filelog-entry.t
+test-fetch.t
 test-filebranch.t
 test-filecache.py
 test-filelog.py
@@ -326,6 +327,8 @@
 test-narrow-shallow.t
 test-narrow-strip.t
 test-narrow-update.t
+test-narrow-widen.t
+test-narrow.t
 test-nested-repo.t
 test-newbranch.t
 test-obshistory.t
@@ -339,6 +342,7 @@
 test-pager.t
 test-parents.t
 test-parseindex2.py
+test-patch.t
 test-pathconflicts-merge.t
 test-pathconflicts-update.t
 test-pathencode.py
@@ -488,6 +492,7 @@
 test-ui-config.py
 test-ui-verbosity.py
 test-unamend.t
+test-unbundlehash.t
 test-uncommit.t
 test-unified-test.t
 test-unionrepo.t



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


Re: Discussion about Mercurial 4.8 Sprint

2018-06-16 Thread Gregory Szorc
On Fri, Jun 15, 2018 at 12:20 PM, Augie Fackler  wrote:

>
>
> > On Jun 15, 2018, at 10:01, Marla da Silva 
> wrote:
> >
> > We really liked to organize mercurial "mini-sprint" which took place at
> our office few weeks ago and we are ready to organize the "real
> international mercurial sprint"!
> >
> > So, please note that Paris can be a location if you are still looking
> for a place in Europe.
> >
> > Our office is not fancy like other places you have been before in Paris
> but feel welcome to do it here!
> >
> > Our premises are available on:
> >
> > - September 7-8-9
> > - September 14-15-16
> > - October 26-27-28
> > - November 8-9-10
> > - November 23-24-25
> >
> > We have two rooms that can accommodate 12 people each, and also few
> small offices for 2 persons each.
> >
>
> Hm, 12 people would be a little small, I don't think we'd be able to get
> everyone in the room. Our last sprint, which was the smallest sprint in
> recent memory was 16 people - do you have any leads on something that'd at
> least let us get 20 people in a room together?
>
> > Please note that we do not want to stop people motivated from organizing
> this sprint in Japan. Unfortunately, Logilab team won't be able to go there
> this time.
> >
> > And if our office does not suit you, we will be happy to help you to
> find another place in France.
>
> More options is always good!
>
> > Thank you for your attention,
>
> Thank you for reaching out and the offer! Finding space for sprints is
> often a challenge.
>

I think it would be productive if we could easily see a list of everyone's
location availability and preferences so we can make a more informed
decision about the location and the trade-offs that would have.

I've updated the people availability table at
https://www.mercurial-scm.org/wiki/4.8sprint to add columns for location
availability and preference. Please update the wiki with your availability
and preference.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Thanks for the concrete feedback. I've uploaded a new diff. The 
(EXPERIMENTAL) tag has been added and I am now using `hg export` to generate 
the diff.

REPOSITORY
  rHG Mercurial

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

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


D3762: py3: whitelist another 5 passing tests thanks to the ratchet

2018-06-16 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: pulkit.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/python3-whitelist

CHANGE DETAILS

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -158,6 +158,7 @@
 test-extensions-afterloaded.t
 test-extensions-wrapfunction.py
 test-extra-filelog-entry.t
+test-fetch.t
 test-filebranch.t
 test-filecache.py
 test-filelog.py
@@ -326,6 +327,8 @@
 test-narrow-shallow.t
 test-narrow-strip.t
 test-narrow-update.t
+test-narrow-widen.t
+test-narrow.t
 test-nested-repo.t
 test-newbranch.t
 test-obshistory.t
@@ -339,6 +342,7 @@
 test-pager.t
 test-parents.t
 test-parseindex2.py
+test-patch.t
 test-pathconflicts-merge.t
 test-pathconflicts-update.t
 test-pathencode.py
@@ -488,6 +492,7 @@
 test-ui-config.py
 test-ui-verbosity.py
 test-unamend.t
+test-unbundlehash.t
 test-uncommit.t
 test-unified-test.t
 test-unionrepo.t



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


D3757: rebase: add dry-run functionality

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.


  Overall I think this is a great feature! The patch as is needs a bit of UI 
work.
  
  Others may have different opinions from mine. So you may want to wait for 
another core developer to weigh in on things.

INLINE COMMENTS

> rebase.py:831-833
> +ui.status(_('Hit a merge conflict\n'))
> +else:
> +ui.status(_('There will be no conflict, you can rebase\n'))

Nit: please use lower case letters to being the message so we're consistent 
with the rest of Mercurial.

> test-rebase-inmemory.t:210-215
> +  $ hg rebase -s 2 -d 6 -n
> +  rebasing 2:177f92b77385 "c"
> +  rebasing 3:055a42cdd887 "d"
> +  rebasing 4:e860deea161a "e"
> +  There will be no conflict, you can rebase
> +  rebase aborted

This is potentially follow-up territory, but I think there is room to improve 
the output here.

I think it would be better to print a message before beginning the dry-run 
rebase so the output is clear that no permanent actions are being taken. e.g. 
`(starting dry-run rebase; repository will not be changed)`.

Similarly, let's tweak the success message a bit. How about `dry-run rebase 
completed successfully; run without -n/--dry-run to perform this rebase`. And I 
don't think we need to print the `rebase aborted` message in this case.

> test-rebase-inmemory.t:280-288
> +  $ hg rebase -s 2 -d 7 -n
> +  rebasing 2:177f92b77385 "c"
> +  rebasing 3:055a42cdd887 "d"
> +  rebasing 4:e860deea161a "e"
> +  merging e
> +  transaction abort!
> +  rollback completed

Again, more nit picks around the messaging.

Again, I think this should print a message that we are starting a dry-run 
rebase.

The `transaction abort!` and `rollback completed` messages are a bit concerning 
to me as a user because a dry-run isn't supposed to alert the repository. But 
the presence of these messages implies it is being altered. Come to think of 
it, the repository may actually be altered during dry-run rebases. Is it? But 
if it is, why don't we see these messages for the successful dry-run case?

I also think it would be helpful if the abort message clearly stated the 
changeset that triggered the failure and the file(s) the merge conflict was in. 
Yes, you can infer it from the output. But summaries are nice. Especially since 
we have been known to change the `rebasing` messages and tweaks could render 
the output difficult to parse for the failure.

As a follow-up feature, it would be pretty cool if adding `--verbose` would 
print the diff of the file section that has the merge conflict. That may 
require a refactoring of the merge code though. This is clearly a follow-up 
feature and shouldn't be included in this patch.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.


  I think having better display of graph symbols is a compelling end-user 
feature and should be part of Mercurial.
  
  It is apparent that no set of advanced glyphs works in all terminals and 
fonts. But that shouldn't mean people can't opt in to using more visually 
appealing glyphs in graph output.
  
  I think this extension is a step in the right direction. But I also don't 
feel comfortable exposing this extension to all users just yet because of the 
many environments it doesn't work in.
  
  If we add `(EXPERIMENTAL)` to the first line of the module docstring (so it 
doesn't show up in `hg help` output), I'm comfortable accepting this extension 
as is. We can remove the experimental state of the feature once support for 
customizing glyphs is added. That can be done in the extension or (preferably) 
in core, alleviating the need for an extension.
  
  While I'm here, I think a reasonable follow-up feature would is to have 
built-in "profiles" for graph glyphs so users could e.g. start with a set of 
glyphs that are known to work reasonably well given a certain terminal 
emulator, font, etc. We could also provide a `hg debuggraphlog` or similar that 
printed examples of the various built-in profiles so users could pick one that 
renders the best. This could be exposed via a `ui.graph-symbols` config option 
or similar.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  I don’t disagree with your premise, but the comments section of this patch 
are not really the right venue for this discussion.

REPOSITORY
  rHG Mercurial

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

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


D3686: shelve: wider check for successful abort in test

2018-06-16 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2313a3599e41: shelve: wider check for successful abort in 
test (authored by lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3686?vs=8974=9115

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

AFFECTED FILES
  tests/test-shelve.t

CHANGE DETAILS

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1289,8 +1289,16 @@
   [1]
   $ sed 's/ae8c668541e8/123456789012/' .hg/shelvedstate > 
../corrupt-shelvedstate
   $ mv ../corrupt-shelvedstate .hg/histedit-state
-  $ hg unshelve --abort 2>&1 | grep 'rebase aborted'
+  $ hg unshelve --abort 2>&1 | grep 'aborted'
   rebase aborted
+  unshelve of 'default-01' aborted
+  $ hg summary
+  parent: 0:ae8c668541e8 tip
+   root
+  branch: default
+  commit: 1 modified, 1 unknown
+  update: (current)
+  phases: 1 draft
   $ hg up -C .
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 



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


D3685: shelve: use full hash in tests

2018-06-16 Thread lothiraldan (Boris Feld)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG756a7682837f: shelve: use full hash in tests (authored by 
lothiraldan, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3685?vs=8973=9114

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

AFFECTED FILES
  tests/test-shelve.t

CHANGE DETAILS

diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -136,9 +136,7 @@
 cleaning the branches made for name checking tests
 
   $ hg up default -q
-  $ hg strip 3 -q
-  $ hg strip 2 -q
-  $ hg strip 1 -q
+  $ hg strip e9177275307e+6a6d231f43d+882bae7c62c2 -q
 
 create an mq patch - shelving should work fine with a patch applied
 
@@ -632,15 +630,15 @@
   $ hg commit -Aqm xy
   $ echo z >> x
   $ hg commit -Aqm z
-  $ hg up 0
+  $ hg up 5c4c67fb7dce
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ printf 'a\nx\ny\nz\n' > x
   $ hg commit -Aqm xyz
   $ echo c >> z
   $ hg shelve
   shelved as default
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  $ hg rebase -d 1 --config extensions.rebase=
+  $ hg rebase -d 6c103be8f4e4 --config extensions.rebase=
   rebasing 2:323bfa07f744 "xyz" (tip)
   merging x
   saved backup bundle to 
$TESTTMP/shelverebase/.hg/strip-backup/323bfa07f744-78114325-rebase.hg
@@ -661,16 +659,16 @@
   $ hg ci -Aqm a
   $ touch b
   $ hg ci -Aqm b
-  $ hg up -q 0
+  $ hg up -q 3903775176ed
   $ touch c
   $ hg ci -Aqm c
 
   $ touch d
   $ hg add d
   $ hg shelve
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg up -q 1
+  $ hg up -q 0e067c57feba
   $ hg unshelve
   unshelving change 'default'
   rebasing shelved changes
@@ -683,7 +681,7 @@
   $ hg shelve
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg up 0
+  $ hg up 3903775176ed
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg unshelve
   unshelving change 'default'
@@ -701,7 +699,7 @@
   $ hg shelve
   shelved as default
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg debugobsolete `hg --debug id -i -r 1`
+  $ hg debugobsolete `hg log -r 0e067c57feba -T '{node}'`
   obsoleted 1 changesets
   $ hg unshelve
   unshelving change 'default'
@@ -874,7 +872,7 @@
 Recreate some conflict again
 
   $ cd ../repo
-  $ hg up -C -r 3
+  $ hg up -C -r 2e69b451d1ea
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   (leaving bookmark test)
   $ echo y >> a/a
@@ -1204,7 +1202,7 @@
 
 == test visibility to external update hook
 
-  $ hg update -q -C 5
+  $ hg update -q -C 703117a2acfb
 
   $ cat >> .hg/hgrc < [hooks]
@@ -1280,7 +1278,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
 Try again but with a corrupted shelve state file
-  $ hg strip -r 2 -r 1 -q
+  $ hg strip -r 406ad6fb39eb -r e22bdf25c863 -q
   $ hg up -r 0 -q
   $ echo '' > root
   $ hg shelve -q
@@ -1558,7 +1556,7 @@
   $ hg shelve
   shelved as test
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  $ hg update -r default
+  $ hg update -r 7049e48789d7
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg unshelve
   unshelving change 'test'



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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D3665#58932, @johnstiles wrote:
  
  > Looks like your font is missing the dashed vertical line, and has an oddly 
small regular-circle glyph. I don't recognize the font at all so I can't really 
speak much more to that. Fortunately though...
  >
  > (a) it's an extension which isn't on by default
  >  (b) your font choices are your own. That doesn't look like any default 
font I've ever seen, so this is unlikely to affect many others
  
  
  Off topic. But there are many CJK fonts that you probably haven't seen. 
People using them are not a minority. So it's unfair to say "this is unlikely 
to affect many others".
  
  > I cannot possibly promise that this extension will look good in every OS, 
font and terminal. That's not a reasonable goal. If I thought looking perfect 
everywhere was an option, I'd be patching the mainline graph view instead of 
making an extension that opts-out by default.
  > 
  > Do you have any ideas to improve the situation? There has been plenty of 
font discussion in the thread already; this is not really covering any new 
ground.
  
  I believe the most "correct" solution is to revise the Unicode standard and 
upgrade fonts. But that cannot happen anytime soon. I do feel sad about the 
current situation.

REPOSITORY
  rHG Mercurial

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

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


D3756: rebase: no need to backup rebased csets while aborting

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg added subscribers: durin42, indygreg.
indygreg added a comment.


  I'm unsure about this change. On one hand, the comment (which appears to have 
been added to mpm several years ago) implies that we never should have 
generated backups in this case. On the other, one of the key rules of a VCS is 
"don't eat my data." Even though we are aborting the operation, I could see 
some scenarios where someone would want a backup of the 
aborted/partially-completed rebase.
  
  @durin42: what do you think?

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Looks like your font is missing the dashed vertical line, and has an oddly 
small regular-circle glyph. I don't recognize the font at all so I can't really 
speak much more to that. Fortunately though...
  
  (a) it's an extension which isn't on by default
  (b) your font choices are your own. That doesn't look like any default font 
I've ever seen, so this is unlikely to affect many others
  
  I cannot possibly promise that this extension will look good in every OS, 
font and terminal. That's not a reasonable goal. If I thought looking perfect 
everywhere was an option, I'd be patching the mainline graph view instead of 
making an extension that opts-out by default.
  
  Do you have any ideas to improve the situation? There has been plenty of font 
discussion in the thread already; this is not really covering any new ground.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread quark (Jun Wu)
quark added a comment.


  Since you mentioned Linux... Here is what your extension renders on my Linux 
terminal:
  
  F103407: 2018-06-16-122437_1046x658_scrot.png 

  
  The characters do not render as question marks, because I have fonts covering 
them and fontconfig smartly choose fallback fonts (Windows does similar things).
  
  I'm not saying others render the same as mine, but I'd repeat - "width" is 
per character, and is generally "undefined" - some of them are wide, some are 
narrow.
  
  You can say "it works great on *my* Linux", but not other's Linux. Depending 
on what fonts are installed, what the rendering engine is, what fontconfig says 
about font substitution rules, etc. There are just too many ways to get ugly 
results. And it still complies the Unicode standard - since it's undefined.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  For what it's worth, it works great on Linux, so no need to feel sad. That's 
my primary dev environment.  If you aren't interested in actually testing the 
extension itself I'm not sure why you are posting here, but thank you for the 
feedback about `type con` issues with UTF8 on Windows.  It was very elucidating.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread quark (Jun Wu)
quark added a comment.


  To be clear, I have no interest in +1 or -1 this feature, and I'm not 
interested in spending more time testing it. I think I have made it very clear 
that Windows (at least WSL) is going to be a headache. Not to say, Linux (as my 
primary OS) font rendering is another story that might surprise you.
  
  At a low-level, the Unicode specification does not define some characters to 
be "wide" or "narrow" explicitly. Using them is like "undefined behavior" 
depending on the actual font. `encoding._wide` cannot be accurate for two 
reasons - 1. no way to get the font details; 2. width is per character, not a 
global thing.
  
  I have seen people testing software on macOS only, then think it improves 
everyone's life and proudly announce the feature. As a Linux/Windows user, I 
feel sad.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Can you provide a screenshot of the actual Windows behavior?

REPOSITORY
  rHG Mercurial

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

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


D3760: packaging: don't write files for templatized Dockerfiles

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now that Docker image building is implemented in Python and we
  can perform template substitution in memory, we don't need to
  write out produced Dockerfiles to disk.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  .hgignore
  contrib/packaging/Makefile
  contrib/packaging/docker/debian.template
  contrib/packaging/docker/ubuntu.template
  contrib/packaging/dockerdeb

CHANGE DETAILS

diff --git a/contrib/packaging/dockerdeb b/contrib/packaging/dockerdeb
--- a/contrib/packaging/dockerdeb
+++ b/contrib/packaging/dockerdeb
@@ -15,7 +15,10 @@
 
 DOCKER=$($BUILDDIR/hg-docker docker-path)
 
-$BUILDDIR/hg-docker build $BUILDDIR/docker/$PLATFORM $CONTAINER
+$BUILDDIR/hg-docker build \
+--build-arg CODENAME=$CODENAME \
+$BUILDDIR/docker/$DISTID.template \
+$CONTAINER
 
 # debuild only appears to be able to save built debs etc to .., so we
 # have to share the .. of the current directory with the docker
diff --git a/contrib/packaging/docker/ubuntu.template 
b/contrib/packaging/docker/ubuntu.template
--- a/contrib/packaging/docker/ubuntu.template
+++ b/contrib/packaging/docker/ubuntu.template
@@ -1,4 +1,4 @@
-FROM ubuntu:__CODENAME__
+FROM ubuntu:%CODENAME%
 
 RUN groupadd -g 1000 build && \
 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
diff --git a/contrib/packaging/docker/debian.template 
b/contrib/packaging/docker/debian.template
--- a/contrib/packaging/docker/debian.template
+++ b/contrib/packaging/docker/debian.template
@@ -1,4 +1,4 @@
-FROM debian:__CODENAME__
+FROM debian:%CODENAME%
 
 RUN groupadd -g 1000 build && \
 useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
diff --git a/contrib/packaging/Makefile b/contrib/packaging/Makefile
--- a/contrib/packaging/Makefile
+++ b/contrib/packaging/Makefile
@@ -47,50 +47,44 @@
 ppa:
./builddeb --source-only
 
-docker/debian-%: docker/debian.template
-   sed "s/__CODENAME__/$*/" $< > $@
-
 .PHONY: docker-debian-jessie
-docker-debian-jessie: docker/debian-jessie
+docker-debian-jessie:
./dockerdeb debian jessie
 
 .PHONY: docker-debian-stretch
-docker-debian-stretch: docker/debian-stretch
+docker-debian-stretch:
./dockerdeb debian stretch
 
-docker/ubuntu-%: docker/ubuntu.template
-   sed "s/__CODENAME__/$*/" $< > $@
-
 .PHONY: docker-ubuntu-trusty
-docker-ubuntu-trusty: docker/ubuntu-trusty
+docker-ubuntu-trusty:
./dockerdeb ubuntu trusty
 
 .PHONY: docker-ubuntu-trusty-ppa
-docker-ubuntu-trusty-ppa: docker/ubuntu-trusty
+docker-ubuntu-trusty-ppa:
./dockerdeb ubuntu trusty --source-only
 
 .PHONY: docker-ubuntu-xenial
-docker-ubuntu-xenial: docker/ubuntu-xenial
+docker-ubuntu-xenial:
./dockerdeb ubuntu xenial
 
 .PHONY: docker-ubuntu-xenial-ppa
-docker-ubuntu-xenial-ppa: docker/ubuntu-xenial
+docker-ubuntu-xenial-ppa:
./dockerdeb ubuntu xenial --source-only
 
 .PHONY: docker-ubuntu-artful
-docker-ubuntu-artful: docker/ubuntu-artful
+docker-ubuntu-artful:
./dockerdeb ubuntu artful
 
 .PHONY: docker-ubuntu-artful-ppa
-docker-ubuntu-artful-ppa: docker/ubuntu-artful
+docker-ubuntu-artful-ppa:
./dockerdeb ubuntu artful --source-only
 
 .PHONY: docker-ubuntu-bionic
-docker-ubuntu-bionic: docker/ubuntu-bionic
+docker-ubuntu-bionic:
./dockerdeb ubuntu bionic
 
 .PHONY: docker-ubuntu-bionic-ppa
-docker-ubuntu-bionic-ppa: docker/ubuntu-bionic
+docker-ubuntu-bionic-ppa:
./dockerdeb ubuntu bionic --source-only
 
 .PHONY: fedora20
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -31,8 +31,6 @@
 contrib/chg/chg
 contrib/hgsh/hgsh
 contrib/vagrant/.vagrant
-contrib/packaging/docker/debian-*
-contrib/packaging/docker/ubuntu-*
 dist
 packages
 doc/common.txt



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


D3758: packaging: consistently create build user in Dockerfiles

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously, dockerlib.sh appended some commands to create a
  "build" user in each Docker image. The resulting Docker images
  could be inconsistent depending on the execution environment
  and base image.
  
  With this change, we explicitly create our custom user and
  group as the first action in each Dockerfile. The user always
  has user:group 1000:1000 and all built images are consistent.
  
  We also create a home directory for the user under /build.
  This directory is currently ignored.
  
  As part of this, we stop setting the DBUILDUSER variable in
  dockerlib.sh and instead set it in the respective scripts that
  call it. This is in preparation for further refactoring of
  dockerlib.sh.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/packaging/docker/centos5
  contrib/packaging/docker/centos6
  contrib/packaging/docker/centos7
  contrib/packaging/docker/debian.template
  contrib/packaging/docker/fedora20
  contrib/packaging/docker/fedora21
  contrib/packaging/docker/ubuntu.template
  contrib/packaging/dockerdeb
  contrib/packaging/dockerlib.sh
  contrib/packaging/dockerrpm

CHANGE DETAILS

diff --git a/contrib/packaging/dockerrpm b/contrib/packaging/dockerrpm
--- a/contrib/packaging/dockerrpm
+++ b/contrib/packaging/dockerrpm
@@ -16,6 +16,8 @@
 $ROOTDIR/contrib/packaging/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $*
 
 DSHARED=/mnt/shared
+DBUILDUSER=build
+
 $DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v 
$RPMBUILDDIR:$DSHARED $CONTAINER \
 rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec 
--clean
 
diff --git a/contrib/packaging/dockerlib.sh b/contrib/packaging/dockerlib.sh
--- a/contrib/packaging/dockerlib.sh
+++ b/contrib/packaging/dockerlib.sh
@@ -26,17 +26,5 @@
   [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
 
   CONTAINER="hg-dockerrpm-$1"
-  DBUILDUSER=build
-  (
-cat $DFILE
-if [ $(uname) = "Darwin" ] ; then
-# The builder is using boot2docker on OS X, so we're going to
-# *guess* the uid of the user inside the VM that is actually
-# running docker. This is *very likely* to fail at some point.
-echo RUN useradd $DBUILDUSER -u 1000
-else
-echo RUN groupadd $DBUILDUSER -g `id -g` -o
-echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER -o
-fi
-  ) | $DOCKER build --build-arg http_proxy --build-arg https_proxy --tag 
$CONTAINER -
+  cat $DFILE | $DOCKER build --build-arg http_proxy --build-arg https_proxy 
--tag $CONTAINER -
 }
diff --git a/contrib/packaging/dockerdeb b/contrib/packaging/dockerdeb
--- a/contrib/packaging/dockerdeb
+++ b/contrib/packaging/dockerdeb
@@ -22,6 +22,8 @@
 # container and hope it's writable. Whee.
 dn=$(basename $ROOTDIR)
 
+DBUILDUSER=build
+
 if [ $(uname) = "Darwin" ] ; then
 $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
 sh -c "cd /mnt/$dn && make clean && make local"
diff --git a/contrib/packaging/docker/ubuntu.template 
b/contrib/packaging/docker/ubuntu.template
--- a/contrib/packaging/docker/ubuntu.template
+++ b/contrib/packaging/docker/ubuntu.template
@@ -1,4 +1,8 @@
 FROM ubuntu:__CODENAME__
+
+RUN groupadd -g 1000 build && \
+useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
+
 RUN apt-get update && apt-get install -y \
   build-essential \
   debhelper \
diff --git a/contrib/packaging/docker/fedora21 
b/contrib/packaging/docker/fedora21
--- a/contrib/packaging/docker/fedora21
+++ b/contrib/packaging/docker/fedora21
@@ -1,4 +1,8 @@
 FROM fedora:21
+
+RUN groupadd -g 1000 build && \
+useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
+
 RUN yum install -y \
gcc \
gettext \
diff --git a/contrib/packaging/docker/fedora20 
b/contrib/packaging/docker/fedora20
--- a/contrib/packaging/docker/fedora20
+++ b/contrib/packaging/docker/fedora20
@@ -1,4 +1,8 @@
 FROM fedora:20
+
+RUN groupadd -g 1000 build && \
+useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
+
 RUN yum install -y \
gcc \
gettext \
diff --git a/contrib/packaging/docker/debian.template 
b/contrib/packaging/docker/debian.template
--- a/contrib/packaging/docker/debian.template
+++ b/contrib/packaging/docker/debian.template
@@ -1,4 +1,8 @@
 FROM debian:__CODENAME__
+
+RUN groupadd -g 1000 build && \
+useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
+
 RUN apt-get update && apt-get install -y \
   build-essential \
   debhelper \
diff --git a/contrib/packaging/docker/centos7 b/contrib/packaging/docker/centos7
--- a/contrib/packaging/docker/centos7
+++ b/contrib/packaging/docker/centos7
@@ -1,4 +1,8 @@
 FROM centos:centos7
+
+RUN groupadd -g 1000 build && \
+useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
+
 RUN yum install -y \
gcc \

D3759: packaging: replace dockerlib.sh with a Python script

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I want to do some more advanced things with Docker in upcoming
  commits. Trying to do that with shell scripts will be a bit too
  painful for my liking. Implementing things in Python will be
  vastly simpler in the long run.
  
  This commit essentially ports dockerlib.sh to a Python script.
  dockerdeb and dockerrpm have been ported to use the new hg-docker
  script.
  
  hg-docker requires Python 3. I've only tested on Python 3.5.
  
  Unlike the local packaging scripts which may need to run on old
  distros, the Docker packaging scripts don't have these constraints.
  So I think it is acceptable to require Python 3.5.
  
  As part of the transition, the Docker image tags changed slightly.
  I don't think that's a big deal: the Docker image names are
  effectively arbitrary and are a means to an end to achieve
  running commands in Docker containers.
  
  The code for resolving the Dockerfile content allows substituting
  values passed as arguments. This will be used in a subsequent commit.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/packaging/dockerdeb
  contrib/packaging/dockerlib.sh
  contrib/packaging/dockerrpm
  contrib/packaging/hg-docker

CHANGE DETAILS

diff --git a/contrib/packaging/hg-docker b/contrib/packaging/hg-docker
new file mode 100755
--- /dev/null
+++ b/contrib/packaging/hg-docker
@@ -0,0 +1,118 @@
+#!/usr/bin/env python3
+#
+# Copyright 2018 Gregory Szorc 
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+
+import argparse
+import pathlib
+import shutil
+import subprocess
+import sys
+
+
+def get_docker() -> str:
+docker = shutil.which('docker.io') or shutil.which('docker')
+if not docker:
+print('could not find docker executable')
+return 1
+
+try:
+out = subprocess.check_output([docker, '-h'], stderr=subprocess.STDOUT)
+
+if b'Jansens' in out:
+print('%s is the Docking System Tray; try installing docker.io' %
+  docker)
+sys.exit(1)
+except subprocess.CalledProcessError as e:
+print('error calling `%s -h`: %s' % (docker, e.output))
+sys.exit(1)
+
+out = subprocess.check_output([docker, 'version'],
+  stderr=subprocess.STDOUT)
+
+lines = out.splitlines()
+if not any(l.startswith((b'Client:', b'Client version:')) for l in lines):
+print('`%s version` does not look like Docker' % docker)
+sys.exit(1)
+
+if not any(l.startswith((b'Server:', b'Server version:')) for l in lines):
+print('`%s version` does not look like Docker' % docker)
+sys.exit(1)
+
+return docker
+
+
+def get_dockerfile(path: pathlib.Path, args: list) -> bytes:
+with path.open('rb') as fh:
+df = fh.read()
+
+for k, v in args:
+df = df.replace(b'%%%s%%' % k, v)
+
+return df
+
+
+def build_docker_image(dockerfile: pathlib.Path, params: list, tag: str):
+"""Build a Docker image from a templatized Dockerfile."""
+docker = get_docker()
+
+dockerfile_path = pathlib.Path(dockerfile)
+
+dockerfile = get_dockerfile(dockerfile_path, params)
+
+print('building Dockerfile:')
+print(dockerfile.decode('utf-8', 'replace'))
+
+args = [
+docker,
+'build',
+'--build-arg', 'http_proxy',
+'--build-arg', 'https_proxy',
+'--tag', tag,
+'-',
+]
+
+print('executing: %r' % args)
+subprocess.run(args, input=dockerfile, check=True)
+
+
+def command_build(args):
+build_args = []
+for arg in args.build_arg:
+k, v = arg.split('=', 1)
+build_args.append((k.encode('utf-8'), v.encode('utf-8')))
+
+build_docker_image(pathlib.Path(args.dockerfile),
+   build_args,
+   args.tag)
+
+
+def command_docker(args):
+print(get_docker())
+
+
+def main() -> int:
+parser = argparse.ArgumentParser()
+
+subparsers = parser.add_subparsers(title='subcommands')
+
+build = subparsers.add_parser('build', help='Build a Docker image')
+build.set_defaults(func=command_build)
+build.add_argument('--build-arg', action='append', default=[],
+help='Substitution to perform in Dockerfile; '
+ 'format: key=value')
+build.add_argument('dockerfile', help='path to Dockerfile to use')
+build.add_argument('tag', help='Tag to apply to created image')
+
+docker = subparsers.add_parser('docker-path', help='Resolve path to 
Docker')
+docker.set_defaults(func=command_docker)
+
+args = parser.parse_args()
+
+return args.func(args)
+
+
+if __name__ == '__main__':
+sys.exit(main())
diff --git a/contrib/packaging/dockerrpm 

D3761: packaging: dynamically define make targets

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We currently have make boilerplate for each instance of a distro's
  release. This is redundant, annoying to maintain, and prone to errors.
  
  This commit defines variables holding available releases for
  various distros. We then iterate through the list and dynamically
  define make targets.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/packaging/Makefile

CHANGE DETAILS

diff --git a/contrib/packaging/Makefile b/contrib/packaging/Makefile
--- a/contrib/packaging/Makefile
+++ b/contrib/packaging/Makefile
@@ -1,21 +1,44 @@
 $(eval HGROOT := $(shell cd ../..; pwd))
 
+DEBIAN_CODENAMES := \
+  jessie \
+  stretch \
+  buster
+
+UBUNTU_CODENAMES := \
+  trusty \
+  xenial \
+  artful \
+  bionic \
+
+FEDORA_RELEASES := \
+  20 \
+  21
+
+CENTOS_RELEASES := \
+  5 \
+  6 \
+  7
+
+# Build a Python for these CentOS releases.
+CENTOS_WITH_PYTHON_RELEASES := 5 6
+
 help:
@echo 'Packaging Make Targets'
@echo ''
-   @echo 'docker-centos-{5, 6, 7}'
+   @echo 'docker-centos-{$(strip $(CENTOS_RELEASES))}'
@echo '   Build an RPM for a specific CentOS version using Docker.'
@echo ''
-   @echo 'docker-debian-{jessie, stretch}'
+   @echo 'docker-debian-{$(strip $(DEBIAN_CODENAMES))}'
@echo '   Build Debian packages specific to a Debian distro using 
Docker.'
@echo ''
-   @echo 'docker-fedora-{20, 21}'
+   @echo 'docker-fedora-{$(strip $(FEDORA_RELEASES))}'
@echo '   Build an RPM for a specific Fedora version using Docker.'
@echo ''
-   @echo 'docker-ubuntu-{trusty, xenial, artful, bionic}'
+   @echo 'docker-ubuntu-{$(strip $(UBUNTU_CODENAMES))}'
@echo '   Build Debian package specific to an Ubuntu distro using 
Docker.'
@echo ''
-   @echo 'docker-ubuntu-{trusty, xenial, artful, bionic}-ppa'
+   @echo 'docker-ubuntu-{$(strip $(UBUNTU_CODENAMES))}-ppa'
@echo '   Build a source-only Debian package specific to an Ubuntu 
distro'
@echo '   using Docker.'
@echo ''
@@ -31,10 +54,10 @@
@echo 'ppa'
@echo '   Build a Debian source package locally targeting the current 
system'
@echo ''
-   @echo 'centos-{5, 6, 7}'
+   @echo 'centos-{$(strip $(CENTOS_RELEASES))}'
@echo '   Build an RPM for a specific CentOS version locally'
@echo ''
-   @echo 'fedora-{20, 21}'
+   @echo 'fedora-{$(strip $(FEDORA_RELEASES))}'
@echo '   Build an RPM for a specific Fedora version locally'
 
 .PHONY: help
@@ -47,107 +70,66 @@
 ppa:
./builddeb --source-only
 
-.PHONY: docker-debian-jessie
-docker-debian-jessie:
-   ./dockerdeb debian jessie
+# Debian targets.
+define debian_targets =
+.PHONY: docker-debian-$(1)
+docker-debian-$(1):
+   ./dockerdeb debian $(1)
 
-.PHONY: docker-debian-stretch
-docker-debian-stretch:
-   ./dockerdeb debian stretch
+endef
 
-.PHONY: docker-ubuntu-trusty
-docker-ubuntu-trusty:
-   ./dockerdeb ubuntu trusty
+$(foreach codename,$(DEBIAN_CODENAMES),$(eval $(call 
debian_targets,$(codename
 
-.PHONY: docker-ubuntu-trusty-ppa
-docker-ubuntu-trusty-ppa:
-   ./dockerdeb ubuntu trusty --source-only
-
-.PHONY: docker-ubuntu-xenial
-docker-ubuntu-xenial:
-   ./dockerdeb ubuntu xenial
+# Ubuntu targets.
+define ubuntu_targets =
+.PHONY: docker-ubuntu-$(1)
+docker-ubuntu-$(1):
+   ./dockerdeb ubuntu $(1)
 
-.PHONY: docker-ubuntu-xenial-ppa
-docker-ubuntu-xenial-ppa:
-   ./dockerdeb ubuntu xenial --source-only
+.PHONY: docker-ubuntu-$(1)-ppa
+docker-ubuntu-$(1)-ppa:
+   ./dockerdeb ubuntu $(1) --source-only
 
-.PHONY: docker-ubuntu-artful
-docker-ubuntu-artful:
-   ./dockerdeb ubuntu artful
+endef
 
-.PHONY: docker-ubuntu-artful-ppa
-docker-ubuntu-artful-ppa:
-   ./dockerdeb ubuntu artful --source-only
+$(foreach codename,$(UBUNTU_CODENAMES),$(eval $(call 
ubuntu_targets,$(codename
 
-.PHONY: docker-ubuntu-bionic
-docker-ubuntu-bionic:
-   ./dockerdeb ubuntu bionic
-
-.PHONY: docker-ubuntu-bionic-ppa
-docker-ubuntu-bionic-ppa:
-   ./dockerdeb ubuntu bionic --source-only
-
-.PHONY: fedora20
-fedora20:
-   mkdir -p $(HGROOT)/packages/fedora20
+# Fedora targets.
+define fedora_targets =
+.PHONY: fedora$(1)
+fedora$(1):
+   mkdir -p $$(HGROOT)/packages/fedora$(1)
./buildrpm
-   cp $(HGROOT)/rpmbuild/RPMS/*/* $(HGROOT)/packages/fedora20
-   cp $(HGROOT)/rpmbuild/SRPMS/* $(HGROOT)/packages/fedora20
+   cp $$(HGROOT)/rpmbuild/RPMS/*/* $$(HGROOT)/packages/fedora$(1)
+   cp $$(HGROOT)/rpmbuild/SRPMS/* $$(HGROOT)/packages/fedora$(1)
rm -rf $(HGROOT)/rpmbuild
 
-.PHONY: docker-fedora20
-docker-fedora20:
-   mkdir -p $(HGROOT)/packages/fedora20
-   ./dockerrpm fedora20
+.PHONY: docker-fedora$(1)
+docker-fedora$(1):
+   mkdir -p 

mercurial@38332: 26 new changesets

2018-06-16 Thread Mercurial Commits
26 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/519b46a8f4d2
changeset:   38307:519b46a8f4d2
user:Sune Foldager 
date:Thu Jun 14 13:44:42 2018 +0200
summary: hgweb: propagate http headers from ErrorResponse for web interface 
commands

https://www.mercurial-scm.org/repo/hg/rev/068e774ae29e
changeset:   38308:068e774ae29e
user:Yuya Nishihara 
date:Thu Jun 14 20:25:16 2018 +0900
summary: bdiff: document that bdiff_freehunks() accepts NULL

https://www.mercurial-scm.org/repo/hg/rev/93b812d5b818
changeset:   38309:93b812d5b818
user:Yuya Nishihara 
date:Thu Jun 14 20:25:51 2018 +0900
summary: bdiff: one more safe call of bdiff_freehunks(NULL)

https://www.mercurial-scm.org/repo/hg/rev/2049a21c8396
changeset:   38310:2049a21c8396
user:Augie Fackler 
date:Thu Jun 14 16:51:39 2018 -0400
summary: py3: two more passing tests from the ratchet in buildbot

https://www.mercurial-scm.org/repo/hg/rev/47f5454a30ed
changeset:   38311:47f5454a30ed
user:Pulkit Goyal <7895pul...@gmail.com>
date:Fri Jun 15 02:07:39 2018 +0530
summary: cmdutil: say that `graft --stop` stops the graft instead of 
aborting

https://www.mercurial-scm.org/repo/hg/rev/79dd61a4554f
changeset:   38312:79dd61a4554f
user:Pulkit Goyal <7895pul...@gmail.com>
date:Wed Jun 13 22:51:08 2018 +0530
summary: py3: replace `unicode` with pycompat.unicode

https://www.mercurial-scm.org/repo/hg/rev/275cc461b854
changeset:   38313:275cc461b854
user:Augie Fackler 
date:Thu Jun 14 11:47:51 2018 -0400
summary: debugcommands: work around logiofd being a pipe and unseekable

https://www.mercurial-scm.org/repo/hg/rev/565074cc9ac6
changeset:   38314:565074cc9ac6
user:Augie Fackler 
date:Thu Jun 14 11:49:10 2018 -0400
summary: tests: suppress read(-1) -> '' calls in fileobjectobserver

https://www.mercurial-scm.org/repo/hg/rev/79dcaad9d145
changeset:   38315:79dcaad9d145
user:Martin von Zweigbergk 
date:Thu Jun 14 15:45:16 2018 -0700
summary: graft: use context manager for config override

https://www.mercurial-scm.org/repo/hg/rev/7e34fc78701a
changeset:   38316:7e34fc78701a
user:Martin von Zweigbergk 
date:Thu Jun 14 15:45:45 2018 -0700
summary: merge: use context manager for config override

https://www.mercurial-scm.org/repo/hg/rev/ff9694ea3852
changeset:   38317:ff9694ea3852
user:Martin von Zweigbergk 
date:Thu Jun 14 15:46:17 2018 -0700
summary: resolve: use context manager for config override

https://www.mercurial-scm.org/repo/hg/rev/929405af558a
changeset:   38318:929405af558a
user:Martin von Zweigbergk 
date:Thu Jun 14 15:46:31 2018 -0700
summary: update: use context manager for config override (API)

https://www.mercurial-scm.org/repo/hg/rev/0d6d0aa3c4bf
changeset:   38319:0d6d0aa3c4bf
user:Martin von Zweigbergk 
date:Thu Jun 14 15:26:18 2018 -0700
summary: backout: use context manager for config override

https://www.mercurial-scm.org/repo/hg/rev/eef4668be8a3
changeset:   38320:eef4668be8a3
user:Martin von Zweigbergk 
date:Thu Jun 14 15:28:32 2018 -0700
summary: backout: use context manager for dirstateguard

https://www.mercurial-scm.org/repo/hg/rev/9b1536b02221
changeset:   38321:9b1536b02221
user:Martin von Zweigbergk 
date:Thu Jun 14 15:08:19 2018 -0700
summary: backout: use context manager for locks

https://www.mercurial-scm.org/repo/hg/rev/e218ed5ba484
changeset:   38322:e218ed5ba484
user:Martin von Zweigbergk 
date:Thu Jun 14 15:05:14 2018 -0700
summary: commit: use context manager for locks

https://www.mercurial-scm.org/repo/hg/rev/48c52385e062
changeset:   38323:48c52385e062
user:Martin von Zweigbergk 
date:Thu Jun 14 15:08:32 2018 -0700
summary: tag: use context manager for locks

https://www.mercurial-scm.org/repo/hg/rev/c924e7dbcd0f
changeset:   38324:c924e7dbcd0f
user:Martin von Zweigbergk 
date:Thu Jun 14 15:12:28 2018 -0700
summary: import: use context manager for wlock

https://www.mercurial-scm.org/repo/hg/rev/5cb39a368c80
changeset:   38325:5cb39a368c80
user:Yuya Nishihara 
date:Sat Jun 16 16:56:38 2018 +0900
summary: py3: cast bytes encoding name to str in fileset.py

https://www.mercurial-scm.org/repo/hg/rev/8783f128048e
changeset:   38326:8783f128048e
user:Yuya Nishihara 
date:Sat Jun 16 17:00:05 2018 +0900
summary: fileset: raise ProgrammingError for bad existing() calls

https://www.mercurial-scm.org/repo/hg/rev/62376d7b8859
changeset:   38327:62376d7b8859
user:Yuya Nishihara 
date:Sat Jun 16 17:04:03 2018 +0900
summary: py3: glob out some error messages in test-fileset.t

https://www.mercurial-scm.org/repo/hg/rev/aa9dd805234d
changeset:   38328:aa9dd805234d
user:Yuya Nishihara 
date:

D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D3665#58864, @johnstiles wrote:
  
  > Are you capable of running the extension?
  >
  > The output of `type` is irrelevant to me. The behavior of python.exe when 
outputting to the Windows shell is all that really matters here. If 
`encoding.encoding` reports UTF8, it should work or there's an Hg issue. If it 
reports something else, the extension will disable itself anyway.
  
  
  Running hg installed in WSL 
 inside cmd.exe, 
`encoding.encoding` is `utf-8`. Since it's still using cmd.exe font, it cannot 
render those fancy characters correctly.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 1 of 8] templater: mark most attributes as private

2018-06-16 Thread Gregory Szorc
On Thu, Jun 14, 2018 at 8:40 AM, Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1525312409 -32400
> #  Thu May 03 10:53:29 2018 +0900
> # Node ID 8541f1e6178053f6cafd2ff22c8b632499ffa298
> # Parent  6196cc6cd37bc7260fdcb1f5c020d4adb7f8c176
> templater: mark most attributes as private
>

Queued this series.

Support for additional template engines was added in 2009 and doesn't seem
to be used in the wild. It was an interesting idea. I agree we can remove
the feature with minimal risk.


>
> diff --git a/mercurial/templater.py b/mercurial/templater.py
> --- a/mercurial/templater.py
> +++ b/mercurial/templater.py
> @@ -808,14 +808,14 @@ class templater(object):
>  if cache is None:
>  cache = {}
>  self.cache = cache.copy()
> -self.map = {}
> -self.filters = templatefilters.filters.copy()
> -self.filters.update(filters)
> +self._map = {}
> +self._filters = templatefilters.filters.copy()
> +self._filters.update(filters)
>  self.defaults = defaults
>  self._resources = resources
>  self._aliases = aliases
> -self.minchunk, self.maxchunk = minchunk, maxchunk
> -self.ecache = {}
> +self._minchunk, self._maxchunk = minchunk, maxchunk
> +self._ecache = {}
>
>  @classmethod
>  def frommapfile(cls, mapfile, filters=None, defaults=None,
> resources=None,
> @@ -824,24 +824,24 @@ class templater(object):
>  t = cls(filters, defaults, resources, cache, [], minchunk,
> maxchunk)
>  cache, tmap, aliases = _readmapfile(mapfile)
>  t.cache.update(cache)
> -t.map = tmap
> +t._map = tmap
>  t._aliases = aliases
>  return t
>
>  def __contains__(self, key):
> -return key in self.cache or key in self.map
> +return key in self.cache or key in self._map
>
>  def load(self, t):
>  '''Get the template for the given template name. Use a local
> cache.'''
>  if t not in self.cache:
>  try:
> -self.cache[t] = util.readfile(self.map[t][1])
> +self.cache[t] = util.readfile(self._map[t][1])
>  except KeyError as inst:
>  raise templateutil.TemplateNotFound(
>  _('"%s" not in template map') % inst.args[0])
>  except IOError as inst:
>  reason = (_('template file %s: %s')
> -  % (self.map[t][1],
> +  % (self._map[t][1],
>   stringutil.forcebytestr(inst.args[1])))
>  raise IOError(inst.args[0], encoding.strfromlocal(reason))
>  return self.cache[t]
> @@ -857,20 +857,20 @@ class templater(object):
>  def generate(self, t, mapping):
>  """Return a generator that renders the specified named template
> and
>  yields chunks"""
> -ttype = t in self.map and self.map[t][0] or 'default'
> -if ttype not in self.ecache:
> +ttype = t in self._map and self._map[t][0] or 'default'
> +if ttype not in self._ecache:
>  try:
>  ecls = engines[ttype]
>  except KeyError:
>  raise error.Abort(_('invalid template engine: %s') %
> ttype)
> -self.ecache[ttype] = ecls(self.load, self.filters,
> self.defaults,
> -  self._resources, self._aliases)
> -proc = self.ecache[ttype]
> +self._ecache[ttype] = ecls(self.load, self._filters,
> self.defaults,
> +   self._resources, self._aliases)
> +proc = self._ecache[ttype]
>
>  stream = proc.process(t, mapping)
> -if self.minchunk:
> -stream = util.increasingchunks(stream, min=self.minchunk,
> -   max=self.maxchunk)
> +if self._minchunk:
> +stream = util.increasingchunks(stream, min=self._minchunk,
> +   max=self._maxchunk)
>  return stream
>
>  def templatepaths():
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3733: tests: suppress read(-1) -> '' calls in fileobjectobserver

2018-06-16 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  So Python 3 is performing a lot more `read(-1)` calls than Python 2? That, 
uh, seems weird and might be worth investigating.
  
  Hiding the `read()` calls does undermine the tests somewhat. But it's not a 
deal breaker. Let's keep this commit and keep this excessive `read(-1)` issue 
in the back of our heads.

REPOSITORY
  rHG Mercurial

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

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


D3754: graft: introduce --abort flag to abort interrupted graft

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


  > +def _abortgraft(ui, repo, graftstate):
  >  +"""abort the interrupted graft and rollbacks to the state before 
interrupted
  >  +graft"""
  >  +if not graftstate.exists():
  >  +raise error.Abort(_("no interrupted graft to abort"))
  >  +statedata = _readgraftstate(repo, graftstate)
  >  +startnode = statedata.get('startnode')
  >  +if not startnode:
  >  +# and old graft state which does not have all the data required 
to abort
  >  +# the graft
  >  +raise error.Abort(_("cannot abort using an old graftstate"))
  >  +newnodes = statedata.get('newnodes')
  >  +hg.updaterepo(repo, startnode, True)
  >  +if newnodes:
  
  It's probably better to not updating to the startnode if we can't strip
  grafted revisions.
  
  > +newnodes = [repo[r].rev() for r in newnodes]
  >  +
  >  +# checking that none of the newnodes turned public or is public
  >  +immutable = [c for c in newnodes if not repo[c].mutable()]
  >  +if immutable:
  >  +repo.ui.warn(_("cannot clean up public changesets %s\n")
  >  + % ','.join(bytes(repo[r]) for r in immutable),
  >  + hint=_("see 'hg help phases' for details"))
  >  +
  >  +# checking that no new nodes are created on top of grafted revs
  >  +desc = set(repo.changelog.descendants(newnodes))
  >  +if desc - set(newnodes):
  >  +repo.ui.warn(_("new changesets detected on destination "
  >  +   "branch, can't strip\n"))
  >  +
  >  +with repo.wlock(), repo.lock():
  >  +# stripping the new nodes created
  >  +strippoints = [c.node() for c in repo.set("roots(%ld)", 
newnodes)]
  >  +repair.strip(repo.ui, repo, strippoints, False)
  >  +
  >  +ui.write(_("graft aborted\nworking directory is now at %s\n")
  >  + % repo[startnode].hex()[:12])
  >  +graftstate.delete()
  >  +return 0
  
  This looks quite similar to rebase.abort(). Can we factor out a common part?
  Maybe it's time to add a new module for rebase/graft thingy.

REPOSITORY
  rHG Mercurial

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

To: pulkit, #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: D3754: graft: introduce --abort flag to abort interrupted graft

2018-06-16 Thread Yuya Nishihara
> +def _abortgraft(ui, repo, graftstate):
> +"""abort the interrupted graft and rollbacks to the state before 
> interrupted
> +graft"""
> +if not graftstate.exists():
> +raise error.Abort(_("no interrupted graft to abort"))
> +statedata = _readgraftstate(repo, graftstate)
> +startnode = statedata.get('startnode')
> +if not startnode:
> +# and old graft state which does not have all the data required to 
> abort
> +# the graft
> +raise error.Abort(_("cannot abort using an old graftstate"))
> +newnodes = statedata.get('newnodes')
> +hg.updaterepo(repo, startnode, True)
> +if newnodes:

It's probably better to not updating to the startnode if we can't strip
grafted revisions.

> +newnodes = [repo[r].rev() for r in newnodes]
> +
> +# checking that none of the newnodes turned public or is public
> +immutable = [c for c in newnodes if not repo[c].mutable()]
> +if immutable:
> +repo.ui.warn(_("cannot clean up public changesets %s\n")
> + % ','.join(bytes(repo[r]) for r in immutable),
> + hint=_("see 'hg help phases' for details"))
> +
> +# checking that no new nodes are created on top of grafted revs
> +desc = set(repo.changelog.descendants(newnodes))
> +if desc - set(newnodes):
> +repo.ui.warn(_("new changesets detected on destination "
> +   "branch, can't strip\n"))
> +
> +with repo.wlock(), repo.lock():
> +# stripping the new nodes created
> +strippoints = [c.node() for c in repo.set("roots(%ld)", 
> newnodes)]
> +repair.strip(repo.ui, repo, strippoints, False)
> +
> +ui.write(_("graft aborted\nworking directory is now at %s\n")
> + % repo[startnode].hex()[:12])
> +graftstate.delete()
> +return 0

This looks quite similar to rebase.abort(). Can we factor out a common part?
Maybe it's time to add a new module for rebase/graft thingy.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3753: graft: store the node from where we started the operation in graftstate

2018-06-16 Thread Yuya Nishihara
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -2233,6 +2233,8 @@
>  raise error.Abort(_('no revisions specified'))
>  cmdutil.checkunfinished(repo)
>  cmdutil.bailifchanged(repo)
> +# the node from where we started the graft operation
> +statedata['startnode'] = repo['.'].node()

Nit: Isn't it always the parent of the `newnodes[0]`?

I don't have strong opinion whether we should store the startnode, but if
we store it at the start of the graft, I think we won't need to care for
`statedata.get('newnodes') is None` case, in the first patch. I mean we can
always record newnodes no matter if it may be incomplete or not since the
existence of the startnode gives us a trust.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3753: graft: store the node from where we started the operation in graftstate

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


  > - a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2233,6 +2233,8 @@ 
raise error.Abort(_('no revisions specified')) cmdutil.checkunfinished(repo) 
cmdutil.bailifchanged(repo) +# the node from where we started the graft 
operation +statedata['startnode'] = repo['.'].node()
  
  Nit: Isn't it always the parent of the `newnodes[0]`?
  
  I don't have strong opinion whether we should store the startnode, but if
  we store it at the start of the graft, I think we won't need to care for
  `statedata.get('newnodes') is None` case, in the first patch. I mean we can
  always record newnodes no matter if it may be incomplete or not since the
  existence of the startnode gives us a trust.

REPOSITORY
  rHG Mercurial

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

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


D3757: rebase: add dry-run functionality

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

REVISION SUMMARY
  For now, it just notify that if we will hit a conflict or not, but
  we can improve this like making it a --confirm flag or by showing the
  graph that would result when we will run the command without --dry-run

REPOSITORY
  rHG Mercurial

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

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
@@ -155,4 +155,169 @@
   |/
   o  0: b173517d0057 'a'
   
+Test dry-run rebasing
+  $ hg init skrepo
+  $ cd skrepo
+  $ echo a>a
+  $ hg ci -Aqma
+  $ echo b>b
+  $ hg ci -Aqmb
+  $ echo c>c
+  $ hg ci -Aqmc
+  $ echo d>d
+  $ hg ci -Aqmd
+  $ echo e>e
+  $ hg ci -Aqme
 
+  $ hg up 1 -q
+  $ echo f>f
+  $ hg ci -Amf
+  adding f
+  created new head
+  $ echo g>g
+  $ hg ci -Aqmg
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Make sure it throws error while passing --continue or --abort with --dry-run
+  $ hg rebase -s 2 -d 6 -n --continue
+  abort: cannot specify both --dry-run and --continue
+  [255]
+  $ hg rebase -s 2 -d 6 -n --abort
+  abort: cannot specify both --dry-run and --abort
+  [255]
+
+Check dryrun gives correct results when there is no conflict in rebasing
+  $ hg rebase -s 2 -d 6 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  There will be no conflict, you can rebase
+  rebase aborted
+
+  $ hg diff
+  $ hg status
+
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is no conflict
+  $ hg rebase -s 2 -d 6 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  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:
+  $ hg up 6 -q
+  $ echo conflict>e
+  $ hg ci -Aqm "conflict with e"
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+  $ hg rebase -s 2 -d 7 -n
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  transaction abort!
+  rollback completed
+  Hit a merge conflict
+  rebase aborted
+  $ hg diff
+  $ hg status
+  $ hg log -G --template "{rev}:{short(node)} 
{person(author)}\n{firstline(desc)} {topic}\n\n"
+  @  7:d2c195b28050 test
+  |  conflict with e
+  |
+  o  6:baf10c5166d4 test
+  |  g
+  |
+  o  5:6343ca3eff20 test
+  |  f
+  |
+  | o  4:e860deea161a test
+  | |  e
+  | |
+  | o  3:055a42cdd887 test
+  | |  d
+  | |
+  | o  2:177f92b77385 test
+  |/   c
+  |
+  o  1:d2ae7f538514 test
+  |  b
+  |
+  o  0:cb9a9f314b8b test
+ a
+  
+Check dryrun working with --collapse when there is conflicts
+  $ hg rebase -s 2 -d 7 -n --collapse
+  rebasing 2:177f92b77385 "c"
+  rebasing 3:055a42cdd887 "d"
+  rebasing 4:e860deea161a "e"
+  merging e
+  Hit a merge conflict
+  rebase aborted
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -673,8 +673,7 @@
 ('a', 'abort', False, _('abort an interrupted rebase')),
 ('', 'auto-orphans', '', _('automatically rebase orphan revisions '
'in the specified revset (EXPERIMENTAL)')),
- ] +
-cmdutil.formatteropts,
+ ] + cmdutil.dryrunopts + cmdutil.formatteropts,
 _('[-s REV | -b REV] [-d REV] [OPTION]'))
 def rebase(ui, repo, **opts):
 """move changeset (and descendants) to a different branch
@@ -798,6 +797,15 @@
 
 """
 inmemory = ui.configbool('rebase', 'experimental.inmemory')
+dryrun = opts.get(r'dry_run')
+if dryrun:
+if (opts.get(r'abort')):
+raise error.Abort(_('cannot specify both --dry-run '
+  

D3756: rebase: no need to backup rebased csets while aborting

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

REPOSITORY
  rHG Mercurial

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

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

CHANGE DETAILS

diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -115,7 +115,6 @@
 Abort (should clear out unsupported merge state):
 
   $ hg rebase --abort
-  saved backup bundle to 
$TESTTMP/a/.hg/strip-backup/3e046f2ecedb-6beef7d5-backup.hg
   rebase aborted
   $ hg debugmergestate
   no merge state found
@@ -406,7 +405,6 @@
   [255]
 
   $ hg rebase --abort
-  saved backup bundle to 
$TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg
   rebase aborted
   $ hg log -G --template "{rev} {desc} {bookmarks}"
   o  6 no-a
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1573,7 +1573,7 @@
 # Strip from the first rebased revision
 if rebased:
 # no backup of rebased cset versions needed
-repair.strip(repo.ui, repo, strippoints)
+repair.strip(repo.ui, repo, strippoints, backup=False)
 
 if activebookmark and activebookmark in repo._bookmarks:
 bookmarks.activate(repo, activebookmark)



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


D3728: grep: adds unmodified mode

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

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3728?vs=9092=9107

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

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  tests/test-grep.t

CHANGE DETAILS

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -368,3 +368,20 @@
   binfile.bin:0:+: Binary file matches
 
   $ cd ..
+
+Test for showing working of unmodified flag
+
+  $ hg init sng
+  $ cd sng
+  $ echo "unmod" >> um
+  $ hg ci -A -m "adds unmod to um"
+  adding um
+  $ echo "something else" >> new
+  $ hg ci -A -m "second commit"
+  adding new
+  $ hg grep -r "." "unmod"
+  [1]
+  $ hg grep -r "." "unmod" --unmodified
+  um:1:unmod
+
+  $ cd ..
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2408,6 +2408,8 @@
 ('n', 'line-number', None, _('print matching line numbers')),
 ('r', 'rev', [],
  _('only search files changed within revision range'), _('REV')),
+('', 'allfiles', False,
+ _('include all files in the changeset while grepping (EXPERIMENTAL)')),
 ('u', 'user', None, _('list the author (long with -v)')),
 ('d', 'date', None, _('list the date (short with -q)')),
 ] + formatteropts + walkopts,
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1881,6 +1881,9 @@
 yielding each context, the iterator will first call the prepare
 function on each context in the window in forward order.'''
 
+allfiles = opts.get('allfiles')
+if allfiles and len(revs) > 1:
+raise error.Abort(_("multiple revisions not supported with 
--allfiles"))
 follow = opts.get('follow') or opts.get('follow_first')
 revs = _walkrevs(repo, opts)
 if not revs:
@@ -1990,7 +1993,11 @@
 ctx = change(rev)
 if not fns:
 def fns_generator():
-for f in ctx.files():
+if allfiles and len(revs) == 1:
+fiter = iter(ctx)
+else:
+fiter = ctx.files()
+for f in fiter:
 if match(f):
 yield f
 fns = fns_generator()



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


D3650: serve: add an option to open in the default browser

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


  (Resend because I forgot to remove the "someone wrote:" line again, sorry.)
  
  >   For laziness,  this patch could be also useful. It is also better for 
text shell beginners, because they may not know that they can combine commands 
like that (even if it is basic).
  
  For laziness, we can add it to `[alias]`. I'm not a fan of adding lots of
  one-off options since that's the source of man page bloat.
  
  How about document the xdg-open example in `hg help serve -v`?

REPOSITORY
  rHG Mercurial

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

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


Re: D3650: serve: add an option to open in the default browser

2018-06-16 Thread Yuya Nishihara
(Resend because I forgot to remove the "someone wrote:" line again, sorry.)

>   For laziness,  this patch could be also useful. It is also better for text 
> shell beginners, because they may not know that they can combine commands 
> like that (even if it is basic).

For laziness, we can add it to `[alias]`. I'm not a fan of adding lots of
one-off options since that's the source of man page bloat.

How about document the xdg-open example in `hg help serve -v`?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3728: grep: adds unmodified mode

2018-06-16 Thread Yuya Nishihara
> +allfiles = opts.get('allfiles')
>  follow = opts.get('follow') or opts.get('follow_first')
>  revs = _walkrevs(repo, opts)
>  if not revs:
> @@ -1990,7 +1991,11 @@
>  ctx = change(rev)
>  if not fns:
>  def fns_generator():
> -for f in ctx.files():
> +if allfiles and len(revs) == 1:

Can you make it error out if len(revs) > 1 isn't supported?
For example,

```
allfiles = opts.get('allfiles')
follow = opts.get('follow') or opts.get('follow_first')
revs = _walkrevs(repo, opts)
if allfiles and len(revs) > 1:
raise error.Abort(_(...))  # or ProgrammingError if that never happens
```
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3728: grep: adds unmodified mode

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


  > +allfiles = opts.get('allfiles')
  > 
  >   follow = opts.get('follow') or opts.get('follow_first')
  >   revs = _walkrevs(repo, opts)
  >   if not revs:
  > 
  > @@ -1990,7 +1991,11 @@
  > 
  >   ctx = change(rev)
  >   if not fns:
  >   def fns_generator():
  > 
  > - for f in ctx.files(): +if allfiles and len(revs) 
== 1:
  
  Can you make it error out if len(revs) > 1 isn't supported?
  For example,
  
allfiles = opts.get('allfiles')
follow = opts.get('follow') or opts.get('follow_first')
revs = _walkrevs(repo, opts)
if allfiles and len(revs) > 1:
raise error.Abort(_(...))  # or ProgrammingError if that never happens

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  Are you capable of running the extension?
  
  The output of `type` is irrelevant to me. The behavior of python.exe when 
outputting to the Windows shell is all that really matters here. If 
`encoding.encoding` reports UTF8, it should work or there's an Hg issue. If it 
reports something else, the extension will disable itself anyway.
  
  In https://phab.mercurial-scm.org/D3665#58863, @quark wrote:
  
  > In https://phab.mercurial-scm.org/D3665#58862, @johnstiles wrote:
  >
  > > Without more context I have no idea what you are trying to show. Windows 
is
  > >  certainly capable of rendering Unicode characters in the console. It is
  > >  also very possible to get ? characters if you're running a
  > >  non-Unicode-aware tool or if there are encoding mix-up issues. "type con"
  > >  and pasting in text from a text editor doesn't really prove anything one
  > >  way or the other. (What editor? What encoding did it think the data was?
  > >  How does "type con" handle Unicode text? etc.)
  > >
  > > Run the actual hgext and take a screenshot of what it generates if you 
want
  > >  to give a more useful data point for us.
  >
  >
  > Copy-pasting would render utf-8 characters correctly if the font supports 
them. It does not seem to be related to the current codepage.
  >
  > I edited the screenshot to show an explicit `type a-utf-8-file` with 
"utf-8" (65001) codepage, with different fonts.
  >
  > Note: Mercurial will raise "unknown encoding: cp65001" in this case so it's 
probably safe if you have the `encoding.encoding != 'utf8'` check. But anything 
rendered using the utf-8 characters (be it from "git bash hg -G ... > a.txt" or 
whatever POSIX-like shells) will render sub-optimally in cmd.exe.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH] phabricator: preserve the phase when amending in the Differential fields

2018-06-16 Thread Yuya Nishihara
On Fri, 15 Jun 2018 22:55:20 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1528994104 14400
> #  Thu Jun 14 12:35:04 2018 -0400
> # Node ID b9b8a6cd6b71dacc3e901295d0dae11aa0b04d22
> # Parent  c924e7dbcd0ff8bf2f7ab9e5bde5f6679d70a894
> phabricator: preserve the phase when amending in the Differential fields

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


Re: [PATCH 1 of 8] py3: cast bytes encoding name to str in fileset.py

2018-06-16 Thread Pulkit Goyal
On Sat, Jun 16, 2018 at 4:36 PM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1529135798 -32400
> #  Sat Jun 16 16:56:38 2018 +0900
> # Node ID 5cb39a368c803683fd8bc944480486a618ab785a
> # Parent  c924e7dbcd0ff8bf2f7ab9e5bde5f6679d70a894
> py3: cast bytes encoding name to str in fileset.py
>

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


[PATCH 7 of 8] py3: remove b'' from error message of disallowed filename

2018-06-16 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529139397 -32400
#  Sat Jun 16 17:56:37 2018 +0900
# Node ID bc71920694ff3bb072daff3751a57ede528fcb8b
# Parent  f701eb1d33ae7b9526742315b4f1d375ec016574
py3: remove b'' from error message of disallowed filename

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -127,6 +127,7 @@ test-eol-patch.t
 test-eol-tag.t
 test-eol-update.t
 test-eol.t
+test-eolfilename.t
 test-excessive-merge.t
 test-exchange-obsmarkers-case-A1.t
 test-exchange-obsmarkers-case-A2.t
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -20,6 +20,7 @@ from . import (
 error,
 mdiff,
 policy,
+pycompat,
 revlog,
 util,
 )
@@ -635,7 +636,8 @@ def _checkforbidden(l):
 for f in l:
 if '\n' in f or '\r' in f:
 raise error.RevlogError(
-_("'\\n' and '\\r' disallowed in filenames: %r") % f)
+_("'\\n' and '\\r' disallowed in filenames: %r")
+% pycompat.bytestr(f))
 
 
 # apply the changes collected during the bisect loop to our addlist
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -287,7 +287,8 @@ def checknewlabel(repo, lbl, kind):
 def checkfilename(f):
 '''Check that the filename f is an acceptable filename for a tracked 
file'''
 if '\r' in f or '\n' in f:
-raise error.Abort(_("'\\n' and '\\r' disallowed in filenames: %r") % f)
+raise error.Abort(_("'\\n' and '\\r' disallowed in filenames: %r")
+  % pycompat.bytestr(f))
 
 def checkportable(ui, f):
 '''Check if filename f is portable and warn or abort depending on config'''
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 8] py3: fix loop over byte string in wireprotov1peer

2018-06-16 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529138204 -32400
#  Sat Jun 16 17:36:44 2018 +0900
# Node ID cfa1ca8c0eb7a92cdc088b0699415f9d4351543a
# Parent  f13276ec9109d1b428c14e638d0f2b35f484291e
py3: fix loop over byte string in wireprotov1peer

Before, it would always return [True]s on Python 3 because list(b"0") == [48].

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -205,6 +205,7 @@ test-import.t
 test-imports-checker.t
 test-incoming-outgoing.t
 test-inherit-mode.t
+test-init.t
 test-issue1089.t
 test-issue1102.t
 test-issue1175.t
@@ -227,6 +228,7 @@ test-issue842.t
 test-journal-exists.t
 test-journal-share.t
 test-journal.t
+test-known.t
 test-largefiles-cache.t
 test-largefiles-misc.t
 test-largefiles-small-disk.t
@@ -450,9 +452,11 @@ test-sparse-requirement.t
 test-sparse-verbose-json.t
 test-sparse.t
 test-split.t
+test-ssh-bundle1.t
 test-ssh-clone-r.t
 test-ssh-proto-unbundle.t
 test-ssh-proto.t
+test-ssh.t
 test-sshserver.py
 test-stack.t
 test-status-inprocess.py
diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py
--- a/mercurial/wireprotov1peer.py
+++ b/mercurial/wireprotov1peer.py
@@ -355,7 +355,7 @@ class wirepeer(repository.peer):
 yield {'nodes': wireprototypes.encodelist(nodes)}, f
 d = f.value
 try:
-yield [bool(int(b)) for b in d]
+yield [bool(int(b)) for b in pycompat.iterbytestr(d)]
 except ValueError:
 self._abort(error.ResponseError(_("unexpected response:"), d))
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 8] py3: glob out some error messages in test-fileset.t

2018-06-16 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529136243 -32400
#  Sat Jun 16 17:04:03 2018 +0900
# Node ID f13276ec9109d1b428c14e638d0f2b35f484291e
# Parent  63809ae9c19bbec2df4bed0003d2347ddf5c3ea1
py3: glob out some error messages in test-fileset.t

Python3 provides more detailed messages, which is fine.

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -159,6 +159,7 @@ test-filebranch.t
 test-filecache.py
 test-filelog.py
 test-fileset-generated.t
+test-fileset.t
 test-fix-topology.t
 test-flags.t
 test-generaldelta.t
diff --git a/tests/test-fileset.t b/tests/test-fileset.t
--- a/tests/test-fileset.t
+++ b/tests/test-fileset.t
@@ -68,7 +68,7 @@ Test operators and basic patterns
   a2
   $ fileset 'a_b'
   $ fileset '"\xy"'
-  hg: parse error: invalid \x escape
+  hg: parse error: invalid \x escape* (glob)
   [255]
 
 Test invalid syntax
@@ -196,7 +196,7 @@ Test files properties
   c1
   b1
   $ fileset 'grep("missingparens(")'
-  hg: parse error: invalid match pattern: unbalanced parenthesis
+  hg: parse error: invalid match pattern: (unbalanced parenthesis|missing 
\)).* (re)
   [255]
 
 #if execbit
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 8] py3: cast bytes encoding name to str in fileset.py

2018-06-16 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529135798 -32400
#  Sat Jun 16 16:56:38 2018 +0900
# Node ID 5cb39a368c803683fd8bc944480486a618ab785a
# Parent  c924e7dbcd0ff8bf2f7ab9e5bde5f6679d70a894
py3: cast bytes encoding name to str in fileset.py

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -427,7 +427,7 @@ def encoding(mctx, x):
 for f in mctx.existing():
 d = mctx.ctx[f].data()
 try:
-d.decode(enc)
+d.decode(pycompat.sysstr(enc))
 except LookupError:
 raise error.Abort(_("unknown encoding '%s'") % enc)
 except UnicodeDecodeError:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 8] fileset: raise ProgrammingError for bad existing() calls

2018-06-16 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529136005 -32400
#  Sat Jun 16 17:00:05 2018 +0900
# Node ID 63809ae9c19bbec2df4bed0003d2347ddf5c3ea1
# Parent  5cb39a368c803683fd8bc944480486a618ab785a
fileset: raise ProgrammingError for bad existing() calls

And glob out Py2/3 difference.

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -566,7 +566,8 @@ class matchctx(object):
 def filter(self, files):
 return [f for f in files if f in self.subset]
 def existing(self):
-assert self._existingenabled, 'unexpected existing() invocation'
+if not self._existingenabled:
+raise error.ProgrammingError('unexpected existing() invocation')
 if self._status is not None:
 removed = set(self._status[3])
 unknown = set(self._status[4] + self._status[5])
diff --git a/tests/test-fileset.t b/tests/test-fileset.t
--- a/tests/test-fileset.t
+++ b/tests/test-fileset.t
@@ -446,7 +446,7 @@ Test detection of unintentional 'matchct
   > EOF
 
   $ fileset 'existingcaller()' 2>&1 | tail -1
-  AssertionError: unexpected existing() invocation
+  *ProgrammingError: *unexpected existing() invocation* (glob)
 
 Test 'revs(...)'
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 6 of 8] py3: remove b'' from output of test-eol.t

2018-06-16 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529139269 -32400
#  Sat Jun 16 17:54:29 2018 +0900
# Node ID f701eb1d33ae7b9526742315b4f1d375ec016574
# Parent  bb0ed8255ed912ae146dd3f1f594ab3321025f48
py3: remove b'' from output of test-eol.t

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -126,6 +126,7 @@ test-eol-hook.t
 test-eol-patch.t
 test-eol-tag.t
 test-eol-update.t
+test-eol.t
 test-excessive-merge.t
 test-exchange-obsmarkers-case-A1.t
 test-exchange-obsmarkers-case-A2.t
diff --git a/tests/test-eol.t b/tests/test-eol.t
--- a/tests/test-eol.t
+++ b/tests/test-eol.t
@@ -7,7 +7,7 @@ Test EOL extension
 
 Set up helpers
 
-  $ cat > switch-eol.py < switch-eol.py <<'EOF'
   > from __future__ import absolute_import
   > import os
   > import sys
@@ -17,8 +17,10 @@ Set up helpers
   > msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
   > except ImportError:
   > pass
+  > eolmap = {b'\n': '\\n', b'\r\n': '\\r\\n'}
   > (old, new) = sys.argv[1] == 'LF' and (b'\n', b'\r\n') or (b'\r\n', b'\n')
-  > print("%% switching encoding from %r to %r" % (old, new))
+  > print("%% switching encoding from '%s' to '%s'"
+  >   % (eolmap[old], eolmap[new]))
   > for path in sys.argv[2:]:
   > data = open(path, 'rb').read()
   > data = data.replace(old, new)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 8 of 8] py3: ditch email.parser.BytesParser which appears to be plain crap

2018-06-16 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529145067 -32400
#  Sat Jun 16 19:31:07 2018 +0900
# Node ID eecc513212b2cacc491d898d62ad8edec5192974
# Parent  bc71920694ff3bb072daff3751a57ede528fcb8b
py3: ditch email.parser.BytesParser which appears to be plain crap

As I said before, BytesParser is a thin wrapper over the unicode Parser,
and it's too thin to return bytes back. Today, I found it does normalize
newline characters to '\n's thanks to the careless use of TextIOWrapper.

So, this patch replaces BytesParser with Parser + TextIOWrapper, and fix
newline handling. Since I don't know what's the least bad encoding strategy
here, I just copied it from BytesParser.

I've moved new parse() function from pycompat, as it is no longer a trivial
wrapper.

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -203,6 +203,7 @@ test-http.t
 test-hybridencode.py
 test-identify.t
 test-import-bypass.t
+test-import-eol.t
 test-import-merge.t
 test-import-unknown.t
 test-import.t
diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -11,6 +11,8 @@ import email
 import email.charset
 import email.header
 import email.message
+import email.parser
+import io
 import os
 import smtplib
 import socket
@@ -322,6 +324,23 @@ def mimeencode(ui, s, charsets=None, dis
 s, cs = _encode(ui, s, charsets)
 return mimetextqp(s, 'plain', cs)
 
+if pycompat.ispy3:
+def parse(fp):
+ep = email.parser.Parser()
+# disable the "universal newlines" mode, which isn't binary safe.
+# I have no idea if ascii/surrogateescape is correct, but that's
+# what the standard Python email parser does.
+fp = io.TextIOWrapper(fp, encoding=r'ascii',
+  errors=r'surrogateescape', newline=chr(10))
+try:
+return ep.parse(fp)
+finally:
+fp.detach()
+else:
+def parse(fp):
+ep = email.parser.Parser()
+return ep.parse(fp)
+
 def headdecode(s):
 '''Decodes RFC-2047 header'''
 uparts = []
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -112,7 +112,7 @@ def split(stream):
 cur.append(line)
 c = chunk(cur)
 
-m = pycompat.emailparser().parse(c)
+m = mail.parse(c)
 if not m.is_multipart():
 yield msgfp(m)
 else:
@@ -230,7 +230,7 @@ def _extract(ui, fileobj, tmpname, tmpfp
 
 data = {}
 
-msg = pycompat.emailparser().parse(fileobj)
+msg = mail.parse(fileobj)
 
 subject = msg[r'Subject'] and mail.headdecode(msg[r'Subject'])
 data['user'] = msg[r'From'] and mail.headdecode(msg[r'From'])
diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -295,10 +295,6 @@ if ispy3:
 ret = shlex.split(s.decode('latin-1'), comments, posix)
 return [a.encode('latin-1') for a in ret]
 
-def emailparser(*args, **kwargs):
-import email.parser
-return email.parser.BytesParser(*args, **kwargs)
-
 else:
 import cStringIO
 
@@ -371,10 +367,6 @@ else:
 rawinput = raw_input
 getargspec = inspect.getargspec
 
-def emailparser(*args, **kwargs):
-import email.parser
-return email.parser.Parser(*args, **kwargs)
-
 isjython = sysplatform.startswith('java')
 
 isdarwin = sysplatform == 'darwin'
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 8] py3: replace s[-1] with s.endswith() in eol handling

2018-06-16 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1529139231 -32400
#  Sat Jun 16 17:53:51 2018 +0900
# Node ID bb0ed8255ed912ae146dd3f1f594ab3321025f48
# Parent  cfa1ca8c0eb7a92cdc088b0699415f9d4351543a
py3: replace s[-1] with s.endswith() in eol handling

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -123,6 +123,7 @@ test-encoding.t
 test-eol-add.t
 test-eol-clone.t
 test-eol-hook.t
+test-eol-patch.t
 test-eol-tag.t
 test-eol-update.t
 test-excessive-merge.t
@@ -199,6 +200,7 @@ test-http-clone-r.t
 test-http.t
 test-hybridencode.py
 test-identify.t
+test-import-bypass.t
 test-import-merge.t
 test-import-unknown.t
 test-import.t
diff --git a/hgext/eol.py b/hgext/eol.py
--- a/hgext/eol.py
+++ b/hgext/eol.py
@@ -142,7 +142,7 @@ def tolf(s, params, ui, **kwargs):
 if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
 return s
 if (ui.configbool('eol', 'fix-trailing-newline')
-and s and s[-1] != '\n'):
+and s and not s.endswith('\n')):
 s = s + '\n'
 return util.tolf(s)
 
@@ -153,7 +153,7 @@ def tocrlf(s, params, ui, **kwargs):
 if ui.configbool('eol', 'only-consistent') and inconsistenteol(s):
 return s
 if (ui.configbool('eol', 'fix-trailing-newline')
-and s and s[-1] != '\n'):
+and s and not s.endswith('\n')):
 s = s + '\n'
 return util.tocrlf(s)
 
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -707,7 +707,7 @@ class patchfile(object):
 if self.eolmode != 'strict' and eol and eol != '\n':
 rawlines = []
 for l in lines:
-if l and l[-1] == '\n':
+if l and l.endswith('\n'):
 l = l[:-1] + eol
 rawlines.append(l)
 lines = rawlines
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D3665#58862, @johnstiles wrote:
  
  > Without more context I have no idea what you are trying to show. Windows is
  >  certainly capable of rendering Unicode characters in the console. It is
  >  also very possible to get ? characters if you're running a
  >  non-Unicode-aware tool or if there are encoding mix-up issues. "type con"
  >  and pasting in text from a text editor doesn't really prove anything one
  >  way or the other. (What editor? What encoding did it think the data was?
  >  How does "type con" handle Unicode text? etc.)
  >
  > Run the actual hgext and take a screenshot of what it generates if you want
  >  to give a more useful data point for us.
  
  
  Copy-pasting would render utf-8 characters correctly if the font supports 
them. It does not seem to be related to the current codepage.
  
  I edited the screenshot to show an explicit `type a-utf-8-file` with "utf-8" 
(65001) codepage, with different fonts.
  
  Note: Mercurial will raise "unknown encoding: cp65001" in this case so it's 
probably safe if you have the `encoding.encoding != 'utf8'` check. But anything 
rendered using the utf-8 characters (be it from "git bash hg -G ... > a.txt" or 
whatever POSIX-like shells) will render sub-optimally in cmd.exe.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread quark (Jun Wu)
quark added a comment.


  In https://phab.mercurial-scm.org/D3665#58860, @johnstiles wrote:
  
  > What are you trying to demonstrate here? I'm lost.
  
  
  I'm sorry you feel lost. Since Windows was mentioned in the thread and I 
happen to have a Windows system, I thought it's somehow useful to post a real 
cmd.exe screenshot with these characters - they do NOT render well. If that's 
not clear or is unrelated to the change, please ignore.

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread johnstiles (John Stiles)
johnstiles added a comment.


  What are you trying to demonstrate here? I'm lost.
  
  In https://phab.mercurial-scm.org/D3665#58858, @quark wrote:
  
  > Maybe I should change cmd.exe font. But here's what I got pasting the text 
into the console:
  >
  > F103261: cmd.png 

REPOSITORY
  rHG Mercurial

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

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


D3665: graph: improve graph output by using Unicode characters

2018-06-16 Thread quark (Jun Wu)
quark added a comment.


  Maybe I should change cmd.exe font. But here's what I got pasting the text 
into the console:
  
  F103261: cmd.png 

REPOSITORY
  rHG Mercurial

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

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