[PATCH 2 of 2 v3] hgweb: show obsolescence status of a commit

2017-11-17 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1510977848 -28800
#  Sat Nov 18 12:04:08 2017 +0800
# Node ID 7dee8249ba0efc42a60c4523fd9593853ec2eb79
# Parent  880072944df7bb19b949d9a025a80e7def1a8525
# EXP-Topic hgweb-more-info
hgweb: show obsolescence status of a commit

As with phases, spartan theme shows a simple "obsolete: yes" on its own line
(this allows replacing "yes" with something more useful in future, like output
of obsfate* template functions). Everywhere else a new "tag" is added to the
same line that has phase, branch, etc of a changeset; in gitweb and monoblue
the element has gray background, in paper and coal the element is gray with a
dashed underline.

diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -263,11 +263,12 @@ filecompchild = '
 shortlog = shortlog.tmpl
 graph = graph.tmpl
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 tagtag = '{name|escape} '
 branchtag = '{name|escape} '
 inbranchtag = '{name|escape} '
 bookmarktag = '{name|escape} '
-alltags = '{phasetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
+alltags = '{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
 shortlogentry = '
   
 {date|rfc822date}
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -222,11 +222,12 @@ filecompchild = '
   {node|short}'
 shortlog = shortlog.tmpl
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 tagtag = '{name|escape} '
 branchtag = '{name|escape} '
 inbranchtag = '{name|escape} '
 bookmarktag = '{name|escape} '
-alltags = '{phasetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
+alltags = '{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
 shortlogentry = '
   
 {date|rfc822date}
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -199,12 +199,13 @@ branchentry = '
 
   '
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 changelogtag = '{name|escape} '
 changesettag = '{tag|escape} '
 changesetbookmark = '{bookmark|escape} '
 changelogbranchhead = '{name|escape} '
 changelogbranchname = '{name|escape} '
-alltags = 
'{phasetag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
+alltags = 
'{phasetag}{obsoletetag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
 
 filediffparent = '
   
diff --git a/mercurial/templates/spartan/changelogentry.tmpl 
b/mercurial/templates/spartan/changelogentry.tmpl
--- a/mercurial/templates/spartan/changelogentry.tmpl
+++ b/mercurial/templates/spartan/changelogentry.tmpl
@@ -22,6 +22,10 @@
   phase:
   {phase|escape}
  ')}
+ {if(obsolete, '
+  obsolete:
+  yes
+ ')}
  
   files:
   {files}
diff --git a/mercurial/templates/spartan/changeset.tmpl 
b/mercurial/templates/spartan/changeset.tmpl
--- a/mercurial/templates/spartan/changeset.tmpl
+++ b/mercurial/templates/spartan/changeset.tmpl
@@ -37,6 +37,10 @@
  phase:
  {phase|escape}
 ')}
+{if(obsolete, '
+ obsolete:
+ yes
+')}
 
  files:
  {files}
diff --git a/mercurial/templates/static/style-gitweb.css 
b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -126,6 +126,10 @@ span.logtags span.phasetag {
background-color: #dfafff;
border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
 }
+span.logtags span.obsoletetag {
+   background-color: #dd;
+   border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
+}
 span.logtags span.tagtag {
background-color: #aa;
border-color: #cc #ffee00 #ffee00 #cc;
diff --git a/mercurial/templates/static/style-monoblue.css 
b/mercurial/templates/static/style-monoblue.css
--- a/mercurial/templates/static/style-monoblue.css
+++ b/mercurial/templates/static/style-monoblue.css
@@ -237,6 +237,10 @@ span.logtags span.phasetag {
   background-color: #dfafff;
   border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
 }
+span.logtags span.obsoletetag {
+  background-color: #dd;
+  border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
+}
 span.logtags span.tagtag {
   background-color: #aa;
   border-color: #cc #ffee00 #ffee00 #cc;
diff --git a/mercurial/templates/static/style-paper.css 
b/mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css
+++ b/mercurial/templates/static/style-paper.css
@@ -146,6 +146,15 @@ a { text-decoration:none; }
   ve

[PATCH 1 of 2 v3] context: add obsolete() method to basefilectx

2017-11-17 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1510977537 -28800
#  Sat Nov 18 11:58:57 2017 +0800
# Node ID 880072944df7bb19b949d9a025a80e7def1a8525
# Parent  b437b4c6a7bec3aad936fcd56d6feda8d3b089d0
# EXP-Topic hgweb-more-info
context: add obsolete() method to basefilectx

This method is now used in webutils.commonentry(), which adds common data items
(commit hash, author, date, etc) for rendering changesets in hgweb. Usually,
commonentry() is given a changectx as ctx; but in views related to files (e.g.
file view, diff, annotate) it's replaced by a filectx, so the latter also needs
to have obsolete() method.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -819,6 +819,8 @@ class basefilectx(object):
 return self._changectx.phase()
 def phasestr(self):
 return self._changectx.phasestr()
+def obsolete(self):
+return self._changectx.obsolete()
 def manifest(self):
 return self._changectx.manifest()
 def changectx(self):
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -361,6 +361,7 @@ def commonentry(repo, ctx):
 'date': ctx.date(),
 'extra': ctx.extra(),
 'phase': ctx.phasestr(),
+'obsolete': ctx.obsolete(),
 'branch': nodebranchnodefault(ctx),
 'inbranch': nodeinbranch(repo, ctx),
 'branches': nodebranchdict(repo, ctx),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] cmdutil: add within-line color diff capacity

2017-11-17 Thread Anton Shestakov
On Sat, 18 Nov 2017 15:38:54 +0900
matthieu.laneuvi...@octobus.net wrote:

> # HG changeset patch
> # User Matthieu Laneuville 
> # Date 1508944418 -32400
> #  Thu Oct 26 00:13:38 2017 +0900
> # Node ID 99b64b304324b89cd8e472faf82e5235a846ff36
> # Parent  75013952d8d9608f73cd45f68405fbd6ec112bf2
> # EXP-Topic hg248
> cmdutil: add within-line color diff capacity
> 
> The `diff' command usually writes deletion in red and insertions in green. 
> This
> patch adds within-line colors, to highlight which part of the lines differ.

Is this what git calls "word diff"? If so, this is great.

> diff -r 75013952d8d9 -r 99b64b304324 mercurial/cmdutil.py
> --- a/mercurial/cmdutil.pyFri Nov 10 19:14:06 2017 +0800
> +++ b/mercurial/cmdutil.pyThu Oct 26 00:13:38 2017 +0900
> @@ -7,6 +7,7 @@
>  
>  from __future__ import absolute_import
>  
> +import difflib
>  import errno
>  import itertools
>  import os
> @@ -1513,6 +1514,11 @@ def diffordiffstat(ui, repo, diffopts, n
>  ui.warn(_('warning: %s not inside relative root %s\n') % (
>  match.uipath(matchroot), uirelroot))
>  
> +store = {
> +'diff.inserted': [],
> +'diff.deleted':[]

Would be nice to have a space after ":".

> +def _inlinediff(s1, s2, direction):
> +'''Perform string diff to highlight specific changes.'''
> +direction_skip = '+?' if direction == 'deleted' else '-?'
> +s = difflib.ndiff(s2.split(' '), s1.split(' '))
> +# buffer required to remove last space, there may be smarter ways to do 
> this
> +buff = []
> +for line in s:
> +if line[0] in direction_skip:
> +continue
> +l = 'diff.'+direction+'.highlight'
> +if line[0] == ' ':
> +l = 'diff.'+direction
> +buff.append((l, line[2:]+' '))

check-code.py complains if you write "1+2": "missing whitespace in
expression" (around the operator), but it doesn't complain when strings
are involved. It should, and this function also should have spaces
around "+".

To be fair, these are all stylistic nitpicks that can probably just be
fixed in-flight, but we do have a
https://www.mercurial-scm.org/wiki/CodingStyle
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] run-tests: outputdir also has to be changed if $TESTDIR is not $PWD

2017-11-17 Thread matthieu . laneuville
# HG changeset patch
# User Matthieu Laneuville 
# Date 1510989120 -32400
#  Sat Nov 18 16:12:00 2017 +0900
# Node ID 2933f3be5afdc2ed50f6865c4f23bc0d4a8c4878
# Parent  75013952d8d9608f73cd45f68405fbd6ec112bf2
# EXP-Topic hg122b
run-tests: outputdir also has to be changed if $TESTDIR is not $PWD

Following a18eef03d879, running run-tests.py from outside tests/ would lead to
the creation of .testtimes and test-*.t.err in $PWD instead of $TESTDIR. This
patch fixes that and updates the relevant test.

diff -r 75013952d8d9 -r 2933f3be5afd tests/run-tests.py
--- a/tests/run-tests.pyFri Nov 10 19:14:06 2017 +0800
+++ b/tests/run-tests.pySat Nov 18 16:12:00 2017 +0900
@@ -2363,6 +2363,9 @@ class TestRunner(object):
 self._outputdir = canonpath(_bytespath(self.options.outputdir))
 else:
 self._outputdir = self._testdir
+if testdescs and pathname and not self._testdir.endswith(b'/'):
+self._outputdir += b'/'
+self._outputdir += pathname
 
 if 'PYTHONHASHSEED' not in os.environ:
 # use a random python hash seed all the time
diff -r 75013952d8d9 -r 2933f3be5afd tests/test-run-tests.t
--- a/tests/test-run-tests.tFri Nov 10 19:14:06 2017 +0800
+++ b/tests/test-run-tests.tSat Nov 18 16:12:00 2017 +0900
@@ -1281,6 +1281,7 @@ support for automatically discovering te
 
 support for running run-tests.py from another directory
   $ mkdir tmp && cd tmp
+
   $ cat > useful-file.sh << EOF
   > important command
   > EOF
@@ -1290,10 +1291,27 @@ support for running run-tests.py from an
   >   important command
   > EOF
 
+  $ cat > test-folder-fail.t << EOF
+  >   $ cat \$TESTDIR/useful-file.sh
+  >   important commando
+  > EOF
+
   $ cd ..
-  $ $PYTHON $TESTDIR/run-tests.py tmp/test-folder.t
-  .
-  # Ran 1 tests, 0 skipped, 0 failed.
+  $ $PYTHON $TESTDIR/run-tests.py tmp/test-*.t
+  
+  --- $TESTTMP/anothertests/tmp/test-folder-fail.t
+  +++ $TESTTMP/anothertests/tmp/test-folder-fail.t.err
+  @@ -1,2 +1,2 @@
+ $ cat $TESTDIR/useful-file.sh
+  -  important commando
+  +  important command
+  
+  ERROR: test-folder-fail.t output changed
+  !.
+  Failed test-folder-fail.t: output changed
+  # Ran 2 tests, 0 skipped, 1 failed.
+  python hash seed: * (glob)
+  [1]
 
 support for bisecting failed tests automatically
   $ hg init bisect
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] cmdutil: add within-line color diff capacity

2017-11-17 Thread matthieu . laneuville
# HG changeset patch
# User Matthieu Laneuville 
# Date 1508944418 -32400
#  Thu Oct 26 00:13:38 2017 +0900
# Node ID 99b64b304324b89cd8e472faf82e5235a846ff36
# Parent  75013952d8d9608f73cd45f68405fbd6ec112bf2
# EXP-Topic hg248
cmdutil: add within-line color diff capacity

The `diff' command usually writes deletion in red and insertions in green. This
patch adds within-line colors, to highlight which part of the lines differ.

The patch passes all tests except `test-diff-color.t' that had to be amended
because of the new default inline coloring.

diff -r 75013952d8d9 -r 99b64b304324 mercurial/cmdutil.py
--- a/mercurial/cmdutil.py  Fri Nov 10 19:14:06 2017 +0800
+++ b/mercurial/cmdutil.py  Thu Oct 26 00:13:38 2017 +0900
@@ -7,6 +7,7 @@
 
 from __future__ import absolute_import
 
+import difflib
 import errno
 import itertools
 import os
@@ -1513,6 +1514,11 @@ def diffordiffstat(ui, repo, diffopts, n
 ui.warn(_('warning: %s not inside relative root %s\n') % (
 match.uipath(matchroot), uirelroot))
 
+store = {
+'diff.inserted': [],
+'diff.deleted':[]
+}
+status = False
 if stat:
 diffopts = diffopts.copy(context=0)
 width = 80
@@ -1529,7 +1535,56 @@ def diffordiffstat(ui, repo, diffopts, n
  changes, diffopts, prefix=prefix,
  relroot=relroot,
  hunksfilterfn=hunksfilterfn):
-write(chunk, label=label)
+# Each deleted/inserted chunk is followed by an EOL chunk with ''
+# label. The 'status' flag helps us grab that second line.
+if label in ['diff.deleted', 'diff.inserted'] or status:
+if status:
+store[status].append(chunk)
+status = False
+else:
+store[label].append(chunk)
+status = label
+continue
+
+if store['diff.inserted'] or store['diff.deleted']:
+# It is possible that the amount of deleted/inserted lines
+# differ, therefore we have to pad them before 1-on-1 
comparison
+while len(store['diff.deleted']) < len(store['diff.inserted']):
+store['diff.deleted'].append(None)
+while len(store['diff.deleted']) > len(store['diff.inserted']):
+store['diff.inserted'].append(None)
+
+# First print all deletions
+for insert, delete in zip(store['diff.inserted'],
+  store['diff.deleted']):
+if not delete:
+continue
+if not insert: # no matching insertion, no diff needed
+write(delete, label='diff.deleted')
+
+else:
+buff = _inlinediff(insert, delete, direction='deleted')
+for line in buff:
+write(line[1], label=line[0])
+
+# Then print all deletions
+for insert, delete in zip(store['diff.inserted'],
+  store['diff.deleted']):
+if not insert:
+continue
+if not delete: # no matching insertion, no diff needed
+write(insert, label='diff.inserted')
+
+else:
+buff = _inlinediff(insert, delete, 
direction='inserted')
+for line in buff:
+write(line[1], label=line[0])
+
+store['diff.inserted'] = []
+store['diff.deleted'] = []
+
+if chunk:
+write(chunk, label=label)
 
 if listsubrepos:
 ctx1 = repo[node1]
@@ -1548,6 +1603,23 @@ def diffordiffstat(ui, repo, diffopts, n
 sub.diff(ui, diffopts, tempnode2, submatch, changes=changes,
  stat=stat, fp=fp, prefix=prefix)
 
+def _inlinediff(s1, s2, direction):
+'''Perform string diff to highlight specific changes.'''
+direction_skip = '+?' if direction == 'deleted' else '-?'
+s = difflib.ndiff(s2.split(' '), s1.split(' '))
+# buffer required to remove last space, there may be smarter ways to do 
this
+buff = []
+for line in s:
+if line[0] in direction_skip:
+continue
+l = 'diff.'+direction+'.highlight'
+if line[0] == ' ':
+l = 'diff.'+direction
+buff.append((l, line[2:]+' '))
+
+buff[-1] = (buff[-1][0], buff[-1][1].strip(' '))
+return buff
+
 def _changesetlabels(ctx):
 labels = ['log.changeset', 'changeset.%s' % ctx.phasestr()]
 if ctx.obsolete():
diff -r 75013952d8d9 -r 99b64b304324 mercurial/color.py
--- a/mercurial/color.pyFri Nov 10 19:14:06 2017 +0800
+++ b/mercurial/color.p

Re: [PATCH 2 of 2 v2] hgweb: show obsolescence status of a commit

2017-11-17 Thread Anton Shestakov
On Sat, 18 Nov 2017 12:41:06 +0800
Anton Shestakov  wrote:

> diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
> --- a/tests/test-obsolete.t
> +++ b/tests/test-obsolete.t
> @@ -1015,6 +1015,43 @@ test summary output
>orphan: 2 changesets
>phase-divergent: 1 changesets
>  
> +#if serve
> +
> +  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E 
> errors.log
> +  $ cat hg.pid >> $DAEMON_PIDS
> +
> +check obsolete changeset
> +
> +  $ get-with-headers.py localhost:$HGPORT 
> 'log?rev=first(obsolete())&style=paper' | grep -A3 ''

Turns out check-code tries to forbid grep with -A, only with not much
success (tests passed for me). I've sent a patch for it.

I'll send a v3.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] check-code: grep's context flags don't need an extra space before number

2017-11-17 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1510981247 -28800
#  Sat Nov 18 13:00:47 2017 +0800
# Node ID 37a6f2a93c9e26a5534a421c0351bcca2bf59062
# Parent  38e695b081ed5fdbaad1da0df6d8236ace5a9f29
# EXP-Topic hgweb-more-info
check-code: grep's context flags don't need an extra space before number

A bit of useless trivia found while researching this: OpenBSD's grep's -C has a
default value (of 2) and disallows space before the argument (while -A and -B
allow).

diff --git a/contrib/check-code.py b/contrib/check-code.py
--- a/contrib/check-code.py
+++ b/contrib/check-code.py
@@ -148,7 +148,7 @@ testpats = [
 (r'\bsed\b.*[^\\]\\n', "don't use 'sed ... \\n', use a \\ and a newline"),
 (r'env.*-u', "don't use 'env -u VAR', use 'unset VAR'"),
 (r'cp.* -r ', "don't use 'cp -r', use 'cp -R'"),
-(r'grep.* -[ABC] ', "don't use grep's context flags"),
+(r'grep.* -[ABC]', "don't use grep's context flags"),
   ],
   # warnings
   [
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 v2] context: add obsolete() method to basefilectx

2017-11-17 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1510977537 -28800
#  Sat Nov 18 11:58:57 2017 +0800
# Node ID f7de3640058b0cef36a1af5b237827a922e84ca2
# Parent  f1e997d4a24fb59ddd33c3780104dc002f870f5c
# EXP-Topic hgweb-more-info
context: add obsolete() method to basefilectx

This method is now used in webutils.commonentry(), which adds common data items
(commit hash, author, date, etc) for rendering changesets in hgweb. Usually,
commonentry() is given a changectx as ctx; but in views related to files (e.g.
file view, diff, annotate) it's replaced by a filectx, so the latter also needs
to have obsolete() method.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -819,6 +819,8 @@ class basefilectx(object):
 return self._changectx.phase()
 def phasestr(self):
 return self._changectx.phasestr()
+def obsolete(self):
+return self._changectx.obsolete()
 def manifest(self):
 return self._changectx.manifest()
 def changectx(self):
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -361,6 +361,7 @@ def commonentry(repo, ctx):
 'date': ctx.date(),
 'extra': ctx.extra(),
 'phase': ctx.phasestr(),
+'obsolete': ctx.obsolete(),
 'branch': nodebranchnodefault(ctx),
 'inbranch': nodeinbranch(repo, ctx),
 'branches': nodebranchdict(repo, ctx),
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2 v2] hgweb: show obsolescence status of a commit

2017-11-17 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1510977848 -28800
#  Sat Nov 18 12:04:08 2017 +0800
# Node ID 38e695b081ed5fdbaad1da0df6d8236ace5a9f29
# Parent  f7de3640058b0cef36a1af5b237827a922e84ca2
# EXP-Topic hgweb-more-info
hgweb: show obsolescence status of a commit

As with phases, spartan theme shows a simple "obsolete: yes" on its own line
(this allows replacing "yes" with something more useful in future, like output
of obsfate* template functions). In gitweb and monoblue the element has gray
background, in paper and coal the element is gray with a dashed underline.

diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -263,11 +263,12 @@ filecompchild = '
 shortlog = shortlog.tmpl
 graph = graph.tmpl
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 tagtag = '{name|escape} '
 branchtag = '{name|escape} '
 inbranchtag = '{name|escape} '
 bookmarktag = '{name|escape} '
-alltags = '{phasetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
+alltags = '{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
 shortlogentry = '
   
 {date|rfc822date}
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -222,11 +222,12 @@ filecompchild = '
   {node|short}'
 shortlog = shortlog.tmpl
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 tagtag = '{name|escape} '
 branchtag = '{name|escape} '
 inbranchtag = '{name|escape} '
 bookmarktag = '{name|escape} '
-alltags = '{phasetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
+alltags = '{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
 shortlogentry = '
   
 {date|rfc822date}
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -199,12 +199,13 @@ branchentry = '
 
   '
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 changelogtag = '{name|escape} '
 changesettag = '{tag|escape} '
 changesetbookmark = '{bookmark|escape} '
 changelogbranchhead = '{name|escape} '
 changelogbranchname = '{name|escape} '
-alltags = 
'{phasetag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
+alltags = 
'{phasetag}{obsoletetag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
 
 filediffparent = '
   
diff --git a/mercurial/templates/spartan/changelogentry.tmpl 
b/mercurial/templates/spartan/changelogentry.tmpl
--- a/mercurial/templates/spartan/changelogentry.tmpl
+++ b/mercurial/templates/spartan/changelogentry.tmpl
@@ -22,6 +22,10 @@
   phase:
   {phase|escape}
  ')}
+ {if(obsolete, '
+  obsolete:
+  yes
+ ')}
  
   files:
   {files}
diff --git a/mercurial/templates/spartan/changeset.tmpl 
b/mercurial/templates/spartan/changeset.tmpl
--- a/mercurial/templates/spartan/changeset.tmpl
+++ b/mercurial/templates/spartan/changeset.tmpl
@@ -37,6 +37,10 @@
  phase:
  {phase|escape}
 ')}
+{if(obsolete, '
+ obsolete:
+ yes
+')}
 
  files:
  {files}
diff --git a/mercurial/templates/static/style-gitweb.css 
b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -126,6 +126,10 @@ span.logtags span.phasetag {
background-color: #dfafff;
border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
 }
+span.logtags span.obsoletetag {
+   background-color: #dd;
+   border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
+}
 span.logtags span.tagtag {
background-color: #aa;
border-color: #cc #ffee00 #ffee00 #cc;
diff --git a/mercurial/templates/static/style-monoblue.css 
b/mercurial/templates/static/style-monoblue.css
--- a/mercurial/templates/static/style-monoblue.css
+++ b/mercurial/templates/static/style-monoblue.css
@@ -237,6 +237,10 @@ span.logtags span.phasetag {
   background-color: #dfafff;
   border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
 }
+span.logtags span.obsoletetag {
+  background-color: #dd;
+  border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4e4;
+}
 span.logtags span.tagtag {
   background-color: #aa;
   border-color: #cc #ffee00 #ffee00 #cc;
diff --git a/mercurial/templates/static/style-paper.css 
b/mercurial/templates/static/style-paper.css
--- a/mercurial/templates/static/style-paper.css
+++ b/mercurial/templates/static/style-paper.css
@@ -146,6 +146,15 @@ a { text-decoration:none; }
   vertical-align: baseline;
 }
 
+.obsolete {
+  color: #999;
+  font-size: 70%;
+  border-bottom: 1px

D1336: remove: print message for each file in verbose mode only while using `-A`

2017-11-17 Thread pavanpc (Pavan Kumar PC)
pavanpc added a comment.


  @yuja Thank you for your input. Now, warnings are suppressed for the 
directory case. Also, I have added test cases for the above cases.

REPOSITORY
  rHG Mercurial

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

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


D1336: remove: print message for each file in verbose mode only while using `-A`

2017-11-17 Thread pavanpc (Pavan Kumar PC)
pavanpc updated this revision to Diff 3621.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1336?vs=3435&id=3621

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-remove.t

CHANGE DETAILS

diff --git a/tests/test-remove.t b/tests/test-remove.t
--- a/tests/test-remove.t
+++ b/tests/test-remove.t
@@ -189,9 +189,9 @@
   \r (no-eol) (esc)
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-21 state clean, options -A
+21 state clean, options -Av
 
-  $ remove -A foo
+  $ remove -Av foo
   \r (no-eol) (esc)
   deleting [===>] 1/1\r (no-eol) (esc)
   \r (no-eol) (esc)
@@ -205,10 +205,10 @@
   ./foo
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-22 state modified, options -A
+22 state modified, options -Av
 
   $ echo b >> foo
-  $ remove -A foo
+  $ remove -Av foo
   \r (no-eol) (esc)
   deleting [===>] 1/1\r (no-eol) (esc)
   \r (no-eol) (esc)
@@ -357,9 +357,32 @@
   \r (no-eol) (esc)
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
-dir, options -A
+dir, options -Av
 
   $ rm test/bar
+  $ remove -Av test
+  \r (no-eol) (esc)
+  deleting [===>] 1/1\r (no-eol) (esc)
+  \r (no-eol) (esc)
+  \r (no-eol) (esc)
+  skipping [===>] 1/1\r (no-eol) (esc)
+  \r (no-eol) (esc)
+  \r (no-eol) (esc)
+  deleting [===>] 1/1\r (no-eol) (esc)
+  \r (no-eol) (esc)
+  removing test/bar (glob)
+  not removing test/foo: file still exists (glob)
+  exit code: 1
+  R test/bar
+  ./foo
+  ./test/foo
+  \r (no-eol) (esc)
+  updating [===>] 1/1\r (no-eol) (esc)
+  \r (no-eol) (esc)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+dir, options -A  
+  $ rm test/bar
   $ remove -A test
   \r (no-eol) (esc)
   deleting [===>] 1/1\r (no-eol) (esc)
@@ -371,7 +394,26 @@
   deleting [===>] 1/1\r (no-eol) (esc)
   \r (no-eol) (esc)
   removing test/bar (glob)
-  not removing test/foo: file still exists (glob)
+  exit code: 1
+  R test/bar
+  ./foo
+  ./test/foo
+  \r (no-eol) (esc)
+  updating [===>] 1/1\r (no-eol) (esc)
+  \r (no-eol) (esc)
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+without any files/dirs, options -A 
+  $ rm test/bar
+  $ remove -A 
+  \r (no-eol) (esc)
+  skipping [=>  ] 1/2\r (no-eol) (esc)
+  skipping [===>] 2/2\r (no-eol) (esc)
+  \r (no-eol) (esc)
+  \r (no-eol) (esc)
+  deleting [===>] 1/1\r (no-eol) (esc)
+  \r (no-eol) (esc)
+  removing test/bar (glob)
   exit code: 1
   R test/bar
   ./foo
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2975,8 +2975,9 @@
 for f in remaining:
 count += 1
 ui.progress(_('skipping'), count, total=total, unit=_('files'))
-warnings.append(_('not removing %s: file still exists\n')
-% m.rel(f))
+if ui.verbose or (f in files):
+warnings.append(_('not removing %s: file still exists\n')
+% m.rel(f))
 ret = 1
 ui.progress(_('skipping'), None)
 else:



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


Re: [PATCH 4 of 5 STABLE RFC] dispatch: ignore --early-bool-option that might not be a flag (BC)

2017-11-17 Thread Augie Fackler
On Wed, Nov 15, 2017 at 09:54:23PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1510321154 -32400
> #  Fri Nov 10 22:39:14 2017 +0900
> # Branch stable
> # Node ID c2c34cf080aefbd983320bdaca111ebbd0826ff3
> # Parent  5838a6130d07b588e4640542865e3c175a124bff
> dispatch: ignore --early-bool-option that might not be a flag (BC)

This one worries me less. Maybe we can land it?

>
> The basic idea is if the preceding arg doesn't look like a flag taking a
> value, the current arg can be parsed as a flag.
>
>   hg ci -m --foo --config  # bad: --foo may be a flag
>   hg ci -m --verbose --config  # good: --verbose known to take no value
># whether it is a value for -m or a flag
>
> --debugger/--profile/--traceback are all for developers. They don't need to
> be any fancy. So let's turn it to safer side.
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -106,6 +106,22 @@ globalopts = [
>  # TODO: perhaps --debugger should be included
>  earlyoptflags = ("--cwd", "-R", "--repository", "--repo", "--config")
>
> +# core options known to be always boolean type (i.e. takes no value)
> +corebooloptflags = {
> +'-y', '--noninteractive',
> +'-q', '--quiet',
> +'-v', '--verbose',
> +'--debug',
> +'--debugger',
> +'--traceback',
> +'--time',
> +'--profile',
> +'--version',
> +'-h', '--help',
> +'--hidden',
> +'--mq',  # mostly global as mqopt is inserted into all repo commands
> +}
> +
>  dryrunopts = cmdutil.dryrunopts
>  remoteopts = cmdutil.remoteopts
>  walkopts = cmdutil.walkopts
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -644,6 +644,13 @@ def _parseconfig(ui, config):
>
>  return configs
>
> +def _argmaytakevalue(arg):
> +"""True if the given arg looks like an option flag taking the next item
> +as its value"""
> +return (arg.startswith('-')
> +and not (arg.startswith('--') and '=' in arg)  # --opt=val
> +and arg not in commands.corebooloptflags)
> +
>  def _earlygetopt(aliases, args, strip=True):
>  """Return list of values for an option (or aliases).
>
> @@ -751,17 +758,48 @@ def _earlyreqoptbool(req, name, aliases)
>
>  >>> req = request([b'x', b'--', b'--debugger'])
>  >>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
> +
> +Options can't appear immediately after any option-like flag:
> +
> +>>> req = request([b'x', b'-z', b'--debugger'])
> +>>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
> +
> +>>> req = request([b'x', b'-z', b'--zzz', b'--debugger'])
> +>>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
> +
> +unless the preceding flag is known to be a boolean:
> +
> +>>> req = request([b'x', b'-v', b'--debugger'])
> +>>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
> +True
> +
> +>>> req = request([b'x', b'--debug', b'--debugger'])
> +>>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
> +True
> +
> +>>> req = request([b'x', b'-z', b'--debugger', b'--debugger'])
> +>>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
> +True
> +
> +or it takes an immediate value:
> +
> +>>> req = request([b'x', b'--foo=bar', b'--debugger'])
> +>>> _earlyreqoptbool(req, b'debugger', [b'--debugger'])
> +True
>  """
>  try:
>  argcount = req.args.index("--")
>  except ValueError:
>  argcount = len(req.args)
>  value = None
> +inopt = False
>  pos = 0
>  while pos < argcount:
>  arg = req.args[pos]
> -if arg in aliases:
> +if arg in aliases and not inopt:
>  value = True
> +else:
> +inopt = _argmaytakevalue(arg)
>  pos += 1
>  req.earlyoptions[name] = value
>  return value
> @@ -897,7 +935,8 @@ def _dispatch(req):
>  "option -R has to be separated from other options (e.g. not "
>  "-qR) and --repository may only be abbreviated as --repo!"))
>  if options["debugger"] != req.earlyoptions["debugger"]:
> -raise error.Abort(_("option --debugger may not be abbreviated!"))
> +raise error.Abort(_("option --debugger may not be abbreviated "
> +"and should come very first!"))
>  # don't validate --profile/--traceback, which can be enabled from now
>
>  if options["encoding"]:
> diff --git a/tests/test-dispatch.t b/tests/test-dispatch.t
> --- a/tests/test-dispatch.t
> +++ b/tests/test-dispatch.t
> @@ -54,7 +54,12 @@ Parsing of early options should stop at
>  Unparsable form of early options:
>
>$ hg cat --debugg
> -  abort: option --debugger may not be abbreviated!
> +  abort: option --debugger may not be abbreviated and should come very first!
> +  [255]
> +  $ hg log -T --

Re: [PATCH 5 of 5 STABLE RFC] dispatch: ignore --early-list-opt that might not be a flag (BC)

2017-11-17 Thread Augie Fackler
On Wed, Nov 15, 2017 at 09:54:24PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara 
> # Date 1510321154 -32400
> #  Fri Nov 10 22:39:14 2017 +0900
> # Branch stable
> # Node ID f1892a7fd3fdca0401072041774be62a1774bacd
> # Parent  c2c34cf080aefbd983320bdaca111ebbd0826ff3
> dispatch: ignore --early-list-opt that might not be a flag (BC)

I've gone ahead and queued patches 1-3 for stable, as they seem like
fairly straightforward correctness wins here.

I'm really conflicted on these last two. The test changes in this one
suggest to me it'll be at least somewhat painful in the real world, so
it should probably be opt-in. We could at least document how to opt-in
on `hg help scripting`, which would probably be enough to catch the
eye of people doing security-relevant things, assuming they read docs
at all (which is probably a stretch.)

>
> As you can see, not a few tests have to be updated because of this change.
> Given we use --config/--cwd/-R more extensively in tests, this might not
> be terrible in real word, but I don't know.
>
> So, what can we do?
>
>  a) enable this by default
>  b) or, add config knob or env var to enable this
>  c) or, add config knob or env var to enable more restricted version
> ...
>
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -692,6 +692,38 @@ def _earlygetopt(aliases, args, strip=Tr
>  >>> args = [b'x', b'-R', b'--', b'y']
>  >>> _earlygetopt([b'-R'], args), args
>  ([], ['x', '-R', '--', 'y'])
> +
> +Options can't appear immediately after any option-like flag:
> +
> +>>> args = [b'x', b'-b', b'--cwd', b'foo']
> +>>> _earlygetopt([b'--cwd'], args), args
> +([], ['x', '-b', '--cwd', 'foo'])
> +
> +>>> args = [b'x', b'-b', b'--branch', b'--cwd', b'foo']
> +>>> _earlygetopt([b'--cwd'], args), args
> +([], ['x', '-b', '--branch', '--cwd', 'foo'])
> +
> +>>> args = [b'x', b'--branch', b'--cwd', b'foo']
> +>>> _earlygetopt([b'--cwd'], args), args
> +([], ['x', '--branch', '--cwd', 'foo'])
> +
> +unless the preceding flag is known to be a boolean:
> +
> +>>> args = [b'x', b'--time', b'--cwd', b'foo']
> +>>> _earlygetopt([b'--cwd'], args), args
> +(['foo'], ['x', '--time'])
> +
> +or is known to be a value for the previous early option:
> +
> +>>> args = [b'x', b'--cwd', b'--foo', b'--cwd', b'--bar', b'baz']
> +>>> _earlygetopt([b'--cwd'], args), args
> +(['--foo', '--bar'], ['x', 'baz'])
> +
> +or the preceding flag takes an immediate value:
> +
> +>>> args = [b'x', b'--foo=bar', b'--cwd', b'baz']
> +>>> _earlygetopt([b'--cwd'], args), args
> +(['baz'], ['x', '--foo=bar'])
>  """
>  try:
>  argcount = args.index("--")
> @@ -699,6 +731,7 @@ def _earlygetopt(aliases, args, strip=Tr
>  argcount = len(args)
>  shortopts = [opt for opt in aliases if len(opt) == 2]
>  values = []
> +inopt = False
>  pos = 0
>  while pos < argcount:
>  fullarg = arg = args[pos]
> @@ -707,7 +740,7 @@ def _earlygetopt(aliases, args, strip=Tr
>  equals = arg.find('=')
>  if equals > -1:
>  arg = arg[:equals]
> -if arg in aliases:
> +if arg in aliases and not inopt:
>  if equals > -1:
>  values.append(fullarg[equals + 1:])
>  if strip:
> @@ -725,7 +758,7 @@ def _earlygetopt(aliases, args, strip=Tr
>  argcount -= 2
>  else:
>  pos += 2
> -elif arg[:2] in shortopts:
> +elif arg[:2] in shortopts and not inopt:
>  # short option can have no following space, e.g. hg log -Rfoo
>  values.append(args[pos][2:])
>  if strip:
> @@ -734,6 +767,7 @@ def _earlygetopt(aliases, args, strip=Tr
>  else:
>  pos += 1
>  else:
> +inopt = _argmaytakevalue(fullarg)
>  pos += 1
>  return values
>
> @@ -927,13 +961,16 @@ def _dispatch(req):
>  cmd, func, args, options, cmdoptions = _parse(lui, args)
>
>  if options["config"] != req.earlyoptions["config"]:
> -raise error.Abort(_("option --config may not be abbreviated!"))
> +raise error.Abort(_("option --config may not be abbreviated "
> +"and should come very first!"))
>  if options["cwd"] != req.earlyoptions["cwd"]:
> -raise error.Abort(_("option --cwd may not be abbreviated!"))
> +raise error.Abort(_("option --cwd may not be abbreviated "
> +"and should come very first!"))
>  if options["repository"] != req.earlyoptions["repository"]:
>  raise error.Abort(_(
>  "option -R has to be separated from other options (e.g. not "
> -"-qR) and --repository may only be abbreviated as --r

D1345: dirstate: add explicit methods for querying directories (API)

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG88ed6f5f6c86: dirstate: add explicit methods for querying 
directories (API) (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1345?vs=3519&id=3619

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

AFFECTED FILES
  contrib/perf.py
  hgext/largefiles/reposetup.py
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -157,8 +157,8 @@
 def _pl(self):
 return self._map.parents()
 
-def dirs(self):
-return self._map.dirs
+def hasdir(self, d):
+return self._map.hastrackeddir(d)
 
 @rootcache('.hgignore')
 def _ignore(self):
@@ -390,11 +390,11 @@
 oldstate = self[f]
 if state == 'a' or oldstate == 'r':
 scmutil.checkfilename(f)
-if f in self._map.dirs:
+if self._map.hastrackeddir(f):
 raise error.Abort(_('directory %r already in dirstate') % f)
 # shadows
 for d in util.finddirs(f):
-if d in self._map.dirs:
+if self._map.hastrackeddir(d):
 break
 entry = self._map.get(d)
 if entry is not None and entry[0] != 'r':
@@ -770,7 +770,6 @@
 results = dict.fromkeys(subrepos)
 results['.hg'] = None
 
-alldirs = None
 for ff in files:
 # constructing the foldmap is expensive, so don't do it for the
 # common case where files is ['.']
@@ -801,9 +800,7 @@
 if nf in dmap: # does it exactly match a missing file?
 results[nf] = None
 else: # does it match a missing directory?
-if alldirs is None:
-alldirs = util.dirs(dmap._map)
-if nf in alldirs:
+if self._map.hasdir(nf):
 if matchedir:
 matchedir(nf)
 notfoundadd(nf)
@@ -1197,9 +1194,6 @@
 - `otherparentset` is a set of the filenames that are marked as coming
   from the second parent when the dirstate is currently being merged.
 
-- `dirs` is a set-like object containing all the directories that contain
-  files in the dirstate, excluding any files that are marked as removed.
-
 - `filefoldmap` is a dict mapping normalized filenames to the denormalized
   form that they appear as in the dirstate.
 
@@ -1235,7 +1229,8 @@
 self._map.clear()
 self.copymap.clear()
 self.setparents(nullid, nullid)
-util.clearcachedproperty(self, "dirs")
+util.clearcachedproperty(self, "_dirs")
+util.clearcachedproperty(self, "_alldirs")
 util.clearcachedproperty(self, "filefoldmap")
 util.clearcachedproperty(self, "dirfoldmap")
 util.clearcachedproperty(self, "nonnormalset")
@@ -1268,8 +1263,10 @@
 
 def addfile(self, f, oldstate, state, mode, size, mtime):
 """Add a tracked file to the dirstate."""
-if oldstate in "?r" and "dirs" in self.__dict__:
-self.dirs.addpath(f)
+if oldstate in "?r" and "_dirs" in self.__dict__:
+self._dirs.addpath(f)
+if oldstate == "?" and "_alldirs" in self.__dict__:
+self._alldirs.addpath(f)
 self._map[f] = dirstatetuple(state, mode, size, mtime)
 if state != 'n' or mtime == -1:
 self.nonnormalset.add(f)
@@ -1284,8 +1281,10 @@
 the file's previous state.  In the future, we should refactor this
 to be more explicit about what that state is.
 """
-if oldstate not in "?r" and "dirs" in self.__dict__:
-self.dirs.delpath(f)
+if oldstate not in "?r" and "_dirs" in self.__dict__:
+self._dirs.delpath(f)
+if oldstate == "?" and "_alldirs" in self.__dict__:
+self._alldirs.addpath(f)
 if "filefoldmap" in self.__dict__:
 normed = util.normcase(f)
 self.filefoldmap.pop(normed, None)
@@ -1299,8 +1298,10 @@
 """
 exists = self._map.pop(f, None) is not None
 if exists:
-if oldstate != "r" and "dirs" in self.__dict__:
-self.dirs.delpath(f)
+if oldstate != "r" and "_dirs" in self.__dict__:
+self._dirs.delpath(f)
+if "_alldirs" in self.__dict__:
+self._alldirs.delpath(f)
 if "filefoldmap" in self.__dict__:
 normed = util.normcase(f)
 self.filefoldmap.pop(normed, None)
@@ -1349,13 +1350,28 @@
 f['.'] = '.' # prevents useless util.fspath() invocation
 return f
 
+def hastrackeddir(self, d):
+"""
+Returns True if the dirstate contains a tracked (not remov

D1347: dirstate: make map implementation overridable

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG51f155abc689: dirstate: make map implementation overridable 
(authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1347?vs=3521&id=3620

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -80,6 +80,7 @@
 self._plchangecallbacks = {}
 self._origpl = None
 self._updatedfiles = set()
+self._mapcls = dirstatemap
 
 @contextlib.contextmanager
 def parentchange(self):
@@ -128,7 +129,7 @@
 @propertycache
 def _map(self):
 """Return the dirstate contents (see documentation for dirstatemap)."""
-self._map = dirstatemap(self._ui, self._opener, self._root)
+self._map = self._mapcls(self._ui, self._opener, self._root)
 return self._map
 
 @property



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


D1346: fsmonitor: only access inner dirstate map if it is available

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5d53247190d3: fsmonitor: only access inner dirstate map if 
it is available (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1346?vs=3520&id=3618

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

AFFECTED FILES
  hgext/fsmonitor/__init__.py

CHANGE DETAILS

diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py
+++ b/hgext/fsmonitor/__init__.py
@@ -273,7 +273,11 @@
 
 matchfn = match.matchfn
 matchalways = match.always()
-dmap = self._map._map
+dmap = self._map
+if util.safehasattr(dmap, '_map'):
+# for better performance, directly access the inner dirstate map if the
+# standard dirstate implementation is in use.
+dmap = dmap._map
 nonnormalset = self._map.nonnormalset
 
 copymap = self._map.copymap



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


D1344: dirstate: remove _droppath method

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG8b498ae36d0c: dirstate: remove _droppath method (authored 
by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1344?vs=3518&id=3617

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -386,9 +386,6 @@
 def copies(self):
 return self._map.copymap
 
-def _droppath(self, f):
-self._updatedfiles.add(f)
-
 def _addpath(self, f, state, mode, size, mtime):
 oldstate = self[f]
 if state == 'a' or oldstate == 'r':
@@ -465,7 +462,6 @@
 def remove(self, f):
 '''Mark a file removed.'''
 self._dirty = True
-self._droppath(f)
 oldstate = self[f]
 size = 0
 if self._pl[1] != nullid:
@@ -477,6 +473,7 @@
 elif entry[0] == 'n' and entry[2] == -2: # other parent
 size = -2
 self._map.otherparentset.add(f)
+self._updatedfiles.add(f)
 self._map.removefile(f, oldstate, size)
 if size == 0:
 self._map.copymap.pop(f, None)
@@ -492,7 +489,7 @@
 oldstate = self[f]
 if self._map.dropfile(f, oldstate):
 self._dirty = True
-self._droppath(f)
+self._updatedfiles.add(f)
 self._map.copymap.pop(f, None)
 
 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):



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


D1380: dirstate: document dirstatemap interface

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG74b8563e4f13: dirstate: document dirstatemap interface 
(authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1380?vs=3513&id=3612

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -127,8 +127,7 @@
 
 @propertycache
 def _map(self):
-'''Return the dirstate contents as a map from filename to
-(state, mode, size, time).'''
+"""Return the dirstate contents (see documentation for dirstatemap)."""
 self._map = dirstatemap(self._ui, self._opener, self._root)
 return self._map
 
@@ -1196,6 +1195,44 @@
 self._opener.unlink(backupname)
 
 class dirstatemap(object):
+"""Map encapsulating the dirstate's contents.
+
+The dirstate contains the following state:
+
+- `identity` is the identity of the dirstate file, which can be used to
+  detect when changes have occurred to the dirstate file.
+
+- `parents` is a pair containing the parents of the working copy. The
+  parents are updated by calling `setparents`.
+
+- the state map maps filenames to tuples of (state, mode, size, mtime),
+  where state is a single character representing 'normal', 'added',
+  'removed', or 'merged'. It is accessed by treating the dirstate as a
+  dict.
+
+- `copymap` maps destination filenames to their source filename.
+
+The dirstate also provides the following views onto the state:
+
+- `nonnormalset` is a set of the filenames that have state other
+  than 'normal', or are normal but have an mtime of -1 ('normallookup').
+
+- `otherparentset` is a set of the filenames that are marked as coming
+  from the second parent when the dirstate is currently being merged.
+
+- `dirs` is a set-like object containing all the directories that contain
+  files in the dirstate, excluding any files that are marked as removed.
+
+- `filefoldmap` is a dict mapping normalized filenames to the denormalized
+  form that they appear as in the dirstate.
+
+- `dirfoldmap` is a dict mapping normalized directory names to the
+  denormalized form that they appear as in the dirstate.
+
+Once instantiated, the nonnormalset, otherparentset, dirs, filefoldmap and
+dirfoldmap views must be maintained by the caller.
+"""
+
 def __init__(self, ui, opener, root):
 self._ui = ui
 self._opener = opener



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


D1340: dirstate: add explicit methods for modifying dirstate

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd85f598b24e0: dirstate: add explicit methods for modifying 
dirstate (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1340?vs=3514&id=3613

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -415,11 +415,11 @@
 self._map.dirs.addpath(f)
 self._dirty = True
 self._updatedfiles.add(f)
-self._map[f] = dirstatetuple(state, mode, size, mtime)
 if state != 'n' or mtime == -1:
 self._map.nonnormalset.add(f)
 if size == -2:
 self._map.otherparentset.add(f)
+self._map.addfile(f, state, mode, size, mtime)
 
 def normal(self, f):
 '''Mark a file normal and clean.'''
@@ -490,8 +490,8 @@
 elif entry[0] == 'n' and entry[2] == -2: # other parent
 size = -2
 self._map.otherparentset.add(f)
-self._map[f] = dirstatetuple('r', 0, size, 0)
 self._map.nonnormalset.add(f)
+self._map.removefile(f, size)
 if size == 0:
 self._map.copymap.pop(f, None)
 
@@ -503,10 +503,9 @@
 
 def drop(self, f):
 '''Drop a file from the dirstate'''
-if f in self._map:
+if self._map.dropfile(f):
 self._dirty = True
 self._droppath(f)
-del self._map[f]
 if f in self._map.nonnormalset:
 self._map.nonnormalset.remove(f)
 self._map.copymap.pop(f, None)
@@ -636,7 +635,7 @@
 for f in self._updatedfiles:
 e = dmap.get(f)
 if e is not None and e[0] == 'n' and e[3] == now:
-dmap[f] = dirstatetuple(e[0], e[1], e[2], -1)
+dmap.addfile(f, e[0], e[1], e[2], -1)
 self._map.nonnormalset.add(f)
 
 # emulate that all 'dirstate.normal' results are written out
@@ -1207,8 +1206,9 @@
 
 - the state map maps filenames to tuples of (state, mode, size, mtime),
   where state is a single character representing 'normal', 'added',
-  'removed', or 'merged'. It is accessed by treating the dirstate as a
-  dict.
+  'removed', or 'merged'. It is read by treating the dirstate as a
+  dict.  File state is updated by calling the `addfile`, `removefile` and
+  `dropfile` methods.
 
 - `copymap` maps destination filenames to their source filename.
 
@@ -1282,22 +1282,37 @@
 def __contains__(self, key):
 return key in self._map
 
-def __setitem__(self, key, value):
-self._map[key] = value
-
 def __getitem__(self, key):
 return self._map[key]
 
-def __delitem__(self, key):
-del self._map[key]
-
 def keys(self):
 return self._map.keys()
 
 def preload(self):
 """Loads the underlying data, if it's not already loaded"""
 self._map
 
+def addfile(self, f, state, mode, size, mtime):
+"""Add a tracked file to the dirstate."""
+self._map[f] = dirstatetuple(state, mode, size, mtime)
+
+def removefile(self, f, size):
+"""
+Mark a file as removed in the dirstate.
+
+The `size` parameter is used to store sentinel values that indicate
+the file's previous state.  In the future, we should refactor this
+to be more explicit about what that state is.
+"""
+self._map[f] = dirstatetuple('r', 0, size, 0)
+
+def dropfile(self, f):
+"""
+Remove a file from the dirstate.  Returns True if the file was
+previously recorded.
+"""
+return self._map.pop(f, None) is not None
+
 def nonnormalentries(self):
 '''Compute the nonnormal dirstate entries from the dmap'''
 try:
@@ -1427,8 +1442,6 @@
 # Avoid excess attribute lookups by fast pathing certain checks
 self.__contains__ = self._map.__contains__
 self.__getitem__ = self._map.__getitem__
-self.__setitem__ = self._map.__setitem__
-self.__delitem__ = self._map.__delitem__
 self.get = self._map.get
 
 def write(self, st, now):



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


D1342: dirstate: move management of the dirstate dirs into the dirstatemap

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG7e93c8c71502: dirstate: move management of the dirstate 
dirs into the dirstatemap (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1342?vs=3516&id=3615

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -387,9 +387,6 @@
 return self._map.copymap
 
 def _droppath(self, f):
-if self[f] not in "?r" and "dirs" in self._map.__dict__:
-self._map.dirs.delpath(f)
-
 if "filefoldmap" in self._map.__dict__:
 normed = util.normcase(f)
 if normed in self._map.filefoldmap:
@@ -411,11 +408,9 @@
 if entry is not None and entry[0] != 'r':
 raise error.Abort(
 _('file %r in dirstate clashes with %r') % (d, f))
-if oldstate in "?r" and "dirs" in self._map.__dict__:
-self._map.dirs.addpath(f)
 self._dirty = True
 self._updatedfiles.add(f)
-self._map.addfile(f, state, mode, size, mtime)
+self._map.addfile(f, oldstate, state, mode, size, mtime)
 
 def normal(self, f):
 '''Mark a file normal and clean.'''
@@ -476,6 +471,7 @@
 '''Mark a file removed.'''
 self._dirty = True
 self._droppath(f)
+oldstate = self[f]
 size = 0
 if self._pl[1] != nullid:
 entry = self._map.get(f)
@@ -486,7 +482,7 @@
 elif entry[0] == 'n' and entry[2] == -2: # other parent
 size = -2
 self._map.otherparentset.add(f)
-self._map.removefile(f, size)
+self._map.removefile(f, oldstate, size)
 if size == 0:
 self._map.copymap.pop(f, None)
 
@@ -498,7 +494,8 @@
 
 def drop(self, f):
 '''Drop a file from the dirstate'''
-if self._map.dropfile(f):
+oldstate = self[f]
+if self._map.dropfile(f, oldstate):
 self._dirty = True
 self._droppath(f)
 self._map.copymap.pop(f, None)
@@ -1217,8 +1214,8 @@
 - `dirfoldmap` is a dict mapping normalized directory names to the
   denormalized form that they appear as in the dirstate.
 
-Once instantiated, the dirs, filefoldmap and dirfoldmap views must be
-maintained by the caller.
+Once instantiated, the filefoldmap and dirfoldmap views must be maintained
+by the caller.
 """
 
 def __init__(self, ui, opener, root):
@@ -1280,31 +1277,38 @@
 """Loads the underlying data, if it's not already loaded"""
 self._map
 
-def addfile(self, f, state, mode, size, mtime):
+def addfile(self, f, oldstate, state, mode, size, mtime):
 """Add a tracked file to the dirstate."""
+if oldstate in "?r" and "dirs" in self.__dict__:
+self.dirs.addpath(f)
 self._map[f] = dirstatetuple(state, mode, size, mtime)
 if state != 'n' or mtime == -1:
 self.nonnormalset.add(f)
 if size == -2:
 self.otherparentset.add(f)
 
-def removefile(self, f, size):
+def removefile(self, f, oldstate, size):
 """
 Mark a file as removed in the dirstate.
 
 The `size` parameter is used to store sentinel values that indicate
 the file's previous state.  In the future, we should refactor this
 to be more explicit about what that state is.
 """
+if oldstate not in "?r" and "dirs" in self.__dict__:
+self.dirs.delpath(f)
 self._map[f] = dirstatetuple('r', 0, size, 0)
 self.nonnormalset.add(f)
 
-def dropfile(self, f):
+def dropfile(self, f, oldstate):
 """
 Remove a file from the dirstate.  Returns True if the file was
 previously recorded.
 """
 exists = self._map.pop(f, None) is not None
+if exists:
+if oldstate != "r" and "dirs" in self.__dict__:
+self.dirs.delpath(f)
 self.nonnormalset.discard(f)
 return exists
 



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


D1341: dirstate: move management of nonnormal sets into dirstate map

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfd745bbf00c5: dirstate: move management of nonnormal sets 
into dirstate map (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1341?vs=3515&id=3614

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -415,10 +415,6 @@
 self._map.dirs.addpath(f)
 self._dirty = True
 self._updatedfiles.add(f)
-if state != 'n' or mtime == -1:
-self._map.nonnormalset.add(f)
-if size == -2:
-self._map.otherparentset.add(f)
 self._map.addfile(f, state, mode, size, mtime)
 
 def normal(self, f):
@@ -490,7 +486,6 @@
 elif entry[0] == 'n' and entry[2] == -2: # other parent
 size = -2
 self._map.otherparentset.add(f)
-self._map.nonnormalset.add(f)
 self._map.removefile(f, size)
 if size == 0:
 self._map.copymap.pop(f, None)
@@ -506,8 +501,6 @@
 if self._map.dropfile(f):
 self._dirty = True
 self._droppath(f)
-if f in self._map.nonnormalset:
-self._map.nonnormalset.remove(f)
 self._map.copymap.pop(f, None)
 
 def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
@@ -631,12 +624,7 @@
 
 # emulate dropping timestamp in 'parsers.pack_dirstate'
 now = _getfsnow(self._opener)
-dmap = self._map
-for f in self._updatedfiles:
-e = dmap.get(f)
-if e is not None and e[0] == 'n' and e[3] == now:
-dmap.addfile(f, e[0], e[1], e[2], -1)
-self._map.nonnormalset.add(f)
+self._map.clearambiguoustimes(self._updatedfiles, now)
 
 # emulate that all 'dirstate.normal' results are written out
 self._lastnormaltime = 0
@@ -1229,8 +1217,8 @@
 - `dirfoldmap` is a dict mapping normalized directory names to the
   denormalized form that they appear as in the dirstate.
 
-Once instantiated, the nonnormalset, otherparentset, dirs, filefoldmap and
-dirfoldmap views must be maintained by the caller.
+Once instantiated, the dirs, filefoldmap and dirfoldmap views must be
+maintained by the caller.
 """
 
 def __init__(self, ui, opener, root):
@@ -1295,6 +1283,10 @@
 def addfile(self, f, state, mode, size, mtime):
 """Add a tracked file to the dirstate."""
 self._map[f] = dirstatetuple(state, mode, size, mtime)
+if state != 'n' or mtime == -1:
+self.nonnormalset.add(f)
+if size == -2:
+self.otherparentset.add(f)
 
 def removefile(self, f, size):
 """
@@ -1305,13 +1297,23 @@
 to be more explicit about what that state is.
 """
 self._map[f] = dirstatetuple('r', 0, size, 0)
+self.nonnormalset.add(f)
 
 def dropfile(self, f):
 """
 Remove a file from the dirstate.  Returns True if the file was
 previously recorded.
 """
-return self._map.pop(f, None) is not None
+exists = self._map.pop(f, None) is not None
+self.nonnormalset.discard(f)
+return exists
+
+def clearambiguoustimes(self, files, now):
+for f in files:
+e = self.get(f)
+if e is not None and e[0] == 'n' and e[3] == now:
+self._map[f] = dirstatetuple(e[0], e[1], e[2], -1)
+self.nonnormalset.add(f)
 
 def nonnormalentries(self):
 '''Compute the nonnormal dirstate entries from the dmap'''



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


D1343: dirstate: move dropping of folded filenames into the dirstate map

2017-11-17 Thread mbthomas (Mark Thomas)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6326579352cf: dirstate: move dropping of folded filenames 
into the dirstate map (authored by mbthomas, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1343?vs=3517&id=3616

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -387,11 +387,6 @@
 return self._map.copymap
 
 def _droppath(self, f):
-if "filefoldmap" in self._map.__dict__:
-normed = util.normcase(f)
-if normed in self._map.filefoldmap:
-del self._map.filefoldmap[normed]
-
 self._updatedfiles.add(f)
 
 def _addpath(self, f, state, mode, size, mtime):
@@ -1213,9 +1208,6 @@
 
 - `dirfoldmap` is a dict mapping normalized directory names to the
   denormalized form that they appear as in the dirstate.
-
-Once instantiated, the filefoldmap and dirfoldmap views must be maintained
-by the caller.
 """
 
 def __init__(self, ui, opener, root):
@@ -1297,6 +1289,9 @@
 """
 if oldstate not in "?r" and "dirs" in self.__dict__:
 self.dirs.delpath(f)
+if "filefoldmap" in self.__dict__:
+normed = util.normcase(f)
+self.filefoldmap.pop(normed, None)
 self._map[f] = dirstatetuple('r', 0, size, 0)
 self.nonnormalset.add(f)
 
@@ -1309,6 +1304,9 @@
 if exists:
 if oldstate != "r" and "dirs" in self.__dict__:
 self.dirs.delpath(f)
+if "filefoldmap" in self.__dict__:
+normed = util.normcase(f)
+self.filefoldmap.pop(normed, None)
 self.nonnormalset.discard(f)
 return exists
 



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


D1427: logtoprocess: add a test to show pager and ltp bad interaction

2017-11-17 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Jun, any idea why this might be chg-broken?

REPOSITORY
  rHG Mercurial

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

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


D1383: bundlerepo: rename "bundle" arguments to "cgunpacker"

2017-11-17 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2d4972eb94b0: bundlerepo: rename "bundle" 
arguments to "cgunpacker" (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1383?vs=3461&id=3610

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

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -42,7 +42,7 @@
 )
 
 class bundlerevlog(revlog.revlog):
-def __init__(self, opener, indexfile, bundle, linkmapper):
+def __init__(self, opener, indexfile, cgunpacker, linkmapper):
 # How it works:
 # To retrieve a revision, we need to know the offset of the revision in
 # the bundle (an unbundle object). We store this offset in the index
@@ -52,15 +52,15 @@
 # check revision against repotiprev.
 opener = vfsmod.readonlyvfs(opener)
 revlog.revlog.__init__(self, opener, indexfile)
-self.bundle = bundle
+self.bundle = cgunpacker
 n = len(self)
 self.repotiprev = n - 1
 self.bundlerevs = set() # used by 'bundle()' revset expression
-for deltadata in bundle.deltaiter():
+for deltadata in cgunpacker.deltaiter():
 node, p1, p2, cs, deltabase, delta, flags = deltadata
 
 size = len(delta)
-start = bundle.tell() - size
+start = cgunpacker.tell() - size
 
 link = linkmapper(cs)
 if node in self.nodemap:
@@ -165,10 +165,10 @@
 raise NotImplementedError
 
 class bundlechangelog(bundlerevlog, changelog.changelog):
-def __init__(self, opener, bundle):
+def __init__(self, opener, cgunpacker):
 changelog.changelog.__init__(self, opener)
 linkmapper = lambda x: x
-bundlerevlog.__init__(self, opener, self.indexfile, bundle,
+bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker,
   linkmapper)
 
 def baserevision(self, nodeorrev):
@@ -186,9 +186,10 @@
 self.filteredrevs = oldfilter
 
 class bundlemanifest(bundlerevlog, manifest.manifestrevlog):
-def __init__(self, opener, bundle, linkmapper, dirlogstarts=None, dir=''):
+def __init__(self, opener, cgunpacker, linkmapper, dirlogstarts=None,
+ dir=''):
 manifest.manifestrevlog.__init__(self, opener, dir=dir)
-bundlerevlog.__init__(self, opener, self.indexfile, bundle,
+bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker,
   linkmapper)
 if dirlogstarts is None:
 dirlogstarts = {}
@@ -217,9 +218,9 @@
 return super(bundlemanifest, self).dirlog(d)
 
 class bundlefilelog(bundlerevlog, filelog.filelog):
-def __init__(self, opener, path, bundle, linkmapper):
+def __init__(self, opener, path, cgunpacker, linkmapper):
 filelog.filelog.__init__(self, opener, path)
-bundlerevlog.__init__(self, opener, self.indexfile, bundle,
+bundlerevlog.__init__(self, opener, self.indexfile, cgunpacker,
   linkmapper)
 
 def baserevision(self, nodeorrev):
@@ -246,12 +247,12 @@
 self.invalidate()
 self.dirty = True
 
-def _getfilestarts(bundle):
 bundlefilespos = {}
-for chunkdata in iter(bundle.filelogheader, {}):
+def _getfilestarts(cgunpacker):
+for chunkdata in iter(cgunpacker.filelogheader, {}):
 fname = chunkdata['filename']
 bundlefilespos[fname] = bundle.tell()
-for chunk in iter(lambda: bundle.deltachunk(None), {}):
+for chunk in iter(lambda: cgunpacker.deltachunk(None), {}):
 pass
 return bundlefilespos
 



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


D1382: bundlerepo: use early return

2017-11-17 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG2b1373d8ef93: bundlerepo: use early return (authored by 
indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1382?vs=3460&id=3609

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

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -319,19 +319,19 @@
[ctx.node() for ctx in self[self.firstnewrev:]])
 
 def _handlebundle2part(self, bundle, part):
-if part.type == 'changegroup':
-cgstream = part
-version = part.params.get('version', '01')
-legalcgvers = changegroup.supportedincomingversions(self)
-if version not in legalcgvers:
-msg = _('Unsupported changegroup version: %s')
-raise error.Abort(msg % version)
-if bundle.compressed():
-cgstream = self._writetempbundle(part.read,
- ".cg%sun" % version)
+if part.type != 'changegroup':
+return
 
-self._cgunpacker = changegroup.getunbundler(version, cgstream,
- 'UN')
+cgstream = part
+version = part.params.get('version', '01')
+legalcgvers = changegroup.supportedincomingversions(self)
+if version not in legalcgvers:
+msg = _('Unsupported changegroup version: %s')
+raise error.Abort(msg % version)
+if bundle.compressed():
+cgstream = self._writetempbundle(part.read, '.cg%sun' % version)
+
+self._cgunpacker = changegroup.getunbundler(version, cgstream, 'UN')
 
 def _writetempbundle(self, readfn, suffix, header=''):
 """Write a temporary file to disk



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


D1384: bundlerepo: rename "bundlefilespos" variable and attribute

2017-11-17 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5ae62363ae55: bundlerepo: rename "bundlefilespos" 
variable and attribute (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1384?vs=3462&id=3611

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

AFFECTED FILES
  mercurial/bundlerepo.py

CHANGE DETAILS

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -247,14 +247,14 @@
 self.invalidate()
 self.dirty = True
 
-bundlefilespos = {}
 def _getfilestarts(cgunpacker):
+filespos = {}
 for chunkdata in iter(cgunpacker.filelogheader, {}):
 fname = chunkdata['filename']
-bundlefilespos[fname] = bundle.tell()
+filespos[fname] = cgunpacker.tell()
 for chunk in iter(lambda: cgunpacker.deltachunk(None), {}):
 pass
-return bundlefilespos
+return filespos
 
 class bundlerepository(localrepo.localrepository):
 """A repository instance that is a union of a local repo and a bundle.
@@ -312,8 +312,8 @@
 raise error.Abort(_('bundle type %s cannot be read') %
   type(bundle))
 
-# dict with the mapping 'filename' -> position in the bundle
-self.bundlefilespos = {}
+# dict with the mapping 'filename' -> position in the changegroup.
+self._cgfilespos = {}
 
 self.firstnewrev = self.changelog.repotiprev + 1
 phases.retractboundary(self, None, phases.draft,
@@ -403,12 +403,12 @@
 return self._url
 
 def file(self, f):
-if not self.bundlefilespos:
+if not self._cgfilespos:
 self._cgunpacker.seek(self.filestart)
-self.bundlefilespos = _getfilestarts(self._cgunpacker)
+self._cgfilespos = _getfilestarts(self._cgunpacker)
 
-if f in self.bundlefilespos:
-self._cgunpacker.seek(self.bundlefilespos[f])
+if f in self._cgfilespos:
+self._cgunpacker.seek(self._cgfilespos[f])
 linkmapper = self.unfiltered().changelog.rev
 return bundlefilelog(self.svfs, f, self._cgunpacker, linkmapper)
 else:



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


D1431: sshpeer: add a configurable hint for the ssh error message

2017-11-17 Thread durin42 (Augie Fackler)
durin42 requested changes to this revision.
durin42 added a comment.
This revision now requires changes to proceed.


  D'oh: this also needs to be documented, probably in `hg help config`. That's 
from `mercurial/help/config.txt` - hopefully it'll be fairly straightforward to 
add?

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 02 of 15 V2] bookmark: add methods to binary encode and decode bookmark values

2017-11-17 Thread Sean Farley

Augie Fackler  writes:

>> On Nov 13, 2017, at 05:16, Boris Feld  wrote:
>>
>> On Fri, 2017-11-10 at 17:35 -0500, Augie Fackler wrote:
>>> (+indygreg, who also is a formats enthusiast)
>>>
>>> On Thu, Nov 02, 2017 at 02:17:59PM +0100, Boris Feld wrote:
 # HG changeset patch
 # User Boris Feld 
 # Date 1508072395 -7200
 #  Sun Oct 15 14:59:55 2017 +0200
 # Node ID 4d0c6772a81aa1e2b25f32f944563db1f33fd327
 # Parent  8c9a9eecdcd61401a1604a08a5272f7dabd4b912
 # EXP-Topic b2.bookmarks
 # Available At https://bitbucket.org/octobus/mercurial-devel/
 #  hg pull https://bitbucket.org/octobus/mercurial-deve
 l/ -r 4d0c6772a81a
 bookmark: add methods to binary encode and decode bookmark values

 Coming new bundle2 parts related to bookmark will use a binary
 encoding. It
 encodes a series of '(bookmark, node)' pairs. Bookmark name has a
 high enough
 size limit to not be affected by issue5165. (64K length, we are
 well covered)
>>>
>>> I'm not thrilled here. Could we do some sort of varint encoding,
>>> which
>>> would be generally useful going forward for a variety of things,
>>> rather than just shrugging and setting a limit which we (today) deem
>>> absurdly large?
>>
>> We are not sure what the value of that would be. Bundle2 makes it very
>> easy to move to a newer encoding version if needed.
>
> I mean, not really. We have to add a b2cap, and then we've got to maintain 
> multiple versions forever. It's kind of a pain. A varint encoding wouldn't be 
> hard, and will probably take O(an hour) to code up. I'd entertain that much 
> more eagerly than just dropping a uint64 in here and asserting it should be 
> big enough forever.
>
>> We are already
>> doing so for changegroup and obsmarkers.
>>
>> The biggest bookmark we have seen was about 800 characters, that should
>> leave us some room for the future without blocking us.
>
> That you know about. I seem to remember violent arguments that 255 bytes 
> should be more than enough. I agree a 64k bookmark sounds totally insane, but 
> what if I wanted to put base64'd test result metadata in a bookmark?
>
>>
>>>
>>> I agree that practically speaking, nobody should have a 64k bookmark,
>>> but we can do better. We also know that \0 shouldn't appear in a
>>> bookmark name, so we could just make the format be
>>> null-terminated. I'd much rather we get in the practice of
>>> deliberately crafting formats that are maximally flexible and
>>> reusable.
>>
>> That would be significantly harder to parse since we would need to
>> search for the '\0' in the stream. We do not think it brings much value
>> either since any new data we sneak into the last field would have to be
>> understood by the receiver. If we need to negotiate for such
>> capabilities, this is equivalent to rolling out a new encoding.
>
> Then let's explore the varint option. Here's a rough sketch of a reader:
>
> import io
> src = io.BytesIO(b'\xff\x01')
> cur = ord(src.read(1))
> i = cur & 0x7f
> while cur & 0x80:
> i = i << 7
> cur = ord(src.read(1))
> i += cur & 0x7f
> assert 0b111001 == i
>
> Gives you 7 bits of value per byte transmitted, which means that we'll get 
> most realistic bookmark lengths in two bytes of "here's how much string" 
> (probably one byte for the vast majority of ascii cases!)
>
> I'd much rather we just build up the infrastructure for stuff like this _now_ 
> and start using it, rather than continue to punt and shove massive uint64 
> fields in and then pray it'll be enough for all eternity. It does mean we 
> can't use struct anymore, but that seems like a comparatively small price to 
> pay for being able to trivially make this future proof.
>
> (As before, if other reviewers think I'm being too hard on this, please speak 
> up.)

Just to chime in here with some Bitbucket data. All branch names and
git refs on Bitbucket all fall in < 1K. That's because we arbitrarily
set that long ago and there hasn't ever been an issue.

In fact, if you try to have a longer ref name, I suspect you'd hit the
MAX_PATH limit before the 1K limit. Regardless, parts of Bitbucket will
straight-up 500 on long names. To add to this, designing a layout for
bookmarks / branches / refs listing is fairly difficult, UX-wise, when
such a long limit is given.

I'd lean on saying 64K is too large, actually, and that binary encoding
is just not what bookmark names should be. (so, yes, I think 64k is more
than enough)


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


Re: [PATCH 2 of 2] config: rename allow_push to allow-push

2017-11-17 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Nov 17, 2017 at 1:04 PM, David Demelier  wrote:
> Le 17 nov. 2017 18:35, Martin von Zweigbergk  a écrit
> :
>
> On Fri, Nov 10, 2017 at 6:09 AM, David Demelier 
> wrote:
>> # HG changeset patch
>> # User David Demelier 
>> # Date 1508406401 -7200
>> #  Thu Oct 19 11:46:41 2017 +0200
>> # Node ID 7618db2f7c818bcfd73393fff45a13e50fa9250b
>> # Parent  4157480049dabdf7bd54160c909baf13ea8d5107
>> config: rename allow_push to allow-push
>>
>> diff -r 4157480049da -r 7618db2f7c81 mercurial/help/config.txt
>> --- a/mercurial/help/config.txt Thu Oct 19 11:43:19 2017 +0200
>> +++ b/mercurial/help/config.txt Thu Oct 19 11:46:41 2017 +0200
>> @@ -2290,13 +2290,13 @@
>>  ``allow-pull``
>>  Whether to allow pulling from the repository. (default: True)
>>
>> -``allow_push``
>> +``allow-push``
>>  Whether to allow pushing to the repository. If empty or not set,
>>  pushing is not allowed. If the special value ``*``, any remote
>>  user can push, including unauthenticated users. Otherwise, the
>>  remote user must have been authenticated, and the authenticated
>>  user name must be present in this list. The contents of the
>> -allow_push list are examined after the deny_push list.
>> +allow-push list are examined after the deny_push list.
>
>
> Hmm, it seems weird not to change deny_push in the same series. Could
> we have a patch for that too, please? (Or tell me what I'm missing.)
>
> all the hgrc will be taken in account :)

I assume they will be eventually. It's just in a weird state right
now. It's not the end of the world, of course, but it would have been
better to have those two renamed together.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] config: rename allow_push to allow-push

2017-11-17 Thread David Demelier
Le 17 nov. 2017 18:35, Martin von Zweigbergk  a écrit :On Fri, Nov 10, 2017 at 6:09 AM, David Demelier  wrote:

> # HG changeset patch

> # User David Demelier 

> # Date 1508406401 -7200

> #  Thu Oct 19 11:46:41 2017 +0200

> # Node ID 7618db2f7c818bcfd73393fff45a13e50fa9250b

> # Parent  4157480049dabdf7bd54160c909baf13ea8d5107

> config: rename allow_push to allow-push

>

> diff -r 4157480049da -r 7618db2f7c81 mercurial/help/config.txt

> --- a/mercurial/help/config.txt Thu Oct 19 11:43:19 2017 +0200

> +++ b/mercurial/help/config.txt Thu Oct 19 11:46:41 2017 +0200

> @@ -2290,13 +2290,13 @@

>  ``allow-pull``

>  Whether to allow pulling from the repository. (default: True)

>

> -``allow_push``

> +``allow-push``

>  Whether to allow pushing to the repository. If empty or not set,

>  pushing is not allowed. If the special value ``*``, any remote

>  user can push, including unauthenticated users. Otherwise, the

>  remote user must have been authenticated, and the authenticated

>  user name must be present in this list. The contents of the

> -    allow_push list are examined after the deny_push list.

> +    allow-push list are examined after the deny_push list.





Hmm, it seems weird not to change deny_push in the same series. Could

we have a patch for that too, please? (Or tell me what I'm missing.)




all the hgrc will be taken in account :)___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D821: unamend: move fb extension unamend to core

2017-11-17 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> durin42 wrote in uncommit.py:265
> Should we also look for unamend_source in the extra, and potentially refuse 
> to unamend an unamend? Or not?

Okay while trying to add this condition, I found we cannot refuse to unamend a 
changeset on the basis of unamend_source, for e.g
`a -amend-> b -unamend-> a' -amend-> c -unamend-> a''`

But if we refuse on basis on unamend_source, unamend `c` will refuse. We need 
to be more smart here but when I think the other way around, I think it's okay 
to unamend an unamend. I am open to suggestion and will go with what you guys 
prefer is good.

REPOSITORY
  rHG Mercurial

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

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


[Bug 5745] New: hg import --exact yields crasgh

2017-11-17 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5745

Bug ID: 5745
   Summary: hg import --exact yields crasgh
   Product: Mercurial
   Version: 4.3.1
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: david.a.holl...@carrier.utc.com
CC: mercurial-devel@mercurial-scm.org

Created file called export using:

 hg export -o export -r e8118e6e186d


The changeset being exported contained a single file deletion.

If I import it without --exact it seems to fail silently. The changset is not
imported. But if I use --exact then I get the error below.




λ hg import --exact ..\repo\export
applying ..\repo\export
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64
bit (AMD64)]
** Mercurial Distributed SCM (version 4.3.1)
** Extensions loaded: convert, graphlog, eol, strip, transplant, rebase,
relink, extdiff
Traceback (most recent call last):
  File "hg", line 61, in 
  File "mercurial\dispatch.pyo", line 81, in run
  File "mercurial\dispatch.pyo", line 162, in dispatch
  File "mercurial\dispatch.pyo", line 302, in _runcatch
  File "mercurial\dispatch.pyo", line 310, in _callcatch
  File "mercurial\scmutil.pyo", line 150, in callcatch
  File "mercurial\dispatch.pyo", line 292, in _runcatchfunc
  File "mercurial\dispatch.pyo", line 896, in _dispatch
  File "mercurial\dispatch.pyo", line 658, in runcommand
  File "mercurial\dispatch.pyo", line 904, in _runcommand
  File "mercurial\dispatch.pyo", line 893, in 
  File "mercurial\util.pyo", line 1077, in check
  File "mercurial\commands.pyo", line 3024, in import_
  File "mercurial\cmdutil.pyo", line 1297, in tryimportone
TypeError: b2a_hex() argument 1 must be string or buffer, not None





Here's the patch file called "export":

λ type export
# HG changeset patch
# User cleanbuild
# Date 1510922542 18000
#  Fri Nov 17 07:42:22 2017 -0500
# Branch x
# Node ID e8118e6e186d32642afd20bf06d0bcb0f7917692
# Parent  e4f55415d598eb942d8c7f2b36bc1abc7bd312bb
remove binary from source control

diff -r e4f55415d598 -r e8118e6e186d path/to/file/filename
Binary file path/to/file/filename has changed

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


D1358: remotenames: store journal entry for bookmarks if journal is loaded

2017-11-17 Thread durham (Durham Goode)
durham added a comment.


  There seems like two use cases for remotenames:  knowledge about the most 
recently seen location of each remote bookmark, and knowledge about where the 
remote bookmarks have been over time.  I think 99% of the benefit of 
remotenames comes from the first part.  Building a storage layer which suits 
both the journal and remotenames seems like massive scope creep to address the 
1% use case.  Even if we did unify the storage models, I still don't believe 
remotenames and the journal could share a common storage format because they 
don't have similar access patterns.  Remotenames is much more of a random 
access dict-like object, while the journal is much more of a sequential log.  
If I want to lookup the value of the latest remote master I don't want to deal 
with scanning some log of recent activity, and if I want to maintain a log of 
recent activity I don't want to build an index that allows for random access.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH 6 of 6 V2] test-pattern: actually update tests using the patterns

2017-11-17 Thread Augie Fackler
On Wed, Nov 15, 2017 at 05:07:06PM +0100, Boris Feld wrote:
> On Mon, 2017-11-13 at 18:09 -0500, Augie Fackler wrote:
> > On Mon, Nov 13, 2017 at 12:11:20PM +0100, Boris Feld wrote:
> > > # HG changeset patch
> > > # User Boris Feld 
> > > # Date 1509866592 -3600
> > > #  Sun Nov 05 08:23:12 2017 +0100
> > > # Node ID 715948f2256fa181c4f3730825492f9da0f74b2e
> > > # Parent  c06ed80fc1063905dc6a711fc32c88d5913b0db6
> > > # EXP-Topic better-substitute
> > > # Available At https://bitbucket.org/octobus/mercurial-devel/
> > > #  hg pull https://bitbucket.org/octobus/mercurial-deve
> > > l/ -r 715948f2256f
> > > test-pattern: actually update tests using the patterns
> >
> >
> > I love this feature. But, could we get away with a non-.py file
> > for configuring the substitutions? Maybe just use a configparser file
> > for now?
> >
> > I'm hesitant to use Python files for config languages, it's been a
> > bad
> > experience in the past.
>
> We give a try to the INI format but it doesn't seem to handle well
> multi-lines and special characters which are painful for defining 200
> characters regexp.

For the record, this argument was not convincing.

>
> One argument in favor Python files is that we can have dynamic
> definition that computes values from the environment. run-test.py
> already has to do this for LOCALIP, so we expect more case to show up.

But this one seems unavoidable and hopelessly regrettable. Queued with regret.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] hgweb: show obsolescence status of a commit

2017-11-17 Thread Augie Fackler
On Fri, Nov 17, 2017 at 04:39:16PM +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov 
> # Date 1510906994 -28800
> #  Fri Nov 17 16:23:14 2017 +0800
> # Node ID 6ff29042647acd6d5f938b0e321afe4ce7df5508
> # Parent  f1e997d4a24fb59ddd33c3780104dc002f870f5c
> # EXP-Topic hgweb-more-info
> hgweb: show obsolescence status of a commit
>
> A new method is added to basefilectx class because filectx and changectx are
> used interchangeably in hgweb views related to files (e.g. file view, diff,
> annotate).
>
> As with phases, spartan theme shows a simple "obsolete: yes" on its own line
> (this allows replacing "yes" with something more useful in future, like output
> of obsfate* template functions). In gitweb and monoblue the element has gray
> background, in paper and coal the element is gray with a dashed underline.
>
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -819,6 +819,8 @@ class basefilectx(object):
>  return self._changectx.phase()
>  def phasestr(self):
>  return self._changectx.phasestr()
> +def obsolete(self):
> +return self._changectx.obsolete()

My only comment is to send the context.py as a standalone change, but
even that's not really a hard requirement.

I like the feature, go ahead and send v2?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 2] config: rename allow_push to allow-push

2017-11-17 Thread Martin von Zweigbergk via Mercurial-devel
On Fri, Nov 10, 2017 at 6:09 AM, David Demelier  wrote:
> # HG changeset patch
> # User David Demelier 
> # Date 1508406401 -7200
> #  Thu Oct 19 11:46:41 2017 +0200
> # Node ID 7618db2f7c818bcfd73393fff45a13e50fa9250b
> # Parent  4157480049dabdf7bd54160c909baf13ea8d5107
> config: rename allow_push to allow-push
>
> diff -r 4157480049da -r 7618db2f7c81 mercurial/help/config.txt
> --- a/mercurial/help/config.txt Thu Oct 19 11:43:19 2017 +0200
> +++ b/mercurial/help/config.txt Thu Oct 19 11:46:41 2017 +0200
> @@ -2290,13 +2290,13 @@
>  ``allow-pull``
>  Whether to allow pulling from the repository. (default: True)
>
> -``allow_push``
> +``allow-push``
>  Whether to allow pushing to the repository. If empty or not set,
>  pushing is not allowed. If the special value ``*``, any remote
>  user can push, including unauthenticated users. Otherwise, the
>  remote user must have been authenticated, and the authenticated
>  user name must be present in this list. The contents of the
> -allow_push list are examined after the deny_push list.
> +allow-push list are examined after the deny_push list.


Hmm, it seems weird not to change deny_push in the same series. Could
we have a patch for that too, please? (Or tell me what I'm missing.)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 5744] New: help text for hg bundle doesn't explain what [DEST] is for

2017-11-17 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=5744

Bug ID: 5744
   Summary: help text for hg bundle doesn't explain what [DEST] is
for
   Product: Mercurial
   Version: 4.3.1
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: david.a.holl...@carrier.utc.com
CC: mercurial-devel@mercurial-scm.org

The help text for the hg bundle command indicates there is an optional argument
[DEST] which may be used but it does not explain what the argument is for.

The --verbose option doesn't add this information either.

Sample output placed below.






λ hg --version
Mercurial Distributed SCM (version 4.3.1)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2017 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



λ hg bundle --help
hg bundle [-f] [-t BUNDLESPEC] [-a] [-r REV]... [--base REV]... FILE [DEST]

create a bundle file

Generate a bundle file containing data to be added to a repository.

To create a bundle containing all changesets, use -a/--all (or --base
null). Otherwise, hg assumes the destination will have all the nodes you
specify with --base parameters. Otherwise, hg will assume the repository
has all the nodes in destination, or default-push/default if no
destination is specified.

You can change bundle format with the -t/--type option. See 'hg help
bundlespec' for documentation on this format. By default, the most
appropriate format is used and compression defaults to bzip2.

The bundle file can then be transferred using conventional means and
applied to another repository with the unbundle or pull command. This is
useful when direct push and pull are not available or when exporting an
entire repository is undesirable.

Applying bundles preserves all changeset contents including permissions,
copy/rename information, and revision history.

Returns 0 on success, 1 if no changes found.

options ([+] can be repeated):

 -f --force run even when the destination is unrelated
 -r --rev REV [+]   a changeset intended to be added to the destination
 -b --branch BRANCH [+] a specific branch you would like to bundle
--base REV [+]  a base changeset assumed to be available at the
destination
 -a --all   bundle all changesets in the repository
 -t --type TYPE bundle compression type to use (default: bzip2)
 -e --ssh CMD   specify ssh command to use
--remotecmd CMD specify hg command to run on the remote side
--insecure  do not verify server certificate (ignoring web.cacerts
config)

(some details hidden, use --verbose to show complete help)

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


D971: uncommit: unify functions _uncommitdirstate and _unamenddirstate to one

2017-11-17 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In https://phab.mercurial-scm.org/D971#22932, @durin42 wrote:
  
  > (Marking accepted, but consider just moving this to `scmutil` or 
`rewriteutil` (I made that second one up, but it might be a sensible thing to 
have?) in parallel with the inevitable bikeshedding over on 
https://phab.mercurial-scm.org/D821.
  
  
  `rewriteutil` sounds good. This aligns with our plans of moving evolve to 
core and I will do that.

REPOSITORY
  rHG Mercurial

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

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


D821: unamend: move fb extension unamend to core

2017-11-17 Thread pulkit (Pulkit Goyal)
pulkit added a subscriber: quark.
pulkit added inline comments.

INLINE COMMENTS

> durin42 wrote in uncommit.py:247
> undo the _most recent_ amend? or can I run this iteratively and undo many 
> amends in sequence?

Nice catch, it should be undo the _most recent_ amend. Thanks!

> durin42 wrote in uncommit.py:265
> Should we also look for unamend_source in the extra, and potentially refuse 
> to unamend an unamend? Or not?

I don't think users will run unamend(1) and then will try to run unamend(2) 
again to unamend the first unamend. It's not intuitive in my opinion. @durham 
@quark what do you guys think here?

REPOSITORY
  rHG Mercurial

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

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


D1444: tweakdefaults: turn on ui.statuscopies

2017-11-17 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG58fea953e130: tweakdefaults: turn on ui.statuscopies 
(authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1444?vs=3588&id=3591

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

AFFECTED FILES
  mercurial/ui.py
  tests/test-status.t

CHANGE DETAILS

diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -572,6 +572,10 @@
   $ hg st --config ui.statuscopies=false
   M a
   R b
+  $ hg st --config ui.tweakdefaults=yes
+  M a
+b
+  R b
 
 using log status template (issue5155)
   $ hg log -Tstatus -r 'wdir()' -C
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -49,6 +49,8 @@
 [ui]
 # The rollback command is dangerous. As a rule, don't use it.
 rollback = False
+# Make `hg status` report copy information
+statuscopies = yes
 
 [commands]
 # Make `hg status` emit cwd-relative paths by default.



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


D1381: crecord: fix revert -ir '.^' crash caused by 3649c3f2cd

2017-11-17 Thread quark (Jun Wu)
This revision was automatically updated to reflect the committed changes.
quark marked an inline comment as done.
Closed by commit rHGc220bdd610da: crecord: fix revert -ir '.^' crash 
caused by 3649c3f2cd (authored by quark, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1381?vs=3494&id=3592

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

AFFECTED FILES
  mercurial/crecord.py

CHANGE DETAILS

diff --git a/mercurial/crecord.py b/mercurial/crecord.py
--- a/mercurial/crecord.py
+++ b/mercurial/crecord.py
@@ -555,7 +555,7 @@
 return chunkselector.opts
 
 _headermessages = { # {operation: text}
-'revert': _('Select hunks to revert'),
+'apply': _('Select hunks to apply'),
 'discard': _('Select hunks to discard'),
 None: _('Select hunks to record'),
 }



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


D1433: run-tests: fix TESTDIR if testdescs are absolute paths

2017-11-17 Thread spectral (Kyle Lippincott)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGdb5da5c563d0: run-tests: fix TESTDIR if testdescs are 
absolute paths (authored by spectral, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D1433?vs=3578&id=3590#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1433?vs=3578&id=3590

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2356,9 +2356,9 @@
 # assume all tests in same folder for now
 if testdescs:
 pathname = os.path.dirname(testdescs[0]['path'])
-if pathname and not osenvironb[b'TESTDIR'].endswith(b'/'):
-osenvironb[b'TESTDIR'] += b'/'
-osenvironb[b'TESTDIR'] += pathname
+if pathname:
+osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'],
+  pathname)
 if self.options.outputdir:
 self._outputdir = canonpath(_bytespath(self.options.outputdir))
 else:



To: spectral, #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


D1336: remove: print message for each file in verbose mode only while using `-A`

2017-11-17 Thread yuja (Yuya Nishihara)
yuja added a comment.


  In https://phab.mercurial-scm.org/D1336#23872, @pavanpc wrote:
  
  > 4. hg rm -A   -  What should be the 
behavior here? What if the directory has thousands of  files . May be we can 
suppress warnings based on number of files in the warnings list, like if 
len(warnings_list) > 25 suppress warnings ? or always suppress warnings for 
this case
  
  
  I think "always suppress" is the right thing to do because I would run `hg rm 
-A `
  to record deleted files under the directory. In matcher, I think only 
`m.files()` needs to
  be warned.
  
  > -I PATTERN or -X PATTERN
  
  I see these patterns are not "explicit" files, so won't be warned.

REPOSITORY
  rHG Mercurial

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

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


D1433: run-tests: fix TESTDIR if testdescs are absolute paths

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


  Queued, thanks. FIle APIs still accept bytes/unicode on Py3.

INLINE COMMENTS

> run-tests.py:2359
>  pathname = os.path.dirname(testdescs[0]['path'])
> -if pathname and not osenvironb[b'TESTDIR'].endswith(b'/'):
> -osenvironb[b'TESTDIR'] += b'/'
> -osenvironb[b'TESTDIR'] += pathname
> +osenvironb[b'TESTDIR'] = os.path.join(osenvironb[b'TESTDIR'],
> +  pathname)

Restored `if pathname:` part, caught by test-run-tests.t

REPOSITORY
  rHG Mercurial

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

To: spectral, #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: Upstreaming Facebook extensions

2017-11-17 Thread Matt Harbison

> On Nov 16, 2017, at 2:03 PM, Augie Fackler  wrote:
> 
> 
>> On Nov 16, 2017, at 12:05, David Soria Parra  
>> wrote:
>> 
>> Already commented on this. We use this day-to-day and it seems to be solid. 
>> A few things:
>> 
>> - UI:
>> - The progress bar gets confused by downloads, as those are done one by one. 
>> We need to improve how we show the amount of lfs files and the bytes to 
>> download. Something we can figure out while upstreaming
>> - Resumable Downloads:
>> - We don’t support that yet. Should be in there, but not urgent for 
>> upstreaming.
> 
> None of these seem worrying
> 
>> - Additional consistency checks:
>> - We know that somehow it can happen that a file only gets partially 
>> downloaded. We need to better consistency check before upstreaming.
> 
> seems vaguely important for a "done" feature

I couldn’t interrupt the download, but if I corrupt the file in the local store 
and then update/cat/etc, that aborts with a message about corruption.  So it’s 
not silent corruption, and may be just a case of figuring out how to fix the 
file in the local store.  I’m not sure largefiles handles that case any better.

That said, I see it will happily upload a corrupt file.  I’ve got a patch once 
the first series is queued.

>> - Interaction with largefiles
>> - We need a consistent story how to get from largefiles to LFS and back. 
>> Alternatively we can just say “you can’t use LFS if you used largefiles”.
> 
> I'm fine to just have the extension refuse, and point to docs on how to use 
> convert to escape the clutches of the old largefiles. Not sure if that's 
> practical, but it's at least a  start and we could advance the state of the 
> art later if it proves painful for people.

I haven’t tried with largefiles yet, but I wonder if that works ok because it 
doesn’t actually track the huge file.  I’ve seen code that attempts to handle 
switching between large and normal, so switching might just be a remove and 
re-add.  The only thing that seems iffy is the config settings that allow *new* 
files to be added as large automatically.  It would be nice if they played 
together with convert.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH] hgweb: show obsolescence status of a commit

2017-11-17 Thread Anton Shestakov
On Fri, 17 Nov 2017 16:39:16 +0800
Anton Shestakov  wrote:

> # HG changeset patch
> # User Anton Shestakov 
> # Date 1510906994 -28800
> #  Fri Nov 17 16:23:14 2017 +0800
> # Node ID 6ff29042647acd6d5f938b0e321afe4ce7df5508
> # Parent  f1e997d4a24fb59ddd33c3780104dc002f870f5c
> # EXP-Topic hgweb-more-info
> hgweb: show obsolescence status of a commit
> 
> A new method is added to basefilectx class because filectx and changectx are
> used interchangeably in hgweb views related to files (e.g. file view, diff,
> annotate).
> 
> As with phases, spartan theme shows a simple "obsolete: yes" on its own line
> (this allows replacing "yes" with something more useful in future, like output
> of obsfate* template functions). In gitweb and monoblue the element has gray
> background, in paper and coal the element is gray with a dashed underline.

[snip]

> diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
> --- a/tests/test-obsolete.t
> +++ b/tests/test-obsolete.t
> @@ -1015,6 +1015,43 @@ test summary output
>orphan: 2 changesets
>phase-divergent: 1 changesets
>  
> +#if serve
> +
> +  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E 
> errors.log
> +  $ cat hg.pid >> $DAEMON_PIDS
> +
> +check changeset with instabilities

Oops, this should say "obsolete changeset". I can resend, but I will
wait for more feedback first.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1336: remove: print message for each file in verbose mode only while using `-A`

2017-11-17 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.


  I guess the other case is when -I PATTERN or -X PATTERN are used instead of 
file names.  These will be inexact matches like when a directory is specified.  
I don’t like the dual behavior controlled by how many files are in the 
directory, because the it will seem inconsistent.

REPOSITORY
  rHG Mercurial

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

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


D1336: remove: print message for each file in verbose mode only while using `-A`

2017-11-17 Thread mitrandir (Mateusz Jakub Kwapich)
mitrandir added a comment.


  I think that the cases mentioned by you are right :) In case of directory I'd 
prefer so suppress warns. What do you think @yuja ?

REPOSITORY
  rHG Mercurial

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

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


D1074: branch: add a --rev flag to change branch name of given revisions

2017-11-17 Thread lothiraldan (Boris Feld)
lothiraldan added a comment.


  Looking good, should we allow changing the branch if any changeset is 
unstable or obsolete?

INLINE COMMENTS

> cmdutil.py:723
> +with repo.wlock(), repo.lock(), repo.transaction('branches'):
> +# abort incase in uncommitted merger of dirty wdir
> +bailifchanged(repo)

Small typo, missing space between `in` and `case`

> cmdutil.py:774
> +p2 = replacements[p2][0]
> +
> +mc = context.memctx(repo, (p1, p2),

For safety, I would add a check that p1 and p2 are not obsolete here.

REPOSITORY
  rHG Mercurial

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

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


D1438: revlog: use "partialmatch" on the nodemap object

2017-11-17 Thread quark (Jun Wu)
quark abandoned this revision.
quark added a comment.


  Actually it is hex -> node. So does not really belong to nodemap.

REPOSITORY
  rHG Mercurial

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

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


D1440: docs: add args/returns docs for some cmdutil, context, and registrar functions

2017-11-17 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  I see you used the word `string` at few places, do you mean the Python 
string? If yes, that won't be true on Python 3 as most of the things are bytes.

REPOSITORY
  rHG Mercurial

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

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


Re: [PATCH] hgweb: show commit phase if it's not public

2017-11-17 Thread Anton Shestakov
On Fri, 17 Nov 2017 09:22:56 +0100
Denis Laxalde  wrote:

> Gregory Szorc a écrit :
> > On Thu, Nov 16, 2017 at 7:53 PM, Anton Shestakov  wrote:
> >   
> >> # HG changeset patch
> >> # User Anton Shestakov
> >> # Date 1510842063 -28800
> >> #  Thu Nov 16 22:21:03 2017 +0800
> >> # Node ID f1e997d4a24fb59ddd33c3780104dc002f870f5c
> >> # Parent  5ec3062f234c53970beae8b8d4f20b30cfa9f889
> >> # EXP-Topic hgweb-more-info
> >> hgweb: show commit phase if it's not public
> >>  
> > Queued with delight. It's great to see patches to hgweb!
> > 
> >   
> 
> Agreed.
> Might be worth adding a `.. feature::` release notes block?

I'll just go over these commits and describe them all together in a
couple of phrases. Not sure if I want to even bring attention to the
fact that phases are visible in hgweb only now.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH] hgweb: show obsolescence status of a commit

2017-11-17 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1510906994 -28800
#  Fri Nov 17 16:23:14 2017 +0800
# Node ID 6ff29042647acd6d5f938b0e321afe4ce7df5508
# Parent  f1e997d4a24fb59ddd33c3780104dc002f870f5c
# EXP-Topic hgweb-more-info
hgweb: show obsolescence status of a commit

A new method is added to basefilectx class because filectx and changectx are
used interchangeably in hgweb views related to files (e.g. file view, diff,
annotate).

As with phases, spartan theme shows a simple "obsolete: yes" on its own line
(this allows replacing "yes" with something more useful in future, like output
of obsfate* template functions). In gitweb and monoblue the element has gray
background, in paper and coal the element is gray with a dashed underline.

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -819,6 +819,8 @@ class basefilectx(object):
 return self._changectx.phase()
 def phasestr(self):
 return self._changectx.phasestr()
+def obsolete(self):
+return self._changectx.obsolete()
 def manifest(self):
 return self._changectx.manifest()
 def changectx(self):
diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -361,6 +361,7 @@ def commonentry(repo, ctx):
 'date': ctx.date(),
 'extra': ctx.extra(),
 'phase': ctx.phasestr(),
+'obsolete': ctx.obsolete(),
 'branch': nodebranchnodefault(ctx),
 'inbranch': nodeinbranch(repo, ctx),
 'branches': nodebranchdict(repo, ctx),
diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -263,11 +263,12 @@ filecompchild = '
 shortlog = shortlog.tmpl
 graph = graph.tmpl
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 tagtag = '{name|escape} '
 branchtag = '{name|escape} '
 inbranchtag = '{name|escape} '
 bookmarktag = '{name|escape} '
-alltags = '{phasetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
+alltags = '{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
 shortlogentry = '
   
 {date|rfc822date}
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -222,11 +222,12 @@ filecompchild = '
   {node|short}'
 shortlog = shortlog.tmpl
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 tagtag = '{name|escape} '
 branchtag = '{name|escape} '
 inbranchtag = '{name|escape} '
 bookmarktag = '{name|escape} '
-alltags = '{phasetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
+alltags = '{phasetag}{obsoletetag}{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}{bookmarks%bookmarktag}'
 shortlogentry = '
   
 {date|rfc822date}
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -199,12 +199,13 @@ branchentry = '
 
   '
 phasetag = '{ifeq(phase, 'public', '', '{phase|escape} ')}'
+obsoletetag = '{if(obsolete, 'obsolete ')}'
 changelogtag = '{name|escape} '
 changesettag = '{tag|escape} '
 changesetbookmark = '{bookmark|escape} '
 changelogbranchhead = '{name|escape} '
 changelogbranchname = '{name|escape} '
-alltags = 
'{phasetag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
+alltags = 
'{phasetag}{obsoletetag}{inbranch%changelogbranchname}{branches%changelogbranchhead}{tags%changelogtag}{bookmarks%changelogtag}'
 
 filediffparent = '
   
diff --git a/mercurial/templates/spartan/changelogentry.tmpl 
b/mercurial/templates/spartan/changelogentry.tmpl
--- a/mercurial/templates/spartan/changelogentry.tmpl
+++ b/mercurial/templates/spartan/changelogentry.tmpl
@@ -22,6 +22,10 @@
   phase:
   {phase|escape}
  ')}
+ {if(obsolete, '
+  obsolete:
+  yes
+ ')}
  
   files:
   {files}
diff --git a/mercurial/templates/spartan/changeset.tmpl 
b/mercurial/templates/spartan/changeset.tmpl
--- a/mercurial/templates/spartan/changeset.tmpl
+++ b/mercurial/templates/spartan/changeset.tmpl
@@ -37,6 +37,10 @@
  phase:
  {phase|escape}
 ')}
+{if(obsolete, '
+ obsolete:
+ yes
+')}
 
  files:
  {files}
diff --git a/mercurial/templates/static/style-gitweb.css 
b/mercurial/templates/static/style-gitweb.css
--- a/mercurial/templates/static/style-gitweb.css
+++ b/mercurial/templates/static/style-gitweb.css
@@ -126,6 +126,10 @@ span.logtags span.phasetag {
background-color: #dfafff;
border-color: #e2b8ff #ce48ff #ce48ff #e2b8ff;
 }
+span.logtags span.obsoletetag {
+   background-color: #dd;
+   border-color: #e4e4e4 #a3a3a3 #a3a3a3 #e4e4

D1428: logtoprocess: connect all fds to /dev/null to avoid bad interaction with pager

2017-11-17 Thread lothiraldan (Boris Feld)
lothiraldan updated this revision to Diff 3589.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1428?vs=3530&id=3589

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

AFFECTED FILES
  hgext/logtoprocess.py
  tests/test-logtoprocess.t

CHANGE DETAILS

diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
--- a/tests/test-logtoprocess.t
+++ b/tests/test-logtoprocess.t
@@ -122,4 +122,4 @@
   $ touch $TESTTMP/wait-for-touched
   $ sleep 0.2
   $ test -f $TESTTMP/touched && echo "SUCCESS Pager is waiting on ltp" || echo 
"FAIL Pager is waiting on ltp"
-  FAIL Pager is waiting on ltp
+  SUCCESS Pager is waiting on ltp
diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -79,11 +79,16 @@
 else:
 newsession = {'start_new_session': True}
 try:
-# connect stdin to devnull to make sure the subprocess can't
-# muck up that stream for mercurial.
+# connect std* to devnull to make sure the subprocess can't
+# muck up these stream for mercurial.
+# Connect all the streams to be more close to Windows behavior
+# and pager will wait for scripts to end if we don't do that
+nullrfd = open(os.devnull, 'r')
+nullwfd = open(os.devnull, 'w')
 subprocess.Popen(
-script, shell=shell, stdin=open(os.devnull, 'r'), env=env,
-close_fds=True, **newsession)
+script, shell=shell, stdin=nullrfd,
+stdout=nullwfd, stderr=nullwfd,
+env=env, close_fds=True, **newsession)
 finally:
 # mission accomplished, this child needs to exit and not
 # continue the hg process here.



To: lothiraldan, #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] hgweb: show commit phase if it's not public

2017-11-17 Thread Denis Laxalde

Gregory Szorc a écrit :

On Thu, Nov 16, 2017 at 7:53 PM, Anton Shestakov  wrote:


# HG changeset patch
# User Anton Shestakov
# Date 1510842063 -28800
#  Thu Nov 16 22:21:03 2017 +0800
# Node ID f1e997d4a24fb59ddd33c3780104dc002f870f5c
# Parent  5ec3062f234c53970beae8b8d4f20b30cfa9f889
# EXP-Topic hgweb-more-info
hgweb: show commit phase if it's not public


Queued with delight. It's great to see patches to hgweb!




Agreed.
Might be worth adding a `.. feature::` release notes block?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D1428: logtoprocess: connect all fds to /dev/null to avoid bad interaction with pager

2017-11-17 Thread lothiraldan (Boris Feld)
lothiraldan added inline comments.

INLINE COMMENTS

> yuja wrote in logtoprocess.py:89
> stdout and stderr should be writable. We can simply pass a file
> descriptor open with O_RDWR.
> 
>   nullfd = os.open(os.devnull, os.O_RDWR)
>   Popen(stdin=nullfd, stdout=nullfd, stderr=nullfd)
> 
> and `os.close(nullfd)` though it doesn't mater since the process
> is terminated with `_exit()`.

Thx for the catch, I will make the change.

REPOSITORY
  rHG Mercurial

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

To: lothiraldan, #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