Re: 4.4 Sprint Planning

2017-09-13 Thread Gregory Szorc
On Wed, Sep 13, 2017 at 2:22 AM, Ryan McElroy  wrote:

> Greetings Mercurial Community!
>
> As hopefully everyone is aware, the 4.4 sprint (https://www.mercurial-scm.
> org/wiki/4.4sprint) is coming up in two and a half weeks. Please make
> sure you have copied your name from the "Availability" list to the
> "Attendance" list if you are planning on coming (currently our confirmed
> numbers are about half of those a year ago in Paris and I'll confirming
> numbers would also be awesome).
>
> As we have have learned from the past few sprints, a little bit of
> planning has helped us get the most out of these events. I wanted to
> propose a tentative schedule and solicit feedback now so we can hit the
> ground running when the sprint starts on Friday, September 29.
>
> Once we agree on a schedule that at least most of us are okay with, I’ll
> add it to the sprint wiki. Also, Kostia Balytskyi and I are volunteering to
> help organize the sprint on-the-ground (to help ensure we’re covering as
> much ground as possible during the three days of the sprint).
>
> # Proposed Schedule Draft
>
> ## Friday
> 9-10am arrive, get breakfast at FB office, mingle
> 10am-noon: Welcome and Status Updates
> * state of the community (updates from the steering committee)
> * state of the tooling (updates about the build bots and systems on
> mercurial-scm.org)
> * state of the code (updates on statistics about code contributions and
> code review)
> * state of hg at company X (BitBucket, Mozilla, Unity, Google, FB, etc)
> noon-1:00pm: lunch at FB cafeteria
> 1:00-3:00pm: breakout sessions on major topics, with notetakers in
> etherpad (will use wiki ideas to pre-seed)
> 3:00-3:30: break
> 3:30-5:30: breakout sessions continue
> 5:30: order Saturday breakfast
> 6:00-evening: dinner at FB office, enjoy Dublin, etc
>
> ## Saturday
> 9-10am: arrive, eat breakfast, mingle
> 10am: order lunch
> 10:30am-noon: Tech Talks – interesting project presentations (will have
> sign ups before and at sprint)
> noon-1:00pm: eat lunch
> 1:00-5:30 hackathon, fix some low-hanging bugs, implement some quick
> features, etc (needs reviewers!)
> 5:30: order Sunday breakfast
> 6:00-evening: dinner out in Dublin, enjoy the brisk Irish air, etc
>
> ## Sunday
> 9-10am: arrive, eat breakfast, mingle
> 10am: order lunch
> 10:30am-noon: Vision statements – directions we’d like to see mercurial go
> in the future (good idea?)
> noon-1:00pm: eat lunch
> 1:00-3:00pm: breakout sessions
> 3:00-3:30: break
> 3:30-5:30: breakout sessions
> 5:30-evening: freedom!
>
> Please help paint this bikeshed! All ideas will be considered.
>
> I’m looking forward to seeing many of you in a couple of weeks!
>

Thank you and Kostia for volunteering to organize things on the ground! The
sprints can be chaotic and I'm sure you'll make great masters-of-ceremony.

While the draft schedule seems very reasonable (I'd be happy if it were the
final schedule), I'd like to throw out a few ideas and observations.

Experience from previous Sprints tells me that people are pretty drained by
the 3rd day. I like the idea of a "vision statements" session to hash out
project direction. But I'm a bit worried about doing that on Sunday. If we
have the session, I'd prefer see it done on Friday or Saturday when
everyone is still pretty fresh. I /think/ it would make a natural follow-up
to the "state of" sessions. Maybe we could do it after lunch on Friday?
Although I do worry about information overload if we stack all the heavy
talking on Friday. It might also be useful for people to have time to
digest all the "state of" information and to connect with others before we
start thinking about vision statements.

Personally, I love when things get done at the Sprint. The best Sprints for
me are when I walk away feeling energized about what was accomplished.
Something I feel has been lacking from previous Sprints is a natural "book
end" to the event. Sundays can kind of tail off and fizzle. What do others
think about some kind of "closing" event where we announce accomplishments
and leave on a high note?

Another area I'd like to explore is establishing more formal goals or even
"tracks" for the Sprint - before the Sprint starts. It would be cool if by
the time I get on a plane I have a pretty good sense of what we're going to
try to do at the Sprint. For example, perhaps a few people sign up for
Python 3 porting, others on storage futures, another group on UX papercuts,
and another group on bug triage and fixing. Being a reviewer and patch
author, if I have time to "page in" areas that I know will be a focus at
the Sprint, it should enable me - and others - to have a more productive
Sprint.

Finally, I'd really like to make sure we address as many of the "only at
the Sprint" activities as we can. We tend to save many of our larger
backwards compatibility breaking decisions for Sprints. Going back to
knowing what will happen before the Sprint, if we could get a list of major
proposals on the 

D558: show: use consistent (and possibly shorter) node lengths

2017-09-13 Thread indygreg (Gregory Szorc)
indygreg updated this revision to Diff 1811.
indygreg edited the summary of this revision.
indygreg retitled this revision from "show: decrease minimum node length from 5 
to 3" to "show: use consistent (and possibly shorter) node lengths".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D558?vs=1385=1811

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

AFFECTED FILES
  hgext/show.py
  tests/test-show-stack.t
  tests/test-show-work.t
  tests/test-show.t

CHANGE DETAILS

diff --git a/tests/test-show.t b/tests/test-show.t
--- a/tests/test-show.t
+++ b/tests/test-show.t
@@ -95,8 +95,8 @@
   $ hg bookmark a-longer-bookmark
 
   $ hg show bookmarks
-  * a-longer-bookmark7b570
-book1b757f
+  * a-longer-bookmark7b57
+book1b757
 
 A custom bookmarks template works
 
@@ -113,14 +113,14 @@
 "bookmark": "a-longer-bookmark",
 "longestbookmarklen": 17,
 "node": "7b5709ab64cbc34da9b4367b64afff47f2c4ee83",
-"nodelen": 5
+"nodelen": 4
},
{
 "active": false,
 "bookmark": "book1",
 "longestbookmarklen": 17,
 "node": "b757f780b8ffd71267c6ccb32e0882d9d32a8cc0",
-"nodelen": 5
+"nodelen": 4
}
   ]
 
@@ -138,19 +138,19 @@
   (no bookmarks set)
 
   $ hg --config commands.show.aliasprefix=sh shwork
-  @  7b570 commit for book2
-  o  b757f commit for book1
-  o  ba592 initial
+  @  7b57 commit for book2
+  o  b757 commit for book1
+  o  ba59 initial
 
   $ hg --config commands.show.aliasprefix='s sh' swork
-  @  7b570 commit for book2
-  o  b757f commit for book1
-  o  ba592 initial
+  @  7b57 commit for book2
+  o  b757 commit for book1
+  o  ba59 initial
 
   $ hg --config commands.show.aliasprefix='s sh' shwork
-  @  7b570 commit for book2
-  o  b757f commit for book1
-  o  ba592 initial
+  @  7b57 commit for book2
+  o  b757 commit for book1
+  o  ba59 initial
 
 The aliases don't appear in `hg config`
 
diff --git a/tests/test-show-work.t b/tests/test-show-work.t
--- a/tests/test-show-work.t
+++ b/tests/test-show-work.t
@@ -16,47 +16,47 @@
   $ hg -q commit -A -m 'commit 0'
 
   $ hg show work
-  @  9f171 commit 0
+  @  9f17 commit 0
 
 Even when it isn't the wdir
 
   $ hg -q up null
 
   $ hg show work
-  o  9f171 commit 0
+  o  9f17 commit 0
 
 Single changeset is still there when public because it is a head
 
   $ hg phase --public -r 0
   $ hg show work
-  o  9f171 commit 0
+  o  9f17 commit 0
 
 A draft child will show both it and public parent
 
   $ hg -q up 0
   $ echo 1 > foo
   $ hg commit -m 'commit 1'
 
   $ hg show work
-  @  181cc commit 1
-  o  9f171 commit 0
+  @  181c commit 1
+  o  9f17 commit 0
 
 Multiple draft children will be shown
 
   $ echo 2 > foo
   $ hg commit -m 'commit 2'
 
   $ hg show work
-  @  128c8 commit 2
-  o  181cc commit 1
-  o  9f171 commit 0
+  @  128c commit 2
+  o  181c commit 1
+  o  9f17 commit 0
 
 Bumping first draft changeset to public will hide its parent
 
   $ hg phase --public -r 1
   $ hg show work
-  @  128c8 commit 2
-  o  181cc commit 1
+  @  128c commit 2
+  o  181c commit 1
   |
   ~
 
@@ -68,22 +68,22 @@
   created new head
 
   $ hg show work
-  @  f0abc commit 3
-  | o  128c8 commit 2
+  @  f0ab commit 3
+  | o  128c commit 2
   |/
-  o  181cc commit 1
+  o  181c commit 1
   |
   ~
 
 Even when wdir is something else
 
   $ hg -q up null
 
   $ hg show work
-  o  f0abc commit 3
-  | o  128c8 commit 2
+  o  f0ab commit 3
+  | o  128c commit 2
   |/
-  o  181cc commit 1
+  o  181c commit 1
   |
   ~
 
@@ -95,13 +95,13 @@
   created new head
 
   $ hg show work
-  @  668ca commit 4
-  | o  f0abc commit 3
-  | | o  128c8 commit 2
+  @  668c commit 4
+  | o  f0ab commit 3
+  | | o  128c commit 2
   | |/
-  | o  181cc commit 1
+  | o  181c commit 1
   |/
-  o  9f171 commit 0
+  o  9f17 commit 0
 
   $ cd ..
 
@@ -126,11 +126,11 @@
   $ hg commit -m 'commit 4'
 
   $ hg show work
-  @  f8dd3 (mybranch) commit 4
-  o  90cfc (mybranch) commit 3
-  | o  128c8 commit 2
+  @  f8dd (mybranch) commit 4
+  o  90cf (mybranch) commit 3
+  | o  128c commit 2
   |/
-  o  181cc commit 1
+  o  181c commit 1
   |
   ~
 
@@ -157,11 +157,11 @@
   $ hg bookmark mybook
 
   $ hg show work
-  @  cac82 (mybook) commit 4
-  o  f0abc commit 3
-  | o  128c8 (@) commit 2
+  @  cac8 (mybook) commit 4
+  o  f0ab commit 3
+  | o  128c (@) commit 2
   |/
-  o  181cc commit 1
+  o  181c commit 1
   |
   ~
 
@@ -182,9 +182,9 @@
   $ hg tag 0.2
 
   $ hg show work
-  @  37582 Added tag 0.2 for changeset 6379c25b76f1
-  o  6379c (0.2) commit 3
-  o  a2ad9 Added tag 0.1 for changeset 6a75536ea0b1
+  @  3758 Added tag 0.2 for changeset 6379c25b76f1
+  o  6379 (0.2) commit 3
+  o  a2ad Added tag 0.1 for changeset 6a75536ea0b1
   |
   ~
 
@@ -205,15 +205,15 @@
   $ hg commit -m 'commit 2'
 
   $ hg show work
-  @  34834 (mybook) (mybranch) commit 2
-  o  97fcc commit 1
+  @  3483 (mybook) (mybranch) commit 2
+  o  97fc commit 1
 
 Multiple bookmarks on same 

D555: cmdutil: allow extra properties to be added to each context

2017-09-13 Thread indygreg (Gregory Szorc)
indygreg updated this revision to Diff 1810.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D555?vs=1382=1810

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2617,7 +2617,8 @@
 return formatnode
 
 def displaygraph(ui, repo, dag, displayer, edgefn, getrenamed=None,
- filematcher=None):
+ filematcher=None, props=None):
+props = props or {}
 formatnode = _graphnodeformatter(ui, displayer)
 state = graphmod.asciistate()
 styles = state['styles']
@@ -2658,7 +2659,7 @@
 firstedge = next(edges)
 width = firstedge[2]
 displayer.show(ctx, copies=copies, matchfn=revmatchfn,
-   _graphwidth=width)
+   _graphwidth=width, **props)
 lines = displayer.hunk.pop(rev).split('\n')
 if not lines[-1]:
 del lines[-1]



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


D557: show: use consistent node lengths

2017-09-13 Thread indygreg (Gregory Szorc)
indygreg abandoned this revision.
indygreg added a comment.


  This got rolled into https://phab.mercurial-scm.org/D558. `hg phabsend` 
didn't appear smart enough to discard it from Phabricator when I pushed the new 
stack.

REPOSITORY
  rHG Mercurial

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

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


D557: show: use consistent node lengths

2017-09-13 Thread indygreg (Gregory Szorc)
indygreg added inline comments.

INLINE COMMENTS

> quark wrote in show.py:440
> I'd call low level function without template and maintain a current minlen to 
> reduce calculation.

The current minlen code is semi-tightly integrated with the templating layer.

I agree with you that a generic function should be established. But I 
considered that scope bloat and figured it was territory for a follow-up.

REPOSITORY
  rHG Mercurial

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

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


D708: bundle2: remove unnecessary try finally

2017-09-13 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added a comment.
This revision now requires changes to proceed.


  Let's wait for a new version of https://phab.mercurial-scm.org/D706 before 
looking at this.

REPOSITORY
  rHG Mercurial

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

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


D706: bundle2: move processpart stream maintenance into part iterator

2017-09-13 Thread indygreg (Gregory Szorc)
indygreg requested changes to this revision.
indygreg added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> bundle2.py:1149-1152
> +try:
> +_processpart(op, part)
> +finally:
> +part.seek(0, 2)

I think there is a change in behavior here.

Before, _processpart() would catch SystemExit and KeyboardInterrupt and not 
attempt part.seek(). After this change, it always does the part.seek() courtesy 
of being in a finally block.

The problem with this is that we may attempt I/O after process termination is 
requested. This can lead to bad things, as the commit message for 
https://phab.mercurial-scm.org/rHG9a9629b9416c262ff62bbd17568fcd2a2e09b4be 
details.

We mustn't attempt possibly blocking I/O after process termination is requested.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 01 of 27] configitems: register the 'convert.cvsps.cache' config

2017-09-13 Thread Gregory Szorc
On Tue, Sep 12, 2017 at 11:59 PM, Boris Feld  wrote:

> # HG changeset patch
> # User Boris Feld 
> # Date 1498786373 -7200
> #  ven. juin 30 03:32:53 2017 +0200
> # Node ID 30cdc4d4189ee6399c8a39d825333c0602244899
> # Parent  24bf823377fcbf49fec9da8adb796924dff91c73
> # EXP-Topic config.register.convert
> configitems: register the 'convert.cvsps.cache' config
>
> The convert extensions has code a bit all around, but it seems simpler to
> use a
> central declaration of options at the root first.
>

Queued this series, thanks.


