Re: [PATCH] histedit: improve documentation and behaviour of dates (issue4820)

2017-02-19 Thread Ben Schmidt

It also adjusts and documents the new behaviour of 'roll'. It now fits nicely
with the behaviour of 'commit --amend' and the 'edit' action, by discarding the
date as well as the commit message of the second commit. Previously it used the
later date, like 'fold', but this often wasn't desirable, for example, in the
common use case of using 'roll' to add forgotten changes to a changeset
(because 'hg add' was previously forgotten or not all changes were identified
while using 'hg record').


This...could stand to be its own patch (generally any time a commit
message contains the word "also" that's a sign you've really got two patches).

I'm also not sure I'm sold: why shouldn't roll advance the date?


I originally added another action, 'amnd' for 'amend', but then
modifying 'roll' seemed equally appropriate, and with the benefit of not
adding another action. For some back-story, see:

https://bz.mercurial-scm.org/show_bug.cgi?id=4820

There was some brief discussion on this list a year ago:

https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-April/083475.html
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-April/083477.html
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-April/083488.html
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-April/083489.html

I recognise there are probably use cases for the current 'roll'
behaviour as well. What I'm primarily interested in is solving the
problems raised in the bug, so if we can do that another way, such as
adding a new action, that will satisfy me just fine.

Smiles,

Ben




diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -36,7 +36,7 @@
  #  p, pick = use commit
  #  e, edit = use commit, but stop for amending
  #  f, fold = use commit, but combine it with the one above
- #  r, roll = like fold, but discard this commit's description
+ #  r, roll = like fold, but discard this commit's description and date
  #  d, drop = remove commit from history
  #  m, mess = edit commit message without changing commit content
  #
@@ -58,7 +58,7 @@
  #  p, pick = use commit
  #  e, edit = use commit, but stop for amending
  #  f, fold = use commit, but combine it with the one above
- #  r, roll = like fold, but discard this commit's description
+ #  r, roll = like fold, but discard this commit's description and date
  #  d, drop = remove commit from history
  #  m, mess = edit commit message without changing commit content
  #
@@ -71,11 +71,11 @@
  ***
  Add delta

-Edit the commit message to your liking, then close the editor. For
-this example, let's assume that the commit message was changed to
-``Add beta and delta.`` After histedit has run and had a chance to
-remove any old or temporary revisions it needed, the history looks
-like this::
+Edit the commit message to your liking, then close the editor. The date used
+for the commit will be the later of the two commits' dates. For this example,
+let's assume that the commit message was changed to ``Add beta and delta.``
+After histedit has run and had a chance to remove any old or temporary
+revisions it needed, the history looks like this::

  @  2[tip]   989b4d060121   2009-04-27 18:04 -0500   durin42
  |Add beta and delta.
@@ -97,9 +97,10 @@
 allowing you to edit files freely, or even use ``hg record`` to commit
 some changes as a separate commit. When you're done, any remaining
 uncommitted changes will be committed as well. When done, run ``hg
-histedit --continue`` to finish this step. You'll be prompted for a
-new commit message, but the default commit message will be the
-original message for the ``edit`` ed revision.
+histedit --continue`` to finish this step. If there are uncommitted
+changes, you'll be prompted for a new commit message, but the default
+commit message will be the original message for the ``edit`` ed
+revision, and the date of the original commit will be preserved.

 The ``message`` operation will give you a chance to revise a commit
 message without changing the contents. It's a shortcut for doing
@@ -724,6 +725,15 @@
 """
 return True

+def firstdate(self):
+"""Returns true if the rule should preserve the date of the first
+change.
+
+This exists mainly so that 'rollup' rules can be a subclass of
+'fold'.
+"""
+return False
+
 def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
 parent = ctx.parents()[0].node()
 repo.ui.pushbuffer()
@@ -742,7 +752,10 @@
 [oldctx.description()]) + '\n'
 commitopts['message'] = newmessage
 # date
-commitopts['date'] = max(ctx.date(), oldctx.date())
+if self.firstdate():
+commitopts['date'] = ctx.date()
+else:
+commitopts['date'] = max(ctx.date(), oldctx.date())
 extra = ctx.extra().copy()
 # histedit_source
 # note: ctx is likely a temporary commit 

Re: [PATCH] histedit: improve documentation and behaviour of dates (issue4820)

2017-02-19 Thread Augie Fackler

> On Feb 20, 2017, at 12:00 AM, timeless  wrote:
> 
> Fwiw, recently someone identified that if's are roughly as expensive
> as method calls.
> 
> I /think/ that means it'd be better for:
> +if self.firstdate():
> +commitopts['date'] = ctx.date()
> +else:
> +commitopts['date'] = max(ctx.date(), oldctx.date())
> 
> to be managed as:
> 
> def date(self, ctx, oldctx):
>   return ctx.date()
> 
> def date(self, ctx, oldctx):
>return max(ctx.date(), oldctx.date())

Maybe. I’d do whatever’s architecturally more readable without concern for 
performance here, since it’s histedit and we’ll be doing this computation ~once 
a commit. The overhead of an extra function call is minor compared to the disk 
IO that implies.

AF

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


Re: [PATCH] histedit: improve documentation and behaviour of dates (issue4820)

2017-02-19 Thread timeless
Fwiw, recently someone identified that if's are roughly as expensive
as method calls.

I /think/ that means it'd be better for:
+if self.firstdate():
+commitopts['date'] = ctx.date()
+else:
+commitopts['date'] = max(ctx.date(), oldctx.date())

to be managed as:

def date(self, ctx, oldctx):
   return ctx.date()

def date(self, ctx, oldctx):
return max(ctx.date(), oldctx.date())
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] bookmarks: fix HG_PENDING handling

2017-02-19 Thread timeless
fwiw, I really don't have the resources to push either of these forward.

I was just trying to call attention to the problem.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] histedit: improve documentation and behaviour of dates (issue4820)

2017-02-19 Thread Ben Schmidt

On 20/02/2017 12:39 pm, Augie Fackler wrote:

On Feb 19, 2017, at 8:23 PM, Augie Fackler  wrote:
On Sun, Feb 19, 2017 at 02:51:46PM +1100, Ben Schmidt wrote:

# HG changeset patch
# User Ben Schmidt 
# Date 1487413828 -39600
#  Sat Feb 18 21:30:28 2017 +1100
# Node ID 4037ff1c9713d73b21ddc182580eacacba254ea7
# Parent  1f51b4658f21bbb797e922d155c1046eddccf91d
histedit: improve documentation and behaviour of dates (issue4820)

This clarifies in the histedit documentation that the 'edit' action preserves
the date and that the 'fold' action uses the later date. The documentation was
previously silent on this issue which left users in doubt.


Wow, that's a great fix.


I’m excited enough about this that I’ve done the split, see:

https://hg.durin42.com/hg-wip/log?rev=only%28histedit%29

With your permission, I’d like to just take that first patch (the documentation 
fix), and then we can discuss the behavior change to `roll` on the list as a 
followup. Sound good?


Yes, sorry I didn't split it. I did actually think of it, but about an
hour after I emailed the patch off.

Your split looks pretty good except for the commit messages. It's really
the alteration of the rollup behaviour that addresses issue4820, and of
course the description of that part of the change belongs with that
commit, but it's currently at the bottom of the commit for the doc
change.

But yes, feel free to go ahead and land that part, and we can continue
discussion of the other part.

Smiles,

Ben



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


[PATCH] run-tests: improve diff intelligence [RFC]

2017-02-19 Thread timeless
# HG changeset patch
# User timeless 
# Date 1487565093 0
#  Mon Feb 20 04:31:33 2017 +
# Node ID b04c501c22d75f368e69b3b533f71e16c17ea8b6
# Parent  693a5bb478543a986808264e586073a3ceedc38f
# Available At https://bitbucket.org/timeless/mercurial-crew
#  hg pull https://bitbucket.org/timeless/mercurial-crew -r 
b04c501c22d7
run-tests: improve diff intelligence [RFC]

This doesn't work w/ py3 (we'd have to talk to the underlying
differ).

This is based on a problem smf hit recently, which I hit
periodically.

diff -r 693a5bb47854 -r b04c501c22d7 tests/run-tests.py
--- a/tests/run-tests.pyMon Feb 13 17:03:14 2017 -0800
+++ b/tests/run-tests.pyMon Feb 20 04:31:33 2017 +
@@ -485,6 +485,34 @@
 
 return servefail, lines
 
+if not PYTHON3:
+def getmindiff(expected, output, ref, err):
+servefail = False
+stats = (len(expected) + len(output), 0, [])
+for n in range(4):
+lines = []
+change = 0
+neutral = 0
+for line in _unified_diff(expected, output, ref, err, n=n):
+if line.startswith(b'+++') or line.startswith(b'---'):
+line = line.replace(b'\\', b'/')
+if line.endswith(b' \n'):
+line = line[:-2] + b'\n'
+elif line.startswith(b'+') or line.startswith(b'-'):
+change += 1
+else:
+neutral += 1
+lines.append(line)
+if not servefail and line.startswith(
+ b'+  abort: child process failed to start'):
+servefail = True
+if change <= stats[0]:
+stats = (change, neutral, lines)
+lines = stats[-1]
+
+return servefail, lines
+getdiff = getmindiff
+
 verbose = False
 def vlog(*msg):
 """Log only when in verbose mode."""
diff -r 693a5bb47854 -r b04c501c22d7 tests/test-run-tests.t
--- a/tests/test-run-tests.tMon Feb 13 17:03:14 2017 -0800
+++ b/tests/test-run-tests.tMon Feb 20 04:31:33 2017 +
@@ -483,6 +483,35 @@
 (reinstall)
   $ mv backup test-failure.t
 
+#if no-py3k
+  $ cat > test-disparate-changes.t << EOF
+  >   $ echo 1
+  >   * (glob)
+  >   $ echo 1
+  >   1
+  >   $ echo 1
+  >   2
+  > EOF
+  $ echo n | rt -i test-disparate-changes.t
+  
+  --- $TESTTMP/test-disparate-changes.t
+  +++ $TESTTMP/test-disparate-changes.t.err
+  @@ -3,4 +3,4 @@
+ $ echo 1
+ 1
+ $ echo 1
+  -  2
+  +  1
+  Accept this change? [n] 
+  ERROR: test-disparate-changes.t output changed
+  !
+  Failed test-disparate-changes.t: output changed
+  # Ran 1 tests, 0 skipped, 0 warned, 1 failed.
+  python hash seed: * (glob)
+  [1]
+  $ rm test-disparate-changes.t
+#endif
+
 No Diff
 ===
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: RFC: bitmap storage for precursors and phases

2017-02-19 Thread Augie Fackler
On Fri, Feb 17, 2017 at 09:59:48PM +, Stanislau Hlebik wrote:
> Excerpts from Bryan O'Sullivan's message of 2017-02-17 13:29:58 -0800:
> > On Fri, Feb 17, 2017 at 10:30 AM, Jun Wu  wrote:
> >
> > > Excerpts from Stanislau Hlebik's message of 2017-02-17 11:24:34 +:
> > > > As I said before we will load all non-public revs in one set and all
> > >
> > > The problem is, loading a Python set from disk is O(size-of-the-set).
> > >
> > > Bitmap's loading cost should be basically 0 (with mmap). I think that's 
> > > why
> > > we want bitmap at the first place. There are other choices like packfile
> > > index, hash tables, but bitmap is the simplest and most efficient.
> > >
> >
> > Hey folks,
> >
> > I haven't yet seen mention of some considerations that seem very important
> > in driving the decision-making, so I'd appreciate it if someone could fill
> > me in.
> >
> > Firstly, what's our current understanding of the sizes and compositions of
> > these sets of numbers? In theory, we have a lot of data from practical
> > application at Facebook, but nobody's brought it up.
>
> I assume that both sets (set for nonpublic commits and set for
> obsstore) are going to be very small comparing to the repo size. I
> expect both sets < 1% of the repo size. And the sets is going to be
> sparse.

I replied elsewhere in the thread, but in my clone of hg it's on the
order of 25-30% of the history, so assuming it's going to be very
sparse is probably unwise.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: RFC: bitmap storage for precursors and phases

2017-02-19 Thread Augie Fackler
On Fri, Feb 17, 2017 at 07:14:12PM -0800, Jun Wu wrote:
> Excerpts from Bryan O'Sullivan's message of 2017-02-17 13:29:58 -0800:
> > I think there are multiple topics being discussed:
> >
> >   1. How to solve the overhead loading hiddenrevs with minimal changes?
> >   2. Why is the bitmap format interesting (future use-cases)?
> >
> For 2,
>
>   len(filteredrevs) in my hg-committed is 2155. It's small. I tend to think
>   about solutions that scale longer and are not too complex to build. That
>   may or may not be a good habit.
>

For what it's worth, my clone of hg has 12716 hidden revisions - about
a quarter of the entire repo history is hidden.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 3 of 3] (RFC) scmutil: proxy revrange() through repo to break import cycles

2017-02-19 Thread Augie Fackler
On Sun, Feb 19, 2017 at 10:12:06PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1487502018 -32400
> #  Sun Feb 19 20:00:18 2017 +0900
> # Node ID fd48908e928243b8d06faaef518f1b862d8f2579
> # Parent  85ab530251b2810e18339c13a0f95a4f02d7ab3a
> (RFC) scmutil: proxy revrange() through repo to break import cycles

Queued with delight. I'm more concerned about the cycles than I am
another small method on localrepo. Many thanks!

>
> This was one of the hardest import cycles as scmutil is widely used and
> revset functions are likely to depend on a variety of modules.
>
> New repo.anyrevs() does not expand user aliases by default to copy the
> behavior of the existing repo.revs(). I don't want to add new function to
> localrepository, but this function is quite similar to repo.revs() so it
> won't increase the complexity of the localrepository class so much.
>
> diff --git a/mercurial/destutil.py b/mercurial/destutil.py
> --- a/mercurial/destutil.py
> +++ b/mercurial/destutil.py
> @@ -12,6 +12,7 @@ from . import (
>  bookmarks,
>  error,
>  obsolete,
> +scmutil,
>  )
>
>  def _destupdateobs(repo, clean):
> @@ -342,9 +343,6 @@ histeditdefaultrevset = 'reverse(only(.)
>
>  def desthistedit(ui, repo):
>  """Default base revision to edit for `hg histedit`."""
> -# Avoid cycle: scmutil -> revset -> destutil
> -from . import scmutil
> -
>  default = ui.config('histedit', 'defaultrev', histeditdefaultrevset)
>  if default:
>  revs = scmutil.revrange(repo, [default])
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -577,7 +577,8 @@ class localrepository(object):
>  %-formatting to escape certain types. See ``revsetlang.formatspec``.
>
>  Revset aliases from the configuration are not expanded. To expand
> -user aliases, consider calling ``scmutil.revrange()``.
> +user aliases, consider calling ``scmutil.revrange()`` or
> +``repo.anyrevs([expr], user=True)``.
>
>  Returns a revset.abstractsmartset, which is a list-like interface
>  that contains integer revisions.
> @@ -598,6 +599,18 @@ class localrepository(object):
>  for r in self.revs(expr, *args):
>  yield self[r]
>
> +def anyrevs(self, specs, user=False):
> +'''Find revisions matching one of the given revsets.
> +
> +Revset aliases from the configuration are not expanded by default. To
> +expand user aliases, specify ``user=True``.
> +'''
> +if user:
> +m = revset.matchany(self.ui, specs, repo=self)
> +else:
> +m = revset.matchany(None, specs)
> +return m(self)
> +
>  def url(self):
>  return 'file:' + self.root
>
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -29,7 +29,6 @@ from . import (
>  pathutil,
>  phases,
>  pycompat,
> -revset,
>  revsetlang,
>  similar,
>  util,
> @@ -950,8 +949,7 @@ def revrange(repo, specs):
>  if isinstance(spec, int):
>  spec = revsetlang.formatspec('rev(%d)', spec)
>  allspecs.append(spec)
> -m = revset.matchany(repo.ui, allspecs, repo)
> -return m(repo)
> +return repo.anyrevs(allspecs, user=True)
>
>  def meaningfulparents(repo, ctx):
>  """Return list of meaningful (or all if debug) parentrevs for rev.
> diff --git a/mercurial/tags.py b/mercurial/tags.py
> --- a/mercurial/tags.py
> +++ b/mercurial/tags.py
> @@ -24,6 +24,7 @@ from .node import (
>  from . import (
>  encoding,
>  error,
> +scmutil,
>  util,
>  )
>
> @@ -277,8 +278,6 @@ def _readtagcache(ui, repo):
>  If the cache is not up to date, the caller is responsible for reading tag
>  info from each returned head. (See findglobaltags().)
>  '''
> -from . import scmutil  # avoid cycle
> -
>  try:
>  cachefile = repo.vfs(_filename(repo), 'r')
>  # force reading the file for static-http
> ___
> 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


Re: [PATCH] help: add pointer how to narrow list of resolved/unresolved files (issue5469)

2017-02-19 Thread Augie Fackler
On Sat, Feb 18, 2017 at 06:48:27PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1487408401 -32400
> #  Sat Feb 18 18:00:01 2017 +0900
> # Node ID ceef988474afe31056a2d8fcef67526cf43c2d6f
> # Parent  1ca3469fdd08c0d5d814a4bc359869bc157c7fc9
> help: add pointer how to narrow list of resolved/unresolved files (issue5469)

Queued, thanks.

>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -4259,6 +4259,8 @@ def resolve(ui, repo, *pats, **opts):
>
>  - :hg:`resolve -l`: list files which had or still have conflicts.
>In the printed list, ``U`` = unresolved and ``R`` = resolved.
> +  You can use ``set:unresolved()`` or ``set:resolved()`` to filter
> +  the list. See :hg:`help filesets` for details.
>
>  .. note::
>
> ___
> 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


Re: [PATCH] histedit: improve documentation and behaviour of dates (issue4820)

2017-02-19 Thread Augie Fackler

> On Feb 19, 2017, at 8:23 PM, Augie Fackler  wrote:
> 
> On Sun, Feb 19, 2017 at 02:51:46PM +1100, Ben Schmidt wrote:
>> # HG changeset patch
>> # User Ben Schmidt 
>> # Date 1487413828 -39600
>> #  Sat Feb 18 21:30:28 2017 +1100
>> # Node ID 4037ff1c9713d73b21ddc182580eacacba254ea7
>> # Parent  1f51b4658f21bbb797e922d155c1046eddccf91d
>> histedit: improve documentation and behaviour of dates (issue4820)
>> 
>> This clarifies in the histedit documentation that the 'edit' action preserves
>> the date and that the 'fold' action uses the later date. The documentation 
>> was
>> previously silent on this issue which left users in doubt.
> 
> Wow, that's a great fix.

I’m excited enough about this that I’ve done the split, see:

https://hg.durin42.com/hg-wip/log?rev=only%28histedit%29

With your permission, I’d like to just take that first patch (the documentation 
fix), and then we can discuss the behavior change to `roll` on the list as a 
followup. Sound good?

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


Re: [PATCH] histedit: improve documentation and behaviour of dates (issue4820)

2017-02-19 Thread Augie Fackler
On Sun, Feb 19, 2017 at 02:51:46PM +1100, Ben Schmidt wrote:
> # HG changeset patch
> # User Ben Schmidt 
> # Date 1487413828 -39600
> #  Sat Feb 18 21:30:28 2017 +1100
> # Node ID 4037ff1c9713d73b21ddc182580eacacba254ea7
> # Parent  1f51b4658f21bbb797e922d155c1046eddccf91d
> histedit: improve documentation and behaviour of dates (issue4820)
>
> This clarifies in the histedit documentation that the 'edit' action preserves
> the date and that the 'fold' action uses the later date. The documentation was
> previously silent on this issue which left users in doubt.

Wow, that's a great fix.

> It also adjusts and documents the new behaviour of 'roll'. It now fits nicely
> with the behaviour of 'commit --amend' and the 'edit' action, by discarding 
> the
> date as well as the commit message of the second commit. Previously it used 
> the
> later date, like 'fold', but this often wasn't desirable, for example, in the
> common use case of using 'roll' to add forgotten changes to a changeset
> (because 'hg add' was previously forgotten or not all changes were identified
> while using 'hg record').

This...could stand to be its own patch (generally any time a commit
message contains the word "also" that's a sign you've really got two patches).

I'm also not sure I'm sold: why shouldn't roll advance the date?

>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -36,7 +36,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> - #  r, roll = like fold, but discard this commit's description
> + #  r, roll = like fold, but discard this commit's description and date
>   #  d, drop = remove commit from history
>   #  m, mess = edit commit message without changing commit content
>   #
> @@ -58,7 +58,7 @@
>   #  p, pick = use commit
>   #  e, edit = use commit, but stop for amending
>   #  f, fold = use commit, but combine it with the one above
> - #  r, roll = like fold, but discard this commit's description
> + #  r, roll = like fold, but discard this commit's description and date
>   #  d, drop = remove commit from history
>   #  m, mess = edit commit message without changing commit content
>   #
> @@ -71,11 +71,11 @@
>   ***
>   Add delta
>
> -Edit the commit message to your liking, then close the editor. For
> -this example, let's assume that the commit message was changed to
> -``Add beta and delta.`` After histedit has run and had a chance to
> -remove any old or temporary revisions it needed, the history looks
> -like this::
> +Edit the commit message to your liking, then close the editor. The date used
> +for the commit will be the later of the two commits' dates. For this example,
> +let's assume that the commit message was changed to ``Add beta and delta.``
> +After histedit has run and had a chance to remove any old or temporary
> +revisions it needed, the history looks like this::
>
>   @  2[tip]   989b4d060121   2009-04-27 18:04 -0500   durin42
>   |Add beta and delta.
> @@ -97,9 +97,10 @@
>  allowing you to edit files freely, or even use ``hg record`` to commit
>  some changes as a separate commit. When you're done, any remaining
>  uncommitted changes will be committed as well. When done, run ``hg
> -histedit --continue`` to finish this step. You'll be prompted for a
> -new commit message, but the default commit message will be the
> -original message for the ``edit`` ed revision.
> +histedit --continue`` to finish this step. If there are uncommitted
> +changes, you'll be prompted for a new commit message, but the default
> +commit message will be the original message for the ``edit`` ed
> +revision, and the date of the original commit will be preserved.
>
>  The ``message`` operation will give you a chance to revise a commit
>  message without changing the contents. It's a shortcut for doing
> @@ -724,6 +725,15 @@
>  """
>  return True
>
> +def firstdate(self):
> +"""Returns true if the rule should preserve the date of the first
> +change.
> +
> +This exists mainly so that 'rollup' rules can be a subclass of
> +'fold'.
> +"""
> +return False
> +
>  def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
>  parent = ctx.parents()[0].node()
>  repo.ui.pushbuffer()
> @@ -742,7 +752,10 @@
>  [oldctx.description()]) + '\n'
>  commitopts['message'] = newmessage
>  # date
> -commitopts['date'] = max(ctx.date(), oldctx.date())
> +if self.firstdate():
> +commitopts['date'] = ctx.date()
> +else:
> +commitopts['date'] = max(ctx.date(), oldctx.date())
>  extra = ctx.extra().copy()
>  # histedit_source
>  # note: ctx is likely a temporary commit but that the best we can do
> @@ -809,7 +822,7 @@
>  return True
>

[PATCH 1 of 2 pager-tweaks] ui: rename neverpager to disablepager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1487553172 18000
#  Sun Feb 19 20:12:52 2017 -0500
# Node ID 147cbbe59b257eac92c779361894ae361a788f83
# Parent  2c9e619ba9ee8e72370cc0f27f59da39947773b6
ui: rename neverpager to disablepager

I agree this is a clearer name for this method.

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -750,7 +750,7 @@ def _dispatch(req):
 ui_.setconfig('ui', 'interactive', 'off', '-y')
 
 if options['pager'] != 'auto' and not util.parsebool(options['pager']):
-ui.neverpager()
+ui.disablepager()
 
 if cmdoptions.get('insecure', False):
 for ui_ in uis:
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -160,7 +160,7 @@ class ui(object):
 self.ferr = src.ferr
 self.fin = src.fin
 self.pageractive = src.pageractive
-self._neverpager = src._neverpager
+self._disablepager = src._disablepager
 
 self._tcfg = src._tcfg.copy()
 self._ucfg = src._ucfg.copy()
@@ -179,7 +179,7 @@ class ui(object):
 self.ferr = util.stderr
 self.fin = util.stdin
 self.pageractive = False
-self._neverpager = False
+self._disablepager = False
 
 # shared read-only environment
 self.environ = encoding.environ
@@ -838,8 +838,8 @@ class ui(object):
 return False
 return util.isatty(fh)
 
-def neverpager(self):
-self._neverpager = True
+def disablepager(self):
+self._disablepager = True
 
 def pager(self, command):
 """Start a pager for subsequent command output.
@@ -854,7 +854,7 @@ class ui(object):
   command: The full, non-aliased name of the command. That is, "log"
not "history, "summary" not "summ", etc.
 """
-if (self._neverpager
+if (self._disablepager
 or self.pageractive
 or command in self.configlist('pager', 'ignore')
 or not self.configbool('pager', 'attend-' + command, True)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2 pager-tweaks] dispatch: consolidate pager flag handling to a single place

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1487553371 18000
#  Sun Feb 19 20:16:11 2017 -0500
# Node ID 86a8d5ba8a05485fa1f90927c41ead4e7bb84b54
# Parent  147cbbe59b257eac92c779361894ae361a788f83
dispatch: consolidate pager flag handling to a single place

This makes a little more sense, thanks to Martin for suggesting it.

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -749,7 +749,10 @@ def _dispatch(req):
 for ui_ in uis:
 ui_.setconfig('ui', 'interactive', 'off', '-y')
 
-if options['pager'] != 'auto' and not util.parsebool(options['pager']):
+pagerbool = util.parsebool(options['pager'])
+if pagerbool:
+ui.pager('internal-always-' + cmd)
+elif options['pager'] != 'auto' and not pagerbool:
 ui.disablepager()
 
 if cmdoptions.get('insecure', False):
@@ -822,8 +825,6 @@ def _dispatch(req):
 
 def _runcommand(ui, options, cmd, cmdfunc):
 """Run a command function, possibly with profiling enabled."""
-if util.parsebool(options['pager']):
-ui.pager('internal-always-' + cmd)
 try:
 return cmdfunc()
 except error.SignatureError:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


mercurial@31013: 2 new changesets

2017-02-19 Thread Mercurial Commits
2 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/88358446da16
changeset:   31012:88358446da16
user:Rodrigo Damazio Bovendorp 
date:Mon Feb 13 15:39:29 2017 -0800
summary: match: adding support for matching files inside a directory

https://www.mercurial-scm.org/repo/hg/rev/693a5bb47854
changeset:   31013:693a5bb47854
bookmark:@
tag: tip
user:Rodrigo Damazio Bovendorp 
date:Mon Feb 13 17:03:14 2017 -0800
summary: match: making visitdir() deal with non-recursive entries

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


Re: [PATCH 07 of 10 ipv6 V2] tests: use LOCALIP

2017-02-19 Thread Augie Fackler

> On Feb 19, 2017, at 8:06 PM, Martin von Zweigbergk  
> wrote:
> 
> 
> 
> On Sun, Feb 19, 2017, 16:57 Augie Fackler  wrote:
>> On Feb 19, 2017, at 7:56 PM, Martin von Zweigbergk  
>> wrote:
>> 
>> 
>> 
>> On Sun, Feb 19, 2017, 16:47 Augie Fackler  wrote:
>> 
>> > On Feb 19, 2017, at 7:45 PM, Martin von Zweigbergk  
>> > wrote:
>> >
>> > There are two pieces to this patch. One part is about using the variable 
>> > in the tests. The other (which I actually moved here from patch 4/10) is 
>> > about matching test output containing the address against the variable by 
>> > name. How does it currently work (before this patch) that those FreeBSD 
>> > systems can connect when 127.0.0.1 is hardcoded in the test (such as 
>> > "get-with-headers.py 127.0.0.1:$HGPORT”)?
>> 
>> The jail subsystem transparently swaps out the loopback IP with the valid IP 
>> for the jail, in our jail’s case a 172.16.18/24 IP. The connection works, 
>> but hg then prints out the replacement IP if it inspects the socket to see 
>> what it connected to.
>> 
>> Oh, I see. So how do we fix this? Make LOCALIP match anything, simply? Just 
>> like 127.0.0.1 did after your patch.
> 
> That would work, but I think we could also not put $LOCALIP in any output and 
> instead match 127.0.0.1 with (glob) and the globbing would work out...
> 
> Matching 127.0.0.1 in ipv6 tests is a bit odd, so I'd vote for matching 
> $LOCALIP instead. That's how we do it with $HGPORT (we could have matched 
> 8000-8002 against $HGPORT-$HGPORT2, which would have been similarly odd).

That’s fine with me. Jun, can I convince you to take a look at making $LOCALIP 
a glob in the same manner as 127.0.0.1?

> 
>> 
>> 
>> >
>> > On Feb 19, 2017 15:32, "Augie Fackler"  wrote:
>> > On Fri, Feb 17, 2017 at 10:51:21AM -0800, Jun Wu wrote:
>> > > # HG changeset patch
>> > > # User Jun Wu 
>> > > # Date 1487266732 28800
>> > > #  Thu Feb 16 09:38:52 2017 -0800
>> > > # Node ID 1ea3da89ecc44b59e96cb366e6388c1ac178d3af
>> > > # Parent  bb7f41b2c8043a3115f242fb9b9f71ee461c93a9
>> > > # Available At https://bitbucket.org/quark-zju/hg-draft
>> > > #  hg pull https://bitbucket.org/quark-zju/hg-draft -r 
>> > > 1ea3da89ecc4
>> > > tests: use LOCALIP
>> > >
>> > > This patch replaces hardcoded 127.0.0.1 with $LOCALIP in all tests.
>> >
>> > This shouldn't have been required or done: 127.0.0.1 is a glob
>> > already[0], and this change is (I think) at fault for new failures on
>> > the freebsd builder[1].
>> >
>> > Can we figure out an approach that doesn't break the FreeBSD build?
>> >
>> > Thanks!
>> > Augie
>> >
>> > 0: https://www.mercurial-scm.org/repo/hg/rev/348b2b9da703
>> > 1: 
>> > https://buildbot.mercurial-scm.org/builders/FreeBSD%20hg%20tests/builds/487/steps/run-tests.py%20%28python%202.7.10%29/logs/stdio
>> >
>> > >
>> > > Till now, the IPv6 series should make tests pass on common IPv6 systems
>> > > where the local device has the address "::1" and the hostname "localhost"
>> > > resolves to "::1".
>> > >
>> > > diff --git a/tests/test-archive.t b/tests/test-archive.t
>> > > --- a/tests/test-archive.t
>> > > +++ b/tests/test-archive.t
>> > > @@ -100,5 +100,5 @@ invalid arch type should give 404
>> > >> stdout = sys.stdout
>> > >> try:
>> > > -  > f = util.urlreq.urlopen('http://127.0.0.1:%s/?%s'
>> > > +  > f = util.urlreq.urlopen('http://$LOCALIP:%s/?%s'
>> > >> % (os.environ['HGPORT'], requeststr))
>> > >> stdout.write(f.read())
>> > > diff --git a/tests/test-bundle2-exchange.t 
>> > > b/tests/test-bundle2-exchange.t
>> > > --- a/tests/test-bundle2-exchange.t
>> > > +++ b/tests/test-bundle2-exchange.t
>> > > @@ -341,5 +341,5 @@ push over ssh
>> > >remote: wlock: free
>> > >remote: postclose-tip:5fddd98957c8 draft book_5fdd
>> > > -  remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 
>> > > HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 
>> > > HG_NODE_LAST=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve 
>> > > HG_TXNID=TXN:* HG_TXNNAME=serve HG_URL=remote:ssh:127.0.0.1 (glob)
>> > > +  remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 
>> > > HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 
>> > > HG_NODE_LAST=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve 
>> > > HG_TXNID=TXN:* HG_TXNNAME=serve HG_URL=remote:ssh:$LOCALIP (glob)
>> > >updating bookmark book_5fdd
>> > >pre-close-tip:02de42196ebe draft book_02de
>> > > @@ -395,5 +395,5 @@ push over http
>> > >remote: wlock: free
>> > >remote: postclose-tip:32af7686d403 public book_32af
>> > > -  remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 
>> > > HG_NEW_OBSMARKERS=1 HG_NODE=32af7686d403cf45b5d95f2d70cebea587ac806a 
>> > > HG_NODE_LAST=32af7686d403cf45b5d95f2d70cebea587ac806a HG_PHASES_MOVED=1 
>> > > 

Re: [PATCH py3] ui: construct _keepalnum list in a python3-friendly way

2017-02-19 Thread Augie Fackler

> On Feb 19, 2017, at 9:29 AM, Yuya Nishihara  wrote:
> 
> On Sat, 18 Feb 2017 22:58:10 +, Martijn Pieters wrote:
>> On 16 Feb 2017, at 16:35, Augie Fackler > > wrote:
>>> +if pycompat.ispy3:
>>> +_unicodes = [bytes([c]).decode('latin1') for c in range(256)]
>>> +_notalnum = [s.encode('latin1') for s in _unicodes if not s.isalnum()]
>> 
>> ...
>>> +_keepalnum = ''.join(_notalnum)
>> 
>> This could be more cheaply calculated as
>> 
>>_keepalnum = bytes(c for c in range(256) if not chr(c).isalnum())
>> 
>> This takes a third of the time.
> 
> Good catch, but I found both of them are incorrect since str.isalnum() is
> unicode aware on Python3. We'll need to use bytes.isalnum() or string.*
> constants.

Oh, gross. I missed that. I think this patch fixes it, though not with the perf 
wins Martijn suggested:

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -40,8 +40,8 @@ urlreq = util.urlreq
 
 # for use with str.translate(None, _keepalnum), to keep just alphanumerics
 if pycompat.ispy3:
-_unicodes = [bytes([c]).decode('latin1') for c in range(256)]
-_notalnum = [s.encode('latin1') for s in _unicodes if not s.isalnum()]
+_bytes = [bytes([c]) for c in range(256)]
+_notalnum = [s for s in _bytes if not s.isalnum()]
 else:
 _notalnum = [c for c in map(chr, range(256)) if not c.isalnum()]
 _keepalnum = ''.join(_notalnum)


Feel free to amend that into what’s already queued, or I can do a followup or 
resend as feels appropriate.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] histedit: improve documentation and behaviour of dates (issue4820)

2017-02-19 Thread Ben Schmidt
# HG changeset patch
# User Ben Schmidt 
# Date 1487413828 -39600
#  Sat Feb 18 21:30:28 2017 +1100
# Node ID 4037ff1c9713d73b21ddc182580eacacba254ea7
# Parent  1f51b4658f21bbb797e922d155c1046eddccf91d
histedit: improve documentation and behaviour of dates (issue4820)

This clarifies in the histedit documentation that the 'edit' action preserves
the date and that the 'fold' action uses the later date. The documentation was
previously silent on this issue which left users in doubt.

It also adjusts and documents the new behaviour of 'roll'. It now fits nicely
with the behaviour of 'commit --amend' and the 'edit' action, by discarding the
date as well as the commit message of the second commit. Previously it used the
later date, like 'fold', but this often wasn't desirable, for example, in the
common use case of using 'roll' to add forgotten changes to a changeset
(because 'hg add' was previously forgotten or not all changes were identified
while using 'hg record').

diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -36,7 +36,7 @@
  #  p, pick = use commit
  #  e, edit = use commit, but stop for amending
  #  f, fold = use commit, but combine it with the one above
- #  r, roll = like fold, but discard this commit's description
+ #  r, roll = like fold, but discard this commit's description and date
  #  d, drop = remove commit from history
  #  m, mess = edit commit message without changing commit content
  #
@@ -58,7 +58,7 @@
  #  p, pick = use commit
  #  e, edit = use commit, but stop for amending
  #  f, fold = use commit, but combine it with the one above
- #  r, roll = like fold, but discard this commit's description
+ #  r, roll = like fold, but discard this commit's description and date
  #  d, drop = remove commit from history
  #  m, mess = edit commit message without changing commit content
  #
@@ -71,11 +71,11 @@
  ***
  Add delta
 
-Edit the commit message to your liking, then close the editor. For
-this example, let's assume that the commit message was changed to
-``Add beta and delta.`` After histedit has run and had a chance to
-remove any old or temporary revisions it needed, the history looks
-like this::
+Edit the commit message to your liking, then close the editor. The date used
+for the commit will be the later of the two commits' dates. For this example,
+let's assume that the commit message was changed to ``Add beta and delta.``
+After histedit has run and had a chance to remove any old or temporary
+revisions it needed, the history looks like this::
 
  @  2[tip]   989b4d060121   2009-04-27 18:04 -0500   durin42
  |Add beta and delta.
@@ -97,9 +97,10 @@
 allowing you to edit files freely, or even use ``hg record`` to commit
 some changes as a separate commit. When you're done, any remaining
 uncommitted changes will be committed as well. When done, run ``hg
-histedit --continue`` to finish this step. You'll be prompted for a
-new commit message, but the default commit message will be the
-original message for the ``edit`` ed revision.
+histedit --continue`` to finish this step. If there are uncommitted
+changes, you'll be prompted for a new commit message, but the default
+commit message will be the original message for the ``edit`` ed
+revision, and the date of the original commit will be preserved.
 
 The ``message`` operation will give you a chance to revise a commit
 message without changing the contents. It's a shortcut for doing
@@ -724,6 +725,15 @@
 """
 return True
 
+def firstdate(self):
+"""Returns true if the rule should preserve the date of the first
+change.
+
+This exists mainly so that 'rollup' rules can be a subclass of
+'fold'.
+"""
+return False
+
 def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
 parent = ctx.parents()[0].node()
 repo.ui.pushbuffer()
@@ -742,7 +752,10 @@
 [oldctx.description()]) + '\n'
 commitopts['message'] = newmessage
 # date
-commitopts['date'] = max(ctx.date(), oldctx.date())
+if self.firstdate():
+commitopts['date'] = ctx.date()
+else:
+commitopts['date'] = max(ctx.date(), oldctx.date())
 extra = ctx.extra().copy()
 # histedit_source
 # note: ctx is likely a temporary commit but that the best we can do
@@ -809,7 +822,7 @@
 return True
 
 @action(["roll", "r"],
-_("like fold, but discard this commit's description"))
+_("like fold, but discard this commit's description and date"))
 class rollup(fold):
 def mergedescs(self):
 return False
@@ -817,6 +830,9 @@
 def skipprompt(self):
 return True
 
+def firstdate(self):
+return True
+
 @action(["drop", "d"],
 _('remove commit from history'))
 class drop(histeditaction):
@@ -884,11 +900,11 @@
 
 - `mess` to reword the 

[PATCH 09 of 19 pager] help: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440561 18000
#  Mon Feb 06 23:09:21 2017 -0500
# Node ID f6f080904a6ecac993f137b92d50bf4991f8d07c
# Parent  6dd615d163eb069405ba71fe968980d3340d4702
help: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2721,7 +2721,6 @@ def help_(ui, name=None, **opts):
 
 Returns 0 if successful.
 """
-
 textwidth = ui.configint('ui', 'textwidth', 78)
 termwidth = ui.termwidth() - 2
 if textwidth <= 0 or termwidth < textwidth:
@@ -2772,6 +2771,7 @@ def help_(ui, name=None, **opts):
 keep.append('notomitted')
 formatted, pruned = minirst.format(text, textwidth, keep=keep,
section=section)
+ui.pager('help')
 ui.write(formatted)
 
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 15 of 19 pager] resolve: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440370 18000
#  Mon Feb 06 23:06:10 2017 -0500
# Node ID bd38eff9de15d07ea9be63da3d79edd2d41f667d
# Parent  500ccd82255b5769cd8199c379333139f172420d
resolve: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4298,6 +4298,7 @@ def resolve(ui, repo, *pats, **opts):
  hint=('use --all to re-merge all unresolved files'))
 
 if show:
+ui.pager('resolve')
 fm = ui.formatter('resolve', opts)
 ms = mergemod.mergestate.read(repo)
 m = scmutil.match(repo[None], pats, opts)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 13 of 19 pager] outgoing: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440284 18000
#  Mon Feb 06 23:04:44 2017 -0500
# Node ID 1a66b4d02263e729191c832b6c1ede112a698279
# Parent  8068b33f645ab0e7770f709e9b9d8dd24f67d762
outgoing: enable pager

The structure here is similar to incoming, and requires similar treatment.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3643,6 +3643,7 @@ def outgoing(ui, repo, dest=None, **opts
 """
 if opts.get('graph'):
 cmdutil.checkunsupportedgraphflags([], opts)
+ui.pager('outgoing')
 o, other = hg._outgoing(ui, repo, dest, opts)
 if not o:
 cmdutil.outgoinghooks(ui, repo, other, opts, o)
@@ -3661,11 +3662,13 @@ def outgoing(ui, repo, dest=None, **opts
 if 'bookmarks' not in other.listkeys('namespaces'):
 ui.warn(_("remote doesn't support bookmarks\n"))
 return 0
+ui.pager('outgoing')
 ui.status(_('comparing with %s\n') % util.hidepassword(dest))
 return bookmarks.outgoing(ui, repo, other)
 
 repo._subtoppath = ui.expandpath(dest or 'default-push', dest or 'default')
 try:
+ui.pager('outgoing')
 return hg.outgoing(ui, repo, dest, opts)
 finally:
 del repo._subtoppath
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 19 of 19 pager] version: enable pager if --verbose is specified

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440529 18000
#  Mon Feb 06 23:08:49 2017 -0500
# Node ID 2a054d530fa6763f0cf97a6e7193870ff8f2378b
# Parent  190fc3b8c22dff15bf147ea74cc507757327251e
version: enable pager if --verbose is specified

`hg version` output is very short without --verbose, but with
--verbose it tends to scroll off the user's screen.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5413,6 +5413,8 @@ def verify(ui, repo):
 @command('version', [] + formatteropts, norepo=True)
 def version_(ui, **opts):
 """output version and copyright information"""
+if ui.verbose:
+ui.pager('version')
 fm = ui.formatter("version", opts)
 fm.startitem()
 fm.write("ver", _("Mercurial Distributed SCM (version %s)\n"),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 10 of 19 pager] incoming: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440228 18000
#  Mon Feb 06 23:03:48 2017 -0500
# Node ID b6f05836ba20bb8b25469a30aeed1b3506392bbf
# Parent  f6f080904a6ecac993f137b92d50bf4991f8d07c
incoming: enable pager

The design of incoming means we have to activate the pager in several
places, depending on which codepath gets chosen.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3210,6 +3210,7 @@ def incoming(ui, repo, source="default",
 cmdutil.displaygraph(ui, repo, revdag, displayer,
  graphmod.asciiedges)
 
+ui.pager('incoming')
 hg._incoming(display, lambda: 1, ui, repo, source, opts, buffered=True)
 return 0
 
@@ -3223,11 +3224,13 @@ def incoming(ui, repo, source="default",
 if 'bookmarks' not in other.listkeys('namespaces'):
 ui.warn(_("remote doesn't support bookmarks\n"))
 return 0
+ui.pager('incoming')
 ui.status(_('comparing with %s\n') % util.hidepassword(source))
 return bookmarks.incoming(ui, repo, other)
 
 repo._subtoppath = ui.expandpath(source)
 try:
+ui.pager('incoming')
 return hg.incoming(ui, repo, source, opts)
 finally:
 del repo._subtoppath
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 03 of 19 pager] export: migrate to modern pager API

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486439934 18000
#  Mon Feb 06 22:58:54 2017 -0500
# Node ID c263fdd944aa367df3fce4dc30c901eb7fdadd26
# Parent  c0e57f44ebed1240c000850ce256d928cdb69312
export: migrate to modern pager API

diff --git a/hgext/pager.py b/hgext/pager.py
--- a/hgext/pager.py
+++ b/hgext/pager.py
@@ -110,4 +110,4 @@ def uisetup(ui):
 extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
 extensions.afterloaded('color', afterloaded)
 
-attended = ['export', 'glog', 'log', 'qdiff']
+attended = ['glog', 'log', 'qdiff']
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2022,6 +2022,7 @@ def export(ui, repo, *changesets, **opts
 ui.note(_('exporting patches:\n'))
 else:
 ui.note(_('exporting patch:\n'))
+ui.pager('export')
 cmdutil.export(repo, revs, template=opts.get('output'),
  switch_parent=opts.get('switch_parent'),
  opts=patch.diffallopts(ui, opts))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 11 of 19 pager] locate: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440250 18000
#  Mon Feb 06 23:04:10 2017 -0500
# Node ID fbd10f8b093b23fb9dba972b5a05c7bcdfb904f2
# Parent  b6f05836ba20bb8b25469a30aeed1b3506392bbf
locate: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3292,6 +3292,7 @@ def locate(ui, repo, *pats, **opts):
 m = scmutil.match(ctx, pats, opts, default='relglob',
   badfn=lambda x, y: False)
 
+ui.pager('locate')
 for abs in ctx.matches(m):
 if opts.get('fullpath'):
 ui.write(repo.wjoin(abs), end)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 12 of 19 pager] manifest: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440266 18000
#  Mon Feb 06 23:04:26 2017 -0500
# Node ID 8068b33f645ab0e7770f709e9b9d8dd24f67d762
# Parent  fbd10f8b093b23fb9dba972b5a05c7bcdfb904f2
manifest: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3484,7 +3484,6 @@ def manifest(ui, repo, node=None, rev=No
 
 Returns 0 on success.
 """
-
 fm = ui.formatter('manifest', opts)
 
 if opts.get('all'):
@@ -3500,6 +3499,7 @@ def manifest(ui, repo, node=None, rev=No
 for fn, b, size in repo.store.datafiles():
 if size != 0 and fn[-slen:] == suffix and fn[:plen] == prefix:
 res.append(fn[plen:-slen])
+ui.pager('manifest')
 for f in res:
 fm.startitem()
 fm.write("path", '%s\n', f)
@@ -3516,6 +3516,7 @@ def manifest(ui, repo, node=None, rev=No
 mode = {'l': '644', 'x': '755', '': '644'}
 ctx = scmutil.revsingle(repo, node)
 mf = ctx.manifest()
+ui.pager('manifest')
 for f in ctx:
 fm.startitem()
 fl = ctx[f].flags()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 17 of 19 pager] summary: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440419 18000
#  Mon Feb 06 23:06:59 2017 -0500
# Node ID 2bbd0d7759e102d7ed0a95e41b6f48bc7bddae48
# Parent  efe1daeb054101ccdd14057062be826c2bd1180d
summary: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4819,6 +4819,7 @@ def summary(ui, repo, **opts):
 Returns 0 on success.
 """
 
+ui.pager('summary')
 ctx = repo[None]
 parents = ctx.parents()
 pnode = parents[0].node()
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 16 of 19 pager] status: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440392 18000
#  Mon Feb 06 23:06:32 2017 -0500
# Node ID efe1daeb054101ccdd14057062be826c2bd1180d
# Parent  bd38eff9de15d07ea9be63da3d79edd2d41f667d
status: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4788,6 +4788,7 @@ def status(ui, repo, *pats, **opts):
 or ui.configbool('ui', 'statuscopies')) and not opts.get('no_status'):
 copy = copies.pathcopies(repo[node1], repo[node2], m)
 
+ui.pager('status')
 fm = ui.formatter('status', opts)
 fmt = '%s' + end
 showchar = not opts.get('no_status')
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 14 of 19 pager] paths: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440361 18000
#  Mon Feb 06 23:06:01 2017 -0500
# Node ID 500ccd82255b5769cd8199c379333139f172420d
# Parent  1a66b4d02263e729191c832b6c1ede112a698279
paths: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3761,6 +3761,7 @@ def paths(ui, repo, search=None, **opts)
 
 Returns 0 on success.
 """
+ui.pager('paths')
 if search:
 pathitems = [(name, path) for name, path in ui.paths.iteritems()
  if name == search]
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 18 of 19 pager] tags: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440436 18000
#  Mon Feb 06 23:07:16 2017 -0500
# Node ID 190fc3b8c22dff15bf147ea74cc507757327251e
# Parent  2bbd0d7759e102d7ed0a95e41b6f48bc7bddae48
tags: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -5212,6 +5212,7 @@ def tags(ui, repo, **opts):
 Returns 0 on success.
 """
 
+ui.pager('tags')
 fm = ui.formatter('tags', opts)
 hexfunc = fm.hexfunc
 tagtype = ""
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 07 of 19 pager] files: enable pager

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440168 18000
#  Mon Feb 06 23:02:48 2017 -0500
# Node ID a7e54c6d8835bcda8aed14284046be7489a460a2
# Parent  22e4e9bdff5ebdd7feabb9ed7a1ff6b72c0fe7e8
files: enable pager

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2084,6 +2084,7 @@ def files(ui, repo, *pats, **opts):
 fmt = '%s' + end
 
 m = scmutil.match(ctx, pats, opts)
+ui.pager('files')
 with ui.formatter('files', opts) as fm:
 return cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos'))
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 02 of 19 pager] diff: migrate to modern pager API

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486439906 18000
#  Mon Feb 06 22:58:26 2017 -0500
# Node ID c0e57f44ebed1240c000850ce256d928cdb69312
# Parent  2832edeb9d5358b483ad0babbbf3f1dfb43aaf4c
diff: migrate to modern pager API

diff --git a/hgext/pager.py b/hgext/pager.py
--- a/hgext/pager.py
+++ b/hgext/pager.py
@@ -110,4 +110,4 @@ def uisetup(ui):
 extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
 extensions.afterloaded('color', afterloaded)
 
-attended = ['diff', 'export', 'glog', 'log', 'qdiff']
+attended = ['export', 'glog', 'log', 'qdiff']
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1940,6 +1940,7 @@ def diff(ui, repo, *pats, **opts):
 
 diffopts = patch.diffallopts(ui, opts)
 m = scmutil.match(repo[node2], pats, opts)
+ui.pager('diff')
 cmdutil.diffordiffstat(ui, repo, diffopts, node1, node2, m, stat=stat,
listsubrepos=opts.get('subrepos'),
root=opts.get('root'))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 06 of 19 pager] config: activate pager if not starting an editor

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486440102 18000
#  Mon Feb 06 23:01:42 2017 -0500
# Node ID 22e4e9bdff5ebdd7feabb9ed7a1ff6b72c0fe7e8
# Parent  047682a5c9af676f0ac0e8169715f4e0b29f3dc0
config: activate pager if not starting an editor

This demonstrates the power of the non-attend-based pager API.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1792,7 +1792,7 @@ def config(ui, repo, *values, **opts):
 ui.system("%s \"%s\"" % (editor, f),
   onerr=error.Abort, errprefix=_("edit failed"))
 return
-
+ui.pager('config')
 fm = ui.formatter('config', opts)
 for f in scmutil.rcpath():
 ui.debug('read config from: %s\n' % f)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 04 of 19 pager] log: migrate to modern pager API

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1486439965 18000
#  Mon Feb 06 22:59:25 2017 -0500
# Node ID 173c95da11848036895410797f8228c6562ce1d3
# Parent  c263fdd944aa367df3fce4dc30c901eb7fdadd26
log: migrate to modern pager API

diff --git a/hgext/pager.py b/hgext/pager.py
--- a/hgext/pager.py
+++ b/hgext/pager.py
@@ -110,4 +110,4 @@ def uisetup(ui):
 extensions.wrapfunction(dispatch, '_runcommand', pagecmd)
 extensions.afterloaded('color', afterloaded)
 
-attended = ['glog', 'log', 'qdiff']
+attended = ['qdiff']
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3435,6 +3435,7 @@ def log(ui, repo, *pats, **opts):
 endrev = scmutil.revrange(repo, opts.get('rev')).max() + 1
 getrenamed = templatekw.getrenamedfn(repo, endrev=endrev)
 
+ui.pager('log')
 displayer = cmdutil.show_changeset(ui, repo, opts, buffered=True)
 for rev in revs:
 if count == limit:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH pager annotate-fix] annotate: start pager after we're sure we wont abort

2017-02-19 Thread Augie Fackler
# HG changeset patch
# User Augie Fackler 
# Date 1487534981 18000
#  Sun Feb 19 15:09:41 2017 -0500
# Node ID 7353b9603c574678314f9525b3e56f31a4497bb9
# Parent  2c9e619ba9ee8e72370cc0f27f59da39947773b6
annotate: start pager after we're sure we wont abort

This avoids needlessly putting a short error message into the pager.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -361,7 +361,6 @@ def annotate(ui, repo, *pats, **opts):
 
 Returns 0 on success.
 """
-ui.pager('annotate')
 if not pats:
 raise error.Abort(_('at least one filename or pattern is required'))
 
@@ -422,6 +421,8 @@ def annotate(ui, repo, *pats, **opts):
 if linenumber and (not opts.get('changeset')) and (not opts.get('number')):
 raise error.Abort(_('at least one of -n/-c is required for -l'))
 
+ui.pager('annotate')
+
 if fm.isplain():
 def makefunc(get, fmt):
 return lambda x: fmt(get(x))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] bookmarks: fix HG_PENDING handling

2017-02-19 Thread FUJIWARA Katsunori
At Mon, 20 Feb 2017 06:11:30 +0900,
FUJIWARA Katsunori wrote:
> 
> At Mon, 20 Feb 2017 03:57:54 +0900,
> FUJIWARA Katsunori wrote:
> > 
> > At Wed, 15 Feb 2017 21:33:20 -0500,
> > Augie Fackler wrote:
> > > 
> > > foozy, how does this (and timeless' other patch in the same basic
> > > area) relate to the patches you said you've got coming?
> > 
> > (sorry for late response)
> > 
> > This series (for bookmarks.py and localrepo.py) LGTM as the first step
> > of fixing HG_PENDING issues.
> 
> (I discard this reply according to recent confirmation with wrong
> condition. I had to believe my pending works :-<)
> 
> This patch works as expected, only if bookmarks aren't shared by share
> extension.
> 
> Enabling share extension (+ bookmark sharing) makes
> bookmarks._getbkfile() receive repo to be shared (= 'srcrepo') as
> 'repo'. On the other hand, HG_PENDING always refers current working
> repository (= 'currepo') enabling share extension.
> 
> Therefore, pending changes in srcrepo are never visible to an external
> hook spawned by currepo.
> 
> This patch should imply changes for share.py, IMHO.
> 
> Unfortunately, bookmarks._getbkfile() uses received 'repo' not only
> for getting 'root' but also getting 'vfs'. To fix original issue
> safely, we should:
> 
>   - make bookmarks._getbkfile() receive 'root' and 'vfs' separately, or
>   - execute HG_PENDING logic locally in share.getbkfile()

Even after fixing above, pending changes of bookmarks is still
invisible in srcrepo to an external hook (with HG_PENDING, spawned in
currepo), because writing bookmarks.pending into srcrepo is executed
via "postclose" transaction hook.

If we should make currepo and srcrepo equal (except for "active
bookmark") for an external hook, more hacks are needed.

I remember that problem described in pages below led me to postpone
posting my patches :-)

  https://www.mercurial-scm.org/wiki/SharedRepository
  https://bz.mercurial-scm.org/show_bug.cgi?id=4858


> 
> > I can revise my pending patches for them easily.
> > 
> > > Thanks!
> > > Augie
> > > 
> > > On Tue, Feb 14, 2017 at 04:19:45PM +, timeless wrote:
> > > > # HG changeset patch
> > > > # User timeless 
> > > > # Date 1487089111 0
> > > > #  Tue Feb 14 16:18:31 2017 +
> > > > # Node ID 54804162d8b35ceff3bd22f05b515fc716705ce2
> > > > # Parent  f2ad0d8047009e6e58ab1fa34ae7107714f5dc30
> > > > # Available At https://bitbucket.org/timeless/mercurial-crew
> > > > #  hg pull https://bitbucket.org/timeless/mercurial-crew -r 
> > > > 54804162d8b3
> > > > bookmarks: fix HG_PENDING handling
> > > >
> > > > HG_PENDING is supposed to point to a specific repo when
> > > > called as part of a hook, without this, any command in an
> > > > unrelated repository would read the pending version of
> > > > bookmark state instead of the version that is appropriate.
> > > >
> > > > diff -r f2ad0d804700 -r 54804162d8b3 mercurial/bookmarks.py
> > > > --- a/mercurial/bookmarks.pyTue Feb 14 01:52:16 2017 +0530
> > > > +++ b/mercurial/bookmarks.pyTue Feb 14 16:18:31 2017 +
> > > > @@ -30,7 +30,7 @@
> > > >  may need to tweak this behavior further.
> > > >  """
> > > >  bkfile = None
> > > > -if 'HG_PENDING' in encoding.environ:
> > > > +if encoding.environ.get('HG_PENDING') == repo.root:
> > > >  try:
> > > >  bkfile = repo.vfs('bookmarks.pending')
> > > >  except IOError as inst:
> > > > ___
> > > > Mercurial-devel mailing list
> > > > Mercurial-devel@mercurial-scm.org
> > > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> > > 
> > 
> > -- 
> > --
> > [FUJIWARA Katsunori] fo...@lares.dti.ne.jp
> > 
> 
> -- 
> --
> [FUJIWARA Katsunori] fo...@lares.dti.ne.jp
> 

-- 
--
[FUJIWARA Katsunori] fo...@lares.dti.ne.jp
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] bookmarks: fix HG_PENDING handling

2017-02-19 Thread FUJIWARA Katsunori
At Mon, 20 Feb 2017 03:57:54 +0900,
FUJIWARA Katsunori wrote:
> 
> At Wed, 15 Feb 2017 21:33:20 -0500,
> Augie Fackler wrote:
> > 
> > foozy, how does this (and timeless' other patch in the same basic
> > area) relate to the patches you said you've got coming?
> 
> (sorry for late response)
> 
> This series (for bookmarks.py and localrepo.py) LGTM as the first step
> of fixing HG_PENDING issues.

(I discard this reply according to recent confirmation with wrong
condition. I had to believe my pending works :-<)

This patch works as expected, only if bookmarks aren't shared by share
extension.

Enabling share extension (+ bookmark sharing) makes
bookmarks._getbkfile() receive repo to be shared (= 'srcrepo') as
'repo'. On the other hand, HG_PENDING always refers current working
repository (= 'currepo') enabling share extension.

Therefore, pending changes in srcrepo are never visible to an external
hook spawned by currepo.

This patch should imply changes for share.py, IMHO.

Unfortunately, bookmarks._getbkfile() uses received 'repo' not only
for getting 'root' but also getting 'vfs'. To fix original issue
safely, we should:

  - make bookmarks._getbkfile() receive 'root' and 'vfs' separately, or
  - execute HG_PENDING logic locally in share.getbkfile()


> I can revise my pending patches for them easily.
> 
> > Thanks!
> > Augie
> > 
> > On Tue, Feb 14, 2017 at 04:19:45PM +, timeless wrote:
> > > # HG changeset patch
> > > # User timeless 
> > > # Date 1487089111 0
> > > #  Tue Feb 14 16:18:31 2017 +
> > > # Node ID 54804162d8b35ceff3bd22f05b515fc716705ce2
> > > # Parent  f2ad0d8047009e6e58ab1fa34ae7107714f5dc30
> > > # Available At https://bitbucket.org/timeless/mercurial-crew
> > > #  hg pull https://bitbucket.org/timeless/mercurial-crew -r 
> > > 54804162d8b3
> > > bookmarks: fix HG_PENDING handling
> > >
> > > HG_PENDING is supposed to point to a specific repo when
> > > called as part of a hook, without this, any command in an
> > > unrelated repository would read the pending version of
> > > bookmark state instead of the version that is appropriate.
> > >
> > > diff -r f2ad0d804700 -r 54804162d8b3 mercurial/bookmarks.py
> > > --- a/mercurial/bookmarks.py  Tue Feb 14 01:52:16 2017 +0530
> > > +++ b/mercurial/bookmarks.py  Tue Feb 14 16:18:31 2017 +
> > > @@ -30,7 +30,7 @@
> > >  may need to tweak this behavior further.
> > >  """
> > >  bkfile = None
> > > -if 'HG_PENDING' in encoding.environ:
> > > +if encoding.environ.get('HG_PENDING') == repo.root:
> > >  try:
> > >  bkfile = repo.vfs('bookmarks.pending')
> > >  except IOError as inst:
> > > ___
> > > Mercurial-devel mailing list
> > > Mercurial-devel@mercurial-scm.org
> > > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> > 
> 
> -- 
> --
> [FUJIWARA Katsunori] fo...@lares.dti.ne.jp
> 

-- 
--
[FUJIWARA Katsunori] fo...@lares.dti.ne.jp
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 5488] New: mercurial/help/internals/revlogs.txt seems to be wrong about chain base

2017-02-19 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5488

Bug ID: 5488
   Summary: mercurial/help/internals/revlogs.txt seems to be wrong
about chain base
   Product: Mercurial
   Version: unspecified
  Hardware: All
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: z...@zash.se
CC: mercurial-de...@selenic.com

Created attachment 1949
  --> https://bz.mercurial-scm.org/attachment.cgi?id=1949=edit
Patch, attempt to improve the text

mercurial/help/internals/revlogs.txt states that for the chain base field, "-1
means this revision holds full text", but the code in revlog.chainbase() and
revlog._deltachain() seems to stop when this field is equal to its own revision
id.

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


Re: [PATCH 8 of 9 pager v2] annotate: migrate to modern pager API

2017-02-19 Thread Augie Fackler

> On Feb 18, 2017, at 9:32 PM, Jun Wu  wrote:
> 
> Excerpts from Yuya Nishihara's message of 2017-02-19 11:04:19 +0900:
>> On Sat, 18 Feb 2017 15:39:08 -0500, Augie Fackler wrote:
>>> 
 On Feb 18, 2017, at 3:11 PM, Martin von Zweigbergk  
 wrote:
 
>> --- a/mercurial/commands.py
>> +++ b/mercurial/commands.py
>> @@ -361,6 +361,7 @@ def annotate(ui, repo, *pats, **opts):
>> 
>> Returns 0 on success.
>> """
>> +ui.pager('annotate')
>> if not pats:
>> raise error.Abort(_('at least one filename or pattern is 
>> required'))
> 
> Just to make sure. Do we plan to delay ui.pager() call so short error 
> messages
> (and password prompt, etc.) won't be paged?
> 
 I was wondering the same, but was hoping the pager would be configured to 
 exit if the full text would fit. I have no idea if that's true for most 
 systems out there, though. I don't believe I've manually configured mine 
 that way, so I suspect it's that way be default on our custom Ubuntu. I 
 guess pager on by default will be pretty annoying if that is not a common 
 default configuration, so I really hope it is.
>>> 
>>> I don’t think that’s a safe assumption, sadly. I’ll do a follow-up to try 
>>> and make sure that things are sane at least at a high level.
>> 
>> IIRC, "more" exits automatically, but "less" doesn't by default. Also, "less"
>> clears the paged contents on exit.
> 
> less can be configured to not clear the screen (-X), and exit automatically
> (-F). And another common flag is -R, which will allow colors.
> 
> git used to just hard-code LESS=FRX as the default in pager.c [1]. That got
> moved to an override-able build variable by [2].
> 
> I guess we could do the same, provide "LESS=FRX" as the default to be more
> user-friendly.

This is a great idea for built packages, but in the sources the default should 
be more(1) because that’s the only pager we can be sure to find.

(I expect our packages on debian would default to sensible-pager, packages on 
OS X would default to less with FRX set, etc)

> 
> [1]: 
> https://github.com/git/git/blob/c3b1e8d85133e2a19d372b7c166d5b49fcbbfef2/pager.c#L70
> [2]: 
> https://github.com/git/git/commit/995bc22d7f8c611e342095a211065f8585a08e65

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


Re: [PATCH] bookmarks: fix HG_PENDING handling

2017-02-19 Thread FUJIWARA Katsunori
At Wed, 15 Feb 2017 21:33:20 -0500,
Augie Fackler wrote:
> 
> foozy, how does this (and timeless' other patch in the same basic
> area) relate to the patches you said you've got coming?

(sorry for late response)

This series (for bookmarks.py and localrepo.py) LGTM as the first step
of fixing HG_PENDING issues.

I can revise my pending patches for them easily.

> Thanks!
> Augie
> 
> On Tue, Feb 14, 2017 at 04:19:45PM +, timeless wrote:
> > # HG changeset patch
> > # User timeless 
> > # Date 1487089111 0
> > #  Tue Feb 14 16:18:31 2017 +
> > # Node ID 54804162d8b35ceff3bd22f05b515fc716705ce2
> > # Parent  f2ad0d8047009e6e58ab1fa34ae7107714f5dc30
> > # Available At https://bitbucket.org/timeless/mercurial-crew
> > #  hg pull https://bitbucket.org/timeless/mercurial-crew -r 
> > 54804162d8b3
> > bookmarks: fix HG_PENDING handling
> >
> > HG_PENDING is supposed to point to a specific repo when
> > called as part of a hook, without this, any command in an
> > unrelated repository would read the pending version of
> > bookmark state instead of the version that is appropriate.
> >
> > diff -r f2ad0d804700 -r 54804162d8b3 mercurial/bookmarks.py
> > --- a/mercurial/bookmarks.pyTue Feb 14 01:52:16 2017 +0530
> > +++ b/mercurial/bookmarks.pyTue Feb 14 16:18:31 2017 +
> > @@ -30,7 +30,7 @@
> >  may need to tweak this behavior further.
> >  """
> >  bkfile = None
> > -if 'HG_PENDING' in encoding.environ:
> > +if encoding.environ.get('HG_PENDING') == repo.root:
> >  try:
> >  bkfile = repo.vfs('bookmarks.pending')
> >  except IOError as inst:
> > ___
> > Mercurial-devel mailing list
> > Mercurial-devel@mercurial-scm.org
> > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
> 

-- 
--
[FUJIWARA Katsunori] fo...@lares.dti.ne.jp
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH V3] shelve: add -n/--name option to unshelve (issue5475)

2017-02-19 Thread liscju
# HG changeset patch
# User liscju 
# Date 1487498168 -3600
#  Sun Feb 19 10:56:08 2017 +0100
# Node ID 07d5e04a0641a33917bd6eccc7284c76103f46c7
# Parent  01eebb65a61d9edcad1665ed747c7092f1ddb8b9
shelve: add -n/--name option to unshelve (issue5475)

This makes using shelve/unshelve more consistent because
shelving can be done using name option and unshelving as
well. Author of the idea of this improvement and solution is
joshgold.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -747,10 +747,12 @@ def _checkunshelveuntrackedproblems(ui, 
_('continue an incomplete unshelve operation')),
   ('k', 'keep', None,
_('keep shelve after unshelving')),
+  ('n', 'name', '',
+   _('restore shelved change with given name'), _('NAME')),
   ('t', 'tool', '', _('specify merge tool')),
   ('', 'date', '',
_('set date for temporary commits (DEPRECATED)'), _('DATE'))],
- _('hg unshelve [SHELVED]'))
+ _('hg unshelve [[-n] SHELVED]'))
 def unshelve(ui, repo, *shelved, **opts):
 """restore a shelved change to the working directory
 
@@ -795,6 +797,9 @@ def _dounshelve(ui, repo, *shelved, **op
 continuef = opts.get('continue')
 if not abortf and not continuef:
 cmdutil.checkunfinished(repo)
+shelved = list(shelved)
+if opts.get("name"):
+shelved.append(opts["name"])
 
 if abortf or continuef:
 if abortf and continuef:
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -493,7 +493,7 @@ ensure that metadata-only changes are sh
   $ ln -s foo a/a
   $ hg shelve -q -n symlink a/a
   $ hg status a/a
-  $ hg unshelve -q symlink
+  $ hg unshelve -q -n symlink
   $ hg status a/a
   M a/a
   $ hg revert a/a
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH V2] shelve: add -n/--name option to unshelve (issue5475)

2017-02-19 Thread Pulkit Goyal
On Sun, Feb 19, 2017 at 8:51 PM, liscju  wrote:

> # HG changeset patch
> # User liscju 
> # Date 1487498168 -3600
> #  Sun Feb 19 10:56:08 2017 +0100
> # Node ID f89322e6f48bfe709f759abe71e39fba06f06632
> # Parent  01eebb65a61d9edcad1665ed747c7092f1ddb8b9
> shelve: add -n/--name option to unshelve (issue5475)
>
> This makes using shelve/unshelve more consistent because
> shelving can be done using name option and unshelving as
> well. Author of the idea of this improvement and solution is
> joshgold.
>
> diff --git a/hgext/shelve.py b/hgext/shelve.py
> --- a/hgext/shelve.py
> +++ b/hgext/shelve.py
> @@ -747,10 +747,12 @@ def _checkunshelveuntrackedproblems(ui,
> _('continue an incomplete unshelve operation')),
>('k', 'keep', None,
> _('keep shelve after unshelving')),
> +  ('n', 'name', '',
> +   _('use the given name for the shelved commit'), _('NAME')),
>
​
This should be changed to something like "unshelve this named shelve".​
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH py3] ui: construct _keepalnum list in a python3-friendly way

2017-02-19 Thread Yuya Nishihara
On Sat, 18 Feb 2017 22:58:10 +, Martijn Pieters wrote:
> On 16 Feb 2017, at 16:35, Augie Fackler  > wrote:
> > +if pycompat.ispy3:
> > +_unicodes = [bytes([c]).decode('latin1') for c in range(256)]
> > +_notalnum = [s.encode('latin1') for s in _unicodes if not s.isalnum()]
> 
> ...
> > +_keepalnum = ''.join(_notalnum)
> 
> This could be more cheaply calculated as
> 
> _keepalnum = bytes(c for c in range(256) if not chr(c).isalnum())
> 
> This takes a third of the time.

Good catch, but I found both of them are incorrect since str.isalnum() is
unicode aware on Python3. We'll need to use bytes.isalnum() or string.*
constants.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] shelve: add -n/--name option to unshelve (issue5475)

2017-02-19 Thread Yuya Nishihara
On Sun, 19 Feb 2017 11:07:23 +0100, liscju wrote:
> # HG changeset patch
> # User liscju 
> # Date 1487498168 -3600
> #  Sun Feb 19 10:56:08 2017 +0100
> # Node ID a645a60d15639f01892fc2887beff30193d09f20
> # Parent  01eebb65a61d9edcad1665ed747c7092f1ddb8b9
> shelve: add -n/--name option to unshelve (issue5475)
> 
> This makes using shelve/unshelve more consistent because
> shelving can be done using name option and unshelving as
> well. Author of the idea of this improvement and solution is
> joshgold.
> 
> diff --git a/hgext/shelve.py b/hgext/shelve.py
> --- a/hgext/shelve.py
> +++ b/hgext/shelve.py
> @@ -747,10 +747,12 @@ def _checkunshelveuntrackedproblems(ui, 
> _('continue an incomplete unshelve operation')),
>('k', 'keep', None,
> _('keep shelve after unshelving')),
> +  ('n', 'name', '',
> +   _('use the given name for the shelved commit'), _('NAME')),
>('t', 'tool', '', _('specify merge tool')),
>('', 'date', '',
> _('set date for temporary commits (DEPRECATED)'), _('DATE'))],
> - _('hg unshelve [SHELVED]'))
> + _('hg unshelve [[-n] SHELVED]'))
>  def unshelve(ui, repo, *shelved, **opts):
>  """restore a shelved change to the working directory

You need to process opts.get('name').

> @@ -493,7 +493,7 @@ ensure that metadata-only changes are sh
>$ ln -s foo a/a
>$ hg shelve -q -n symlink a/a
>$ hg status a/a
> -  $ hg unshelve -q symlink
> +  $ hg unshelve -q -n symlink

Perhaps it would unshelve the last change since -n option was discarded.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2 V2] smartset: use native set operations as fast paths

2017-02-19 Thread Yuya Nishihara
On Sat, 18 Feb 2017 17:27:31 -0800, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu 
> # Date 1487467423 28800
> #  Sat Feb 18 17:23:43 2017 -0800
> # Node ID 6f57ef05c74567db95f42426499640ad29bc878f
> # Parent  deb48622b857d621606a1cdda4adc868b1c663d4
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #  hg pull https://bitbucket.org/quark-zju/hg-draft -r 
> 6f57ef05c745
> smartset: use native set operations as fast paths

Nice. Queued the series, thanks.

> +def _fastsetop(self, other, op):
> +# try to use native set operations as fast paths
> +if (type(other) is baseset and '_set' in other.__dict__ and '_set' in
> +self.__dict__ and self._ascending is not None):
> +s = baseset(data=getattr(self._set, op)(other._set))
> +s._ascending = self._ascending
> +else:
> +s = getattr(super(baseset, self), op)(other)
> +return s

Nit:
It doesn't preserve the istopo flag. That's okay since '_ascending is not None'
and _istopo should be mutually exclusive, but I hope it's guaranteed. If you
construct a baseset from a set with istopo=True, baseset blindly trust it.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 3] (RFC) scmutil: proxy revrange() through repo to break import cycles

2017-02-19 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1487502018 -32400
#  Sun Feb 19 20:00:18 2017 +0900
# Node ID fd48908e928243b8d06faaef518f1b862d8f2579
# Parent  85ab530251b2810e18339c13a0f95a4f02d7ab3a
(RFC) scmutil: proxy revrange() through repo to break import cycles

This was one of the hardest import cycles as scmutil is widely used and
revset functions are likely to depend on a variety of modules.

New repo.anyrevs() does not expand user aliases by default to copy the
behavior of the existing repo.revs(). I don't want to add new function to
localrepository, but this function is quite similar to repo.revs() so it
won't increase the complexity of the localrepository class so much.

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -12,6 +12,7 @@ from . import (
 bookmarks,
 error,
 obsolete,
+scmutil,
 )
 
 def _destupdateobs(repo, clean):
@@ -342,9 +343,6 @@ histeditdefaultrevset = 'reverse(only(.)
 
 def desthistedit(ui, repo):
 """Default base revision to edit for `hg histedit`."""
-# Avoid cycle: scmutil -> revset -> destutil
-from . import scmutil
-
 default = ui.config('histedit', 'defaultrev', histeditdefaultrevset)
 if default:
 revs = scmutil.revrange(repo, [default])
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -577,7 +577,8 @@ class localrepository(object):
 %-formatting to escape certain types. See ``revsetlang.formatspec``.
 
 Revset aliases from the configuration are not expanded. To expand
-user aliases, consider calling ``scmutil.revrange()``.
+user aliases, consider calling ``scmutil.revrange()`` or
+``repo.anyrevs([expr], user=True)``.
 
 Returns a revset.abstractsmartset, which is a list-like interface
 that contains integer revisions.
@@ -598,6 +599,18 @@ class localrepository(object):
 for r in self.revs(expr, *args):
 yield self[r]
 
+def anyrevs(self, specs, user=False):
+'''Find revisions matching one of the given revsets.
+
+Revset aliases from the configuration are not expanded by default. To
+expand user aliases, specify ``user=True``.
+'''
+if user:
+m = revset.matchany(self.ui, specs, repo=self)
+else:
+m = revset.matchany(None, specs)
+return m(self)
+
 def url(self):
 return 'file:' + self.root
 
diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -29,7 +29,6 @@ from . import (
 pathutil,
 phases,
 pycompat,
-revset,
 revsetlang,
 similar,
 util,
@@ -950,8 +949,7 @@ def revrange(repo, specs):
 if isinstance(spec, int):
 spec = revsetlang.formatspec('rev(%d)', spec)
 allspecs.append(spec)
-m = revset.matchany(repo.ui, allspecs, repo)
-return m(repo)
+return repo.anyrevs(allspecs, user=True)
 
 def meaningfulparents(repo, ctx):
 """Return list of meaningful (or all if debug) parentrevs for rev.
diff --git a/mercurial/tags.py b/mercurial/tags.py
--- a/mercurial/tags.py
+++ b/mercurial/tags.py
@@ -24,6 +24,7 @@ from .node import (
 from . import (
 encoding,
 error,
+scmutil,
 util,
 )
 
@@ -277,8 +278,6 @@ def _readtagcache(ui, repo):
 If the cache is not up to date, the caller is responsible for reading tag
 info from each returned head. (See findglobaltags().)
 '''
-from . import scmutil  # avoid cycle
-
 try:
 cachefile = repo.vfs(_filename(repo), 'r')
 # force reading the file for static-http
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] shelve: add -n/--name option to unshelve (issue5475)

2017-02-19 Thread liscju
# HG changeset patch
# User liscju 
# Date 1487498168 -3600
#  Sun Feb 19 10:56:08 2017 +0100
# Node ID a645a60d15639f01892fc2887beff30193d09f20
# Parent  01eebb65a61d9edcad1665ed747c7092f1ddb8b9
shelve: add -n/--name option to unshelve (issue5475)

This makes using shelve/unshelve more consistent because
shelving can be done using name option and unshelving as
well. Author of the idea of this improvement and solution is
joshgold.

diff --git a/hgext/shelve.py b/hgext/shelve.py
--- a/hgext/shelve.py
+++ b/hgext/shelve.py
@@ -747,10 +747,12 @@ def _checkunshelveuntrackedproblems(ui, 
_('continue an incomplete unshelve operation')),
   ('k', 'keep', None,
_('keep shelve after unshelving')),
+  ('n', 'name', '',
+   _('use the given name for the shelved commit'), _('NAME')),
   ('t', 'tool', '', _('specify merge tool')),
   ('', 'date', '',
_('set date for temporary commits (DEPRECATED)'), _('DATE'))],
- _('hg unshelve [SHELVED]'))
+ _('hg unshelve [[-n] SHELVED]'))
 def unshelve(ui, repo, *shelved, **opts):
 """restore a shelved change to the working directory
 
diff --git a/tests/test-shelve.t b/tests/test-shelve.t
--- a/tests/test-shelve.t
+++ b/tests/test-shelve.t
@@ -493,7 +493,7 @@ ensure that metadata-only changes are sh
   $ ln -s foo a/a
   $ hg shelve -q -n symlink a/a
   $ hg status a/a
-  $ hg unshelve -q symlink
+  $ hg unshelve -q -n symlink
   $ hg status a/a
   M a/a
   $ hg revert a/a
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel