Re: Auto-formatting with yapf (was: Re: Auto-formatting code with black - object now if you have a strong opinion)

2019-01-09 Thread Matt Harbison

On Wed, 09 Jan 2019 15:30:19 -0500, Augie Fackler  wrote:





On Dec 6, 2018, at 23:21, Matt Harbison  wrote:

On Wed, 05 Dec 2018 08:23:17 -0500, Yuya Nishihara   
wrote:



On Tue, 4 Dec 2018 10:06:24 -0500, Augie Fackler wrote:


So, options to move forward:
1) blacken everything (controversial for good reasons)
2) try black only on a subset
3) explore yapf
4) Give up and keep manually formatting files (I'd rather not do  
this, but I understand if it's where we end up)


My vote: 3 > 4 > 2 > 1

I'm not super enthusiastic about 100%-machine-forced formatting. I like
consistency level provided by e.g. astyle command. clang-format is  
pretty

good IMHO, but the black seems to sacrifice the code readability.


+1.

That said, I got used to longnamesthataresmooshedtogether, so I can  
probably adjust to anything after awhile.


I think I'd still prefer black overall (yapf is less opinionated and  
requires me to think more), but here's a yapf RFC:  
https://phab.mercurial-scm.org/D5539


This would at least help _most_ cases of line-too-long, which I think  
would be good. What do people think?


I think there's less that I dislike with yapf, but I'm not adamant about  
it.


Since I've never used auto formatting, I'm assuming the general procedure  
is to:


  1) code something the approximates the style
  2) run fix
  3) submit

If that's true, what's there to think about?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 2] phabricator: warn if unable to amend, instead of aborting after posting

2019-01-09 Thread Matt Harbison
On Wed, 09 Jan 2019 23:28:38 -0500, Matt Harbison   
wrote:



# HG changeset patch
# User Matt Harbison 
# Date 1546719633 18000
#  Sat Jan 05 15:20:33 2019 -0500
# Node ID 0b7c3a31e42b075b5fc1d90c85f10239d87f9e33
# Parent  98ce494e104dca5200af6ed53d3f4ff6547962a8
phabricator: warn if unable to amend, instead of aborting after posting


Not sure if this made it through OK.  In the preview, the commit message  
was wrapped weird, and there were random '=' characters sprinkled around.   
It looks mangled in my sent box, but the ML web page looks fine.  I assume  
it's related to some really long lines in the VCR file.

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


[PATCH 1 of 2] phabricator: warn if unable to amend, instead of aborting after posting

2019-01-09 Thread Matt Harbison
.push\":\"users\"}},\"attachments\":{}}],\"maps\":{},\"query\":{\"queryKey\":null},\"cursor\":{\"limit\":100,\"after\":null,\"before\":null,\"order\":null}},\"error_code\":null,\"error_info\":null}"
+}
+}, 
+"request": {
+"method": "POST", 
+"uri": 
"https://phab.mercurial-scm.org//api/diffusion.repository.search;, 
+"headers": {
+"content-length": [
+"79"
+], 
+"accept": [
+"application/mercurial-0.1"
+], 
+"content-type": [
+"application/x-www-form-urlencoded"
+], 
+"user-agent": [
+"mercurial/proto-1.0 (Mercurial 
4.8.2+682-e2cf04a597cc+20190109)"
+], 
+"host": [
+"phab.mercurial-scm.org"
+]
+}, 
+"body": 
"constraints%5Bcallsigns%5D%5B0%5D=HG=cli-hahayouwish"
+}
+}, 
+{
+"response": {
+"headers": {
+"content-type": [
+"application/json"
+], 
+"date": [
+"Thu, 10 Jan 2019 04:08:25 GMT"
+], 
+"x-content-type-options": [
+"nosniff"
+], 
+"cache-control": [
+"no-store"
+], 
+"server": [
+"Apache/2.4.10 (Debian)"
+], 
+"x-xss-protection": [
+"1; mode=block"
+], 
+"x-frame-options": [
+"Deny"
+], 
+"expires": [
+"Sat, 01 Jan 2000 00:00:00 GMT"
+], 
+"set-cookie": [
+"phsid=A%2Fkb72422mbpyuyoultl4hkizat6qscjgrl5hi6k2n; 
expires=Tue, 09-Jan-2024 04:08:25 GMT; Max-Age=15768; path=/; 
domain=phab.mercurial-scm.org; secure; httponly"
+], 
+"transfer-encoding": [
+"chunked"
+], 
+"strict-transport-security": [
+    "max-age=0; includeSubdomains; preload"
+]
+}, 
+"status": {
+"message": "OK", 
+"code": 200
+}, 
+"body": {
+"string": 
"{\"result\":{\"id\":13121,\"phid\":\"PHID-DIFF-xrku5f3mlveqr3hhj6a7\",\"uri\":\"https:\\/\\/phab.mercurial-scm.org\\/differential\\/diff\\/13121\\/\"},\"error_code\":null,\"error_info\":null}"
+}
+}, 
+"request": {
+"method": "POST", 
+"uri": 
"https://phab.mercurial-scm.org//api/differential.createrawdiff;, 
+"headers": {
+"content-length": [
+"220"
+], 
+"accept": [
+"application/mercurial-0.1"
+], 
+"content-type": [
+"application/x-www-form-urlencoded"
+], 
+"user-agent": [
+"mercurial/proto-1.0 (Mercurial 
4.8.2+682-e2cf04a597cc+20190109)"
+], 
+"host": [
+"phab.mercurial-scm.org"
+]
+}, 
+"body": 
"repositoryPHID=PHID-REPO-bvunnehri4u2isyr7bc3=diff+--git+a%2Fbeta+b%2Fbeta%0A---+a%2Fbeta%0A%2B%2B%2B+b%2Fbeta%0A%40%40+-1%2C1+%2B1%2C1+%40%40%0A-beta%0A%2Bpublic+change%0A=cli-hahayouwish"
+}
+}, 
+{
+"response": {
+"headers": {
+"content-type

[PATCH 2 of 2] phabricator: teach {phabreview} to work without --amend

2019-01-09 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1546735830 18000
#  Sat Jan 05 19:50:30 2019 -0500
# Node ID bb9cd63d1cce015431a274a581021d8807cd9267
# Parent  0b7c3a31e42b075b5fc1d90c85f10239d87f9e33
phabricator: teach {phabreview} to work without --amend

There's some possibility of this being wrong (e.g. if the url config was
changed).  But commit messages can be amended too, so that isn't bulletproof
either.  Having something seems better than just returning None.

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -997,3 +997,17 @@ def template_review(context, mapping):
 b'url': m.group(b'url'),
 b'id': b"D{}".format(m.group(b'id')),
 })
+else:
+tags = ctx.repo().nodetags(ctx.node())
+for t in tags:
+if _differentialrevisiontagre.match(t):
+url = ctx.repo().ui.config(b'phabricator', b'url')
+if not url.endswith(b'/'):
+url += b'/'
+url += t
+
+return templateutil.hybriddict({
+b'url': url,
+b'id': t,
+})
+return None
diff --git a/tests/test-phabricator.t b/tests/test-phabricator.t
--- a/tests/test-phabricator.t
+++ b/tests/test-phabricator.t
@@ -106,13 +106,13 @@ behind to identify it.
 Template keywords
   $ hg log -T'{rev} {phabreview|json}\n'
   3 {"id": "D5545", "url": "https://phab.mercurial-scm.org/D5545"}
-  2 null
+  2 {"id": "D5544", "url": "https://phab.mercurial-scm.org/D5544"}
   1 {"id": "D4597", "url": "https://phab.mercurial-scm.org/D4597"}
   0 {"id": "D4596", "url": "https://phab.mercurial-scm.org/D4596"}
 
   $ hg log -T'{rev} {if(phabreview, "{phabreview.url} {phabreview.id}")}\n'
   3 https://phab.mercurial-scm.org/D5545 D5545
-  2 
+  2 https://phab.mercurial-scm.org/D5544 D5544
   1 https://phab.mercurial-scm.org/D4597 D4597
   0 https://phab.mercurial-scm.org/D4596 D4596
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5543: histedit: crashing with a more useful error message on empty defaultrev

2019-01-09 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio added a comment.


  (and btw I'd be happier with '' meaning the default, but the original author 
went through the trouble of checking both cases explicitly, so I kept that)

REPOSITORY
  rHG Mercurial

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

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


D5545: create draft change for phabricator testing

2019-01-09 Thread mharbison72 (Matt Harbison)
mharbison72 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/D5545

AFFECTED FILES
  alpha

CHANGE DETAILS

diff --git a/alpha b/alpha
--- a/alpha
+++ b/alpha
@@ -1,2 +1 @@
-alpha
-more
+draft change



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


D5544: create public change for phabricator testing

2019-01-09 Thread mharbison72 (Matt Harbison)
mharbison72 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/D5544

AFFECTED FILES
  beta

CHANGE DETAILS

diff --git a/beta b/beta
--- a/beta
+++ b/beta
@@ -1 +1 @@
-beta
+public change



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


D5543: histedit: crashing with a more useful error message on empty defaultrev

2019-01-09 Thread rdamazio (Rodrigo Damazio Bovendorp)
rdamazio created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this, `hg --config histedit.defaultrev= histedit` would crash with
  File "destutil.py", line 385, in desthistedit
  
if revs:
  
  UnboundLocalError: local variable 'revs' referenced before assignment

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/destutil.py
  tests/test-histedit-arguments.t

CHANGE DETAILS

diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -112,6 +112,13 @@
   > pick 08d98a8350f3 4 five
   > EOF
 
+Test invalid config default
+---
+
+  $ hg histedit --config "histedit.defaultrev="
+  abort: config option histedit.defaultrev can't be empty
+  [255]
+
 Run on a revision not descendants of the initial parent
 
 
diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -381,6 +381,8 @@
 revs = stack.getstack(repo)
 elif default:
 revs = scmutil.revrange(repo, [default])
+else:
+raise error.Abort('config option histedit.defaultrev can\'t be empty')
 
 if revs:
 # Take the first revision of the revset as the root



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


Re: Using mercurial on windows.

2019-01-09 Thread Matt Harbison
On Wed, 09 Jan 2019 16:16:02 -0500, Pulkit Goyal <7895pul...@gmail.com>  
wrote:



Hey everyone,

Hope you are doing good.

In past few weeks, I have been playing with mercurial on windows. During
that time, I realised why windows support is so hard and was quite proud
that hg support windows. Huge thanks to all the people who work on this.

Now, I know things work because there is a windows buildbot which we try  
to

keep green. I tested, most of the times it works fine. But I was bit
shocked to find there was no good documentation on how mercurial can be
used on windows, what's preferred way to use, and what works and what  
does

not, what config knobs should be set, how to get started.


I'm not sure what you mean by "how it can be used on windows".

I can't think of any specific config knobs that are needed for Windows  
that aren't needed for other platforms.  (Editors and tools excluded, of  
course.)  If I remember tomorrow, I'll look through our setup scripts to  
see what we tweaked.


The only surprises that I can think of is that before Windows 10, ANSI  
color isn't supported by cmd.exe.  The default color.mode config is set to  
win32 mode instead, which sets console attributes.  That means pager  
effectively swallows color.  And the default more.com pager is fairly  
annoying.  Also be aware that you can't tweak +x bits, and they can get  
lost during a rebase.  (I filed a bug on the latter.)  EOL issues can bite  
you if you aren't careful if you import/export patches.


After sometime of fighting with windows, here I am looking for  
suggestions

on how one can use mercurial on windows smoothly and what are the
recommended ways. Like shall I use MYSYS, did things will work in  
cmd.exe?


What fighting did you have to do?

It works fine in cmd.exe for a user, but I tend to use MSYS.  The '^' is  
treated as a line continuation character in cmd.exe, so it makes revsets  
goofy.  Also, it doesn't understand strong quotes, and will feed them to  
Mercurial.  That can throw off reasonable looking commands, but I can't  
think of an example ATM.  (Filesets/revsets perhaps?)


You need MSYS to run tests, but I think you can use cmd.exe too if you  
only want to build from source.  I recently made a pass over this page  
when I set up a new Win10 laptop:


https://www.mercurial-scm.org/wiki/BuildingOnWindows

I meant to find a page to describe how to setup MSYS for running tests,  
but everything looked pretty out of date, and I pretty much did the setup  
through the mingw-get GUI.  I've got a fresh Windows install in a VM, so  
maybe I'll get to figuring out what the exact packages are.  In the  
meantime, see this:



https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-June/099953.html


If anyone can shed some light on their experiences and tips and tricks on
how to use mercurial on windows, that will be great!


I have TortoiseHg installed, and evolve enabled without a path (it's  
bundled in the private python there).  That means you'll need to  
pip-install it when running hg from source.  TortoiseHg comes with a lot  
of default options, but it's only visible if *not* running from source.   
Work around that by adding a %include to the hg source repo's .hg/hgrc to  
pick up the thg MergeTools.rc, and possibly the other *.rc files as  
needed.  Merges may go poorly otherwise.


Be careful in MSYS, because `hg config -e` will open the config for the  
MSYS user, *not* mercurial.ini under %USERPROFILE%.   
%USERPROFILE%/mercurial.ini gets loaded after the MSYS user config, so you  
might be able to use that order to tweak what pager is used by MSYS.


The other potential option is to install WSL, and maybe use (Linux)  
Mercurial in there.  I've toyed with Ubuntu for running tests with  
(Windows) hg.exe.  It looks promising, but I'm concerned we'd just be  
trading a set of MSYS problems for a different set of WSL problems.


I promise to convert all the relevant information I get on this thread  
and

some which I accumulated while testing into a wiki page.

Thanks and regards
Pulkit

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


D5542: histedit: use context manager for locks

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

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -207,7 +207,6 @@
 exchange,
 extensions,
 hg,
-lock,
 logcmdutil,
 merge as mergemod,
 mergeutil,
@@ -225,7 +224,6 @@
 )
 
 pickle = util.pickle
-release = lock.release
 cmdtable = {}
 command = registrar.command(cmdtable)
 
@@ -1601,12 +1599,10 @@
 
 def _texthistedit(ui, repo, *freeargs, **opts):
 state = histeditstate(repo)
-try:
-state.wlock = repo.wlock()
-state.lock = repo.lock()
+with repo.wlock() as wlock, repo.lock() as lock:
+state.wlock = wlock
+state.lock = lock
 _histedit(ui, repo, state, *freeargs, **opts)
-finally:
-release(state.lock, state.wlock)
 
 goalcontinue = 'continue'
 goalabort = 'abort'



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


mercurial@41145: 7 new changesets

2019-01-09 Thread Mercurial Commits
7 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/2e60a77b7058
changeset:   41139:2e60a77b7058
user:Augie Fackler 
date:Tue Jan 08 10:31:10 2019 -0500
summary: xdiff: don't attempt to use fuzzer inputs larger than 100k

https://www.mercurial-scm.org/repo/hg/rev/92a5fb73b3d5
changeset:   41140:92a5fb73b3d5
user:Kyle Lippincott 
date:Tue Jan 08 14:48:05 2019 -0800
summary: remotefilelog: add newlines to ui.log() invocations

https://www.mercurial-scm.org/repo/hg/rev/89d103fc9c19
changeset:   41141:89d103fc9c19
user:Martin von Zweigbergk 
date:Tue Jan 08 22:07:47 2019 -0800
summary: testrunner: avoid capturing a regex group we don't care about

https://www.mercurial-scm.org/repo/hg/rev/8cf92ca92bfe
changeset:   41142:8cf92ca92bfe
user:Martin von Zweigbergk 
date:Mon Jan 07 23:55:26 2019 -0800
summary: progress: write ui.progress() in terms of ui.makeprogress()

https://www.mercurial-scm.org/repo/hg/rev/7b80406b8271
changeset:   41143:7b80406b8271
user:Martin von Zweigbergk 
date:Tue Jan 08 00:12:08 2019 -0800
summary: progress: move cached debug flag from progress.progbar to 
scmutil.progress

https://www.mercurial-scm.org/repo/hg/rev/3025fd3c2e71
changeset:   41144:3025fd3c2e71
user:Martin von Zweigbergk 
date:Tue Jan 08 00:17:41 2019 -0800
summary: progress: split up _print() method in bar-updating and 
debug-printing

https://www.mercurial-scm.org/repo/hg/rev/963462786f6e
changeset:   41145:963462786f6e
bookmark:@
tag: tip
user:Martin von Zweigbergk 
date:Tue Jan 08 00:30:30 2019 -0800
summary: progress: check what type of progress bar to use only once per 
topic

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


D5495: revset: add "branch" positional arguments to the merge revset

2019-01-09 Thread angel.ezquerra (Angel Ezquerra)
angel.ezquerra added a comment.


  In https://phab.mercurial-scm.org/D5495#81562, @yuja wrote:
  
  > > +@predicate('merge(*withbranch)', safe=True)
  > > 
  > >   def merge(repo, subset, x):
  > > 
  > > - """Changeset is a merge changeset. +"""Changeset is a merge 
changeset + +All merge revisions are returned by default. If one or more 
"withbranch" +names are provided only merges with those branches (i.e. 
whose +second parent belongs to one of those branches) will be returned.
  >
  > I understand this will be useful in a certain branch strategy, but the
  >  proposed syntax is hardly extensible. Maybe it can be a non-wildcard 
argument
  >  of `stringmatcher` type so we can at least add another option later.
  >
  > Any thoughts? Do anyone love this feature?
  >
  > If we had a syntax to filter revisions by sub expression, this and the
  >  samebranch option could be expressed as follows:
  >
  >   merge() & filter($a, p2($a) & branch("..."))
  >   merge() & filter($a, samebranch(parents($a)))
  >  
  >   where filter(argname, boolean-expr)
  >
  >
  > This is much more expressive (or verbose) and can support other types of
  >  branches, but is hard to implement.
  
  
  Thank you for the review, @yuja
  
  I think it would be a good idea to make the "branch" arguments more flexible. 
One option could be to use a stringmatcher to add support for regular 
expressions as you suggest. I can look into that. However there may be some 
other options worth exploring. The one you suggest is very interesting although 
I find the syntax a bit complicated for the common use cases that I want to 
enable which are:
  
  1. Ignore merges from the same branch, which in a named-branch based 
branching strategy are usually irrelevant
  2. Look into merges with a specific branch (e.g. which branches have been 
merged with the default branch)?
  
  In my experience those two are the ones that are the most common and I think 
we should try to make the easy to use. That is, I think that even if mercurial 
had a filter function like the one you propose I would still want to be able to 
express those 2 common merge properties in a simple way.
  
  That being said, I really like your idea since I often find myself being 
unable to express what I want with a revset (as powerful as those are) because 
of the lack of a filtering mechanism. Adding a generic filter function would be 
very useful indeed. I'm not sure if the syntax you propose would work as is 
though. It seems that it would need a new "&" operator? In any case I believe 
that it is out of the scope of this particular set of patches. Do you agree? If 
so I can focus on improving this patch by adding the stringmatcher as you 
suggest (as it seems I'm not the only one who thinks this would be useful). Is 
that ok?

REPOSITORY
  rHG Mercurial

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

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


D5519: simplestorerepo: minimal changes required to get this mostly working again

2019-01-09 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  In https://phab.mercurial-scm.org/D5519#81903, @durin42 wrote:
  
  > In https://phab.mercurial-scm.org/D5519#81899, @indygreg wrote:
  >
  > > The original purpose of the simple store repo was to flush out problems 
with storage abstraction by building an alternate storage backend. Now that we 
have storage interface unit tests and the SQLite storage backend, there is 
definitely less of a need for the simple store backend and we could probably 
consider deleting it.
  >
  >
  > I wonder if it's worth keeping the simpler simplestore code as an example. 
Probably not?
  
  
  With the SQLite store being a thing, probably not worth keeping even as an 
example. That being said, if it works and isn't hard to maintain, then why not 
keep it? The problem is it is difficult to maintain. You need to teach various 
tests about the existing of different backends because test output varies. 
Search for `simplestore` in the tests directory to see all the conditionals. 
Given the cost of maintaining support, I don't think it can justify its 
existence.
  
  That being said, I'll probably regret this decision someday. Meh.

REPOSITORY
  rHG Mercurial

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

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


D5524: cleanup: stop including thirdparty.cbor in builds

2019-01-09 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG98ce494e104d: cleanup: stop including thirdparty.cbor in 
builds (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5524?vs=13071=13117

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

AFFECTED FILES
  contrib/import-checker.py
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -846,8 +846,6 @@
 'mercurial.pure',
 'mercurial.thirdparty',
 'mercurial.thirdparty.attr',
-'mercurial.thirdparty.cbor',
-'mercurial.thirdparty.cbor.cbor2',
 'mercurial.thirdparty.zope',
 'mercurial.thirdparty.zope.interface',
 'mercurial.utils',
diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -40,8 +40,6 @@
 # third-party imports should be directly imported
 'mercurial.thirdparty',
 'mercurial.thirdparty.attr',
-'mercurial.thirdparty.cbor',
-'mercurial.thirdparty.cbor.cbor2',
 'mercurial.thirdparty.zope',
 'mercurial.thirdparty.zope.interface',
 )



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


D5523: tests: get access to thirdparty.cbor without requiring it to be installed

2019-01-09 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGa9905045b992: tests: get access to thirdparty.cbor without 
requiring it to be installed (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5523?vs=13070=13116

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

AFFECTED FILES
  tests/test-cbor.py

CHANGE DETAILS

diff --git a/tests/test-cbor.py b/tests/test-cbor.py
--- a/tests/test-cbor.py
+++ b/tests/test-cbor.py
@@ -1,10 +1,19 @@
 from __future__ import absolute_import
 
+import os
+import sys
 import unittest
 
-from mercurial.thirdparty import (
-cbor,
-)
+# TODO migrate to canned cbor test strings and stop using thirdparty.cbor
+tpp = os.path.normpath(os.path.join(os.path.dirname(__file__),
+'..', 'mercurial', 'thirdparty'))
+if not os.path.exists(tpp):
+# skip, not in a repo
+sys.exit(80)
+sys.path[0:0] = [tpp]
+import cbor
+del sys.path[0]
+
 from mercurial.utils import (
 cborutil,
 )



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


D5521: tests: add simplestorerepo to test-check-interfaces.py

2019-01-09 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG23d5e03dad70: tests: add simplestorerepo to 
test-check-interfaces.py (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5521?vs=13068=13115

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

AFFECTED FILES
  tests/test-check-interfaces.py

CHANGE DETAILS

diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py
--- a/tests/test-check-interfaces.py
+++ b/tests/test-check-interfaces.py
@@ -40,8 +40,12 @@
 wireprotov2server,
 )
 
-rootdir = pycompat.fsencode(
-os.path.normpath(os.path.join(os.path.dirname(__file__), '..')))
+testdir = os.path.dirname(__file__)
+rootdir = pycompat.fsencode(os.path.normpath(os.path.join(testdir, '..')))
+
+sys.path[0:0] = [testdir]
+import simplestorerepo
+del sys.path[0]
 
 def checkzobject(o, allowextra=False):
 """Verify an object with a zope interface."""
@@ -177,6 +181,12 @@
 ziverify.verifyClass(repository.imanifestlog, manifest.manifestlog)
 ziverify.verifyClass(repository.imanifeststorage, manifest.manifestrevlog)
 
+ziverify.verifyClass(repository.irevisiondelta,
+ simplestorerepo.simplestorerevisiondelta)
+ziverify.verifyClass(repository.ifilestorage, simplestorerepo.filestorage)
+ziverify.verifyClass(repository.iverifyproblem,
+ simplestorerepo.simplefilestoreproblem)
+
 vfs = vfsmod.vfs(b'.')
 fl = filelog.filelog(vfs, b'dummy.i')
 checkzobject(fl, allowextra=True)



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


D5520: simplestorerepo: migrate to in-hg CBOR code

2019-01-09 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGad51e6117095: simplestorerepo: migrate to in-hg CBOR code 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5520?vs=13067=13114

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

AFFECTED FILES
  tests/simplestorerepo.py

CHANGE DETAILS

diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -23,7 +23,6 @@
 )
 from mercurial.thirdparty import (
 attr,
-cbor,
 )
 from mercurial import (
 ancestor,
@@ -39,6 +38,7 @@
 verify,
 )
 from mercurial.utils import (
+cborutil,
 interfaceutil,
 storageutil,
 )
@@ -106,7 +106,7 @@
 
 indexdata = self._svfs.tryread(self._indexpath)
 if indexdata:
-indexdata = cbor.loads(indexdata)
+indexdata = cborutil.decodeall(indexdata)
 
 self._indexdata = indexdata or []
 self._indexbynode = {}
@@ -513,7 +513,8 @@
 
 def _reflectindexupdate(self):
 self._refreshindex()
-self._svfs.write(self._indexpath, cbor.dumps(self._indexdata))
+self._svfs.write(self._indexpath,
+ ''.join(cborutil.streamencode(self._indexdata)))
 
 def addgroup(self, deltas, linkmapper, transaction, addrevisioncb=None,
  maybemissingparents=False):



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


D5519: simplestorerepo: minimal changes required to get this mostly working again

2019-01-09 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc4639fdae1b9: simplestorerepo: minimal changes required to 
get this mostly working again (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5519?vs=13066=13113

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

AFFECTED FILES
  tests/simplestorerepo.py

CHANGE DETAILS

diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py
--- a/tests/simplestorerepo.py
+++ b/tests/simplestorerepo.py
@@ -66,17 +66,24 @@
 pass
 
 @interfaceutil.implementer(repository.irevisiondelta)
-@attr.s(slots=True, frozen=True)
+@attr.s(slots=True)
 class simplestorerevisiondelta(object):
 node = attr.ib()
 p1node = attr.ib()
 p2node = attr.ib()
 basenode = attr.ib()
-linknode = attr.ib()
 flags = attr.ib()
 baserevisionsize = attr.ib()
 revision = attr.ib()
 delta = attr.ib()
+linknode = attr.ib(default=None)
+
+@interfaceutil.implementer(repository.iverifyproblem)
+@attr.s(frozen=True)
+class simplefilestoreproblem(object):
+warning = attr.ib(default=None)
+error = attr.ib(default=None)
+node = attr.ib(default=None)
 
 @interfaceutil.implementer(repository.ifilestorage)
 class filestorage(object):
@@ -192,6 +199,13 @@
 
 return self._indexbyrev[rev][b'node']
 
+def hasnode(self, node):
+validatenode(node)
+return node in self._indexbynode
+
+def censorrevision(self, tr, censornode, tombstone=b''):
+raise NotImplementedError('TODO')
+
 def lookup(self, node):
 if isinstance(node, int):
 return self.node(node)
@@ -290,7 +304,11 @@
 raise simplestoreerror(_("integrity check failed on %s") %
 self._path)
 
-def revision(self, node, raw=False):
+def revision(self, nodeorrev, raw=False):
+if isinstance(nodeorrev, int):
+node = self.node(nodeorrev)
+else:
+node = nodeorrev
 validatenode(node)
 
 if node == nullid:
@@ -409,6 +427,44 @@
 
 return [b'/'.join((self._storepath, f)) for f in entries]
 
+def storageinfo(self, exclusivefiles=False, sharedfiles=False,
+revisionscount=False, trackedsize=False,
+storedsize=False):
+# TODO do a real implementation of this
+return {
+'exclusivefiles': [],
+'sharedfiles': [],
+'revisionscount': len(self),
+'trackedsize': 0,
+'storedsize': None,
+}
+
+def verifyintegrity(self, state):
+state['skipread'] = set()
+for rev in self:
+node = self.node(rev)
+try:
+self.revision(node)
+except Exception as e:
+yield simplefilestoreproblem(
+error='unpacking %s: %s' % (node, e),
+node=node)
+state['skipread'].add(node)
+
+def emitrevisions(self, nodes, nodesorder=None, revisiondata=False,
+  assumehaveparentrevisions=False,
+  deltamode=repository.CG_DELTAMODE_STD):
+# TODO this will probably break on some ordering options.
+nodes = [n for n in nodes if n != nullid]
+if not nodes:
+return
+for delta in storageutil.emitrevisions(
+self, nodes, nodesorder, simplestorerevisiondelta,
+revisiondata=revisiondata,
+assumehaveparentrevisions=assumehaveparentrevisions,
+deltamode=deltamode):
+yield delta
+
 def add(self, text, meta, transaction, linkrev, p1, p2):
 if meta or text.startswith(b'\1\n'):
 text = storageutil.packmeta(meta, text)
@@ -489,15 +545,26 @@
 
 if addrevisioncb:
 addrevisioncb(self, node)
+return nodes
 
-return nodes
+def _headrevs(self):
+# Assume all revisions are heads by default.
+revishead = {rev: True for rev in self._indexbyrev}
+
+for rev, entry in self._indexbyrev.items():
+# Unset head flag for all seen parents.
+revishead[self.rev(entry[b'p1'])] = False
+revishead[self.rev(entry[b'p2'])] = False
+
+return [rev for rev, ishead in sorted(revishead.items())
+if ishead]
 
 def heads(self, start=None, stop=None):
 # This is copied from revlog.py.
 if start is None and stop is None:
 if not len(self):
 return [nullid]
-return [self.node(r) for r in self.headrevs()]
+return [self.node(r) for r in self._headrevs()]
 
 if start is None:
 start = nullid
@@ -537,41 +604,9 @@
 return c
 
 def getstrippoint(self, minlink):
-
-# This is largely a copy of revlog.getstrippoint().
-brokenrevs = set()
-

D5519: simplestorerepo: minimal changes required to get this mostly working again

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D5519#81899, @indygreg wrote:
  
  > The original purpose of the simple store repo was to flush out problems 
with storage abstraction by building an alternate storage backend. Now that we 
have storage interface unit tests and the SQLite storage backend, there is 
definitely less of a need for the simple store backend and we could probably 
consider deleting it.
  
  
  I wonder if it's worth keeping the simpler simplestore code as an example. 
Probably not?

REPOSITORY
  rHG Mercurial

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

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


D5540: histedit: fix --continue and --abort when curses is enabled

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> histedit.py:1605-1606
> +# operations.
> +if ui.interface('histedit') == 'curses' and not (
> +opts.get( b'continue', False) or opts.get( b'abort', False)):
>  return _chistedit(ui, repo, *freeargs, **opts)

Maybe use `... and _getgoal(opts) == goalnew` instead? In addition to being 
simpler, that seems like it would also correctly handle the `--edit-plan` 
option (which I didn't even know existed until just now).

REPOSITORY
  rHG Mercurial

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

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


D5523: tests: get access to thirdparty.cbor without requiring it to be installed

2019-01-09 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  I agree that we should nuke the vendored CBOR package altogether.

REPOSITORY
  rHG Mercurial

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

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


D5540: histedit: fix --continue and --abort when curses is enabled

2019-01-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I overlooked this when I did the initial import.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-non-commute.t

CHANGE DETAILS

diff --git a/tests/test-histedit-non-commute.t 
b/tests/test-histedit-non-commute.t
--- a/tests/test-histedit-non-commute.t
+++ b/tests/test-histedit-non-commute.t
@@ -161,7 +161,10 @@
   warning: conflicts while merging e! (edit, then use 'hg resolve --mark')
   Fix up the change (pick 7b4e2f4b7bcd)
   (hg histedit --continue to resume)
-  $ hg histedit --continue 2>&1 | fixbundle
+We forcibly enable curses here so we can verify that continuing works
+with curses enabled.
+  $ hg histedit --continue --config ui.interactive=true \
+  >   --config ui.interface=curses 2>&1 | fixbundle
   abort: unresolved merge conflicts (see 'hg help resolve')
 
 This failure is caused by 7b4e2f4b7bcd "e" not rebasing the non commutative
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -1599,7 +1599,11 @@
 for intentional "edit" command, but also for resolving unexpected
 conflicts).
 """
-if ui.interface('histedit') == 'curses':
+# kludge: _chistedit only works for starting an edit, not aborting
+# or continuing, so fall back to regular _texthistedit for those
+# operations.
+if ui.interface('histedit') == 'curses' and not (
+opts.get( b'continue', False) or opts.get( b'abort', False)):
 return _chistedit(ui, repo, *freeargs, **opts)
 return _texthistedit(ui, repo, *freeargs, **opts)
 



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


Re: Using mercurial on windows.

2019-01-09 Thread Ludovic Chabant
> After sometime of fighting with windows, here I am looking for suggestions on 
> how one can use mercurial on windows smoothly and what are the recommended 
> ways. Like shall I use MYSYS, did things will work in cmd.exe?
> 
> If anyone can shed some light on their experiences and tips and tricks on how 
> to use mercurial on windows, that will be great!


Do you mean "using Mercurial on Windows" as a user, or did you really mean 
"working with the Mercurial code on Windows"?

As a plain user, Mercurial is a breeze to use cross-platform, there's not much 
to do. I personally use it in a normal cmd.exe shell (albeit inside a ConsoleZ 
UI so I get resizable/tabbed terminals). Nothing fancy.

Checking my dotfiles (https://bitbucket.org/ludovicchabant/dotfiles), the only 
tricks I have are:

1. Include an OS-specific config file from your .hgrc with:

%include hgrc-${OS}

(where $OS is a valid environment variable... I don't remember if I set it 
myself or if it's set by default by most OSes, but for me on Windows 10 this 
means it includes a config file named "hgrc-Windows_NT" in the same directory 
as the main hgrc file)

2. In that OS-specific file, set the ui.ssh config to "plink.exe -ssh -2 -batch 
-C" to make SSH pull/push work.

3. Set Windows-specific editor/extdiff/merge-tools configs if necessary.

That's it.

--
l u d o .
. 8 0 17 80
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Using mercurial on windows.

2019-01-09 Thread Pulkit Goyal
Hey everyone,

Hope you are doing good.

In past few weeks, I have been playing with mercurial on windows. During
that time, I realised why windows support is so hard and was quite proud
that hg support windows. Huge thanks to all the people who work on this.

Now, I know things work because there is a windows buildbot which we try to
keep green. I tested, most of the times it works fine. But I was bit
shocked to find there was no good documentation on how mercurial can be
used on windows, what's preferred way to use, and what works and what does
not, what config knobs should be set, how to get started.

After sometime of fighting with windows, here I am looking for suggestions
on how one can use mercurial on windows smoothly and what are the
recommended ways. Like shall I use MYSYS, did things will work in cmd.exe?

If anyone can shed some light on their experiences and tips and tricks on
how to use mercurial on windows, that will be great!

I promise to convert all the relevant information I get on this thread and
some which I accumulated while testing into a wiki page.

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


D5514: test: change test's diff generation to use mdiff for nicer output

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D5514#81800, @sangeet259 wrote:
  
  > @durin42 So the `try/except` will fall back to `unified diff`?
  
  
  Correct.
  
  > Is there a way we can enforce this on system's that don't have mercurial 
installed globally and not have to fall back on the earlier practice.
  
  I think we don't have any choice: if hg isn't installed, we have to fall back 
to the old codepath, since we won't know if mdiff is present.
  
  > Also, I didn't get your comment on checking the API of `mdiff` :/
  
  Well, what if we iterate on the API of mdiff.new_diff? then again, if the 
point of it is to have the same API as difflib.unified_diff, probably don't 
need to worry (and so we only have to fall back to difflib if mdiff isn't 
available or is too old).

REPOSITORY
  rHG Mercurial

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

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


D5372: perfrevlogwrite: use progress helper on modern hg

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf36fd52dae8f: perfrevlogwrite: use progress helper on 
modern hg (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5372?vs=13109=13111

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1838,17 +1838,30 @@
 topic = 'adding'
 if runidx is not None:
 topic += ' (run #%d)' % runidx
+ # Support both old and new progress API
+if util.safehasattr(ui, 'makeprogress'):
+progress = ui.makeprogress(topic, unit='revs', total=total)
+def updateprogress(pos):
+progress.update(pos)
+def completeprogress():
+progress.complete()
+else:
+def updateprogress(pos):
+ui.progress(topic, pos, unit='revs', total=total)
+def completeprogress():
+ui.progress(topic, None, unit='revs', total=total)
+
 for idx, rev in enumerate(revs):
-ui.progress(topic, idx, unit='revs', total=total)
+updateprogress(idx)
 addargs, addkwargs = _getrevisionseed(orig, rev, tr, source)
 if clearcaches:
 dest.index.clearcaches()
 dest.clearcaches()
 with timeone() as r:
 dest.addrawrevision(*addargs, **addkwargs)
 timings.append((rev, r[0]))
-ui.progress(topic, total, unit='revs', total=total)
-ui.progress(topic, None, unit='revs', total=total)
+updateprogress(total)
+completeprogress()
 return timings
 
 def _getrevisionseed(orig, rev, tr, source):



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


D5539: style: run yapf on a subset of mercurial

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I see a few minor issues here, but it's at least plausible?

INLINE COMMENTS

> minifileset.py:57-58
>  symbols = {
> -'all': lambda n, s: True,
> -'none': lambda n, s: False,
> -'size': lambda n, s: _sizep(tree[2])(s),
> +'all': lambda n,
> +s: True,
> +'none': lambda n,

yapf bug here, filed as https://github.com/google/yapf/issues/662

> scmwindows.py:53
>  home = os.path.expanduser('~')
> -path = [os.path.join(home, 'mercurial.ini'),
> -os.path.join(home, '.hgrc')]
> +path = [os.path.join(home, 'mercurial.ini'), os.path.join(home, '.hgrc')]
>  userprofile = encoding.environ.get('USERPROFILE')

We could force this to one-per-line by adding a trailing comma.

REPOSITORY
  rHG Mercurial

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

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


Auto-formatting with yapf (was: Re: Auto-formatting code with black - object now if you have a strong opinion)

2019-01-09 Thread Augie Fackler


> On Dec 6, 2018, at 23:21, Matt Harbison  wrote:
> 
> On Wed, 05 Dec 2018 08:23:17 -0500, Yuya Nishihara  wrote:
> 
>> On Tue, 4 Dec 2018 10:06:24 -0500, Augie Fackler wrote:
>>> 
>>> So, options to move forward:
>>> 1) blacken everything (controversial for good reasons)
>>> 2) try black only on a subset
>>> 3) explore yapf
>>> 4) Give up and keep manually formatting files (I'd rather not do this, but 
>>> I understand if it's where we end up)
>> 
>> My vote: 3 > 4 > 2 > 1
>> 
>> I'm not super enthusiastic about 100%-machine-forced formatting. I like
>> consistency level provided by e.g. astyle command. clang-format is pretty
>> good IMHO, but the black seems to sacrifice the code readability.
> 
> +1.
> 
> That said, I got used to longnamesthataresmooshedtogether, so I can probably 
> adjust to anything after awhile.

I think I'd still prefer black overall (yapf is less opinionated and requires 
me to think more), but here's a yapf RFC: https://phab.mercurial-scm.org/D5539

This would at least help _most_ cases of line-too-long, which I think would be 
good. What do people think?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5064: style: run black on a subset of mercurial

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Per mailing list thread, I've sent out https://phab.mercurial-scm.org/D5539 
to show what yapf would want to do.

REPOSITORY
  rHG Mercurial

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

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


D5539: style: run yapf on a subset of mercurial

2019-01-09 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I've tried to pick knobs that more or less conform to our current
  style. I ran the formatter on the same set of files as the black
  proposal (see https://phab.mercurial-scm.org/D5064), but it resulted in many 
fewer edits.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  .style.yapf
  mercurial/dirstateguard.py
  mercurial/httpconnection.py
  mercurial/lsprofcalltree.py
  mercurial/mergeutil.py
  mercurial/minifileset.py
  mercurial/node.py
  mercurial/policy.py
  mercurial/pushkey.py
  mercurial/rcutil.py
  mercurial/scmposix.py
  mercurial/scmwindows.py
  mercurial/state.py
  tests/test-check-code.t

CHANGE DETAILS

diff --git a/tests/test-check-code.t b/tests/test-check-code.t
--- a/tests/test-check-code.t
+++ b/tests/test-check-code.t
@@ -42,6 +42,7 @@
   .hgsigs
   .hgtags
   .jshintrc
+  .style.yapf
   CONTRIBUTING
   CONTRIBUTORS
   COPYING
diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -4,7 +4,6 @@
 #
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
-
 """
 This file contains class to wrap the state for commands and other
 related logic.
diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py
--- a/mercurial/scmwindows.py
+++ b/mercurial/scmwindows.py
@@ -32,7 +32,8 @@
 if f.endswith('.rc'):
 rcpath.append(os.path.join(progrcd, f))
 # else look for a system rcpath in the registry
-value = util.lookupreg('SOFTWARE\\Mercurial', None,
+value = util.lookupreg('SOFTWARE\\Mercurial',
+   None,
winreg.HKEY_LOCAL_MACHINE)
 if not isinstance(value, str) or not value:
 return rcpath
@@ -49,8 +50,7 @@
 def userrcpath():
 '''return os-specific hgrc search path to the user dir'''
 home = os.path.expanduser('~')
-path = [os.path.join(home, 'mercurial.ini'),
-os.path.join(home, '.hgrc')]
+path = [os.path.join(home, 'mercurial.ini'), os.path.join(home, '.hgrc')]
 userprofile = encoding.environ.get('USERPROFILE')
 if userprofile and userprofile != home:
 path.append(os.path.join(userprofile, 'mercurial.ini'))
diff --git a/mercurial/scmposix.py b/mercurial/scmposix.py
--- a/mercurial/scmposix.py
+++ b/mercurial/scmposix.py
@@ -22,9 +22,11 @@
 rcs = [os.path.join(path, 'hgrc')]
 rcdir = os.path.join(path, 'hgrc.d')
 try:
-rcs.extend([os.path.join(rcdir, f)
-for f, kind in util.listdir(rcdir)
-if f.endswith(".rc")])
+rcs.extend([
+os.path.join(rcdir,
+ f) for f,
+kind in util.listdir(rcdir) if f.endswith(".rc")
+])
 except OSError:
 pass
 return rcs
@@ -53,13 +55,17 @@
 if confighome is None or not os.path.isabs(confighome):
 confighome = os.path.expanduser('~/.config')
 
-return [os.path.expanduser('~/.hgrc'),
-os.path.join(confighome, 'hg', 'hgrc')]
+return [
+os.path.expanduser('~/.hgrc'),
+os.path.join(confighome,
+ 'hg',
+ 'hgrc')
+]
 
 def termsize(ui):
 try:
 import termios
-TIOCGWINSZ = termios.TIOCGWINSZ  # unavailable on IRIX (issue3449)
+TIOCGWINSZ = termios.TIOCGWINSZ # unavailable on IRIX (issue3449)
 except (AttributeError, ImportError):
 return 80, 24
 
diff --git a/mercurial/rcutil.py b/mercurial/rcutil.py
--- a/mercurial/rcutil.py
+++ b/mercurial/rcutil.py
@@ -43,9 +43,15 @@
 if env is None:
 env = encoding.environ
 checklist = [
-('EDITOR', 'ui', 'editor'),
-('VISUAL', 'ui', 'editor'),
-('PAGER', 'pager', 'pager'),
+('EDITOR',
+ 'ui',
+ 'editor'),
+('VISUAL',
+ 'ui',
+ 'editor'),
+('PAGER',
+ 'pager',
+ 'pager'),
 ]
 result = []
 for envname, section, configname in checklist:
diff --git a/mercurial/pushkey.py b/mercurial/pushkey.py
--- a/mercurial/pushkey.py
+++ b/mercurial/pushkey.py
@@ -22,11 +22,16 @@
 n.pop('obsolete')
 return n
 
-_namespaces = {"namespaces": (lambda *x: False, _nslist),
-   "bookmarks": (bookmarks.pushbookmark, bookmarks.listbookmarks),
-   "phases": (phases.pushphase, phases.listphases),
-   "obsolete": (obsolete.pushmarker, obsolete.listmarkers),
-  }
+_namespaces = {
+"namespaces": (lambda *x: False,
+   _nslist),
+"bookmarks": (bookmarks.pushbookmark,
+  bookmarks.listbookmarks),
+"phases": (phases.pushphase,
+   phases.listphases),
+"obsolete": 

D5516: fix: add some arguments to facilitate extensions

2019-01-09 Thread hooper (Danny Hooper)
hooper added a comment.


  In https://phab.mercurial-scm.org/D5516#81841, @durin42 wrote:
  
  > In https://phab.mercurial-scm.org/D5516#81683, @hooper wrote:
  >
  > > In https://phab.mercurial-scm.org/D5516#81679, @durin42 wrote:
  > >
  > > > I'm -0 on this: what's special about this functionality that it needs 
to be an extension of an extension instead of something that can be done in 
core?
  > >
  > >
  > > Google's internal use of this extension makes some customizations that I 
doubt would be appealing in core. This patch makes some of it simpler to 
implement. Making all of it possible through configs/templates might be unduly 
complex.
  >
  >
  > What kinds of customizations?
  
  
  One is to aggregate metadata output from multiple fixer tool executions to 
display a summary at the end (so wrapping cleanup() is sensible). Not sure who 
else would use that, or if there's a good way to make a generic interface for 
it.
  
  Another is basically to add a "--nodeid_for_this_file=deadbeef" to a fixer 
tool command line. That's where it would be sufficient to have the ctx 
available. It might be nice to put the ctx into the templater, but that raises 
some questions about implementation that I wanted to punt for now.
  
  >> A better version of this might put "ctx" into the templater inside 
Fixer.command, and maybe add a no-op Fixer.cleanup method to make that part 
more explicit. I think that would be a less trivial super set of this patch.

REPOSITORY
  rHG Mercurial

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

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


D5372: perfrevlogwrite: use progress helper on modern hg

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 13109.
martinvonz retitled this revision from "perfrevlogwrite: use progress helper" 
to "perfrevlogwrite: use progress helper on modern hg".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5372?vs=12711=13109

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -1838,17 +1838,30 @@
 topic = 'adding'
 if runidx is not None:
 topic += ' (run #%d)' % runidx
+ # Support both old and new progress API
+if util.safehasattr(ui, 'makeprogress'):
+progress = ui.makeprogress(topic, unit='revs', total=total)
+def updateprogress(pos):
+progress.update(pos)
+def completeprogress():
+progress.complete()
+else:
+def updateprogress(pos):
+ui.progress(topic, pos, unit='revs', total=total)
+def completeprogress():
+ui.progress(topic, None, unit='revs', total=total)
+
 for idx, rev in enumerate(revs):
-ui.progress(topic, idx, unit='revs', total=total)
+updateprogress(idx)
 addargs, addkwargs = _getrevisionseed(orig, rev, tr, source)
 if clearcaches:
 dest.index.clearcaches()
 dest.clearcaches()
 with timeone() as r:
 dest.addrawrevision(*addargs, **addkwargs)
 timings.append((rev, r[0]))
-ui.progress(topic, total, unit='revs', total=total)
-ui.progress(topic, None, unit='revs', total=total)
+updateprogress(total)
+completeprogress()
 return timings
 
 def _getrevisionseed(orig, rev, tr, source):



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


D5372: perfrevlogwrite: use progress helper on modern hg

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D5372#81858, @durin42 wrote:
  
  > per yuya, this has to support old hgs
  
  
  Thanks for the reminder. I was thinking of just leaving this on the old API, 
but now that I'm deprecating `ui.progress()`, this needs to be migrated. Done.

REPOSITORY
  rHG Mercurial

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

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


D5534: merge: make local file storage in the .hg/merge directory extensible

2019-01-09 Thread dploch (Daniel Ploch)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8c222bec97da: merge: make local file storage in the 
.hg/merge directory extensible (authored by dploch, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5534?vs=13086=13108

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -478,6 +478,13 @@
 f.write(_pack(format, key, len(data), data))
 f.close()
 
+@staticmethod
+def getlocalkey(path):
+"""hash the path of a local file context for storage in the .hg/merge
+directory."""
+
+return hex(hashlib.sha1(path).digest())
+
 def add(self, fcl, fco, fca, fd):
 """add a new (potentially?) conflicting file the merge state
 fcl: file context for local,
@@ -488,11 +495,11 @@
 note: also write the local version to the `.hg/merge` directory.
 """
 if fcl.isabsent():
-hash = nullhex
+localkey = nullhex
 else:
-hash = hex(hashlib.sha1(fcl.path()).digest())
-self._repo.vfs.write('merge/' + hash, fcl.data())
-self._state[fd] = [MERGE_RECORD_UNRESOLVED, hash, fcl.path(),
+localkey = mergestate.getlocalkey(fcl.path())
+self._repo.vfs.write('merge/' + localkey, fcl.data())
+self._state[fd] = [MERGE_RECORD_UNRESOLVED, localkey, fcl.path(),
fca.path(), hex(fca.filenode()),
fco.path(), hex(fco.filenode()),
fcl.flags()]
@@ -551,15 +558,15 @@
MERGE_RECORD_DRIVER_RESOLVED):
 return True, 0
 stateentry = self._state[dfile]
-state, hash, lfile, afile, anode, ofile, onode, flags = stateentry
+state, localkey, lfile, afile, anode, ofile, onode, flags = stateentry
 octx = self._repo[self._other]
 extras = self.extras(dfile)
 anccommitnode = extras.get('ancestorlinknode')
 if anccommitnode:
 actx = self._repo[anccommitnode]
 else:
 actx = None
-fcd = self._filectxorabsent(hash, wctx, dfile)
+fcd = self._filectxorabsent(localkey, wctx, dfile)
 fco = self._filectxorabsent(onode, octx, ofile)
 # TODO: move this to filectxorabsent
 fca = self._repo.filectx(afile, fileid=anode, changectx=actx)
@@ -577,8 +584,8 @@
 flags = flo
 if preresolve:
 # restore local
-if hash != nullhex:
-f = self._repo.vfs('merge/' + hash)
+if localkey != nullhex:
+f = self._repo.vfs('merge/' + localkey)
 wctx[dfile].write(f.read(), flags)
 f.close()
 else:



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


D5532: context: schedule file prefetch before comparing for cleanliness

2019-01-09 Thread spectral (Kyle Lippincott)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf18f665b1424: context: schedule file prefetch before 
comparing for cleanliness (authored by spectral, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5532?vs=13084=13107

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -2018,6 +2018,12 @@
 to resolve a conflict.
 """
 keys = []
+# This won't be perfect, but can help performance significantly when
+# using things like remotefilelog.
+scmutil.prefetchfiles(
+self.repo(), [self.p1().rev()],
+matchmod.match('', '', patterns=self._cache.keys(), exact=True))
+
 for path in self._cache.keys():
 cache = self._cache[path]
 try:



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


D5413: manifest: convert a recursive function to iterative one using stacks

2019-01-09 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2c3f69855ce8: manifest: convert a recursive function to 
iterative one using stacks (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5413?vs=12826=13106

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

AFFECTED FILES
  mercurial/manifest.py

CHANGE DETAILS

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1135,20 +1135,23 @@
 return m1.diff(m2, clean=clean)
 result = {}
 emptytree = treemanifest()
-def _diff(t1, t2):
+
+def _iterativediff(t1, t2, stack):
+"""compares two tree manifests and append new tree-manifests which
+needs to be compared to stack"""
 if t1._node == t2._node and not t1._dirty and not t2._dirty:
 return
 t1._load()
 t2._load()
 self._loaddifflazy(t1, t2)
 
 for d, m1 in t1._dirs.iteritems():
 m2 = t2._dirs.get(d, emptytree)
-_diff(m1, m2)
+stack.append((m1, m2))
 
 for d, m2 in t2._dirs.iteritems():
 if d not in t1._dirs:
-_diff(emptytree, m2)
+stack.append((emptytree, m2))
 
 for fn, n1 in t1._files.iteritems():
 fl1 = t1._flags.get(fn, '')
@@ -1164,7 +1167,12 @@
 fl2 = t2._flags.get(fn, '')
 result[t2._subpath(fn)] = ((None, ''), (n2, fl2))
 
-_diff(self, m2)
+stackls = []
+_iterativediff(self, m2, stackls)
+while stackls:
+t1, t2 = stackls.pop()
+# stackls is populated in the function call
+_iterativediff(t1, t2, stackls)
 return result
 
 def unmodifiedsince(self, m2):



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


D5474: obsutil: fix the issue5686

2019-01-09 Thread khanchi97 (Sushil khanchi)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG191fac9ff9d3: obsutil: fix the issue5686 (authored by 
khanchi97, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5474?vs=12962=13105

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

AFFECTED FILES
  mercurial/obsutil.py
  tests/test-obsmarker-template.t
  tests/test-obsolete.t

CHANGE DETAILS

diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -935,38 +935,38 @@
   $ rm access.log errors.log
 #endif
 
-Several troubles on the same changeset (create an unstable and bumped 
changeset)
+Several troubles on the same changeset (create an unstable and bumped and 
content-divergent changeset)
 
   $ hg debugobsolete `getid obsolete_e`
   obsoleted 1 changesets
   2 new orphan changesets
   $ hg debugobsolete `getid original_c` `getid babar`
   1 new phase-divergent changesets
-  $ hg log --config ui.logtemplate= -r 'phasedivergent() and orphan()'
+  2 new content-divergent changesets
+  $ hg log --config ui.logtemplate= -r 'phasedivergent() and orphan() and 
contentdivergent()'
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  instability: orphan, phase-divergent
+  instability: orphan, phase-divergent, content-divergent
   summary: add babar
   
-
 test the "obsolete" templatekw
 
   $ hg log -r 'obsolete()'
   6:3de5eca88c00 (draft *obsolete*) [ ] add obsolete_e [pruned]
 
 test the "troubles" templatekw
 
   $ hg log -r 'phasedivergent() and orphan()'
-  7:50c51b361e60 (draft orphan phase-divergent) [ ] add babar
+  7:50c51b361e60 (draft orphan phase-divergent content-divergent) [ ] add babar
 
 test the default cmdline template
 
   $ hg log -T default -r 'phasedivergent()'
   changeset:   7:50c51b361e60
   user:test
   date:Thu Jan 01 00:00:00 1970 +
-  instability: orphan, phase-divergent
+  instability: orphan, phase-divergent, content-divergent
   summary: add babar
   
   $ hg log -T default -r 'obsolete()'
@@ -981,18 +981,18 @@
 test the obsolete labels
 
   $ hg log --config ui.logtemplate= --color=debug -r 'phasedivergent()'
-  [log.changeset changeset.draft changeset.unstable instability.orphan 
instability.phase-divergent|changeset:   7:50c51b361e60]
+  [log.changeset changeset.draft changeset.unstable instability.orphan 
instability.phase-divergent instability.content-divergent|changeset:   
7:50c51b361e60]
   [log.user|user:test]
   [log.date|date:Thu Jan 01 00:00:00 1970 +]
-  [log.instability|instability: orphan, phase-divergent]
+  [log.instability|instability: orphan, phase-divergent, content-divergent]
   [log.summary|summary: add babar]
   
 
   $ hg log -T default -r 'phasedivergent()' --color=debug
-  [log.changeset changeset.draft changeset.unstable instability.orphan 
instability.phase-divergent|changeset:   7:50c51b361e60]
+  [log.changeset changeset.draft changeset.unstable instability.orphan 
instability.phase-divergent instability.content-divergent|changeset:   
7:50c51b361e60]
   [log.user|user:test]
   [log.date|date:Thu Jan 01 00:00:00 1970 +]
-  [log.instability|instability: orphan, phase-divergent]
+  [log.instability|instability: orphan, phase-divergent, content-divergent]
   [log.summary|summary: add babar]
   
 
@@ -1019,13 +1019,14 @@
   $ hg up -r 'phasedivergent() and orphan()'
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg summary
-  parent: 7:50c51b361e60  (orphan, phase-divergent)
+  parent: 7:50c51b361e60  (orphan, phase-divergent, content-divergent)
add babar
   branch: default
   commit: (clean)
   update: 2 new changesets (update)
   phases: 4 draft
   orphan: 2 changesets
+  content-divergent: 2 changesets
   phase-divergent: 1 changesets
   $ hg up -r 'obsolete()'
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -1037,22 +1038,26 @@
   update: 3 new changesets (update)
   phases: 4 draft
   orphan: 2 changesets
+  content-divergent: 2 changesets
   phase-divergent: 1 changesets
 
 test debugwhyunstable output
 
   $ hg debugwhyunstable 50c51b361e60
   orphan: obsolete parent 3de5eca88c00aa039da7399a220f4a5221faa585
   phase-divergent: immutable predecessor 
245bde4270cd1072a27757984f9cda8ba26f08ca
+  content-divergent: 6f96419950729f3671185b847352890f074f7557 (draft) 
predecessor 245bde4270cd1072a27757984f9cda8ba26f08ca
 
 test whyunstable template keyword
 
   $ hg log -r 50c51b361e60 -T '{whyunstable}\n'
   orphan: obsolete parent 3de5eca88c00
   phase-divergent: immutable predecessor 245bde4270cd
+  content-divergent: 3:6f9641995072 (draft) predecessor 245bde4270cd
   $ hg log -r 50c51b361e60 -T '{whyunstable % "{instability}: {reason} 
{node|shortest}\n"}'
   orphan: obsolete parent 3de5
   phase-divergent: immutable predecessor 245b
+  

D5413: manifest: convert a recursive function to iterative one using stacks

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added inline comments.

INLINE COMMENTS

> manifest.py:1139
> +
> +def _iterativediff(t1, t2, stack):
> +"""compares two tree manifests and append new tree-manifests 
> which

room for a follow-up: I'm not sure this needs to be a nested function anymore 
(it could be a separate method on self)

REPOSITORY
  rHG Mercurial

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

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


D5372: perfrevlogwrite: use progress helper

2019-01-09 Thread durin42 (Augie Fackler)
durin42 requested changes to this revision.
durin42 added a comment.
This revision now requires changes to proceed.


  per yuya, this has to support old hgs

REPOSITORY
  rHG Mercurial

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

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


D5494: histedit: add user input to warning message on editing tagged commits

2019-01-09 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Sorry for bumping on this now, can you add tests for this as follow-up?

REPOSITORY
  rHG Mercurial

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

To: navaneeth.suresh, durin42, #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


D5494: histedit: add user input to warning message on editing tagged commits

2019-01-09 Thread navaneeth.suresh (Navaneeth Suresh)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7b7e081f8954: histedit: add user input to warning message 
on editing tagged commits (authored by navaneeth.suresh, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5494?vs=13016=13104#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5494?vs=13016=13104

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

AFFECTED FILES
  hgext/histedit.py

CHANGE DETAILS

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -194,7 +194,6 @@
 import functools
 import os
 import struct
-import time
 
 from mercurial.i18n import _
 from mercurial import (
@@ -1702,9 +1701,10 @@
 if not hastags:
 hastags = len(tags)
 if hastags:
-ui.warn(_('warning: tags associated with the given changeset '
-'will be lost after histedit \n'))
-time.sleep(1)
+if ui.promptchoice(_('warning: tags associated with the given'
+' changeset will be lost after histedit. \n'
+'do you want to continue (yN)? $$  $$ '), default=1):
+raise error.Abort(_('histedit cancelled\n'))
 # rebuild state
 if goal == goalcontinue:
 state.read()



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


D5481: sparse: fix debugrebuilddirsate when narrow extension is enabled

2019-01-09 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb05eb98a6b67: sparse: fix debugrebuilddirsate when narrow 
extension is enabled (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5481?vs=12975=13103

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

AFFECTED FILES
  hgext/sparse.py
  tests/test-narrow-sparse.t

CHANGE DETAILS

diff --git a/tests/test-narrow-sparse.t b/tests/test-narrow-sparse.t
--- a/tests/test-narrow-sparse.t
+++ b/tests/test-narrow-sparse.t
@@ -67,43 +67,3 @@
   treemanifest (tree !)
 
   $ hg debugrebuilddirstate
-  ** unknown exception encountered, please report by visiting
-  ** https://mercurial-scm.org/wiki/BugTracker
-  ** Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
-  ** Mercurial Distributed SCM (version 4.8.1+588-479a5ea51ccc+20181224)
-  ** Extensions loaded: narrow, sparse
-  Traceback (most recent call last):
-File "/place/vartmp/hgtests.zMelCK/install/bin/hg", line 43, in 
-  dispatch.run()
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
99, in run
-  status = dispatch(req)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
225, in dispatch
-  ret = _runcatch(req) or 0
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
376, in _runcatch
-  return _callcatch(ui, _runcatchfunc)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
384, in _callcatch
-  return scmutil.callcatch(ui, func)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/scmutil.py", line 
166, in callcatch
-  return func()
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
367, in _runcatchfunc
-  return _dispatch(req)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
1021, in _dispatch
-  cmdpats, cmdoptions)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
756, in runcommand
-  ret = _runcommand(ui, options, cmd, d)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
1030, in _runcommand
-  return cmdfunc()
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
1018, in 
-  d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
-File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/util.py", 
line 1670, in check
-  return func(*args, **kwargs)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/debugcommands.py", 
line 1998, in debugrebuilddirstate
-  dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/hgext/narrow/narrowdirstate.py",
 line 60, in rebuild
-  super(narrowdirstate, self).rebuild(parent, allfiles, changedfiles)
-File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/extensions.py", line 
437, in closure
-  return func(*(args + a), **kw)
-File "/place/vartmp/hgtests.zMelCK/install/lib/python/hgext/sparse.py", 
line 213, in _rebuild
-  allfiles = allfiles.matches(matcher)
-  AttributeError: 'list' object has no attribute 'matches'
-  [1]
diff --git a/hgext/sparse.py b/hgext/sparse.py
--- a/hgext/sparse.py
+++ b/hgext/sparse.py
@@ -210,7 +210,7 @@
 def _rebuild(orig, self, parent, allfiles, changedfiles=None):
 matcher = self._sparsematcher
 if not matcher.always():
-allfiles = allfiles.matches(matcher)
+allfiles = [f for f in allfiles if matcher(f)]
 if changedfiles:
 changedfiles = [f for f in changedfiles if matcher(f)]
 



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


D5480: tests: show that debugrebuilddirstate is broken with narrow+sparse

2019-01-09 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG76dcf7958c5f: tests: show that debugrebuilddirstate is 
broken with narrow+sparse (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5480?vs=12974=13102

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

AFFECTED FILES
  tests/test-narrow-sparse.t

CHANGE DETAILS

diff --git a/tests/test-narrow-sparse.t b/tests/test-narrow-sparse.t
--- a/tests/test-narrow-sparse.t
+++ b/tests/test-narrow-sparse.t
@@ -65,3 +65,45 @@
   sparserevlog
   store
   treemanifest (tree !)
+
+  $ hg debugrebuilddirstate
+  ** unknown exception encountered, please report by visiting
+  ** https://mercurial-scm.org/wiki/BugTracker
+  ** Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609]
+  ** Mercurial Distributed SCM (version 4.8.1+588-479a5ea51ccc+20181224)
+  ** Extensions loaded: narrow, sparse
+  Traceback (most recent call last):
+File "/place/vartmp/hgtests.zMelCK/install/bin/hg", line 43, in 
+  dispatch.run()
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
99, in run
+  status = dispatch(req)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
225, in dispatch
+  ret = _runcatch(req) or 0
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
376, in _runcatch
+  return _callcatch(ui, _runcatchfunc)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
384, in _callcatch
+  return scmutil.callcatch(ui, func)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/scmutil.py", line 
166, in callcatch
+  return func()
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
367, in _runcatchfunc
+  return _dispatch(req)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
1021, in _dispatch
+  cmdpats, cmdoptions)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
756, in runcommand
+  ret = _runcommand(ui, options, cmd, d)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
1030, in _runcommand
+  return cmdfunc()
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/dispatch.py", line 
1018, in 
+  d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
+File "/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/util.py", 
line 1670, in check
+  return func(*args, **kwargs)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/debugcommands.py", 
line 1998, in debugrebuilddirstate
+  dirstate.rebuild(ctx.node(), ctx.manifest(), changedfiles)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/hgext/narrow/narrowdirstate.py",
 line 60, in rebuild
+  super(narrowdirstate, self).rebuild(parent, allfiles, changedfiles)
+File 
"/place/vartmp/hgtests.zMelCK/install/lib/python/mercurial/extensions.py", line 
437, in closure
+  return func(*(args + a), **kw)
+File "/place/vartmp/hgtests.zMelCK/install/lib/python/hgext/sparse.py", 
line 213, in _rebuild
+  allfiles = allfiles.matches(matcher)
+  AttributeError: 'list' object has no attribute 'matches'
+  [1]



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


D5479: sparse: don't enable on clone if it was a narrow clone

2019-01-09 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8eaf693b1409: sparse: dont enable on clone if it was 
a narrow clone (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5479?vs=12973=13101

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

AFFECTED FILES
  hgext/sparse.py
  tests/test-narrow-sparse.t

CHANGE DETAILS

diff --git a/tests/test-narrow-sparse.t b/tests/test-narrow-sparse.t
--- a/tests/test-narrow-sparse.t
+++ b/tests/test-narrow-sparse.t
@@ -52,14 +52,12 @@
   $ hg files
   inside/f
 
-XXX: we should not have sparse enabled
-  $ cat .hg/sparse
-  [include]
-  inside/f
+XXX: we should have a flag in `hg debugsparse` to list the sparse profile
+  $ test -f .hg/sparse
+  [1]
 
   $ cat .hg/requires
   dotencode
-  exp-sparse
   fncache
   generaldelta
   narrowhg-experimental
diff --git a/hgext/sparse.py b/hgext/sparse.py
--- a/hgext/sparse.py
+++ b/hgext/sparse.py
@@ -141,6 +141,7 @@
 include_pat = opts.get(r'include')
 exclude_pat = opts.get(r'exclude')
 enableprofile_pat = opts.get(r'enable_profile')
+narrow_pat = opts.get(r'narrow')
 include = exclude = enableprofile = False
 if include_pat:
 pat = include_pat
@@ -153,7 +154,9 @@
 enableprofile = True
 if sum([include, exclude, enableprofile]) > 1:
 raise error.Abort(_("too many flags specified."))
-if include or exclude or enableprofile:
+# if --narrow is passed, it means they are includes and excludes for narrow
+# clone
+if not narrow_pat and (include or exclude or enableprofile):
 def clonesparse(orig, self, node, overwrite, *args, **kwargs):
 sparse.updateconfig(self.unfiltered(), pat, {}, include=include,
 exclude=exclude, enableprofile=enableprofile,



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


D5478: tests: add tests for narrow clone when both sparse and narrow are enabled

2019-01-09 Thread pulkit (Pulkit Goyal)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGeb172f9c208c: tests: add tests for narrow clone when both 
sparse and narrow are enabled (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5478?vs=12972=13100

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

AFFECTED FILES
  tests/test-narrow-sparse.t

CHANGE DETAILS

diff --git a/tests/test-narrow-sparse.t b/tests/test-narrow-sparse.t
new file mode 100644
--- /dev/null
+++ b/tests/test-narrow-sparse.t
@@ -0,0 +1,69 @@
+Testing interaction of sparse and narrow when both are enabled on the client
+side and we do a non-ellipsis clone
+
+#testcases tree flat
+  $ . "$TESTDIR/narrow-library.sh"
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > sparse =
+  > EOF
+
+#if tree
+  $ cat << EOF >> $HGRCPATH
+  > [experimental]
+  > treemanifest = 1
+  > EOF
+#endif
+
+  $ hg init master
+  $ cd master
+
+  $ mkdir inside
+  $ echo 'inside' > inside/f
+  $ hg add inside/f
+  $ hg commit -m 'add inside'
+
+  $ mkdir widest
+  $ echo 'widest' > widest/f
+  $ hg add widest/f
+  $ hg commit -m 'add widest'
+
+  $ mkdir outside
+  $ echo 'outside' > outside/f
+  $ hg add outside/f
+  $ hg commit -m 'add outside'
+
+  $ cd ..
+
+narrow clone the inside file
+
+  $ hg clone --narrow ssh://user@dummy/master narrow --include inside/f
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 3 changesets with 1 changes to 1 files
+  new changesets *:* (glob)
+  updating to branch default
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd narrow
+  $ hg tracked
+  I path:inside/f
+  $ hg files
+  inside/f
+
+XXX: we should not have sparse enabled
+  $ cat .hg/sparse
+  [include]
+  inside/f
+
+  $ cat .hg/requires
+  dotencode
+  exp-sparse
+  fncache
+  generaldelta
+  narrowhg-experimental
+  revlogv1
+  sparserevlog
+  store
+  treemanifest (tree !)



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


D5490: commit: remove ignore whitespace option on --interactive (issue6042)

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Could you add a test?
  
  (Bonus points if you add a test that shows the wrong behavior and then fix it 
in this change.)

REPOSITORY
  rHG Mercurial

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

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


D5516: fix: add some arguments to facilitate extensions

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In https://phab.mercurial-scm.org/D5516#81683, @hooper wrote:
  
  > In https://phab.mercurial-scm.org/D5516#81679, @durin42 wrote:
  >
  > > I'm -0 on this: what's special about this functionality that it needs to 
be an extension of an extension instead of something that can be done in core?
  >
  >
  > Google's internal use of this extension makes some customizations that I 
doubt would be appealing in core. This patch makes some of it simpler to 
implement. Making all of it possible through configs/templates might be unduly 
complex.
  
  
  What kinds of customizations?
  
  > A better version of this might put "ctx" into the templater inside 
Fixer.command, and maybe add a no-op Fixer.cleanup method to make that part 
more explicit. I think that would be a less trivial super set of this patch.

REPOSITORY
  rHG Mercurial

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

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


D5527: progress: write ui.progress() in terms of ui.makeprogress()

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8cf92ca92bfe: progress: write ui.progress() in terms of 
ui.makeprogress() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5527?vs=13077=13096

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

AFFECTED FILES
  mercurial/scmutil.py
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1691,39 +1691,11 @@
 All topics should be marked closed by setting pos to None at
 termination.
 '''
-if getattr(self._fmsgerr, 'structured', False):
-# channel for machine-readable output with metadata, just send
-# raw information
-# TODO: consider porting some useful information (e.g. estimated
-# time) from progbar. we might want to support update delay to
-# reduce the cost of transferring progress messages.
-self._fmsgerr.write(None, type=b'progress', topic=topic, pos=pos,
-item=item, unit=unit, total=total)
-elif self._progbar is not None:
-self._progbar.progress(topic, pos, item=item, unit=unit,
-   total=total)
-
-# Looking up progress.debug in tight loops is expensive. The value
-# is cached on the progbar object and we can avoid the lookup in
-# the common case where a progbar is active.
-if pos is None or not self._progbar.debug:
-return
-
-# Keep this logic in sync with above.
-if pos is None or not self.configbool('progress', 'debug'):
-return
-
-if unit:
-unit = ' ' + unit
-if item:
-item = ' ' + item
-
-if total:
-pct = 100.0 * pos / total
-self.debug('%s:%s %d/%d%s (%4.2f%%)\n'
- % (topic, item, pos, total, unit, pct))
+progress = self.makeprogress(topic, unit, total)
+if pos is not None:
+progress.update(pos, item=item)
 else:
-self.debug('%s:%s %d%s\n' % (topic, item, pos, unit))
+progress.complete()
 
 def makeprogress(self, topic, unit="", total=None):
 '''exists only so low-level modules won't need to import scmutil'''
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1439,11 +1439,46 @@
 self.update(self.pos + step, item, total)
 
 def complete(self):
-self.ui.progress(self.topic, None)
+self.pos = None
+self.unit = ""
+self.total = None
+self._print("")
 
 def _print(self, item):
-self.ui.progress(self.topic, self.pos, item, self.unit,
- self.total)
+if getattr(self.ui._fmsgerr, 'structured', False):
+# channel for machine-readable output with metadata, just send
+# raw information
+# TODO: consider porting some useful information (e.g. estimated
+# time) from progbar. we might want to support update delay to
+# reduce the cost of transferring progress messages.
+self.ui._fmsgerr.write(None, type=b'progress', topic=self.topic,
+   pos=self.pos, item=item, unit=self.unit,
+   total=self.total)
+elif self.ui._progbar is not None:
+self.ui._progbar.progress(self.topic, self.pos, item=item,
+  unit=self.unit, total=self.total)
+
+# Looking up progress.debug in tight loops is expensive. The value
+# is cached on the progbar object and we can avoid the lookup in
+# the common case where a progbar is active.
+if self.pos is None or not self.ui._progbar.debug:
+return
+
+# Keep this logic in sync with above.
+if self.pos is None or not self.ui.configbool('progress', 'debug'):
+return
+
+if self.unit:
+unit = ' ' + self.unit
+if item:
+item = ' ' + item
+
+if self.total:
+pct = 100.0 * self.pos / self.total
+self.ui.debug('%s:%s %d/%d%s (%4.2f%%)\n'
+   % (self.topic, item, self.pos, self.total, unit, pct))
+else:
+self.ui.debug('%s:%s %d%s\n' % (self.topic, item, self.pos, unit))
 
 def gdinitconfig(ui):
 """helper function to know if a repo should be created as general delta



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


D5529: progress: split up _print() method in bar-updating and debug-printing

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3025fd3c2e71: progress: split up _print() method in 
bar-updating and debug-printing (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5529?vs=13079=13099

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1434,18 +1434,20 @@
 if total:
 self.total = total
 self.pos = pos
-self._print(item)
+self._updatebar(item)
+if self.debug:
+self._printdebug(item)
 
 def increment(self, step=1, item="", total=None):
 self.update(self.pos + step, item, total)
 
 def complete(self):
 self.pos = None
 self.unit = ""
 self.total = None
-self._print("")
+self._updatebar("")
 
-def _print(self, item):
+def _updatebar(self, item):
 if getattr(self.ui._fmsgerr, 'structured', False):
 # channel for machine-readable output with metadata, just send
 # raw information
@@ -1459,9 +1461,7 @@
 self.ui._progbar.progress(self.topic, self.pos, item=item,
   unit=self.unit, total=self.total)
 
-if self.pos is None or not self.debug:
-return
-
+def _printdebug(self, item):
 if self.unit:
 unit = ' ' + self.unit
 if item:



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


D5530: progress: check what type of progress bar to use only once per topic

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG963462786f6e: progress: check what type of progress bar to 
use only once per topic (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5530?vs=13080=13098

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -1422,6 +1422,24 @@
 self.unit = unit
 self.total = total
 self.debug = ui.configbool('progress', 'debug')
+if getattr(ui._fmsgerr, 'structured', False):
+# channel for machine-readable output with metadata, just send
+# raw information
+# TODO: consider porting some useful information (e.g. estimated
+# time) from progbar. we might want to support update delay to
+# reduce the cost of transferring progress messages.
+def updatebar(item):
+ui._fmsgerr.write(None, type=b'progress', topic=self.topic,
+  pos=self.pos, item=item, unit=self.unit,
+  total=self.total)
+elif ui._progbar is not None:
+def updatebar(item):
+ui._progbar.progress(self.topic, self.pos, item=item,
+ unit=self.unit, total=self.total)
+else:
+def updatebar(item):
+pass
+self._updatebar = updatebar
 
 def __enter__(self):
 return self
@@ -1447,20 +1465,6 @@
 self.total = None
 self._updatebar("")
 
-def _updatebar(self, item):
-if getattr(self.ui._fmsgerr, 'structured', False):
-# channel for machine-readable output with metadata, just send
-# raw information
-# TODO: consider porting some useful information (e.g. estimated
-# time) from progbar. we might want to support update delay to
-# reduce the cost of transferring progress messages.
-self.ui._fmsgerr.write(None, type=b'progress', topic=self.topic,
-   pos=self.pos, item=item, unit=self.unit,
-   total=self.total)
-elif self.ui._progbar is not None:
-self.ui._progbar.progress(self.topic, self.pos, item=item,
-  unit=self.unit, total=self.total)
-
 def _printdebug(self, item):
 if self.unit:
 unit = ' ' + self.unit



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


D5538: hgweb: add /obsgraph page that shows obsolescence history of a changeset (PoC)

2019-01-09 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Without looking deeply at the implementation (I basically trust you to do 
reasonable things here), I like the feature existing and poking around briefly 
on obsdemo looks reasonable...

REPOSITORY
  rHG Mercurial

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

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


mercurial@41138: 4 new changesets

2019-01-09 Thread Mercurial Commits
4 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/050ea8eb42a5
changeset:   41135:050ea8eb42a5
user:Augie Fackler 
date:Mon Jan 07 16:34:04 2019 -0500
summary: state: update comment about use of CBOR

https://www.mercurial-scm.org/repo/hg/rev/a181a1c8af1d
changeset:   41136:a181a1c8af1d
user:Augie Fackler 
date:Mon Jan 07 18:37:50 2019 -0500
summary: tests: migrate test-wireproto-serverreactor.py to our internal CBOR

https://www.mercurial-scm.org/repo/hg/rev/785a75f0ddcb
changeset:   41137:785a75f0ddcb
user:Martin von Zweigbergk 
date:Tue Jan 08 09:43:24 2019 -0800
summary: progress: document progress.debug config option

https://www.mercurial-scm.org/repo/hg/rev/8ddc5d8bea25
changeset:   41138:8ddc5d8bea25
bookmark:@
tag: tip
user:Kyle Lippincott 
date:Tue Jan 08 17:52:39 2019 -0800
summary: tests: support passing testcase after .t paths that have path 
separators

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


D5531: progress: deprecate ui.progress()

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In https://phab.mercurial-scm.org/D5531#81827, @lothiraldan wrote:
  
  > The new makeprogress API is more clean but more low-level, could we extend 
the deprecation warning until the 5.1 release to gives more time to extension 
authors to update?
  
  
  I'm not sure I agree with the first part, but I don't mind extending the 
deprecation until 5.1. Done.

REPOSITORY
  rHG Mercurial

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

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


D5531: progress: deprecate ui.progress()

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 13095.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5531?vs=13082=13095

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

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1691,6 +1691,8 @@
 All topics should be marked closed by setting pos to None at
 termination.
 '''
+self.deprecwarn("use ui.makeprogress() instead of ui.progress()",
+"5.1")
 progress = self.makeprogress(topic, unit, total)
 if pos is not None:
 progress.update(pos, item=item)



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


D5531: progress: deprecate ui.progress()

2019-01-09 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  The new makeprogress API is more clean but more low-level, could we extend 
the deprecation warning until the 5.1 release to gives more time to extension 
authors to update?

REPOSITORY
  rHG Mercurial

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

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


D5503: vfs: add support for repo names with `$` when using with env vars (issue5739)

2019-01-09 Thread yuja (Yuya Nishihara)
yuja added a comment.


  >   > This is logically incorrect. The problem is that we're doing variable
  >   >  expansion at too lower layer. `vfs(expand(user_specified_path))` makes
  >   >  some sense, but `vfs(expand(getcwd()))` is clearly wrong. And the vfs 
class
  >   >  can't know where the `base` comes from.
  >   
  >   If I add a condition for expanding env var if present in `hgrc`, can this 
work as a fix?
  
  Maybe no. Where do you intend to add such code? vfs doesn't know where the 
path
  comes from. Neither does localrepo.
  
  >   If the only solution for this is shifting path expansion from `vfs` 
class, where do you
  >   think it can be?
  
  Somewhere specifying repository path read from hgrc or user input.

REPOSITORY
  rHG Mercurial

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

To: navaneeth.suresh, #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: D5503: vfs: add support for repo names with `$` when using with env vars (issue5739)

2019-01-09 Thread Yuya Nishihara
>   > This is logically incorrect. The problem is that we're doing variable
>   >  expansion at too lower layer. `vfs(expand(user_specified_path))` makes
>   >  some sense, but `vfs(expand(getcwd()))` is clearly wrong. And the vfs 
> class
>   >  can't know where the `base` comes from.
>   
>   If I add a condition for expanding env var if present in `hgrc`, can this 
> work as a fix?

Maybe no. Where do you intend to add such code? vfs doesn't know where the path
comes from. Neither does localrepo.

>   If the only solution for this is shifting path expansion from `vfs` class, 
> where do you
>   think it can be?

Somewhere specifying repository path read from hgrc or user input.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5536: testrunner: avoid capturing a regex group we don't care about

2019-01-09 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG89d103fc9c19: testrunner: avoid capturing a regex group we 
dont care about (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5536?vs=13089=13094

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2786,7 +2786,8 @@
 expanded_args.append(arg)
 args = expanded_args
 
-testcasepattern = re.compile(br'([\w-]+\.t|py)(#([a-zA-Z0-9_\-\.#]+))')
+testcasepattern = re.compile(
+br'([\w-]+\.t|py)(?:#([a-zA-Z0-9_\-\.#]+))')
 tests = []
 for t in args:
 case = []
@@ -2796,7 +2797,7 @@
 
 m = testcasepattern.match(os.path.basename(t))
 if m is not None:
-t_basename, _, casestr = m.groups()
+t_basename, casestr = m.groups()
 t = os.path.join(os.path.dirname(t), t_basename)
 if casestr:
 case = casestr.split(b'#')



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


D5533: remotefilelog: add newlines to ui.log() invocations

2019-01-09 Thread spectral (Kyle Lippincott)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG92a5fb73b3d5: remotefilelog: add newlines to ui.log() 
invocations (authored by spectral, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5533?vs=13085=13093

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

AFFECTED FILES
  hgext/remotefilelog/remotefilectx.py
  hgext/remotefilelog/shallowutil.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/shallowutil.py 
b/hgext/remotefilelog/shallowutil.py
--- a/hgext/remotefilelog/shallowutil.py
+++ b/hgext/remotefilelog/shallowutil.py
@@ -106,7 +106,7 @@
 def reportpackmetrics(ui, prefix, *stores):
 dicts = [s.getmetrics() for s in stores]
 dict = prefixkeys(sumdicts(*dicts), prefix + '_')
-ui.log(prefix + "_packsizes", "", **pycompat.strkwargs(dict))
+ui.log(prefix + "_packsizes", "\n", **pycompat.strkwargs(dict))
 
 def _parsepackmeta(metabuf):
 """parse datapack meta, bytes () -> dict
diff --git a/hgext/remotefilelog/remotefilectx.py 
b/hgext/remotefilelog/remotefilectx.py
--- a/hgext/remotefilelog/remotefilectx.py
+++ b/hgext/remotefilelog/remotefilectx.py
@@ -226,7 +226,7 @@
 r'reponame': shallowutil.getreponame(repo.ui),
 }
 
-repo.ui.log('linkrevfixup', 'adjusting linknode', **commonlogkwargs)
+repo.ui.log('linkrevfixup', 'adjusting linknode\n', **commonlogkwargs)
 
 pc = repo._phasecache
 seenpublic = False
@@ -315,7 +315,7 @@
 return None
 finally:
 elapsed = time.time() - start
-repo.ui.log('linkrevfixup', logmsg, elapsed=elapsed * 1000,
+repo.ui.log('linkrevfixup', logmsg + '\n', elapsed=elapsed * 1000,
 **pycompat.strkwargs(commonlogkwargs))
 
 def _verifylinknode(self, revs, linknode):



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


D5493: match: support rooted globs in hgignore

2019-01-09 Thread yuja (Yuya Nishihara)
yuja added subscribers: foozy, yuja.
yuja added a comment.


  >   The code already supports this but there is no syntax to make use of
  >   it, so it seems reasonable to create such syntax. I create a new
  >   hgignore syntax "rootedglob". There might be a better name, but
  >   "rooted" is the terminology in use in user-facing documentation.
  
  Perhaps, it can be called a "rootglob".
  
  
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-October/089604.html
  
  I don't remember how the discussion ended, but since we have new "rootfilesin"
  matcher, "root" should be the new naming convention.
  
  > +syntaxes = collections.OrderedDict([
  >  +('re', 'relre:'),
  >  +('regexp', 'relre:'),
  >  +('glob', 'relglob:'),
  >  +('rootedglob', 'glob:'), # after 'glob' line, so glob:a means 
relglob:a
  
  Can you add a new matcher kind 'rootglob'? I understand 'glob' can be abused
  for .hgignore, but it's the pattern relative to cwd.

REPOSITORY
  rHG Mercurial

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

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


Re: D5493: match: support rooted globs in hgignore

2019-01-09 Thread Yuya Nishihara
>   The code already supports this but there is no syntax to make use of
>   it, so it seems reasonable to create such syntax. I create a new
>   hgignore syntax "rootedglob". There might be a better name, but
>   "rooted" is the terminology in use in user-facing documentation.

Perhaps, it can be called a "rootglob".

https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-October/089604.html

I don't remember how the discussion ended, but since we have new "rootfilesin"
matcher, "root" should be the new naming convention.

> +syntaxes = collections.OrderedDict([
> +('re', 'relre:'),
> +('regexp', 'relre:'),
> +('glob', 'relglob:'),
> +('rootedglob', 'glob:'), # after 'glob' line, so glob:a means 
> relglob:a

Can you add a new matcher kind 'rootglob'? I understand 'glob' can be abused
for .hgignore, but it's the pattern relative to cwd.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5538: hgweb: add /obsgraph page that shows obsolescence history of a changeset (PoC)

2019-01-09 Thread av6 (Anton Shestakov)
av6 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Feel free to ask questions, I suspect some chunks would need a comment (either
  in review or in code) to explain what's going on there.
  
  I'll start working on the other hgweb themes later, when I get feedback on 
this
  series.
  
  Color choices are from the current canvas-based graph, but that probably will
  change when I find a better color scheme.
  
  I'm revisiting the idea of making graph in hgweb be SVG as opposed to canvas,
  and this new page, that is separate from /graph, looks like a good testing
  field: locally I have replaced canvas graph with this new SVG graph on /graph
  page and it works fine and looks better, and I hope to improve the visuals 
even
  more. The data structures are the same (for now, at least), and SVGGraph in
  mercurial.js is mostly a copy of the current Graph class.
  
  Tooltips for different graph nodes currently work only in Chromium and similar
  browsers, but it's still better than no tooltips (on cavnas).
  
  You can see obsgraph live on http://hg-test.dwimlabs.net/

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/wix/templates.wxs
  mercurial/hgweb/webcommands.py
  mercurial/templates/paper/changeset.tmpl
  mercurial/templates/paper/graphentry.tmpl
  mercurial/templates/paper/map
  mercurial/templates/paper/obsgraph.tmpl
  mercurial/templates/paper/obsgraphentry.tmpl
  mercurial/templates/static/mercurial.js
  mercurial/templates/static/style-paper.css
  tests/test-hgweb-commands.t
  tests/test-hgweb-diffs.t
  tests/test-hgweb-empty.t
  tests/test-hgweb-removed.t
  tests/test-hgweb-symrev.t

CHANGE DETAILS

diff --git a/tests/test-hgweb-symrev.t b/tests/test-hgweb-symrev.t
--- a/tests/test-hgweb-symrev.t
+++ b/tests/test-hgweb-symrev.t
@@ -97,6 +97,7 @@
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'rev/xyzzy?style=paper' | 
egrep $REVLINKS
log
graph
+   obsgraph
raw
browse
   zip
@@ -297,6 +298,7 @@
   $ "$TESTDIR/get-with-headers.py" $LOCALIP:$HGPORT 'rev/xyzzy?style=coal' | 
egrep $REVLINKS
log
graph
+   obsgraph
raw
browse
   zip
diff --git a/tests/test-hgweb-removed.t b/tests/test-hgweb-removed.t
--- a/tests/test-hgweb-removed.t
+++ b/tests/test-hgweb-removed.t
@@ -46,6 +46,7 @@
   
   
changeset
+   obsgraph
raw
browse
   
diff --git a/tests/test-hgweb-empty.t b/tests/test-hgweb-empty.t
--- a/tests/test-hgweb-empty.t
+++ b/tests/test-hgweb-empty.t
@@ -335,6 +335,156 @@
   
   
   
+  $ (get-with-headers.py localhost:$HGPORT 'obsgraph')
+  200 Script output follows
+  
+  http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd;>
+  http://www.w3.org/1999/xhtml; xml:lang="en-US">
+  
+  
+  
+  
+  
+  
+  test:  obsolescence graph
+  
+  
+  
+  
+  
+  https://mercurial-scm.org/;>
+  
+  
+  
+   log
+   graph
+   tags
+   bookmarks
+   branches
+  
+  
+   changeset
+   obsgraph
+   raw
+   browse
+  
+  
+   
+  
+  
+   help
+  
+  
+  
+  
+  
+  Mercurial 
+  
+   changeset -1:
+   tip 
+  
+  
+  
+  
+  
+  
+  Find changesets by keywords (author, files, the commit 
message), revision
+  number or hash, or revset expression.
+  
+  
+  (none)
+  
+  
+  
+   author
+   
+  
+  
+   date
+   Thu, 01 Jan 1970 00:00:00 +
+  
+  
+  
+  
+   parents
+   
+  
+  
+   children
+   
+  
+  
+   files
+   
+  
+  
+  
+  The revision graph only works with JavaScript-enabled 
browsers.
+  
+  
+  http://www.w3.org/2000/svg;>
+   
+
+  
+
+
+
+
+
+
+  
+
+ normal commit
+ 
+
+
+ branch-closing commit
+ 
+
+
+ unstable commit
+ 
+
+
+ obsolete commit
+ 
+
+
+ working directory parent
+ 
+
+   
+   
+
+
+   
+  
+  
+   
+
+ (none)
+
+tip 
+Thu, 01 Jan 1970 00:00:00 
+, by 
+   
+  
+  
+  
+  
+  
+  var data = [{"edges": [], "graphnode": "@o", "node": "", 
"vertex": [0, 1]}];
+  var graph = new SVGGraph();
+  graph.scale(39);
+  graph.render(data);
+  
+  
+  
+  
+  
+  
+  
+  
+  
   $ (get-with-headers.py localhost:$HGPORT 'file')
   200 Script output follows
   
diff --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t
--- a/tests/test-hgweb-diffs.t
+++ b/tests/test-hgweb-diffs.t
@@ -65,6 +65,7 @@
   
   
changeset
+   obsgraph
raw
browse
   
@@ -362,6 +363,7 @@
   
   
changeset
+   obsgraph
raw
browse
   
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -859,6 +859,7 @@
   
   
changeset
+   obsgraph
raw
browse
   
@@ -964,6 +965,8 @@
   
   
   
+  $ get-with-headers.py $LOCALIP:$HGPORT 'obsgraph' | grep 'var data ='
+  var data = [{"edges": [], "graphnode": "@o", "node": "cad8025a2e87", 

D5537: obsutil: add a simplified obshistorywalker() (PoC)

2019-01-09 Thread av6 (Anton Shestakov)
av6 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This code is taken from evolve extension, namely from obslog command
  implementation, and somewhat simplified to be easier to review.
  
  No tests and no users for now. The next patch will be more interesting.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/obsutil.py

CHANGE DETAILS

diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py
--- a/mercurial/obsutil.py
+++ b/mercurial/obsutil.py
@@ -981,3 +981,156 @@
'reason': 'predecessor',
'node': nodemod.hex(dset['commonpredecessor'])})
 return result
+
+class missingchangectx(object):
+''' a minimal object mimicking changectx for change contexts
+referenced by obs markers but not available locally '''
+
+def __init__(self, repo, nodeid):
+self._repo = repo
+self._node = nodeid
+
+def __bytes__(self):
+return nodemod.short(self.node())
+
+__str__ = encoding.strmethod(__bytes__)
+
+def __repr__(self):
+return r"<%s %s>" % (type(self).__name__, str(self))
+
+def node(self):
+return self._node
+
+def obsolete(self):
+# If we don't have it locally, it's obsolete
+return True
+
+def cyclic(graph):
+"""Return True if the directed graph has a cycle.
+The graph must be represented as a dictionary mapping vertices to
+iterables of neighbouring vertices. For example:
+
+>>> cyclic({1: (2,), 2: (3,), 3: (1,)})
+True
+>>> cyclic({1: (2,), 2: (3,), 3: (4,)})
+False
+
+Taken from: https://codereview.stackexchange.com/a/86067
+
+"""
+visited = set()
+o = object()
+path = [o]
+pathset = set(path)
+stack = [iter(graph)]
+while stack:
+for v in sorted(stack[-1]):
+if v in pathset:
+return True
+elif v not in visited:
+visited.add(v)
+path.append(v)
+pathset.add(v)
+stack.append(iter(graph.get(v, (
+break
+else:
+pathset.remove(path.pop())
+stack.pop()
+return False
+
+def _obshistorylinks(repo, revs):
+""" Iterate over the obsolescence history tree starting from revs,
+traversing successors and predecessors of each revision recursively.
+
+Returns a tuple of::
+
+  - A list of all walked nodes
+  - A dict of successors of each node, values are sets
+  - A dict of predecessors of each node, values are lists
+"""
+nodes = [repo.changelog.node(r) for r in revs]
+seen = set(nodes)
+nodesuccs = dict()
+nodepreds = dict()
+
+predecessors = repo.obsstore.predecessors
+successors = repo.obsstore.successors
+
+while nodes:
+node = nodes.pop()
+nodepreds[node] = []
+
+for marker in sorted(predecessors.get(node, ())):
+prednode = marker[0]
+nodepreds[node].append(prednode)
+# `node` is a successor of `predecessor`
+nodesuccs.setdefault(prednode, set()).add(node)
+
+if prednode not in seen:
+seen.add(prednode)
+nodes.append(prednode)
+
+for marker in successors.get(node, ()):
+for succnode in marker[1]:
+if succnode not in seen:
+seen.add(succnode)
+nodes.append(succnode)
+
+return sorted(seen), nodesuccs, nodepreds
+
+def obshistorywalker(unfi, revs):
+""" Walk the obsolescence marker tree and yield tuples in this format::
+
+  (id, CHANGESET, ctx, [predecessorinfo])
+
+Directly inspired by graphmod.dagwalker.
+"""
+
+# avoid import cycle
+# dagop -> patch -> scmutil -> obsutil -> graphmod -> dagop
+from . import graphmod
+candidates, nodesucc, nodepred = _obshistorylinks(unfi, revs)
+shown = set()
+
+def isvalidcandidate(candidate):
+""" Function to filter candidates, check the candidate successors are
+in shown set
+"""
+return nodesucc.get(candidate, set()).issubset(shown)
+
+while candidates:
+
+# Filter out candidates, returns only nodes with all their successors
+# already shown
+validcandidates = filter(isvalidcandidate, candidates)
+
+# If we likely have a cycle
+if not validcandidates:
+cycle = cyclic(nodesucc)
+assert cycle
+
+# Then choose a random node from the cycle
+breaknode = sorted(cycle)[0]
+# And display it by force
+unfi.ui.debug('obs-cycle detected, forcing display of %s\n'
+  % nodemod.short(breaknode))
+validcandidates = [breaknode]
+
+for candidate in sorted(validcandidates):
+

D5525: xdiff: don't attempt to use fuzzer inputs larger than 100k

2019-01-09 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2e60a77b7058: xdiff: dont attempt to use fuzzer 
inputs larger than 100k (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5525?vs=13075=13090

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

AFFECTED FILES
  contrib/fuzz/xdiff.cc

CHANGE DETAILS

diff --git a/contrib/fuzz/xdiff.cc b/contrib/fuzz/xdiff.cc
--- a/contrib/fuzz/xdiff.cc
+++ b/contrib/fuzz/xdiff.cc
@@ -22,6 +22,11 @@
 
 int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
 {
+   // Don't allow fuzzer inputs larger than 100k, since we'll just bog
+   // down and not accomplish much.
+   if (Size > 10) {
+   return 0;
+   }
auto maybe_inputs = SplitInputs(Data, Size);
if (!maybe_inputs) {
return 0;



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


D5514: test: change test's diff generation to use mdiff for nicer output

2019-01-09 Thread sangeet259 (Sangeet Kumar Mishra)
sangeet259 added a comment.


  @durin42 So the `try/except` will fall back to `unified diff`?
  Is there a way we can enforce this on system's that don't have mercurial 
installed globally and not have to fall back on the earlier practice.
  
  Also, I didn't get your comment on checking the API of `mdiff` :/

REPOSITORY
  rHG Mercurial

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

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