>
> diff -r 24bf823377fc -r 30cdc4d4189e hgext/convert/__init__.py
> --- a/hgext/convert/__init__.py mar. sept. 12 19:27:01 2017 -0700
> +++ b/hgext/convert/__init__.py ven. juin 30 03:32:53 2017 +0200
> @@ -28,6 +28,13 @@
>  # leave the attribute unspecified.
>  testedwith = 'ships-with-hg-core'
>
> +configtable = {}
> +configitem = registrar.configitem(configtable)
> +
> +configitem('convert', 'cvsps.cache',
> +default=True,
> +)
> +
>  # Commands definition was moved elsewhere to ease demandload job.
>
>  @command('convert',
> diff -r 24bf823377fc -r 30cdc4d4189e hgext/convert/cvs.py
> --- a/hgext/convert/cvs.py  mar. sept. 12 19:27:01 2017 -0700
> +++ b/hgext/convert/cvs.py  ven. juin 30 03:32:53 2017 +0200
> @@ -76,7 +76,7 @@
>  id = None
>
>  cache = 'update'
> -if not self.ui.configbool('convert', 'cvsps.cache', True):
> +if not self.ui.configbool('convert', 'cvsps.cache'):
>  cache = None
>  db = cvsps.createlog(self.ui, cache=cache)
>  db = cvsps.createchangeset(self.ui, db,
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D705: bundle2: move exception handling into part iterator

2017-09-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG3d8fb0c37e12: bundle2: move exception handling into part 
iterator (authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D705?vs=1801=1809

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -348,8 +348,9 @@
 return op
 
 class partiterator(object):
-def __init__(self, repo, unbundler):
+def __init__(self, repo, op, unbundler):
 self.repo = repo
+self.op = op
 self.unbundler = unbundler
 self.iterator = None
 self.count = 0
@@ -363,10 +364,43 @@
 self.iterator = func()
 return self.iterator
 
-def __exit__(self, type, value, tb):
+def __exit__(self, type, exc, tb):
 if not self.iterator:
 return
 
+if exc:
+# Any exceptions seeking to the end of the bundle at this point are
+# almost certainly related to the underlying stream being bad.
+# And, chances are that the exception we're handling is related to
+# getting in that bad state. So, we swallow the seeking error and
+# re-raise the original error.
+seekerror = False
+try:
+for part in self.iterator:
+# consume the bundle content
+part.seek(0, 2)
+except Exception:
+seekerror = True
+
+# Small hack to let caller code distinguish exceptions from bundle2
+# processing from processing the old format. This is mostly needed
+# to handle different return codes to unbundle according tothe type
+# of bundle. We should probably clean up or drop this return code
+# craziness in a future version.
+exc.duringunbundle2 = True
+salvaged = []
+replycaps = None
+if self.op.reply is not None:
+salvaged = self.op.reply.salvageoutput()
+replycaps = self.op.reply.capabilities
+exc._replycaps = replycaps
+exc._bundle2salvagedoutput = salvaged
+
+# Re-raising from a variable loses the original stack. So only use
+# that form if we need to.
+if seekerror:
+raise exc
+
 self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' %
self.count)
 
@@ -402,45 +436,9 @@
 msg.append('\n')
 repo.ui.debug(''.join(msg))
 
-with partiterator(repo, unbundler) as parts:
-part = None
-try:
-for part in parts:
-_processpart(op, part)
-except Exception as exc:
-# Any exceptions seeking to the end of the bundle at this point are
-# almost certainly related to the underlying stream being bad.
-# And, chances are that the exception we're handling is related to
-# getting in that bad state. So, we swallow the seeking error and
-# re-raise the original error.
-seekerror = False
-try:
-for part in parts:
-# consume the bundle content
-part.seek(0, 2)
-except Exception:
-seekerror = True
-
-# Small hack to let caller code distinguish exceptions from bundle2
-# processing from processing the old format. This is mostly needed
-# to handle different return codes to unbundle according to the 
type
-# of bundle. We should probably clean up or drop this return code
-# craziness in a future version.
-exc.duringunbundle2 = True
-salvaged = []
-replycaps = None
-if op.reply is not None:
-salvaged = op.reply.salvageoutput()
-replycaps = op.reply.capabilities
-exc._replycaps = replycaps
-exc._bundle2salvagedoutput = salvaged
-
-# Re-raising from a variable loses the original stack. So only use
-# that form if we need to.
-if seekerror:
-raise exc
-else:
-raise
+with partiterator(repo, op, unbundler) as parts:
+for part in parts:
+_processpart(op, part)
 
 return op
 



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


D704: bundle2: move part counter to partiterator

2017-09-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG550343626bb2: bundle2: move part counter to partiterator 
(authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D704?vs=1800=1808

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -348,14 +348,27 @@
 return op
 
 class partiterator(object):
-def __init__(self, unbundler):
+def __init__(self, repo, unbundler):
+self.repo = repo
 self.unbundler = unbundler
+self.iterator = None
+self.count = 0
 
 def __enter__(self):
-return enumerate(self.unbundler.iterparts())
+def func():
+itr = enumerate(self.unbundler.iterparts())
+for count, p in itr:
+self.count = count
+yield p
+self.iterator = func()
+return self.iterator
 
 def __exit__(self, type, value, tb):
-pass
+if not self.iterator:
+return
+
+self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' %
+   self.count)
 
 def processbundle(repo, unbundler, transactiongetter=None, op=None):
 """This function process a bundle, apply effect to/from a repo
@@ -389,11 +402,10 @@
 msg.append('\n')
 repo.ui.debug(''.join(msg))
 
-with partiterator(unbundler) as parts:
+with partiterator(repo, unbundler) as parts:
 part = None
-nbpart = 0
 try:
-for nbpart, part in parts:
+for part in parts:
 _processpart(op, part)
 except Exception as exc:
 # Any exceptions seeking to the end of the bundle at this point are
@@ -403,7 +415,7 @@
 # re-raise the original error.
 seekerror = False
 try:
-for nbpart, part in parts:
+for part in parts:
 # consume the bundle content
 part.seek(0, 2)
 except Exception:
@@ -429,8 +441,6 @@
 raise exc
 else:
 raise
-finally:
-repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart)
 
 return op
 



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


D703: bundle2: move part iterator a separate class

2017-09-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe9e0e1143fc5: bundle2: move part iterator a separate class 
(authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D703?vs=1799=1807

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -347,6 +347,16 @@
 _processchangegroup(op, unbundler, tr, source, url, **kwargs)
 return op
 
+class partiterator(object):
+def __init__(self, unbundler):
+self.unbundler = unbundler
+
+def __enter__(self):
+return enumerate(self.unbundler.iterparts())
+
+def __exit__(self, type, value, tb):
+pass
+
 def processbundle(repo, unbundler, transactiongetter=None, op=None):
 """This function process a bundle, apply effect to/from a repo
 
@@ -378,48 +388,49 @@
 msg.append(' with-transaction')
 msg.append('\n')
 repo.ui.debug(''.join(msg))
-iterparts = enumerate(unbundler.iterparts())
-part = None
-nbpart = 0
-try:
-for nbpart, part in iterparts:
-_processpart(op, part)
-except Exception as exc:
-# Any exceptions seeking to the end of the bundle at this point are
-# almost certainly related to the underlying stream being bad.
-# And, chances are that the exception we're handling is related to
-# getting in that bad state. So, we swallow the seeking error and
-# re-raise the original error.
-seekerror = False
+
+with partiterator(unbundler) as parts:
+part = None
+nbpart = 0
 try:
-for nbpart, part in iterparts:
-# consume the bundle content
-part.seek(0, 2)
-except Exception:
-seekerror = True
+for nbpart, part in parts:
+_processpart(op, part)
+except Exception as exc:
+# Any exceptions seeking to the end of the bundle at this point are
+# almost certainly related to the underlying stream being bad.
+# And, chances are that the exception we're handling is related to
+# getting in that bad state. So, we swallow the seeking error and
+# re-raise the original error.
+seekerror = False
+try:
+for nbpart, part in parts:
+# consume the bundle content
+part.seek(0, 2)
+except Exception:
+seekerror = True
 
-# Small hack to let caller code distinguish exceptions from bundle2
-# processing from processing the old format. This is mostly
-# needed to handle different return codes to unbundle according to the
-# type of bundle. We should probably clean up or drop this return code
-# craziness in a future version.
-exc.duringunbundle2 = True
-salvaged = []
-replycaps = None
-if op.reply is not None:
-salvaged = op.reply.salvageoutput()
-replycaps = op.reply.capabilities
-exc._replycaps = replycaps
-exc._bundle2salvagedoutput = salvaged
+# Small hack to let caller code distinguish exceptions from bundle2
+# processing from processing the old format. This is mostly needed
+# to handle different return codes to unbundle according to the 
type
+# of bundle. We should probably clean up or drop this return code
+# craziness in a future version.
+exc.duringunbundle2 = True
+salvaged = []
+replycaps = None
+if op.reply is not None:
+salvaged = op.reply.salvageoutput()
+replycaps = op.reply.capabilities
+exc._replycaps = replycaps
+exc._bundle2salvagedoutput = salvaged
 
-# Re-raising from a variable loses the original stack. So only use
-# that form if we need to.
-if seekerror:
-raise exc
-else:
-raise
-finally:
-repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart)
+# Re-raising from a variable loses the original stack. So only use
+# that form if we need to.
+if seekerror:
+raise exc
+else:
+raise
+finally:
+repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart)
 
 return op
 



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


D696: registrar: add a enum 'cmdtype' for the type of the command

2017-09-13 Thread indygreg (Gregory Szorc)
indygreg added a comment.


  I'm holding off on accepting this because I'd like to see an example before 
it is committed.
  
  Since Python 2 doesn't have real enums and Mercurial tends to shy away from 
object-oriented programming, I'm -0 on the use of a class here. Module-level 
variables with a common prefix would accomplish the same thing.

REPOSITORY
  rHG Mercurial

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

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


D706: bundle2: move processpart stream maintenance into part iterator

2017-09-13 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The processpart function also did some stream maintenance, so let's move it to
  the part iterator as well, as part of moving all part iteration logic into the
  class.
  
  There is one place processpart is called outside of the normal loop, so we
  manually handle the seek there.
  
  The now-empty try/finally will be removed in a later patch, for ease of 
review.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -354,21 +354,32 @@
 self.unbundler = unbundler
 self.iterator = None
 self.count = 0
+self.current = None
 
 def __enter__(self):
 def func():
 itr = enumerate(self.unbundler.iterparts())
 for count, p in itr:
 self.count = count
+self.current = p
 yield p
+p.seek(0, 2)
+self.current = None
 self.iterator = func()
 return self.iterator
 
 def __exit__(self, type, exc, tb):
 if not self.iterator:
 return
 
 if exc:
+# If exiting or interrupted, do not attempt to seek the stream in
+# the finally block below. This makes abort faster.
+if (self.current and
+not isinstance(exc, (SystemExit, KeyboardInterrupt))):
+# consume the part content to not corrupt the stream.
+self.current.seek(0, 2)
+
 # Any exceptions seeking to the end of the bundle at this point are
 # almost certainly related to the underlying stream being bad.
 # And, chances are that the exception we're handling is related to
@@ -455,7 +466,6 @@
 The part is guaranteed to have been fully consumed when the function exits
 (even if an exception is raised)."""
 status = 'unknown' # used by debug output
-hardabort = False
 try:
 try:
 handler = parthandlermapping.get(part.type)
@@ -511,15 +521,8 @@
mandatory=False)
 outpart.addparam(
 'in-reply-to', pycompat.bytestr(part.id), mandatory=False)
-# If exiting or interrupted, do not attempt to seek the stream in the
-# finally block below. This makes abort faster.
-except (SystemExit, KeyboardInterrupt):
-hardabort = True
-raise
 finally:
-# consume the part content to not corrupt the stream.
-if not hardabort:
-part.seek(0, 2)
+pass
 
 
 def decodecaps(blob):
@@ -1143,7 +1146,10 @@
 return
 part = unbundlepart(self.ui, headerblock, self._fp)
 op = interruptoperation(self.ui)
-_processpart(op, part)
+try:
+_processpart(op, part)
+finally:
+part.seek(0, 2)
 self.ui.debug('bundle2-input-stream-interrupt:'
   ' closing out of band context\n')
 



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


D708: bundle2: remove unnecessary try finally

2017-09-13 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is no longer needed.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -505,32 +505,28 @@
 
 The part is guaranteed to have been fully consumed when the function exits
 (even if an exception is raised)."""
-try:
-handler = _gethandler(op, part)
-if handler is None:
-return
+handler = _gethandler(op, part)
+if handler is None:
+return
 
-# handler is called outside the above try block so that we don't
-# risk catching KeyErrors from anything other than the
-# parthandlermapping lookup (any KeyError raised by handler()
-# itself represents a defect of a different variety).
-output = None
-if op.captureoutput and op.reply is not None:
-op.ui.pushbuffer(error=True, subproc=True)
-output = ''
-try:
-handler(op, part)
-finally:
-if output is not None:
-output = op.ui.popbuffer()
-if output:
-outpart = op.reply.newpart('output', data=output,
-   mandatory=False)
-outpart.addparam(
-'in-reply-to', pycompat.bytestr(part.id), mandatory=False)
+# handler is called outside the above try block so that we don't
+# risk catching KeyErrors from anything other than the
+# parthandlermapping lookup (any KeyError raised by handler()
+# itself represents a defect of a different variety).
+output = None
+if op.captureoutput and op.reply is not None:
+op.ui.pushbuffer(error=True, subproc=True)
+output = ''
+try:
+handler(op, part)
 finally:
-pass
-
+if output is not None:
+output = op.ui.popbuffer()
+if output:
+outpart = op.reply.newpart('output', data=output,
+   mandatory=False)
+outpart.addparam(
+'in-reply-to', pycompat.bytestr(part.id), mandatory=False)
 
 def decodecaps(blob):
 """decode a bundle2 caps bytes blob into a dictionary



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


D703: bundle2: move part iterator a separate class

2017-09-13 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Currently, the part iterator logic is tightly coupled with the part handling
  logic, which means it's hard to replace the part handling logic without
  duplicating the part iterator bits.
  
  In a future diff we'll want to be able to replace all part handling, so let's
  begin refactoring the part iterator logic to it's own class.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -347,6 +347,16 @@
 _processchangegroup(op, unbundler, tr, source, url, **kwargs)
 return op
 
+class partiterator(object):
+def __init__(self, unbundler):
+self.unbundler = unbundler
+
+def __enter__(self):
+return enumerate(self.unbundler.iterparts())
+
+def __exit__(self, type, value, tb):
+pass
+
 def processbundle(repo, unbundler, transactiongetter=None, op=None):
 """This function process a bundle, apply effect to/from a repo
 
@@ -378,48 +388,49 @@
 msg.append(' with-transaction')
 msg.append('\n')
 repo.ui.debug(''.join(msg))
-iterparts = enumerate(unbundler.iterparts())
-part = None
-nbpart = 0
-try:
-for nbpart, part in iterparts:
-_processpart(op, part)
-except Exception as exc:
-# Any exceptions seeking to the end of the bundle at this point are
-# almost certainly related to the underlying stream being bad.
-# And, chances are that the exception we're handling is related to
-# getting in that bad state. So, we swallow the seeking error and
-# re-raise the original error.
-seekerror = False
+
+with partiterator(unbundler) as parts:
+part = None
+nbpart = 0
 try:
-for nbpart, part in iterparts:
-# consume the bundle content
-part.seek(0, 2)
-except Exception:
-seekerror = True
+for nbpart, part in parts:
+_processpart(op, part)
+except Exception as exc:
+# Any exceptions seeking to the end of the bundle at this point are
+# almost certainly related to the underlying stream being bad.
+# And, chances are that the exception we're handling is related to
+# getting in that bad state. So, we swallow the seeking error and
+# re-raise the original error.
+seekerror = False
+try:
+for nbpart, part in parts:
+# consume the bundle content
+part.seek(0, 2)
+except Exception:
+seekerror = True
 
-# Small hack to let caller code distinguish exceptions from bundle2
-# processing from processing the old format. This is mostly
-# needed to handle different return codes to unbundle according to the
-# type of bundle. We should probably clean up or drop this return code
-# craziness in a future version.
-exc.duringunbundle2 = True
-salvaged = []
-replycaps = None
-if op.reply is not None:
-salvaged = op.reply.salvageoutput()
-replycaps = op.reply.capabilities
-exc._replycaps = replycaps
-exc._bundle2salvagedoutput = salvaged
+# Small hack to let caller code distinguish exceptions from bundle2
+# processing from processing the old format. This is mostly needed
+# to handle different return codes to unbundle according to the 
type
+# of bundle. We should probably clean up or drop this return code
+# craziness in a future version.
+exc.duringunbundle2 = True
+salvaged = []
+replycaps = None
+if op.reply is not None:
+salvaged = op.reply.salvageoutput()
+replycaps = op.reply.capabilities
+exc._replycaps = replycaps
+exc._bundle2salvagedoutput = salvaged
 
-# Re-raising from a variable loses the original stack. So only use
-# that form if we need to.
-if seekerror:
-raise exc
-else:
-raise
-finally:
-repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart)
+# Re-raising from a variable loses the original stack. So only use
+# that form if we need to.
+if seekerror:
+raise exc
+else:
+raise
+finally:
+repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart)
 
 return op
 



To: durham, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list

D707: bundle2: move handler validation out of processpart

2017-09-13 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As part of refactoring bundle part processing let's move handler validation to
  its own function.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -460,48 +460,55 @@
 })
 return ret
 
+def _gethandler(op, part):
+status = 'unknown' # used by debug output
+try:
+handler = parthandlermapping.get(part.type)
+if handler is None:
+status = 'unsupported-type'
+raise error.BundleUnknownFeatureError(parttype=part.type)
+indebug(op.ui, 'found a handler for part %r' % part.type)
+unknownparams = part.mandatorykeys - handler.params
+if unknownparams:
+unknownparams = list(unknownparams)
+unknownparams.sort()
+status = 'unsupported-params (%s)' % unknownparams
+raise error.BundleUnknownFeatureError(parttype=part.type,
+  params=unknownparams)
+status = 'supported'
+except error.BundleUnknownFeatureError as exc:
+if part.mandatory: # mandatory parts
+raise
+indebug(op.ui, 'ignoring unsupported advisory part %s' % exc)
+return # skip to part processing
+finally:
+if op.ui.debugflag:
+msg = ['bundle2-input-part: "%s"' % part.type]
+if not part.mandatory:
+msg.append(' (advisory)')
+nbmp = len(part.mandatorykeys)
+nbap = len(part.params) - nbmp
+if nbmp or nbap:
+msg.append(' (params:')
+if nbmp:
+msg.append(' %i mandatory' % nbmp)
+if nbap:
+msg.append(' %i advisory' % nbmp)
+msg.append(')')
+msg.append(' %s\n' % status)
+op.ui.debug(''.join(msg))
+
+return handler
+
 def _processpart(op, part):
 """process a single part from a bundle
 
 The part is guaranteed to have been fully consumed when the function exits
 (even if an exception is raised)."""
-status = 'unknown' # used by debug output
 try:
-try:
-handler = parthandlermapping.get(part.type)
-if handler is None:
-status = 'unsupported-type'
-raise error.BundleUnknownFeatureError(parttype=part.type)
-indebug(op.ui, 'found a handler for part %r' % part.type)
-unknownparams = part.mandatorykeys - handler.params
-if unknownparams:
-unknownparams = list(unknownparams)
-unknownparams.sort()
-status = 'unsupported-params (%s)' % unknownparams
-raise error.BundleUnknownFeatureError(parttype=part.type,
-  params=unknownparams)
-status = 'supported'
-except error.BundleUnknownFeatureError as exc:
-if part.mandatory: # mandatory parts
-raise
-indebug(op.ui, 'ignoring unsupported advisory part %s' % exc)
-return # skip to part processing
-finally:
-if op.ui.debugflag:
-msg = ['bundle2-input-part: "%s"' % part.type]
-if not part.mandatory:
-msg.append(' (advisory)')
-nbmp = len(part.mandatorykeys)
-nbap = len(part.params) - nbmp
-if nbmp or nbap:
-msg.append(' (params:')
-if nbmp:
-msg.append(' %i mandatory' % nbmp)
-if nbap:
-msg.append(' %i advisory' % nbmp)
-msg.append(')')
-msg.append(' %s\n' % status)
-op.ui.debug(''.join(msg))
+handler = _gethandler(op, part)
+if handler is None:
+return
 
 # handler is called outside the above try block so that we don't
 # risk catching KeyErrors from anything other than the



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


D704: bundle2: move part counter to partiterator

2017-09-13 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As part of moving the part iterator logic to a separate class, let's move the
  part counting logic and the output for it.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -348,14 +348,27 @@
 return op
 
 class partiterator(object):
-def __init__(self, unbundler):
+def __init__(self, repo, unbundler):
+self.repo = repo
 self.unbundler = unbundler
+self.iterator = None
+self.count = 0
 
 def __enter__(self):
-return enumerate(self.unbundler.iterparts())
+def func():
+itr = enumerate(self.unbundler.iterparts())
+for count, p in itr:
+self.count = count
+yield p
+self.iterator = func()
+return self.iterator
 
 def __exit__(self, type, value, tb):
-pass
+if not self.iterator:
+return
+
+self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' %
+   self.count)
 
 def processbundle(repo, unbundler, transactiongetter=None, op=None):
 """This function process a bundle, apply effect to/from a repo
@@ -389,11 +402,10 @@
 msg.append('\n')
 repo.ui.debug(''.join(msg))
 
-with partiterator(unbundler) as parts:
+with partiterator(repo, unbundler) as parts:
 part = None
-nbpart = 0
 try:
-for nbpart, part in parts:
+for part in parts:
 _processpart(op, part)
 except Exception as exc:
 # Any exceptions seeking to the end of the bundle at this point are
@@ -403,7 +415,7 @@
 # re-raise the original error.
 seekerror = False
 try:
-for nbpart, part in parts:
+for part in parts:
 # consume the bundle content
 part.seek(0, 2)
 except Exception:
@@ -429,8 +441,6 @@
 raise exc
 else:
 raise
-finally:
-repo.ui.debug('bundle2-input-bundle: %i parts total\n' % nbpart)
 
 return op
 



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


D709: bundle2: move part processing to a separate function

2017-09-13 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Now that the part processing loop is tiny, let's move it to a separate 
function.
  This will allow extensions to completely replace the part processing logic,
  without having to replace the overall bundle processing logic or the stream
  maintenance logic.
  
  This will be useful for the infinitepush extension, so it can completely take
  over receiving a bundle and rerouting it to a side store. This will also make 
it
  easier to upstream the infinitepush functionality later.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -447,12 +447,15 @@
 msg.append('\n')
 repo.ui.debug(''.join(msg))
 
+processparts(repo, op, unbundler)
+
+return op
+
+def processparts(repo, op, unbundler):
 with partiterator(repo, op, unbundler) as parts:
 for part in parts:
 _processpart(op, part)
 
-return op
-
 def _processchangegroup(op, cg, tr, source, url, **kwargs):
 ret = cg.apply(op.repo, tr, source, url, **kwargs)
 op.records.add('changegroup', {



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


D705: bundle2: move exception handling into part iterator

2017-09-13 Thread durham (Durham Goode)
durham created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As part of separating the part iteration logic from the part handling logic,
  let's move the exception handling to the part iterator class.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -348,8 +348,9 @@
 return op
 
 class partiterator(object):
-def __init__(self, repo, unbundler):
+def __init__(self, repo, op, unbundler):
 self.repo = repo
+self.op = op
 self.unbundler = unbundler
 self.iterator = None
 self.count = 0
@@ -363,10 +364,43 @@
 self.iterator = func()
 return self.iterator
 
-def __exit__(self, type, value, tb):
+def __exit__(self, type, exc, tb):
 if not self.iterator:
 return
 
+if exc:
+# Any exceptions seeking to the end of the bundle at this point are
+# almost certainly related to the underlying stream being bad.
+# And, chances are that the exception we're handling is related to
+# getting in that bad state. So, we swallow the seeking error and
+# re-raise the original error.
+seekerror = False
+try:
+for part in self.iterator:
+# consume the bundle content
+part.seek(0, 2)
+except Exception:
+seekerror = True
+
+# Small hack to let caller code distinguish exceptions from bundle2
+# processing from processing the old format. This is mostly needed
+# to handle different return codes to unbundle according tothe type
+# of bundle. We should probably clean up or drop this return code
+# craziness in a future version.
+exc.duringunbundle2 = True
+salvaged = []
+replycaps = None
+if self.op.reply is not None:
+salvaged = self.op.reply.salvageoutput()
+replycaps = self.op.reply.capabilities
+exc._replycaps = replycaps
+exc._bundle2salvagedoutput = salvaged
+
+# Re-raising from a variable loses the original stack. So only use
+# that form if we need to.
+if seekerror:
+raise exc
+
 self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' %
self.count)
 
@@ -402,45 +436,9 @@
 msg.append('\n')
 repo.ui.debug(''.join(msg))
 
-with partiterator(repo, unbundler) as parts:
-part = None
-try:
-for part in parts:
-_processpart(op, part)
-except Exception as exc:
-# Any exceptions seeking to the end of the bundle at this point are
-# almost certainly related to the underlying stream being bad.
-# And, chances are that the exception we're handling is related to
-# getting in that bad state. So, we swallow the seeking error and
-# re-raise the original error.
-seekerror = False
-try:
-for part in parts:
-# consume the bundle content
-part.seek(0, 2)
-except Exception:
-seekerror = True
-
-# Small hack to let caller code distinguish exceptions from bundle2
-# processing from processing the old format. This is mostly needed
-# to handle different return codes to unbundle according to the 
type
-# of bundle. We should probably clean up or drop this return code
-# craziness in a future version.
-exc.duringunbundle2 = True
-salvaged = []
-replycaps = None
-if op.reply is not None:
-salvaged = op.reply.salvageoutput()
-replycaps = op.reply.capabilities
-exc._replycaps = replycaps
-exc._bundle2salvagedoutput = salvaged
-
-# Re-raising from a variable loses the original stack. So only use
-# that form if we need to.
-if seekerror:
-raise exc
-else:
-raise
+with partiterator(repo, op, unbundler) as parts:
+for part in parts:
+_processpart(op, part)
 
 return op
 



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


D625: copytrace: use the full copytracing method if only drafts are involved

2017-09-13 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 1792.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D625?vs=1689=1792

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copytrace-heuristics.t

CHANGE DETAILS

diff --git a/tests/test-copytrace-heuristics.t 
b/tests/test-copytrace-heuristics.t
--- a/tests/test-copytrace-heuristics.t
+++ b/tests/test-copytrace-heuristics.t
@@ -589,3 +589,79 @@
   $ cd ..
   $ rm -rf server
   $ rm -rf repo
+
+Test full copytrace ability on draft branch
+---
+
+File directory and base name changed in same move
+  $ hg init repo
+  $ initclient repo
+  $ mkdir repo/dir1
+  $ cd repo/dir1
+  $ echo a > a
+  $ hg add a
+  $ hg ci -qm initial
+  $ cd ..
+  $ hg mv -q dir1 dir2
+  $ hg mv dir2/a dir2/b
+  $ hg ci -qm 'mv a b; mv dir1 dir2'
+  $ hg up -q '.^'
+  $ cd dir1
+  $ echo b >> a
+  $ cd ..
+  $ hg ci -qm 'mod a'
+
+  $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
+  @  changeset 6207d2d318e710b882e3d5ada2a89770efc42c96
+  |   desc mod a, phase: draft
+  | o  changeset abffdd4e3dfc04bc375034b970299b2a309a1cce
+  |/desc mv a b; mv dir1 dir2, phase: draft
+  o  changeset 81973cd24b58db2fdf18ce3d64fb2cc3284e9ab3
+  desc initial, phase: draft
+
+  $ hg rebase -s . -d 1
+  rebasing 2:6207d2d318e7 "mod a" (tip)
+  merging dir2/b and dir1/a to dir2/b
+  saved backup bundle to 
$TESTTMP/repo/repo/.hg/strip-backup/6207d2d318e7-1c9779ad-rebase.hg (glob)
+  $ cat dir2/b
+  a
+  b
+  $ cd ..
+  $ rm -rf server
+  $ rm -rf repo
+
+Move directory in one merge parent, while adding file to original directory
+in other merge parent. File moved on rebase.
+  $ hg init repo
+  $ initclient repo
+  $ mkdir repo/dir1
+  $ cd repo/dir1
+  $ echo dummy > dummy
+  $ hg add dummy
+  $ cd ..
+  $ hg ci -qm initial
+  $ cd dir1
+  $ echo a > a
+  $ hg add a
+  $ cd ..
+  $ hg ci -qm 'hg add dir1/a'
+  $ hg up -q '.^'
+  $ hg mv -q dir1 dir2
+  $ hg ci -qm 'mv dir1 dir2'
+
+  $ hg log -G -T 'changeset {node}\n desc {desc}, phase: {phase}\n'
+  @  changeset e8919e7df8d036e07b906045eddcd4a42ff1915f
+  |   desc mv dir1 dir2, phase: draft
+  | o  changeset 7c7c6f339be00f849c3cb2df738ca91db78b32c8
+  |/desc hg add dir1/a, phase: draft
+  o  changeset a235dcce55dcf42034c4e374cb200662d0bb4a13
+  desc initial, phase: draft
+
+  $ hg rebase -s . -d 1
+  rebasing 2:e8919e7df8d0 "mv dir1 dir2" (tip)
+  saved backup bundle to 
$TESTTMP/repo/repo/.hg/strip-backup/e8919e7df8d0-f62fab62-rebase.hg (glob)
+  $ ls dir2
+  a
+  dummy
+  $ rm -rf server
+  $ rm -rf repo
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -15,6 +15,7 @@
 match as matchmod,
 node,
 pathutil,
+phases,
 scmutil,
 util,
 )
@@ -367,10 +368,27 @@
 if copytracing == 'off':
 return {}, {}, {}, {}, {}
 elif copytracing == 'heuristics':
+# Do full copytracing if only drafts are involved as that will be fast
+# enough and will also cover the copies which can be missed by
+# heuristics
+if _isfullcopytraceable(c1, base):
+return _fullcopytracing(repo, c1, c2, base)
 return _heuristicscopytracing(repo, c1, c2, base)
 else:
 return _fullcopytracing(repo, c1, c2, base)
 
+def _isfullcopytraceable(c1, base):
+""" Checks that if base, source and destination are all draft branches, if
+yes let's use the full copytrace algorithm for increased capabilities since
+it will be fast enough.
+"""
+
+nonpublicphases = set([phases.draft, phases.secret])
+
+if (c1.phase() in nonpublicphases) and (base.phase() in nonpublicphases):
+return True
+return False
+
 def _fullcopytracing(repo, c1, c2, base):
 """ The full copytracing algorithm which finds all the new files that were
 added from merge base up to the top commit and for each file it checks if



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


D623: copytrace: move fast heuristic copytracing algorithm to core

2017-09-13 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 1791.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D623?vs=1688=1791

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

AFFECTED FILES
  mercurial/copies.py
  tests/test-copytrace-heuristics.t

CHANGE DETAILS

diff --git a/tests/test-copytrace-heuristics.t 
b/tests/test-copytrace-heuristics.t
new file mode 100644
--- /dev/null
+++ b/tests/test-copytrace-heuristics.t
@@ -0,0 +1,591 @@
+Test for the heuristic copytracing algorithm
+
+
+  $ cat >> $TESTTMP/copytrace.sh << '__EOF__'
+  > initclient() {
+  > cat >> $1/.hg/hgrc < [experimental]
+  > copytrace = heuristics
+  > EOF
+  > }
+  > __EOF__
+  $ . "$TESTTMP/copytrace.sh"
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > rebase=
+  > shelve=
+  > EOF
+
+Check filename heuristics (same dirname and same basename)
+  $ hg init server
+  $ cd server
+  $ echo a > a
+  $ mkdir dir
+  $ echo a > dir/file.txt
+  $ hg addremove
+  adding a
+  adding dir/file.txt
+  $ hg ci -m initial
+  $ hg mv a b
+  $ hg mv -q dir dir2
+  $ hg ci -m 'mv a b, mv dir/ dir2/'
+  $ cd ..
+  $ hg clone -q server repo
+  $ initclient repo
+  $ cd repo
+  $ hg up -q 0
+  $ echo b > a
+  $ echo b > dir/file.txt
+  $ hg ci -qm 'mod a, mod dir/file.txt'
+
+  $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
+  @  changeset: 557f403c0afd2a3cf15d7e2fb1f1001a8b85e081
+  |   desc: mod a, mod dir/file.txt, phase: draft
+  | o  changeset: 928d74bc9110681920854d845c06959f6dfc9547
+  |/desc: mv a b, mv dir/ dir2/, phase: public
+  o  changeset: 3c482b16e54596fed340d05ffaf155f156cda7ee
+  desc: initial, phase: public
+
+  $ hg rebase -s . -d 1
+  rebasing 2:557f403c0afd "mod a, mod dir/file.txt" (tip)
+  merging b and a to b
+  merging dir2/file.txt and dir/file.txt to dir2/file.txt
+  saved backup bundle to 
$TESTTMP/repo/.hg/strip-backup/557f403c0afd-9926eeff-rebase.hg (glob)
+  $ cd ..
+  $ rm -rf server
+  $ rm -rf repo
+
+Make sure filename heuristics do not when they are not related
+  $ hg init server
+  $ cd server
+  $ echo 'somecontent' > a
+  $ hg add a
+  $ hg ci -m initial
+  $ hg rm a
+  $ echo 'completelydifferentcontext' > b
+  $ hg add b
+  $ hg ci -m 'rm a, add b'
+  $ cd ..
+  $ hg clone -q server repo
+  $ initclient repo
+  $ cd repo
+  $ hg up -q 0
+  $ printf 'somecontent\nmoarcontent' > a
+  $ hg ci -qm 'mode a'
+
+  $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
+  @  changeset: d526312210b9e8f795d576a77dc643796384d86e
+  |   desc: mode a, phase: draft
+  | o  changeset: 46985f76c7e5e5123433527f5c8526806145650b
+  |/desc: rm a, add b, phase: public
+  o  changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
+  desc: initial, phase: public
+
+  $ hg rebase -s . -d 1
+  rebasing 2:d526312210b9 "mode a" (tip)
+  other [source] changed a which local [dest] deleted
+  use (c)hanged version, leave (d)eleted, or leave (u)nresolved? u
+  unresolved conflicts (see hg resolve, then hg rebase --continue)
+  [1]
+
+  $ cd ..
+  $ rm -rf server
+  $ rm -rf repo
+
+Test when lca didn't modified the file that was moved
+  $ hg init server
+  $ cd server
+  $ echo 'somecontent' > a
+  $ hg add a
+  $ hg ci -m initial
+  $ echo c > c
+  $ hg add c
+  $ hg ci -m randomcommit
+  $ hg mv a b
+  $ hg ci -m 'mv a b'
+  $ cd ..
+  $ hg clone -q server repo
+  $ initclient repo
+  $ cd repo
+  $ hg up -q 1
+  $ echo b > a
+  $ hg ci -qm 'mod a'
+
+  $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
+  @  changeset: 9d5cf99c3d9f8e8b05ba55421f7f56530cfcf3bc
+  |   desc: mod a, phase: draft
+  | o  changeset: d760186dd240fc47b91eb9f0b58b0002aaeef95d
+  |/desc: mv a b, phase: public
+  o  changeset: 48e1b6ba639d5d7fb313fa7989eebabf99c9eb83
+  |   desc: randomcommit, phase: public
+  o  changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
+  desc: initial, phase: public
+
+  $ hg rebase -s . -d 2
+  rebasing 3:9d5cf99c3d9f "mod a" (tip)
+  merging b and a to b
+  saved backup bundle to 
$TESTTMP/repo/.hg/strip-backup/9d5cf99c3d9f-f02358cc-rebase.hg (glob)
+  $ cd ..
+  $ rm -rf server
+  $ rm -rf repo
+
+Rebase "backwards"
+  $ hg init server
+  $ cd server
+  $ echo 'somecontent' > a
+  $ hg add a
+  $ hg ci -m initial
+  $ echo c > c
+  $ hg add c
+  $ hg ci -m randomcommit
+  $ hg mv a b
+  $ hg ci -m 'mv a b'
+  $ cd ..
+  $ hg clone -q server repo
+  $ initclient repo
+  $ cd repo
+  $ hg up -q 2
+  $ echo b > b
+  $ hg ci -qm 'mod b'
+
+  $ hg log -G -T 'changeset: {node}\n desc: {desc}, phase: {phase}\n'
+  @  changeset: fbe97126b3969056795c462a67d93faf13e4d298
+  |   desc: mod b, phase: draft
+  o  changeset: d760186dd240fc47b91eb9f0b58b0002aaeef95d
+  |   desc: mv a b, phase: public
+  o  changeset: 48e1b6ba639d5d7fb313fa7989eebabf99c9eb83
+  |   desc: randomcommit, phase: public
+  o  changeset: e5b71fb099c29d9172ef4a23485aaffd497e4cc0
+  desc: initial, phase: public
+
+  $ hg 

[Bug 5678] New: Phase of public revisions reset to draft after rebasing a draft rev. on top of the public head

2017-09-13 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5678

Bug ID: 5678
   Summary: Phase of public revisions reset to draft after
rebasing a draft rev. on top of the public head
   Product: Mercurial
   Version: 4.3
  Hardware: Macintosh
OS: Mac OS
Status: UNCONFIRMED
  Keywords: regression
  Severity: bug
  Priority: urgent
 Component: rebase
  Assignee: bugzi...@mercurial-scm.org
  Reporter: mmn100+sele...@gmail.com
CC: gregory.sz...@gmail.com,
mercurial-devel@mercurial-scm.org

STR:

$ hg log --graph --rev=wip --template "{rev} {phase} {firstline(desc)}\n"
> o  380545 public This is the public head
> :
> : @  380260 draft This is my draft commit
> :/
> o  380259 public This is the 2nd-last public commit
> |
> ~

$ hg rebase -s 380260 -d 380545
> rebasing 380260:7bf1ca063893 "This is my draft commit"
> saved backup bundle to 
> /Users/…/mozilla-central2/.hg/strip-backup/7bf1ca063893-565e6f60-rebase.hg


Expected result:

I can get to this state by doing a `hg pull` which seems to fix the phase info.

$ hg log --graph --rev=wip --template "{rev} {phase} {firstline(desc)}\n"
> @  380545 draft This is my draft commit
> |
> o  380544 public This is the public head
> |
> ~

Actual result: 

Note that revs that were previously public are now draft:

$ hg log --graph --rev=wip --template "{rev} {phase} {firstline(desc)}\n"   
> @  380545 draft This is my draft commit
> |
> o  380544 draft This is the public head
> |
> o  380543 draft This is the 2nd-last public commit
> |
> o380542 draft merge autoland to mozilla-central. r=merge a=merge
> |\
> | ~
> o  380541 draft Bug 1397717 - Using GenericPrinter for DEBUG-only C++ dump() 
> APIs;r=nbp
> |
> o  380540 draft Bug 1397141 - part8 : update test for video under 48x48. r=jya
> |
> o  380539 draft Bug 1397141 - part7 : update error description in MFR. r=jya
> |
> o  380538 draft Bug 1397141 - part6 : use MediaResult to replace nsresult 
> r=jya
> |
> ~

My coworker can also reproduce this with 4.3.1

Mercurial Distributed SCM (version 4.3.1)

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


D688: changegroup: remove changegroup dependency from revlog.addgroup

2017-09-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> changegroup.py:191-192
>  node, p1, p2, deltabase, cs, flags = self._deltaheader(header, 
> prevnode)
>  return {'node': node, 'p1': p1, 'p2': p2, 'cs': cs,
>  'deltabase': deltabase, 'delta': delta, 'flags': flags}
>  

This is now a little unnecessary, since the first thing you do is to put it 
back in a tuple (much like the output from _deltaheader). Still worth the 
complexity and performance cost for compatibility maybe or should we make this 
method return a tuple?

REPOSITORY
  rHG Mercurial

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

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


D688: changegroup: remove changegroup dependency from revlog.addgroup

2017-09-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc8b6ed51386b: changegroup: remove changegroup dependency 
from revlog.addgroup (authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D688?vs=1788=1790

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

AFFECTED FILES
  mercurial/changegroup.py
  mercurial/revlog.py
  tests/test-revlog-raw.py

CHANGE DETAILS

diff --git a/tests/test-revlog-raw.py b/tests/test-revlog-raw.py
--- a/tests/test-revlog-raw.py
+++ b/tests/test-revlog-raw.py
@@ -119,11 +119,28 @@
 'deltabase': rlog.node(deltaparent),
 'delta': rlog.revdiff(deltaparent, r)}
 
+def deltaiter(self, linkmapper):
+chain = None
+for chunkdata in iter(lambda: self.deltachunk(chain), {}):
+node = chunkdata['node']
+p1 = chunkdata['p1']
+p2 = chunkdata['p2']
+cs = chunkdata['cs']
+deltabase = chunkdata['deltabase']
+delta = chunkdata['delta']
+flags = chunkdata['flags']
+
+link = linkmapper(cs)
+chain = node
+
+yield (node, p1, p2, link, deltabase, delta, flags)
+
 def linkmap(lnode):
 return rlog.rev(lnode)
 
 dlog = newrevlog(destname, recreate=True)
-dlog.addgroup(dummychangegroup(), linkmap, tr)
+dummydeltas = dummychangegroup().deltaiter(linkmap)
+dlog.addgroup(dummydeltas, tr)
 return dlog
 
 def lowlevelcopy(rlog, tr, destname=b'_destrevlog.i'):
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1872,7 +1872,7 @@
 ifh.write(data[1])
 self.checkinlinesize(transaction, ifh)
 
-def addgroup(self, cg, linkmapper, transaction, addrevisioncb=None):
+def addgroup(self, deltas, transaction, addrevisioncb=None):
 """
 add a delta group
 
@@ -1905,20 +1905,12 @@
 ifh.flush()
 try:
 # loop through our set of deltas
-chain = None
-for chunkdata in iter(lambda: cg.deltachunk(chain), {}):
-node = chunkdata['node']
-p1 = chunkdata['p1']
-p2 = chunkdata['p2']
-cs = chunkdata['cs']
-deltabase = chunkdata['deltabase']
-delta = chunkdata['delta']
-flags = chunkdata['flags'] or REVIDX_DEFAULT_FLAGS
+for data in deltas:
+node, p1, p2, link, deltabase, delta, flags = data
+flags = flags or REVIDX_DEFAULT_FLAGS
 
 nodes.append(node)
-chain = node
 
-link = linkmapper(cs)
 if node in self.nodemap:
 # this can happen if two branches make the same change
 continue
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -245,7 +245,8 @@
 # no new manifest will be created and the manifest group will
 # be empty during the pull
 self.manifestheader()
-repo.manifestlog._revlog.addgroup(self, revmap, trp)
+deltas = self.deltaiter(revmap)
+repo.manifestlog._revlog.addgroup(deltas, trp)
 repo.ui.progress(_('manifests'), None)
 self.callback = None
 
@@ -307,7 +308,8 @@
 efiles.update(cl.readfiles(node))
 
 self.changelogheader()
-cgnodes = cl.addgroup(self, csmap, trp, addrevisioncb=onchangelog)
+deltas = self.deltaiter(csmap)
+cgnodes = cl.addgroup(deltas, trp, addrevisioncb=onchangelog)
 efiles = len(efiles)
 
 if not cgnodes:
@@ -428,6 +430,27 @@
 ret = deltaheads + 1
 return ret
 
+def deltaiter(self, linkmapper):
+"""
+returns an iterator of the deltas in this changegroup
+
+Useful for passing to the underlying storage system to be stored.
+"""
+chain = None
+for chunkdata in iter(lambda: self.deltachunk(chain), {}):
+node = chunkdata['node']
+p1 = chunkdata['p1']
+p2 = chunkdata['p2']
+cs = chunkdata['cs']
+deltabase = chunkdata['deltabase']
+delta = chunkdata['delta']
+flags = chunkdata['flags']
+
+link = linkmapper(cs)
+chain = node
+
+yield (node, p1, p2, link, deltabase, delta, flags)
+
 class cg2unpacker(cg1unpacker):
 """Unpacker for cg2 streams.
 
@@ -468,7 +491,8 @@
 d = chunkdata["filename"]
 repo.ui.debug("adding %s revisions\n" % d)
 dirlog = repo.manifestlog._revlog.dirlog(d)
-if not dirlog.addgroup(self, revmap, trp):
+deltas = 

D699: revlog: refactor chain variable

2017-09-13 Thread durham (Durham Goode)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGb96cfc309ac5: revlog: refactor chain variable (authored by 
durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D699?vs=1787=1789

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1916,11 +1916,11 @@
 flags = chunkdata['flags'] or REVIDX_DEFAULT_FLAGS
 
 nodes.append(node)
+chain = node
 
 link = linkmapper(cs)
 if node in self.nodemap:
 # this can happen if two branches make the same change
-chain = node
 continue
 
 for p in (p1, p2):
@@ -1954,13 +1954,13 @@
 # We're only using addgroup() in the context of changegroup
 # generation so the revision data can always be handled as raw
 # by the flagprocessor.
-chain = self._addrevision(node, None, transaction, link,
-  p1, p2, flags, (baserev, delta),
-  ifh, dfh,
-  alwayscache=bool(addrevisioncb))
+self._addrevision(node, None, transaction, link,
+  p1, p2, flags, (baserev, delta),
+  ifh, dfh,
+  alwayscache=bool(addrevisioncb))
 
 if addrevisioncb:
-addrevisioncb(self, chain)
+addrevisioncb(self, node)
 
 if not dfh and not self._inline:
 # addrevision switched from inline to conventional



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


D674: filemerge: use arbitraryfilectx for backup files

2017-09-13 Thread phillco (Phil Cohen)
phillco added inline comments.

INLINE COMMENTS

> martinvonz wrote in filemerge.py:744
> Can we not simply make arbitraryfilectx.cmp() something like
> 
>   def cmp(self, fctx):
>   if isinstance(fctx, arbitraryfilectx):
>   return filecmp.cmp(self.path(), fctx.path())
>   return self.data() != otherfilectx.data()

`fcd` is a `workingfilectx`, so it'd need to need to be something like:

  return filecmp.cmp(self.path(), self._repo.wjoin(fctx.path()))

and `arbitraryfilectx` doesn't have a `_repo` because we use it in 
`contrib/simplemerge`. Maybe we could make it an optional property and raise in 
this case if it's missing? `contrib/simplemerge` doesn't need it.

REPOSITORY
  rHG Mercurial

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

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


D699: revlog: refactor chain variable

2017-09-13 Thread durham (Durham Goode)
durham created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Previously the addgroup loop would set chain to be the result of
  self._addrevision(node,...). Since _addrevision now always returns the passed 
in
  node, we can drop that behavior and just always set chain = node in the loop.
  
  This will be useful in a future patch where we refactor the cg.deltachunk 
logic
  to another function and therefore chain disappears entirely from this 
function.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1916,11 +1916,11 @@
 flags = chunkdata['flags'] or REVIDX_DEFAULT_FLAGS
 
 nodes.append(node)
+chain = node
 
 link = linkmapper(cs)
 if node in self.nodemap:
 # this can happen if two branches make the same change
-chain = node
 continue
 
 for p in (p1, p2):
@@ -1954,13 +1954,13 @@
 # We're only using addgroup() in the context of changegroup
 # generation so the revision data can always be handled as raw
 # by the flagprocessor.
-chain = self._addrevision(node, None, transaction, link,
-  p1, p2, flags, (baserev, delta),
-  ifh, dfh,
-  alwayscache=bool(addrevisioncb))
+self._addrevision(node, None, transaction, link,
+  p1, p2, flags, (baserev, delta),
+  ifh, dfh,
+  alwayscache=bool(addrevisioncb))
 
 if addrevisioncb:
-addrevisioncb(self, chain)
+addrevisioncb(self, node)
 
 if not dfh and not self._inline:
 # addrevision switched from inline to conventional



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


D688: changegroup: remove changegroup dependency from revlog.addgroup

2017-09-13 Thread durham (Durham Goode)
durham updated this revision to Diff 1788.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D688?vs=1745=1788

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

AFFECTED FILES
  mercurial/changegroup.py
  mercurial/revlog.py
  tests/test-revlog-raw.py

CHANGE DETAILS

diff --git a/tests/test-revlog-raw.py b/tests/test-revlog-raw.py
--- a/tests/test-revlog-raw.py
+++ b/tests/test-revlog-raw.py
@@ -119,11 +119,28 @@
 'deltabase': rlog.node(deltaparent),
 'delta': rlog.revdiff(deltaparent, r)}
 
+def deltaiter(self, linkmapper):
+chain = None
+for chunkdata in iter(lambda: self.deltachunk(chain), {}):
+node = chunkdata['node']
+p1 = chunkdata['p1']
+p2 = chunkdata['p2']
+cs = chunkdata['cs']
+deltabase = chunkdata['deltabase']
+delta = chunkdata['delta']
+flags = chunkdata['flags']
+
+link = linkmapper(cs)
+chain = node
+
+yield (node, p1, p2, link, deltabase, delta, flags)
+
 def linkmap(lnode):
 return rlog.rev(lnode)
 
 dlog = newrevlog(destname, recreate=True)
-dlog.addgroup(dummychangegroup(), linkmap, tr)
+dummydeltas = dummychangegroup().deltaiter(linkmap)
+dlog.addgroup(dummydeltas, tr)
 return dlog
 
 def lowlevelcopy(rlog, tr, destname=b'_destrevlog.i'):
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1872,7 +1872,7 @@
 ifh.write(data[1])
 self.checkinlinesize(transaction, ifh)
 
-def addgroup(self, cg, linkmapper, transaction, addrevisioncb=None):
+def addgroup(self, deltas, transaction, addrevisioncb=None):
 """
 add a delta group
 
@@ -1905,20 +1905,12 @@
 ifh.flush()
 try:
 # loop through our set of deltas
-chain = None
-for chunkdata in iter(lambda: cg.deltachunk(chain), {}):
-node = chunkdata['node']
-p1 = chunkdata['p1']
-p2 = chunkdata['p2']
-cs = chunkdata['cs']
-deltabase = chunkdata['deltabase']
-delta = chunkdata['delta']
-flags = chunkdata['flags'] or REVIDX_DEFAULT_FLAGS
+for data in deltas:
+node, p1, p2, link, deltabase, delta, flags = data
+flags = flags or REVIDX_DEFAULT_FLAGS
 
 nodes.append(node)
-chain = node
 
-link = linkmapper(cs)
 if node in self.nodemap:
 # this can happen if two branches make the same change
 continue
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -245,7 +245,8 @@
 # no new manifest will be created and the manifest group will
 # be empty during the pull
 self.manifestheader()
-repo.manifestlog._revlog.addgroup(self, revmap, trp)
+deltas = self.deltaiter(revmap)
+repo.manifestlog._revlog.addgroup(deltas, trp)
 repo.ui.progress(_('manifests'), None)
 self.callback = None
 
@@ -307,7 +308,8 @@
 efiles.update(cl.readfiles(node))
 
 self.changelogheader()
-cgnodes = cl.addgroup(self, csmap, trp, addrevisioncb=onchangelog)
+deltas = self.deltaiter(csmap)
+cgnodes = cl.addgroup(deltas, trp, addrevisioncb=onchangelog)
 efiles = len(efiles)
 
 if not cgnodes:
@@ -428,6 +430,27 @@
 ret = deltaheads + 1
 return ret
 
+def deltaiter(self, linkmapper):
+"""
+returns an iterator of the deltas in this changegroup
+
+Useful for passing to the underlying storage system to be stored.
+"""
+chain = None
+for chunkdata in iter(lambda: self.deltachunk(chain), {}):
+node = chunkdata['node']
+p1 = chunkdata['p1']
+p2 = chunkdata['p2']
+cs = chunkdata['cs']
+deltabase = chunkdata['deltabase']
+delta = chunkdata['delta']
+flags = chunkdata['flags']
+
+link = linkmapper(cs)
+chain = node
+
+yield (node, p1, p2, link, deltabase, delta, flags)
+
 class cg2unpacker(cg1unpacker):
 """Unpacker for cg2 streams.
 
@@ -468,7 +491,8 @@
 d = chunkdata["filename"]
 repo.ui.debug("adding %s revisions\n" % d)
 dirlog = repo.manifestlog._revlog.dirlog(d)
-if not dirlog.addgroup(self, revmap, trp):
+deltas = self.deltaiter(revmap)
+if not dirlog.addgroup(deltas, trp):
 raise error.Abort(_("received dir revlog group is empty"))
 
 class headerlessfixup(object):
@@ 

D688: changegroup: remove changegroup dependency from revlog.addgroup

2017-09-13 Thread durham (Durham Goode)
durham planned changes to this revision.
durham added inline comments.

INLINE COMMENTS

> martinvonz wrote in revlog.py:1908
> nit: If I'm reading this right, you're implicitly saying that "chain" was 
> unnecessary before this patch too. Is that correct? If so, could you extract 
> that to separate patch and explain in the commit message why it's safe?

Not quite.  Chain is necessary for the cg.deltachunk call.  Since that call has 
moved, so has the chain declaration.

However, there is another spot below where I say it's unnecessary to store the 
result of 'self._addrevision(node, ...)', since it will always return node.  I 
could change that to just be `chain = none` in a separate diff.

REPOSITORY
  rHG Mercurial

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

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


D477: revlog: add option to mmap revlog index

2017-09-13 Thread mbthomas (Mark Thomas)
mbthomas updated this revision to Diff 1786.
mbthomas added a comment.


  Rebase and remove mmapindexthreshold from revlog object

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D477?vs=1297=1786

BRANCH
  mmap-revlog (bookmark) on default (branch)

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

AFFECTED FILES
  mercurial/changelog.py
  mercurial/localrepo.py
  mercurial/manifest.py
  mercurial/revlog.py
  tests/test-revlog-mmapindex.t

CHANGE DETAILS

diff --git a/tests/test-revlog-mmapindex.t b/tests/test-revlog-mmapindex.t
new file mode 100644
--- /dev/null
+++ b/tests/test-revlog-mmapindex.t
@@ -0,0 +1,54 @@
+create verbosemmap.py
+  $ cat << EOF > verbosemmap.py
+  > # extension to make util.mmapread verbose
+  > 
+  > from __future__ import absolute_import
+  > 
+  > from mercurial import (
+  > extensions,
+  > util,
+  > )
+  > 
+  > def mmapread(orig, fp):
+  > print "mmapping %s" % fp.name
+  > return orig(fp)
+  > 
+  > def extsetup(ui):
+  > extensions.wrapfunction(util, 'mmapread', mmapread)
+  > EOF
+
+setting up base repo
+  $ hg init a
+  $ cd a
+  $ touch a
+  $ hg add a
+  $ hg commit -qm base
+  $ for i in `seq 1 100` ; do
+  > echo $i > a
+  > hg commit -qm $i
+  > done
+
+set up verbosemmap extension
+  $ cat << EOF >> $HGRCPATH
+  > [extensions]
+  > verbosemmap=$TESTTMP/verbosemmap.py
+  > EOF
+
+mmap index which is now more than 4k long
+  $ hg log -l 5 -T '{rev}\n' --config experimental.mmapindexthreshold=4k
+  mmapping $TESTTMP/a/.hg/store/00changelog.i (glob)
+  100
+  99
+  98
+  97
+  96
+
+do not mmap index which is still less than 32k
+  $ hg log -l 5 -T '{rev}\n' --config experimental.mmapindexthreshold=32k
+  100
+  99
+  98
+  97
+  96
+
+  $ cd ..
diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -268,8 +268,13 @@
 
 If checkambig, indexfile is opened with checkambig=True at
 writing, to avoid file stat ambiguity.
+
+If mmaplargeindex is True, and an mmapindexthreshold is set, the
+index will be mmapped rather than read if it is larger than the
+configured threshold.
 """
-def __init__(self, opener, indexfile, datafile=None, checkambig=False):
+def __init__(self, opener, indexfile, datafile=None, checkambig=False,
+ mmaplargeindex=False):
 """
 create a revlog object
 
@@ -301,6 +306,7 @@
 self._compengine = 'zlib'
 self._maxdeltachainspan = -1
 
+mmapindexthreshold = None
 v = REVLOG_DEFAULT_VERSION
 opts = getattr(opener, 'options', None)
 if opts is not None:
@@ -323,6 +329,8 @@
 self._compengine = opts['compengine']
 if 'maxdeltachainspan' in opts:
 self._maxdeltachainspan = opts['maxdeltachainspan']
+if mmaplargeindex and 'mmapindexthreshold' in opts:
+mmapindexthreshold = opts['mmapindexthreshold']
 
 if self._chunkcachesize <= 0:
 raise RevlogError(_('revlog chunk cache size %r is not greater '
@@ -335,7 +343,11 @@
 self._initempty = True
 try:
 f = self.opener(self.indexfile)
-indexdata = f.read()
+if (mmapindexthreshold is not None and
+self.opener.fstat(f).st_size >= mmapindexthreshold):
+indexdata = util.buffer(util.mmapread(f))
+else:
+indexdata = f.read()
 f.close()
 if len(indexdata) > 0:
 v = versionformat_unpack(indexdata[:4])[0]
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1231,7 +1231,8 @@
 
 super(manifestrevlog, self).__init__(opener, indexfile,
  # only root indexfile is cached
- checkambig=not bool(dir))
+ checkambig=not bool(dir),
+ mmaplargeindex=True)
 
 @property
 def fulltextcache(self):
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -599,6 +599,10 @@
 chainspan = self.ui.configbytes('experimental', 'maxdeltachainspan', 
-1)
 if 0 <= chainspan:
 self.svfs.options['maxdeltachainspan'] = chainspan
+mmapindexthreshold = self.ui.configbytes('experimental',
+ 'mmapindexthreshold', None)
+if mmapindexthreshold is not None:
+self.svfs.options['mmapindexthreshold'] = mmapindexthreshold
 
 for r in self.requirements:
 if r.startswith('exp-compression-'):
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -275,7 +275,7 @@
 
 datafile = 

D476: util: add an mmapread method

2017-09-13 Thread mbthomas (Mark Thomas)
mbthomas updated this revision to Diff 1785.
mbthomas added a comment.


  Accept both file objects and fds

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D476?vs=1157=1785

BRANCH
  default

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -26,6 +26,7 @@
 import gc
 import hashlib
 import imp
+import mmap
 import os
 import platform as pyplatform
 import re as remod
@@ -407,6 +408,13 @@
 self._lenbuf += len(data)
 self._buffer.append(data)
 
+def mmapread(fp):
+try:
+fd = getattr(fp, 'fileno', lambda: fp)()
+return mmap.mmap(fd, 0, access=mmap.ACCESS_READ)
+except ValueError: # cannot mmap an empty file
+return ''
+
 def popen2(cmd, env=None, newlines=False):
 # Setting bufsize to -1 lets the system decide the buffer size.
 # The default for bufsize is 0, meaning unbuffered. This leads to



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


D674: filemerge: use arbitraryfilectx for backup files

2017-09-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added inline comments.

INLINE COMMENTS

> phillco wrote in filemerge.py:744
> Yes, and it's a bigger impact than past changes of this nature, since each 
> merged file, and its backup file, will be read again. So I think we need some 
> way to reintroduce this fast-path for two disk-backed files inside `cmp`.
> 
> I'd propose adding something like this to `filectx`:
> 
>   def ondisk():
>  """Returns True iff this filectx is directly backed by a file in the 
> filesystem and not some other abstraction. If so, callers can run system file 
> functions on it for better performance.
>  """
> 
> It'd be True only for `workingfilectx`s and `abstractfilectx`s.
> 
> Then, inside `abstractfilectx.cmp()`, check if both the caller and other are 
> on-disk and use filecmp in that case.
> 
> It's a naive first take though, so improvements are appreciated.

Can we not simply make arbitraryfilectx.cmp() something like

  def cmp(self, fctx):
  if isinstance(fctx, arbitraryfilectx):
  return filecmp.cmp(self.path(), fctx.path())
  return self.data() != otherfilectx.data()

REPOSITORY
  rHG Mercurial

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

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


D663: dirstate: perform transactions with _map using single call, where possible

2017-09-13 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> dirstate.py:554
> +entry = self._map.get(d)
> +if entry is not None and entry != 'r':
>  raise error.Abort(

test-add.t fails here. It was `self[d]`, not `self._map[d]`.

REPOSITORY
  rHG Mercurial

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

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


D679: scmutil: don't append .orig to backups in origbackuppath

2017-09-13 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9e4f82bc2b0b: scmutil: dont append .orig to backups 
in origbackuppath (BC) (authored by mbthomas, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D679?vs=1716=1780#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D679?vs=1716=1780

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

AFFECTED FILES
  mercurial/help/config.txt
  mercurial/scmutil.py
  tests/test-largefiles-misc.t
  tests/test-merge-local.t
  tests/test-mq-qpush-fail.t
  tests/test-mq.t
  tests/test-resolve.t
  tests/test-revert.t
  tests/test-shelve.t
  tests/test-subrepo-git.t

CHANGE DETAILS

diff --git a/tests/test-subrepo-git.t b/tests/test-subrepo-git.t
--- a/tests/test-subrepo-git.t
+++ b/tests/test-subrepo-git.t
@@ -885,9 +885,9 @@
   $ hg revert --all --verbose --config 'ui.origbackuppath=.hg/origbackups'
   reverting subrepo ../gitroot
   creating directory: $TESTTMP/tc/.hg/origbackups (glob)
-  saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar.orig 
(glob)
+  saving current version of foobar as $TESTTMP/tc/.hg/origbackups/foobar (glob)
   $ ls .hg/origbackups
-  foobar.orig
+  foobar
   $ rm -rf .hg/origbackups
 
 show file at specific revision
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -1260,7 +1260,7 @@
   unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue')
   [1]
   $ ls .hg/origbackups
-  root.orig
+  root
   $ rm -rf .hg/origbackups
 
 test Abort unshelve always gets user out of the unshelved state
diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -92,7 +92,7 @@
   $ echo z > e
   $ hg revert --all -v --config 'ui.origbackuppath=.hg/origbackups'
   creating directory: $TESTTMP/repo/.hg/origbackups (glob)
-  saving current version of e as $TESTTMP/repo/.hg/origbackups/e.orig (glob)
+  saving current version of e as $TESTTMP/repo/.hg/origbackups/e (glob)
   reverting e
   $ rm -rf .hg/origbackups
 
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -255,8 +255,8 @@
   warning: conflicts while merging file2! (edit, then use 'hg resolve --mark')
   [1]
   $ ls .hg/origbackups
-  file1.orig
-  file2.orig
+  file1
+  file2
   $ grep '<<<' file1 > /dev/null
   $ grep '<<<' file2 > /dev/null
 
diff --git a/tests/test-mq.t b/tests/test-mq.t
--- a/tests/test-mq.t
+++ b/tests/test-mq.t
@@ -1388,7 +1388,7 @@
   $ hg qpush -f --verbose --config 'ui.origbackuppath=.hg/origbackups'
   applying empty
   creating directory: $TESTTMP/forcepush/.hg/origbackups (glob)
-  saving current version of hello.txt as 
$TESTTMP/forcepush/.hg/origbackups/hello.txt.orig (glob)
+  saving current version of hello.txt as 
$TESTTMP/forcepush/.hg/origbackups/hello.txt (glob)
   patching file hello.txt
   committing files:
   hello.txt
@@ -1422,7 +1422,7 @@
 test that the previous call to qpush with -f (--force) and --config actually 
put
 the orig files out of the working copy
   $ ls .hg/origbackups
-  hello.txt.orig
+  hello.txt
 
 test popping revisions not in working dir ancestry
 
diff --git a/tests/test-mq-qpush-fail.t b/tests/test-mq-qpush-fail.t
--- a/tests/test-mq-qpush-fail.t
+++ b/tests/test-mq-qpush-fail.t
@@ -465,7 +465,7 @@
 test previous qpop (with --force and --config) saved .orig files to where user
 wants them
   $ ls .hg/origbackups
-  b.orig
+  b
   $ rm -rf .hg/origbackups
 
   $ cd ..
diff --git a/tests/test-merge-local.t b/tests/test-merge-local.t
--- a/tests/test-merge-local.t
+++ b/tests/test-merge-local.t
@@ -110,7 +110,7 @@
 
 Are orig files from the last commit where we want them?
   $ ls .hg/origbackups
-  zzz2_merge_bad.orig
+  zzz2_merge_bad
 
   $ hg diff --nodates | grep "^[+-][^<>]"
   --- a/zzz1_merge_ok
diff --git a/tests/test-largefiles-misc.t b/tests/test-largefiles-misc.t
--- a/tests/test-largefiles-misc.t
+++ b/tests/test-largefiles-misc.t
@@ -528,13 +528,13 @@
   $ echo moremore >> anotherlarge
   $ hg revert anotherlarge -v --config 'ui.origbackuppath=.hg/origbackups'
   creating directory: $TESTTMP/addrm2/.hg/origbackups/.hglf/sub (glob)
-  saving current version of ../.hglf/sub/anotherlarge as 
$TESTTMP/addrm2/.hg/origbackups/.hglf/sub/anotherlarge.orig (glob)
+  saving current version of ../.hglf/sub/anotherlarge as 
$TESTTMP/addrm2/.hg/origbackups/.hglf/sub/anotherlarge (glob)
   reverting ../.hglf/sub/anotherlarge (glob)
   creating directory: $TESTTMP/addrm2/.hg/origbackups/sub (glob)
   found 90c622cf65cebe75c5842f9136c459333faf392e in store
   found 90c622cf65cebe75c5842f9136c459333faf392e in store
   $ ls ../.hg/origbackups/sub
-  anotherlarge.orig
+  anotherlarge
   $ cd ..
 
 Test glob logging from the root dir
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py

D680: scmutil: handle conflicting files and dirs in origbackuppath

2017-09-13 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> scmutil.py:570
> +# Remove any files that conflict with the backup file's path
> +for f in util.finddirs(fullorigpath):
> +if repo.vfs.exists(f):

Perhaps fullorigpath may be a Windows path, but util.finddirs()
can only handle internal path.

> scmutil.py:574
> +ui.note(_('removing conflicting file: %s\n') % f)
> +repo.vfs.unlink(f)
> +break

It shouldn't delete files out of the origbackuppath directory
even if the configured path points to (or under) a file.

Maybe we could use a new vfs dedicated to backup directory to
audit operations.

REPOSITORY
  rHG Mercurial

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

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


D679: scmutil: don't append .orig to backups in origbackuppath

2017-09-13 Thread yuja (Yuya Nishihara)
yuja accepted this revision.
yuja added a comment.
This revision is now accepted and ready to land.


  Marked as (BC) and queued, thanks.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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


Re: [PATCH 1 of 8] py3: fix type of regex literals in patch.py

2017-09-13 Thread Augie Fackler

> On Sep 13, 2017, at 09:04, Yuya Nishihara  wrote:
> 
> On Tue, 12 Sep 2017 23:00:03 -0400, Augie Fackler wrote:
>> On Sun, Sep 03, 2017 at 11:36:19PM +0900, Yuya Nishihara wrote:
>>> # HG changeset patch
>>> # User Yuya Nishihara 
>>> # Date 1504422735 -32400
>>> #  Sun Sep 03 16:12:15 2017 +0900
>>> # Node ID 313ecdde1470bb3a0e1f9beced7e596b8004e456
>>> # Parent  68afb88b51bb626cd25440e2df812f2306463b55
>>> py3: fix type of regex literals in patch.py
>> 
>> Series LGTM, but I can't get them to apply despite my best efforts. Resend?
> 
> This has been queued by Sean. Perhaps his email was bounced.

Argh. I'll look into whitelisting his domain on the hg server end.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D623: copytrace: move fast heuristic copytracing algorithm to core

2017-09-13 Thread yuja (Yuya Nishihara)
yuja requested changes to this revision.
yuja added a comment.
This revision now requires changes to proceed.


  I don't think we can just swap c1 and c2 because what we're calculating
  is the copy from c1 to c2, which is directed. Instead, maybe we can simply
  fall back to the "full" algorithm if base isn't in the c2 branch.
  
while ctx.rev() > base.rev():
...
if ctx != base:
switch to full copytracing

INLINE COMMENTS

> copies.py:634
> +changedfiles = set()
> +mdst = c1.manifest()
> +# Tell whether the base is ancestor of c2 or not

Nit: s/mdst/m1/

> copies.py:639
> +baserev = base.rev()
> +if c2rev < baserev and len(repo.revs('%s::%s' % (c2rev, baserev))) == 0:
> +baseancestor = False

- `len(smartset)` might be expensive, just evaluate it as boolean
- `repo.revs('%d::%d', c2rev, baserev)` should be safer

> copies.py:646
> +if not baseancestor:
> +c1, c2 = c2, c1
> +

I don't think we can do that, but if we could, we should swap
m1 and m2, too.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 1 of 8] py3: fix type of regex literals in patch.py

2017-09-13 Thread Yuya Nishihara
On Tue, 12 Sep 2017 23:00:03 -0400, Augie Fackler wrote:
> On Sun, Sep 03, 2017 at 11:36:19PM +0900, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara 
> > # Date 1504422735 -32400
> > #  Sun Sep 03 16:12:15 2017 +0900
> > # Node ID 313ecdde1470bb3a0e1f9beced7e596b8004e456
> > # Parent  68afb88b51bb626cd25440e2df812f2306463b55
> > py3: fix type of regex literals in patch.py
> 
> Series LGTM, but I can't get them to apply despite my best efforts. Resend?

This has been queued by Sean. Perhaps his email was bounced.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D614: registrar: make cmdtype an attribute of the function in registar.command

2017-09-13 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 1779.
pulkit edited the summary of this revision.
pulkit retitled this revision from "directaccess: make the hiddenlevel an 
attribute of the function" to "registrar: make cmdtype an attribute of the 
function in registar.command".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D614?vs=1731=1779

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

AFFECTED FILES
  mercurial/dispatch.py
  mercurial/registrar.py

CHANGE DETAILS

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -7,6 +7,8 @@
 
 from __future__ import absolute_import
 
+from .i18n import _
+
 from . import (
 configitems,
 error,
@@ -149,9 +151,14 @@
 def _doregister(self, func, name, options=(), synopsis=None,
 norepo=False, optionalrepo=False, inferrepo=False,
 cmdtype=cmdtype.UNRECOVERABLE_WRITE):
+possiblecmdtypes = set(['unrecoverable', 'recoverable', 'readonly'])
 func.norepo = norepo
 func.optionalrepo = optionalrepo
 func.inferrepo = inferrepo
+if cmdtype not in possiblecmdtypes:
+raise error.ProgrammingError(_("unknown cmdtype value '%s' for "
+"'%s' command") % (cmdtype, name))
+func.cmdtype = cmdtype
 if synopsis:
 self._table[name] = func, list(options), synopsis
 else:
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -488,7 +488,7 @@
 return aliasargs(self.fn, args)
 
 def __getattr__(self, name):
-adefaults = {r'norepo': True,
+adefaults = {r'norepo': True, r'cmdtype': 'unrecoverable',
  r'optionalrepo': False, r'inferrepo': False}
 if name not in adefaults:
 raise AttributeError(name)



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


D612: command: add a cmdtype argument to registrar.command

2017-09-13 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 1778.
pulkit edited the summary of this revision.
pulkit retitled this revision from "directaccess: add a hiddenlevel argument to 
registrar.command" to "command: add a cmdtype argument to registrar.command".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D612?vs=1730=1778

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

AFFECTED FILES
  mercurial/registrar.py

CHANGE DETAILS

diff --git a/mercurial/registrar.py b/mercurial/registrar.py
--- a/mercurial/registrar.py
+++ b/mercurial/registrar.py
@@ -104,6 +104,14 @@
 """
 pass
 
+class cmdtype(object):
+""" enum for the type of command which will tell whether the command is
+write, if so either recoverable or unrecoverable or just read only
+"""
+UNRECOVERABLE_WRITE = "unrecoverable"
+RECOVERABLE_WRITE = "recoverable"
+READ_ONLY = "readonly"
+
 class command(_funcregistrarbase):
 """Decorator to register a command function to table
 
@@ -132,10 +140,15 @@
 command line arguments. If True, arguments will be examined for potential
 repository locations. See ``findrepo()``. If a repository is found, it
 will be used.
+
+The cmdtype argument tells us the type of command that whether its a read
+only command, or a recoverable write command or an unrecoverable write
+command. The values of the argument should be one from the cmdtype enum.
 """
 
 def _doregister(self, func, name, options=(), synopsis=None,
-norepo=False, optionalrepo=False, inferrepo=False):
+norepo=False, optionalrepo=False, inferrepo=False,
+cmdtype=cmdtype.UNRECOVERABLE_WRITE):
 func.norepo = norepo
 func.optionalrepo = optionalrepo
 func.inferrepo = inferrepo
@@ -145,14 +158,6 @@
 self._table[name] = func, list(options)
 return func
 
-class cmdtype(object):
-""" enum for the type of command which will tell whether the command is
-write, if so either recoverable or unrecoverable or just read only
-"""
-UNRECOVERABLE_WRITE = "unrecoverable"
-RECOVERABLE_WRITE = "recoverable"
-READ_ONLY = "readonly"
-
 class revsetpredicate(_funcregistrarbase):
 """Decorator to register revset predicate
 



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


[PATCH V2] configitems: register the 'win32mbcs.encoding' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498787154 -7200
#  ven. juin 30 03:45:54 2017 +0200
# Node ID 5fb90f89802ce9428913ef67df6a96d66e218d51
# Parent  a763c891f36e55f4869f443c220227d1da747d18
# EXP-Topic config.register.win32mbcs
configitems: register the 'win32mbcs.encoding' config

diff -r a763c891f36e -r 5fb90f89802c hgext/win32mbcs.py
--- a/hgext/win32mbcs.pymar. sept. 05 15:18:45 2017 -0700
+++ b/hgext/win32mbcs.pyven. juin 30 03:45:54 2017 +0200
@@ -54,6 +54,7 @@
 encoding,
 error,
 pycompat,
+registrar,
 )
 
 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
@@ -62,6 +63,15 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+# Encoding.encoding may be updated by --encoding option.
+# Use a lambda do delay the resolution.
+configitem('win32mbcs', 'encoding',
+default=lambda: encoding.encoding,
+)
+
 _encoding = None# see extsetup
 
 def decode(arg):
@@ -175,7 +185,7 @@
 return
 # determine encoding for filename
 global _encoding
-_encoding = ui.config('win32mbcs', 'encoding', encoding.encoding)
+_encoding = ui.config('win32mbcs', 'encoding')
 # fake is only for relevant environment.
 if _encoding.lower() in problematic_encodings.split():
 for f in funcs.split():
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


4.4 Sprint Planning

2017-09-13 Thread Ryan McElroy

Greetings Mercurial Community!

As hopefully everyone is aware, the 4.4 sprint 
(https://www.mercurial-scm.org/wiki/4.4sprint) 
is coming up in two and 
a half weeks. Please make sure you have copied your name from the 
"Availability" list to the "Attendance" list if you are planning on 
coming (currently our confirmed numbers are about half of those a year 
ago in Paris and I'll confirming numbers would also be awesome).


As we have have learned from the past few sprints, a little bit of 
planning has helped us get the most out of these events. I wanted to 
propose a tentative schedule and solicit feedback now so we can hit the 
ground running when the sprint starts on Friday, September 29.


Once we agree on a schedule that at least most of us are okay with, I’ll 
add it to the sprint wiki. Also, Kostia Balytskyi and I are volunteering 
to help organize the sprint on-the-ground (to help ensure we’re covering 
as much ground as possible during the three days of the sprint).


# Proposed Schedule Draft

## Friday
9-10am arrive, get breakfast at FB office, mingle
10am-noon: Welcome and Status Updates
* state of the community (updates from the steering committee)
* state of the tooling (updates about the build bots and systems on 
mercurial-scm.org)
* state of the code (updates on statistics about code contributions and 
code review)

* state of hg at company X (BitBucket, Mozilla, Unity, Google, FB, etc)
noon-1:00pm: lunch at FB cafeteria
1:00-3:00pm: breakout sessions on major topics, with notetakers in 
etherpad (will use wiki ideas to pre-seed)

3:00-3:30: break
3:30-5:30: breakout sessions continue
5:30: order Saturday breakfast
6:00-evening: dinner at FB office, enjoy Dublin, etc

## Saturday
9-10am: arrive, eat breakfast, mingle
10am: order lunch
10:30am-noon: Tech Talks – interesting project presentations (will have 
sign ups before and at sprint)

noon-1:00pm: eat lunch
1:00-5:30 hackathon, fix some low-hanging bugs, implement some quick 
features, etc (needs reviewers!)

5:30: order Sunday breakfast
6:00-evening: dinner out in Dublin, enjoy the brisk Irish air, etc

## Sunday
9-10am: arrive, eat breakfast, mingle
10am: order lunch
10:30am-noon: Vision statements – directions we’d like to see mercurial 
go in the future (good idea?)

noon-1:00pm: eat lunch
1:00-3:00pm: breakout sessions
3:00-3:30: break
3:30-5:30: breakout sessions
5:30-evening: freedom!

Please help paint this bikeshed! All ideas will be considered.

I’m looking forward to seeing many of you in a couple of weeks!

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


[PATCH 26 of 27] configitems: register the 'convert.svn.startrev' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786606 -7200
#  ven. juin 30 03:36:46 2017 +0200
# Node ID 64be670052f552196c3a5dfb029f12fd6e54271b
# Parent  1014bb15cf2ec7e66e31332167ce7cefe42dda71
# EXP-Topic config.register.convert
configitems: register the 'convert.svn.startrev' config

diff -r 1014bb15cf2e -r 64be670052f5 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:36:36 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:36:46 2017 +0200
@@ -106,6 +106,9 @@
 configitem('convert', 'svn.debugsvnlog',
 default=True,
 )
+configitem('convert', 'svn.startrev',
+default=0,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r 1014bb15cf2e -r 64be670052f5 hgext/convert/subversion.py
--- a/hgext/convert/subversion.py   ven. juin 30 03:36:36 2017 +0200
+++ b/hgext/convert/subversion.py   ven. juin 30 03:36:46 2017 +0200
@@ -354,7 +354,7 @@
 
 self.trunkname = self.ui.config('convert', 'svn.trunk',
 'trunk').strip('/')
-self.startrev = self.ui.config('convert', 'svn.startrev', default=0)
+self.startrev = self.ui.config('convert', 'svn.startrev')
 try:
 self.startrev = int(self.startrev)
 if self.startrev < 0:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 23 of 27] configitems: register the 'convert.p4.startrev' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786580 -7200
#  ven. juin 30 03:36:20 2017 +0200
# Node ID 1acea52756eaf12d0bbff6d3fa93c0c89f51c907
# Parent  b36390e8baa1d2336b270f588724c6cb764ea9f7
# EXP-Topic config.register.convert
configitems: register the 'convert.p4.startrev' config

diff -r b36390e8baa1 -r 1acea52756ea hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:36:00 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:36:20 2017 +0200
@@ -97,6 +97,9 @@
 configitem('convert', 'localtimezone',
 default=False,
 )
+configitem('convert', 'p4.startrev',
+default=0,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r b36390e8baa1 -r 1acea52756ea hgext/convert/p4.py
--- a/hgext/convert/p4.py   ven. juin 30 03:36:00 2017 +0200
+++ b/hgext/convert/p4.py   ven. juin 30 03:36:20 2017 +0200
@@ -138,7 +138,7 @@
 vieworder.sort(key=len, reverse=True)
 
 # handle revision limiting
-startrev = self.ui.config('convert', 'p4.startrev', default=0)
+startrev = self.ui.config('convert', 'p4.startrev')
 
 # now read the full changelists to get the list of file revisions
 ui.status(_('collecting p4 changelists\n'))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 24 of 27] configitems: register the 'convert.skiptags' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786588 -7200
#  ven. juin 30 03:36:28 2017 +0200
# Node ID 90443693aa15334f563d3040531c5047533e28e0
# Parent  1acea52756eaf12d0bbff6d3fa93c0c89f51c907
# EXP-Topic config.register.convert
configitems: register the 'convert.skiptags' config

diff -r 1acea52756ea -r 90443693aa15 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:36:20 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:36:28 2017 +0200
@@ -100,6 +100,9 @@
 configitem('convert', 'p4.startrev',
 default=0,
 )
+configitem('convert', 'skiptags',
+default=False,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 25 of 27] configitems: register the 'convert.svn.debugsvnlog' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786596 -7200
#  ven. juin 30 03:36:36 2017 +0200
# Node ID 1014bb15cf2ec7e66e31332167ce7cefe42dda71
# Parent  90443693aa15334f563d3040531c5047533e28e0
# EXP-Topic config.register.convert
configitems: register the 'convert.svn.debugsvnlog' config

diff -r 90443693aa15 -r 1014bb15cf2e hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:36:28 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:36:36 2017 +0200
@@ -103,6 +103,9 @@
 configitem('convert', 'skiptags',
 default=False,
 )
+configitem('convert', 'svn.debugsvnlog',
+default=True,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r 90443693aa15 -r 1014bb15cf2e hgext/convert/subversion.py
--- a/hgext/convert/subversion.py   ven. juin 30 03:36:28 2017 +0200
+++ b/hgext/convert/subversion.py   ven. juin 30 03:36:36 2017 +0200
@@ -1059,7 +1059,7 @@
 args = [self.baseurl, relpaths, start, end, limit,
 discover_changed_paths, strict_node_history]
 # developer config: convert.svn.debugsvnlog
-if not self.ui.configbool('convert', 'svn.debugsvnlog', True):
+if not self.ui.configbool('convert', 'svn.debugsvnlog'):
 return directlogstream(*args)
 arg = encodeargs(args)
 hgexe = util.hgexecutable()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 18 of 27] configitems: register the 'convert.hg.startrev' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786529 -7200
#  ven. juin 30 03:35:29 2017 +0200
# Node ID e3fca664768b13f2a0c5e105270e8470c4c33547
# Parent  b72c9c2a8aac0b36023d5b3bc2536374416f5d1e
# EXP-Topic config.register.convert
configitems: register the 'convert.hg.startrev' config

diff -r b72c9c2a8aac -r e3fca664768b hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:35:22 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:35:29 2017 +0200
@@ -82,6 +82,9 @@
 configitem('convert', 'hg.sourcename',
 default=None,
 )
+configitem('convert', 'hg.startrev',
+default=None,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 15 of 27] configitems: register the 'convert.hg.revs' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786498 -7200
#  ven. juin 30 03:34:58 2017 +0200
# Node ID ec1265e10b50045c7889343ef431e974f906c5b9
# Parent  02ef13d05ad905d749dcb605ed97668f1a859630
# EXP-Topic config.register.convert
configitems: register the 'convert.hg.revs' config

diff -r 02ef13d05ad9 -r ec1265e10b50 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:34:49 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:34:58 2017 +0200
@@ -73,6 +73,9 @@
 configitem('convert', 'hg.ignoreerrors',
 default=False,
 )
+configitem('convert', 'hg.revs',
+default=None,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 20 of 27] configitems: register the 'convert.hg.usebranchnames' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786548 -7200
#  ven. juin 30 03:35:48 2017 +0200
# Node ID ca528d5a3dd22f4ed658d1fa269cbcc1526d196d
# Parent  1a45a9526e570e7b55c8d23470fa697f930e127c
# EXP-Topic config.register.convert
configitems: register the 'convert.hg.usebranchnames' config

diff -r 1a45a9526e57 -r ca528d5a3dd2 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:35:38 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:35:48 2017 +0200
@@ -88,6 +88,9 @@
 configitem('convert', 'hg.tagsbranch',
 default='default',
 )
+configitem('convert', 'hg.usebranchnames',
+default=True,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r 1a45a9526e57 -r ca528d5a3dd2 hgext/convert/hg.py
--- a/hgext/convert/hg.py   ven. juin 30 03:35:38 2017 +0200
+++ b/hgext/convert/hg.py   ven. juin 30 03:35:48 2017 +0200
@@ -47,7 +47,7 @@
 class mercurial_sink(common.converter_sink):
 def __init__(self, ui, path):
 common.converter_sink.__init__(self, ui, path)
-self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
+self.branchnames = ui.configbool('convert', 'hg.usebranchnames')
 self.clonebranches = ui.configbool('convert', 'hg.clonebranches')
 self.tagsbranch = ui.config('convert', 'hg.tagsbranch')
 self.lastbranch = None
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 22 of 27] configitems: register the 'convert.localtimezone' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786560 -7200
#  ven. juin 30 03:36:00 2017 +0200
# Node ID b36390e8baa1d2336b270f588724c6cb764ea9f7
# Parent  93f4d32f9b691daee2af94acf20006c07dfd4556
# EXP-Topic config.register.convert
configitems: register the 'convert.localtimezone' config

diff -r 93f4d32f9b69 -r b36390e8baa1 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:35:55 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:36:00 2017 +0200
@@ -94,6 +94,9 @@
 configitem('convert', 'ignoreancestorcheck',
 default=False,
 )
+configitem('convert', 'localtimezone',
+default=False,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 19 of 27] configitems: register the 'convert.hg.tagsbranch' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786538 -7200
#  ven. juin 30 03:35:38 2017 +0200
# Node ID 1a45a9526e570e7b55c8d23470fa697f930e127c
# Parent  e3fca664768b13f2a0c5e105270e8470c4c33547
# EXP-Topic config.register.convert
configitems: register the 'convert.hg.tagsbranch' config

diff -r e3fca664768b -r 1a45a9526e57 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:35:29 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:35:38 2017 +0200
@@ -85,6 +85,9 @@
 configitem('convert', 'hg.startrev',
 default=None,
 )
+configitem('convert', 'hg.tagsbranch',
+default='default',
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r e3fca664768b -r 1a45a9526e57 hgext/convert/hg.py
--- a/hgext/convert/hg.py   ven. juin 30 03:35:29 2017 +0200
+++ b/hgext/convert/hg.py   ven. juin 30 03:35:38 2017 +0200
@@ -49,7 +49,7 @@
 common.converter_sink.__init__(self, ui, path)
 self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
 self.clonebranches = ui.configbool('convert', 'hg.clonebranches')
-self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
+self.tagsbranch = ui.config('convert', 'hg.tagsbranch')
 self.lastbranch = None
 if os.path.isdir(path) and len(os.listdir(path)) > 0:
 try:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 11 of 27] configitems: register the 'convert.git.similarity' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786463 -7200
#  ven. juin 30 03:34:23 2017 +0200
# Node ID d9edf9dd29eaf07f75165e28fdbf13702d29ee55
# Parent  9610a6b85481b82d7285ef984b8007f89e97fd00
# EXP-Topic config.register.convert
configitems: register the 'convert.git.similarity' config

diff -r 9610a6b85481 -r d9edf9dd29ea hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:34:14 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:34:23 2017 +0200
@@ -61,6 +61,9 @@
 configitem('convert', 'git.saverev',
 default=True,
 )
+configitem('convert', 'git.similarity',
+default=50,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r 9610a6b85481 -r d9edf9dd29ea hgext/convert/git.py
--- a/hgext/convert/git.py  ven. juin 30 03:34:14 2017 +0200
+++ b/hgext/convert/git.py  ven. juin 30 03:34:23 2017 +0200
@@ -81,7 +81,7 @@
 path)
 
 # The default value (50) is based on the default for 'git diff'.
-similarity = ui.configint('convert', 'git.similarity', default=50)
+similarity = ui.configint('convert', 'git.similarity')
 if similarity < 0 or similarity > 100:
 raise error.Abort(_('similarity must be between 0 and 100'))
 if similarity > 0:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 13 of 27] configitems: register the 'convert.hg.clonebranches' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786485 -7200
#  ven. juin 30 03:34:45 2017 +0200
# Node ID bb608ac7127a42869504635109bc831fec38f7a0
# Parent  bf67fe8f61095494e07cc67369925273e9645354
# EXP-Topic config.register.convert
configitems: register the 'convert.hg.clonebranches' config

diff -r bf67fe8f6109 -r bb608ac7127a hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:34:32 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:34:45 2017 +0200
@@ -67,6 +67,9 @@
 configitem('convert', 'git.skipsubmodules',
 default=False,
 )
+configitem('convert', 'hg.clonebranches',
+default=False,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r bf67fe8f6109 -r bb608ac7127a hgext/convert/hg.py
--- a/hgext/convert/hg.py   ven. juin 30 03:34:32 2017 +0200
+++ b/hgext/convert/hg.py   ven. juin 30 03:34:45 2017 +0200
@@ -48,7 +48,7 @@
 def __init__(self, ui, path):
 common.converter_sink.__init__(self, ui, path)
 self.branchnames = ui.configbool('convert', 'hg.usebranchnames', True)
-self.clonebranches = ui.configbool('convert', 'hg.clonebranches', 
False)
+self.clonebranches = ui.configbool('convert', 'hg.clonebranches')
 self.tagsbranch = ui.config('convert', 'hg.tagsbranch', 'default')
 self.lastbranch = None
 if os.path.isdir(path) and len(os.listdir(path)) > 0:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 14 of 27] configitems: register the 'convert.hg.ignoreerrors' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786489 -7200
#  ven. juin 30 03:34:49 2017 +0200
# Node ID 02ef13d05ad905d749dcb605ed97668f1a859630
# Parent  bb608ac7127a42869504635109bc831fec38f7a0
# EXP-Topic config.register.convert
configitems: register the 'convert.hg.ignoreerrors' config

diff -r bb608ac7127a -r 02ef13d05ad9 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:34:45 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:34:49 2017 +0200
@@ -70,6 +70,9 @@
 configitem('convert', 'hg.clonebranches',
 default=False,
 )
+configitem('convert', 'hg.ignoreerrors',
+default=False,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r bb608ac7127a -r 02ef13d05ad9 hgext/convert/hg.py
--- a/hgext/convert/hg.py   ven. juin 30 03:34:45 2017 +0200
+++ b/hgext/convert/hg.py   ven. juin 30 03:34:49 2017 +0200
@@ -446,7 +446,7 @@
 class mercurial_source(common.converter_source):
 def __init__(self, ui, path, revs=None):
 common.converter_source.__init__(self, ui, path, revs)
-self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors', False)
+self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors')
 self.ignored = set()
 self.saverev = ui.configbool('convert', 'hg.saverev', False)
 try:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 17 of 27] configitems: register the 'convert.hg.sourcename' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786522 -7200
#  ven. juin 30 03:35:22 2017 +0200
# Node ID b72c9c2a8aac0b36023d5b3bc2536374416f5d1e
# Parent  7eb23ec158592611555de67654bfb88d671f9c52
# EXP-Topic config.register.convert
configitems: register the 'convert.hg.sourcename' config

diff -r 7eb23ec15859 -r b72c9c2a8aac hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:35:12 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:35:22 2017 +0200
@@ -79,6 +79,9 @@
 configitem('convert', 'hg.saverev',
 default=False,
 )
+configitem('convert', 'hg.sourcename',
+default=None,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 10 of 27] configitems: register the 'convert.git.saverev' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786454 -7200
#  ven. juin 30 03:34:14 2017 +0200
# Node ID 9610a6b85481b82d7285ef984b8007f89e97fd00
# Parent  1f322f5d18d0e2febbeca6479112cb8c6f30f64a
# EXP-Topic config.register.convert
configitems: register the 'convert.git.saverev' config

diff -r 1f322f5d18d0 -r 9610a6b85481 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:34:06 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:34:14 2017 +0200
@@ -58,6 +58,9 @@
 configitem('convert', 'git.renamelimit',
 default=400,
 )
+configitem('convert', 'git.saverev',
+default=True,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r 1f322f5d18d0 -r 9610a6b85481 hgext/convert/git.py
--- a/hgext/convert/git.py  ven. juin 30 03:34:06 2017 +0200
+++ b/hgext/convert/git.py  ven. juin 30 03:34:14 2017 +0200
@@ -372,7 +372,7 @@
 tzs, tzh, tzm = tz[-5:-4] + "1", tz[-4:-2], tz[-2:]
 tz = -int(tzs) * (int(tzh) * 3600 + int(tzm))
 date = tm + " " + str(tz)
-saverev = self.ui.configbool('convert', 'git.saverev', True)
+saverev = self.ui.configbool('convert', 'git.saverev')
 
 c = common.commit(parents=parents, date=date, author=author,
   desc=message,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 16 of 27] configitems: register the 'convert.hg.saverev' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786512 -7200
#  ven. juin 30 03:35:12 2017 +0200
# Node ID 7eb23ec158592611555de67654bfb88d671f9c52
# Parent  ec1265e10b50045c7889343ef431e974f906c5b9
# EXP-Topic config.register.convert
configitems: register the 'convert.hg.saverev' config

diff -r ec1265e10b50 -r 7eb23ec15859 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:34:58 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:35:12 2017 +0200
@@ -76,6 +76,9 @@
 configitem('convert', 'hg.revs',
 default=None,
 )
+configitem('convert', 'hg.saverev',
+default=False,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r ec1265e10b50 -r 7eb23ec15859 hgext/convert/hg.py
--- a/hgext/convert/hg.py   ven. juin 30 03:34:58 2017 +0200
+++ b/hgext/convert/hg.py   ven. juin 30 03:35:12 2017 +0200
@@ -448,7 +448,7 @@
 common.converter_source.__init__(self, ui, path, revs)
 self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors')
 self.ignored = set()
-self.saverev = ui.configbool('convert', 'hg.saverev', False)
+self.saverev = ui.configbool('convert', 'hg.saverev')
 try:
 self.repo = hg.repository(self.ui, path)
 # try to provoke an exception if this isn't really a hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 08 of 27] configitems: register the 'convert.git.remoteprefix' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786440 -7200
#  ven. juin 30 03:34:00 2017 +0200
# Node ID fb705634d0c19d20a5fbc12f26b1bfb6178f429e
# Parent  b3e4b98ffae06431ccf5d22e186f5eff955576c0
# EXP-Topic config.register.convert
configitems: register the 'convert.git.remoteprefix' config

diff -r b3e4b98ffae0 -r fb705634d0c1 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:33:51 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:34:00 2017 +0200
@@ -52,6 +52,9 @@
 configitem('convert', 'git.findcopiesharder',
 default=False,
 )
+configitem('convert', 'git.remoteprefix',
+default='remote',
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r b3e4b98ffae0 -r fb705634d0c1 hgext/convert/git.py
--- a/hgext/convert/git.py  ven. juin 30 03:33:51 2017 +0200
+++ b/hgext/convert/git.py  ven. juin 30 03:34:00 2017 +0200
@@ -446,7 +446,7 @@
 bookmarks = {}
 
 # Handle local and remote branches
-remoteprefix = self.ui.config('convert', 'git.remoteprefix', 'remote')
+remoteprefix = self.ui.config('convert', 'git.remoteprefix')
 reftypes = [
 # (git prefix, hg prefix)
 ('refs/remotes/origin/', remoteprefix + '/'),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 12 of 27] configitems: register the 'convert.git.skipsubmodules' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786472 -7200
#  ven. juin 30 03:34:32 2017 +0200
# Node ID bf67fe8f61095494e07cc67369925273e9645354
# Parent  d9edf9dd29eaf07f75165e28fdbf13702d29ee55
# EXP-Topic config.register.convert
configitems: register the 'convert.git.skipsubmodules' config

diff -r d9edf9dd29ea -r bf67fe8f6109 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:34:23 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:34:32 2017 +0200
@@ -64,6 +64,9 @@
 configitem('convert', 'git.similarity',
 default=50,
 )
+configitem('convert', 'git.skipsubmodules',
+default=False,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r d9edf9dd29ea -r bf67fe8f6109 hgext/convert/git.py
--- a/hgext/convert/git.py  ven. juin 30 03:34:23 2017 +0200
+++ b/hgext/convert/git.py  ven. juin 30 03:34:32 2017 +0200
@@ -261,8 +261,7 @@
 lcount = len(difftree)
 i = 0
 
-skipsubmodules = self.ui.configbool('convert', 'git.skipsubmodules',
-False)
+skipsubmodules = self.ui.configbool('convert', 'git.skipsubmodules')
 def add(entry, f, isdest):
 seen.add(f)
 h = entry[3]
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 04 of 27] configitems: register the 'convert.cvsps.mergeto' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786405 -7200
#  ven. juin 30 03:33:25 2017 +0200
# Node ID cb42d350be7955d112360633b3feb6e124dc55ca
# Parent  9902b23bdb4e92e48b0ce69f95cedc6ea55d53ca
# EXP-Topic config.register.convert
configitems: register the 'convert.cvsps.mergeto' config

diff -r 9902b23bdb4e -r cb42d350be79 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:33:15 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:33:25 2017 +0200
@@ -40,6 +40,9 @@
 configitem('convert', 'cvsps.mergefrom',
 default=None,
 )
+configitem('convert', 'cvsps.mergeto',
+default=None,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r 9902b23bdb4e -r cb42d350be79 hgext/convert/cvs.py
--- a/hgext/convert/cvs.py  ven. juin 30 03:33:15 2017 +0200
+++ b/hgext/convert/cvs.py  ven. juin 30 03:33:25 2017 +0200
@@ -81,7 +81,7 @@
 db = cvsps.createlog(self.ui, cache=cache)
 db = cvsps.createchangeset(self.ui, db,
 fuzz=int(self.ui.config('convert', 'cvsps.fuzz')),
-mergeto=self.ui.config('convert', 'cvsps.mergeto', None),
+mergeto=self.ui.config('convert', 'cvsps.mergeto'),
 mergefrom=self.ui.config('convert', 'cvsps.mergefrom'))
 
 for cs in db:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 01 of 27] configitems: register the 'convert.cvsps.cache' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786373 -7200
#  ven. juin 30 03:32:53 2017 +0200
# Node ID 30cdc4d4189ee6399c8a39d825333c0602244899
# Parent  24bf823377fcbf49fec9da8adb796924dff91c73
# EXP-Topic config.register.convert
configitems: register the 'convert.cvsps.cache' config

The convert extensions has code a bit all around, but it seems simpler to use a
central declaration of options at the root first.

diff -r 24bf823377fc -r 30cdc4d4189e hgext/convert/__init__.py
--- a/hgext/convert/__init__.py mar. sept. 12 19:27:01 2017 -0700
+++ b/hgext/convert/__init__.py ven. juin 30 03:32:53 2017 +0200
@@ -28,6 +28,13 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('convert', 'cvsps.cache',
+default=True,
+)
+
 # Commands definition was moved elsewhere to ease demandload job.
 
 @command('convert',
diff -r 24bf823377fc -r 30cdc4d4189e hgext/convert/cvs.py
--- a/hgext/convert/cvs.py  mar. sept. 12 19:27:01 2017 -0700
+++ b/hgext/convert/cvs.py  ven. juin 30 03:32:53 2017 +0200
@@ -76,7 +76,7 @@
 id = None
 
 cache = 'update'
-if not self.ui.configbool('convert', 'cvsps.cache', True):
+if not self.ui.configbool('convert', 'cvsps.cache'):
 cache = None
 db = cvsps.createlog(self.ui, cache=cache)
 db = cvsps.createchangeset(self.ui, db,
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 05 of 27] configitems: register the 'convert.git.committeractions' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786409 -7200
#  ven. juin 30 03:33:29 2017 +0200
# Node ID d2b588a305858f034453b20d7735f35c13d33fc8
# Parent  cb42d350be7955d112360633b3feb6e124dc55ca
# EXP-Topic config.register.convert
configitems: register the 'convert.git.committeractions' config

diff -r cb42d350be79 -r d2b588a30585 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:33:25 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:33:29 2017 +0200
@@ -43,6 +43,9 @@
 configitem('convert', 'cvsps.mergeto',
 default=None,
 )
+configitem('convert', 'git.committeractions',
+default=lambda: ['messagedifferent'],
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r cb42d350be79 -r d2b588a30585 hgext/convert/git.py
--- a/hgext/convert/git.py  ven. juin 30 03:33:25 2017 +0200
+++ b/hgext/convert/git.py  ven. juin 30 03:33:29 2017 +0200
@@ -110,8 +110,7 @@
 raise error.Abort(_('copying of extra key is forbidden: %s') %
   _(', ').join(sorted(banned)))
 
-committeractions = self.ui.configlist('convert', 
'git.committeractions',
-  'messagedifferent')
+committeractions = self.ui.configlist('convert', 
'git.committeractions')
 
 messagedifferent = None
 messagealways = None
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 09 of 27] configitems: register the 'convert.git.renamelimit' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786446 -7200
#  ven. juin 30 03:34:06 2017 +0200
# Node ID 1f322f5d18d0e2febbeca6479112cb8c6f30f64a
# Parent  fb705634d0c19d20a5fbc12f26b1bfb6178f429e
# EXP-Topic config.register.convert
configitems: register the 'convert.git.renamelimit' config

diff -r fb705634d0c1 -r 1f322f5d18d0 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:34:00 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:34:06 2017 +0200
@@ -55,6 +55,9 @@
 configitem('convert', 'git.remoteprefix',
 default='remote',
 )
+configitem('convert', 'git.renamelimit',
+default=400,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r fb705634d0c1 -r 1f322f5d18d0 hgext/convert/git.py
--- a/hgext/convert/git.py  ven. juin 30 03:34:00 2017 +0200
+++ b/hgext/convert/git.py  ven. juin 30 03:34:06 2017 +0200
@@ -90,8 +90,7 @@
 if findcopiesharder:
 self.simopt.append('--find-copies-harder')
 
-renamelimit = ui.configint('convert', 'git.renamelimit',
-   default=400)
+renamelimit = ui.configint('convert', 'git.renamelimit')
 self.simopt.append('-l%d' % renamelimit)
 else:
 self.simopt = []
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 03 of 27] configitems: register the 'convert.cvsps.mergefrom' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786395 -7200
#  ven. juin 30 03:33:15 2017 +0200
# Node ID 9902b23bdb4e92e48b0ce69f95cedc6ea55d53ca
# Parent  b0b81a60d458a9b1be73a21d94268735a5409626
# EXP-Topic config.register.convert
configitems: register the 'convert.cvsps.mergefrom' config

diff -r b0b81a60d458 -r 9902b23bdb4e hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:33:06 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:33:15 2017 +0200
@@ -37,6 +37,9 @@
 configitem('convert', 'cvsps.fuzz',
 default=60,
 )
+configitem('convert', 'cvsps.mergefrom',
+default=None,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r b0b81a60d458 -r 9902b23bdb4e hgext/convert/cvs.py
--- a/hgext/convert/cvs.py  ven. juin 30 03:33:06 2017 +0200
+++ b/hgext/convert/cvs.py  ven. juin 30 03:33:15 2017 +0200
@@ -82,7 +82,7 @@
 db = cvsps.createchangeset(self.ui, db,
 fuzz=int(self.ui.config('convert', 'cvsps.fuzz')),
 mergeto=self.ui.config('convert', 'cvsps.mergeto', None),
-mergefrom=self.ui.config('convert', 'cvsps.mergefrom', None))
+mergefrom=self.ui.config('convert', 'cvsps.mergefrom'))
 
 for cs in db:
 if maxrev and cs.id > maxrev:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 06 of 27] configitems: register the 'convert.git.extrakeys' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786421 -7200
#  ven. juin 30 03:33:41 2017 +0200
# Node ID 750a17e8dab48e75d5920a0e54a8c7d2cd84fceb
# Parent  d2b588a305858f034453b20d7735f35c13d33fc8
# EXP-Topic config.register.convert
configitems: register the 'convert.git.extrakeys' config

diff -r d2b588a30585 -r 750a17e8dab4 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:33:29 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:33:41 2017 +0200
@@ -46,6 +46,9 @@
 configitem('convert', 'git.committeractions',
 default=lambda: ['messagedifferent'],
 )
+configitem('convert', 'git.extrakeys',
+default=list,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 02 of 27] configitems: register the 'convert.cvsps.fuzz' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786386 -7200
#  ven. juin 30 03:33:06 2017 +0200
# Node ID b0b81a60d458a9b1be73a21d94268735a5409626
# Parent  30cdc4d4189ee6399c8a39d825333c0602244899
# EXP-Topic config.register.convert
configitems: register the 'convert.cvsps.fuzz' config

diff -r 30cdc4d4189e -r b0b81a60d458 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:32:53 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:33:06 2017 +0200
@@ -34,6 +34,9 @@
 configitem('convert', 'cvsps.cache',
 default=True,
 )
+configitem('convert', 'cvsps.fuzz',
+default=60,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r 30cdc4d4189e -r b0b81a60d458 hgext/convert/cvs.py
--- a/hgext/convert/cvs.py  ven. juin 30 03:32:53 2017 +0200
+++ b/hgext/convert/cvs.py  ven. juin 30 03:33:06 2017 +0200
@@ -80,7 +80,7 @@
 cache = None
 db = cvsps.createlog(self.ui, cache=cache)
 db = cvsps.createchangeset(self.ui, db,
-fuzz=int(self.ui.config('convert', 'cvsps.fuzz', 60)),
+fuzz=int(self.ui.config('convert', 'cvsps.fuzz')),
 mergeto=self.ui.config('convert', 'cvsps.mergeto', None),
 mergefrom=self.ui.config('convert', 'cvsps.mergefrom', None))
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 07 of 27] configitems: register the 'convert.git.findcopiesharder' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786431 -7200
#  ven. juin 30 03:33:51 2017 +0200
# Node ID b3e4b98ffae06431ccf5d22e186f5eff955576c0
# Parent  750a17e8dab48e75d5920a0e54a8c7d2cd84fceb
# EXP-Topic config.register.convert
configitems: register the 'convert.git.findcopiesharder' config

diff -r 750a17e8dab4 -r b3e4b98ffae0 hgext/convert/__init__.py
--- a/hgext/convert/__init__.py ven. juin 30 03:33:41 2017 +0200
+++ b/hgext/convert/__init__.py ven. juin 30 03:33:51 2017 +0200
@@ -49,6 +49,9 @@
 configitem('convert', 'git.extrakeys',
 default=list,
 )
+configitem('convert', 'git.findcopiesharder',
+default=False,
+)
 
 # Commands definition was moved elsewhere to ease demandload job.
 
diff -r 750a17e8dab4 -r b3e4b98ffae0 hgext/convert/git.py
--- a/hgext/convert/git.py  ven. juin 30 03:33:41 2017 +0200
+++ b/hgext/convert/git.py  ven. juin 30 03:33:51 2017 +0200
@@ -86,8 +86,7 @@
 raise error.Abort(_('similarity must be between 0 and 100'))
 if similarity > 0:
 self.simopt = ['-C%d%%' % similarity]
-findcopiesharder = ui.configbool('convert', 'git.findcopiesharder',
- False)
+findcopiesharder = ui.configbool('convert', 'git.findcopiesharder')
 if findcopiesharder:
 self.simopt.append('--find-copies-harder')
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 3] extensions: register config item early

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1504564453 -7200
#  mar. sept. 05 00:34:13 2017 +0200
# Node ID 2603449fbeb1c6af8c0e26f18eb4d12ea0ca7b5c
# Parent  61359c114a007e20e8d4799ab9b849d124ae9639
# EXP-Topic config.register.schedule
extensions: register config item early

Config items are likely to be used in during extensions setup. So we much
register them before that.

For example this apply to the 'win32text.warn' options.

diff -r 61359c114a00 -r 2603449fbeb1 mercurial/extensions.py
--- a/mercurial/extensions.py   mar. sept. 05 00:31:59 2017 +0200
+++ b/mercurial/extensions.py   mar. sept. 05 00:34:13 2017 +0200
@@ -232,6 +232,18 @@
 if isinstance(inst, error.Hint) and inst.hint:
 ui.warn(_("*** (%s)\n") % inst.hint)
 ui.traceback()
+# list of (objname, loadermod, loadername) tuple:
+# - objname is the name of an object in extension module,
+#   from which extra information is loaded
+# - loadermod is the module where loader is placed
+# - loadername is the name of the function,
+#   which takes (ui, extensionname, extraobj) arguments
+#
+# This one is for the list of item that must be run before running any 
setup
+earlyextraloaders = [
+('configtable', configitems, 'loadconfigtable'),
+]
+_loadextra(ui, newindex, earlyextraloaders)
 
 broken = set()
 for name in _order[newindex:]:
@@ -280,7 +292,6 @@
 extraloaders = [
 ('cmdtable', commands, 'loadcmdtable'),
 ('colortable', color, 'loadcolortable'),
-('configtable', configitems, 'loadconfigtable'),
 ('filesetpredicate', fileset, 'loadpredicate'),
 ('internalmerge', filemerge, 'loadinternalmerge'),
 ('revsetpredicate', revset, 'loadpredicate'),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 3] configitems: register the 'win32text.warn' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498787156 -7200
#  ven. juin 30 03:45:56 2017 +0200
# Node ID 2cf07eee9f82fcefb32b696929695de3b2c9f816
# Parent  2603449fbeb1c6af8c0e26f18eb4d12ea0ca7b5c
# EXP-Topic config.register.win32text
configitems: register the 'win32text.warn' config

diff -r 2603449fbeb1 -r 2cf07eee9f82 hgext/win32text.py
--- a/hgext/win32text.pymar. sept. 05 00:34:13 2017 +0200
+++ b/hgext/win32text.pyven. juin 30 03:45:56 2017 +0200
@@ -49,6 +49,7 @@
 short,
 )
 from mercurial import (
+registrar,
 util,
 )
 
@@ -58,6 +59,13 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('win32text', 'warn',
+default=True,
+)
+
 # regexp for single LF without CR preceding.
 re_single_lf = re.compile('(^|[^\r])\n', re.MULTILINE)
 
@@ -178,6 +186,6 @@
 
 def extsetup(ui):
 # deprecated config: win32text.warn
-if ui.configbool('win32text', 'warn', True):
+if ui.configbool('win32text', 'warn'):
 ui.warn(_("win32text is deprecated: "
   "https://mercurial-scm.org/wiki/Win32TextExtension\n;))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 3] extensions: factor extra data loading out

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1504564319 -7200
#  mar. sept. 05 00:31:59 2017 +0200
# Node ID 61359c114a007e20e8d4799ab9b849d124ae9639
# Parent  24bf823377fcbf49fec9da8adb796924dff91c73
# EXP-Topic config.register.schedule
extensions: factor extra data loading out

Some of the extra data need to be registered earlier than they currently are
(eg: config items). We first factor out the logic to registered them in a small
function before reusing it in the next changeset.

diff -r 24bf823377fc -r 61359c114a00 mercurial/extensions.py
--- a/mercurial/extensions.py   mar. sept. 12 19:27:01 2017 -0700
+++ b/mercurial/extensions.py   mar. sept. 05 00:31:59 2017 +0200
@@ -288,7 +288,9 @@
 ('templatefunc', templater, 'loadfunction'),
 ('templatekeyword', templatekw, 'loadkeyword'),
 ]
+_loadextra(ui, newindex, extraloaders)
 
+def _loadextra(ui, newindex, extraloaders):
 for name in _order[newindex:]:
 module = _extensions[name]
 if not module:
diff -r 24bf823377fc -r 61359c114a00 tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t   mar. sept. 12 19:27:01 2017 -0700
+++ b/tests/test-devel-warnings.t   mar. sept. 05 00:31:59 2017 +0200
@@ -242,8 +242,8 @@
   > EOF
 
   $ hg --config "extensions.buggyconfig=${TESTTMP}/buggyconfig.py" buggyconfig
-  devel-warn: extension 'buggyconfig' overwrite config item 'ui.interactive' 
at: */mercurial/extensions.py:* (loadall) (glob)
-  devel-warn: extension 'buggyconfig' overwrite config item 'ui.quiet' at: 
*/mercurial/extensions.py:* (loadall) (glob)
+  devel-warn: extension 'buggyconfig' overwrite config item 'ui.interactive' 
at: */mercurial/extensions.py:* (_loadextra) (glob)
+  devel-warn: extension 'buggyconfig' overwrite config item 'ui.quiet' at: 
*/mercurial/extensions.py:* (_loadextra) (glob)
   devel-warn: specifying a default value for a registered config item: 
'ui.quiet' 'False' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
   devel-warn: specifying a default value for a registered config item: 
'ui.interactive' 'None' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
   devel-warn: specifying a default value for a registered config item: 
'test.some' 'foo' at: $TESTTMP/buggyconfig.py:* (cmdbuggyconfig) (glob)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 4] configitems: register the 'mq.git' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786994 -7200
#  ven. juin 30 03:43:14 2017 +0200
# Node ID ea821914bb23ec4365dbd92ca1ef4d25c4e28fb2
# Parent  24bf823377fcbf49fec9da8adb796924dff91c73
# EXP-Topic config.register.mq
configitems: register the 'mq.git' config

diff -r 24bf823377fc -r ea821914bb23 hgext/mq.py
--- a/hgext/mq.py   mar. sept. 12 19:27:01 2017 -0700
+++ b/hgext/mq.py   ven. juin 30 03:43:14 2017 +0200
@@ -109,6 +109,13 @@
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('mq', 'git',
+default='auto',
+)
+
 # force load strip extension formerly included in mq and import some utility
 try:
 stripext = extensions.find('strip')
@@ -444,17 +451,14 @@
 self.activeguards = None
 self.guardsdirty = False
 # Handle mq.git as a bool with extended values
-try:
-gitmode = ui.configbool('mq', 'git', None)
-if gitmode is None:
-raise error.ConfigError
-if gitmode:
-self.gitmode = 'yes'
+gitmode = ui.config('mq', 'git').lower()
+boolmode = util.parsebool(gitmode)
+if boolmode is not None:
+if boolmode:
+gitmode = 'yes'
 else:
-self.gitmode = 'no'
-except error.ConfigError:
-# let's have check-config ignore the type mismatch
-self.gitmode = ui.config(r'mq', 'git', 'auto').lower()
+gitmode = 'no'
+self.gitmode = gitmode
 # deprecated config: mq.plain
 self.plainmode = ui.configbool('mq', 'plain', False)
 self.checkapplied = True
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 4] configitems: register the 'mq.keepchanges' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786995 -7200
#  ven. juin 30 03:43:15 2017 +0200
# Node ID 7989e079e5fa27b7b185df9b0a5b7b2a80e025f6
# Parent  ea821914bb23ec4365dbd92ca1ef4d25c4e28fb2
# EXP-Topic config.register.mq
configitems: register the 'mq.keepchanges' config

diff -r ea821914bb23 -r 7989e079e5fa hgext/mq.py
--- a/hgext/mq.py   ven. juin 30 03:43:14 2017 +0200
+++ b/hgext/mq.py   ven. juin 30 03:43:15 2017 +0200
@@ -115,6 +115,9 @@
 configitem('mq', 'git',
 default='auto',
 )
+configitem('mq', 'keepchanges',
+default=False,
+)
 
 # force load strip extension formerly included in mq and import some utility
 try:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 4] configitems: register the 'mq.plain' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786996 -7200
#  ven. juin 30 03:43:16 2017 +0200
# Node ID 50f09e900eb1a9b85b03c673922605fa4cebbe28
# Parent  7989e079e5fa27b7b185df9b0a5b7b2a80e025f6
# EXP-Topic config.register.mq
configitems: register the 'mq.plain' config

diff -r 7989e079e5fa -r 50f09e900eb1 hgext/mq.py
--- a/hgext/mq.py   ven. juin 30 03:43:15 2017 +0200
+++ b/hgext/mq.py   ven. juin 30 03:43:16 2017 +0200
@@ -118,6 +118,9 @@
 configitem('mq', 'keepchanges',
 default=False,
 )
+configitem('mq', 'plain',
+default=False,
+)
 
 # force load strip extension formerly included in mq and import some utility
 try:
@@ -463,7 +466,7 @@
 gitmode = 'no'
 self.gitmode = gitmode
 # deprecated config: mq.plain
-self.plainmode = ui.configbool('mq', 'plain', False)
+self.plainmode = ui.configbool('mq', 'plain')
 self.checkapplied = True
 
 @util.propertycache
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 4] configitems: register the 'mq.secret' config

2017-09-13 Thread Boris Feld
# HG changeset patch
# User Boris Feld 
# Date 1498786997 -7200
#  ven. juin 30 03:43:17 2017 +0200
# Node ID 548a8ce3885acf89786890c944ac62276635
# Parent  50f09e900eb1a9b85b03c673922605fa4cebbe28
# EXP-Topic config.register.mq
configitems: register the 'mq.secret' config

diff -r 50f09e900eb1 -r 548a8ce3 hgext/mq.py
--- a/hgext/mq.py   ven. juin 30 03:43:16 2017 +0200
+++ b/hgext/mq.py   ven. juin 30 03:43:17 2017 +0200
@@ -121,6 +121,9 @@
 configitem('mq', 'plain',
 default=False,
 )
+configitem('mq', 'secret',
+default=False,
+)
 
 # force load strip extension formerly included in mq and import some utility
 try:
@@ -419,7 +422,7 @@
 """
 repo = repo.unfiltered()
 if phase is None:
-if repo.ui.configbool('mq', 'secret', False):
+if repo.ui.configbool('mq', 'secret'):
 phase = phases.secret
 overrides = {('ui', 'allowemptycommit'): True}
 if phase is not None:
@@ -1059,7 +1062,7 @@
 repo._phasecache
 patches = self._revpatches(repo, sorted(revs))
 qfinished = self._cleanup(patches, len(patches))
-if qfinished and repo.ui.configbool('mq', 'secret', False):
+if qfinished and repo.ui.configbool('mq', 'secret'):
 # only use this logic when the secret option is added
 oldqbase = repo[qfinished[0]]
 tphase = repo.ui.config('phases', 'new-commit', phases.draft)
@@ -2164,7 +2167,7 @@
 self.added.append(patchname)
 imported.append(patchname)
 patchname = None
-if rev and repo.ui.configbool('mq', 'secret', False):
+if rev and repo.ui.configbool('mq', 'secret'):
 # if we added anything with --rev, move the secret root
 phases.retractboundary(repo, tr, phases.secret, [n])
 self.parseseries()
@@ -3423,7 +3426,7 @@
 def mqphasedefaults(repo, roots):
 """callback used to set mq changeset as secret when no phase data exists"""
 if repo.mq.applied:
-if repo.ui.configbool('mq', 'secret', False):
+if repo.ui.configbool('mq', 'secret'):
 mqphase = phases.secret
 else:
 mqphase = phases.draft
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel