Re: [PATCH 5 of 5] githelp: lowercase the start of output messages for consistency

2018-05-22 Thread Martin von Zweigbergk via Mercurial-devel
On Mon, May 21, 2018 at 8:17 PM Matt Harbison  wrote:

> # HG changeset patch
> # User Matt Harbison 
> # Date 1526958268 14400
> #  Mon May 21 23:04:28 2018 -0400
> # Node ID d6ecb77cc36283d5141cef8f87b014619322132a
> # Parent  8e4cdc86c55f579eac9887bd2bd09a5867232d32
> githelp: lowercase the start of output messages for consistency
>
> I left 'Mercurial' as a proper name capitalized.
>
> diff --git a/hgext/githelp.py b/hgext/githelp.py
> --- a/hgext/githelp.py
> +++ b/hgext/githelp.py
> @@ -196,7 +196,7 @@ def apply(ui, repo, *args, **kwargs):
>  ui.status((bytes(cmd)), "\n")
>
>  def bisect(ui, repo, *args, **kwargs):
> -ui.status(_("See 'hg help bisect' for how to use bisect.\n\n"))
> +ui.status(_("see 'hg help bisect' for how to use bisect.\n\n"))
>

I think we usually also drop the trailing period.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] githelp: cleanup one more abort message

2018-05-22 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1527047288 14400
#  Tue May 22 23:48:08 2018 -0400
# Node ID e951e2017229ef3e84bef144fb50546de058d93b
# Parent  a6bed2a6eafea7d89af7e12696169c754c9bf64a
githelp: cleanup one more abort message

This makes the string localizable, uses the more standard hint argument, quotes
the problem option so it stands out, and kills a stray apostrophe.

diff --git a/hgext/githelp.py b/hgext/githelp.py
--- a/hgext/githelp.py
+++ b/hgext/githelp.py
@@ -94,10 +94,9 @@ def parseoptions(ui, cmdoptions, args):
 try:
 args.remove(flag)
 except Exception:
-raise error.Abort(
-"unknown option {0} packed with other options\n"
-"Please try passing the option as it's own flag: -{0}" \
-.format(ex.opt))
+msg = _("unknown option '{0}' packed with other options")
+hint = _("please try passing the option as its own flag: -{0}")
+raise error.Abort(msg.format(ex.opt), hint=hint.format(ex.opt))
 
 ui.warn(_("ignoring unknown option %s\n") % flag)
 
diff --git a/tests/test-githelp.t b/tests/test-githelp.t
--- a/tests/test-githelp.t
+++ b/tests/test-githelp.t
@@ -43,8 +43,8 @@ githelp on a command with standalone unr
 
 githelp on a command with unrecognized option packed with other options should 
fail with error
   $ hg githelp -- commit -pv
-  abort: unknown option v packed with other options
-  Please try passing the option as it's own flag: -v
+  abort: unknown option 'v' packed with other options
+  (please try passing the option as its own flag: -v)
   [255]
 
 githelp for git rebase --skip
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] terse: pconvert() entries added to the temporary terse dict for Windows

2018-05-22 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1527045735 14400
#  Tue May 22 23:22:15 2018 -0400
# Node ID a6bed2a6eafea7d89af7e12696169c754c9bf64a
# Parent  c65931d23baf101780d00f027bf57dbe0af5e8cc
terse: pconvert() entries added to the temporary terse dict for Windows

Recent additional testing revealed this problem on Windows:

  --- tests/test-status.t.err
  +++ tests/test-status.t.err
  @@ -109,7 +109,7 @@

   tweaking defaults works
 $ hg status --cwd a --config ui.tweakdefaults=yes
  -  ? .
  +  ? ../a/
 ? ../b/
 ? ../in_root
 $ HGPLAIN=1 hg status --cwd a --config ui.tweakdefaults=yes
  @@ -120,7 +120,7 @@
 ? b/in_b (glob)
 ? in_root
 $ HGPLAINEXCEPT=tweakdefaults hg status --cwd a --config 
ui.tweakdefaults=yes
  -  ? .
  +  ? ..\a\
 ? ../b/
 ? ../in_root (glob)

AFAICT, the status list (input and output here) is always in '/' format.  The
'\' printed output on Windows is because each file is run through repo.pathto()
-> dirstate.pathto() -> util.pathto().  (And that function states that the
argument uses '/' separators.)

I fixed a similar issue in 362096cfdb1f, and given the apparent need for these
strings to be in '/' format, I wonder if cmdutil.dirnode() should be rewritten
to avoid os.path.join().  But it looks like all entries added to the temporary
terse dict should use '/' now, and cmdutil.tersedir() looks like the only user.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -552,7 +552,7 @@ def tersedir(statuslist, terseargs):
 # process each sub-directory and build tersedict
 for subdir in rootobj.subdirs.values():
 for st, f in subdir.tersewalk(terseargs):
-tersedict[st].append(f)
+tersedict[st].append(util.pconvert(f))
 
 tersedlist = []
 for st in allst:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3644: state: raise CorruptedState error isntead of ProgrammingError

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

REVISION SUMMARY
  There are old state files which don't have a version number in top of them and
  hence we have to read them to check whether they are good or not.
  ProgrammingError is not apt for this case. Thanks to Yuya for suggesting
  CorruptedState error.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -72,8 +72,8 @@
 try:
 int(fp.readline())
 except ValueError:
-raise error.ProgrammingError("unknown version of state file"
- " found")
+raise error.CorruptedState("unknown version of state file"
+   " found")
 return cbor.load(fp)
 
 def delete(self):



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


Re: [PATCH] githelp: do not concatenate i18n messages dynamically so they can be collected

2018-05-22 Thread Pulkit Goyal
On Tue, May 22, 2018 at 5:21 PM Yuya Nishihara  wrote:

> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1526989422 -32400
> #  Tue May 22 20:43:42 2018 +0900
> # Node ID 4640b4e1027f5060caa11e7eb23c2524a9a354c4
> # Parent  6ef01102ebfff6e1fdfa54bff6ebaebe27e37b7b
> githelp: do not concatenate i18n messages dynamically so they can be
> collected
>

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


mercurial@38033: 6 new changesets (2 on stable)

2018-05-22 Thread Mercurial Commits
6 new changesets (2 on stable) in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/d1134ca5b1a3
changeset:   38028:d1134ca5b1a3
user:Joerg Sonnenberger 
date:Sat May 12 23:44:08 2018 +0200
summary: notify: add option to include function names in the diff output

https://www.mercurial-scm.org/repo/hg/rev/a4a5c3085ea9
changeset:   38029:a4a5c3085ea9
user:Yuya Nishihara 
date:Thu May 17 21:55:00 2018 +0900
summary: test-merge-tools: create repo directory to free $TESTTMP for 
temporary files

https://www.mercurial-scm.org/repo/hg/rev/69779a222d5e
changeset:   38030:69779a222d5e
user:Yuya Nishihara 
date:Sun May 13 11:08:35 2018 +0900
summary: test-http-branchmap: fix encoding test to wrap the server stream

https://www.mercurial-scm.org/repo/hg/rev/37ef6ee87488
changeset:   38031:37ef6ee87488
bookmark:@
user:Yuya Nishihara 
date:Sun May 13 11:09:53 2018 +0900
summary: test-http-branchmap: fix stdio mode on Windows

https://www.mercurial-scm.org/repo/hg/rev/f9dc1d5b676b
changeset:   38032:f9dc1d5b676b
branch:  stable
parent:  38000:7c05198cd1ca
user:Boris Feld 
date:Fri May 04 19:06:46 2018 +0200
summary: httppeer: properly gate debug usage behind debug flag check

https://www.mercurial-scm.org/repo/hg/rev/13b2812cff2b
changeset:   38033:13b2812cff2b
branch:  stable
tag: tip
user:Boris Feld 
date:Mon May 21 15:14:46 2018 +0200
summary: httppeer: declare 'dbg' at the function level

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


D3643: localrepo: add docstring to _makedirstate to make it less likely to be removed

2018-05-22 Thread spectral (Kyle Lippincott)
spectral 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/D3643

AFFECTED FILES
  mercurial/localrepo.py

CHANGE DETAILS

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -781,6 +781,7 @@
 return self._makedirstate()
 
 def _makedirstate(self):
+"""Extension point for wrapping the dirstate per-repo."""
 sparsematchfn = lambda: sparse.matcher(self)
 
 return dirstate.dirstate(self.vfs, self.ui, self.root,



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


[Bug 5892] New: `hg showconfig ui.interactive` returns incorrect value

2018-05-22 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5892

Bug ID: 5892
   Summary: `hg showconfig ui.interactive` returns incorrect value
   Product: Mercurial
   Version: default branch
  Hardware: PC
OS: All
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: 7895pul...@gmail.com
CC: mercurial-devel@mercurial-scm.org

If you set `ui.interactive = True` in your hgrc and do `hg showconfig
ui.interactive`, it will return `False`. The reason behind this is that the
config command starts pager and pager sets `ui.interactive` to False. We should
show the original value of the config option here which was True.

This bug will also apply to other config settings changed by pager currently or
in future.

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


D3579: state: write the version number in plain text on top of state files

2018-05-22 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D3579#57298, @yuja wrote:
  
  > > mercurial/state.py:65: undefined name 'iv'
  > >  mercurial/state.py:73: local variable 'version' is assigned to but never 
used
  >
  > Queued the fixes.
  
  
  Thanks!

REPOSITORY
  rHG Mercurial

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

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


mercurial@38027: 27 new changesets

2018-05-22 Thread Mercurial Commits
27 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/d9185fa1e868
changeset:   38001:d9185fa1e868
parent:  37999:514605777244
user:Gregory Szorc 
date:Sat May 12 10:53:53 2018 -0700
summary: contrib: remove fixpax.py

https://www.mercurial-scm.org/repo/hg/rev/cd4959c33d1a
changeset:   38002:cd4959c33d1a
user:Gregory Szorc 
date:Sat May 12 12:12:12 2018 -0700
summary: setup: reformat options argument

https://www.mercurial-scm.org/repo/hg/rev/1335bbfb066f
changeset:   38003:1335bbfb066f
user:Gregory Szorc 
date:Sat May 12 13:17:01 2018 -0700
summary: packaging: move most of contrib/docker to contrib/packaging/docker

https://www.mercurial-scm.org/repo/hg/rev/1868db0d1515
changeset:   38004:1868db0d1515
user:Gregory Szorc 
date:Sat May 12 10:33:11 2018 -0700
summary: packaging: move some docker scripts into contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/ea70512b1ad6
changeset:   38005:ea70512b1ad6
user:Gregory Szorc 
date:Sat May 12 10:28:00 2018 -0700
summary: packaging: move packagelib.sh into contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/64b086f0ebb5
changeset:   38006:64b086f0ebb5
user:Gregory Szorc 
date:Sat May 12 10:31:34 2018 -0700
summary: packaging: move builddeb into contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/c1a028d15005
changeset:   38007:c1a028d15005
user:Gregory Szorc 
date:Sat May 12 10:38:36 2018 -0700
summary: packaging: move mercurial.spec to contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/b7cd9e94c259
changeset:   38008:b7cd9e94c259
user:Gregory Szorc 
date:Sat May 12 10:41:08 2018 -0700
summary: packaging: move buildrpm to contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/e51c91c14a07
changeset:   38009:e51c91c14a07
user:Gregory Szorc 
date:Sat May 12 17:16:09 2018 -0700
summary: packaging: move contrib/debian to contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/142998a45056
changeset:   38010:142998a45056
user:Gregory Szorc 
date:Sat May 12 10:47:44 2018 -0700
summary: packaging: move build-linux-wheels.sh to contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/6f5b4ceea95b
changeset:   38011:6f5b4ceea95b
user:Gregory Szorc 
date:Sat May 12 10:50:30 2018 -0700
summary: packaging: move linux-wheel-centos5-blacklist to contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/e5d2248dcc39
changeset:   38012:e5d2248dcc39
user:Gregory Szorc 
date:Sat May 12 10:57:04 2018 -0700
summary: packaging: move contrib/macosx to contrib/packaging/

https://www.mercurial-scm.org/repo/hg/rev/917f635b5c6a
changeset:   38013:917f635b5c6a
user:Gregory Szorc 
date:Sat May 12 12:27:51 2018 -0700
summary: packaging: make packaging scripts less reliant on pwd

https://www.mercurial-scm.org/repo/hg/rev/768bd75835d7
changeset:   38014:768bd75835d7
user:Gregory Szorc 
date:Sat May 12 18:05:50 2018 -0700
summary: packaging: move most packaging targets to own Makefile

https://www.mercurial-scm.org/repo/hg/rev/c76526d7d6e9
changeset:   38015:c76526d7d6e9
user:David Demelier 
date:Mon May 14 12:53:13 2018 +0200
summary: export: add -B option to select a bookmark

https://www.mercurial-scm.org/repo/hg/rev/81ca0fd348e3
changeset:   38016:81ca0fd348e3
user:Martin von Zweigbergk 
date:Tue May 15 09:57:58 2018 -0700
summary: tests: test failure reporting in blackbox code

https://www.mercurial-scm.org/repo/hg/rev/6660b90805c6
changeset:   38017:6660b90805c6
user:Pulkit Goyal <7895pul...@gmail.com>
date:Fri Apr 27 20:55:10 2018 +0530
summary: py3: suppress the value returned by .write() calls

https://www.mercurial-scm.org/repo/hg/rev/a9ffb4a577d0
changeset:   38018:a9ffb4a577d0
user:Pulkit Goyal <7895pul...@gmail.com>
date:Thu Feb 15 17:15:21 2018 +0530
summary: py3: add b'' prefixes in tests/test-extension.t

https://www.mercurial-scm.org/repo/hg/rev/2f406142d7b4
changeset:   38019:2f406142d7b4
user:Pulkit Goyal <7895pul...@gmail.com>
date:Wed May 16 07:58:02 2018 +0530
summary: py3: use pycompat.bytestr() on bytes before %r-ing it

https://www.mercurial-scm.org/repo/hg/rev/9d44c71bd892
changeset:   38020:9d44c71bd892
user:Pulkit Goyal <7895pul...@gmail.com>
date:Fri Apr 27 21:54:37 2018 +0530
summary: py3: use pycompat.bytestr() instead of str() in extensions.py

https://www.mercurial-scm.org/repo/hg/rev/538e850ae737
changeset:   38021:538e850ae737
user:Kyle Lippincott 
date:Tue May 15 11:52:43 2018 -0700
summary: tests: mark tests that fail when using chg as #require no-chg

https://www.mercurial-scm.org/repo/hg/rev/48853a927757
changeset:   38022:48853a927757
user:Yuya Ni

D3559: narrow: only wrap dirstate functions once, instead of per-reposetup

2018-05-22 Thread spectral (Kyle Lippincott)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1cba497491be: narrow: only wrap dirstate functions once, 
instead of per-reposetup (authored by spectral, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3559?vs=8744&id=8871#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3559?vs=8744&id=8871

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

AFFECTED FILES
  hgext/narrow/__init__.py
  hgext/narrow/narrowdirstate.py
  hgext/narrow/narrowrepo.py
  mercurial/localrepo.py
  tests/test-narrow-expanddirstate.t

CHANGE DETAILS

diff --git a/tests/test-narrow-expanddirstate.t 
b/tests/test-narrow-expanddirstate.t
--- a/tests/test-narrow-expanddirstate.t
+++ b/tests/test-narrow-expanddirstate.t
@@ -72,29 +72,31 @@
   >   for f in repo[b'.'].manifest().walk(added):
   > repo.dirstate.normallookup(f)
   > 
-  > def makeds(ui, repo):
-  >   def wrapds(orig, self):
-  > ds = orig(self)
-  > class expandingdirstate(ds.__class__):
-  >   @hgutil.propertycache
-  >   def _map(self):
-  > ret = super(expandingdirstate, self)._map
-  > with repo.wlock(), repo.lock(), repo.transaction(
-  > b'expandnarrowspec'):
-  >   expandnarrowspec(ui, repo,
-  >encoding.environ.get(b'DIRSTATEINCLUDES'))
-  > return ret
-  > ds.__class__ = expandingdirstate
-  > return ds
-  >   return wrapds
+  > def wrapds(ui, repo, ds):
+  >   class expandingdirstate(ds.__class__):
+  > @hgutil.propertycache
+  > def _map(self):
+  >   ret = super(expandingdirstate, self)._map
+  >   with repo.wlock(), repo.lock(), repo.transaction(
+  >   b'expandnarrowspec'):
+  > expandnarrowspec(ui, repo,
+  >  encoding.environ.get(b'DIRSTATEINCLUDES'))
+  >   return ret
+  >   ds.__class__ = expandingdirstate
+  >   return ds
   > 
   > def reposetup(ui, repo):
-  >   extensions.wrapfilecache(localrepo.localrepository, b'dirstate',
-  >makeds(ui, repo))
-  >   def overridepatch(orig, *args, **kwargs):
+  >   class expandingrepo(repo.__class__):
+  > def _makedirstate(self):
+  >   dirstate = super(expandingrepo, self)._makedirstate()
+  >   return wrapds(ui, repo, dirstate)
+  >   repo.__class__ = expandingrepo
+  > 
+  > def extsetup(unused_ui):
+  >   def overridepatch(orig, ui, repo, *args, **kwargs):
   > with repo.wlock():
   >   expandnarrowspec(ui, repo, encoding.environ.get(b'PATCHINCLUDES'))
-  >   return orig(*args, **kwargs)
+  >   return orig(ui, repo, *args, **kwargs)
   > 
   >   extensions.wrapfunction(patch, b'patch', overridepatch)
   > EOF
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -778,6 +778,9 @@
 
 @repofilecache('dirstate')
 def dirstate(self):
+return self._makedirstate()
+
+def _makedirstate(self):
 sparsematchfn = lambda: sparse.matcher(self)
 
 return dirstate.dirstate(self.vfs, self.ui, self.root,
diff --git a/hgext/narrow/narrowrepo.py b/hgext/narrow/narrowrepo.py
--- a/hgext/narrow/narrowrepo.py
+++ b/hgext/narrow/narrowrepo.py
@@ -15,6 +15,7 @@
 )
 
 from . import (
+narrowdirstate,
 narrowrevlog,
 )
 
@@ -62,4 +63,8 @@
 return scmutil.status(modified, added, removed, deleted, unknown,
   ignored, clean)
 
+def _makedirstate(self):
+dirstate = super(narrowrepository, self)._makedirstate()
+return narrowdirstate.wrapdirstate(self, dirstate)
+
 repo.__class__ = narrowrepository
diff --git a/hgext/narrow/narrowdirstate.py b/hgext/narrow/narrowdirstate.py
--- a/hgext/narrow/narrowdirstate.py
+++ b/hgext/narrow/narrowdirstate.py
@@ -9,74 +9,91 @@
 
 from mercurial.i18n import _
 from mercurial import (
-dirstate,
 error,
-extensions,
 match as matchmod,
 narrowspec,
 util as hgutil,
 )
 
-def setup(repo):
+def wrapdirstate(repo, dirstate):
 """Add narrow spec dirstate ignore, block changes outside narrow spec."""
 
-def walk(orig, self, match, subrepos, unknown, ignored, full=True,
- narrowonly=True):
-if narrowonly:
-# hack to not exclude explicitly-specified paths so that they can
-# be warned later on e.g. dirstate.add()
-em = matchmod.exact(match._root, match._cwd, match.files())
-nm = matchmod.unionmatcher([repo.narrowmatch(), em])
-match = matchmod.intersectmatchers(match, nm)
-return orig(self, match, subrepos, unknown, ignored, full)
-
-extensions.wrapfunction(dirstate.dirstate, 'walk', walk)
-
-# Prevent adding files that are outside the sparse checkout
-editfuncs = ['normal', 'add', 'normallookup', 'copy', 'remove', 'merge']
-for func in editfuncs:
-def _w

D3559: narrow: only wrap dirstate functions once, instead of per-reposetup

2018-05-22 Thread yuja (Yuya Nishihara)
yuja added a comment.


  Queued, thanks.
  
  > - a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -778,6 +778,9 @@
  > 
  >   @repofilecache('dirstate') def dirstate(self): +return 
self._makedirstate() + +def _makedirstate(self):
  
  Can you add a docstring so we wouldn't remove this function by mistake?
  
  > - # Prevent adding files that are outside the sparse checkout
  > - editfuncs = ['normal', 'add', 'normallookup', 'copy', 'remove', 'merge']
  
  
  
  > +@_editfunc
  >  +def remove(self, *args):
  >  +return super(narrowdirstate, self).remove(*args)
  >  +
  >  +@_editfunc
  >  +def remove(self, *args):
  >  +return super(narrowdirstate, self).remove(*args)
  
  s/remove/merge/ the last function in flight.

REPOSITORY
  rHG Mercurial

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

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


Re: D3559: narrow: only wrap dirstate functions once, instead of per-reposetup

2018-05-22 Thread Yuya Nishihara
Queued, thanks.

> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -778,6 +778,9 @@
>  
>  @repofilecache('dirstate')
>  def dirstate(self):
> +return self._makedirstate()
> +
> +def _makedirstate(self):

Can you add a docstring so we wouldn't remove this function by mistake?

> -# Prevent adding files that are outside the sparse checkout
> -editfuncs = ['normal', 'add', 'normallookup', 'copy', 'remove', 'merge']

> +@_editfunc
> +def remove(self, *args):
> +return super(narrowdirstate, self).remove(*args)
> +
> +@_editfunc
> +def remove(self, *args):
> +return super(narrowdirstate, self).remove(*args)

s/remove/merge/ the last function in flight.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3579: state: write the version number in plain text on top of state files

2018-05-22 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > mercurial/state.py:65: undefined name 'iv'
  >  mercurial/state.py:73: local variable 'version' is assigned to but never 
used
  
  Queued the fixes.

REPOSITORY
  rHG Mercurial

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

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


D3640: state: fix usage of an unassigned variable

2018-05-22 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbdc4079ceb16: state: fix usage of an unassigned variable 
(authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3640?vs=8862&id=8869

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -62,7 +62,7 @@
  " an integer")
 
 with self._repo.vfs(self.fname, 'wb', atomictemp=True) as fp:
-fp.write('%d\n' % iv)
+fp.write('%d\n' % version)
 cbor.dump(self.opts, fp, canonical=True)
 
 def _read(self):



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


Re: D3579: state: write the version number in plain text on top of state files

2018-05-22 Thread Yuya Nishihara
> mercurial/state.py:65: undefined name 'iv'
> mercurial/state.py:73: local variable 'version' is assigned to but never used

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


D3641: state: temporary silence pyflakes warning by removing variable assignment

2018-05-22 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb7e5c53a779e: state: temporary silence pyflakes warning by 
removing variable assignment (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3641?vs=8863&id=8870

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -70,7 +70,7 @@
 data in the same format as it was before storing"""
 with self._repo.vfs(self.fname, 'rb') as fp:
 try:
-version = int(fp.readline())
+int(fp.readline())
 except ValueError:
 raise error.ProgrammingError("unknown version of state file"
  " found")



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


Re: [PATCH] export: add -B option to select a bookmark

2018-05-22 Thread Yuya Nishihara
On Tue, 22 May 2018 09:30:39 +0200, David Demelier wrote:
> On Mon, 2018-05-14 at 21:16 +0900, Yuya Nishihara wrote:
> > FWIW, stripbmrevset() will have to be moved somewhere. Maybe scmutil?
> 
> Yes when we will find an appropriate name. Anyone has idea?
> 
> Few ideas:
> 
> scmutil.brevset
> scmutil.bmrevset
> scmutil.bookmarkrevset

My two cents. s/revset/revs/ since no input nor output is a revset query,
and we generally call an evaluated list/set of revisions as revs.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] githelp: do not concatenate i18n messages dynamically so they can be collected

2018-05-22 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1526989422 -32400
#  Tue May 22 20:43:42 2018 +0900
# Node ID 4640b4e1027f5060caa11e7eb23c2524a9a354c4
# Parent  6ef01102ebfff6e1fdfa54bff6ebaebe27e37b7b
githelp: do not concatenate i18n messages dynamically so they can be collected

diff --git a/hgext/githelp.py b/hgext/githelp.py
--- a/hgext/githelp.py
+++ b/hgext/githelp.py
@@ -395,8 +395,8 @@ def clone(ui, repo, *args, **kwargs):
 
 if opts.get('bare'):
 cmd['-U'] = None
-ui.status(_("note: Mercurial does not have bare clones. " +
-"-U will clone the repo without checking out a commit\n\n"))
+ui.status(_("note: Mercurial does not have bare clones. "
+"-U will clone the repo without checking out a 
commit\n\n"))
 elif opts.get('no_checkout'):
 cmd['-U'] = None
 
@@ -438,9 +438,9 @@ def commit(ui, repo, *args, **kwargs):
 cmd['-m'] = "'%s'" % (opts.get('message'),)
 
 if opts.get('all'):
-ui.status(_("note: Mercurial doesn't have a staging area, " +
-"so there is no --all. -A will add and remove files " +
-"for you though.\n\n"))
+ui.status(_("note: Mercurial doesn't have a staging area, "
+"so there is no --all. -A will add and remove files "
+"for you though.\n\n"))
 
 if opts.get('file'):
 cmd['-l'] = opts.get('file')
@@ -456,8 +456,8 @@ def commit(ui, repo, *args, **kwargs):
 ui.status((bytes(cmd)), "\n")
 
 def deprecated(ui, repo, *args, **kwargs):
-ui.warn(_('this command has been deprecated in the git project, ' +
-'thus isn\'t supported by this tool.\n\n'))
+ui.warn(_('this command has been deprecated in the git project, '
+  'thus isn\'t supported by this tool.\n\n'))
 
 def diff(ui, repo, *args, **kwargs):
 cmdoptions = [
@@ -470,8 +470,8 @@ def diff(ui, repo, *args, **kwargs):
 cmd = Command('diff')
 
 if opts.get('cached'):
-ui.status(_('note: Mercurial has no concept of a staging area, ' +
-'so --cached does nothing.\n\n'))
+ui.status(_('note: Mercurial has no concept of a staging area, '
+'so --cached does nothing.\n\n'))
 
 if opts.get('reverse'):
 cmd['--reverse'] = None
@@ -507,10 +507,10 @@ def fetch(ui, repo, *args, **kwargs):
 if len(args) > 0:
 cmd.append(args[0])
 if len(args) > 1:
-ui.status(_("note: Mercurial doesn't have refspecs. " +
-"-r can be used to specify which commits you want to pull. " +
-"-B can be used to specify which bookmark you want to pull." +
-"\n\n"))
+ui.status(_("note: Mercurial doesn't have refspecs. "
+"-r can be used to specify which commits you want to "
+"pull. -B can be used to specify which bookmark you "
+"want to pull.\n\n"))
 for v in args[1:]:
 if v in repo._bookmarks:
 cmd['-B'] = v
@@ -558,10 +558,10 @@ def log(ui, repo, *args, **kwargs):
 ('p', 'patch', None, ''),
 ]
 args, opts = parseoptions(ui, cmdoptions, args)
-ui.status(_('note: -v prints the entire commit message like Git does. To ' 
+
-  'print just the first line, drop the -v.\n\n'))
-ui.status(_("note: see hg help revset for information on how to filter " +
-"log output.\n\n"))
+ui.status(_('note: -v prints the entire commit message like Git does. To '
+'print just the first line, drop the -v.\n\n'))
+ui.status(_("note: see hg help revset for information on how to filter "
+"log output.\n\n"))
 
 cmd = Command('log')
 cmd['-v'] = None
@@ -580,13 +580,13 @@ def log(ui, repo, *args, **kwargs):
 if opts.get('pretty') or opts.get('format') or opts.get('oneline'):
 format = opts.get('format', '')
 if 'format:' in format:
-ui.status(_("note: --format format:??? equates to Mercurial's " +
-"--template. See hg help templates for more info.\n\n"))
+ui.status(_("note: --format format:??? equates to Mercurial's "
+"--template. See hg help templates for more 
info.\n\n"))
 cmd['--template'] = '???'
 else:
-ui.status(_("note: --pretty/format/oneline equate to Mercurial's " 
+
-"--style or --template. See hg help templates for more info." +
-"\n\n"))
+ui.status(_("note: --pretty/format/oneline equate to Mercurial's "
+"--style or --template. See hg help templates for "
+"more info.\n\n"))
 cmd['--style'] = '???'
 
 if len(args) > 0:
@@ -699,10 +699,10 @@ def pull(ui, repo, *args, **kwargs):
 if len(args) > 0:
 cmd.append(args[0])
 if len(args) > 1:
-ui.status(_("note: Me

D3556: run-tests: update the test case name format

2018-05-22 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  I fixed the issue, it was a last minute style fix that turns out to not be 
equivalent to the previous code.
  
  Anyway, here is the updated version that was rebased on top of hg-commited.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 2 of 2 STABLE] httppeer: declare 'dgb' at the function level

2018-05-22 Thread Yuya Nishihara
On Mon, 21 May 2018 16:40:07 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld 
> # Date 1526908486 -7200
> #  Mon May 21 15:14:46 2018 +0200
> # Branch stable
> # Node ID 06458d4a1ca84506d04280052d0288221b2701f0
> # Parent  413f444c264455169af8ff0431a36f9901afc36a
> # EXP-Topic stable-dbg-bug
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
> 06458d4a1ca8
> httppeer: declare 'dgb' at the function level

Queued for stable, thanks.

FWIW, I slight prefer not aliasing ui.debug at all as there are just a few
users.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3556: run-tests: update the test case name format

2018-05-22 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 8868.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3556?vs=8678&id=8868

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

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

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -1496,9 +1496,9 @@
  $ [ $V = C ]
#endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !.
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 3 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -1519,9 +1519,9 @@
  $ [ $V = C ]
#endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !.
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 2 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -1544,9 +1544,9 @@
  $ [ $V = C ]
#endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !.
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 2 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
@@ -1573,7 +1573,7 @@
 
 Support running a specific test case
 
-  $ rt "test-cases-abc.t (case B)"
+  $ rt "test-cases-abc.t#B"
   
   --- $TESTTMP/anothertests/cases/test-cases-abc.t
   +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
@@ -1587,16 +1587,16 @@
  $ [ $V = C ]
#endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 1 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
 
 Support running multiple test cases in the same file
 
-  $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case C)"
+  $ rt test-cases-abc.t#B test-cases-abc.t#C
   
   --- $TESTTMP/anothertests/cases/test-cases-abc.t
   +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
@@ -1610,16 +1610,16 @@
  $ [ $V = C ]
#endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !.
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 2 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
 
 Support running invalid test cases
 
-  $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case D)"
+  $ rt test-cases-abc.t#B test-cases-abc.t#D
   
   --- $TESTTMP/anothertests/cases/test-cases-abc.t
   +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
@@ -1633,9 +1633,9 @@
  $ [ $V = C ]
#endif
   
-  ERROR: test-cases-abc.t (case B) output changed
+  ERROR: test-cases-abc.t#B output changed
   !
-  Failed test-cases-abc.t (case B): output changed
+  Failed test-cases-abc.t#B: output changed
   # Ran 1 tests, 0 skipped, 1 failed.
   python hash seed: * (glob)
   [1]
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -120,7 +120,7 @@
 }
 
 class TestRunnerLexer(lexer.RegexLexer):
-testpattern = r'[\w-]+\.(t|py)( \(case [\w-]+\))?'
+testpattern = r'[\w-]+\.(t|py)(#[\w-]+)?'
 tokens = {
 'root': [
 (r'^Skipped', token.Generic.Skipped, 'skipped'),
@@ -1247,7 +1247,7 @@
 self._allcases = parsettestcases(path)
 super(TTest, self).__init__(path, *args, **kwds)
 if case:
-self.name = '%s (case %s)' % (self.name, _strpath(case))
+self.name = '%s#%s' % (self.name, _strpath(case))
 self.errpath = b'%s.%s.err' % (self.errpath[:-4], case)
 self._tmpname += b'-%s' % case
 self._have = {}
@@ -2646,7 +2646,7 @@
 expanded_args.append(arg)
 args = expanded_args
 
-testcasepattern = re.compile(r'([\w-]+\.t|py)( \(case ([\w-])+\))')
+testcasepattern = re.compile(r'([\w-]+\.t|py)(#([\w-])+)')
 tests = []
 for t in args:
 case = None



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


D3555: run-tests: add support for running specific test cases

2018-05-22 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 8867.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3555?vs=8677&id=8867

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

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

CHANGE DETAILS

diff --git a/tests/test-run-tests.t b/tests/test-run-tests.t
--- a/tests/test-run-tests.t
+++ b/tests/test-run-tests.t
@@ -1571,7 +1571,77 @@
   ..
   # Ran 2 tests, 0 skipped, 0 failed.
 
+Support running a specific test case
+
+  $ rt "test-cases-abc.t (case B)"
+  
+  --- $TESTTMP/anothertests/cases/test-cases-abc.t
+  +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
+  @@ -7,7 +7,7 @@
+ $ V=C
+   #endif
+ $ echo $V | sed 's/A/C/'
+  -  C
+  +  B
+   #if C
+ $ [ $V = C ]
+   #endif
+  
+  ERROR: test-cases-abc.t (case B) output changed
+  !
+  Failed test-cases-abc.t (case B): output changed
+  # Ran 1 tests, 0 skipped, 1 failed.
+  python hash seed: * (glob)
+  [1]
+
+Support running multiple test cases in the same file
+
+  $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case C)"
+  
+  --- $TESTTMP/anothertests/cases/test-cases-abc.t
+  +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
+  @@ -7,7 +7,7 @@
+ $ V=C
+   #endif
+ $ echo $V | sed 's/A/C/'
+  -  C
+  +  B
+   #if C
+ $ [ $V = C ]
+   #endif
+  
+  ERROR: test-cases-abc.t (case B) output changed
+  !.
+  Failed test-cases-abc.t (case B): output changed
+  # Ran 2 tests, 0 skipped, 1 failed.
+  python hash seed: * (glob)
+  [1]
+
+Support running invalid test cases
+
+  $ rt "test-cases-abc.t (case B)" "test-cases-abc.t (case D)"
+  
+  --- $TESTTMP/anothertests/cases/test-cases-abc.t
+  +++ $TESTTMP/anothertests/cases/test-cases-abc.t.B.err
+  @@ -7,7 +7,7 @@
+ $ V=C
+   #endif
+ $ echo $V | sed 's/A/C/'
+  -  C
+  +  B
+   #if C
+ $ [ $V = C ]
+   #endif
+  
+  ERROR: test-cases-abc.t (case B) output changed
+  !
+  Failed test-cases-abc.t (case B): output changed
+  # Ran 1 tests, 0 skipped, 1 failed.
+  python hash seed: * (glob)
+  [1]
+
 Test automatic pattern replacement
+==
 
   $ cat << EOF >> common-pattern.py
   > substitutions = [
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2646,16 +2646,31 @@
 expanded_args.append(arg)
 args = expanded_args
 
+testcasepattern = re.compile(r'([\w-]+\.t|py)( \(case ([\w-])+\))')
 tests = []
 for t in args:
+case = None
+
 if not (os.path.basename(t).startswith(b'test-')
 and (t.endswith(b'.py') or t.endswith(b'.t'))):
-continue
+
+m = testcasepattern.match(t)
+if m is not None:
+t, _, case = m.groups()
+else:
+continue
+
 if t.endswith(b'.t'):
 # .t file may contain multiple test cases
 cases = sorted(parsettestcases(t))
 if cases:
-tests += [{'path': t, 'case': c} for c in sorted(cases)]
+if case is not None and case in cases:
+tests += [{'path': t, 'case': case}]
+elif case is not None and case not in cases:
+# Ignore invalid cases
+pass
+else:
+tests += [{'path': t, 'case': c} for c in 
sorted(cases)]
 else:
 tests.append({'path': t})
 else:



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


D3635: py3: add support for NoneType in stringutil.pprint()

2018-05-22 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >> --- a/mercurial/utils/stringutil.py
  >  > +++ b/mercurial/utils/stringutil.py
  >  > @@ -29,6 +29,8 @@
  >  >  if bprefix:
  >  >  return "b'%s'" % escapestr(o)
  >  >  return "'%s'" % escapestr(o)
  >  > +elif o is None:
  >  > +return 'None'
  > 
  > Should be handled by `b'%r' % o`.
  
  Dropped this patch from hg-committed before sinking deep.

REPOSITORY
  rHG Mercurial

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

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


Re: D3635: py3: add support for NoneType in stringutil.pprint()

2018-05-22 Thread Yuya Nishihara
> > --- a/mercurial/utils/stringutil.py
> > +++ b/mercurial/utils/stringutil.py
> > @@ -29,6 +29,8 @@
> >  if bprefix:
> >  return "b'%s'" % escapestr(o)
> >  return "'%s'" % escapestr(o)
> > +elif o is None:
> > +return 'None'
> 
> Should be handled by `b'%r' % o`.

Dropped this patch from hg-committed before sinking deep.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3635: py3: add support for NoneType in stringutil.pprint()

2018-05-22 Thread Yuya Nishihara
> --- a/mercurial/utils/stringutil.py
> +++ b/mercurial/utils/stringutil.py
> @@ -29,6 +29,8 @@
>  if bprefix:
>  return "b'%s'" % escapestr(o)
>  return "'%s'" % escapestr(o)
> +elif o is None:
> +return 'None'

Should be handled by `b'%r' % o`.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3635: py3: add support for NoneType in stringutil.pprint()

2018-05-22 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > - a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ 
-29,6 +29,8 @@ if bprefix: return "b'%s'" % escapestr(o) return "'%s'" % 
escapestr(o) +elif o is None: +return 'None'
  
  Should be handled by `b'%r' % o`.

REPOSITORY
  rHG Mercurial

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

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


Re: D3631: py3: use pycompat.fsencode to convert path to bytes

2018-05-22 Thread Yuya Nishihara
> --- a/contrib/hg-ssh
> +++ b/contrib/hg-ssh
> @@ -39,6 +39,7 @@
>  
>  from mercurial import (
>  dispatch,
> +pycompat,
>  ui as uimod,
>  )
>  
> @@ -69,7 +70,7 @@
>  path = cmdargv[2]
>  repo = os.path.normpath(os.path.join(cwd, os.path.expanduser(path)))
>  if repo in allowed_paths:
> -cmd = [b'-R', repo, b'serve', b'--stdio']
> +cmd = [b'-R', pycompat.fsencode(repo), b'serve', b'--stdio']

It's probably better to convert sys.argv and cwd to bytes. Otherwise we'll
have to be a human type checker.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D3631: py3: use pycompat.fsencode to convert path to bytes

2018-05-22 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   - a/contrib/hg-ssh +++ b/contrib/hg-ssh @@ -39,6 +39,7 @@
  > 
  > from mercurial import ( dispatch, +pycompat, ui as uimod, )
  > 
  > @@ -69,7 +70,7 @@ path = cmdargv[2] repo = 
os.path.normpath(os.path.join(cwd, os.path.expanduser(path))) if repo in 
allowed_paths:
  > - cmd = [b'-R', repo, b'serve', b'--stdio'] +cmd = [b'-R', 
pycompat.fsencode(repo), b'serve', b'--stdio']
  
  It's probably better to convert sys.argv and cwd to bytes. Otherwise we'll
  have to be a human type checker.

REPOSITORY
  rHG Mercurial

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

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


D3637: py3: add b'' prefixes in tests/test-revset2.t

2018-05-22 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdbea87a2d7e8: py3: add b'' prefixes in 
tests/test-revset2.t (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3637?vs=8845&id=8866

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

AFFECTED FILES
  tests/test-revset2.t

CHANGE DETAILS

diff --git a/tests/test-revset2.t b/tests/test-revset2.t
--- a/tests/test-revset2.t
+++ b/tests/test-revset2.t
@@ -1589,11 +1589,11 @@
   > 
   > revsetpredicate = registrar.revsetpredicate()
   > 
-  > @revsetpredicate('custom1()')
+  > @revsetpredicate(b'custom1()')
   > def custom1(repo, subset, x):
   > return revset.baseset([1])
   > 
-  > raise error.Abort('intentional failure of loading extension')
+  > raise error.Abort(b'intentional failure of loading extension')
   > EOF
   $ cat < .hg/hgrc
   > [extensions]
@@ -1611,14 +1611,14 @@
   > from mercurial import encoding, registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('printprevset')
+  > @command(b'printprevset')
   > def printprevset(ui, repo):
   > alias = {}
-  > p = encoding.environ.get('P')
+  > p = encoding.environ.get(b'P')
   > if p:
-  > alias['P'] = p
-  > revs = repo.anyrevs(['P'], user=True, localalias=alias)
-  > ui.write('P=%r\n' % list(revs))
+  > alias[b'P'] = p
+  > revs = repo.anyrevs([b'P'], user=True, localalias=alias)
+  > ui.write(b'P=%r\n' % list(revs))
   > EOF
 
   $ cat >> .hg/hgrc 

D3642: py3: use encoding.strfromlocal() instead of pycompat.sysstr()

2018-05-22 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd6d939a3676f: py3: use encoding.strfromlocal() instead of 
pycompat.sysstr() (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3642?vs=8864&id=8865

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

AFFECTED FILES
  hgext/churn.py

CHANGE DETAILS

diff --git a/hgext/churn.py b/hgext/churn.py
--- a/hgext/churn.py
+++ b/hgext/churn.py
@@ -52,7 +52,7 @@
 def getkey(ctx):
 t, tz = ctx.date()
 date = datetime.datetime(*time.gmtime(float(t) - tz)[:6])
-return date.strftime(pycompat.sysstr(opts['dateformat']))
+return date.strftime(encoding.strfromlocal(opts['dateformat']))
 else:
 tmpl = opts.get('oldtemplate') or opts.get('template')
 tmpl = logcmdutil.maketemplater(ui, repo, tmpl)



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


D3579: state: write the version number in plain text on top of state files

2018-05-22 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > - def save(self, data): +def save(self, version, data): """write all 
the state data stored to .hg/ file
  > 
  >   we use third-party library cbor to serialize data to write in the file. 
""" +if not isinstance(version, int): +raise 
error.ProgrammingError("version of state file should be" +  
   " an integer") + with self._repo.vfs(self.fname, 'wb', 
atomictemp=True) as fp: +fp.write('%d\n' % iv) cbor.dump(self.opts, 
fp, canonical=True)
  > 
  >   def _read(self): """reads the state file and returns a dictionary which 
contain data in the same format as it was before storing""" with 
self._repo.vfs(self.fname, 'rb') as fp: +try: +
version = int(fp.readline())
  
  mercurial/state.py:65: undefined name 'iv'
  mercurial/state.py:73: local variable 'version' is assigned to but never used
  
  > +except ValueError:
  >  +raise error.ProgrammingError("unknown version of state 
file"
  >  + " found")
  
  Perhaps this should be a CorruptedState error. We don't know whether the
  state file is good until reading it.

REPOSITORY
  rHG Mercurial

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

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


Re: D3579: state: write the version number in plain text on top of state files

2018-05-22 Thread Yuya Nishihara
> -def save(self, data):
> +def save(self, version, data):
>  """write all the state data stored to .hg/ file
>  
>  we use third-party library cbor to serialize data to write in the 
> file.
>  """
> +if not isinstance(version, int):
> +raise error.ProgrammingError("version of state file should be"
> + " an integer")
> +
>  with self._repo.vfs(self.fname, 'wb', atomictemp=True) as fp:
> +fp.write('%d\n' % iv)
>  cbor.dump(self.opts, fp, canonical=True)
>  
>  def _read(self):
>  """reads the state file and returns a dictionary which contain
>  data in the same format as it was before storing"""
>  with self._repo.vfs(self.fname, 'rb') as fp:
> +try:
> +version = int(fp.readline())

mercurial/state.py:65: undefined name 'iv'
mercurial/state.py:73: local variable 'version' is assigned to but never used

> +except ValueError:
> +raise error.ProgrammingError("unknown version of state file"
> + " found")

Perhaps this should be a CorruptedState error. We don't know whether the
state file is good until reading it.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: D3636: py3: use pycompat.fsencode() to convert user value to bytes

2018-05-22 Thread Yuya Nishihara
On Sun, 20 May 2018 13:40:10 +, pulkit (Pulkit Goyal) wrote:
> --- a/mercurial/debugcommands.py
> +++ b/mercurial/debugcommands.py
> @@ -1400,7 +1400,7 @@
>  try:
>  st = vfs.lstat(name)
>  age = now - st[stat.ST_MTIME]
> -user = util.username(st.st_uid)
> +user = pycompat.fsencode(util.username(st.st_uid))

This should be handled by posix/windows.username() just like the other
functions.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH V2] tests: stabilize test-patch.t on Windows

2018-05-22 Thread Yuya Nishihara
On Mon, 21 May 2018 21:45:42 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1526871918 14400
> #  Sun May 20 23:05:18 2018 -0400
> # Node ID 589535dae225b24312ef6d86a54865314a9acebd
> # Parent  6acf41bb8d40c55073e846b81c7466f4b0d390dc
> tests: stabilize test-patch.t on Windows

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


Re: [PATCH 1 of 5] githelp: fail gracefully in a couple cases where arguments are missing

2018-05-22 Thread Pulkit Goyal
On Tue, May 22, 2018 at 8:47 AM Matt Harbison  wrote:

> # HG changeset patch
> # User Matt Harbison 
> # Date 1526956335 14400
> #  Mon May 21 22:32:15 2018 -0400
> # Node ID a34bed7475cc8237665aa8a3febc1237a090bc20
> # Parent  90e02bd8c4473fec03639f26f3d1b2d30d9861d3
> githelp: fail gracefully in a couple cases where arguments are missing
>
> I didn't bother adding tests because the other commands that already
> handled
> missing arguments don't test these edge cases.  I didn't read over all of
> the
> code, rather I scanned for `args` not being checked before indexing.
>

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


Re: [PATCH 3 of 5] githelp: make several strings localizable

2018-05-22 Thread Pulkit Goyal
On Tue, May 22, 2018 at 8:47 AM Matt Harbison  wrote:

> # HG changeset patch
> # User Matt Harbison 
> # Date 1526957717 14400
> #  Mon May 21 22:55:17 2018 -0400
> # Node ID d00bfbf24df05e8b8e21acf1444ea24f265a6123
> # Parent  c137053c30e3a477d9f27aa72f0f791d5bcbe5b2
> githelp: make several strings localizable
>

> diff --git a/hgext/githelp.py b/hgext/githelp.py
> --- a/hgext/githelp.py
> +++ b/hgext/githelp.py
> @@ -67,7 +67,7 @@ def githelp(ui, repo, *args, **kwargs):
>
>  cmd = args[0]
>  if not cmd in gitcommands:
> -raise error.Abort("error: unknown git command %s" % (cmd))
> +raise error.Abort(_("error: unknown git command %s") % (cmd))
>
>  ui.pager('githelp')
>  args = args[1:]
> @@ -90,7 +90,7 @@ def parseoptions(ui, cmdoptions, args):
>  elif ('-' + ex.opt) in ex.msg:
>  flag = '-' + ex.opt
>  else:
> -raise error.Abort("unknown option %s" % ex.opt)
> +raise error.Abort(_("unknown option %s") % ex.opt)
>  try:
>  args.remove(flag)
>  except Exception:
>

​Below this one, there is one more occurrence which needs this love.​
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 6] revlog: in _getcandidaterevs, shorten revlog._generaldelta to gdelta

2018-05-22 Thread Paul Morelle

On 22/05/18 01:12, Gregory Szorc wrote:
> On Mon, May 21, 2018 at 2:47 PM, Paul Morelle
> mailto:paul.more...@octobus.net>> wrote:
>
> # HG changeset patch
> # User Paul Morelle  >
> # Date 1525438855 -7200
> #      Fri May 04 15:00:55 2018 +0200
> # Node ID 054469518b3480201e7f8ada16957027009e9f64
> # Parent  514605777244de61b68c7e1503c4f106773913f4
> # EXP-Topic semi-snapshots
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> 
> #              hg pull
> https://bitbucket.org/octobus/mercurial-devel/
>  -r 054469518b34
> revlog: in _getcandidaterevs, shorten revlog._generaldelta to gdelta
>
>
> Queued parts 1-4. Thanks.
>
> Part 5 failed to apply cleanly. Could you please rebase and resend?
Sure!

However, I am not certain that I have done this properly, as [PATCH 5 of
6] and [PATCH 6 of 6] were sent as [PATCH 1 of 2 V2] and [PATCH 2 of 2 V2].
Is it correct even if the numbers don't match?

Thanks,

Paul
>  
>
>
> diff -r 514605777244 -r 054469518b34 mercurial/revlog.py
> --- a/mercurial/revlog.py       Fri May 11 23:28:02 2018 -0700
> +++ b/mercurial/revlog.py       Fri May 04 15:00:55 2018 +0200
> @@ -305,6 +305,7 @@
>          grouped by level of easiness.
>          """
>          revlog = self.revlog
> +        gdelta = revlog._generaldelta
>          curr = len(revlog)
>          prev = curr - 1
>          p1r, p2r = revlog.rev(p1), revlog.rev(p2)
> @@ -316,13 +317,13 @@
>              # changegroup data into a generaldelta repo. The only
> time it
>              # isn't true is if this is the first revision in a
> delta chain
>              # or if ``format.generaldelta=true`` disabled
> ``lazydeltabase``.
> -            if cachedelta and revlog._generaldelta and
> revlog._lazydeltabase:
> +            if cachedelta and gdelta and revlog._lazydeltabase:
>                  # Assume what we received from the server is a
> good choice
>                  # build delta will reuse the cache
>                  yield (cachedelta[0],)
>                  tested.add(cachedelta[0])
>
> -            if revlog._generaldelta:
> +            if gdelta:
>                  # exclude already lazy tested base if any
>                  parents = [p for p in (p1r, p2r)
>                             if p != nullrev and p not in tested]
> ___
> 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


[PATCH 2 of 2 V2] revlog: make chainbase cache its result for the correct revision

2018-05-22 Thread Paul Morelle
# HG changeset patch
# User Paul Morelle 
# Date 1524324477 -7200
#  Sat Apr 21 17:27:57 2018 +0200
# Node ID 787f2b0636c6d6f44235dcd8436f6d8fc5f1a6cb
# Parent  c0ac96176ebefaf19cd2d368281c180c575c31f2
# EXP-Topic semi-snapshots
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
787f2b0636c6
revlog: make chainbase cache its result for the correct revision

Previously, as 'rev' was our iterator, we were always caching the chain base
for the second revision of the chain, or for the base itself.

diff -r c0ac96176ebe -r 787f2b0636c6 mercurial/revlog.py
--- a/mercurial/revlog.py   Wed Mar 07 11:10:22 2018 +0100
+++ b/mercurial/revlog.py   Sat Apr 21 17:27:57 2018 +0200
@@ -877,10 +877,11 @@
 return base
 
 index = self.index
-base = index[rev][3]
-while base != rev:
-rev = base
-base = index[rev][3]
+iterrev = rev
+base = index[iterrev][3]
+while base != iterrev:
+iterrev = base
+base = index[iterrev][3]
 
 self._chainbasecache[rev] = base
 return base
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 V2] revlog: make getcandidaterevs more consistent about updating tested revs set

2018-05-22 Thread Paul Morelle
# HG changeset patch
# User Paul Morelle 
# Date 1520417422 -3600
#  Wed Mar 07 11:10:22 2018 +0100
# Node ID c0ac96176ebefaf19cd2d368281c180c575c31f2
# Parent  90e02bd8c4473fec03639f26f3d1b2d30d9861d3
# EXP-Topic semi-snapshots
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
c0ac96176ebe
revlog: make getcandidaterevs more consistent about updating tested revs set

Like in previous cases, update the set of tested revisions after yielding

diff -r 90e02bd8c447 -r c0ac96176ebe mercurial/revlog.py
--- a/mercurial/revlog.py   Wed Mar 07 12:00:58 2018 +0100
+++ b/mercurial/revlog.py   Wed Mar 07 11:10:22 2018 +0100
@@ -345,6 +345,7 @@
 # other approach failed try against prev to hopefully save us a
 # fulltext.
 yield (prev,)
+tested.add(prev)
 
 def buildtext(self, revinfo, fh):
 """Builds a fulltext version of a revision
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] export: add -B option to select a bookmark

2018-05-22 Thread David Demelier
On Mon, 2018-05-14 at 21:16 +0900, Yuya Nishihara wrote:
> FWIW, stripbmrevset() will have to be moved somewhere. Maybe scmutil?

Yes when we will find an appropriate name. Anyone has idea?

Few ideas:

scmutil.brevset
scmutil.bmrevset
scmutil.bookmarkrevset

Regards,

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